UNPKG

mirror-magi-meta-agent

Version:

AI-powered development planning and execution system with Supabase integration

264 lines (225 loc) • 9.27 kB
#!/usr/bin/env node const fs = require('fs').promises; /** * Demo of the new Project Planning system * Shows how we generate specific, actionable commands instead of generic templates */ async function demonstrateProjectPlanning() { console.log('šŸŽÆ Mirror Magi Enhanced Project Planning Demo\n'); console.log('This shows how we solve the placeholder problem with specific, actionable commands.\n'); // Simulate the current problem console.log('āŒ CURRENT PROBLEM: Generic templates with placeholders'); console.log('━'.repeat(60)); const genericCommand = ` Create a {{component_name}} component that handles {{requirements}} with the following features: {{features}} File location: {{file_path}} Props interface: {{props_interface}} Integration with: {{existing_components}} `; console.log(genericCommand); console.log('This requires manual replacement of all placeholders!\n'); // Show the new solution console.log('āœ… NEW SOLUTION: Specific, actionable commands'); console.log('━'.repeat(60)); // Simulate creating a master plan for a dashboard project const projectGoal = "Create an investment dashboard page with portfolio overview and transaction history"; console.log(`šŸŽÆ PROJECT GOAL: ${projectGoal}\n`); // Simulate the planning phase console.log('šŸ”„ PLANNING PHASE:'); console.log('1. Analyzing project goal...'); console.log('2. Breaking down into sequential tasks...'); console.log('3. Extracting specific details...\n'); const masterPlan = simulateMasterPlan(projectGoal); console.log('šŸ“‹ MASTER PLAN CREATED:'); console.log(`šŸ“Š ${masterPlan.phases.length} phases, ${masterPlan.totalTasks} tasks`); console.log(`ā±ļø Estimated: ${masterPlan.estimatedHours} hours\n`); // Show the phases console.log('šŸ“‹ DEVELOPMENT PHASES:'); masterPlan.phases.forEach((phase, index) => { console.log(`\n${index + 1}. ${phase.name}`); console.log(` ${phase.description}`); console.log(` šŸ“ ${phase.tasks.length} tasks`); }); console.log('\nšŸš€ GENERATING FIRST SPECIFIC COMMAND:\n'); // Generate a specific command for the first task const firstTask = masterPlan.phases[0].tasks[0]; const specificCommand = generateSpecificCommand(firstTask, projectGoal); console.log('šŸŽÆ TASK:', firstTask.description); console.log('šŸ“‹ TYPE:', firstTask.type); console.log('ā±ļø ESTIMATED:', firstTask.estimatedTime, 'minutes\n'); console.log('šŸ“ SPECIFIC DETAILS:'); Object.entries(firstTask.specifics).forEach(([key, value]) => { console.log(` ${key}: ${JSON.stringify(value)}`); }); console.log('\nšŸš€ GENERATED SPECIFIC COMMAND:'); console.log('═'.repeat(80)); console.log(specificCommand); console.log('═'.repeat(80)); console.log('\nāœ… VALIDATION STEPS:'); const validationSteps = generateValidationSteps(firstTask); validationSteps.forEach((step, index) => { console.log(`${index + 1}. ${step}`); }); console.log('\nšŸŽÆ SUCCESS CRITERIA:'); const successCriteria = generateSuccessCriteria(firstTask); successCriteria.forEach((criteria, index) => { console.log(`${index + 1}. ${criteria}`); }); console.log('\nšŸ’” SEQUENTIAL WORKFLOW:'); console.log('1. Complete this task following the specific command'); console.log('2. Run: node plan-project.js complete create_page_component'); console.log('3. Run: node plan-project.js continue'); console.log('4. Get the next specific command in the sequence\n'); console.log('🌟 KEY IMPROVEMENTS:'); console.log('• No placeholders - everything is filled in with actual values'); console.log('• Sequential development - each task builds on the previous'); console.log('• Project awareness - commands reference actual files and components'); console.log('• Progress tracking - always know where you are in the plan'); console.log('• Context accumulation - later tasks know about earlier work\n'); console.log('šŸš€ This makes the meta-agent practical for real development work!'); } function simulateMasterPlan(projectGoal) { return { goal: projectGoal, phases: [ { id: 'foundation', name: 'Page Foundation', description: 'Create the basic Investment page structure and routing', tasks: [ { id: 'create_page_component', description: 'Create Investment main component', type: 'component_creation', specifics: { componentName: 'InvestmentPage', filePath: 'src/pages/InvestmentPage.tsx', props: { portfolioData: 'Portfolio[]', transactions: 'Transaction[]', onFilter: '(filters: FilterOptions) => void' }, routePath: '/investment', routeFile: 'src/App.tsx', authRequired: true }, dependencies: [], estimatedTime: 30 }, { id: 'setup_routing', description: 'Add Investment page to application routing', type: 'configuration', specifics: { routePath: '/investment', routeFile: 'src/App.tsx', authRequired: true, parentRoute: '/dashboard' }, dependencies: ['create_page_component'], estimatedTime: 15 } ] }, { id: 'data_layer', name: 'Data & State Management', description: 'Set up data fetching and state management for Investment page', tasks: [ { id: 'create_api_service', description: 'Create investment data API service', type: 'api_integration', specifics: { serviceName: 'InvestmentService', filePath: 'src/services/InvestmentService.ts', endpoints: { getPortfolio: '/api/portfolio', getTransactions: '/api/transactions', getPerformance: '/api/performance' } }, estimatedTime: 45 } ] } ], totalTasks: 3, estimatedHours: 1.5 }; } function generateSpecificCommand(task, projectGoal) { // This simulates what the enhanced template engine would generate return ` Create a comprehensive Investment Dashboard page component with portfolio overview and transaction management. SPECIFIC IMPLEMENTATION: 1. Create the main InvestmentPage component: - File: src/pages/InvestmentPage.tsx - Component name: InvestmentPage - Use TypeScript with strict typing 2. Component structure: \`\`\`typescript interface InvestmentPageProps { portfolioData: Portfolio[]; transactions: Transaction[]; onFilter: (filters: FilterOptions) => void; } export const InvestmentPage: React.FC<InvestmentPageProps> = ({ portfolioData, transactions, onFilter }) => { // Component implementation }; \`\`\` 3. Layout and sections: - Header with page title "Investment Dashboard" - Portfolio overview section with key metrics - Transaction history section with filtering - Use CSS Grid for responsive layout 4. Integration requirements: - Import existing components: Layout, Header, DataCard - Use the existing theme system from src/styles/theme.ts - Integrate with React Router for /investment route - Connect to authentication context for protected access 5. State management: - Use React hooks for local state - Implement loading and error states - Add pagination for transaction history 6. Accessibility: - Proper ARIA labels for all interactive elements - Keyboard navigation support - Screen reader compatibility This component will serve as the foundation for the investment tracking features in the dashboard, providing users with a comprehensive view of their portfolio performance and transaction history. The implementation should follow the existing code patterns in the project and integrate seamlessly with the current routing and authentication system. `; } function generateValidationSteps(task) { return [ 'Type checking: npx tsc --noEmit', 'Linting: npm run lint', 'Build verification: npm run build', `Verify ${task.specifics.componentName} component renders correctly`, `Navigate to ${task.specifics.routePath} and verify page loads`, `Check ${task.specifics.componentName} props are properly typed`, 'Verify responsive design works on mobile and desktop', 'Test component with mock data', 'Verify accessibility with screen reader' ]; } function generateSuccessCriteria(task) { return [ `${task.specifics.componentName} component renders without errors`, `Route ${task.specifics.routePath} is accessible and loads the component`, 'Component follows existing design system and patterns', 'TypeScript types are properly defined and enforced', 'Component is responsive and accessible', 'Progress made toward: Create an investment dashboard page with portfolio overview and transaction history' ]; } // Run the demo demonstrateProjectPlanning().catch(console.error);