Skip to content

Commit 46b7fea

Browse files
author
root
committed
feat: add Trae IDE support as a new agent
Add Trae (https://www.trae.ai/) as a supported AI agent in spec-kit. Trae is an IDE-based agent that uses .trae/rules/ directory for project-level rules in Markdown format. Changes across 9 files: - src/specify_cli/__init__.py: Add trae to AGENT_CONFIG (IDE-based, .trae/ folder, rules subdir, no CLI required) - src/specify_cli/extensions.py: Add trae to CommandRegistrar.AGENT_CONFIGS (.trae/rules, markdown format, .md extension) - README.md: Add Trae to supported agents table, CLI examples, and --ai option description - .github/workflows/scripts/create-release-packages.sh: Add trae to ALL_AGENTS array and build case statement - .github/workflows/scripts/create-release-packages.ps1: Add trae to AllAgents array and switch statement - .github/workflows/scripts/create-github-release.sh: Add trae template zip files to release assets - scripts/bash/update-agent-context.sh: Add TRAE_FILE, trae case in update function, and auto-detect block - scripts/powershell/update-agent-context.ps1: Add TRAE_FILE, ValidateSet entry, switch case, and auto-detect block - tests/test_agent_config_consistency.py: Add 8 consistency tests for trae following established kimi/tabnine patterns
1 parent 0f1cbd7 commit 46b7fea

9 files changed

Lines changed: 128 additions & 12 deletions

File tree

.github/workflows/scripts/create-github-release.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ gh release create "$VERSION" \
5858
.genreleases/spec-kit-template-vibe-ps-"$VERSION".zip \
5959
.genreleases/spec-kit-template-kimi-sh-"$VERSION".zip \
6060
.genreleases/spec-kit-template-kimi-ps-"$VERSION".zip \
61+
.genreleases/spec-kit-template-trae-sh-"$VERSION".zip \
62+
.genreleases/spec-kit-template-trae-ps-"$VERSION".zip \
6163
.genreleases/spec-kit-template-generic-sh-"$VERSION".zip \
6264
.genreleases/spec-kit-template-generic-ps-"$VERSION".zip \
6365
--title "Spec Kit Templates - $VERSION_NO_V" \

.github/workflows/scripts/create-release-packages.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
1515
.PARAMETER Agents
1616
Comma or space separated subset of agents to build (default: all)
17-
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
17+
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
1818
1919
.PARAMETER Scripts
2020
Comma or space separated subset of script types to build (default: both)
@@ -454,6 +454,11 @@ function Build-Variant {
454454
New-Item -ItemType Directory -Force -Path $skillsDir | Out-Null
455455
New-KimiSkills -SkillsDir $skillsDir -ScriptVariant $Script
456456
}
457+
'trae' {
458+
$rulesDir = Join-Path $baseDir ".trae/rules"
459+
New-Item -ItemType Directory -Force -Path $rulesDir | Out-Null
460+
Generate-Commands -Agent 'trae' -Format 'md' -ArgsToken '$ARGUMENTS' -OutDir $rulesDir -ScriptVariant $script
461+
}
457462
'generic' {
458463
$cmdDir = Join-Path $baseDir ".speckit/commands"
459464
Generate-Commands -Agent 'generic' -Extension 'md' -ArgFormat '$ARGUMENTS' -OutputDir $cmdDir -ScriptVariant $Script
@@ -470,7 +475,7 @@ function Build-Variant {
470475
}
471476

472477
# Define all agents and scripts
473-
$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')
478+
$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')
474479
$AllScripts = @('sh', 'ps')
475480

476481
function Normalize-List {

.github/workflows/scripts/create-release-packages.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -euo pipefail
66
# Usage: .github/workflows/scripts/create-release-packages.sh <version>
77
# Version argument should include leading 'v'.
88
# Optionally set AGENTS and/or SCRIPTS env vars to limit what gets built.
9-
# 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)
9+
# 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)
1010
# SCRIPTS : space or comma separated subset of: sh ps (default: both)
1111
# Examples:
1212
# AGENTS=claude SCRIPTS=sh $0 v0.2.0
@@ -291,6 +291,9 @@ build_variant() {
291291
kimi)
292292
mkdir -p "$base_dir/.kimi/skills"
293293
create_kimi_skills "$base_dir/.kimi/skills" "$script" ;;
294+
trae)
295+
mkdir -p "$base_dir/.trae/rules"
296+
generate_commands trae md "\$ARGUMENTS" "$base_dir/.trae/rules" "$script" ;;
294297
generic)
295298
mkdir -p "$base_dir/.speckit/commands"
296299
generate_commands generic md "\$ARGUMENTS" "$base_dir/.speckit/commands" "$script" ;;
@@ -300,7 +303,7 @@ build_variant() {
300303
}
301304

302305
# Determine agent list
303-
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)
306+
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)
304307
ALL_SCRIPTS=(sh ps)
305308

