jinzd-ai-cli 0.4.182 → 0.4.184

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.
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  executeTests,
4
4
  runTestsTool
5
- } from "./chunk-QUYLXQRU.js";
6
- import "./chunk-ISO5KVEJ.js";
5
+ } from "./chunk-NVCB6SFZ.js";
6
+ import "./chunk-2DVGTYZG.js";
7
7
  import "./chunk-PDX44BCA.js";
8
8
  export {
9
9
  executeTests,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  executeTests,
3
3
  runTestsTool
4
- } from "./chunk-RUUJHLEV.js";
4
+ } from "./chunk-HNSN575P.js";
5
5
  import "./chunk-3RG5ZIWI.js";
6
6
  export {
7
7
  executeTests,
@@ -16,12 +16,10 @@ import {
16
16
  McpManager,
17
17
  SkillManager,
18
18
  autoTrimSessionIfNeeded,
19
- computeCost,
20
- formatCost,
21
19
  loadDevState,
22
20
  persistToolRound,
23
21
  setupProxy
24
- } from "./chunk-C6UJBTZO.js";
22
+ } from "./chunk-QLHGIWTT.js";
25
23
  import {
26
24
  ToolExecutor,
27
25
  ToolRegistry,
@@ -39,14 +37,18 @@ import {
39
37
  spawnAgentContext,
40
38
  truncateOutput,
41
39
  undoStack
42
- } from "./chunk-XI7EUUL7.js";
40
+ } from "./chunk-4JWMT7XQ.js";
43
41
  import "./chunk-HDSKW7Q3.js";
44
42
  import "./chunk-ZWVIDFGY.js";
45
- import "./chunk-QUYLXQRU.js";
43
+ import "./chunk-NVCB6SFZ.js";
46
44
  import {
47
45
  SessionManager,
48
46
  getContentText
49
47
  } from "./chunk-RIVZNS3K.js";
48
+ import {
49
+ computeCost,
50
+ formatCost
51
+ } from "./chunk-BLRPRWZX.js";
50
52
  import {
51
53
  BudgetWarner,
52
54
  CONTENT_ONLY_STREAM_REMINDER,
@@ -74,13 +76,13 @@ import {
74
76
  } from "./chunk-5LK7H45B.js";
75
77
  import {
76
78
  runTool
77
- } from "./chunk-LWZ6P73G.js";
79
+ } from "./chunk-PS6S4IIW.js";
78
80
  import {
79
81
  getDangerLevel
80
82
  } from "./chunk-HIU2SH4V.js";
81
83
  import {
82
84
  ConfigManager
83
- } from "./chunk-YDIR3MXD.js";
85
+ } from "./chunk-WLMBMRIA.js";
84
86
  import "./chunk-TZQHYZKT.js";
85
87
  import {
86
88
  AGENTIC_BEHAVIOR_GUIDELINE,
@@ -100,7 +102,7 @@ import {
100
102
  SKILLS_DIR_NAME,
101
103
  VERSION,
102
104
  buildUserIdentityPrompt
103
- } from "./chunk-ISO5KVEJ.js";
105
+ } from "./chunk-2DVGTYZG.js";
104
106
  import {
105
107
  formatGitContextForPrompt,
106
108
  getGitContext,
@@ -2487,7 +2489,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
2487
2489
  case "test": {
2488
2490
  this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
2489
2491
  try {
2490
- const { executeTests } = await import("./run-tests-GFOHEIWM.js");
2492
+ const { executeTests } = await import("./run-tests-JHICSWKH.js");
2491
2493
  const argStr = args.join(" ").trim();
2492
2494
  let testArgs = {};
2493
2495
  if (argStr) {
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ToolRegistry
4
- } from "./chunk-XI7EUUL7.js";
4
+ } from "./chunk-4JWMT7XQ.js";
5
5
  import "./chunk-HDSKW7Q3.js";
6
6
  import "./chunk-ZWVIDFGY.js";
7
- import "./chunk-QUYLXQRU.js";
7
+ import "./chunk-NVCB6SFZ.js";
8
8
  import {
9
9
  runTool
10
- } from "./chunk-LWZ6P73G.js";
10
+ } from "./chunk-PS6S4IIW.js";
11
11
  import {
12
12
  getDangerLevel,
13
13
  schemaToJsonSchema
@@ -15,7 +15,7 @@ import {
15
15
  import "./chunk-TZQHYZKT.js";
16
16
  import {
17
17
  VERSION
18
- } from "./chunk-ISO5KVEJ.js";
18
+ } from "./chunk-2DVGTYZG.js";
19
19
  import "./chunk-4BKXL7SM.js";
20
20
  import "./chunk-MM3F43H6.js";
21
21
  import "./chunk-KHYD3WXE.js";
@@ -3,20 +3,20 @@ import {
3
3
  ToolRegistry,
4
4
  googleSearchContext,
5
5
  truncateOutput
6
- } from "./chunk-XI7EUUL7.js";
6
+ } from "./chunk-4JWMT7XQ.js";
7
7
  import "./chunk-HDSKW7Q3.js";
8
8
  import "./chunk-ZWVIDFGY.js";
9
- import "./chunk-QUYLXQRU.js";
9
+ import "./chunk-NVCB6SFZ.js";
10
10
  import {
11
11
  runTool
12
- } from "./chunk-LWZ6P73G.js";
12
+ } from "./chunk-PS6S4IIW.js";
13
13
  import {
14
14
  getDangerLevel
15
15
  } from "./chunk-HIU2SH4V.js";
