diff --git a/src/core/templates/skill-templates.ts b/src/core/templates/skill-templates.ts index cd67b634e..509aa6d3a 100644 --- a/src/core/templates/skill-templates.ts +++ b/src/core/templates/skill-templates.ts @@ -1563,38 +1563,20 @@ export function getArchiveChangeSkillTemplate(): SkillTemplate { **If no tasks file exists:** Proceed without task-related warning. -4. **Check if delta specs need syncing** +4. **Assess delta spec sync state** - Check if \`specs/\` directory exists in the change with spec files. + Check for delta specs at \`openspec/changes//specs/\`. If none exist, proceed without sync prompt. - **If delta specs exist, perform a quick sync check:** + **If delta specs exist:** + - Compare each delta spec with its corresponding main spec at \`openspec/specs//spec.md\` + - Determine what changes would be applied (adds, modifications, removals, renames) + - Show a combined summary before prompting - a. **For each delta spec** at \`openspec/changes//specs//spec.md\`: - - Extract requirement names (lines matching \`### Requirement: \`) - - Note which sections exist (ADDED, MODIFIED, REMOVED) + **Prompt options:** + - If changes needed: "Sync now (recommended)", "Archive without syncing" + - If already synced: "Archive now", "Sync anyway", "Cancel" - b. **Check corresponding main spec** at \`openspec/specs//spec.md\`: - - If main spec doesn't exist → needs sync - - If main spec exists, check if ADDED requirement names appear in it - - If any ADDED requirements are missing from main spec → needs sync - - c. **Report findings:** - - **If sync needed:** - \`\`\` - ⚠️ Delta specs may not be synced: - - specs/auth/spec.md → Main spec missing requirement "Token Refresh" - - specs/api/spec.md → Main spec doesn't exist yet - - Would you like to sync now before archiving? - \`\`\` - - Use **AskUserQuestion tool** with options: "Sync now", "Archive without syncing" - - If user chooses sync, execute /opsx:sync logic (use the openspec-sync-specs skill) - - **If already synced (all requirements found):** - - Proceed without prompting (specs appear to be in sync) - - **If no delta specs exist:** Proceed without sync-related checks. + If user chooses sync, execute /opsx:sync logic (use the openspec-sync-specs skill). Proceed to archive regardless of choice. 5. **Perform the archive** @@ -1630,7 +1612,7 @@ export function getArchiveChangeSkillTemplate(): SkillTemplate { **Change:** **Schema:** **Archived to:** openspec/changes/archive/YYYY-MM-DD-/ -**Specs:** ✓ Synced to main specs (or "No delta specs" or "⚠️ Not synced") +**Specs:** ✓ Synced to main specs (or "No delta specs" or "Sync skipped") All artifacts complete. All tasks complete. \`\`\` @@ -1642,7 +1624,7 @@ All artifacts complete. All tasks complete. - Preserve .openspec.yaml when moving to archive (it moves with the directory) - Show clear summary of what happened - If sync is requested, use openspec-sync-specs approach (agent-driven) -- Quick sync check: look for requirement names in delta specs, verify they exist in main specs` +- If delta specs exist, always run the sync assessment and show the combined summary before prompting` }; } @@ -2003,38 +1985,20 @@ export function getOpsxArchiveCommandTemplate(): CommandTemplate { **If no tasks file exists:** Proceed without task-related warning. -4. **Check if delta specs need syncing** - - Check if \`specs/\` directory exists in the change with spec files. - - **If delta specs exist, perform a quick sync check:** - - a. **For each delta spec** at \`openspec/changes//specs//spec.md\`: - - Extract requirement names (lines matching \`### Requirement: \`) - - Note which sections exist (ADDED, MODIFIED, REMOVED) - - b. **Check corresponding main spec** at \`openspec/specs//spec.md\`: - - If main spec doesn't exist → needs sync - - If main spec exists, check if ADDED requirement names appear in it - - If any ADDED requirements are missing from main spec → needs sync - - c. **Report findings:** +4. **Assess delta spec sync state** - **If sync needed:** - \`\`\` - ⚠️ Delta specs may not be synced: - - specs/auth/spec.md → Main spec missing requirement "Token Refresh" - - specs/api/spec.md → Main spec doesn't exist yet + Check for delta specs at \`openspec/changes//specs/\`. If none exist, proceed without sync prompt. - Would you like to sync now before archiving? - \`\`\` - - Use **AskUserQuestion tool** with options: "Sync now", "Archive without syncing" - - If user chooses sync, execute \`/opsx:sync\` logic + **If delta specs exist:** + - Compare each delta spec with its corresponding main spec at \`openspec/specs//spec.md\` + - Determine what changes would be applied (adds, modifications, removals, renames) + - Show a combined summary before prompting - **If already synced (all requirements found):** - - Proceed without prompting (specs appear to be in sync) + **Prompt options:** + - If changes needed: "Sync now (recommended)", "Archive without syncing" + - If already synced: "Archive now", "Sync anyway", "Cancel" - **If no delta specs exist:** Proceed without sync-related checks. + If user chooses sync, execute \`/opsx:sync\` logic. Proceed to archive regardless of choice. 5. **Perform the archive** @@ -2059,7 +2023,7 @@ export function getOpsxArchiveCommandTemplate(): CommandTemplate { - Change name - Schema that was used - Archive location - - Spec sync status (synced / not synced / no delta specs) + - Spec sync status (synced / sync skipped / no delta specs) - Note about any warnings (incomplete artifacts/tasks) **Output On Success** @@ -2096,12 +2060,12 @@ All artifacts complete. All tasks complete. **Change:** **Schema:** **Archived to:** openspec/changes/archive/YYYY-MM-DD-/ -**Specs:** ⚠️ Not synced +**Specs:** Sync skipped (user chose to skip) **Warnings:** - Archived with 2 incomplete artifacts - Archived with 3 incomplete tasks -- Delta specs were not synced (user chose to skip) +- Delta spec sync was skipped (user chose to skip) Review the archive if this was not intentional. \`\`\` @@ -2127,9 +2091,9 @@ Target archive directory already exists. - Use artifact graph (openspec status --json) for completion checking - Don't block archive on warnings - just inform and confirm - Preserve .openspec.yaml when moving to archive (it moves with the directory) -- Quick sync check: look for requirement names in delta specs, verify they exist in main specs - Show clear summary of what happened -- If sync is requested, use /opsx:sync approach (agent-driven)` +- If sync is requested, use /opsx:sync approach (agent-driven) +- If delta specs exist, always run the sync assessment and show the combined summary before prompting` }; }