UNPKG

mcp-codesentry

Version:

CodeSentry MCP - AI-powered code review assistant with 5 specialized review tools for security, best practices, and comprehensive code analysis

49 lines (44 loc) 1.75 kB
# Task ID: 4 # Title: Implement Repomix Integration # Status: pending # Dependencies: 1, 3 # Priority: high # Description: Develop the Repomix manager component to execute repomix for codebase flattening and analysis. # Details: 1. Create RepomixManager class: ```typescript class RepomixManager { constructor(config: RepomixConfig) { // Initialize with configuration } async flattenCodebase(options: { codebaseRoot: string, includePatterns?: string[], excludePatterns?: string[] }): Promise<string> { // Execute repomix via child_process // Format output for optimal LLM consumption // Return flattened codebase content } async generateDiff(beforeSnapshot: string, afterSnapshot: string): Promise<string> { // Generate diff between two snapshots } } ``` 2. Implement execution of repomix using Node.js child_process: ```typescript const { exec } = require('child_process'); // Execute repomix command const command = `npx repomix ${options.codebaseRoot} ${includeFlags} ${excludeFlags}`; const result = await new Promise((resolve, reject) => { exec(command, { maxBuffer: 1024 * 1024 * 100 }, (error, stdout, stderr) => { if (error) reject(error); else resolve(stdout); }); }); ``` 3. Add optimization for large codebases 4. Implement caching mechanism to avoid redundant processing 5. Add error handling for repomix execution failures # Test Strategy: Test repomix execution with various include/exclude patterns. Verify correct handling of large codebases. Test caching mechanism by measuring execution time for repeated calls. Test error handling by simulating repomix failures.