From 08dde3dae4cdbbb3b70a2b7e8d73f12b401f97cf Mon Sep 17 00:00:00 2001 From: "grant.esparza" Date: Fri, 24 Oct 2025 08:53:35 -0700 Subject: [PATCH 1/3] feat: add support for opencode slash command generator --- docs/slash-command-generator.md | 4 +++- slash_commands/config.py | 8 ++++++++ tests/test_config.py | 11 ++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/slash-command-generator.md b/docs/slash-command-generator.md index de79f5a..8f37cdf 100644 --- a/docs/slash-command-generator.md +++ b/docs/slash-command-generator.md @@ -6,7 +6,7 @@ The Slash Command Generator automates the creation of slash command files for AI The generator reads markdown prompts from the `prompts/` directory and produces command files in the appropriate format for each configured AI assistant. It supports: -- **Multiple agents**: 6 supported AI assistants with different command formats +- **Multiple agents**: 7 supported AI assistants with different command formats - **Auto-detection**: Automatically detects configured agents in your workspace - **Dry run mode**: Preview changes without writing files - **Safe overwrite handling**: Prompts before overwriting existing files with backup support @@ -193,6 +193,7 @@ The following agents are supported: | `codex-cli` | Codex CLI | Markdown | `.md` | `.codex/prompts` | [Home](https://developers.openai.com/codex) · [Docs](https://developers.openai.com/codex/cli/) | | `cursor` | Cursor | Markdown | `.md` | `.cursor/commands` | [Home](https://cursor.com/) · [Docs](https://cursor.com/docs) | | `gemini-cli` | Gemini CLI | TOML | `.toml` | `.gemini/commands` | [Home](https://github.com/google-gemini/gemini-cli) · [Docs](https://geminicli.com/docs/) | +| `opencode` | OpenCode CLI | Markdown | `.md` | `.config/opencode/command` | [Home](https://opencode.ai) · [Docs](https://opencode.ai/docs/commands) | | `vs-code` | VS Code | Markdown | `.prompt.md` | `.config/Code/User/prompts` | [Home](https://code.visualstudio.com/) · [Docs](https://code.visualstudio.com/docs) | | `windsurf` | Windsurf | Markdown | `.md` | `.codeium/windsurf/global_workflows` | [Home](https://windsurf.com/editor) · [Docs](https://docs.windsurf.com/) | @@ -284,6 +285,7 @@ Generated files are placed in agent-specific directories: .codex/prompts/ # Codex CLI .cursor/commands/ # Cursor .gemini/commands/ # Gemini CLI +.config/opencode/command/ # OpenCode CLI .codeium/windsurf/global_workflows/ # Windsurf ``` diff --git a/slash_commands/config.py b/slash_commands/config.py index 2f1157c..ffda15a 100644 --- a/slash_commands/config.py +++ b/slash_commands/config.py @@ -59,6 +59,14 @@ def iter_detection_dirs(self) -> Iterable[str]: ".md", (".codeium", ".codeium/windsurf"), ), + ( + "opencode", + "OpenCode CLI", + ".config/opencode/command", + CommandFormat.MARKDOWN, + ".md", + (".config/opencode",), + ), ) _SORTED_AGENT_DATA = tuple(sorted(_SUPPORTED_AGENT_DATA, key=lambda item: item[0])) diff --git a/tests/test_config.py b/tests/test_config.py index ba86a48..6e8333e 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -39,6 +39,13 @@ "command_file_extension": ".toml", "detection_dirs": (".gemini",), }, + "opencode": { + "display_name": "OpenCode CLI", + "command_dir": ".config/opencode/command", + "command_format": CommandFormat.MARKDOWN, + "command_file_extension": ".md", + "detection_dirs": (".config/opencode",), + }, "vs-code": { "display_name": "VS Code", "command_dir": ".config/Code/User/prompts", @@ -128,7 +135,7 @@ def test_supported_agents_include_all_markdown_and_toml_formats( for agent in supported_agents_by_key.values() if agent.command_format is CommandFormat.TOML ] - assert len(markdown_agents) == 5 + assert len(markdown_agents) == 6 assert len(toml_agents) == 1 @@ -149,6 +156,8 @@ def test_detection_dirs_cover_command_directory_roots( ".codeium" in agent.detection_dirs or ".codeium/windsurf" in agent.detection_dirs ) + elif agent.key == "opencode": + assert ".config/opencode" in agent.detection_dirs else: assert command_root in agent.detection_dirs else: From 79f04c8864f464c5a6b506a4057cc95fc9a585ba Mon Sep 17 00:00:00 2001 From: "grant.esparza" Date: Fri, 24 Oct 2025 09:30:39 -0700 Subject: [PATCH 2/3] fix: update project path to use '.opencode' --- slash_commands/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slash_commands/config.py b/slash_commands/config.py index ffda15a..b27a9b8 100644 --- a/slash_commands/config.py +++ b/slash_commands/config.py @@ -65,7 +65,7 @@ def iter_detection_dirs(self) -> Iterable[str]: ".config/opencode/command", CommandFormat.MARKDOWN, ".md", - (".config/opencode",), + (".opencode",), ), ) From f6aeefd0a20261f0b5e15e3791a15497bb39aa62 Mon Sep 17 00:00:00 2001 From: "grant.esparza" Date: Fri, 24 Oct 2025 11:21:33 -0700 Subject: [PATCH 3/3] fix(test): update config directory for corresponding test --- tests/test_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_config.py b/tests/test_config.py index 6e8333e..05caf94 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -44,7 +44,7 @@ "command_dir": ".config/opencode/command", "command_format": CommandFormat.MARKDOWN, "command_file_extension": ".md", - "detection_dirs": (".config/opencode",), + "detection_dirs": (".opencode",), }, "vs-code": { "display_name": "VS Code", @@ -157,7 +157,7 @@ def test_detection_dirs_cover_command_directory_roots( or ".codeium/windsurf" in agent.detection_dirs ) elif agent.key == "opencode": - assert ".config/opencode" in agent.detection_dirs + assert ".opencode" in agent.detection_dirs else: assert command_root in agent.detection_dirs else: