zedbee 0.1.0-beta.13 → 0.1.0-beta.14

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 (361) 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 +9 -6
  24. package/dist/checks/applicability.js.map +1 -1
  25. package/dist/checks/complexity/adapter.d.ts.map +1 -1
  26. package/dist/checks/complexity/adapter.js +61 -12
  27. package/dist/checks/complexity/adapter.js.map +1 -1
  28. package/dist/checks/complexity/pair-class-metrics.d.ts.map +1 -1
  29. package/dist/checks/complexity/pair-class-metrics.js +52 -19
  30. package/dist/checks/complexity/pair-class-metrics.js.map +1 -1
  31. package/dist/checks/dead-code/framework-entrypoints.d.ts +9 -0
  32. package/dist/checks/dead-code/framework-entrypoints.d.ts.map +1 -0
  33. package/dist/checks/dead-code/framework-entrypoints.js +47 -0
  34. package/dist/checks/dead-code/framework-entrypoints.js.map +1 -0
  35. package/dist/checks/dead-code/managed-config.d.ts +1 -0
  36. package/dist/checks/dead-code/managed-config.d.ts.map +1 -1
  37. package/dist/checks/dead-code/managed-config.js +6 -1
  38. package/dist/checks/dead-code/managed-config.js.map +1 -1
  39. package/dist/checks/dead-code/parse-report.d.ts.map +1 -1
  40. package/dist/checks/dead-code/parse-report.js +26 -23
  41. package/dist/checks/dead-code/parse-report.js.map +1 -1
  42. package/dist/checks/diagnostic-messages.d.ts +4 -0
  43. package/dist/checks/diagnostic-messages.d.ts.map +1 -0
  44. package/dist/checks/diagnostic-messages.js +50 -0
  45. package/dist/checks/diagnostic-messages.js.map +1 -0
  46. package/dist/checks/dispatch-adapter.d.ts +25 -0
  47. package/dist/checks/dispatch-adapter.d.ts.map +1 -0
  48. package/dist/checks/dispatch-adapter.js +133 -0
  49. package/dist/checks/dispatch-adapter.js.map +1 -0
  50. package/dist/checks/dispatch-cache.d.ts +9 -0
  51. package/dist/checks/dispatch-cache.d.ts.map +1 -0
  52. package/dist/checks/dispatch-cache.js +154 -0
  53. package/dist/checks/dispatch-cache.js.map +1 -0
  54. package/dist/checks/dispatch-context.d.ts +11 -0
  55. package/dist/checks/dispatch-context.d.ts.map +1 -0
  56. package/dist/checks/dispatch-context.js +155 -0
  57. package/dist/checks/dispatch-context.js.map +1 -0
  58. package/dist/checks/dispatch-target.d.ts +17 -0
  59. package/dist/checks/dispatch-target.d.ts.map +1 -0
  60. package/dist/checks/dispatch-target.js +167 -0
  61. package/dist/checks/dispatch-target.js.map +1 -0
  62. package/dist/checks/dispatcher.d.ts +3 -7
  63. package/dist/checks/dispatcher.d.ts.map +1 -1
  64. package/dist/checks/dispatcher.js +12 -642
  65. package/dist/checks/dispatcher.js.map +1 -1
  66. package/dist/checks/duplication/adapter.d.ts.map +1 -1
  67. package/dist/checks/duplication/adapter.js +44 -6
  68. package/dist/checks/duplication/adapter.js.map +1 -1
  69. package/dist/checks/duplication/clone-comparison.d.ts +6 -0
  70. package/dist/checks/duplication/clone-comparison.d.ts.map +1 -0
  71. package/dist/checks/duplication/clone-comparison.js +163 -0
  72. package/dist/checks/duplication/clone-comparison.js.map +1 -0
  73. package/dist/checks/duplication/normalize-clone.d.ts.map +1 -1
  74. package/dist/checks/duplication/normalize-clone.js +9 -0
  75. package/dist/checks/duplication/normalize-clone.js.map +1 -1
  76. package/dist/checks/duplication/source-tokens.d.ts +18 -0
  77. package/dist/checks/duplication/source-tokens.d.ts.map +1 -0
  78. package/dist/checks/duplication/source-tokens.js +68 -0
  79. package/dist/checks/duplication/source-tokens.js.map +1 -0
  80. package/dist/checks/duplication/types.d.ts +2 -0
  81. package/dist/checks/duplication/types.d.ts.map +1 -1
  82. package/dist/checks/engine-identity.d.ts.map +1 -1
  83. package/dist/checks/engine-identity.js +8 -7
  84. package/dist/checks/engine-identity.js.map +1 -1
  85. package/dist/checks/eslint/convert-message.d.ts +2 -0
  86. package/dist/checks/eslint/convert-message.d.ts.map +1 -1
  87. package/dist/checks/eslint/convert-message.js +34 -1
  88. package/dist/checks/eslint/convert-message.js.map +1 -1
  89. package/dist/checks/metadata.d.ts +4 -2
  90. package/dist/checks/metadata.d.ts.map +1 -1
  91. package/dist/checks/metadata.js +7 -4
  92. package/dist/checks/metadata.js.map +1 -1
  93. package/dist/checks/observation-result.d.ts.map +1 -1
  94. package/dist/checks/observation-result.js +24 -12
  95. package/dist/checks/observation-result.js.map +1 -1
  96. package/dist/checks/prettier/project-engine.d.ts +8 -14
  97. package/dist/checks/prettier/project-engine.d.ts.map +1 -1
  98. package/dist/checks/prettier/project-engine.js +33 -281
  99. package/dist/checks/prettier/project-engine.js.map +1 -1
  100. package/dist/checks/prettier/project-error.d.ts +7 -0
  101. package/dist/checks/prettier/project-error.d.ts.map +1 -0
  102. package/dist/checks/prettier/project-error.js +12 -0
  103. package/dist/checks/prettier/project-error.js.map +1 -0
  104. package/dist/checks/prettier/project-import-capture.d.ts +20 -0
  105. package/dist/checks/prettier/project-import-capture.d.ts.map +1 -0
  106. package/dist/checks/prettier/project-import-capture.js +173 -0
  107. package/dist/checks/prettier/project-import-capture.js.map +1 -0
  108. package/dist/checks/prettier/project-import-dependencies.d.ts +5 -0
  109. package/dist/checks/prettier/project-import-dependencies.d.ts.map +1 -0
  110. package/dist/checks/prettier/project-import-dependencies.js +84 -0
  111. package/dist/checks/prettier/project-import-dependencies.js.map +1 -0
  112. package/dist/checks/prettier/project-installation.d.ts +3 -0
  113. package/dist/checks/prettier/project-installation.d.ts.map +1 -0
  114. package/dist/checks/prettier/project-installation.js +204 -0
  115. package/dist/checks/prettier/project-installation.js.map +1 -0
  116. package/dist/checks/prettier/project-protocol.d.ts.map +1 -1
  117. package/dist/checks/prettier/project-protocol.js +15 -3
  118. package/dist/checks/prettier/project-protocol.js.map +1 -1
  119. package/dist/checks/prettier/project-snapshot-identity.d.ts +7 -0
  120. package/dist/checks/prettier/project-snapshot-identity.d.ts.map +1 -0
  121. package/dist/checks/prettier/project-snapshot-identity.js +63 -0
  122. package/dist/checks/prettier/project-snapshot-identity.js.map +1 -0
  123. package/dist/checks/prettier/project-types.d.ts +2 -0
  124. package/dist/checks/prettier/project-types.d.ts.map +1 -1
  125. package/dist/checks/prettier/project-worker.js +25 -3
  126. package/dist/checks/prettier/project-worker.js.map +1 -1
  127. package/dist/checks/prettier/project-workspace.d.ts +7 -0
  128. package/dist/checks/prettier/project-workspace.d.ts.map +1 -1
  129. package/dist/checks/prettier/project-workspace.js +101 -40
  130. package/dist/checks/prettier/project-workspace.js.map +1 -1
  131. package/dist/checks/project-inputs.d.ts.map +1 -1
  132. package/dist/checks/project-inputs.js +50 -12
  133. package/dist/checks/project-inputs.js.map +1 -1
  134. package/dist/checks/runner/process-group.d.ts.map +1 -1
  135. package/dist/checks/runner/process-group.js +30 -2
  136. package/dist/checks/runner/process-group.js.map +1 -1
  137. package/dist/checks/secrets/content.d.ts.map +1 -1
  138. package/dist/checks/secrets/content.js +19 -9
  139. package/dist/checks/secrets/content.js.map +1 -1
  140. package/dist/checks/typescript/configuration-paths.d.ts +4 -3
  141. package/dist/checks/typescript/configuration-paths.d.ts.map +1 -1
  142. package/dist/checks/typescript/configuration-paths.js +127 -58
  143. package/dist/checks/typescript/configuration-paths.js.map +1 -1
  144. package/dist/checks/typescript/convert-diagnostic.d.ts +2 -0
  145. package/dist/checks/typescript/convert-diagnostic.d.ts.map +1 -1
  146. package/dist/checks/typescript/convert-diagnostic.js +23 -5
  147. package/dist/checks/typescript/convert-diagnostic.js.map +1 -1
  148. package/dist/checks/vulnerabilities/inventory/normalize.d.ts +1 -0
  149. package/dist/checks/vulnerabilities/inventory/normalize.d.ts.map +1 -1
  150. package/dist/checks/vulnerabilities/inventory/normalize.js +5 -2
  151. package/dist/checks/vulnerabilities/inventory/normalize.js.map +1 -1
  152. package/dist/checks/vulnerabilities/inventory/parse-bun.d.ts.map +1 -1
  153. package/dist/checks/vulnerabilities/inventory/parse-bun.js +18 -7
  154. package/dist/checks/vulnerabilities/inventory/parse-bun.js.map +1 -1
  155. package/dist/checks/vulnerabilities/inventory/parse-yarn.d.ts.map +1 -1
  156. package/dist/checks/vulnerabilities/inventory/parse-yarn.js +21 -11
  157. package/dist/checks/vulnerabilities/inventory/parse-yarn.js.map +1 -1
  158. package/dist/commands/checks.d.ts +5 -2
  159. package/dist/commands/checks.d.ts.map +1 -1
  160. package/dist/commands/checks.js +18 -5
  161. package/dist/commands/checks.js.map +1 -1
  162. package/dist/commands/fix.d.ts.map +1 -1
  163. package/dist/commands/fix.js +6 -297
  164. package/dist/commands/fix.js.map +1 -1
  165. package/dist/commands/init.d.ts +4 -2
  166. package/dist/commands/init.d.ts.map +1 -1
  167. package/dist/commands/init.js +36 -379
  168. package/dist/commands/init.js.map +1 -1
  169. package/dist/commands/scan.d.ts.map +1 -1
  170. package/dist/commands/scan.js +1 -13
  171. package/dist/commands/scan.js.map +1 -1
  172. package/dist/config/load-config.d.ts.map +1 -1
  173. package/dist/config/load-config.js +6 -15
  174. package/dist/config/load-config.js.map +1 -1
  175. package/dist/config/selection-path.d.ts +7 -0
  176. package/dist/config/selection-path.d.ts.map +1 -0
  177. package/dist/config/selection-path.js +20 -0
  178. package/dist/config/selection-path.js.map +1 -0
  179. package/dist/core/check-label.d.ts +2 -0
  180. package/dist/core/check-label.d.ts.map +1 -0
  181. package/dist/core/check-label.js +19 -0
  182. package/dist/core/check-label.js.map +1 -0
  183. package/dist/core/freeze-result.d.ts +3 -0
  184. package/dist/core/freeze-result.d.ts.map +1 -0
  185. package/dist/core/freeze-result.js +10 -0
  186. package/dist/core/freeze-result.js.map +1 -0
  187. package/dist/core/immutable-map.d.ts +3 -0
  188. package/dist/core/immutable-map.d.ts.map +1 -0
  189. package/dist/core/immutable-map.js +33 -0
  190. package/dist/core/immutable-map.js.map +1 -0
  191. package/dist/core/kernel-lease.d.ts +17 -0
  192. package/dist/core/kernel-lease.d.ts.map +1 -0
  193. package/dist/core/kernel-lease.js +55 -0
  194. package/dist/core/kernel-lease.js.map +1 -0
  195. package/dist/fixes/apply-plan.d.ts.map +1 -1
  196. package/dist/fixes/apply-plan.js +2 -9
  197. package/dist/fixes/apply-plan.js.map +1 -1
  198. package/dist/fixes/build-plan.d.ts +4 -5
  199. package/dist/fixes/build-plan.d.ts.map +1 -1
  200. package/dist/fixes/build-plan.js +10 -465
  201. package/dist/fixes/build-plan.js.map +1 -1
  202. package/dist/fixes/exact-edits.d.ts +11 -1
  203. package/dist/fixes/exact-edits.d.ts.map +1 -1
  204. package/dist/fixes/exact-edits.js +101 -46
  205. package/dist/fixes/exact-edits.js.map +1 -1
  206. package/dist/fixes/plan-candidates.d.ts +8 -0
  207. package/dist/fixes/plan-candidates.d.ts.map +1 -0
  208. package/dist/fixes/plan-candidates.js +144 -0
  209. package/dist/fixes/plan-candidates.js.map +1 -0
  210. package/dist/fixes/prettier-provider.d.ts +3 -2
  211. package/dist/fixes/prettier-provider.d.ts.map +1 -1
  212. package/dist/fixes/prettier-provider.js +53 -0
  213. package/dist/fixes/prettier-provider.js.map +1 -1
  214. package/dist/fixes/public-plan.d.ts +8 -0
  215. package/dist/fixes/public-plan.d.ts.map +1 -0
  216. package/dist/fixes/public-plan.js +194 -0
  217. package/dist/fixes/public-plan.js.map +1 -0
  218. package/dist/fixes/working-preview.d.ts +18 -0
  219. package/dist/fixes/working-preview.d.ts.map +1 -0
  220. package/dist/fixes/working-preview.js +162 -0
  221. package/dist/fixes/working-preview.js.map +1 -0
  222. package/dist/git/change-set.d.ts.map +1 -1
  223. package/dist/git/change-set.js +1 -9
  224. package/dist/git/change-set.js.map +1 -1
  225. package/dist/git/client.d.ts +1 -1
  226. package/dist/git/client.d.ts.map +1 -1
  227. package/dist/git/client.js +14 -12
  228. package/dist/git/client.js.map +1 -1
  229. package/dist/init/formatter-setup.d.ts +29 -0
  230. package/dist/init/formatter-setup.d.ts.map +1 -0
  231. package/dist/init/formatter-setup.js +166 -0
  232. package/dist/init/formatter-setup.js.map +1 -0
  233. package/dist/init/import-provenance.d.ts +7 -0
  234. package/dist/init/import-provenance.d.ts.map +1 -0
  235. package/dist/init/import-provenance.js +58 -0
  236. package/dist/init/import-provenance.js.map +1 -0
  237. package/dist/init/install-dependency.d.mts +40 -0
  238. package/dist/init/install-dependency.mjs +427 -0
  239. package/dist/init/install-project.d.ts +1 -0
  240. package/dist/init/install-project.d.ts.map +1 -1
  241. package/dist/init/install-project.js +12 -31
  242. package/dist/init/install-project.js.map +1 -1
  243. package/dist/init/presentation.d.ts +54 -0
  244. package/dist/init/presentation.d.ts.map +1 -0
  245. package/dist/init/presentation.js +139 -0
  246. package/dist/init/presentation.js.map +1 -0
  247. package/dist/init/selection-policy.d.ts +29 -0
  248. package/dist/init/selection-policy.d.ts.map +1 -0
  249. package/dist/init/selection-policy.js +59 -0
  250. package/dist/init/selection-policy.js.map +1 -0
  251. package/dist/init/types.d.ts +7 -0
  252. package/dist/init/types.d.ts.map +1 -1
  253. package/dist/init/types.js.map +1 -1
  254. package/dist/init/write-config.d.ts.map +1 -1
  255. package/dist/init/write-config.js +3 -13
  256. package/dist/init/write-config.js.map +1 -1
  257. package/dist/inspection/inspect-repository.d.ts.map +1 -1
  258. package/dist/inspection/inspect-repository.js +4 -3
  259. package/dist/inspection/inspect-repository.js.map +1 -1
  260. package/dist/inspection/snapshot-registry.d.ts.map +1 -1
  261. package/dist/inspection/snapshot-registry.js +24 -2
  262. package/dist/inspection/snapshot-registry.js.map +1 -1
  263. package/dist/reporting/check-label.d.ts +1 -1
  264. package/dist/reporting/check-label.d.ts.map +1 -1
  265. package/dist/reporting/check-label.js +1 -18
  266. package/dist/reporting/check-label.js.map +1 -1
  267. package/dist/reporting/fix-plan-store.d.ts +7 -0
  268. package/dist/reporting/fix-plan-store.d.ts.map +1 -0
  269. package/dist/reporting/fix-plan-store.js +29 -0
  270. package/dist/reporting/fix-plan-store.js.map +1 -0
  271. package/dist/reporting/fix-presentation.d.ts +77 -0
  272. package/dist/reporting/fix-presentation.d.ts.map +1 -0
  273. package/dist/reporting/fix-presentation.js +262 -0
  274. package/dist/reporting/fix-presentation.js.map +1 -0
  275. package/dist/reporting/temporary-report-common.d.ts +27 -0
  276. package/dist/reporting/temporary-report-common.d.ts.map +1 -0
  277. package/dist/reporting/temporary-report-common.js +33 -0
  278. package/dist/reporting/temporary-report-common.js.map +1 -0
  279. package/dist/reporting/temporary-report-filesystem.d.ts +6 -0
  280. package/dist/reporting/temporary-report-filesystem.d.ts.map +1 -0
  281. package/dist/reporting/temporary-report-filesystem.js +124 -0
  282. package/dist/reporting/temporary-report-filesystem.js.map +1 -0
  283. package/dist/reporting/temporary-report-lifecycle.d.ts +19 -0
  284. package/dist/reporting/temporary-report-lifecycle.d.ts.map +1 -0
  285. package/dist/reporting/temporary-report-lifecycle.js +278 -0
  286. package/dist/reporting/temporary-report-lifecycle.js.map +1 -0
  287. package/dist/reporting/temporary-report-lock.d.ts +21 -0
  288. package/dist/reporting/temporary-report-lock.d.ts.map +1 -0
  289. package/dist/reporting/temporary-report-lock.js +106 -0
  290. package/dist/reporting/temporary-report-lock.js.map +1 -0
  291. package/dist/reporting/temporary-reports.d.ts +3 -24
  292. package/dist/reporting/temporary-reports.d.ts.map +1 -1
  293. package/dist/reporting/temporary-reports.js +10 -534
  294. package/dist/reporting/temporary-reports.js.map +1 -1
  295. package/dist/scan/run-scan.d.ts.map +1 -1
  296. package/dist/scan/run-scan.js +4 -12
  297. package/dist/scan/run-scan.js.map +1 -1
  298. package/dist/scan/source-excerpts.d.ts +1 -1
  299. package/dist/scan/source-excerpts.d.ts.map +1 -1
  300. package/dist/scan/source-excerpts.js +25 -27
  301. package/dist/scan/source-excerpts.js.map +1 -1
  302. package/dist/service/client-connection.d.ts +21 -0
  303. package/dist/service/client-connection.d.ts.map +1 -0
  304. package/dist/service/client-connection.js +219 -0
  305. package/dist/service/client-connection.js.map +1 -0
  306. package/dist/service/client-executor.d.ts +10 -0
  307. package/dist/service/client-executor.d.ts.map +1 -0
  308. package/dist/service/client-executor.js +69 -0
  309. package/dist/service/client-executor.js.map +1 -0
  310. package/dist/service/client-ownership.d.ts +16 -0
  311. package/dist/service/client-ownership.d.ts.map +1 -0
  312. package/dist/service/client-ownership.js +104 -0
  313. package/dist/service/client-ownership.js.map +1 -0
  314. package/dist/service/client-startup.d.ts +3 -0
  315. package/dist/service/client-startup.d.ts.map +1 -0
  316. package/dist/service/client-startup.js +123 -0
  317. package/dist/service/client-startup.js.map +1 -0
  318. package/dist/service/client.d.ts +2 -27
  319. package/dist/service/client.d.ts.map +1 -1
  320. package/dist/service/client.js +7 -490
  321. package/dist/service/client.js.map +1 -1
  322. package/dist/service/server-connection.d.ts +43 -0
  323. package/dist/service/server-connection.d.ts.map +1 -0
  324. package/dist/service/server-connection.js +327 -0
  325. package/dist/service/server-connection.js.map +1 -0
  326. package/dist/service/server.d.ts +1 -1
  327. package/dist/service/server.d.ts.map +1 -1
  328. package/dist/service/server.js +77 -343
  329. package/dist/service/server.js.map +1 -1
  330. package/dist/service/state.d.ts.map +1 -1
  331. package/dist/service/state.js +2 -25
  332. package/dist/service/state.js.map +1 -1
  333. package/dist/service/windows-pipe.d.ts +22 -14
  334. package/dist/service/windows-pipe.d.ts.map +1 -1
  335. package/dist/service/windows-pipe.js +384 -350
  336. package/dist/service/windows-pipe.js.map +1 -1
  337. package/dist/telemetry/details-store.js +1 -1
  338. package/dist/telemetry/details-store.js.map +1 -1
  339. package/dist/telemetry/schema.d.ts +5 -5
  340. package/dist/telemetry/state.d.ts +3 -2
  341. package/dist/telemetry/state.d.ts.map +1 -1
  342. package/dist/telemetry/state.js +112 -66
  343. package/dist/telemetry/state.js.map +1 -1
  344. package/dist/ui/init-app.d.ts +6 -14
  345. package/dist/ui/init-app.d.ts.map +1 -1
  346. package/dist/ui/init-app.js +39 -203
  347. package/dist/ui/init-app.js.map +1 -1
  348. package/dist/ui/init-operation.d.ts +19 -0
  349. package/dist/ui/init-operation.d.ts.map +1 -0
  350. package/dist/ui/init-operation.js +54 -0
  351. package/dist/ui/init-operation.js.map +1 -0
  352. package/dist/ui/init-view.d.ts +42 -0
  353. package/dist/ui/init-view.d.ts.map +1 -0
  354. package/dist/ui/init-view.js +199 -0
  355. package/dist/ui/init-view.js.map +1 -0
  356. package/docs/checks.md +24 -0
  357. package/docs/cli-reference.md +3 -1
  358. package/docs/managed-fixes.md +14 -0
  359. package/docs/privacy.md +22 -1
  360. package/package.json +1 -1
  361. 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,431 +31,10 @@ 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
