shipdeck
Version:
Ship MVPs in 48 hours. Fix bugs in 30 seconds. The command deck for developers who ship.
256 lines (216 loc) ⢠6.81 kB
JavaScript
/**
* Script to generate all remaining agents using the AgentFactory
*/
const AgentFactory = require('./agent-factory');
const fs = require('fs').promises;
const path = require('path');
// Console colors
const colors = {
green: '\x1b[32m',
red: '\x1b[31m',
yellow: '\x1b[33m',
blue: '\x1b[34m',
magenta: '\x1b[35m',
cyan: '\x1b[36m',
reset: '\x1b[0m'
};
function log(message, color = 'reset') {
console.log(`${colors[color]}${message}${colors.reset}`);
}
async function generateAgents() {
log('\nš Agent Factory - Generating Remaining Agents', 'cyan');
log('=' .repeat(50), 'cyan');
const factory = new AgentFactory();
// List all agent specifications
const specs = factory.listAgentSpecs();
log(`\nš Found ${specs.length} agent specifications to generate:`, 'yellow');
// Group by category
const categories = {};
specs.forEach(spec => {
if (!categories[spec.category]) {
categories[spec.category] = [];
}
categories[spec.category].push(spec);
});
// Display by category
Object.entries(categories).forEach(([category, agents]) => {
log(`\n ${category.toUpperCase()} (${agents.length} agents):`, 'blue');
agents.forEach(agent => {
log(` - ${agent.name}: ${agent.description}`, 'reset');
});
});
log('\nš Starting generation process...', 'yellow');
// Check for existing agents to avoid overwriting
const existingAgents = [
'base-agent',
'agent-registry',
'orchestrator',
'backend-agent',
'frontend-agent',
'ai-agent',
'test-agent',
'devops-agent',
'agent-coordinator',
'workflow-integration',
'rapid-prototyper',
'mobile-app-builder',
'parallel-runner',
'result-synthesizer',
'llm-judge',
'whimsy-injector',
'growth-hacker',
'agent-factory',
'generate-agents'
];
const toGenerate = [];
const skipped = [];
for (const spec of specs) {
const fileName = spec.key.replace(/-/g, '-');
if (existingAgents.includes(fileName)) {
skipped.push(spec.name);
} else {
toGenerate.push(spec);
}
}
if (skipped.length > 0) {
log(`\nāļø Skipping ${skipped.length} existing agents:`, 'yellow');
log(` ${skipped.join(', ')}`, 'reset');
}
log(`\nš¦ Generating ${toGenerate.length} new agents...\n`, 'green');
// Generate each agent
const results = {
success: [],
failed: []
};
for (const spec of toGenerate) {
try {
process.stdout.write(` Generating ${spec.name}...`);
const result = await factory.generateSingleAgent(spec.key);
results.success.push(result);
log(' ā
', 'green');
} catch (error) {
results.failed.push({ name: spec.name, error: error.message });
log(` ā ${error.message}`, 'red');
}
}
// Summary
log('\n' + '=' .repeat(50), 'cyan');
log('š Generation Summary', 'cyan');
log('=' .repeat(50), 'cyan');
log(`\nā
Successfully generated: ${results.success.length} agents`, 'green');
if (results.success.length > 0) {
// Group successful by category
const successByCategory = {};
results.success.forEach(agent => {
if (!successByCategory[agent.category]) {
successByCategory[agent.category] = [];
}
successByCategory[agent.category].push(agent.name);
});
Object.entries(successByCategory).forEach(([category, agents]) => {
log(` ${category}: ${agents.join(', ')}`, 'reset');
});
}
if (results.failed.length > 0) {
log(`\nā Failed to generate: ${results.failed.length} agents`, 'red');
results.failed.forEach(fail => {
log(` - ${fail.name}: ${fail.error}`, 'red');
});
}
// Create index file
log('\nš Creating agent index file...', 'yellow');
await createIndexFile(specs, existingAgents);
log(' ā
Index file created', 'green');
// Final statistics
const totalAgents = existingAgents.length - 5 + results.success.length; // Subtract utility files
log(`\nšÆ Total Agents in System: ${totalAgents}`, 'magenta');
log(` - Pre-existing: ${existingAgents.length - 5}`, 'reset');
log(` - Newly generated: ${results.success.length}`, 'reset');
if (totalAgents >= 50) {
log('\nš SUCCESS! Multi-Agent System with 50+ agents is complete! š', 'green');
} else {
log(`\nā ļø Only ${totalAgents} agents created. Need ${50 - totalAgents} more for full system.`, 'yellow');
}
return results;
}
/**
* Create an index file for all agents
*/
async function createIndexFile(specs, existingAgents) {
const indexContent = `/**
* Multi-Agent System Index
* Central registry of all available agents
*/
// Core System
const BaseAgent = require('./base-agent');
const AgentRegistry = require('./agent-registry');
const Orchestrator = require('./orchestrator');
const AgentCoordinator = require('./agent-coordinator');
const WorkflowIntegration = require('./workflow-integration');
// Engineering Agents
const BackendAgent = require('./backend-agent');
const FrontendAgent = require('./frontend-agent');
const DevOpsAgent = require('./devops-agent');
const AIAgent = require('./ai-agent');
const TestAgent = require('./test-agent');
const RapidPrototyper = require('./rapid-prototyper');
const MobileAppBuilder = require('./mobile-app-builder');
// Orchestration Agents
const ParallelRunner = require('./parallel-runner');
const ResultSynthesizer = require('./result-synthesizer');
const LLMJudge = require('./llm-judge');
// Specialist Agents
const WhimsyInjector = require('./whimsy-injector');
const GrowthHacker = require('./growth-hacker');
// Generated Agents
${specs.map(spec => {
const fileName = spec.key.replace(/-/g, '-');
if (!existingAgents.includes(fileName)) {
return `const ${spec.name}Agent = require('./${spec.key}');`;
}
return null;
}).filter(Boolean).join('\n')}
module.exports = {
// Core
BaseAgent,
AgentRegistry,
Orchestrator,
AgentCoordinator,
WorkflowIntegration,
// Engineering
BackendAgent,
FrontendAgent,
DevOpsAgent,
AIAgent,
TestAgent,
RapidPrototyper,
MobileAppBuilder,
// Orchestration
ParallelRunner,
ResultSynthesizer,
LLMJudge,
// Specialists
WhimsyInjector,
GrowthHacker,
// Generated
${specs.map(spec => {
const fileName = spec.key.replace(/-/g, '-');
if (!existingAgents.includes(fileName)) {
return ` ${spec.name}Agent,`;
}
return null;
}).filter(Boolean).join('\n')}
};
`;
await fs.writeFile(path.join(__dirname, 'index.js'), indexContent);
}
// Run if executed directly
if (require.main === module) {
generateAgents().catch(error => {
log(`\nā Fatal error: ${error.message}`, 'red');
console.error(error);
process.exit(1);
});
}
module.exports = { generateAgents };