Add smart detection to preserve .specify/ when adding agents #1506
+66
−3
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.
Smart Detection: Preserve User Work When Adding Agents
Problem
When users initialized a project with one agent and later wanted to add another agent, running
specify initagain would overwrite the.specify/directorySolution
Implement smart detection that automatically detects existing
.specify/directory and preserves user's work by default.How It Works
.specify/directory exists with content--forceflag to explicitly overwriteUser Experience
specify init . --ai claude
Work on project...
specify init . --ai copilot
✅ Automatically preserves .specify/, adds .github/ directory
Shows: "Existing project detected - preserving your work"
Key Features
✅ Safe by default - Automatically preserves existing work
✅ Intuitive - Users do what feels natural (just run init again)
✅ Clear feedback - Shows what's being preserved or overwritten
✅ Explicit override - Use --force to reinitialize
✅ Backward compatible - Existing single-agent workflow unchanged
Implementation Details
Code Changes (~100 lines)
Added:
Files Modified:
Breaking Changes
None. This is a purely additive feature that improves existing behavior.
AI Assistance
This implementation was developed with assistance from Claude Code, which was utilized for both the technical implementation and the creation of this pull request description.