sdd-toolkit 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +133 -133
- package/definitions/dev.coder.yaml +59 -59
- package/package.json +40 -40
- package/src/index.js +207 -183
- package/src/lib/agents.js +125 -68
- package/src/lib/docs.js +104 -104
- package/src/lib/profiles.js +186 -0
- package/src/lib/schema.js +13 -13
- package/src/lib/transformers.js +199 -199
package/src/lib/transformers.js
CHANGED
|
@@ -1,199 +1,199 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converte definição do agente para TOML do Gemini CLI
|
|
3
|
-
*/
|
|
4
|
-
function toGeminiTOML(agent) {
|
|
5
|
-
// Escapa aspas duplas na descrição
|
|
6
|
-
const description = (agent.description || agent.role).replace(/"/g, '\\"');
|
|
7
|
-
|
|
8
|
-
// Constrói o prompt completo
|
|
9
|
-
const parts = [
|
|
10
|
-
`# Identity`,
|
|
11
|
-
`You are **${agent.name}** ${agent.emoji}`,
|
|
12
|
-
`Role: ${agent.role}\n`,
|
|
13
|
-
`# Core Instructions`,
|
|
14
|
-
agent.systemPrompt.trim(),
|
|
15
|
-
'\n'
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
if (agent.rules && agent.rules.length > 0) {
|
|
19
|
-
parts.push(`# Rules & Guidelines`);
|
|
20
|
-
agent.rules.forEach(rule => parts.push(`- ${rule}`));
|
|
21
|
-
parts.push('\n');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const fullPrompt = parts.join('\n');
|
|
25
|
-
|
|
26
|
-
// Escapa aspas triplas para o bloco multilinha TOML
|
|
27
|
-
const escapedPrompt = fullPrompt.replace(/"""/g, '\\"\\\"\\"');
|
|
28
|
-
|
|
29
|
-
// Monta o TOML final
|
|
30
|
-
let toml = `description = "${description}"\n`;
|
|
31
|
-
toml += `prompt = """\n${escapedPrompt}\n"""\n`;
|
|
32
|
-
|
|
33
|
-
// Mantém rules como array separado se a ferramenta suportar (Gemini CLI suporta)
|
|
34
|
-
if (agent.rules && agent.rules.length > 0) {
|
|
35
|
-
toml += 'rules = [\n';
|
|
36
|
-
agent.rules.forEach(rule => {
|
|
37
|
-
const escaped = rule.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
38
|
-
toml += ` "${escaped}",\n`;
|
|
39
|
-
});
|
|
40
|
-
toml += ']\n';
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return toml;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Converte para configuração de Custom Mode do Roo Code / Cline (JSON)
|
|
48
|
-
*/
|
|
49
|
-
function toRooConfig(agent, slug) {
|
|
50
|
-
const promptParts = [
|
|
51
|
-
`# ${agent.name} (${agent.role})`,
|
|
52
|
-
`\n${agent.systemPrompt.trim()}\n`
|
|
53
|
-
];
|
|
54
|
-
|
|
55
|
-
if (agent.rules && agent.rules.length > 0) {
|
|
56
|
-
promptParts.push(`## Rules & Guidelines`);
|
|
57
|
-
agent.rules.forEach(rule => promptParts.push(`- ${rule}`));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
slug: slug,
|
|
62
|
-
name: `${agent.emoji} ${agent.name}`,
|
|
63
|
-
roleDefinition: promptParts.join('\n'),
|
|
64
|
-
groups: ["read", "edit", "browser", "command", "mcp"]
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Converte para Markdown do Kilo Code
|
|
70
|
-
*/
|
|
71
|
-
function toKiloMarkdown(agent) {
|
|
72
|
-
const parts = [
|
|
73
|
-
`<!--- Kilo Code Agent Config --->`,
|
|
74
|
-
`# ${agent.name} ${agent.emoji}`,
|
|
75
|
-
`**Role**: ${agent.role}\n`,
|
|
76
|
-
`## Instructions`,
|
|
77
|
-
agent.systemPrompt.trim(),
|
|
78
|
-
'\n'
|
|
79
|
-
];
|
|
80
|
-
|
|
81
|
-
if (agent.rules && agent.rules.length > 0) {
|
|
82
|
-
parts.push(`## Constraints`);
|
|
83
|
-
agent.rules.forEach(rule => parts.push(`- ${rule}`));
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return parts.join('\n');
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Converte para Instruções do GitHub Copilot (.github/copilot-instructions.md)
|
|
91
|
-
*/
|
|
92
|
-
function toCopilotInstructions(agent) {
|
|
93
|
-
const parts = [
|
|
94
|
-
`<!-- GitHub Copilot Instructions for ${agent.name} -->`,
|
|
95
|
-
`# Identity and Role`,
|
|
96
|
-
`You are **${agent.name}** ${agent.emoji}.`,
|
|
97
|
-
`**Role**: ${agent.role}`,
|
|
98
|
-
`\n## Core Instructions`,
|
|
99
|
-
agent.systemPrompt.trim(),
|
|
100
|
-
'\n'
|
|
101
|
-
];
|
|
102
|
-
|
|
103
|
-
if (agent.rules && agent.rules.length > 0) {
|
|
104
|
-
parts.push(`## Rules & Guidelines`);
|
|
105
|
-
agent.rules.forEach(rule => parts.push(`- ${rule}`));
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Adiciona uma seção de estilo de resposta para garantir conformidade
|
|
109
|
-
parts.push(`\n## Response Style`);
|
|
110
|
-
parts.push(`- Be concise and objective.`);
|
|
111
|
-
parts.push(`- Use Portuguese (Brazil) unless told otherwise.`);
|
|
112
|
-
parts.push(`- Follow the project conventions defined in the workspace.`);
|
|
113
|
-
|
|
114
|
-
return parts.join('\n');
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Converte para Cursor Rules (.mdc)
|
|
119
|
-
* Inclui Frontmatter para Contexto
|
|
120
|
-
*/
|
|
121
|
-
function toCursorMDC(agent) {
|
|
122
|
-
// Tenta inferir globs baseados no papel do agente
|
|
123
|
-
let globs = "*";
|
|
124
|
-
const roleLower = agent.slug.toLowerCase();
|
|
125
|
-
|
|
126
|
-
if (roleLower.includes('test') || roleLower.includes('qa')) globs = "*.test.*, *.spec.*, **/tests/**";
|
|
127
|
-
if (roleLower.includes('css') || roleLower.includes('style')) globs = "*.css, *.scss, *.tailwind";
|
|
128
|
-
if (roleLower.includes('sql') || roleLower.includes('db')) globs = "*.sql, *.prisma, *.schema";
|
|
129
|
-
|
|
130
|
-
return `---
|
|
131
|
-
description: ${agent.description || agent.role}
|
|
132
|
-
globs: ${globs}
|
|
133
|
-
---
|
|
134
|
-
# ${agent.name} ${agent.emoji}
|
|
135
|
-
|
|
136
|
-
Role: ${agent.role}
|
|
137
|
-
|
|
138
|
-
## Instructions
|
|
139
|
-
${agent.systemPrompt.trim()}
|
|
140
|
-
|
|
141
|
-
${agent.rules && agent.rules.length > 0 ? '## Rules\n' + agent.rules.map(r => `- ${r}`).join('\n') : ''}
|
|
142
|
-
`;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Converte para Windsurf (.windsurfrules)
|
|
147
|
-
*/
|
|
148
|
-
function toWindsurfRules(agent) {
|
|
149
|
-
return `# ${agent.name} ${agent.emoji} Rules
|
|
150
|
-
|
|
151
|
-
Role: ${agent.role}
|
|
152
|
-
|
|
153
|
-
## Core Logic
|
|
154
|
-
${agent.systemPrompt.trim()}
|
|
155
|
-
|
|
156
|
-
${agent.rules && agent.rules.length > 0 ? '## Guidelines\n' + agent.rules.map(r => `- ${r}`).join('\n') : ''}
|
|
157
|
-
`;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Converte para System Prompt Puro (OpenAI/Claude/Web)
|
|
162
|
-
*/
|
|
163
|
-
function toPlainSystemPrompt(agent) {
|
|
164
|
-
return `You are ${agent.name} ${agent.emoji}
|
|
165
|
-
Role: ${agent.role}
|
|
166
|
-
|
|
167
|
-
[SYSTEM INSTRUCTIONS]
|
|
168
|
-
${agent.systemPrompt.trim()}
|
|
169
|
-
|
|
170
|
-
${agent.rules && agent.rules.length > 0 ? '[GUIDELINES]\n' + agent.rules.map(r => `- ${r}`).join('\n') : ''}
|
|
171
|
-
`;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Converte para Trae Instructions
|
|
176
|
-
*/
|
|
177
|
-
function toTraeRules(agent) {
|
|
178
|
-
return `<!-- Trae Workspace Rules -->
|
|
179
|
-
# ${agent.name} ${agent.emoji}
|
|
180
|
-
|
|
181
|
-
**Role**: ${agent.role}
|
|
182
|
-
|
|
183
|
-
## Context & Instructions
|
|
184
|
-
${agent.systemPrompt.trim()}
|
|
185
|
-
|
|
186
|
-
${agent.rules && agent.rules.length > 0 ? '## Constraints\n' + agent.rules.map(r => `- ${r}`).join('\n') : ''}
|
|
187
|
-
`;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
module.exports = {
|
|
191
|
-
toGeminiTOML,
|
|
192
|
-
toRooConfig,
|
|
193
|
-
toKiloMarkdown,
|
|
194
|
-
toCopilotInstructions,
|
|
195
|
-
toCursorMDC,
|
|
196
|
-
toWindsurfRules,
|
|
197
|
-
toPlainSystemPrompt,
|
|
198
|
-
toTraeRules
|
|
199
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Converte definição do agente para TOML do Gemini CLI
|
|
3
|
+
*/
|
|
4
|
+
function toGeminiTOML(agent) {
|
|
5
|
+
// Escapa aspas duplas na descrição
|
|
6
|
+
const description = (agent.description || agent.role).replace(/"/g, '\\"');
|
|
7
|
+
|
|
8
|
+
// Constrói o prompt completo
|
|
9
|
+
const parts = [
|
|
10
|
+
`# Identity`,
|
|
11
|
+
`You are **${agent.name}** ${agent.emoji}`,
|
|
12
|
+
`Role: ${agent.role}\n`,
|
|
13
|
+
`# Core Instructions`,
|
|
14
|
+
agent.systemPrompt.trim(),
|
|
15
|
+
'\n'
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
if (agent.rules && agent.rules.length > 0) {
|
|
19
|
+
parts.push(`# Rules & Guidelines`);
|
|
20
|
+
agent.rules.forEach(rule => parts.push(`- ${rule}`));
|
|
21
|
+
parts.push('\n');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const fullPrompt = parts.join('\n');
|
|
25
|
+
|
|
26
|
+
// Escapa aspas triplas para o bloco multilinha TOML
|
|
27
|
+
const escapedPrompt = fullPrompt.replace(/"""/g, '\\"\\\"\\"');
|
|
28
|
+
|
|
29
|
+
// Monta o TOML final
|
|
30
|
+
let toml = `description = "${description}"\n`;
|
|
31
|
+
toml += `prompt = """\n${escapedPrompt}\n"""\n`;
|
|
32
|
+
|
|
33
|
+
// Mantém rules como array separado se a ferramenta suportar (Gemini CLI suporta)
|
|
34
|
+
if (agent.rules && agent.rules.length > 0) {
|
|
35
|
+
toml += 'rules = [\n';
|
|
36
|
+
agent.rules.forEach(rule => {
|
|
37
|
+
const escaped = rule.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
38
|
+
toml += ` "${escaped}",\n`;
|
|
39
|
+
});
|
|
40
|
+
toml += ']\n';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return toml;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Converte para configuração de Custom Mode do Roo Code / Cline (JSON)
|
|
48
|
+
*/
|
|
49
|
+
function toRooConfig(agent, slug) {
|
|
50
|
+
const promptParts = [
|
|
51
|
+
`# ${agent.name} (${agent.role})`,
|
|
52
|
+
`\n${agent.systemPrompt.trim()}\n`
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
if (agent.rules && agent.rules.length > 0) {
|
|
56
|
+
promptParts.push(`## Rules & Guidelines`);
|
|
57
|
+
agent.rules.forEach(rule => promptParts.push(`- ${rule}`));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
slug: slug,
|
|
62
|
+
name: `${agent.emoji} ${agent.name}`,
|
|
63
|
+
roleDefinition: promptParts.join('\n'),
|
|
64
|
+
groups: ["read", "edit", "browser", "command", "mcp"]
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Converte para Markdown do Kilo Code
|
|
70
|
+
*/
|
|
71
|
+
function toKiloMarkdown(agent) {
|
|
72
|
+
const parts = [
|
|
73
|
+
`<!--- Kilo Code Agent Config --->`,
|
|
74
|
+
`# ${agent.name} ${agent.emoji}`,
|
|
75
|
+
`**Role**: ${agent.role}\n`,
|
|
76
|
+
`## Instructions`,
|
|
77
|
+
agent.systemPrompt.trim(),
|
|
78
|
+
'\n'
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
if (agent.rules && agent.rules.length > 0) {
|
|
82
|
+
parts.push(`## Constraints`);
|
|
83
|
+
agent.rules.forEach(rule => parts.push(`- ${rule}`));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return parts.join('\n');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Converte para Instruções do GitHub Copilot (.github/copilot-instructions.md)
|
|
91
|
+
*/
|
|
92
|
+
function toCopilotInstructions(agent) {
|
|
93
|
+
const parts = [
|
|
94
|
+
`<!-- GitHub Copilot Instructions for ${agent.name} -->`,
|
|
95
|
+
`# Identity and Role`,
|
|
96
|
+
`You are **${agent.name}** ${agent.emoji}.`,
|
|
97
|
+
`**Role**: ${agent.role}`,
|
|
98
|
+
`\n## Core Instructions`,
|
|
99
|
+
agent.systemPrompt.trim(),
|
|
100
|
+
'\n'
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
if (agent.rules && agent.rules.length > 0) {
|
|
104
|
+
parts.push(`## Rules & Guidelines`);
|
|
105
|
+
agent.rules.forEach(rule => parts.push(`- ${rule}`));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Adiciona uma seção de estilo de resposta para garantir conformidade
|
|
109
|
+
parts.push(`\n## Response Style`);
|
|
110
|
+
parts.push(`- Be concise and objective.`);
|
|
111
|
+
parts.push(`- Use Portuguese (Brazil) unless told otherwise.`);
|
|
112
|
+
parts.push(`- Follow the project conventions defined in the workspace.`);
|
|
113
|
+
|
|
114
|
+
return parts.join('\n');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Converte para Cursor Rules (.mdc)
|
|
119
|
+
* Inclui Frontmatter para Contexto
|
|
120
|
+
*/
|
|
121
|
+
function toCursorMDC(agent) {
|
|
122
|
+
// Tenta inferir globs baseados no papel do agente
|
|
123
|
+
let globs = "*";
|
|
124
|
+
const roleLower = agent.slug.toLowerCase();
|
|
125
|
+
|
|
126
|
+
if (roleLower.includes('test') || roleLower.includes('qa')) globs = "*.test.*, *.spec.*, **/tests/**";
|
|
127
|
+
if (roleLower.includes('css') || roleLower.includes('style')) globs = "*.css, *.scss, *.tailwind";
|
|
128
|
+
if (roleLower.includes('sql') || roleLower.includes('db')) globs = "*.sql, *.prisma, *.schema";
|
|
129
|
+
|
|
130
|
+
return `---
|
|
131
|
+
description: ${agent.description || agent.role}
|
|
132
|
+
globs: ${globs}
|
|
133
|
+
---
|
|
134
|
+
# ${agent.name} ${agent.emoji}
|
|
135
|
+
|
|
136
|
+
Role: ${agent.role}
|
|
137
|
+
|
|
138
|
+
## Instructions
|
|
139
|
+
${agent.systemPrompt.trim()}
|
|
140
|
+
|
|
141
|
+
${agent.rules && agent.rules.length > 0 ? '## Rules\n' + agent.rules.map(r => `- ${r}`).join('\n') : ''}
|
|
142
|
+
`;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Converte para Windsurf (.windsurfrules)
|
|
147
|
+
*/
|
|
148
|
+
function toWindsurfRules(agent) {
|
|
149
|
+
return `# ${agent.name} ${agent.emoji} Rules
|
|
150
|
+
|
|
151
|
+
Role: ${agent.role}
|
|
152
|
+
|
|
153
|
+
## Core Logic
|
|
154
|
+
${agent.systemPrompt.trim()}
|
|
155
|
+
|
|
156
|
+
${agent.rules && agent.rules.length > 0 ? '## Guidelines\n' + agent.rules.map(r => `- ${r}`).join('\n') : ''}
|
|
157
|
+
`;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Converte para System Prompt Puro (OpenAI/Claude/Web)
|
|
162
|
+
*/
|
|
163
|
+
function toPlainSystemPrompt(agent) {
|
|
164
|
+
return `You are ${agent.name} ${agent.emoji}
|
|
165
|
+
Role: ${agent.role}
|
|
166
|
+
|
|
167
|
+
[SYSTEM INSTRUCTIONS]
|
|
168
|
+
${agent.systemPrompt.trim()}
|
|
169
|
+
|
|
170
|
+
${agent.rules && agent.rules.length > 0 ? '[GUIDELINES]\n' + agent.rules.map(r => `- ${r}`).join('\n') : ''}
|
|
171
|
+
`;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Converte para Trae Instructions
|
|
176
|
+
*/
|
|
177
|
+
function toTraeRules(agent) {
|
|
178
|
+
return `<!-- Trae Workspace Rules -->
|
|
179
|
+
# ${agent.name} ${agent.emoji}
|
|
180
|
+
|
|
181
|
+
**Role**: ${agent.role}
|
|
182
|
+
|
|
183
|
+
## Context & Instructions
|
|
184
|
+
${agent.systemPrompt.trim()}
|
|
185
|
+
|
|
186
|
+
${agent.rules && agent.rules.length > 0 ? '## Constraints\n' + agent.rules.map(r => `- ${r}`).join('\n') : ''}
|
|
187
|
+
`;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
module.exports = {
|
|
191
|
+
toGeminiTOML,
|
|
192
|
+
toRooConfig,
|
|
193
|
+
toKiloMarkdown,
|
|
194
|
+
toCopilotInstructions,
|
|
195
|
+
toCursorMDC,
|
|
196
|
+
toWindsurfRules,
|
|
197
|
+
toPlainSystemPrompt,
|
|
198
|
+
toTraeRules
|
|
199
|
+
};
|