@cdxgen/cdxgen 13.0.1 → 13.2.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 (286) hide show
  1. package/README.md +30 -16
  2. package/bin/audit.js +6 -0
  3. package/bin/cdxgen.js +141 -7
  4. package/bin/evinse.js +3 -1
  5. package/data/component-tags.json +8 -1
  6. package/data/crypto-oid.json +88 -12
  7. package/data/frameworks-list.json +86 -1
  8. package/data/remediations.json +1167 -0
  9. package/data/rules/ai-bom.yaml +78 -0
  10. package/data/rules/asar-archives.yaml +1 -1
  11. package/data/rules/build-fidelity.yaml +782 -0
  12. package/data/rules/cargo-rust.yaml +132 -0
  13. package/data/rules/mcp-servers.yaml +122 -0
  14. package/data/rules/package-integrity.yaml +13 -13
  15. package/lib/audit/index.js +48 -4
  16. package/lib/audit/scoring.js +2 -8
  17. package/lib/audit/targets.js +6 -1
  18. package/lib/cli/bomAssembly.js +32 -1
  19. package/lib/cli/cliOptions.js +94 -7
  20. package/lib/cli/index.js +268 -49
  21. package/lib/cli/jsBom.js +91 -5
  22. package/lib/cli/jvmBom.js +1515 -1314
  23. package/lib/cli/managedBom.js +249 -28
  24. package/lib/cli/nativeBom.js +986 -10
  25. package/lib/core/activity.js +120 -2
  26. package/lib/core/buildLedger.js +799 -0
  27. package/lib/core/deferredExit.js +141 -0
  28. package/lib/core/env.js +108 -2
  29. package/lib/core/fs.js +60 -0
  30. package/lib/core/logger.js +12 -99
  31. package/lib/core/severity.js +16 -0
  32. package/lib/core/syncFileWriter.js +106 -0
  33. package/lib/core/userAgent.js +151 -0
  34. package/lib/ecosystems/cargoCache.js +364 -0
  35. package/lib/ecosystems/caxa.js +13 -5
  36. package/lib/ecosystems/cppEvidence.js +40 -2
  37. package/lib/ecosystems/ecosystems.js +250 -91
  38. package/lib/ecosystems/golem.js +11 -1
  39. package/lib/ecosystems/gradleutils.js +498 -17
  40. package/lib/ecosystems/kosi.js +1256 -0
  41. package/lib/ecosystems/parsers-crystal.js +179 -0
  42. package/lib/ecosystems/parsers-dotnet.js +69 -39
  43. package/lib/ecosystems/parsers-elm.js +816 -0
  44. package/lib/ecosystems/parsers-gleam.js +1 -1
  45. package/lib/ecosystems/parsers-js.js +26 -0
  46. package/lib/ecosystems/parsers-julia.js +268 -0
  47. package/lib/ecosystems/parsers-jvm.js +9 -0
  48. package/lib/ecosystems/parsers-lua.js +218 -0
  49. package/lib/ecosystems/parsers-misc.js +188 -2
  50. package/lib/ecosystems/parsers-nim.js +221 -0
  51. package/lib/ecosystems/parsers-opam.js +180 -0
  52. package/lib/ecosystems/parsers-perl.js +277 -0
  53. package/lib/ecosystems/parsers-python.js +172 -36
  54. package/lib/ecosystems/parsers-r.js +148 -0
  55. package/lib/ecosystems/parsers-rebar.js +411 -0
  56. package/lib/ecosystems/parsers-rust.js +944 -19
  57. package/lib/ecosystems/parsers-spack.js +204 -0
  58. package/lib/ecosystems/parsers-stack.js +264 -0
  59. package/lib/ecosystems/parsers-terraform.js +194 -0
  60. package/lib/ecosystems/pypiClassifiers.js +326 -0
  61. package/lib/ecosystems/pythonutils.js +49 -1
  62. package/lib/ecosystems/rubyutils.js +13 -0
  63. package/lib/ecosystems/rusi.js +126 -6
  64. package/lib/evinser/evinser.js +141 -13
  65. package/lib/helpers/agenticToolutils.js +925 -0
  66. package/lib/helpers/remote/dependency-track.js +81 -14
  67. package/lib/inventory/agentFormulationParser.js +57 -4
  68. package/lib/inventory/aiCollector.js +504 -10
  69. package/lib/inventory/aiInventory.js +12 -0
  70. package/lib/inventory/analyzer.js +488 -30
  71. package/lib/inventory/astWorker.js +6 -0
  72. package/lib/inventory/auditCategories.js +17 -0
  73. package/lib/inventory/cbomutils.js +30 -0
  74. package/lib/inventory/cdxrs.js +7 -2
  75. package/lib/inventory/communityAiConfigParser.js +215 -2
  76. package/lib/inventory/depsUtils.js +72 -0
  77. package/lib/inventory/dosai.js +508 -22
  78. package/lib/inventory/envcontext.js +215 -24
  79. package/lib/inventory/evidenceUtils.js +13 -0
  80. package/lib/inventory/fetchBatch.js +131 -2
  81. package/lib/inventory/fetchRate.js +74 -11
  82. package/lib/inventory/forgeEnricher.js +3 -2
  83. package/lib/inventory/jvmToolEnv.js +594 -0
  84. package/lib/inventory/mcpConfigParser.js +166 -2
  85. package/lib/inventory/mcpDiscovery.js +11 -0
  86. package/lib/inventory/mcpServerManifest.js +389 -0
  87. package/lib/inventory/mcpbBundle.js +419 -0
  88. package/lib/inventory/osinfo.js +1 -0
  89. package/lib/inventory/plugins.js +3 -0
  90. package/lib/inventory/protobom.js +54 -88
  91. package/lib/inventory/protobomLoader.js +4 -0
  92. package/lib/inventory/rustFormulationParser.js +1 -1
  93. package/lib/inventory/source.js +10 -4
  94. package/lib/inventory/stylePackageRefs.js +41 -0
  95. package/lib/inventory/svelteUtils.js +524 -0
  96. package/lib/inventory/toolRequirements.js +903 -0
  97. package/lib/managers/binary.js +24 -0
  98. package/lib/managers/docker.js +26 -5
  99. package/lib/parsers/huggingfaceUtils.js +15 -7
  100. package/lib/parsers/onnx.js +294 -0
  101. package/lib/parsers/safetensors.js +114 -0
  102. package/lib/server/server.js +1 -1
  103. package/lib/stages/postgen/annotationBuilder.js +97 -0
  104. package/lib/stages/postgen/auditBom.js +76 -79
  105. package/lib/stages/postgen/introspection/annotate.js +320 -0
  106. package/lib/stages/postgen/introspection/commandFacts.js +293 -0
  107. package/lib/stages/postgen/introspection/emit.js +192 -0
  108. package/lib/stages/postgen/introspection/formulationEvidence.js +427 -0
  109. package/lib/stages/postgen/introspection/markers.js +250 -0
  110. package/lib/stages/postgen/introspection/reflect.js +1214 -0
  111. package/lib/stages/postgen/introspection/report.js +1208 -0
  112. package/lib/stages/postgen/introspection/score.js +1067 -0
  113. package/lib/stages/postgen/introspection/shapeCommand.js +304 -0
  114. package/lib/stages/postgen/parentEdge.js +156 -0
  115. package/lib/stages/postgen/postgen.js +284 -3
  116. package/lib/stages/postgen/ruleEngine.js +17 -0
  117. package/lib/stages/pregen/envAudit.js +42 -2
  118. package/lib/stages/pregen/pregen.js +1171 -6
  119. package/lib/third-party/arborist/snapshots/calc-dep-flags.test.cjs +462 -0
  120. package/lib/validator/bomValidator.js +11 -2
  121. package/package.json +26 -26
  122. package/types/lib/audit/index.d.ts.map +1 -1
  123. package/types/lib/audit/scoring.d.ts +2 -8
  124. package/types/lib/audit/scoring.d.ts.map +1 -1
  125. package/types/lib/audit/targets.d.ts.map +1 -1
  126. package/types/lib/cli/bomAssembly.d.ts.map +1 -1
  127. package/types/lib/cli/cliOptions.d.ts +2 -1
  128. package/types/lib/cli/cliOptions.d.ts.map +1 -1
  129. package/types/lib/cli/index.d.ts +10 -2
  130. package/types/lib/cli/index.d.ts.map +1 -1
  131. package/types/lib/cli/jsBom.d.ts +23 -0
  132. package/types/lib/cli/jsBom.d.ts.map +1 -1
  133. package/types/lib/cli/jvmBom.d.ts.map +1 -1
  134. package/types/lib/cli/managedBom.d.ts +33 -0
  135. package/types/lib/cli/managedBom.d.ts.map +1 -1
  136. package/types/lib/cli/nativeBom.d.ts +88 -8
  137. package/types/lib/cli/nativeBom.d.ts.map +1 -1
  138. package/types/lib/core/activity.d.ts.map +1 -1
  139. package/types/lib/core/buildLedger.d.ts +272 -0
  140. package/types/lib/core/buildLedger.d.ts.map +1 -0
  141. package/types/lib/core/deferredExit.d.ts +84 -0
  142. package/types/lib/core/deferredExit.d.ts.map +1 -0
  143. package/types/lib/core/env.d.ts +43 -1
  144. package/types/lib/core/env.d.ts.map +1 -1
  145. package/types/lib/core/fs.d.ts +21 -0
  146. package/types/lib/core/fs.d.ts.map +1 -1
  147. package/types/lib/core/logger.d.ts +2 -11
  148. package/types/lib/core/logger.d.ts.map +1 -1
  149. package/types/lib/core/severity.d.ts +11 -0
  150. package/types/lib/core/severity.d.ts.map +1 -0
  151. package/types/lib/core/syncFileWriter.d.ts +33 -0
  152. package/types/lib/core/syncFileWriter.d.ts.map +1 -0
  153. package/types/lib/core/userAgent.d.ts +56 -0
  154. package/types/lib/core/userAgent.d.ts.map +1 -0
  155. package/types/lib/ecosystems/cargoCache.d.ts +75 -0
  156. package/types/lib/ecosystems/cargoCache.d.ts.map +1 -0
  157. package/types/lib/ecosystems/caxa.d.ts.map +1 -1
  158. package/types/lib/ecosystems/cppEvidence.d.ts +1 -1
  159. package/types/lib/ecosystems/cppEvidence.d.ts.map +1 -1
  160. package/types/lib/ecosystems/ecosystems.d.ts +15 -1
  161. package/types/lib/ecosystems/ecosystems.d.ts.map +1 -1
  162. package/types/lib/ecosystems/gradleutils.d.ts +53 -0
  163. package/types/lib/ecosystems/gradleutils.d.ts.map +1 -1
  164. package/types/lib/ecosystems/kosi.d.ts +73 -0
  165. package/types/lib/ecosystems/kosi.d.ts.map +1 -0
  166. package/types/lib/ecosystems/parsers-crystal.d.ts +27 -0
  167. package/types/lib/ecosystems/parsers-crystal.d.ts.map +1 -0
  168. package/types/lib/ecosystems/parsers-dotnet.d.ts +19 -0
  169. package/types/lib/ecosystems/parsers-dotnet.d.ts.map +1 -1
  170. package/types/lib/ecosystems/parsers-elm.d.ts +79 -0
  171. package/types/lib/ecosystems/parsers-elm.d.ts.map +1 -0
  172. package/types/lib/ecosystems/parsers-js.d.ts.map +1 -1
  173. package/types/lib/ecosystems/parsers-julia.d.ts +57 -0
  174. package/types/lib/ecosystems/parsers-julia.d.ts.map +1 -0
  175. package/types/lib/ecosystems/parsers-jvm.d.ts.map +1 -1
  176. package/types/lib/ecosystems/parsers-lua.d.ts +50 -0
  177. package/types/lib/ecosystems/parsers-lua.d.ts.map +1 -0
  178. package/types/lib/ecosystems/parsers-misc.d.ts +23 -0
  179. package/types/lib/ecosystems/parsers-misc.d.ts.map +1 -1
  180. package/types/lib/ecosystems/parsers-nim.d.ts +43 -0
  181. package/types/lib/ecosystems/parsers-nim.d.ts.map +1 -0
  182. package/types/lib/ecosystems/parsers-opam.d.ts +31 -0
  183. package/types/lib/ecosystems/parsers-opam.d.ts.map +1 -0
  184. package/types/lib/ecosystems/parsers-perl.d.ts +36 -0
  185. package/types/lib/ecosystems/parsers-perl.d.ts.map +1 -0
  186. package/types/lib/ecosystems/parsers-python.d.ts.map +1 -1
  187. package/types/lib/ecosystems/parsers-r.d.ts +35 -0
  188. package/types/lib/ecosystems/parsers-r.d.ts.map +1 -0
  189. package/types/lib/ecosystems/parsers-rebar.d.ts +42 -0
  190. package/types/lib/ecosystems/parsers-rebar.d.ts.map +1 -0
  191. package/types/lib/ecosystems/parsers-rust.d.ts +199 -0
  192. package/types/lib/ecosystems/parsers-rust.d.ts.map +1 -1
  193. package/types/lib/ecosystems/parsers-spack.d.ts +33 -0
  194. package/types/lib/ecosystems/parsers-spack.d.ts.map +1 -0
  195. package/types/lib/ecosystems/parsers-stack.d.ts +35 -0
  196. package/types/lib/ecosystems/parsers-stack.d.ts.map +1 -0
  197. package/types/lib/ecosystems/parsers-terraform.d.ts +34 -0
  198. package/types/lib/ecosystems/parsers-terraform.d.ts.map +1 -0
  199. package/types/lib/ecosystems/pypiClassifiers.d.ts +80 -0
  200. package/types/lib/ecosystems/pypiClassifiers.d.ts.map +1 -0
  201. package/types/lib/ecosystems/pythonutils.d.ts +21 -1
  202. package/types/lib/ecosystems/pythonutils.d.ts.map +1 -1
  203. package/types/lib/ecosystems/rubyutils.d.ts.map +1 -1
  204. package/types/lib/ecosystems/rusi.d.ts.map +1 -1
  205. package/types/lib/evinser/evinser.d.ts +34 -1
  206. package/types/lib/evinser/evinser.d.ts.map +1 -1
  207. package/types/lib/helpers/agenticToolutils.d.ts +87 -0
  208. package/types/lib/helpers/agenticToolutils.d.ts.map +1 -0
  209. package/types/lib/helpers/remote/dependency-track.d.ts +45 -4
  210. package/types/lib/helpers/remote/dependency-track.d.ts.map +1 -1
  211. package/types/lib/inventory/agentFormulationParser.d.ts.map +1 -1
  212. package/types/lib/inventory/aiCollector.d.ts.map +1 -1
  213. package/types/lib/inventory/aiInventory.d.ts.map +1 -1
  214. package/types/lib/inventory/analyzer.d.ts.map +1 -1
  215. package/types/lib/inventory/auditCategories.d.ts +12 -0
  216. package/types/lib/inventory/auditCategories.d.ts.map +1 -1
  217. package/types/lib/inventory/cbomutils.d.ts.map +1 -1
  218. package/types/lib/inventory/communityAiConfigParser.d.ts.map +1 -1
  219. package/types/lib/inventory/depsUtils.d.ts.map +1 -1
  220. package/types/lib/inventory/dosai.d.ts +43 -0
  221. package/types/lib/inventory/dosai.d.ts.map +1 -1
  222. package/types/lib/inventory/envcontext.d.ts.map +1 -1
  223. package/types/lib/inventory/evidenceUtils.d.ts.map +1 -1
  224. package/types/lib/inventory/fetchBatch.d.ts +43 -0
  225. package/types/lib/inventory/fetchBatch.d.ts.map +1 -1
  226. package/types/lib/inventory/fetchRate.d.ts +9 -6
  227. package/types/lib/inventory/fetchRate.d.ts.map +1 -1
  228. package/types/lib/inventory/forgeEnricher.d.ts.map +1 -1
  229. package/types/lib/inventory/jvmToolEnv.d.ts +190 -0
  230. package/types/lib/inventory/jvmToolEnv.d.ts.map +1 -0
  231. package/types/lib/inventory/mcpConfigParser.d.ts.map +1 -1
  232. package/types/lib/inventory/mcpDiscovery.d.ts.map +1 -1
  233. package/types/lib/inventory/mcpServerManifest.d.ts +19 -0
  234. package/types/lib/inventory/mcpServerManifest.d.ts.map +1 -0
  235. package/types/lib/inventory/mcpbBundle.d.ts +19 -0
  236. package/types/lib/inventory/mcpbBundle.d.ts.map +1 -0
  237. package/types/lib/inventory/osinfo.d.ts.map +1 -1
  238. package/types/lib/inventory/plugins.d.ts.map +1 -1
  239. package/types/lib/inventory/protobom.d.ts +18 -13
  240. package/types/lib/inventory/protobom.d.ts.map +1 -1
  241. package/types/lib/inventory/protobomLoader.d.ts.map +1 -1
  242. package/types/lib/inventory/source.d.ts.map +1 -1
  243. package/types/lib/inventory/stylePackageRefs.d.ts +17 -0
  244. package/types/lib/inventory/stylePackageRefs.d.ts.map +1 -0
  245. package/types/lib/inventory/svelteUtils.d.ts +124 -0
  246. package/types/lib/inventory/svelteUtils.d.ts.map +1 -0
  247. package/types/lib/inventory/toolRequirements.d.ts +216 -0
  248. package/types/lib/inventory/toolRequirements.d.ts.map +1 -0
  249. package/types/lib/managers/binary.d.ts.map +1 -1
  250. package/types/lib/managers/docker.d.ts.map +1 -1
  251. package/types/lib/parsers/huggingfaceUtils.d.ts +8 -1
  252. package/types/lib/parsers/huggingfaceUtils.d.ts.map +1 -1
  253. package/types/lib/parsers/onnx.d.ts +28 -0
  254. package/types/lib/parsers/onnx.d.ts.map +1 -0
  255. package/types/lib/parsers/safetensors.d.ts +22 -0
  256. package/types/lib/parsers/safetensors.d.ts.map +1 -0
  257. package/types/lib/stages/postgen/annotationBuilder.d.ts +53 -0
  258. package/types/lib/stages/postgen/annotationBuilder.d.ts.map +1 -0
  259. package/types/lib/stages/postgen/auditBom.d.ts.map +1 -1
  260. package/types/lib/stages/postgen/introspection/annotate.d.ts +81 -0
  261. package/types/lib/stages/postgen/introspection/annotate.d.ts.map +1 -0
  262. package/types/lib/stages/postgen/introspection/commandFacts.d.ts +32 -0
  263. package/types/lib/stages/postgen/introspection/commandFacts.d.ts.map +1 -0
  264. package/types/lib/stages/postgen/introspection/emit.d.ts +71 -0
  265. package/types/lib/stages/postgen/introspection/emit.d.ts.map +1 -0
  266. package/types/lib/stages/postgen/introspection/formulationEvidence.d.ts +154 -0
  267. package/types/lib/stages/postgen/introspection/formulationEvidence.d.ts.map +1 -0
  268. package/types/lib/stages/postgen/introspection/markers.d.ts +58 -0
  269. package/types/lib/stages/postgen/introspection/markers.d.ts.map +1 -0
  270. package/types/lib/stages/postgen/introspection/reflect.d.ts +77 -0
  271. package/types/lib/stages/postgen/introspection/reflect.d.ts.map +1 -0
  272. package/types/lib/stages/postgen/introspection/report.d.ts +85 -0
  273. package/types/lib/stages/postgen/introspection/report.d.ts.map +1 -0
  274. package/types/lib/stages/postgen/introspection/score.d.ts +149 -0
  275. package/types/lib/stages/postgen/introspection/score.d.ts.map +1 -0
  276. package/types/lib/stages/postgen/introspection/shapeCommand.d.ts +79 -0
  277. package/types/lib/stages/postgen/introspection/shapeCommand.d.ts.map +1 -0
  278. package/types/lib/stages/postgen/parentEdge.d.ts +35 -0
  279. package/types/lib/stages/postgen/parentEdge.d.ts.map +1 -0
  280. package/types/lib/stages/postgen/postgen.d.ts +35 -2
  281. package/types/lib/stages/postgen/postgen.d.ts.map +1 -1
  282. package/types/lib/stages/postgen/ruleEngine.d.ts.map +1 -1
  283. package/types/lib/stages/pregen/envAudit.d.ts.map +1 -1
  284. package/types/lib/stages/pregen/pregen.d.ts +131 -0
  285. package/types/lib/stages/pregen/pregen.d.ts.map +1 -1
  286. package/types/lib/validator/bomValidator.d.ts.map +1 -1
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Reader over the BOM's formulation section, the third evidence source.
3
+ *
4
+ * Formulation is two things at once, and the distinction governs every
5
+ * confidence decision downstream. The run-derived half — `type: "platform"`
6
+ * components recording the toolchain the generating run probed, and the git
7
+ * provenance components — is what cdxgen itself did. The config-parsed half —
8
+ * the commands, environment variables and task types under
9
+ * `formulation[].workflows[]` — is what the repo's CI declares, and a
10
+ * declared command was never observed to run.
11
+ *
12
+ * This module is pure: the BOM and the caller's run facts are the only
13
+ * inputs, nothing is read from the filesystem, and environment variable
14
+ * *values* are never touched — names only, because the BOM stores them and
15
+ * copying them into a report would republish them.
16
+ */
17
+ /**
18
+ * Property carrying the id of the run that stamped a BOM's formulation, set
19
+ * on every formulation workflow by the introspection pass that reflected
20
+ * over the freshly generated document.
21
+ *
22
+ * @type {string}
23
+ */
24
+ export declare const FORMULATION_RUN_ID_PROPERTY: string;
25
+ /** The formulation record was produced by the run being reflected. */
26
+ export declare const FORMULATION_ORIGIN_SAME_RUN = "same-run";
27
+ /** The formulation record came with a BOM this run did not generate. */
28
+ export declare const FORMULATION_ORIGIN_FOREIGN = "foreign";
29
+ /**
30
+ * The BOM carries no formulation record at all, which is neither of the
31
+ * above: there is no evidence to weigh, so every consumer must behave as it
32
+ * did before formulation became a source.
33
+ */
34
+ export declare const FORMULATION_ORIGIN_ABSENT = "absent";
35
+ /**
36
+ * Platform component names, as the environment probes emit them, mapped to
37
+ * the canonical ecosystem whose row their facts can corroborate. Names not
38
+ * listed here have no fidelity row to join.
39
+ *
40
+ * @type {Readonly<Record<string, string>>}
41
+ */
42
+ export declare const TOOL_NAME_ECOSYSTEMS: Readonly<Record<string, string>>;
43
+ /**
44
+ * Resolver executables whose presence in a declared command says a build or
45
+ * dependency resolution was attempted, mapped to the ecosystem they drive.
46
+ * Keys are executable basenames, lower-cased.
47
+ *
48
+ * @type {Readonly<Record<string, string>>}
49
+ */
50
+ export declare const RESOLVER_EXECUTABLES: Readonly<Record<string, string>>;
51
+ /**
52
+ * Whether an `executed` value is a CI action reference such as
53
+ * `actions/checkout@<sha>` rather than a shell command. An action reference
54
+ * carries no whitespace, contains a path separator, and names a revision of
55
+ * the repository after the last separator; a relative-path executable such
56
+ * as `./mvnw` carries no revision and stays a command.
57
+ *
58
+ * @param {string|undefined} executed The executed value of a step command.
59
+ * @returns {boolean} True when the value names an action, not a command.
60
+ */
61
+ export declare function isActionReference(executed: string | undefined): boolean;
62
+ /**
63
+ * The executable a command line starts with, as a bare name.
64
+ *
65
+ * @param {string|undefined} commandLine Command line.
66
+ * @returns {string} Basename of the first whitespace token, or "" when absent.
67
+ */
68
+ export declare function executableOf(commandLine: string | undefined): string;
69
+ /**
70
+ * Read the provenance-aware formulation evidence out of a BOM.
71
+ *
72
+ * `origin` decides how the evidence may be used. `same-run` means the
73
+ * formulation describes this very run — its platform components are the same
74
+ * probes the ledger recorded as `tool.resolved`, so the evidence corroborates
75
+ * and must never add confidence. `foreign` means the BOM arrived without a
76
+ * ledger for its generation, and the formulation is the only surviving trace
77
+ * of what that build attempted. `absent` is neither: the BOM carries no
78
+ * formulation record, so there is nothing to weigh and every consumer keeps
79
+ * the behaviour it had before formulation became a source.
80
+ *
81
+ * Environment variable names are collected; values are never read.
82
+ *
83
+ * @param {Object} bomJson CycloneDX BOM.
84
+ * @param {Object} [context] Run facts the caller already knows.
85
+ * @param {string} [context.runId] This reflection's run id, matched against the formulation's marker.
86
+ * @param {number} [context.ledgerEventCount] Events the ledger holds for this BOM's generation.
87
+ * @returns {{
88
+ * origin: "same-run"|"foreign"|"absent",
89
+ * tools: {name: string|undefined, version: string|undefined, source: "probe"}[],
90
+ * declaredCommands: {executable: string, commandLine: string, workflow: string|undefined, task: string|undefined, step: string|undefined, source: "ci-config"}[],
91
+ * sourceTree: {commit: string|undefined, treeId: string|undefined, fileCount: number}|undefined,
92
+ * environmentKeys: string[]
93
+ * }} The formulation evidence.
94
+ */
95
+ export declare function readFormulationEvidence(bomJson: Object, context?: {
96
+ runId?: string;
97
+ ledgerEventCount?: number;
98
+ }): {
99
+ origin: "same-run" | "foreign" | "absent";
100
+ tools: {
101
+ name: string | undefined;
102
+ version: string | undefined;
103
+ source: "probe";
104
+ }[];
105
+ declaredCommands: {
106
+ executable: string;
107
+ commandLine: string;
108
+ workflow: string | undefined;
109
+ task: string | undefined;
110
+ step: string | undefined;
111
+ source: "ci-config";
112
+ }[];
113
+ sourceTree: {
114
+ commit: string | undefined;
115
+ treeId: string | undefined;
116
+ fileCount: number;
117
+ } | undefined;
118
+ environmentKeys: string[];
119
+ };
120
+ /**
121
+ * The formulation platform entry for the runtime family this reflection runs
122
+ * on, when the record cannot describe the machine in use: either the
123
+ * recorded version of the family differs from the runtime actually running,
124
+ * or the record names other toolchains but no entry of this family at all. A
125
+ * difference proves the formulation's toolchain record describes a machine
126
+ * other than the one re-scanning the BOM; it says nothing about the other
127
+ * toolchains the record names, which no probe of this run observed.
128
+ *
129
+ * @param {Object} evidence Formulation evidence from readFormulationEvidence.
130
+ * @param {Object} runtime The reflection's runtime facts.
131
+ * @param {string} runtime.name Runtime name, such as "Node.js".
132
+ * @param {string} runtime.version Runtime version.
133
+ * @returns {{tool: string, recordedVersion: string|undefined, runtimeVersion: string}|undefined} The mismatching formulation entry, when one exists.
134
+ */
135
+ export declare function findRuntimeToolMismatch(evidence: Object, runtime: {
136
+ name: string;
137
+ version: string;
138
+ }): {
139
+ tool: string;
140
+ recordedVersion: string | undefined;
141
+ runtimeVersion: string;
142
+ } | undefined;
143
+ /**
144
+ * The declared CI command a formulation records for one ecosystem, if any.
145
+ * Commands carry no ecosystem tag, so the executable answers: the first
146
+ * declared command whose executable drives that ecosystem's resolver wins,
147
+ * in the order the formulation records them.
148
+ *
149
+ * @param {Object} evidence Formulation evidence from readFormulationEvidence.
150
+ * @param {string} ecosystem Canonical ecosystem name.
151
+ * @returns {Object|undefined} The matching declared command entry.
152
+ */
153
+ export declare function declaredCommandForEcosystem(evidence: Object, ecosystem: string): Object | undefined;
154
+ //# sourceMappingURL=formulationEvidence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formulationEvidence.d.ts","sourceRoot":"","sources":["../../../../../lib/stages/postgen/introspection/formulationEvidence.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,EAF9B,MAE0D,CAAC;AAErE,sEAAsE;AACtE,eAAO,MAAM,2BAA2B,aAAa,CAAC;AAEtD,wEAAwE;AACxE,eAAO,MAAM,0BAA0B,YAAY,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAElD;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAFvB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYvC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAFvB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAkDvC,CAAC;AA6BH;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAH/B,MAAM,GAAC,SAGwB,GAF7B,OAAO,CAYnB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAH7B,MAAM,GAAC,SAGsB,GAF3B,MAAM,CAKlB;AA6ED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAZpC,MAYoC,EAAE,OAAO,AAXrD,CAGA,EAFA;IAAyB,KAAK,AAA9B,CACA,EADQ,MAAM,CACd;IAAyB,gBAAgB,AAAzC,CACA,EADQ,MAAM,CACd;CAQ0D,GARhD;IACR,MAAM,EAAE,UAAU,GAAC,SAAS,GAAC,QAAQ,CAAC;IACtC,KAAK,EAAE;QAAC,IAAI,EAAE,MAAM,GAAC,SAAS,CAAC;QAAC,OAAO,EAAE,MAAM,GAAC,SAAS,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAC,EAAE,CAAC;IAC9E,gBAAgB,EAAE;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAC,SAAS,CAAC;QAAC,IAAI,EAAE,MAAM,GAAC,SAAS,CAAC;QAAC,IAAI,EAAE,MAAM,GAAC,SAAS,CAAC;QAAC,MAAM,EAAE,WAAW,CAAA;KAAC,EAAE,CAAC;IAC/J,UAAU,EAAE;QAAC,MAAM,EAAE,MAAM,GAAC,SAAS,CAAC;QAAC,MAAM,EAAE,MAAM,GAAC,SAAS,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAC,GAAC,SAAS,CAAC;IAC9F,eAAe,EAAE,MAAM,EAAE,CAAA;CAC1B,CA2FH;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EANrC,MAMqC,EAAE,OAAO,EAJtD;IAAwB,IAAI,EAApB,MAAM,CACd;IAAwB,OAAO,EAAvB,MAAM,CACd;CAEsD,GAF5C;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,GAAC,SAAS,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAC,GAAC,SAAS,CAyB/F;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,QAAQ,EAJzC,MAIyC,EAAE,SAAS,EAHpD,MAGoD,GAFlD,MAAM,GAAC,SAAS,CAW5B"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Ecosystem marker detection for the build-introspection reflection step.
3
+ *
4
+ * A marker is a manifest or lockfile whose presence on disk proves an
5
+ * ecosystem was part of the scanned project. Markers drive two verdicts:
6
+ * an ecosystem with markers but zero components in the BOM is `absent`, and
7
+ * an ecosystem that has markers but no cdxgen project type at all is a
8
+ * coverage gap (`unsupported`), which is cdxgen's backlog rather than the
9
+ * user's problem.
10
+ *
11
+ * Detection is deliberately bounded: the scanned directory itself plus one
12
+ * level of immediate subdirectories. postProcess runs after generation, so a
13
+ * second full tree walk would be a measurable cost on large repos; markers
14
+ * deeper than one directory level are simply not seen, which is acceptable
15
+ * because tier assignment never relies on markers alone when the BOM already
16
+ * carries the ecosystem's components.
17
+ */
18
+ /**
19
+ * Marker table: ecosystem → manifest and lockfile names that indicate the
20
+ * ecosystem is part of the project. Entries are either exact file names or
21
+ * `{ suffix }` matchers for extension-driven ecosystems. Ecosystems cdxgen
22
+ * cannot parse (currently only dub, the D package manager) are included so
23
+ * the reflection can report them as coverage gaps instead of silently
24
+ * ignoring them.
25
+ *
26
+ * @type {Readonly<Record<string, {names: string[], suffixes: string[]}>>}
27
+ */
28
+ export declare const ECOSYSTEM_MARKERS: Readonly<Record<string, {
29
+ names: string[];
30
+ suffixes: string[];
31
+ }>>;
32
+ /** Marker file name → ecosystems claiming it, and marker suffix → claiming
33
+ * ecosystems, both built once from the table. The name index is exported so
34
+ * the reflection can recognize marker paths carried in ledger events without
35
+ * rescanning the filesystem. */
36
+ export declare const MARKERS_BY_NAME: Map<any, any>;
37
+ /**
38
+ * Detect ecosystem markers under a project directory without walking the full
39
+ * tree: the directory itself is inspected, then up to
40
+ * {@link MAX_SUBDIRS_SCANNED} immediate subdirectories in sorted order. Paths
41
+ * are built with `node:path`, so `markersOnDisk` carries platform-correct
42
+ * separators.
43
+ *
44
+ * @param {string} projectPath Directory that was scanned, when known.
45
+ * @param {Object} [hooks] Test hooks.
46
+ * @param {(dirPath: string) => {name: string, directory: boolean}[]} [hooks.listDir] Directory lister override.
47
+ * @returns {{markersByEcosystem: Map<string, string[]>, scannedDirectories: number}} Marker paths per ecosystem and the number of directories inspected.
48
+ */
49
+ export declare function detectEcosystemMarkers(projectPath: string, hooks?: {
50
+ listDir?: (dirPath: string) => {
51
+ name: string;
52
+ directory: boolean;
53
+ }[];
54
+ }): {
55
+ markersByEcosystem: Map<string, string[]>;
56
+ scannedDirectories: number;
57
+ };
58
+ //# sourceMappingURL=markers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markers.d.ts","sourceRoot":"","sources":["../../../../../lib/stages/postgen/introspection/markers.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAUH;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,EAFpB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;IAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAC,CAAC,CA0GtE,CAAC;AAEH;;;gCAGgC;AAChC,eAAO,MAAM,eAAe,eAAY,CAAC;AAyDzC;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EALvC,MAKuC,EAAE,KAAK,AAJtD,CAEA,EADA;IAA0E,OAAO,AAAjF,CACA,EADQ,CAAC,OAAO,EAAE,MAAM,KAAK;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAC,EAAE,CACjE;CAE2D,GAFjD;IAAC,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAAC,kBAAkB,EAAE,MAAM,CAAA;CAAC,CAoCnF"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Reflection: join what cdxgen did (the build ledger) with what it produced
3
+ * (the BOM, through the build-fidelity rule pack) and commit to a per-
4
+ * ecosystem fidelity verdict.
5
+ *
6
+ * The two evidence sources are kept independent on purpose. A finding backed
7
+ * by both the ledger and a BOM-side rule is high confidence; either alone is
8
+ * lower confidence. A ledger event with no BOM-side corroboration is reported
9
+ * as an observation, never as a defect: an event says the run degraded
10
+ * somewhere, but only the BOM shows whether the output paid for it. The
11
+ * rule-only path is a first-class path — reflecting over a foreign BOM with
12
+ * no ledger at all still produces a complete verdict.
13
+ *
14
+ * Every ecosystem present in the scan is assigned exactly one tier from the
15
+ * ladder `resolved > lockfile > manifest > heuristic > absent`, or excluded
16
+ * from scoring entirely as `unsupported` when its markers name an ecosystem
17
+ * cdxgen has no project type for. Ties break toward the worse tier: a report
18
+ * that overstates fidelity stops the remediation loop early, while one that
19
+ * understates it merely costs an extra iteration.
20
+ */
21
+ /**
22
+ * The fidelity tier ladder, from healthiest to worst.
23
+ *
24
+ * @type {string[]}
25
+ */
26
+ export declare const FIDELITY_TIERS: string[];
27
+ /**
28
+ * Ecosystem states. `graded` rows carry a tier below their ceiling and are
29
+ * the remediation loop's business; `at-ceiling` rows already parse as
30
+ * completely as their ecosystem permits; `absent` rows produced zero
31
+ * components for a supported ecosystem and are real failures; `unsupported`
32
+ * rows are coverage gaps in cdxgen itself, excluded from the score.
33
+ *
34
+ * @type {string[]}
35
+ */
36
+ export declare const ECOSYSTEM_STATES: string[];
37
+ /**
38
+ * Ecosystems whose best achievable tier is below `resolved`, because the
39
+ * ecosystem has no resolved graph for cdxgen to read. Any ecosystem not
40
+ * listed here defaults to a ceiling of `resolved`, so a newly supported
41
+ * ecosystem fails safe by demanding the most. Every entry below is backed by
42
+ * a measurement recorded in the deliverable handoff; none is added from
43
+ * reading a table.
44
+ *
45
+ * @type {Readonly<Record<string, string>>}
46
+ */
47
+ export declare const ECOSYSTEM_CEILINGS: Readonly<Record<string, string>>;
48
+ /**
49
+ * True when introspection is enabled for a run: the CLI option is set or the
50
+ * documented environment opt-in is present. Everything in this module sits
51
+ * behind this check, so a disabled run pays one boolean test.
52
+ *
53
+ * @param {Object} options CLI options.
54
+ * @returns {boolean} True when the reflection should run.
55
+ */
56
+ export { isIntrospectionEnabled } from "../../../core/buildLedger.js";
57
+ /**
58
+ * Review a completed run and produce a per-ecosystem fidelity assessment.
59
+ *
60
+ * @param {Object} bomJson Generated CycloneDX BOM.
61
+ * @param {Object} options CLI options.
62
+ * @param {Object} [context] Overrides for testing.
63
+ * @param {Object[]} [context.ledgerEvents] Events, defaulting to the sidecar or in-memory ledger.
64
+ * @param {string} [context.ledgerSource] Force the reported ledger source.
65
+ * @param {boolean} [context.ledgerComplete] Force the reported ledger completeness.
66
+ * @param {string} [context.projectPath] Directory scanned, for marker detection.
67
+ * @param {Object} [context.markerHooks] Directory-lister overrides for marker detection tests.
68
+ * @returns {Promise<Object>} The reflection document.
69
+ */
70
+ export declare function reflectOnRun(bomJson: Object, options?: Object, context?: {
71
+ ledgerEvents?: Object[];
72
+ ledgerSource?: string;
73
+ ledgerComplete?: boolean;
74
+ projectPath?: string;
75
+ markerHooks?: Object;
76
+ }): Promise<Object>;
77
+ //# sourceMappingURL=reflect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflect.d.ts","sourceRoot":"","sources":["../../../../../lib/stages/postgen/introspection/reflect.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA6BH;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAFjB,MAAM,EAQf,CAAC;AAWF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAFnB,MAAM,EAOf,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAFrB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA6BvC,CAAC;AAqIH;;;;;;;GAOG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAusBtE;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAV/B,MAU+B,EAAE,OAAO,GATxC,MAS6C,EAAE,OAAO,AAR9D,CAMA,EALA;IAA2B,YAAY,AAAvC,CACA,EADQ,MAAM,EAAE,CAChB;IAAyB,YAAY,AAArC,CACA,EADQ,MAAM,CACd;IAA0B,cAAc,AAAxC,CACA,EADQ,OAAO,CACf;IAAyB,WAAW,AAApC,CACA,EADQ,MAAM,CACd;IAAyB,WAAW,AAApC,CACA,EADQ,MAAM,CACd;CAEmE,GAFzD,OAAO,CAAC,MAAM,CAAC,CAmO3B"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Renderers over a completed reflection document and its scoring document.
3
+ *
4
+ * Every function here is pure: the reflection and scoring documents are the
5
+ * only evidence inputs, nothing reads the filesystem, the ledger, or the BOM
6
+ * again, and nothing writes a file. The caller owns serialization and printing,
7
+ * which is what makes these renderable against a committed fixture without a
8
+ * temporary directory.
9
+ *
10
+ * The markdown report is written for a human reading it in a terminal pager, a
11
+ * CI log, or a pull-request comment: plain GitHub-flavoured markdown, no HTML,
12
+ * no emoji, and a verdict line that carries the right impression on its own.
13
+ * The JSON report is written for the remediation loop: a versioned contract
14
+ * with stable key order and no content that churns between identical runs, so
15
+ * an agent can diff consecutive reports to detect progress. Free text is
16
+ * redacted again here even though the ledger already sanitized it, because
17
+ * this report is the artifact most likely to be pasted into a chat window.
18
+ */
19
+ /**
20
+ * Version of the JSON report contract. Additive fields bump the minor version;
21
+ * removals or semantic changes bump the major version.
22
+ *
23
+ * @type {string}
24
+ */
25
+ export declare const INTROSPECTION_REPORT_SCHEMA_VERSION: string;
26
+ /**
27
+ * Derive the overall tier and confidence labels from the scored rows.
28
+ *
29
+ * The scoring document publishes a number only. Both labels the reports
30
+ * publish are the *worst* among the scored rows: one unhealthy ecosystem must
31
+ * not disappear behind a healthy average, and no report may claim more
32
+ * confidence than its least-corroborated row. A reflection with no scored
33
+ * rows carries no verdict at all, so both labels are null.
34
+ *
35
+ * @param {Object} scored Scoring document from scoreReflection.
36
+ * @returns {{tier: string|null, confidence: string|null}} Worst tier and confidence among the scored rows.
37
+ */
38
+ export declare function overallAssessment(scored: Object): {
39
+ tier: string | null;
40
+ confidence: string | null;
41
+ };
42
+ /**
43
+ * Build the JSON report document, the remediation loop's contract.
44
+ *
45
+ * @param {Object} reflection Reflection document from reflectOnRun.
46
+ * @param {Object} scored Scoring document from scoreReflection.
47
+ * @param {Object} [options] CLI options that name the run's outputs.
48
+ * @param {string} [options.output] Path the BOM was written to.
49
+ * @param {number} [options.introspectFailBelow] CI gate threshold, when configured.
50
+ * @returns {Object} The report document; serializing it is the caller's job.
51
+ */
52
+ export declare function buildIntrospectionJson(reflection: Object, scored: Object, options?: {
53
+ output?: string;
54
+ introspectFailBelow?: number;
55
+ }): Object;
56
+ /**
57
+ * Render the markdown report.
58
+ *
59
+ * @param {Object} reflection Reflection document from reflectOnRun.
60
+ * @param {Object} scored Scoring document from scoreReflection.
61
+ * @param {Object} [options] CLI options that name the run's outputs.
62
+ * @param {string} [options.output] Path the BOM was written to.
63
+ * @param {boolean} [options.installDeps] Whether the run installs dependencies.
64
+ * @returns {string} The complete markdown report.
65
+ */
66
+ export declare function renderIntrospectionMarkdown(reflection: Object, scored: Object, options?: {
67
+ output?: string;
68
+ installDeps?: boolean;
69
+ }): string;
70
+ /**
71
+ * Render the console summary: a handful of diagnostic lines carrying the
72
+ * verdict, the remediation counts, and the paths the reports were written
73
+ * to. The full report never goes to the console.
74
+ *
75
+ * @param {Object} scored Scoring document from scoreReflection.
76
+ * @param {Object} [options] CLI options naming the report outputs.
77
+ * @param {string} [options.introspectReport] Path of the markdown report.
78
+ * @param {string} [options.introspectJson] Path of the JSON report.
79
+ * @returns {string} Newline-terminated lines for the diagnostic stream.
80
+ */
81
+ export declare function renderIntrospectionConsole(scored: Object, options?: {
82
+ introspectReport?: string;
83
+ introspectJson?: string;
84
+ }): string;
85
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../../../lib/stages/postgen/introspection/report.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC,EAFtC,MAE8C,CAAC;AAwGzD;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAH7B,MAG6B,GAF3B;IAAC,IAAI,EAAE,MAAM,GAAC,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,GAAC,IAAI,CAAA;CAAC,CAuBxD;AA0XD;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAPtC,MAOsC,EAAE,MAAM,EAN9C,MAM8C,EAAE,OAAO,AAL/D,CAGA,EAFA;IAAyB,MAAM,AAA/B,CACA,EADQ,MAAM,CACd;IAAyB,mBAAmB,AAA5C,CACA,EADQ,MAAM,CACd;CAEoE,GAF1D,MAAM,CA4ElB;AAoXD;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,EAP3C,MAO2C,EAAE,MAAM,EANnD,MAMmD,EAAE,OAAO,AALpE,CAGA,EAFA;IAAyB,MAAM,AAA/B,CACA,EADQ,MAAM,CACd;IAA0B,WAAW,AAArC,CACA,EADQ,OAAO,CACf;CAEyE,GAF/D,MAAM,CA2JlB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EANtC,MAMsC,EAAE,OAAO,AALvD,CAGA,EAFA;IAAyB,gBAAgB,AAAzC,CACA,EADQ,MAAM,CACd;IAAyB,cAAc,AAAvC,CACA,EADQ,MAAM,CACd;CAE4D,GAFlD,MAAM,CAiClB"}
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Scoring and remediation ranking over a completed reflection document.
3
+ *
4
+ * Every function here is pure: the reflection produced by `reflect.js` is the
5
+ * only evidence input, the remediation catalog is a static lookup passed in by
6
+ * the caller, and nothing reads the ledger, the BOM, or the filesystem. The
7
+ * same reflection therefore always yields the same score, on every runtime.
8
+ *
9
+ * The score is the gradient and the tier is the verdict: an ecosystem at its
10
+ * ceiling scores 100 and emits nothing (a manifest-tier helm chart is a
11
+ * success, not a nagging opportunity), an unsupported ecosystem is excluded
12
+ * from the mean entirely (a missing Elm parser is a coverage gap, not a
13
+ * project defect), and everything else starts from its tier base and loses
14
+ * points for each tool fact and corroborated degradation the reflection
15
+ * recorded. Deductions are floored at the tier base minus 15 so a single
16
+ * ecosystem can never fall out of its tier's band.
17
+ */
18
+ /**
19
+ * Base score per fidelity tier, from healthiest to worst.
20
+ *
21
+ * @type {Readonly<Record<string, number>>}
22
+ */
23
+ export declare const TIER_BASE_SCORES: Readonly<Record<string, number>>;
24
+ /**
25
+ * The fidelity ladder, healthiest first, shared by the rank arithmetic and the
26
+ * rule-derived target selection.
27
+ *
28
+ * @type {Readonly<string[]>}
29
+ */
30
+ export declare const TIER_LADDER: Readonly<string[]>;
31
+ /**
32
+ * Closed vocabulary for catalog action kinds. `container` proposes running
33
+ * cdxgen inside the official image for toolchains that are impractical to
34
+ * provision on the host.
35
+ *
36
+ * @type {Readonly<string[]>}
37
+ */
38
+ export declare const REMEDIATION_ACTION_KINDS: Readonly<string[]>;
39
+ /**
40
+ * Action kinds that need outbound network access, and are therefore blocked
41
+ * when the run was offline or under a command-execution policy.
42
+ *
43
+ * @type {ReadonlySet<string>}
44
+ */
45
+ export declare const NETWORK_ACTION_KINDS: ReadonlySet<string>;
46
+ /**
47
+ * Provisioners a catalog action can depend on. An action whose `via` names one
48
+ * of these is blocked when the run recorded the provisioner as unavailable.
49
+ *
50
+ * @type {ReadonlySet<string>}
51
+ */
52
+ export declare const PROVISIONER_TOOLS: ReadonlySet<string>;
53
+ /**
54
+ * Confidence that the row's verdict reflects reality, derived from the
55
+ * corroboration between the ledger and the rule pack. `high` needs both
56
+ * sources on the row, `low` covers an absent or incomplete ledger and
57
+ * disk-marker-only verdicts, and everything else is `medium`.
58
+ *
59
+ * A foreign BOM's formulation is the asymmetric case. It substitutes for the
60
+ * absent ledger events as primary evidence, which lifts the verdict off the
61
+ * marker-only floor; because the run was never observed, `medium` is a cap
62
+ * it can never exceed, and a formulation without a toolchain record leaves
63
+ * the row at `low`. On a same-run scan the formulation is the ledger's own
64
+ * evidence reported twice, so it moves nothing in either direction.
65
+ *
66
+ * @param {Object} row Ecosystem row.
67
+ * @param {Object} reflection Reflection document.
68
+ * @returns {"high"|"medium"|"low"} Confidence label.
69
+ */
70
+ export declare function confidenceFor(row: Object, reflection: Object): "high" | "medium" | "low";
71
+ /**
72
+ * Total score deduction for a row: one amount per missing or mismatched tool,
73
+ * plus one impact-keyed amount per distinct corroborated remediation id. The
74
+ * catalog supplies the kind behind each id, so a `command.failed` event keeps
75
+ * its own extra deduction even though the reflection stores degradations by
76
+ * id.
77
+ *
78
+ * @param {Object} row Ecosystem row.
79
+ * @param {Object|null} catalog Remediation catalog keyed by id.
80
+ * @returns {{total: number, byRemediationId: Map<string, number>}} Total deduction and the per-remediation split.
81
+ */
82
+ export declare function deductionsFor(row: Object, catalog: Object | null): {
83
+ total: number;
84
+ byRemediationId: Map<string, number>;
85
+ };
86
+ /**
87
+ * Score one ecosystem row. At-ceiling rows score 100 whatever their tier and
88
+ * unsupported rows score nothing at all — they sit outside the mean.
89
+ *
90
+ * @param {Object} row Ecosystem row.
91
+ * @param {Object|null} catalog Remediation catalog keyed by id.
92
+ * @returns {{score: number, base: number, deduction: number, weight: number}|null} Score facts, or null for unsupported rows.
93
+ */
94
+ export declare function scoreEcosystemRow(row: Object, catalog: Object | null): {
95
+ score: number;
96
+ base: number;
97
+ deduction: number;
98
+ weight: number;
99
+ } | null;
100
+ export type ResolvedActionVersion = {
101
+ /**
102
+ * Declared version, when a source answered.
103
+ */
104
+ version: string | undefined;
105
+ /**
106
+ * Cascade band that answered.
107
+ */
108
+ versionFrom: "mismatch" | "pin" | "expected" | "unresolved";
109
+ /**
110
+ * Where the version came from.
111
+ */
112
+ versionSource: string | undefined;
113
+ /**
114
+ * True when no source answered.
115
+ */
116
+ versionSourceMissing: boolean | undefined;
117
+ };
118
+ /**
119
+ * Order remediations for the loop: the largest expected gain first, then the
120
+ * largest per-ecosystem recovery, then the most confident evidence, then the
121
+ * id — a total order, so the sequence is identical no matter how the input
122
+ * findings were ordered. The per-ecosystem recovery separates entries whose
123
+ * weighted gains round to the same hundredth.
124
+ *
125
+ * @param {Object[]} entries Remediation entries.
126
+ * @returns {Object[]} Ranked copy of the entries.
127
+ */
128
+ export declare function rankRemediations(entries: Object[]): Object[];
129
+ /**
130
+ * Score a completed reflection and rank everything an agent could do next.
131
+ *
132
+ * @param {Object} reflection Reflection document from reflectOnRun.
133
+ * @param {Object|null} catalog Remediation catalog keyed by id (data/remediations.json).
134
+ * @param {Object} [runContext] Run facts the reflection cannot carry.
135
+ * @param {boolean} [runContext.secureMode] The run executed under secure mode or a command policy.
136
+ * @param {boolean} [runContext.inContainer] The run executed inside a container.
137
+ * @param {boolean} [runContext.offline] Overrides the offline fact derived from the ledger observations.
138
+ * @param {string[]} [runContext.unavailableProvisioners] Overrides the provisioners derived from the reflection.
139
+ * @param {Object} [runContext.commandFacts] Project facts the command variables (`{{mvn}}`, `{{gradle}}`, `{{pythonManager}}`, `{{npmClient}}`) resolve from; without them the variables fall back to the plain executables.
140
+ * @returns {Object} Scoring document with the overall score, per-ecosystem scores, coverage gaps and the ranked remediation list.
141
+ */
142
+ export declare function scoreReflection(reflection: Object, catalog: Object | null, runContext?: {
143
+ secureMode?: boolean;
144
+ inContainer?: boolean;
145
+ offline?: boolean;
146
+ unavailableProvisioners?: string[];
147
+ commandFacts?: Object;
148
+ }): Object;
149
+ //# sourceMappingURL=score.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"score.d.ts","sourceRoot":"","sources":["../../../../../lib/stages/postgen/introspection/score.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAFnB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQvC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAFd,QAAQ,CAAC,MAAM,EAAE,CAQzB,CAAC;AAwBH;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAF3B,QAAQ,CAAC,MAAM,EAAE,CASzB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAFvB,WAAW,CAAC,MAAM,CAEkD,CAAC;AAE/E;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAFpB,WAAW,CAAC,MAAM,CAQ1B,CAAC;AAiEH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAJtB,MAIsB,EAAE,UAAU,EAHlC,MAGkC,GAFhC,MAAM,GAAC,QAAQ,GAAC,KAAK,CAwCjC;AAgED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAJtB,MAIsB,EAAE,OAAO,EAH/B,MAAM,GAAC,IAGwB,GAF7B;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAC,CAsBjE;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAJ1B,MAI0B,EAAE,OAAO,EAHnC,MAAM,GAAC,IAG4B,GAFjC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,GAAC,IAAI,CAgBjF;AAkFE,YAAkB,qBAAqB,GACvC;;;;IAA6B,OAAO,EAAzB,MAAM,GAAC,SAAS,CAC3B;;;;IAAqD,WAAW,EAArD,UAAU,GAAC,KAAK,GAAC,UAAU,GAAC,YAAY,CACnD;;;;IAA6B,aAAa,EAA/B,MAAM,GAAC,SAAS,CAC3B;;;;IAA8B,oBAAoB,EAAvC,OAAO,GAAC,SAAS,CAC9B;CAAA,CAAA;AA+fD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAH7B,MAAM,EAGuB,GAF3B,MAAM,EAAE,CAWpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAV/B,MAU+B,EAAE,OAAO,EATxC,MAAM,GAAC,IASiC,EAAE,UAAU,AAR5D,CAMA,EALA;IAA6B,UAAU,AAAvC,CACA,EADQ,OAAO,CACf;IAA6B,WAAW,AAAxC,CACA,EADQ,OAAO,CACf;IAA6B,OAAO,AAApC,CACA,EADQ,OAAO,CACf;IAA8B,uBAAuB,AAArD,CACA,EADQ,MAAM,EAAE,CAChB;IAA4B,YAAY,AAAxC,CACA,EADQ,MAAM,CACd;CAEiE,GAFvD,MAAM,CA0FlB"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Command shaping for remediation actions.
3
+ *
4
+ * The remediation catalog authors commands with template variables where the
5
+ * right value depends on the scanned project: which maven or gradle
6
+ * executable the repo wraps, which Python manager owns its lock files, which
7
+ * client npm itself should use. This module substitutes those variables from
8
+ * a facts object the caller gathered earlier, and names on every shaped
9
+ * command the detection it relied on, so a reviewer can tell a correct
10
+ * detection from a lucky default.
11
+ *
12
+ * Every function here is pure: the facts object is the only input beyond the
13
+ * template string, nothing reads the filesystem, and the same facts always
14
+ * yield the same command. The filesystem reads live in the collector
15
+ * (`commandFacts.js`).
16
+ */
17
+ /**
18
+ * Template variables this module substitutes, beside the `{{version}}` and
19
+ * `{{major}}` placeholders the version cascade fills.
20
+ *
21
+ * @type {Readonly<string[]>}
22
+ */
23
+ export declare const SHAPE_VARIABLES: Readonly<string[]>;
24
+ /**
25
+ * Python managers a command can name, with the lock command each catalog
26
+ * entry pairs the variable with.
27
+ *
28
+ * @type {Readonly<string[]>}
29
+ */
30
+ export declare const PYTHON_MANAGERS: Readonly<string[]>;
31
+ export type CommandFacts = {
32
+ /**
33
+ * Directory the facts were gathered from.
34
+ */
35
+ projectRoot?: string;
36
+ /**
37
+ * Platform the command targets; defaults to posix.
38
+ */
39
+ platform?: "posix" | "windows";
40
+ /**
41
+ * Wrapper presence facts, executable-bit included for the platform's script.
42
+ */
43
+ wrappers?: {
44
+ mvnw?: boolean;
45
+ mvnwInexecutable?: boolean;
46
+ mvnwCmd?: boolean;
47
+ gradlew?: boolean;
48
+ gradlewInexecutable?: boolean;
49
+ gradlewBat?: boolean;
50
+ composerPhar?: boolean;
51
+ };
52
+ /**
53
+ * The Python manager in play.
54
+ */
55
+ pythonManager?: string | undefined;
56
+ /**
57
+ * Every manager detected, when two or more compete.
58
+ */
59
+ pythonManagerCandidates?: string[];
60
+ /**
61
+ * The npm client the project names or locks.
62
+ */
63
+ npmClient?: string;
64
+ };
65
+ /**
66
+ * Shape one command string: substitute the template variables the catalog
67
+ * authors into it and report which detection drove the result. A command
68
+ * without any `{{` marker is returned byte-identical and unshaped.
69
+ *
70
+ * @param {string} templateCommand Catalog command template.
71
+ * @param {CommandFacts} [facts] Facts gathered for the scanned project.
72
+ * @returns {{command: string, shapedBy: string|undefined, shapedNote: string|undefined}} The shaped command, the detection behind it, and the question to surface when shaping could not answer.
73
+ */
74
+ export declare function shapeCommand(templateCommand: string, facts?: CommandFacts): {
75
+ command: string;
76
+ shapedBy: string | undefined;
77
+ shapedNote: string | undefined;
78
+ };
79
+ //# sourceMappingURL=shapeCommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shapeCommand.d.ts","sourceRoot":"","sources":["../../../../../lib/stages/postgen/introspection/shapeCommand.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAFlB,QAAQ,CAAC,MAAM,EAAE,CAazB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAFlB,QAAQ,CAAC,MAAM,EAAE,CAEoD,CAAC;AAO7E,YAAkB,YAAY,GAC9B;;;;IAAoB,WAAW,AAA/B,CACA,EADW,MAAM,CACjB;;;;IAA+B,QAAQ,AAAvC,CACA,EADW,OAAO,GAAC,SAAS,CAC5B;;;;IAAoB,QAAQ,AAA5B,CAQA,EAPA;QAA8B,IAAI,AAAlC,CACA,EADW,OAAO,CAClB;QAA8B,gBAAgB,AAA9C,CACA,EADW,OAAO,CAClB;QAA8B,OAAO,AAArC,CACA,EADW,OAAO,CAClB;QAA8B,OAAO,AAArC,CACA,EADW,OAAO,CAClB;QAA8B,mBAAmB,AAAjD,CACA,EADW,OAAO,CAClB;QAA8B,UAAU,AAAxC,CACA,EADW,OAAO,CAClB;QAA8B,YAAY,AAA1C,CACA,EADW,OAAO,CAClB;KAAA,CAAA;;;;IAA8B,aAAa,AAA3C,CACA,EADW,MAAM,GAAC,SAAS,CAC3B;;;;IAAsB,uBAAuB,AAA7C,CACA,EADW,MAAM,EAAE,CACnB;;;;IAAoB,SAAS,AAA7B,CACF,EADa,MAAM,CACnB;CAAA,CAAA;AA2MD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,eAAe,EAJjC,MAIiC,EAAE,KAAK,AAHhD,CACA,EADQ,YAG6C,GAF3C;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAC,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,GAAC,SAAS,CAAA;CAAC,CA8BvF"}