ccusage 16.2.5 → 17.0.1
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.
- package/README.md +20 -25
- package/config-schema.json +0 -33
- package/dist/_types-CV6z8-9_.js +583 -0
- package/dist/{calculate-cost-BDqO4yWA.js → calculate-cost-CX9KwEZt.js} +1 -1
- package/dist/calculate-cost.d.ts +1 -4
- package/dist/calculate-cost.js +2 -3
- package/dist/data-loader-ClkEoCfz.js +3733 -0
- package/dist/data-loader-D_hlygEz.d.ts +2307 -0
- package/dist/data-loader.d.ts +1 -2
- package/dist/data-loader.js +3 -5
- package/dist/debug-BQXAD_hV.js +148 -0
- package/dist/debug.d.ts +8 -0
- package/dist/debug.js +4 -6
- package/dist/index.d.ts +0 -0
- package/dist/index.js +2841 -2066
- package/dist/{logger-wHijzbnK.js → logger-C_yajNg2.js} +179 -74
- package/dist/logger.d.ts +11 -7
- package/dist/logger.js +1 -1
- package/dist/{prompt-DsUFNEY7.js → prompt-BeRmYuGP.js} +49 -28
- package/package.json +4 -4
- package/dist/_token-utils-WjkbrjKv.js +0 -5
- package/dist/_types-DIdtMJ6V.js +0 -3076
- package/dist/data-loader-D1FVB4Lp.d.ts +0 -785
- package/dist/data-loader-abvRdQYo.js +0 -2681
- package/dist/debug-CkCfHFil.js +0 -109
- package/dist/mcp-Dz21qUWi.js +0 -6832
- package/dist/mcp.d.ts +0 -35
- package/dist/mcp.js +0 -8
- package/dist/pricing-fetcher-BtUY4dRM.js +0 -402
- package/dist/pricing-fetcher-DK8lcI1w.d.ts +0 -219
- package/dist/pricing-fetcher.d.ts +0 -2
- package/dist/pricing-fetcher.js +0 -4
|
@@ -4,13 +4,18 @@ import f from "node:readline";
|
|
|
4
4
|
function getDefaultExportFromCjs(x$1) {
|
|
5
5
|
return x$1 && x$1.__esModule && Object.prototype.hasOwnProperty.call(x$1, "default") ? x$1["default"] : x$1;
|
|
6
6
|
}
|
|
7
|
-
var src
|
|
7
|
+
var src;
|
|
8
|
+
var hasRequiredSrc;
|
|
8
9
|
function requireSrc() {
|
|
9
10
|
if (hasRequiredSrc) return src;
|
|
10
11
|
hasRequiredSrc = 1;
|
|
11
|
-
const ESC = "\x1B"
|
|
12
|
+
const ESC = "\x1B";
|
|
13
|
+
const CSI = `${ESC}[`;
|
|
14
|
+
const beep = "\x07";
|
|
15
|
+
const cursor = {
|
|
12
16
|
to(x$1, y$1) {
|
|
13
|
-
|
|
17
|
+
if (!y$1) return `${CSI}${x$1 + 1}G`;
|
|
18
|
+
return `${CSI}${y$1 + 1};${x$1 + 1}H`;
|
|
14
19
|
},
|
|
15
20
|
move(x$1, y$1) {
|
|
16
21
|
let ret = "";
|
|
@@ -31,10 +36,12 @@ function requireSrc() {
|
|
|
31
36
|
show: `${CSI}?25h`,
|
|
32
37
|
save: `${ESC}7`,
|
|
33
38
|
restore: `${ESC}8`
|
|
34
|
-
}
|
|
39
|
+
};
|
|
40
|
+
const scroll = {
|
|
35
41
|
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
36
42
|
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
37
|
-
}
|
|
43
|
+
};
|
|
44
|
+
const erase = {
|
|
38
45
|
screen: `${CSI}2J`,
|
|
39
46
|
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
40
47
|
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
@@ -48,27 +55,36 @@ function requireSrc() {
|
|
|
48
55
|
return clear;
|
|
49
56
|
}
|
|
50
57
|
};
|
|
51
|
-
|
|
58
|
+
src = {
|
|
52
59
|
cursor,
|
|
53
60
|
scroll,
|
|
54
61
|
erase,
|
|
55
62
|
beep
|
|
56
|
-
}
|
|
63
|
+
};
|
|
64
|
+
return src;
|
|
57
65
|
}
|
|
58
|
-
var srcExports = requireSrc()
|
|
66
|
+
var srcExports = requireSrc();
|
|
67
|
+
var picocolors = { exports: {} };
|
|
68
|
+
var hasRequiredPicocolors;
|
|
59
69
|
function requirePicocolors() {
|
|
60
70
|
if (hasRequiredPicocolors) return picocolors.exports;
|
|
61
71
|
hasRequiredPicocolors = 1;
|
|
62
|
-
let p = process || {}, argv = p.argv || [], env = p.env || {}
|
|
72
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
73
|
+
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
74
|
+
let formatter = (open, close, replace = open) => (input) => {
|
|
63
75
|
let string = "" + input, index = string.indexOf(close, open.length);
|
|
64
76
|
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
65
|
-
}
|
|
77
|
+
};
|
|
78
|
+
let replaceClose = (string, close, replace, index) => {
|
|
66
79
|
let result = "", cursor = 0;
|
|
67
|
-
do
|
|
68
|
-
result += string.substring(cursor, index) + replace
|
|
69
|
-
|
|
80
|
+
do {
|
|
81
|
+
result += string.substring(cursor, index) + replace;
|
|
82
|
+
cursor = index + close.length;
|
|
83
|
+
index = string.indexOf(close, cursor);
|
|
84
|
+
} while (~index);
|
|
70
85
|
return result + string.substring(cursor);
|
|
71
|
-
}
|
|
86
|
+
};
|
|
87
|
+
let createColors = (enabled = isColorSupported) => {
|
|
72
88
|
let f$1 = enabled ? formatter : () => String;
|
|
73
89
|
return {
|
|
74
90
|
isColorSupported: enabled,
|
|
@@ -115,10 +131,11 @@ function requirePicocolors() {
|
|
|
115
131
|
bgWhiteBright: f$1("\x1B[107m", "\x1B[49m")
|
|
116
132
|
};
|
|
117
133
|
};
|
|
118
|
-
|
|
134
|
+
picocolors.exports = createColors();
|
|
135
|
+
picocolors.exports.createColors = createColors;
|
|
136
|
+
return picocolors.exports;
|
|
119
137
|
}
|
|
120
|
-
|
|
121
|
-
const e = /* @__PURE__ */ getDefaultExportFromCjs(picocolorsExports);
|
|
138
|
+
const e = /* @__PURE__ */ getDefaultExportFromCjs(/* @__PURE__ */ requirePicocolors());
|
|
122
139
|
function J({ onlyFirst: t = false } = {}) {
|
|
123
140
|
const F$1 = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
124
141
|
return new RegExp(F$1, t ? void 0 : "g");
|
|
@@ -425,7 +442,8 @@ var AD = Object.defineProperty, pD = (t, u$1, F$1) => u$1 in t ? AD(t, u$1, {
|
|
|
425
442
|
configurable: true,
|
|
426
443
|
writable: true,
|
|
427
444
|
value: F$1
|
|
428
|
-
}) : t[u$1] = F$1, h = (t, u$1, F$1) => (pD(t, typeof u$1 != "symbol" ? u$1 + "" : u$1, F$1), F$1)
|
|
445
|
+
}) : t[u$1] = F$1, h = (t, u$1, F$1) => (pD(t, typeof u$1 != "symbol" ? u$1 + "" : u$1, F$1), F$1);
|
|
446
|
+
var x = class {
|
|
429
447
|
constructor(u$1, F$1 = true) {
|
|
430
448
|
h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
|
|
431
449
|
const { input: e$1 = stdin, output: s = stdout, render: i, signal: D,...C$1 } = u$1;
|
|
@@ -527,7 +545,8 @@ var AD = Object.defineProperty, pD = (t, u$1, F$1) => u$1 in t ? AD(t, u$1, {
|
|
|
527
545
|
this.output.write(u$1), this.state === "initial" && (this.state = "active"), this._prevFrame = u$1;
|
|
528
546
|
}
|
|
529
547
|
}
|
|
530
|
-
}
|
|
548
|
+
};
|
|
549
|
+
var fD = class extends x {
|
|
531
550
|
get cursor() {
|
|
532
551
|
return this.value ? 0 : 1;
|
|
533
552
|
}
|
|
@@ -543,7 +562,8 @@ var AD = Object.defineProperty, pD = (t, u$1, F$1) => u$1 in t ? AD(t, u$1, {
|
|
|
543
562
|
this.value = !this.value;
|
|
544
563
|
});
|
|
545
564
|
}
|
|
546
|
-
}
|
|
565
|
+
};
|
|
566
|
+
var bD = Object.defineProperty, mD = (t, u$1, F$1) => u$1 in t ? bD(t, u$1, {
|
|
547
567
|
enumerable: true,
|
|
548
568
|
configurable: true,
|
|
549
569
|
writable: true,
|
|
@@ -573,12 +593,10 @@ let wD = class extends x {
|
|
|
573
593
|
return this.options[this.cursor].value;
|
|
574
594
|
}
|
|
575
595
|
toggleAll() {
|
|
576
|
-
|
|
577
|
-
this.value = u$1 ? [] : this.options.map((F$1) => F$1.value);
|
|
596
|
+
this.value = this.value.length === this.options.length ? [] : this.options.map((F$1) => F$1.value);
|
|
578
597
|
}
|
|
579
598
|
toggleValue() {
|
|
580
|
-
|
|
581
|
-
this.value = u$1 ? this.value.filter((F$1) => F$1 !== this._value) : [...this.value, this._value];
|
|
599
|
+
this.value = this.value.includes(this._value) ? this.value.filter((F$1) => F$1 !== this._value) : [...this.value, this._value];
|
|
582
600
|
}
|
|
583
601
|
};
|
|
584
602
|
var SD = Object.defineProperty, $D = (t, u$1, F$1) => u$1 in t ? SD(t, u$1, {
|
|
@@ -586,7 +604,8 @@ var SD = Object.defineProperty, $D = (t, u$1, F$1) => u$1 in t ? SD(t, u$1, {
|
|
|
586
604
|
configurable: true,
|
|
587
605
|
writable: true,
|
|
588
606
|
value: F$1
|
|
589
|
-
}) : t[u$1] = F$1, q = (t, u$1, F$1) => ($D(t, typeof u$1 != "symbol" ? u$1 + "" : u$1, F$1), F$1)
|
|
607
|
+
}) : t[u$1] = F$1, q = (t, u$1, F$1) => ($D(t, typeof u$1 != "symbol" ? u$1 + "" : u$1, F$1), F$1);
|
|
608
|
+
var jD = class extends x {
|
|
590
609
|
constructor(u$1) {
|
|
591
610
|
super(u$1, false), q(this, "options"), q(this, "cursor", 0), this.options = u$1.options, this.cursor = this.options.findIndex(({ value: F$1 }) => F$1 === u$1.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F$1) => {
|
|
592
611
|
switch (F$1) {
|
|
@@ -608,7 +627,8 @@ var SD = Object.defineProperty, $D = (t, u$1, F$1) => u$1 in t ? SD(t, u$1, {
|
|
|
608
627
|
changeValue() {
|
|
609
628
|
this.value = this._value.value;
|
|
610
629
|
}
|
|
611
|
-
}
|
|
630
|
+
};
|
|
631
|
+
var PD = class extends x {
|
|
612
632
|
get valueWithCursor() {
|
|
613
633
|
if (this.state === "submit") return this.value;
|
|
614
634
|
if (this.cursor >= this.value.length) return `${this.value}\u2588`;
|
|
@@ -782,10 +802,11 @@ async function prompt(message, opts = {}) {
|
|
|
782
802
|
switch (opts.cancel) {
|
|
783
803
|
case "reject": {
|
|
784
804
|
const error = /* @__PURE__ */ new Error("Prompt cancelled.");
|
|
785
|
-
|
|
805
|
+
error.name = "ConsolaPromptCancelledError";
|
|
806
|
+
if (Error.captureStackTrace) Error.captureStackTrace(error, prompt);
|
|
786
807
|
throw error;
|
|
787
808
|
}
|
|
788
|
-
case "undefined": return
|
|
809
|
+
case "undefined": return;
|
|
789
810
|
case "null": return null;
|
|
790
811
|
case "symbol": return kCancel;
|
|
791
812
|
default:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccusage",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.1",
|
|
4
4
|
"description": "Usage analysis tool for Claude Code",
|
|
5
5
|
"homepage": "https://github.com/ryoppippi/ccusage#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
"./data-loader": "./dist/data-loader.js",
|
|
21
21
|
"./debug": "./dist/debug.js",
|
|
22
22
|
"./logger": "./dist/logger.js",
|
|
23
|
-
"./mcp": "./dist/mcp.js",
|
|
24
|
-
"./pricing-fetcher": "./dist/pricing-fetcher.js",
|
|
25
23
|
"./package.json": "./package.json"
|
|
26
24
|
},
|
|
27
25
|
"main": "./dist/index.js",
|
|
28
26
|
"module": "./dist/index.js",
|
|
29
27
|
"types": "./dist/index.d.ts",
|
|
30
|
-
"bin":
|
|
28
|
+
"bin": {
|
|
29
|
+
"ccusage": "./dist/index.js"
|
|
30
|
+
},
|
|
31
31
|
"files": [
|
|
32
32
|
"config-schema.json",
|
|
33
33
|
"dist"
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
function getTotalTokens(tokenCounts) {
|
|
2
|
-
const cacheCreation = "cacheCreationInputTokens" in tokenCounts ? tokenCounts.cacheCreationInputTokens : tokenCounts.cacheCreationTokens, cacheRead = "cacheReadInputTokens" in tokenCounts ? tokenCounts.cacheReadInputTokens : tokenCounts.cacheReadTokens;
|
|
3
|
-
return tokenCounts.inputTokens + tokenCounts.outputTokens + cacheCreation + cacheRead;
|
|
4
|
-
}
|
|
5
|
-
export { getTotalTokens };
|