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.3 KiB

Add Archive Command Arguments

Why

The /openspec:archive slash command currently lacks argument support, forcing the AI to infer which change to archive from conversation context or by listing all changes. This creates a safety risk where the wrong proposal could be archived if the context is ambiguous or multiple changes exist. Users expect to specify the change ID explicitly, matching the behavior of the CLI command openspec archive <id>.

What Changes

  • Add $ARGUMENTS placeholder to the OpenCode archive slash command frontmatter (matching existing pattern for proposal command)
  • Update archive command template steps to validate the specific change ID argument when provided
  • Note: Codex, GitHub Copilot, and Amazon Q already have $ARGUMENTS for archive; Claude/Cursor/Windsurf/Kilocode don't support arguments

Impact

  • Affected specs: cli-update (slash command generation logic)
  • Affected code:
    • src/core/configurators/slash/opencode.ts (add $ARGUMENTS to archive frontmatter)
    • src/core/templates/slash-command-templates.ts (archive template steps for argument validation)
  • Breaking: No - this is additive functionality that makes the command safer
  • User-facing: Yes - OpenCode users will be able to pass the change ID as an argument: /openspec:archive <change-id>