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.
Files changed (288) hide show
  1. package/README.md +703 -0
  2. package/config.yaml.example +227 -0
  3. package/dist/action/src/index.d.ts +2 -0
  4. package/dist/action/src/index.d.ts.map +1 -0
  5. package/dist/action/src/index.js +349 -0
  6. package/dist/action/src/prComment.d.ts +34 -0
  7. package/dist/action/src/prComment.d.ts.map +1 -0
  8. package/dist/action/src/prComment.js +146 -0
  9. package/dist/src/ast/astAnalysisOrchestrator.d.ts +36 -0
  10. package/dist/src/ast/astAnalysisOrchestrator.d.ts.map +1 -0
  11. package/dist/src/ast/astAnalysisOrchestrator.js +123 -0
  12. package/dist/src/ast/astTypes.d.ts +105 -0
  13. package/dist/src/ast/astTypes.d.ts.map +1 -0
  14. package/dist/src/ast/astTypes.js +9 -0
  15. package/dist/src/ast/languageAnalyzer.d.ts +46 -0
  16. package/dist/src/ast/languageAnalyzer.d.ts.map +1 -0
  17. package/dist/src/ast/languageAnalyzer.js +9 -0
  18. package/dist/src/ast/languageCapabilities.d.ts +24 -0
  19. package/dist/src/ast/languageCapabilities.d.ts.map +1 -0
  20. package/dist/src/ast/languageCapabilities.js +92 -0
  21. package/dist/src/ast/parseFile.d.ts +16 -0
  22. package/dist/src/ast/parseFile.d.ts.map +1 -0
  23. package/dist/src/ast/parseFile.js +65 -0
  24. package/dist/src/ast/parserRegistry.d.ts +39 -0
  25. package/dist/src/ast/parserRegistry.d.ts.map +1 -0
  26. package/dist/src/ast/parserRegistry.js +66 -0
  27. package/dist/src/buildSummary.d.ts +26 -0
  28. package/dist/src/buildSummary.d.ts.map +1 -0
  29. package/dist/src/buildSummary.js +193 -0
  30. package/dist/src/businessCoverage.d.ts +68 -0
  31. package/dist/src/businessCoverage.d.ts.map +1 -0
  32. package/dist/src/businessCoverage.js +290 -0
  33. package/dist/src/compatibilityCoverage.d.ts +83 -0
  34. package/dist/src/compatibilityCoverage.d.ts.map +1 -0
  35. package/dist/src/compatibilityCoverage.js +501 -0
  36. package/dist/src/config/defaultConfig.d.ts +9 -0
  37. package/dist/src/config/defaultConfig.d.ts.map +1 -0
  38. package/dist/src/config/defaultConfig.js +97 -0
  39. package/dist/src/config/index.d.ts +12 -0
  40. package/dist/src/config/index.d.ts.map +1 -0
  41. package/dist/src/config/index.js +37 -0
  42. package/dist/src/config/loadConfig.d.ts +29 -0
  43. package/dist/src/config/loadConfig.d.ts.map +1 -0
  44. package/dist/src/config/loadConfig.js +135 -0
  45. package/dist/src/config/mergeConfig.d.ts +15 -0
  46. package/dist/src/config/mergeConfig.d.ts.map +1 -0
  47. package/dist/src/config/mergeConfig.js +57 -0
  48. package/dist/src/config/schema.d.ts +15 -0
  49. package/dist/src/config/schema.d.ts.map +1 -0
  50. package/dist/src/config/schema.js +30 -0
  51. package/dist/src/config/types.d.ts +175 -0
  52. package/dist/src/config/types.d.ts.map +1 -0
  53. package/dist/src/config/types.js +9 -0
  54. package/dist/src/config/validateConfig.d.ts +22 -0
  55. package/dist/src/config/validateConfig.d.ts.map +1 -0
  56. package/dist/src/config/validateConfig.js +171 -0
  57. package/dist/src/config.d.ts +168 -0
  58. package/dist/src/config.d.ts.map +1 -0
  59. package/dist/src/config.js +204 -0
  60. package/dist/src/coverage/deep-analysis/callGraph.d.ts +67 -0
  61. package/dist/src/coverage/deep-analysis/callGraph.d.ts.map +1 -0
  62. package/dist/src/coverage/deep-analysis/callGraph.js +275 -0
  63. package/dist/src/coverage/deep-analysis/deepEndpointResolver.d.ts +23 -0
  64. package/dist/src/coverage/deep-analysis/deepEndpointResolver.d.ts.map +1 -0
  65. package/dist/src/coverage/deep-analysis/deepEndpointResolver.js +394 -0
  66. package/dist/src/coverage/deep-analysis/index.d.ts +17 -0
  67. package/dist/src/coverage/deep-analysis/index.d.ts.map +1 -0
  68. package/dist/src/coverage/deep-analysis/index.js +63 -0
  69. package/dist/src/coverage/deep-analysis/resolveAssertions.d.ts +60 -0
  70. package/dist/src/coverage/deep-analysis/resolveAssertions.d.ts.map +1 -0
  71. package/dist/src/coverage/deep-analysis/resolveAssertions.js +121 -0
  72. package/dist/src/coverage/deep-analysis/resolveConstants.d.ts +36 -0
  73. package/dist/src/coverage/deep-analysis/resolveConstants.d.ts.map +1 -0
  74. package/dist/src/coverage/deep-analysis/resolveConstants.js +92 -0
  75. package/dist/src/coverage/deep-analysis/resolveEnums.d.ts +55 -0
  76. package/dist/src/coverage/deep-analysis/resolveEnums.d.ts.map +1 -0
  77. package/dist/src/coverage/deep-analysis/resolveEnums.js +152 -0
  78. package/dist/src/coverage/deep-analysis/resolveMethodChains.d.ts +70 -0
  79. package/dist/src/coverage/deep-analysis/resolveMethodChains.d.ts.map +1 -0
  80. package/dist/src/coverage/deep-analysis/resolveMethodChains.js +152 -0
  81. package/dist/src/coverage/deep-analysis/resolvePaths.d.ts +80 -0
  82. package/dist/src/coverage/deep-analysis/resolvePaths.d.ts.map +1 -0
  83. package/dist/src/coverage/deep-analysis/resolvePaths.js +216 -0
  84. package/dist/src/coverage/deep-analysis/resolveRequestWrappers.d.ts +71 -0
  85. package/dist/src/coverage/deep-analysis/resolveRequestWrappers.d.ts.map +1 -0
  86. package/dist/src/coverage/deep-analysis/resolveRequestWrappers.js +226 -0
  87. package/dist/src/coverage/deep-analysis/symbolTable.d.ts +58 -0
  88. package/dist/src/coverage/deep-analysis/symbolTable.d.ts.map +1 -0
  89. package/dist/src/coverage/deep-analysis/symbolTable.js +230 -0
  90. package/dist/src/coverage/deep-analysis/types.d.ts +122 -0
  91. package/dist/src/coverage/deep-analysis/types.d.ts.map +1 -0
  92. package/dist/src/coverage/deep-analysis/types.js +21 -0
  93. package/dist/src/discovery/fileClassifier.d.ts +50 -0
  94. package/dist/src/discovery/fileClassifier.d.ts.map +1 -0
  95. package/dist/src/discovery/fileClassifier.js +238 -0
  96. package/dist/src/discovery/projectDiscovery.d.ts +66 -0
  97. package/dist/src/discovery/projectDiscovery.d.ts.map +1 -0
  98. package/dist/src/discovery/projectDiscovery.js +287 -0
  99. package/dist/src/endpointCoverage.d.ts +70 -0
  100. package/dist/src/endpointCoverage.d.ts.map +1 -0
  101. package/dist/src/endpointCoverage.js +381 -0
  102. package/dist/src/errorCoverage.d.ts +93 -0
  103. package/dist/src/errorCoverage.d.ts.map +1 -0
  104. package/dist/src/errorCoverage.js +698 -0
  105. package/dist/src/index.d.ts +3 -0
  106. package/dist/src/index.d.ts.map +1 -0
  107. package/dist/src/index.js +1441 -0
  108. package/dist/src/inference/businessRuleInference.d.ts +63 -0
  109. package/dist/src/inference/businessRuleInference.d.ts.map +1 -0
  110. package/dist/src/inference/businessRuleInference.js +268 -0
  111. package/dist/src/inference/integrationFlowInference.d.ts +56 -0
  112. package/dist/src/inference/integrationFlowInference.d.ts.map +1 -0
  113. package/dist/src/inference/integrationFlowInference.js +266 -0
  114. package/dist/src/integrationCoverage.d.ts +72 -0
  115. package/dist/src/integrationCoverage.d.ts.map +1 -0
  116. package/dist/src/integrationCoverage.js +317 -0
  117. package/dist/src/intelligence/index.d.ts +20 -0
  118. package/dist/src/intelligence/index.d.ts.map +1 -0
  119. package/dist/src/intelligence/index.js +105 -0
  120. package/dist/src/intelligence/linkageEngine.d.ts +20 -0
  121. package/dist/src/intelligence/linkageEngine.d.ts.map +1 -0
  122. package/dist/src/intelligence/linkageEngine.js +522 -0
  123. package/dist/src/intelligence/markdownReporter.d.ts +12 -0
  124. package/dist/src/intelligence/markdownReporter.d.ts.map +1 -0
  125. package/dist/src/intelligence/markdownReporter.js +265 -0
  126. package/dist/src/intelligence/riskScoring.d.ts +53 -0
  127. package/dist/src/intelligence/riskScoring.d.ts.map +1 -0
  128. package/dist/src/intelligence/riskScoring.js +181 -0
  129. package/dist/src/intelligence/types.d.ts +121 -0
  130. package/dist/src/intelligence/types.d.ts.map +1 -0
  131. package/dist/src/intelligence/types.js +8 -0
  132. package/dist/src/languageDetection.d.ts +100 -0
  133. package/dist/src/languageDetection.d.ts.map +1 -0
  134. package/dist/src/languageDetection.js +349 -0
  135. package/dist/src/languages/java/index.d.ts +16 -0
  136. package/dist/src/languages/java/index.d.ts.map +1 -0
  137. package/dist/src/languages/java/index.js +103 -0
  138. package/dist/src/languages/java/parser.d.ts +7 -0
  139. package/dist/src/languages/java/parser.d.ts.map +1 -0
  140. package/dist/src/languages/java/parser.js +50 -0
  141. package/dist/src/languages/java/semanticBuilder.d.ts +21 -0
  142. package/dist/src/languages/java/semanticBuilder.d.ts.map +1 -0
  143. package/dist/src/languages/java/semanticBuilder.js +358 -0
  144. package/dist/src/languages/javascript/annotationExtractor.d.ts +20 -0
  145. package/dist/src/languages/javascript/annotationExtractor.d.ts.map +1 -0
  146. package/dist/src/languages/javascript/annotationExtractor.js +94 -0
  147. package/dist/src/languages/javascript/assertionResolver.d.ts +18 -0
  148. package/dist/src/languages/javascript/assertionResolver.d.ts.map +1 -0
  149. package/dist/src/languages/javascript/assertionResolver.js +150 -0
  150. package/dist/src/languages/javascript/callResolver.d.ts +23 -0
  151. package/dist/src/languages/javascript/callResolver.d.ts.map +1 -0
  152. package/dist/src/languages/javascript/callResolver.js +236 -0
  153. package/dist/src/languages/javascript/httpInteractionExtractor.d.ts +23 -0
  154. package/dist/src/languages/javascript/httpInteractionExtractor.d.ts.map +1 -0
  155. package/dist/src/languages/javascript/httpInteractionExtractor.js +205 -0
  156. package/dist/src/languages/javascript/index.d.ts +20 -0
  157. package/dist/src/languages/javascript/index.d.ts.map +1 -0
  158. package/dist/src/languages/javascript/index.js +136 -0
  159. package/dist/src/languages/javascript/parser.d.ts +14 -0
  160. package/dist/src/languages/javascript/parser.d.ts.map +1 -0
  161. package/dist/src/languages/javascript/parser.js +38 -0
  162. package/dist/src/languages/javascript/symbolResolver.d.ts +31 -0
  163. package/dist/src/languages/javascript/symbolResolver.d.ts.map +1 -0
  164. package/dist/src/languages/javascript/symbolResolver.js +183 -0
  165. package/dist/src/languages/kotlin/index.d.ts +16 -0
  166. package/dist/src/languages/kotlin/index.d.ts.map +1 -0
  167. package/dist/src/languages/kotlin/index.js +151 -0
  168. package/dist/src/languages/kotlin/parser.d.ts +11 -0
  169. package/dist/src/languages/kotlin/parser.d.ts.map +1 -0
  170. package/dist/src/languages/kotlin/parser.js +74 -0
  171. package/dist/src/languages/python/index.d.ts +15 -0
  172. package/dist/src/languages/python/index.d.ts.map +1 -0
  173. package/dist/src/languages/python/index.js +293 -0
  174. package/dist/src/languages/ruby/index.d.ts +15 -0
  175. package/dist/src/languages/ruby/index.d.ts.map +1 -0
  176. package/dist/src/languages/ruby/index.js +274 -0
  177. package/dist/src/languages/shared/treeSitterUtils.d.ts +43 -0
  178. package/dist/src/languages/shared/treeSitterUtils.d.ts.map +1 -0
  179. package/dist/src/languages/shared/treeSitterUtils.js +100 -0
  180. package/dist/src/languages/typescript/index.d.ts +14 -0
  181. package/dist/src/languages/typescript/index.d.ts.map +1 -0
  182. package/dist/src/languages/typescript/index.js +25 -0
  183. package/dist/src/lib/index.d.ts +228 -0
  184. package/dist/src/lib/index.d.ts.map +1 -0
  185. package/dist/src/lib/index.js +486 -0
  186. package/dist/src/mcp/client/index.d.ts +37 -0
  187. package/dist/src/mcp/client/index.d.ts.map +1 -0
  188. package/dist/src/mcp/client/index.js +235 -0
  189. package/dist/src/mcp/config.d.ts +50 -0
  190. package/dist/src/mcp/config.d.ts.map +1 -0
  191. package/dist/src/mcp/config.js +125 -0
  192. package/dist/src/mcp/events.d.ts +24 -0
  193. package/dist/src/mcp/events.d.ts.map +1 -0
  194. package/dist/src/mcp/events.js +48 -0
  195. package/dist/src/mcp/fallback/index.d.ts +50 -0
  196. package/dist/src/mcp/fallback/index.d.ts.map +1 -0
  197. package/dist/src/mcp/fallback/index.js +216 -0
  198. package/dist/src/mcp/index.d.ts +67 -0
  199. package/dist/src/mcp/index.d.ts.map +1 -0
  200. package/dist/src/mcp/index.js +212 -0
  201. package/dist/src/mcp/normalizer.d.ts +21 -0
  202. package/dist/src/mcp/normalizer.d.ts.map +1 -0
  203. package/dist/src/mcp/normalizer.js +99 -0
  204. package/dist/src/mcp/prompts/index.d.ts +86 -0
  205. package/dist/src/mcp/prompts/index.d.ts.map +1 -0
  206. package/dist/src/mcp/prompts/index.js +304 -0
  207. package/dist/src/mcp/templates/index.d.ts +35 -0
  208. package/dist/src/mcp/templates/index.d.ts.map +1 -0
  209. package/dist/src/mcp/templates/index.js +143 -0
  210. package/dist/src/mcp/testing/mock-server/index.d.ts +47 -0
  211. package/dist/src/mcp/testing/mock-server/index.d.ts.map +1 -0
  212. package/dist/src/mcp/testing/mock-server/index.js +157 -0
  213. package/dist/src/mcp/types.d.ts +127 -0
  214. package/dist/src/mcp/types.d.ts.map +1 -0
  215. package/dist/src/mcp/types.js +8 -0
  216. package/dist/src/observability.d.ts +138 -0
  217. package/dist/src/observability.d.ts.map +1 -0
  218. package/dist/src/observability.js +519 -0
  219. package/dist/src/parameterCoverage.d.ts +75 -0
  220. package/dist/src/parameterCoverage.d.ts.map +1 -0
  221. package/dist/src/parameterCoverage.js +629 -0
  222. package/dist/src/perfResilienceCoverage.d.ts +155 -0
  223. package/dist/src/perfResilienceCoverage.d.ts.map +1 -0
  224. package/dist/src/perfResilienceCoverage.js +670 -0
  225. package/dist/src/pluginLoader.d.ts +51 -0
  226. package/dist/src/pluginLoader.d.ts.map +1 -0
  227. package/dist/src/pluginLoader.js +72 -0
  228. package/dist/src/publishing.d.ts +63 -0
  229. package/dist/src/publishing.d.ts.map +1 -0
  230. package/dist/src/publishing.js +379 -0
  231. package/dist/src/qualityGate.d.ts +58 -0
  232. package/dist/src/qualityGate.d.ts.map +1 -0
  233. package/dist/src/qualityGate.js +118 -0
  234. package/dist/src/reporting.d.ts +41 -0
  235. package/dist/src/reporting.d.ts.map +1 -0
  236. package/dist/src/reporting.js +278 -0
  237. package/dist/src/screenshots.d.ts +71 -0
  238. package/dist/src/screenshots.d.ts.map +1 -0
  239. package/dist/src/screenshots.js +141 -0
  240. package/dist/src/security/gate/index.d.ts +11 -0
  241. package/dist/src/security/gate/index.d.ts.map +1 -0
  242. package/dist/src/security/gate/index.js +65 -0
  243. package/dist/src/security/index.d.ts +30 -0
  244. package/dist/src/security/index.d.ts.map +1 -0
  245. package/dist/src/security/index.js +342 -0
  246. package/dist/src/security/normalizers/semgrep.d.ts +10 -0
  247. package/dist/src/security/normalizers/semgrep.d.ts.map +1 -0
  248. package/dist/src/security/normalizers/semgrep.js +104 -0
  249. package/dist/src/security/normalizers/trivy.d.ts +10 -0
  250. package/dist/src/security/normalizers/trivy.d.ts.map +1 -0
  251. package/dist/src/security/normalizers/trivy.js +78 -0
  252. package/dist/src/security/normalizers/zap.d.ts +10 -0
  253. package/dist/src/security/normalizers/zap.d.ts.map +1 -0
  254. package/dist/src/security/normalizers/zap.js +104 -0
  255. package/dist/src/security/scanners/semgrep.d.ts +6 -0
  256. package/dist/src/security/scanners/semgrep.d.ts.map +1 -0
  257. package/dist/src/security/scanners/semgrep.js +125 -0
  258. package/dist/src/security/scanners/trivy.d.ts +6 -0
  259. package/dist/src/security/scanners/trivy.d.ts.map +1 -0
  260. package/dist/src/security/scanners/trivy.js +115 -0
  261. package/dist/src/security/scanners/zap.d.ts +6 -0
  262. package/dist/src/security/scanners/zap.d.ts.map +1 -0
  263. package/dist/src/security/scanners/zap.js +135 -0
  264. package/dist/src/security/types.d.ts +146 -0
  265. package/dist/src/security/types.d.ts.map +1 -0
  266. package/dist/src/security/types.js +6 -0
  267. package/dist/src/securityCoverage.d.ts +116 -0
  268. package/dist/src/securityCoverage.d.ts.map +1 -0
  269. package/dist/src/securityCoverage.js +725 -0
  270. package/dist/src/summary/buildSummary.d.ts +28 -0
  271. package/dist/src/summary/buildSummary.d.ts.map +1 -0
  272. package/dist/src/summary/buildSummary.js +257 -0
  273. package/dist/src/summary/evaluateMetrics.d.ts +31 -0
  274. package/dist/src/summary/evaluateMetrics.d.ts.map +1 -0
  275. package/dist/src/summary/evaluateMetrics.js +118 -0
  276. package/dist/src/summary/index.d.ts +10 -0
  277. package/dist/src/summary/index.d.ts.map +1 -0
  278. package/dist/src/summary/index.js +22 -0
  279. package/dist/src/summary/markdownRenderer.d.ts +139 -0
  280. package/dist/src/summary/markdownRenderer.d.ts.map +1 -0
  281. package/dist/src/summary/markdownRenderer.js +459 -0
  282. package/dist/src/summary/prSummary.d.ts +24 -0
  283. package/dist/src/summary/prSummary.d.ts.map +1 -0
  284. package/dist/src/summary/prSummary.js +233 -0
  285. package/dist/src/summary/summaryTypes.d.ts +35 -0
  286. package/dist/src/summary/summaryTypes.d.ts.map +1 -0
  287. package/dist/src/summary/summaryTypes.js +27 -0
  288. package/package.json +84 -0
