ccusage 16.2.4 → 16.2.5
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 +0 -10
- package/dist/{data-loader-DV25VhPk.js → data-loader-abvRdQYo.js} +2 -2
- package/dist/data-loader.js +3 -3
- package/dist/{debug-CWd5mOJK.js → debug-CkCfHFil.js} +3 -3
- package/dist/debug.js +4 -4
- package/dist/index.js +17 -12
- package/dist/{logger-Df86rWXR.js → logger-wHijzbnK.js} +1 -1
- package/dist/logger.js +1 -1
- package/dist/{mcp-CEW0jW3t.js → mcp-Dz21qUWi.js} +3 -3
- package/dist/mcp.js +4 -4
- package/dist/{pricing-fetcher-COuXYEih.js → pricing-fetcher-BtUY4dRM.js} +1 -1
- package/dist/pricing-fetcher.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -127,16 +127,6 @@ Check out [ccusage: The Claude Code cost scorecard that went viral](https://www.
|
|
|
127
127
|
</a>
|
|
128
128
|
</p>
|
|
129
129
|
|
|
130
|
-
## Claude Code Resources
|
|
131
|
-
|
|
132
|
-
[`ClaudeLog`](https://claudelog.com) by [InventorBlack](https://www.reddit.com/user/inventor_black/)
|
|
133
|
-
A comprehensive knowledge base with detailed breakdowns of advanced topics, including:
|
|
134
|
-
|
|
135
|
-
- Advanced [mechanics](https://claudelog.com/mechanics/you-are-the-main-thread/) and [CLAUDE.md best practices](https://claudelog.com/mechanics/claude-md-supremacy).
|
|
136
|
-
- Practical technique guides for [plan mode](https://claudelog.com/mechanics/plan-mode), [ultrathink](https://claudelog.com/faqs/what-is-ultrathink/), and [sub-agents](https://claudelog.com/mechanics/task-agent-tools/).
|
|
137
|
-
- Concepts like [agent-first design](https://claudelog.com/mechanics/agent-first-design/), [agent engineering](https://claudelog.com/mechanics/agent-engineering/), and [humanizing agents](https://claudelog.com/mechanics/humanising-agents/).
|
|
138
|
-
- [Configuration guides](https://claudelog.com/configuration).
|
|
139
|
-
|
|
140
130
|
## Star History
|
|
141
131
|
|
|
142
132
|
<a href="https://www.star-history.com/#ryoppippi/ccusage&Date">
|
|
@@ -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-
|
|
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-BtUY4dRM.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-
|
|
4
|
+
import { logger } from "./logger-wHijzbnK.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";
|
package/dist/data-loader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./pricing-fetcher-
|
|
1
|
+
import "./pricing-fetcher-BtUY4dRM.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-
|
|
5
|
-
import "./logger-
|
|
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-abvRdQYo.js";
|
|
5
|
+
import "./logger-wHijzbnK.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-
|
|
2
|
-
import { getClaudePaths, glob, unwrap, usageDataSchema } from "./data-loader-
|
|
3
|
-
import { logger } from "./logger-
|
|
1
|
+
import { CLAUDE_PROJECTS_DIR_NAME, DEBUG_MATCH_THRESHOLD_PERCENT, PricingFetcher, USAGE_DATA_GLOB_PATTERN, __toESM, isFailure, require_usingCtx, try_ } from "./pricing-fetcher-BtUY4dRM.js";
|
|
2
|
+
import { getClaudePaths, glob, unwrap, usageDataSchema } from "./data-loader-abvRdQYo.js";
|
|
3
|
+
import { logger } from "./logger-wHijzbnK.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-
|
|
1
|
+
import "./pricing-fetcher-BtUY4dRM.js";
|
|
2
2
|
import "./_token-utils-WjkbrjKv.js";
|
|
3
3
|
import "./_types-DIdtMJ6V.js";
|
|
4
|
-
import "./data-loader-
|
|
5
|
-
import "./logger-
|
|
6
|
-
import { detectMismatches, printMismatchReport } from "./debug-
|
|
4
|
+
import "./data-loader-abvRdQYo.js";
|
|
5
|
+
import "./logger-wHijzbnK.js";
|
|
6
|
+
import { detectMismatches, printMismatchReport } from "./debug-CkCfHFil.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-
|
|
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-BtUY4dRM.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-
|
|
7
|
-
import { description, log, logger, name, version } from "./logger-
|
|
8
|
-
import { detectMismatches, printMismatchReport } from "./debug-
|
|
9
|
-
import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-
|
|
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-abvRdQYo.js";
|
|
7
|
+
import { description, log, logger, name, version } from "./logger-wHijzbnK.js";
|
|
8
|
+
import { detectMismatches, printMismatchReport } from "./debug-CkCfHFil.js";
|
|
9
|
+
import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-Dz21qUWi.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";
|
|
@@ -2478,8 +2478,9 @@ var ResponsiveTable = class {
|
|
|
2478
2478
|
compactThreshold;
|
|
2479
2479
|
compactMode = false;
|
|
2480
2480
|
forceCompact;
|
|
2481
|
+
logger;
|
|
2481
2482
|
constructor(options) {
|
|
2482
|
-
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;
|
|
2483
|
+
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, this.logger = options.logger ?? logger.warn;
|
|
2483
2484
|
}
|
|
2484
2485
|
push(row) {
|
|
2485
2486
|
this.rows.push(row);
|
|
@@ -2499,7 +2500,7 @@ var ResponsiveTable = class {
|
|
|
2499
2500
|
getCompactIndices() {
|
|
2500
2501
|
return this.compactHead == null || !this.compactMode ? Array.from({ length: this.head.length }, (_$1, i) => i) : this.compactHead.map((compactHeader) => {
|
|
2501
2502
|
const index = this.head.indexOf(compactHeader);
|
|
2502
|
-
return index < 0 ? (logger
|
|
2503
|
+
return index < 0 ? (this.logger(`Warning: Compact header "${compactHeader}" not found in table headers [${this.head.join(", ")}]. Using first column as fallback.`), 0) : index;
|
|
2503
2504
|
});
|
|
2504
2505
|
}
|
|
2505
2506
|
isCompactMode() {
|
|
@@ -3746,15 +3747,17 @@ var RequestError = class extends Error {
|
|
|
3746
3747
|
if (typeof options?.body?.getReader !== "undefined") options.duplex ??= "half";
|
|
3747
3748
|
super(input, options);
|
|
3748
3749
|
}
|
|
3749
|
-
},
|
|
3750
|
+
}, newHeadersFromIncoming = (incoming) => {
|
|
3750
3751
|
const headerRecord = [], rawHeaders = incoming.rawHeaders;
|
|
3751
3752
|
for (let i = 0; i < rawHeaders.length; i += 2) {
|
|
3752
3753
|
const { [i]: key, [i + 1]: value$1 } = rawHeaders;
|
|
3753
3754
|
if (key.charCodeAt(0) !== 58) headerRecord.push([key, value$1]);
|
|
3754
3755
|
}
|
|
3756
|
+
return new Headers(headerRecord);
|
|
3757
|
+
}, wrapBodyStream = Symbol("wrapBodyStream"), newRequestFromIncoming = (method, url, headers, incoming, abortController) => {
|
|
3755
3758
|
const init$1 = {
|
|
3756
3759
|
method,
|
|
3757
|
-
headers
|
|
3760
|
+
headers,
|
|
3758
3761
|
signal: abortController.signal
|
|
3759
3762
|
};
|
|
3760
3763
|
if (method === "TRACE") {
|
|
@@ -3781,18 +3784,21 @@ var RequestError = class extends Error {
|
|
|
3781
3784
|
} });
|
|
3782
3785
|
} else init$1.body = Readable.toWeb(incoming);
|
|
3783
3786
|
return new Request(url, init$1);
|
|
3784
|
-
}, getRequestCache = Symbol("getRequestCache"), requestCache = Symbol("requestCache"), incomingKey = Symbol("incomingKey"), urlKey = Symbol("urlKey"), abortControllerKey = Symbol("abortControllerKey"), getAbortController = Symbol("getAbortController"), requestPrototype = {
|
|
3787
|
+
}, getRequestCache = Symbol("getRequestCache"), requestCache = Symbol("requestCache"), incomingKey = Symbol("incomingKey"), urlKey = Symbol("urlKey"), headersKey = Symbol("headersKey"), abortControllerKey = Symbol("abortControllerKey"), getAbortController = Symbol("getAbortController"), requestPrototype = {
|
|
3785
3788
|
get method() {
|
|
3786
3789
|
return this[incomingKey].method || "GET";
|
|
3787
3790
|
},
|
|
3788
3791
|
get url() {
|
|
3789
3792
|
return this[urlKey];
|
|
3790
3793
|
},
|
|
3794
|
+
get headers() {
|
|
3795
|
+
return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]);
|
|
3796
|
+
},
|
|
3791
3797
|
[getAbortController]() {
|
|
3792
3798
|
return this[getRequestCache](), this[abortControllerKey];
|
|
3793
3799
|
},
|
|
3794
3800
|
[getRequestCache]() {
|
|
3795
|
-
return this[abortControllerKey] ||= new AbortController(), this[requestCache] ||= newRequestFromIncoming(this.method, this[urlKey], this[incomingKey], this[abortControllerKey]);
|
|
3801
|
+
return this[abortControllerKey] ||= new AbortController(), this[requestCache] ||= newRequestFromIncoming(this.method, this[urlKey], this.headers, this[incomingKey], this[abortControllerKey]);
|
|
3796
3802
|
}
|
|
3797
3803
|
};
|
|
3798
3804
|
[
|
|
@@ -3801,7 +3807,6 @@ var RequestError = class extends Error {
|
|
|
3801
3807
|
"cache",
|
|
3802
3808
|
"credentials",
|
|
3803
3809
|
"destination",
|
|
3804
|
-
"headers",
|
|
3805
3810
|
"integrity",
|
|
3806
3811
|
"mode",
|
|
3807
3812
|
"redirect",
|
|
@@ -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.
|
|
764
|
+
var name = "ccusage", version = "16.2.5", 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-
|
|
1
|
+
import { log, logger } from "./logger-wHijzbnK.js";
|
|
2
2
|
export { log, logger };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DEFAULT_LOCALE, __commonJSMin, __toESM, require_usingCtx } from "./pricing-fetcher-
|
|
1
|
+
import { DEFAULT_LOCALE, __commonJSMin, __toESM, require_usingCtx } from "./pricing-fetcher-BtUY4dRM.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-
|
|
6
|
-
import { name, version } from "./logger-
|
|
5
|
+
import { getClaudePaths, loadDailyUsageData, loadMonthlyUsageData, loadSessionBlockData, loadSessionData } from "./data-loader-abvRdQYo.js";
|
|
6
|
+
import { name, version } from "./logger-wHijzbnK.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-
|
|
1
|
+
import "./pricing-fetcher-BtUY4dRM.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-
|
|
6
|
-
import "./logger-
|
|
7
|
-
import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-
|
|
5
|
+
import "./data-loader-abvRdQYo.js";
|
|
6
|
+
import "./logger-wHijzbnK.js";
|
|
7
|
+
import { createMcpHttpApp, createMcpServer, startMcpServerStdio } from "./mcp-Dz21qUWi.js";
|
|
8
8
|
export { createMcpHttpApp, createMcpServer, startMcpServerStdio };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { modelPricingSchema } from "./_types-DIdtMJ6V.js";
|
|
2
|
-
import { logger } from "./logger-
|
|
2
|
+
import { logger } from "./logger-wHijzbnK.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import F, { homedir } from "node:os";
|
package/dist/pricing-fetcher.js
CHANGED