Skip to content

Commit 6536bc4

Browse files
JiaKangning002jiakangningCopilot
authored
fix speckit issue for trae (#2112)
* 修改trea文件结构错误问题 * 修改trea文件结构错误问题 * 修复trae agent 文件结构错误问题 * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix trae's test case files * Update src/specify_cli/integrations/trae/__init__.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: jiakangning <jiakangning@bytedance.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 1a9e4d1 commit 6536bc4

9 files changed

Lines changed: 42 additions & 22 deletions

File tree

scripts/bash/update-agent-context.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ AGY_FILE="$REPO_ROOT/.agent/rules/specify-rules.md"
8484
BOB_FILE="$AGENTS_FILE"
8585
VIBE_FILE="$REPO_ROOT/.vibe/agents/specify-agents.md"
8686
KIMI_FILE="$REPO_ROOT/KIMI.md"
87-
TRAE_FILE="$REPO_ROOT/.trae/rules/AGENTS.md"
87+
TRAE_FILE="$REPO_ROOT/.trae/rules/project_rules.md"
8888
IFLOW_FILE="$REPO_ROOT/IFLOW.md"
8989
FORGE_FILE="$AGENTS_FILE"
9090

scripts/powershell/update-agent-context.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ $AGY_FILE = Join-Path $REPO_ROOT '.agent/rules/specify-rules.md'
6565
$BOB_FILE = Join-Path $REPO_ROOT 'AGENTS.md'
6666
$VIBE_FILE = Join-Path $REPO_ROOT '.vibe/agents/specify-agents.md'
6767
$KIMI_FILE = Join-Path $REPO_ROOT 'KIMI.md'
68-
$TRAE_FILE = Join-Path $REPO_ROOT '.trae/rules/AGENTS.md'
68+
$TRAE_FILE = Join-Path $REPO_ROOT '.trae/rules/project_rules.md'
6969
$IFLOW_FILE = Join-Path $REPO_ROOT 'IFLOW.md'
7070
$FORGE_FILE = Join-Path $REPO_ROOT 'AGENTS.md'
7171

src/specify_cli/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,15 +1312,16 @@ def init(
13121312
step_num = 2
13131313

13141314
# Determine skill display mode for the next-steps panel.
1315-
# Skills integrations (codex, kimi, agy) should show skill invocation syntax.
1315+
# Skills integrations (codex, kimi, agy, trae) should show skill invocation syntax.
13161316
from .integrations.base import SkillsIntegration as _SkillsInt
13171317
_is_skills_integration = isinstance(resolved_integration, _SkillsInt)
13181318

13191319
codex_skill_mode = selected_ai == "codex" and (ai_skills or _is_skills_integration)
13201320
claude_skill_mode = selected_ai == "claude" and (ai_skills or _is_skills_integration)
13211321
kimi_skill_mode = selected_ai == "kimi"
13221322
agy_skill_mode = selected_ai == "agy" and _is_skills_integration
1323-
native_skill_mode = codex_skill_mode or claude_skill_mode or kimi_skill_mode or agy_skill_mode
1323+
trae_skill_mode = selected_ai == "trae"
1324+
native_skill_mode = codex_skill_mode or claude_skill_mode or kimi_skill_mode or agy_skill_mode or trae_skill_mode
13241325

13251326
if codex_skill_mode and not ai_skills:
13261327
# Integration path installed skills; show the helpful notice
@@ -1332,7 +1333,7 @@ def init(
13321333
usage_label = "skills" if native_skill_mode else "slash commands"
13331334

13341335
def _display_cmd(name: str) -> str:
1335-
if codex_skill_mode or agy_skill_mode:
1336+
if codex_skill_mode or agy_skill_mode or trae_skill_mode:
13361337
return f"$speckit-{name}"
13371338
if claude_skill_mode:
13381339
return f"/speckit-{name}"
Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,40 @@
1-
"""Trae IDE integration."""
1+
"""Trae IDE integration. — skills-based agent.
22
3-
from ..base import MarkdownIntegration
3+
Trae IDE uses ``.trae/skills/speckit-<name>/SKILL.md`` layout.
4+
In the Specify CLI Trae integration, explicit command support was deprecated
5+
since v0.5.1; ``--skills`` defaults to ``True``.
6+
"""
47

8+
from __future__ import annotations
9+
from ..base import IntegrationOption, SkillsIntegration
10+
11+
12+
class TraeIntegration(SkillsIntegration):
13+
"""Integration for Trae IDE."""
514

6-
class TraeIntegration(MarkdownIntegration):
715
key = "trae"
816
config = {
917
"name": "Trae",
1018
"folder": ".trae/",
11-
"commands_subdir": "rules",
19+
"commands_subdir": "skills",
1220
"install_url": None,
1321
"requires_cli": False,
1422
}
1523
registrar_config = {
16-
"dir": ".trae/rules",
24+
"dir": ".trae/skills",
1725
"format": "markdown",
1826
"args": "$ARGUMENTS",
19-
"extension": ".md",
27+
"extension": "/SKILL.md",
2028
}
21-
context_file = ".trae/rules/AGENTS.md"
29+
context_file = ".trae/rules/project_rules.md"
30+
31+
@classmethod
32+
def options(cls) -> list[IntegrationOption]:
33+
return [
34+
IntegrationOption(
35+
"--skills",
36+
is_flag=True,
37+
default=True,
38+
help="Install as agent skills (default for trae since v0.5.1)",
39+
),
40+
]

src/specify_cli/integrations/trae/scripts/update-context.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# update-context.ps1 — Trae integration: create/update .trae/rules/AGENTS.md
1+
# update-context.ps1 — Trae integration: create/update .trae/rules/project_rules.md
22
#
33
# Thin wrapper that delegates to the shared update-agent-context script.
44
# Activated in Stage 7 when the shared script uses integration.json dispatch.

src/specify_cli/integrations/trae/scripts/update-context.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# update-context.sh — Trae integration: create/update .trae/rules/AGENTS.md
2+
# update-context.sh — Trae integration: create/update .trae/rules/project_rules.md
33
#
44
# Thin wrapper that delegates to the shared update-agent-context script.
55
# Activated in Stage 7 when the shared script uses integration.json dispatch.

src/specify_cli/presets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ def _register_skills(
717717
ai_skills_enabled = bool(init_opts.get("ai_skills"))
718718
registrar = CommandRegistrar()
719719
agent_config = registrar.AGENT_CONFIGS.get(selected_ai, {})
720-
# Native skill agents (e.g. codex/kimi/agy) materialize brand-new
720+
# Native skill agents (e.g. codex/kimi/agy/trae) materialize brand-new
721721
# preset skills in _register_commands() because their detected agent
722722
# directory is already the skills directory. This flag is only for
723723
# command-backed agents that also mirror commands into skills.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""Tests for TraeIntegration."""
22

3-
from .test_integration_base_markdown import MarkdownIntegrationTests
3+
from .test_integration_base_skills import SkillsIntegrationTests
44

55

6-
class TestTraeIntegration(MarkdownIntegrationTests):
6+
class TestTraeIntegration(SkillsIntegrationTests):
77
KEY = "trae"
88
FOLDER = ".trae/"
9-
COMMANDS_SUBDIR = "rules"
10-
REGISTRAR_DIR = ".trae/rules"
11-
CONTEXT_FILE = ".trae/rules/AGENTS.md"
9+
COMMANDS_SUBDIR = "skills"
10+
REGISTRAR_DIR = ".trae/skills"
11+
CONTEXT_FILE = ".trae/rules/project_rules.md"

tests/test_agent_config_consistency.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def test_trae_in_agent_config(self):
139139
"""AGENT_CONFIG should include trae with correct folder and commands_subdir."""
140140
assert "trae" in AGENT_CONFIG
141141
assert AGENT_CONFIG["trae"]["folder"] == ".trae/"
142-
assert AGENT_CONFIG["trae"]["commands_subdir"] == "rules"
142+
assert AGENT_CONFIG["trae"]["commands_subdir"] == "skills"
143143
assert AGENT_CONFIG["trae"]["requires_cli"] is False
144144
assert AGENT_CONFIG["trae"]["install_url"] is None
145145

@@ -151,7 +151,7 @@ def test_trae_in_extension_registrar(self):
151151
trae_cfg = cfg["trae"]
152152
assert trae_cfg["format"] == "markdown"
153153
assert trae_cfg["args"] == "$ARGUMENTS"
154-
assert trae_cfg["extension"] == ".md"
154+
assert trae_cfg["extension"] == "/SKILL.md"
155155

156156
def test_trae_in_agent_context_scripts(self):
157157
"""Agent context scripts should support trae agent type."""

0 commit comments

Comments
 (0)