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,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP integration – prompt builders.
|
|
3
|
+
*
|
|
4
|
+
* Each builder produces a deterministic, structured prompt for a specific
|
|
5
|
+
* analysis category. All prompts include analysis scope, metrics, gate
|
|
6
|
+
* status, and a request for structured output.
|
|
7
|
+
*/
|
|
8
|
+
import type { McpPromptRequest } from '../types';
|
|
9
|
+
import type { CoverageResult } from '../../reporting';
|
|
10
|
+
import type { SecurityScanSummary } from '../../security/types';
|
|
11
|
+
export interface CoverageSummaryPromptInput {
|
|
12
|
+
results: CoverageResult[];
|
|
13
|
+
thresholds?: Record<string, number | undefined>;
|
|
14
|
+
projectName?: string;
|
|
15
|
+
branch?: string;
|
|
16
|
+
commitSha?: string;
|
|
17
|
+
gatePassed?: boolean;
|
|
18
|
+
failedCategories?: string[];
|
|
19
|
+
}
|
|
20
|
+
export declare function buildCoverageSummaryPrompt(input: CoverageSummaryPromptInput): McpPromptRequest;
|
|
21
|
+
export interface SecurityScanPromptInput {
|
|
22
|
+
scanSummary: SecurityScanSummary;
|
|
23
|
+
projectName?: string;
|
|
24
|
+
branch?: string;
|
|
25
|
+
commitSha?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function buildSecurityScanPrompt(input: SecurityScanPromptInput): McpPromptRequest;
|
|
28
|
+
export interface PerformancePromptInput {
|
|
29
|
+
coveragePercent: number;
|
|
30
|
+
totalScenarios: number;
|
|
31
|
+
coveredScenarios: number;
|
|
32
|
+
uncoveredScenarios?: string[];
|
|
33
|
+
projectName?: string;
|
|
34
|
+
branch?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare function buildPerformancePrompt(input: PerformancePromptInput): McpPromptRequest;
|
|
37
|
+
export interface CompatibilityPromptInput {
|
|
38
|
+
compatibilityPercent: number;
|
|
39
|
+
breakingChanges: number;
|
|
40
|
+
totalEndpoints: number;
|
|
41
|
+
projectName?: string;
|
|
42
|
+
branch?: string;
|
|
43
|
+
}
|
|
44
|
+
export declare function buildCompatibilityPrompt(input: CompatibilityPromptInput): McpPromptRequest;
|
|
45
|
+
export interface IntelligencePromptInput {
|
|
46
|
+
totalFindings: number;
|
|
47
|
+
totalRecommendations: number;
|
|
48
|
+
maxRiskScore: number;
|
|
49
|
+
avgRiskScore: number;
|
|
50
|
+
criticalUncoveredItems: number;
|
|
51
|
+
unprotectedSecurityFindings: number;
|
|
52
|
+
recommendationsByPriority: Record<string, number>;
|
|
53
|
+
topFindings: Array<{
|
|
54
|
+
category: string;
|
|
55
|
+
severity: string;
|
|
56
|
+
title: string;
|
|
57
|
+
endpoint?: {
|
|
58
|
+
method?: string;
|
|
59
|
+
path?: string;
|
|
60
|
+
};
|
|
61
|
+
}>;
|
|
62
|
+
topRecommendations: Array<{
|
|
63
|
+
priority: string;
|
|
64
|
+
riskScore: number;
|
|
65
|
+
title: string;
|
|
66
|
+
recommendedTestType: string;
|
|
67
|
+
likelyLanguage?: string;
|
|
68
|
+
likelyFramework?: string;
|
|
69
|
+
}>;
|
|
70
|
+
languages?: string[];
|
|
71
|
+
frameworks?: string[];
|
|
72
|
+
projectName?: string;
|
|
73
|
+
branch?: string;
|
|
74
|
+
}
|
|
75
|
+
export declare function buildIntelligencePrompt(input: IntelligencePromptInput): McpPromptRequest;
|
|
76
|
+
export interface CiSummaryPromptInput {
|
|
77
|
+
overallPassed: boolean;
|
|
78
|
+
coverageResults: CoverageResult[];
|
|
79
|
+
failedGates: string[];
|
|
80
|
+
projectName?: string;
|
|
81
|
+
branch?: string;
|
|
82
|
+
commitSha?: string;
|
|
83
|
+
buildId?: string;
|
|
84
|
+
}
|
|
85
|
+
export declare function buildCiSummaryPrompt(input: CiSummaryPromptInput): McpPromptRequest;
|
|
86
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp/prompts/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MCP integration – prompt builders.
|
|
4
|
+
*
|
|
5
|
+
* Each builder produces a deterministic, structured prompt for a specific
|
|
6
|
+
* analysis category. All prompts include analysis scope, metrics, gate
|
|
7
|
+
* status, and a request for structured output.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.buildCoverageSummaryPrompt = buildCoverageSummaryPrompt;
|
|
11
|
+
exports.buildSecurityScanPrompt = buildSecurityScanPrompt;
|
|
12
|
+
exports.buildPerformancePrompt = buildPerformancePrompt;
|
|
13
|
+
exports.buildCompatibilityPrompt = buildCompatibilityPrompt;
|
|
14
|
+
exports.buildIntelligencePrompt = buildIntelligencePrompt;
|
|
15
|
+
exports.buildCiSummaryPrompt = buildCiSummaryPrompt;
|
|
16
|
+
function buildCoverageSummaryPrompt(input) {
|
|
17
|
+
var _a, _b, _c, _d;
|
|
18
|
+
const lines = [
|
|
19
|
+
'Analyze the following API test coverage results.',
|
|
20
|
+
'',
|
|
21
|
+
'## Context',
|
|
22
|
+
];
|
|
23
|
+
if (input.projectName)
|
|
24
|
+
lines.push(`Project: ${input.projectName}`);
|
|
25
|
+
if (input.branch)
|
|
26
|
+
lines.push(`Branch: ${input.branch}`);
|
|
27
|
+
if (input.commitSha)
|
|
28
|
+
lines.push(`Commit: ${input.commitSha}`);
|
|
29
|
+
lines.push('');
|
|
30
|
+
lines.push('## Coverage Metrics');
|
|
31
|
+
for (const r of input.results) {
|
|
32
|
+
const threshold = (_a = input.thresholds) === null || _a === void 0 ? void 0 : _a[r.type];
|
|
33
|
+
const status = threshold !== undefined
|
|
34
|
+
? r.coveragePercent >= threshold ? 'PASS' : 'FAIL'
|
|
35
|
+
: 'no gate';
|
|
36
|
+
lines.push(`- ${r.type}: ${r.coveragePercent.toFixed(2)}% ` +
|
|
37
|
+
`(${r.coveredItems}/${r.totalItems} covered) [${status}]` +
|
|
38
|
+
(threshold !== undefined ? ` threshold=${threshold}%` : ''));
|
|
39
|
+
}
|
|
40
|
+
lines.push('');
|
|
41
|
+
if (((_c = (_b = input.failedCategories) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0) > 0) {
|
|
42
|
+
lines.push(`## Failed Gates`);
|
|
43
|
+
lines.push(input.failedCategories.join(', '));
|
|
44
|
+
lines.push('');
|
|
45
|
+
}
|
|
46
|
+
lines.push('## Required Output');
|
|
47
|
+
lines.push('Provide a JSON response with the following fields:');
|
|
48
|
+
lines.push('- summary (string): one-paragraph executive summary');
|
|
49
|
+
lines.push('- keyFindings (string[]): bullet-point key findings');
|
|
50
|
+
lines.push('- topRisks (string[]): top risk items ordered by severity');
|
|
51
|
+
lines.push('- recommendedActions (string[]): concrete recommended actions');
|
|
52
|
+
lines.push('- missingCoverageAreas (string[]): specific coverage gaps');
|
|
53
|
+
lines.push('- confidence ("low"|"medium"|"high")');
|
|
54
|
+
return {
|
|
55
|
+
category: 'coverage',
|
|
56
|
+
prompt: lines.join('\n'),
|
|
57
|
+
context: {
|
|
58
|
+
projectName: input.projectName,
|
|
59
|
+
branch: input.branch,
|
|
60
|
+
commitSha: input.commitSha,
|
|
61
|
+
results: input.results.map((r) => {
|
|
62
|
+
var _a;
|
|
63
|
+
return ({
|
|
64
|
+
type: r.type,
|
|
65
|
+
coveragePercent: r.coveragePercent,
|
|
66
|
+
coveredItems: r.coveredItems,
|
|
67
|
+
totalItems: r.totalItems,
|
|
68
|
+
threshold: (_a = input.thresholds) === null || _a === void 0 ? void 0 : _a[r.type],
|
|
69
|
+
});
|
|
70
|
+
}),
|
|
71
|
+
gatePassed: input.gatePassed,
|
|
72
|
+
failedCategories: (_d = input.failedCategories) !== null && _d !== void 0 ? _d : [],
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function buildSecurityScanPrompt(input) {
|
|
77
|
+
var _a, _b, _c;
|
|
78
|
+
const s = input.scanSummary;
|
|
79
|
+
const lines = [
|
|
80
|
+
'Analyze the following security scan results for an API project.',
|
|
81
|
+
'',
|
|
82
|
+
'## Context',
|
|
83
|
+
];
|
|
84
|
+
if (input.projectName)
|
|
85
|
+
lines.push(`Project: ${input.projectName}`);
|
|
86
|
+
if (input.branch)
|
|
87
|
+
lines.push(`Branch: ${input.branch}`);
|
|
88
|
+
if (input.commitSha)
|
|
89
|
+
lines.push(`Commit: ${input.commitSha}`);
|
|
90
|
+
lines.push('');
|
|
91
|
+
lines.push('## Security Findings');
|
|
92
|
+
lines.push(`Total findings: ${s.totalFindings}`);
|
|
93
|
+
lines.push(`Critical: ${s.bySeverity.CRITICAL}`);
|
|
94
|
+
lines.push(`High: ${s.bySeverity.HIGH}`);
|
|
95
|
+
lines.push(`Medium: ${s.bySeverity.MEDIUM}`);
|
|
96
|
+
lines.push(`Low: ${s.bySeverity.LOW}`);
|
|
97
|
+
lines.push(`Scanners run: ${s.scannersRun.join(', ')}`);
|
|
98
|
+
lines.push(`Gate passed: ${(_b = (_a = s.gateResult) === null || _a === void 0 ? void 0 : _a.passed) !== null && _b !== void 0 ? _b : 'not evaluated'}`);
|
|
99
|
+
lines.push('');
|
|
100
|
+
const blocking = s.findings
|
|
101
|
+
.filter((f) => f.severity === 'HIGH' || f.severity === 'CRITICAL')
|
|
102
|
+
.slice(0, 10);
|
|
103
|
+
if (blocking.length > 0) {
|
|
104
|
+
lines.push('## High / Critical Findings');
|
|
105
|
+
for (const f of blocking) {
|
|
106
|
+
lines.push(`- [${f.severity}] ${f.title} — ${f.category}`);
|
|
107
|
+
}
|
|
108
|
+
lines.push('');
|
|
109
|
+
}
|
|
110
|
+
lines.push('## Required Output');
|
|
111
|
+
lines.push('Provide a JSON response with:');
|
|
112
|
+
lines.push('- summary (string): executive summary of security posture');
|
|
113
|
+
lines.push('- keyFindings (string[]): key security findings');
|
|
114
|
+
lines.push('- topRisks (string[]): top risks by severity');
|
|
115
|
+
lines.push('- recommendedActions (string[]): remediation steps');
|
|
116
|
+
lines.push('- likelyRootCauses (string[]): probable root causes');
|
|
117
|
+
lines.push('- confidence ("low"|"medium"|"high")');
|
|
118
|
+
return {
|
|
119
|
+
category: 'security',
|
|
120
|
+
prompt: lines.join('\n'),
|
|
121
|
+
context: {
|
|
122
|
+
projectName: input.projectName,
|
|
123
|
+
branch: input.branch,
|
|
124
|
+
commitSha: input.commitSha,
|
|
125
|
+
totalFindings: s.totalFindings,
|
|
126
|
+
bySeverity: s.bySeverity,
|
|
127
|
+
byCategory: s.byCategory,
|
|
128
|
+
scannersRun: s.scannersRun,
|
|
129
|
+
gatePassed: (_c = s.gateResult) === null || _c === void 0 ? void 0 : _c.passed,
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function buildPerformancePrompt(input) {
|
|
134
|
+
var _a, _b, _c;
|
|
135
|
+
const lines = [
|
|
136
|
+
'Analyze the following performance and resilience test coverage.',
|
|
137
|
+
'',
|
|
138
|
+
'## Metrics',
|
|
139
|
+
`Coverage: ${input.coveragePercent.toFixed(2)}%`,
|
|
140
|
+
`Scenarios: ${input.coveredScenarios}/${input.totalScenarios} covered`,
|
|
141
|
+
];
|
|
142
|
+
if (((_b = (_a = input.uncoveredScenarios) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
143
|
+
lines.push('');
|
|
144
|
+
lines.push('## Uncovered Scenarios');
|
|
145
|
+
for (const s of input.uncoveredScenarios.slice(0, 10)) {
|
|
146
|
+
lines.push(`- ${s}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
lines.push('');
|
|
150
|
+
lines.push('## Required Output');
|
|
151
|
+
lines.push('Provide a JSON response with: summary, keyFindings, topRisks, recommendedActions, confidence');
|
|
152
|
+
return {
|
|
153
|
+
category: 'performance',
|
|
154
|
+
prompt: lines.join('\n'),
|
|
155
|
+
context: {
|
|
156
|
+
projectName: input.projectName,
|
|
157
|
+
branch: input.branch,
|
|
158
|
+
coveragePercent: input.coveragePercent,
|
|
159
|
+
totalScenarios: input.totalScenarios,
|
|
160
|
+
coveredScenarios: input.coveredScenarios,
|
|
161
|
+
uncoveredScenarios: (_c = input.uncoveredScenarios) !== null && _c !== void 0 ? _c : [],
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function buildCompatibilityPrompt(input) {
|
|
166
|
+
const lines = [
|
|
167
|
+
'Analyze the following API compatibility and contract coverage results.',
|
|
168
|
+
'',
|
|
169
|
+
'## Metrics',
|
|
170
|
+
`Compatibility: ${input.compatibilityPercent.toFixed(2)}%`,
|
|
171
|
+
`Breaking changes: ${input.breakingChanges}`,
|
|
172
|
+
`Endpoints analyzed: ${input.totalEndpoints}`,
|
|
173
|
+
'',
|
|
174
|
+
'## Required Output',
|
|
175
|
+
'Provide a JSON response with: summary, keyFindings, topRisks, recommendedActions, confidence',
|
|
176
|
+
];
|
|
177
|
+
return {
|
|
178
|
+
category: 'compatibility',
|
|
179
|
+
prompt: lines.join('\n'),
|
|
180
|
+
context: {
|
|
181
|
+
projectName: input.projectName,
|
|
182
|
+
branch: input.branch,
|
|
183
|
+
compatibilityPercent: input.compatibilityPercent,
|
|
184
|
+
breakingChanges: input.breakingChanges,
|
|
185
|
+
totalEndpoints: input.totalEndpoints,
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function buildIntelligencePrompt(input) {
|
|
190
|
+
var _a, _b, _c, _d, _e, _f;
|
|
191
|
+
const lines = [
|
|
192
|
+
'Analyze the following Coverage Intelligence results for an API project.',
|
|
193
|
+
'',
|
|
194
|
+
'## Context',
|
|
195
|
+
];
|
|
196
|
+
if (input.projectName)
|
|
197
|
+
lines.push(`Project: ${input.projectName}`);
|
|
198
|
+
if (input.branch)
|
|
199
|
+
lines.push(`Branch: ${input.branch}`);
|
|
200
|
+
if ((_a = input.languages) === null || _a === void 0 ? void 0 : _a.length)
|
|
201
|
+
lines.push(`Languages: ${input.languages.join(', ')}`);
|
|
202
|
+
if ((_b = input.frameworks) === null || _b === void 0 ? void 0 : _b.length)
|
|
203
|
+
lines.push(`Frameworks: ${input.frameworks.join(', ')}`);
|
|
204
|
+
lines.push('');
|
|
205
|
+
lines.push('## Intelligence Summary');
|
|
206
|
+
lines.push(`Total functional findings: ${input.totalFindings}`);
|
|
207
|
+
lines.push(`Total missing test recommendations: ${input.totalRecommendations}`);
|
|
208
|
+
lines.push(`Max risk score: ${input.maxRiskScore}`);
|
|
209
|
+
lines.push(`Avg risk score: ${input.avgRiskScore}`);
|
|
210
|
+
lines.push(`Critical uncovered items: ${input.criticalUncoveredItems}`);
|
|
211
|
+
lines.push(`Unprotected security findings: ${input.unprotectedSecurityFindings}`);
|
|
212
|
+
lines.push('');
|
|
213
|
+
lines.push('## Recommendations by Priority');
|
|
214
|
+
for (const [p, count] of Object.entries(input.recommendationsByPriority)) {
|
|
215
|
+
lines.push(`- ${p}: ${count}`);
|
|
216
|
+
}
|
|
217
|
+
lines.push('');
|
|
218
|
+
if (input.topFindings.length > 0) {
|
|
219
|
+
lines.push('## Top Functional Findings');
|
|
220
|
+
for (const f of input.topFindings.slice(0, 10)) {
|
|
221
|
+
const ep = f.endpoint ? ` [${(_c = f.endpoint.method) !== null && _c !== void 0 ? _c : ''} ${(_d = f.endpoint.path) !== null && _d !== void 0 ? _d : ''}]`.trim() : '';
|
|
222
|
+
lines.push(`- [${f.severity}] ${f.title}${ep} (${f.category})`);
|
|
223
|
+
}
|
|
224
|
+
lines.push('');
|
|
225
|
+
}
|
|
226
|
+
if (input.topRecommendations.length > 0) {
|
|
227
|
+
lines.push('## Top Missing Test Recommendations');
|
|
228
|
+
for (const r of input.topRecommendations.slice(0, 10)) {
|
|
229
|
+
lines.push(`- [${r.priority}] ${r.title} (risk: ${r.riskScore}, type: ${r.recommendedTestType})`);
|
|
230
|
+
}
|
|
231
|
+
lines.push('');
|
|
232
|
+
}
|
|
233
|
+
lines.push('## Required Output');
|
|
234
|
+
lines.push('Provide a JSON response with:');
|
|
235
|
+
lines.push('- summary (string): executive summary of testing intelligence gaps');
|
|
236
|
+
lines.push('- keyFindings (string[]): key functional findings');
|
|
237
|
+
lines.push('- topRisks (string[]): top risks ordered by severity and risk score');
|
|
238
|
+
lines.push('- recommendedActions (string[]): prioritized actions to close gaps');
|
|
239
|
+
lines.push('- missingCoverageAreas (string[]): specific areas lacking test coverage');
|
|
240
|
+
lines.push('- confidence ("low"|"medium"|"high")');
|
|
241
|
+
return {
|
|
242
|
+
category: 'intelligence',
|
|
243
|
+
prompt: lines.join('\n'),
|
|
244
|
+
context: {
|
|
245
|
+
projectName: input.projectName,
|
|
246
|
+
branch: input.branch,
|
|
247
|
+
totalFindings: input.totalFindings,
|
|
248
|
+
totalRecommendations: input.totalRecommendations,
|
|
249
|
+
maxRiskScore: input.maxRiskScore,
|
|
250
|
+
avgRiskScore: input.avgRiskScore,
|
|
251
|
+
criticalUncoveredItems: input.criticalUncoveredItems,
|
|
252
|
+
unprotectedSecurityFindings: input.unprotectedSecurityFindings,
|
|
253
|
+
recommendationsByPriority: input.recommendationsByPriority,
|
|
254
|
+
languages: (_e = input.languages) !== null && _e !== void 0 ? _e : [],
|
|
255
|
+
frameworks: (_f = input.frameworks) !== null && _f !== void 0 ? _f : [],
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function buildCiSummaryPrompt(input) {
|
|
260
|
+
const lines = [
|
|
261
|
+
'Summarize the following CI API coverage analysis for a PR/build comment.',
|
|
262
|
+
'',
|
|
263
|
+
'## Build Context',
|
|
264
|
+
];
|
|
265
|
+
if (input.projectName)
|
|
266
|
+
lines.push(`Project: ${input.projectName}`);
|
|
267
|
+
if (input.branch)
|
|
268
|
+
lines.push(`Branch: ${input.branch}`);
|
|
269
|
+
if (input.commitSha)
|
|
270
|
+
lines.push(`Commit: ${input.commitSha}`);
|
|
271
|
+
if (input.buildId)
|
|
272
|
+
lines.push(`Build ID: ${input.buildId}`);
|
|
273
|
+
lines.push(`Overall gate: ${input.overallPassed ? 'PASSED' : 'FAILED'}`);
|
|
274
|
+
lines.push('');
|
|
275
|
+
if (input.failedGates.length > 0) {
|
|
276
|
+
lines.push('## Failed Gates');
|
|
277
|
+
lines.push(input.failedGates.join(', '));
|
|
278
|
+
lines.push('');
|
|
279
|
+
}
|
|
280
|
+
lines.push('## Coverage Summary');
|
|
281
|
+
for (const r of input.coverageResults) {
|
|
282
|
+
lines.push(`- ${r.type}: ${r.coveragePercent.toFixed(2)}%`);
|
|
283
|
+
}
|
|
284
|
+
lines.push('');
|
|
285
|
+
lines.push('## Required Output');
|
|
286
|
+
lines.push('Provide a concise JSON summary suitable for a PR comment:');
|
|
287
|
+
lines.push('summary, keyFindings, topRisks, recommendedActions, confidence');
|
|
288
|
+
return {
|
|
289
|
+
category: 'ci-summary',
|
|
290
|
+
prompt: lines.join('\n'),
|
|
291
|
+
context: {
|
|
292
|
+
overallPassed: input.overallPassed,
|
|
293
|
+
projectName: input.projectName,
|
|
294
|
+
branch: input.branch,
|
|
295
|
+
commitSha: input.commitSha,
|
|
296
|
+
buildId: input.buildId,
|
|
297
|
+
failedGates: input.failedGates,
|
|
298
|
+
coverageResults: input.coverageResults.map((r) => ({
|
|
299
|
+
type: r.type,
|
|
300
|
+
coveragePercent: r.coveragePercent,
|
|
301
|
+
})),
|
|
302
|
+
},
|
|
303
|
+
};
|
|
304
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP integration – template mapper.
|
|
3
|
+
*
|
|
4
|
+
* Converts a NormalizedAiAnalysis into rendered markdown/HTML sections that
|
|
5
|
+
* can be embedded in dashboard pages, PR comments, and build summaries.
|
|
6
|
+
*/
|
|
7
|
+
import type { NormalizedAiAnalysis, TemplateContext } from '../types';
|
|
8
|
+
/**
|
|
9
|
+
* Render a NormalizedAiAnalysis as a collapsible Markdown section.
|
|
10
|
+
* Compatible with GitHub Flavoured Markdown `<details>` blocks.
|
|
11
|
+
*/
|
|
12
|
+
export declare function renderAiAnalysisMarkdown(ctx: TemplateContext): string;
|
|
13
|
+
/**
|
|
14
|
+
* Render a NormalizedAiAnalysis as an HTML `<details>` block.
|
|
15
|
+
* Used in published HTML reports.
|
|
16
|
+
*/
|
|
17
|
+
export declare function renderAiAnalysisHtml(ctx: TemplateContext): string;
|
|
18
|
+
/**
|
|
19
|
+
* Convert a NormalizedAiAnalysis into a plain-object panel data structure
|
|
20
|
+
* consumed by the React dashboard.
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildAiPanelData(analysis: NormalizedAiAnalysis): AiPanelData;
|
|
23
|
+
/** Data shape consumed by the AiSummaryPanel React component */
|
|
24
|
+
export interface AiPanelData {
|
|
25
|
+
summary: string;
|
|
26
|
+
keyFindings: string[];
|
|
27
|
+
topRisks: string[];
|
|
28
|
+
recommendedActions: string[];
|
|
29
|
+
missingCoverageAreas: string[];
|
|
30
|
+
likelyRootCauses: string[];
|
|
31
|
+
confidence: string;
|
|
32
|
+
isFallback: boolean;
|
|
33
|
+
category: string;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp/templates/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAItE;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CA4DrE;AAID;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAoDjE;AAID;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,WAAW,CAY5E;AAED,gEAAgE;AAChE,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MCP integration – template mapper.
|
|
4
|
+
*
|
|
5
|
+
* Converts a NormalizedAiAnalysis into rendered markdown/HTML sections that
|
|
6
|
+
* can be embedded in dashboard pages, PR comments, and build summaries.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.renderAiAnalysisMarkdown = renderAiAnalysisMarkdown;
|
|
10
|
+
exports.renderAiAnalysisHtml = renderAiAnalysisHtml;
|
|
11
|
+
exports.buildAiPanelData = buildAiPanelData;
|
|
12
|
+
// ─── Markdown template ────────────────────────────────────────────────────────
|
|
13
|
+
/**
|
|
14
|
+
* Render a NormalizedAiAnalysis as a collapsible Markdown section.
|
|
15
|
+
* Compatible with GitHub Flavoured Markdown `<details>` blocks.
|
|
16
|
+
*/
|
|
17
|
+
function renderAiAnalysisMarkdown(ctx) {
|
|
18
|
+
var _a, _b, _c, _d;
|
|
19
|
+
const { analysis, categoryTitle, mcpEnabled, serverRef } = ctx;
|
|
20
|
+
const title = categoryTitle !== null && categoryTitle !== void 0 ? categoryTitle : ctx.category;
|
|
21
|
+
const lines = [
|
|
22
|
+
`<details>`,
|
|
23
|
+
`<summary>🤖 AI Analysis — ${title}${analysis.isFallback ? ' (fallback mode)' : ''}</summary>`,
|
|
24
|
+
'',
|
|
25
|
+
`### ${title} — AI Insights`,
|
|
26
|
+
'',
|
|
27
|
+
`**Summary:** ${analysis.summary}`,
|
|
28
|
+
'',
|
|
29
|
+
];
|
|
30
|
+
if (analysis.keyFindings.length > 0) {
|
|
31
|
+
lines.push('**Key Findings:**');
|
|
32
|
+
for (const f of analysis.keyFindings)
|
|
33
|
+
lines.push(`- ${f}`);
|
|
34
|
+
lines.push('');
|
|
35
|
+
}
|
|
36
|
+
if (analysis.topRisks.length > 0) {
|
|
37
|
+
lines.push('**Top Risks:**');
|
|
38
|
+
for (const r of analysis.topRisks)
|
|
39
|
+
lines.push(`- ${r}`);
|
|
40
|
+
lines.push('');
|
|
41
|
+
}
|
|
42
|
+
if (((_b = (_a = analysis.missingCoverageAreas) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
43
|
+
lines.push('**Missing Coverage Areas:**');
|
|
44
|
+
for (const a of analysis.missingCoverageAreas)
|
|
45
|
+
lines.push(`- ${a}`);
|
|
46
|
+
lines.push('');
|
|
47
|
+
}
|
|
48
|
+
if (((_d = (_c = analysis.likelyRootCauses) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0) {
|
|
49
|
+
lines.push('**Likely Root Causes:**');
|
|
50
|
+
for (const c of analysis.likelyRootCauses)
|
|
51
|
+
lines.push(`- ${c}`);
|
|
52
|
+
lines.push('');
|
|
53
|
+
}
|
|
54
|
+
if (analysis.recommendedActions.length > 0) {
|
|
55
|
+
lines.push('**Recommended Actions:**');
|
|
56
|
+
for (const a of analysis.recommendedActions)
|
|
57
|
+
lines.push(`- ${a}`);
|
|
58
|
+
lines.push('');
|
|
59
|
+
}
|
|
60
|
+
if (analysis.confidence) {
|
|
61
|
+
lines.push(`*Confidence: ${analysis.confidence}*`);
|
|
62
|
+
lines.push('');
|
|
63
|
+
}
|
|
64
|
+
if (mcpEnabled !== undefined) {
|
|
65
|
+
lines.push(`*MCP enabled: ${mcpEnabled}*`);
|
|
66
|
+
}
|
|
67
|
+
if (serverRef) {
|
|
68
|
+
lines.push(`*Server: ${serverRef}*`);
|
|
69
|
+
}
|
|
70
|
+
lines.push('</details>');
|
|
71
|
+
lines.push('');
|
|
72
|
+
return lines.join('\n');
|
|
73
|
+
}
|
|
74
|
+
// ─── HTML template ────────────────────────────────────────────────────────────
|
|
75
|
+
/**
|
|
76
|
+
* Render a NormalizedAiAnalysis as an HTML `<details>` block.
|
|
77
|
+
* Used in published HTML reports.
|
|
78
|
+
*/
|
|
79
|
+
function renderAiAnalysisHtml(ctx) {
|
|
80
|
+
var _a, _b, _c, _d;
|
|
81
|
+
const { analysis, categoryTitle, mcpEnabled, serverRef } = ctx;
|
|
82
|
+
const title = categoryTitle !== null && categoryTitle !== void 0 ? categoryTitle : ctx.category;
|
|
83
|
+
const fallbackNote = analysis.isFallback
|
|
84
|
+
? '<span class="ai-fallback"> (fallback mode)</span>'
|
|
85
|
+
: '';
|
|
86
|
+
const escHtml = (s) => s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
87
|
+
const li = (items) => items.map((i) => `<li>${escHtml(i)}</li>`).join('\n');
|
|
88
|
+
const sections = [];
|
|
89
|
+
sections.push(`<p><strong>Summary:</strong> ${escHtml(analysis.summary)}</p>`);
|
|
90
|
+
if (analysis.keyFindings.length > 0) {
|
|
91
|
+
sections.push(`<p><strong>Key Findings:</strong></p><ul>${li(analysis.keyFindings)}</ul>`);
|
|
92
|
+
}
|
|
93
|
+
if (analysis.topRisks.length > 0) {
|
|
94
|
+
sections.push(`<p><strong>Top Risks:</strong></p><ul>${li(analysis.topRisks)}</ul>`);
|
|
95
|
+
}
|
|
96
|
+
if (((_b = (_a = analysis.missingCoverageAreas) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
97
|
+
sections.push(`<p><strong>Missing Coverage Areas:</strong></p><ul>${li(analysis.missingCoverageAreas)}</ul>`);
|
|
98
|
+
}
|
|
99
|
+
if (((_d = (_c = analysis.likelyRootCauses) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0) {
|
|
100
|
+
sections.push(`<p><strong>Likely Root Causes:</strong></p><ul>${li(analysis.likelyRootCauses)}</ul>`);
|
|
101
|
+
}
|
|
102
|
+
if (analysis.recommendedActions.length > 0) {
|
|
103
|
+
sections.push(`<p><strong>Recommended Actions:</strong></p><ul>${li(analysis.recommendedActions)}</ul>`);
|
|
104
|
+
}
|
|
105
|
+
if (analysis.confidence) {
|
|
106
|
+
sections.push(`<p><em>Confidence: ${escHtml(analysis.confidence)}</em></p>`);
|
|
107
|
+
}
|
|
108
|
+
if (mcpEnabled !== undefined) {
|
|
109
|
+
sections.push(`<p><em>MCP enabled: ${mcpEnabled}</em></p>`);
|
|
110
|
+
}
|
|
111
|
+
if (serverRef) {
|
|
112
|
+
sections.push(`<p><em>Server: ${escHtml(serverRef)}</em></p>`);
|
|
113
|
+
}
|
|
114
|
+
return [
|
|
115
|
+
`<details class="ai-analysis-panel">`,
|
|
116
|
+
` <summary>🤖 AI Analysis — ${escHtml(title)}${fallbackNote}</summary>`,
|
|
117
|
+
` <div class="ai-analysis-content">`,
|
|
118
|
+
` <h4>${escHtml(title)} — AI Insights</h4>`,
|
|
119
|
+
...sections.map((s) => ` ${s}`),
|
|
120
|
+
` </div>`,
|
|
121
|
+
`</details>`,
|
|
122
|
+
'',
|
|
123
|
+
].join('\n');
|
|
124
|
+
}
|
|
125
|
+
// ─── Dashboard panel data ─────────────────────────────────────────────────────
|
|
126
|
+
/**
|
|
127
|
+
* Convert a NormalizedAiAnalysis into a plain-object panel data structure
|
|
128
|
+
* consumed by the React dashboard.
|
|
129
|
+
*/
|
|
130
|
+
function buildAiPanelData(analysis) {
|
|
131
|
+
var _a, _b, _c, _d, _e;
|
|
132
|
+
return {
|
|
133
|
+
summary: analysis.summary,
|
|
134
|
+
keyFindings: analysis.keyFindings,
|
|
135
|
+
topRisks: analysis.topRisks,
|
|
136
|
+
recommendedActions: analysis.recommendedActions,
|
|
137
|
+
missingCoverageAreas: (_a = analysis.missingCoverageAreas) !== null && _a !== void 0 ? _a : [],
|
|
138
|
+
likelyRootCauses: (_b = analysis.likelyRootCauses) !== null && _b !== void 0 ? _b : [],
|
|
139
|
+
confidence: (_c = analysis.confidence) !== null && _c !== void 0 ? _c : 'medium',
|
|
140
|
+
isFallback: (_d = analysis.isFallback) !== null && _d !== void 0 ? _d : false,
|
|
141
|
+
category: (_e = analysis.category) !== null && _e !== void 0 ? _e : '',
|
|
142
|
+
};
|
|
143
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP integration – mock MCP server.
|
|
3
|
+
*
|
|
4
|
+
* This module provides a deterministic mock MCP server for testing.
|
|
5
|
+
* It can operate in two modes:
|
|
6
|
+
*
|
|
7
|
+
* 1. **HTTP mode** – starts an HTTP server on a configurable port that
|
|
8
|
+
* accepts POST /mcp requests and returns deterministic AI responses.
|
|
9
|
+
*
|
|
10
|
+
* 2. **stdio mode** – a standalone Node script that reads a JSON prompt
|
|
11
|
+
* from stdin and writes a deterministic JSON response to stdout.
|
|
12
|
+
*
|
|
13
|
+
* The mock can be configured to:
|
|
14
|
+
* - Return normal deterministic responses
|
|
15
|
+
* - Simulate errors (status 500)
|
|
16
|
+
* - Simulate timeouts (delayed response)
|
|
17
|
+
* - Return malformed JSON
|
|
18
|
+
*/
|
|
19
|
+
import type { NormalizedAiAnalysis } from '../../types';
|
|
20
|
+
/** Behaviours that the mock server can be configured to exhibit */
|
|
21
|
+
export type MockBehaviour = 'normal' | 'error' | 'timeout' | 'malformed';
|
|
22
|
+
/**
|
|
23
|
+
* Build a deterministic mock NormalizedAiAnalysis for a given category.
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildMockAnalysisResponse(category: string, behaviour?: MockBehaviour): NormalizedAiAnalysis;
|
|
26
|
+
export interface MockServerOptions {
|
|
27
|
+
port?: number;
|
|
28
|
+
behaviour?: MockBehaviour;
|
|
29
|
+
/** Delay in ms before responding (for timeout simulation) */
|
|
30
|
+
delayMs?: number;
|
|
31
|
+
}
|
|
32
|
+
export interface MockServerHandle {
|
|
33
|
+
url: string;
|
|
34
|
+
close(): Promise<void>;
|
|
35
|
+
/** Change behaviour after the server is started */
|
|
36
|
+
setBehaviour(behaviour: MockBehaviour, delayMs?: number): void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Start an HTTP mock MCP server.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* const server = await startMockMcpServer({ port: 3099 });
|
|
43
|
+
* // use server.url in test MCP config
|
|
44
|
+
* await server.close();
|
|
45
|
+
*/
|
|
46
|
+
export declare function startMockMcpServer(options?: MockServerOptions): Promise<MockServerHandle>;
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/testing/mock-server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAIxD,mEAAmE;AACnE,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;AAEzE;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,aAAwB,GAClC,oBAAoB,CAqBtB;AAQD,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,mDAAmD;IACnD,YAAY,CAAC,SAAS,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChE;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,gBAAgB,CAAC,CAmE3B"}
|