zedbee 0.1.0-beta.13 → 0.1.0-beta.15

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 (408) hide show
  1. package/SECURITY.md +2 -0
  2. package/dist/attribution/entities.d.ts.map +1 -1
  3. package/dist/attribution/entities.js +47 -68
  4. package/dist/attribution/entities.js.map +1 -1
  5. package/dist/attribution/metrics.d.ts +2 -0
  6. package/dist/attribution/metrics.d.ts.map +1 -1
  7. package/dist/attribution/metrics.js +8 -0
  8. package/dist/attribution/metrics.js.map +1 -1
  9. package/dist/attribution/pair-locations.js +1 -1
  10. package/dist/attribution/pair-locations.js.map +1 -1
  11. package/dist/attribution/source-identity.d.ts +6 -0
  12. package/dist/attribution/source-identity.d.ts.map +1 -0
  13. package/dist/attribution/source-identity.js +60 -0
  14. package/dist/attribution/source-identity.js.map +1 -0
  15. package/dist/cache/key.d.ts +6 -1
  16. package/dist/cache/key.d.ts.map +1 -1
  17. package/dist/cache/key.js +54 -21
  18. package/dist/cache/key.js.map +1 -1
  19. package/dist/cache/store.d.ts.map +1 -1
  20. package/dist/cache/store.js +7 -7
  21. package/dist/cache/store.js.map +1 -1
  22. package/dist/checks/applicability.d.ts.map +1 -1
  23. package/dist/checks/applicability.js +40 -15
  24. package/dist/checks/applicability.js.map +1 -1
  25. package/dist/checks/compiler-inputs.d.ts +6 -6
  26. package/dist/checks/compiler-inputs.d.ts.map +1 -1
  27. package/dist/checks/compiler-inputs.js +82 -6
  28. package/dist/checks/compiler-inputs.js.map +1 -1
  29. package/dist/checks/complexity/adapter.d.ts.map +1 -1
  30. package/dist/checks/complexity/adapter.js +61 -12
  31. package/dist/checks/complexity/adapter.js.map +1 -1
  32. package/dist/checks/complexity/pair-class-metrics.d.ts.map +1 -1
  33. package/dist/checks/complexity/pair-class-metrics.js +52 -19
  34. package/dist/checks/complexity/pair-class-metrics.js.map +1 -1
  35. package/dist/checks/dead-code/framework-entrypoints.d.ts +9 -0
  36. package/dist/checks/dead-code/framework-entrypoints.d.ts.map +1 -0
  37. package/dist/checks/dead-code/framework-entrypoints.js +47 -0
  38. package/dist/checks/dead-code/framework-entrypoints.js.map +1 -0
  39. package/dist/checks/dead-code/managed-config.d.ts +1 -0
  40. package/dist/checks/dead-code/managed-config.d.ts.map +1 -1
  41. package/dist/checks/dead-code/managed-config.js +6 -1
  42. package/dist/checks/dead-code/managed-config.js.map +1 -1
  43. package/dist/checks/dead-code/parse-report.d.ts.map +1 -1
  44. package/dist/checks/dead-code/parse-report.js +26 -23
  45. package/dist/checks/dead-code/parse-report.js.map +1 -1
  46. package/dist/checks/diagnostic-messages.d.ts +4 -0
  47. package/dist/checks/diagnostic-messages.d.ts.map +1 -0
  48. package/dist/checks/diagnostic-messages.js +50 -0
  49. package/dist/checks/diagnostic-messages.js.map +1 -0
  50. package/dist/checks/dispatch-adapter.d.ts +25 -0
  51. package/dist/checks/dispatch-adapter.d.ts.map +1 -0
  52. package/dist/checks/dispatch-adapter.js +133 -0
  53. package/dist/checks/dispatch-adapter.js.map +1 -0
  54. package/dist/checks/dispatch-cache.d.ts +9 -0
  55. package/dist/checks/dispatch-cache.d.ts.map +1 -0
  56. package/dist/checks/dispatch-cache.js +154 -0
  57. package/dist/checks/dispatch-cache.js.map +1 -0
  58. package/dist/checks/dispatch-context.d.ts +11 -0
  59. package/dist/checks/dispatch-context.d.ts.map +1 -0
  60. package/dist/checks/dispatch-context.js +155 -0
  61. package/dist/checks/dispatch-context.js.map +1 -0
  62. package/dist/checks/dispatch-target.d.ts +17 -0
  63. package/dist/checks/dispatch-target.d.ts.map +1 -0
  64. package/dist/checks/dispatch-target.js +167 -0
  65. package/dist/checks/dispatch-target.js.map +1 -0
  66. package/dist/checks/dispatcher.d.ts +12 -7
  67. package/dist/checks/dispatcher.d.ts.map +1 -1
  68. package/dist/checks/dispatcher.js +44 -653
  69. package/dist/checks/dispatcher.js.map +1 -1
  70. package/dist/checks/duplication/adapter.d.ts.map +1 -1
  71. package/dist/checks/duplication/adapter.js +46 -11
  72. package/dist/checks/duplication/adapter.js.map +1 -1
  73. package/dist/checks/duplication/clone-comparison.d.ts +6 -0
  74. package/dist/checks/duplication/clone-comparison.d.ts.map +1 -0
  75. package/dist/checks/duplication/clone-comparison.js +163 -0
  76. package/dist/checks/duplication/clone-comparison.js.map +1 -0
  77. package/dist/checks/duplication/input-paths.d.ts +10 -0
  78. package/dist/checks/duplication/input-paths.d.ts.map +1 -0
  79. package/dist/checks/duplication/input-paths.js +45 -0
  80. package/dist/checks/duplication/input-paths.js.map +1 -0
  81. package/dist/checks/duplication/normalize-clone.d.ts.map +1 -1
  82. package/dist/checks/duplication/normalize-clone.js +9 -0
  83. package/dist/checks/duplication/normalize-clone.js.map +1 -1
  84. package/dist/checks/duplication/source-tokens.d.ts +18 -0
  85. package/dist/checks/duplication/source-tokens.d.ts.map +1 -0
  86. package/dist/checks/duplication/source-tokens.js +68 -0
  87. package/dist/checks/duplication/source-tokens.js.map +1 -0
  88. package/dist/checks/duplication/types.d.ts +2 -0
  89. package/dist/checks/duplication/types.d.ts.map +1 -1
  90. package/dist/checks/engine-identity.d.ts.map +1 -1
  91. package/dist/checks/engine-identity.js +8 -7
  92. package/dist/checks/engine-identity.js.map +1 -1
  93. package/dist/checks/eslint/convert-message.d.ts +2 -0
  94. package/dist/checks/eslint/convert-message.d.ts.map +1 -1
  95. package/dist/checks/eslint/convert-message.js +34 -1
  96. package/dist/checks/eslint/convert-message.js.map +1 -1
  97. package/dist/checks/eslint/lint-adapter.d.ts.map +1 -1
  98. package/dist/checks/eslint/lint-adapter.js +5 -3
  99. package/dist/checks/eslint/lint-adapter.js.map +1 -1
  100. package/dist/checks/metadata.d.ts +4 -2
  101. package/dist/checks/metadata.d.ts.map +1 -1
  102. package/dist/checks/metadata.js +7 -4
  103. package/dist/checks/metadata.js.map +1 -1
  104. package/dist/checks/observation-result.d.ts.map +1 -1
  105. package/dist/checks/observation-result.js +24 -12
  106. package/dist/checks/observation-result.js.map +1 -1
  107. package/dist/checks/policy-scheduling.d.ts +3 -5
  108. package/dist/checks/policy-scheduling.d.ts.map +1 -1
  109. package/dist/checks/policy-scheduling.js +9 -6
  110. package/dist/checks/policy-scheduling.js.map +1 -1
  111. package/dist/checks/prettier/project-engine.d.ts +8 -14
  112. package/dist/checks/prettier/project-engine.d.ts.map +1 -1
  113. package/dist/checks/prettier/project-engine.js +33 -281
  114. package/dist/checks/prettier/project-engine.js.map +1 -1
  115. package/dist/checks/prettier/project-error.d.ts +7 -0
  116. package/dist/checks/prettier/project-error.d.ts.map +1 -0
  117. package/dist/checks/prettier/project-error.js +12 -0
  118. package/dist/checks/prettier/project-error.js.map +1 -0
  119. package/dist/checks/prettier/project-import-capture.d.ts +20 -0
  120. package/dist/checks/prettier/project-import-capture.d.ts.map +1 -0
  121. package/dist/checks/prettier/project-import-capture.js +173 -0
  122. package/dist/checks/prettier/project-import-capture.js.map +1 -0
  123. package/dist/checks/prettier/project-import-dependencies.d.ts +5 -0
  124. package/dist/checks/prettier/project-import-dependencies.d.ts.map +1 -0
  125. package/dist/checks/prettier/project-import-dependencies.js +84 -0
  126. package/dist/checks/prettier/project-import-dependencies.js.map +1 -0
  127. package/dist/checks/prettier/project-installation.d.ts +3 -0
  128. package/dist/checks/prettier/project-installation.d.ts.map +1 -0
  129. package/dist/checks/prettier/project-installation.js +204 -0
  130. package/dist/checks/prettier/project-installation.js.map +1 -0
  131. package/dist/checks/prettier/project-protocol.d.ts.map +1 -1
  132. package/dist/checks/prettier/project-protocol.js +15 -3
  133. package/dist/checks/prettier/project-protocol.js.map +1 -1
  134. package/dist/checks/prettier/project-snapshot-identity.d.ts +7 -0
  135. package/dist/checks/prettier/project-snapshot-identity.d.ts.map +1 -0
  136. package/dist/checks/prettier/project-snapshot-identity.js +63 -0
  137. package/dist/checks/prettier/project-snapshot-identity.js.map +1 -0
  138. package/dist/checks/prettier/project-types.d.ts +2 -0
  139. package/dist/checks/prettier/project-types.d.ts.map +1 -1
  140. package/dist/checks/prettier/project-worker.js +25 -3
  141. package/dist/checks/prettier/project-worker.js.map +1 -1
  142. package/dist/checks/prettier/project-workspace.d.ts +7 -0
  143. package/dist/checks/prettier/project-workspace.d.ts.map +1 -1
  144. package/dist/checks/prettier/project-workspace.js +101 -40
  145. package/dist/checks/prettier/project-workspace.js.map +1 -1
  146. package/dist/checks/project-inputs.d.ts.map +1 -1
  147. package/dist/checks/project-inputs.js +39 -10
  148. package/dist/checks/project-inputs.js.map +1 -1
  149. package/dist/checks/runner/process-group.d.ts.map +1 -1
  150. package/dist/checks/runner/process-group.js +30 -2
  151. package/dist/checks/runner/process-group.js.map +1 -1
  152. package/dist/checks/secrets/content.d.ts.map +1 -1
  153. package/dist/checks/secrets/content.js +43 -18
  154. package/dist/checks/secrets/content.js.map +1 -1
  155. package/dist/checks/typescript/adapter.d.ts.map +1 -1
  156. package/dist/checks/typescript/adapter.js +4 -2
  157. package/dist/checks/typescript/adapter.js.map +1 -1
  158. package/dist/checks/typescript/compiler-host.d.ts +2 -0
  159. package/dist/checks/typescript/compiler-host.d.ts.map +1 -1
  160. package/dist/checks/typescript/compiler-host.js.map +1 -1
  161. package/dist/checks/typescript/configuration-paths.d.ts +12 -4
  162. package/dist/checks/typescript/configuration-paths.d.ts.map +1 -1
  163. package/dist/checks/typescript/configuration-paths.js +167 -58
  164. package/dist/checks/typescript/configuration-paths.js.map +1 -1
  165. package/dist/checks/typescript/convert-diagnostic.d.ts +2 -0
  166. package/dist/checks/typescript/convert-diagnostic.d.ts.map +1 -1
  167. package/dist/checks/typescript/convert-diagnostic.js +23 -5
  168. package/dist/checks/typescript/convert-diagnostic.js.map +1 -1
  169. package/dist/checks/typescript/project-coverage.d.ts.map +1 -1
  170. package/dist/checks/typescript/project-coverage.js +1 -1
  171. package/dist/checks/typescript/project-coverage.js.map +1 -1
  172. package/dist/checks/typescript/projects.d.ts +2 -1
  173. package/dist/checks/typescript/projects.d.ts.map +1 -1
  174. package/dist/checks/typescript/projects.js +3 -2
  175. package/dist/checks/typescript/projects.js.map +1 -1
  176. package/dist/checks/vulnerabilities/inventory/normalize.d.ts +1 -0
  177. package/dist/checks/vulnerabilities/inventory/normalize.d.ts.map +1 -1
  178. package/dist/checks/vulnerabilities/inventory/normalize.js +5 -2
  179. package/dist/checks/vulnerabilities/inventory/normalize.js.map +1 -1
  180. package/dist/checks/vulnerabilities/inventory/parse-bun.d.ts.map +1 -1
  181. package/dist/checks/vulnerabilities/inventory/parse-bun.js +18 -7
  182. package/dist/checks/vulnerabilities/inventory/parse-bun.js.map +1 -1
  183. package/dist/checks/vulnerabilities/inventory/parse-yarn.d.ts.map +1 -1
  184. package/dist/checks/vulnerabilities/inventory/parse-yarn.js +21 -11
  185. package/dist/checks/vulnerabilities/inventory/parse-yarn.js.map +1 -1
  186. package/dist/commands/checks.d.ts +5 -2
  187. package/dist/commands/checks.d.ts.map +1 -1
  188. package/dist/commands/checks.js +21 -6
  189. package/dist/commands/checks.js.map +1 -1
  190. package/dist/commands/fix.d.ts.map +1 -1
  191. package/dist/commands/fix.js +6 -297
  192. package/dist/commands/fix.js.map +1 -1
  193. package/dist/commands/init.d.ts +4 -2
  194. package/dist/commands/init.d.ts.map +1 -1
  195. package/dist/commands/init.js +36 -379
  196. package/dist/commands/init.js.map +1 -1
  197. package/dist/commands/scan.d.ts.map +1 -1
  198. package/dist/commands/scan.js +1 -13
  199. package/dist/commands/scan.js.map +1 -1
  200. package/dist/config/load-config.d.ts.map +1 -1
  201. package/dist/config/load-config.js +6 -15
  202. package/dist/config/load-config.js.map +1 -1
  203. package/dist/config/selection-path.d.ts +7 -0
  204. package/dist/config/selection-path.d.ts.map +1 -0
  205. package/dist/config/selection-path.js +20 -0
  206. package/dist/config/selection-path.js.map +1 -0
  207. package/dist/core/check-label.d.ts +2 -0
  208. package/dist/core/check-label.d.ts.map +1 -0
  209. package/dist/core/check-label.js +19 -0
  210. package/dist/core/check-label.js.map +1 -0
  211. package/dist/core/freeze-result.d.ts +3 -0
  212. package/dist/core/freeze-result.d.ts.map +1 -0
  213. package/dist/core/freeze-result.js +10 -0
  214. package/dist/core/freeze-result.js.map +1 -0
  215. package/dist/core/immutable-map.d.ts +3 -0
  216. package/dist/core/immutable-map.d.ts.map +1 -0
  217. package/dist/core/immutable-map.js +33 -0
  218. package/dist/core/immutable-map.js.map +1 -0
  219. package/dist/core/kernel-lease.d.ts +17 -0
  220. package/dist/core/kernel-lease.d.ts.map +1 -0
  221. package/dist/core/kernel-lease.js +55 -0
  222. package/dist/core/kernel-lease.js.map +1 -0
  223. package/dist/fixes/apply-plan.d.ts.map +1 -1
  224. package/dist/fixes/apply-plan.js +2 -9
  225. package/dist/fixes/apply-plan.js.map +1 -1
  226. package/dist/fixes/build-plan.d.ts +4 -5
  227. package/dist/fixes/build-plan.d.ts.map +1 -1
  228. package/dist/fixes/build-plan.js +10 -465
  229. package/dist/fixes/build-plan.js.map +1 -1
  230. package/dist/fixes/exact-edits.d.ts +11 -1
  231. package/dist/fixes/exact-edits.d.ts.map +1 -1
  232. package/dist/fixes/exact-edits.js +101 -46
  233. package/dist/fixes/exact-edits.js.map +1 -1
  234. package/dist/fixes/plan-candidates.d.ts +8 -0
  235. package/dist/fixes/plan-candidates.d.ts.map +1 -0
  236. package/dist/fixes/plan-candidates.js +144 -0
  237. package/dist/fixes/plan-candidates.js.map +1 -0
  238. package/dist/fixes/prettier-provider.d.ts +3 -2
  239. package/dist/fixes/prettier-provider.d.ts.map +1 -1
  240. package/dist/fixes/prettier-provider.js +53 -0
  241. package/dist/fixes/prettier-provider.js.map +1 -1
  242. package/dist/fixes/public-plan.d.ts +8 -0
  243. package/dist/fixes/public-plan.d.ts.map +1 -0
  244. package/dist/fixes/public-plan.js +194 -0
  245. package/dist/fixes/public-plan.js.map +1 -0
  246. package/dist/fixes/working-preview.d.ts +18 -0
  247. package/dist/fixes/working-preview.d.ts.map +1 -0
  248. package/dist/fixes/working-preview.js +162 -0
  249. package/dist/fixes/working-preview.js.map +1 -0
  250. package/dist/git/change-set.d.ts.map +1 -1
  251. package/dist/git/change-set.js +1 -9
  252. package/dist/git/change-set.js.map +1 -1
  253. package/dist/git/client.d.ts +1 -1
  254. package/dist/git/client.d.ts.map +1 -1
  255. package/dist/git/client.js +14 -12
  256. package/dist/git/client.js.map +1 -1
  257. package/dist/init/formatter-setup.d.ts +29 -0
  258. package/dist/init/formatter-setup.d.ts.map +1 -0
  259. package/dist/init/formatter-setup.js +166 -0
  260. package/dist/init/formatter-setup.js.map +1 -0
  261. package/dist/init/import-provenance.d.ts +7 -0
  262. package/dist/init/import-provenance.d.ts.map +1 -0
  263. package/dist/init/import-provenance.js +58 -0
  264. package/dist/init/import-provenance.js.map +1 -0
  265. package/dist/init/install-dependency.d.mts +40 -0
  266. package/dist/init/install-dependency.mjs +427 -0
  267. package/dist/init/install-project.d.ts +1 -0
  268. package/dist/init/install-project.d.ts.map +1 -1
  269. package/dist/init/install-project.js +12 -31
  270. package/dist/init/install-project.js.map +1 -1
  271. package/dist/init/presentation.d.ts +54 -0
  272. package/dist/init/presentation.d.ts.map +1 -0
  273. package/dist/init/presentation.js +139 -0
  274. package/dist/init/presentation.js.map +1 -0
  275. package/dist/init/selection-policy.d.ts +29 -0
  276. package/dist/init/selection-policy.d.ts.map +1 -0
  277. package/dist/init/selection-policy.js +59 -0
  278. package/dist/init/selection-policy.js.map +1 -0
  279. package/dist/init/types.d.ts +7 -0
  280. package/dist/init/types.d.ts.map +1 -1
  281. package/dist/init/types.js.map +1 -1
  282. package/dist/init/write-config.d.ts.map +1 -1
  283. package/dist/init/write-config.js +3 -13
  284. package/dist/init/write-config.js.map +1 -1
  285. package/dist/inspection/inspect-repository.d.ts.map +1 -1
  286. package/dist/inspection/inspect-repository.js +4 -3
  287. package/dist/inspection/inspect-repository.js.map +1 -1
  288. package/dist/inspection/snapshot-registry.d.ts.map +1 -1
  289. package/dist/inspection/snapshot-registry.js +24 -2
  290. package/dist/inspection/snapshot-registry.js.map +1 -1
  291. package/dist/reporting/check-label.d.ts +1 -1
  292. package/dist/reporting/check-label.d.ts.map +1 -1
  293. package/dist/reporting/check-label.js +1 -18
  294. package/dist/reporting/check-label.js.map +1 -1
  295. package/dist/reporting/fix-plan-store.d.ts +7 -0
  296. package/dist/reporting/fix-plan-store.d.ts.map +1 -0
  297. package/dist/reporting/fix-plan-store.js +29 -0
  298. package/dist/reporting/fix-plan-store.js.map +1 -0
  299. package/dist/reporting/fix-presentation.d.ts +77 -0
  300. package/dist/reporting/fix-presentation.d.ts.map +1 -0
  301. package/dist/reporting/fix-presentation.js +262 -0
  302. package/dist/reporting/fix-presentation.js.map +1 -0
  303. package/dist/reporting/report-callouts.d.ts.map +1 -1
  304. package/dist/reporting/report-callouts.js +1 -0
  305. package/dist/reporting/report-callouts.js.map +1 -1
  306. package/dist/reporting/temporary-report-common.d.ts +27 -0
  307. package/dist/reporting/temporary-report-common.d.ts.map +1 -0
  308. package/dist/reporting/temporary-report-common.js +33 -0
  309. package/dist/reporting/temporary-report-common.js.map +1 -0
  310. package/dist/reporting/temporary-report-filesystem.d.ts +6 -0
  311. package/dist/reporting/temporary-report-filesystem.d.ts.map +1 -0
  312. package/dist/reporting/temporary-report-filesystem.js +124 -0
  313. package/dist/reporting/temporary-report-filesystem.js.map +1 -0
  314. package/dist/reporting/temporary-report-lifecycle.d.ts +19 -0
  315. package/dist/reporting/temporary-report-lifecycle.d.ts.map +1 -0
  316. package/dist/reporting/temporary-report-lifecycle.js +278 -0
  317. package/dist/reporting/temporary-report-lifecycle.js.map +1 -0
  318. package/dist/reporting/temporary-report-lock.d.ts +21 -0
  319. package/dist/reporting/temporary-report-lock.d.ts.map +1 -0
  320. package/dist/reporting/temporary-report-lock.js +106 -0
  321. package/dist/reporting/temporary-report-lock.js.map +1 -0
  322. package/dist/reporting/temporary-reports.d.ts +3 -24
  323. package/dist/reporting/temporary-reports.d.ts.map +1 -1
  324. package/dist/reporting/temporary-reports.js +10 -534
  325. package/dist/reporting/temporary-reports.js.map +1 -1
  326. package/dist/scan/analysis-session.d.ts.map +1 -1
  327. package/dist/scan/analysis-session.js +40 -17
  328. package/dist/scan/analysis-session.js.map +1 -1
  329. package/dist/scan/run-scan.d.ts.map +1 -1
  330. package/dist/scan/run-scan.js +4 -12
  331. package/dist/scan/run-scan.js.map +1 -1
  332. package/dist/scan/source-excerpts.d.ts +1 -1
  333. package/dist/scan/source-excerpts.d.ts.map +1 -1
  334. package/dist/scan/source-excerpts.js +25 -27
  335. package/dist/scan/source-excerpts.js.map +1 -1
  336. package/dist/service/client-connection.d.ts +21 -0
  337. package/dist/service/client-connection.d.ts.map +1 -0
  338. package/dist/service/client-connection.js +219 -0
  339. package/dist/service/client-connection.js.map +1 -0
  340. package/dist/service/client-executor.d.ts +10 -0
  341. package/dist/service/client-executor.d.ts.map +1 -0
  342. package/dist/service/client-executor.js +69 -0
  343. package/dist/service/client-executor.js.map +1 -0
  344. package/dist/service/client-ownership.d.ts +16 -0
  345. package/dist/service/client-ownership.d.ts.map +1 -0
  346. package/dist/service/client-ownership.js +104 -0
  347. package/dist/service/client-ownership.js.map +1 -0
  348. package/dist/service/client-startup.d.ts +3 -0
  349. package/dist/service/client-startup.d.ts.map +1 -0
  350. package/dist/service/client-startup.js +123 -0
  351. package/dist/service/client-startup.js.map +1 -0
  352. package/dist/service/client.d.ts +2 -27
  353. package/dist/service/client.d.ts.map +1 -1
  354. package/dist/service/client.js +7 -490
  355. package/dist/service/client.js.map +1 -1
  356. package/dist/service/server-connection.d.ts +43 -0
  357. package/dist/service/server-connection.d.ts.map +1 -0
  358. package/dist/service/server-connection.js +327 -0
  359. package/dist/service/server-connection.js.map +1 -0
  360. package/dist/service/server.d.ts +1 -1
  361. package/dist/service/server.d.ts.map +1 -1
  362. package/dist/service/server.js +77 -343
  363. package/dist/service/server.js.map +1 -1
  364. package/dist/service/state.d.ts.map +1 -1
  365. package/dist/service/state.js +2 -25
  366. package/dist/service/state.js.map +1 -1
  367. package/dist/service/windows-pipe.d.ts +22 -14
  368. package/dist/service/windows-pipe.d.ts.map +1 -1
  369. package/dist/service/windows-pipe.js +384 -350
  370. package/dist/service/windows-pipe.js.map +1 -1
  371. package/dist/telemetry/details-store.js +1 -1
  372. package/dist/telemetry/details-store.js.map +1 -1
  373. package/dist/telemetry/schema.d.ts +11 -11
  374. package/dist/telemetry/state.d.ts +3 -2
  375. package/dist/telemetry/state.d.ts.map +1 -1
  376. package/dist/telemetry/state.js +112 -66
  377. package/dist/telemetry/state.js.map +1 -1
  378. package/dist/ui/branded-command-frame.d.ts.map +1 -1
  379. package/dist/ui/branded-command-frame.js +8 -3
  380. package/dist/ui/branded-command-frame.js.map +1 -1
  381. package/dist/ui/init-app.d.ts +6 -14
  382. package/dist/ui/init-app.d.ts.map +1 -1
  383. package/dist/ui/init-app.js +39 -203
  384. package/dist/ui/init-app.js.map +1 -1
  385. package/dist/ui/init-operation.d.ts +19 -0
  386. package/dist/ui/init-operation.d.ts.map +1 -0
  387. package/dist/ui/init-operation.js +54 -0
  388. package/dist/ui/init-operation.js.map +1 -0
  389. package/dist/ui/init-view.d.ts +42 -0
  390. package/dist/ui/init-view.d.ts.map +1 -0
  391. package/dist/ui/init-view.js +199 -0
  392. package/dist/ui/init-view.js.map +1 -0
  393. package/dist/ui/live-dashboard.d.ts.map +1 -1
  394. package/dist/ui/live-dashboard.js +10 -3
  395. package/dist/ui/live-dashboard.js.map +1 -1
  396. package/dist/ui/pixel-wordmark.d.ts +2 -1
  397. package/dist/ui/pixel-wordmark.d.ts.map +1 -1
  398. package/dist/ui/pixel-wordmark.js +3 -1
  399. package/dist/ui/pixel-wordmark.js.map +1 -1
  400. package/dist/ui/scan-result-dashboard.d.ts.map +1 -1
  401. package/dist/ui/scan-result-dashboard.js +5 -5
  402. package/dist/ui/scan-result-dashboard.js.map +1 -1
  403. package/docs/checks.md +71 -7
  404. package/docs/cli-reference.md +31 -4
  405. package/docs/managed-fixes.md +14 -0
  406. package/docs/privacy.md +22 -1
  407. package/package.json +1 -1
  408. package/plugins/swarm/references/scan.md +6 -13
