ccusage 0.3.1 → 0.3.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.
- package/dist/calculate-cost.d.ts +1 -2
- package/dist/{data-loader-Dh4y6ICb.js → data-loader-D64xoJ7s.js} +443 -48
- package/dist/data-loader-ToqWI8hT.d.ts +1467 -0
- package/dist/data-loader.d.ts +1 -1
- package/dist/data-loader.js +1 -1
- package/dist/index.js +67 -69
- package/package.json +2 -10
- package/dist/data-loader-Ds_vUoR2.d.ts +0 -49
package/dist/data-loader.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DailyUsage, DailyUsageSchema$1 as DailyUsageSchema, DateFilter, LoadOptions, SessionUsage, SessionUsageSchema$1 as SessionUsageSchema, UsageData, UsageDataSchema$1 as UsageDataSchema, formatDate$1 as formatDate, getDefaultClaudePath$1 as getDefaultClaudePath, loadSessionData$1 as loadSessionData, loadUsageData$1 as loadUsageData } from "./data-loader-
|
|
1
|
+
import { DailyUsage, DailyUsageSchema$1 as DailyUsageSchema, DateFilter, LoadOptions, SessionUsage, SessionUsageSchema$1 as SessionUsageSchema, UsageData, UsageDataSchema$1 as UsageDataSchema, formatDate$1 as formatDate, getDefaultClaudePath$1 as getDefaultClaudePath, loadSessionData$1 as loadSessionData, loadUsageData$1 as loadUsageData } from "./data-loader-ToqWI8hT.js";
|
|
2
2
|
export { DailyUsage, DailyUsageSchema, DateFilter, LoadOptions, SessionUsage, SessionUsageSchema, UsageData, UsageDataSchema, formatDate, getDefaultClaudePath, loadSessionData, loadUsageData };
|
package/dist/data-loader.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DailyUsageSchema, SessionUsageSchema, UsageDataSchema, formatDate, getDefaultClaudePath, loadSessionData, loadUsageData } from "./data-loader-
|
|
1
|
+
import { DailyUsageSchema, SessionUsageSchema, UsageDataSchema, formatDate, getDefaultClaudePath, loadSessionData, loadUsageData } from "./data-loader-D64xoJ7s.js";
|
|
2
2
|
|
|
3
3
|
export { DailyUsageSchema, SessionUsageSchema, UsageDataSchema, formatDate, getDefaultClaudePath, loadSessionData, loadUsageData };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { __commonJS, __require, __toESM, getDefaultClaudePath, loadSessionData, loadUsageData } from "./data-loader-
|
|
2
|
+
import { __commonJS, __require, __toESM, boolean, getDefaultClaudePath, loadSessionData, loadUsageData, number, object, optional, pipe, record, regex, safeParse, string, union } from "./data-loader-D64xoJ7s.js";
|
|
3
3
|
import { calculateTotals, createTotalsObject, getTotalTokens } from "./calculate-cost-DMC4FhU4.js";
|
|
4
4
|
import { sep } from "node:path";
|
|
5
|
-
import * as v$1 from "valibot";
|
|
6
|
-
import * as v from "valibot";
|
|
7
5
|
import process$1 from "node:process";
|
|
8
6
|
import { formatWithOptions } from "node:util";
|
|
9
7
|
import * as tty from "node:tty";
|
|
@@ -1147,8 +1145,8 @@ var require_debug = __commonJS({ "node_modules/cli-table3/src/debug.js"(exports,
|
|
|
1147
1145
|
debug$3.reset = () => {
|
|
1148
1146
|
messages = [];
|
|
1149
1147
|
};
|
|
1150
|
-
debug$3.setDebugLevel = (v
|
|
1151
|
-
level = v
|
|
1148
|
+
debug$3.setDebugLevel = (v) => {
|
|
1149
|
+
level = v;
|
|
1152
1150
|
};
|
|
1153
1151
|
debug$3.warn = (msg) => debug$3(msg, debug$3.WARN);
|
|
1154
1152
|
debug$3.info = (msg) => debug$3(msg, debug$3.INFO);
|
|
@@ -1170,7 +1168,7 @@ var require_ansi_regex = __commonJS({ "node_modules/ansi-regex/index.js"(exports
|
|
|
1170
1168
|
//#region node_modules/strip-ansi/index.js
|
|
1171
1169
|
var require_strip_ansi = __commonJS({ "node_modules/strip-ansi/index.js"(exports, module) {
|
|
1172
1170
|
const ansiRegex$2 = require_ansi_regex();
|
|
1173
|
-
module.exports = (string) => typeof string === "string" ? string.replace(ansiRegex$2(), "") : string;
|
|
1171
|
+
module.exports = (string$1) => typeof string$1 === "string" ? string$1.replace(ansiRegex$2(), "") : string$1;
|
|
1174
1172
|
} });
|
|
1175
1173
|
|
|
1176
1174
|
//#endregion
|
|
@@ -1199,14 +1197,14 @@ var require_string_width = __commonJS({ "node_modules/string-width/index.js"(exp
|
|
|
1199
1197
|
const stripAnsi$2 = require_strip_ansi();
|
|
1200
1198
|
const isFullwidthCodePoint = require_is_fullwidth_code_point();
|
|
1201
1199
|
const emojiRegex$1 = require_emoji_regex();
|
|
1202
|
-
const stringWidth$3 = (string) => {
|
|
1203
|
-
if (typeof string !== "string" || string.length === 0) return 0;
|
|
1204
|
-
string = stripAnsi$2(string);
|
|
1205
|
-
if (string.length === 0) return 0;
|
|
1206
|
-
string = string.replace(emojiRegex$1(), " ");
|
|
1200
|
+
const stringWidth$3 = (string$1) => {
|
|
1201
|
+
if (typeof string$1 !== "string" || string$1.length === 0) return 0;
|
|
1202
|
+
string$1 = stripAnsi$2(string$1);
|
|
1203
|
+
if (string$1.length === 0) return 0;
|
|
1204
|
+
string$1 = string$1.replace(emojiRegex$1(), " ");
|
|
1207
1205
|
let width = 0;
|
|
1208
|
-
for (let i$1 = 0; i$1 < string.length; i$1++) {
|
|
1209
|
-
const code = string.codePointAt(i$1);
|
|
1206
|
+
for (let i$1 = 0; i$1 < string$1.length; i$1++) {
|
|
1207
|
+
const code = string$1.codePointAt(i$1);
|
|
1210
1208
|
if (code <= 31 || code >= 127 && code <= 159) continue;
|
|
1211
1209
|
if (code >= 768 && code <= 879) continue;
|
|
1212
1210
|
if (code > 65535) i$1++;
|
|
@@ -2468,7 +2466,7 @@ var require_cell = __commonJS({ "node_modules/cli-table3/src/cell.js"(exports, m
|
|
|
2468
2466
|
mergeTableOptions() {}
|
|
2469
2467
|
};
|
|
2470
2468
|
function firstDefined(...args) {
|
|
2471
|
-
return args.filter((v
|
|
2469
|
+
return args.filter((v) => v !== void 0 && v !== null).shift();
|
|
2472
2470
|
}
|
|
2473
2471
|
function setOption(objA, objB, nameB, targetObj) {
|
|
2474
2472
|
let nameA = nameB.split("-");
|
|
@@ -2811,17 +2809,17 @@ var require_picocolors = __commonJS({ "node_modules/picocolors/picocolors.js"(ex
|
|
|
2811
2809
|
let p = process || {}, argv$1 = p.argv || [], env$1 = p.env || {};
|
|
2812
2810
|
let isColorSupported$1 = !(!!env$1.NO_COLOR || argv$1.includes("--no-color")) && (!!env$1.FORCE_COLOR || argv$1.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env$1.TERM !== "dumb" || !!env$1.CI);
|
|
2813
2811
|
let formatter = (open, close, replace = open) => (input) => {
|
|
2814
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
2815
|
-
return ~index ? open + replaceClose$1(string, close, replace, index) + close : open + string + close;
|
|
2812
|
+
let string$1 = "" + input, index = string$1.indexOf(close, open.length);
|
|
2813
|
+
return ~index ? open + replaceClose$1(string$1, close, replace, index) + close : open + string$1 + close;
|
|
2816
2814
|
};
|
|
2817
|
-
let replaceClose$1 = (string, close, replace, index) => {
|
|
2815
|
+
let replaceClose$1 = (string$1, close, replace, index) => {
|
|
2818
2816
|
let result = "", cursor = 0;
|
|
2819
2817
|
do {
|
|
2820
|
-
result += string.substring(cursor, index) + replace;
|
|
2818
|
+
result += string$1.substring(cursor, index) + replace;
|
|
2821
2819
|
cursor = index + close.length;
|
|
2822
|
-
index = string.indexOf(close, cursor);
|
|
2820
|
+
index = string$1.indexOf(close, cursor);
|
|
2823
2821
|
} while (~index);
|
|
2824
|
-
return result + string.substring(cursor);
|
|
2822
|
+
return result + string$1.substring(cursor);
|
|
2825
2823
|
};
|
|
2826
2824
|
let createColors$1 = (enabled = isColorSupported$1) => {
|
|
2827
2825
|
let f$1 = enabled ? formatter : () => String;
|
|
@@ -2918,17 +2916,17 @@ function isPlainObject$1(value) {
|
|
|
2918
2916
|
}
|
|
2919
2917
|
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
2920
2918
|
if (!isPlainObject$1(defaults)) return _defu(baseObject, {}, namespace, merger);
|
|
2921
|
-
const object = Object.assign({}, defaults);
|
|
2919
|
+
const object$1 = Object.assign({}, defaults);
|
|
2922
2920
|
for (const key in baseObject) {
|
|
2923
2921
|
if (key === "__proto__" || key === "constructor") continue;
|
|
2924
2922
|
const value = baseObject[key];
|
|
2925
2923
|
if (value === null || value === void 0) continue;
|
|
2926
|
-
if (merger && merger(object, key, value, namespace)) continue;
|
|
2927
|
-
if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
|
|
2928
|
-
else if (isPlainObject$1(value) && isPlainObject$1(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
2929
|
-
else object[key] = value;
|
|
2924
|
+
if (merger && merger(object$1, key, value, namespace)) continue;
|
|
2925
|
+
if (Array.isArray(value) && Array.isArray(object$1[key])) object$1[key] = [...value, ...object$1[key]];
|
|
2926
|
+
else if (isPlainObject$1(value) && isPlainObject$1(object$1[key])) object$1[key] = _defu(value, object$1[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
2927
|
+
else object$1[key] = value;
|
|
2930
2928
|
}
|
|
2931
|
-
return object;
|
|
2929
|
+
return object$1;
|
|
2932
2930
|
}
|
|
2933
2931
|
function createDefu(merger) {
|
|
2934
2932
|
return (...arguments_) => arguments_.reduce((p$1, c$1) => _defu(p$1, c$1, "", merger), {});
|
|
@@ -3334,14 +3332,14 @@ const isDumbTerminal = env.TERM === "dumb";
|
|
|
3334
3332
|
const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
3335
3333
|
const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
3336
3334
|
const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
3337
|
-
function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
|
|
3335
|
+
function replaceClose(index, string$1, close, replace, head = string$1.slice(0, Math.max(0, index)) + replace, tail = string$1.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
|
|
3338
3336
|
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
3339
3337
|
}
|
|
3340
|
-
function clearBleed(index, string, open, close, replace) {
|
|
3341
|
-
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
3338
|
+
function clearBleed(index, string$1, open, close, replace) {
|
|
3339
|
+
return index < 0 ? open + string$1 + close : open + replaceClose(index, string$1, close, replace) + close;
|
|
3342
3340
|
}
|
|
3343
3341
|
function filterEmpty(open, close, replace = open, at = open.length + 1) {
|
|
3344
|
-
return (string) => string || !(string === "" || string === void 0) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
|
|
3342
|
+
return (string$1) => string$1 || !(string$1 === "" || string$1 === void 0) ? clearBleed(("" + string$1).indexOf(close, at), string$1, open, close, replace) : "";
|
|
3345
3343
|
}
|
|
3346
3344
|
function init(open, close, replace) {
|
|
3347
3345
|
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
@@ -3680,10 +3678,10 @@ function ansiRegex({ onlyFirst = false } = {}) {
|
|
|
3680
3678
|
const pattern = [`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`, "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
3681
3679
|
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
3682
3680
|
}
|
|
3683
|
-
const regex = ansiRegex();
|
|
3684
|
-
function stripAnsi(string) {
|
|
3685
|
-
if (typeof string !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
3686
|
-
return string.replace(regex, "");
|
|
3681
|
+
const regex$1 = ansiRegex();
|
|
3682
|
+
function stripAnsi(string$1) {
|
|
3683
|
+
if (typeof string$1 !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string$1}\``);
|
|
3684
|
+
return string$1.replace(regex$1, "");
|
|
3687
3685
|
}
|
|
3688
3686
|
function isAmbiguous(x) {
|
|
3689
3687
|
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
@@ -3707,14 +3705,14 @@ const emojiRegex = () => {
|
|
|
3707
3705
|
};
|
|
3708
3706
|
const segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split("") };
|
|
3709
3707
|
const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
3710
|
-
function stringWidth$1(string, options = {}) {
|
|
3711
|
-
if (typeof string !== "string" || string.length === 0) return 0;
|
|
3708
|
+
function stringWidth$1(string$1, options = {}) {
|
|
3709
|
+
if (typeof string$1 !== "string" || string$1.length === 0) return 0;
|
|
3712
3710
|
const { ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = options;
|
|
3713
|
-
if (!countAnsiEscapeCodes) string = stripAnsi(string);
|
|
3714
|
-
if (string.length === 0) return 0;
|
|
3711
|
+
if (!countAnsiEscapeCodes) string$1 = stripAnsi(string$1);
|
|
3712
|
+
if (string$1.length === 0) return 0;
|
|
3715
3713
|
let width = 0;
|
|
3716
3714
|
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
3717
|
-
for (const { segment: character } of segmenter.segment(string)) {
|
|
3715
|
+
for (const { segment: character } of segmenter.segment(string$1)) {
|
|
3718
3716
|
const codePoint = character.codePointAt(0);
|
|
3719
3717
|
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) continue;
|
|
3720
3718
|
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) continue;
|
|
@@ -3837,7 +3835,7 @@ const consola = createConsola();
|
|
|
3837
3835
|
//#endregion
|
|
3838
3836
|
//#region package.json
|
|
3839
3837
|
var name = "ccusage";
|
|
3840
|
-
var version = "0.3.
|
|
3838
|
+
var version = "0.3.2";
|
|
3841
3839
|
var description = "Usage analysis tool for Claude Code";
|
|
3842
3840
|
|
|
3843
3841
|
//#endregion
|
|
@@ -3847,41 +3845,41 @@ const log = (...args) => console.log(...args);
|
|
|
3847
3845
|
|
|
3848
3846
|
//#endregion
|
|
3849
3847
|
//#region types.ts
|
|
3850
|
-
const ModelSpecSchema =
|
|
3851
|
-
max_tokens:
|
|
3852
|
-
max_input_tokens:
|
|
3853
|
-
max_output_tokens:
|
|
3854
|
-
input_cost_per_token:
|
|
3855
|
-
output_cost_per_token:
|
|
3856
|
-
output_cost_per_reasoning_token:
|
|
3857
|
-
cache_creation_input_token_cost:
|
|
3858
|
-
cache_read_input_token_cost:
|
|
3859
|
-
litellm_provider:
|
|
3860
|
-
mode:
|
|
3861
|
-
supports_function_calling:
|
|
3862
|
-
supports_parallel_function_calling:
|
|
3863
|
-
supports_vision:
|
|
3864
|
-
supports_audio_input:
|
|
3865
|
-
supports_audio_output:
|
|
3866
|
-
supports_prompt_caching:
|
|
3867
|
-
supports_response_schema:
|
|
3868
|
-
supports_system_messages:
|
|
3869
|
-
supports_reasoning:
|
|
3870
|
-
supports_web_search:
|
|
3871
|
-
search_context_cost_per_query:
|
|
3872
|
-
search_context_size_low:
|
|
3873
|
-
search_context_size_medium:
|
|
3874
|
-
search_context_size_high:
|
|
3848
|
+
const ModelSpecSchema = object({
|
|
3849
|
+
max_tokens: optional(union([number(), string()])),
|
|
3850
|
+
max_input_tokens: optional(union([number(), string()])),
|
|
3851
|
+
max_output_tokens: optional(union([number(), string()])),
|
|
3852
|
+
input_cost_per_token: optional(number()),
|
|
3853
|
+
output_cost_per_token: optional(number()),
|
|
3854
|
+
output_cost_per_reasoning_token: optional(number()),
|
|
3855
|
+
cache_creation_input_token_cost: optional(number()),
|
|
3856
|
+
cache_read_input_token_cost: optional(number()),
|
|
3857
|
+
litellm_provider: optional(string()),
|
|
3858
|
+
mode: optional(string()),
|
|
3859
|
+
supports_function_calling: optional(boolean()),
|
|
3860
|
+
supports_parallel_function_calling: optional(boolean()),
|
|
3861
|
+
supports_vision: optional(boolean()),
|
|
3862
|
+
supports_audio_input: optional(boolean()),
|
|
3863
|
+
supports_audio_output: optional(boolean()),
|
|
3864
|
+
supports_prompt_caching: optional(boolean()),
|
|
3865
|
+
supports_response_schema: optional(boolean()),
|
|
3866
|
+
supports_system_messages: optional(boolean()),
|
|
3867
|
+
supports_reasoning: optional(boolean()),
|
|
3868
|
+
supports_web_search: optional(boolean()),
|
|
3869
|
+
search_context_cost_per_query: optional(object({
|
|
3870
|
+
search_context_size_low: number(),
|
|
3871
|
+
search_context_size_medium: number(),
|
|
3872
|
+
search_context_size_high: number()
|
|
3875
3873
|
})),
|
|
3876
|
-
deprecation_date:
|
|
3874
|
+
deprecation_date: optional(string())
|
|
3877
3875
|
});
|
|
3878
|
-
const LiteLLMModelPricesSchema =
|
|
3879
|
-
const dateSchema =
|
|
3876
|
+
const LiteLLMModelPricesSchema = record(string(), ModelSpecSchema);
|
|
3877
|
+
const dateSchema = pipe(string(), regex(/^\d{8}$/, "Date must be in YYYYMMDD format"));
|
|
3880
3878
|
|
|
3881
3879
|
//#endregion
|
|
3882
3880
|
//#region shared-args.ts
|
|
3883
3881
|
const parseDateArg = (value) => {
|
|
3884
|
-
const result =
|
|
3882
|
+
const result = safeParse(dateSchema, value);
|
|
3885
3883
|
if (!result.success) throw new TypeError(result.issues[0].message);
|
|
3886
3884
|
return result.output;
|
|
3887
3885
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccusage",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Usage analysis tool for Claude Code",
|
|
5
5
|
"homepage": "https://github.com/ryoppippi/ccusage#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -26,13 +26,5 @@
|
|
|
26
26
|
"bin": "./dist/index.js",
|
|
27
27
|
"files": [
|
|
28
28
|
"dist"
|
|
29
|
-
]
|
|
30
|
-
"peerDependencies": {
|
|
31
|
-
"valibot": "^1.1.0"
|
|
32
|
-
},
|
|
33
|
-
"peerDependenciesMeta": {
|
|
34
|
-
"valibot": {
|
|
35
|
-
"optional": true
|
|
36
|
-
}
|
|
37
|
-
}
|
|
29
|
+
]
|
|
38
30
|
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import * as v from "valibot";
|
|
2
|
-
|
|
3
|
-
//#region data-loader.d.ts
|
|
4
|
-
declare const getDefaultClaudePath: () => string;
|
|
5
|
-
declare const UsageDataSchema: v.ObjectSchema<{
|
|
6
|
-
readonly timestamp: v.StringSchema<undefined>;
|
|
7
|
-
readonly message: v.ObjectSchema<{
|
|
8
|
-
readonly usage: v.ObjectSchema<{
|
|
9
|
-
readonly input_tokens: v.NumberSchema<undefined>;
|
|
10
|
-
readonly output_tokens: v.NumberSchema<undefined>;
|
|
11
|
-
readonly cache_creation_input_tokens: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
12
|
-
readonly cache_read_input_tokens: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
13
|
-
}, undefined>;
|
|
14
|
-
}, undefined>;
|
|
15
|
-
readonly costUSD: v.NumberSchema<undefined>;
|
|
16
|
-
}, undefined>;
|
|
17
|
-
type UsageData = v.InferOutput<typeof UsageDataSchema>;
|
|
18
|
-
declare const DailyUsageSchema: v.ObjectSchema<{
|
|
19
|
-
readonly date: v.StringSchema<undefined>;
|
|
20
|
-
readonly inputTokens: v.NumberSchema<undefined>;
|
|
21
|
-
readonly outputTokens: v.NumberSchema<undefined>;
|
|
22
|
-
readonly cacheCreationTokens: v.NumberSchema<undefined>;
|
|
23
|
-
readonly cacheReadTokens: v.NumberSchema<undefined>;
|
|
24
|
-
readonly totalCost: v.NumberSchema<undefined>;
|
|
25
|
-
}, undefined>;
|
|
26
|
-
type DailyUsage = v.InferOutput<typeof DailyUsageSchema>;
|
|
27
|
-
declare const SessionUsageSchema: v.ObjectSchema<{
|
|
28
|
-
readonly sessionId: v.StringSchema<undefined>;
|
|
29
|
-
readonly projectPath: v.StringSchema<undefined>;
|
|
30
|
-
readonly inputTokens: v.NumberSchema<undefined>;
|
|
31
|
-
readonly outputTokens: v.NumberSchema<undefined>;
|
|
32
|
-
readonly cacheCreationTokens: v.NumberSchema<undefined>;
|
|
33
|
-
readonly cacheReadTokens: v.NumberSchema<undefined>;
|
|
34
|
-
readonly totalCost: v.NumberSchema<undefined>;
|
|
35
|
-
readonly lastActivity: v.StringSchema<undefined>;
|
|
36
|
-
}, undefined>;
|
|
37
|
-
type SessionUsage = v.InferOutput<typeof SessionUsageSchema>;
|
|
38
|
-
declare const formatDate: (dateStr: string) => string;
|
|
39
|
-
interface DateFilter {
|
|
40
|
-
since?: string;
|
|
41
|
-
until?: string;
|
|
42
|
-
}
|
|
43
|
-
interface LoadOptions extends DateFilter {
|
|
44
|
-
claudePath?: string;
|
|
45
|
-
}
|
|
46
|
-
declare function loadUsageData(options?: LoadOptions): Promise<DailyUsage[]>;
|
|
47
|
-
declare function loadSessionData(options?: LoadOptions): Promise<SessionUsage[]>;
|
|
48
|
-
//#endregion
|
|
49
|
-
export { DailyUsage, DailyUsageSchema as DailyUsageSchema$1, DateFilter, LoadOptions, SessionUsage, SessionUsageSchema as SessionUsageSchema$1, UsageData, UsageDataSchema as UsageDataSchema$1, formatDate as formatDate$1, getDefaultClaudePath as getDefaultClaudePath$1, loadSessionData as loadSessionData$1, loadUsageData as loadUsageData$1 };
|