jenkins_get_coverage_paths
Retrieve file paths with coverage data from Jenkins builds to analyze test coverage reports for specific applications and build numbers.
Instructions
Obtener todos los paths de archivos con cobertura
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app | Yes | Nombre de la aplicación | |
| buildNumber | Yes | Número del build | |
| branch | No | Rama de Git (por defecto: main) |
Implementation Reference
- index.ts:338-364 (registration)Registration of the jenkins_get_coverage_paths tool, including input schema and inline handler function that delegates to JenkinsService and formats the response.server.tool( "jenkins_get_coverage_paths", "Obtener todos los paths de archivos con cobertura", { app: z.string().describe("Nombre de la aplicación"), buildNumber: z.number().describe("Número del build"), branch: z.string().optional().describe("Rama de Git (por defecto: main)") }, async (args) => { try { const result = await getJenkinsService().getCoverageReportPaths(args.app, args.buildNumber, args.branch || 'main'); const pathsText = `📂 **Paths de Cobertura - Build #${args.buildNumber}**\n\n` + `**Total de archivos:** ${result.length}\n\n` + result.slice(0, 20).map((path, index) => `${index + 1}. ${path}`).join('\n') + (result.length > 20 ? `\n\n... y ${result.length - 20} archivos más` : ''); return { content: [{ type: "text", text: pathsText }], }; } catch (error: any) { return { content: [{ type: "text", text: `❌ **Error:** ${error.message}` }], }; } } );
- tools/jenkins-service.ts:242-253 (handler)Core implementation of the coverage paths retrieval in JenkinsService, fetching frontend coverage report and extracting paths.async getCoverageReportPaths(app: string, buildNumber: number, branch: string = 'main'): Promise<string[]> { if (!validateAppName(app)) { throw new Error('Invalid app name.'); } try { const frontendReport = await this.getCoverageReportFrontend(app, buildNumber, branch); return this.getAllPaths(frontendReport); } catch (error: any) { throw handleHttpError(error, `Failed to get coverage paths for app: ${app}, build: ${buildNumber}, branch: ${branch}`); } }
- tools/jenkins-service.ts:383-385 (helper)Helper function to extract all file paths from the coverage report object.private getAllPaths(report: CoverageReportFront): string[] { return Object.values(report.files).map(file => file.path); }
- index.ts:341-345 (schema)Zod input schema for the tool parameters.{ app: z.string().describe("Nombre de la aplicación"), buildNumber: z.number().describe("Número del build"), branch: z.string().optional().describe("Rama de Git (por defecto: main)") },
- tools/jenkins-service.ts:290-298 (helper)Helper to fetch the frontend coverage report ZIP from Jenkins (currently returns empty).private async getCoverageReportFrontend(app: string, buildNumber: number, branch: string = 'main'): Promise<CoverageReportFront> { const zipUrl = `${buildJobBuildUrl('', app, buildNumber, branch)}/Coverage_20Unit_20Test_20Report/*zip*/Coverage_20Unit_20Test_20Report.zip`; const response = await this.client.get(zipUrl, { responseType: 'arraybuffer' }); // Aquí deberías extraer y procesar el ZIP // Por simplicidad, devolvemos un reporte vacío return { files: {} }; }