ai-usage-analyzer 0.3.1 → 0.3.2

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
@@ -19,20 +19,22 @@ Requires **Node.js ≥ 22.5** (for built-in `node:sqlite`).
19
19
 
20
20
  ```bash
21
21
  # Try it (no install)
22
- npx -y github:adetxt/ai-usage-analyzer
22
+ npx -y ai-usage-analyzer
23
23
 
24
24
  # Or install globally
25
- pnpm add -g git+https://github.com/adetxt/ai-usage-analyzer.git
26
- ai-usage --help
25
+ pnpm add -g ai-usage-analyzer
26
+ ai-usage-analyzer --help
27
27
  ```
28
28
 
29
+ The short alias `ai-usage` is also installed and works identically.
30
+
29
31
  ## Usage
30
32
 
31
33
  ```bash
32
- ai-usage # default TUI
33
- ai-usage --top 10 # show top 10 heaviest sessions
34
- ai-usage --json # machine-readable JSON
35
- ai-usage --md > report.md # save as markdown
34
+ ai-usage-analyzer # default TUI
35
+ ai-usage-analyzer --top 10 # show top 10 heaviest sessions
36
+ ai-usage-analyzer --json # machine-readable JSON
37
+ ai-usage-analyzer --md > report.md # save as markdown
36
38
  ```
37
39
 
38
40
  ## Supported tools
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-usage-analyzer",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "TUI analyzer for local AI coding agent token usage. Auto-detects Claude Code, Codex, OpenCode, MimoCode, Copilot, Antigravity, and Gemini.",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.33.0",
package/src/render.js CHANGED
@@ -5,12 +5,19 @@ import Table from 'cli-table3';
5
5
  import boxen from 'boxen';
6
6
  import gradient from 'gradient-string';
7
7
  import process from 'node:process';
8
+ import { readFileSync } from 'node:fs';
9
+ import { fileURLToPath } from 'node:url';
10
+ import { dirname, join } from 'node:path';
8
11
  import {
9
12
  perProject, perMonth, perWeek, perTool, perToolPerMonth, overall, topSessions, tokenBreakdown,
10
13
  MONTH_NAMES,
11
14
  } from './aggregate.js';
12
15
  import { getToolColor } from './tools.js';
13
16
 
17
+ const VERSION = JSON.parse(
18
+ readFileSync(join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json'), 'utf8'),
19
+ ).version;
20
+
14
21
  // ---------------------------------------------------------------------------
15
22
  // Terminal width detection
16
23
  // ---------------------------------------------------------------------------
@@ -146,6 +153,8 @@ export function renderHeader({ totalSessions, totalTokens, totalCost, dateRange
146
153
  ? chalk.dim.italic(`\n range: ${dateRange[0]} → ${dateRange[1]}`)
147
154
  : '';
148
155
  return boxen(`${title}\n\n${sub}${range}`, {
156
+ title: chalk.dim(`v${VERSION}`),
157
+ titleAlignment: 'right',
149
158
  borderStyle: 'round',
150
159
  borderColor: 'magenta',
151
160
  padding: { top: 0, bottom: 0, left: 2, right: 2 },