ccusage 0.4.2 → 0.5.0
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 +68 -0
- package/dist/arktype-C-GObzDh-Dj1DVoqC.js +5 -0
- package/dist/calculate-cost.d.ts +4 -4
- package/dist/calculate-cost.js +1 -1
- package/dist/core-BgFXUe_h.js +693 -0
- package/dist/{data-loader-DtCt7sNl.d.ts → data-loader-LMCrJ-lW.d.ts} +3 -3
- package/dist/{data-loader-B8mdiY5r.js → data-loader-r5ZcMQy7.js} +2 -2
- package/dist/data-loader.d.ts +4 -4
- package/dist/data-loader.js +4 -4
- package/dist/{debug-Oce2b5bO.js → debug-BVxGf4UL.js} +4 -4
- package/dist/debug.js +5 -5
- package/dist/dist-C_i5I27w.js +469 -0
- package/dist/{dist-D6rk8Ra5.js → dist-FwNhpFrW.js} +30 -1
- package/dist/effect-WSjEuzC9-BsxP11fz.js +10 -0
- package/dist/esm-vjyZjnpZ.js +1090 -0
- package/dist/index-CISmcbXk-BotItq1T.js +23 -0
- package/dist/index.js +48 -9
- package/dist/{logger-nCODI08N.js → logger-Cu4Ir1a5.js} +2 -2
- package/dist/logger.js +1 -1
- package/dist/mcp-DAzj5Pua.js +37580 -0
- package/dist/mcp.d.ts +15 -0
- package/dist/mcp.js +10 -0
- package/dist/{pricing-fetcher-bvi4lbXl.js → pricing-fetcher-B5yPtoTB.js} +2 -2
- package/dist/{pricing-fetcher-BqlslEH3.d.ts → pricing-fetcher-DygIroMj.d.ts} +1 -1
- package/dist/pricing-fetcher.d.ts +2 -2
- package/dist/pricing-fetcher.js +3 -3
- package/dist/{shared-args-DWaGio0e.js → shared-args-DN3jRldX.js} +3 -3
- package/dist/shared-args.js +6 -6
- package/dist/sury-DmrZ3_Oj-DhGOjCNc.js +10 -0
- package/dist/{types-BfZ5dOy7.d.ts → types-B3ib19os.d.ts} +1 -1
- package/dist/types-CFnCBr2I.js +3586 -0
- package/dist/{types-DjlBTM5P.js → types-DFrbJmnT.js} +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.js +2 -2
- package/dist/utils.js +1 -1
- package/dist/valibot-CQk-M5rL-Cq5E7F3g.js +10 -0
- package/dist/zod-Db63SLXj-BWdcigdx.js +30 -0
- package/package.json +2 -1
- /package/dist/{calculate-cost-BnufbprY.js → calculate-cost-2IwHSzmi.js} +0 -0
- /package/dist/{index-Bazt8Nfd.d.ts → index-BurjgCfW.d.ts} +0 -0
- /package/dist/{prompt-BwcIpzWm.js → prompt-IToGuko2.js} +0 -0
- /package/dist/{utils-BeihwpHn.js → utils-C7kg8MXN.js} +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region node_modules/xsschema/dist/index-CISmcbXk.js
|
|
2
|
+
const missingDependenciesUrl = "https://xsai.js.org/docs/packages-top/xsschema#missing-dependencies";
|
|
3
|
+
const tryImport = async (result, name) => {
|
|
4
|
+
try {
|
|
5
|
+
return await result;
|
|
6
|
+
} catch {
|
|
7
|
+
throw new Error(`xsschema: Missing dependencies "${name}". see ${missingDependenciesUrl}`);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
const getToJsonSchemaFn = async (vendor) => {
|
|
11
|
+
switch (vendor) {
|
|
12
|
+
case "arktype": return import("./arktype-C-GObzDh-Dj1DVoqC.js").then(async ({ getToJsonSchemaFn: getToJsonSchemaFn2 }) => getToJsonSchemaFn2());
|
|
13
|
+
case "effect": return import("./effect-WSjEuzC9-BsxP11fz.js").then(async ({ getToJsonSchemaFn: getToJsonSchemaFn2 }) => getToJsonSchemaFn2());
|
|
14
|
+
case "sury": return import("./sury-DmrZ3_Oj-DhGOjCNc.js").then(async ({ getToJsonSchemaFn: getToJsonSchemaFn2 }) => getToJsonSchemaFn2());
|
|
15
|
+
case "valibot": return import("./valibot-CQk-M5rL-Cq5E7F3g.js").then(async ({ getToJsonSchemaFn: getToJsonSchemaFn2 }) => getToJsonSchemaFn2());
|
|
16
|
+
case "zod": return import("./zod-Db63SLXj-BWdcigdx.js").then(async ({ getToJsonSchemaFn: getToJsonSchemaFn2 }) => getToJsonSchemaFn2());
|
|
17
|
+
default: throw new Error(`xsschema: Unsupported schema vendor "${vendor}". see https://xsai.js.org/docs/packages-top/xsschema#unsupported-schema-vendor`);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const toJsonSchema = async (schema) => getToJsonSchemaFn(schema["~standard"].vendor).then(async (toJsonSchema2) => toJsonSchema2(schema));
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { missingDependenciesUrl, toJsonSchema, tryImport };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { __commonJS, __require, __toESM, loadSessionData, loadUsageData } from "./data-loader-
|
|
3
|
-
import {
|
|
4
|
-
import "./dist-
|
|
5
|
-
import { description, log, logger, name, version } from "./logger-
|
|
6
|
-
import "./pricing-fetcher-
|
|
7
|
-
import "./
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
2
|
+
import { __commonJS, __require, __toESM, loadSessionData, loadUsageData } from "./data-loader-r5ZcMQy7.js";
|
|
3
|
+
import { calculateTotals, createTotalsObject, getTotalTokens } from "./calculate-cost-2IwHSzmi.js";
|
|
4
|
+
import "./dist-FwNhpFrW.js";
|
|
5
|
+
import { description, log, logger, name, version } from "./logger-Cu4Ir1a5.js";
|
|
6
|
+
import "./pricing-fetcher-B5yPtoTB.js";
|
|
7
|
+
import { detectMismatches, printMismatchReport } from "./debug-BVxGf4UL.js";
|
|
8
|
+
import "./types-DFrbJmnT.js";
|
|
9
|
+
import { sharedArgs, sharedCommandConfig } from "./shared-args-DN3jRldX.js";
|
|
10
|
+
import { formatCurrency, formatNumber } from "./utils-C7kg8MXN.js";
|
|
11
|
+
import "./types-CFnCBr2I.js";
|
|
12
|
+
import { createMcpServer } from "./mcp-DAzj5Pua.js";
|
|
13
|
+
import "./index-CISmcbXk-BotItq1T.js";
|
|
11
14
|
import process$1 from "node:process";
|
|
12
15
|
|
|
13
16
|
//#region node_modules/gunshi/lib/utils-B_QNzw5q.js
|
|
@@ -2972,6 +2975,41 @@ const dailyCommand = define({
|
|
|
2972
2975
|
}
|
|
2973
2976
|
});
|
|
2974
2977
|
|
|
2978
|
+
//#endregion
|
|
2979
|
+
//#region src/commands/mcp.ts
|
|
2980
|
+
const mcpCommand = define({
|
|
2981
|
+
name: "mcp",
|
|
2982
|
+
description: "Show usage report for MCP",
|
|
2983
|
+
args: {
|
|
2984
|
+
path: sharedArgs.path,
|
|
2985
|
+
mode: sharedArgs.mode,
|
|
2986
|
+
type: {
|
|
2987
|
+
type: "enum",
|
|
2988
|
+
short: "t",
|
|
2989
|
+
description: "Transport type for MCP server",
|
|
2990
|
+
choices: ["stdio", "http"],
|
|
2991
|
+
default: "stdio"
|
|
2992
|
+
},
|
|
2993
|
+
port: {
|
|
2994
|
+
type: "number",
|
|
2995
|
+
description: "Port for HTTP transport (default: 8080)",
|
|
2996
|
+
default: 8080
|
|
2997
|
+
}
|
|
2998
|
+
},
|
|
2999
|
+
async run(ctx) {
|
|
3000
|
+
const { type, mode, path, port } = ctx.values;
|
|
3001
|
+
if (type === "stdio") logger.level = 0;
|
|
3002
|
+
const server = createMcpServer({
|
|
3003
|
+
claudePath: path,
|
|
3004
|
+
mode
|
|
3005
|
+
});
|
|
3006
|
+
server.start(ctx.values.type === "http" ? {
|
|
3007
|
+
transportType: "httpStream",
|
|
3008
|
+
httpStream: { port }
|
|
3009
|
+
} : { transportType: "stdio" });
|
|
3010
|
+
}
|
|
3011
|
+
});
|
|
3012
|
+
|
|
2975
3013
|
//#endregion
|
|
2976
3014
|
//#region src/commands/session.ts
|
|
2977
3015
|
var import_cli_table3 = __toESM(require_cli_table3(), 1);
|
|
@@ -3093,6 +3131,7 @@ const sessionCommand = define({
|
|
|
3093
3131
|
const subCommands = new Map();
|
|
3094
3132
|
subCommands.set("daily", dailyCommand);
|
|
3095
3133
|
subCommands.set("session", sessionCommand);
|
|
3134
|
+
subCommands.set("mcp", mcpCommand);
|
|
3096
3135
|
const mainCommand = dailyCommand;
|
|
3097
3136
|
await cli(process$1.argv.slice(2), mainCommand, {
|
|
3098
3137
|
name,
|
|
@@ -949,7 +949,7 @@ function createConsola(options = {}) {
|
|
|
949
949
|
defaults: { level },
|
|
950
950
|
stdout: process.stdout,
|
|
951
951
|
stderr: process.stderr,
|
|
952
|
-
prompt: (...args) => import("./prompt-
|
|
952
|
+
prompt: (...args) => import("./prompt-IToGuko2.js").then((m) => m.prompt(...args)),
|
|
953
953
|
reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
|
|
954
954
|
...options
|
|
955
955
|
});
|
|
@@ -965,7 +965,7 @@ const consola = createConsola();
|
|
|
965
965
|
//#endregion
|
|
966
966
|
//#region package.json
|
|
967
967
|
var name = "ccusage";
|
|
968
|
-
var version = "0.
|
|
968
|
+
var version = "0.5.0";
|
|
969
969
|
var description = "Usage analysis tool for Claude Code";
|
|
970
970
|
|
|
971
971
|
//#endregion
|
package/dist/logger.js
CHANGED