306309
norm_list() {

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ See Spec-Driven Development in action across different scenarios with these comm
182182
| [Kimi Code](https://code.kimi.com/) || |
183183
| [Windsurf](https://windsurf.com/) || |
184184
| [Antigravity (agy)](https://antigravity.google/) || |
185+
| [Trae](https://www.trae.ai/) || |
185186
| Generic || Bring your own agent — use `--ai generic --ai-commands-dir <path>` for unsupported agents |
186187

187188
## 🔧 Specify CLI Reference
@@ -200,7 +201,7 @@ The `specify` command supports the following options:
200201
| Argument/Option | Type | Description |
201202
| ---------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
202203
| `<project-name>` | Argument | Name for your new project directory (optional if using `--here`, or use `.` for current directory) |
203-
| `--ai` | Option | AI assistant to use: `claude`, `gemini`, `copilot`, `cursor-agent`, `qwen`, `opencode`, `codex`, `windsurf`, `kilocode`, `auggie`, `roo`, `codebuddy`, `amp`, `shai`, `kiro-cli` (`kiro` alias), `agy`, `bob`, `qodercli`, `vibe`, `kimi`, or `generic` (requires `--ai-commands-dir`) |
204+
| `--ai` | Option | AI assistant to use: `claude`, `gemini`, `copilot`, `cursor-agent`, `qwen`, `opencode`, `codex`, `windsurf`, `kilocode`, `auggie`, `roo`, `codebuddy`, `amp`, `shai`, `kiro-cli` (`kiro` alias), `agy`, `bob`, `qodercli`, `vibe`, `kimi`, `trae`, or `generic` (requires `--ai-commands-dir`) |
204205
| `--ai-commands-dir` | Option | Directory for agent command files (required with `--ai generic`, e.g. `.myagent/commands/`) |
205206
| `--script` | Option | Script variant to use: `sh` (bash/zsh) or `ps` (PowerShell) |
206207
| `--ignore-agent-tools` | Flag | Skip checks for AI agent tools like Claude Code |
@@ -248,6 +249,9 @@ specify init my-project --ai bob
248249
# Initialize with Antigravity support
249250
specify init my-project --ai agy
250251

252+
# Initialize with Trae support
253+
specify init my-project --ai trae
254+
251255
# Initialize with an unsupported agent (generic / bring your own agent)
252256
specify init my-project --ai generic --ai-commands-dir .myagent/commands/
253257

scripts/bash/update-agent-context.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
# - Creates default Claude file if no agent files exist
3636
#
3737
# Usage: ./update-agent-context.sh [agent_type]
38-
# 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
38+
# 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
3939
# Leave empty to update all existing agent files
4040

4141
set -e
@@ -79,6 +79,7 @@ AGY_FILE="$REPO_ROOT/.agent/rules/specify-rules.md"
7979
BOB_FILE="$REPO_ROOT/AGENTS.md"
8080
VIBE_FILE="$REPO_ROOT/.vibe/agents/specify-agents.md"
8181
KIMI_FILE="$REPO_ROOT/KIMI.md"
82+
TRAE_FILE="$REPO_ROOT/.trae/rules/AGENTS.md"
8283

8384
# Template file
8485
TEMPLATE_FILE="$REPO_ROOT/.specify/templates/agent-file-template.md"
@@ -669,12 +670,15 @@ update_specific_agent() {
669670
kimi)
670671
update_agent_file "$KIMI_FILE" "Kimi Code"
671672
;;
673+
trae)
674+
update_agent_file "$TRAE_FILE" "Trae"
675+
;;
672676
generic)
673677
log_info "Generic agent: no predefined context file. Use the agent-specific update script for your agent."
674678
;;
675679
*)
676680
log_error "Unknown agent type '$agent_type'"
677-
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"
681+
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"
678682
exit 1
679683
;;
680684
esac
@@ -778,6 +782,11 @@ update_all_existing_agents() {
778782
found_agent=true
779783
fi
780784

785+
if [[ -f "$TRAE_FILE" ]]; then
786+
update_agent_file "$TRAE_FILE" "Trae"
787+
found_agent=true
788+
fi
789+
781790
# If no agent files exist, create a default Claude file
782791
if [[ "$found_agent" == false ]]; then
783792
log_info "No existing agent files found, creating default Claude file..."
@@ -801,7 +810,7 @@ print_summary() {
801810
fi
802811

803812
echo
804-
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]"
813+
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]"
805814
}
806815

807816
#==============================================================================

scripts/powershell/update-agent-context.ps1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Mirrors the behavior of scripts/bash/update-agent-context.sh:
99
2. Plan Data Extraction
1010
3. Agent File Management (create from template or update existing)
1111
4. Content Generation (technology stack, recent changes, timestamp)
12-
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)
12+
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)
1313
1414
.PARAMETER AgentType
1515
Optional 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
2525
#>
2626
param(
2727
[Parameter(Position=0)]
28-
[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')]
28+
[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')]
2929
[string]$AgentType
3030
)
3131

@@ -64,6 +64,7 @@ $AGY_FILE = Join-Path $REPO_ROOT '.agent/rules/specify-rules.md'
6464
$BOB_FILE = Join-Path $REPO_ROOT 'AGENTS.md'
6565
$VIBE_FILE = Join-Path $REPO_ROOT '.vibe/agents/specify-agents.md'
6666
$KIMI_FILE = Join-Path $REPO_ROOT 'KIMI.md'
67+
$TRAE_FILE = Join-Path $REPO_ROOT '.trae/rules/AGENTS.md'
6768

6869
$TEMPLATE_FILE = Join-Path $REPO_ROOT '.specify/templates/agent-file-template.md'
6970

@@ -408,8 +409,9 @@ function Update-SpecificAgent {
408409
'bob' { Update-AgentFile -TargetFile $BOB_FILE -AgentName 'IBM Bob' }
409410
'vibe' { Update-AgentFile -TargetFile $VIBE_FILE -AgentName 'Mistral Vibe' }
410411
'kimi' { Update-AgentFile -TargetFile $KIMI_FILE -AgentName 'Kimi Code' }
412+
'trae' { Update-AgentFile -TargetFile $TRAE_FILE -AgentName 'Trae' }
411413
'generic' { Write-Info 'Generic agent: no predefined context file. Use the agent-specific update script for your agent.' }
412-
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 }
414+
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 }
413415
}
414416
}
415417

