ccusage 0.8.0 → 9.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.
Files changed (37) hide show
  1. package/README.md +25 -5
  2. package/dist/calculate-cost.d.ts +2 -2
  3. package/dist/chunk-BLXvPPr8.js +30 -0
  4. package/dist/{data-loader-Bz6Vemxw.js → data-loader-Ca8k_uX0.js} +235 -294
  5. package/dist/{data-loader-amTZCtBR.d.ts → data-loader-OGaMjZTD.d.ts} +8 -80
  6. package/dist/data-loader.d.ts +3 -3
  7. package/dist/data-loader.js +5 -5
  8. package/dist/{debug-DQXeZIjf.js → debug-zCcXwR8p.js} +5 -4
  9. package/dist/debug.js +5 -5
  10. package/dist/{dist-DAarI-SJ.js → dist-BZzwBtZs.js} +1 -1
  11. package/dist/{effect-WSjEuzC9-ChJ5OQQf.js → effect-WSjEuzC9-DHMVzzyB.js} +1 -1
  12. package/dist/{esm-Dqsc1zmX.js → esm-BU3FhOe-.js} +1 -1
  13. package/dist/{index-CISmcbXk-x9eVmhGM.js → index-CISmcbXk-CW1Gj6Ab.js} +5 -5
  14. package/dist/index.js +199 -1760
  15. package/dist/{logger-DN-RT9jL.js → logger-DKw-DPXD.js} +3 -3
  16. package/dist/logger.js +1 -1
  17. package/dist/{mcp-DZXbfmbs.js → mcp-BRFYI5rd.js} +42 -50
  18. package/dist/mcp.d.ts +2 -2
  19. package/dist/mcp.js +7 -7
  20. package/dist/{pricing-fetcher-Dq-OLBp4.d.ts → pricing-fetcher-BkSZh4lR.d.ts} +83 -3
  21. package/dist/pricing-fetcher-BlxDpqFj.js +205 -0
  22. package/dist/pricing-fetcher.d.ts +2 -2
  23. package/dist/pricing-fetcher.js +3 -3
  24. package/dist/{sury-DmrZ3_Oj-l0qqtY-f.js → sury-DmrZ3_Oj-Cpjsc2Lm.js} +1 -1
  25. package/dist/utils.table-DRzF8vZJ.js +1838 -0
  26. package/dist/utils.table.d.ts +24 -0
  27. package/dist/utils.table.js +3 -0
  28. package/dist/valibot-CQk-M5rL-BcaCeUrF.js +10 -0
  29. package/dist/{zod-Db63SLXj-N1oN-yiY.js → zod-Db63SLXj-BIXn64AP.js} +3 -3
  30. package/package.json +2 -1
  31. package/dist/pricing-fetcher-DMNBE90M.js +0 -79
  32. package/dist/valibot-CQk-M5rL-BNHzwpA0.js +0 -10
  33. /package/dist/{arktype-C-GObzDh-Bx7Fdrqj.js → arktype-C-GObzDh-CNoBqQrr.js} +0 -0
  34. /package/dist/{core-B0ovMhJe.js → core-DHCbAXJf.js} +0 -0
  35. /package/dist/{dist-BEQ1tJCL.js → dist-DCvt9hEv.js} +0 -0
  36. /package/dist/{prompt-CUbwSrjo.js → prompt-DtZgx4wU.js} +0 -0
  37. /package/dist/{types-DS8M8QF_.js → types-BlyCnKwN.js} +0 -0
package/README.md CHANGED
@@ -129,8 +129,9 @@ ccusage daily
129
129
  # Filter by date range
130
130
  ccusage daily --since 20250525 --until 20250530
131
131
 
132
- # Use custom Claude data directory
133
- ccusage daily --path /custom/path/to/.claude
132
+ # Set CLAUDE_CONFIG_DIR environment variable for custom data directory
133
+ export CLAUDE_CONFIG_DIR="/custom/path/to/.claude"
134
+ ccusage daily
134
135
 
135
136
  # Output in JSON format
136
137
  ccusage daily --json
@@ -164,6 +165,10 @@ ccusage monthly --since 20250101 --until 20250531
164
165
  # Use custom Claude data directory
165
166
  ccusage monthly --path /custom/path/to/.claude
166
167
 
168
+ # Or set CLAUDE_CONFIG_DIR environment variable
169
+ export CLAUDE_CONFIG_DIR="/custom/path/to/.claude"
170
+ ccusage monthly
171
+
167
172
  # Output in JSON format
168
173
  ccusage monthly --json
169
174
 
@@ -191,8 +196,9 @@ ccusage session
191
196
  # Filter sessions by last activity date
192
197
  ccusage session --since 20250525
193
198
 
194
- # Combine filters
195
- ccusage session --since 20250525 --until 20250530 --path /custom/path
199
+ # Combine filters with environment variable
200
+ export CLAUDE_CONFIG_DIR="/custom/path"
201
+ ccusage session --since 20250525 --until 20250530
196
202
 
197
203
  # Output in JSON format
198
204
  ccusage session --json
@@ -216,7 +222,6 @@ All commands support the following options:
216
222
 
217
223
  - `-s, --since <date>`: Filter from date (YYYYMMDD format)
218
224
  - `-u, --until <date>`: Filter until date (YYYYMMDD format)
219
- - `-p, --path <path>`: Custom path to Claude data directory (default: `~/.claude`)
220
225
  - `-j, --json`: Output results in JSON format instead of table
221
226
  - `-m, --mode <mode>`: Cost calculation mode: `auto` (default), `calculate`, or `display`
222
227
  - `-o, --order <order>`: Sort order: `desc` (newest first, default) or `asc` (oldest first).
@@ -232,6 +237,21 @@ All commands support the following options:
232
237
  - **`calculate`**: Always calculates costs from token counts using model pricing, ignores any pre-calculated `costUSD` values
233
238
  - **`display`**: Always uses pre-calculated `costUSD` values only, shows $0.00 for entries without pre-calculated costs
234
239
 
240
+ #### Environment Variable Support
241
+
242
+ The tool supports the `CLAUDE_CONFIG_DIR` environment variable to specify the Claude data directory:
243
+
244
+ ```bash
245
+ # Set the environment variable to use a custom Claude directory
246
+ export CLAUDE_CONFIG_DIR="/path/to/custom/claude/directory"
247
+ ccusage daily
248
+
249
+ # The environment variable determines the Claude data directory
250
+ ccusage daily
251
+ ```
252
+
253
+ The tool will use the path specified in the `CLAUDE_CONFIG_DIR` environment variable, or fall back to the default `~/.claude` directory if not set.
254
+
235
255
  ### MCP (Model Context Protocol) Support
236
256
 
237
257
  Exposes usage data through Model Context Protocol for integration with other tools:
@@ -1,5 +1,5 @@
1
- import { DailyUsage, MonthlyUsage, SessionUsage } from "./data-loader-amTZCtBR.js";
2
- import "./pricing-fetcher-Dq-OLBp4.js";
1
+ import "./pricing-fetcher-BkSZh4lR.js";
2
+ import { DailyUsage, MonthlyUsage, SessionUsage } from "./data-loader-OGaMjZTD.js";
3
3
 
4
4
  //#region src/calculate-cost.d.ts
5
5
  type TokenData = {
@@ -0,0 +1,30 @@
1
+ import { createRequire } from "node:module";
2
+
3
+ //#region rolldown:runtime
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __commonJS = (cb, mod) => function() {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
+ key = keys[i];
16
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: ((k) => from[k]).bind(null, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
28
+
29
+ //#endregion
30
+ export { __commonJS, __require, __toESM };