@claude-flow/cli 3.32.35 → 3.32.36
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/.claude/helpers/helpers.manifest.json +5 -5
- package/.claude/helpers/hook-handler.cjs +30 -0
- package/.claude/helpers/intelligence.cjs +47 -4
- package/.claude/helpers/statusline.cjs +169 -6
- package/bin/cli.js +25 -1
- package/catalog-manifest.json +2 -2
- package/dist/src/commands/agent.js +1 -1
- package/dist/src/commands/doctor.js +159 -11
- package/dist/src/commands/hooks.js +39 -4
- package/dist/src/commands/mcp.js +1 -1
- package/dist/src/commands/memory-distill.js +1 -0
- package/dist/src/commands/swarm.js +28 -0
- package/dist/src/init/executor.js +16 -10
- package/dist/src/init/helpers-generator.js +15 -4
- package/dist/src/init/statusline-generator.js +18 -5
- package/dist/src/mcp-server.d.ts +25 -0
- package/dist/src/mcp-server.js +57 -2
- package/dist/src/mcp-tools/embeddings-tools.js +51 -10
- package/dist/src/mcp-tools/hooks-tools.js +34 -8
- package/dist/src/memory/memory-bridge.d.ts +2 -0
- package/dist/src/memory/memory-bridge.js +5 -1
- package/dist/src/services/memory-distillation.d.ts +1 -0
- package/dist/src/services/memory-distillation.js +81 -5
- package/dist/src/services/worker-daemon.js +1 -0
- package/node_modules/@claude-flow/codex/.agents/skills/github-automation/SKILL.md +32 -0
- package/node_modules/@claude-flow/codex/.agents/skills/performance-analysis/SKILL.md +32 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts +4 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.d.ts.map +1 -1
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js +20 -1
- package/node_modules/@claude-flow/codex/dist/dual-mode/cli.js.map +1 -1
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts +4 -0
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.d.ts.map +1 -1
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js +18 -2
- package/node_modules/@claude-flow/codex/dist/dual-mode/orchestrator.js.map +1 -1
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts +11 -5
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.d.ts.map +1 -1
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.js +84 -849
- package/node_modules/@claude-flow/codex/dist/generators/skill-md.js.map +1 -1
- package/node_modules/@claude-flow/codex/dist/initializer.d.ts.map +1 -1
- package/node_modules/@claude-flow/codex/dist/initializer.js +9 -13
- package/node_modules/@claude-flow/codex/dist/initializer.js.map +1 -1
- package/package.json +1 -1
- package/plugins/ruflo-metaharness/scripts/_harness.mjs +5 -1
- package/plugins/ruflo-metaharness/scripts/_invoke.mjs +12 -13
- package/plugins/ruflo-metaharness/scripts/mcp-scan.mjs +7 -8
- package/plugins/ruflo-metaharness/scripts/smoke.sh +58 -2
- package/plugins/ruflo-metaharness/scripts/test-similarity.mjs +38 -0
- package/plugins/ruflo-metaharness/scripts/threat-model.mjs +4 -1
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @claude-flow/codex - SKILL.md Generator
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Custom skills are rendered from typed options. Built-in skills use the
|
|
5
|
+
* packaged `.agents/skills` trees as their canonical definitions so direct
|
|
6
|
+
* generation, project initialization, and npm artifacts cannot drift.
|
|
6
7
|
*/
|
|
8
|
+
import { readdir, readFile } from 'node:fs/promises';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import { fileURLToPath } from 'node:url';
|
|
11
|
+
export const BUILT_IN_SKILL_NAMES = [
|
|
12
|
+
'swarm-orchestration',
|
|
13
|
+
'memory-management',
|
|
14
|
+
'sparc-methodology',
|
|
15
|
+
'security-audit',
|
|
16
|
+
'performance-analysis',
|
|
17
|
+
'github-automation',
|
|
18
|
+
];
|
|
19
|
+
const BUILT_IN_SKILLS_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../.agents/skills');
|
|
7
20
|
/**
|
|
8
|
-
* Generate a SKILL.md file based on the provided options
|
|
21
|
+
* Generate a SKILL.md file based on the provided options.
|
|
9
22
|
*/
|
|
10
23
|
export async function generateSkillMd(options) {
|
|
11
24
|
const { name, description, version = '1.0.0', author = 'rUv', tags, triggers = [], skipWhen = [], scripts = [], references = [], commands = [], } = options;
|
|
12
|
-
// Derive discovery tags from the skill name when not supplied explicitly.
|
|
13
25
|
const tagList = tags && tags.length > 0 ? tags : name.split('-').filter(Boolean);
|
|
14
|
-
// Build YAML frontmatter
|
|
15
26
|
const triggerText = triggers.length > 0
|
|
16
27
|
? `Use when: ${triggers.join(', ')}.`
|
|
17
28
|
: '';
|
|
@@ -28,19 +39,9 @@ description: >
|
|
|
28
39
|
${triggerText}
|
|
29
40
|
${skipText}
|
|
30
41
|
---`;
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
: '';
|
|
35
|
-
// Build scripts section
|
|
36
|
-
const scriptsSection = scripts.length > 0
|
|
37
|
-
? buildScriptsSection(scripts)
|
|
38
|
-
: '';
|
|
39
|
-
// Build references section
|
|
40
|
-
const referencesSection = references.length > 0
|
|
41
|
-
? buildReferencesSection(references)
|
|
42
|
-
: '';
|
|
43
|
-
// Combine all sections
|
|
42
|
+
const commandsSection = commands.length > 0 ? buildCommandsSection(commands) : '';
|
|
43
|
+
const scriptsSection = scripts.length > 0 ? buildScriptsSection(scripts) : '';
|
|
44
|
+
const referencesSection = references.length > 0 ? buildReferencesSection(references) : '';
|
|
44
45
|
return `${frontmatter}
|
|
45
46
|
|
|
46
47
|
# ${formatSkillName(name)} Skill
|
|
@@ -63,9 +64,6 @@ ${referencesSection}
|
|
|
63
64
|
4. Document any new learnings
|
|
64
65
|
`;
|
|
65
66
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Build the commands section of the SKILL.md
|
|
68
|
-
*/
|
|
69
67
|
function buildCommandsSection(commands) {
|
|
70
68
|
const lines = commands.map(cmd => {
|
|
71
69
|
let block = `### ${cmd.name}\n${cmd.description}\n\n\`\`\`bash\n${cmd.command}\n\`\`\``;
|
|
@@ -80,9 +78,6 @@ function buildCommandsSection(commands) {
|
|
|
80
78
|
${lines.join('\n\n')}
|
|
81
79
|
`;
|
|
82
80
|
}
|
|
83
|
-
/**
|
|
84
|
-
* Build the scripts section
|
|
85
|
-
*/
|
|
86
81
|
function buildScriptsSection(scripts) {
|
|
87
82
|
const lines = scripts.map(s => `| \`${s.name}\` | \`${s.path}\` | ${s.description} |`);
|
|
88
83
|
return `
|
|
@@ -93,9 +88,6 @@ function buildScriptsSection(scripts) {
|
|
|
93
88
|
${lines.join('\n')}
|
|
94
89
|
`;
|
|
95
90
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Build the references section
|
|
98
|
-
*/
|
|
99
91
|
function buildReferencesSection(references) {
|
|
100
92
|
const lines = references.map(r => `| \`${r.name}\` | \`${r.path}\` | ${r.description ?? ''} |`);
|
|
101
93
|
return `
|
|
@@ -106,846 +98,89 @@ function buildReferencesSection(references) {
|
|
|
106
98
|
${lines.join('\n')}
|
|
107
99
|
`;
|
|
108
100
|
}
|
|
109
|
-
/**
|
|
110
|
-
* Format skill name for display (kebab-case to Title Case)
|
|
111
|
-
*/
|
|
112
101
|
function formatSkillName(name) {
|
|
113
102
|
return name
|
|
114
103
|
.split('-')
|
|
115
104
|
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
116
105
|
.join(' ');
|
|
117
106
|
}
|
|
107
|
+
async function readPayloadTree(root) {
|
|
108
|
+
const payload = {};
|
|
109
|
+
async function visit(directory) {
|
|
110
|
+
let entries;
|
|
111
|
+
try {
|
|
112
|
+
entries = await readdir(directory, { withFileTypes: true });
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
const code = error.code;
|
|
116
|
+
if (code === 'ENOENT')
|
|
117
|
+
return;
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
121
|
+
const absolute = path.join(directory, entry.name);
|
|
122
|
+
if (entry.isSymbolicLink()) {
|
|
123
|
+
throw new Error(`Built-in skill payload cannot contain symlinks: ${absolute}`);
|
|
124
|
+
}
|
|
125
|
+
if (entry.isDirectory()) {
|
|
126
|
+
await visit(absolute);
|
|
127
|
+
}
|
|
128
|
+
else if (entry.isFile()) {
|
|
129
|
+
const relative = path.relative(root, absolute);
|
|
130
|
+
if (relative.startsWith('..') || path.isAbsolute(relative)) {
|
|
131
|
+
throw new Error(`Built-in skill payload escapes its root: ${absolute}`);
|
|
132
|
+
}
|
|
133
|
+
const payloadPath = relative.split(path.sep).join('/');
|
|
134
|
+
payload[payloadPath] = await readFile(absolute, 'utf8');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
await visit(root);
|
|
139
|
+
return payload;
|
|
140
|
+
}
|
|
118
141
|
/**
|
|
119
|
-
*
|
|
142
|
+
* Read one canonical built-in tree from the package payload.
|
|
120
143
|
*/
|
|
121
144
|
export async function generateBuiltInSkill(skillName) {
|
|
122
|
-
|
|
123
|
-
'swarm-orchestration': {
|
|
124
|
-
name: 'swarm-orchestration',
|
|
125
|
-
description: 'Multi-agent swarm coordination for complex tasks. Uses hierarchical topology with specialized agents to break down and execute complex work across multiple files and modules.',
|
|
126
|
-
triggers: [
|
|
127
|
-
'3+ files need changes',
|
|
128
|
-
'new feature implementation',
|
|
129
|
-
'cross-module refactoring',
|
|
130
|
-
'API changes with tests',
|
|
131
|
-
'security-related changes',
|
|
132
|
-
'performance optimization across codebase',
|
|
133
|
-
'database schema changes',
|
|
134
|
-
],
|
|
135
|
-
skipWhen: [
|
|
136
|
-
'single file edits',
|
|
137
|
-
'simple bug fixes (1-2 lines)',
|
|
138
|
-
'documentation updates',
|
|
139
|
-
'configuration changes',
|
|
140
|
-
'quick exploration',
|
|
141
|
-
],
|
|
142
|
-
commands: [
|
|
143
|
-
{
|
|
144
|
-
name: 'Initialize Swarm',
|
|
145
|
-
description: 'Start a new swarm with hierarchical topology (anti-drift)',
|
|
146
|
-
command: 'npx ruflo swarm init --topology hierarchical --max-agents 8 --strategy specialized',
|
|
147
|
-
example: 'npx ruflo swarm init --topology hierarchical --max-agents 6 --strategy specialized',
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
name: 'Route Task',
|
|
151
|
-
description: 'Route a task to the appropriate agents based on task type',
|
|
152
|
-
command: 'npx @claude-flow/cli hooks route --task "[task description]"',
|
|
153
|
-
example: 'npx @claude-flow/cli hooks route --task "implement OAuth2 authentication flow"',
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
name: 'Spawn Agent',
|
|
157
|
-
description: 'Spawn a specific agent type',
|
|
158
|
-
command: 'npx @claude-flow/cli agent spawn --type [type] --name [name]',
|
|
159
|
-
example: 'npx @claude-flow/cli agent spawn --type coder --name impl-auth',
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
name: 'Monitor Status',
|
|
163
|
-
description: 'Check the current swarm status',
|
|
164
|
-
command: 'npx @claude-flow/cli swarm status --verbose',
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
name: 'Orchestrate Task',
|
|
168
|
-
description: 'Orchestrate a task across multiple agents',
|
|
169
|
-
command: 'npx @claude-flow/cli task orchestrate --task "[task]" --strategy adaptive',
|
|
170
|
-
example: 'npx @claude-flow/cli task orchestrate --task "refactor auth module" --strategy parallel --max-agents 4',
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
name: 'List Agents',
|
|
174
|
-
description: 'List all active agents',
|
|
175
|
-
command: 'npx @claude-flow/cli agent list --filter active',
|
|
176
|
-
},
|
|
177
|
-
],
|
|
178
|
-
scripts: [
|
|
179
|
-
{
|
|
180
|
-
name: 'swarm-start',
|
|
181
|
-
path: '.agents/scripts/swarm-start.sh',
|
|
182
|
-
description: 'Initialize swarm with default settings',
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
name: 'swarm-monitor',
|
|
186
|
-
path: '.agents/scripts/swarm-monitor.sh',
|
|
187
|
-
description: 'Real-time swarm monitoring dashboard',
|
|
188
|
-
},
|
|
189
|
-
],
|
|
190
|
-
references: [
|
|
191
|
-
{
|
|
192
|
-
name: 'Agent Types',
|
|
193
|
-
path: 'docs/agents.md',
|
|
194
|
-
description: 'Complete list of agent types and capabilities',
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
name: 'Topology Guide',
|
|
198
|
-
path: 'docs/topology.md',
|
|
199
|
-
description: 'Swarm topology configuration guide',
|
|
200
|
-
},
|
|
201
|
-
],
|
|
202
|
-
},
|
|
203
|
-
'memory-management': {
|
|
204
|
-
name: 'memory-management',
|
|
205
|
-
description: 'AgentDB memory system with HNSW vector search. Provides 150x-12,500x faster pattern retrieval, persistent storage, and semantic search capabilities for learning and knowledge management.',
|
|
206
|
-
triggers: [
|
|
207
|
-
'need to store successful patterns',
|
|
208
|
-
'searching for similar solutions',
|
|
209
|
-
'semantic lookup of past work',
|
|
210
|
-
'learning from previous tasks',
|
|
211
|
-
'sharing knowledge between agents',
|
|
212
|
-
'building knowledge base',
|
|
213
|
-
],
|
|
214
|
-
skipWhen: [
|
|
215
|
-
'no learning needed',
|
|
216
|
-
'ephemeral one-off tasks',
|
|
217
|
-
'external data sources available',
|
|
218
|
-
'read-only exploration',
|
|
219
|
-
],
|
|
220
|
-
commands: [
|
|
221
|
-
{
|
|
222
|
-
name: 'Store Pattern',
|
|
223
|
-
description: 'Store a pattern or knowledge item in memory',
|
|
224
|
-
command: 'npx @claude-flow/cli memory store --key "[key]" --value "[value]" --namespace patterns',
|
|
225
|
-
example: 'npx @claude-flow/cli memory store --key "auth-jwt-pattern" --value "JWT validation with refresh tokens" --namespace patterns',
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
name: 'Semantic Search',
|
|
229
|
-
description: 'Search memory using semantic similarity',
|
|
230
|
-
command: 'npx @claude-flow/cli memory search --query "[search terms]" --limit 10',
|
|
231
|
-
example: 'npx @claude-flow/cli memory search --query "authentication best practices" --limit 5',
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
name: 'Retrieve Entry',
|
|
235
|
-
description: 'Retrieve a specific memory entry by key',
|
|
236
|
-
command: 'npx @claude-flow/cli memory get --key "[key]" --namespace [namespace]',
|
|
237
|
-
example: 'npx @claude-flow/cli memory get --key "auth-jwt-pattern" --namespace patterns',
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
name: 'List Entries',
|
|
241
|
-
description: 'List all entries in a namespace',
|
|
242
|
-
command: 'npx @claude-flow/cli memory list --namespace [namespace]',
|
|
243
|
-
example: 'npx @claude-flow/cli memory list --namespace patterns --limit 20',
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
name: 'Delete Entry',
|
|
247
|
-
description: 'Delete a memory entry',
|
|
248
|
-
command: 'npx @claude-flow/cli memory delete --key "[key]" --namespace [namespace]',
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
name: 'Initialize HNSW Index',
|
|
252
|
-
description: 'Initialize HNSW vector search index',
|
|
253
|
-
command: 'npx @claude-flow/cli memory init --enable-hnsw',
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
name: 'Memory Stats',
|
|
257
|
-
description: 'Show memory usage statistics',
|
|
258
|
-
command: 'npx @claude-flow/cli memory stats',
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
name: 'Export Memory',
|
|
262
|
-
description: 'Export memory to JSON',
|
|
263
|
-
command: 'npx @claude-flow/cli memory export --output memory-backup.json',
|
|
264
|
-
},
|
|
265
|
-
],
|
|
266
|
-
scripts: [
|
|
267
|
-
{
|
|
268
|
-
name: 'memory-backup',
|
|
269
|
-
path: '.agents/scripts/memory-backup.sh',
|
|
270
|
-
description: 'Backup memory to external storage',
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
name: 'memory-consolidate',
|
|
274
|
-
path: '.agents/scripts/memory-consolidate.sh',
|
|
275
|
-
description: 'Consolidate and optimize memory',
|
|
276
|
-
},
|
|
277
|
-
],
|
|
278
|
-
references: [
|
|
279
|
-
{
|
|
280
|
-
name: 'HNSW Guide',
|
|
281
|
-
path: 'docs/hnsw.md',
|
|
282
|
-
description: 'HNSW vector search configuration',
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
name: 'Memory Schema',
|
|
286
|
-
path: 'docs/memory-schema.md',
|
|
287
|
-
description: 'Memory namespace and schema reference',
|
|
288
|
-
},
|
|
289
|
-
],
|
|
290
|
-
},
|
|
291
|
-
'sparc-methodology': {
|
|
292
|
-
name: 'sparc-methodology',
|
|
293
|
-
description: 'SPARC development workflow: Specification, Pseudocode, Architecture, Refinement, Completion. A structured approach for complex implementations that ensures thorough planning before coding.',
|
|
294
|
-
triggers: [
|
|
295
|
-
'new feature implementation',
|
|
296
|
-
'complex implementations',
|
|
297
|
-
'architectural changes',
|
|
298
|
-
'system redesign',
|
|
299
|
-
'integration work',
|
|
300
|
-
'unclear requirements',
|
|
301
|
-
],
|
|
302
|
-
skipWhen: [
|
|
303
|
-
'simple bug fixes',
|
|
304
|
-
'documentation updates',
|
|
305
|
-
'configuration changes',
|
|
306
|
-
'well-defined small tasks',
|
|
307
|
-
'routine maintenance',
|
|
308
|
-
],
|
|
309
|
-
commands: [
|
|
310
|
-
{
|
|
311
|
-
name: 'Specification Phase',
|
|
312
|
-
description: 'Define requirements, acceptance criteria, and constraints',
|
|
313
|
-
command: 'npx @claude-flow/cli hooks route --task "specification: [requirements]"',
|
|
314
|
-
example: 'npx @claude-flow/cli hooks route --task "specification: user authentication with OAuth2, MFA, and session management"',
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
name: 'Pseudocode Phase',
|
|
318
|
-
description: 'Write high-level pseudocode for the implementation',
|
|
319
|
-
command: 'npx @claude-flow/cli hooks route --task "pseudocode: [feature]"',
|
|
320
|
-
example: 'npx @claude-flow/cli hooks route --task "pseudocode: OAuth2 login flow with token refresh"',
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
name: 'Architecture Phase',
|
|
324
|
-
description: 'Design system structure, interfaces, and dependencies',
|
|
325
|
-
command: 'npx @claude-flow/cli hooks route --task "architecture: [design]"',
|
|
326
|
-
example: 'npx @claude-flow/cli hooks route --task "architecture: auth module with service layer, repository, and API endpoints"',
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
name: 'Refinement Phase',
|
|
330
|
-
description: 'Iterate on the design based on feedback',
|
|
331
|
-
command: 'npx @claude-flow/cli hooks route --task "refinement: [feedback]"',
|
|
332
|
-
example: 'npx @claude-flow/cli hooks route --task "refinement: add rate limiting and brute force protection"',
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
name: 'Completion Phase',
|
|
336
|
-
description: 'Finalize implementation with tests and documentation',
|
|
337
|
-
command: 'npx @claude-flow/cli hooks route --task "completion: [final checks]"',
|
|
338
|
-
example: 'npx @claude-flow/cli hooks route --task "completion: verify all tests pass, update API docs, security review"',
|
|
339
|
-
},
|
|
340
|
-
{
|
|
341
|
-
name: 'SPARC Coordinator',
|
|
342
|
-
description: 'Spawn SPARC coordinator agent',
|
|
343
|
-
command: 'npx @claude-flow/cli agent spawn --type sparc-coord --name sparc-lead',
|
|
344
|
-
},
|
|
345
|
-
],
|
|
346
|
-
scripts: [
|
|
347
|
-
{
|
|
348
|
-
name: 'sparc-init',
|
|
349
|
-
path: '.agents/scripts/sparc-init.sh',
|
|
350
|
-
description: 'Initialize SPARC workflow for a new feature',
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
name: 'sparc-review',
|
|
354
|
-
path: '.agents/scripts/sparc-review.sh',
|
|
355
|
-
description: 'Run SPARC phase review checklist',
|
|
356
|
-
},
|
|
357
|
-
],
|
|
358
|
-
references: [
|
|
359
|
-
{
|
|
360
|
-
name: 'SPARC Overview',
|
|
361
|
-
path: 'docs/sparc.md',
|
|
362
|
-
description: 'Complete SPARC methodology guide',
|
|
363
|
-
},
|
|
364
|
-
{
|
|
365
|
-
name: 'Phase Templates',
|
|
366
|
-
path: 'docs/sparc-templates.md',
|
|
367
|
-
description: 'Templates for each SPARC phase',
|
|
368
|
-
},
|
|
369
|
-
],
|
|
370
|
-
},
|
|
371
|
-
'security-audit': {
|
|
372
|
-
name: 'security-audit',
|
|
373
|
-
description: 'Comprehensive security scanning and vulnerability detection. Includes input validation, path traversal prevention, CVE detection, and secure coding pattern enforcement.',
|
|
374
|
-
triggers: [
|
|
375
|
-
'authentication implementation',
|
|
376
|
-
'authorization logic',
|
|
377
|
-
'payment processing',
|
|
378
|
-
'user data handling',
|
|
379
|
-
'API endpoint creation',
|
|
380
|
-
'file upload handling',
|
|
381
|
-
'database queries',
|
|
382
|
-
'external API integration',
|
|
383
|
-
],
|
|
384
|
-
skipWhen: [
|
|
385
|
-
'read-only operations on public data',
|
|
386
|
-
'internal development tooling',
|
|
387
|
-
'static documentation',
|
|
388
|
-
'styling changes',
|
|
389
|
-
],
|
|
390
|
-
commands: [
|
|
391
|
-
{
|
|
392
|
-
name: 'Full Security Scan',
|
|
393
|
-
description: 'Run comprehensive security analysis on the codebase',
|
|
394
|
-
command: 'npx @claude-flow/cli security scan --depth full',
|
|
395
|
-
example: 'npx @claude-flow/cli security scan --depth full --output security-report.json',
|
|
396
|
-
},
|
|
397
|
-
{
|
|
398
|
-
name: 'Input Validation Check',
|
|
399
|
-
description: 'Check for input validation issues',
|
|
400
|
-
command: 'npx @claude-flow/cli security scan --check input-validation',
|
|
401
|
-
example: 'npx @claude-flow/cli security scan --check input-validation --path ./src/api',
|
|
402
|
-
},
|
|
403
|
-
{
|
|
404
|
-
name: 'Path Traversal Check',
|
|
405
|
-
description: 'Check for path traversal vulnerabilities',
|
|
406
|
-
command: 'npx @claude-flow/cli security scan --check path-traversal',
|
|
407
|
-
},
|
|
408
|
-
{
|
|
409
|
-
name: 'SQL Injection Check',
|
|
410
|
-
description: 'Check for SQL injection vulnerabilities',
|
|
411
|
-
command: 'npx @claude-flow/cli security scan --check sql-injection',
|
|
412
|
-
},
|
|
413
|
-
{
|
|
414
|
-
name: 'XSS Check',
|
|
415
|
-
description: 'Check for cross-site scripting vulnerabilities',
|
|
416
|
-
command: 'npx @claude-flow/cli security scan --check xss',
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
name: 'CVE Scan',
|
|
420
|
-
description: 'Scan dependencies for known CVEs',
|
|
421
|
-
command: 'npx @claude-flow/cli security cve --scan',
|
|
422
|
-
example: 'npx @claude-flow/cli security cve --scan --severity high',
|
|
423
|
-
},
|
|
424
|
-
{
|
|
425
|
-
name: 'Security Audit Report',
|
|
426
|
-
description: 'Generate full security audit report',
|
|
427
|
-
command: 'npx @claude-flow/cli security audit --report',
|
|
428
|
-
example: 'npx @claude-flow/cli security audit --report --format markdown --output SECURITY.md',
|
|
429
|
-
},
|
|
430
|
-
{
|
|
431
|
-
name: 'Threat Modeling',
|
|
432
|
-
description: 'Run threat modeling analysis',
|
|
433
|
-
command: 'npx @claude-flow/cli security threats --analyze',
|
|
434
|
-
},
|
|
435
|
-
{
|
|
436
|
-
name: 'Validate Secrets',
|
|
437
|
-
description: 'Check for hardcoded secrets',
|
|
438
|
-
command: 'npx @claude-flow/cli security validate --check secrets',
|
|
439
|
-
},
|
|
440
|
-
],
|
|
441
|
-
scripts: [
|
|
442
|
-
{
|
|
443
|
-
name: 'security-scan',
|
|
444
|
-
path: '.agents/scripts/security-scan.sh',
|
|
445
|
-
description: 'Run full security scan pipeline',
|
|
446
|
-
},
|
|
447
|
-
{
|
|
448
|
-
name: 'cve-remediate',
|
|
449
|
-
path: '.agents/scripts/cve-remediate.sh',
|
|
450
|
-
description: 'Auto-remediate known CVEs',
|
|
451
|
-
},
|
|
452
|
-
],
|
|
453
|
-
references: [
|
|
454
|
-
{
|
|
455
|
-
name: 'Security Checklist',
|
|
456
|
-
path: 'docs/security-checklist.md',
|
|
457
|
-
description: 'Security review checklist',
|
|
458
|
-
},
|
|
459
|
-
{
|
|
460
|
-
name: 'OWASP Guide',
|
|
461
|
-
path: 'docs/owasp-top10.md',
|
|
462
|
-
description: 'OWASP Top 10 mitigation guide',
|
|
463
|
-
},
|
|
464
|
-
],
|
|
465
|
-
},
|
|
466
|
-
'performance-analysis': {
|
|
467
|
-
name: 'performance-analysis',
|
|
468
|
-
description: 'Performance profiling, benchmarking, and optimization. Includes CPU profiling, memory analysis, latency measurement, and automated optimization suggestions.',
|
|
469
|
-
triggers: [
|
|
470
|
-
'slow operations detected',
|
|
471
|
-
'memory usage issues',
|
|
472
|
-
'optimization needed',
|
|
473
|
-
'pre-release performance validation',
|
|
474
|
-
'database query optimization',
|
|
475
|
-
'API latency concerns',
|
|
476
|
-
'bundle size analysis',
|
|
477
|
-
],
|
|
478
|
-
skipWhen: [
|
|
479
|
-
'early feature development',
|
|
480
|
-
'documentation updates',
|
|
481
|
-
'prototyping phase',
|
|
482
|
-
'configuration changes',
|
|
483
|
-
],
|
|
484
|
-
commands: [
|
|
485
|
-
{
|
|
486
|
-
name: 'Run Benchmark Suite',
|
|
487
|
-
description: 'Execute all performance benchmarks',
|
|
488
|
-
command: 'npx @claude-flow/cli performance benchmark --suite all',
|
|
489
|
-
example: 'npx @claude-flow/cli performance benchmark --suite all --iterations 100 --output bench-results.json',
|
|
490
|
-
},
|
|
491
|
-
{
|
|
492
|
-
name: 'Profile Code',
|
|
493
|
-
description: 'Profile code execution for CPU and memory',
|
|
494
|
-
command: 'npx @claude-flow/cli performance profile --target ./src',
|
|
495
|
-
example: 'npx @claude-flow/cli performance profile --target ./src/api --duration 60s',
|
|
496
|
-
},
|
|
497
|
-
{
|
|
498
|
-
name: 'Memory Analysis',
|
|
499
|
-
description: 'Analyze memory usage patterns',
|
|
500
|
-
command: 'npx @claude-flow/cli performance metrics --metric memory',
|
|
501
|
-
example: 'npx @claude-flow/cli performance metrics --metric memory --threshold 100MB',
|
|
502
|
-
},
|
|
503
|
-
{
|
|
504
|
-
name: 'Latency Analysis',
|
|
505
|
-
description: 'Measure and analyze latency',
|
|
506
|
-
command: 'npx @claude-flow/cli performance metrics --metric latency',
|
|
507
|
-
},
|
|
508
|
-
{
|
|
509
|
-
name: 'Optimize Suggestions',
|
|
510
|
-
description: 'Get automated optimization suggestions',
|
|
511
|
-
command: 'npx @claude-flow/cli performance optimize --analyze',
|
|
512
|
-
example: 'npx @claude-flow/cli performance optimize --analyze --apply-safe',
|
|
513
|
-
},
|
|
514
|
-
{
|
|
515
|
-
name: 'Performance Report',
|
|
516
|
-
description: 'Generate performance report',
|
|
517
|
-
command: 'npx @claude-flow/cli performance report',
|
|
518
|
-
example: 'npx @claude-flow/cli performance report --format html --output perf-report.html',
|
|
519
|
-
},
|
|
520
|
-
{
|
|
521
|
-
name: 'Compare Benchmarks',
|
|
522
|
-
description: 'Compare benchmark results',
|
|
523
|
-
command: 'npx @claude-flow/cli performance benchmark --compare baseline.json current.json',
|
|
524
|
-
},
|
|
525
|
-
{
|
|
526
|
-
name: 'WASM Benchmark',
|
|
527
|
-
description: 'Run WASM-specific benchmarks',
|
|
528
|
-
command: 'npx @claude-flow/cli performance benchmark --suite wasm',
|
|
529
|
-
},
|
|
530
|
-
],
|
|
531
|
-
scripts: [
|
|
532
|
-
{
|
|
533
|
-
name: 'perf-baseline',
|
|
534
|
-
path: '.agents/scripts/perf-baseline.sh',
|
|
535
|
-
description: 'Capture performance baseline',
|
|
536
|
-
},
|
|
537
|
-
{
|
|
538
|
-
name: 'perf-regression',
|
|
539
|
-
path: '.agents/scripts/perf-regression.sh',
|
|
540
|
-
description: 'Check for performance regressions',
|
|
541
|
-
},
|
|
542
|
-
],
|
|
543
|
-
references: [
|
|
544
|
-
{
|
|
545
|
-
name: 'Performance Guide',
|
|
546
|
-
path: 'docs/performance.md',
|
|
547
|
-
description: 'Performance optimization guide',
|
|
548
|
-
},
|
|
549
|
-
{
|
|
550
|
-
name: 'Benchmark Reference',
|
|
551
|
-
path: 'docs/benchmarks.md',
|
|
552
|
-
description: 'Benchmark configuration reference',
|
|
553
|
-
},
|
|
554
|
-
],
|
|
555
|
-
},
|
|
556
|
-
'github-automation': {
|
|
557
|
-
name: 'github-automation',
|
|
558
|
-
description: 'GitHub workflow automation including PR management, CI/CD, issue tracking, and release management. Integrates with GitHub CLI for seamless automation.',
|
|
559
|
-
triggers: [
|
|
560
|
-
'creating pull requests',
|
|
561
|
-
'setting up CI/CD pipelines',
|
|
562
|
-
'release management',
|
|
563
|
-
'issue tracking automation',
|
|
564
|
-
'branch management',
|
|
565
|
-
'code review workflows',
|
|
566
|
-
'repository maintenance',
|
|
567
|
-
],
|
|
568
|
-
skipWhen: [
|
|
569
|
-
'local-only development',
|
|
570
|
-
'prototyping without commits',
|
|
571
|
-
'non-GitHub repositories',
|
|
572
|
-
'offline work',
|
|
573
|
-
],
|
|
574
|
-
commands: [
|
|
575
|
-
{
|
|
576
|
-
name: 'Create Pull Request',
|
|
577
|
-
description: 'Create a new pull request with summary',
|
|
578
|
-
command: 'gh pr create --title "[title]" --body "[description]"',
|
|
579
|
-
example: 'gh pr create --title "feat: add OAuth2 authentication" --body "## Summary\\n- Implemented OAuth2 flow\\n- Added token refresh\\n\\n## Test Plan\\n- Run auth tests"',
|
|
580
|
-
},
|
|
581
|
-
{
|
|
582
|
-
name: 'View PR',
|
|
583
|
-
description: 'View pull request details',
|
|
584
|
-
command: 'gh pr view [number]',
|
|
585
|
-
example: 'gh pr view 123 --comments',
|
|
586
|
-
},
|
|
587
|
-
{
|
|
588
|
-
name: 'Merge PR',
|
|
589
|
-
description: 'Merge a pull request',
|
|
590
|
-
command: 'gh pr merge [number] --squash',
|
|
591
|
-
example: 'gh pr merge 123 --squash --delete-branch',
|
|
592
|
-
},
|
|
593
|
-
{
|
|
594
|
-
name: 'Run Workflow',
|
|
595
|
-
description: 'Trigger a GitHub Actions workflow',
|
|
596
|
-
command: 'gh workflow run [workflow]',
|
|
597
|
-
example: 'gh workflow run ci.yml --ref feature-branch',
|
|
598
|
-
},
|
|
599
|
-
{
|
|
600
|
-
name: 'View Workflow Runs',
|
|
601
|
-
description: 'List recent workflow runs',
|
|
602
|
-
command: 'gh run list --limit 10',
|
|
603
|
-
},
|
|
604
|
-
{
|
|
605
|
-
name: 'Create Issue',
|
|
606
|
-
description: 'Create a new issue',
|
|
607
|
-
command: 'gh issue create --title "[title]" --body "[body]"',
|
|
608
|
-
example: 'gh issue create --title "Bug: login fails on mobile" --body "## Description\\n..." --label bug',
|
|
609
|
-
},
|
|
610
|
-
{
|
|
611
|
-
name: 'Create Release',
|
|
612
|
-
description: 'Create a new release',
|
|
613
|
-
command: 'gh release create [tag] --notes "[notes]"',
|
|
614
|
-
example: 'gh release create v1.0.0 --notes "Initial release" --generate-notes',
|
|
615
|
-
},
|
|
616
|
-
{
|
|
617
|
-
name: 'View Checks',
|
|
618
|
-
description: 'View PR check status',
|
|
619
|
-
command: 'gh pr checks [number]',
|
|
620
|
-
example: 'gh pr checks 123 --watch',
|
|
621
|
-
},
|
|
622
|
-
{
|
|
623
|
-
name: 'Review PR',
|
|
624
|
-
description: 'Submit a PR review',
|
|
625
|
-
command: 'gh pr review [number] --approve --body "[comment]"',
|
|
626
|
-
example: 'gh pr review 123 --approve --body "LGTM! Great work on the tests."',
|
|
627
|
-
},
|
|
628
|
-
],
|
|
629
|
-
scripts: [
|
|
630
|
-
{
|
|
631
|
-
name: 'pr-template',
|
|
632
|
-
path: '.agents/scripts/pr-template.sh',
|
|
633
|
-
description: 'Generate PR from template',
|
|
634
|
-
},
|
|
635
|
-
{
|
|
636
|
-
name: 'release-prep',
|
|
637
|
-
path: '.agents/scripts/release-prep.sh',
|
|
638
|
-
description: 'Prepare release with changelog',
|
|
639
|
-
},
|
|
640
|
-
],
|
|
641
|
-
references: [
|
|
642
|
-
{
|
|
643
|
-
name: 'GitHub CLI Reference',
|
|
644
|
-
path: 'docs/gh-cli.md',
|
|
645
|
-
description: 'GitHub CLI command reference',
|
|
646
|
-
},
|
|
647
|
-
{
|
|
648
|
-
name: 'PR Guidelines',
|
|
649
|
-
path: 'docs/pr-guidelines.md',
|
|
650
|
-
description: 'Pull request best practices',
|
|
651
|
-
},
|
|
652
|
-
{
|
|
653
|
-
name: 'CI/CD Setup',
|
|
654
|
-
path: 'docs/ci-cd.md',
|
|
655
|
-
description: 'CI/CD pipeline configuration',
|
|
656
|
-
},
|
|
657
|
-
],
|
|
658
|
-
},
|
|
659
|
-
};
|
|
660
|
-
const template = skillTemplates[skillName];
|
|
661
|
-
if (!template) {
|
|
145
|
+
if (!BUILT_IN_SKILL_NAMES.includes(skillName)) {
|
|
662
146
|
throw new Error(`Unknown built-in skill: ${skillName}`);
|
|
663
147
|
}
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
148
|
+
const skillRoot = path.join(BUILT_IN_SKILLS_ROOT, skillName);
|
|
149
|
+
let skillMd;
|
|
150
|
+
try {
|
|
151
|
+
skillMd = await readFile(path.join(skillRoot, 'SKILL.md'), 'utf8');
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
if (error.code === 'ENOENT') {
|
|
155
|
+
throw new Error(`Built-in skill payload missing: ${skillName}/SKILL.md`);
|
|
672
156
|
}
|
|
157
|
+
throw error;
|
|
673
158
|
}
|
|
674
|
-
|
|
159
|
+
const result = {
|
|
675
160
|
skillMd,
|
|
676
|
-
scripts,
|
|
677
|
-
references:
|
|
161
|
+
scripts: await readPayloadTree(path.join(skillRoot, 'scripts')),
|
|
162
|
+
references: await readPayloadTree(path.join(skillRoot, 'references')),
|
|
678
163
|
};
|
|
164
|
+
validateBuiltInSkillPayload(skillName, result.skillMd, result.scripts, result.references);
|
|
165
|
+
return result;
|
|
679
166
|
}
|
|
680
167
|
/**
|
|
681
|
-
*
|
|
168
|
+
* Ensure every skill-local path is contained in and shipped with its tree.
|
|
682
169
|
*/
|
|
683
|
-
function
|
|
684
|
-
const
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
echo "Swarm initialized successfully"
|
|
699
|
-
npx @claude-flow/cli swarm status
|
|
700
|
-
`,
|
|
701
|
-
'swarm-monitor': `#!/bin/bash
|
|
702
|
-
# Swarm Orchestration - Monitor Script
|
|
703
|
-
# Real-time swarm monitoring
|
|
704
|
-
|
|
705
|
-
set -e
|
|
706
|
-
|
|
707
|
-
echo "Starting swarm monitor..."
|
|
708
|
-
npx @claude-flow/cli swarm status --watch --interval 5
|
|
709
|
-
`,
|
|
710
|
-
},
|
|
711
|
-
'memory-management': {
|
|
712
|
-
'memory-backup': `#!/bin/bash
|
|
713
|
-
# Memory Management - Backup Script
|
|
714
|
-
# Export memory to backup file
|
|
715
|
-
|
|
716
|
-
set -e
|
|
717
|
-
|
|
718
|
-
BACKUP_DIR="\${BACKUP_DIR:-./.backups}"
|
|
719
|
-
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
|
720
|
-
BACKUP_FILE="\${BACKUP_DIR}/memory_\${TIMESTAMP}.json"
|
|
721
|
-
|
|
722
|
-
mkdir -p "$BACKUP_DIR"
|
|
723
|
-
|
|
724
|
-
echo "Backing up memory to $BACKUP_FILE..."
|
|
725
|
-
npx @claude-flow/cli memory export --output "$BACKUP_FILE"
|
|
726
|
-
|
|
727
|
-
echo "Backup complete: $BACKUP_FILE"
|
|
728
|
-
`,
|
|
729
|
-
'memory-consolidate': `#!/bin/bash
|
|
730
|
-
# Memory Management - Consolidate Script
|
|
731
|
-
# Optimize and consolidate memory
|
|
732
|
-
|
|
733
|
-
set -e
|
|
734
|
-
|
|
735
|
-
echo "Running memory consolidation..."
|
|
736
|
-
npx @claude-flow/cli hooks worker dispatch --trigger consolidate
|
|
737
|
-
|
|
738
|
-
echo "Memory consolidation complete"
|
|
739
|
-
npx @claude-flow/cli memory stats
|
|
740
|
-
`,
|
|
741
|
-
},
|
|
742
|
-
'sparc-methodology': {
|
|
743
|
-
'sparc-init': `#!/bin/bash
|
|
744
|
-
# SPARC Methodology - Init Script
|
|
745
|
-
# Initialize SPARC workflow for a new feature
|
|
746
|
-
|
|
747
|
-
set -e
|
|
748
|
-
|
|
749
|
-
FEATURE_NAME="\${1:-new-feature}"
|
|
750
|
-
|
|
751
|
-
echo "Initializing SPARC workflow for: $FEATURE_NAME"
|
|
752
|
-
|
|
753
|
-
# Create SPARC documentation directory
|
|
754
|
-
mkdir -p "./docs/sparc/$FEATURE_NAME"
|
|
755
|
-
|
|
756
|
-
# Create phase files
|
|
757
|
-
touch "./docs/sparc/$FEATURE_NAME/1-specification.md"
|
|
758
|
-
touch "./docs/sparc/$FEATURE_NAME/2-pseudocode.md"
|
|
759
|
-
touch "./docs/sparc/$FEATURE_NAME/3-architecture.md"
|
|
760
|
-
touch "./docs/sparc/$FEATURE_NAME/4-refinement.md"
|
|
761
|
-
touch "./docs/sparc/$FEATURE_NAME/5-completion.md"
|
|
762
|
-
|
|
763
|
-
echo "SPARC workflow initialized in ./docs/sparc/$FEATURE_NAME"
|
|
764
|
-
`,
|
|
765
|
-
'sparc-review': `#!/bin/bash
|
|
766
|
-
# SPARC Methodology - Review Script
|
|
767
|
-
# Run SPARC phase review checklist
|
|
768
|
-
|
|
769
|
-
set -e
|
|
770
|
-
|
|
771
|
-
FEATURE_DIR="\${1:-.}"
|
|
772
|
-
|
|
773
|
-
echo "SPARC Phase Review Checklist"
|
|
774
|
-
echo "============================="
|
|
775
|
-
|
|
776
|
-
for phase in specification pseudocode architecture refinement completion; do
|
|
777
|
-
if [ -f "$FEATURE_DIR/\${phase}.md" ]; then
|
|
778
|
-
echo "[x] $phase - found"
|
|
779
|
-
else
|
|
780
|
-
echo "[ ] $phase - missing"
|
|
781
|
-
fi
|
|
782
|
-
done
|
|
783
|
-
`,
|
|
784
|
-
},
|
|
785
|
-
'security-audit': {
|
|
786
|
-
'security-scan': `#!/bin/bash
|
|
787
|
-
# Security Audit - Full Scan Script
|
|
788
|
-
# Run comprehensive security scan pipeline
|
|
789
|
-
|
|
790
|
-
set -e
|
|
791
|
-
|
|
792
|
-
echo "Running full security scan..."
|
|
793
|
-
|
|
794
|
-
# Input validation
|
|
795
|
-
echo "Checking input validation..."
|
|
796
|
-
npx @claude-flow/cli security scan --check input-validation
|
|
797
|
-
|
|
798
|
-
# Path traversal
|
|
799
|
-
echo "Checking path traversal..."
|
|
800
|
-
npx @claude-flow/cli security scan --check path-traversal
|
|
801
|
-
|
|
802
|
-
# SQL injection
|
|
803
|
-
echo "Checking SQL injection..."
|
|
804
|
-
npx @claude-flow/cli security scan --check sql-injection
|
|
805
|
-
|
|
806
|
-
# XSS
|
|
807
|
-
echo "Checking XSS..."
|
|
808
|
-
npx @claude-flow/cli security scan --check xss
|
|
809
|
-
|
|
810
|
-
# Secrets
|
|
811
|
-
echo "Checking for hardcoded secrets..."
|
|
812
|
-
npx @claude-flow/cli security validate --check secrets
|
|
813
|
-
|
|
814
|
-
# CVE scan
|
|
815
|
-
echo "Scanning dependencies for CVEs..."
|
|
816
|
-
npx @claude-flow/cli security cve --scan
|
|
817
|
-
|
|
818
|
-
echo "Security scan complete"
|
|
819
|
-
`,
|
|
820
|
-
'cve-remediate': `#!/bin/bash
|
|
821
|
-
# Security Audit - CVE Remediation Script
|
|
822
|
-
# Auto-remediate known CVEs
|
|
823
|
-
|
|
824
|
-
set -e
|
|
825
|
-
|
|
826
|
-
echo "Scanning for CVEs..."
|
|
827
|
-
npx @claude-flow/cli security cve --scan --severity high
|
|
828
|
-
|
|
829
|
-
echo "Attempting auto-remediation..."
|
|
830
|
-
npm audit fix
|
|
831
|
-
|
|
832
|
-
echo "Re-scanning after remediation..."
|
|
833
|
-
npx @claude-flow/cli security cve --scan
|
|
834
|
-
|
|
835
|
-
echo "CVE remediation complete"
|
|
836
|
-
`,
|
|
837
|
-
},
|
|
838
|
-
'performance-analysis': {
|
|
839
|
-
'perf-baseline': `#!/bin/bash
|
|
840
|
-
# Performance Analysis - Baseline Script
|
|
841
|
-
# Capture performance baseline
|
|
842
|
-
|
|
843
|
-
set -e
|
|
844
|
-
|
|
845
|
-
BASELINE_FILE="\${1:-baseline.json}"
|
|
846
|
-
|
|
847
|
-
echo "Capturing performance baseline..."
|
|
848
|
-
npx @claude-flow/cli performance benchmark \\
|
|
849
|
-
--suite all \\
|
|
850
|
-
--iterations 100 \\
|
|
851
|
-
--output "$BASELINE_FILE"
|
|
852
|
-
|
|
853
|
-
echo "Baseline saved to $BASELINE_FILE"
|
|
854
|
-
`,
|
|
855
|
-
'perf-regression': `#!/bin/bash
|
|
856
|
-
# Performance Analysis - Regression Check Script
|
|
857
|
-
# Check for performance regressions
|
|
858
|
-
|
|
859
|
-
set -e
|
|
860
|
-
|
|
861
|
-
BASELINE_FILE="\${1:-baseline.json}"
|
|
862
|
-
CURRENT_FILE="current.json"
|
|
863
|
-
THRESHOLD="\${2:-10}"
|
|
864
|
-
|
|
865
|
-
echo "Running current benchmarks..."
|
|
866
|
-
npx @claude-flow/cli performance benchmark \\
|
|
867
|
-
--suite all \\
|
|
868
|
-
--iterations 100 \\
|
|
869
|
-
--output "$CURRENT_FILE"
|
|
870
|
-
|
|
871
|
-
echo "Comparing against baseline..."
|
|
872
|
-
npx @claude-flow/cli performance benchmark \\
|
|
873
|
-
--compare "$BASELINE_FILE" "$CURRENT_FILE" \\
|
|
874
|
-
--threshold "$THRESHOLD"
|
|
875
|
-
|
|
876
|
-
rm "$CURRENT_FILE"
|
|
877
|
-
`,
|
|
878
|
-
},
|
|
879
|
-
'github-automation': {
|
|
880
|
-
'pr-template': `#!/bin/bash
|
|
881
|
-
# GitHub Automation - PR Template Script
|
|
882
|
-
# Generate PR from template
|
|
883
|
-
|
|
884
|
-
set -e
|
|
885
|
-
|
|
886
|
-
TITLE="\${1:-Update}"
|
|
887
|
-
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
888
|
-
|
|
889
|
-
echo "Creating PR for branch: $BRANCH"
|
|
890
|
-
|
|
891
|
-
gh pr create \\
|
|
892
|
-
--title "$TITLE" \\
|
|
893
|
-
--body "$(cat <<EOF
|
|
894
|
-
## Summary
|
|
895
|
-
<!-- Describe your changes -->
|
|
896
|
-
|
|
897
|
-
## Test Plan
|
|
898
|
-
- [ ] Unit tests pass
|
|
899
|
-
- [ ] Integration tests pass
|
|
900
|
-
- [ ] Manual testing completed
|
|
901
|
-
|
|
902
|
-
## Checklist
|
|
903
|
-
- [ ] Code follows style guidelines
|
|
904
|
-
- [ ] Documentation updated
|
|
905
|
-
- [ ] No breaking changes
|
|
906
|
-
|
|
907
|
-
Generated with claude-flow
|
|
908
|
-
EOF
|
|
909
|
-
)"
|
|
910
|
-
|
|
911
|
-
echo "PR created successfully"
|
|
912
|
-
`,
|
|
913
|
-
'release-prep': `#!/bin/bash
|
|
914
|
-
# GitHub Automation - Release Prep Script
|
|
915
|
-
# Prepare release with changelog
|
|
916
|
-
|
|
917
|
-
set -e
|
|
918
|
-
|
|
919
|
-
VERSION="\${1:-patch}"
|
|
920
|
-
|
|
921
|
-
echo "Preparing release..."
|
|
922
|
-
|
|
923
|
-
# Bump version
|
|
924
|
-
npm version "$VERSION" --no-git-tag-version
|
|
925
|
-
|
|
926
|
-
NEW_VERSION=$(node -p "require('./package.json').version")
|
|
927
|
-
|
|
928
|
-
echo "Creating release v$NEW_VERSION..."
|
|
929
|
-
gh release create "v$NEW_VERSION" \\
|
|
930
|
-
--generate-notes \\
|
|
931
|
-
--draft
|
|
932
|
-
|
|
933
|
-
echo "Draft release v$NEW_VERSION created"
|
|
934
|
-
`,
|
|
935
|
-
},
|
|
936
|
-
};
|
|
937
|
-
const skillScripts = scripts[skillName];
|
|
938
|
-
if (skillScripts && skillScripts[scriptName]) {
|
|
939
|
-
return skillScripts[scriptName];
|
|
170
|
+
export function validateBuiltInSkillPayload(skillName, skillMd, scripts, references) {
|
|
171
|
+
const localPaths = Array.from(skillMd.matchAll(/`((?:scripts|references)\/[^`\s]+)`/g), (match) => match[1]);
|
|
172
|
+
for (const localPath of localPaths) {
|
|
173
|
+
const normalized = path.posix.normalize(localPath.replaceAll('\\', '/'));
|
|
174
|
+
if (normalized.startsWith('../') || path.posix.isAbsolute(normalized)) {
|
|
175
|
+
throw new Error(`Built-in skill path escapes ${skillName}: ${localPath}`);
|
|
176
|
+
}
|
|
177
|
+
const slash = normalized.indexOf('/');
|
|
178
|
+
const directory = normalized.slice(0, slash);
|
|
179
|
+
const payloadPath = normalized.slice(slash + 1);
|
|
180
|
+
const payload = directory === 'scripts' ? scripts : references;
|
|
181
|
+
if (!Object.hasOwn(payload, payloadPath)) {
|
|
182
|
+
throw new Error(`Built-in skill payload missing: ${skillName}/${normalized}`);
|
|
183
|
+
}
|
|
940
184
|
}
|
|
941
|
-
return `#!/bin/bash
|
|
942
|
-
# ${skillName} - ${scriptName}
|
|
943
|
-
# Generated by @claude-flow/codex
|
|
944
|
-
|
|
945
|
-
set -e
|
|
946
|
-
|
|
947
|
-
echo "Running ${scriptName}..."
|
|
948
|
-
# Add your script logic here
|
|
949
|
-
`;
|
|
950
185
|
}
|
|
951
186
|
//# sourceMappingURL=skill-md.js.map
|