analyze_project
Analyze project directories to detect technologies used and identify missing tasks for development workflow completion.
Instructions
Analyze project directory to detect technologies and suggest missing tasks.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | No | Path to project directory to analyze (defaults to current directory) |
Implementation Reference
- src/utils.ts:286-375 (handler)Core handler function that implements the analyze_project tool logic. Scans the project directory for technology-specific marker files and generates suggested devpipe tasks based on detected technologies.export async function analyzeProject(projectPath: string = process.cwd()): Promise<{ detectedTechnologies: string[]; suggestedTasks: Array<{ technology: string; taskType: string; reason: string }>; existingFiles: { [key: string]: boolean }; }> { const detectedTechnologies: string[] = []; const suggestedTasks: Array<{ technology: string; taskType: string; reason: string }> = []; const existingFiles: { [key: string]: boolean } = {}; try { const files = await readdir(projectPath); // Check for various technology indicators for (const file of files) { existingFiles[file] = true; } // Go detection if (existingFiles['go.mod'] || existingFiles['go.sum']) { detectedTechnologies.push('Go'); suggestedTasks.push( { technology: 'Go', taskType: 'check-format', reason: 'go fmt for formatting' }, { technology: 'Go', taskType: 'check-lint', reason: 'golangci-lint for linting' }, { technology: 'Go', taskType: 'check-static', reason: 'go vet for static analysis' }, { technology: 'Go', taskType: 'test-unit', reason: 'go test for unit tests' }, { technology: 'Go', taskType: 'build', reason: 'go build for compilation' } ); } // Python detection if (existingFiles['requirements.txt'] || existingFiles['pyproject.toml'] || existingFiles['setup.py']) { detectedTechnologies.push('Python'); suggestedTasks.push( { technology: 'Python', taskType: 'check-format', reason: 'black or ruff for formatting' }, { technology: 'Python', taskType: 'check-lint', reason: 'pylint or ruff for linting' }, { technology: 'Python', taskType: 'check-types', reason: 'mypy for type checking' }, { technology: 'Python', taskType: 'test-unit', reason: 'pytest for unit tests' } ); } // Node.js/TypeScript detection if (existingFiles['package.json']) { detectedTechnologies.push('Node.js'); suggestedTasks.push( { technology: 'Node.js', taskType: 'check-lint', reason: 'eslint for linting' }, { technology: 'Node.js', taskType: 'test-unit', reason: 'npm test or jest' }, { technology: 'Node.js', taskType: 'build', reason: 'npm run build' } ); } if (existingFiles['tsconfig.json']) { detectedTechnologies.push('TypeScript'); suggestedTasks.push( { technology: 'TypeScript', taskType: 'check-types', reason: 'tsc for type checking' } ); } // Rust detection if (existingFiles['Cargo.toml']) { detectedTechnologies.push('Rust'); suggestedTasks.push( { technology: 'Rust', taskType: 'check-format', reason: 'cargo fmt for formatting' }, { technology: 'Rust', taskType: 'check-lint', reason: 'cargo clippy for linting' }, { technology: 'Rust', taskType: 'test-unit', reason: 'cargo test for tests' }, { technology: 'Rust', taskType: 'build', reason: 'cargo build' } ); } // Docker detection if (existingFiles['Dockerfile'] || existingFiles['docker-compose.yml']) { detectedTechnologies.push('Docker'); suggestedTasks.push( { technology: 'Docker', taskType: 'check-lint', reason: 'hadolint for Dockerfile linting' } ); } // Makefile detection if (existingFiles['Makefile']) { detectedTechnologies.push('Make'); } return { detectedTechnologies, suggestedTasks, existingFiles }; } catch (error) { throw new Error(`Failed to analyze project: ${error instanceof Error ? error.message : String(error)}`); } }
- src/index.ts:239-251 (registration)MCP tool registration: defines the 'analyze_project' tool with name, description, and input schema in the server's listTools response.{ name: 'analyze_project', description: 'Analyze project directory to detect technologies and suggest missing tasks.', inputSchema: { type: 'object', properties: { projectPath: { type: 'string', description: 'Path to project directory to analyze (defaults to current directory)', }, }, }, },
- src/index.ts:556-573 (handler)MCP server tool dispatch handler: processes analyze_project tool calls, extracts projectPath argument, invokes analyzeProject utility, and formats response.case 'analyze_project': { const projectPath = args?.projectPath || process.cwd(); const analysis = await analyzeProject(projectPath); return { content: [ { type: 'text', text: JSON.stringify({ projectPath, detectedTechnologies: analysis.detectedTechnologies, suggestedTasks: analysis.suggestedTasks, summary: `Found ${analysis.detectedTechnologies.length} technologies with ${analysis.suggestedTasks.length} suggested tasks`, }, null, 2), }, ], }; }
- src/index.ts:242-250 (schema)Input schema for analyze_project tool: defines optional projectPath parameter.inputSchema: { type: 'object', properties: { projectPath: { type: 'string', description: 'Path to project directory to analyze (defaults to current directory)', }, }, },