| name | speckit-sync-apply |
| description | Apply approved drift resolutions to specs and/or code |
| compatibility | Requires spec-kit project structure with .specify/ directory |
| metadata | {"author":"github-spec-kit","source":"sync:commands/apply.md"} |
Spec Sync: Apply Resolutions
Apply approved resolutions from the proposals file. Updates specs or generates implementation tasks.
User Input
$ARGUMENTS
Prerequisites
- Run
speckit.sync.analyze to generate drift report
- Run
speckit.sync.propose to generate proposals
- Review and mark proposals as approved in
.specify/sync/proposals.json
Context
Read:
.specify/sync/proposals.json - proposals with approval status
- Original spec files that need updating
Steps
1. Load Approved Proposals
Read proposals and filter to those marked approved: true.
If no proposals are approved:
- In interactive mode: prompt to review proposals first
- In batch mode: exit with "No approved proposals to apply"
2. Apply Backfill Proposals
For each approved BACKFILL proposal:
- Read the original spec file
- Locate the requirement being updated
- Replace with proposed text
- Add any new acceptance scenarios
- Update the spec's "Status" or "Last Modified" metadata
- Write the updated spec
Track changes:
{
"spec": "spec-011",
"requirement": "FR-001",
"before": "original text",
"after": "updated text",
"applied_at": "timestamp"
}
3. Apply New Spec Proposals
For each approved NEW_SPEC proposal:
- Create new spec directory:
specs/{spec-id}/
- Write
spec.md with generated content
- Create empty
tasks.md placeholder
- Add to git (if in a git repo)
4. Generate Implementation Tasks for Align Proposals
For ALIGN proposals (spec → code), don't modify code directly. Instead:
- Generate a task file:
.specify/sync/align-tasks.md
- Each task describes the code change needed
- Optionally create GitHub issues if
--create-issues is passed
Task format:
## Task: Align [spec-id]/[requirement]
**Spec Requirement**: [FR-XXX]
**Current Code**: [description of current behavior]
**Required Change**: [description of needed change]
**Files to Modify**: [list of files]
**Estimated Effort**: [small/medium/large]
### Acceptance Criteria
- [ ] [criterion 1]
- [ ] [criterion 2]
5. Handle Supersede Resolutions
For SUPERSEDE proposals:
- Add
superseded_by field to old spec metadata
- Add cross-reference in new spec
- Optionally mark old spec as deprecated
6. Generate Apply Report
# Sync Apply Report
Applied: [timestamp]
## Changes Made
### Specs Updated
| Spec | Requirement | Change Type |
|------|-------------|-------------|
| spec-011 | FR-001 | Modified |
| spec-011 | FR-015 | Added |
### New Specs Created
- spec-013-reconciliation
### Implementation Tasks Generated
- 3 tasks in `.specify/sync/align-tasks.md`
### Not Applied
| Proposal | Reason |
|----------|--------|
| spec-008/FR-003 | Not approved |
## Next Steps
1. Review updated specs
2. Commit changes: `git add specs/ && git commit -m "sync: apply drift resolutions"`
3. Implement tasks in align-tasks.md
7. Save Report
Write to:
.specify/sync/apply-report.md
.specify/sync/apply-report.json
Options
--dry-run: Show what would be applied without making changes
--create-issues: Create GitHub issues for ALIGN tasks
--auto-commit: Commit spec changes automatically
--spec <id>: Apply only proposals for a specific spec
Example Usage
/speckit.sync.apply --dry-run
/speckit.sync.apply
/speckit.sync.apply --auto-commit --create-issues
Safety
- Always creates backups before modifying specs
- Backups stored in
.specify/sync/backups/
- Use
--dry-run first to preview changes
- All changes are logged for audit