@zxyycom/vibe-check 0.0.2 → 0.0.3

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 (670) hide show
  1. package/README.md +36 -5
  2. package/dist/esm/check/check.mjs +4 -0
  3. package/dist/esm/check/check.mjs.map +1 -1
  4. package/dist/esm/check/flag-enablement.mjs +32 -0
  5. package/dist/esm/check/flag-enablement.mjs.map +1 -0
  6. package/dist/esm/check/handoff-provider-identity.mjs +18 -0
  7. package/dist/esm/check/handoff-provider-identity.mjs.map +1 -0
  8. package/dist/esm/check/inherited-collection.mjs +1 -1
  9. package/dist/esm/check/inherited-collection.mjs.map +1 -1
  10. package/dist/esm/check/project-changes.mjs +2 -0
  11. package/dist/esm/check/project-changes.mjs.map +1 -0
  12. package/dist/esm/check/project-context.mjs +2 -0
  13. package/dist/esm/check/project-context.mjs.map +1 -0
  14. package/dist/esm/check-settlement/facts.mjs.map +1 -1
  15. package/dist/esm/check-settlement/record-store.mjs +1 -1
  16. package/dist/esm/check-settlement/record-store.mjs.map +1 -1
  17. package/dist/esm/data-boundary/canonical-data.mjs +36 -7
  18. package/dist/esm/data-boundary/canonical-data.mjs.map +1 -1
  19. package/dist/esm/data-boundary/canonical-json.mjs.map +1 -1
  20. package/dist/esm/data-boundary/closed-values.mjs +28 -4
  21. package/dist/esm/data-boundary/closed-values.mjs.map +1 -1
  22. package/dist/esm/{package-checks/project-files → data-boundary}/config-glob.mjs +3 -3
  23. package/dist/esm/data-boundary/config-glob.mjs.map +1 -0
  24. package/dist/esm/data-boundary/project-path.mjs +19 -0
  25. package/dist/esm/data-boundary/project-path.mjs.map +1 -0
  26. package/dist/esm/index.mjs +12 -5
  27. package/dist/esm/index.mjs.map +1 -1
  28. package/dist/esm/machine-output/v4/atomic-publication.mjs +4 -1
  29. package/dist/esm/machine-output/v4/atomic-publication.mjs.map +1 -1
  30. package/dist/esm/package-checks/check-authoring.mjs +69 -0
  31. package/dist/esm/package-checks/check-authoring.mjs.map +1 -0
  32. package/dist/esm/package-checks/code-quality-findings/finding-waiver-authoring.mjs.map +1 -1
  33. package/dist/esm/package-checks/code-quality-findings/finding-waiver-evidence.mjs.map +1 -1
  34. package/dist/esm/package-checks/command-check/command-check.mjs +55 -0
  35. package/dist/esm/package-checks/command-check/command-check.mjs.map +1 -0
  36. package/dist/esm/package-checks/command-check/contract.mjs +2 -0
  37. package/dist/esm/package-checks/command-check/contract.mjs.map +1 -0
  38. package/dist/esm/package-checks/command-check/execution.mjs +134 -0
  39. package/dist/esm/package-checks/command-check/execution.mjs.map +1 -0
  40. package/dist/esm/package-checks/command-check/options.mjs +284 -0
  41. package/dist/esm/package-checks/command-check/options.mjs.map +1 -0
  42. package/dist/esm/package-checks/command-check/transcript.mjs +26 -0
  43. package/dist/esm/package-checks/command-check/transcript.mjs.map +1 -0
  44. package/dist/esm/package-checks/duplicate-detection/default-check.mjs +9 -11
  45. package/dist/esm/package-checks/duplicate-detection/default-check.mjs.map +1 -1
  46. package/dist/esm/package-checks/duplicate-detection/execution.mjs +2 -4
  47. package/dist/esm/package-checks/duplicate-detection/execution.mjs.map +1 -1
  48. package/dist/esm/package-checks/duplicate-detection/finding-messages.mjs +1 -1
  49. package/dist/esm/package-checks/duplicate-detection/finding-messages.mjs.map +1 -1
  50. package/dist/esm/package-checks/duplicate-detection/jscpd/availability.mjs +1 -1
  51. package/dist/esm/package-checks/duplicate-detection/jscpd/availability.mjs.map +1 -1
  52. package/dist/esm/package-checks/duplicate-detection/options.mjs.map +1 -1
  53. package/dist/esm/package-checks/duplicate-detection/records.mjs.map +1 -1
  54. package/dist/esm/package-checks/file-metrics/constructor.mjs +9 -11
  55. package/dist/esm/package-checks/file-metrics/constructor.mjs.map +1 -1
  56. package/dist/esm/package-checks/file-metrics/execution.mjs +2 -4
  57. package/dist/esm/package-checks/file-metrics/execution.mjs.map +1 -1
  58. package/dist/esm/package-checks/file-metrics/finding-messages.mjs +1 -1
  59. package/dist/esm/package-checks/file-metrics/finding-messages.mjs.map +1 -1
  60. package/dist/esm/package-checks/file-metrics/options.mjs.map +1 -1
  61. package/dist/esm/package-checks/file-metrics/records.mjs.map +1 -1
  62. package/dist/esm/package-checks/file-metrics/scc/availability.mjs +1 -1
  63. package/dist/esm/package-checks/file-metrics/scc/availability.mjs.map +1 -1
  64. package/dist/esm/package-checks/file-metrics/scc/batch-planner.mjs +38 -0
  65. package/dist/esm/package-checks/file-metrics/scc/batch-planner.mjs.map +1 -0
  66. package/dist/esm/package-checks/file-metrics/scc/logical-scan-resources.mjs +35 -0
  67. package/dist/esm/package-checks/file-metrics/scc/logical-scan-resources.mjs.map +1 -0
  68. package/dist/esm/package-checks/file-metrics/scc/scanner.mjs +102 -29
  69. package/dist/esm/package-checks/file-metrics/scc/scanner.mjs.map +1 -1
  70. package/dist/esm/package-checks/function-metrics/analysis.mjs +7 -2
  71. package/dist/esm/package-checks/function-metrics/analysis.mjs.map +1 -1
  72. package/dist/esm/package-checks/function-metrics/analyzer/analysis-model.mjs +1 -1
  73. package/dist/esm/package-checks/function-metrics/analyzer/analysis-model.mjs.map +1 -1
  74. package/dist/esm/package-checks/function-metrics/analyzer/extensions/lizardcomplextags.mjs +1 -3
  75. package/dist/esm/package-checks/function-metrics/analyzer/extensions/lizardcomplextags.mjs.map +1 -1
  76. package/dist/esm/package-checks/function-metrics/analyzer/extensions/protocol.mjs.map +1 -1
  77. package/dist/esm/package-checks/function-metrics/analyzer/pipeline.mjs +3 -2
  78. package/dist/esm/package-checks/function-metrics/analyzer/pipeline.mjs.map +1 -1
  79. package/dist/esm/package-checks/function-metrics/analyzer/readers/erlang.mjs +6 -6
  80. package/dist/esm/package-checks/function-metrics/analyzer/readers/erlang.mjs.map +1 -1
  81. package/dist/esm/package-checks/function-metrics/analyzer/readers/fortran.mjs +1 -1
  82. package/dist/esm/package-checks/function-metrics/analyzer/readers/fortran.mjs.map +1 -1
  83. package/dist/esm/package-checks/function-metrics/analyzer/readers/objc.mjs +9 -3
  84. package/dist/esm/package-checks/function-metrics/analyzer/readers/objc.mjs.map +1 -1
  85. package/dist/esm/package-checks/function-metrics/analyzer/readers/php-states.mjs +12 -7
  86. package/dist/esm/package-checks/function-metrics/analyzer/readers/php-states.mjs.map +1 -1
  87. package/dist/esm/package-checks/function-metrics/analyzer/readers/plsql.mjs +6 -6
  88. package/dist/esm/package-checks/function-metrics/analyzer/readers/plsql.mjs.map +1 -1
  89. package/dist/esm/package-checks/function-metrics/analyzer/readers/python.mjs +5 -3
  90. package/dist/esm/package-checks/function-metrics/analyzer/readers/python.mjs.map +1 -1
  91. package/dist/esm/package-checks/function-metrics/analyzer/readers/r.mjs +2 -0
  92. package/dist/esm/package-checks/function-metrics/analyzer/readers/r.mjs.map +1 -1
  93. package/dist/esm/package-checks/function-metrics/analyzer/readers/ttcn.mjs +9 -3
  94. package/dist/esm/package-checks/function-metrics/analyzer/readers/ttcn.mjs.map +1 -1
  95. package/dist/esm/package-checks/function-metrics/analyzer/readers/typescript.mjs +9 -3
  96. package/dist/esm/package-checks/function-metrics/analyzer/readers/typescript.mjs.map +1 -1
  97. package/dist/esm/package-checks/function-metrics/analyzer/readers/zig.mjs +3 -1
  98. package/dist/esm/package-checks/function-metrics/analyzer/readers/zig.mjs.map +1 -1
  99. package/dist/esm/package-checks/function-metrics/analyzer/shared/code-reader.mjs +3 -1
  100. package/dist/esm/package-checks/function-metrics/analyzer/shared/code-reader.mjs.map +1 -1
  101. package/dist/esm/package-checks/function-metrics/analyzer/shared/js-style-regex.mjs +12 -5
  102. package/dist/esm/package-checks/function-metrics/analyzer/shared/js-style-regex.mjs.map +1 -1
  103. package/dist/esm/package-checks/function-metrics/analyzer-worker-port.mjs +20 -8
  104. package/dist/esm/package-checks/function-metrics/analyzer-worker-port.mjs.map +1 -1
  105. package/dist/esm/package-checks/function-metrics/constructor.mjs +9 -11
  106. package/dist/esm/package-checks/function-metrics/constructor.mjs.map +1 -1
  107. package/dist/esm/package-checks/function-metrics/execution.mjs +2 -4
  108. package/dist/esm/package-checks/function-metrics/execution.mjs.map +1 -1
  109. package/dist/esm/package-checks/function-metrics/finding-messages.mjs +1 -1
  110. package/dist/esm/package-checks/function-metrics/finding-messages.mjs.map +1 -1
  111. package/dist/esm/package-checks/function-metrics/measurement.mjs +3 -1
  112. package/dist/esm/package-checks/function-metrics/measurement.mjs.map +1 -1
  113. package/dist/esm/package-checks/function-metrics/options.mjs.map +1 -1
  114. package/dist/esm/package-checks/function-metrics/records.mjs.map +1 -1
  115. package/dist/esm/package-checks/host-environment/git.mjs +11 -0
  116. package/dist/esm/package-checks/host-environment/git.mjs.map +1 -1
  117. package/dist/esm/package-checks/host-environment/path.mjs +1 -17
  118. package/dist/esm/package-checks/host-environment/path.mjs.map +1 -1
  119. package/dist/esm/package-checks/host-environment/process/contract.mjs.map +1 -1
  120. package/dist/esm/package-checks/host-environment/process/result.mjs +43 -17
  121. package/dist/esm/package-checks/host-environment/process/result.mjs.map +1 -1
  122. package/dist/esm/package-checks/host-environment/process/runner.mjs +7 -5
  123. package/dist/esm/package-checks/host-environment/process/runner.mjs.map +1 -1
  124. package/dist/esm/package-checks/json-schema-validation/default-check.mjs +9 -11
  125. package/dist/esm/package-checks/json-schema-validation/default-check.mjs.map +1 -1
  126. package/dist/esm/package-checks/json-schema-validation/options.mjs.map +1 -1
  127. package/dist/esm/package-checks/json-schema-validation/reference-resolver.mjs +6 -2
  128. package/dist/esm/package-checks/json-schema-validation/reference-resolver.mjs.map +1 -1
  129. package/dist/esm/package-checks/json-schema-validation/schema-policy.mjs +11 -3
  130. package/dist/esm/package-checks/json-schema-validation/schema-policy.mjs.map +1 -1
  131. package/dist/esm/package-checks/json-validation/default-check.mjs +9 -11
  132. package/dist/esm/package-checks/json-validation/default-check.mjs.map +1 -1
  133. package/dist/esm/package-checks/json-validation/options.mjs.map +1 -1
  134. package/dist/esm/package-checks/local-cache-options.mjs +28 -0
  135. package/dist/esm/package-checks/local-cache-options.mjs.map +1 -0
  136. package/dist/esm/package-checks/maintenance-reminders/maintenance-reminders.mjs +37 -45
  137. package/dist/esm/package-checks/maintenance-reminders/maintenance-reminders.mjs.map +1 -1
  138. package/dist/esm/package-checks/maintenance-reminders/maintenance-support.mjs +3 -1
  139. package/dist/esm/package-checks/maintenance-reminders/maintenance-support.mjs.map +1 -1
  140. package/dist/esm/package-checks/markdown-link-validation/default-check.mjs +19 -33
  141. package/dist/esm/package-checks/markdown-link-validation/default-check.mjs.map +1 -1
  142. package/dist/esm/package-checks/markdown-link-validation/execution.mjs +1 -1
  143. package/dist/esm/package-checks/markdown-link-validation/execution.mjs.map +1 -1
  144. package/dist/esm/package-checks/markdown-link-validation/finding-messages.mjs +1 -1
  145. package/dist/esm/package-checks/markdown-link-validation/finding-messages.mjs.map +1 -1
  146. package/dist/esm/package-checks/markdown-link-validation/markdown-parser.mjs +1 -3
  147. package/dist/esm/package-checks/markdown-link-validation/markdown-parser.mjs.map +1 -1
  148. package/dist/esm/package-checks/markdown-link-validation/options-resolution.mjs +3 -18
  149. package/dist/esm/package-checks/markdown-link-validation/options-resolution.mjs.map +1 -1
  150. package/dist/esm/package-checks/markdown-link-validation/options-validation.mjs +2 -14
  151. package/dist/esm/package-checks/markdown-link-validation/options-validation.mjs.map +1 -1
  152. package/dist/esm/package-checks/markdown-link-validation/options.mjs.map +1 -1
  153. package/dist/esm/package-checks/markdown-link-validation/parse-facts-cache-payload.mjs +4 -5
  154. package/dist/esm/package-checks/markdown-link-validation/parse-facts-cache-payload.mjs.map +1 -1
  155. package/dist/esm/package-checks/markdown-lint/adapter.mjs +125 -0
  156. package/dist/esm/package-checks/markdown-lint/adapter.mjs.map +1 -0
  157. package/dist/esm/package-checks/markdown-lint/default-check.mjs +37 -0
  158. package/dist/esm/package-checks/markdown-lint/default-check.mjs.map +1 -0
  159. package/dist/esm/package-checks/markdown-lint/execution.mjs +202 -0
  160. package/dist/esm/package-checks/markdown-lint/execution.mjs.map +1 -0
  161. package/dist/esm/package-checks/markdown-lint/final-data.mjs +16 -0
  162. package/dist/esm/package-checks/markdown-lint/final-data.mjs.map +1 -0
  163. package/dist/esm/package-checks/markdown-lint/finding-messages.mjs +72 -0
  164. package/dist/esm/package-checks/markdown-lint/finding-messages.mjs.map +1 -0
  165. package/dist/esm/package-checks/markdown-lint/finding-waiver-identity.mjs +41 -0
  166. package/dist/esm/package-checks/markdown-lint/finding-waiver-identity.mjs.map +1 -0
  167. package/dist/esm/package-checks/markdown-lint/findings-cache.mjs +110 -0
  168. package/dist/esm/package-checks/markdown-lint/findings-cache.mjs.map +1 -0
  169. package/dist/esm/package-checks/markdown-lint/options-resolution.mjs +74 -0
  170. package/dist/esm/package-checks/markdown-lint/options-resolution.mjs.map +1 -0
  171. package/dist/esm/package-checks/markdown-lint/options-validation.mjs +41 -0
  172. package/dist/esm/package-checks/markdown-lint/options-validation.mjs.map +1 -0
  173. package/dist/esm/package-checks/markdown-lint/options.mjs +13 -0
  174. package/dist/esm/package-checks/markdown-lint/options.mjs.map +1 -0
  175. package/dist/esm/package-checks/markdown-lint/records.mjs +65 -0
  176. package/dist/esm/package-checks/markdown-lint/records.mjs.map +1 -0
  177. package/dist/esm/package-checks/markdown-lint/unavailable-reasons.mjs +14 -0
  178. package/dist/esm/package-checks/markdown-lint/unavailable-reasons.mjs.map +1 -0
  179. package/dist/esm/package-checks/project-files/collection.mjs +23 -19
  180. package/dist/esm/package-checks/project-files/collection.mjs.map +1 -1
  181. package/dist/esm/package-checks/project-files/configuration.mjs +1 -1
  182. package/dist/esm/package-checks/project-files/configuration.mjs.map +1 -1
  183. package/dist/esm/package-checks/project-files/gitlink-revision.mjs +2 -5
  184. package/dist/esm/package-checks/project-files/gitlink-revision.mjs.map +1 -1
  185. package/dist/esm/package-checks/project-files/gitlink-worktree.mjs +22 -6
  186. package/dist/esm/package-checks/project-files/gitlink-worktree.mjs.map +1 -1
  187. package/dist/esm/package-checks/project-files/public-collection.mjs +1 -1
  188. package/dist/esm/package-checks/project-files/public-collection.mjs.map +1 -1
  189. package/dist/esm/package-checks/project-files/revision-paths.mjs +3 -3
  190. package/dist/esm/package-checks/project-files/revision-paths.mjs.map +1 -1
  191. package/dist/esm/package-checks/project-files/revision-worktree-files.mjs +11 -15
  192. package/dist/esm/package-checks/project-files/revision-worktree-files.mjs.map +1 -1
  193. package/dist/esm/package-checks/secret-detection/default-check.mjs +9 -11
  194. package/dist/esm/package-checks/secret-detection/default-check.mjs.map +1 -1
  195. package/dist/esm/package-checks/secret-detection/execution.mjs +2 -2
  196. package/dist/esm/package-checks/secret-detection/execution.mjs.map +1 -1
  197. package/dist/esm/package-checks/secret-detection/input-preparation.mjs +46 -7
  198. package/dist/esm/package-checks/secret-detection/input-preparation.mjs.map +1 -1
  199. package/dist/esm/package-checks/secret-detection/options.mjs.map +1 -1
  200. package/dist/esm/package-checks/secret-detection/records.mjs.map +1 -1
  201. package/dist/esm/package-checks/secret-detection/secretlint/adapter.mjs +3 -4
  202. package/dist/esm/package-checks/secret-detection/secretlint/adapter.mjs.map +1 -1
  203. package/dist/esm/package-tools/admission-policy/define-admission-policy.mjs +10 -0
  204. package/dist/esm/package-tools/admission-policy/define-admission-policy.mjs.map +1 -0
  205. package/dist/esm/{cache → package-tools/cache}/cache-json-by-key.mjs +13 -14
  206. package/dist/esm/package-tools/cache/cache-json-by-key.mjs.map +1 -0
  207. package/dist/esm/package-tools/finding-presentation/finding-presentation.mjs.map +1 -0
  208. package/dist/esm/{finding-waivers → package-tools/finding-waivers}/reconciliation.mjs +14 -5
  209. package/dist/esm/package-tools/finding-waivers/reconciliation.mjs.map +1 -0
  210. package/dist/esm/package-tools/learned-critical-path/critical-path-ranking.mjs.map +1 -0
  211. package/dist/esm/package-tools/learned-critical-path/duration-model/bounded-history.mjs.map +1 -0
  212. package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/duration-model/prediction.mjs +2 -2
  213. package/dist/esm/package-tools/learned-critical-path/duration-model/prediction.mjs.map +1 -0
  214. package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/duration-model/preparation.mjs +4 -2
  215. package/dist/esm/package-tools/learned-critical-path/duration-model/preparation.mjs.map +1 -0
  216. package/dist/esm/package-tools/learned-critical-path/duration-model/recording.mjs.map +1 -0
  217. package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/duration-model/storage.mjs +8 -8
  218. package/dist/esm/package-tools/learned-critical-path/duration-model/storage.mjs.map +1 -0
  219. package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/selection-layers.mjs +1 -2
  220. package/dist/esm/package-tools/learned-critical-path/selection-layers.mjs.map +1 -0
  221. package/dist/esm/package-tools/learned-critical-path/static-decision.mjs.map +1 -0
  222. package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/strategy.mjs +3 -3
  223. package/dist/esm/package-tools/learned-critical-path/strategy.mjs.map +1 -0
  224. package/dist/esm/project-definition/check-tree/authoring.mjs +8 -5
  225. package/dist/esm/project-definition/check-tree/authoring.mjs.map +1 -1
  226. package/dist/esm/project-definition/check-tree/check-fields-authoring.mjs +79 -66
  227. package/dist/esm/project-definition/check-tree/check-fields-authoring.mjs.map +1 -1
  228. package/dist/esm/project-definition/check-tree/flag-conditions.mjs +71 -0
  229. package/dist/esm/project-definition/check-tree/flag-conditions.mjs.map +1 -0
  230. package/dist/esm/project-definition/check-tree/materialization.mjs +13 -8
  231. package/dist/esm/project-definition/check-tree/materialization.mjs.map +1 -1
  232. package/dist/esm/project-definition/check-tree/resolution.mjs +7 -6
  233. package/dist/esm/project-definition/check-tree/resolution.mjs.map +1 -1
  234. package/dist/esm/project-definition/declarative-snapshot.mjs +2 -1
  235. package/dist/esm/project-definition/declarative-snapshot.mjs.map +1 -1
  236. package/dist/esm/project-definition/project-changes.mjs +70 -0
  237. package/dist/esm/project-definition/project-changes.mjs.map +1 -0
  238. package/dist/esm/project-definition/project-definition-validation.mjs +40 -8
  239. package/dist/esm/project-definition/project-definition-validation.mjs.map +1 -1
  240. package/dist/esm/project-definition/project-definition.mjs +22 -15
  241. package/dist/esm/project-definition/project-definition.mjs.map +1 -1
  242. package/dist/esm/project-definition/scheduler-policy.mjs.map +1 -1
  243. package/dist/esm/project-run/admission-strategy-provider/custom-strategy-preparation.mjs +9 -6
  244. package/dist/esm/project-run/admission-strategy-provider/custom-strategy-preparation.mjs.map +1 -1
  245. package/dist/esm/project-run/admission-strategy-provider/prepared-admission-strategy.mjs.map +1 -1
  246. package/dist/esm/project-run/aggregation.mjs +42 -59
  247. package/dist/esm/project-run/aggregation.mjs.map +1 -1
  248. package/dist/esm/project-run/changes/git.mjs +161 -0
  249. package/dist/esm/project-run/changes/git.mjs.map +1 -0
  250. package/dist/esm/project-run/check-execution/admitted-check-execution.mjs +41 -0
  251. package/dist/esm/project-run/check-execution/admitted-check-execution.mjs.map +1 -0
  252. package/dist/esm/project-run/check-execution/callback.mjs +3 -2
  253. package/dist/esm/project-run/check-execution/callback.mjs.map +1 -1
  254. package/dist/esm/project-run/check-execution/dependencies.mjs +80 -5
  255. package/dist/esm/project-run/check-execution/dependencies.mjs.map +1 -1
  256. package/dist/esm/project-run/check-execution/execution-finalization.mjs +5 -3
  257. package/dist/esm/project-run/check-execution/execution-finalization.mjs.map +1 -1
  258. package/dist/esm/project-run/check-execution/execution-settlement.mjs +37 -16
  259. package/dist/esm/project-run/check-execution/execution-settlement.mjs.map +1 -1
  260. package/dist/esm/project-run/check-execution/flag-controls.mjs +15 -7
  261. package/dist/esm/project-run/check-execution/flag-controls.mjs.map +1 -1
  262. package/dist/esm/project-run/check-execution/lifecycle.mjs.map +1 -1
  263. package/dist/esm/project-run/check-execution/{preflight-result.mjs → preparation-result.mjs} +24 -24
  264. package/dist/esm/project-run/check-execution/preparation-result.mjs.map +1 -0
  265. package/dist/esm/project-run/check-execution/{preflight.mjs → preparation.mjs} +52 -52
  266. package/dist/esm/project-run/check-execution/preparation.mjs.map +1 -0
  267. package/dist/esm/project-run/check-execution/ready-check-execution.mjs +71 -0
  268. package/dist/esm/project-run/check-execution/ready-check-execution.mjs.map +1 -0
  269. package/dist/esm/project-run/check-execution/resolved-checks.mjs +27 -164
  270. package/dist/esm/project-run/check-execution/resolved-checks.mjs.map +1 -1
  271. package/dist/esm/project-run/check-execution/scheduled-check-run.mjs +79 -0
  272. package/dist/esm/project-run/check-execution/scheduled-check-run.mjs.map +1 -0
  273. package/dist/esm/project-run/check-execution/terminal-result.mjs +70 -25
  274. package/dist/esm/project-run/check-execution/terminal-result.mjs.map +1 -1
  275. package/dist/esm/project-run/completion/completion.mjs +18 -1
  276. package/dist/esm/project-run/completion/completion.mjs.map +1 -1
  277. package/dist/esm/project-run/controls/contract.mjs.map +1 -1
  278. package/dist/esm/project-run/controls/validation.mjs +7 -54
  279. package/dist/esm/project-run/controls/validation.mjs.map +1 -1
  280. package/dist/esm/project-run/diagnostic-logging/diagnostic-detail-rendering.mjs +3 -3
  281. package/dist/esm/project-run/diagnostic-logging/diagnostic-detail-rendering.mjs.map +1 -1
  282. package/dist/esm/project-run/diagnostic-logging/observation-rendering.mjs +1 -1
  283. package/dist/esm/project-run/diagnostic-logging/observation-rendering.mjs.map +1 -1
  284. package/dist/esm/project-run/invocation/candidate.mjs +17 -13
  285. package/dist/esm/project-run/invocation/candidate.mjs.map +1 -1
  286. package/dist/esm/project-run/invocation/candidates.mjs +26 -0
  287. package/dist/esm/project-run/invocation/candidates.mjs.map +1 -0
  288. package/dist/esm/project-run/invocation/creation.mjs +7 -3
  289. package/dist/esm/project-run/invocation/creation.mjs.map +1 -1
  290. package/dist/esm/project-run/invocation/execution.mjs +98 -0
  291. package/dist/esm/project-run/invocation/execution.mjs.map +1 -0
  292. package/dist/esm/project-run/invocation/run.mjs +13 -112
  293. package/dist/esm/project-run/invocation/run.mjs.map +1 -1
  294. package/dist/esm/project-run/invocation/scheduler.mjs +13 -6
  295. package/dist/esm/project-run/invocation/scheduler.mjs.map +1 -1
  296. package/dist/esm/project-run/outputs/status.mjs +12 -12
  297. package/dist/esm/project-run/outputs/status.mjs.map +1 -1
  298. package/dist/esm/project-run/progress-rendering/presentation.mjs +31 -11
  299. package/dist/esm/project-run/progress-rendering/presentation.mjs.map +1 -1
  300. package/dist/esm/project-run/progress-rendering/renderer-formatting.mjs +11 -4
  301. package/dist/esm/project-run/progress-rendering/renderer-formatting.mjs.map +1 -1
  302. package/dist/esm/project-run/progress-rendering/renderer-lifecycle.mjs +20 -6
  303. package/dist/esm/project-run/progress-rendering/renderer-lifecycle.mjs.map +1 -1
  304. package/dist/esm/project-run/progress-rendering/renderer.mjs +6 -2
  305. package/dist/esm/project-run/progress-rendering/renderer.mjs.map +1 -1
  306. package/dist/esm/project-run/project-context.mjs +2 -1
  307. package/dist/esm/project-run/project-context.mjs.map +1 -1
  308. package/dist/esm/project-run/result.mjs +2 -2
  309. package/dist/esm/project-run/result.mjs.map +1 -1
  310. package/dist/esm/project-run/run.mjs.map +1 -1
  311. package/dist/esm/project-run/task-scheduler/admission-core/compiled-graph-lookup.mjs +45 -0
  312. package/dist/esm/project-run/task-scheduler/admission-core/compiled-graph-lookup.mjs.map +1 -0
  313. package/dist/esm/project-run/task-scheduler/admission-core/compiled-graph.mjs +9 -4
  314. package/dist/esm/project-run/task-scheduler/admission-core/compiled-graph.mjs.map +1 -1
  315. package/dist/esm/project-run/task-scheduler/admission-core/selection-query.mjs +3 -5
  316. package/dist/esm/project-run/task-scheduler/admission-core/selection-query.mjs.map +1 -1
  317. package/dist/esm/project-run/task-scheduler/admission-core/selection-seed.mjs +25 -8
  318. package/dist/esm/project-run/task-scheduler/admission-core/selection-seed.mjs.map +1 -1
  319. package/dist/esm/project-run/task-scheduler/admission-core/selection-transition.mjs +8 -8
  320. package/dist/esm/project-run/task-scheduler/admission-core/selection-transition.mjs.map +1 -1
  321. package/dist/esm/project-run/task-scheduler/execution-state.mjs.map +1 -1
  322. package/dist/esm/project-run/task-scheduler/measurement/diagnostics.mjs +8 -4
  323. package/dist/esm/project-run/task-scheduler/measurement/diagnostics.mjs.map +1 -1
  324. package/dist/esm/project-run/task-scheduler/measurement/timing.mjs +12 -6
  325. package/dist/esm/project-run/task-scheduler/measurement/timing.mjs.map +1 -1
  326. package/dist/esm/project-run/task-scheduler/scheduler-observation.mjs +3 -1
  327. package/dist/esm/project-run/task-scheduler/scheduler-observation.mjs.map +1 -1
  328. package/dist/esm/project-run/task-scheduler/scheduler-terminal-measurement.mjs +17 -17
  329. package/dist/esm/project-run/task-scheduler/scheduler-terminal-measurement.mjs.map +1 -1
  330. package/dist/esm/project-run/task-scheduler/scheduler.mjs +18 -6
  331. package/dist/esm/project-run/task-scheduler/scheduler.mjs.map +1 -1
  332. package/docs/api-mechanics.md +147 -28
  333. package/docs/changelog.md +145 -2
  334. package/docs/checks/duplicate-detection.md +22 -3
  335. package/docs/checks/file-metrics.md +25 -6
  336. package/docs/checks/function-metrics.md +21 -2
  337. package/docs/checks/json-schema-validation.md +25 -4
  338. package/docs/checks/json-validation.md +24 -5
  339. package/docs/checks/maintenance-reminders.md +30 -6
  340. package/docs/checks/markdown-link-validation.md +24 -4
  341. package/docs/checks/markdown-lint.md +167 -0
  342. package/docs/checks/secret-detection.md +31 -7
  343. package/docs/examples/artifacts/mixed-outcomes/definition.ts +10 -10
  344. package/docs/guides/building-project-gate.md +706 -0
  345. package/docs/guides/callbacks.md +81 -22
  346. package/docs/guides/check-dependencies.md +41 -10
  347. package/docs/guides/collecting-project-files.md +7 -7
  348. package/docs/guides/command-check.md +155 -0
  349. package/docs/guides/data-boundaries.md +140 -0
  350. package/docs/guides/extending-check-lifecycle.md +77 -25
  351. package/docs/guides/finding-waivers.md +43 -1
  352. package/docs/guides/learned-scheduling.md +1 -1
  353. package/docs/guides/run-outputs.md +35 -9
  354. package/docs/guides/scheduling.md +15 -15
  355. package/docs/output.md +6 -5
  356. package/package.json +2 -1
  357. package/src/check/check.ts +332 -92
  358. package/src/check/flag-enablement.ts +76 -0
  359. package/src/check/handoff-provider-identity.ts +34 -0
  360. package/src/check/inherited-collection.ts +1 -1
  361. package/src/check/project-changes.ts +14 -0
  362. package/src/check/project-context.ts +11 -0
  363. package/src/check-settlement/facts.ts +1 -1
  364. package/src/check-settlement/record-store.ts +1 -1
  365. package/src/data-boundary/canonical-data.ts +36 -9
  366. package/src/data-boundary/canonical-json.ts +18 -1
  367. package/src/data-boundary/closed-values.ts +26 -6
  368. package/src/data-boundary/config-glob.ts +17 -0
  369. package/src/data-boundary/project-path.ts +21 -0
  370. package/src/index.ts +72 -11
  371. package/src/machine-output/v4/atomic-publication.ts +3 -1
  372. package/src/package-checks/check-authoring.ts +136 -0
  373. package/src/package-checks/code-quality-findings/finding-waiver-authoring.ts +1 -1
  374. package/src/package-checks/code-quality-findings/finding-waiver-evidence.ts +1 -1
  375. package/src/package-checks/command-check/command-check.ts +152 -0
  376. package/src/package-checks/command-check/contract.ts +168 -0
  377. package/src/package-checks/command-check/execution.ts +211 -0
  378. package/src/package-checks/command-check/options.ts +331 -0
  379. package/src/package-checks/command-check/transcript.ts +35 -0
  380. package/src/package-checks/duplicate-detection/default-check.ts +37 -6
  381. package/src/package-checks/duplicate-detection/execution.ts +2 -4
  382. package/src/package-checks/duplicate-detection/finding-messages.ts +2 -2
  383. package/src/package-checks/duplicate-detection/jscpd/availability.ts +1 -1
  384. package/src/package-checks/duplicate-detection/options.ts +6 -3
  385. package/src/package-checks/duplicate-detection/records.ts +1 -1
  386. package/src/package-checks/file-metrics/constructor.ts +29 -6
  387. package/src/package-checks/file-metrics/execution.ts +2 -4
  388. package/src/package-checks/file-metrics/finding-messages.ts +1 -1
  389. package/src/package-checks/file-metrics/options.ts +6 -3
  390. package/src/package-checks/file-metrics/records.ts +1 -1
  391. package/src/package-checks/file-metrics/scc/availability.ts +1 -1
  392. package/src/package-checks/file-metrics/scc/batch-planner.ts +56 -0
  393. package/src/package-checks/file-metrics/scc/logical-scan-resources.ts +59 -0
  394. package/src/package-checks/file-metrics/scc/scanner.ts +134 -32
  395. package/src/package-checks/function-metrics/analysis.ts +7 -2
  396. package/src/package-checks/function-metrics/analyzer/analysis-model.ts +1 -1
  397. package/src/package-checks/function-metrics/analyzer/extension-output.ts +14 -6
  398. package/src/package-checks/function-metrics/analyzer/extensions/lizardcomplextags.ts +1 -3
  399. package/src/package-checks/function-metrics/analyzer/extensions/protocol.ts +3 -3
  400. package/src/package-checks/function-metrics/analyzer/pipeline.ts +4 -2
  401. package/src/package-checks/function-metrics/analyzer/readers/erlang.ts +6 -6
  402. package/src/package-checks/function-metrics/analyzer/readers/fortran.ts +1 -1
  403. package/src/package-checks/function-metrics/analyzer/readers/objc.ts +9 -3
  404. package/src/package-checks/function-metrics/analyzer/readers/php-states.ts +14 -7
  405. package/src/package-checks/function-metrics/analyzer/readers/plsql.ts +8 -4
  406. package/src/package-checks/function-metrics/analyzer/readers/python.ts +4 -3
  407. package/src/package-checks/function-metrics/analyzer/readers/r.ts +2 -1
  408. package/src/package-checks/function-metrics/analyzer/readers/ttcn.ts +9 -3
  409. package/src/package-checks/function-metrics/analyzer/readers/typescript.ts +9 -3
  410. package/src/package-checks/function-metrics/analyzer/readers/zig.ts +2 -1
  411. package/src/package-checks/function-metrics/analyzer/shared/code-reader.ts +3 -1
  412. package/src/package-checks/function-metrics/analyzer/shared/js-style-regex.ts +10 -5
  413. package/src/package-checks/function-metrics/analyzer-worker-port.ts +20 -6
  414. package/src/package-checks/function-metrics/constructor.ts +30 -7
  415. package/src/package-checks/function-metrics/execution.ts +2 -4
  416. package/src/package-checks/function-metrics/finding-messages.ts +2 -2
  417. package/src/package-checks/function-metrics/measurement.ts +3 -1
  418. package/src/package-checks/function-metrics/options.ts +6 -3
  419. package/src/package-checks/function-metrics/records.ts +1 -1
  420. package/src/package-checks/host-environment/git.ts +11 -0
  421. package/src/package-checks/host-environment/path.ts +1 -20
  422. package/src/package-checks/host-environment/process/contract.ts +17 -9
  423. package/src/package-checks/host-environment/process/result.ts +48 -20
  424. package/src/package-checks/host-environment/process/runner.ts +8 -4
  425. package/src/package-checks/json-schema-validation/default-check.ts +38 -5
  426. package/src/package-checks/json-schema-validation/options.ts +4 -1
  427. package/src/package-checks/json-schema-validation/reference-resolver.ts +6 -2
  428. package/src/package-checks/json-schema-validation/schema-policy.ts +10 -5
  429. package/src/package-checks/json-validation/default-check.ts +27 -6
  430. package/src/package-checks/json-validation/options.ts +4 -1
  431. package/src/package-checks/local-cache-options.ts +40 -0
  432. package/src/package-checks/maintenance-reminders/maintenance-reminders.ts +89 -9
  433. package/src/package-checks/maintenance-reminders/maintenance-support.ts +3 -3
  434. package/src/package-checks/markdown-link-validation/default-check.ts +48 -5
  435. package/src/package-checks/markdown-link-validation/execution.ts +1 -1
  436. package/src/package-checks/markdown-link-validation/finding-messages.ts +1 -1
  437. package/src/package-checks/markdown-link-validation/markdown-parser.ts +1 -5
  438. package/src/package-checks/markdown-link-validation/options-resolution.ts +2 -19
  439. package/src/package-checks/markdown-link-validation/options-validation.ts +2 -17
  440. package/src/package-checks/markdown-link-validation/options.ts +6 -7
  441. package/src/package-checks/markdown-link-validation/parse-facts-cache-payload.ts +4 -5
  442. package/src/package-checks/markdown-lint/adapter.ts +167 -0
  443. package/src/package-checks/markdown-lint/default-check.ts +92 -0
  444. package/src/package-checks/markdown-lint/execution.ts +266 -0
  445. package/src/package-checks/markdown-lint/final-data.ts +33 -0
  446. package/src/package-checks/markdown-lint/finding-messages.ts +87 -0
  447. package/src/package-checks/markdown-lint/finding-waiver-identity.ts +54 -0
  448. package/src/package-checks/markdown-lint/findings-cache.ts +141 -0
  449. package/src/package-checks/markdown-lint/options-resolution.ts +102 -0
  450. package/src/package-checks/markdown-lint/options-validation.ts +50 -0
  451. package/src/package-checks/markdown-lint/options.ts +82 -0
  452. package/src/package-checks/markdown-lint/records.ts +132 -0
  453. package/src/package-checks/markdown-lint/unavailable-reasons.ts +33 -0
  454. package/src/package-checks/project-files/collection.ts +38 -22
  455. package/src/package-checks/project-files/config-glob.ts +1 -17
  456. package/src/package-checks/project-files/configuration.ts +1 -1
  457. package/src/package-checks/project-files/gitlink-revision.ts +4 -6
  458. package/src/package-checks/project-files/gitlink-worktree.ts +35 -7
  459. package/src/package-checks/project-files/public-collection.ts +1 -1
  460. package/src/package-checks/project-files/revision-paths.ts +3 -3
  461. package/src/package-checks/project-files/revision-worktree-files.ts +16 -16
  462. package/src/package-checks/secret-detection/default-check.ts +29 -6
  463. package/src/package-checks/secret-detection/execution.ts +2 -2
  464. package/src/package-checks/secret-detection/input-preparation.ts +64 -7
  465. package/src/package-checks/secret-detection/options.ts +5 -2
  466. package/src/package-checks/secret-detection/records.ts +1 -1
  467. package/src/package-checks/secret-detection/secretlint/adapter.ts +3 -4
  468. package/src/package-tools/admission-policy/define-admission-policy.ts +54 -0
  469. package/src/{cache → package-tools/cache}/cache-json-by-key.ts +13 -17
  470. package/src/{check → package-tools/finding-presentation}/finding-presentation.ts +3 -1
  471. package/src/{finding-waivers → package-tools/finding-waivers}/reconciliation.ts +16 -8
  472. package/src/{learned-critical-path → package-tools/learned-critical-path}/duration-model/prediction.ts +5 -2
  473. package/src/{learned-critical-path → package-tools/learned-critical-path}/duration-model/preparation.ts +5 -3
  474. package/src/{learned-critical-path → package-tools/learned-critical-path}/duration-model/recording.ts +5 -4
  475. package/src/{learned-critical-path → package-tools/learned-critical-path}/duration-model/storage.ts +9 -10
  476. package/src/{learned-critical-path → package-tools/learned-critical-path}/selection-layers.ts +2 -3
  477. package/src/{learned-critical-path → package-tools/learned-critical-path}/static-decision.ts +1 -1
  478. package/src/{learned-critical-path → package-tools/learned-critical-path}/strategy.ts +7 -4
  479. package/src/project-definition/check-tree/authoring.ts +15 -8
  480. package/src/project-definition/check-tree/check-fields-authoring.ts +106 -91
  481. package/src/project-definition/check-tree/flag-conditions.ts +99 -0
  482. package/src/project-definition/check-tree/materialization.ts +12 -8
  483. package/src/project-definition/check-tree/resolution.ts +13 -15
  484. package/src/project-definition/declarative-snapshot.ts +9 -2
  485. package/src/project-definition/project-changes.ts +112 -0
  486. package/src/project-definition/project-definition-validation.ts +58 -10
  487. package/src/project-definition/project-definition.ts +41 -68
  488. package/src/project-definition/scheduler-policy.ts +6 -3
  489. package/src/project-run/admission-strategy-provider/custom-strategy-preparation.ts +11 -8
  490. package/src/project-run/admission-strategy-provider/prepared-admission-strategy.ts +2 -2
  491. package/src/project-run/aggregation.ts +51 -74
  492. package/src/project-run/changes/git.ts +206 -0
  493. package/src/project-run/check-execution/admitted-check-execution.ts +62 -0
  494. package/src/project-run/check-execution/callback.ts +3 -2
  495. package/src/project-run/check-execution/dependencies.ts +120 -6
  496. package/src/project-run/check-execution/execution-finalization.ts +6 -4
  497. package/src/project-run/check-execution/execution-settlement.ts +88 -29
  498. package/src/project-run/check-execution/flag-controls.ts +22 -8
  499. package/src/project-run/check-execution/lifecycle.ts +14 -6
  500. package/src/project-run/check-execution/{preflight-result.ts → preparation-result.ts} +34 -32
  501. package/src/project-run/check-execution/{preflight.ts → preparation.ts} +92 -84
  502. package/src/project-run/check-execution/ready-check-execution.ts +97 -0
  503. package/src/project-run/check-execution/resolved-checks.ts +40 -219
  504. package/src/project-run/check-execution/scheduled-check-run.ts +119 -0
  505. package/src/project-run/check-execution/terminal-result.ts +108 -29
  506. package/src/project-run/completion/completion.ts +17 -3
  507. package/src/project-run/controls/contract.ts +6 -16
  508. package/src/project-run/controls/validation.ts +7 -60
  509. package/src/project-run/diagnostic-logging/diagnostic-detail-rendering.ts +1 -2
  510. package/src/project-run/diagnostic-logging/observation-rendering.ts +1 -1
  511. package/src/project-run/invocation/candidate.ts +28 -15
  512. package/src/project-run/invocation/candidates.ts +56 -0
  513. package/src/project-run/invocation/creation.ts +7 -3
  514. package/src/project-run/invocation/execution.ts +136 -0
  515. package/src/project-run/invocation/run.ts +15 -179
  516. package/src/project-run/invocation/scheduler.ts +13 -6
  517. package/src/project-run/outputs/status.ts +15 -15
  518. package/src/project-run/progress-rendering/presentation.ts +35 -13
  519. package/src/project-run/progress-rendering/renderer-formatting.ts +20 -7
  520. package/src/project-run/progress-rendering/renderer-lifecycle.ts +23 -6
  521. package/src/project-run/progress-rendering/renderer.ts +10 -4
  522. package/src/project-run/project-context.ts +8 -4
  523. package/src/project-run/result.ts +5 -5
  524. package/src/project-run/run.ts +1 -1
  525. package/src/project-run/task-scheduler/admission-core/compiled-graph-lookup.ts +71 -0
  526. package/src/project-run/task-scheduler/admission-core/compiled-graph.ts +9 -4
  527. package/src/project-run/task-scheduler/admission-core/selection-query.ts +6 -4
  528. package/src/project-run/task-scheduler/admission-core/selection-seed.ts +36 -6
  529. package/src/project-run/task-scheduler/admission-core/selection-transition.ts +17 -8
  530. package/src/project-run/task-scheduler/execution-state.ts +4 -4
  531. package/src/project-run/task-scheduler/measurement/diagnostics.ts +10 -4
  532. package/src/project-run/task-scheduler/measurement/timing.ts +13 -5
  533. package/src/project-run/task-scheduler/scheduler-observation.ts +3 -1
  534. package/src/project-run/task-scheduler/scheduler-terminal-measurement.ts +24 -22
  535. package/src/project-run/task-scheduler/scheduler.ts +23 -6
  536. package/types/check/check.d.ts +178 -67
  537. package/types/check/flag-enablement.d.ts +42 -0
  538. package/types/check/handoff-provider-identity.d.ts +12 -0
  539. package/types/check/project-changes.d.ts +13 -0
  540. package/types/check/project-context.d.ts +10 -0
  541. package/types/check-settlement/facts.d.ts +1 -1
  542. package/types/data-boundary/canonical-data.d.ts +28 -5
  543. package/types/data-boundary/canonical-json.d.ts +18 -1
  544. package/types/data-boundary/closed-values.d.ts +17 -1
  545. package/types/data-boundary/config-glob.d.ts +5 -0
  546. package/types/data-boundary/project-path.d.ts +4 -0
  547. package/types/index.d.ts +27 -11
  548. package/types/package-checks/check-authoring.d.ts +45 -0
  549. package/types/package-checks/code-quality-findings/finding-waiver-authoring.d.ts +1 -1
  550. package/types/package-checks/code-quality-findings/finding-waiver-evidence.d.ts +1 -1
  551. package/types/package-checks/command-check/command-check.d.ts +48 -0
  552. package/types/package-checks/command-check/contract.d.ts +108 -0
  553. package/types/package-checks/command-check/execution.d.ts +7 -0
  554. package/types/package-checks/command-check/options.d.ts +11 -0
  555. package/types/package-checks/command-check/transcript.d.ts +8 -0
  556. package/types/package-checks/duplicate-detection/default-check.d.ts +5 -2
  557. package/types/package-checks/duplicate-detection/finding-messages.d.ts +1 -1
  558. package/types/package-checks/duplicate-detection/options.d.ts +4 -3
  559. package/types/package-checks/duplicate-detection/records.d.ts +1 -1
  560. package/types/package-checks/file-metrics/constructor.d.ts +5 -2
  561. package/types/package-checks/file-metrics/options.d.ts +4 -3
  562. package/types/package-checks/file-metrics/records.d.ts +1 -1
  563. package/types/package-checks/file-metrics/scc/batch-planner.d.ts +18 -0
  564. package/types/package-checks/file-metrics/scc/logical-scan-resources.d.ts +14 -0
  565. package/types/package-checks/function-metrics/analyzer/extensions/protocol.d.ts +3 -3
  566. package/types/package-checks/function-metrics/constructor.d.ts +5 -2
  567. package/types/package-checks/function-metrics/finding-messages.d.ts +1 -1
  568. package/types/package-checks/function-metrics/options.d.ts +4 -3
  569. package/types/package-checks/function-metrics/records.d.ts +1 -1
  570. package/types/package-checks/host-environment/git.d.ts +2 -0
  571. package/types/package-checks/host-environment/path.d.ts +1 -3
  572. package/types/package-checks/host-environment/process/contract.d.ts +17 -9
  573. package/types/package-checks/json-schema-validation/default-check.d.ts +4 -1
  574. package/types/package-checks/json-schema-validation/options.d.ts +2 -1
  575. package/types/package-checks/json-validation/default-check.d.ts +4 -1
  576. package/types/package-checks/json-validation/options.d.ts +2 -1
  577. package/types/package-checks/local-cache-options.d.ts +9 -0
  578. package/types/package-checks/maintenance-reminders/maintenance-reminders.d.ts +11 -2
  579. package/types/package-checks/markdown-link-validation/default-check.d.ts +4 -1
  580. package/types/package-checks/markdown-link-validation/options.d.ts +4 -7
  581. package/types/package-checks/markdown-lint/adapter.d.ts +10 -0
  582. package/types/package-checks/markdown-lint/default-check.d.ts +37 -0
  583. package/types/package-checks/markdown-lint/execution.d.ts +24 -0
  584. package/types/package-checks/markdown-lint/final-data.d.ts +8 -0
  585. package/types/package-checks/markdown-lint/finding-messages.d.ts +6 -0
  586. package/types/package-checks/markdown-lint/finding-waiver-identity.d.ts +3 -0
  587. package/types/package-checks/markdown-lint/findings-cache.d.ts +17 -0
  588. package/types/package-checks/markdown-lint/options-resolution.d.ts +3 -0
  589. package/types/package-checks/markdown-lint/options-validation.d.ts +2 -0
  590. package/types/package-checks/markdown-lint/options.d.ts +65 -0
  591. package/types/package-checks/markdown-lint/records.d.ts +39 -0
  592. package/types/package-checks/markdown-lint/unavailable-reasons.d.ts +3 -0
  593. package/types/package-checks/secret-detection/default-check.d.ts +4 -1
  594. package/types/package-checks/secret-detection/options.d.ts +3 -2
  595. package/types/package-tools/admission-policy/define-admission-policy.d.ts +26 -0
  596. package/types/{check → package-tools/finding-presentation}/finding-presentation.d.ts +3 -1
  597. package/types/{finding-waivers → package-tools/finding-waivers}/reconciliation.d.ts +3 -3
  598. package/types/{learned-critical-path → package-tools/learned-critical-path}/duration-model/prediction.d.ts +2 -2
  599. package/types/{learned-critical-path → package-tools/learned-critical-path}/duration-model/preparation.d.ts +1 -1
  600. package/types/{learned-critical-path → package-tools/learned-critical-path}/duration-model/recording.d.ts +1 -1
  601. package/types/{learned-critical-path → package-tools/learned-critical-path}/selection-layers.d.ts +1 -1
  602. package/types/{learned-critical-path → package-tools/learned-critical-path}/static-decision.d.ts +1 -1
  603. package/types/{learned-critical-path → package-tools/learned-critical-path}/strategy.d.ts +1 -1
  604. package/types/project-definition/check-tree/authoring.d.ts +5 -3
  605. package/types/project-definition/check-tree/check-fields-authoring.d.ts +12 -7
  606. package/types/project-definition/check-tree/flag-conditions.d.ts +5 -0
  607. package/types/project-definition/check-tree/resolution.d.ts +6 -4
  608. package/types/project-definition/declarative-snapshot.d.ts +4 -1
  609. package/types/project-definition/project-changes.d.ts +30 -0
  610. package/types/project-definition/project-definition.d.ts +15 -30
  611. package/types/project-definition/scheduler-policy.d.ts +3 -3
  612. package/types/project-run/admission-strategy-provider/prepared-admission-strategy.d.ts +2 -2
  613. package/types/project-run/aggregation.d.ts +8 -6
  614. package/types/project-run/changes/git.d.ts +14 -0
  615. package/types/project-run/check-execution/admitted-check-execution.d.ts +18 -0
  616. package/types/project-run/check-execution/dependencies.d.ts +3 -0
  617. package/types/project-run/check-execution/execution-finalization.d.ts +1 -1
  618. package/types/project-run/check-execution/execution-settlement.d.ts +15 -7
  619. package/types/project-run/check-execution/flag-controls.d.ts +1 -1
  620. package/types/project-run/check-execution/lifecycle.d.ts +9 -5
  621. package/types/project-run/check-execution/{preflight-result.d.ts → preparation-result.d.ts} +3 -3
  622. package/types/project-run/check-execution/{preflight.d.ts → preparation.d.ts} +10 -9
  623. package/types/project-run/check-execution/ready-check-execution.d.ts +18 -0
  624. package/types/project-run/check-execution/resolved-checks.d.ts +12 -13
  625. package/types/project-run/check-execution/scheduled-check-run.d.ts +10 -0
  626. package/types/project-run/check-execution/terminal-result.d.ts +13 -1
  627. package/types/project-run/completion/completion.d.ts +3 -1
  628. package/types/project-run/controls/contract.d.ts +6 -16
  629. package/types/project-run/invocation/candidates.d.ts +8 -0
  630. package/types/project-run/invocation/execution.d.ts +5 -0
  631. package/types/project-run/invocation/run.d.ts +2 -2
  632. package/types/project-run/outputs/status.d.ts +4 -4
  633. package/types/project-run/progress-rendering/presentation.d.ts +4 -3
  634. package/types/project-run/progress-rendering/renderer-formatting.d.ts +5 -2
  635. package/types/project-run/progress-rendering/renderer-lifecycle.d.ts +2 -0
  636. package/types/project-run/progress-rendering/renderer.d.ts +4 -2
  637. package/types/project-run/project-context.d.ts +3 -3
  638. package/types/project-run/result.d.ts +3 -3
  639. package/types/project-run/run.d.ts +1 -1
  640. package/types/project-run/task-scheduler/admission-core/compiled-graph-lookup.d.ts +10 -0
  641. package/types/project-run/task-scheduler/execution-state.d.ts +4 -4
  642. package/types/project-run/task-scheduler/measurement/diagnostics.d.ts +2 -2
  643. package/types/project-run/task-scheduler/scheduler-terminal-measurement.d.ts +1 -1
  644. package/dist/esm/cache/cache-json-by-key.mjs.map +0 -1
  645. package/dist/esm/check/finding-presentation.mjs.map +0 -1
  646. package/dist/esm/finding-waivers/reconciliation.mjs.map +0 -1
  647. package/dist/esm/learned-critical-path/duration-model/bounded-history.mjs.map +0 -1
  648. package/dist/esm/learned-critical-path/duration-model/prediction.mjs.map +0 -1
  649. package/dist/esm/learned-critical-path/duration-model/preparation.mjs.map +0 -1
  650. package/dist/esm/learned-critical-path/duration-model/recording.mjs.map +0 -1
  651. package/dist/esm/learned-critical-path/duration-model/storage.mjs.map +0 -1
  652. package/dist/esm/learned-critical-path/selection-layers.mjs.map +0 -1
  653. package/dist/esm/learned-critical-path/static-decision.mjs.map +0 -1
  654. package/dist/esm/learned-critical-path/strategy.mjs.map +0 -1
  655. package/dist/esm/package-checks/project-files/config-glob.mjs.map +0 -1
  656. package/dist/esm/project-run/check-execution/preflight-result.mjs.map +0 -1
  657. package/dist/esm/project-run/check-execution/preflight.mjs.map +0 -1
  658. package/dist/esm/project-run/task-scheduler/critical-path-ranking.mjs.map +0 -1
  659. package/types/package-checks/project-files/config-glob.d.ts +0 -5
  660. /package/dist/esm/{check → package-tools/finding-presentation}/finding-presentation.mjs +0 -0
  661. /package/dist/esm/{project-run/task-scheduler → package-tools/learned-critical-path}/critical-path-ranking.mjs +0 -0
  662. /package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/duration-model/bounded-history.mjs +0 -0
  663. /package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/duration-model/recording.mjs +0 -0
  664. /package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/static-decision.mjs +0 -0
  665. /package/src/{project-run/task-scheduler → package-tools/learned-critical-path}/critical-path-ranking.ts +0 -0
  666. /package/src/{learned-critical-path → package-tools/learned-critical-path}/duration-model/bounded-history.ts +0 -0
  667. /package/types/{cache → package-tools/cache}/cache-json-by-key.d.ts +0 -0
  668. /package/types/{project-run/task-scheduler → package-tools/learned-critical-path}/critical-path-ranking.d.ts +0 -0
  669. /package/types/{learned-critical-path → package-tools/learned-critical-path}/duration-model/bounded-history.d.ts +0 -0
  670. /package/types/{learned-critical-path → package-tools/learned-critical-path}/duration-model/storage.d.ts +0 -0
