mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 06:06:37 +03:00
Support both Trae China and International versions
- Output skills to both .trae-cn/ and .trae/ directories - Update README with installation instructions for both versions - Update DEVELOP.md with dual-variant documentation
This commit is contained in:
+4
-2
@@ -151,7 +151,8 @@ function assembleUniversal(distDir, suffix = '') {
|
||||
{ provider: 'kiro', configDir: '.kiro' },
|
||||
{ provider: 'opencode', configDir: '.opencode' },
|
||||
{ provider: 'pi', configDir: '.pi' },
|
||||
{ provider: 'trae', configDir: '.trae-cn' }
|
||||
{ provider: 'trae', configDir: '.trae-cn' },
|
||||
{ provider: 'trae', configDir: '.trae' }
|
||||
];
|
||||
|
||||
for (const { provider, configDir } of providerMappings) {
|
||||
@@ -179,7 +180,8 @@ This folder contains skills for all supported tools:
|
||||
.kiro/ → Kiro
|
||||
.opencode/ → OpenCode
|
||||
.pi/ → Pi
|
||||
.trae-cn/ → Trae
|
||||
.trae-cn/ → Trae China
|
||||
.trae/ → Trae International
|
||||
|
||||
To install, copy the relevant folder(s) into your project root.
|
||||
These are hidden folders (dotfiles) — press Cmd+Shift+. in Finder to see them.
|
||||
|
||||
@@ -4,7 +4,10 @@ import { cleanDir, ensureDir, writeFile, generateYamlFrontmatter, replacePlaceho
|
||||
/**
|
||||
* Trae Transformer (Skills Only)
|
||||
*
|
||||
* All skills output to .trae-cn/builtin_skills/{name}/SKILL.md
|
||||
* Outputs skills for both Trae China and Trae International versions:
|
||||
* - .trae-cn/builtin_skills/{name}/SKILL.md (China version)
|
||||
* - .trae/builtin_skills/{name}/SKILL.md (International version)
|
||||
*
|
||||
* Trae uses a similar format to Claude Code with full metadata support.
|
||||
*
|
||||
* @param {Array} skills - All skills (including user-invokable ones)
|
||||
@@ -17,51 +20,63 @@ import { cleanDir, ensureDir, writeFile, generateYamlFrontmatter, replacePlaceho
|
||||
export function transformTrae(skills, distDir, patterns = null, options = {}) {
|
||||
const { prefix = '', outputSuffix = '' } = options;
|
||||
const traeDir = path.join(distDir, `trae${outputSuffix}`);
|
||||
const skillsDir = path.join(traeDir, '.trae-cn/builtin_skills');
|
||||
|
||||
cleanDir(traeDir);
|
||||
ensureDir(skillsDir);
|
||||
|
||||
const allSkillNames = skills.map(s => s.name);
|
||||
const commandNames = skills.filter(s => s.userInvokable).map(s => `${prefix}${s.name}`);
|
||||
let refCount = 0;
|
||||
for (const skill of skills) {
|
||||
const skillName = `${prefix}${skill.name}`;
|
||||
const skillDir = path.join(skillsDir, skillName);
|
||||
|
||||
const frontmatterObj = {
|
||||
name: skillName,
|
||||
description: skill.description,
|
||||
};
|
||||
const variants = [
|
||||
{ name: 'China', configDir: '.trae-cn/builtin_skills' },
|
||||
{ name: 'International', configDir: '.trae/builtin_skills' }
|
||||
];
|
||||
|
||||
if (skill.userInvokable) frontmatterObj['user-invokable'] = true;
|
||||
if (skill.args && skill.args.length > 0) frontmatterObj.args = skill.args;
|
||||
if (skill.license) frontmatterObj.license = skill.license;
|
||||
if (skill.compatibility) frontmatterObj.compatibility = skill.compatibility;
|
||||
if (skill.metadata) frontmatterObj.metadata = skill.metadata;
|
||||
if (skill.allowedTools) frontmatterObj['allowed-tools'] = skill.allowedTools;
|
||||
let totalRefCount = 0;
|
||||
|
||||
const frontmatter = generateYamlFrontmatter(frontmatterObj);
|
||||
let skillBody = replacePlaceholders(skill.body, 'trae', commandNames);
|
||||
if (prefix) skillBody = prefixSkillReferences(skillBody, prefix, allSkillNames);
|
||||
const content = `${frontmatter}\n\n${skillBody}`;
|
||||
const outputPath = path.join(skillDir, 'SKILL.md');
|
||||
writeFile(outputPath, content);
|
||||
for (const variant of variants) {
|
||||
const skillsDir = path.join(traeDir, variant.configDir);
|
||||
ensureDir(skillsDir);
|
||||
|
||||
if (skill.references && skill.references.length > 0) {
|
||||
const refDir = path.join(skillDir, 'reference');
|
||||
ensureDir(refDir);
|
||||
for (const ref of skill.references) {
|
||||
const refOutputPath = path.join(refDir, `${ref.name}.md`);
|
||||
const refContent = replacePlaceholders(ref.content, 'trae');
|
||||
writeFile(refOutputPath, refContent);
|
||||
refCount++;
|
||||
let refCount = 0;
|
||||
for (const skill of skills) {
|
||||
const skillName = `${prefix}${skill.name}`;
|
||||
const skillDir = path.join(skillsDir, skillName);
|
||||
|
||||
const frontmatterObj = {
|
||||
name: skillName,
|
||||
description: skill.description,
|
||||
};
|
||||
|
||||
if (skill.userInvokable) frontmatterObj['user-invokable'] = true;
|
||||
if (skill.args && skill.args.length > 0) frontmatterObj.args = skill.args;
|
||||
if (skill.license) frontmatterObj.license = skill.license;
|
||||
if (skill.compatibility) frontmatterObj.compatibility = skill.compatibility;
|
||||
if (skill.metadata) frontmatterObj.metadata = skill.metadata;
|
||||
if (skill.allowedTools) frontmatterObj['allowed-tools'] = skill.allowedTools;
|
||||
|
||||
const frontmatter = generateYamlFrontmatter(frontmatterObj);
|
||||
let skillBody = replacePlaceholders(skill.body, 'trae', commandNames);
|
||||
if (prefix) skillBody = prefixSkillReferences(skillBody, prefix, allSkillNames);
|
||||
const content = `${frontmatter}\n\n${skillBody}`;
|
||||
const outputPath = path.join(skillDir, 'SKILL.md');
|
||||
writeFile(outputPath, content);
|
||||
|
||||
if (skill.references && skill.references.length > 0) {
|
||||
const refDir = path.join(skillDir, 'reference');
|
||||
ensureDir(refDir);
|
||||
for (const ref of skill.references) {
|
||||
const refOutputPath = path.join(refDir, `${ref.name}.md`);
|
||||
const refContent = replacePlaceholders(ref.content, 'trae');
|
||||
writeFile(refOutputPath, refContent);
|
||||
refCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
totalRefCount += refCount;
|
||||
}
|
||||
|
||||
const userInvokableCount = skills.filter(s => s.userInvokable).length;
|
||||
const refInfo = refCount > 0 ? ` (${refCount} reference files)` : '';
|
||||
const refInfo = totalRefCount > 0 ? ` (${totalRefCount / 2} reference files per variant)` : '';
|
||||
const prefixInfo = prefix ? ` [${prefix}prefixed]` : '';
|
||||
console.log(`✓ Trae${prefixInfo}: ${skills.length} skills (${userInvokableCount} user-invokable)${refInfo}`);
|
||||
console.log(`✓ Trae${prefixInfo}: ${skills.length} skills (${userInvokableCount} user-invokable) for 2 variants${refInfo}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user