[Bug]: check-prerequisites.sh --paths-only still runs branch validation, contradicting --help
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 86/100
调研方向
从 scripts/bash/check-prerequisites.sh 和 issue 中描述的 --paths-only 流程开始,然后将其顺序与 scripts/powershell/check-prerequisites.ps1 以及 common.sh 中的 branch 检查进行比较。在非 feature branch 上使用 --paths-only 和 --json 重现;当路径变量被输出且命令无需进行 branch 验证即可成功时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Bug Description
scripts/bash/check-prerequisites.sh --paths-only is documented as "no validation" / "no prerequisite validation", but the script runs check_feature_branch before the --paths-only early exit. The result: when the current branch does not match the feature-branch naming convention, --paths-only exits non-zero with a branch-format error, even though the caller asked for paths only and explicitly opted out of validation.
Source: https://github.com/github/spec-kit/blob/main/scripts/bash/check-prerequisites.sh#L81-L113
# Get feature paths and validate branch
_paths_output=$(get_feature_paths) || { ... ; exit 1; }
eval "$_paths_output"
unset _paths_output
check_feature_branch "$CURRENT_BRANCH" "$HAS_GIT" || exit 1 # ← runs even with --paths-only
# If paths-only mode, output paths and exit (support JSON + paths-only combined)
if \$PATHS_ONLY; then
...
exit 0
fi
The header documentation (line 14) says: `--paths-only Only output path variables (no validation)` and `--help` (line 54) says `(no prerequisite validation)`. Branch validation is the most user-visible form of validation, so this contradicts the documented behavior.
Steps to Reproduce
- Initialize a Spec Kit project: `specify init test-paths-only --integration claude`
- Switch to a non-feature branch: `git checkout -b chore/some-cleanup`
- Run paths-only: `./.specify/scripts/bash/check-prerequisites.sh --paths-only`
Expected Behavior
`--paths-only` succeeds and emits `REPO_ROOT`, `BRANCH`, `FEATURE_DIR`, etc., regardless of branch name (the caller asked for paths, not validation).
Actual Behavior
Exit 1 with branch-validation error (the message produced by `check_feature_branch` in `common.sh`), no path variables emitted.
Specify CLI Version
0.7.4.dev0
AI Agent
Claude Code
Suggested Fix
Move `check_feature_branch` after the `if $PATHS_ONLY; then ... exit 0; fi` block so `--paths-only` truly skips validation. Same source ordering already exists in `scripts/powershell/check-prerequisites.ps1` — please verify both are aligned.
Context
Surfaced while bulk-installing Spec Kit across 20 internal projects. `/speckit-tasks` and similar commands invoke `check-prerequisites.sh --paths-only --json` from non-feature chore branches and unexpectedly fail with branch-format errors despite the documented opt-out.
- 主要语言
- Python
- 星标
- 138k
- 派生
- 12.4k
- 平均合并
- 3 天 6 小时
- 30 天内合并 PR
- 136
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/spec-kit 的其他 Issue
-
enhancement needs-triage
难度 2/5 1-3 小时 新手友好度 78/100
-
enhancement needs-triage
难度 2/5 1-3 小时 新手友好度 72/100
-
enhancement needs-triage
难度 2/5 1-3 小时 新手友好度 68/100
-
enhancement needs-triage triage-can-wait
难度 2/5 1-3 小时 新手友好度 65/100
-
extension-submission triage-can-wait
难度 2/5 1-3 小时 新手友好度 75/100
相似的 Issue
-
documentation help wanted
难度 2/5 1-3 小时 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 90/100
simonw/sqlite-utils#872 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 78/100