feat(usage): pin the TokenTracker CLI invocations

This commit is contained in:
mika kuns
2026-08-24 13:36:59 +02:00
parent 580d4e0717
commit d6b22ea528
2 changed files with 73 additions and 0 deletions
@@ -0,0 +1,31 @@
using System.Globalization;
namespace ClaudeDo.Worker.Usage.TokenTracker;
/// <summary>
/// The exact CLI invocations we rely on. <c>--no-git</c> matters: without it TokenTracker runs
/// <c>git log</c> inside every session's working directory, which is both slower and touches
/// repositories we have no business touching. We never invoke <c>init</c> — that would write
/// hooks into the user's global <c>~/.claude/settings.json</c> and switch on cloud sync.
/// The date range is passed for correctness, not economy: v0.88.4 accepts it but returns the
/// full history regardless, so <see cref="TokenTrackerAggregator"/> does the real filtering.
/// </summary>
public static class TokenTrackerArgs
{
public const string Command = "tokentracker";
public const string NpmCommand = "npm";
public const string PackageName = "tokentracker-cli";
public static string[] Export(DateOnly from, DateOnly to) =>
[
"sessions",
"--from", from.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture),
"--to", to.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture),
"--no-git",
"--format", "json",
];
public static string[] Version() => ["-v"];
public static string[] Install() => ["i", "-g", PackageName];
}