@@ -0,0 +1,706 @@
1
+ # 从项目质量目标构建 Gate
2
+
3
+ 你可能已经有 lint、测试、配置校验等脚本。把它们组合成 Gate,关键不只是“一起运行”,而是回答三个问题:
4
+
5
+ 1. 每项检查分别证明什么?
6
+ 2. 哪些工作需要共享、等待或限制并发?
7
+ 3. 最后什么结果允许继续,什么结果需要停止?
8
+
9
+ 本文先跑通最小路径,再按实际问题展开九种场景。从最接近当前目标的一节开始,按需组合其中的做法。
10
+
11
+ ## 先跑通:定义检查、运行、判断结果
12
+
13
+ 安装与运行环境见 [README](../../README.md#安装)。以下是一个完整的 `quality.ts`,使用固定测量值,方便先观察通过和失败;实际项目中再替换成真实测量。
14
+
15
+ ```ts
16
+ import { defineCheck, defineConfig, run } from "@zxyycom/vibe-check";
17
+
18
+ const bundleSize = defineCheck({
19
+ checkId: "bundle-size",
20
+ displayName: "Bundle size",
21
+ execute() {
22
+ const actualBytes = 82_000;
23
+ const maximumBytes = 100_000;
24
+ const data = { actualBytes, maximumBytes };
25
+ return actualBytes <= maximumBytes ? { status: "passed", data } : { status: "failed", data };
26
+ }
27
+ });
28
+
29
+ const definition = defineConfig({
30
+ checks: [bundleSize],
31
+ outputs: { machinePublication: { enabled: false } }
32
+ });
33
+
34
+ const result = await run(definition);
35
+ process.exitCode = result.kind === "completed" && result.aggregate === "passed" ? 0 : 1;
36
+ ```
37
+
38
+ 在你安装 package 的项目中执行 `node quality.ts`。把 `actualBytes` 改成 `120_000`,Check 会失败,脚本退出非零。
39
+
40
+ 这里有三层责任:
41
+
42
+ - Check 返回它自己的质量结论。
43
+ - `run` 执行整张图,并对本次有效 Checks 形成 `aggregate`。
44
+ - 项目脚本决定退出码。本例只接受正常完成且 aggregate 通过,其余情况统一退出 `1`。
45
+
46
+ `completed` 表示 Run 完整结算,不表示质量通过。默认聚合只在有效列表非空、且每项都 `passed` 时通过;未被 flags 选中的项不进入有效列表,已选中却返回 `not-applicable` 的项会使默认聚合失败。
47
+
48
+ **提醒还是阻断,在检查自己的规则中决定。** 自定义 Check 通过返回的 status 表达结论,warning message 本身不让检查失败。支持 `findingPolicy` 的随包 Check 可用 `"non-blocking"` 保留普通 Finding 而通过,用 `"blocking"` 让未豁免 Finding 阻断;工具不可用仍是 `unavailable`,不会因此放行。日常使用保留默认聚合即可;确需其它总体判断时再读 [aggregation](../api-mechanics.md#runcontrols-与-check-aggregation)。
49
+
50
+ **先确定独立结果,再拆 Check。** “编译、打包、读取包大小”如果只服务于一个验收结论,可以留在同一 execution;若产物结构和包大小需要分别判断,再考虑共享准备并拆出两个消费者。
51
+
52
+ ## 按你遇到的问题阅读
53
+
54
+ | 你现在遇到的情况 | 场景 |
55
+ | --- | --- |
56
+ | 已有脚本,想接进 Gate | [1.接入已有检查](#1接入已有检查) |
57
+ | 多项检查重复做同一份准备 | [2.准备一次分别验收](#2准备一次分别验收) |
58
+ | 上游失败后,有的任务要停,有的还要解释失败 | [3.成功依赖与终态观察](#3成功依赖与终态观察) |
59
+ | 本地与 CI 要运行不同集合 | [4.按任务选择检查](#4按任务选择检查) |
60
+ | 小改动总是启动所有材料检查 | [5.按真实输入增量选择](#5按真实输入增量选择) |
61
+ | 测试分组了,但仍然全选或漏选 | [6.找出测试真正读取的输入](#6找出测试真正读取的输入) |
62
+ | 需要完整检查,但重复计算昂贵 | [7.复用计算而非通过结论](#7复用计算而非通过结论) |
63
+ | 并发检查争抢资源 | [8.表达并发约束](#8表达并发约束) |
64
+ | 失败只有文本,或已有结构不适合直接发布 | [9.把工具输出转换为结构化诊断](#9把工具输出转换为结构化诊断) |
65
+
66
+ ### 运行本页示例
67
+
68
+ 每个 TypeScript 片段独立定义一份 `definition`。任选一个片段,按以下步骤运行:
69
+
70
+ 1. 在已安装 package 的项目中,将片段保存为 `quality.ts`,并准备该节列出的文件或工具。
71
+ 2. 片段若只定义 `definition`,按[最小入口](#先跑通定义检查运行判断结果)补齐 `run` 导入,并在 `definition` 之后添加调用与退出码判断。场景 4、5 已包含带 flags 的完整入口,直接使用各自的 `runGate`。
72
+ 3. 执行 `node quality.ts`,核对该节的 Check 结果、`aggregate` 和进程退出码。
73
+
74
+ ## 1.接入已有检查
75
+
76
+ **情况:** 项目已经有 `tools/check-config.mjs`,成功退出 `0`,发现错误退出非零。
77
+
78
+ 先保留脚本拥有的检查逻辑,用 `commandCheck` 接管进程生命周期。以下片段的调用步骤见[运行本页示例](#运行本页示例):
79
+
80
+ ```ts
81
+ import { commandCheck, defineConfig } from "@zxyycom/vibe-check";
82
+
83
+ const configCheck = commandCheck({
84
+ checkId: "config",
85
+ displayName: "Configuration",
86
+ executable: process.execPath, // 复用启动 quality.ts 的运行时;本文使用 Node。
87
+ arguments: ["tools/check-config.mjs"],
88
+ environment: { mode: "exact" },
89
+ timeoutMs: 30_000,
90
+ outputByteLimit: 1024 * 1024
91
+ });
92
+
93
+ const definition = defineConfig({
94
+ checks: [configCheck],
95
+ outputs: { machinePublication: { enabled: false } }
96
+ });
97
+ ```
98
+
99
+ 这里的脚本路径和两个限额是项目选择,运行前需要有对应脚本。普通非零退出形成 `failed`;无法启动、超时等无法获得可信结果的情况形成 `unavailable`。Product 负责取消、受限输出捕获和结算。
100
+
101
+ `executable` 是要启动的程序,`arguments` 才是传给它的参数。按上文执行 `node quality.ts` 时,`process.execPath` 是当前 Node 的绝对路径,所以子进程相当于执行 `node tools/check-config.mjs`,并不是直接执行 `.mjs` 文件。使用绝对路径也无需从 child 的 `PATH` 寻找 Node。
102
+
103
+ 若入口改用 Bun,这里复用的也会是 Bun;需要固定使用 Node 的脚本,应由项目提供 Node 的绝对路径作为 `executable`。`commandCheck` 不安装或自动选择运行时。
104
+
105
+ 选择哪种接法,取决于你已有的入口:
106
+
107
+ | 已有能力 | 接入方式 |
108
+ | --- | --- |
109
+ | 工具退出码已能表达结果 | 使用上面的 `commandCheck`。 |
110
+ | 有可 import、不会自动启动 CLI 的校验函数 | 在自定义 Check 的 `execute` 中调用,保留领域结果;可取消工作继续传递 `signal`。 |
111
+ | 完整命令输出还需要解析成领域事实 | 使用 `afterCommand`,由项目验证工具协议;见场景 9。 |
112
+
113
+ 命令通过 executable 和独立 arguments 表示。默认不继承父进程环境;需要环境变量时显式提供必要值,确需继承时再选 `inherit`。使用独立脚本承接多步骤 workflow,通常比把 shell pipeline 塞进一个参数更清楚。
114
+
115
+ **试一下:** 让脚本分别退出 `0`、退出 `1`、超过 timeout,确认三种结果被区分。先保持原检查覆盖和结果含义,再决定是否拆分。
116
+
117
+ 完整契约:[执行外部命令](./command-check.md)、[自定义 Check](./extending-check-lifecycle.md)。
118
+
119
+ ## 2.准备一次,分别验收
120
+
121
+ **情况:** 产物清单需要一次构建才能取得,包大小和文件数量检查都要用它。你希望构建一次,但保留两项验收结果。
122
+
123
+ 把昂贵准备放在 provider,把独立判断留在 consumer。下面用固定清单摘要代替真实构建,按[公共运行约定](#运行本页示例)观察数据与责任关系:
124
+
125
+ ```ts
126
+ import { defineCheck, defineConfig } from "@zxyycom/vibe-check";
127
+
128
+ const manifest = defineCheck({
129
+ checkId: "artifact-manifest",
130
+ displayName: "Artifact manifest",
131
+ omitQuietPassedRow: true,
132
+ parseData(data) {
133
+ if (
134
+ data.version !== 1 ||
135
+ typeof data.totalBytes !== "number" ||
136
+ !Number.isSafeInteger(data.totalBytes) ||
137
+ data.totalBytes < 0 ||
138
+ typeof data.fileCount !== "number" ||
139
+ !Number.isSafeInteger(data.fileCount) ||
140
+ data.fileCount < 0
141
+ )
142
+ throw new TypeError("Invalid artifact manifest");
143
+ return { version: 1, totalBytes: data.totalBytes, fileCount: data.fileCount };
144
+ },
145
+ execute: () => ({
146
+ status: "passed",
147
+ data: { version: 1, totalBytes: 82_000, fileCount: 3 }
148
+ })
149
+ });
150
+
151
+ const size = defineCheck({
152
+ checkId: "artifact-size",
153
+ displayName: "Artifact size",
154
+ dependsOn: [manifest.checkId],
155
+ execute({ dependencies }) {
156
+ const read = dependencies.get(manifest.checkId);
157
+ if (!read.ok) return { status: "unavailable", reason: { code: read.error.code } };
158
+ const data = manifest.parseData(read.data);
159
+ return data.totalBytes <= 100_000 ? { status: "passed", data } : { status: "failed", data };
160
+ }
161
+ });
162
+
163
+ const contents = defineCheck({
164
+ checkId: "artifact-contents",
165
+ displayName: "Artifact contents",
166
+ dependsOn: [manifest.checkId],
167
+ execute({ dependencies }) {
168
+ const read = dependencies.get(manifest.checkId);
169
+ if (!read.ok) return { status: "unavailable", reason: { code: read.error.code } };
170
+ const data = manifest.parseData(read.data);
171
+ return data.fileCount > 0 ? { status: "passed", data } : { status: "failed", data };
172
+ }
173
+ });
174
+
175
+ const definition = defineConfig({
176
+ checks: [manifest, size, contents],
177
+ outputs: { machinePublication: { enabled: false } }
178
+ });
179
+ ```
180
+
181
+ 两条消费者关系都直接指向 provider。parser 恢复领域类型并验证数据;依赖声明提供读取授权,两者职责不同。
182
+
183
+ **预期结果:** provider 成功后,两项消费者各自运行。把 `totalBytes` 改成 `120_000`,大小检查失败,但文件数量检查仍可通过;它们不共享判决。provider 失败则阻断两项消费者。
184
+
185
+ 本例的 provider 只准备材料,安静通过后无需占一行结果,因此设置 `omitQuietPassedRow: true`。只有 `passed` 且没有 Records/messages 时才省略完成行;有 data 不影响省略,失败或带诊断时仍显示。它仍参与依赖、聚合和完整结果,TTY 中的运行状态也仍可见。需要保留成功行时,省略此字段即可。见[省略安静通过行](./extending-check-lifecycle.md#省略安静通过行)。
186
+
187
+ 真实 provider 若创建临时目录,应由资源 owner 在最后一个消费者结束后清理;例如用 Run 外层的 `try/finally` 管理生命周期。破坏性或失败注入测试使用独立材料,避免污染共享只读输入。
188
+
189
+ 只有确需同 Run 的非 JSON 引用时才另选 handoff;普通清单、路径和摘要用 canonical data 即可。见[依赖与类型化数据](./check-dependencies.md)。
190
+
191
+ ## 3.成功依赖与终态观察
192
+
193
+ **情况:** 配置校验失败后,业务检查应停止,但汇总检查仍要报告发生了什么。
194
+
195
+ 按[公共运行约定](#运行本页示例)执行下面的组合,比较 `dependsOn` 与 `observes` 对上游失败的处理:
196
+
197
+ ```ts
198
+ import { defineCheck, defineConfig } from "@zxyycom/vibe-check";
199
+
200
+ const config = defineCheck({
201
+ checkId: "config",
202
+ displayName: "Configuration",
203
+ execute: () => ({ status: "failed", data: { valid: false } })
204
+ });
205
+
206
+ const consumer = defineCheck({
207
+ checkId: "use-config",
208
+ displayName: "Use configuration",
209
+ dependsOn: [config.checkId],
210
+ execute: () => ({ status: "passed", data: { consumed: true } })
211
+ });
212
+
213
+ const audit = defineCheck({
214
+ checkId: "audit-config",
215
+ displayName: "Audit configuration",
216
+ observes: [config.checkId],
217
+ execute({ dependencies }) {
218
+ const outcomes = dependencies.list().map(({ checkId, outcome }) => ({
219
+ checkId,
220
+ status: outcome.status
221
+ }));
222
+ return { status: "passed", data: { outcomes } };
223
+ }
224
+ });
225
+
226
+ const definition = defineConfig({
227
+ checks: [config, consumer, audit],
228
+ outputs: { machinePublication: { enabled: false } }
229
+ });
230
+ ```
231
+
232
+ | Check | 预期行为 |
233
+ | --- | --- |
234
+ | `config` | 固定失败,模拟无效配置。 |
235
+ | `use-config` | 不进入 execute,结算为 `unavailable / dependency-not-passed`。 |
236
+ | `audit-config` | 等 config 终态后执行,记录它失败;自身完成审计而通过。 |
237
+
238
+ 审计通过不会把配置失败变成通过,默认 aggregate 仍失败。
239
+
240
+ 两种关系都只授权直接读取。`observes` 可以观察无 data 的终态,因此这里只读取 status;需要 data 时再收窄状态。加入 flags 后,还要确保观察者与被观察者的选择符合你的任务,`observes` 本身不会传播选择。
241
+
242
+ ## 4.按任务选择检查
243
+
244
+ **情况:** 本地快速检查只跑配置;CI 同时检查配置和文档;开发者还可以单独查文档。
245
+
246
+ preset 是项目入口的命名,Product 只接收普通 flags:
247
+
248
+ ```ts
249
+ import { any, defineConfig, jsonValidation, markdownLint, run } from "@zxyycom/vibe-check";
250
+
251
+ const definition = defineConfig({
252
+ checks: [
253
+ jsonValidation({
254
+ checkId: "config",
255
+ files: { include: ["config/**/*.json"] },
256
+ enabledByFlags: { when: any("local", "ci", "config") }
257
+ }),
258
+ markdownLint({
259
+ checkId: "docs",
260
+ files: { include: ["handbook/**/*.md"] },
261
+ findingPolicy: "blocking",
262
+ enabledByFlags: { when: any("ci", "docs") }
263
+ })
264
+ ],
265
+ outputs: { machinePublication: { enabled: false } }
266
+ });
267
+
268
+ async function runGate() {
269
+ const result = await run(definition, { flags: ["local"] });
270
+ process.exitCode = result.kind === "completed" && result.aggregate === "passed" ? 0 : 1;
271
+ return result;
272
+ }
273
+
274
+ if (import.meta.main) await runGate();
275
+ ```
276
+
277
+ 这里的 `import.meta.main` 让脚本在直接执行 `node quality.ts` 时调用 `runGate`,被其它模块 import 时不自动启动。项目中需有对应的配置与文档文件。换成 `["ci"]` 会选择两项,`["docs"]` 只选择文档。未选项仍保留 `not-applicable` facts,但不参加本次有效列表的默认聚合。
278
+
279
+ 若只选择一个下游 Check,却希望同时启动它的前置项,在下游的 `enabledByFlags` 加 `propagateDependsOn: true`。它补齐传递 `dependsOn`,不是把所有相邻节点都选中,也不保证前置项通过。
280
+
281
+ argv、help 和未知 preset 的拒绝由项目入口处理。用户输入先验证再映射,避免拼错任务名后静默得到空检查集合。精确规则见[按 flag 选择 Check](./extending-check-lifecycle.md#按-flag-选择-check)。
282
+
283
+ ## 5.按真实输入增量选择
284
+
285
+ **情况:** 日常反馈中,配置 JSON 改动需要语法检查;schema 或实例改动需要 schema 检查;文档链接还可能被其它文件的删除影响。
286
+
287
+ 增量选择分两步:Definition 声明哪些输入变化会生成 flag,Check 声明在什么任务下使用它。
288
+
289
+ ```ts
290
+ import {
291
+ all,
292
+ any,
293
+ changeFlag,
294
+ defineConfig,
295
+ run,
296
+ jsonValidation,
297
+ jsonSchemaValidation,
298
+ markdownLinkValidation
299
+ } from "@zxyycom/vibe-check";
300
+
301
+ const shared = ["quality.ts", "package.json", "pnpm-lock.yaml"];
302
+ const definition = defineConfig({
303
+ changes: {
304
+ source: { compareWith: "HEAD" },
305
+ flags: {
306
+ config: { include: [...shared, "config/**/*.json"] },
307
+ schema: {
308
+ include: [...shared, "config/**/*.json", "schema/**/*.json"],
309
+ exclude: ["config/scratch/**"]
310
+ }
311
+ }
312
+ },
313
+ checks: [
314
+ jsonValidation({
315
+ files: { include: ["config/**/*.json"] },
316
+ enabledByFlags: { when: any(all("daily", changeFlag("config")), "force") }
317
+ }),
318
+ jsonSchemaValidation({
319
+ files: {
320
+ include: ["config/**/*.json", "schema/**/*.json"],
321
+ exclude: ["config/scratch/**"]
322
+ },
323
+ schemas: [{ id: "urn:example:config", path: "schema/config.json" }],
324
+ bindings: [
325
+ {
326
+ id: "app",
327
+ instancePath: "config/app.json",
328
+ schemaId: "urn:example:config"
329
+ }
330
+ ],
331
+ enabledByFlags: { when: any(all("daily", changeFlag("schema")), "force") }
332
+ }),
333
+ markdownLinkValidation({
334
+ files: { include: ["handbook/**/*.md"] },
335
+ findingPolicy: "blocking",
336
+ enabledByFlags: { when: any("daily", "force") }
337
+ })
338
+ ],
339
+ outputs: { machinePublication: { enabled: false } }
340
+ });
341
+
342
+ async function runGate() {
343
+ const result = await run(definition, { flags: ["daily"] });
344
+ process.exitCode = result.kind === "completed" && result.aggregate === "passed" ? 0 : 1;
345
+ return result;
346
+ }
347
+
348
+ if (import.meta.main) await runGate();
349
+ ```
350
+
351
+ 上例的日常调用需要 `daily`,改用 `["force"]` 可强制选择三项。schema 文件中的根 `$id` 应为 `urn:example:config`,实例是 `config/app.json`;这是本例显式声明的材料结构。
352
+
353
+ `changes.flags.*` 的 region 要求提供 `include`,`exclude` 可省略,默认等同于 `[]`。上面的 config region 没有排除项,所以不写;schema region 则给出具体排除。随包 Check 的 `files.exclude` 同样可省略,实际文件选择仍需与 change region 的输入范围保持一致。
354
+
355
+ 本例约定 `config/scratch/**` 是不被正式实例或 schema 引用的草稿,只检查 JSON 语法,不参与 schema 验收。因此 schema 的变化 region 与实际文件选择都排除它;如果草稿后来成为正式输入,两处都需调整。
356
+
357
+ | 改动 | daily 下选择 |
358
+ | --- | --- |
359
+ | `config/app.json` | JSON、Schema、链接。 |
360
+ | `schema/config.json` | Schema、链接。 |
361
+ | `config/scratch/local.json` | JSON、链接;不选择 Schema。 |
362
+ | 仅删除一张被文档引用的图片 | 链接;即使 Markdown 本身没改。 |
363
+ | `quality.ts` 或 lockfile | 三项全部。 |
364
+
365
+ 这里 `HEAD` 适合查看尚未提交的工作区改动;刚提交的内容需要选择更早的比较基准。整条 PR 应使用项目明确取得的 PR 基准,而不是照抄本地策略。
366
+
367
+ 实际输入还可能包括外部 schema references、生成器、共享读取函数或配置。随着这些来源加入,region 必须同步扩展。尚未建模反向依赖的链接检查保留完整运行,比只匹配 Markdown 更安全。
368
+
369
+ Git evidence 可信但零命中,与 Git 不可用不同。不可用时会提供所有已声明 change flags;上例使用正向条件,使 daily 保守选择两项材料检查。`changeFlag` 仅生成 token,selection 与 callback 共用 effective flags;证据详情读取 `project.changes`。
370
+
371
+ 更多边界见 [文件变化选择](../api-mechanics.md#按文件变化选择-check)。
372
+
373
+ ## 6.找出测试真正读取的输入
374
+
375
+ **情况:** 你把测试分成 parser、configuration、source-identity 三组,却发现按同名目录选择会漏掉测试。
376
+
377
+ 此时先列真实读取,再写 region:
378
+
379
+ | 测试目的 | 真实输入示例 | 选择策略 |
380
+ | --- | --- | --- |
381
+ | parser 私有行为 | parser 源码、测试、fixtures、共享运行工具。 | 只在已证明无关时排除其它私有模块。 |
382
+ | configuration constructor 行为 | configuration 源码,加上实际调用的 JSON reader 与 validator。 | reader 改动也选择此组,尽管目录名不同。 |
383
+ | 全源 identity 审计 | 整个 source tree 和 provenance 映射。 | 保持全源输入;测试文件所在目录不能代表扫描范围。 |
384
+
385
+ 例如,修改 JSON reader 后,应同时选择它自己的测试和实际调用它的 configuration 测试;只改无关私有模块时,前两组可能跳过,但全源审计仍有工作。
386
+
387
+ 在收窄前,至少验证:
388
+
389
+ - 每组的 test file、fixture 及工具链输入的新增、修改、删除都能触发该组。
390
+ - 共享和未知输入有保守路径,人工完整测试入口仍可用。
391
+ - 用已确认无关的输入变更验证跳过,并保留各组独立的验收目的。
392
+
393
+ 收窄的是执行条件:相关输入变化时,该组仍完整证明原有目标。将触发与跳过的对照随 region 一起维护。
394
+
395
+ ## 7.复用计算,而非通过结论
396
+
397
+ **情况:** 你写了一个检查 `dist/app.js` gzip 大小的 Check。相同文件反复压缩有成本,但大小阈值仍应按本次规则判断。
398
+
399
+ 用 `cacheJsonByKey` 保存自己计算的大小,而不是上次的通过结论。下面每次都读取当前文件,用同一份 bytes 生成 key 并计算;调用步骤见[运行本页示例](#运行本页示例):
400
+
401
+ ```ts
402
+ import { createHash } from "node:crypto";
403
+ import { readFile } from "node:fs/promises";
404
+ import { resolve } from "node:path";
405
+ import { gzipSync } from "node:zlib";
406
+ import { cacheJsonByKey, defineCheck, defineConfig } from "@zxyycom/vibe-check";
407
+
408
+ function parseMeasurement(value: unknown): { compressedBytes: number } {
409
+ if (
410
+ value === null ||
411
+ typeof value !== "object" ||
412
+ !("compressedBytes" in value) ||
413
+ typeof value.compressedBytes !== "number" ||
414
+ !Number.isSafeInteger(value.compressedBytes) ||
415
+ value.compressedBytes < 0
416
+ )
417
+ throw new TypeError("Invalid gzip measurement");
418
+ return { compressedBytes: value.compressedBytes };
419
+ }
420
+
421
+ const gzipSize = defineCheck({
422
+ checkId: "gzip-size",
423
+ displayName: "Gzip size",
424
+ options: { maximumBytes: 100_000 },
425
+ async execute({ options, project }) {
426
+ const source = await readFile(resolve(project.root, "dist/app.js"));
427
+ const level = 9;
428
+ const key = JSON.stringify({
429
+ sourceHash: createHash("sha256").update(source).digest("hex"),
430
+ measurementRevision: "gzip-size-v1",
431
+ level,
432
+ nodeVersion: process.versions.node,
433
+ zlibVersion: process.versions.zlib ?? null,
434
+ bunVersion: process.versions.bun ?? null
435
+ });
436
+ const cached = await cacheJsonByKey({
437
+ directory: resolve(project.root, ".cache/quality/gzip-size"),
438
+ namespace: "my-project.gzip-size",
439
+ version: "1",
440
+ key,
441
+ parse: parseMeasurement,
442
+ compute: () => ({ compressedBytes: gzipSync(source, { level }).byteLength })
443
+ });
444
+ const maximumBytes = options.maximumBytes;
445
+ const data = {
446
+ compressedBytes: cached.value.compressedBytes,
447
+ maximumBytes,
448
+ cacheSource: cached.source
449
+ };
450
+ return data.compressedBytes <= maximumBytes
451
+ ? { status: "passed", data }
452
+ : { status: "failed", data };
453
+ }
454
+ });
455
+
456
+ const definition = defineConfig({
457
+ checks: [gzipSize],
458
+ outputs: { machinePublication: { enabled: false } }
459
+ });
460
+ ```
461
+
462
+ 运行前需有 `dist/app.js`。这里读取已生成产物;构建本身如何增量复用是另一项任务,不由这个 key 覆盖。
463
+
464
+ 写自己的缓存时,分清三件事:
465
+
466
+ | 部分 | 本例如何定义 |
467
+ | --- | --- |
468
+ | 哪些变化必须重算? | key 包含文件内容摘要、计算实现版本、压缩参数与运行时/压缩库版本;计算读取其它输入时也要加入。 |
469
+ | 复用的事实是什么? | payload 只有 `compressedBytes`;`version` 标识 payload 格式,`parse` 验证读取和新计算的值。 |
470
+ | 本次是否通过? | 每次用当前 `maximumBytes` 判断,包括缓存命中时。阈值不影响压缩结果,因此不进入 key。 |
471
+
472
+ 缓存目录是项目拥有、允许写入并可删除的本地目录。helper 负责读写与失效回退,不判断 key 是否完整,也不提供防篡改或保密保证;本例显式从 `project.root` 解析目录。
473
+
474
+ **试一下:**
475
+
476
+ 1. 连续运行两次,大小相同,`cacheSource` 从 `computed` 变成 `cache`。
477
+ 2. 改文件内容或 `level`,应重新计算;计算实现变化时同步更新 `measurementRevision`。
478
+ 3. 只把阈值降到实测大小以下,即使命中缓存,也应失败。
479
+ 4. 删除或破坏缓存文件,应重新计算;存储失败不抹掉本次已计算的结果,计算或 payload 校验失败则不能当成通过。
480
+
481
+ selection 决定是否做检查;cache 只复用检查内部的计算。本例的机制正确性与性能收益分别验证,是否值得缓存仍需测量。完整 helper 契约见[缓存计算结果](./cache-results.md);现成 Check 已有缓存选项时,可直接使用其能力。
482
+
483
+ ## 8.表达并发约束
484
+
485
+ **情况:** 三组测试各自会启动重工作,你希望同时最多两组运行,但轻量检查仍可使用第三个总任务槽位。
486
+
487
+ 下面的组合按[公共运行约定](#运行本页示例)执行:
488
+
489
+ ```ts
490
+ import { defineCheck, defineConfig } from "@zxyycom/vibe-check";
491
+
492
+ const runners = ["unit", "integration", "typecheck"].map((checkId) =>
493
+ defineCheck({
494
+ checkId,
495
+ displayName: checkId,
496
+ resourceClaims: { runner: 1 },
497
+ async execute() {
498
+ // 用短等待模拟已等待的异步工作;实际项目在这里调用真实检查。
499
+ await new Promise((resolve) => setTimeout(resolve, 20));
500
+ return { status: "passed", data: {} };
501
+ }
502
+ })
503
+ );
504
+
505
+ const metadata = defineCheck({
506
+ checkId: "metadata",
507
+ displayName: "Metadata",
508
+ execute: () => ({ status: "passed", data: {} })
509
+ });
510
+
511
+ const definition = defineConfig({
512
+ checks: [...runners, metadata],
513
+ scheduler: { maxParallel: 3, resourceCapacities: { runner: 2 } },
514
+ outputs: { machinePublication: { enabled: false } }
515
+ });
516
+ ```
517
+
518
+ 三种约束分别回答不同问题:
519
+
520
+ | 约束 | 表达的意思 |
521
+ | --- | --- |
522
+ | `scheduler.maxParallel: 3` | 同时最多运行三个 Check。 |
523
+ | `runner: 2`,每组 claim 1 | 同时最多运行两组声明了该资源的任务。 |
524
+ | 两项都声明 `mutex: ["shared-fixture"]` | 若它们会改同一份 fixture,同一时刻只能运行其中一项。 |
525
+
526
+ 需要共享 fixture 互斥时,将上表的同名 mutex 分别加入对应 Check;不必让其它独立测试一起串行。所有 claims 在准入时原子取得,结束后释放。
527
+
528
+ 这里的 unit 是逻辑配额,不是 CPU 核或物理内存。第三个槽位可供轻量任务使用,但是否立即被选中取决于调度条件;容量 `2` 也不是性能最优承诺。先表达真实硬约束,再通过配对测量判断是否需要调整策略。
529
+
530
+ 完整机制见[调度 Check](./scheduling.md)。
531
+
532
+ ## 9.把工具输出转换为结构化诊断
533
+
534
+ **情况:** 你想把失败位置和原因变成可展示、可消费的 Records,但工具输出可能只有文本,也可能已有另一种结构。
535
+
536
+ 先确认工具能提供什么:有稳定 JSON 模式时优先使用;自己拥有的 validator 可直接返回领域数据;只有文本模式时,再为已知格式写 parser。没有稳定格式的任意日志不能可靠还原成诊断,此时保留失败结论,不编造文件、行号或错误码。
537
+
538
+ ### 9.1.只有文本:解析明确的格式
539
+
540
+ 假设现有工具约定每行输出 `config/app.json:<行号>: MISSING_NAME`,退出 `0` 表示通过,普通非零退出表示检查失败。下面固定输出一行模拟它,按[公共运行约定](#运行本页示例)执行;替换成真实命令时,parser 也要遵循真实协议。
541
+
542
+ ```ts
543
+ import {
544
+ commandCheck,
545
+ defineConfig,
546
+ type CheckResult,
547
+ type AfterCommandContext
548
+ } from "@zxyycom/vibe-check";
549
+
550
+ type DiagnosticData = { exitCode: number; diagnosticsAvailable?: boolean };
551
+
552
+ function parseTextDiagnostics(text: string) {
553
+ return text
554
+ .trim()
555
+ .split(/\r?\n/)
556
+ .map((line) => {
557
+ const match = /^config\/app\.json:([1-9][0-9]*): MISSING_NAME$/.exec(line);
558
+ if (!match) throw new TypeError("Unsupported diagnostic line");
559
+ const lineNumber = Number(match[1]);
560
+ if (!Number.isSafeInteger(lineNumber)) throw new TypeError("Invalid line number");
561
+ return { path: "config/app.json", line: lineNumber, code: "missing-name" };
562
+ });
563
+ }
564
+
565
+ const afterCommand = {
566
+ execute({ command, records }: AfterCommandContext): CheckResult<DiagnosticData> {
567
+ if (command.exitCode === 0) return { status: "passed", data: { exitCode: 0 } };
568
+ let diagnostics;
569
+ try {
570
+ diagnostics = parseTextDiagnostics(command.stdout);
571
+ } catch {
572
+ return {
573
+ status: "failed",
574
+ data: { exitCode: command.exitCode, diagnosticsAvailable: false }
575
+ };
576
+ }
577
+ diagnostics.forEach((data, index) => records.report({ id: "config-" + index }, data));
578
+ return {
579
+ status: "failed",
580
+ data: { exitCode: command.exitCode, diagnosticsAvailable: true }
581
+ };
582
+ }
583
+ };
584
+
585
+ const check = commandCheck({
586
+ checkId: "config-text-diagnostics",
587
+ displayName: "Configuration diagnostics",
588
+ executable: process.execPath,
589
+ arguments: [
590
+ "--eval",
591
+ 'process.stdout.write("config/app.json:3: MISSING_NAME\\n"); process.exit(1);'
592
+ ],
593
+ timeoutMs: 5_000,
594
+ outputByteLimit: 64 * 1024,
595
+ afterCommand
596
+ });
597
+
598
+ const definition = defineConfig({
599
+ checks: [check],
600
+ outputs: { machinePublication: { enabled: false } }
601
+ });
602
+ ```
603
+
604
+ 输出被转换为 `{ path: "config/app.json", line: 3, code: "missing-name" }`。parser 只接受这里声明的格式;混入一行无法识别的日志,整组诊断就不发布,Check 仍保留 `failed`。如果工具把诊断写在 stderr,应读取对应通道,而不是将 stdout/stderr 任意拼接。
605
+
606
+ ### 9.2.已有结构:验证并映射为项目字段
607
+
608
+ 另一个工具输出 `{ errors: [...] }`,使用 `filename`、`location.row` 和工具错误码 `CFG001`;项目则需要 `path`、`line` 和 `missing-name`。先验证源结构,再做字段、错误码和公开范围的转换,而不是把 JSON 原样塞进 Record。此片段独立使用[公共运行约定](#运行本页示例)。
609
+
610
+ ```ts
611
+ import {
612
+ commandCheck,
613
+ defineConfig,
614
+ type CheckResult,
615
+ type AfterCommandContext
616
+ } from "@zxyycom/vibe-check";
617
+
618
+ type DiagnosticData = { exitCode: number; diagnosticsAvailable?: boolean };
619
+
620
+ function projectJsonDiagnostics(text: string) {
621
+ const value: unknown = JSON.parse(text);
622
+ if (
623
+ value === null ||
624
+ typeof value !== "object" ||
625
+ !("errors" in value) ||
626
+ !Array.isArray(value.errors)
627
+ )
628
+ throw new TypeError("Expected an errors array");
629
+ return value.errors.map((item) => {
630
+ if (
631
+ item === null ||
632
+ typeof item !== "object" ||
633
+ item.filename !== "config/app.json" ||
634
+ item.rule !== "CFG001" ||
635
+ item.location === null ||
636
+ typeof item.location !== "object" ||
637
+ typeof item.location.row !== "number" ||
638
+ !Number.isSafeInteger(item.location.row) ||
639
+ item.location.row < 1
640
+ )
641
+ throw new TypeError("Unsupported diagnostic");
642
+ return { path: "config/app.json", line: item.location.row, code: "missing-name" };
643
+ });
644
+ }
645
+
646
+ const afterCommand = {
647
+ execute({ command, records }: AfterCommandContext): CheckResult<DiagnosticData> {
648
+ if (command.exitCode === 0) {
649
+ return { status: "passed", data: { exitCode: 0 } };
650
+ }
651
+ let diagnostics;
652
+ try {
653
+ diagnostics = projectJsonDiagnostics(command.stdout);
654
+ } catch {
655
+ return {
656
+ status: "failed",
657
+ data: { exitCode: command.exitCode, diagnosticsAvailable: false }
658
+ };
659
+ }
660
+ diagnostics.forEach((data, index) => records.report({ id: "config-" + index }, data));
661
+ return {
662
+ status: "failed",
663
+ data: { exitCode: command.exitCode, diagnosticsAvailable: true }
664
+ };
665
+ }
666
+ };
667
+
668
+ const check = commandCheck({
669
+ checkId: "config-json-diagnostics",
670
+ displayName: "Configuration diagnostics",
671
+ executable: process.execPath,
672
+ arguments: [
673
+ "--eval",
674
+ 'process.stdout.write(JSON.stringify({errors:[{filename:"config/app.json",location:{row:3},rule:"CFG001",debug:"internal context"}]})); process.exit(1);'
675
+ ],
676
+ timeoutMs: 5_000,
677
+ outputByteLimit: 64 * 1024,
678
+ afterCommand
679
+ });
680
+
681
+ const definition = defineConfig({
682
+ checks: [check],
683
+ outputs: { machinePublication: { enabled: false } }
684
+ });
685
+ ```
686
+
687
+ 这个例子故意只支持一个已知文件和一种工具错误码,以清楚展示映射;实际 adapter 按协议扩充允许的范围。`debug` 等额外字段被丢弃,不会复制进 Record。Record 的领域 data 由 Check 自己定义,并不存在 Product 强制所有工具遵循的 `path/line/code` 诊断 schema。
688
+
689
+ **两种转换都应验证:** 有效输入得到一条相同形状的 Record,Check 仍为 `failed`;第二条格式错误、使用未支持的错误码或指向 `../outside.json` 时,整组拒绝,不会先发布第一条。非零退出的失败结论保留为 `diagnosticsAvailable: false`,不是把无法解析误当成没有问题。
690
+
691
+ 上述原子性来自“先 map 验证全部,再 report”,不是 reporter 自带事务。这两个例子的兜底依赖工具以非零退出表达失败的约定;如果工具区分“发现错误”和“自身崩溃”的退出码,adapter 也要分别映射。启动失败、超时等不会进入 `afterCommand`,仍由 Product 结算为 `unavailable`。
692
+
693
+ 例子保持默认 `discard`,不保存原始输出;Records 仍进入 Run 的内存结果与默认进度预览,启用 machine publication 后也会发布。需要排障 transcript 时,显式配置 `output: { mode: "transcript" }` 和本次 `checkArtifactBaseDirectory`,并由 caller 管理访问和留存。preview 限额不承担脱敏责任。
694
+
695
+ 更多约束见 [afterCommand](./command-check.md#调用方完成阶段)和[Run 输出](./run-outputs.md)。
696
+
697
+ ## 把选中的场景带回项目
698
+
699
+ 可以先选最接近当前问题的一节,按小步迭代:
700
+
701
+ 1. 明确希望改变的结果,例如“安装一次,分别知道类型和运行时验收是否通过”。
702
+ 2. 写出一组成功与失败对照,再选择 Check、关系和约束。
703
+ 3. 只加入这次确实需要的能力。
704
+ 4. 运行后核对单项 outcome、aggregate 和调用入口退出码;涉及性能时另做可比较测量。
705
+
706
+ 将各场景的判断顺序用于自己的项目,选择适合当前目标的组合。精确契约由各专题拥有,按节内链接继续阅读。