- });
498
- }
499
38
  export async function dispatchChecks(adapters, context, options = {}) {
500
39
  const clock = options.clock ?? performance.now.bind(performance);
501
40
  const emit = (event) => {
@@ -509,31 +48,8 @@ export async function dispatchChecks(adapters, context, options = {}) {
509
48
  // Bounded producers retain only four active adapter inputs. Worker/class
510
49
  // scheduling belongs to the shared executor, including its four-worker mode.
511
50
  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
51
  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
- });
52
+ const collectObservations = createDispatchObservationCollector(adapterContext, options);
537
53
  const scheduled = [];
538
54
  const adapterSnapshots = adapters.map(snapshotAdapter);
539
55
  for (const snapshot of adapterSnapshots) {
@@ -693,158 +209,12 @@ export async function dispatchChecks(adapters, context, options = {}) {
693
209
  target: target.id,
694
210
  timestamp: clock(),
695
211
  });
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
- }
838
- }
839
- emit({
840
- type: "check-completed",
841
- checkId: adapter.id,
842
- target: target.id,
843
- timestamp: clock(),
844
- result: sanitizeCheckResult(displayResult),
845
- });
846
- return executionResult(result, executionPolicy, target, adapterContext.policyForFile, fixCandidates);
847
- }));
212
+ scheduled.push(limit(() => executeDispatchTarget(adapter, adapterContext, target, executionPolicy, applicability.requiresBaseline, {
213
+ clock,
214
+ emit,
215
+ collectObservations,
216
+ collectFixes: options.collectFixes === true,
217
+ })));
848
218
  }
849
219
  }
850
220
  return (await Promise.all(scheduled)).sort(compareResults);