@trazum/cli 3.0.1 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/README.md +4 -1
  2. package/assets/trazum-statusline.sh +45 -0
  3. package/dist/base-cost.d.ts +173 -0
  4. package/dist/base-cost.d.ts.map +1 -0
  5. package/dist/base-cost.js +244 -0
  6. package/dist/base-cost.js.map +1 -0
  7. package/dist/bill-range.d.ts +118 -0
  8. package/dist/bill-range.d.ts.map +1 -0
  9. package/dist/bill-range.js +122 -0
  10. package/dist/bill-range.js.map +1 -0
  11. package/dist/command-help.d.ts +17 -0
  12. package/dist/command-help.d.ts.map +1 -0
  13. package/dist/command-help.js +69 -0
  14. package/dist/command-help.js.map +1 -0
  15. package/dist/filter.d.ts +7 -1
  16. package/dist/filter.d.ts.map +1 -1
  17. package/dist/filter.js +10 -18
  18. package/dist/filter.js.map +1 -1
  19. package/dist/gateway-metrics.d.ts +83 -0
  20. package/dist/gateway-metrics.d.ts.map +1 -0
  21. package/dist/gateway-metrics.js +181 -0
  22. package/dist/gateway-metrics.js.map +1 -0
  23. package/dist/gateway-server.d.ts +23 -5
  24. package/dist/gateway-server.d.ts.map +1 -1
  25. package/dist/gateway-server.js +26 -1
  26. package/dist/gateway-server.js.map +1 -1
  27. package/dist/gateway-spend.d.ts +11 -1
  28. package/dist/gateway-spend.d.ts.map +1 -1
  29. package/dist/gateway-spend.js +44 -32
  30. package/dist/gateway-spend.js.map +1 -1
  31. package/dist/git.d.ts +70 -0
  32. package/dist/git.d.ts.map +1 -1
  33. package/dist/git.js +145 -0
  34. package/dist/git.js.map +1 -1
  35. package/dist/i18n/en.d.ts.map +1 -1
  36. package/dist/i18n/en.js +358 -6
  37. package/dist/i18n/en.js.map +1 -1
  38. package/dist/i18n/es.d.ts +0 -1
  39. package/dist/i18n/es.d.ts.map +1 -1
  40. package/dist/i18n/es.js +456 -35
  41. package/dist/i18n/es.js.map +1 -1
  42. package/dist/i18n/types.d.ts +205 -0
  43. package/dist/i18n/types.d.ts.map +1 -1
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +942 -59
  46. package/dist/index.js.map +1 -1
  47. package/dist/loopback-guard.d.ts +37 -0
  48. package/dist/loopback-guard.d.ts.map +1 -0
  49. package/dist/loopback-guard.js +65 -0
  50. package/dist/loopback-guard.js.map +1 -0
  51. package/dist/markdown.d.ts +23 -0
  52. package/dist/markdown.d.ts.map +1 -1
  53. package/dist/markdown.js +105 -0
  54. package/dist/markdown.js.map +1 -1
  55. package/dist/plan-edits.d.ts +63 -0
  56. package/dist/plan-edits.d.ts.map +1 -0
  57. package/dist/plan-edits.js +96 -0
  58. package/dist/plan-edits.js.map +1 -0
  59. package/dist/proactive.d.ts +17 -2
  60. package/dist/proactive.d.ts.map +1 -1
  61. package/dist/proactive.js +16 -9
  62. package/dist/proactive.js.map +1 -1
  63. package/dist/receipt-send.d.ts +44 -0
  64. package/dist/receipt-send.d.ts.map +1 -0
  65. package/dist/receipt-send.js +71 -0
  66. package/dist/receipt-send.js.map +1 -0
  67. package/dist/serve.d.ts +7 -0
  68. package/dist/serve.d.ts.map +1 -1
  69. package/dist/serve.js +22 -1
  70. package/dist/serve.js.map +1 -1
  71. package/dist/session-guard.d.ts +210 -0
  72. package/dist/session-guard.d.ts.map +1 -0
  73. package/dist/session-guard.js +463 -0
  74. package/dist/session-guard.js.map +1 -0
  75. package/dist/task.d.ts +7 -1
  76. package/dist/task.d.ts.map +1 -1
  77. package/dist/task.js +7 -26
  78. package/dist/task.js.map +1 -1
  79. package/dist/waste.d.ts +25 -0
  80. package/dist/waste.d.ts.map +1 -0
  81. package/dist/waste.js +39 -0
  82. package/dist/waste.js.map +1 -0
  83. package/dist/zone.d.ts +27 -0
  84. package/dist/zone.d.ts.map +1 -0
  85. package/dist/zone.js +96 -0
  86. package/dist/zone.js.map +1 -0
  87. package/package.json +2 -2
  88. package/src/base-cost.ts +384 -0
  89. package/src/bill-range.ts +206 -0
  90. package/src/command-help.ts +65 -0
  91. package/src/filter.ts +11 -18
  92. package/src/gateway-metrics.ts +209 -0
  93. package/src/gateway-server.ts +43 -6
  94. package/src/gateway-spend.ts +45 -33
  95. package/src/git.ts +158 -0
  96. package/src/i18n/en.ts +424 -6
  97. package/src/i18n/es.ts +542 -35
  98. package/src/i18n/types.ts +208 -0
  99. package/src/index.ts +952 -58
  100. package/src/loopback-guard.ts +74 -0
  101. package/src/markdown.ts +117 -0
  102. package/src/plan-edits.ts +120 -0
  103. package/src/proactive.ts +22 -13
  104. package/src/receipt-send.ts +89 -0
  105. package/src/serve.ts +23 -1
  106. package/src/session-guard.ts +541 -0
  107. package/src/task.ts +8 -26
  108. package/src/waste.ts +42 -0
  109. package/src/zone.ts +95 -0
