Skip to content

fix(skills): Windows 下 python3 硬编码导致 6verity/doctor 失效 - #115

Open
hailuohl wants to merge 2 commits into
jihe520:mainfrom
hailuohl:fix/skills-windows-python-compat
Open

fix(skills): Windows 下 python3 硬编码导致 6verity/doctor 失效#115
hailuohl wants to merge 2 commits into
jihe520:mainfrom
hailuohl:fix/skills-windows-python-compat

Conversation

@hailuohl

@hailuohl hailuohl commented Sep 7, 2026

Copy link
Copy Markdown

关联 issue:#114

Summary

修复 Windows(原生 Python + Git Bash,无 python3 命令)环境下两个质量关卡失效的问题:

  • skills/6verity/scripts/writing_check.sh
    • 脚本开头探测 python3 / python 任一可用解释器(PYTHON_BIN),heredoc 改用探测结果;两者都缺失时输出明确错误并以退出码 2 退出,而不是 python3: command not found
    • 修复选项缺值时的死循环:--paper-dir 等带值选项位于末尾(缺值)时,原实现 shift 2 无法消费参数导致 while 永真刷屏;现在统一报 ERROR: <option> requires a value 并以退出码 2 退出(新增 die_missing_value 辅助函数)。
  • skills/doctor/SKILL.md
    • check_cmd 函数补显式 return 0 / return 1——原实现以 echo 结尾恒返回 0,导致 check_cmd python3 || check_cmd python 的回退分支永远不执行(Windows 上 python 明明存在却报 MISS,误导后续安装向导)。
    • Python 包检测段改用探测到的 PYTHON_BIN 执行 heredoc,并在无解释器时显式跳过提示。
    • 修正 "command -v 在 PowerShell 中可用" 的错误说明(POSIX 内建,PowerShell 应使用 Get-Command)。
    • 核心工具表格与"必须项"表述同步为 python3 / python

行为对比

场景 修复前 修复后
Windows 上运行 writing_check.sh python3: command not found,验收门禁失效 探测到 python,完整执行全部检查
Windows 上运行 doctor Step 2 MISS python3(即使 python 已装),包检测报错 MISS python3 后回退 OK python,包检测完整执行
writing_check.sh --paper-dir(缺值) 死循环刷屏 ERROR: --paper-dir requires a value,退出码 2
Linux/macOS 正常 行为不变(优先 python3

验证

在 Windows 10 + Git Bash(command -v python3 为空、python = 3.12.8)实测:

  1. bash -n 语法检查通过;
  2. writing_check.sh --paper-dir <含 PLACEHOLDER 的测试目录>:探测到 python 并完整执行,正确输出 FAIL: placeholder text remains ...(门禁逻辑生效);
  3. writing_check.sh --paper-dir(缺值):立即报错退出(exit=2),不再死循环;
  4. doctor SKILL.md 的 Step 2 代码块原样提取执行:MISS python3OK python (...) 回退生效,6 个 Python 包检测全部经 python 执行;
  5. doctor 原版 check_cmd 的回退失效问题已单独复现确认(函数返回值恒为 0)。

备注

  • 桌面版内置 Claude Code + 全套 skills,Claude Code 在 Windows 上经 Git Bash 执行这些脚本,因此该修复直接惠及所有 Windows 桌面版用户的验收与诊断流程。
  • 改动保持 bash 3.2 兼容(未使用 bash 4+ 特性),macOS 老版本 bash 不受影响。

@hailuohl hailuohl closed this Sep 7, 2026
@hailuohl
hailuohl force-pushed the fix/skills-windows-python-compat branch from e578692 to 83d8783 Compare September 7, 2026 19:35
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.

1 participant