16
16
  import "./chunk-TZQHYZKT.js";
17
17
  import {
18
18
  SUBAGENT_ALLOWED_TOOLS
19
- } from "./chunk-ISO5KVEJ.js";
19
+ } from "./chunk-2DVGTYZG.js";
20
20
  import "./chunk-4BKXL7SM.js";
21
21
  import "./chunk-MM3F43H6.js";
22
22
  import "./chunk-KHYD3WXE.js";
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ CostTracker
4
+ } from "./chunk-7D67AR56.js";
5
+ import {
6
+ formatCost
7
+ } from "./chunk-BLRPRWZX.js";
8
+ import {
9
+ ConfigManager
10
+ } from "./chunk-WLMBMRIA.js";
11
+ import "./chunk-TZQHYZKT.js";
12
+ import "./chunk-2DVGTYZG.js";
13
+ import "./chunk-PDX44BCA.js";
14
+
15
+ // src/cli/usage.ts
16
+ function num(n) {
17
+ return n.toLocaleString("en-US");
18
+ }
19
+ async function runUsageCli(options = {}) {
20
+ const chalk = (await import("chalk")).default;
21
+ const config = new ConfigManager();
22
+ const tracker = new CostTracker(config.getConfigDir());
23
+ const sinceDays = options.days ? Math.max(1, parseInt(options.days, 10) || 0) : void 0;
24
+ const month = options.month?.trim();
25
+ if (month && !/^\d{4}-\d{2}$/.test(month)) {
26
+ console.error(`Invalid --month "${month}". Expected YYYY-MM (e.g. 2026-06).`);
27
+ process.exit(1);
28
+ }
29
+ const breakdown = tracker.getUsageBreakdown({ sinceDays, month });
30
+ if (options.json) {
31
+ console.log(JSON.stringify(breakdown, null, 2));
32
+ return;
33
+ }
34
+ const { rows, totals, fromDate, toDate, dayCount } = breakdown;
35
+ let window;
36
+ if (month) window = month;
37
+ else if (sinceDays) window = `last ${sinceDays} day${sinceDays === 1 ? "" : "s"}`;
38
+ else window = "all tracked history";
39
+ console.log();
40
+ console.log(chalk.bold(" \u{1F4B0} Usage by model") + chalk.dim(` \u2014 ${window}`));
41
+ if (fromDate && toDate) {
42
+ const span = fromDate === toDate ? fromDate : `${fromDate} \u2192 ${toDate}`;
43
+ console.log(chalk.dim(` ${span} (${dayCount} day${dayCount === 1 ? "" : "s"} with activity)`));
44
+ }
45
+ console.log();
46
+ if (rows.length === 0) {
47
+ console.log(chalk.dim(" No usage recorded yet."));
48
+ if (sinceDays || month) console.log(chalk.dim(" Try a wider window, or `aicli usage` for all history."));
49
+ console.log(chalk.dim(" (cost history accrues as you chat in the REPL / Web UI; up to 90 days.)"));
50
+ console.log();
51
+ return;
52
+ }
53
+ const nameW = Math.min(42, Math.max(20, ...rows.map((r) => label(r).length)));
54
+ const rule = " " + chalk.dim("\u2500".repeat(nameW + 7 + 14 + 14 + 13));
55
+ console.log(
56
+ " " + chalk.bold("Provider / Model".padEnd(nameW)) + chalk.bold("Calls".padStart(7)) + chalk.bold("Input".padStart(14)) + chalk.bold("Output".padStart(14)) + chalk.bold("Cost".padStart(13))
57
+ );
58
+ console.log(rule);
59
+ for (const r of rows) {
60
+ const isFree = r.cost === 0;
61
+ const namePad = r.provider === "(unattributed)" ? chalk.dim("(unattributed, pre-v0.4.184)".padEnd(nameW)) : chalk.cyan(label(r).padEnd(nameW));
62
+ console.log(
63
+ " " + namePad + chalk.white(num(r.calls).padStart(7)) + chalk.white(num(r.inputTokens).padStart(14)) + chalk.white(num(r.outputTokens).padStart(14)) + (isFree ? chalk.dim("$0.00".padStart(13)) : chalk.cyan(formatCost(r.cost).padStart(13)))
64
+ );
65
+ }
66
+ console.log(rule);
67
+ console.log(
68
+ " " + chalk.bold("Total".padEnd(nameW)) + chalk.bold(num(totals.calls).padStart(7)) + chalk.bold(num(totals.inputTokens).padStart(14)) + chalk.bold(num(totals.outputTokens).padStart(14)) + chalk.bold.cyan(formatCost(totals.cost).padStart(13))
69
+ );
70
+ if (totals.cacheReadTokens > 0) {
71
+ console.log(chalk.dim(` (incl. ${num(totals.cacheReadTokens)} cached-read tokens billed at the cache rate)`));
72
+ }
73
+ console.log();
74
+ }
75
+ function label(r) {
76
+ return r.model ? `${r.provider}/${r.model}` : r.provider;
77
+ }
78
+ export {
79
+ runUsageCli
80
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jinzd-ai-cli",
3
- "version": "0.4.182",
3
+ "version": "0.4.184",
4
4
  "description": "Cross-platform REPL-style AI CLI with multi-provider support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",