Skip to content

Inconsistent feature resolution: check-prerequisites.sh enforces branch name while setup-plan.sh/setup-tasks.sh honor feature.json #3273

Description

@PechiSW

Summary

Feature-directory resolution is inconsistent across the bundled scripts. check-prerequisites.sh (used by /speckit.implement) enforces the feature-branch name unconditionally, while setup-plan.sh and setup-tasks.sh skip that check when .specify/feature.json pins a valid feature directory. As a result, a valid feature.json lets plan and tasks run on any branch, but /speckit.implement still fails on a branch not named NNN-....

Environment

  • Spec Kit CLI: 0.8.18

Detail

scripts/bash/common.sh get_feature_paths resolves the feature directory from, in priority order:

  1. SPECIFY_FEATURE_DIRECTORY env var
  2. .specify/feature.json feature_directory
  3. branch-name prefix lookup

setup-plan.sh and setup-tasks.sh wrap the branch validation with feature_json_matches_feature_dir, e.g. "skip the git branch pattern check when feature.json resolves to the active feature dir". But check-prerequisites.sh calls check_feature_branch "$CURRENT_BRANCH" "$HAS_GIT" unconditionally, with no such guard. CURRENT_BRANCH comes from the git branch (unless SPECIFY_FEATURE is set), so feature.json alone does not let /speckit.implement proceed.

Steps to reproduce

  1. In a git repo, on a branch not named like NNN-... (e.g. feature/foo), create specs/001-x/{spec,plan,tasks}.md and .specify/feature.json = {"feature_directory":"specs/001-x"}.
  2. Run the plan or tasks prerequisite (setup-plan.sh / setup-tasks.sh): passes (feature.json honored).
  3. Run check-prerequisites.sh --json --require-tasks: fails with ERROR: Not on a feature branch.

Expected

Consistent resolution. If .specify/feature.json (or SPECIFY_FEATURE_DIRECTORY) pins a valid feature directory, every prerequisite script should accept it.

Actual

check-prerequisites.sh ignores feature.json for the branch gate, so /speckit.implement fails where /speckit.plan and /speckit.tasks succeed.

Suggested fix

Wrap the check_feature_branch call in check-prerequisites.sh with the same feature_json_matches_feature_dir guard used by setup-plan.sh / setup-tasks.sh, so the branch-name check is skipped when feature.json resolves to the active feature directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions