@cookielab.io/klovi 2.0.0 → 3.0.0-beta.17

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
@@ -1,164 +1,73 @@
1
- # Klovi
1
+ # @cookielab.io/klovi
2
2
 
3
- [![CI](https://github.com/cookielab/klovi/actions/workflows/ci.yml/badge.svg)](https://github.com/cookielab/klovi/actions/workflows/ci.yml)
4
- [![npm version](https://img.shields.io/npm/v/@cookielab.io/klovi)](https://www.npmjs.com/package/@cookielab.io/klovi)
5
- [![npm downloads](https://img.shields.io/npm/dm/@cookielab.io/klovi)](https://www.npmjs.com/package/@cookielab.io/klovi)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE.md)
3
+ Browse and present AI coding session history. Supports Claude Code, Codex (CLI & app), and OpenCode.
7
4
 
8
- A local web app for browsing and presenting AI coding session history. Supports Claude Code, Codex CLI, and OpenCode. Built for showing AI coding workflows at meetups and conferences.
9
-
10
- ![Klovi homepage screenshot](docs/screenshot-homepage.png)
11
- ![Klovi homepage screenshot](docs/screenshot-session.png)
5
+ ## Quick Start
12
6
 
13
- ## Why Klovi?
7
+ ```bash
8
+ # Run with Node.js
9
+ npx @cookielab.io/klovi
14
10
 
15
- AI coding tools like Claude Code, Codex CLI, and OpenCode store conversation history locally, but there's no unified way to browse, search, or present them. Klovi fills that gap: run a single command and get a local web UI to explore your full session history across all tools, review what AI assistants did across projects, and step through conversations in a presentation mode perfect for demos and talks.
11
+ # Run with Bun
12
+ bunx @cookielab.io/klovi
13
+ ```
16
14
 
17
- Klovi auto-discovers sessions from Claude Code (`~/.claude/projects/`), Codex CLI (`~/.codex/sessions/`), and OpenCode (`~/.local/share/opencode/opencode.db`), then renders conversations with markdown, syntax highlighting, collapsible tool calls, and a step-through presentation mode. Projects from different tools that share the same working directory are merged automatically.
15
+ Klovi starts a local server on `http://127.0.0.1:3583` and opens your browser. All data stays on your machine sessions are read directly from each tool's local storage.
18
16
 
19
- ## Quick Start
17
+ ## CLI Options
20
18
 
21
- Run directly without installing (requires [Bun](https://bun.sh) or [Node.js](https://nodejs.org) >=24):
19
+ ```
20
+ klovi [options]
22
21
 
23
- ```bash
24
- bunx --bun @cookielab.io/klovi@latest
25
- npx @cookielab.io/klovi@latest
26
- yarn dlx @cookielab.io/klovi@latest
27
- pnpm dlx @cookielab.io/klovi@latest
22
+ Options:
23
+ --port NUMBER Override the default port (default: 3583)
24
+ --no-browser Start the server without opening a browser
28
25
  ```
29
26
 
30
- Or install globally:
27
+ ## Environment Variables
31
28
 
32
- ```bash
33
- bun install -g @cookielab.io/klovi
34
- klovi
35
- ```
29
+ | Variable | Default | Description |
30
+ |---|---|---|
31
+ | `KLOVI_PORT` | `3583` | Server port |
32
+ | `KLOVI_HOST` | `127.0.0.1` | Bind address (localhost-only by default) |
33
+ | `KLOVI_STATIC_DIR` | (auto) | Override the static assets directory |
34
+ | `KLOVI_SETTINGS_PATH` | `~/.klovi/settings.json` | Override the settings file used by the CLI |
36
35
 
37
- Or install via [Homebrew](https://brew.sh) (no runtime dependency):
36
+ ## Programmatic API
38
37
 
39
- ```bash
40
- brew install cookielab/tap/klovi
41
- klovi
42
- ```
38
+ ```ts
39
+ import { startKloviServer } from "@cookielab.io/klovi/server";
43
40
 
44
- Open http://localhost:3583
41
+ const server = await startKloviServer({
42
+ host: "127.0.0.1",
43
+ port: 3583,
44
+ });
45
45
 
46
- ### Development
46
+ console.log(`Klovi listening on ${server.url}`);
47
47
 
48
- ```bash
49
- bun install
50
- bun run dev
48
+ // Later:
49
+ server.stop();
51
50
  ```
52
51
 
53
- ## Features
54
-
55
- **Multi-Tool Support**
56
- - Claude Code, Codex CLI, and OpenCode sessions in one unified viewer
57
- - Plugin-based architecture auto-discovers tools from their default data directories
58
- - Projects from different tools sharing the same working directory are merged
59
- - Tool name badge shown on each session in the sidebar
60
-
61
- **Session Browsing**
62
- - Auto-discovers all projects across registered tools
63
- - Dashboard statistics: project/session/tool counts, token usage breakdown, model distribution
64
- - Filterable project list with session counts and last activity
65
- - Hide/unhide projects to declutter the list
66
- - Sessions show first message, model, git branch, and timestamp
67
- - Plan/implementation session detection with colored badges and cross-session navigation links
68
- - Full conversation rendering with user/assistant/system messages
69
- - Sub-agent browsing: navigate into Task tool sub-agent sessions
70
- - Copy resume command from session header (tool-specific: `claude --resume <id>`, `codex resume <id>`)
71
-
72
- **Message Rendering**
73
- - Markdown with GFM support (tables, strikethrough, task lists)
74
- - Syntax-highlighted code blocks (language-aware, Prism)
75
- - Collapsible tool calls with smart summaries (file paths for Read/Write/Edit, commands for Bash, patterns for Grep/Glob)
76
- - Collapsible thinking/reasoning blocks
77
- - Token usage display (input/output/cache tokens per assistant message)
78
- - Timestamps on messages (relative time format)
79
- - Tool result images rendered as clickable thumbnails with fullscreen lightbox
80
- - File references (`@filepath.ext`) highlighted as green badges
81
- - Image attachments displayed as media-type badges
82
- - Slash commands shown with green `> /command` badge
83
-
84
- **Presentation Mode**
85
- - Step-through navigation: each conversation turn is a step, assistant turns have sub-steps (each text block is a step, consecutive non-text blocks like thinking and tool calls are grouped together)
86
- - Keyboard controls: Arrow keys / Space to advance, Escape to exit, F for fullscreen
87
- - Progress bar with step counter at the bottom
88
- - Sidebar hidden, content full-width with larger font
89
- - Fade-in animation for each revealed step
90
-
91
- **Theme & Display**
92
- - Light and dark themes (toggle in header, persisted to localStorage)
93
- - System theme auto-detection
94
- - Font size control (+/- buttons) for projector readability
95
-
96
- **CLI**
97
- - `--port <number>` — specify server port (default: 3583)
98
- - `--claude-code-dir <path>` — path to Claude Code data directory (default: `~/.claude`)
99
- - `--codex-cli-dir <path>` — path to Codex CLI data directory (default: `~/.codex`)
100
- - `--opencode-dir <path>` — path to OpenCode data directory (default: `~/.local/share/opencode`)
101
- - `--accept-risks` — skip the startup security warning
102
- - `--help` / `-h` — show usage information
103
-
104
- ## Scripts
105
-
106
- | Script | Description |
107
- |---|---|
108
- | `bun run dev` | Build frontend + start dev server with watch (port 3583) |
109
- | `bun run start` | Start production server (`node dist/server.js`) |
110
- | `bun run build` | Build frontend + server for production |
111
- | `bun run build:frontend` | Bundle frontend into `dist/public/` |
112
- | `bun run build:server` | Bundle server into `dist/server.js` (Node.js target) |
113
- | `bun run build:compile` | Compile standalone binaries for multiple platforms |
114
- | `bun test` | Run all tests |
115
- | `bun run typecheck` | TypeScript type checking (`tsc --noEmit`) |
116
- | `bun run lint` | Lint with Biome |
117
- | `bun run format` | Format with Biome |
118
- | `bun run check` | Biome check (lint + format, no write) |
119
- | `bun run check:fix` | Biome check + auto-fix |
120
-
121
- ## API
122
-
123
- | Endpoint | Description |
124
- |---|---|
125
- | `GET /api/version` | Server version information |
126
- | `GET /api/stats` | Aggregate dashboard statistics (projects, sessions, tokens, models) |
127
- | `GET /api/projects` | List all discovered projects |
128
- | `GET /api/projects/:encodedPath/sessions` | List sessions for a project |
129
- | `GET /api/sessions/:id?project=:encodedPath` | Full parsed session with turns |
130
- | `GET /api/sessions/:id/subagents/:agentId?project=:encodedPath` | Sub-agent session data |
131
-
132
- ## Tech Stack
133
-
134
- - [Bun](https://bun.sh) - runtime, bundler, test runner; [Node.js](https://nodejs.org) - production HTTP server
135
- - React 19 + TypeScript (strict mode)
136
- - react-markdown + remark-gfm
137
- - react-syntax-highlighter (Prism, oneDark theme)
138
- - CSS custom properties for theming (no CSS framework)
139
- - Biome for linting and formatting
140
- - happy-dom + @testing-library/react for tests
141
-
142
- ## Documentation
143
-
144
- See [docs/](docs/) for detailed documentation:
145
-
146
- - [Architecture](docs/architecture.md) - project structure, data flow, component hierarchy
147
- - [JSONL Format](docs/jsonl-format.md) - session file format specification
148
- - [Components](docs/components.md) - frontend component guide and patterns
149
- - [Testing](docs/testing.md) - test setup, patterns, and conventions
150
- - [Content Types](CONTENT_TYPES.md) - catalog of all JSONL content types and rendering status
151
-
152
- ## Contributing
153
-
154
- Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
155
-
156
- Please note that this project follows a [Code of Conduct](CODE_OF_CONDUCT.md).
157
-
158
- ## Built With
159
-
160
- This project was built with love using [Claude Code](https://claude.ai/claude-code).
161
-
162
- ## Trademark Notice
163
-
164
- "Claude" and "Claude Code" are trademarks of Anthropic, PBC. "Codex" is a trademark of OpenAI. This project is not affiliated with, endorsed by, or sponsored by Anthropic, OpenAI, or any other AI tool vendor. All trademarks and registered trademarks are the property of their respective owners.
52
+ ### `startKloviServer(options?)`
53
+
54
+ Starts the Klovi backend server. Returns `{ url, stop() }`.
55
+
56
+ | Option | Type | Default | Description |
57
+ |---|---|---|---|
58
+ | `host` | `string` | `"127.0.0.1"` | Bind address |
59
+ | `port` | `number` | `0` (auto) | Server port |
60
+ | `version` | `string` | `"dev"` | Version string |
61
+ | `commit` | `string` | `""` | Commit hash |
62
+ | `settingsPath` | `string` | `~/.klovi/settings.json` | Settings file path |
63
+ | `runtime` | `"auto" \| "bun" \| "node"` | `"auto"` | Runtime selection |
64
+
65
+ ## Supported Tools
66
+
67
+ - **Claude Code** reads from `~/.claude/projects/`
68
+ - **Codex** (CLI & app) reads from `~/.codex/sessions/`
69
+ - **OpenCode** reads from `~/.local/share/opencode/opencode.db`
70
+
71
+ ## License
72
+
73
+ MIT