cc-flight 0.4.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,236 @@
1
+ # SuperView
2
+
3
+ [English](README.md) | [简体中文](README.zh-CN.md)
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ npx cc-flight
9
+ ```
10
+
11
+ Or install globally:
12
+
13
+ ```bash
14
+ npm install -g cc-flight
15
+ ccflight
16
+ ```
17
+
18
+ Launch pre-focused on a project directory — SuperView auto-scans and selects that project on open:
19
+
20
+ ```bash
21
+ ccflight . # current directory
22
+ ccflight /path/to/your/project # absolute path
23
+ ccflight --project-dir=/path/to/project
24
+ ```
25
+
26
+ Then open **http://127.0.0.1:5174** and scan your agent logs.
27
+
28
+ SuperView is a local-first flight recorder for coding agents. It ingests session logs from Codex, Claude Code, and OpenCode, reconstructs every task journey, and surfaces hidden agent work — context snapshots, tool calls, cost, errors, and project telemetry — in a single dashboard.
29
+
30
+ ## Package Rename
31
+
32
+ The npm package is now `cc-flight`. The old package name, `@seanxdo/superview`, remains available as a compatibility package for existing installs.
33
+
34
+ New installs should use:
35
+
36
+ ```bash
37
+ npx cc-flight
38
+ ```
39
+
40
+ Existing commands still work during the transition:
41
+
42
+ ```bash
43
+ npx @seanxdo/superview
44
+ superview
45
+ ```
46
+
47
+ For future updates, switch scripts and docs to `cc-flight` or `ccflight`.
48
+
49
+ ## Preview
50
+
51
+ <table>
52
+ <tr>
53
+ <td colspan="4" align="center"><img src="docs/assets/02.png" width="900" alt="SuperView screenshot" /></td>
54
+ </tr>
55
+ <tr>
56
+ <td colspan="4" align="center"><img src="docs/assets/03.png" width="900" alt="SuperView screenshot" /></td>
57
+ </tr>
58
+ <tr>
59
+ <td colspan="4" align="center"><img src="docs/assets/08.png" width="900" alt="SuperView screenshot" /></td>
60
+ </tr>
61
+ <tr>
62
+ <td><img src="docs/assets/04.png" width="100%" alt="SuperView screenshot" /></td>
63
+ <td><img src="docs/assets/05.png" width="100%" alt="SuperView screenshot" /></td>
64
+ <td><img src="docs/assets/06.png" width="100%" alt="SuperView screenshot" /></td>
65
+ <td><img src="docs/assets/07.png" width="100%" alt="SuperView screenshot" /></td>
66
+ </tr>
67
+ </table>
68
+
69
+ ## Features
70
+
71
+ ### Session Recap
72
+
73
+ A collapsible flight-recorder readout panel with five sections:
74
+
75
+ - **01 Readout** — Sessions, estimated cost, total tokens, tool calls, errors, most-used model, busiest day, and priciest session.
76
+ - **02 Rhythm** — Daily activity calendar heatmap, hour×weekday clock heatmap, and daily token usage chart.
77
+ - **03 Efficiency** — Cache hit rate, error rate, tokens per session, and cost per session with animated gauges.
78
+ - **04 Spend by Model** — Per-model cost breakdown with editable token pricing.
79
+ - **05 Tool Usage** — Horizontal bar chart of tool call frequency with error indicators.
80
+
81
+ ### Context Replay
82
+
83
+ A snapshot-by-snapshot walkthrough of the agent's context window:
84
+
85
+ - Numbered step rail showing phase, title, and +added/-dropped content per step.
86
+ - Auto-play mode (cycles snapshots every 2.8s).
87
+ - Context blocks grouped by state: carried forward, newly added, changed, dropped.
88
+ - Warning strip for stale context, contradictions, and missing files.
89
+ - **Factory Strip** — A full-width belt view of all snapshots with active blocks and transitions.
90
+
91
+ ### Token Timeline
92
+
93
+ A vertical bar chart of token usage per journey, segmented by input/output/cached/reasoning. Click any bar to jump to that journey. Summary bar with conversation count, total tokens, and per-type breakdown.
94
+
95
+ ### Share Card
96
+
97
+ One-click summary generation for any task journey — hero stat, skills used, verdict (cleared/failed/in-progress), token sparkline, and copy-as-Markdown support.
98
+
99
+ ### Event Tape
100
+
101
+ A horizontal mini-timeline on every journey row showing categorized events (user, assistant, tool, thinking, error) with tooltip details on hover.
102
+
103
+ ### Cost Estimation
104
+
105
+ Built-in pricing table for Claude and GPT models (June 2026 rates). All rates are editable in-place. Costs are computed from raw token usage with cache read/write multipliers. Supports per-model cost aggregation.
106
+
107
+ ### Multi-Provider Support
108
+
109
+ | Provider | Source | Default Path |
110
+ |----------|--------|--------------|
111
+ | Codex CLI | Session JSONL files | `~/.codex/sessions/**/*.jsonl` |
112
+ | Claude Code | Project JSONL files | `~/.claude/projects/**/*.jsonl` |
113
+ | OpenCode | Exported session files | Manual export |
114
+
115
+ ### Theme & Language
116
+
117
+ Four themes: Bright Command Center (default), Dark Command Center, Forest Lab, Plasma Violet. Full bilingual support: English and Simplified Chinese. Preferences persist across sessions.
118
+
119
+ ## Development
120
+
121
+ ```bash
122
+ pnpm install
123
+ pnpm dev # Start API + Vite dev server
124
+ ```
125
+
126
+ Open the app:
127
+
128
+ ```
129
+ http://127.0.0.1:5173/
130
+ ```
131
+
132
+ The API server runs at:
133
+
134
+ ```
135
+ http://127.0.0.1:5174/
136
+ ```
137
+
138
+ ### CLI Ingest
139
+
140
+ ```bash
141
+ pnpm ingest /path/to/.codex
142
+ ```
143
+
144
+ ### API Ingest
145
+
146
+ ```bash
147
+ curl -X POST http://127.0.0.1:5174/api/ingest \
148
+ -H 'Content-Type: application/json' \
149
+ -d '{"sources":[{"provider":"codex"}]}'
150
+ ```
151
+
152
+ Claude Code:
153
+
154
+ ```bash
155
+ curl -X POST http://127.0.0.1:5174/api/ingest \
156
+ -H 'Content-Type: application/json' \
157
+ -d '{"sources":[{"provider":"claude-code","root":"/path/to/.claude"}]}'
158
+ ```
159
+
160
+ OpenCode:
161
+
162
+ ```bash
163
+ curl -X POST http://127.0.0.1:5174/api/ingest \
164
+ -H 'Content-Type: application/json' \
165
+ -d '{"sources":[{"provider":"opencode","path":"/path/to/opencode-export.json"}]}'
166
+ ```
167
+
168
+ Poll job status:
169
+
170
+ ```bash
171
+ curl http://127.0.0.1:5174/api/ingest/jobs/<jobId>
172
+ ```
173
+
174
+ ### Scripts
175
+
176
+ ```bash
177
+ pnpm dev # Start API and Vite client
178
+ pnpm dev:server # Start the Express API only
179
+ pnpm dev:client # Start the Vite client only
180
+ pnpm start # Start production server (single port, serves API + UI)
181
+ pnpm build # Typecheck and build the UI
182
+ pnpm typecheck # Run TypeScript checks
183
+ pnpm test # Run Vitest tests
184
+ pnpm test:e2e # Run Playwright tests
185
+ pnpm publish:dual # Build and dry-run publishing cc-flight + legacy package
186
+ ```
187
+
188
+ ### Publishing
189
+
190
+ ```bash
191
+ pnpm publish:dual # Build, pack, and dry-run both npm packages
192
+ pnpm publish:dual:live # Build, pack, and publish cc-flight + @seanxdo/superview
193
+ ```
194
+
195
+ Use `pnpm publish:dual -- --tag next` to dry-run with a non-`latest` npm dist-tag. The live command publishes `cc-flight` first, then republishes the same packed artifact as the legacy `@seanxdo/superview` compatibility package.
196
+ If npm requires two-factor authentication, run `pnpm publish:dual:live -- --otp <code>`.
197
+
198
+ ## API Reference
199
+
200
+ | Endpoint | Method | Description |
201
+ |----------|--------|-------------|
202
+ | `/api/health` | GET | Health check |
203
+ | `/api/ingest` | POST | Start ingest job |
204
+ | `/api/ingest/jobs/:id` | GET | Poll ingest progress |
205
+ | `/api/projects` | GET | List all projects |
206
+ | `/api/projects/:id/timeline` | GET | Get project timeline |
207
+ | `/api/projects/:id/token-usage/daily` | GET | Daily token usage |
208
+ | `/api/task-journeys/:id` | GET | Journey detail |
209
+ | `/api/task-journeys/:id/context-replay` | GET | Context replay data |
210
+ | `/api/events/:id/evidence` | GET | Event evidence |
211
+ | `/api/runs/:id` | GET | Run replay |
212
+ | `/api/reset` | POST | Reset database |
213
+
214
+ ## Architecture
215
+
216
+ ```text
217
+ ui/ React + Vite dashboard
218
+ runtime-node/ Express API, ingest service, worker process, log adapters
219
+ core/ Parser, normalizer, redactor, cost engine, timeline, context replay
220
+ storage/ SQLite database layer and local data paths
221
+ ```
222
+
223
+ The ingest path is intentionally split from the API. The API creates an ingest job and returns immediately. A worker process scans and parses log files, then writes normalized data into SQLite. This keeps the dashboard responsive during large historical scans. Ingest uses single-flight behavior — if one is already active, subsequent requests return the existing job.
224
+
225
+ ## Environment Variables
226
+
227
+ ```bash
228
+ SUPERVIEW_DATA_DIR # Data directory (default: ./.superview)
229
+ SUPERVIEW_CODEX_HOME # Codex log root (default: ~/.codex)
230
+ SUPERVIEW_CLAUDE_HOME # Claude Code log root (default: ~/.claude)
231
+ SUPERVIEW_PORT # Production server port (default: 5174)
232
+ ```
233
+
234
+ ## Privacy
235
+
236
+ SuperView is local-first. No accounts, no cloud sync, no remote backend. Raw agent logs stay on your machine. Normalized records are stored in a local SQLite database. Evidence views expose only redacted payloads with source provenance (path, line, timestamp, hash) — enough for debugging, not raw dumps.
@@ -0,0 +1,236 @@
1
+ # SuperView
2
+
3
+ [English](README.md) | [简体中文](README.zh-CN.md)
4
+
5
+ ## 快速开始
6
+
7
+ ```bash
8
+ npx --yes cc-flight@latest
9
+ ```
10
+
11
+ 或全局安装:
12
+
13
+ ```bash
14
+ npm install -g cc-flight
15
+ ccflight
16
+ ```
17
+
18
+ 从指定项目目录启动——SuperView 会自动扫描并默认选中该项目:
19
+
20
+ ```bash
21
+ ccflight . # 当前目录
22
+ ccflight /path/to/your/project # 绝对路径
23
+ ccflight --project-dir=/path/to/project
24
+ ```
25
+
26
+ 然后打开 **http://127.0.0.1:5174**,扫描你的 agent 日志即可。
27
+
28
+ SuperView 是一个本地优先的 coding agent 飞行记录器。它会读取 Codex、Claude Code 和 OpenCode 的 session 日志,重建每一轮任务旅程,并将隐藏的 agent 工作——上下文快照、工具调用、成本、错误和项目遥测——呈现在一个统一的仪表盘中。
29
+
30
+ ## 包名迁移
31
+
32
+ npm 包名现在是 `cc-flight`。旧包名 `@seanxdo/superview` 会作为兼容包继续保留,避免已有安装立即失效。
33
+
34
+ 新安装建议使用:
35
+
36
+ ```bash
37
+ npx cc-flight
38
+ ```
39
+
40
+ 迁移期间,旧命令仍然可用:
41
+
42
+ ```bash
43
+ npx @seanxdo/superview
44
+ superview
45
+ ```
46
+
47
+ 后续脚本和文档建议统一切换到 `cc-flight` 或 `ccflight`。
48
+
49
+ ## 界面预览
50
+
51
+ <table>
52
+ <tr>
53
+ <td colspan="4" align="center"><img src="docs/assets/02.png" width="900" alt="SuperView 截图" /></td>
54
+ </tr>
55
+ <tr>
56
+ <td colspan="4" align="center"><img src="docs/assets/03.png" width="900" alt="SuperView 截图" /></td>
57
+ </tr>
58
+ <tr>
59
+ <td colspan="4" align="center"><img src="docs/assets/08.png" width="900" alt="SuperView screenshot" /></td>
60
+ </tr>
61
+ <tr>
62
+ <td><img src="docs/assets/04.png" width="100%" alt="SuperView 截图" /></td>
63
+ <td><img src="docs/assets/05.png" width="100%" alt="SuperView 截图" /></td>
64
+ <td><img src="docs/assets/06.png" width="100%" alt="SuperView 截图" /></td>
65
+ <td><img src="docs/assets/07.png" width="100%" alt="SuperView 截图" /></td>
66
+ </tr>
67
+ </table>
68
+
69
+ ## 功能
70
+
71
+ ### 会话概览
72
+
73
+ 可折叠的飞行记录仪面板,包含五个模块:
74
+
75
+ - **01 总览** — 会话数、预估成本、Token 总量、工具调用次数、错误数、最常用模型、最忙一天和最贵项目。
76
+ - **02 节奏** — 每日活动日历热力图、小时×星期时钟热力图、每日 Token 用量图表。
77
+ - **03 效率** — 缓存命中率、错误率、每次会话 Token 数、每次会话成本,带动画仪表条。
78
+ - **04 模型成本** — 按模型分组的成本明细表,支持自定义 Token 定价。
79
+ - **05 工具用量** — 工具调用频率的横向柱状图,标注错误次数。
80
+
81
+ ### 上下文回放
82
+
83
+ 按快照逐步回溯 agent 的上下文窗口:
84
+
85
+ - 编号步骤栏,显示每步的阶段、标题和 +新增/-丢弃 内容。
86
+ - 自动播放模式(每 2.8 秒切换快照)。
87
+ - 上下文块按状态分组:延续、新增、变更、丢弃。
88
+ - 警告条:过期上下文、矛盾信息、缺失文件。
89
+ - **工厂流水线** — 全宽皮带视图,展示所有快照节点及其活跃上下文块的流转。
90
+
91
+ ### Token 时间线
92
+
93
+ 每次旅程的 Token 用量纵向柱状图,按输入/输出/缓存/推理分段。点击任意柱子跳转到对应旅程。顶部汇总条显示会话总数、Token 总量和分类明细。
94
+
95
+ ### 分享卡片
96
+
97
+ 一键生成任务旅程摘要——关键统计、使用技能、判定结果(完成/失败/进行中)、Token 火花图和 Markdown 格式复制。
98
+
99
+ ### 事件条
100
+
101
+ 每条旅程行上的水平迷你时间线,以颜色区分事件类型(用户、agent、工具、思考、错误),悬停显示详情。
102
+
103
+ ### 成本估算
104
+
105
+ 内置 Claude 和 GPT 模型定价表(2026 年 6 月费率)。所有费率可实时编辑。根据原始 Token 用量计算成本,含缓存读写系数。支持按模型聚合成本。
106
+
107
+ ### 多提供商支持
108
+
109
+ | 提供商 | 数据来源 | 默认路径 |
110
+ |--------|---------|---------|
111
+ | Codex CLI | Session JSONL 文件 | `~/.codex/sessions/**/*.jsonl` |
112
+ | Claude Code | Project JSONL 文件 | `~/.claude/projects/**/*.jsonl` |
113
+ | OpenCode | 导出 session 文件 | 手动导出 |
114
+
115
+ ### 主题与语言
116
+
117
+ 四种主题:明亮指挥中心(默认)、暗色指挥中心、森林实验室、等离子紫。完整双语支持:英文和简体中文。偏好设置跨会话持久保存。
118
+
119
+ ## 本地开发
120
+
121
+ ```bash
122
+ pnpm install
123
+ pnpm dev # 启动 API + Vite 开发服务器
124
+ ```
125
+
126
+ 打开应用:
127
+
128
+ ```
129
+ http://127.0.0.1:5173/
130
+ ```
131
+
132
+ API 服务地址:
133
+
134
+ ```
135
+ http://127.0.0.1:5174/
136
+ ```
137
+
138
+ ### CLI 导入
139
+
140
+ ```bash
141
+ pnpm ingest /path/to/.codex
142
+ ```
143
+
144
+ ### API 导入
145
+
146
+ ```bash
147
+ curl -X POST http://127.0.0.1:5174/api/ingest \
148
+ -H 'Content-Type: application/json' \
149
+ -d '{"sources":[{"provider":"codex"}]}'
150
+ ```
151
+
152
+ Claude Code:
153
+
154
+ ```bash
155
+ curl -X POST http://127.0.0.1:5174/api/ingest \
156
+ -H 'Content-Type: application/json' \
157
+ -d '{"sources":[{"provider":"claude-code","root":"/path/to/.claude"}]}'
158
+ ```
159
+
160
+ OpenCode:
161
+
162
+ ```bash
163
+ curl -X POST http://127.0.0.1:5174/api/ingest \
164
+ -H 'Content-Type: application/json' \
165
+ -d '{"sources":[{"provider":"opencode","path":"/path/to/opencode-export.json"}]}'
166
+ ```
167
+
168
+ 查询任务状态:
169
+
170
+ ```bash
171
+ curl http://127.0.0.1:5174/api/ingest/jobs/<jobId>
172
+ ```
173
+
174
+ ### 常用脚本
175
+
176
+ ```bash
177
+ pnpm dev # 同时启动 API 和 Vite 客户端
178
+ pnpm dev:server # 只启动 Express API
179
+ pnpm dev:client # 只启动 Vite 客户端
180
+ pnpm start # 启动生产服务器(单端口,同时提供 API + UI)
181
+ pnpm build # 类型检查并构建 UI
182
+ pnpm typecheck # 运行 TypeScript 检查
183
+ pnpm test # 运行 Vitest 测试
184
+ pnpm test:e2e # 运行 Playwright 测试
185
+ pnpm publish:dual # 构建并 dry-run 发布 cc-flight + 兼容包
186
+ ```
187
+
188
+ ### 发布
189
+
190
+ ```bash
191
+ pnpm publish:dual # 构建、打包,并 dry-run 两个 npm 包
192
+ pnpm publish:dual:live # 构建、打包,并正式发布 cc-flight + @seanxdo/superview
193
+ ```
194
+
195
+ 如需 dry-run 到非 `latest` 标签,可运行 `pnpm publish:dual -- --tag next`。正式发布会先发布 `cc-flight`,再将同一个打包产物改写为旧包名 `@seanxdo/superview` 兼容包后发布。
196
+ 如果 npm 要求双因素认证,可运行 `pnpm publish:dual:live -- --otp <code>`。
197
+
198
+ ## API Reference
199
+
200
+ | 端点 | 方法 | 说明 |
201
+ |------|------|------|
202
+ | `/api/health` | GET | 健康检查 |
203
+ | `/api/ingest` | POST | 启动导入任务 |
204
+ | `/api/ingest/jobs/:id` | GET | 查询导入进度 |
205
+ | `/api/projects` | GET | 列出所有项目 |
206
+ | `/api/projects/:id/timeline` | GET | 获取项目时间线 |
207
+ | `/api/projects/:id/token-usage/daily` | GET | 每日 Token 用量 |
208
+ | `/api/task-journeys/:id` | GET | 任务旅程详情 |
209
+ | `/api/task-journeys/:id/context-replay` | GET | 上下文回放数据 |
210
+ | `/api/events/:id/evidence` | GET | 事件证据 |
211
+ | `/api/runs/:id` | GET | 运行回放 |
212
+ | `/api/reset` | POST | 重置数据库 |
213
+
214
+ ## 架构
215
+
216
+ ```text
217
+ ui/ React + Vite 仪表盘
218
+ runtime-node/ Express API、导入服务、工作进程、日志适配器
219
+ core/ 解析器、规范化器、脱敏器、成本引擎、时间线、上下文回放
220
+ storage/ SQLite 数据库层和本地数据路径
221
+ ```
222
+
223
+ 导入路径与 API 路径分离。API 创建导入任务后立即返回,工作进程独立扫描和解析日志文件,将标准化数据写入 SQLite。即使扫描大量历史会话,仪表盘也能保持响应。导入服务采用单飞模式——若已有任务在运行,后续请求返回现有任务而非启动新的全量扫描。
224
+
225
+ ## 环境变量
226
+
227
+ ```bash
228
+ SUPERVIEW_DATA_DIR # 数据目录(默认:./.superview)
229
+ SUPERVIEW_CODEX_HOME # Codex 日志根目录(默认:~/.codex)
230
+ SUPERVIEW_CLAUDE_HOME # Claude Code 日志根目录(默认:~/.claude)
231
+ SUPERVIEW_PORT # 生产服务器端口(默认:5174)
232
+ ```
233
+
234
+ ## 隐私
235
+
236
+ SuperView 完全本地运行。无需账号、云同步或远程后端。原始 agent 日志始终留在你的机器上。标准化记录存储在本地 SQLite 数据库中。证据视图仅暴露脱敏 payload 及来源信息(路径、行号、时间戳、哈希),足以用于调试,但不会泄露原始内容。