@@ -0,0 +1,233 @@
1
+ "use strict";
2
+ /**
3
+ * Summary engine – PR comment summary generator.
4
+ *
5
+ * Generates concise PR comment markdown from analysis results.
6
+ * Uses the same gate-aware inclusion logic as generateBuildSummary
7
+ * but produces a shorter format suitable for PR comments.
8
+ *
9
+ * Public API:
10
+ * generatePrSummary(input): Promise<SummaryResult>
11
+ */
12
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ var desc = Object.getOwnPropertyDescriptor(m, k);
15
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
16
+ desc = { enumerable: true, get: function() { return m[k]; } };
17
+ }
18
+ Object.defineProperty(o, k2, desc);
19
+ }) : (function(o, m, k, k2) {
20
+ if (k2 === undefined) k2 = k;
21
+ o[k2] = m[k];
22
+ }));
23
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
24
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
25
+ }) : function(o, v) {
26
+ o["default"] = v;
27
+ });
28
+ var __importStar = (this && this.__importStar) || (function () {
29
+ var ownKeys = function(o) {
30
+ ownKeys = Object.getOwnPropertyNames || function (o) {
31
+ var ar = [];
32
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
33
+ return ar;
34
+ };
35
+ return ownKeys(o);
36
+ };
37
+ return function (mod) {
38
+ if (mod && mod.__esModule) return mod;
39
+ var result = {};
40
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
41
+ __setModuleDefault(result, mod);
42
+ return result;
43
+ };
44
+ })();
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.generatePrSummary = generatePrSummary;
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
+ // ─── PR summary generator ─────────────────────────────────────────────────────
52
+ /**
53
+ * Generate a concise PR comment summary from analysis results.
54
+ *
55
+ * The PR summary is shorter than the build summary – it shows the key status
56
+ * table and links to the full report, while still honouring gate-aware
57
+ * inclusion rules.
58
+ *
59
+ * @param input All analysis results and configuration.
60
+ * @param outDir Optional directory to write pr-summary.md to.
61
+ */
62
+ async function generatePrSummary(input, outDir) {
63
+ var _a, _b, _c, _d, _e, _f;
64
+ const sections = buildPrSections(input);
65
+ const included = sections.filter((s) => s.included);
66
+ const lines = [];
67
+ const overallPassed = (_b = (_a = input.qualityGate) === null || _a === void 0 ? void 0 : _a.passed) !== null && _b !== void 0 ? _b : true;
68
+ const statusEmoji = overallPassed ? '✅' : '❌';
69
+ lines.push(`${statusEmoji} **API Coverage: ${overallPassed ? 'PASSED' : 'FAILED'}**`);
70
+ if (input.buildId)
71
+ lines.push(`Build \`${input.buildId}\``);
72
+ lines.push('');
73
+ // Compact coverage table — uses evaluated metrics for correct PASS/FAIL/N/A/SKIPPED
74
+ if (input.results.length > 0) {
75
+ const evaluatedMetrics = (0, evaluateMetrics_1.evaluateMetrics)(input.results, (_c = input.thresholds) !== null && _c !== void 0 ? _c : {}, input.qualityGate);
76
+ lines.push('| Category | Coverage | Status |');
77
+ lines.push('|---|---|---|');
78
+ for (const m of evaluatedMetrics) {
79
+ const coverageCell = m.applicable ? (0, markdownRenderer_1.pct)(m.coveragePercent) : '—';
80
+ lines.push(`| ${m.category} | ${coverageCell} | ${(0, markdownRenderer_1.metricStatusCell)(m.status)} |`);
81
+ }
82
+ lines.push('');
83
+ }
84
+ // Security scan summary row if present
85
+ if (input.securityScan) {
86
+ const gatePassed = (_d = input.securityScan.gateResult) === null || _d === void 0 ? void 0 : _d.passed;
87
+ const gateStatus = gatePassed === undefined ? '—' : gatePassed ? '✅ PASS' : '❌ FAIL';
88
+ lines.push(`**Security scan findings:** ${input.securityScan.totalFindings} total`);
89
+ lines.push(`**Security gate:** ${gateStatus}`);
90
+ lines.push('');
91
+ }
92
+ // Intelligence summary row if present
93
+ if (input.intelligenceSummary) {
94
+ const intel = input.intelligenceSummary;
95
+ const p0 = (_e = intel.recommendationsByPriority['P0']) !== null && _e !== void 0 ? _e : 0;
96
+ const p1 = (_f = intel.recommendationsByPriority['P1']) !== null && _f !== void 0 ? _f : 0;
97
+ const criticalFlag = p0 > 0 ? ' ⚠️' : '';
98
+ lines.push(`**Coverage Intelligence:**${criticalFlag} ${intel.totalFindings} finding(s), ${intel.totalRecommendations} recommendation(s) (P0: ${p0}, P1: ${p1})`);
99
+ lines.push(`**Max risk score:** ${intel.maxRiskScore} | **Critical uncovered:** ${intel.criticalUncoveredItems}`);
100
+ lines.push('');
101
+ }
102
+ // Failed gates detail
103
+ if (input.qualityGate && input.qualityGate.failures.length > 0) {
104
+ lines.push('**Failed gates:**');
105
+ for (const f of input.qualityGate.failures) {
106
+ lines.push(`- ${f.category}: ${(0, markdownRenderer_1.pct)(f.actual)} < ${(0, markdownRenderer_1.pct)(f.expected)} (gap: ${(0, markdownRenderer_1.pct)(f.gap)})`);
107
+ }
108
+ lines.push('');
109
+ }
110
+ if (input.pagesUrl) {
111
+ lines.push(`[📊 View full report](${input.pagesUrl})`);
112
+ lines.push('');
113
+ }
114
+ // Include per-section detail for included sections (collapsed)
115
+ const detailSections = included.filter((s) => s.gateEvaluated && s.passed === false);
116
+ if (detailSections.length > 0) {
117
+ lines.push('<details>');
118
+ lines.push('<summary>Failed gate details</summary>');
119
+ lines.push('');
120
+ for (const s of detailSections) {
121
+ lines.push(s.markdown);
122
+ }
123
+ lines.push('</details>');
124
+ lines.push('');
125
+ }
126
+ const markdown = lines.join('\n');
127
+ const aiMarkdown = (0, markdownRenderer_1.renderAiSummary)(input, sections);
128
+ const json = buildPrJsonSummary(input, sections);
129
+ if (outDir) {
130
+ await writePrOutputFiles(outDir, markdown, aiMarkdown, json);
131
+ }
132
+ return { markdown, sections, json };
133
+ }
134
+ // ─── Internals ────────────────────────────────────────────────────────────────
135
+ function buildPrSections(input) {
136
+ var _a, _b, _c, _d, _e, _f;
137
+ const sections = [];
138
+ const thresholds = (_a = input.thresholds) !== null && _a !== void 0 ? _a : {};
139
+ const onlyEvaluated = (_c = (_b = input.summaryConfig) === null || _b === void 0 ? void 0 : _b.includeOnlyEvaluatedSections) !== null && _c !== void 0 ? _c : false;
140
+ for (const result of input.results) {
141
+ const threshold = thresholds[result.type];
142
+ const gateEvaluated = threshold !== undefined;
143
+ const failure = (_d = input.qualityGate) === null || _d === void 0 ? void 0 : _d.failures.find((f) => f.category === result.type);
144
+ const passed = gateEvaluated ? failure === undefined : undefined;
145
+ const included = onlyEvaluated ? gateEvaluated : true;
146
+ sections.push({
147
+ id: result.type,
148
+ title: (0, markdownRenderer_1.coverageTypeTitle)(result.type),
149
+ included,
150
+ gateEvaluated,
151
+ passed,
152
+ markdown: included
153
+ ? (0, markdownRenderer_1.renderCoverageSection)(result, threshold, failure !== undefined)
154
+ : '',
155
+ });
156
+ }
157
+ if (input.securityScan) {
158
+ const scannerResults = (_e = input.scannerResults) !== null && _e !== void 0 ? _e : [];
159
+ const gatePassed = (_f = input.securityScan.gateResult) === null || _f === void 0 ? void 0 : _f.passed;
160
+ const included = !onlyEvaluated || (input.securityScan.gateResult !== undefined);
161
+ sections.push({
162
+ id: 'security-scan',
163
+ title: 'Security Scanning',
164
+ included,
165
+ gateEvaluated: input.securityScan.gateResult !== undefined,
166
+ passed: gatePassed,
167
+ markdown: included
168
+ ? (0, markdownRenderer_1.renderSecurityScanSection)(input.securityScan, scannerResults, input.securityScan.gateResult !== undefined, gatePassed)
169
+ : '',
170
+ });
171
+ }
172
+ // Coverage Intelligence section
173
+ if (input.intelligenceSummary) {
174
+ sections.push({
175
+ id: 'coverage-intelligence',
176
+ title: 'Coverage Intelligence',
177
+ included: true,
178
+ gateEvaluated: false,
179
+ passed: undefined,
180
+ markdown: (0, markdownRenderer_1.renderIntelligenceSection)(input.intelligenceSummary),
181
+ });
182
+ }
183
+ return sections;
184
+ }
185
+ function buildPrJsonSummary(input, sections) {
186
+ var _a, _b, _c, _d;
187
+ return {
188
+ generatedAt: new Date().toISOString(),
189
+ type: 'pr-summary',
190
+ projectName: input.projectName,
191
+ branch: input.branch,
192
+ commitSha: input.commitSha,
193
+ buildId: input.buildId,
194
+ overallPassed: (_b = (_a = input.qualityGate) === null || _a === void 0 ? void 0 : _a.passed) !== null && _b !== void 0 ? _b : true,
195
+ coverage: input.results.map((r) => {
196
+ var _a, _b;
197
+ return ({
198
+ type: r.type,
199
+ coveragePercent: r.coveragePercent,
200
+ threshold: (_a = input.thresholds) === null || _a === void 0 ? void 0 : _a[r.type],
201
+ passed: !((_b = input.qualityGate) === null || _b === void 0 ? void 0 : _b.failures.some((f) => f.category === r.type)),
202
+ });
203
+ }),
204
+ failedGates: (_d = (_c = input.qualityGate) === null || _c === void 0 ? void 0 : _c.failures) !== null && _d !== void 0 ? _d : [],
205
+ sections: sections.map((s) => ({
206
+ id: s.id,
207
+ included: s.included,
208
+ gateEvaluated: s.gateEvaluated,
209
+ passed: s.passed,
210
+ })),
211
+ intelligence: input.intelligenceSummary
212
+ ? {
213
+ totalFindings: input.intelligenceSummary.totalFindings,
214
+ totalRecommendations: input.intelligenceSummary.totalRecommendations,
215
+ maxRiskScore: input.intelligenceSummary.maxRiskScore,
216
+ criticalUncoveredItems: input.intelligenceSummary.criticalUncoveredItems,
217
+ unprotectedSecurityFindings: input.intelligenceSummary.unprotectedSecurityFindings,
218
+ recommendationsByPriority: input.intelligenceSummary.recommendationsByPriority,
219
+ }
220
+ : undefined,
221
+ };
222
+ }
223
+ async function writePrOutputFiles(outDir, prMarkdown, aiMarkdown, json) {
224
+ fs.mkdirSync(outDir, { recursive: true });
225
+ fs.writeFileSync(path.join(outDir, 'pr-summary.md'), prMarkdown, 'utf-8');
226
+ // Also write ai-summary files if not already written by build summary
227
+ if (!fs.existsSync(path.join(outDir, 'ai-summary.md'))) {
228
+ fs.writeFileSync(path.join(outDir, 'ai-summary.md'), aiMarkdown, 'utf-8');
229
+ }
230
+ if (!fs.existsSync(path.join(outDir, 'summary.json'))) {
231
+ fs.writeFileSync(path.join(outDir, 'summary.json'), JSON.stringify(json, null, 2), 'utf-8');
232
+ }
233
+ }
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Shared types for the metric evaluation model.
3
+ *
4
+ * MetricStatus encodes the four possible outcomes for a metric row:
5
+ * PASS – ran, has items, gate configured, threshold met
6
+ * FAIL – ran, has items, gate configured, threshold missed
7
+ * N/A – ran but totalItems === 0 (nothing to measure), OR no threshold
8
+ * SKIPPED – did not run at all (not present in coverage-summary.json)
9
+ *
10
+ * Critical invariant: totalItems === 0 → always N/A, never PASS.
11
+ * ⚠️ PASS does not exist anywhere in the codebase.
12
+ */
13
+ export type MetricStatus = 'PASS' | 'FAIL' | 'SKIPPED' | 'N/A';
14
+ export interface EvaluatedMetric {
15
+ /** Coverage type identifier, e.g. "endpoint", "error" */
16
+ category: string;
17
+ /** True when this type appeared in coverage-summary.json */
18
+ executed: boolean;
19
+ /** True when executed AND totalItems > 0 */
20
+ applicable: boolean;
21
+ totalItems: number;
22
+ coveredItems: number;
23
+ coveragePercent: number;
24
+ threshold: number | undefined;
25
+ /** True when a threshold is configured for this type */
26
+ gateEvaluated: boolean;
27
+ status: MetricStatus;
28
+ /** Human-readable explanation of the status */
29
+ reason: string;
30
+ /** Up to 5 uncovered item descriptions (for FAIL / low coverage) */
31
+ topGaps: string[];
32
+ }
33
+ /** Canonical ordered list of all built-in metric types. */
34
+ export declare const KNOWN_METRIC_TYPES: string[];
35
+ //# sourceMappingURL=summaryTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summaryTypes.d.ts","sourceRoot":"","sources":["../../../src/summary/summaryTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC;AAE/D,MAAM,WAAW,eAAe;IAC9B,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,QAAQ,EAAE,OAAO,CAAC;IAClB,4CAA4C;IAC5C,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,wDAAwD;IACxD,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,YAAY,CAAC;IACrB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,2DAA2D;AAC3D,eAAO,MAAM,kBAAkB,EAAE,MAAM,EAUtC,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /**
3
+ * Shared types for the metric evaluation model.
4
+ *
5
+ * MetricStatus encodes the four possible outcomes for a metric row:
6
+ * PASS – ran, has items, gate configured, threshold met
7
+ * FAIL – ran, has items, gate configured, threshold missed
8
+ * N/A – ran but totalItems === 0 (nothing to measure), OR no threshold
9
+ * SKIPPED – did not run at all (not present in coverage-summary.json)
10
+ *
11
+ * Critical invariant: totalItems === 0 → always N/A, never PASS.
12
+ * ⚠️ PASS does not exist anywhere in the codebase.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.KNOWN_METRIC_TYPES = void 0;
16
+ /** Canonical ordered list of all built-in metric types. */
17
+ exports.KNOWN_METRIC_TYPES = [
18
+ 'endpoint',
19
+ 'parameter',
20
+ 'business',
21
+ 'integration',
22
+ 'error',
23
+ 'security',
24
+ 'performance',
25
+ 'resilience',
26
+ 'compatibility',
27
+ ];
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "api-tests-coverage",
3
+ "version": "1.0.0",
4
+ "description": "CLI and library to measure how thoroughly your test suite exercises your API surface area",
5
+ "main": "dist/src/lib/index.js",
6
+ "types": "dist/src/lib/index.d.ts",
7
+ "bin": {
8
+ "api-tests-coverage": "./dist/src/index.js"
9
+ },
10
+ "files": [
11
+ "dist/src/",
12
+ "dist/action/",
13
+ "README.md",
14
+ "config.yaml.example"
15
+ ],
16
+ "type": "commonjs",
17
+ "engines": {
18
+ "node": ">=18"
19
+ },
20
+ "keywords": [
21
+ "api",
22
+ "coverage",
23
+ "test",
24
+ "openapi",
25
+ "swagger",
26
+ "typescript",
27
+ "cli",
28
+ "github-action"
29
+ ],
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/skaliber/apiTestsCoverageAnalyzer.git"
33
+ },
34
+ "homepage": "https://github.com/skaliber/apiTestsCoverageAnalyzer#readme",
35
+ "license": "MIT",
36
+ "scripts": {
37
+ "build": "tsc",
38
+ "prepublishOnly": "npm run build",
39
+ "start": "node dist/src/index.js",
40
+ "test": "jest",
41
+ "coverage": "node scripts/run-coverage.js",
42
+ "docs:dev": "vitepress dev docs",
43
+ "docs:build": "vitepress build docs",
44
+ "docs:preview": "vitepress preview docs",
45
+ "docs:check": "node scripts/docs-check.js && npm run docs:build",
46
+ "docs:test": "cypress run --config-file cypress.config.js",
47
+ "docs:test:open": "cypress open --config-file cypress.config.js",
48
+ "dashboard:test": "cypress run --config-file cypress.dashboard.config.js",
49
+ "dashboard:test:open": "cypress open --config-file cypress.dashboard.config.js"
50
+ },
51
+ "dependencies": {
52
+ "@actions/core": "^1.11.1",
53
+ "@actions/github": "^6.0.1",
54
+ "@apidevtools/swagger-parser": "^10.0.2",
55
+ "@opentelemetry/api": "^1.9.0",
56
+ "@opentelemetry/exporter-trace-otlp-http": "^0.213.0",
57
+ "@opentelemetry/sdk-node": "^0.213.0",
58
+ "@types/js-yaml": "^4.0.9",
59
+ "@typescript-eslint/typescript-estree": "^8.56.1",
60
+ "commander": "^11.0.0",
61
+ "fast-glob": "^3.3.3",
62
+ "globby": "^13.2.2",
63
+ "js-yaml": "^4.1.1",
64
+ "openapi-types": "^12.1.3",
65
+ "pino": "^10.3.1",
66
+ "prom-client": "^15.1.3",
67
+ "tree-sitter": "^0.25.0",
68
+ "tree-sitter-java": "^0.23.5",
69
+ "tree-sitter-python": "^0.25.0",
70
+ "tree-sitter-ruby": "^0.23.1"
71
+ },
72
+ "devDependencies": {
73
+ "@types/jest": "^29.0.0",
74
+ "@types/node": "^20.4.2",
75
+ "@types/pino": "^7.0.4",
76
+ "cypress": "^13.17.0",
77
+ "jest": "^29.0.0",
78
+ "ts-jest": "^29.0.0",
79
+ "ts-node": "^10.9.1",
80
+ "typescript": "^5.2.0",
81
+ "vitepress": "^1.6.4",
82
+ "wait-on": "^9.0.4"
83
+ }
84
+ }