[Bug]: check-prerequisites.sh --paths-only still runs branch validation, contradicting --help

Abierto Apto para principiantes
#2,477 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
86/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
bash, git, powershell
Área
cli, tooling

Línea de trabajo

Comienza con scripts/bash/check-prerequisites.sh y el flujo de --paths-only descrito en el issue; después, compara su orden con scripts/powershell/check-prerequisites.ps1 y la comprobación de branch en common.sh. Reprodúcelo en un branch que no sea de feature con --paths-only y --json; se considera terminado cuando se emiten las variables de ruta y el comando se ejecuta correctamente sin validación del branch.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

stale

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

  1. Initialize a Spec Kit project: `specify init test-paths-only --integration claude`
  2. Switch to a non-feature branch: `git checkout -b chore/some-cleanup`
  3. 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.

Lenguaje dominante
Python
Estrellas
138k
Forks
12.4k
Merge medio
3 d 6 h
PR fusionados (30 d)
136

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de github/spec-kit

Todos los issues de github/spec-kit

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.