π« Toolkit to help you get started with SDD or any other process!
feat: add Trae IDE support as a new agent (#1817)
ι»ι»ζ±ͺa177a1a6d149
diff --git a/.github/workflows/scripts/create-github-release.sh b/.github/workflows/scripts/create-github-release.shindex 864e0011b..b57778384 100755--- a/.github/workflows/scripts/create-github-release.sh+++ b/.github/workflows/scripts/create-github-release.sh@@ -58,6 +58,8 @@ gh release create "$VERSION" \.genreleases/spec-kit-template-vibe-ps-"$VERSION".zip \.genreleases/spec-kit-template-kimi-sh-"$VERSION".zip \.genreleases/spec-kit-template-kimi-ps-"$VERSION".zip \+ .genreleases/spec-kit-template-trae-sh-"$VERSION".zip \+ .genreleases/spec-kit-template-trae-ps-"$VERSION".zip \.genreleases/spec-kit-template-generic-sh-"$VERSION".zip \.genreleases/spec-kit-template-generic-ps-"$VERSION".zip \--title "Spec Kit Templates - $VERSION_NO_V" \diff --git a/.github/workflows/scripts/create-release-packages.ps1 b/.github/workflows/scripts/create-release-packages.ps1index 60ad3da97..aa79a9556 100644--- a/.github/workflows/scripts/create-release-packages.ps1+++ b/.github/workflows/scripts/create-release-packages.ps1@@ -14,7 +14,7 @@.PARAMETER AgentsComma or space separated subset of agents to build (default: all)- Valid agents: claude, gemini, copilot, cursor-agent, qwen, opencode, windsurf, codex, kilocode, auggie, roo, codebuddy, amp, kiro-cli, bob, qodercli, shai, tabnine, agy, vibe, kimi, generic+ Valid agents: claude, gemini, copilot, cursor-agent, qwen, opencode, windsurf, codex, kilocode, auggie, roo, codebuddy, amp, kiro-cli, bob, qodercli, shai, tabnine, agy, vibe, kimi, trae, generic.PARAMETER ScriptsComma or space separated subset of script types to build (default: both)@@ -454,6 +454,11 @@ function Build-Variant {New-Item -ItemType Directory -Force -Path $skillsDir | Out-NullNew-KimiSkills -SkillsDir $skillsDir -ScriptVariant $Script}+ 'trae' {+ $rulesDir = Join-Path $baseDir ".trae/rules"+ New-Item -ItemType Directory -Force -Path $rulesDir | Out-Null+ Generate-Commands -Agent 'trae' -Extension 'md' -ArgFormat '$ARGUMENTS' -OutputDir $rulesDir -ScriptVariant $Script+ }'generic' {$cmdDir = Join-Path $baseDir ".speckit/commands"Generate-Commands -Agent 'generic' -Extension 'md' -ArgFormat '$ARGUMENTS' -OutputDir $cmdDir -ScriptVariant $Script@@ -470,7 +475,7 @@ function Build-Variant {}# Define all agents and scripts-$AllAgents = @('claude', 'gemini', 'copilot', 'cursor-agent', 'qwen', 'opencode', 'windsurf', 'codex', 'kilocode', 'auggie', 'roo', 'codebuddy', 'amp', 'kiro-cli', 'bob', 'qodercli', 'shai', 'tabnine', 'agy', 'vibe', 'kimi', 'generic')+$AllAgents = @('claude', 'gemini', 'copilot', 'cursor-agent', 'qwen', 'opencode', 'windsurf', 'codex', 'kilocode', 'auggie', 'roo', 'codebuddy', 'amp', 'kiro-cli', 'bob', 'qodercli', 'shai', 'tabnine', 'agy', 'vibe', 'kimi', 'trae', 'generic')$AllScripts = @('sh', 'ps')function Normalize-List {diff --git a/.github/workflows/scripts/create-release-packages.sh b/.github/workflows/scripts/create-release-packages.shindex 620da0233..77dac397a 100755--- a/.github/workflows/scripts/create-release-packages.sh+++ b/.github/workflows/scripts/create-release-packages.sh@@ -6,7 +6,7 @@ set -euo pipefail# Usage: .github/workflows/scripts/create-release-packages.sh <version># Version argument should include leading 'v'.# Optionally set AGENTS and/or SCRIPTS env vars to limit what gets built.-# AGENTS : space or comma separated subset of: claude gemini copilot cursor-agent qwen opencode windsurf codex kilocode auggie roo codebuddy amp shai tabnine kiro-cli agy bob vibe qodercli kimi generic (default: all)+# AGENTS : space or comma separated subset of: claude gemini copilot cursor-agent qwen opencode windsurf codex kilocode auggie roo codebuddy amp shai tabnine kiro-cli agy bob vibe qodercli kimi trae generic (default: all)# SCRIPTS : space or comma separated subset of: sh ps (default: both)# Examples:# AGENTS=claude SCRIPTS=sh $0 v0.2.0@@ -291,6 +291,9 @@ build_variant() {kimi)mkdir -p "$base_dir/.kimi/skills"create_kimi_skills "$base_dir/.kimi/skills" "$script" ;;+ trae)+ mkdir -p "$base_dir/.trae/rules"+ generate_commands trae md "\$ARGUMENTS" "$base_dir/.trae/rules" "$script" ;;generic)mkdir -p "$base_dir/.speckit/commands"generate_commands generic md "\$ARGUMENTS" "$base_dir/.speckit/commands" "$script" ;;@@ -300,7 +303,7 @@ build_variant() {}# Determine agent list-ALL_AGENTS=(claude gemini copilot cursor-agent qwen opencode windsurf codex kilocode auggie roo codebuddy amp shai tabnine kiro-cli agy bob vibe qodercli kimi generic)+ALL_AGENTS=(claude gemini copilot cursor-agent qwen opencode windsurf codex kilocode auggie roo codebuddy amp shai tabnine kiro-cli agy bob vibe qodercli kimi trae generic)ALL_SCRIPTS=(sh ps)norm_list() {diff --git a/AGENTS.md b/AGENTS.mdindex 8f0742eb8..77f54d05a 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -46,6 +46,7 @@ Specify supports multiple AI agents by generating agent-specific command files a| **Tabnine CLI** | `.tabnine/agent/commands/` | TOML | `tabnine` | Tabnine CLI || **Kimi Code** | `.kimi/skills/` | Markdown | `kimi` | Kimi Code CLI (Moonshot AI) || **IBM Bob** | `.bob/commands/` | Markdown | N/A (IDE-based) | IBM Bob IDE |+| **Trae** | `.trae/rules/` | Markdown | N/A (IDE-based) | Trae IDE || **Generic** | User-specified via `--ai-commands-dir` | Markdown | N/A | Bring your own agent |### Step-by-Step Integration Guidediff --git a/README.md b/README.mdindex e97e2d442..51ee094f1 100644--- a/README.md+++ b/README.md@@ -186,6 +186,7 @@ See Spec-Driven Development in action across different scenarios with these comm| [Kimi Code](https://code.kimi.com/) | β | || [Windsurf](https://windsurf.com/) | β | || [Antigravity (agy)](https://antigravity.google/) | β | Requires `--ai-skills` |+| [Trae](https://www.trae.ai/) | β | || Generic | β | Bring your own agent β use `--ai generic --ai-commands-dir <path>` for unsupported agents |## π§ Specify CLI Referencediff --git a/scripts/bash/update-agent-context.sh b/scripts/bash/update-agent-context.shindex b4b901fb1..0e33772f9 100644--- a/scripts/bash/update-agent-context.sh+++ b/scripts/bash/update-agent-context.sh@@ -35,7 +35,7 @@# - Creates default Claude file if no agent files exist## Usage: ./update-agent-context.sh [agent_type]-# Agent types: claude|gemini|copilot|cursor-agent|qwen|opencode|codex|windsurf|kilocode|auggie|roo|codebuddy|amp|shai|tabnine|kiro-cli|agy|bob|vibe|qodercli|kimi|generic+# Agent types: claude|gemini|copilot|cursor-agent|qwen|opencode|codex|windsurf|kilocode|auggie|roo|codebuddy|amp|shai|tabnine|kiro-cli|agy|bob|vibe|qodercli|kimi|trae|generic# Leave empty to update all existing agent filesset -e@@ -83,6 +83,7 @@ AGY_FILE="$REPO_ROOT/.agent/rules/specify-rules.md"BOB_FILE="$AGENTS_FILE"VIBE_FILE="$REPO_ROOT/.vibe/agents/specify-agents.md"KIMI_FILE="$REPO_ROOT/KIMI.md"+TRAE_FILE="$REPO_ROOT/.trae/rules/AGENTS.md"# Template fileTEMPLATE_FILE="$REPO_ROOT/.specify/templates/agent-file-template.md"@@ -675,12 +676,15 @@ update_specific_agent() {kimi)update_agent_file "$KIMI_FILE" "Kimi Code" || return 1;;+ trae)+ update_agent_file "$TRAE_FILE" "Trae" || return 1+ ;;generic)log_info "Generic agent: no predefined context file. Use the agent-specific update script for your agent.";;*)log_error "Unknown agent type '$agent_type'"- log_error "Expected: claude|gemini|copilot|cursor-agent|qwen|opencode|codex|windsurf|kilocode|auggie|roo|codebuddy|amp|shai|tabnine|kiro-cli|agy|bob|vibe|qodercli|kimi|generic"+ log_error "Expected: claude|gemini|copilot|cursor-agent|qwen|opencode|codex|windsurf|kilocode|auggie|roo|codebuddy|amp|shai|tabnine|kiro-cli|agy|bob|vibe|qodercli|kimi|trae|generic"exit 1;;esac@@ -739,6 +743,7 @@ update_all_existing_agents() {_update_if_new "$AGY_FILE" "Antigravity" || _all_ok=false_update_if_new "$VIBE_FILE" "Mistral Vibe" || _all_ok=false_update_if_new "$KIMI_FILE" "Kimi Code" || _all_ok=false+ _update_if_new "$TRAE_FILE" "Trae" || _all_ok=false# If no agent files exist, create a default Claude fileif [[ "$_found_agent" == false ]]; then@@ -765,7 +770,7 @@ print_summary() {fiecho- log_info "Usage: $0 [claude|gemini|copilot|cursor-agent|qwen|opencode|codex|windsurf|kilocode|auggie|roo|codebuddy|amp|shai|tabnine|kiro-cli|agy|bob|vibe|qodercli|kimi|generic]"+ log_info "Usage: $0 [claude|gemini|copilot|cursor-agent|qwen|opencode|codex|windsurf|kilocode|auggie|roo|codebuddy|amp|shai|tabnine|kiro-cli|agy|bob|vibe|qodercli|kimi|trae|generic]"}#==============================================================================diff --git a/scripts/powershell/update-agent-context.ps1 b/scripts/powershell/update-agent-context.ps1index 30e1e0e69..c0e0a674f 100644--- a/scripts/powershell/update-agent-context.ps1+++ b/scripts/powershell/update-agent-context.ps1@@ -9,7 +9,7 @@ Mirrors the behavior of scripts/bash/update-agent-context.sh:2. Plan Data Extraction3. Agent File Management (create from template or update existing)4. Content Generation (technology stack, recent changes, timestamp)- 5. Multi-Agent Support (claude, gemini, copilot, cursor-agent, qwen, opencode, codex, windsurf, kilocode, auggie, roo, codebuddy, amp, shai, tabnine, kiro-cli, agy, bob, vibe, qodercli, kimi, generic)+ 5. Multi-Agent Support (claude, gemini, copilot, cursor-agent, qwen, opencode, codex, windsurf, kilocode, auggie, roo, codebuddy, amp, shai, tabnine, kiro-cli, agy, bob, vibe, qodercli, kimi, trae, generic).PARAMETER AgentTypeOptional agent key to update a single agent. If omitted, updates all existing agent files (creating a default Claude file if none exist).@@ -25,7 +25,7 @@ Relies on common helper functions in common.ps1#>param([Parameter(Position=0)]- [ValidateSet('claude','gemini','copilot','cursor-agent','qwen','opencode','codex','windsurf','kilocode','auggie','roo','codebuddy','amp','shai','tabnine','kiro-cli','agy','bob','qodercli','vibe','kimi','generic')]+ [ValidateSet('claude','gemini','copilot','cursor-agent','qwen','opencode','codex','windsurf','kilocode','auggie','roo','codebuddy','amp','shai','tabnine','kiro-cli','agy','bob','qodercli','vibe','kimi','trae','generic')][string]$AgentType)@@ -64,6 +64,7 @@ $AGY_FILE = Join-Path $REPO_ROOT '.agent/rules/specify-rules.md'$BOB_FILE = Join-Path $REPO_ROOT 'AGENTS.md'$VIBE_FILE = Join-Path $REPO_ROOT '.vibe/agents/specify-agents.md'$KIMI_FILE = Join-Path $REPO_ROOT 'KIMI.md'+$TRAE_FILE = Join-Path $REPO_ROOT '.trae/rules/AGENTS.md'$TEMPLATE_FILE = Join-Path $REPO_ROOT '.specify/templates/agent-file-template.md'@@ -408,8 +409,9 @@ function Update-SpecificAgent {'bob' { Update-AgentFile -TargetFile $BOB_FILE -AgentName 'IBM Bob' }'vibe' { Update-AgentFile -TargetFile $VIBE_FILE -AgentName 'Mistral Vibe' }'kimi' { Update-AgentFile -TargetFile $KIMI_FILE -AgentName 'Kimi Code' }+ 'trae' { Update-AgentFile -TargetFile $TRAE_FILE -AgentName 'Trae' }'generic' { Write-Info 'Generic agent: no predefined context file. Use the agent-specific update script for your agent.' }- default { Write-Err "Unknown agent type '$Type'"; Write-Err 'Expected: claude|gemini|copilot|cursor-agent|qwen|opencode|codex|windsurf|kilocode|auggie|roo|codebuddy|amp|shai|tabnine|kiro-cli|agy|bob|vibe|qodercli|kimi|generic'; return $false }+ default { Write-Err "Unknown agent type '$Type'"; Write-Err 'Expected: claude|gemini|copilot|cursor-agent|qwen|opencode|codex|windsurf|kilocode|auggie|roo|codebuddy|amp|shai|tabnine|kiro-cli|agy|bob|vibe|qodercli|kimi|trae|generic'; return $false }}}@@ -435,6 +437,7 @@ function Update-AllExistingAgents {if (Test-Path $BOB_FILE) { if (-not (Update-AgentFile -TargetFile $BOB_FILE -AgentName 'IBM Bob')) { $ok = $false }; $found = $true }if (Test-Path $VIBE_FILE) { if (-not (Update-AgentFile -TargetFile $VIBE_FILE -AgentName 'Mistral Vibe')) { $ok = $false }; $found = $true }if (Test-Path $KIMI_FILE) { if (-not (Update-AgentFile -TargetFile $KIMI_FILE -AgentName 'Kimi Code')) { $ok = $false }; $found = $true }+ if (Test-Path $TRAE_FILE) { if (-not (Update-AgentFile -TargetFile $TRAE_FILE -AgentName 'Trae')) { $ok = $false }; $found = $true }if (-not $found) {Write-Info 'No existing agent files found, creating default Claude file...'if (-not (Update-AgentFile -TargetFile $CLAUDE_FILE -AgentName 'Claude Code')) { $ok = $false }diff --git a/src/specify_cli/__init__.py b/src/specify_cli/__init__.pyindex f30e58f96..219df9d58 100644--- a/src/specify_cli/__init__.py+++ b/src/specify_cli/__init__.py@@ -275,6 +275,13 @@ AGENT_CONFIG = {"install_url": "https://code.kimi.com/","requires_cli": True,},+ "trae": {+ "name": "Trae",+ "folder": ".trae/",+ "commands_subdir": "rules", # Trae uses .trae/rules/ for project rules+ "install_url": None, # IDE-based+ "requires_cli": False,+ },"generic": {"name": "Generic (bring your own agent)","folder": None, # Set dynamically via --ai-commands-dirdiff --git a/src/specify_cli/agents.py b/src/specify_cli/agents.pyindex 9927daee8..6f9aaa910 100644--- a/src/specify_cli/agents.py+++ b/src/specify_cli/agents.py@@ -135,6 +135,12 @@ class CommandRegistrar:"format": "markdown","args": "$ARGUMENTS","extension": "/SKILL.md"+ },+ "trae": {+ "dir": ".trae/rules",+ "format": "markdown",+ "args": "$ARGUMENTS",+ "extension": ".md"}}diff --git a/tests/test_agent_config_consistency.py b/tests/test_agent_config_consistency.pyindex 6831fad36..1d6a4b2df 100644--- a/tests/test_agent_config_consistency.py+++ b/tests/test_agent_config_consistency.py@@ -233,3 +233,79 @@ class TestAgentConfigConsistency:def test_ai_help_includes_kimi(self):"""CLI help text for --ai should include kimi."""assert "kimi" in AI_ASSISTANT_HELP++ # --- Trae IDE consistency checks ---++ def test_trae_in_agent_config(self):+ """AGENT_CONFIG should include trae with correct folder and commands_subdir."""+ assert "trae" in AGENT_CONFIG+ assert AGENT_CONFIG["trae"]["folder"] == ".trae/"+ assert AGENT_CONFIG["trae"]["commands_subdir"] == "rules"+ assert AGENT_CONFIG["trae"]["requires_cli"] is False+ assert AGENT_CONFIG["trae"]["install_url"] is None++ def test_trae_in_extension_registrar(self):+ """Extension command registrar should include trae using .trae/rules and markdown, if present."""+ cfg = CommandRegistrar.AGENT_CONFIGS++ assert "trae" in cfg+ trae_cfg = cfg["trae"]+ assert trae_cfg["format"] == "markdown"+ assert trae_cfg["args"] == "$ARGUMENTS"+ assert trae_cfg["extension"] == ".md"++ def test_trae_in_release_agent_lists(self):+ """Bash and PowerShell release scripts should include trae in agent lists."""+ sh_text = (REPO_ROOT / ".github" / "workflows" / "scripts" / "create-release-packages.sh").read_text(encoding="utf-8")+ ps_text = (REPO_ROOT / ".github" / "workflows" / "scripts" / "create-release-packages.ps1").read_text(encoding="utf-8")++ sh_match = re.search(r"ALL_AGENTS=\(([^)]*)\)", sh_text)+ assert sh_match is not None+ sh_agents = sh_match.group(1).split()++ ps_match = re.search(r"\$AllAgents = @\(([^)]*)\)", ps_text)+ assert ps_match is not None+ ps_agents = re.findall(r"'([^']+)'", ps_match.group(1))++ assert "trae" in sh_agents+ assert "trae" in ps_agents++ def test_trae_in_release_scripts_generate_commands(self):+ """Release scripts should generate markdown commands for trae in .trae/rules."""+ sh_text = (REPO_ROOT / ".github" / "workflows" / "scripts" / "create-release-packages.sh").read_text(encoding="utf-8")+ ps_text = (REPO_ROOT / ".github" / "workflows" / "scripts" / "create-release-packages.ps1").read_text(encoding="utf-8")++ assert ".trae/rules" in sh_text+ assert ".trae/rules" in ps_text+ assert re.search(r"'trae'\s*\{.*?\.trae/rules", ps_text, re.S) is not None++ def test_trae_in_github_release_output(self):+ """GitHub release script should include trae template packages."""+ gh_release_text = (REPO_ROOT / ".github" / "workflows" / "scripts" / "create-github-release.sh").read_text(encoding="utf-8")++ assert "spec-kit-template-trae-sh-" in gh_release_text+ assert "spec-kit-template-trae-ps-" in gh_release_text++ def test_trae_in_agent_context_scripts(self):+ """Agent context scripts should support trae agent type."""+ bash_text = (REPO_ROOT / "scripts" / "bash" / "update-agent-context.sh").read_text(encoding="utf-8")+ pwsh_text = (REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1").read_text(encoding="utf-8")++ assert "trae" in bash_text+ assert "TRAE_FILE" in bash_text+ assert "trae" in pwsh_text+ assert "TRAE_FILE" in pwsh_text++ def test_trae_in_powershell_validate_set(self):+ """PowerShell update-agent-context script should include 'trae' in ValidateSet."""+ ps_text = (REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1").read_text(encoding="utf-8")++ validate_set_match = re.search(r"\[ValidateSet\(([^)]*)\)\]", ps_text)+ assert validate_set_match is not None+ validate_set_values = re.findall(r"'([^']+)'", validate_set_match.group(1))++ assert "trae" in validate_set_values++ def test_ai_help_includes_trae(self):+ """CLI help text for --ai should include trae."""+ assert "trae" in AI_ASSISTANT_HELP