analyze-project
Scan a project directory to identify and recommend specialized sub-agents for optimal team composition and task execution.
Instructions
Analyze a project directory and recommend suitable sub-agents
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | Path to the project directory to analyze |
Implementation Reference
- src/projectAnalyzer.ts:46-116 (handler)Core handler function that performs static analysis of project structure using glob patterns and package.json dependencies to detect project types, technologies, and recommend agents.async analyzeProject(projectPath: string): Promise<ProjectAnalysis> { const detectedTypes: string[] = []; const detectedTechnologies: string[] = []; const recommendedAgents = new Set<string>(); let confidence = 0; // Analyze file structure for (const [type, pattern] of Object.entries(this.patterns)) { let typeScore = 0; // Check for pattern files for (const filePattern of pattern.files) { const files = await glob(filePattern, { cwd: projectPath, ignore: ['node_modules/**', 'dist/**', 'build/**'] }); if (files.length > 0) { typeScore += files.length; } } // Check package.json for keywords const packageJsonPath = path.join(projectPath, 'package.json'); try { const packageContent = await fs.readFile(packageJsonPath, 'utf-8'); const packageJson = JSON.parse(packageContent); const deps = { ...packageJson.dependencies || {}, ...packageJson.devDependencies || {} }; for (const keyword of pattern.keywords) { if (Object.keys(deps).some(dep => dep.includes(keyword))) { typeScore += 2; detectedTechnologies.push(keyword); } } } catch (e) { // Not a Node.js project, check other files } if (typeScore > 0) { detectedTypes.push(type); pattern.agents.forEach(agent => recommendedAgents.add(agent)); confidence += typeScore * 10; } } // Add general agents based on project complexity if (detectedTypes.length > 2) { recommendedAgents.add('project-manager'); recommendedAgents.add('architect'); } // Add QA for any development project if (detectedTypes.includes('frontend') || detectedTypes.includes('backend')) { recommendedAgents.add('qa-engineer'); } // Normalize confidence to 0-100 confidence = Math.min(confidence, 100); return { projectType: detectedTypes, technologies: detectedTechnologies, recommendedAgents: Array.from(recommendedAgents), confidence }; }
- src/index.ts:1387-1400 (registration)MCP tool registration including name, description, and input schema definition in the ListToolsRequestSchema handler.{ name: 'analyze-project', description: 'Analyze a project directory and recommend suitable sub-agents', inputSchema: { type: 'object', properties: { projectPath: { type: 'string', description: 'Path to the project directory to analyze', }, }, required: ['projectPath'], }, },
- src/index.ts:1571-1594 (handler)MCP CallToolRequestSchema handler that extracts projectPath argument, calls projectAnalyzer.analyzeProject, tracks analytics, and returns formatted JSON response.case 'analyze-project': { const { projectPath } = args as { projectPath: string }; const analysis = await projectAnalyzer.analyzeProject(projectPath); // Track project analysis trackEvent(AnalyticsEvents.PROJECT_ANALYZED, { project_types: analysis.projectType, technologies: analysis.technologies, recommended_count: analysis.recommendedAgents.length, confidence: analysis.confidence, }); return { content: [ { type: 'text', text: JSON.stringify({ success: true, analysis, message: `Analyzed project at ${projectPath}. Found ${analysis.projectType.length} project types and recommended ${analysis.recommendedAgents.length} agents.`, }, null, 2), }, ], };
- src/projectAnalyzer.ts:13-44 (helper)Pattern definitions used by analyzeProject for matching project types via files, keywords, and associated agent recommendations.private patterns = { frontend: { files: ['package.json', 'index.html', '*.jsx', '*.tsx', '*.vue'], keywords: ['react', 'vue', 'angular', 'svelte', 'next', 'nuxt'], agents: ['frontend-developer', 'ux-designer', 'ui-designer'] }, backend: { files: ['server.js', 'app.py', 'main.go', 'api/*'], keywords: ['express', 'fastapi', 'django', 'spring', 'nest'], agents: ['backend-engineer', 'devops-engineer', 'security-engineer'] }, mobile: { files: ['*.swift', '*.kt', '*.java', 'pubspec.yaml', 'Info.plist'], keywords: ['react-native', 'flutter', 'ionic', 'xamarin'], agents: ['mobile-developer', 'ui-designer', 'qa-engineer'] }, data: { files: ['*.ipynb', 'requirements.txt', '*.sql', 'dbt_project.yml'], keywords: ['pandas', 'numpy', 'tensorflow', 'scikit-learn', 'jupyter'], agents: ['data-scientist', 'data-analyst', 'data-engineer'] }, infrastructure: { files: ['Dockerfile', 'docker-compose.yml', '*.tf', '.github/workflows/*'], keywords: ['kubernetes', 'terraform', 'ansible', 'jenkins'], agents: ['devops-engineer', 'cloud-architect', 'security-engineer'] }, documentation: { files: ['README.md', 'docs/*', '*.rst', 'mkdocs.yml'], keywords: ['documentation', 'api-docs', 'user-guide'], agents: ['technical-writer', 'content-creator', 'scribe'] } };