已关闭
[Follow-up] gc precommit check 评审暂缓项跟踪(JSON reason / 安装错误分类 / ToolVersion stdout-only) #260
zhaoxufeng创建于 6月4日关闭于 6月5日
6月4日 关联了pull request:feat(precommit): structured reason, install failure categories, stdout-only version (#260)
6月4日 关联了pull request:feat(precommit): structured reason, install failure categories, stdout-only version (#260)
背景
在 PR #220(
gc precommit check)的评审中,有几条建议经评估后暂缓到后续 PR 处理(非阻塞),本 issue 用于跟踪。来源:PR #220 6-agent 评审的 P2 / 行内建议项。
待办项
1.
precommit check --json增加结构化失败原因字段(原 P2 #10)当前通过
ok+run_result+run_output+ stderr 提示区分失败,但没有单独的error/reason机器可读字段。reason: "no_config" | "tool_missing" | "hook_missing" | "run_failed" | "not_in_repo"。pkg/precommit.Result的 JSON 契约,需同步docs/COMMANDS.md。2. 安装失败按错误类型细分(原 P2 #17)
EnsureTool当前聚合各 installer 的失败详情为一条错误,但不区分"权限不足 / 网络失败 / 工具链缺失"。pkg/precommit/install.go;注意保持跨平台与可测试性(经CommandRunner注入)。3.
ToolVersion版本探测改用 stdout-only(原行内建议 / detect.go L26)当前经
CommandRunner.Run使用CombinedOutput()(混 stdout+stderr)。若未来pre-commit --version在 stderr 输出 warning,可能干扰版本解析。cmd.Output())。CommandRunner接口以区分 stdout/stderr(改动面相对较大),故与上面两项一并排期。验收
CommandRunner,不依赖真实 pre-commit)。docs/COMMANDS.md与设计文档docs/superpowers/specs/2026-06-03-precommit-check-design.md。关联