claude-session-dashboard 0.5.0 → 0.5.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.
package/README.md ADDED
@@ -0,0 +1,218 @@
1
+ # Claude Session Dashboard
2
+
3
+ [![CI](https://github.com/dlupiak/claude-session-dashboard/actions/workflows/ci.yml/badge.svg)](https://github.com/dlupiak/claude-session-dashboard/actions/workflows/ci.yml)
4
+ [![CodeQL](https://github.com/dlupiak/claude-session-dashboard/actions/workflows/codeql.yml/badge.svg)](https://github.com/dlupiak/claude-session-dashboard/actions/workflows/codeql.yml)
5
+ [![OpenSSF Scorecard](https://img.shields.io/ossf-scorecard/github.com/dlupiak/claude-session-dashboard)](https://securityscorecards.dev/viewer/?uri=github.com/dlupiak/claude-session-dashboard)
6
+ [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/12094/badge)](https://www.bestpractices.dev/projects/12094)
7
+ [![codecov](https://codecov.io/gh/dlupiak/claude-session-dashboard/graph/badge.svg)](https://codecov.io/gh/dlupiak/claude-session-dashboard)
8
+ [![Socket](https://img.shields.io/badge/Socket-secured-green?logo=socket.dev)](https://socket.dev/npm/package/claude-session-dashboard)
9
+ [![npm version](https://img.shields.io/npm/v/claude-session-dashboard)](https://www.npmjs.com/package/claude-session-dashboard)
10
+ [![npm downloads](https://img.shields.io/npm/dm/claude-session-dashboard)](https://www.npmjs.com/package/claude-session-dashboard)
11
+ [![Node.js](https://img.shields.io/node/v/claude-session-dashboard)](https://nodejs.org)
12
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
13
+
14
+ A read-only, local observability dashboard for [Claude Code](https://docs.anthropic.com/en/docs/claude-code) sessions. Scans your `~/.claude` directory to visualize session history, tool usage, token consumption, cost estimates, and activity trends -- all without sending data anywhere.
15
+
16
+ ```bash
17
+ npx claude-session-dashboard
18
+ ```
19
+
20
+ ## Why?
21
+
22
+ Claude Code stores all session data locally in `~/.claude/projects/`, but there is no built-in way to browse, search, or analyze past sessions. As you accumulate hundreds of sessions across dozens of projects, questions start piling up:
23
+
24
+ - How many tokens did that refactoring session actually use?
25
+ - Which tools does Claude call most often in my codebase?
26
+ - How much am I spending per project, per day, per model?
27
+ - Is the context window filling up mid-session?
28
+ - When am I most active -- mornings or late nights?
29
+
30
+ This dashboard gives you answers. It reads your local session files, parses the JSONL logs, and presents everything in a fast, searchable web UI that runs entirely on your machine.
31
+
32
+ ## Features
33
+
34
+ **Session browsing and search**
35
+ - Full-text search across session names, projects, and branches
36
+ - Filter by status (active / completed), project, model, and date range
37
+ - Sortable columns with pagination
38
+ - Active session indicator with real-time status polling
39
+
40
+ **Session detail view**
41
+ - Context window utilization breakdown (input, output, cache read, cache creation)
42
+ - Tool usage frequency and duration statistics
43
+ - Agent dispatch history with nested tool calls
44
+ - Gantt-style timeline chart with zoom controls for tool calls, agent runs, and skill invocations
45
+ - Per-session and per-agent cost estimates with per-model and per-category breakdowns
46
+
47
+ ![Session Detail](screenshots/session-detail-full.png)
48
+
49
+ **Analytics and stats**
50
+ - GitHub-style contribution heatmap showing token usage intensity over the past year
51
+ - Token usage over time -- stacked area chart with daily/weekly toggle, top 5 models + "Other"
52
+ - Model usage distribution across all sessions
53
+ - Hourly activity distribution chart
54
+ - Aggregate metrics: total sessions, messages, tokens, estimated cost
55
+
56
+ ![Stats Overview](screenshots/stats-overview-full.png)
57
+
58
+ **Per-project analytics**
59
+ - Dedicated "Projects" tab with sortable table
60
+ - Sessions, messages, tokens, and duration aggregated per project
61
+ - Drill-down links to filtered session lists
62
+
63
+ ![Per-Project Analytics](screenshots/stats-projects.png)
64
+
65
+ **Cost estimation**
66
+ - Configurable API pricing per model (Claude Sonnet 4, Opus 4, Haiku, etc.)
67
+ - Subscription tier support (Free, Pro, Max 5x/20x) with appropriate rate adjustments
68
+ - Settings persisted to `~/.claude-dashboard/settings.json`
69
+
70
+ ![Settings Page](screenshots/settings-page.png)
71
+
72
+ **Data export**
73
+ - Export stats and session data in CSV or JSON format
74
+ - Four export formats: session summaries, model usage, daily activity, project analytics
75
+ - Client-side export -- no server round-trip needed
76
+
77
+ **Real-time monitoring**
78
+ - Active sessions badge in the sidebar with 3-second status polling
79
+ - Active session banner on detail pages with adaptive refresh intervals
80
+ - Automatic data refresh for in-progress sessions
81
+
82
+ **Privacy mode**
83
+ - Toggle to anonymize project names, file paths, branch names, and usernames
84
+ - Analytics data anonymized consistently across all views
85
+ - Safe for screenshot sharing and presentations
86
+
87
+ ## Quick Start
88
+
89
+ ### Using npx (recommended)
90
+
91
+ ```bash
92
+ npx claude-session-dashboard
93
+ ```
94
+
95
+ ### Using npm (global install)
96
+
97
+ ```bash
98
+ npm install -g claude-session-dashboard
99
+ claude-dashboard
100
+ ```
101
+
102
+ ### From source
103
+
104
+ ```bash
105
+ git clone https://github.com/dlupiak/claude-session-dashboard.git
106
+ cd claude-session-dashboard/apps/web
107
+ npm install
108
+ npm run build
109
+ npm start
110
+ ```
111
+
112
+ Open [http://localhost:3000](http://localhost:3000) in your browser.
113
+
114
+ ### Updating
115
+
116
+ **npx** — always fetches the latest published version automatically. No action needed.
117
+
118
+ **Global install** — check your current version and update:
119
+
120
+ ```bash
121
+ claude-dashboard --version # see current version
122
+ npm install -g claude-session-dashboard@latest
123
+ ```
124
+
125
+ **From source** — pull the latest changes and rebuild:
126
+
127
+ ```bash
128
+ cd claude-session-dashboard
129
+ git pull
130
+ cd apps/web && npm install && npm run build
131
+ ```
132
+
133
+ ## CLI Options
134
+
135
+ ```
136
+ -p, --port <number> Port to listen on (default: 3000)
137
+ --host <hostname> Host to bind to (default: localhost)
138
+ -o, --open Open browser after starting
139
+ -v, --version Show version number
140
+ -h, --help Show this help message
141
+ ```
142
+
143
+ > **Note:** The dashboard runs entirely on localhost and only reads files from `~/.claude`. It never modifies any Claude Code data and never sends data over the network.
144
+
145
+ ## Tech Stack
146
+
147
+ - [TanStack Start](https://tanstack.com/start) -- SSR framework on Vite
148
+ - [TanStack Router](https://tanstack.com/router) -- file-based routing with type-safe search params
149
+ - [TanStack Query](https://tanstack.com/query) -- data fetching with caching and automatic background refetch
150
+ - [Tailwind CSS v4](https://tailwindcss.com/) -- utility-first styling with CSS-first configuration
151
+ - [Recharts](https://recharts.org/) -- composable charting library for timeline, heatmap, and stats visualizations
152
+ - [Zod](https://zod.dev/) -- runtime validation for server functions and URL params
153
+ - Node.js >= 18
154
+
155
+ ## Project Structure
156
+
157
+ ```
158
+ apps/web/src/
159
+ routes/ # File-based routes (TanStack Router)
160
+ _dashboard/
161
+ sessions/
162
+ index.tsx # Sessions list page
163
+ $sessionId.tsx # Session detail page
164
+ stats.tsx # Stats + per-project analytics page
165
+ settings.tsx # Settings page
166
+ features/ # Vertical Slice Architecture
167
+ sessions/ # Session list, filters, active badge
168
+ session-detail/ # Session detail, timeline, context window
169
+ stats/ # Activity chart, heatmap, token trends, model usage
170
+ project-analytics/ # Per-project aggregated metrics
171
+ cost-estimation/ # Cost calculation and display
172
+ settings/ # Subscription tier, pricing editor
173
+ privacy/ # Privacy mode toggle and anonymization
174
+ lib/
175
+ scanner/ # Filesystem scanner for ~/.claude
176
+ parsers/ # JSONL session file parsers
177
+ cache/ # Persistent disk cache (heatmap data)
178
+ utils/ # Formatting, export utilities
179
+ components/ # Shared UI components (ExportDropdown, etc.)
180
+ ```
181
+
182
+ ## How It Works
183
+
184
+ 1. **Scanning** -- The server reads `~/.claude/projects/` to discover all session `.jsonl` files. An mtime-based cache avoids re-parsing unchanged files.
185
+ 2. **Parsing** -- Session files are parsed to extract metadata (project, branch, duration, model), tool calls, agent dispatches, token usage, and errors.
186
+ 3. **Server Functions** -- TanStack Start server functions (`createServerFn`) expose parsed data to the client via type-safe RPC. All file I/O stays on the server.
187
+ 4. **React Query** -- The UI fetches data through React Query with automatic background refetch for live updates. Active sessions use adaptive polling intervals.
188
+ 5. **Caching** -- Parsed session summaries and heatmap data are cached in memory (mtime-based invalidation) and on disk (`~/.claude-dashboard/cache/`) for fast startup.
189
+
190
+ ## Development
191
+
192
+ ```bash
193
+ cd apps/web
194
+
195
+ npm run dev # Dev server on localhost:3000
196
+ npm run build # Production build
197
+ npm run typecheck # TypeScript type checking
198
+ npm run lint # ESLint
199
+ npm run test # Unit tests (Vitest)
200
+ npm run e2e # End-to-end tests (Playwright)
201
+ ```
202
+
203
+ ## Contributing
204
+
205
+ Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for setup instructions and conventions. Check [good first issues](https://github.com/dlupiak/claude-session-dashboard/labels/good%20first%20issue) for beginner-friendly tasks.
206
+
207
+ If you find this project useful, consider giving it a star -- it helps others discover it.
208
+
209
+ ## Links
210
+
211
+ - [GitHub](https://github.com/dlupiak/claude-session-dashboard)
212
+ - [npm](https://www.npmjs.com/package/claude-session-dashboard)
213
+ - [Issues](https://github.com/dlupiak/claude-session-dashboard/issues)
214
+ - [Discussions](https://github.com/dlupiak/claude-session-dashboard/discussions)
215
+
216
+ ## License
217
+
218
+ MIT
@@ -1,5 +1,5 @@
1
1
  import { c as createServerRpc } from "./createServerRpc-D_-6bKnO.js";
2
- import { s as scanAllSessions } from "./session-scanner-CECpfGFh.js";
2
+ import { a as scanAllSessions } from "./session-scanner-GwtZjgds.js";
3
3
  import { c as createServerFn } from "../server.js";
4
4
  import "node:fs";
5
5
  import "node:path";
@@ -94,7 +94,7 @@ async function getActiveSessions() {
94
94
  return all.filter((s) => s.isActive);
95
95
  }
96
96
  export {
97
- scanAllSessionsWithPaths as a,
97
+ scanAllSessions as a,
98
98
  getActiveSessions as g,
99
- scanAllSessions as s
99
+ scanAllSessionsWithPaths as s
100
100
  };
@@ -1,6 +1,6 @@
1
1
  import { c as createServerRpc } from "./createServerRpc-D_-6bKnO.js";
2
2
  import { z } from "zod";
3
- import { s as scanAllSessions, g as getActiveSessions } from "./session-scanner-CECpfGFh.js";
3
+ import { a as scanAllSessions, g as getActiveSessions } from "./session-scanner-GwtZjgds.js";
4
4
  import { c as createServerFn } from "../server.js";
5
5
  import "node:fs";
6
6
  import "node:path";
@@ -4,7 +4,7 @@ import { g as getStatsPath, p as parseDetail } from "./session-parser-DKZZMuh6.j
4
4
  import * as path from "node:path";
5
5
  import * as os from "node:os";
6
6
  import { z } from "zod";
7
- import { a as scanAllSessionsWithPaths } from "./session-scanner-CECpfGFh.js";
7
+ import { s as scanAllSessionsWithPaths } from "./session-scanner-GwtZjgds.js";
8
8
  import { c as createServerFn } from "../server.js";
9
9
  import "node:fs/promises";
10
10
  import "node:readline";
@@ -89,33 +89,33 @@ async function getStartManifest(matchedRoutes) {
89
89
  injectedHeadScripts
90
90
  };
91
91
  }
92
- const manifest = { "39e65590d2bc41f653f54a9b6a9e0a72f185da275304c0a4a595d811cf185572": {
93
- functionName: "getProjectAnalytics_createServerFn_handler",
94
- importer: () => import("./assets/project-analytics.api-6b5TIBNn.js")
95
- }, "44af69d3bfcf3ec46fffb3f297d2b12cd7fe4db36c654b8a322df34d549c6493": {
92
+ const manifest = { "44af69d3bfcf3ec46fffb3f297d2b12cd7fe4db36c654b8a322df34d549c6493": {
96
93
  functionName: "getStats_createServerFn_handler",
97
- importer: () => import("./assets/stats.api-tIZqhk4B.js")
94
+ importer: () => import("./assets/stats.api-B9I1HZQw.js")
95
+ }, "39e65590d2bc41f653f54a9b6a9e0a72f185da275304c0a4a595d811cf185572": {
96
+ functionName: "getProjectAnalytics_createServerFn_handler",
97
+ importer: () => import("./assets/project-analytics.api-B6FCr_cZ.js")
98
98
  }, "71794080473579a94431392ab409ebd02772f6a9f6a08386cadbb8c0d3cf804a": {
99
99
  functionName: "getSessionDetail_createServerFn_handler",
100
100
  importer: () => import("./assets/session-detail.api-BQts3iQn.js")
101
+ }, "04ac41a7e3e644815167d098c2d6c3375d00a72a11e5af0d37033ba771081ba9": {
102
+ functionName: "getAppInfo_createServerFn_handler",
103
+ importer: () => import("./assets/app-info.api-CrHplh0q.js")
101
104
  }, "72f81ef9e8fa751bab60a8bdabd7e77816e2a6723a5e6e26e03712c01b3a249c": {
102
105
  functionName: "getSettings_createServerFn_handler",
103
106
  importer: () => import("./assets/settings.api-Cq5KPUxN.js")
104
107
  }, "7fe8c2b131c4fc81aa9a2570aec79640ff84603fe0060d13c24928b7329cb236": {
105
108
  functionName: "saveSettings_createServerFn_handler",
106
109
  importer: () => import("./assets/settings.api-Cq5KPUxN.js")
107
- }, "04ac41a7e3e644815167d098c2d6c3375d00a72a11e5af0d37033ba771081ba9": {
108
- functionName: "getAppInfo_createServerFn_handler",
109
- importer: () => import("./assets/app-info.api-CrHplh0q.js")
110
110
  }, "8fd6c4e5b4d5590acf1ec73da75f249978e8aced6dd2be23de06ade8431033be": {
111
111
  functionName: "getSessionList_createServerFn_handler",
112
- importer: () => import("./assets/sessions.api-CQ-Lrk5S.js")
112
+ importer: () => import("./assets/sessions.api-BHD6I0Q1.js")
113
113
  }, "946cc550946f64ee7985dc35913a690eb13183d7ba83cffe398e424e697b4265": {
114
114
  functionName: "getActiveSessionList_createServerFn_handler",
115
- importer: () => import("./assets/sessions.api-CQ-Lrk5S.js")
115
+ importer: () => import("./assets/sessions.api-BHD6I0Q1.js")
116
116
  }, "e574977967ea9b3387e72d70704b6ca87230e72becaf69f0b98cbc91c9cd1339": {
117
117
  functionName: "getPaginatedSessions_createServerFn_handler",
118
- importer: () => import("./assets/sessions.api-CQ-Lrk5S.js")
118
+ importer: () => import("./assets/sessions.api-BHD6I0Q1.js")
119
119
  } };
120
120
  async function getServerFnById(id) {
121
121
  const serverFnInfo = manifest[id];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-session-dashboard",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Local observability dashboard for Claude Code sessions",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -43,6 +43,7 @@
43
43
  "e2e:ui": "playwright test --ui",
44
44
  "e2e:headed": "playwright test --headed",
45
45
  "lint": "eslint src/",
46
+ "prepack": "cp ../../README.md ./README.md",
46
47
  "prepublishOnly": "npm run build"
47
48
  },
48
49
  "dependencies": {