api-tests-coverage 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +703 -0
- package/config.yaml.example +227 -0
- package/dist/action/src/index.d.ts +2 -0
- package/dist/action/src/index.d.ts.map +1 -0
- package/dist/action/src/index.js +349 -0
- package/dist/action/src/prComment.d.ts +34 -0
- package/dist/action/src/prComment.d.ts.map +1 -0
- package/dist/action/src/prComment.js +146 -0
- package/dist/src/ast/astAnalysisOrchestrator.d.ts +36 -0
- package/dist/src/ast/astAnalysisOrchestrator.d.ts.map +1 -0
- package/dist/src/ast/astAnalysisOrchestrator.js +123 -0
- package/dist/src/ast/astTypes.d.ts +105 -0
- package/dist/src/ast/astTypes.d.ts.map +1 -0
- package/dist/src/ast/astTypes.js +9 -0
- package/dist/src/ast/languageAnalyzer.d.ts +46 -0
- package/dist/src/ast/languageAnalyzer.d.ts.map +1 -0
- package/dist/src/ast/languageAnalyzer.js +9 -0
- package/dist/src/ast/languageCapabilities.d.ts +24 -0
- package/dist/src/ast/languageCapabilities.d.ts.map +1 -0
- package/dist/src/ast/languageCapabilities.js +92 -0
- package/dist/src/ast/parseFile.d.ts +16 -0
- package/dist/src/ast/parseFile.d.ts.map +1 -0
- package/dist/src/ast/parseFile.js +65 -0
- package/dist/src/ast/parserRegistry.d.ts +39 -0
- package/dist/src/ast/parserRegistry.d.ts.map +1 -0
- package/dist/src/ast/parserRegistry.js +66 -0
- package/dist/src/buildSummary.d.ts +26 -0
- package/dist/src/buildSummary.d.ts.map +1 -0
- package/dist/src/buildSummary.js +193 -0
- package/dist/src/businessCoverage.d.ts +68 -0
- package/dist/src/businessCoverage.d.ts.map +1 -0
- package/dist/src/businessCoverage.js +290 -0
- package/dist/src/compatibilityCoverage.d.ts +83 -0
- package/dist/src/compatibilityCoverage.d.ts.map +1 -0
- package/dist/src/compatibilityCoverage.js +501 -0
- package/dist/src/config/defaultConfig.d.ts +9 -0
- package/dist/src/config/defaultConfig.d.ts.map +1 -0
- package/dist/src/config/defaultConfig.js +97 -0
- package/dist/src/config/index.d.ts +12 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/index.js +37 -0
- package/dist/src/config/loadConfig.d.ts +29 -0
- package/dist/src/config/loadConfig.d.ts.map +1 -0
- package/dist/src/config/loadConfig.js +135 -0
- package/dist/src/config/mergeConfig.d.ts +15 -0
- package/dist/src/config/mergeConfig.d.ts.map +1 -0
- package/dist/src/config/mergeConfig.js +57 -0
- package/dist/src/config/schema.d.ts +15 -0
- package/dist/src/config/schema.d.ts.map +1 -0
- package/dist/src/config/schema.js +30 -0
- package/dist/src/config/types.d.ts +175 -0
- package/dist/src/config/types.d.ts.map +1 -0
- package/dist/src/config/types.js +9 -0
- package/dist/src/config/validateConfig.d.ts +22 -0
- package/dist/src/config/validateConfig.d.ts.map +1 -0
- package/dist/src/config/validateConfig.js +171 -0
- package/dist/src/config.d.ts +168 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/config.js +204 -0
- package/dist/src/coverage/deep-analysis/callGraph.d.ts +67 -0
- package/dist/src/coverage/deep-analysis/callGraph.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/callGraph.js +275 -0
- package/dist/src/coverage/deep-analysis/deepEndpointResolver.d.ts +23 -0
- package/dist/src/coverage/deep-analysis/deepEndpointResolver.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/deepEndpointResolver.js +394 -0
- package/dist/src/coverage/deep-analysis/index.d.ts +17 -0
- package/dist/src/coverage/deep-analysis/index.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/index.js +63 -0
- package/dist/src/coverage/deep-analysis/resolveAssertions.d.ts +60 -0
- package/dist/src/coverage/deep-analysis/resolveAssertions.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolveAssertions.js +121 -0
- package/dist/src/coverage/deep-analysis/resolveConstants.d.ts +36 -0
- package/dist/src/coverage/deep-analysis/resolveConstants.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolveConstants.js +92 -0
- package/dist/src/coverage/deep-analysis/resolveEnums.d.ts +55 -0
- package/dist/src/coverage/deep-analysis/resolveEnums.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolveEnums.js +152 -0
- package/dist/src/coverage/deep-analysis/resolveMethodChains.d.ts +70 -0
- package/dist/src/coverage/deep-analysis/resolveMethodChains.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolveMethodChains.js +152 -0
- package/dist/src/coverage/deep-analysis/resolvePaths.d.ts +80 -0
- package/dist/src/coverage/deep-analysis/resolvePaths.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolvePaths.js +216 -0
- package/dist/src/coverage/deep-analysis/resolveRequestWrappers.d.ts +71 -0
- package/dist/src/coverage/deep-analysis/resolveRequestWrappers.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/resolveRequestWrappers.js +226 -0
- package/dist/src/coverage/deep-analysis/symbolTable.d.ts +58 -0
- package/dist/src/coverage/deep-analysis/symbolTable.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/symbolTable.js +230 -0
- package/dist/src/coverage/deep-analysis/types.d.ts +122 -0
- package/dist/src/coverage/deep-analysis/types.d.ts.map +1 -0
- package/dist/src/coverage/deep-analysis/types.js +21 -0
- package/dist/src/discovery/fileClassifier.d.ts +50 -0
- package/dist/src/discovery/fileClassifier.d.ts.map +1 -0
- package/dist/src/discovery/fileClassifier.js +238 -0
- package/dist/src/discovery/projectDiscovery.d.ts +66 -0
- package/dist/src/discovery/projectDiscovery.d.ts.map +1 -0
- package/dist/src/discovery/projectDiscovery.js +287 -0
- package/dist/src/endpointCoverage.d.ts +70 -0
- package/dist/src/endpointCoverage.d.ts.map +1 -0
- package/dist/src/endpointCoverage.js +381 -0
- package/dist/src/errorCoverage.d.ts +93 -0
- package/dist/src/errorCoverage.d.ts.map +1 -0
- package/dist/src/errorCoverage.js +698 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +1441 -0
- package/dist/src/inference/businessRuleInference.d.ts +63 -0
- package/dist/src/inference/businessRuleInference.d.ts.map +1 -0
- package/dist/src/inference/businessRuleInference.js +268 -0
- package/dist/src/inference/integrationFlowInference.d.ts +56 -0
- package/dist/src/inference/integrationFlowInference.d.ts.map +1 -0
- package/dist/src/inference/integrationFlowInference.js +266 -0
- package/dist/src/integrationCoverage.d.ts +72 -0
- package/dist/src/integrationCoverage.d.ts.map +1 -0
- package/dist/src/integrationCoverage.js +317 -0
- package/dist/src/intelligence/index.d.ts +20 -0
- package/dist/src/intelligence/index.d.ts.map +1 -0
- package/dist/src/intelligence/index.js +105 -0
- package/dist/src/intelligence/linkageEngine.d.ts +20 -0
- package/dist/src/intelligence/linkageEngine.d.ts.map +1 -0
- package/dist/src/intelligence/linkageEngine.js +522 -0
- package/dist/src/intelligence/markdownReporter.d.ts +12 -0
- package/dist/src/intelligence/markdownReporter.d.ts.map +1 -0
- package/dist/src/intelligence/markdownReporter.js +265 -0
- package/dist/src/intelligence/riskScoring.d.ts +53 -0
- package/dist/src/intelligence/riskScoring.d.ts.map +1 -0
- package/dist/src/intelligence/riskScoring.js +181 -0
- package/dist/src/intelligence/types.d.ts +121 -0
- package/dist/src/intelligence/types.d.ts.map +1 -0
- package/dist/src/intelligence/types.js +8 -0
- package/dist/src/languageDetection.d.ts +100 -0
- package/dist/src/languageDetection.d.ts.map +1 -0
- package/dist/src/languageDetection.js +349 -0
- package/dist/src/languages/java/index.d.ts +16 -0
- package/dist/src/languages/java/index.d.ts.map +1 -0
- package/dist/src/languages/java/index.js +103 -0
- package/dist/src/languages/java/parser.d.ts +7 -0
- package/dist/src/languages/java/parser.d.ts.map +1 -0
- package/dist/src/languages/java/parser.js +50 -0
- package/dist/src/languages/java/semanticBuilder.d.ts +21 -0
- package/dist/src/languages/java/semanticBuilder.d.ts.map +1 -0
- package/dist/src/languages/java/semanticBuilder.js +358 -0
- package/dist/src/languages/javascript/annotationExtractor.d.ts +20 -0
- package/dist/src/languages/javascript/annotationExtractor.d.ts.map +1 -0
- package/dist/src/languages/javascript/annotationExtractor.js +94 -0
- package/dist/src/languages/javascript/assertionResolver.d.ts +18 -0
- package/dist/src/languages/javascript/assertionResolver.d.ts.map +1 -0
- package/dist/src/languages/javascript/assertionResolver.js +150 -0
- package/dist/src/languages/javascript/callResolver.d.ts +23 -0
- package/dist/src/languages/javascript/callResolver.d.ts.map +1 -0
- package/dist/src/languages/javascript/callResolver.js +236 -0
- package/dist/src/languages/javascript/httpInteractionExtractor.d.ts +23 -0
- package/dist/src/languages/javascript/httpInteractionExtractor.d.ts.map +1 -0
- package/dist/src/languages/javascript/httpInteractionExtractor.js +205 -0
- package/dist/src/languages/javascript/index.d.ts +20 -0
- package/dist/src/languages/javascript/index.d.ts.map +1 -0
- package/dist/src/languages/javascript/index.js +136 -0
- package/dist/src/languages/javascript/parser.d.ts +14 -0
- package/dist/src/languages/javascript/parser.d.ts.map +1 -0
- package/dist/src/languages/javascript/parser.js +38 -0
- package/dist/src/languages/javascript/symbolResolver.d.ts +31 -0
- package/dist/src/languages/javascript/symbolResolver.d.ts.map +1 -0
- package/dist/src/languages/javascript/symbolResolver.js +183 -0
- package/dist/src/languages/kotlin/index.d.ts +16 -0
- package/dist/src/languages/kotlin/index.d.ts.map +1 -0
- package/dist/src/languages/kotlin/index.js +151 -0
- package/dist/src/languages/kotlin/parser.d.ts +11 -0
- package/dist/src/languages/kotlin/parser.d.ts.map +1 -0
- package/dist/src/languages/kotlin/parser.js +74 -0
- package/dist/src/languages/python/index.d.ts +15 -0
- package/dist/src/languages/python/index.d.ts.map +1 -0
- package/dist/src/languages/python/index.js +293 -0
- package/dist/src/languages/ruby/index.d.ts +15 -0
- package/dist/src/languages/ruby/index.d.ts.map +1 -0
- package/dist/src/languages/ruby/index.js +274 -0
- package/dist/src/languages/shared/treeSitterUtils.d.ts +43 -0
- package/dist/src/languages/shared/treeSitterUtils.d.ts.map +1 -0
- package/dist/src/languages/shared/treeSitterUtils.js +100 -0
- package/dist/src/languages/typescript/index.d.ts +14 -0
- package/dist/src/languages/typescript/index.d.ts.map +1 -0
- package/dist/src/languages/typescript/index.js +25 -0
- package/dist/src/lib/index.d.ts +228 -0
- package/dist/src/lib/index.d.ts.map +1 -0
- package/dist/src/lib/index.js +486 -0
- package/dist/src/mcp/client/index.d.ts +37 -0
- package/dist/src/mcp/client/index.d.ts.map +1 -0
- package/dist/src/mcp/client/index.js +235 -0
- package/dist/src/mcp/config.d.ts +50 -0
- package/dist/src/mcp/config.d.ts.map +1 -0
- package/dist/src/mcp/config.js +125 -0
- package/dist/src/mcp/events.d.ts +24 -0
- package/dist/src/mcp/events.d.ts.map +1 -0
- package/dist/src/mcp/events.js +48 -0
- package/dist/src/mcp/fallback/index.d.ts +50 -0
- package/dist/src/mcp/fallback/index.d.ts.map +1 -0
- package/dist/src/mcp/fallback/index.js +216 -0
- package/dist/src/mcp/index.d.ts +67 -0
- package/dist/src/mcp/index.d.ts.map +1 -0
- package/dist/src/mcp/index.js +212 -0
- package/dist/src/mcp/normalizer.d.ts +21 -0
- package/dist/src/mcp/normalizer.d.ts.map +1 -0
- package/dist/src/mcp/normalizer.js +99 -0
- package/dist/src/mcp/prompts/index.d.ts +86 -0
- package/dist/src/mcp/prompts/index.d.ts.map +1 -0
- package/dist/src/mcp/prompts/index.js +304 -0
- package/dist/src/mcp/templates/index.d.ts +35 -0
- package/dist/src/mcp/templates/index.d.ts.map +1 -0
- package/dist/src/mcp/templates/index.js +143 -0
- package/dist/src/mcp/testing/mock-server/index.d.ts +47 -0
- package/dist/src/mcp/testing/mock-server/index.d.ts.map +1 -0
- package/dist/src/mcp/testing/mock-server/index.js +157 -0
- package/dist/src/mcp/types.d.ts +127 -0
- package/dist/src/mcp/types.d.ts.map +1 -0
- package/dist/src/mcp/types.js +8 -0
- package/dist/src/observability.d.ts +138 -0
- package/dist/src/observability.d.ts.map +1 -0
- package/dist/src/observability.js +519 -0
- package/dist/src/parameterCoverage.d.ts +75 -0
- package/dist/src/parameterCoverage.d.ts.map +1 -0
- package/dist/src/parameterCoverage.js +629 -0
- package/dist/src/perfResilienceCoverage.d.ts +155 -0
- package/dist/src/perfResilienceCoverage.d.ts.map +1 -0
- package/dist/src/perfResilienceCoverage.js +670 -0
- package/dist/src/pluginLoader.d.ts +51 -0
- package/dist/src/pluginLoader.d.ts.map +1 -0
- package/dist/src/pluginLoader.js +72 -0
- package/dist/src/publishing.d.ts +63 -0
- package/dist/src/publishing.d.ts.map +1 -0
- package/dist/src/publishing.js +379 -0
- package/dist/src/qualityGate.d.ts +58 -0
- package/dist/src/qualityGate.d.ts.map +1 -0
- package/dist/src/qualityGate.js +118 -0
- package/dist/src/reporting.d.ts +41 -0
- package/dist/src/reporting.d.ts.map +1 -0
- package/dist/src/reporting.js +278 -0
- package/dist/src/screenshots.d.ts +71 -0
- package/dist/src/screenshots.d.ts.map +1 -0
- package/dist/src/screenshots.js +141 -0
- package/dist/src/security/gate/index.d.ts +11 -0
- package/dist/src/security/gate/index.d.ts.map +1 -0
- package/dist/src/security/gate/index.js +65 -0
- package/dist/src/security/index.d.ts +30 -0
- package/dist/src/security/index.d.ts.map +1 -0
- package/dist/src/security/index.js +342 -0
- package/dist/src/security/normalizers/semgrep.d.ts +10 -0
- package/dist/src/security/normalizers/semgrep.d.ts.map +1 -0
- package/dist/src/security/normalizers/semgrep.js +104 -0
- package/dist/src/security/normalizers/trivy.d.ts +10 -0
- package/dist/src/security/normalizers/trivy.d.ts.map +1 -0
- package/dist/src/security/normalizers/trivy.js +78 -0
- package/dist/src/security/normalizers/zap.d.ts +10 -0
- package/dist/src/security/normalizers/zap.d.ts.map +1 -0
- package/dist/src/security/normalizers/zap.js +104 -0
- package/dist/src/security/scanners/semgrep.d.ts +6 -0
- package/dist/src/security/scanners/semgrep.d.ts.map +1 -0
- package/dist/src/security/scanners/semgrep.js +125 -0
- package/dist/src/security/scanners/trivy.d.ts +6 -0
- package/dist/src/security/scanners/trivy.d.ts.map +1 -0
- package/dist/src/security/scanners/trivy.js +115 -0
- package/dist/src/security/scanners/zap.d.ts +6 -0
- package/dist/src/security/scanners/zap.d.ts.map +1 -0
- package/dist/src/security/scanners/zap.js +135 -0
- package/dist/src/security/types.d.ts +146 -0
- package/dist/src/security/types.d.ts.map +1 -0
- package/dist/src/security/types.js +6 -0
- package/dist/src/securityCoverage.d.ts +116 -0
- package/dist/src/securityCoverage.d.ts.map +1 -0
- package/dist/src/securityCoverage.js +725 -0
- package/dist/src/summary/buildSummary.d.ts +28 -0
- package/dist/src/summary/buildSummary.d.ts.map +1 -0
- package/dist/src/summary/buildSummary.js +257 -0
- package/dist/src/summary/evaluateMetrics.d.ts +31 -0
- package/dist/src/summary/evaluateMetrics.d.ts.map +1 -0
- package/dist/src/summary/evaluateMetrics.js +118 -0
- package/dist/src/summary/index.d.ts +10 -0
- package/dist/src/summary/index.d.ts.map +1 -0
- package/dist/src/summary/index.js +22 -0
- package/dist/src/summary/markdownRenderer.d.ts +139 -0
- package/dist/src/summary/markdownRenderer.d.ts.map +1 -0
- package/dist/src/summary/markdownRenderer.js +459 -0
- package/dist/src/summary/prSummary.d.ts +24 -0
- package/dist/src/summary/prSummary.d.ts.map +1 -0
- package/dist/src/summary/prSummary.js +233 -0
- package/dist/src/summary/summaryTypes.d.ts +35 -0
- package/dist/src/summary/summaryTypes.d.ts.map +1 -0
- package/dist/src/summary/summaryTypes.js +27 -0
- package/package.json +84 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Summary engine – build/CI summary generator.
|
|
3
|
+
*
|
|
4
|
+
* Generates PR/CI build summaries that include only the sections that actually
|
|
5
|
+
* ran or had gates evaluated (gate-aware inclusion).
|
|
6
|
+
*
|
|
7
|
+
* Public API:
|
|
8
|
+
* generateBuildSummary(input): Promise<SummaryResult>
|
|
9
|
+
*/
|
|
10
|
+
import { SummaryInput, SummaryResult } from './markdownRenderer';
|
|
11
|
+
/**
|
|
12
|
+
* Generate a full build/CI summary from analysis results.
|
|
13
|
+
*
|
|
14
|
+
* Gate-aware inclusion rules:
|
|
15
|
+
* - A section is included when: the analyzer ran (results present) OR the gate
|
|
16
|
+
* was explicitly configured for that category.
|
|
17
|
+
* - A section is omitted when: neither results nor gate configuration exist.
|
|
18
|
+
* - Security scanning section is included only when securityScan is provided.
|
|
19
|
+
*
|
|
20
|
+
* @param input All analysis results and configuration.
|
|
21
|
+
* @param outDir Optional directory to write output files to (e.g. "reports").
|
|
22
|
+
* When provided, writes pr-summary.md, build-summary.md,
|
|
23
|
+
* summary.json, ai-summary.md, and ai-summary.json.
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateBuildSummary(input: SummaryInput, outDir?: string): Promise<SummaryResult>;
|
|
26
|
+
export type { SummaryInput, SummaryResult, SummarySection, SummaryConfig } from './markdownRenderer';
|
|
27
|
+
export { renderIntelligenceSection } from './markdownRenderer';
|
|
28
|
+
//# sourceMappingURL=buildSummary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildSummary.d.ts","sourceRoot":"","sources":["../../../src/summary/buildSummary.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EACL,YAAY,EACZ,aAAa,EAYd,MAAM,oBAAoB,CAAC;AAK5B;;;;;;;;;;;;;GAaG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,YAAY,EACnB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,aAAa,CAAC,CAuBxB;AAkND,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACrG,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Summary engine – build/CI summary generator.
|
|
4
|
+
*
|
|
5
|
+
* Generates PR/CI build summaries that include only the sections that actually
|
|
6
|
+
* ran or had gates evaluated (gate-aware inclusion).
|
|
7
|
+
*
|
|
8
|
+
* Public API:
|
|
9
|
+
* generateBuildSummary(input): Promise<SummaryResult>
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.renderIntelligenceSection = void 0;
|
|
46
|
+
exports.generateBuildSummary = generateBuildSummary;
|
|
47
|
+
const fs = __importStar(require("fs"));
|
|
48
|
+
const path = __importStar(require("path"));
|
|
49
|
+
const markdownRenderer_1 = require("./markdownRenderer");
|
|
50
|
+
const evaluateMetrics_1 = require("./evaluateMetrics");
|
|
51
|
+
// ─── Build summary generator ──────────────────────────────────────────────────
|
|
52
|
+
/**
|
|
53
|
+
* Generate a full build/CI summary from analysis results.
|
|
54
|
+
*
|
|
55
|
+
* Gate-aware inclusion rules:
|
|
56
|
+
* - A section is included when: the analyzer ran (results present) OR the gate
|
|
57
|
+
* was explicitly configured for that category.
|
|
58
|
+
* - A section is omitted when: neither results nor gate configuration exist.
|
|
59
|
+
* - Security scanning section is included only when securityScan is provided.
|
|
60
|
+
*
|
|
61
|
+
* @param input All analysis results and configuration.
|
|
62
|
+
* @param outDir Optional directory to write output files to (e.g. "reports").
|
|
63
|
+
* When provided, writes pr-summary.md, build-summary.md,
|
|
64
|
+
* summary.json, ai-summary.md, and ai-summary.json.
|
|
65
|
+
*/
|
|
66
|
+
async function generateBuildSummary(input, outDir) {
|
|
67
|
+
const sections = buildSections(input);
|
|
68
|
+
const included = sections.filter((s) => s.included);
|
|
69
|
+
const headerLines = buildHeader(input, 'build');
|
|
70
|
+
const bodyLines = [];
|
|
71
|
+
for (const section of included) {
|
|
72
|
+
bodyLines.push(section.markdown);
|
|
73
|
+
}
|
|
74
|
+
const footer = buildFooter(input);
|
|
75
|
+
const markdown = [...headerLines, '', ...bodyLines, footer].join('\n');
|
|
76
|
+
const aiMarkdown = (0, markdownRenderer_1.renderAiSummary)(input, sections);
|
|
77
|
+
const json = buildJsonSummary(input, sections);
|
|
78
|
+
if (outDir) {
|
|
79
|
+
await writeOutputFiles(outDir, markdown, aiMarkdown, json);
|
|
80
|
+
}
|
|
81
|
+
return { markdown, sections, json };
|
|
82
|
+
}
|
|
83
|
+
// ─── Internals ────────────────────────────────────────────────────────────────
|
|
84
|
+
function buildHeader(input, mode) {
|
|
85
|
+
var _a, _b, _c;
|
|
86
|
+
const overallPassed = (_b = (_a = input.qualityGate) === null || _a === void 0 ? void 0 : _a.passed) !== null && _b !== void 0 ? _b : true;
|
|
87
|
+
const statusEmoji = overallPassed ? '✅' : '❌';
|
|
88
|
+
const title = mode === 'pr'
|
|
89
|
+
? `${statusEmoji} API Coverage — ${overallPassed ? 'PASSED' : 'FAILED'}`
|
|
90
|
+
: `## ${statusEmoji} API Coverage Report — ${overallPassed ? 'PASSED' : 'FAILED'}`;
|
|
91
|
+
const lines = [title, ''];
|
|
92
|
+
lines.push('| | |');
|
|
93
|
+
lines.push('|---|---|');
|
|
94
|
+
if (input.projectName)
|
|
95
|
+
lines.push((0, markdownRenderer_1.tableRow)('Project', input.projectName));
|
|
96
|
+
if (input.branch)
|
|
97
|
+
lines.push((0, markdownRenderer_1.tableRow)('Branch', input.branch));
|
|
98
|
+
if (input.commitSha)
|
|
99
|
+
lines.push((0, markdownRenderer_1.tableRow)('Commit', `\`${input.commitSha}\``));
|
|
100
|
+
if (input.buildId)
|
|
101
|
+
lines.push((0, markdownRenderer_1.tableRow)('Build ID', `\`${input.buildId}\``));
|
|
102
|
+
lines.push('');
|
|
103
|
+
// Coverage summary table — uses evaluated metrics for correct PASS/FAIL/N/A/SKIPPED
|
|
104
|
+
if (input.results.length > 0) {
|
|
105
|
+
const evaluatedMetrics = (0, evaluateMetrics_1.evaluateMetrics)(input.results, (_c = input.thresholds) !== null && _c !== void 0 ? _c : {}, input.qualityGate);
|
|
106
|
+
lines.push('### Coverage Summary');
|
|
107
|
+
lines.push('');
|
|
108
|
+
lines.push('| Category | Total | Covered | Coverage | Status |');
|
|
109
|
+
lines.push('|---|---|---|---|---|');
|
|
110
|
+
for (const m of evaluatedMetrics) {
|
|
111
|
+
const totalCell = m.applicable ? String(m.totalItems) : '—';
|
|
112
|
+
const coveredCell = m.applicable ? String(m.coveredItems) : '—';
|
|
113
|
+
const coverageCell = m.applicable ? (0, markdownRenderer_1.pct)(m.coveragePercent) : '—';
|
|
114
|
+
lines.push(`| ${m.category} | ${totalCell} | ${coveredCell} | ${coverageCell} | ${(0, markdownRenderer_1.metricStatusCell)(m.status)} |`);
|
|
115
|
+
}
|
|
116
|
+
lines.push('');
|
|
117
|
+
}
|
|
118
|
+
return lines;
|
|
119
|
+
}
|
|
120
|
+
function buildSections(input) {
|
|
121
|
+
var _a, _b, _c, _d, _e, _f;
|
|
122
|
+
const sections = [];
|
|
123
|
+
const thresholds = (_a = input.thresholds) !== null && _a !== void 0 ? _a : {};
|
|
124
|
+
const onlyEvaluated = (_c = (_b = input.summaryConfig) === null || _b === void 0 ? void 0 : _b.includeOnlyEvaluatedSections) !== null && _c !== void 0 ? _c : false;
|
|
125
|
+
// Coverage sections – one per result
|
|
126
|
+
for (const result of input.results) {
|
|
127
|
+
const threshold = thresholds[result.type];
|
|
128
|
+
const gateEvaluated = threshold !== undefined;
|
|
129
|
+
const failure = (_d = input.qualityGate) === null || _d === void 0 ? void 0 : _d.failures.find((f) => f.category === result.type);
|
|
130
|
+
const passed = gateEvaluated ? failure === undefined : undefined;
|
|
131
|
+
// Gate-aware inclusion: include if results ran, unless onlyEvaluated forces us to skip
|
|
132
|
+
const included = onlyEvaluated ? gateEvaluated : true;
|
|
133
|
+
sections.push({
|
|
134
|
+
id: result.type,
|
|
135
|
+
title: (0, markdownRenderer_1.coverageTypeTitle)(result.type),
|
|
136
|
+
included,
|
|
137
|
+
gateEvaluated,
|
|
138
|
+
passed,
|
|
139
|
+
markdown: included
|
|
140
|
+
? (0, markdownRenderer_1.renderCoverageSection)(result, threshold, failure !== undefined)
|
|
141
|
+
: '',
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
// Security scanning section
|
|
145
|
+
if (input.securityScan) {
|
|
146
|
+
const scannerResults = (_e = input.scannerResults) !== null && _e !== void 0 ? _e : [];
|
|
147
|
+
const gatePassed = (_f = input.securityScan.gateResult) === null || _f === void 0 ? void 0 : _f.passed;
|
|
148
|
+
const sectionGateEvaluated = input.securityScan.gateResult !== undefined;
|
|
149
|
+
const included = !onlyEvaluated || sectionGateEvaluated;
|
|
150
|
+
sections.push({
|
|
151
|
+
id: 'security-scan',
|
|
152
|
+
title: 'Security Scanning',
|
|
153
|
+
included,
|
|
154
|
+
gateEvaluated: sectionGateEvaluated,
|
|
155
|
+
passed: gatePassed,
|
|
156
|
+
markdown: included
|
|
157
|
+
? (0, markdownRenderer_1.renderSecurityScanSection)(input.securityScan, scannerResults, sectionGateEvaluated, gatePassed)
|
|
158
|
+
: '',
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
// Coverage Intelligence section
|
|
162
|
+
if (input.intelligenceSummary) {
|
|
163
|
+
sections.push({
|
|
164
|
+
id: 'coverage-intelligence',
|
|
165
|
+
title: 'Coverage Intelligence',
|
|
166
|
+
included: true,
|
|
167
|
+
gateEvaluated: false,
|
|
168
|
+
passed: undefined,
|
|
169
|
+
markdown: (0, markdownRenderer_1.renderIntelligenceSection)(input.intelligenceSummary),
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
return sections;
|
|
173
|
+
}
|
|
174
|
+
function buildFooter(input) {
|
|
175
|
+
var _a;
|
|
176
|
+
const lines = [];
|
|
177
|
+
// Failed gates summary
|
|
178
|
+
if (input.qualityGate && input.qualityGate.failures.length > 0) {
|
|
179
|
+
lines.push('### Failed Gates');
|
|
180
|
+
lines.push('');
|
|
181
|
+
for (const f of input.qualityGate.failures) {
|
|
182
|
+
lines.push(`- **${f.category}**: expected ≥ ${(0, markdownRenderer_1.pct)(f.expected)}, actual ${(0, markdownRenderer_1.pct)(f.actual)}, gap **${(0, markdownRenderer_1.pct)(f.gap)}**`);
|
|
183
|
+
}
|
|
184
|
+
lines.push('');
|
|
185
|
+
}
|
|
186
|
+
// Interpretation section
|
|
187
|
+
if (input.results.length > 0) {
|
|
188
|
+
const evaluatedMetrics = (0, evaluateMetrics_1.evaluateMetrics)(input.results, (_a = input.thresholds) !== null && _a !== void 0 ? _a : {}, input.qualityGate);
|
|
189
|
+
lines.push((0, markdownRenderer_1.renderInterpretationSection)(evaluatedMetrics));
|
|
190
|
+
}
|
|
191
|
+
// Links
|
|
192
|
+
if (input.pagesUrl) {
|
|
193
|
+
lines.push(`📊 **[View Full Report](${input.pagesUrl})**`);
|
|
194
|
+
lines.push('');
|
|
195
|
+
}
|
|
196
|
+
return lines.join('\n');
|
|
197
|
+
}
|
|
198
|
+
function buildJsonSummary(input, sections) {
|
|
199
|
+
var _a, _b, _c, _d, _e;
|
|
200
|
+
return {
|
|
201
|
+
generatedAt: new Date().toISOString(),
|
|
202
|
+
projectName: input.projectName,
|
|
203
|
+
branch: input.branch,
|
|
204
|
+
commitSha: input.commitSha,
|
|
205
|
+
buildId: input.buildId,
|
|
206
|
+
overallPassed: (_b = (_a = input.qualityGate) === null || _a === void 0 ? void 0 : _a.passed) !== null && _b !== void 0 ? _b : true,
|
|
207
|
+
coverage: input.results.map((r) => {
|
|
208
|
+
var _a, _b;
|
|
209
|
+
return ({
|
|
210
|
+
type: r.type,
|
|
211
|
+
totalItems: r.totalItems,
|
|
212
|
+
coveredItems: r.coveredItems,
|
|
213
|
+
coveragePercent: r.coveragePercent,
|
|
214
|
+
threshold: (_a = input.thresholds) === null || _a === void 0 ? void 0 : _a[r.type],
|
|
215
|
+
passed: !((_b = input.qualityGate) === null || _b === void 0 ? void 0 : _b.failures.some((f) => f.category === r.type)),
|
|
216
|
+
});
|
|
217
|
+
}),
|
|
218
|
+
failedGates: (_d = (_c = input.qualityGate) === null || _c === void 0 ? void 0 : _c.failures) !== null && _d !== void 0 ? _d : [],
|
|
219
|
+
sections: sections.map((s) => ({
|
|
220
|
+
id: s.id,
|
|
221
|
+
title: s.title,
|
|
222
|
+
included: s.included,
|
|
223
|
+
gateEvaluated: s.gateEvaluated,
|
|
224
|
+
passed: s.passed,
|
|
225
|
+
})),
|
|
226
|
+
securityScan: input.securityScan
|
|
227
|
+
? {
|
|
228
|
+
totalFindings: input.securityScan.totalFindings,
|
|
229
|
+
bySeverity: input.securityScan.bySeverity,
|
|
230
|
+
scannersRun: input.securityScan.scannersRun,
|
|
231
|
+
gatePassed: (_e = input.securityScan.gateResult) === null || _e === void 0 ? void 0 : _e.passed,
|
|
232
|
+
}
|
|
233
|
+
: undefined,
|
|
234
|
+
intelligence: input.intelligenceSummary
|
|
235
|
+
? {
|
|
236
|
+
totalFindings: input.intelligenceSummary.totalFindings,
|
|
237
|
+
totalRecommendations: input.intelligenceSummary.totalRecommendations,
|
|
238
|
+
maxRiskScore: input.intelligenceSummary.maxRiskScore,
|
|
239
|
+
avgRiskScore: input.intelligenceSummary.avgRiskScore,
|
|
240
|
+
criticalUncoveredItems: input.intelligenceSummary.criticalUncoveredItems,
|
|
241
|
+
unprotectedSecurityFindings: input.intelligenceSummary.unprotectedSecurityFindings,
|
|
242
|
+
recommendationsByPriority: input.intelligenceSummary.recommendationsByPriority,
|
|
243
|
+
topRiskAreas: input.intelligenceSummary.topRiskAreas,
|
|
244
|
+
}
|
|
245
|
+
: undefined,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
async function writeOutputFiles(outDir, buildMarkdown, aiMarkdown, json) {
|
|
249
|
+
var _a;
|
|
250
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
251
|
+
fs.writeFileSync(path.join(outDir, 'build-summary.md'), buildMarkdown, 'utf-8');
|
|
252
|
+
fs.writeFileSync(path.join(outDir, 'ai-summary.md'), aiMarkdown, 'utf-8');
|
|
253
|
+
fs.writeFileSync(path.join(outDir, 'summary.json'), JSON.stringify(json, null, 2), 'utf-8');
|
|
254
|
+
fs.writeFileSync(path.join(outDir, 'ai-summary.json'), JSON.stringify({ aiSummary: aiMarkdown, ...((_a = json) !== null && _a !== void 0 ? _a : {}) }, null, 2), 'utf-8');
|
|
255
|
+
}
|
|
256
|
+
var markdownRenderer_2 = require("./markdownRenderer");
|
|
257
|
+
Object.defineProperty(exports, "renderIntelligenceSection", { enumerable: true, get: function () { return markdownRenderer_2.renderIntelligenceSection; } });
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical metric evaluation model.
|
|
3
|
+
*
|
|
4
|
+
* evaluateMetrics() maps raw CoverageResult[] + thresholds → EvaluatedMetric[]
|
|
5
|
+
* with well-defined PASS / FAIL / SKIPPED / N/A semantics.
|
|
6
|
+
*
|
|
7
|
+
* Status rules (applied in priority order):
|
|
8
|
+
* 1. !executed → SKIPPED
|
|
9
|
+
* 2. executed && totalItems === 0 → N/A (nothing measurable)
|
|
10
|
+
* 3. executed && applicable && !gateEvaluated → N/A (no threshold set)
|
|
11
|
+
* 4. executed && gateEvaluated && passes → PASS
|
|
12
|
+
* 5. executed && gateEvaluated && fails → FAIL
|
|
13
|
+
*
|
|
14
|
+
* Critical invariant: totalItems === 0 → always N/A, never PASS.
|
|
15
|
+
*/
|
|
16
|
+
import type { CoverageResult } from '../reporting';
|
|
17
|
+
import type { QualityGateResult } from '../qualityGate';
|
|
18
|
+
import { type EvaluatedMetric } from './summaryTypes';
|
|
19
|
+
export { KNOWN_METRIC_TYPES } from './summaryTypes';
|
|
20
|
+
export type { EvaluatedMetric, MetricStatus } from './summaryTypes';
|
|
21
|
+
/**
|
|
22
|
+
* Evaluate all metrics and return EvaluatedMetric[] in KNOWN_METRIC_TYPES order,
|
|
23
|
+
* with any additional (plugin) types appended at the end.
|
|
24
|
+
*
|
|
25
|
+
* @param results Coverage results that actually ran.
|
|
26
|
+
* @param thresholds Per-type threshold map (may contain undefined values).
|
|
27
|
+
* @param qualityGate Quality gate result (may be undefined when no gate ran).
|
|
28
|
+
* @param knownTypes Ordered list of expected types (defaults to KNOWN_METRIC_TYPES).
|
|
29
|
+
*/
|
|
30
|
+
export declare function evaluateMetrics(results: CoverageResult[], thresholds: Record<string, number | undefined>, qualityGate: QualityGateResult | undefined, knownTypes?: string[]): EvaluatedMetric[];
|
|
31
|
+
//# sourceMappingURL=evaluateMetrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluateMetrics.d.ts","sourceRoot":"","sources":["../../../src/summary/evaluateMetrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,KAAK,eAAe,EAAyC,MAAM,gBAAgB,CAAC;AAE7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAIpE;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,cAAc,EAAE,EACzB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAC9C,WAAW,EAAE,iBAAiB,GAAG,SAAS,EAC1C,UAAU,GAAE,MAAM,EAAuB,GACxC,eAAe,EAAE,CAqBnB"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Canonical metric evaluation model.
|
|
4
|
+
*
|
|
5
|
+
* evaluateMetrics() maps raw CoverageResult[] + thresholds → EvaluatedMetric[]
|
|
6
|
+
* with well-defined PASS / FAIL / SKIPPED / N/A semantics.
|
|
7
|
+
*
|
|
8
|
+
* Status rules (applied in priority order):
|
|
9
|
+
* 1. !executed → SKIPPED
|
|
10
|
+
* 2. executed && totalItems === 0 → N/A (nothing measurable)
|
|
11
|
+
* 3. executed && applicable && !gateEvaluated → N/A (no threshold set)
|
|
12
|
+
* 4. executed && gateEvaluated && passes → PASS
|
|
13
|
+
* 5. executed && gateEvaluated && fails → FAIL
|
|
14
|
+
*
|
|
15
|
+
* Critical invariant: totalItems === 0 → always N/A, never PASS.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.KNOWN_METRIC_TYPES = void 0;
|
|
19
|
+
exports.evaluateMetrics = evaluateMetrics;
|
|
20
|
+
const markdownRenderer_1 = require("./markdownRenderer");
|
|
21
|
+
const summaryTypes_1 = require("./summaryTypes");
|
|
22
|
+
var summaryTypes_2 = require("./summaryTypes");
|
|
23
|
+
Object.defineProperty(exports, "KNOWN_METRIC_TYPES", { enumerable: true, get: function () { return summaryTypes_2.KNOWN_METRIC_TYPES; } });
|
|
24
|
+
// ─── Public API ───────────────────────────────────────────────────────────────
|
|
25
|
+
/**
|
|
26
|
+
* Evaluate all metrics and return EvaluatedMetric[] in KNOWN_METRIC_TYPES order,
|
|
27
|
+
* with any additional (plugin) types appended at the end.
|
|
28
|
+
*
|
|
29
|
+
* @param results Coverage results that actually ran.
|
|
30
|
+
* @param thresholds Per-type threshold map (may contain undefined values).
|
|
31
|
+
* @param qualityGate Quality gate result (may be undefined when no gate ran).
|
|
32
|
+
* @param knownTypes Ordered list of expected types (defaults to KNOWN_METRIC_TYPES).
|
|
33
|
+
*/
|
|
34
|
+
function evaluateMetrics(results, thresholds, qualityGate, knownTypes = summaryTypes_1.KNOWN_METRIC_TYPES) {
|
|
35
|
+
const resultByType = new Map();
|
|
36
|
+
for (const r of results) {
|
|
37
|
+
resultByType.set(r.type, r);
|
|
38
|
+
}
|
|
39
|
+
const evaluated = [];
|
|
40
|
+
// Process known types in canonical order
|
|
41
|
+
for (const type of knownTypes) {
|
|
42
|
+
evaluated.push(buildMetric(type, resultByType, thresholds, qualityGate));
|
|
43
|
+
}
|
|
44
|
+
// Append any plugin-added types not in knownTypes
|
|
45
|
+
for (const r of results) {
|
|
46
|
+
if (!knownTypes.includes(r.type)) {
|
|
47
|
+
evaluated.push(buildMetric(r.type, resultByType, thresholds, qualityGate));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return evaluated;
|
|
51
|
+
}
|
|
52
|
+
// ─── Internal helpers ─────────────────────────────────────────────────────────
|
|
53
|
+
function buildMetric(type, resultByType, thresholds, qualityGate) {
|
|
54
|
+
var _a, _b, _c;
|
|
55
|
+
const result = resultByType.get(type);
|
|
56
|
+
const executed = result !== undefined;
|
|
57
|
+
const totalItems = (_a = result === null || result === void 0 ? void 0 : result.totalItems) !== null && _a !== void 0 ? _a : 0;
|
|
58
|
+
const coveredItems = (_b = result === null || result === void 0 ? void 0 : result.coveredItems) !== null && _b !== void 0 ? _b : 0;
|
|
59
|
+
const coveragePercent = (_c = result === null || result === void 0 ? void 0 : result.coveragePercent) !== null && _c !== void 0 ? _c : 0;
|
|
60
|
+
const applicable = executed && totalItems > 0;
|
|
61
|
+
const threshold = thresholds[type];
|
|
62
|
+
const gateEvaluated = threshold !== undefined;
|
|
63
|
+
const { status, reason } = computeStatus({
|
|
64
|
+
executed,
|
|
65
|
+
applicable,
|
|
66
|
+
totalItems,
|
|
67
|
+
coveragePercent,
|
|
68
|
+
threshold,
|
|
69
|
+
gateEvaluated,
|
|
70
|
+
qualityGate,
|
|
71
|
+
type,
|
|
72
|
+
});
|
|
73
|
+
const topGaps = result && applicable
|
|
74
|
+
? (0, markdownRenderer_1.extractGaps)(result, 5)
|
|
75
|
+
: [];
|
|
76
|
+
return {
|
|
77
|
+
category: type,
|
|
78
|
+
executed,
|
|
79
|
+
applicable,
|
|
80
|
+
totalItems,
|
|
81
|
+
coveredItems,
|
|
82
|
+
coveragePercent,
|
|
83
|
+
threshold,
|
|
84
|
+
gateEvaluated,
|
|
85
|
+
status,
|
|
86
|
+
reason,
|
|
87
|
+
topGaps,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function computeStatus(opts) {
|
|
91
|
+
var _a;
|
|
92
|
+
const { executed, applicable, totalItems, coveragePercent, threshold, gateEvaluated, qualityGate, type } = opts;
|
|
93
|
+
if (!executed) {
|
|
94
|
+
return { status: 'SKIPPED', reason: 'Analyzer did not run for this type' };
|
|
95
|
+
}
|
|
96
|
+
if (totalItems === 0) {
|
|
97
|
+
return { status: 'N/A', reason: 'No items found to measure' };
|
|
98
|
+
}
|
|
99
|
+
if (!gateEvaluated) {
|
|
100
|
+
return { status: 'N/A', reason: 'No threshold configured — gate not evaluated' };
|
|
101
|
+
}
|
|
102
|
+
if (!applicable) {
|
|
103
|
+
// Should not reach here given totalItems > 0 implies applicable, but guard anyway
|
|
104
|
+
return { status: 'N/A', reason: 'Not applicable' };
|
|
105
|
+
}
|
|
106
|
+
const gateFailed = (_a = qualityGate === null || qualityGate === void 0 ? void 0 : qualityGate.failures.some((f) => f.category === type)) !== null && _a !== void 0 ? _a : false;
|
|
107
|
+
if (gateFailed) {
|
|
108
|
+
const gap = threshold - coveragePercent;
|
|
109
|
+
return {
|
|
110
|
+
status: 'FAIL',
|
|
111
|
+
reason: `Coverage ${coveragePercent.toFixed(2)}% is below threshold ${threshold.toFixed(2)}% (gap: ${gap.toFixed(2)}%)`,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
status: 'PASS',
|
|
116
|
+
reason: `Coverage ${coveragePercent.toFixed(2)}% meets threshold ${threshold.toFixed(2)}%`,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Summary engine – public entry point.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the full public API for the built-in summary engine.
|
|
5
|
+
*/
|
|
6
|
+
export { generateBuildSummary } from './buildSummary';
|
|
7
|
+
export { generatePrSummary } from './prSummary';
|
|
8
|
+
export type { SummaryInput, SummaryResult, SummarySection, SummaryConfig, } from './markdownRenderer';
|
|
9
|
+
export { coverageTypeTitle, renderCoverageSection, renderSecurityScanSection, renderAiSummary, renderIntelligenceSection, statusBadge, pct, tableRow, extractGaps, } from './markdownRenderer';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/summary/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EACV,YAAY,EACZ,aAAa,EACb,cAAc,EACd,aAAa,GACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,yBAAyB,EACzB,eAAe,EACf,yBAAyB,EACzB,WAAW,EACX,GAAG,EACH,QAAQ,EACR,WAAW,GACZ,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Summary engine – public entry point.
|
|
4
|
+
*
|
|
5
|
+
* Re-exports the full public API for the built-in summary engine.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.extractGaps = exports.tableRow = exports.pct = exports.statusBadge = exports.renderIntelligenceSection = exports.renderAiSummary = exports.renderSecurityScanSection = exports.renderCoverageSection = exports.coverageTypeTitle = exports.generatePrSummary = exports.generateBuildSummary = void 0;
|
|
9
|
+
var buildSummary_1 = require("./buildSummary");
|
|
10
|
+
Object.defineProperty(exports, "generateBuildSummary", { enumerable: true, get: function () { return buildSummary_1.generateBuildSummary; } });
|
|
11
|
+
var prSummary_1 = require("./prSummary");
|
|
12
|
+
Object.defineProperty(exports, "generatePrSummary", { enumerable: true, get: function () { return prSummary_1.generatePrSummary; } });
|
|
13
|
+
var markdownRenderer_1 = require("./markdownRenderer");
|
|
14
|
+
Object.defineProperty(exports, "coverageTypeTitle", { enumerable: true, get: function () { return markdownRenderer_1.coverageTypeTitle; } });
|
|
15
|
+
Object.defineProperty(exports, "renderCoverageSection", { enumerable: true, get: function () { return markdownRenderer_1.renderCoverageSection; } });
|
|
16
|
+
Object.defineProperty(exports, "renderSecurityScanSection", { enumerable: true, get: function () { return markdownRenderer_1.renderSecurityScanSection; } });
|
|
17
|
+
Object.defineProperty(exports, "renderAiSummary", { enumerable: true, get: function () { return markdownRenderer_1.renderAiSummary; } });
|
|
18
|
+
Object.defineProperty(exports, "renderIntelligenceSection", { enumerable: true, get: function () { return markdownRenderer_1.renderIntelligenceSection; } });
|
|
19
|
+
Object.defineProperty(exports, "statusBadge", { enumerable: true, get: function () { return markdownRenderer_1.statusBadge; } });
|
|
20
|
+
Object.defineProperty(exports, "pct", { enumerable: true, get: function () { return markdownRenderer_1.pct; } });
|
|
21
|
+
Object.defineProperty(exports, "tableRow", { enumerable: true, get: function () { return markdownRenderer_1.tableRow; } });
|
|
22
|
+
Object.defineProperty(exports, "extractGaps", { enumerable: true, get: function () { return markdownRenderer_1.extractGaps; } });
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Summary engine – low-level markdown rendering utilities and shared types.
|
|
3
|
+
*
|
|
4
|
+
* This module owns the SummaryResult type and the building blocks used by
|
|
5
|
+
* both generateBuildSummary and generatePrSummary.
|
|
6
|
+
*/
|
|
7
|
+
import type { CoverageResult } from '../reporting';
|
|
8
|
+
import type { QualityGateResult } from '../qualityGate';
|
|
9
|
+
import type { SecurityScanSummary, ScannerResult } from '../security/types';
|
|
10
|
+
import type { EvaluatedMetric, MetricStatus } from './summaryTypes';
|
|
11
|
+
/** A single rendered section inside a summary */
|
|
12
|
+
export interface SummarySection {
|
|
13
|
+
/** Stable machine-readable identifier (e.g. "endpoint", "security-scan") */
|
|
14
|
+
id: string;
|
|
15
|
+
/** Human-readable title shown as a Markdown heading */
|
|
16
|
+
title: string;
|
|
17
|
+
/** Whether this section was included in the final output */
|
|
18
|
+
included: boolean;
|
|
19
|
+
/** Whether a quality gate was configured and evaluated for this section */
|
|
20
|
+
gateEvaluated: boolean;
|
|
21
|
+
/** Gate pass/fail result – only present when gateEvaluated is true */
|
|
22
|
+
passed?: boolean;
|
|
23
|
+
/** The complete Markdown content for this section */
|
|
24
|
+
markdown: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The result returned by generateBuildSummary and generatePrSummary.
|
|
28
|
+
*
|
|
29
|
+
* markdown – The full rendered Markdown document.
|
|
30
|
+
* sections – Per-section metadata (used for gate-aware inclusion checking).
|
|
31
|
+
* json – Machine-readable representation of the same data.
|
|
32
|
+
*/
|
|
33
|
+
export interface SummaryResult {
|
|
34
|
+
markdown: string;
|
|
35
|
+
sections: SummarySection[];
|
|
36
|
+
json: unknown;
|
|
37
|
+
}
|
|
38
|
+
/** Input accepted by the summary generators */
|
|
39
|
+
export interface SummaryInput {
|
|
40
|
+
/** Coverage results from all analysis passes that actually ran */
|
|
41
|
+
results: CoverageResult[];
|
|
42
|
+
/** Quality gate evaluation output */
|
|
43
|
+
qualityGate?: QualityGateResult;
|
|
44
|
+
/** Security scan summary (if the security-scan command ran) */
|
|
45
|
+
securityScan?: SecurityScanSummary;
|
|
46
|
+
/** Individual scanner results (needed for per-scanner detail) */
|
|
47
|
+
scannerResults?: ScannerResult[];
|
|
48
|
+
/** Configured thresholds per category */
|
|
49
|
+
thresholds?: Record<string, number | undefined>;
|
|
50
|
+
/** Summary module configuration */
|
|
51
|
+
summaryConfig?: SummaryConfig;
|
|
52
|
+
/** Project name shown in the header */
|
|
53
|
+
projectName?: string;
|
|
54
|
+
/** Branch name */
|
|
55
|
+
branch?: string;
|
|
56
|
+
/** Commit SHA */
|
|
57
|
+
commitSha?: string;
|
|
58
|
+
/** Build identifier */
|
|
59
|
+
buildId?: string;
|
|
60
|
+
/** Full URL to the published Pages / HTML report */
|
|
61
|
+
pagesUrl?: string;
|
|
62
|
+
/** Coverage Intelligence summary (if the intelligence engine ran) */
|
|
63
|
+
intelligenceSummary?: {
|
|
64
|
+
totalFindings: number;
|
|
65
|
+
totalRecommendations: number;
|
|
66
|
+
maxRiskScore: number;
|
|
67
|
+
avgRiskScore: number;
|
|
68
|
+
criticalUncoveredItems: number;
|
|
69
|
+
unprotectedSecurityFindings: number;
|
|
70
|
+
recommendationsByPriority: Record<string, number>;
|
|
71
|
+
topRiskAreas: string[];
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** Summary module configuration block (mirrors coverage.config.json "summary" key) */
|
|
75
|
+
export interface SummaryConfig {
|
|
76
|
+
enabled?: boolean;
|
|
77
|
+
generatePrSummary?: boolean;
|
|
78
|
+
generateBuildSummary?: boolean;
|
|
79
|
+
generateAiSummary?: boolean;
|
|
80
|
+
includeOnlyEvaluatedSections?: boolean;
|
|
81
|
+
publishPrComment?: boolean;
|
|
82
|
+
publishGithubStepSummary?: boolean;
|
|
83
|
+
publishJenkinsSummary?: boolean;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Map a coverage-type string to a human-readable title.
|
|
87
|
+
*/
|
|
88
|
+
export declare function coverageTypeTitle(type: string): string;
|
|
89
|
+
/**
|
|
90
|
+
* Render a two-column Markdown table row.
|
|
91
|
+
*/
|
|
92
|
+
export declare function tableRow(label: string, value: string): string;
|
|
93
|
+
/**
|
|
94
|
+
* Render a status badge string.
|
|
95
|
+
* "PASS" or "FAIL" – explicit wording, no ambiguous icons.
|
|
96
|
+
*/
|
|
97
|
+
export declare function statusBadge(passed: boolean): string;
|
|
98
|
+
/**
|
|
99
|
+
* Render the coverage percentage with two decimal places.
|
|
100
|
+
*/
|
|
101
|
+
export declare function pct(value: number): string;
|
|
102
|
+
/**
|
|
103
|
+
* Render the gap list items from a CoverageResult's details field.
|
|
104
|
+
* Returns up to `limit` bullet items.
|
|
105
|
+
*/
|
|
106
|
+
export declare function extractGaps(result: CoverageResult, limit?: number): string[];
|
|
107
|
+
/**
|
|
108
|
+
* Render a full coverage section in the structured Markdown format required by
|
|
109
|
+
* the problem spec (§2).
|
|
110
|
+
*
|
|
111
|
+
* @param result Coverage result for this category.
|
|
112
|
+
* @param threshold Configured threshold for this category (may be undefined).
|
|
113
|
+
* @param gateFailure Whether the gate failed for this category.
|
|
114
|
+
*/
|
|
115
|
+
export declare function renderCoverageSection(result: CoverageResult, threshold: number | undefined, gateFailure: boolean): string;
|
|
116
|
+
/**
|
|
117
|
+
* Render the security scanning section.
|
|
118
|
+
*/
|
|
119
|
+
export declare function renderSecurityScanSection(securityScan: SecurityScanSummary, scannerResults: ScannerResult[], gateEvaluated: boolean, gatePassed: boolean | undefined): string;
|
|
120
|
+
/**
|
|
121
|
+
* Render the status cell for a metric row in the coverage summary table.
|
|
122
|
+
* These are the only four valid statuses — ⚠️ PASS does not exist.
|
|
123
|
+
*/
|
|
124
|
+
export declare function metricStatusCell(status: MetricStatus): string;
|
|
125
|
+
/**
|
|
126
|
+
* Render the "Summary Interpretation" section that explains what each metric
|
|
127
|
+
* status means in plain language. Suitable for AI agents and humans alike.
|
|
128
|
+
*/
|
|
129
|
+
export declare function renderInterpretationSection(metrics: EvaluatedMetric[]): string;
|
|
130
|
+
/**
|
|
131
|
+
* Render the AI-friendly summary markdown.
|
|
132
|
+
* Optimized for consumption by AI agents (test generators, fixers, etc.)
|
|
133
|
+
*/
|
|
134
|
+
export declare function renderAiSummary(input: SummaryInput, sections: SummarySection[]): string;
|
|
135
|
+
/**
|
|
136
|
+
* Render a Coverage Intelligence section for inclusion in build/PR summaries.
|
|
137
|
+
*/
|
|
138
|
+
export declare function renderIntelligenceSection(intel: NonNullable<SummaryInput['intelligenceSummary']>): string;
|
|
139
|
+
//# sourceMappingURL=markdownRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdownRenderer.d.ts","sourceRoot":"","sources":["../../../src/summary/markdownRenderer.ts"],"names":[],"mappings":"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"}
|