package/src/i18n/types.ts CHANGED
@@ -96,6 +96,20 @@ export interface CliMessages {
96
96
  numberLocale: string;
97
97
 
98
98
  help(defaults: HelpDefaults, bold: (s: string) => string): string;
99
+ /** Closes `trazum <command> --help`, which shows one command's part of the help: where the rest is. */
100
+ commandHelpMore: string;
101
+
102
+ /**
103
+ * `trazum task` and `trazum filter`, which parse their own arguments. They
104
+ * were dispatched before the language was read, so `--locale` broke them and
105
+ * `LANG` did nothing (#871). Their messages, and those of the core's task
106
+ * analysis, are raised in English; `say` gives one in this language.
107
+ */
108
+ taskFilter: {
109
+ taskHelp: (maxChars: number) => string;
110
+ filterHelp: string;
111
+ say: (message: string) => string;
112
+ };
99
113
 
100
114
  /**
101
115
  * The interview behind `trazum write`, one entry per slot in
@@ -561,6 +575,8 @@ export interface CliMessages {
561
575
  listening(where: string, provider: string): string;
562
576
  unmeasured(cause: 'stream-broke' | 'no-usage-event' | 'no-usage-in-body', sofar: number): string;
563
577
  pointYourSdk(where: string): string;
578
+ metrics(where: string): string;
579
+ badMetricsPort(given: string): string;
564
580
  credential(): string;
565
581
  neverSubstitutes(): string;
566
582
  standing(consumed: string, limit: string): string;
@@ -662,6 +678,22 @@ export interface CliMessages {
662
678
  quality(routeCommand: string): string;
663
679
  };
664
680
 
681
+ /** `model-pricing` — Claude Code's `modelPricing` managed setting as a pricing overlay (#856). */
682
+ modelPricing: {
683
+ noFile(): string;
684
+ noReviewed(): string;
685
+ notFound(file: string): string;
686
+ tooLarge(file: string, bytes: number): string;
687
+ notJson(file: string, detail: string): string;
688
+ skipped(key: string, reason: 'invalid' | 'zero' | 'unknown-model' | 'duplicate', detail?: string): string;
689
+ empty(): string;
690
+ summary(fromRows: number, fromMultiplier: number, multiplier?: number): string;
691
+ batch(models: number): string;
692
+ fastKept(models: string): string;
693
+ usOnly(models: string): string;
694
+ written(file: string, models: number): string;
695
+ };
696
+
665
697
  ownrate: {
666
698
  missing(): string;
667
699
  invalid(flag: string): string;
@@ -859,6 +891,22 @@ export interface CliMessages {
859
891
  periodsUndated(calls: number, usd: string, unit: 'day' | 'week' | 'month'): string;
860
892
  periodHint(since: string, until: string, unit: 'day' | 'week' | 'month'): string;
861
893
  badBy(value: string): string;
894
+ /** `--agent` named an agent `bill` does not know: refused by name, with the ones it does. */
895
+ badAgent(value: string, known: string): string;
896
+ /** `--agent` named a known agent whose records were not among what was read. */
897
+ agentNoRecords(name: string, known: string): string;
898
+ /** What `--agent` kept, and how many records of other agents or sources were left out. */
899
+ agentOnly(name: string, kept: number, leftOut: number): string;
900
+ /** `--timezone` named a zone the platform does not know: refused by name. */
901
+ badTimezone(value: string): string;
902
+ /** `--timezone` cannot be combined with an output that cuts its days in UTC. */
903
+ timezoneConflict(flag: string): string;
904
+ /** The statement's own note: which calendar the days are on. */
905
+ zoneLine(zone: string): string;
906
+ /** The sentence that names the zone beside a `--since`/`--until` hint. */
907
+ periodHintZone(zone: string): string;
908
+ /** On a receipt there is no day to cut: what `--timezone` did decide. */
909
+ zoneReceiptNote(zone: string): string;
862
910
  colCalls(): string;
863
911
  colShare(): string;
864
912
  moreRows(count: number): string;
@@ -886,13 +934,54 @@ export interface CliMessages {
886
934
  sources(read: number, seen: number): string;
887
935
  /** An unpriced slug with a slash is OpenRouter's, and --pricing-live prices it. */
888
936
  pricingLiveHint(count: number): string;
937
+ /** `--send` without `--receipt`: refused, naming both. */
938
+ sendNeedsReceipt(): string;
939
+ /** The URL or the key `--send` would use is one the receipt will not be sent with. Names the variable, never its value. */
940
+ badSendTarget(reason: 'invalid-url' | 'credentials-in-url' | 'insecure-scheme' | 'bad-key', keyVariable: string): string;
941
+ /** The endpoint answered 2xx. `where` is the host only: a path or query can carry a secret. */
942
+ sendDelivered(where: string, status: string): string;
943
+ /** The receipt is written here and was not delivered; `status` is null when no answer arrived. */
944
+ sendFailed(where: string, status: string | null): string;
889
945
  /** Prefixed ids whose part after the slash the catalogue prices under its own name. */
890
946
  prefixedKnown(ids: string): string;
947
+ /** Unpriced ids that are Claude models as Bedrock or Vertex names them (#858). */
948
+ partnerUnpriced(ids: string): string;
949
+ partnerModel(platform: 'bedrock' | 'vertex', model: string | undefined): string;
891
950
  /** Claude Code transcripts are priced at API list rates; on a plan, that is not what was paid. */
892
951
  apiEquivalent(): string;
893
952
  /** A --since/--until window no record falls in: refused, never a $0 bill. */
894
953
  windowMatchesNothing(from: string, to: string): string;
895
954
  written(file: string): string;
955
+ /** --git-range cannot be combined with a flag that sets the period, the project or an output. */
956
+ rangeConflict(flag: string): string;
957
+ /** git could not be run, or the directory is not inside a repository. */
958
+ rangeNoGit(): string;
959
+ rangeNoRepository(): string;
960
+ /** git did not know the range. */
961
+ rangeBad(range: string): string;
962
+ /** The range holds no commit, so it has no span. */
963
+ rangeEmpty(range: string): string;
964
+ rangeHeading(range: string): string;
965
+ rangeWindow(from: string, to: string, commits: number): string;
966
+ rangeInside(usd: string, calls: number, sessions: number): string;
967
+ rangeNothingInside(): string;
968
+ rangeStraddleHeading(count: number): string;
969
+ rangeStraddleRow(session: string, from: string, to: string, insideUsd: string, insideCalls: number, outsideUsd: string, outsideCalls: number): string;
970
+ rangeNoStraddle(): string;
971
+ /** What the figure is, and that it is not the cost of the change. */
972
+ rangeMeaning(): string;
973
+ rangeLeftOut(outsideCalls: number, otherProjects: number, otherSources: number, undated: number): string;
974
+ rangeUnpriced(calls: number): string;
975
+ /** --delivery without --git-range. */
976
+ deliveryNeedsRange(): string;
977
+ /** What git shows landed in the range: counts only (#825). */
978
+ rangeDelivered(commits: number, merges: number, pullRequests: number, days: number): string;
979
+ /** The figure divided by each count; null where the count is zero. */
980
+ rangeDividedBy(perCommit: string | null, perPullRequest: string | null, perDay: string | null): string;
981
+ /** No session inside the span, so nothing to divide. */
982
+ rangeDividedNothing(): string;
983
+ /** No record of any session read belongs to this repository's project folder. */
984
+ rangeNoProject(): string;
896
985
  };
897
986
 
898
987
  fromOpenrouter: {
@@ -1344,6 +1433,43 @@ export interface CliMessages {
1344
1433
  filesFromNoBaseline(): string;
1345
1434
  };
1346
1435
 
1436
+ /**
1437
+ * `check --base` (#785): each changed prompt's cost on the base branch and
1438
+ * on the head. One section for the terminal and the Markdown report, so
1439
+ * the two say the same thing about the same figures.
1440
+ */
1441
+ againstBase: {
1442
+ /** `ref` as given, `sha` its short commit. */
1443
+ heading(ref: string, sha: string): string;
1444
+ columnTokens(): string;
1445
+ columnCalls(): string;
1446
+ columnBase(): string;
1447
+ columnHead(): string;
1448
+ columnPrice(): string;
1449
+ notStated(): string;
1450
+ perMonth(usd: string): string;
1451
+ perCall(usd: string): string;
1452
+ /** Every figure's price, and who said so on which day. */
1453
+ price(perMTok: string, model: string, provider: string, readOn: string): string;
1454
+ priceOverlay(perMTok: string, model: string, readOn: string): string;
1455
+ promo(until: string): string;
1456
+ totals(base: string, head: string, change: string): string;
1457
+ perCallNote(count: number): string;
1458
+ inputOnly(): string;
1459
+ modelDefault(model: string): string;
1460
+ unchanged(count: number): string;
1461
+ nothingChanged(): string;
1462
+ gateWithin(change: string, limit: string): string;
1463
+ gateBreached(change: string, limit: string): string;
1464
+ gateNotJudged(count: number): string;
1465
+ unavailable(why: 'no-git' | 'not-a-repository' | 'no-commit', ref: string): string;
1466
+ gateUnavailable(limit: string): string;
1467
+ /** `--max-monthly-increase-usd` compares with a base, so it needs one. */
1468
+ gateNeedsBase(): string;
1469
+ /** Standard input has no base side to read. */
1470
+ noStdin(): string;
1471
+ };
1472
+
1347
1473
  /**
1348
1474
  * The cost baseline: recording one, and reporting drift from it.
1349
1475
  *
@@ -2067,6 +2193,18 @@ export interface CliMessages {
2067
2193
  footer(): string;
2068
2194
  /** The plan saved as dated JSON — what 1.39's verify will hold it to. */
2069
2195
  wrote(path: string): string;
2196
+ /** `--edits` with no `labels` in the configuration: there is no file to read. */
2197
+ editsNeedLabels(): string;
2198
+ /** `--reorder` without `--edits`: it is a step of an edit, not a plan of its own. */
2199
+ reorderNeedsEdits(): string;
2200
+ /** An edit's measured figure: the workload's bill as the log measured it. */
2201
+ editMeasured(usd: string, calls: string, inputPerCall: string): string;
2202
+ /** What the edit does to which file, with the estimator's tokens labelled as estimated. */
2203
+ editChange(path: string, reordered: boolean, tokensBefore: string, tokensAfter: string): string;
2204
+ /** How verify checks an edit. */
2205
+ editCheck(): string;
2206
+ /** A label the configuration maps to a file that produced no edit, and why. */
2207
+ editSkipped(why: 'no-traffic' | 'unreadable' | 'not-tracked' | 'source-file' | 'unchanged', label: string, path: string): string;
2070
2208
  };
2071
2209
 
2072
2210
  /**
@@ -2287,6 +2425,10 @@ export interface CliMessages {
2287
2425
  batchUnobservable(): string;
2288
2426
  truncationObserved(retryBillUsd: string): string;
2289
2427
  cacheObserved(deltaUsd: string, outcome: VerifyOutcome): string;
2428
+ /** An edit landed: the workload's input per call, before and after, measured. */
2429
+ editObserved(before: string, after: string): string;
2430
+ /** An edit did not land: the file still holds the text the plan was made from. */
2431
+ editNotMade(path: string): string;
2290
2432
  /** The world's movement, measured: never a verdict, always both numbers. */
2291
2433
  attribution(callsBefore: string, callsAfter: string, outBefore: string, outAfter: string): string;
2292
2434
  gateFailed(failures: string, total: string): string;
@@ -2424,5 +2566,71 @@ export interface CliMessages {
2424
2566
  backupNote(suffix: string): string;
2425
2567
  crontab(): string;
2426
2568
  };
2569
+ /** `trazum session-guard`: the Claude Code hook that warns and then stops at a dollar figure. */
2570
+ sessionGuard: {
2571
+ unknownAction(given: string): string;
2572
+ /** The flags that were not given, by name: there is no default for any of them. */
2573
+ refusedMissing(flags: string): string;
2574
+ refusedAmount(flag: string, given: string): string;
2575
+ refusedPolicy(given: string, allowed: string): string;
2576
+ refusedWarnNotBelowStop(): string;
2577
+ refusedFlag(flag: string): string;
2578
+ /** What the hook says to the person; every figure is API-equivalent cost, never what was paid. */
2579
+ warn(usd: string, warnUsd: string, stopUsd: string, atLeast: boolean): string;
2580
+ block(usd: string, stopUsd: string, atLeast: boolean): string;
2581
+ cannotTellOpen(why: string): string;
2582
+ cannotTellClosed(why: string): string;
2583
+ cause: Record<'no-transcript' | 'unreadable' | 'unparseable' | 'skipped', () => string>;
2584
+ unpriced(models: string): string;
2585
+ /** The settings file's shape, when it cannot be edited. */
2586
+ settingsShape(file: string, key: string): string;
2587
+ wouldInstall(): string;
2588
+ wouldUninstall(): string;
2589
+ askInstall(file: string): string;
2590
+ askUninstall(file: string): string;
2591
+ didInstall(file: string): string;
2592
+ didUninstall(file: string): string;
2593
+ declined(): string;
2594
+ nothingToUninstall(): string;
2595
+ alreadyInstalled(file: string): string;
2596
+ dryRun(): string;
2597
+ dryRunNoTerminal(): string;
2598
+ failed(reason: string): string;
2599
+ statusOn(file: string, warnUsd: string, stopUsd: string, policy: string): string;
2600
+ statusOff(file: string): string;
2601
+ statusPartial(file: string): string;
2602
+ apiEquivalent(): string;
2603
+ windows(): string;
2604
+ noClaude(dir: string): string;
2605
+ };
2606
+ /** `trazum waste`: findings on a coding-agent session, priced from its own counts. */
2607
+ waste: {
2608
+ refusedFlag(flag: string): string;
2609
+ noPath(): string;
2610
+ notFound(path: string): string;
2611
+ unreadable(path: string): string;
2612
+ minReadsBad(given: string): string;
2613
+ cannotTell(): string;
2614
+ heading(calls: number, threads: number): string;
2615
+ apiEquivalent(reviewed: string): string;
2616
+ unpriced(models: string): string;
2617
+ readsHeading(): string;
2618
+ readsNone(minReads: number): string;
2619
+ /** One path: reads, repeats, repeats measured, the prompt growth they caused, and the cost (null: nothing measured). */
2620
+ readLine(reads: number, repeats: number, measured: number, tokens: number, usd: string | null): string;
2621
+ readsOmitted(count: number): string;
2622
+ readsTotal(usd: string, measured: number, repeats: number): string;
2623
+ readsUnmeasured(repeats: number): string;
2624
+ mcpHeading(): string;
2625
+ mcpNoList(): string;
2626
+ mcpAllCalled(loaded: number): string;
2627
+ mcpSummary(loaded: number, called: number, source: 'transcript' | 'flag'): string;
2628
+ mcpUnused(server: string, tools: number | null): string;
2629
+ mcpNotPriced(): string;
2630
+ claudeHeading(): string;
2631
+ claudeNone(path: string): string;
2632
+ claudeLine(bytes: number, tokens: number, calls: number, usd: string, low: string, high: string, bandPct: number): string;
2633
+ nothingChanged(): string;
2634
+ };
2427
2635
 
2428
2636
  }