ccusage 16.2.1 → 16.2.3

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.
@@ -483,16 +483,6 @@
483
483
  "markdownDescription": "Number of sample discrepancies to show in debug output (default: 5)",
484
484
  "default": 5
485
485
  },
486
- "order": {
487
- "type": "string",
488
- "enum": [
489
- "desc",
490
- "asc"
491
- ],
492
- "description": "Sort order: desc (newest first) or asc (oldest first)",
493
- "markdownDescription": "Sort order: desc (newest first) or asc (oldest first)",
494
- "default": "asc"
495
- },
496
486
  "breakdown": {
497
487
  "type": "boolean",
498
488
  "description": "Show per-model cost breakdown",
@@ -1,7 +1,7 @@
1
- import { CLAUDE_CONFIG_DIR_ENV, CLAUDE_PROJECTS_DIR_NAME, DEFAULT_CLAUDE_CODE_PATH, DEFAULT_CLAUDE_CONFIG_PATH, DEFAULT_LOCALE, DEFAULT_RECENT_DAYS, PricingFetcher, USAGE_DATA_GLOB_PATTERN, USER_HOME_DIR, __commonJSMin, __require, __toESM, isFailure, isPromise, isSuccess, map, pipe, require_usingCtx, try_ } from "./pricing-fetcher-_ZIEzYHY.js";
1
+ import { CLAUDE_CONFIG_DIR_ENV, CLAUDE_PROJECTS_DIR_NAME, DEFAULT_CLAUDE_CODE_PATH, DEFAULT_CLAUDE_CONFIG_PATH, DEFAULT_LOCALE, DEFAULT_RECENT_DAYS, PricingFetcher, USAGE_DATA_GLOB_PATTERN, USER_HOME_DIR, __commonJSMin, __require, __toESM, isFailure, isPromise, isSuccess, map, pipe, require_usingCtx, try_ } from "./pricing-fetcher-2vtv5hE7.js";
2
2
  import { getTotalTokens } from "./_token-utils-WjkbrjKv.js";
3
3
  import { activityDateSchema, arrayType, booleanType, createBucket, createDailyDate, createMonthlyDate, createProjectPath, createSessionId, createWeeklyDate, dailyDateSchema, isoTimestampSchema, messageIdSchema, modelNameSchema, monthlyDateSchema, numberType, objectType, projectPathSchema, requestIdSchema, sessionIdSchema, stringType, unionType, versionSchema, weeklyDateSchema } from "./_types-DIdtMJ6V.js";
4
- import { logger } from "./logger-Cl0x4-O7.js";
4
+ import { logger } from "./logger-C2RpPo-E.js";
5
5
  import a, { readFile, stat } from "node:fs/promises";
6
6
  import path, { posix } from "node:path";
7
7
  import process$1 from "node:process";
@@ -1,6 +1,6 @@
1
- import "./pricing-fetcher-_ZIEzYHY.js";
1
+ import "./pricing-fetcher-2vtv5hE7.js";
2
2
  import "./_token-utils-WjkbrjKv.js";
3
3
  import "./_types-DIdtMJ6V.js";
4
- import { bucketUsageSchema, calculateContextTokens, calculateCostForEntry, createUniqueHash, dailyUsageSchema, extractProjectFromPath, getClaudePaths, getEarliestTimestamp, getUsageLimitResetTime, globUsageFiles, loadBucketUsageData, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, modelBreakdownSchema, monthlyUsageSchema, sessionUsageSchema, sortFilesByTimestamp, transcriptMessageSchema, transcriptUsageSchema, usageDataSchema, weeklyUsageSchema } from "./data-loader-DzuyD9Va.js";
5
- import "./logger-Cl0x4-O7.js";
4
+ import { bucketUsageSchema, calculateContextTokens, calculateCostForEntry, createUniqueHash, dailyUsageSchema, extractProjectFromPath, getClaudePaths, getEarliestTimestamp, getUsageLimitResetTime, globUsageFiles, loadBucketUsageData, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, modelBreakdownSchema, monthlyUsageSchema, sessionUsageSchema, sortFilesByTimestamp, transcriptMessageSchema, transcriptUsageSchema, usageDataSchema, weeklyUsageSchema } from "./data-loader-Brcu2FT2.js";
5
+ import "./logger-C2RpPo-E.js";
6
6
  export { bucketUsageSchema, calculateContextTokens, calculateCostForEntry, createUniqueHash, dailyUsageSchema, extractProjectFromPath, getClaudePaths, getEarliestTimestamp, getUsageLimitResetTime, globUsageFiles, loadBucketUsageData, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, modelBreakdownSchema, monthlyUsageSchema, sessionUsageSchema, sortFilesByTimestamp, transcriptMessageSchema, transcriptUsageSchema, usageDataSchema, weeklyUsageSchema };
@@ -1,6 +1,6 @@
1
- import { CLAUDE_PROJECTS_DIR_NAME, DEBUG_MATCH_THRESHOLD_PERCENT, PricingFetcher, USAGE_DATA_GLOB_PATTERN, __toESM, isFailure, require_usingCtx, try_ } from "./pricing-fetcher-_ZIEzYHY.js";
2
- import { getClaudePaths, glob, unwrap, usageDataSchema } from "./data-loader-DzuyD9Va.js";
3
- import { logger } from "./logger-Cl0x4-O7.js";
1
+ import { CLAUDE_PROJECTS_DIR_NAME, DEBUG_MATCH_THRESHOLD_PERCENT, PricingFetcher, USAGE_DATA_GLOB_PATTERN, __toESM, isFailure, require_usingCtx, try_ } from "./pricing-fetcher-2vtv5hE7.js";
2
+ import { getClaudePaths, glob, unwrap, usageDataSchema } from "./data-loader-Brcu2FT2.js";
3
+ import { logger } from "./logger-C2RpPo-E.js";
4
4
  import { readFile } from "node:fs/promises";
5
5
  import path from "node:path";
6
6
  var import_usingCtx = /* @__PURE__ */ __toESM(require_usingCtx(), 1);
package/dist/debug.js CHANGED
@@ -1,7 +1,7 @@
1
- import "./pricing-fetcher-_ZIEzYHY.js";
1
+ import "./pricing-fetcher-2vtv5hE7.js";
2
2
  import "./_token-utils-WjkbrjKv.js";
3
3
  import "./_types-DIdtMJ6V.js";
4
- import "./data-loader-DzuyD9Va.js";
5
- import "./logger-Cl0x4-O7.js";
6
- import { detectMismatches, printMismatchReport } from "./debug-CWK-ECNy.js";
4
+ import "./data-loader-Brcu2FT2.js";
5
+ import "./logger-C2RpPo-E.js";
6
+ import { detectMismatches, printMismatchReport } from "./debug-DusXel-O.js";
7
7
  export { detectMismatches, printMismatchReport };
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { BLOCKS_COMPACT_WIDTH_THRESHOLD, BLOCKS_DEFAULT_TERMINAL_WIDTH, BLOCKS_WARNING_THRESHOLD, BURN_RATE_THRESHOLDS, CONFIG_FILE_NAME, DEFAULT_CONTEXT_USAGE_THRESHOLDS, DEFAULT_LOCALE, DEFAULT_RECENT_DAYS, DEFAULT_REFRESH_INTERVAL_SECONDS, MAX_REFRESH_INTERVAL_SECONDS, MCP_DEFAULT_PORT, MIN_REFRESH_INTERVAL_SECONDS, MIN_RENDER_INTERVAL_MS, PricingFetcher, WEEK_DAYS, __commonJSMin, __require, __toESM, andThen, fail, inspect, inspectError, isFailure, isSuccess, map, pipe, require_usingCtx, succeed, try_ } from "./pricing-fetcher-_ZIEzYHY.js";
2
+ import { BLOCKS_COMPACT_WIDTH_THRESHOLD, BLOCKS_DEFAULT_TERMINAL_WIDTH, BLOCKS_WARNING_THRESHOLD, BURN_RATE_THRESHOLDS, CONFIG_FILE_NAME, DEFAULT_CONTEXT_USAGE_THRESHOLDS, DEFAULT_LOCALE, DEFAULT_RECENT_DAYS, DEFAULT_REFRESH_INTERVAL_SECONDS, MAX_REFRESH_INTERVAL_SECONDS, MCP_DEFAULT_PORT, MIN_REFRESH_INTERVAL_SECONDS, MIN_RENDER_INTERVAL_MS, PricingFetcher, WEEK_DAYS, __commonJSMin, __require, __toESM, andThen, fail, inspect, inspectError, isFailure, isSuccess, map, pipe, require_usingCtx, succeed, try_ } from "./pricing-fetcher-2vtv5hE7.js";
3
3
  import { getTotalTokens } from "./_token-utils-WjkbrjKv.js";
4
4
  import { CostModes, SortOrders, coerce, filterDateSchema, statuslineHookJsonSchema } from "./_types-DIdtMJ6V.js";
5
5
  import { calculateTotals, createTotalsObject } from "./calculate-cost-BDqO4yWA.js";
6
- import { DEFAULT_SESSION_DURATION_HOURS, calculateBurnRate, calculateContextTokens, calculateCostForEntry, createUniqueHash, filterRecentBlocks, formatDateCompact, getClaudePaths, getEarliestTimestamp, getFileModifiedTime, getUsageLimitResetTime, globUsageFiles, identifySessionBlocks, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, projectBlockUsage, sortFilesByTimestamp, toArray, uniq, unreachable, unwrap, usageDataSchema } from "./data-loader-DzuyD9Va.js";
7
- import { description, log, logger, name, version } from "./logger-Cl0x4-O7.js";
8
- import { detectMismatches, printMismatchReport } from "./debug-CWK-ECNy.js";
9
- import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-CzT8_3kj.js";
6
+ import { DEFAULT_SESSION_DURATION_HOURS, calculateBurnRate, calculateContextTokens, calculateCostForEntry, createUniqueHash, filterRecentBlocks, formatDateCompact, getClaudePaths, getEarliestTimestamp, getFileModifiedTime, getUsageLimitResetTime, globUsageFiles, identifySessionBlocks, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, projectBlockUsage, sortFilesByTimestamp, toArray, uniq, unreachable, unwrap, usageDataSchema } from "./data-loader-Brcu2FT2.js";
7
+ import { description, log, logger, name, version } from "./logger-C2RpPo-E.js";
8
+ import { detectMismatches, printMismatchReport } from "./debug-DusXel-O.js";
9
+ import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-DnYYAmTW.js";
10
10
  import a, { readFile, stat } from "node:fs/promises";
11
11
  import path, { join } from "node:path";
12
12
  import process$1 from "node:process";
@@ -138,7 +138,7 @@ var DefaultTranslation = class {
138
138
  translate(locale, key, values = create()) {
139
139
  let message = this.getMessage(locale, key);
140
140
  if (message === void 0 && locale !== this.#options.fallbackLocale) message = this.getMessage(this.#options.fallbackLocale, key);
141
- if (message !== void 0) return message.replaceAll(/\{\{(\w+)\}\}/g, (_, name$1) => {
141
+ if (message !== void 0) return message.replaceAll(/\{\{(\w+)\}\}/g, (_$1, name$1) => {
142
142
  return values[name$1] == null ? "" : values[name$1].toString();
143
143
  });
144
144
  }
@@ -351,7 +351,7 @@ function resolveDisplayValue(ctx, key) {
351
351
  return "";
352
352
  }
353
353
  async function generateOptionalArgsUsage(ctx, optionsPairs) {
354
- const optionsMaxLength = Math.max(...Object.entries(optionsPairs).map(([_, value$1]) => value$1.length)), optionSchemaMaxLength = ctx.env.usageOptionType ? Math.max(...Object.entries(optionsPairs).map(([key]) => resolveNegatableType(key, ctx).length)) : 0, usages = await Promise.all(Object.entries(optionsPairs).map(([key, value$1]) => {
354
+ const optionsMaxLength = Math.max(...Object.entries(optionsPairs).map(([_$1, value$1]) => value$1.length)), optionSchemaMaxLength = ctx.env.usageOptionType ? Math.max(...Object.entries(optionsPairs).map(([key]) => resolveNegatableType(key, ctx).length)) : 0, usages = await Promise.all(Object.entries(optionsPairs).map(([key, value$1]) => {
355
355
  let rawDesc = ctx.translate(resolveArgKey(key));
356
356
  if (!rawDesc && key.startsWith("no-")) {
357
357
  const name$1 = resolveNegatableKey(key), schema = ctx.args[name$1], optionKey = makeShortLongOptionPair(schema, name$1, ctx.toKebab);
@@ -363,7 +363,7 @@ async function generateOptionalArgsUsage(ctx, optionsPairs) {
363
363
  return usages.join("\n");
364
364
  }
365
365
  function getPositionalArgs(ctx) {
366
- return Object.entries(ctx.args).filter(([_, schema]) => schema.type === "positional");
366
+ return Object.entries(ctx.args).filter(([_$1, schema]) => schema.type === "positional");
367
367
  }
368
368
  async function generatePositionalArgsUsage(ctx) {
369
369
  const positionals = getPositionalArgs(ctx), argsMaxLength = Math.max(...positionals.map(([name$1]) => name$1.length)), usages = await Promise.all(positionals.map(([name$1]) => {
@@ -2497,7 +2497,7 @@ var ResponsiveTable = class {
2497
2497
  };
2498
2498
  }
2499
2499
  getCompactIndices() {
2500
- return this.compactHead == null || !this.compactMode ? Array.from({ length: this.head.length }, (_, i) => i) : this.compactHead.map((compactHeader) => {
2500
+ return this.compactHead == null || !this.compactMode ? Array.from({ length: this.head.length }, (_$1, i) => i) : this.compactHead.map((compactHeader) => {
2501
2501
  const index = this.head.indexOf(compactHeader);
2502
2502
  return index < 0 ? (logger.warn(`Warning: Compact header "${compactHeader}" not found in table headers [${this.head.join(", ")}]. Using first column as fallback.`), 0) : index;
2503
2503
  });
@@ -2510,7 +2510,7 @@ var ResponsiveTable = class {
2510
2510
  this.compactMode = this.forceCompact || terminalWidth < this.compactThreshold && this.compactHead != null;
2511
2511
  const { head, colAligns } = this.getCurrentTableConfig(), compactIndices = this.getCompactIndices(), dataRows = this.rows.filter((row) => !this.isSeparatorRow(row)), processedDataRows = this.compactMode ? dataRows.map((row) => this.filterRowToCompact(row, compactIndices)) : dataRows, allRows = [head.map(String), ...processedDataRows.map((row) => row.map((cell) => {
2512
2512
  return typeof cell === "object" && cell != null && "content" in cell ? String(cell.content) : String(cell ?? "");
2513
- }))], contentWidths = head.map((_, colIndex) => {
2513
+ }))], contentWidths = head.map((_$1, colIndex) => {
2514
2514
  const maxLength = Math.max(...allRows.map((row) => stringWidth(String(row[colIndex] ?? ""))));
2515
2515
  return maxLength;
2516
2516
  }), numColumns = head.length, tableOverhead = 3 * numColumns + 1, availableWidth = terminalWidth - tableOverhead, columnWidths = contentWidths.map((width, index) => {
@@ -3266,8 +3266,8 @@ async function startLiveMonitoring(config) {
3266
3266
  const errorMessage = error instanceof Error ? error.message : String(error);
3267
3267
  terminal.startBuffering(), terminal.clearScreen(), terminal.write(import_picocolors$3.default.red(`Error: ${errorMessage}\n`)), terminal.flush(), logger.error(`Live monitoring error: ${errorMessage}`), await delayWithAbort(config.refreshInterval, abortController.signal).catch(() => {});
3268
3268
  }
3269
- } catch (_) {
3270
- _usingCtx.e = _;
3269
+ } catch (_$1) {
3270
+ _usingCtx.e = _$1;
3271
3271
  } finally {
3272
3272
  _usingCtx.d();
3273
3273
  }
@@ -4270,12 +4270,12 @@ function calculateSessionTotalTokens(entries) {
4270
4270
  return sum + usage.input_tokens + usage.output_tokens + (usage.cache_creation_input_tokens ?? 0) + (usage.cache_read_input_tokens ?? 0);
4271
4271
  }, 0);
4272
4272
  }
4273
- const sessionCommand = define({
4273
+ const { order: _,...sharedArgs$1 } = sharedCommandConfig.args, sessionCommand = define({
4274
4274
  name: "session",
4275
4275
  description: "Show usage report grouped by conversation session",
4276
4276
  ...sharedCommandConfig,
4277
4277
  args: {
4278
- ...sharedCommandConfig.args,
4278
+ ...sharedArgs$1,
4279
4279
  id: {
4280
4280
  type: "string",
4281
4281
  short: "i",
@@ -4298,7 +4298,6 @@ const sessionCommand = define({
4298
4298
  since: ctx.values.since,
4299
4299
  until: ctx.values.until,
4300
4300
  mode: ctx.values.mode,
4301
- order: ctx.values.order,
4302
4301
  offline: ctx.values.offline,
4303
4302
  timezone: ctx.values.timezone,
4304
4303
  locale: ctx.values.locale
@@ -5273,7 +5272,7 @@ const visualBurnRateChoices = [
5273
5272
  choices: visualBurnRateChoices,
5274
5273
  description: "Controls the visualization of the burn rate status",
5275
5274
  default: "off",
5276
- short: "vb",
5275
+ short: "B",
5277
5276
  negatable: false,
5278
5277
  toKebab: true
5279
5278
  },
@@ -5357,8 +5356,8 @@ const visualBurnRateChoices = [
5357
5356
  pid: currentPid
5358
5357
  };
5359
5358
  }
5360
- } catch (_) {
5361
- _usingCtx.e = _;
5359
+ } catch (_$1) {
5360
+ _usingCtx.e = _$1;
5362
5361
  } finally {
5363
5362
  _usingCtx.d();
5364
5363
  }
@@ -5488,8 +5487,8 @@ const visualBurnRateChoices = [
5488
5487
  pid: void 0
5489
5488
  };
5490
5489
  return;
5491
- } catch (_) {
5492
- _usingCtx3.e = _;
5490
+ } catch (_$1) {
5491
+ _usingCtx3.e = _$1;
5493
5492
  } finally {
5494
5493
  _usingCtx3.d();
5495
5494
  }
@@ -5500,8 +5499,8 @@ const visualBurnRateChoices = [
5500
5499
  if (logger.error("Error in statusline command:", mainProcessingResult.error), !mergedOptions.cache) return;
5501
5500
  const semaphore = _usingCtx4.u(getSemaphore(sessionId));
5502
5501
  if (semaphore.data != null) semaphore.data.isUpdating = false, semaphore.data.pid = void 0;
5503
- } catch (_) {
5504
- _usingCtx4.e = _;
5502
+ } catch (_$1) {
5503
+ _usingCtx4.e = _$1;
5505
5504
  } finally {
5506
5505
  _usingCtx4.d();
5507
5506
  }
@@ -761,7 +761,7 @@ function _getDefaultLogLevel() {
761
761
  return g ? LogLevels.debug : R ? LogLevels.warn : LogLevels.info;
762
762
  }
763
763
  const consola = createConsola$1();
764
- var name = "ccusage", version = "16.2.1", description = "Usage analysis tool for Claude Code";
764
+ var name = "ccusage", version = "16.2.3", description = "Usage analysis tool for Claude Code";
765
765
  const logger = consola.withTag(name);
766
766
  if (process$1.env.LOG_LEVEL != null) {
767
767
  const level = Number.parseInt(process$1.env.LOG_LEVEL, 10);
package/dist/logger.js CHANGED
@@ -1,2 +1,2 @@
1
- import { log, logger } from "./logger-Cl0x4-O7.js";
1
+ import { log, logger } from "./logger-C2RpPo-E.js";
2
2
  export { log, logger };
@@ -1,9 +1,9 @@
1
- import { DEFAULT_LOCALE, __commonJSMin, __toESM, require_usingCtx } from "./pricing-fetcher-_ZIEzYHY.js";
1
+ import { DEFAULT_LOCALE, __commonJSMin, __toESM, require_usingCtx } from "./pricing-fetcher-2vtv5hE7.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-DIdtMJ6V.js";
4
4
  import { calculateTotals, createTotalsObject } from "./calculate-cost-BDqO4yWA.js";
5
- import { getClaudePaths, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData } from "./data-loader-DzuyD9Va.js";
6
- import { name, version } from "./logger-Cl0x4-O7.js";
5
+ import { getClaudePaths, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData } from "./data-loader-Brcu2FT2.js";
6
+ import { name, version } from "./logger-C2RpPo-E.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,
package/dist/mcp.js CHANGED
@@ -1,8 +1,8 @@
1
- import "./pricing-fetcher-_ZIEzYHY.js";
1
+ import "./pricing-fetcher-2vtv5hE7.js";
2
2
  import "./_token-utils-WjkbrjKv.js";
3
3
  import "./_types-DIdtMJ6V.js";
4
4
  import "./calculate-cost-BDqO4yWA.js";
5
- import "./data-loader-DzuyD9Va.js";
6
- import "./logger-Cl0x4-O7.js";
7
- import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-CzT8_3kj.js";
5
+ import "./data-loader-Brcu2FT2.js";
6
+ import "./logger-C2RpPo-E.js";
7
+ import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-DnYYAmTW.js";
8
8
  export { createMcpHttpApp, createMcpServer, startMcpServerStdio };
@@ -1,5 +1,5 @@
1
1
  import { modelPricingSchema } from "./_types-DIdtMJ6V.js";
2
- import { logger } from "./logger-Cl0x4-O7.js";
2
+ import { logger } from "./logger-C2RpPo-E.js";
3
3
  import { createRequire } from "node:module";
4
4
  import path from "node:path";
5
5
  import F, { homedir } from "node:os";
@@ -1,4 +1,4 @@
1
- import { PricingFetcher } from "./pricing-fetcher-_ZIEzYHY.js";
1
+ import { PricingFetcher } from "./pricing-fetcher-2vtv5hE7.js";
2
2
  import "./_types-DIdtMJ6V.js";
3
- import "./logger-Cl0x4-O7.js";
3
+ import "./logger-C2RpPo-E.js";
4
4
  export { PricingFetcher };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccusage",
3
- "version": "16.2.1",
3
+ "version": "16.2.3",
4
4
  "description": "Usage analysis tool for Claude Code",
5
5
  "homepage": "https://github.com/ryoppippi/ccusage#readme",
6
6
  "bugs": {