@@ -435,6 +437,7 @@ function Update-AllExistingAgents {
435437
if (Test-Path $BOB_FILE) { if (-not (Update-AgentFile -TargetFile $BOB_FILE -AgentName 'IBM Bob')) { $ok = $false }; $found = $true }
436438
if (Test-Path $VIBE_FILE) { if (-not (Update-AgentFile -TargetFile $VIBE_FILE -AgentName 'Mistral Vibe')) { $ok = $false }; $found = $true }
437439
if (Test-Path $KIMI_FILE) { if (-not (Update-AgentFile -TargetFile $KIMI_FILE -AgentName 'Kimi Code')) { $ok = $false }; $found = $true }
440+
if (Test-Path $TRAE_FILE) { if (-not (Update-AgentFile -TargetFile $TRAE_FILE -AgentName 'Trae')) { $ok = $false }; $found = $true }
438441
if (-not $found) {
439442
Write-Info 'No existing agent files found, creating default Claude file...'
440443
if (-not (Update-AgentFile -TargetFile $CLAUDE_FILE -AgentName 'Claude Code')) { $ok = $false }

src/specify_cli/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,13 @@ def _format_rate_limit_error(status_code: int, headers: httpx.Headers, url: str)
272272
"install_url": "https://code.kimi.com/",
273273
"requires_cli": True,
274274
},
275+
"trae": {
276+
"name": "Trae",
277+
"folder": ".trae/",
278+
"commands_subdir": "rules", # Trae uses .trae/rules/ for project rules
279+
"install_url": None, # IDE-based
280+
"requires_cli": False,
281+
},
275282
"generic": {
276283
"name": "Generic (bring your own agent)",
277284
"folder": None, # Set dynamically via --ai-commands-dir

src/specify_cli/extensions.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,13 @@ class CommandRegistrar:
779779
"format": "markdown",
780780
"args": "$ARGUMENTS",
781781
"extension": "/SKILL.md"
782-
}
782+
},
783+
"trae": {
784+
"dir": ".trae/rules",
785+
"format": "markdown",
786+
"args": "$ARGUMENTS",
787+
"extension": ".md"
788+
},
783789
}
784790

785791
@staticmethod

