Skip to content

[Bug]: get_feature_paths persists .specify/feature.json during read-only path resolution (check-prerequisites.sh --paths-only) #3025

@athemelis

Description

@athemelis

Bug Description

get_feature_paths() in common.sh calls _persist_feature_json when SPECIFY_FEATURE_DIRECTORY is set, even when invoked purely for path resolution — e.g. check-prerequisites.sh --paths-only, which is documented as "only output path variables (no validation)". This writes the tracked file .specify/feature.json and can overwrite a previously pinned feature directory when a caller passes a temporary override. A skip-write-when-unchanged guard exists, so it only writes when the value differs — but an override value still triggers an unexpected write.

Steps to Reproduce

  1. Pin a feature directory in .specify/feature.json.
  2. Run check-prerequisites.sh --paths-only with SPECIFY_FEATURE_DIRECTORY set to a different value.
  3. Run git status.

Expected Behavior

Read-only / --paths-only path resolution does not modify tracked files.

Actual Behavior

.specify/feature.json is rewritten — the working tree is dirtied and the pinned value is overwritten.

Specify CLI Version

0.11.0

AI Agent

GitHub Copilot

Operating System

macOS Tahoe 26.5.1

Python Version

3.11.15 (uv-managed standalone CPython, cpython-3.11-macos-aarch64-none — uv installs specify under its own Python, not the system CLT 3.9.6 or Homebrew 3.13/3.14)

Error Logs

none (silent write)

Additional Context

Files: .specify/scripts/bash/common.sh (get_feature_paths, _persist_feature_json), .specify/scripts/bash/check-prerequisites.sh. Suggested fix: an opt-out (e.g. SPECIFY_NO_PERSIST_FEATURE_JSON=1) honored in --paths-only mode. Sibling issues: agent-context scoped layout; empty CURRENT_BRANCH.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    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