burner-cc 0.1.0 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +12 -8
  2. package/package.json +1 -1
  3. package/src/cli.js +37 -0
package/README.md CHANGED
@@ -7,14 +7,20 @@ Itemized dollar-and-token cost receipts for Claude Code sessions.
7
7
  ## Usage
8
8
 
9
9
  ```
10
- node bin/burner-cc.js # latest session -> opens a receipt
11
- node bin/burner-cc.js <session-id> # specific session (accepts a prefix)
12
- node bin/burner-cc.js --all # every session found, sliding through one receipt each
13
- node bin/burner-cc.js list # quick terminal table, no browser
14
- node bin/burner-cc.js --json # machine-readable, no browser
10
+ npx burner-cc # latest session -> opens a receipt
11
+ npx burner-cc <session-id> # specific session (accepts a title, slug, or id prefix)
12
+ npx burner-cc --all # every session found, sliding through one receipt each
13
+ npx burner-cc list # quick terminal table, no browser
14
+ npx burner-cc --json # machine-readable, no browser
15
15
  ```
16
16
 
17
- Once published: `npx burner-cc`, `npx burner-cc --all`, etc.
17
+ Or install it globally: `npm install -g burner-cc`, then run `burner-cc` directly.
18
+
19
+ ### Local development
20
+
21
+ ```
22
+ node bin/burner-cc.js <same args as above>
23
+ ```
18
24
 
19
25
  ## How it works
20
26
 
@@ -24,8 +30,6 @@ Once published: `npx burner-cc`, `npx burner-cc --all`, etc.
24
30
  - **Receipt** (`src/build-receipt.js`) groups tokens by model and computes cost per token-type line.
25
31
  - **Rendering** (`src/render.js` + `web/`) injects the receipt JSON into `web/receipt.html` and opens it in the default browser. Theme buttons (paper / thermal / matrix / dark) switch CSS variables client-side.
26
32
 
27
-
28
-
29
33
  ## What this is not
30
34
 
31
35
  Not official billing. Composition breakdown by *source* (system prompt vs. skills vs. MCP tool schemas) isn't available from local transcripts alone — that needs request interception, which this tool doesn't do. The receipt instead itemizes by token *type*: fresh input, cache write, cache read, output.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "burner-cc",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Itemized dollar-and-token cost receipts for Claude Code sessions.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -1,8 +1,35 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
1
4
  import { discoverSessions, findSession, latestSession } from './discover.js';
2
5
  import { buildReceipt, loadPricingTable } from './build-receipt.js';
3
6
  import { renderReceipts, openInBrowser } from './render.js';
4
7
  import { detectBillingMode } from './billing-mode.js';
5
8
 
9
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
+
11
+ const HELP_TEXT = `burner-cc — itemized cost receipts for Claude Code sessions
12
+
13
+ Usage:
14
+ burner-cc latest session -> opens a receipt
15
+ burner-cc <session> specific session (title, slug, or id prefix)
16
+ burner-cc --all every session found, sliding carousel
17
+ burner-cc list quick terminal table, no browser
18
+ burner-cc --json machine-readable output, no browser
19
+ burner-cc -h, --help show this help
20
+ burner-cc -v, --version show version
21
+
22
+ Examples:
23
+ burner-cc
24
+ burner-cc my-renamed-session
25
+ burner-cc --all --json
26
+ `;
27
+
28
+ function printVersion() {
29
+ const pkg = JSON.parse(readFileSync(path.join(__dirname, '..', 'package.json'), 'utf-8'));
30
+ console.log(pkg.version);
31
+ }
32
+
6
33
  function fmtUsd(n) {
7
34
  return '$' + n.toFixed(3);
8
35
  }
@@ -22,6 +49,16 @@ function printList(sessions, table) {
22
49
 
23
50
  async function main() {
24
51
  const args = process.argv.slice(2);
52
+
53
+ if (args.includes('-h') || args.includes('--help')) {
54
+ console.log(HELP_TEXT);
55
+ return;
56
+ }
57
+ if (args.includes('-v') || args.includes('--version')) {
58
+ printVersion();
59
+ return;
60
+ }
61
+
25
62
  const asJson = args.includes('--json');
26
63
  const filtered = args.filter((a) => a !== '--json');
27
64