@@ -1,59 +1,19 @@
1
1
  import pLimit from "p-limit";
2
2
  import { CHECK_IDS, } from "../config/schema.js";
3
- import {} from "../config/file-policy.js";
4
- import { observationCheckResult } from "./observation-result.js";
5
3
  import { sanitizeCheckResult } from "./sanitize-result.js";
6
- import { sanitizeCheckTarget } from "./sanitize-target.js";
7
4
  import { incompleteResult } from "./incomplete-result.js";
8
5
  import { CheckIncompleteError } from "./incomplete-error.js";
9
- import { AnalyzerJobError } from "./diagnostics.js";
10
- import { displayResultForPolicy } from "../policy/evaluate.js";
11
6
  import { compareCodeUnits } from "../core/compare.js";
12
- import { displayLabel, displayProse } from "../core/display-text.js";
13
- import { createObservationCacheKeyBuilder, effectiveBehaviorFingerprint, } from "../cache/key.js";
14
- import { observationCacheEngineIdentity } from "./engine-identity.js";
15
- import { isCacheableObservationCheck } from "./metadata.js";
16
- import { sanitizeCacheableObservationSet, } from "../cache/store.js";
17
- import { validateDependencyInputs } from "../cache/captured-dependencies.js";
7
+ import { checkLabel } from "../core/check-label.js";
18
8
  import { resolveInspectionPolicy, resolveScheduledTargetPolicy, } from "./policy-scheduling.js";
