@@ -37,58 +37,57 @@ Specify supports multiple AI agents by generating agent-specific command files a
3737| ** Cursor** | ` .cursor/commands/ ` | Markdown | ` cursor-agent ` | Cursor CLI |
3838| ** Qwen Code** | ` .qwen/commands/ ` | TOML | ` qwen ` | Alibaba's Qwen Code CLI |
3939| ** opencode** | ` .opencode/command/ ` | Markdown | ` opencode ` | opencode CLI |
40+ | ** Codex CLI** | ` .codex/commands/ ` | Markdown | ` codex ` | Codex CLI |
4041| ** Windsurf** | ` .windsurf/workflows/ ` | Markdown | N/A (IDE-based) | Windsurf IDE workflows |
42+ | ** Kilo Code** | ` .kilocode/rules/ ` | Markdown | N/A (IDE-based) | Kilo Code IDE |
43+ | ** Auggie CLI** | ` .augment/rules/ ` | Markdown | ` auggie ` | Auggie CLI |
44+ | ** Roo Code** | ` .roo/rules/ ` | Markdown | N/A (IDE-based) | Roo Code IDE |
4145| ** CodeBuddy** | ` .codebuddy/commands/ ` | Markdown | ` codebuddy ` | CodeBuddy |
4246| ** Amazon Q Developer CLI** | ` .amazonq/prompts/ ` | Markdown | ` q ` | Amazon Q Developer CLI |
4347
4448### Step-by-Step Integration Guide
4549
46- Follow these steps to add a new agent (using Windsurf as an example):
50+ Follow these steps to add a new agent (using a hypothetical new agent as an example):
4751
48- #### 1. Update AI_CHOICES Constant
52+ #### 1. Add to AGENT_CONFIG
4953
50- Add the new agent to the ` AI_CHOICES ` dictionary in ` src/specify_cli/__init__.py ` :
54+ ** IMPORTANT** : Use the actual CLI tool name as the key, not a shortened version.
55+
56+ Add the new agent to the ` AGENT_CONFIG ` dictionary in ` src/specify_cli/__init__.py ` . This is the ** single source of truth** for all agent metadata:
5157
5258``` python
53- AI_CHOICES = {
54- " copilot" : " GitHub Copilot" ,
55- " claude" : " Claude Code" ,
56- " gemini" : " Gemini CLI" ,
57- " cursor" : " Cursor" ,
58- " qwen" : " Qwen Code" ,
59- " opencode" : " opencode" ,
60- " windsurf" : " Windsurf" ,
61- " codebuddy" : " CodeBuddy"
62- " q" : " Amazon Q Developer CLI"
59+ AGENT_CONFIG = {
60+ # ... existing agents ...
61+ " new-agent-cli" : { # Use the ACTUAL CLI tool name (what users type in terminal)
62+ " name" : " New Agent Display Name" ,
63+ " folder" : " .newagent/" , # Directory for agent files
64+ " install_url" : " https://example.com/install" , # URL for installation docs (or None if IDE-based)
65+ " requires_cli" : True , # True if CLI tool required, False for IDE-based agents
66+ },
6367}
6468```
6569
66- Also update the ` agent_folder_map ` in the same file to include the new agent's folder for the security notice:
70+ ** Key Design Principle** : The dictionary key should match the actual executable name that users install. For example:
71+ - ✅ Use ` "cursor-agent" ` because the CLI tool is literally called ` cursor-agent `
72+ - ❌ Don't use ` "cursor" ` as a shortcut if the tool is ` cursor-agent `
6773
68- ``` python
69- agent_folder_map = {
70- " claude" : " .claude/" ,
71- " gemini" : " .gemini/" ,
72- " cursor" : " .cursor/" ,
73- " qwen" : " .qwen/" ,
74- " opencode" : " .opencode/" ,
75- " codex" : " .codex/" ,
76- " windsurf" : " .windsurf/" ,
77- " kilocode" : " .kilocode/" ,
78- " auggie" : " .auggie/" ,
79- " copilot" : " .github/" ,
80- " q" : " .amazonq/" ,
81- " codebuddy" : " .codebuddy/"
82- }
83- ```
74+ This eliminates the need for special-case mappings throughout the codebase.
75+
76+ ** Field Explanations** :
77+ - ` name ` : Human-readable display name shown to users
78+ - ` folder ` : Directory where agent-specific files are stored (relative to project root)
79+ - ` install_url ` : Installation documentation URL (set to ` None ` for IDE-based agents)
80+ - ` requires_cli ` : Whether the agent requires a CLI tool check during initialization
8481
8582#### 2. Update CLI Help Text
8683
87- Update all help text and examples to include the new agent:
84+ Update the ` --ai ` parameter help text in the ` init() ` command to include the new agent:
85+
86+ ``` python
87+ ai_assistant: str = typer.Option(None , " --ai" , help = " AI assistant to use: claude, gemini, copilot, cursor-agent, qwen, opencode, codex, windsurf, kilocode, auggie, codebuddy, new-agent-cli, or q" ),
88+ ```
8889
89- - Command option help: ` --ai ` parameter description
90- - Function docstrings and examples
91- - Error messages with agent lists
90+ Also update any function docstrings, examples, and error messages that list available agents.
9291
9392#### 3. Update README Documentation
9493
@@ -192,11 +191,58 @@ elif selected_ai == "windsurf":
192191 agent_tool_missing = True
193192```
194193
195- ** Note** : Skip CLI checks for IDE-based agents (Copilot, Windsurf).
194+ ** Note** : CLI tool checks are now handled automatically based on the ` requires_cli ` field in AGENT_CONFIG. No additional code changes needed in the ` check() ` or ` init() ` commands - they automatically loop through AGENT_CONFIG and check tools as needed.
195+
196+ ## Important Design Decisions
197+
198+ ### Using Actual CLI Tool Names as Keys
199+
200+ ** CRITICAL** : When adding a new agent to AGENT_CONFIG, always use the ** actual executable name** as the dictionary key, not a shortened or convenient version.
201+
202+ ** Why this matters:**
203+ - The ` check_tool() ` function uses ` shutil.which(tool) ` to find executables in the system PATH
204+ - If the key doesn't match the actual CLI tool name, you'll need special-case mappings throughout the codebase
205+ - This creates unnecessary complexity and maintenance burden
206+
207+ ** Example - The Cursor Lesson:**
208+
209+ ❌ ** Wrong approach** (requires special-case mapping):
210+ ``` python
211+ AGENT_CONFIG = {
212+ " cursor" : { # Shorthand that doesn't match the actual tool
213+ " name" : " Cursor" ,
214+ # ...
215+ }
216+ }
217+
218+ # Then you need special cases everywhere:
219+ cli_tool = agent_key
220+ if agent_key == " cursor" :
221+ cli_tool = " cursor-agent" # Map to the real tool name
222+ ```
223+
224+ ✅ ** Correct approach** (no mapping needed):
225+ ``` python
226+ AGENT_CONFIG = {
227+ " cursor-agent" : { # Matches the actual executable name
228+ " name" : " Cursor" ,
229+ # ...
230+ }
231+ }
232+
233+ # No special cases needed - just use agent_key directly!
234+ ```
235+
236+ ** Benefits of this approach:**
237+ - Eliminates special-case logic scattered throughout the codebase
238+ - Makes the code more maintainable and easier to understand
239+ - Reduces the chance of bugs when adding new agents
240+ - Tool checking "just works" without additional mappings
196241
197242## Agent Categories
198243
199244### CLI-Based Agents
245+
200246Require a command-line tool to be installed:
201247- ** Claude Code** : ` claude ` CLI
202248- ** Gemini CLI** : ` gemini ` CLI
@@ -260,20 +306,23 @@ Different agents use different argument placeholders:
260306
261307## Common Pitfalls
262308
263- 1 . ** Forgetting update scripts** : Both bash and PowerShell scripts must be updated
264- 2 . ** Missing CLI checks** : Only add for agents that actually have CLI tools
265- 3 . ** Wrong argument format** : Use correct placeholder format for each agent type
266- 4 . ** Directory naming** : Follow agent-specific conventions exactly
267- 5 . ** Help text inconsistency** : Update all user-facing text consistently
309+ 1 . ** Using shorthand keys instead of actual CLI tool names** : Always use the actual executable name as the AGENT_CONFIG key (e.g., ` "cursor-agent" ` not ` "cursor" ` ). This prevents the need for special-case mappings throughout the codebase.
310+ 2 . ** Forgetting update scripts** : Both bash and PowerShell scripts must be updated when adding new agents.
311+ 3 . ** Incorrect ` requires_cli ` value** : Set to ` True ` only for agents that actually have CLI tools to check; set to ` False ` for IDE-based agents.
312+ 4 . ** Wrong argument format** : Use correct placeholder format for each agent type (` $ARGUMENTS ` for Markdown, ` {{args}} ` for TOML).
313+ 5 . ** Directory naming** : Follow agent-specific conventions exactly (check existing agents for patterns).
314+ 6 . ** Help text inconsistency** : Update all user-facing text consistently (help strings, docstrings, README, error messages).
268315
269316## Future Considerations
270317
271318When adding new agents:
319+
272320- Consider the agent's native command/workflow patterns
273321- Ensure compatibility with the Spec-Driven Development process
274322- Document any special requirements or limitations
275323- Update this guide with lessons learned
324+ - Verify the actual CLI tool name before adding to AGENT_CONFIG
276325
277326---
278327
279- * This documentation should be updated whenever new agents are added to maintain accuracy and completeness.*
328+ * This documentation should be updated whenever new agents are added to maintain accuracy and completeness.*
0 commit comments