[Bug]: check-prerequisites.sh --paths-only still runs branch validation, contradicting --help
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 86/100
Hướng nghiên cứu
Bắt đầu với scripts/bash/check-prerequisites.sh và luồng --paths-only được mô tả trong issue, sau đó so sánh thứ tự của luồng này với scripts/powershell/check-prerequisites.ps1 và phần kiểm tra branch trong common.sh. Tái hiện trên một branch không phải feature với --paths-only và --json; hoàn tất khi các biến đường dẫn được xuất ra và lệnh chạy thành công mà không cần xác thực branch.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 138k
- Fork
- 12.4k
- Merge trung bình
- 3 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 154
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của github/spec-kit
-
enhancement needs-triage triage-can-wait
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
preset-submission triage-must-have validation-passed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
extension-submission triage-must-have validation-passed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
extension-submission triage-can-wait validation-passed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
[Feature]: 给 slug 添加默认值 Đang mởenhancement needs-triage triage-can-wait
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Tất cả issue của github/spec-kit
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
xinnan-tech/xiaozhi-fde-talk#263 ·
-
rules
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
huggingface/Repo2RLEnv#163 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
huggingface/sentence-transformers#4074 ·
-
comp/dashboard invalid P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
NousResearch/hermes-agent#121143 ·