@myskyline_ai/ccdebug 0.2.3 → 0.2.5
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.en.md +164 -0
- package/README.md +61 -30
- package/package.json +1 -1
- package/web/dist/assets/{index-B3QVqdGC.js → index-BWI7zXi1.js} +21 -21
- package/web/dist/assets/index-BWI7zXi1.js.map +1 -0
- package/web/dist/assets/index-DMvSjOqe.css +1 -0
- package/web/dist/index.html +2 -2
- package/web/server/conversation-parser.d.ts.map +1 -1
- package/web/server/conversation-parser.js +42 -8
- package/web/server/conversation-parser.js.map +1 -1
- package/web/server/web-server.d.ts +6 -0
- package/web/server/web-server.d.ts.map +1 -1
- package/web/server/web-server.js +141 -22
- package/web/server/web-server.js.map +1 -1
- package/web/dist/assets/index-B3QVqdGC.js.map +0 -1
- package/web/dist/assets/index-CpmGw4Fa.css +0 -1
- package/web/server/src/types/index.d.ts +0 -68
- package/web/server/src/types/index.d.ts.map +0 -1
- package/web/server/src/types/index.js +0 -3
- package/web/server/src/types/index.js.map +0 -1
- package/web/server/test-path.js +0 -48
package/README.en.md
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# CCDebug - Claude Code Debugging Tool
|
|
2
|
+
|
|
3
|
+
CCDebug is a debugging tool for Claude Code. It records and visualizes Claude Code execution traces, and also supports “edit & replay” for a single LLM request so you can quickly pinpoint deviations caused by prompts/context/tool calls.
|
|
4
|
+
|
|
5
|
+
This project is a derivative work based on [lemmy/claude-trace](https://github.com/badlogic/lemmy/tree/main/apps/claude-trace).
|
|
6
|
+
|
|
7
|
+
## ✨ Key Features
|
|
8
|
+
|
|
9
|
+
### 📊 Timeline view for Claude Code execution
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
- **Conversation timeline**: visualize the full conversation flow and tool call chain.
|
|
14
|
+
- **Filter by step type**: filter timeline nodes by type (user message, assistant reply, tool call, etc.).
|
|
15
|
+
- **Combined tool call + result**: tool input and its output are shown together for easier inspection.
|
|
16
|
+
- **Session selector & sub-agent labels**: choose a main session log; sub-agent logs are shown using agent name/description.
|
|
17
|
+
- **Project switching**: switch projects under `~/.claude/projects` in the Web UI to avoid running multiple servers.
|
|
18
|
+
|
|
19
|
+
### 🛠️ Step-level LLM request debugging
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
- **Track LLM requests**: record all LLM request/response logs made by Claude Code.
|
|
26
|
+
- **Replay requests**: edit the request payload and resend it to validate the response repeatedly.
|
|
27
|
+
|
|
28
|
+
## 🚀 Quick Start
|
|
29
|
+
|
|
30
|
+
### Install
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Recommended: install from npm
|
|
34
|
+
npm install -g @myskyline_ai/ccdebug
|
|
35
|
+
|
|
36
|
+
# Or install from a local tgz artifact
|
|
37
|
+
# npm install -g /path/to/@myskyline_ai-ccdebug-x.y.z.tgz
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Basic usage
|
|
41
|
+
|
|
42
|
+
#### 1) Launch Claude and record traffic
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Basic usage - start Claude and record logs
|
|
46
|
+
ccdebug
|
|
47
|
+
|
|
48
|
+
# Include all requests (not only /v1/messages)
|
|
49
|
+
ccdebug --include-all-requests
|
|
50
|
+
|
|
51
|
+
# Pass all subsequent arguments to Claude (example)
|
|
52
|
+
ccdebug --run-with -p "Do the work as requested" --verbose
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
#### 2) Start the Web timeline server
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Start the Web server (default port: 3001, default project dir: current working directory)
|
|
59
|
+
ccdebug --serve
|
|
60
|
+
|
|
61
|
+
# Custom port
|
|
62
|
+
ccdebug --serve --port 3001
|
|
63
|
+
|
|
64
|
+
# Specify project directory
|
|
65
|
+
ccdebug --serve --project /path/to/your/cc_workdir
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Log output directories
|
|
69
|
+
|
|
70
|
+
- **Claude Code standard logs (for timeline)**: `.claude-trace/cclog/*.jsonl` (includes main logs and `agent-*.jsonl` sub-agent logs)
|
|
71
|
+
- **Claude API tracing logs (for LLM debugging)**: `.claude-trace/tracelog/*.jsonl`
|
|
72
|
+
- **Saved LLM request overrides (for replay)**: `.claude-trace/tracelog/llm_requests/*.json`
|
|
73
|
+
|
|
74
|
+
Notes:
|
|
75
|
+
|
|
76
|
+
- After a `ccdebug`-launched Claude session ends, CCDebug automatically copies the corresponding Claude Code standard logs into `.claude-trace/cclog/`, and renames the API tracing log to `{sessionId}.jsonl`.
|
|
77
|
+
- If you are using the **native Claude Code binary** (not the npm script version), CCDebug cannot intercept API requests, so LLM request debugging won’t work. You can still use the Web UI to view existing standard logs.
|
|
78
|
+
|
|
79
|
+
## 📋 CLI Options
|
|
80
|
+
|
|
81
|
+
| Option | Description |
|
|
82
|
+
|------|------|
|
|
83
|
+
| `--serve` | Start the Web timeline server |
|
|
84
|
+
| `--log, -l` | Start the Web timeline server (`--log` without a value behaves like `--serve`; prefer `-l` to avoid confusion with `--log <name>`) |
|
|
85
|
+
| `--port <number>` | Web server port (default: 3001) |
|
|
86
|
+
| `--project <path>` | Project directory |
|
|
87
|
+
| `--run-with <args>` | Pass subsequent args to the Claude process |
|
|
88
|
+
| `--include-all-requests` | Capture all Claude-related requests, not only chat requests |
|
|
89
|
+
| `--no-open` | Do not auto-open the generated HTML in a browser (currently only effective for `--generate-html`) |
|
|
90
|
+
| `--claude-path <path>` | Custom path to the Claude binary or `cli.js` |
|
|
91
|
+
| `--log <name>` | Base name for API tracing logs (affects files under `.claude-trace/tracelog/`) |
|
|
92
|
+
| `--generate-html <input.jsonl> [output.html]` | Generate an HTML report from a JSONL file |
|
|
93
|
+
| `--index` | Generate conversation summaries & an index under `.claude-trace/` (will call Claude and incur token usage) |
|
|
94
|
+
| `--extract-token` | Extract OAuth token and exit |
|
|
95
|
+
| `--version, -v` | Print version |
|
|
96
|
+
| `--help, -h` | Show help |
|
|
97
|
+
|
|
98
|
+
## 🏗️ Architecture
|
|
99
|
+
|
|
100
|
+
### Core components
|
|
101
|
+
|
|
102
|
+
- **HTTP/API interceptor**: intercepts Node.js HTTP/HTTPS + fetch to capture Anthropic/Bedrock requests and responses.
|
|
103
|
+
- **Standard log collection**: on exit, copies main and sub-agent Claude Code logs into `.claude-trace/cclog/`.
|
|
104
|
+
- **Web server**: Express provides APIs for file listing, session management, project switching, and LLM request read/save/replay.
|
|
105
|
+
- **Frontend**: Vue 3 + Vite + Pinia + Arco Design.
|
|
106
|
+
|
|
107
|
+
### Data flow
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
HTTP request/response → interceptor → raw JSONL → processors → structured data → Web UI
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## 📁 Project Structure
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
ccdebug/
|
|
117
|
+
├── src/ # CLI & interceptors
|
|
118
|
+
│ ├── cli.ts # CLI entry
|
|
119
|
+
│ ├── interceptor.ts # API interception and tracelog recording
|
|
120
|
+
│ ├── html-generator.ts # HTML report generator (based on frontend)
|
|
121
|
+
│ └── index-generator.ts # conversation summaries and index
|
|
122
|
+
├── web/ # Web timeline site (Vite + Vue 3)
|
|
123
|
+
│ ├── src/ # frontend source
|
|
124
|
+
│ ├── dist/ # build output
|
|
125
|
+
│ └── server/ # Express backend (required by CLI to start)
|
|
126
|
+
├── frontend/ # standalone HTML report frontend (bundle injected into HTML)
|
|
127
|
+
├── scripts/ # packaging scripts
|
|
128
|
+
└── docs/ # docs and design notes
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## 🔧 Development
|
|
132
|
+
|
|
133
|
+
### Requirements
|
|
134
|
+
|
|
135
|
+
- Node.js >= 16.0.0
|
|
136
|
+
- npm or yarn
|
|
137
|
+
|
|
138
|
+
### Local development
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Clone
|
|
142
|
+
git clone https://github.com/ThinkingBeing/ccdebug.git
|
|
143
|
+
cd ccdebug
|
|
144
|
+
|
|
145
|
+
# Install dependencies
|
|
146
|
+
npm install
|
|
147
|
+
|
|
148
|
+
# Build
|
|
149
|
+
npm run build
|
|
150
|
+
|
|
151
|
+
# Dev mode (watch core code + web frontend)
|
|
152
|
+
npm run dev
|
|
153
|
+
|
|
154
|
+
# Run CLI via tsx (for development/debugging)
|
|
155
|
+
npx tsx src/cli.ts --help
|
|
156
|
+
npx tsx src/cli.ts --serve --port 3001 --project /path/to/your/cc_workdir
|
|
157
|
+
|
|
158
|
+
# Package (artifacts will be placed under release/)
|
|
159
|
+
npm run package
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## 🔗 Links
|
|
163
|
+
|
|
164
|
+
- [GitHub repository](https://github.com/ThinkingBeing/ccdebug)
|
package/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# CCDebug - Claude Code 调试工具
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
CCDebug 是一个针对 Claude Code
|
|
4
|
+
CCDebug 是一个针对 Claude Code 的调试工具,用于记录并可视化 CC 运行轨迹,同时支持对单个 LLM 请求进行“修改-重放”,帮助你快速定位提示词/上下文/工具调用导致的偏差。本项目基于 [lemmy/claude-trace](https://github.com/badlogic/lemmy/tree/main/apps/claude-trace) 二次开发。
|
|
5
|
+
|
|
6
|
+
英文版:[README.en.md](./README.en.md)
|
|
5
7
|
|
|
6
8
|
## ✨ 主要功能
|
|
7
9
|
|
|
@@ -10,6 +12,8 @@ CCDebug 是一个针对 Claude Code的简单调试工具,能够记录、分析
|
|
|
10
12
|
- **对话时间线**: 直观展示完整的对话流程和工具调用链
|
|
11
13
|
- **按节点类型过滤**: 按不同类型的时间线节点过滤,如用户输入、LLM回复、工具调用等
|
|
12
14
|
- **工具调用和结果整合展示**: 将工具调用和调用结果整合在一个节点展示,方便查看工具调用的输入参数和输出结果
|
|
15
|
+
- **会话选择与子代理识别**: 支持主日志会话选择,子代理日志下拉框显示 agent 名称/描述
|
|
16
|
+
- **项目切换**: Web 站点内可切换到 `~/.claude/projects` 下的其他项目,避免重复启动多个站点
|
|
13
17
|
|
|
14
18
|
### 🛠️ 对CC步骤单点调试
|
|
15
19
|

|
|
@@ -19,11 +23,14 @@ CCDebug 是一个针对 Claude Code的简单调试工具,能够记录、分析
|
|
|
19
23
|
|
|
20
24
|
## 🚀 快速开始
|
|
21
25
|
|
|
22
|
-
###
|
|
26
|
+
### 安装
|
|
23
27
|
|
|
24
28
|
```bash
|
|
25
|
-
# 全局安装
|
|
26
|
-
npm install -g @myskyline_ai
|
|
29
|
+
# 推荐:从 npm 全局安装
|
|
30
|
+
npm install -g @myskyline_ai/ccdebug
|
|
31
|
+
|
|
32
|
+
# 或:安装本地/发布产物 tgz
|
|
33
|
+
# npm install -g /path/to/@myskyline_ai-ccdebug-x.y.z.tgz
|
|
27
34
|
```
|
|
28
35
|
|
|
29
36
|
### 基本使用
|
|
@@ -36,40 +43,62 @@ ccdebug
|
|
|
36
43
|
|
|
37
44
|
# 包含所有请求(不仅仅是对话)
|
|
38
45
|
ccdebug --include-all-requests
|
|
46
|
+
|
|
47
|
+
# 将后续参数传递给 Claude 进程(示例)
|
|
48
|
+
ccdebug --run-with -p "请按要求工作" --verbose
|
|
39
49
|
```
|
|
40
50
|
|
|
41
51
|
#### 2. 启动 Web 站点查看时间线轨迹
|
|
42
52
|
|
|
43
53
|
```bash
|
|
44
|
-
# 启动 Web
|
|
45
|
-
ccdebug --serve
|
|
54
|
+
# 启动 Web 服务器查看时间线(默认端口 3001,默认项目目录为当前目录)
|
|
55
|
+
ccdebug --serve
|
|
56
|
+
|
|
57
|
+
# 在自定义端口启动
|
|
58
|
+
ccdebug --serve --port 3001
|
|
59
|
+
|
|
60
|
+
# 指定项目目录启动
|
|
61
|
+
ccdebug --serve --project /path/to/your/cc_workdir
|
|
46
62
|
```
|
|
47
63
|
|
|
64
|
+
### 日志输出目录
|
|
65
|
+
|
|
66
|
+
- **CC 标准日志(用于时间线)**: `.claude-trace/cclog/*.jsonl`(包含主日志与 `agent-*.jsonl` 子代理日志)
|
|
67
|
+
- **CC API 跟踪日志(用于 LLM 请求调试)**: `.claude-trace/tracelog/*.jsonl`
|
|
68
|
+
- **已保存的 LLM 请求(用于覆盖/重放)**: `.claude-trace/tracelog/llm_requests/*.json`
|
|
69
|
+
|
|
70
|
+
说明:
|
|
71
|
+
|
|
72
|
+
- 运行 `ccdebug` 启动 Claude 会话后,会将本次会话对应的 CC 标准日志自动拷贝到 `.claude-trace/cclog/`,并将 API 跟踪日志重命名为 `{sessionId}.jsonl`。
|
|
73
|
+
- 如果你使用的是 Claude Code **原生二进制版本**(非 NPM 脚本形式),CCDebug 无法拦截 API 请求,LLM 请求调试能力将不可用(仍可通过 Web 站点查看已有 CC 标准日志)。
|
|
74
|
+
|
|
48
75
|
## 📋 命令行选项
|
|
49
76
|
|
|
50
77
|
| 选项 | 描述 |
|
|
51
78
|
|------|------|
|
|
52
|
-
| `--extract-token` | 提取 OAuth token 并退出 |
|
|
53
|
-
| `--generate-html` | 从 JSONL 文件生成 HTML 报告 |
|
|
54
|
-
| `--index` | 为 .claude-trace/ 目录生成对话摘要和索引 |
|
|
55
79
|
| `--serve` | 启动 Web 时间线服务器 |
|
|
80
|
+
| `--log, -l` | 启动 Web 时间线服务器(当 `--log` 不带参数时等同于 `--serve`;建议用 `-l` 避免与 `--log <name>` 混淆) |
|
|
56
81
|
| `--port <number>` | 指定 Web 服务器端口(默认 3001) |
|
|
57
82
|
| `--project <path>` | 指定项目目录路径 |
|
|
58
83
|
| `--run-with <args>` | 将后续参数传递给 Claude 进程 |
|
|
59
84
|
| `--include-all-requests` | 包含所有 fetch 请求,而不仅仅是对话 |
|
|
60
|
-
| `--no-open` | 不在浏览器中自动打开生成的 HTML |
|
|
61
|
-
| `--log <name>` | 指定自定义日志文件基础名称 |
|
|
85
|
+
| `--no-open` | 不在浏览器中自动打开生成的 HTML(当前仅对 `--generate-html` 生效) |
|
|
62
86
|
| `--claude-path <path>` | 指定 Claude 二进制文件的自定义路径 |
|
|
87
|
+
| `--log <name>` | 指定 API 跟踪日志基础名称(影响 `.claude-trace/tracelog/` 下文件名) |
|
|
88
|
+
| `--generate-html <input.jsonl> [output.html]` | 从 JSONL 文件生成 HTML 报告 |
|
|
89
|
+
| `--index` | 为 `.claude-trace/` 目录生成对话摘要和索引(会调用 Claude 产生额外 token 消耗) |
|
|
90
|
+
| `--extract-token` | 提取 OAuth token 并退出 |
|
|
91
|
+
| `--version, -v` | 显示版本信息 |
|
|
63
92
|
| `--help, -h` | 显示帮助信息 |
|
|
64
93
|
|
|
65
94
|
## 🏗️ 技术架构
|
|
66
95
|
|
|
67
96
|
### 核心组件
|
|
68
97
|
|
|
69
|
-
- **HTTP 拦截器**: 基于 Node.js 的 HTTP/HTTPS
|
|
70
|
-
-
|
|
71
|
-
- **Web 服务器**: Express.js
|
|
72
|
-
- **前端界面**: Vue
|
|
98
|
+
- **HTTP/API 拦截器**: 基于 Node.js 的 HTTP/HTTPS + fetch 拦截机制,记录对 Anthropic/Bedrock 的请求与响应
|
|
99
|
+
- **CC 标准日志整理**: 退出会话时自动将 CC 标准日志(主日志与子代理日志)拷贝到 `.claude-trace/cclog/`
|
|
100
|
+
- **Web 服务器**: Express.js 提供文件列表、会话管理、项目切换、LLM 请求读取/保存/重放等 API
|
|
101
|
+
- **前端界面**: Vue 3 + Vite + Pinia + Arco Design
|
|
73
102
|
|
|
74
103
|
### 数据流程
|
|
75
104
|
|
|
@@ -81,17 +110,18 @@ HTTP 请求/响应 → 拦截器 → 原始数据(JSONL) → 数据处理器 →
|
|
|
81
110
|
|
|
82
111
|
```
|
|
83
112
|
ccdebug/
|
|
84
|
-
├── src/
|
|
85
|
-
│ ├── cli.ts
|
|
86
|
-
│ ├── interceptor.ts
|
|
87
|
-
│ ├── html-generator.ts
|
|
88
|
-
│ └──
|
|
89
|
-
├── web/
|
|
90
|
-
│ ├── src/
|
|
91
|
-
│
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
113
|
+
├── src/ # CLI 与拦截器
|
|
114
|
+
│ ├── cli.ts # 命令行入口
|
|
115
|
+
│ ├── interceptor.ts # API 拦截与 tracelog 记录
|
|
116
|
+
│ ├── html-generator.ts # HTML 报告生成器(基于 frontend)
|
|
117
|
+
│ └── index-generator.ts # 对话摘要与索引生成
|
|
118
|
+
├── web/ # Web 时间线站点(Vite + Vue 3)
|
|
119
|
+
│ ├── src/ # 前端源码
|
|
120
|
+
│ ├── dist/ # 构建产物
|
|
121
|
+
│ └── server/ # Express 后端(供 CLI 直接 require 启动)
|
|
122
|
+
├── frontend/ # 独立 HTML 报告前端(bundle 注入到 HTML)
|
|
123
|
+
├── scripts/ # 打包脚本
|
|
124
|
+
└── docs/ # 文档与设计说明
|
|
95
125
|
```
|
|
96
126
|
|
|
97
127
|
## 🔧 开发
|
|
@@ -114,11 +144,12 @@ npm install
|
|
|
114
144
|
# 构建项目
|
|
115
145
|
npm run build
|
|
116
146
|
|
|
117
|
-
#
|
|
118
|
-
|
|
147
|
+
# 开发模式(同时 watch 核心代码 + 前端)
|
|
148
|
+
npm run dev
|
|
119
149
|
|
|
120
|
-
#
|
|
121
|
-
npx tsx src/cli.ts --
|
|
150
|
+
# 使用 tsx 直接运行 CLI(开发调试用)
|
|
151
|
+
npx tsx src/cli.ts --help
|
|
152
|
+
npx tsx src/cli.ts --serve --port 3001 --project /path/to/your/cc_workdir
|
|
122
153
|
|
|
123
154
|
# 功能ok后打包,包会出现在release目录
|
|
124
155
|
npm run package
|