cloviz 0.1.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.
- package/README.md +257 -0
- package/dist/client/assets/index-BlQ10IYF.js +168 -0
- package/dist/client/assets/index-ChwCt4EE.css +1 -0
- package/dist/client/index.html +14 -0
- package/dist/client/logo.png +0 -0
- package/dist/server/-ZSFJZLUJ.js +3025 -0
- package/dist/server/chunk-E2OJZHOR.js +8 -0
- package/dist/server/cli.js +31 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="cloviz-logo.png" alt="Cloviz" width="120">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">Cloviz</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">A local dashboard that indexes your Claude Code sessions, tracks costs, visualizes activity patterns, and helps you understand how you work with AI.</p>
|
|
8
|
+
|
|
9
|
+
All data stays on your machine. No external services, no telemetry.
|
|
10
|
+
|
|
11
|
+
### Easy Install
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npx cloviz
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Projects Overview
|
|
18
|
+

|
|
19
|
+
|
|
20
|
+
### Kanban Board
|
|
21
|
+
Sessions organized by phase with linked commits and cost breakdowns.
|
|
22
|
+

|
|
23
|
+
|
|
24
|
+
### Gantt Timeline
|
|
25
|
+
Visualize session durations with 1-day, 1-week, 1-month, and all-time presets.
|
|
26
|
+

|
|
27
|
+
|
|
28
|
+
### Session Replay
|
|
29
|
+
Full conversation replay with file tree, diffs, tool usage, and a session activity chart.
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
### Analytics - Costs
|
|
33
|
+
Track total spend, cache savings, daily cost trends, and per-model breakdowns.
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
### Analytics - Tools
|
|
37
|
+
See which tools Claude uses most across your sessions.
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
### Analytics - Patterns
|
|
41
|
+
Hour-by-day heatmap showing when you code with Claude.
|
|
42
|
+

