|
| 1 | +## MODIFIED Requirements |
| 2 | + |
| 3 | +### Requirement: ToolCommandAdapter interface |
| 4 | + |
| 5 | +The system SHALL define a `ToolCommandAdapter` interface for per-tool formatting. |
| 6 | + |
| 7 | +#### Scenario: Adapter interface structure |
| 8 | + |
| 9 | +- **WHEN** implementing a tool adapter |
| 10 | +- **THEN** `ToolCommandAdapter` SHALL require: |
| 11 | + - `toolId`: string identifier matching `AIToolOption.value` |
| 12 | + - `getFilePath(commandId: string)`: returns file path for command (relative from project root, or absolute for global-scoped tools like Codex) |
| 13 | + - `formatFile(content: CommandContent)`: returns complete file content with frontmatter |
| 14 | + |
| 15 | +#### Scenario: Claude adapter formatting |
| 16 | + |
| 17 | +- **WHEN** formatting a command for Claude Code |
| 18 | +- **THEN** the adapter SHALL output YAML frontmatter with `name`, `description`, `category`, `tags` fields |
| 19 | +- **AND** file path SHALL follow pattern `.claude/commands/opsx/<id>.md` |
| 20 | + |
| 21 | +#### Scenario: Cursor adapter formatting |
| 22 | + |
| 23 | +- **WHEN** formatting a command for Cursor |
| 24 | +- **THEN** the adapter SHALL output YAML frontmatter with `name` as `/opsx-<id>`, `id`, `category`, `description` fields |
| 25 | +- **AND** file path SHALL follow pattern `.cursor/commands/opsx-<id>.md` |
| 26 | + |
| 27 | +#### Scenario: Windsurf adapter formatting |
| 28 | + |
| 29 | +- **WHEN** formatting a command for Windsurf |
| 30 | +- **THEN** the adapter SHALL output YAML frontmatter with `name`, `description`, `category`, `tags` fields |
| 31 | +- **AND** file path SHALL follow pattern `.windsurf/workflows/opsx-<id>.md` |
| 32 | + |
| 33 | +#### Scenario: OpenCode adapter formatting |
| 34 | + |
| 35 | +- **WHEN** formatting a command for OpenCode |
| 36 | +- **THEN** the adapter SHALL output YAML frontmatter with `description` field |
| 37 | +- **AND** file path SHALL follow pattern `.opencode/commands/opsx-<id>.md` using `path.join('.opencode', 'commands', ...)` for cross-platform compatibility |
| 38 | +- **AND** the adapter SHALL transform colon-based command references (`/opsx:name`) to hyphen-based (`/opsx-name`) in the body |
| 39 | + |
| 40 | +## ADDED Requirements |
| 41 | + |
| 42 | +### Requirement: Legacy cleanup for renamed OpenCode command directory |
| 43 | + |
| 44 | +The legacy cleanup module SHALL detect and remove old OpenCode command files from the previous singular `.opencode/command/` directory path. |
| 45 | + |
| 46 | +#### Scenario: Detect old singular-path OpenCode command files |
| 47 | + |
| 48 | +- **WHEN** running legacy artifact detection on a project with files matching `.opencode/command/openspec-*.md` or `.opencode/command/opsx-*.md` |
| 49 | +- **THEN** the system SHALL include those files in the legacy slash command files list via `LEGACY_SLASH_COMMAND_PATHS` |
| 50 | + |
| 51 | +#### Scenario: Clean up old OpenCode command files on init |
| 52 | + |
| 53 | +- **WHEN** a user runs `openspec init` in a project with old `.opencode/command/` artifacts |
| 54 | +- **THEN** the system SHALL remove the old files |
| 55 | +- **AND** generate new command files at `.opencode/commands/` |
0 commit comments