Skip to content

适配windows - #1

Closed
ShengVP wants to merge 14 commits into
BillLucky:mainfrom
ShengVP:main
Closed

适配windows#1
ShengVP wants to merge 14 commits into
BillLucky:mainfrom
ShengVP:main

Conversation

@ShengVP

@ShengVP ShengVP commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

What & why

Briefly describe the change and the motivation.

Checklist

  • No secrets / .env / personal data / real names / tokens / user IDs / open_ids committed (example configs stay generic)
  • node --check syntax check passes on touched index-*.js / lib/*.js
  • Unit tests pass (bash tests/run-all.sh, or node tests/*.test.js)
  • Consistent with the existing code style (see CLAUDE.md)
  • Relevant docs updated if behavior/commands/flags changed (README.md / docs/)

Notes for reviewers

@ShengVP

ShengVP commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

适配windows

@BillLucky

Copy link
Copy Markdown
Owner

首先,感谢你提交 echolog 的第一个外部 PR —— 一上来就啃 Windows 适配这块硬骨头,很有勇气也很有价值 🙌。能看出来背后做了认真的设计(plan/spec 都写了),整体方向是对的。

我通读了一遍,先说最亮的地方lib/utils.jsfindBin() 设计得很漂亮 —— 先走 OS 原生 PATH 查找、再回退常见安装目录、找不到返回 undefined 而不是抛异常、把"未找到"的语义交给调用方决定。这是个干净、零副作用的跨平台抽象,水平很高。feishu.js 里把硬编码的 /opt/homebrew/bin/whisper-cliffmpeg 换成 findBin 并加缺失守卫,以及按平台分流的安装提示(winget / whisper.cpp releases),都是实打实的可用性提升。

下面是一些建议。核心一句话:这个 PR 其实把两件事捆在了一起 —— 一类是低风险的跨平台修复(很棒,建议尽快进),另一类是「把 CLI 整体重写成 Node + pm2 + 降级依赖」(这个动到了项目根基,建议先对齐再做)。如果能拆成两个 PR,第一类我这边可以很快帮你 review 合并。

✅ 建议拆出来、可以马上进的部分

  • lib/utils.js(findBin)
  • feishu.js 改用 findBin + bin 缺失守卫 + process.env.HOME || process.env.USERPROFILE
  • lib/doctor.js / lib/init-wizard.js 里 findBin 替换 which + 按平台的依赖提示

这部分纯增益、不破坏任何现有体验,单独成 PR 我直接合。

⚠️ 需要先和维护者对齐的(架构层)

  • pm2 作为硬依赖:echolog 的 CLI 一直刻意保持「轻量、零依赖」(见 CLAUDE.md"改 CLI 行为时只动 bin/echolog,不要重写成 node 脚本(保持轻量、无依赖)")。引入 pm2(带后台 daemon + 庞大依赖树)会让原本零依赖的 Mac 用户也被迫装 pm2,echolog start 在 daemon 没起时还会直接 exit(1) —— 这是对现有用户的体验回归。
  • 即使要做 Windows 进程管理,能否优先考虑更轻的方案:原生 child_process.spawn(detached) + 保留现有 .pid 文件模型(跨平台用 process.kill(pid, 0) 探活,Windows 也支持)?如果坚持 pm2,建议把它做成可选:只有 start/stop 用到,lib/doctor.jslib/recover-missing.js 不应在顶层 require('pm2')(现在它们俩即使用户从不用 pm2 也会强制加载)。

🔴 几个会影响现有用户的回归,建议必修

  • package.jsonundici ^8.2.0 → ^7.8.0node >=22 → >=20 的降级:仓库锁 Node 22 是因为 undici@8 依赖 Node 22 的 markAsUncloneablelib/llm.js 的云端 provider(DeepSeek/Moonshot/Anthropic 等)都走 undici 的 Agent + fetch。把 undici 降到 7 来迁就 Node 20,很可能破坏云端 LLM 链路。Windows 适配不需要动这两个,建议还原。
  • lib/doctor.js 仍有裸 path.join(process.env.HOME, '.whisper-models', ...):Windows 上 HOMEundefined,会让 echolog doctor 直接抛 TypeError 崩掉(同一个 PR 在 feishu.js 已正确写了 HOME || USERPROFILE,这里漏了)。

🧹 一些清理

  • docs/superpowers/plans/docs/superpowers/specs/(约 1110 行)看着像开发过程中的 agent 规划草稿,建议从 PR 移除,不进交付仓库。
  • 重写 bin/echolog 时丢了不少原有中文注释和踩坑知识,有两处挺关键,希望保留:① symlink 三场景解析(直接路径 / PATH / npm link);② ingest-test--noproxy '*'(localhost 走系统代理会 502 的坑)—— 看你新实现加了 family:4,确认一下能否完全替代这个规避。另外帮助文本建议保留中文(项目面向中文用户)。
  • 建议从 feature 分支提 PR(现在是 main → main),并补上 package-lock.json(若保留新依赖)。
  • README 里建议注明:Windows 目前不支持语音转录(按你的 spec 是有意跳过 ffmpeg/whisper 的),让 Windows 用户有预期。

另外提一句:main 刚合了一个 /diary 上下文自适应的修复,麻烦你 rebase 一下再继续(会动到 feishu.js,不过区域不同,应该能自动合)。

再次感谢,第一个 PR 就能交出 findBin 这种质量的抽象,很能打 💪。拆分之后第一类我尽快帮你合,第二类咱们讨论清楚再推进 —— 一起把 echolog 打磨好,加油!

—— 老一 (laoyi@zhidun.ai)

@BillLucky

Copy link
Copy Markdown
Owner

补充一条 👇

我把「Windows 支持」整理成了一个可认领的任务追踪 issue:#2 —— 把你这个 PR 里的工作按风险拆成了 A/B/C/D/E/F 几组,低风险的跨平台修复(findBin、去硬编码、HOME 兼容、安装提示)列在 🟢 A 组,可以拆出来快速合;进程管理那块放在 🟡 B 组、建议先在 issue 下对齐方案再动手。

后来想参与的朋友也能照着 #2 按块认领,不用从零理。你这个 PR 是整件事的种子,辛苦了 🙏。建议你从 🟢 A 组挑一两项先拆成小 PR,我这边尽快帮你 review + 合。

—— 老一 (laoyi@zhidun.ai)

ShengVP and others added 3 commits June 11, 2026 13:37
…ix Windows edges

- Replace pm2 with child_process.spawn(detached) + PID file model
- Revert undici ^7.8.0 → ^8.2.0, engines >=20 → >=22 (cloud LLM chain)
- Remove pm2 dependency from package.json
- Fix process.env.HOME → HOME || USERPROFILE in doctor.js (Windows crash)
- Uncouple doctor.js + recover-missing.js from pm2
- Add windowsHide: true to spawn/execFile calls (suppress console popups)
- Fix cmdRestart race: poll for old process exit before starting new one
- Restore Chinese comments (symlink resolution, --noproxy rationale)
- Bilingual help text (Chinese/English)
- Delete superpowers plan/spec drafts (~1110 lines)
- README: note Windows voice transcription not yet supported

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- CLAUDE.md: update CLI description (bash → Node.js), cross-platform
  dependency install hints (brew / winget / whisper.cpp releases)
- README.md: Windows install/run guidance, bash setup script caveat
- README.zh-CN.md: voice transcription platform note, CLI usage for Windows

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@ShengVP ShengVP closed this Jun 11, 2026
BillLucky added a commit that referenced this pull request Jun 11, 2026
refactor: address PR #1 review — remove pm2, fix Windows edges, update docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants