Files
Tabish Bidiwale b3d31d224d feat: add GitHub Copilot slash command support (#128)
* feat: add GitHub Copilot slash command support

Add GitHub Copilot as a natively supported AI tool with custom slash
commands for OpenSpec workflow operations. This enables teams using
GitHub Copilot to access /openspec-proposal, /openspec-apply, and
/openspec-archive directly from Copilot's chat interface.

Implementation:
- Create GitHubCopilotSlashCommandConfigurator that writes prompts to
  .github/prompts/ directory with YAML frontmatter and $ARGUMENTS
  placeholder following GitHub Copilot's prompt format
- Register GitHub Copilot in AI_TOOLS configuration and slash
  command registry for automatic init/update integration
- Add comprehensive test coverage for prompt generation, updates,
  and extend mode detection
- Update documentation (README and CHANGELOG) to include GitHub
  Copilot in the slash-command support table

The implementation follows the existing SlashCommandConfigurator
pattern and integrates seamlessly with openspec init and openspec
update commands.

* docs: remove GitHub Copilot from tools list
2025-10-09 02:23:42 +11:00

1.9 KiB

Implementation Tasks

  • Create src/core/configurators/slash/github-copilot.ts implementing SlashCommandConfigurator base class

    • Implement getRelativePath() to return .github/prompts/openspec-{proposal,apply,archive}.prompt.md
    • Implement getFrontmatter() to generate YAML frontmatter with description field and include $ARGUMENTS placeholder
    • Implement generateAll() to create .github/prompts/ directory and write three prompt files with frontmatter, markers, and shared template bodies
    • Implement updateExisting() to refresh only the managed block between markers while preserving frontmatter
    • Set toolId = "github-copilot" and isAvailable = true
  • Register GitHub Copilot configurator in src/core/configurators/slash/registry.ts

    • Import GitHubCopilotSlashCommandConfigurator
    • Add to SLASH_COMMAND_CONFIGURATORS array
    • Update tool picker display name to "GitHub Copilot"
  • Update src/core/init.ts to include GitHub Copilot in the AI tool selection prompt

    • Add GitHub Copilot to the available tools list with detection for existing .github/prompts/openspec-*.prompt.md files
    • Display "(already configured)" when prompt files exist
  • Update src/core/update.ts to refresh GitHub Copilot prompts when they exist

    • Call updateExisting() for GitHub Copilot configurator when .github/prompts/ contains OpenSpec prompt files
  • Add integration tests for GitHub Copilot slash command generation

    • Test generateAll() creates three prompt files with correct structure (frontmatter + markers + body)
    • Test updateExisting() preserves frontmatter and only updates managed blocks
    • Test that missing prompt files are not created during update
  • Update documentation

    • Add GitHub Copilot to README slash-command support table
    • Document .github/prompts/ as the discovery location
    • Add CHANGELOG entry for GitHub Copilot support