19
- import { immutableConfigurationSnapshot, snapshotManagedPolicy, } from "../config/settings-registry.js";
20
- import { sanitizeFixCandidates } from "../fixes/sanitize.js";
9
+ import { adapterBaseContext, immutablePolicy, inspectionContext, } from "./dispatch-context.js";
10
+ import { snapshotAdapter, snapshotApplicability } from "./dispatch-adapter.js";
11
+ import { createDispatchObservationCollector } from "./dispatch-cache.js";
12
+ import { executeDispatchTarget, executionResult } from "./dispatch-target.js";
21
13
  function checkPolicy(context, checkId) {
22
14
  const checks = context.config.checks;
23
15
  return checks[checkId];
24
16
  }
25
- const CHECK_LABELS = Object.freeze({
26
- formatting: "Formatting",
27
- lint: "Lint",
28
- types: "TypeScript",
29
- cyclomaticComplexity: "Cyclomatic complexity",
30
- readabilityComplexity: "Readability complexity",
31
- structuralSecurity: "Structural security",
32
- secrets: "Secrets",
33
- duplication: "Duplication",
34
- dependencyArchitecture: "Dependency architecture",
35
- deadCode: "Dead code",
36
- reactCorrectness: "React correctness",
37
- reactAccessibility: "React accessibility",
38
- vulnerabilities: "Vulnerabilities",
39
- });
40
- function checkLabel(checkId) {
41
- return CHECK_LABELS[checkId] ?? checkId;
42
- }
43
- function immutablePolicy(checkId, policy) {
44
- return CHECK_IDS.includes(checkId)
45
- ? snapshotManagedPolicy(checkId, policy)
46
- : immutableConfigurationSnapshot(policy);
47
- }
48
- function executionResult(result, policy, target, policyForFile, fixCandidates) {
49
- return {
50
- result: sanitizeCheckResult(result),
51
- ...(target === undefined ? {} : { target }),
52
- policy,
53
- ...(policyForFile === undefined ? {} : { policyForFile }),
54
- ...(fixCandidates === undefined ? {} : { fixCandidates }),
55
- };
56
- }
57
17
  function mayBeEnabled(context, checkId) {
58
18
  const policy = checkPolicy(context, checkId);
59
19
  if (policy === undefined)
@@ -71,432 +31,22 @@ function inspectionPolicy(context, checkId) {
71
31
  return root;
72
32
  return resolveInspectionPolicy(context.config, checkId);
73
33
  }
74
- function readonlyMap(entries) {
75
- const internal = new Map(entries);
76
- let facade;
77
- facade = Object.freeze({
78
- get size() {
79
- return internal.size;
80
- },
81
- get(key) {
82
- return internal.get(key);
83
- },
84
- has(key) {
85
- return internal.has(key);
86
- },
87
- entries() {
88
- return internal.entries();
89
- },
90
- keys() {
91
- return internal.keys();
92
- },
93
- values() {
94
- return internal.values();
95
- },
96
- forEach(callback, thisArg) {
97
- internal.forEach((value, key) => callback.call(thisArg, value, key, facade));
98
- },
99
- [Symbol.iterator]() {
100
- return internal[Symbol.iterator]();
101
- },
102
- });
103
- return facade;
104
- }
105
- function snapshotChangedFile(file) {
106
- return Object.freeze({
107
- path: file.path,
108
- ...(file.previousPath === undefined
109
- ? {}
110
- : { previousPath: file.previousPath }),
111
- status: file.status,
112
- addedRanges: Object.freeze(file.addedRanges.map((range) => Object.freeze({ start: range.start, end: range.end }))),
113
- });
114
- }
115
- function snapshotChangeSet(changeSet) {
116
- const files = readonlyMap([...changeSet.files].map(([path, file]) => [path, snapshotChangedFile(file)]));
117
- return Object.freeze({
118
- files,
119
- isEmpty: changeSet.isEmpty,
120
- containsAddedLine(file, line) {
121
- return (files
122
- .get(file.replaceAll("\\", "/"))
123
- ?.addedRanges.some((range) => line >= range.start && line <= range.end) ?? false);
124
- },
125
- });
126
- }
127
- function snapshotOverride(override) {
128
- return Object.freeze({
129
- files: Object.freeze([...override.files]),
130
- ...(override.excludeFiles === undefined
131
- ? {}
132
- : { excludeFiles: Object.freeze([...override.excludeFiles]) }),
133
- checks: Object.freeze(Object.fromEntries(Object.entries(override.checks).map(([id, patch]) => [
134
- id,
135
- patch === undefined ? undefined : immutablePolicy(id, patch),
136
- ]))),
137
- configurationOrigins: snapshotConfigurationOrigins(override.configurationOrigins),
138
- ...(override.generated === undefined
139
- ? {}
140
- : { generated: override.generated }),
141
- });
142
- }
143
- function snapshotConfigurationOrigins(origins) {
144
- return immutableConfigurationSnapshot(Object.fromEntries(CHECK_IDS.map((checkId) => [checkId, origins?.[checkId] ?? {}])));
145
- }
146
- function snapshotConfig(config) {
147
- return Object.freeze({
148
- schemaVersion: config.schemaVersion,
149
- profile: config.profile,
150
- pathExclusions: immutableConfigurationSnapshot(config.pathExclusions),
151
- checks: Object.freeze(Object.fromEntries(Object.entries(config.checks).map(([id, policy]) => [
152
- id,
153
- immutablePolicy(id, policy),
154
- ]))),
155
- overrides: Object.freeze(config.overrides.map(snapshotOverride)),
156
- reporting: immutableConfigurationSnapshot(config.reporting),
157
- resources: immutableConfigurationSnapshot(config.resources),
158
- configurationOrigins: snapshotConfigurationOrigins(config.configurationOrigins),
159
- failOnIncomplete: config.failOnIncomplete,
160
- ...(config.configPath === undefined
161
- ? {}
162
- : { configPath: config.configPath }),
163
- });
164
- }
165
- function snapshotInspection(inspection) {
166
- return Object.freeze({
167
- snapshotRoot: inspection.snapshotRoot,
168
- packageManager: inspection.packageManager,
169
- lockfiles: Object.freeze([...inspection.lockfiles]),
170
- workspaces: Object.freeze(inspection.workspaces.map((workspace) => Object.freeze({
171
- ...(workspace.name === undefined ? {} : { name: workspace.name }),
172
- relativeRoot: workspace.relativeRoot,
173
- manifestPath: workspace.manifestPath,
174
- sourceFiles: Object.freeze([...workspace.sourceFiles]),
175
- tsconfigPaths: Object.freeze([...workspace.tsconfigPaths]),
176
- environments: Object.freeze([...workspace.environments]),
177
- ...(workspace.productionDependencies === undefined
178
- ? {}
179
- : {
180
- productionDependencies: Object.freeze([
181
- ...workspace.productionDependencies,
182
- ]),
183
- }),
184
- ...(workspace.developmentDependencies === undefined
185
- ? {}
186
- : {
187
- developmentDependencies: Object.freeze([
188
- ...workspace.developmentDependencies,
189
- ]),
190
- }),
191
- dependencyDeclarations: Object.freeze(workspace.dependencyDeclarations.map((declaration) => Object.freeze({
192
- name: declaration.name,
193
- specifier: declaration.specifier,
194
- section: declaration.section,
195
- }))),
196
- }))),
197
- });
198
- }
199
- function cacheInspection(inspection, target) {
200
- const workspaces = inspection.workspaces
201
- .filter((workspace) => target.kind === "repository" ||
202
- workspace.relativeRoot === target.relativeRoot)
203
- .map((workspace) => ({
204
- name: workspace.name,
205
- relativeRoot: workspace.relativeRoot,
206
- manifestPath: workspace.manifestPath,
207
- sourceFiles: workspace.sourceFiles,
208
- tsconfigPaths: workspace.tsconfigPaths,
209
- environments: workspace.environments,
210
- dependencyDeclarations: workspace.dependencyDeclarations,
211
- productionDependencies: workspace.productionDependencies,
212
- developmentDependencies: workspace.developmentDependencies,
213
- }));
214
- return {
215
- packageManager: inspection.packageManager,
216
- lockfiles: inspection.lockfiles,
217
- workspaces,
218
- };
219
- }
220
- const LINT_SOURCE_PATH = /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/u;
221
- const REACT_COMPLEXITY_SOURCE_PATH = /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/iu;
222
- const FILE_BEHAVIOR_CHECKS = new Set([
223
- "lint",
224
- "cyclomaticComplexity",
225
- "readabilityComplexity",
226
- "reactCorrectness",
227
- "reactAccessibility",
228
- ]);
229
- function isFileBehaviorPath(checkId, path) {
230
- return checkId === "lint"
231
- ? LINT_SOURCE_PATH.test(path)
232
- : REACT_COMPLEXITY_SOURCE_PATH.test(path);
233
- }
234
- function cacheBehaviorPaths(checkId, target, baseline, staged) {
235
- if (!FILE_BEHAVIOR_CHECKS.has(checkId))
236
- return Object.freeze([]);
237
- const paths = [baseline, staged].flatMap((inspection) => inspection.workspaces
238
- .filter(({ relativeRoot }) => target.kind === "repository" || relativeRoot === target.relativeRoot)
239
- .flatMap(({ sourceFiles }) => sourceFiles.filter((path) => isFileBehaviorPath(checkId, path))));
240
- return Object.freeze([...new Set(paths)].sort(compareCodeUnits));
241
- }
242
- function sameTarget(left, right) {
243
- return (left.id === right.id &&
244
- left.kind === right.kind &&
245
- left.relativeRoot === right.relativeRoot);
246
- }
247
- async function collectObservations(adapter, runContext, cachePolicy, behavior, options, cacheKeyFor) {
248
- if (!isCacheableObservationCheck(adapter.id) ||
249
- (options.cache === undefined && options.cacheEngineIdentity === undefined)) {
250
- return Reflect.apply(adapter.collect, undefined, [runContext]);
251
- }
252
- const engineIdentity = (options.cacheEngineIdentity ?? observationCacheEngineIdentity)(adapter.id);
253
- if (engineIdentity === undefined) {
254
- return Reflect.apply(adapter.collect, undefined, [runContext]);
255
- }
256
- let cacheKey;
257
- if (options.cache !== undefined && engineIdentity !== undefined) {
258
- try {
259
- cacheKey = await cacheKeyFor({
260
- checkId: adapter.id,
261
- engineIdentity,
262
- policy: cachePolicy,
263
- checkTarget: runContext.target,
264
- relevantConfig: {
265
- schemaVersion: runContext.config.schemaVersion,
266
- behavior,
267
- // Collection pairs observations and computes projectDelta from the
268
- // change metadata, including mode-only edits absent from file bytes.
269
- changeSet: {
270
- isEmpty: runContext.changeSet.isEmpty,
271
- files: [...runContext.changeSet.files.values()]
272
- .sort((left, right) => compareCodeUnits(left.path, right.path))
273
- .map((file) => ({
274
- path: file.path,
275
- previousPath: file.previousPath,
276
- status: file.status,
277
- addedRanges: [...file.addedRanges].sort((left, right) => left.start - right.start || left.end - right.end),
278
- })),
279
- },
280
- baseline: cacheInspection(runContext.baselineInspection, runContext.target),
281
- target: cacheInspection(runContext.targetInspection, runContext.target),
282
- },
283
- });
284
- const cached = await options.cache.get(cacheKey).catch(() => undefined);
285
- if (cached !== undefined &&
286
- cached.checkId === adapter.id &&
287
- sameTarget(cached.target, runContext.target) &&
288
- ((adapter.id !== "lint" &&
289
- adapter.id !== "types" &&
290
- adapter.id !== "deadCode") ||
291
- validateDependencyInputs(cached.dependencyInputs, runContext, adapter.id === "deadCode" ? "knip" : false))) {
292
- return sanitizeCacheableObservationSet(cached);
293
- }
294
- }
295
- catch {
296
- cacheKey = undefined;
297
- }
298
- }
299
- const collected = await Reflect.apply(adapter.collect, undefined, [
300
- runContext,
301
- ]);
302
- if (cacheKey !== undefined &&
303
- options.cache !== undefined &&
304
- !runContext.signal.aborted &&
305
- (adapter.id !== "deadCode" ||
306
- (await cacheKeyFor.matchesSnapshotFiles(collected.dependencyInputs))) &&
307
- ((adapter.id !== "lint" &&
308
- adapter.id !== "types" &&
309
- adapter.id !== "deadCode") ||
310
- validateDependencyInputs(collected.dependencyInputs, runContext, adapter.id === "deadCode" ? "knip" : false))) {
311
- await options.cache.set(cacheKey, collected).catch(() => undefined);
312
- }
313
- return collected;
314
- }
315
- function adapterBaseContext(context) {
316
- return Object.freeze({
317
- repositoryRoot: context.repositoryRoot,
318
- ...(context.mergeComparison === true ? { mergeComparison: true } : {}),
319
- changeSet: snapshotChangeSet(context.changeSet),
320
- config: snapshotConfig(context.config),
321
- snapshots: Object.freeze({
322
- baselineDir: context.snapshots.baselineDir,
323
- targetDir: context.snapshots.targetDir,
324
- baselineRef: context.snapshots.baselineRef,
325
- targetRef: context.snapshots.targetRef,
326
- unsupportedEntries: Object.freeze(context.snapshots.unsupportedEntries.map((entry) => Object.freeze({ ...entry }))),
327
- }),
328
- baselineInspection: snapshotInspection(context.baselineInspection),
329
- targetInspection: snapshotInspection(context.targetInspection),
330
- signal: context.signal,
331
- policyForFile: context.policyForFile,
332
- filePolicyConfig: snapshotConfig(context.config),
333
- ...(context.projectPrettierTrust === true
334
- ? { projectPrettierTrust: true }
335
- : {}),
336
- });
337
- }
338
- function inspectionContext(context, checkId, policy) {
339
- return Object.freeze({
340
- repositoryRoot: context.repositoryRoot,
341
- changeSet: context.changeSet,
342
- config: snapshotConfig({
343
- ...context.config,
344
- checks: { ...context.config.checks, [checkId]: policy },
345
- }),
346
- filePolicyConfig: context.config,
347
- baselineInspection: context.baselineInspection,
348
- targetInspection: context.targetInspection,
349
- ...(context.mergeComparison === true ? { mergeComparison: true } : {}),
350
- });
351
- }
352
- function scopedContext(context, checkId, target, policy) {
353
- const config = snapshotConfig({
354
- ...context.config,
355
- checks: { ...context.config.checks, [checkId]: policy },
356
- });
357
- return Object.freeze({
358
- ...context,
359
- config,
360
- target: Object.freeze({ ...target }),
361
- // Keep the adapter snapshot detached from the authoritative execution
362
- // envelope while preserving the same deeply immutable behavior.
363
- policy: Object.freeze({ ...policy }),
364
- });
365
- }
366
34
  function compareResults(left, right) {
367
35
  return (compareCodeUnits(left.result.checkId, right.result.checkId) ||
368
36
  compareCodeUnits(left.result.target ?? "", right.result.target ?? ""));
369
37
  }
370
- function adapterId(value) {
371
- if (typeof value !== "string" ||
372
- value.length === 0 ||
373
- value.trim() !== value ||
374
- /[\u0000-\u001f\u007f]/u.test(value)) {
375
- throw new TypeError("Adapter returned an invalid check id");
376
- }
377
- return displayLabel(value, "adapter check id");
378
- }
379
- function snapshotAdapter(raw) {
380
- const candidate = raw;
381
- let id = "unknown";
382
- try {
383
- id = adapterId(candidate.id);
384
- const output = candidate.output;
385
- const inspect = candidate.inspect;
386
- const planFixes = candidate.planFixes;
387
- if (typeof inspect !== "function") {
388
- throw new TypeError("Adapter returned an invalid inspect function");
389
- }
390
- if (planFixes !== undefined && typeof planFixes !== "function") {
391
- throw new TypeError("Adapter returned an invalid fix provider");
392
- }
393
- const inspectFunction = inspect;
394
- if (output === "observations") {
395
- const collect = candidate.collect;
396
- if (typeof collect !== "function") {
397
- throw new TypeError("Adapter returned an invalid collect function");
398
- }
399
- return Object.freeze({
400
- valid: true,
401
- adapter: Object.freeze({
402
- id,
403
- output,
404
- inspect: inspectFunction,
405
- collect: collect,
406
- ...(planFixes === undefined
407
- ? {}
408
- : { planFixes: planFixes }),
409
- }),
410
- });
411
- }
412
- if (output === "legacy-check-result" && id === "formatting") {
413
- const runLegacy = candidate.runLegacy;
414
- if (typeof runLegacy !== "function") {
415
- throw new TypeError("Adapter returned an invalid legacy function");
416
- }
417
- return Object.freeze({
418
- valid: true,
419
- adapter: Object.freeze({
420
- id,
421
- output,
422
- inspect: inspectFunction,
423
- runLegacy: runLegacy,
424
- ...(planFixes === undefined
425
- ? {}
426
- : { planFixes: planFixes }),
427
- }),
428
- });
429
- }
430
- throw new TypeError("Adapter returned an invalid output contract");
431
- }
432
- catch {
433
- return Object.freeze({ valid: false, id });
434
- }
435
- }
436
- function snapshotApplicability(value) {
437
- if (typeof value !== "object" || value === null) {
438
- throw new TypeError("Adapter returned invalid applicability");
439
- }
440
- const candidate = value;
441
- const applies = candidate.applies;
442
- if (applies === false) {
443
- const reason = candidate.reason;
444
- if (typeof reason !== "string" ||
445
- reason.length === 0 ||
446
- reason.trim() !== reason ||
447
- /[\u0000-\u001f\u007f]/u.test(reason)) {
448
- throw new TypeError("Adapter returned an invalid skip reason");
449
- }
450
- return Object.freeze({
451
- applies,
452
- reason: displayProse(reason, "skip reason"),
453
- });
454
- }
455
- if (applies !== true) {
456
- throw new TypeError("Adapter returned invalid applicability");
457
- }
458
- const executionClass = candidate.executionClass;
459
- const requiresBaseline = candidate.requiresBaseline;
460
- const rawTargets = candidate.targets;
461
- const rawDisclosure = candidate.networkDisclosure;
462
- if ((executionClass !== "lightweight" &&
463
- executionClass !== "project-analysis" &&
464
- executionClass !== "network") ||
465
- typeof requiresBaseline !== "boolean" ||
466
- !Array.isArray(rawTargets)) {
467
- throw new TypeError("Adapter returned invalid applicability");
468
- }
469
- const targets = Object.freeze(rawTargets
470
- .map((target) => sanitizeCheckTarget(target))
471
- .sort((left, right) => compareCodeUnits(left.id, right.id)));
472
- let networkDisclosure;
473
- if (rawDisclosure !== undefined) {
474
- if (executionClass !== "network" ||
475
- typeof rawDisclosure !== "object" ||
476
- rawDisclosure === null) {
477
- throw new TypeError("Adapter returned invalid network disclosure");
478
- }
479
- const disclosure = rawDisclosure;
480
- if (!Array.isArray(disclosure.services) ||
481
- !Array.isArray(disclosure.metadata)) {
482
- throw new TypeError("Adapter returned invalid network disclosure");
483
- }
484
- const services = Object.freeze(disclosure.services.map((service) => displayProse(service, "network service")));
485
- const metadata = Object.freeze(disclosure.metadata.map((field) => displayProse(field, "network metadata")));
486
- if (services.length === 0 || metadata.length === 0) {
487
- throw new TypeError("Adapter returned invalid network disclosure");
488
- }
489
- networkDisclosure = Object.freeze({ services, metadata });
490
- }
491
- return Object.freeze({
492
- applies,
493
- executionClass,
494
- requiresBaseline,
495
- targets,
496
- ...(networkDisclosure === undefined ? {} : { networkDisclosure }),
497
- });
38
+ const preparedExecutions = new WeakMap();
39
+ export function executePreparedCheckDispatch(plan) {
40
+ const execute = preparedExecutions.get(plan);
41
+ if (execute === undefined)
42
+ throw new TypeError("Invalid or consumed dispatch plan");
43
+ preparedExecutions.delete(plan);
44
+ return execute();
498
45
  }
499
46
  export async function dispatchChecks(adapters, context, options = {}) {
47
+ return executePreparedCheckDispatch(await prepareCheckDispatch(adapters, context, options));
48
+ }
49
+ export async function prepareCheckDispatch(adapters, context, options = {}) {
500
50
  const clock = options.clock ?? performance.now.bind(performance);
501
51
  const emit = (event) => {
502
52
  try {
@@ -509,32 +59,11 @@ export async function dispatchChecks(adapters, context, options = {}) {
509
59
  // Bounded producers retain only four active adapter inputs. Worker/class
510
60
  // scheduling belongs to the shared executor, including its four-worker mode.
511
61
  const limit = pLimit(4);
512
- // Default installed metadata is reused only within this dispatch. Preserve
513
- // injected resolvers' per-collection behavior and avoid all reads without cache.
514
- const identities = new Map();
515
- const executionOptions = options.cache === undefined || options.cacheEngineIdentity !== undefined
516
- ? options
517
- : {
518
- ...options,
519
- cacheEngineIdentity(checkId) {
520
- if (!identities.has(checkId))
521
- identities.set(checkId, observationCacheEngineIdentity(checkId));
522
- return identities.get(checkId);
523
- },
524
- };
525
62
  const adapterContext = adapterBaseContext(context);
526
- const cacheKeyFor = createObservationCacheKeyBuilder(adapterContext.snapshots.baselineDir, adapterContext.snapshots.targetDir, adapterContext.snapshots.targetRef === "index"
527
- ? {
528
- mode: "index",
529
- baseline: adapterContext.snapshots.baselineRef,
530
- target: "index",
531
- }
532
- : {
533
- mode: "base",
534
- baseline: adapterContext.snapshots.baselineRef,
535
- target: adapterContext.snapshots.targetRef,
536
- });
63
+ const collectObservations = createDispatchObservationCollector(adapterContext, options);
537
64
  const scheduled = [];
65
+ const jobs = [];
66
+ const scheduledTargets = [];
538
67
  const adapterSnapshots = adapters.map(snapshotAdapter);
539
68
  for (const snapshot of adapterSnapshots) {
540
69
  if (!snapshot.valid) {
@@ -636,7 +165,7 @@ export async function dispatchChecks(adapters, context, options = {}) {
636
165
  for (const target of targets) {
637
166
  let policy;
638
167
  try {
639
- const scheduledPolicy = resolveScheduledTargetPolicy(context.config, adapter.id, target, context.targetInspection, context.changeSet, adapterContext.policyForFile);
168
+ const scheduledPolicy = await resolveScheduledTargetPolicy(context.config, adapter.id, target, context, adapterContext.policyForFile);
640
169
  if (scheduledPolicy === undefined)
641
170
  continue;
642
171
  policy = scheduledPolicy;
@@ -677,176 +206,38 @@ export async function dispatchChecks(adapters, context, options = {}) {
677
206
  continue;
678
207
  }
679
208
  const executionPolicy = immutablePolicy(adapter.id, policy);
680
- if (applicability.networkDisclosure !== undefined) {
681
- emit({
682
- type: "network-disclosure",
683
- checkId: adapter.id,
684
- target: target.id,
685
- timestamp: clock(),
686
- services: applicability.networkDisclosure.services,
687
- metadata: applicability.networkDisclosure.metadata,
688
- });
689
- }
690
- emit({
691
- type: "check-queued",
692
- checkId: adapter.id,
693
- target: target.id,
694
- timestamp: clock(),
695
- });
696
- scheduled.push(limit(async () => {
697
- const started = clock();
698
- emit({
699
- type: "check-running",
700
- checkId: adapter.id,
701
- target: target.id,
702
- timestamp: started,
703
- });
704
- let result;
705
- let runContext;
706
- const durationMs = () => Math.max(0, clock() - started);
707
- const label = checkLabel(adapter.id);
708
- try {
709
- adapterContext.signal.throwIfAborted();
710
- runContext = scopedContext(adapterContext, adapter.id, target, executionPolicy);
711
- const attributionContext = {
712
- ...adapterContext,
713
- target,
714
- policy: executionPolicy,
715
- };
716
- let adapterResult;
717
- if (adapter.output === "observations") {
718
- const checkId = adapter.id;
719
- const observations = await collectObservations(adapter, runContext, FILE_BEHAVIOR_CHECKS.has(checkId)
720
- ? adapterContext.config.checks[checkId]
721
- : runContext.policy, CHECK_IDS.includes(checkId)
722
- ? effectiveBehaviorFingerprint(adapterContext.config, checkId, cacheBehaviorPaths(checkId, target, adapterContext.baselineInspection, adapterContext.targetInspection), adapterContext.changeSet)
723
- : undefined, executionOptions, cacheKeyFor);
724
- try {
725
- adapterResult = await observationCheckResult(adapter.id, observations, attributionContext, applicability.requiresBaseline);
726
- }
727
- catch {
728
- adapterResult = undefined;
729
- }
730
- }
731
- else {
732
- adapterResult = await Reflect.apply(adapter.runLegacy, undefined, [runContext]);
733
- }
734
- if (adapterResult === undefined) {
735
- result = incompleteResult({
736
- checkId: adapter.id,
737
- target: target.id,
738
- durationMs: durationMs(),
739
- code: "ADAPTER_RESULT_INVALID",
740
- message: `${label} returned an invalid result for ${target.id === "." ? "the repository root" : target.id}.`,
741
- remediation: "Run zedbee doctor and update Zedbee before retrying.",
742
- });
743
- }
744
- else {
745
- try {
746
- result = sanitizeCheckResult(adapterResult, {
747
- checkId: adapter.id,
748
- target: target.id,
749
- durationMs: durationMs(),
750
- });
751
- }
752
- catch {
753
- result = incompleteResult({
754
- checkId: adapter.id,
755
- target: target.id,
756
- durationMs: durationMs(),
757
- code: "ADAPTER_RESULT_INVALID",
758
- message: `${label} returned an invalid result for ${target.id === "." ? "the repository root" : target.id}.`,
759
- remediation: "Run zedbee doctor and update Zedbee before retrying.",
760
- });
761
- }
762
- }
763
- }
764
- catch (error) {
765
- result =
766
- error instanceof CheckIncompleteError
767
- ? incompleteResult({
768
- checkId: adapter.id,
769
- target: target.id,
770
- durationMs: durationMs(),
771
- code: error.code,
772
- message: error.message,
773
- remediation: error.remediation,
774
- ...(error.diagnostic === undefined
775
- ? {}
776
- : { diagnostic: error.diagnostic }),
777
- ...(error.path === undefined ? {} : { path: error.path }),
778
- ...(error.paths === undefined
779
- ? {}
780
- : { paths: error.paths }),
781
- ...(error.snapshot === undefined
782
- ? {}
783
- : { snapshot: error.snapshot }),
784
- ...(error.projectPaths === undefined
785
- ? {}
786
- : { projectPaths: error.projectPaths }),
787
- ...(error.disposition === undefined
788
- ? {}
789
- : { disposition: error.disposition }),
790
- })
791
- : incompleteResult({
792
- checkId: adapter.id,
793
- target: target.id,
794
- durationMs: durationMs(),
795
- code: "ADAPTER_EXECUTION_FAILED",
796
- ...(error instanceof AnalyzerJobError
797
- ? { diagnostic: error.diagnostic }
798
- : {}),
799
- message: `${label} could not analyze ${target.id === "." ? "the repository root" : target.id}.`,
800
- remediation: "Check the analyzer installation and selected input, then retry.",
801
- });
802
- }
803
- const policyDisplayResult = displayResultForPolicy(result, executionPolicy, adapterContext.policyForFile);
804
- let displayResult = policyDisplayResult ?? sanitizeCheckResult(result);
805
- let fixCandidates;
806
- if (options.collectFixes === true &&
807
- adapter.planFixes !== undefined &&
808
- policyDisplayResult?.status === "completed" &&
809
- policyDisplayResult.findings.length > 0 &&
810
- runContext !== undefined) {
811
- try {
812
- fixCandidates = sanitizeFixCandidates(await Reflect.apply(adapter.planFixes, undefined, [
813
- runContext,
814
- policyDisplayResult.findings,
815
- ]), {
816
- checkId: adapter.id,
817
- findingIds: policyDisplayResult.findings.map((finding) => finding.id),
818
- });
819
- }
820
- catch (error) {
821
- result = incompleteResult({
822
- checkId: adapter.id,
823
- target: target.id,
824
- durationMs: durationMs(),
825
- code: "FIX_PROVIDER_FAILED",
826
- ...(error instanceof AnalyzerJobError ||
827
- error instanceof CheckIncompleteError
828
- ? error.diagnostic === undefined
829
- ? {}
830
- : { diagnostic: error.diagnostic }
831
- : {}),
832
- message: `${label} could not prepare managed fixes.`,
833
- remediation: "Update Zedbee or inspect the managed rule compatibility before retrying.",
834
- });
835
- displayResult =
836
- displayResultForPolicy(result, executionPolicy, adapterContext.policyForFile) ?? sanitizeCheckResult(result);
837
- }
209
+ scheduledTargets.push({ checkId: adapter.id, target });
210
+ jobs.push(async () => {
211
+ if (applicability.networkDisclosure !== undefined) {
212
+ emit({
213
+ type: "network-disclosure",
214
+ checkId: adapter.id,
215
+ target: target.id,
216
+ timestamp: clock(),
217
+ services: applicability.networkDisclosure.services,
218
+ metadata: applicability.networkDisclosure.metadata,
219
+ });
838
220
  }
839
221
  emit({
840
- type: "check-completed",
222
+ type: "check-queued",
841
223
  checkId: adapter.id,
842
224
  target: target.id,
843
225
  timestamp: clock(),
844
- result: sanitizeCheckResult(displayResult),
845
226
  });
846
- return executionResult(result, executionPolicy, target, adapterContext.policyForFile, fixCandidates);
847
- }));
227
+ return executeDispatchTarget(adapter, adapterContext, target, executionPolicy, applicability.requiresBaseline, {
228
+ clock,
229
+ emit,
230
+ collectObservations,
231
+ collectFixes: options.collectFixes === true,
232
+ });
233
+ });
848
234
  }
849
235
  }
850
- return (await Promise.all(scheduled)).sort(compareResults);
236
+ const plan = Object.freeze({
237
+ hasJobs: jobs.length > 0,
238
+ scheduledTargets: Object.freeze(scheduledTargets),
239
+ });
240
+ preparedExecutions.set(plan, async () => (await Promise.all([...scheduled, ...jobs.map((job) => limit(job))])).sort(compareResults));
241
+ return plan;
851
242
  }
852
243
  //# sourceMappingURL=dispatcher.js.map