tests/test_agent_config_consistency.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,80 @@ def test_kimi_in_github_release_output(self):
226226
def test_ai_help_includes_kimi(self):
227227
"""CLI help text for --ai should include kimi."""
228228
assert "kimi" in AI_ASSISTANT_HELP
229+
230+
# --- Trae IDE consistency checks ---
231+
232+
def test_trae_in_agent_config(self):
233+
"""AGENT_CONFIG should include trae with correct folder and commands_subdir."""
234+
assert "trae" in AGENT_CONFIG
235+
assert AGENT_CONFIG["trae"]["folder"] == ".trae/"
236+
assert AGENT_CONFIG["trae"]["commands_subdir"] == "rules"
237+
assert AGENT_CONFIG["trae"]["requires_cli"] is False
238+
assert AGENT_CONFIG["trae"]["install_url"] is None
239+
240+
def test_trae_in_extension_registrar(self):
241+
"""Extension command registrar should include trae using .trae/rules and markdown."""
242+
cfg = CommandRegistrar.AGENT_CONFIGS
243+
244+
assert "trae" in cfg
245+
trae_cfg = cfg["trae"]
246+
assert trae_cfg["dir"] == ".trae/rules"
247+
assert trae_cfg["format"] == "markdown"
248+
assert trae_cfg["args"] == "$ARGUMENTS"
249+
assert trae_cfg["extension"] == ".md"
250+
251+
def test_trae_in_release_agent_lists(self):
252+
"""Bash and PowerShell release scripts should include trae in agent lists."""
253+
sh_text = (REPO_ROOT / ".github" / "workflows" / "scripts" / "create-release-packages.sh").read_text(encoding="utf-8")
254+
ps_text = (REPO_ROOT / ".github" / "workflows" / "scripts" / "create-release-packages.ps1").read_text(encoding="utf-8")
255+
256+
sh_match = re.search(r"ALL_AGENTS=\(([^)]*)\)", sh_text)
257+
assert sh_match is not None
258+
sh_agents = sh_match.group(1).split()
259+
260+
ps_match = re.search(r"\$AllAgents = @\(([^)]*)\)", ps_text)
261+
assert ps_match is not None
262+
ps_agents = re.findall(r"'([^']+)'", ps_match.group(1))
263+
264+
assert "trae" in sh_agents
265+
assert "trae" in ps_agents
266+
267+
def test_trae_in_release_scripts_generate_commands(self):
268+
"""Release scripts should generate markdown commands for trae in .trae/rules."""
269+
sh_text = (REPO_ROOT / ".github" / "workflows" / "scripts" / "create-release-packages.sh").read_text(encoding="utf-8")
270+
ps_text = (REPO_ROOT / ".github" / "workflows" / "scripts" / "create-release-packages.ps1").read_text(encoding="utf-8")
271+
272+
assert ".trae/rules" in sh_text
273+
assert ".trae/rules" in ps_text
274+
assert re.search(r"'trae'\s*\{.*?\.trae/rules", ps_text, re.S) is not None
275+
276+
def test_trae_in_github_release_output(self):
277+
"""GitHub release script should include trae template packages."""
278+
gh_release_text = (REPO_ROOT / ".github" / "workflows" / "scripts" / "create-github-release.sh").read_text(encoding="utf-8")
279+
280+
assert "spec-kit-template-trae-sh-" in gh_release_text
281+
assert "spec-kit-template-trae-ps-" in gh_release_text
282+
283+
def test_trae_in_agent_context_scripts(self):
284+
"""Agent context scripts should support trae agent type."""
285+
bash_text = (REPO_ROOT / "scripts" / "bash" / "update-agent-context.sh").read_text(encoding="utf-8")
286+
pwsh_text = (REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1").read_text(encoding="utf-8")
287+
288+
assert "trae" in bash_text
289+
assert "TRAE_FILE" in bash_text
290+
assert "trae" in pwsh_text
291+
assert "TRAE_FILE" in pwsh_text
292+
293+
def test_trae_in_powershell_validate_set(self):
294+
"""PowerShell update-agent-context script should include 'trae' in ValidateSet."""
295+
ps_text = (REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1").read_text(encoding="utf-8")
296+
297+
validate_set_match = re.search(r"\[ValidateSet\(([^)]*)\)\]", ps_text)
298+
assert validate_set_match is not None
299+
validate_set_values = re.findall(r"'([^']+)'", validate_set_match.group(1))
300+
301+
assert "trae" in validate_set_values
302+
303+
def test_ai_help_includes_trae(self):
304+
"""CLI help text for --ai should include trae."""
305+
assert "trae" in AI_ASSISTANT_HELP

0 commit comments

Comments
 (0)