Files
Tabish Bidiwale 9ae6141eb1 feat: Add codex custom slash command support (#120)
* Document current cli specs and archive safety

* feat: add Codex slash command support

Add support for generating and updating Codex prompts in `.codex/prompts/` directory:
- Implement CodexSlashCommandConfigurator for managing openspec-*.md prompts
- Update AI_TOOLS configuration to include Codex as an available option
- Add Codex registration in SlashCommandRegistry
- Update documentation to reflect Codex support
- Add comprehensive test coverage for Codex init and update workflows

* feat: complete Codex slash command support implementation

Add comprehensive Codex slash command support with Claude.md integration,
config-driven command management, and full test coverage. Update documentation
and changelog to reflect changes.

* chore: mark all Codex slash command tasks as completed

All tasks for the Codex slash command support feature have been implemented and tested.

* docs: remove Codex-specific note from README

Remove the Codex-specific installation note as it's no longer needed in the main setup instructions. This information is better suited for tool-specific documentation.
2025-10-09 01:55:47 +11:00

4.1 KiB

MODIFIED Requirements

Requirement: AI Tool Configuration

The command SHALL configure AI coding assistants with OpenSpec instructions using a marker system.

Scenario: Prompting for AI tool selection

  • WHEN run interactively
  • THEN prompt the user with "Which AI tools do you use?" using a multi-select menu
  • AND list every available tool with a checkbox:
    • Claude Code (creates or refreshes CLAUDE.md and slash commands)
    • Cursor (creates or refreshes .cursor/commands/* slash commands)
    • OpenCode (creates or refreshes .opencode/command/openspec-*.md slash commands)
    • Windsurf (creates or refreshes .windsurf/workflows/openspec-*.md workflows)
    • Kilo Code (creates or refreshes .kilocode/workflows/openspec-*.md workflows)
    • Codex (creates or refreshes global prompts at ~/.codex/prompts/openspec-*.md)
    • AGENTS.md standard (creates or refreshes AGENTS.md with OpenSpec markers)
  • AND show "(already configured)" beside tools whose managed files exist so users understand selections will refresh content
  • AND treat disabled tools as "coming soon" and keep them unselectable
  • AND allow confirming with Enter after selecting one or more tools

Requirement: Slash Command Configuration

The init command SHALL generate slash command files for supported editors using shared templates.

Scenario: Generating slash commands for Claude Code

  • WHEN the user selects Claude Code during initialization
  • THEN create .claude/commands/openspec/proposal.md, .claude/commands/openspec/apply.md, and .claude/commands/openspec/archive.md
  • AND populate each file from shared templates so command text matches other tools
  • AND each template includes instructions for the relevant OpenSpec workflow stage

Scenario: Generating slash commands for Cursor

  • WHEN the user selects Cursor during initialization
  • THEN create .cursor/commands/openspec-proposal.md, .cursor/commands/openspec-apply.md, and .cursor/commands/openspec-archive.md
  • AND populate each file from shared templates so command text matches other tools
  • AND each template includes instructions for the relevant OpenSpec workflow stage

Scenario: Generating slash commands for OpenCode

  • WHEN the user selects OpenCode during initialization
  • THEN create .opencode/command/openspec-proposal.md, .opencode/command/openspec-apply.md, and .opencode/command/openspec-archive.md
  • AND populate each file from shared templates so command text matches other tools
  • AND each template includes instructions for the relevant OpenSpec workflow stage

Scenario: Generating slash commands for Windsurf

  • WHEN the user selects Windsurf during initialization
  • THEN create .windsurf/workflows/openspec-proposal.md, .windsurf/workflows/openspec-apply.md, and .windsurf/workflows/openspec-archive.md
  • AND populate each file from shared templates (wrapped in OpenSpec markers) so workflow text matches other tools
  • AND each template includes instructions for the relevant OpenSpec workflow stage

Scenario: Generating slash commands for Kilo Code

  • WHEN the user selects Kilo Code during initialization
  • THEN create .kilocode/workflows/openspec-proposal.md, .kilocode/workflows/openspec-apply.md, and .kilocode/workflows/openspec-archive.md
  • AND populate each file from shared templates (wrapped in OpenSpec markers) so workflow text matches other tools
  • AND each template includes instructions for the relevant OpenSpec workflow stage

Scenario: Generating slash commands for Codex

  • WHEN the user selects Codex during initialization
  • THEN create global prompt files at ~/.codex/prompts/openspec-proposal.md, ~/.codex/prompts/openspec-apply.md, and ~/.codex/prompts/openspec-archive.md (or under $CODEX_HOME/prompts if set)
  • AND populate each file from shared templates that map the first numbered placeholder ($1) to the primary user input (e.g., change identifier or question text)
  • AND wrap the generated content in OpenSpec markers so openspec update can refresh the prompts without touching surrounding custom notes