Pull Request已成功合入, 合并人@CANN-robot
(感谢 xutianze 的贡献)变更摘要
本 PR 为 cuda2ascend 工作流新增 TraeCode(Trae)作为目标工具支持,使工作流可初始化到 TraeCode 环境并复用既有技能、Subagent 角色与静默模式能力。核心改动集中在 init.sh:SUPPORTED_TOOLS 增加 trae(--list-tools 同步输出),project 级配置根为 <install>/.trae/、global 级为 ~/.trae-cn/;Step 3 从 agents/*.md 生成 .trae/agents/*.md(TraeCode Subagent,frontmatter 按角色注入 tools 静态限权白名单),Step 4+ 在 .trae/hooks.json 幂等注册 PreToolUse hook(matcher AskUserQuestion,静默问卷拦截),并同步 health check、CLI_NAME 与帮助文本。同时新增 hooks/trae/permission-guard.js hook 实现 Trae 侧静默问卷拦截,与 opencode/claude/dsh 三侧的 SILENT_GUARDED_TOOLS / readSilentMode 语义保持一致。
主要改动
-
目标工具枚举扩展:
init.sh中SUPPORTED_TOOLS由四项扩为("opencode" "claude" "codex" "dsh" "trae"),--list-tools、参数解析分支、CLI_NAME映射及 help 文本同步补齐trae,使工作流可初始化到 TraeCode 环境。 -
配置根与 Subagent 生成: project 级配置根设为
${INSTALL_BASE}/.trae、global 级设为${HOME}/.trae-cn;Step 3 新增 trae 分支,用内嵌 Python 脚本解析agents/*.md的 frontmatter(name/description),按角色(如architect、developer、qa等)注入tools静态限权白名单后生成.trae/agents/{name}.md,其中仅qa角色含AskUserQuestion。 -
新增
hooks/trae/permission-guard.js: Trae 侧 PreToolUse 静默问卷拦截 hook——SILENT_GUARDED_TOOLS按子串匹配question/ask类工具名,经readSilentMode读取.cannbot/settings.json,mode=silent时阻断问卷并以 exit 2 回传原因,非问卷工具放行。 -
.trae/hooks.json幂等注册 hook: Step 4+ 新增 trae 分支,将permission-guard.js软链至${CONFIG_ROOT}/hooks/,并用内嵌 Python 幂等写入hooks.json(matcher 为AskUserQuestion);project 级用${CLAUDE_PROJECT_DIR}占位符引用、global 级用绝对路径,已注册则跳过或补充 matcher。 -
health check 与示例脚本同步:
init.shhealth check 新增 trae 检查(校验permission-guard.js软链存在及hooks.json是否注册 hook);example/init.sh补充[ "$TARGET_ENV" = "trae" ] && CLI_NAME="trae"映射,子仓 init 保持零改动兼容。


Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/cannbot-skills | ✅ benwallace52, 汤平川 (2/2) | ✅ benwallace52, 汤平川 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
xutianze, thanks for your pull request. All authors of the commits have signed the CLA. 👍


这一句有点多余


这里不要把支持的框架列表都列出来,这样不方便扩展


这里有必要用个映射吗,直接CLI_NAME=$TARGET_ENV是不是就行了


不要加注释


compile


compile


流水线任务触发成功
任务链接 [d856c786b4a24eeab64c929d3069aaf0][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| Check_Pr | ✅ SUCCESS | >>>>> | |
| UT_Test | ❌ FAILED | >>>>> | |
| codecheck_style | ✅ SUCCESS | >>>>> | |
| pre-commit | ✅ SUCCESS | ||
| pre_comment | ✅ SUCCESS | >>>>> | |
| UT_Test_AI_review | ✅ SUCCESS | >>>>> |


compile


流水线任务触发成功
任务链接 [3fe43b8ef9534543986c15b1b11495c3][流水线指导]
| 任务名称 | 状态 | 日志 | 下载链接 |
|---|---|---|---|
| codecheck | ✅ SUCCESS | >>>>> | |
| SCA | ✅ SUCCESS | >>>>> | |
| antipoison | ✅ SUCCESS | >>>>> | |
| Check_Pr | ✅ SUCCESS | >>>>> | |
| UT_Test | ✅ SUCCESS | >>>>> | |
| codecheck_style | ✅ SUCCESS | >>>>> | |
| pre-commit | ✅ SUCCESS | ||
| pre_comment | ✅ SUCCESS | >>>>> | |
| UT_Test_AI_review | ✅ SUCCESS | >>>>> | |
| ST_Test_A2 | ✅ SUCCESS | >>>>> | |
| ST_Test_A5 | ✅ SUCCESS | >>>>> |
[2026-08-27 15:42:27] CI执行结束


/approve


/lgtm
/approve


描述
【cuda2ascend 工作流】新增 TraeCode(Trae)作为目标工具支持,使工作流可初始化到 TraeCode 环境并复用全部技能、Subagent 角色与静默模式能力。
改动内容
SUPPORTED_TOOLS增加trae(--list-tools同步);project 级配置根<install>/.trae/、global 级~/.trae-cn/;Step 3 从agents/*.md生成.trae/agents/*.md(TraeCode Subagent,frontmatter 按角色注入tools静态限权白名单,Trae 原生机制);Step 4+ 在.trae/hooks.json幂等注册 PreToolUse hook(matcherAskUserQuestion,静默问卷拦截);health check、CLI_NAME、help 文本同步。hooks/trae/permission-guard.js:Trae 侧静默问卷拦截 hook——mode=silent时阻断AskUserQuestion问卷发送(exit 2 回传原因),与 opencode/claude/dsh 三侧SILENT_GUARDED_TOOLS/readSilentMode语义一致。tools字段静态限权承担,目录级写权限(.cannbot等)由 prompt 约束(同 codex 降级,文档中已显式标注)。CLI_NAME增加 trae 映射;子仓 init 零改动(C1-C4 兼容)。architecture-and-links.md(运行时目录树 / init 表 Step 3/4/4+ / 动态权限 hook 段)、review-checklist.md(L3/L8/M6 补 trae)、modify-skill.md(工具支持列表)、workflow-agent-permissions、settings.md、task-prompts.md、workflow-cp0/1/2-2、agents/qa.md、plugin-experience-summary等运行时文档补 trae 问卷工具枚举与权限机制说明。关联的Issue
测试
init.sh --list-tools→opencode claude codex dsh trae.trae/agents/生成 6 个 Subagent(frontmatter 含tools白名单)、43 个 skills 链接、.trae/hooks.json注册成功~/.trae-cn/配置根正确,hook 使用绝对路径AskUserQuestion(exit 2)、放行非问卷工具;interactive 模式放行问卷——符合预期bash -n(init.sh / example/init.sh)与node --check(permission-guard.js)语法检查通过文档更新
plugins-community/cuda2ascend/README.md:工具支持与静默模式说明补 traeplugins-community/cuda2ascend/AGENTS.md:权限预检补 trae 分支类型标签