Files
Tabish Bidiwale 810f12fd43 feat: add argument support to archive slash command
Add $ARGUMENTS placeholder to the /openspec:archive slash command to allow explicit change ID specification, improving safety and matching CLI behavior.

Changes:
- Add $ARGUMENTS to archive command frontmatter in OpenCode configurator
- Update archive command template with argument validation steps
- Add rewriteArchiveFile method to handle managed section updates
- Update AGENTS.md documentation for archive command usage

This change makes it possible for users to run `/openspec:archive <change-id>` instead of relying on context inference, reducing the risk of archiving the wrong change.
2025-10-15 15:20:36 +11:00

1.2 KiB

Implementation Tasks

1. Update OpenCode Configurator

  • 1.1 Add $ARGUMENTS placeholder to OpenCode archive frontmatter (matching the proposal pattern)
  • 1.2 Format it as <ChangeId>\n $ARGUMENTS\n</ChangeId> or similar structure for clarity
  • 1.3 Ensure updateExisting rewrites the archive frontmatter/body so $ARGUMENTS persists after openspec update

2. Update Slash Command Templates

  • 2.1 Modify archive steps to validate change ID argument when provided via $ARGUMENTS
  • 2.2 Keep backward compatibility - allow inferring from context if no argument provided
  • 2.3 Add step to validate the change ID exists using openspec list before archiving

3. Update Documentation

  • 3.1 Update AGENTS.md archive examples to show argument usage
  • 3.2 Document that OpenCode now supports /openspec:archive <change-id>

4. Validation and Testing

  • 4.1 Run openspec update to regenerate OpenCode slash commands
  • 4.2 Manually test with OpenCode using /openspec:archive <change-id>
  • 4.3 Test backward compatibility (archive command without arguments)
  • 4.4 Run openspec validate --strict to ensure no issues