ccusage 15.10.0 → 16.0.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.
@@ -1,9 +1,9 @@
1
- import { __commonJSMin, __toESM, require_usingCtx } from "./pricing-fetcher-D3tIkxxO.js";
1
+ import { __commonJSMin, __toESM, require_usingCtx } from "./pricing-fetcher-CUQk_dDN.js";
2
2
  import { getTotalTokens } from "./_token-utils-WjkbrjKv.js";
3
3
  import { ZodFirstPartyTypeKind, ZodOptional, ZodType, arrayType, booleanType, discriminatedUnionType, enumType, filterDateSchema, literalType, numberType, objectType, optionalType, recordType, stringType, unionType, unknownType } from "./_types-BbEk8t2a.js";
4
4
  import { calculateTotals, createTotalsObject } from "./calculate-cost-BDqO4yWA.js";
5
- import { getClaudePaths, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData } from "./data-loader-Dhwqb-FE.js";
6
- import { name, version } from "./logger-yNFB24CE.js";
5
+ import { getClaudePaths, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData } from "./data-loader-Bf4qMLf2.js";
6
+ import { name, version } from "./logger-ClcgjXEW.js";
7
7
  import process from "node:process";
8
8
  const LATEST_PROTOCOL_VERSION = "2025-06-18", SUPPORTED_PROTOCOL_VERSIONS = [
9
9
  LATEST_PROTOCOL_VERSION,
@@ -6670,12 +6670,12 @@ function transformUsageDataWithTotals(data, totals, mapper, key) {
6670
6670
  totals: createTotalsObject(totals)
6671
6671
  };
6672
6672
  }
