Skip to content

Commit cc556e7

Browse files
gesparza3grant.esparza
andauthored
feat: add support for opencode slash command generator (#20)
* feat: add support for opencode slash command generator * fix: update project path to use '.opencode' * fix(test): update config directory for corresponding test --------- Co-authored-by: grant.esparza <grant.esparza@daicompanies.com>
1 parent 0c56308 commit cc556e7

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

docs/slash-command-generator.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The Slash Command Generator automates the creation of slash command files for AI
66

77
The generator reads markdown prompts from the `prompts/` directory and produces command files in the appropriate format for each configured AI assistant. It supports:
88

9-
- **Multiple agents**: 6 supported AI assistants with different command formats
9+
- **Multiple agents**: 7 supported AI assistants with different command formats
1010
- **Auto-detection**: Automatically detects configured agents in your workspace
1111
- **Dry run mode**: Preview changes without writing files
1212
- **Safe overwrite handling**: Prompts before overwriting existing files with backup support
@@ -193,6 +193,7 @@ The following agents are supported:
193193
| `codex-cli` | Codex CLI | Markdown | `.md` | `.codex/prompts` | [Home](https://developers.openai.com/codex) · [Docs](https://developers.openai.com/codex/cli/) |
194194
| `cursor` | Cursor | Markdown | `.md` | `.cursor/commands` | [Home](https://cursor.com/) · [Docs](https://cursor.com/docs) |
195195
| `gemini-cli` | Gemini CLI | TOML | `.toml` | `.gemini/commands` | [Home](https://github.com/google-gemini/gemini-cli) · [Docs](https://geminicli.com/docs/) |
196+
| `opencode` | OpenCode CLI | Markdown | `.md` | `.config/opencode/command` | [Home](https://opencode.ai) · [Docs](https://opencode.ai/docs/commands) |
196197
| `vs-code` | VS Code | Markdown | `.prompt.md` | `.config/Code/User/prompts` | [Home](https://code.visualstudio.com/) · [Docs](https://code.visualstudio.com/docs) |
197198
| `windsurf` | Windsurf | Markdown | `.md` | `.codeium/windsurf/global_workflows` | [Home](https://windsurf.com/editor) · [Docs](https://docs.windsurf.com/) |
198199

@@ -284,6 +285,7 @@ Generated files are placed in agent-specific directories:
284285
.codex/prompts/ # Codex CLI
285286
.cursor/commands/ # Cursor
286287
.gemini/commands/ # Gemini CLI
288+
.config/opencode/command/ # OpenCode CLI
287289
.codeium/windsurf/global_workflows/ # Windsurf
288290
```
289291

slash_commands/config.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ def iter_detection_dirs(self) -> Iterable[str]:
5959
".md",
6060
(".codeium", ".codeium/windsurf"),
6161
),
62+
(
63+
"opencode",
64+
"OpenCode CLI",
65+
".config/opencode/command",
66+
CommandFormat.MARKDOWN,
67+
".md",
68+
(".opencode",),
69+
),
6270
)
6371

6472
_SORTED_AGENT_DATA = tuple(sorted(_SUPPORTED_AGENT_DATA, key=lambda item: item[0]))

tests/test_config.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@
3939
"command_file_extension": ".toml",
4040
"detection_dirs": (".gemini",),
4141
},
42+
"opencode": {
43+
"display_name": "OpenCode CLI",
44+
"command_dir": ".config/opencode/command",
45+
"command_format": CommandFormat.MARKDOWN,
46+
"command_file_extension": ".md",
47+
"detection_dirs": (".opencode",),
48+
},
4249
"vs-code": {
4350
"display_name": "VS Code",
4451
"command_dir": ".config/Code/User/prompts",
@@ -128,7 +135,7 @@ def test_supported_agents_include_all_markdown_and_toml_formats(
128135
for agent in supported_agents_by_key.values()
129136
if agent.command_format is CommandFormat.TOML
130137
]
131-
assert len(markdown_agents) == 5
138+
assert len(markdown_agents) == 6
132139
assert len(toml_agents) == 1
133140

134141

@@ -149,6 +156,8 @@ def test_detection_dirs_cover_command_directory_roots(
149156
".codeium" in agent.detection_dirs
150157
or ".codeium/windsurf" in agent.detection_dirs
151158
)
159+
elif agent.key == "opencode":
160+
assert ".opencode" in agent.detection_dirs
152161
else:
153162
assert command_root in agent.detection_dirs
154163
else:

0 commit comments

Comments
 (0)