You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Closes#3025 by preventing check-prerequisites --paths-only / -PathsOnly from rewriting .specify/feature.json when SPECIFY_FEATURE_DIRECTORY is only a temporary read-only override.
Both Bash and PowerShell paths now suppress feature context persistence only for paths-only mode; normal command execution continues to persist explicit feature directory context.
Testing
Tested locally with uv run specify --help
Ran existing tests with uv sync && uv run pytest
Tested with a sample project (if applicable)
Additional validation run locally after splitting this PR:
uv run --extra test pytest tests/test_check_prerequisites_paths_only.py -q - 4 passed, 5 skipped
Covered by regression test for read-only .specify/feature.json behavior.
AI Disclosure
I did not use AI assistance for this contribution
I did use AI assistance (describe below)
This PR was implemented by Codex (GPT-5) acting as an AI coding agent on behalf of @luohui1. The agent read the repository contribution/security/code-of-conduct docs and issue templates, inspected the relevant code paths, implemented the changes, ran the validation listed above, and prepared this PR description.
Thanks for this. The fix direction is right — --paths-only is documented as read-only path resolution, so it shouldn't write tracked files. A couple of requests before this lands:
1. Reframe the rationale. The PR/issue describes SPECIFY_FEATURE_DIRECTORY as "only a temporary read-only override," but that's not how it's defined in the code. In get_feature_paths() it's an explicit override that is deliberately persisted ("Persist to feature.json so future sessions without the env var still work"). Can you re-anchor the justification on the defensible claim — "--paths-only must not mutate tracked files" — rather than on the env var being temporary? Also worth a line confirming persistence is still covered by the non-paths-only commands (specify, setup-plan, setup-tasks, etc.), so the "future sessions still work" guarantee holds.
2. Drop the new SPECIFY_NO_PERSIST_FEATURE_JSON env var. It's a global back-channel for one bit of state, and the PowerShell path sets $env:SPECIFY_NO_PERSIST_FEATURE_JSON = '1' without ever unsetting it — so suppression leaks for the rest of the process and would silently disable persistence for any later in-process Save-FeatureJson call. Please pass this as a local parameter/switch instead:
Bash: a flag/arg on get_feature_paths threaded down to _persist_feature_json.
PowerShell: a [switch]$NoPersist on Get-FeaturePathsEnv passed to Save-FeatureJson.
That keeps it self-contained and removes the leak. (If there's a strong reason to keep the env var, the PS side at least needs to scope/unset it in a finally to match the inline scoping Bash already uses.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #3025 by preventing
check-prerequisites --paths-only/-PathsOnlyfrom rewriting.specify/feature.jsonwhenSPECIFY_FEATURE_DIRECTORYis only a temporary read-only override.Both Bash and PowerShell paths now suppress feature context persistence only for paths-only mode; normal command execution continues to persist explicit feature directory context.
Testing
uv run specify --helpuv sync && uv run pytestAdditional validation run locally after splitting this PR:
uv run --extra test pytest tests/test_check_prerequisites_paths_only.py -q- 4 passed, 5 skippeduvx ruff check tests/test_check_prerequisites_paths_only.py- passedgit diff --check- passedManual test results
Agent: Codex (GPT-5) | OS/Shell: Windows 11 / PowerShell 7.5.4
.specify/scripts/powershell/check-prerequisites.ps1 -Json -PathsOnly.specify/feature.jsonbehavior.AI Disclosure
This PR was implemented by Codex (GPT-5) acting as an AI coding agent on behalf of @luohui1. The agent read the repository contribution/security/code-of-conduct docs and issue templates, inspected the relevant code paths, implemented the changes, ran the validation listed above, and prepared this PR description.