feat(skills): migrate Trae to config-driven native skills

Move Trae installer from .trae/rules to .trae/skills with SKILL.md
directory output. Add legacy cleanup and 9 test assertions.
This commit is contained in:
Alex Verkhovsky 2026-03-07 00:19:10 -07:00
parent 41c9b6bcfd
commit b8bf7bb923
3 changed files with 74 additions and 11 deletions

View File

@ -1075,6 +1075,65 @@ async function runTests() {
console.log('');
// ============================================================
// Test 21: Trae Native Skills Install
// ============================================================
console.log(`${colors.yellow}Test Suite 21: Trae Native Skills${colors.reset}\n`);
try {
clearCache();
const platformCodes21 = await loadPlatformCodes();
const traeInstaller = platformCodes21.platforms.trae?.installer;
assert(traeInstaller?.target_dir === '.trae/skills', 'Trae target_dir uses native skills path');
assert(traeInstaller?.skill_format === true, 'Trae installer enables native skill output');
assert(
Array.isArray(traeInstaller?.legacy_targets) && traeInstaller.legacy_targets.includes('.trae/rules'),
'Trae installer cleans legacy rules output',
);
const tempProjectDir21 = await fs.mkdtemp(path.join(os.tmpdir(), 'bmad-trae-test-'));
const installedBmadDir21 = await createTestBmadFixture();
const legacyDir21 = path.join(tempProjectDir21, '.trae', 'rules');
await fs.ensureDir(legacyDir21);
await fs.writeFile(path.join(legacyDir21, 'bmad-legacy.md'), 'legacy\n');
const ideManager21 = new IdeManager();
await ideManager21.ensureInitialized();
const result21 = await ideManager21.setup('trae', tempProjectDir21, installedBmadDir21, {
silent: true,
selectedModules: ['bmm'],
});
assert(result21.success === true, 'Trae setup succeeds against temp project');
const skillFile21 = path.join(tempProjectDir21, '.trae', 'skills', 'bmad-master', 'SKILL.md');
assert(await fs.pathExists(skillFile21), 'Trae install writes SKILL.md directory output');
const skillContent21 = await fs.readFile(skillFile21, 'utf8');
const nameMatch21 = skillContent21.match(/^name:\s*(.+)$/m);
assert(nameMatch21 && nameMatch21[1].trim() === 'bmad-master', 'Trae skill name frontmatter matches directory name exactly');
assert(!(await fs.pathExists(path.join(tempProjectDir21, '.trae', 'rules'))), 'Trae setup removes legacy rules dir');
const result21b = await ideManager21.setup('trae', tempProjectDir21, installedBmadDir21, {
silent: true,
selectedModules: ['bmm'],
});
assert(result21b.success === true, 'Trae reinstall/upgrade succeeds over existing skills');
assert(await fs.pathExists(skillFile21), 'Trae reinstall preserves SKILL.md output');
await fs.remove(tempProjectDir21);
await fs.remove(installedBmadDir21);
} catch (error) {
assert(false, 'Trae native skills migration test succeeds', error.message);
}
console.log('');
// ============================================================
// Summary
// ============================================================

View File

@ -214,8 +214,11 @@ platforms:
category: ide
description: "AI coding tool"
installer:
target_dir: .trae/rules
template_type: trae
legacy_targets:
- .trae/rules
target_dir: .trae/skills
template_type: default
skill_format: true
windsurf:
name: "Windsurf"

View File

@ -175,18 +175,19 @@ Support assumption: full Agent Skills support. BMAD currently installs commands
## Trae
Support assumption: full Agent Skills support. BMAD currently installs rule files to `.trae/rules`; target should move to the platform's native skills directory.
Support assumption: full Agent Skills support. [Trae docs](https://docs.trae.ai/ide/skills) confirm workspace skills at `.trae/skills/<skill-name>/SKILL.md`. BMAD has now migrated from `.trae/rules` to `.trae/skills`.
**Install:** Download [standalone IDE](https://www.trae.ai/download) (macOS/Windows/Linux) or `winget install -e --id ByteDance.Trae`
- [ ] Confirm Trae native skills path and whether the current `.trae/rules` path is still required for compatibility
- [ ] Implement installer migration to native skills output
- [ ] Add legacy cleanup for `.trae/rules`
- [ ] Test fresh install
- [ ] Test reinstall/upgrade from legacy rules output
- [ ] Confirm ancestor conflict protection where applicable
- [ ] Implement/extend automated tests
- [ ] Commit
- [x] Confirm Trae native skills path is `.trae/skills/{skill-name}/SKILL.md` — per official docs
- [x] Implement installer migration to native skills output
- [x] Add legacy cleanup for `.trae/rules`
- [x] Test fresh install — 43 skills installed to `.trae/skills/`
- [x] Test reinstall/upgrade from legacy rules output
- [x] Confirm no ancestor conflict protection is needed — Trae docs describe project-local `.trae/skills/` only
- [ ] **NEEDS MANUAL IDE VERIFICATION** — download Trae IDE and confirm skills appear in UI
- [x] Implement/extend automated tests — 9 assertions in test suite 21
- [x] Commit
## GitHub Copilot