|
|
43
|
+
|
|
44
|
+
## Features
|
|
45
|
+
|
|
46
|
+
- **Cost Tracking** - Monitor spend across Claude models with daily trends, cache savings, and per-model breakdowns
|
|
47
|
+
- **Session Replay** - Step through full conversations with file diffs, tool usage, thinking blocks, and todos
|
|
48
|
+
- **Git Integration** - Automatically links commits to sessions and tracks branches and file changes
|
|
49
|
+
- **Activity Patterns** - Hour-by-day heatmaps, peak hour detection, and session cadence analysis
|
|
50
|
+
- **Full-Text Search** - Search across messages, sessions, and plan files with highlighted results
|
|
51
|
+
- **Multiple Views** - Kanban board, Gantt timeline, session cards, and detailed analytics charts
|
|
52
|
+
- **Multi-Project** - Per-project analytics with automatic project discovery and logo generation
|
|
53
|
+
- **Real-Time Updates** - WebSocket-powered live dashboard with file watcher
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
56
|
+
|
|
57
|
+
**Prerequisites:** [Bun](https://bun.sh) runtime installed.
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
git clone https://github.com/ioprodz/cloviz.git
|
|
61
|
+
cd cloviz
|
|
62
|
+
bun install
|
|
63
|
+
bun run dev
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The dashboard opens at **http://localhost:3457**. The backend API runs on port 3456.
|
|
67
|
+
|
|
68
|
+
Cloviz automatically watches `~/.claude` and indexes sessions into a local SQLite database at `~/.cache/cloviz/cloviz.db`.
|
|
69
|
+
|
|
70
|
+
## Production Build
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
bun run build
|
|
74
|
+
bun run start
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
This builds the frontend to `dist/client/` and starts the server in production mode at **http://localhost:3456**, serving the SPA and API from the same port.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Contributing
|
|
82
|
+
|
|
83
|
+
### Project Structure
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
cloviz/
|
|
87
|
+
├── src/
|
|
88
|
+
│ ├── client/ # React frontend
|
|
89
|
+
│ │ ├── components/ # Reusable UI components
|
|
90
|
+
│ │ ├── pages/ # Route-level page components
|
|
91
|
+
│ │ ├── hooks/ # Custom React hooks (useApi, useWebSocket, useProjects)
|
|
92
|
+
│ │ ├── utils/ # Helpers (formatting, pricing, classification)
|
|
93
|
+
│ │ ├── App.tsx # Router and top-level layout
|
|
94
|
+
│ │ ├── main.tsx # React DOM entry point
|
|
95
|
+
│ │ └── index.html # HTML template
|
|
96
|
+
│ └── server/ # Hono backend (runs on Bun)
|
|
97
|
+
│ ├── api/ # API route modules (13 modules)
|
|
98
|
+
│ ├── pipeline/ # Data indexing and processing
|
|
99
|
+
│ ├── index.ts # Server entry point
|
|
100
|
+
│ ├── db.ts # SQLite schema and connection
|
|
101
|
+
│ ├── watcher.ts # File system watcher
|
|
102
|
+
│ ├── ws.ts # WebSocket broadcast
|
|
103
|
+
│ └── pricing.ts # Token cost calculations
|
|
104
|
+
├── docs/ # GitHub Pages site
|
|
105
|
+
├── package.json
|
|
106
|
+
├── tsconfig.json
|
|
107
|
+
└── vite.config.ts
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Tech Stack
|
|
111
|
+
|
|
112
|
+
| Layer | Technology |
|
|
113
|
+
|-------|-----------|
|
|
114
|
+
| Runtime | Bun |
|
|
115
|
+
| Frontend | React 19, React Router 7, Tailwind CSS 4, Recharts |
|
|
116
|
+
| Backend | Hono |
|
|
117
|
+
| Database | SQLite (bun:sqlite) with WAL mode |
|
|
118
|
+
| Build | Vite 6, TypeScript 5 |
|
|
119
|
+
| File watching | chokidar |
|
|
120
|
+
|
|
121
|
+
### Development Workflow
|
|
122
|
+
|
|
123
|
+
#### Running the Dev Environment
|
|
124
|
+
|
|
125
|
+
```sh
|
|
126
|
+
bun run dev
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
This starts two processes concurrently:
|
|
130
|
+
|
|
131
|
+
- **Backend** (`bun run dev:server`) - Bun with `--watch` flag, auto-restarts on changes to `src/server/`. Runs on port **3456**.
|
|
132
|
+
- **Frontend** (`bun run dev:client`) - Vite dev server with HMR. Runs on port **3457** and proxies `/api/*` and `/ws` requests to the backend.
|
|
133
|
+
|
|
134
|
+
Edit server code and it restarts automatically. Edit client code and the browser hot-reloads.
|
|
135
|
+
|
|
136
|
+
#### Running Backend or Frontend Independently
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
# Server only
|
|
140
|
+
bun run dev:server
|
|
141
|
+
|
|
142
|
+
# Client only (requires backend already running on :3456)
|
|
143
|
+
bun run dev:client
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### Preview a Production Build Locally
|
|
147
|
+
|
|
148
|
+
```sh
|
|
149
|
+
bun run preview
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
This builds the frontend and starts the server in production mode, serving everything from port 3456.
|
|
153
|
+
|
|
154
|
+
### Path Aliases
|
|
155
|
+
|
|
156
|
+
TypeScript path aliases are configured in `tsconfig.json`:
|
|
157
|
+
|
|
158
|
+
- `@server/*` maps to `src/server/*`
|
|
159
|
+
- `@client/*` maps to `src/client/*`
|
|
160
|
+
|
|
161
|
+
### Database
|
|
162
|
+
|
|
163
|
+
The SQLite database is created automatically on first run at `~/.cache/cloviz/cloviz.db`. The schema is defined and migrated in `src/server/db.ts`.
|
|
164
|
+
|
|
165
|
+
Key tables: `projects`, `sessions`, `messages`, `tool_uses`, `commits`, `session_commits`, `plans`, `todos`, `file_history`, `daily_stats`, `index_state`.
|
|
166
|
+
|
|
167
|
+
Full-text search uses SQLite FTS5 virtual tables (`messages_fts`, `sessions_fts`, `plans_fts`).
|
|
168
|
+
|
|
169
|
+
To reset the database, delete the file and restart:
|
|
170
|
+
|
|
171
|
+
```sh
|
|
172
|
+
rm ~/.cache/cloviz/cloviz.db
|
|
173
|
+
bun run dev
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Indexing Pipeline
|
|
177
|
+
|
|
178
|
+
On startup, a **quick index** runs synchronously before the server begins listening:
|
|
179
|
+
|
|
180
|
+
1. Scans `~/.claude/stats-cache.json` for session metadata
|
|
181
|
+
2. Indexes session files and parses `history.jsonl`
|
|
182
|
+
3. Scans plan documents and project logos
|
|
183
|
+
4. Reads git remote URLs for project linking
|
|
184
|
+
|
|
185
|
+
A **background index** then processes session JSONL content (files under 2MB are parsed immediately; larger files are lazy-loaded on demand).
|
|
186
|
+
|
|
187
|
+
The **file watcher** monitors `~/.claude` for changes, debounces with a 200ms stability threshold, and broadcasts updates over WebSocket.
|
|
188
|
+
|
|
189
|
+
### Adding a New API Endpoint
|
|
190
|
+
|
|
191
|
+
1. Create a new file in `src/server/api/` (or add to an existing one).
|
|
192
|
+
2. Export a Hono app instance with your routes:
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
import { Hono } from "hono";
|
|
196
|
+
import { getDb } from "../db";
|
|
197
|
+
|
|
198
|
+
const app = new Hono();
|
|
199
|
+
|
|
200
|
+
app.get("/my-endpoint", (c) => {
|
|
201
|
+
const db = getDb();
|
|
202
|
+
// query and return data
|
|
203
|
+
return c.json({ data: [] });
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
export default app;
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
3. Mount it in `src/server/index.ts`:
|
|
210
|
+
|
|
211
|
+
```ts
|
|
212
|
+
import myRoutes from "./api/my-routes";
|
|
213
|
+
app.route("/api/my-routes", myRoutes);
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Adding a New Frontend Page
|
|
217
|
+
|
|
218
|
+
1. Create a new page component in `src/client/pages/`.
|
|
219
|
+
2. Add a route in `src/client/App.tsx` inside the router configuration.
|
|
220
|
+
3. Add a nav link in the navigation bar component if it should be globally accessible.
|
|
221
|
+
|
|
222
|
+
### Adding a New Component
|
|
223
|
+
|
|
224
|
+
Place reusable components in `src/client/components/`. The project uses Tailwind CSS for styling - follow the existing patterns (dark theme with `gray-900` base, indigo/cyan accent colors).
|
|
225
|
+
|
|
226
|
+
### Environment Variables
|
|
227
|
+
|
|
228
|
+
| Variable | Default | Description |
|
|
229
|
+
|----------|---------|-------------|
|
|
230
|
+
| `PORT` | `3456` | Backend server port |
|
|
231
|
+
| `NODE_ENV` | — | Set to `production` to serve static files from `dist/client/` |
|
|
232
|
+
|
|
233
|
+
No `.env` file is needed. The project uses hardcoded paths (`~/.claude` for session data, `~/.cache/cloviz` for the database).
|
|
234
|
+
|
|
235
|
+
### Conventions
|
|
236
|
+
|
|
237
|
+
- TypeScript strict mode is enabled
|
|
238
|
+
- Frontend uses functional components with hooks
|
|
239
|
+
- Backend uses Hono's routing pattern with modular route files
|
|
240
|
+
- Database queries use raw SQL via `bun:sqlite`
|
|
241
|
+
- Dates are handled with `date-fns`
|
|
242
|
+
- Charts use Recharts with a consistent dark theme
|
|
243
|
+
|
|
244
|
+
### Common Tasks
|
|
245
|
+
|
|
246
|
+
| Task | Command |
|
|
247
|
+
|------|---------|
|
|
248
|
+
| Start development | `bun run dev` |
|
|
249
|
+
| Build for production | `bun run build` |
|
|
250
|
+
| Run production server | `bun run start` |
|
|
251
|
+
| Preview production build | `bun run preview` |
|
|
252
|
+
| Reset database | `rm ~/.cache/cloviz/cloviz.db` |
|
|
253
|
+
| Install dependencies | `bun install` |
|
|
254
|
+
|
|
255
|
+
## License
|
|
256
|
+
|
|
257
|
+
MIT
|