ccusage 0.4.0 → 0.4.1
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.
|
@@ -4193,13 +4193,13 @@ const consola = createConsola();
|
|
|
4193
4193
|
//#endregion
|
|
4194
4194
|
//#region package.json
|
|
4195
4195
|
var name = "ccusage";
|
|
4196
|
-
var version = "0.4.
|
|
4196
|
+
var version = "0.4.1";
|
|
4197
4197
|
var description = "Usage analysis tool for Claude Code";
|
|
4198
4198
|
|
|
4199
4199
|
//#endregion
|
|
4200
4200
|
//#region logger.ts
|
|
4201
4201
|
const logger = consola.withTag(name);
|
|
4202
|
-
const log =
|
|
4202
|
+
const log = console.log;
|
|
4203
4203
|
|
|
4204
4204
|
//#endregion
|
|
4205
4205
|
//#region pricing-fetcher.ts
|
|
@@ -4214,7 +4214,7 @@ let cachedPricing = null;
|
|
|
4214
4214
|
async function fetchModelPricing() {
|
|
4215
4215
|
if (cachedPricing) return cachedPricing;
|
|
4216
4216
|
try {
|
|
4217
|
-
logger.
|
|
4217
|
+
logger.warn("Fetching latest model pricing from LiteLLM...");
|
|
4218
4218
|
const response = await fetch(LITELLM_PRICING_URL);
|
|
4219
4219
|
if (!response.ok) throw new Error(`Failed to fetch pricing data: ${response.statusText}`);
|
|
4220
4220
|
const data = await response.json();
|
package/dist/data-loader.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DailyUsageSchema, SessionUsageSchema, UsageDataSchema, calculateCostForEntry, formatDate, getDefaultClaudePath, loadSessionData, loadUsageData } from "./data-loader-
|
|
1
|
+
import { DailyUsageSchema, SessionUsageSchema, UsageDataSchema, calculateCostForEntry, formatDate, getDefaultClaudePath, loadSessionData, loadUsageData } from "./data-loader-BBdPk24U.js";
|
|
2
2
|
|
|
3
3
|
export { DailyUsageSchema, SessionUsageSchema, UsageDataSchema, calculateCostForEntry, formatDate, getDefaultClaudePath, loadSessionData, loadUsageData };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { UsageDataSchema, __commonJS, __require, __toESM, boolean, calculateCostFromTokens, description, fetchModelPricing, getDefaultClaudePath, getModelPricing, glob, loadSessionData, loadUsageData, log, logger, name, number, object, optional, pipe, record, regex, safeParse, string, union, version } from "./data-loader-
|
|
2
|
+
import { UsageDataSchema, __commonJS, __require, __toESM, boolean, calculateCostFromTokens, description, fetchModelPricing, getDefaultClaudePath, getModelPricing, glob, loadSessionData, loadUsageData, log, logger, name, number, object, optional, pipe, record, regex, safeParse, string, union, version } from "./data-loader-BBdPk24U.js";
|
|
3
3
|
import { calculateTotals, createTotalsObject, getTotalTokens } from "./calculate-cost-DMC4FhU4.js";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
5
5
|
import { homedir } from "node:os";
|
|
@@ -3117,6 +3117,7 @@ const dailyCommand = define({
|
|
|
3117
3117
|
description: "Show usage report grouped by date",
|
|
3118
3118
|
...sharedCommandConfig,
|
|
3119
3119
|
async run(ctx) {
|
|
3120
|
+
if (ctx.values.json) logger.level = 0;
|
|
3120
3121
|
const options = {
|
|
3121
3122
|
since: ctx.values.since,
|
|
3122
3123
|
until: ctx.values.until,
|
|
@@ -3198,7 +3199,7 @@ const dailyCommand = define({
|
|
|
3198
3199
|
import_picocolors$1.default.yellow(formatNumber(getTotalTokens(totals))),
|
|
3199
3200
|
import_picocolors$1.default.yellow(formatCurrency(totals.totalCost))
|
|
3200
3201
|
]);
|
|
3201
|
-
|
|
3202
|
+
log(table.toString());
|
|
3202
3203
|
}
|
|
3203
3204
|
}
|
|
3204
3205
|
});
|
|
@@ -3212,6 +3213,7 @@ const sessionCommand = define({
|
|
|
3212
3213
|
description: "Show usage report grouped by conversation session",
|
|
3213
3214
|
...sharedCommandConfig,
|
|
3214
3215
|
async run(ctx) {
|
|
3216
|
+
if (ctx.values.json) logger.level = 0;
|
|
3215
3217
|
const options = {
|
|
3216
3218
|
since: ctx.values.since,
|
|
3217
3219
|
until: ctx.values.until,
|
|
@@ -3313,7 +3315,7 @@ const sessionCommand = define({
|
|
|
3313
3315
|
import_picocolors.default.yellow(formatCurrency(totals.totalCost)),
|
|
3314
3316
|
""
|
|
3315
3317
|
]);
|
|
3316
|
-
|
|
3318
|
+
log(table.toString());
|
|
3317
3319
|
}
|
|
3318
3320
|
}
|
|
3319
3321
|
});
|