claude-flow-novice 2.3.7 ā 2.3.8
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/package.json +1 -1
- package/scripts/categorize-agents.js +255 -0
package/package.json
CHANGED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Categorize imported agents into subdirectories
|
|
5
|
+
* Analyzes YAML frontmatter and filenames to determine appropriate category
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
const AGENTS_DIR = path.join(__dirname, '../agents');
|
|
12
|
+
|
|
13
|
+
// Category definitions with keyword patterns
|
|
14
|
+
const CATEGORIES = {
|
|
15
|
+
'development-engineering': {
|
|
16
|
+
keywords: ['backend', 'frontend', 'api', 'rest', 'graphql', 'react', 'angular', 'vue', 'typescript',
|
|
17
|
+
'javascript', 'python', 'java', 'rust', 'go', 'node', 'developer', 'engineer', 'code',
|
|
18
|
+
'programming', 'devops', 'kubernetes', 'docker', 'ci/cd', 'mobile', 'ios', 'android',
|
|
19
|
+
'web', 'fullstack', 'microservices', 'architecture-analyst', 'database', 'sql', 'nosql',
|
|
20
|
+
'git', 'version-control', 'deployment', 'container', 'orchestration', 'testing-specialist',
|
|
21
|
+
'acceptance-test', 'integration', 'unit-test', 'qa', 'quality-assurance', 'debugging'],
|
|
22
|
+
description: 'Backend, frontend, mobile, DevOps, API development, testing'
|
|
23
|
+
},
|
|
24
|
+
'ai-ml-automation': {
|
|
25
|
+
keywords: ['machine-learning', 'deep-learning', 'neural', 'tensorflow', 'pytorch', 'ai', 'ml',
|
|
26
|
+
'model', 'training', 'inference', 'nlp', 'computer-vision', 'data-science', 'mlops',
|
|
27
|
+
'automation', 'intelligent', 'prediction-engine', 'anomaly-detection', 'algorithm',
|
|
28
|
+
'optimization', 'reinforcement-learning', 'supervised', 'unsupervised'],
|
|
29
|
+
description: 'Machine learning, deep learning, neural networks, MLOps, automation'
|
|
30
|
+
},
|
|
31
|
+
'business-operations': {
|
|
32
|
+
keywords: ['business', 'strategy', 'growth', 'revenue', 'sales', 'marketing', 'customer',
|
|
33
|
+
'operations', 'management', 'planning', 'leadership', 'executive', 'roi', 'kpi',
|
|
34
|
+
'metrics', 'analytics-insights', 'competitive', 'market', 'venture', 'startup',
|
|
35
|
+
'scaling', 'transformation', 'change-management', 'stakeholder', 'organizational'],
|
|
36
|
+
description: 'Business strategy, growth, revenue, customer experience, operations'
|
|
37
|
+
},
|
|
38
|
+
'security-compliance': {
|
|
39
|
+
keywords: ['security', 'cybersecurity', 'compliance', 'audit', 'gdpr', 'privacy', 'threat',
|
|
40
|
+
'vulnerability', 'penetration', 'encryption', 'authentication', 'authorization',
|
|
41
|
+
'zero-trust', 'firewall', 'monitoring', 'incident', 'forensic', 'risk', 'pci',
|
|
42
|
+
'hipaa', 'sox', 'iso', 'regulatory', 'data-privacy', 'infosec'],
|
|
43
|
+
description: 'Cybersecurity, compliance, privacy, threat analysis, auditing'
|
|
44
|
+
},
|
|
45
|
+
'data-analytics': {
|
|
46
|
+
keywords: ['data', 'analytics', 'bi', 'business-intelligence', 'etl', 'elt', 'pipeline',
|
|
47
|
+
'warehouse', 'lake', 'visualization', 'dashboard', 'reporting', 'insights',
|
|
48
|
+
'forecasting', 'time-series', 'statistical', 'metrics', 'kpi-dashboard',
|
|
49
|
+
'real-time-analytics', 'stream-processing', 'batch-processing'],
|
|
50
|
+
description: 'Business intelligence, analytics, ETL, forecasting, data engineering'
|
|
51
|
+
},
|
|
52
|
+
'personal-professional': {
|
|
53
|
+
keywords: ['career', 'personal', 'professional', 'development', 'coaching', 'mentoring',
|
|
54
|
+
'leadership-development', 'emotional-intelligence', 'productivity', 'wellness',
|
|
55
|
+
'work-life', 'communication', 'networking', 'resume', 'interview', 'skill',
|
|
56
|
+
'learning', 'education', 'training', 'mindfulness', 'motivation', 'goal-setting',
|
|
57
|
+
'time-management', 'stress', 'wellness', 'active-listening'],
|
|
58
|
+
description: 'Career, leadership, emotional intelligence, productivity, personal growth'
|
|
59
|
+
},
|
|
60
|
+
'payment-financial': {
|
|
61
|
+
keywords: ['payment', 'stripe', 'paypal', 'square', 'braintree', 'checkout', 'transaction',
|
|
62
|
+
'financial', 'billing', 'invoice', 'subscription', 'bnpl', 'afterpay', 'klarna',
|
|
63
|
+
'affirm', 'gateway', 'merchant', 'pos', 'e-commerce-payment', 'apple-pay', 'google-pay',
|
|
64
|
+
'alipay', 'wechat-pay', 'cryptocurrency', 'blockchain-payment'],
|
|
65
|
+
description: 'Payment gateways, BNPL, financial transactions, billing systems'
|
|
66
|
+
},
|
|
67
|
+
'industry-specific': {
|
|
68
|
+
keywords: ['healthcare', 'medical', 'clinical', 'patient', 'diagnosis', 'telemedicine',
|
|
69
|
+
'finance-sector', 'banking', 'insurance', 'legal', 'law', 'compliance-legal',
|
|
70
|
+
'education', 'e-learning', 'academic', 'retail', 'manufacturing', 'logistics',
|
|
71
|
+
'supply-chain', 'real-estate', 'hospitality', 'tourism', 'energy', 'utilities',
|
|
72
|
+
'telecommunications', 'media', 'entertainment', 'sports', 'gaming'],
|
|
73
|
+
description: 'Healthcare, finance, legal, education, retail, manufacturing, etc.'
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// Files to keep in root
|
|
78
|
+
const META_FILES = ['CLAUDE.md', 'README.md', 'IMPORTED_AGENTS_README.md', 'MIGRATION_SUMMARY.md', '.gitkeep'];
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Extract YAML frontmatter from markdown file
|
|
82
|
+
*/
|
|
83
|
+
function extractFrontmatter(content) {
|
|
84
|
+
const match = content.match(/^---\n([\s\S]*?)\n---/);
|
|
85
|
+
if (!match) return null;
|
|
86
|
+
|
|
87
|
+
const frontmatter = {};
|
|
88
|
+
const lines = match[1].split('\n');
|
|
89
|
+
|
|
90
|
+
for (const line of lines) {
|
|
91
|
+
const colonIndex = line.indexOf(':');
|
|
92
|
+
if (colonIndex === -1) continue;
|
|
93
|
+
|
|
94
|
+
const key = line.substring(0, colonIndex).trim();
|
|
95
|
+
const value = line.substring(colonIndex + 1).trim();
|
|
96
|
+
frontmatter[key] = value;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return frontmatter;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Categorize agent based on name and description
|
|
104
|
+
*/
|
|
105
|
+
function categorizeAgent(filename, content) {
|
|
106
|
+
const frontmatter = extractFrontmatter(content);
|
|
107
|
+
const searchText = (filename + ' ' + (frontmatter?.name || '') + ' ' + (frontmatter?.description || '')).toLowerCase();
|
|
108
|
+
|
|
109
|
+
let bestCategory = null;
|
|
110
|
+
let bestScore = 0;
|
|
111
|
+
|
|
112
|
+
for (const [category, config] of Object.entries(CATEGORIES)) {
|
|
113
|
+
let score = 0;
|
|
114
|
+
for (const keyword of config.keywords) {
|
|
115
|
+
if (searchText.includes(keyword.toLowerCase())) {
|
|
116
|
+
score++;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (score > bestScore) {
|
|
121
|
+
bestScore = score;
|
|
122
|
+
bestCategory = category;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Default to industry-specific if no clear match
|
|
127
|
+
return bestCategory || 'industry-specific';
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Main categorization process
|
|
132
|
+
*/
|
|
133
|
+
async function categorizeAgents() {
|
|
134
|
+
console.log('š Analyzing agent files...\n');
|
|
135
|
+
|
|
136
|
+
// Read all markdown files
|
|
137
|
+
const files = fs.readdirSync(AGENTS_DIR)
|
|
138
|
+
.filter(f => f.endsWith('.md') && !META_FILES.includes(f));
|
|
139
|
+
|
|
140
|
+
console.log(`Found ${files.length} agent files to categorize\n`);
|
|
141
|
+
|
|
142
|
+
// Categorize each file
|
|
143
|
+
const categorization = {};
|
|
144
|
+
for (const category of Object.keys(CATEGORIES)) {
|
|
145
|
+
categorization[category] = [];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
for (const file of files) {
|
|
149
|
+
const filePath = path.join(AGENTS_DIR, file);
|
|
150
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
151
|
+
const category = categorizeAgent(file, content);
|
|
152
|
+
categorization[category].push(file);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Display categorization summary
|
|
156
|
+
console.log('š Categorization Summary:\n');
|
|
157
|
+
for (const [category, files] of Object.entries(categorization)) {
|
|
158
|
+
console.log(`${category}: ${files.length} agents`);
|
|
159
|
+
}
|
|
160
|
+
console.log('');
|
|
161
|
+
|
|
162
|
+
// Create directories and move files
|
|
163
|
+
console.log('š Creating category directories...\n');
|
|
164
|
+
|
|
165
|
+
for (const [category, config] of Object.entries(CATEGORIES)) {
|
|
166
|
+
const categoryDir = path.join(AGENTS_DIR, category);
|
|
167
|
+
|
|
168
|
+
// Create directory
|
|
169
|
+
if (!fs.existsSync(categoryDir)) {
|
|
170
|
+
fs.mkdirSync(categoryDir, { recursive: true });
|
|
171
|
+
console.log(`ā Created ${category}/`);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Move files
|
|
175
|
+
const filesToMove = categorization[category];
|
|
176
|
+
for (const file of filesToMove) {
|
|
177
|
+
const src = path.join(AGENTS_DIR, file);
|
|
178
|
+
const dest = path.join(categoryDir, file);
|
|
179
|
+
fs.renameSync(src, dest);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Create index file
|
|
183
|
+
const indexContent = `# ${category.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ')}
|
|
184
|
+
|
|
185
|
+
**Description:** ${config.description}
|
|
186
|
+
**Agent Count:** ${filesToMove.length}
|
|
187
|
+
|
|
188
|
+
## Available Agents
|
|
189
|
+
|
|
190
|
+
${filesToMove.sort().map(f => `- [${f.replace('.md', '')}](./${f})`).join('\n')}
|
|
191
|
+
`;
|
|
192
|
+
|
|
193
|
+
fs.writeFileSync(path.join(categoryDir, 'INDEX.md'), indexContent);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
console.log('\nā
Categorization complete!\n');
|
|
197
|
+
|
|
198
|
+
// Generate summary report
|
|
199
|
+
const summaryContent = `# Agent Categorization Summary
|
|
200
|
+
|
|
201
|
+
**Total Agents:** ${files.length}
|
|
202
|
+
**Categories:** ${Object.keys(CATEGORIES).length}
|
|
203
|
+
**Generated:** ${new Date().toISOString()}
|
|
204
|
+
|
|
205
|
+
## Category Breakdown
|
|
206
|
+
|
|
207
|
+
${Object.entries(categorization).map(([cat, files]) => {
|
|
208
|
+
const config = CATEGORIES[cat];
|
|
209
|
+
return `### ${cat.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ')} (${files.length} agents)
|
|
210
|
+
|
|
211
|
+
**Description:** ${config.description}
|
|
212
|
+
**Location:** \`agents/${cat}/\`
|
|
213
|
+
|
|
214
|
+
<details>
|
|
215
|
+
<summary>View agents in this category</summary>
|
|
216
|
+
|
|
217
|
+
${files.sort().map(f => `- ${f.replace('.md', '')}`).join('\n')}
|
|
218
|
+
|
|
219
|
+
</details>
|
|
220
|
+
`;
|
|
221
|
+
}).join('\n')}
|
|
222
|
+
|
|
223
|
+
## Quick Navigation
|
|
224
|
+
|
|
225
|
+
${Object.entries(categorization).map(([cat, files]) =>
|
|
226
|
+
`- [${cat}](${cat}/INDEX.md) - ${files.length} agents`
|
|
227
|
+
).join('\n')}
|
|
228
|
+
|
|
229
|
+
## Usage
|
|
230
|
+
|
|
231
|
+
\`\`\`bash
|
|
232
|
+
# List agents in a category
|
|
233
|
+
ls agents/development-engineering/
|
|
234
|
+
|
|
235
|
+
# Find specific agent
|
|
236
|
+
find agents -name "*react*"
|
|
237
|
+
|
|
238
|
+
# Search across all agents
|
|
239
|
+
grep -r "keyword" agents/
|
|
240
|
+
\`\`\`
|
|
241
|
+
`;
|
|
242
|
+
|
|
243
|
+
fs.writeFileSync(path.join(AGENTS_DIR, 'CATEGORIZATION_SUMMARY.md'), summaryContent);
|
|
244
|
+
console.log('š Generated CATEGORIZATION_SUMMARY.md\n');
|
|
245
|
+
|
|
246
|
+
// Final statistics
|
|
247
|
+
console.log('š Final Statistics:\n');
|
|
248
|
+
console.log(`Total agents categorized: ${files.length}`);
|
|
249
|
+
console.log(`Categories created: ${Object.keys(CATEGORIES).length}`);
|
|
250
|
+
console.log(`Meta files preserved: ${META_FILES.filter(f => fs.existsSync(path.join(AGENTS_DIR, f))).length}`);
|
|
251
|
+
console.log('\n⨠Done!\n');
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Run
|
|
255
|
+
categorizeAgents().catch(console.error);
|