6673
- const defaultOptions = { claudePath: (() => {
6673
+ function defaultOptions() {
6674
6674
  const paths = getClaudePaths();
6675
6675
  if (paths.length === 0) throw new Error("No valid Claude path found. Ensure getClaudePaths() returns at least one valid path.");
6676
- return paths[0];
6677
- })() };
6678
- function createMcpServer({ claudePath } = defaultOptions) {
6676
+ return { claudePath: paths[0] };
6677
+ }
6678
+ function createMcpServer(options) {
6679
6679
  const server = new McpServer({
6680
6680
  name,
6681
6681
  version
@@ -6689,7 +6689,7 @@ function createMcpServer({ claudePath } = defaultOptions) {
6689
6689
  ]).default("auto").optional(),
6690
6690
  timezone: stringType().optional(),
6691
6691
  locale: stringType().default("en-CA").optional()
6692
- };
6692
+ }, { claudePath } = options ?? defaultOptions();
6693
6693
  return server.registerTool("daily", {
6694
6694
  description: "Show usage report grouped by date",
6695
6695
  inputSchema: parametersZodSchema,
@@ -6807,8 +6807,8 @@ async function startMcpServerStdio(server) {
6807
6807
  const transport = new StdioServerTransport();
6808
6808
  await server.connect(transport);
6809
6809
  }
6810
- function createMcpHttpApp(options = defaultOptions) {
6811
- const app = new Hono(), mcpServer = createMcpServer(options);
6810
+ function createMcpHttpApp(options) {
6811
+ const app = new Hono(), mcpServer = createMcpServer(options ?? defaultOptions());
6812
6812
  return app.all("/", async (c) => {
6813
6813
  const transport = new StreamableHTTPTransport();
6814
6814
  return await mcpServer.connect(transport), transport.handleRequest(c);
package/dist/mcp.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./pricing-fetcher-BgDfBZ05.js";
2
- import { LoadOptions } from "./data-loader-BJnD_oR3.js";
2
+ import { LoadOptions } from "./data-loader--Ga8BPdt.js";
3
3
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
4
  import { Hono } from "hono/tiny";
5
5
 
@@ -13,9 +13,7 @@ import { Hono } from "hono/tiny";
13
13
  * @param options.claudePath - Path to Claude's data directory
14
14
  * @returns Configured MCP server instance with registered tools
15
15
  */
16
- declare function createMcpServer({
17
- claudePath
18
- }?: LoadOptions): McpServer;
16
+ declare function createMcpServer(options?: LoadOptions): McpServer;
19
17
  /**
20
18
  * Start the MCP server with stdio transport.
21
19
  * Used for traditional MCP client connections via standard input/output.
package/dist/mcp.js CHANGED
@@ -1,8 +1,8 @@
1
- import "./pricing-fetcher-D3tIkxxO.js";
1
+ import "./pricing-fetcher-CUQk_dDN.js";
2
2
  import "./_token-utils-WjkbrjKv.js";
3
3
  import "./_types-BbEk8t2a.js";
4
4
  import "./calculate-cost-BDqO4yWA.js";
5
- import "./data-loader-Dhwqb-FE.js";
6
- import "./logger-yNFB24CE.js";
7
- import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-Cfnsg0lJ.js";
5
+ import "./data-loader-Bf4qMLf2.js";
6
+ import "./logger-ClcgjXEW.js";
7
+ import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-DW2TXqtN.js";
8
8
  export { createMcpHttpApp, createMcpServer, startMcpServerStdio };
@@ -1,5 +1,5 @@
1
1
  import { modelPricingSchema } from "./_types-BbEk8t2a.js";
2
- import { logger } from "./logger-yNFB24CE.js";
2
+ import { logger } from "./logger-ClcgjXEW.js";
3
3
  import { createRequire } from "node:module";
4
4
  import path from "node:path";
5
5
  import F, { homedir } from "node:os";
@@ -107,7 +107,7 @@ const LITELLM_PRICING_URL = "https://raw.githubusercontent.com/BerriAI/litellm/m
107
107
  "thursday",
108
108
  "friday",
109
109
  "saturday"
110
- ];
110
+ ], CONFIG_FILE_NAME = "ccusage.json";
111
111
  var require_usingCtx = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112
112
  function _usingCtx() {
113
113
  var r = "function" == typeof SuppressedError ? SuppressedError : function(r$1, e$1) {
@@ -399,4 +399,4 @@ var require_usingCtx = /* @__PURE__ */ __commonJSMin(((exports, module) => {
399
399
  return cost;
400
400
  }
401
401
  };
402
- export { BLOCKS_COMPACT_WIDTH_THRESHOLD, BLOCKS_DEFAULT_TERMINAL_WIDTH, BLOCKS_WARNING_THRESHOLD, BURN_RATE_THRESHOLDS, CLAUDE_CONFIG_DIR_ENV, CLAUDE_PROJECTS_DIR_NAME, CONTEXT_LOW_THRESHOLD_ENV, CONTEXT_MEDIUM_THRESHOLD_ENV, DEBUG_MATCH_THRESHOLD_PERCENT, DEFAULT_CLAUDE_CODE_PATH, DEFAULT_CLAUDE_CONFIG_PATH, DEFAULT_CONTEXT_USAGE_THRESHOLDS, DEFAULT_RECENT_DAYS, DEFAULT_REFRESH_INTERVAL_SECONDS, MAX_REFRESH_INTERVAL_SECONDS, MCP_DEFAULT_PORT, MIN_REFRESH_INTERVAL_SECONDS, MIN_RENDER_INTERVAL_MS, PROJECT_ALIASES_ENV, PricingFetcher, USAGE_DATA_GLOB_PATTERN, USER_HOME_DIR, WEEK_DAYS, __commonJSMin, __require, __toESM, inspectError, isFailure, isPromise, isSuccess, map, pipe, require_usingCtx, succeed, try_ };
402
+ export { BLOCKS_COMPACT_WIDTH_THRESHOLD, BLOCKS_DEFAULT_TERMINAL_WIDTH, BLOCKS_WARNING_THRESHOLD, BURN_RATE_THRESHOLDS, CLAUDE_CONFIG_DIR_ENV, CLAUDE_PROJECTS_DIR_NAME, CONFIG_FILE_NAME, CONTEXT_LOW_THRESHOLD_ENV, CONTEXT_MEDIUM_THRESHOLD_ENV, DEBUG_MATCH_THRESHOLD_PERCENT, DEFAULT_CLAUDE_CODE_PATH, DEFAULT_CLAUDE_CONFIG_PATH, DEFAULT_CONTEXT_USAGE_THRESHOLDS, DEFAULT_RECENT_DAYS, DEFAULT_REFRESH_INTERVAL_SECONDS, MAX_REFRESH_INTERVAL_SECONDS, MCP_DEFAULT_PORT, MIN_REFRESH_INTERVAL_SECONDS, MIN_RENDER_INTERVAL_MS, PROJECT_ALIASES_ENV, PricingFetcher, USAGE_DATA_GLOB_PATTERN, USER_HOME_DIR, WEEK_DAYS, __commonJSMin, __require, __toESM, inspect, inspectError, isFailure, isPromise, isSuccess, map, pipe, require_usingCtx, succeed, try_ };
@@ -1,4 +1,4 @@
1
- import { PricingFetcher } from "./pricing-fetcher-D3tIkxxO.js";
1
+ import { PricingFetcher } from "./pricing-fetcher-CUQk_dDN.js";
2
2
  import "./_types-BbEk8t2a.js";
3
- import "./logger-yNFB24CE.js";
3
+ import "./logger-ClcgjXEW.js";
4
4
  export { PricingFetcher };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccusage",
3
- "version": "15.10.0",
3
+ "version": "16.0.0",
4
4
  "description": "Usage analysis tool for Claude Code",
5
5
  "homepage": "https://github.com/ryoppippi/ccusage#readme",
6
6
  "bugs": {
@@ -29,6 +29,7 @@
29
29
  "types": "./dist/index.d.ts",
30
30
  "bin": "./dist/index.js",
31
31
  "files": [
32
+ "config-schema.json",
32
33
  "dist"
33
34
  ],
34
35
  "engines": {