mirror-magi-meta-agent
Version:
AI-powered development planning and execution system with Supabase integration
48 lines (39 loc) • 1.67 kB
JavaScript
const fs = require('fs').promises;
const path = require('path');
const GenericTemplateEngine = require('./core/template-engine');
const TaskClassifier = require('./core/task-classifier');
async function generateCommand(taskDescription) {
try {
// Load configurations
const config = JSON.parse(await fs.readFile('config/project-config.json', 'utf8'));
const projectState = JSON.parse(await fs.readFile('state/project-state.json', 'utf8'));
// Initialize components
const classifier = new TaskClassifier();
const templateEngine = new GenericTemplateEngine(config, projectState);
// Classify and generate
const classification = classifier.classifyTask(taskDescription);
const taskSpec = {
description: taskDescription,
type: classification.primaryType,
complexity: classification.complexity,
domains: classification.domains
};
const commandData = await templateEngine.generateCommand(taskSpec);
console.log('🎯 TASK:', taskDescription);
console.log('📋 CLASSIFICATION:', classification.primaryType, `(${classification.complexity}/5)`);
console.log('🚀 FULL COMMAND:\n');
console.log(commandData.command);
} catch (error) {
console.error('❌ Error:', error.message);
console.log('💡 Run "npm run setup" first to create configuration files');
}
}
// Get task from command line argument
const task = process.argv[2];
if (!task) {
console.log('Usage: node generate-command.js "your task description"');
console.log('Example: node generate-command.js "Create a login form component"');
process.exit(1);
}
generateCommand(task);