From 1524b15cd0a7a4a21e20b1c8f93fe9daa5c1014a Mon Sep 17 00:00:00 2001 From: Zhang Jiahao Date: Tue, 21 Apr 2026 01:31:39 +0800 Subject: [PATCH] sync sidecars from ~/.claude/ --- mdTemplet/debug.md | 14 ++++++++++++++ mdTemplet/note.md | 11 +++++++++++ mdTemplet/tool.md | 3 +++ 3 files changed, 28 insertions(+) diff --git a/mdTemplet/debug.md b/mdTemplet/debug.md index 16ea28d..49c2e80 100644 --- a/mdTemplet/debug.md +++ b/mdTemplet/debug.md @@ -23,3 +23,17 @@ - 症状: nexus4cc (203M 磁盘) 经 .gitignore 过滤后仍 144k tokens - 原因: 前端单文件(如 Terminal.tsx 21k tokens)累积 - 规避: > 100k tokens 的仓库按子目录切片 (`repomix frontend/src -o /tmp/fe.xml`) + +## pkill / bash + +### 2026-04-21 pkill -f 匹配自身命令行导致 shell 退出 +- 症状: `pkill -f cdp-proxy.mjs` 后整个 Bash 块 exit 144,没有错误信息 +- 原因: `-f` 按完整命令行匹配,Bash tool 执行 `-c "pkill -f cdp-proxy.mjs ..."` 时 argv 里包含 "cdp-proxy.mjs",pkill 把自己的父 shell 一并杀了 +- 规避: 用 `pgrep -af ` 先列出 PID 再按 PID kill;或用更窄的 regex 如 `'cdp\S*proxy'`(regex 元字符不在自己的命令行里出现) + +## web-access skill + +### 2026-04-21 cdp-proxy.mjs 硬编码 Chrome 专用 ws 路径,不兼容 lightpanda +- 症状: `lightpanda serve --port 9222` 起来后 `check-deps.mjs` 报 "连接超时",proxy 日志循环 "连接错误: 连接失败" +- 原因: `scripts/cdp-proxy.mjs` `getWebSocketUrl()` fallback 到 `/devtools/browser`(Chrome 专用),而 lightpanda 的 `webSocketDebuggerUrl` 是 `ws://host:port/`(根路径) +- 规避: 端口扫描分支加入 `/json/version` 探测(CDP 标准 discovery endpoint),从响应的 `webSocketDebuggerUrl` 取 `pathname`。通用修复,Chrome 也受益。已本地 patch,skill 升级会被覆盖,需重新应用 diff --git a/mdTemplet/note.md b/mdTemplet/note.md index 4bc2812..52211aa 100644 --- a/mdTemplet/note.md +++ b/mdTemplet/note.md @@ -8,3 +8,14 @@ - `eza --tree --git-ignore --level=3 .` for layout (path arg required) - `fd ` for files; `rg ` for call sites - `git ls-files` when tokens are tight + +## lightpanda + +- 关掉遥测:`export LIGHTPANDA_DISABLE_TELEMETRY=true` +- 快速抓 markdown(A 模式):`lightpanda fetch --dump markdown --obey-robots `;`--wait-until` / `--wait-ms` / `--wait-selector` 调节等待 +- 作 web-access skill 的 CDP 后端(B 模式): + 1. `lightpanda serve --host 127.0.0.1 --port 9222` 后台跑 + 2. `node ~/.claude/skills/web-access/scripts/cdp-proxy.mjs` 后台跑(自动扫 9222) + 3. 用 `curl http://localhost:3456/new?url=...` 等 API;`/targets` 列 tab,`/eval?target=ID` 执行 JS,`/info?target=ID` 查标题/URL +- 区分 A vs B:公开静态页用 A(快、无状态);需要点击/上传/多 tab/交互取 DOM 用 B +- 不具备登录态(对比 web-access 连用户日常 Chrome);需要登录的站点仍走用户 Chrome 模式 diff --git a/mdTemplet/tool.md b/mdTemplet/tool.md index e3d020f..bb23efa 100644 --- a/mdTemplet/tool.md +++ b/mdTemplet/tool.md @@ -12,3 +12,6 @@ ## 协作 - `gh` — GitHub CLI(已登录) - `curl` — Gitea API 交互(见 CLAUDE.md §0) + +## 浏览器 / 联网 +- `lightpanda` — Zig 写的无头浏览器,CDP 兼容,~1/16 内存 / ~9x 速度 vs headless Chrome(Beta,Web API 覆盖率不完整)