From 1f0a2e44c85b26bb51131222cc7c599c85f91ec8 Mon Sep 17 00:00:00 2001 From: claude-code-best Date: Fri, 3 Apr 2026 01:11:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90=20debug=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/launch.json | 13 +++++++++++++ README.md | 19 +++++++++++++++++++ package.json | 1 + 3 files changed, 33 insertions(+) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..727844a --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,13 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "bun", + "request": "attach", + "name": "Attach to Bun (TUI debug)", + "url": "ws://localhost:8888/2dc3gzl5xot", + "stopOnEntry": false, + "internalConsoleOptions": "neverOpen" + } + ] +} diff --git a/README.md b/README.md index 977f157..268eb44 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ - [x] 所有 Feature 现在可以通过环境变量配置, 而不是垃圾的 bun --feature - [x] 移除牢 A 的反蒸馏代码!!! - [x] 补全 web search 能力(用的 Bing 搜索)!!! + - [x] 支持 Debug - [ ] V5 大规模重构石山代码, 全面模块分包 - [ ] V5 将会为全新分支, 届时 main 分支将会封存为历史版本 @@ -66,6 +67,24 @@ bun run build 如果遇到 bug 请直接提一个 issues, 我们优先解决 +## VS Code 调试 + +TUI (REPL) 模式需要真实终端,无法直接通过 VS Code launch 启动调试。使用 **attach 模式**: + +### 步骤 + +1. **终端启动 inspect 服务**: + ```bash + bun run dev:inspect + ``` + 会输出类似 `ws://localhost:8888/xxxxxxxx` 的地址。 + +2. **VS Code 附着调试器**: + - 在 `src/` 文件中打断点 + - F5 → 选择 **"Attach to Bun (TUI debug)"** + +> 注意:`dev:inspect` 和 `launch.json` 中的 WebSocket 地址会在每次启动时变化,需要同步更新两处。 + ## 相关文档及网站 diff --git a/package.json b/package.json index 083a4b7..843f3ac 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "scripts": { "build": "bun run build.ts", "dev": "bun run scripts/dev.ts", + "dev:inspect": "bun --inspect-wait=localhost:8888/2dc3gzl5xot run scripts/dev.ts", "prepublishOnly": "bun run build", "lint": "biome lint src/", "lint:fix": "biome lint --fix src/",