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,171 @@
1
+ "use strict";
2
+ /**
3
+ * Central config — schema validation.
4
+ *
5
+ * Validates a parsed YAML object against the AnalyzerConfig schema.
6
+ * On failure, throws with a field-level error message that includes
7
+ * the received value and an example of a valid value.
8
+ *
9
+ * Unknown top-level keys produce a warning in default mode and a hard
10
+ * error in strict mode (qualityGate.mode === 'strict').
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.validateConfig = validateConfig;
14
+ const schema_1 = require("./schema");
15
+ // ─── Known top-level keys ─────────────────────────────────────────────────────
16
+ const KNOWN_TOP_LEVEL_KEYS = new Set([
17
+ 'version',
18
+ 'project',
19
+ 'analysis',
20
+ 'scans',
21
+ 'mcp',
22
+ 'thresholds',
23
+ 'qualityGate',
24
+ 'reports',
25
+ 'publishing',
26
+ 'dashboard',
27
+ ]);
28
+ // ─── Error helpers ────────────────────────────────────────────────────────────
29
+ function configError(field, received, expected, example) {
30
+ return new Error([
31
+ `Config error: ${field}`,
32
+ ` Received: ${JSON.stringify(received)}`,
33
+ ` Expected: ${expected}`,
34
+ ` Example: ${example}`,
35
+ ].join('\n'));
36
+ }
37
+ // ─── Validator ────────────────────────────────────────────────────────────────
38
+ /**
39
+ * Validate a raw parsed-YAML object.
40
+ *
41
+ * Returns the cast `AnalyzerConfig` on success.
42
+ * Throws with a field-level error message on validation failure.
43
+ *
44
+ * @param raw Parsed YAML value (must be a plain object)
45
+ * @param strictMode When true, unknown top-level keys are errors not warnings
46
+ */
47
+ function validateConfig(raw, strictMode = false) {
48
+ if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) {
49
+ throw new Error('Config error: config.yaml must contain a YAML mapping (object), not a scalar or list');
50
+ }
51
+ const obj = raw;
52
+ // ── version ────────────────────────────────────────────────────────────────
53
+ if ('version' in obj) {
54
+ const ver = obj['version'];
55
+ if (!schema_1.SUPPORTED_VERSIONS.includes(ver)) {
56
+ throw configError('version', ver, `one of: ${schema_1.SUPPORTED_VERSIONS.join(', ')}`, 'version: 1');
57
+ }
58
+ }
59
+ // ── analysis ───────────────────────────────────────────────────────────────
60
+ if ('analysis' in obj && obj['analysis'] !== null && obj['analysis'] !== undefined) {
61
+ const analysis = obj['analysis'];
62
+ if ('defaultMode' in analysis) {
63
+ const mode = analysis['defaultMode'];
64
+ if (!schema_1.VALID_ANALYSIS_MODES.includes(mode)) {
65
+ throw configError('analysis.defaultMode', mode, `one of: ${schema_1.VALID_ANALYSIS_MODES.join(', ')}`, 'analysis:\n defaultMode: full');
66
+ }
67
+ }
68
+ }
69
+ // ── scans.coverage.types ─────────────────────────────────────────────────
70
+ if ('scans' in obj && obj['scans'] !== null && obj['scans'] !== undefined) {
71
+ const scans = obj['scans'];
72
+ if ('coverage' in scans && scans['coverage'] !== null && scans['coverage'] !== undefined) {
73
+ const coverage = scans['coverage'];
74
+ if ('types' in coverage && Array.isArray(coverage['types'])) {
75
+ for (const t of coverage['types']) {
76
+ if (!schema_1.VALID_COVERAGE_TYPES.includes(t)) {
77
+ throw configError('scans.coverage.types', t, `one of: ${schema_1.VALID_COVERAGE_TYPES.join(', ')}`, 'scans:\n coverage:\n types:\n - endpoint\n - parameter');
78
+ }
79
+ }
80
+ }
81
+ }
82
+ if ('security' in scans && scans['security'] !== null && scans['security'] !== undefined) {
83
+ const security = scans['security'];
84
+ if ('scanners' in security && Array.isArray(security['scanners'])) {
85
+ for (const s of security['scanners']) {
86
+ if (!schema_1.VALID_SECURITY_SCANNERS.includes(s)) {
87
+ throw configError('scans.security.scanners', s, `one of: ${schema_1.VALID_SECURITY_SCANNERS.join(', ')}`, 'scans:\n security:\n scanners:\n - semgrep\n - trivy');
88
+ }
89
+ }
90
+ }
91
+ }
92
+ if ('intelligence' in scans && scans['intelligence'] !== null && scans['intelligence'] !== undefined) {
93
+ const intelligence = scans['intelligence'];
94
+ if ('types' in intelligence && Array.isArray(intelligence['types'])) {
95
+ for (const t of intelligence['types']) {
96
+ if (!schema_1.VALID_INTELLIGENCE_TYPES.includes(t)) {
97
+ throw configError('scans.intelligence.types', t, `one of: ${schema_1.VALID_INTELLIGENCE_TYPES.join(', ')}`, 'scans:\n intelligence:\n types:\n - ai-summary\n - recommendations');
98
+ }
99
+ }
100
+ }
101
+ }
102
+ }
103
+ // ── thresholds ────────────────────────────────────────────────────────────
104
+ if ('thresholds' in obj && obj['thresholds'] !== null && obj['thresholds'] !== undefined) {
105
+ const thresholds = obj['thresholds'];
106
+ for (const [key, value] of Object.entries(thresholds)) {
107
+ if (typeof value !== 'number' || value < 0 || value > 100) {
108
+ throw configError(`thresholds.${key}`, value, 'a number between 0 and 100 (inclusive)', `thresholds:\n ${key}: 80`);
109
+ }
110
+ }
111
+ }
112
+ // ── qualityGate.mode ───────────────────────────────────────────────────────
113
+ if ('qualityGate' in obj && obj['qualityGate'] !== null && obj['qualityGate'] !== undefined) {
114
+ const qg = obj['qualityGate'];
115
+ if ('mode' in qg) {
116
+ const mode = qg['mode'];
117
+ if (!schema_1.VALID_QUALITY_GATE_MODES.includes(mode)) {
118
+ throw configError('qualityGate.mode', mode, `one of: ${schema_1.VALID_QUALITY_GATE_MODES.join(', ')}`, 'qualityGate:\n mode: warn');
119
+ }
120
+ }
121
+ }
122
+ // ── reports.formats ───────────────────────────────────────────────────────
123
+ if ('reports' in obj && obj['reports'] !== null && obj['reports'] !== undefined) {
124
+ const reports = obj['reports'];
125
+ if ('formats' in reports && Array.isArray(reports['formats'])) {
126
+ for (const f of reports['formats']) {
127
+ if (!schema_1.VALID_REPORT_FORMATS.includes(f)) {
128
+ throw configError('reports.formats', f, `one of: ${schema_1.VALID_REPORT_FORMATS.join(', ')}`, 'reports:\n formats:\n - json\n - html');
129
+ }
130
+ }
131
+ }
132
+ }
133
+ // ── mcp server validation ──────────────────────────────────────────────────
134
+ if ('mcp' in obj && obj['mcp'] !== null && obj['mcp'] !== undefined) {
135
+ const mcp = obj['mcp'];
136
+ if ('servers' in mcp && mcp['servers'] !== null && mcp['servers'] !== undefined) {
137
+ const servers = mcp['servers'];
138
+ for (const [serverId, serverCfg] of Object.entries(servers)) {
139
+ if (serverCfg === null || typeof serverCfg !== 'object')
140
+ continue;
141
+ const server = serverCfg;
142
+ const transport = server['transport'];
143
+ if (transport === 'stdio' && !server['command']) {
144
+ throw new Error([
145
+ `Config error: mcp.servers.${serverId}.command is required when transport is "stdio".`,
146
+ ` Example: command: node, args: ["./mcp-servers/coverage-summary.js"]`,
147
+ ].join('\n'));
148
+ }
149
+ if ((transport === 'http' || transport === 'sse') && !server['url']) {
150
+ throw new Error([
151
+ `Config error: mcp.servers.${serverId}.url is required when transport is "http" or "sse".`,
152
+ ` Example: url: http://localhost:3100/mcp`,
153
+ ].join('\n'));
154
+ }
155
+ }
156
+ }
157
+ }
158
+ // ── unknown top-level keys ─────────────────────────────────────────────────
159
+ for (const key of Object.keys(obj)) {
160
+ if (!KNOWN_TOP_LEVEL_KEYS.has(key)) {
161
+ const msg = `[WARNING] config.yaml contains unknown top-level key: "${key}". This key will be ignored.`;
162
+ if (strictMode) {
163
+ throw new Error(`Config error: unknown top-level key "${key}".\n Remove or correct this key before running in strict mode.`);
164
+ }
165
+ else {
166
+ process.stderr.write(msg + '\n');
167
+ }
168
+ }
169
+ }
170
+ return obj;
171
+ }
@@ -0,0 +1,168 @@
1
+ import type { McpConfig } from './mcp/types';
2
+ import type { AnalyzerConfig } from './config/types';
3
+ /**
4
+ * Per-coverage-type threshold percentages.
5
+ * Each key corresponds to a coverage type (e.g. "endpoint", "parameter").
6
+ * A special "global" key sets the default for all categories.
7
+ */
8
+ export interface ThresholdsConfig {
9
+ global?: number;
10
+ endpoint?: number;
11
+ parameter?: number;
12
+ business?: number;
13
+ integration?: number;
14
+ security?: number;
15
+ error?: number;
16
+ performance?: number;
17
+ resilience?: number;
18
+ compatibility?: number;
19
+ [key: string]: number | undefined;
20
+ }
21
+ /**
22
+ * Exclusion rules applied before coverage calculations.
23
+ */
24
+ export interface ExcludeConfig {
25
+ /** Glob-style path patterns whose endpoints should be excluded (e.g. "/internal/*") */
26
+ paths?: string[];
27
+ /** HTTP methods to exclude (e.g. ["OPTIONS", "HEAD"]) */
28
+ methods?: string[];
29
+ }
30
+ /** Configuration for GitHub Pages publishing */
31
+ export interface GitHubPagesConfig {
32
+ enabled?: boolean;
33
+ /** Base path for the Pages site (e.g. "/apiTestsCoverageAnalyzer/") */
34
+ basePath?: string;
35
+ }
36
+ /** Which artifact formats to include in the published bundle */
37
+ export interface ArtifactsConfig {
38
+ includeJson?: boolean;
39
+ includeHtml?: boolean;
40
+ includeCsv?: boolean;
41
+ includeJunit?: boolean;
42
+ includeMarkdown?: boolean;
43
+ includeScreenshots?: boolean;
44
+ }
45
+ /** Screenshots capture configuration */
46
+ export interface ScreenshotsConfig {
47
+ /** Whether to attempt screenshot capture */
48
+ enabled?: boolean;
49
+ /** Fail the build if screenshots cannot be captured */
50
+ strict?: boolean;
51
+ /** Dashboard URL for headless capture (defaults to auto-started server) */
52
+ dashboardUrl?: string;
53
+ }
54
+ /** Publishing configuration block */
55
+ export interface PublishingConfig {
56
+ enabled?: boolean;
57
+ /** Output directory for the static site (default: "site") */
58
+ outputDir?: string;
59
+ /**
60
+ * How to generate the build ID.
61
+ * Supported: "timestamp" | "commit-sha" | "run-number" | "branch-timestamp" | custom string
62
+ */
63
+ buildId?: string;
64
+ githubPages?: GitHubPagesConfig;
65
+ artifacts?: ArtifactsConfig;
66
+ screenshots?: ScreenshotsConfig;
67
+ }
68
+ /** Quality gate configuration block */
69
+ export interface QualityGateConfig {
70
+ enabled?: boolean;
71
+ /** Fail the build (exit code 1) when a threshold is missed */
72
+ failBuildOnThresholdMiss?: boolean;
73
+ /** "strict" = fail on any breach; "warn" = log but do not fail */
74
+ mode?: 'strict' | 'warn';
75
+ }
76
+ /** Summary engine configuration block */
77
+ export interface SummaryConfig {
78
+ /** Whether to generate summaries at all (default: true) */
79
+ enabled?: boolean;
80
+ /** Generate a PR comment summary (default: true) */
81
+ generatePrSummary?: boolean;
82
+ /** Generate a build/CI summary (default: true) */
83
+ generateBuildSummary?: boolean;
84
+ /** Generate AI-friendly summary files (default: true) */
85
+ generateAiSummary?: boolean;
86
+ /** When true, omit sections for analyzers that did not run (default: false) */
87
+ includeOnlyEvaluatedSections?: boolean;
88
+ /** Post/update a PR comment when running in GitHub Actions PR context */
89
+ publishPrComment?: boolean;
90
+ /** Write step summary to $GITHUB_STEP_SUMMARY (default: true) */
91
+ publishGithubStepSummary?: boolean;
92
+ /** Generate Jenkins-compatible summary artifacts (default: true) */
93
+ publishJenkinsSummary?: boolean;
94
+ }
95
+ /**
96
+ * Top-level configuration object that can be provided via `coverage.config.json`.
97
+ */
98
+ export interface CoverageConfig {
99
+ /** Per-type minimum coverage thresholds (percentages 0–100). "global" sets the default. */
100
+ thresholds?: ThresholdsConfig;
101
+ /** Branch-aware threshold overrides, keyed by branch glob pattern */
102
+ thresholdsByBranch?: Record<string, ThresholdsConfig>;
103
+ /** Endpoints / methods to exclude from analysis */
104
+ exclude?: ExcludeConfig;
105
+ /** Glob patterns for test files (overrides CLI --tests default) */
106
+ testPatterns?: string[];
107
+ /** Paths to plugin modules to load after built-in analysis */
108
+ plugins?: string[];
109
+ /** Publishing / static-site generation settings */
110
+ publishing?: PublishingConfig;
111
+ /** Quality gate / threshold enforcement settings */
112
+ qualityGate?: QualityGateConfig;
113
+ /** Summary engine configuration */
114
+ summary?: SummaryConfig;
115
+ /** MCP (Model Context Protocol) integration configuration */
116
+ mcp?: McpConfig;
117
+ }
118
+ export declare const DEFAULT_CONFIG_FILENAME = "coverage.config.json";
119
+ export declare const defaultConfig: CoverageConfig;
120
+ /**
121
+ * Load a `CoverageConfig` from the given file path.
122
+ * The file must be valid JSON.
123
+ *
124
+ * @throws if the file exists but cannot be parsed.
125
+ */
126
+ export declare function loadConfigFile(filePath: string): CoverageConfig;
127
+ /**
128
+ * Resolve and load the configuration file.
129
+ *
130
+ * Resolution order:
131
+ * 1. If `configPath` is provided, load that file (error if missing).
132
+ * 2. Otherwise, look for `coverage.config.json` in the current working directory.
133
+ * 3. If neither is found, return the default (empty) configuration.
134
+ */
135
+ export declare function resolveConfig(configPath?: string): CoverageConfig;
136
+ /**
137
+ * Merge a loaded `CoverageConfig` with explicit CLI overrides.
138
+ * CLI values always take precedence over config-file values.
139
+ *
140
+ * @param fileConfig Configuration loaded from the file (may be empty).
141
+ * @param cliOverrides Values supplied directly on the command line.
142
+ */
143
+ export declare function mergeConfig(fileConfig: CoverageConfig, cliOverrides: Partial<CoverageConfig>): CoverageConfig;
144
+ /**
145
+ * Return `true` if the given `method` / `path` combination should be excluded
146
+ * according to `exclude` configuration rules.
147
+ *
148
+ * Path matching supports simple wildcard segments using `*`
149
+ * (e.g. `/internal/*` matches `/internal/anything`).
150
+ */
151
+ export declare function isExcluded(method: string, endpointPath: string, exclude: ExcludeConfig): boolean;
152
+ /**
153
+ * Load the central `config.yaml` and return a normalized `AnalyzerConfig`.
154
+ *
155
+ * This is the preferred loader for all new code. The legacy `resolveConfig`
156
+ * function is kept for backward compatibility but emits a deprecation warning
157
+ * when `coverage.config.json` is detected without a `config.yaml` present.
158
+ *
159
+ * @param configPath Optional explicit path (from --config flag).
160
+ */
161
+ export declare function loadCentralConfig(configPath?: string): AnalyzerConfig;
162
+ /**
163
+ * Map a legacy `CoverageConfig` object to the new `AnalyzerConfig` shape.
164
+ * Used for backward compatibility when callers still hold a `CoverageConfig`.
165
+ */
166
+ export declare function mapLegacyToAnalyzerConfig(legacy: CoverageConfig): Partial<AnalyzerConfig>;
167
+ export type { AnalyzerConfig } from './config/types';
168
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,204 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.defaultConfig = exports.DEFAULT_CONFIG_FILENAME = void 0;
37
+ exports.loadConfigFile = loadConfigFile;
38
+ exports.resolveConfig = resolveConfig;
39
+ exports.mergeConfig = mergeConfig;
40
+ exports.isExcluded = isExcluded;
41
+ exports.loadCentralConfig = loadCentralConfig;
42
+ exports.mapLegacyToAnalyzerConfig = mapLegacyToAnalyzerConfig;
43
+ const fs = __importStar(require("fs"));
44
+ const path = __importStar(require("path"));
45
+ const loadConfig_1 = require("./config/loadConfig");
46
+ // ─── Defaults ─────────────────────────────────────────────────────────────────
47
+ exports.DEFAULT_CONFIG_FILENAME = 'coverage.config.json';
48
+ exports.defaultConfig = {
49
+ thresholds: {},
50
+ exclude: {
51
+ paths: [],
52
+ methods: [],
53
+ },
54
+ testPatterns: [],
55
+ plugins: [],
56
+ };
57
+ // ─── Loader ───────────────────────────────────────────────────────────────────
58
+ /**
59
+ * Load a `CoverageConfig` from the given file path.
60
+ * The file must be valid JSON.
61
+ *
62
+ * @throws if the file exists but cannot be parsed.
63
+ */
64
+ function loadConfigFile(filePath) {
65
+ const raw = fs.readFileSync(filePath, 'utf-8');
66
+ const parsed = JSON.parse(raw);
67
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
68
+ throw new Error(`Configuration file ${filePath} must contain a JSON object`);
69
+ }
70
+ return parsed;
71
+ }
72
+ /**
73
+ * Resolve and load the configuration file.
74
+ *
75
+ * Resolution order:
76
+ * 1. If `configPath` is provided, load that file (error if missing).
77
+ * 2. Otherwise, look for `coverage.config.json` in the current working directory.
78
+ * 3. If neither is found, return the default (empty) configuration.
79
+ */
80
+ function resolveConfig(configPath) {
81
+ if (configPath) {
82
+ const absPath = path.resolve(configPath);
83
+ if (!fs.existsSync(absPath)) {
84
+ throw new Error(`Configuration file not found: ${absPath}`);
85
+ }
86
+ return loadConfigFile(absPath);
87
+ }
88
+ const defaultPath = path.join(process.cwd(), exports.DEFAULT_CONFIG_FILENAME);
89
+ if (fs.existsSync(defaultPath)) {
90
+ return loadConfigFile(defaultPath);
91
+ }
92
+ return { ...exports.defaultConfig };
93
+ }
94
+ /**
95
+ * Merge a loaded `CoverageConfig` with explicit CLI overrides.
96
+ * CLI values always take precedence over config-file values.
97
+ *
98
+ * @param fileConfig Configuration loaded from the file (may be empty).
99
+ * @param cliOverrides Values supplied directly on the command line.
100
+ */
101
+ function mergeConfig(fileConfig, cliOverrides) {
102
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
103
+ const merged = {
104
+ thresholds: {
105
+ ...((_a = fileConfig.thresholds) !== null && _a !== void 0 ? _a : {}),
106
+ ...((_b = cliOverrides.thresholds) !== null && _b !== void 0 ? _b : {}),
107
+ },
108
+ exclude: {
109
+ paths: (_f = (_d = (_c = cliOverrides.exclude) === null || _c === void 0 ? void 0 : _c.paths) !== null && _d !== void 0 ? _d : (_e = fileConfig.exclude) === null || _e === void 0 ? void 0 : _e.paths) !== null && _f !== void 0 ? _f : [],
110
+ methods: (_k = (_h = (_g = cliOverrides.exclude) === null || _g === void 0 ? void 0 : _g.methods) !== null && _h !== void 0 ? _h : (_j = fileConfig.exclude) === null || _j === void 0 ? void 0 : _j.methods) !== null && _k !== void 0 ? _k : [],
111
+ },
112
+ testPatterns: (cliOverrides.testPatterns && cliOverrides.testPatterns.length > 0)
113
+ ? cliOverrides.testPatterns
114
+ : ((_l = fileConfig.testPatterns) !== null && _l !== void 0 ? _l : []),
115
+ plugins: [
116
+ ...((_m = fileConfig.plugins) !== null && _m !== void 0 ? _m : []),
117
+ ...((_o = cliOverrides.plugins) !== null && _o !== void 0 ? _o : []),
118
+ ],
119
+ };
120
+ return merged;
121
+ }
122
+ // ─── Endpoint exclusion helper ────────────────────────────────────────────────
123
+ /**
124
+ * Return `true` if the given `method` / `path` combination should be excluded
125
+ * according to `exclude` configuration rules.
126
+ *
127
+ * Path matching supports simple wildcard segments using `*`
128
+ * (e.g. `/internal/*` matches `/internal/anything`).
129
+ */
130
+ function isExcluded(method, endpointPath, exclude) {
131
+ var _a, _b;
132
+ const methods = (_a = exclude.methods) !== null && _a !== void 0 ? _a : [];
133
+ if (methods.map((m) => m.toUpperCase()).includes(method.toUpperCase())) {
134
+ return true;
135
+ }
136
+ const patterns = (_b = exclude.paths) !== null && _b !== void 0 ? _b : [];
137
+ for (const pattern of patterns) {
138
+ if (matchesPathPattern(endpointPath, pattern)) {
139
+ return true;
140
+ }
141
+ }
142
+ return false;
143
+ }
144
+ /**
145
+ * Simple glob-style path pattern matcher.
146
+ * Supports `*` (matches a single path segment) and `**` (matches any path suffix).
147
+ */
148
+ function matchesPathPattern(endpointPath, pattern) {
149
+ // Escape special regex characters except * and convert glob * to regex
150
+ const regexStr = pattern
151
+ .replace(/[.+^${}()|[\]\\]/g, '\\$&') // escape regex specials (not *)
152
+ .replace(/\*\*/g, '.+') // ** → any characters
153
+ .replace(/\*/g, '[^/]+'); // * → any characters except /
154
+ const regex = new RegExp(`^${regexStr}$`);
155
+ return regex.test(endpointPath);
156
+ }
157
+ // ─── Central config integration (Feature 18) ──────────────────────────────────
158
+ /**
159
+ * Load the central `config.yaml` and return a normalized `AnalyzerConfig`.
160
+ *
161
+ * This is the preferred loader for all new code. The legacy `resolveConfig`
162
+ * function is kept for backward compatibility but emits a deprecation warning
163
+ * when `coverage.config.json` is detected without a `config.yaml` present.
164
+ *
165
+ * @param configPath Optional explicit path (from --config flag).
166
+ */
167
+ function loadCentralConfig(configPath) {
168
+ // Detect legacy config and warn before delegating.
169
+ const legacyPath = path.join(process.cwd(), loadConfig_1.LEGACY_CONFIG_FILENAME);
170
+ const centralPath = path.join(process.cwd(), loadConfig_1.DEFAULT_CONFIG_FILENAME);
171
+ if (fs.existsSync(legacyPath) && !fs.existsSync(centralPath) && !configPath) {
172
+ process.stderr.write(loadConfig_1.LEGACY_CONFIG_WARNING + '\n');
173
+ }
174
+ return (0, loadConfig_1.loadConfig)(configPath);
175
+ }
176
+ /**
177
+ * Map a legacy `CoverageConfig` object to the new `AnalyzerConfig` shape.
178
+ * Used for backward compatibility when callers still hold a `CoverageConfig`.
179
+ */
180
+ function mapLegacyToAnalyzerConfig(legacy) {
181
+ const partial = {};
182
+ if (legacy.thresholds) {
183
+ partial.thresholds = { ...legacy.thresholds };
184
+ }
185
+ if (legacy.qualityGate) {
186
+ partial.qualityGate = {
187
+ enabled: legacy.qualityGate.enabled,
188
+ failBuildOnThresholdMiss: legacy.qualityGate.failBuildOnThresholdMiss,
189
+ mode: legacy.qualityGate.mode,
190
+ };
191
+ }
192
+ if (legacy.publishing) {
193
+ partial.publishing = {
194
+ enabled: legacy.publishing.enabled,
195
+ githubPages: legacy.publishing.githubPages
196
+ ? { enabled: legacy.publishing.githubPages.enabled }
197
+ : undefined,
198
+ };
199
+ }
200
+ if (legacy.mcp) {
201
+ partial.mcp = legacy.mcp;
202
+ }
203
+ return partial;
204
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Deep Code Analysis — Call Graph Construction
3
+ *
4
+ * Builds a lightweight per-file call graph that maps function/method names to
5
+ * their bodies and the other local functions they call.
6
+ *
7
+ * This call graph is used by wrapper-method and helper-method resolution to
8
+ * follow call chains up to a configurable depth.
9
+ */
10
+ import type { CallGraph } from './types';
11
+ /**
12
+ * Extract top-level function definitions and their bodies from
13
+ * TypeScript/JavaScript source.
14
+ *
15
+ * Handles:
16
+ * function foo() { ... }
17
+ * const foo = () => { ... }
18
+ * const foo = (params) => { ... }
19
+ * const foo = function() { ... }
20
+ */
21
+ export declare function extractJsFunctions(content: string): Array<{
22
+ name: string;
23
+ body: string;
24
+ }>;
25
+ /**
26
+ * Extract method definitions from Java / Kotlin source.
27
+ *
28
+ * Handles:
29
+ * [modifiers] returnType methodName([params]) { body }
30
+ * fun methodName([params]): ReturnType { body }
31
+ */
32
+ export declare function extractJavaKotlinFunctions(content: string): Array<{
33
+ name: string;
34
+ body: string;
35
+ }>;
36
+ /**
37
+ * Extract Python function definitions.
38
+ *
39
+ * Handles:
40
+ * def function_name(params):
41
+ * body (indented block)
42
+ */
43
+ export declare function extractPythonFunctions(content: string): Array<{
44
+ name: string;
45
+ body: string;
46
+ }>;
47
+ /**
48
+ * Build a call graph from JavaScript/TypeScript source.
49
+ */
50
+ export declare function buildJsCallGraph(content: string): CallGraph;
51
+ /**
52
+ * Build a call graph from Java/Kotlin source.
53
+ */
54
+ export declare function buildJavaCallGraph(content: string): CallGraph;
55
+ /**
56
+ * Build a call graph from Python source.
57
+ */
58
+ export declare function buildPythonCallGraph(content: string): CallGraph;
59
+ /**
60
+ * Extract the content of a brace-delimited block starting at `startIndex`
61
+ * (which must point at the opening `{`). Returns the inner body without
62
+ * the surrounding braces.
63
+ *
64
+ * Returns undefined if braces are not balanced.
65
+ */
66
+ export declare function extractBalancedBraces(content: string, startIndex: number): string | undefined;
67
+ //# sourceMappingURL=callGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callGraph.d.ts","sourceRoot":"","sources":["../../../../src/coverage/deep-analysis/callGraph.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAiB,MAAM,SAAS,CAAC;AAIxD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAazF;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAcjG;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CA4C7F;AAID;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAgB3D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAgB7D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAgB/D;AA8FD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA6B7F"}