ccusage 15.9.9 → 15.10.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 CHANGED
@@ -71,6 +71,10 @@ ccusage daily --locale ja-JP # Use Japanese locale for date/time formatting
71
71
  ccusage daily --instances # Group by project/instance
72
72
  ccusage daily --project myproject # Filter to specific project
73
73
  ccusage daily --instances --project myproject --json # Combined usage
74
+
75
+ # Compact mode for screenshots/sharing
76
+ ccusage --compact # Force compact table mode
77
+ ccusage monthly --compact # Compact monthly report
74
78
  ```
75
79
 
76
80
  ## Features
@@ -87,6 +91,7 @@ ccusage daily --instances --project myproject --json # Combined usage
87
91
  - 📁 **Custom Path**: Support for custom Claude data directory locations
88
92
  - 🎨 **Beautiful Output**: Colorful table-formatted display with automatic responsive layout
89
93
  - 📱 **Smart Tables**: Automatic compact mode for narrow terminals (< 100 characters) with essential columns
94
+ - 📸 **Compact Mode**: Use `--compact` flag to force compact table layout, perfect for screenshots and sharing
90
95
  - 📋 **Enhanced Model Display**: Model names shown as bulleted lists for better readability
91
96
  - 📄 **JSON Output**: Export data in structured JSON format with `--json`
92
97
  - 💰 **Cost Tracking**: Shows costs in USD for each day/month/session
@@ -1,7 +1,7 @@
1
- import { CLAUDE_CONFIG_DIR_ENV, CLAUDE_PROJECTS_DIR_NAME, CONTEXT_LOW_THRESHOLD_ENV, CONTEXT_MEDIUM_THRESHOLD_ENV, DEFAULT_CLAUDE_CODE_PATH, DEFAULT_CLAUDE_CONFIG_PATH, DEFAULT_CONTEXT_USAGE_THRESHOLDS, DEFAULT_RECENT_DAYS, PricingFetcher, USAGE_DATA_GLOB_PATTERN, USER_HOME_DIR, __commonJSMin, __require, __toESM, isFailure, isPromise, isSuccess, require_usingCtx } from "./pricing-fetcher-CbLCyFQr.js";
1
+ import { CLAUDE_CONFIG_DIR_ENV, CLAUDE_PROJECTS_DIR_NAME, CONTEXT_LOW_THRESHOLD_ENV, CONTEXT_MEDIUM_THRESHOLD_ENV, DEFAULT_CLAUDE_CODE_PATH, DEFAULT_CLAUDE_CONFIG_PATH, DEFAULT_CONTEXT_USAGE_THRESHOLDS, DEFAULT_RECENT_DAYS, PricingFetcher, USAGE_DATA_GLOB_PATTERN, USER_HOME_DIR, __commonJSMin, __require, __toESM, isFailure, isPromise, isSuccess, require_usingCtx } from "./pricing-fetcher-D3tIkxxO.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-BbEk8t2a.js";
4
- import { logger } from "./logger-m79TqYfY.js";
4
+ import { logger } from "./logger-yNFB24CE.js";
5
5
  import a, { readFile } 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-CbLCyFQr.js";
1
+ import "./pricing-fetcher-D3tIkxxO.js";
2
2
  import "./_token-utils-WjkbrjKv.js";
3
3
  import "./_types-BbEk8t2a.js";
4
- import { bucketUsageSchema, calculateContextTokens, calculateCostForEntry, createUniqueHash, dailyUsageSchema, extractProjectFromPath, formatDate, formatDateCompact, getClaudePaths, getContextUsageThresholds, getEarliestTimestamp, getUsageLimitResetTime, globUsageFiles, loadBucketUsageData, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, modelBreakdownSchema, monthlyUsageSchema, sessionUsageSchema, sortFilesByTimestamp, transcriptMessageSchema, transcriptUsageSchema, usageDataSchema, weeklyUsageSchema } from "./data-loader-CM8RKePp.js";
5
- import "./logger-m79TqYfY.js";
4
+ import { bucketUsageSchema, calculateContextTokens, calculateCostForEntry, createUniqueHash, dailyUsageSchema, extractProjectFromPath, formatDate, formatDateCompact, getClaudePaths, getContextUsageThresholds, getEarliestTimestamp, getUsageLimitResetTime, globUsageFiles, loadBucketUsageData, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, modelBreakdownSchema, monthlyUsageSchema, sessionUsageSchema, sortFilesByTimestamp, transcriptMessageSchema, transcriptUsageSchema, usageDataSchema, weeklyUsageSchema } from "./data-loader-Dhwqb-FE.js";
5
+ import "./logger-yNFB24CE.js";
6
6
  export { bucketUsageSchema, calculateContextTokens, calculateCostForEntry, createUniqueHash, dailyUsageSchema, extractProjectFromPath, formatDate, formatDateCompact, getClaudePaths, getContextUsageThresholds, 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-CbLCyFQr.js";
2
- import { getClaudePaths, glob, unwrap, usageDataSchema } from "./data-loader-CM8RKePp.js";
3
- import { logger } from "./logger-m79TqYfY.js";
1
+ import { CLAUDE_PROJECTS_DIR_NAME, DEBUG_MATCH_THRESHOLD_PERCENT, PricingFetcher, USAGE_DATA_GLOB_PATTERN, __toESM, isFailure, require_usingCtx, try_ } from "./pricing-fetcher-D3tIkxxO.js";
2
+ import { getClaudePaths, glob, unwrap, usageDataSchema } from "./data-loader-Dhwqb-FE.js";
3
+ import { logger } from "./logger-yNFB24CE.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-CbLCyFQr.js";
1
+ import "./pricing-fetcher-D3tIkxxO.js";
2
2
  import "./_token-utils-WjkbrjKv.js";
3
3
  import "./_types-BbEk8t2a.js";
4
- import "./data-loader-CM8RKePp.js";
5
- import "./logger-m79TqYfY.js";
6
- import { detectMismatches, printMismatchReport } from "./debug-D5u7ZVKi.js";
4
+ import "./data-loader-Dhwqb-FE.js";
5
+ import "./logger-yNFB24CE.js";
6
+ import { detectMismatches, printMismatchReport } from "./debug-DseOsUbb.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, 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, WEEK_DAYS, __commonJSMin, __require, __toESM, inspectError, isFailure, isSuccess, map, pipe, require_usingCtx, succeed, try_ } from "./pricing-fetcher-CbLCyFQr.js";
2
+ import { BLOCKS_COMPACT_WIDTH_THRESHOLD, BLOCKS_DEFAULT_TERMINAL_WIDTH, BLOCKS_WARNING_THRESHOLD, BURN_RATE_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, WEEK_DAYS, __commonJSMin, __require, __toESM, inspectError, isFailure, isSuccess, map, pipe, require_usingCtx, succeed, try_ } from "./pricing-fetcher-D3tIkxxO.js";
3
3
  import { getTotalTokens } from "./_token-utils-WjkbrjKv.js";
4
4
  import { CostModes, SortOrders, filterDateSchema, statuslineHookJsonSchema } from "./_types-BbEk8t2a.js";
5
5
  import { calculateTotals, createTotalsObject } from "./calculate-cost-BDqO4yWA.js";
6
- import { DEFAULT_SESSION_DURATION_HOURS, calculateBurnRate, calculateContextTokens, calculateCostForEntry, createUniqueHash, filterRecentBlocks, formatDateCompact, getClaudePaths, getContextUsageThresholds, getEarliestTimestamp, getUsageLimitResetTime, globUsageFiles, identifySessionBlocks, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, projectBlockUsage, sortFilesByTimestamp, uniq, unwrap, usageDataSchema } from "./data-loader-CM8RKePp.js";
7
- import { description, log, logger, name, version } from "./logger-m79TqYfY.js";
8
- import { detectMismatches, printMismatchReport } from "./debug-D5u7ZVKi.js";
9
- import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-r529IhIF.js";
6
+ import { DEFAULT_SESSION_DURATION_HOURS, calculateBurnRate, calculateContextTokens, calculateCostForEntry, createUniqueHash, filterRecentBlocks, formatDateCompact, getClaudePaths, getContextUsageThresholds, getEarliestTimestamp, getUsageLimitResetTime, globUsageFiles, identifySessionBlocks, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData, loadSessionUsageById, loadWeeklyUsageData, projectBlockUsage, sortFilesByTimestamp, uniq, unwrap, usageDataSchema } from "./data-loader-Dhwqb-FE.js";
7
+ import { description, log, logger, name, version } from "./logger-yNFB24CE.js";
8
+ import { detectMismatches, printMismatchReport } from "./debug-DseOsUbb.js";
9
+ import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-Cfnsg0lJ.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";
@@ -1076,6 +1076,11 @@ const sharedArgs = {
1076
1076
  type: "string",
1077
1077
  short: "q",
1078
1078
  description: "Process JSON output with jq command (requires jq binary, implies --json)"
1079
+ },
1080
+ compact: {
1081
+ type: "boolean",
1082
+ description: "Force compact mode for narrow displays (better for screenshots)",
1083
+ default: false
1079
1084
  }
1080
1085
  }, sharedCommandConfig = {
1081
1086
  args: sharedArgs,
@@ -2381,8 +2386,9 @@ var import_usingCtx$2 = /* @__PURE__ */ __toESM(require_usingCtx(), 1), Responsi
2381
2386
  compactColAligns;
2382
2387
  compactThreshold;
2383
2388
  compactMode = false;
2389
+ forceCompact;
2384
2390
  constructor(options) {
2385
- this.head = options.head, this.colAligns = options.colAligns ?? Array.from({ length: this.head.length }, () => "left"), this.style = options.style, this.dateFormatter = options.dateFormatter, this.compactHead = options.compactHead, this.compactColAligns = options.compactColAligns, this.compactThreshold = options.compactThreshold ?? 100;
2391
+ this.head = options.head, this.colAligns = options.colAligns ?? Array.from({ length: this.head.length }, () => "left"), this.style = options.style, this.dateFormatter = options.dateFormatter, this.compactHead = options.compactHead, this.compactColAligns = options.compactColAligns, this.compactThreshold = options.compactThreshold ?? 100, this.forceCompact = options.forceCompact ?? false;
2386
2392
  }
2387
2393
  push(row) {
2388
2394
  this.rows.push(row);
@@ -2410,7 +2416,7 @@ var import_usingCtx$2 = /* @__PURE__ */ __toESM(require_usingCtx(), 1), Responsi
2410
2416
  }
2411
2417
  toString() {
2412
2418
  const terminalWidth = Number.parseInt(process$1.env.COLUMNS ?? "", 10) || process$1.stdout.columns || 120;
2413
- this.compactMode = terminalWidth < this.compactThreshold && this.compactHead != null;
2419
+ this.compactMode = this.forceCompact || terminalWidth < this.compactThreshold && this.compactHead != null;
2414
2420
  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) => {
2415
2421
  return typeof cell === "object" && cell != null && "content" in cell ? String(cell.content) : String(cell ?? "");
2416
2422
  }))], contentWidths = head.map((_, colIndex) => {
@@ -3192,7 +3198,7 @@ const blocksCommand = define({
3192
3198
  head: tableHeaders,
3193
3199
  style: { head: ["cyan"] },
3194
3200
  colAligns: tableAligns
3195
- }), terminalWidth = process$1.stdout.columns || BLOCKS_DEFAULT_TERMINAL_WIDTH, useCompactFormat = terminalWidth < BLOCKS_COMPACT_WIDTH_THRESHOLD;
3201
+ }), terminalWidth = process$1.stdout.columns || BLOCKS_DEFAULT_TERMINAL_WIDTH, isNarrowTerminal = terminalWidth < BLOCKS_COMPACT_WIDTH_THRESHOLD, useCompactFormat = ctx.values.compact || isNarrowTerminal;
3196
3202
  for (const block of blocks) if (block.isGap ?? false) {
3197
3203
  const gapRow = [
3198
3204
  import_picocolors$5.default.gray(formatBlockTime(block, useCompactFormat, ctx.values.locale)),
@@ -3434,7 +3440,8 @@ const dailyCommand = define({
3434
3440
  "right",
3435
3441
  "right"
3436
3442
  ],
3437
- compactThreshold: 100
3443
+ compactThreshold: 100,
3444
+ forceCompact: ctx.values.compact
3438
3445
  });
3439
3446
  if (ctx.values.instances && dailyData.some((d) => d.project != null)) {
3440
3447
  const projectGroups = groupDataByProject(dailyData);
@@ -3985,7 +3992,8 @@ const monthlyCommand = define({
3985
3992
  "right",
3986
3993
  "right"
3987
3994
  ],
3988
- compactThreshold: 100
3995
+ compactThreshold: 100,
3996
+ forceCompact: ctx.values.compact
3989
3997
  });
3990
3998
  for (const data of monthlyData) if (table.push([
3991
3999
  data.month,
@@ -4202,7 +4210,8 @@ const sessionCommand = define({
4202
4210
  "right",
4203
4211
  "left"
4204
4212
  ],
4205
- compactThreshold: 100
4213
+ compactThreshold: 100,
4214
+ forceCompact: ctx.values.compact
4206
4215
  });
4207
4216
  let maxSessionLength = 0;
4208
4217
  for (const data of sessionData) {
@@ -5403,7 +5412,8 @@ const weeklyCommand = define({
5403
5412
  "right",
5404
5413
  "right"
5405
5414
  ],
5406
- compactThreshold: 100
5415
+ compactThreshold: 100,
5416
+ forceCompact: ctx.values.compact
5407
5417
  });
5408
5418
  for (const data of weeklyData) if (table.push([
5409
5419
  data.week,
@@ -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 = "15.9.9", description = "Usage analysis tool for Claude Code";
764
+ var name = "ccusage", version = "15.10.0", 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-m79TqYfY.js";
1
+ import { log, logger } from "./logger-yNFB24CE.js";
2
2
  export { log, logger };
@@ -1,9 +1,9 @@
1
- import { __commonJSMin, __toESM, require_usingCtx } from "./pricing-fetcher-CbLCyFQr.js";
1
+ import { __commonJSMin, __toESM, require_usingCtx } from "./pricing-fetcher-D3tIkxxO.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-CM8RKePp.js";
6
- import { name, version } from "./logger-m79TqYfY.js";
5
+ import { getClaudePaths, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData } from "./data-loader-Dhwqb-FE.js";
6
+ import { name, version } from "./logger-yNFB24CE.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-CbLCyFQr.js";
1
+ import "./pricing-fetcher-D3tIkxxO.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-CM8RKePp.js";
6
- import "./logger-m79TqYfY.js";
7
- import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-r529IhIF.js";
5
+ import "./data-loader-Dhwqb-FE.js";
6
+ import "./logger-yNFB24CE.js";
7
+ import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-Cfnsg0lJ.js";
8
8
  export { createMcpHttpApp, createMcpServer, startMcpServerStdio };
@@ -1,5 +1,5 @@
1
1
  import { modelPricingSchema } from "./_types-BbEk8t2a.js";
2
- import { logger } from "./logger-m79TqYfY.js";
2
+ import { logger } from "./logger-yNFB24CE.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-CbLCyFQr.js";
1
+ import { PricingFetcher } from "./pricing-fetcher-D3tIkxxO.js";
2
2
  import "./_types-BbEk8t2a.js";
3
- import "./logger-m79TqYfY.js";
3
+ import "./logger-yNFB24CE.js";
4
4
  export { PricingFetcher };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccusage",
3
- "version": "15.9.9",
3
+ "version": "15.10.0",
4
4
  "description": "Usage analysis tool for Claude Code",
5
5
  "homepage": "https://github.com/ryoppippi/ccusage#readme",
6
6
  "bugs": {