Repository navigation
Description
Bug Description
The "must be on a feature branch" check can be bypassed when .specify/feature.json pins an existing feature directory (feature_json_matches_feature_dir / Test-FeatureJsonMatchesFeatureDir). setup-plan and setup-tasks apply this bypass; check-prerequisites does not in its validating modes. So with the same feature.json on the same branch, half the spec-kit commands succeed and half fail.
This affects both the bash and PowerShell script sets.
Evidence (main @ 7106858)
The helper is called from only two of the three scripts, in each language:
scripts/bash/common.sh:191 feature_json_matches_feature_dir()
scripts/bash/setup-plan.sh:36 guarded ✅
scripts/bash/setup-tasks.sh:32 guarded ✅
scripts/bash/check-prerequisites.sh:115 check_feature_branch — UNGUARDED ❌
scripts/powershell/common.ps1:169 Test-FeatureJsonMatchesFeatureDir
scripts/powershell/setup-plan.ps1:27 guarded ✅
scripts/powershell/setup-tasks.ps1:23 guarded ✅
scripts/powershell/check-prerequisites.ps1:85 Test-FeatureBranch — UNGUARDED ❌
--paths-only / -PathsOnly exits before the branch check, which is why only that mode happens to work.
Command → script mapping
| Command | Script call | Honors feature.json? |
|---|---|---|
/speckit.plan |
setup-plan |
✅ |
/speckit.tasks |
setup-tasks |
✅ |
/speckit.clarify |
check-prerequisites --paths-only |
➖ exits before check |
/speckit.checklist |
check-prerequisites --json |
❌ fails |
/speckit.analyze |
check-prerequisites --require-tasks --include-tasks |
❌ fails |
/speckit.implement |
check-prerequisites --require-tasks --include-tasks |
❌ fails |
/speckit.taskstoissues |
check-prerequisites --require-tasks --include-tasks |
❌ fails |
Steps to Reproduce
On a branch whose name is not a feature pattern, with feature.json pinning a valid populated feature dir:
bash .specify/scripts/bash/setup-plan.sh --json # EXIT=0
bash .specify/scripts/bash/check-prerequisites.sh --json --paths-only # EXIT=0
bash .specify/scripts/bash/check-prerequisites.sh --json # EXIT=1 "Not on a feature branch"
bash .specify/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks # EXIT=1
Expected Behavior
check-prerequisites honors feature.json the same way setup-plan / setup-tasks do, so the whole command set behaves consistently. The bypass only skips the branch-name check, not the file-existence checks (plan.md, tasks.md).
Actual Behavior
check-prerequisites fails with "Not on a feature branch" even though feature.json pins a valid feature dir, blocking /speckit.checklist, /speckit.analyze, /speckit.implement, /speckit.taskstoissues.
Specify CLI Version
main @ 7106858 (reported on 0.9.3)
AI Agent
Codex CLI
Suggested Fix
Wrap the branch check in both check-prerequisites.sh and check-prerequisites.ps1 with the same guard the setup scripts use:
if ! feature_json_matches_feature_dir "$REPO_ROOT" "$FEATURE_DIR"; then
check_feature_branch "$CURRENT_BRANCH" "$HAS_GIT" || exit 1
fiREPO_ROOT / FEATURE_DIR are already in scope at that point. PR incoming.
Activity
mnriem commentedon Jun 8, 2026
This is resolved by #2873 which removes the branch-name check from
check-prerequisitesentirely (both bash and PowerShell) as part of making the git extension opt-in. Closing PR #2888 in favor of the broader fix.