@claude-flow/codex 3.0.0-alpha.1

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