diff --git a/src/index.ts b/src/index.ts index ec12ed9..6cb5f22 100644 --- a/src/index.ts +++ b/src/index.ts @@ -531,7 +531,7 @@ markup: ], }; - default: + default: { // Try to find specific workflow const workflow = DOCUMENTATION_WORKFLOWS[workflowType || '']; if (workflow) { @@ -546,6 +546,7 @@ markup: }; } throw new Error(`Unknown workflow: ${workflowType}`); + } } } @@ -726,7 +727,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => { }); // Start the server -async function main() { +async function main(): Promise { const transport = new StdioServerTransport(); await server.connect(transport); console.error('DocuMCP server started successfully'); diff --git a/src/tools/populate-content.ts b/src/tools/populate-content.ts index 6df00ec..b8066d5 100644 --- a/src/tools/populate-content.ts +++ b/src/tools/populate-content.ts @@ -25,13 +25,6 @@ interface ContentPlan { explanation: any[]; } -interface ProjectContext { - primaryLanguage: string; - frameworks: any[]; - testingFrameworks: any[]; - dependencies: any; - devopsTools?: DevOpsToolProfile; -} interface DevOpsToolProfile { containerization: ContainerTechnology[]; @@ -430,7 +423,7 @@ app.start();`, ]; } - private generateNodeSetupContent(analysis: any): string { + private generateNodeSetupContent(_analysis: any): string { return `# Setting Up Your Development Environment This guide will help you configure a complete Node.js and TypeScript development environment. @@ -570,7 +563,7 @@ npm test -- --coverage `; } - private generateTestingExamples(analysis: any): string[] { + private generateTestingExamples(_analysis: any): string[] { return [ `// Unit test example import { calculateTotal } from './calculator'; @@ -1534,7 +1527,9 @@ ${analysis.technologies.database ? `### Database try { await fs.access(filePath); continue; - } catch {} + } catch { + // File doesn't exist, continue to create it + } } await fs.writeFile(filePath, howTo.content, 'utf-8'); @@ -1550,7 +1545,9 @@ ${analysis.technologies.database ? `### Database try { await fs.access(filePath); continue; - } catch {} + } catch { + // File doesn't exist, continue to create it + } } await fs.writeFile(filePath, ref.content, 'utf-8'); @@ -1566,7 +1563,9 @@ ${analysis.technologies.database ? `### Database try { await fs.access(filePath); continue; - } catch {} + } catch { + // File doesn't exist, continue to create it + } } await fs.writeFile(filePath, exp.content, 'utf-8'); @@ -1803,7 +1802,7 @@ ${contentPlan.explanation.map(e => `- [${e.title}](explanation/${this.slugify(e. return files.some((f: any) => f.content?.includes(content)); } - private extractDockerVersion(analysis: any): string | undefined { + private extractDockerVersion(_analysis: any): string | undefined { return undefined; // Could be implemented to parse Dockerfile } @@ -1828,11 +1827,11 @@ ${contentPlan.explanation.map(e => `- [${e.title}](explanation/${this.slugify(e. .map((f: any) => f.name); } - private analyzeKubernetesResources(analysis: any): string[] { + private analyzeKubernetesResources(_analysis: any): string[] { return ['Deployment', 'Service', 'ConfigMap']; // Simplified } - private extractNamespaces(analysis: any): string[] { + private extractNamespaces(_analysis: any): string[] { return ['default']; // Simplified } @@ -2159,7 +2158,7 @@ python manage.py runserver `; } - private generateFastAPITutorialContent(analysis: any): string { + private generateFastAPITutorialContent(_analysis: any): string { return `# Building APIs with FastAPI Create modern, fast APIs with automatic documentation using FastAPI. @@ -2226,7 +2225,7 @@ FastAPI automatically generates interactive API documentation: `; } - private generateFlaskTutorialContent(analysis: any): string { + private generateFlaskTutorialContent(_analysis: any): string { return `# Building Applications with Flask Create lightweight web applications and APIs using Flask's minimalist approach. @@ -2303,7 +2302,7 @@ Popular Flask extensions: } // Helper methods for container content generation - private generateContainerFileContent(analysis: any, containerTech: ContainerTechnology): string { + private generateContainerFileContent(analysis: any, _containerTech: ContainerTechnology): string { const language = analysis.metadata.primaryLanguage?.toLowerCase(); if (language === 'python') { @@ -2404,7 +2403,7 @@ ${containerTech.name} ps` ]; } - private generateOrchestrationExamples(analysis: any, orchestrationTech: OrchestrationTechnology): string[] { + private generateOrchestrationExamples(analysis: any, _orchestrationTech: OrchestrationTechnology): string[] { return [ `# Deploy the application kubectl apply -f k8s/`, diff --git a/src/tools/test-local-deployment.ts b/src/tools/test-local-deployment.ts index ef434d8..339804c 100644 --- a/src/tools/test-local-deployment.ts +++ b/src/tools/test-local-deployment.ts @@ -108,7 +108,7 @@ export async function testLocalDeployment(args: unknown): Promise<{ content: any // Step 2: Install dependencies if needed if (config.installCommand && !skipBuild) { try { - const { stdout: _stdout, stderr } = await execAsync(config.installCommand, { + const { stderr } = await execAsync(config.installCommand, { cwd: repositoryPath, timeout: timeout * 1000 }); diff --git a/src/tools/validate-content.ts b/src/tools/validate-content.ts index 9c328a4..236b086 100644 --- a/src/tools/validate-content.ts +++ b/src/tools/validate-content.ts @@ -3,12 +3,12 @@ import * as fs from 'fs/promises'; import * as path from 'path'; import { exec } from 'child_process'; import { promisify } from 'util'; +import { fileURLToPath } from 'url'; // ESM-compatible __dirname replacement - fallback for test environments function getDirname(): string { try { if (typeof import.meta !== 'undefined' && import.meta.url) { - const { fileURLToPath } = require('url'); return path.dirname(fileURLToPath(import.meta.url)); } } catch { @@ -245,8 +245,6 @@ class ContentAccuracyValidator { ): Promise { if (!this.projectContext) return; - const dependencies = this.projectContext.dependencies?.packages || []; - // Check if mentioned versions align with project dependencies const versionPattern = /@(\d+\.\d+\.\d+)/g; const matches = content.match(versionPattern); @@ -615,7 +613,7 @@ class ContentAccuracyValidator { await fs.writeFile(tempFile, code, 'utf-8'); // Try to compile with TypeScript - const { stdout, stderr } = await execAsync(`npx tsc --noEmit --skipLibCheck ${tempFile}`); + const { stderr } = await execAsync(`npx tsc --noEmit --skipLibCheck ${tempFile}`); if (stderr && stderr.includes('error')) { validation.issues.push({ @@ -647,7 +645,9 @@ class ContentAccuracyValidator { // Clean up temp file try { await fs.unlink(tempFile); - } catch {} + } catch { + // Ignore cleanup errors + } } } @@ -826,7 +826,7 @@ class ContentAccuracyValidator { } } - private generateRecommendations(result: ValidationResult, options: ValidationOptions): void { + private generateRecommendations(result: ValidationResult, _options: ValidationOptions): void { const recommendations: string[] = []; const nextSteps: string[] = []; diff --git a/tests/edge-cases/error-handling.test.ts b/tests/edge-cases/error-handling.test.ts index 624340e..fa16466 100644 --- a/tests/edge-cases/error-handling.test.ts +++ b/tests/edge-cases/error-handling.test.ts @@ -531,7 +531,7 @@ describe('Edge Cases and Error Handling', () => { try { await Promise.race([longOperation, timeoutPromise]); } catch (error) { - if (error.message === 'Operation timed out') { + if (error instanceof Error && error.message === 'Operation timed out') { console.warn('Long operation test timed out - this is expected behavior'); } else { throw error;