agentskeptic 0.1.1

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 (661) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +342 -0
  3. package/dist/actionableFailure.d.ts +53 -0
  4. package/dist/actionableFailure.d.ts.map +1 -0
  5. package/dist/actionableFailure.js +424 -0
  6. package/dist/actionableFailure.js.map +1 -0
  7. package/dist/actionableFailure.partitionExhaustive.test.d.ts +2 -0
  8. package/dist/actionableFailure.partitionExhaustive.test.d.ts.map +1 -0
  9. package/dist/actionableFailure.partitionExhaustive.test.js +20 -0
  10. package/dist/actionableFailure.partitionExhaustive.test.js.map +1 -0
  11. package/dist/actionableFailure.remediationExhaustive.test.d.ts +2 -0
  12. package/dist/actionableFailure.remediationExhaustive.test.d.ts.map +1 -0
  13. package/dist/actionableFailure.remediationExhaustive.test.js +297 -0
  14. package/dist/actionableFailure.remediationExhaustive.test.js.map +1 -0
  15. package/dist/actionableFailure.test.d.ts +2 -0
  16. package/dist/actionableFailure.test.d.ts.map +1 -0
  17. package/dist/actionableFailure.test.js +211 -0
  18. package/dist/actionableFailure.test.js.map +1 -0
  19. package/dist/agentRunBundle.d.ts +24 -0
  20. package/dist/agentRunBundle.d.ts.map +1 -0
  21. package/dist/agentRunBundle.js +114 -0
  22. package/dist/agentRunBundle.js.map +1 -0
  23. package/dist/agentRunBundle.rollback.test.d.ts +2 -0
  24. package/dist/agentRunBundle.rollback.test.d.ts.map +1 -0
  25. package/dist/agentRunBundle.rollback.test.js +65 -0
  26. package/dist/agentRunBundle.rollback.test.js.map +1 -0
  27. package/dist/agentRunBundle.test.d.ts +2 -0
  28. package/dist/agentRunBundle.test.d.ts.map +1 -0
  29. package/dist/agentRunBundle.test.js +126 -0
  30. package/dist/agentRunBundle.test.js.map +1 -0
  31. package/dist/agentRunRecord.d.ts +82 -0
  32. package/dist/agentRunRecord.d.ts.map +1 -0
  33. package/dist/agentRunRecord.js +51 -0
  34. package/dist/agentRunRecord.js.map +1 -0
  35. package/dist/agentRunRecord.test.d.ts +2 -0
  36. package/dist/agentRunRecord.test.d.ts.map +1 -0
  37. package/dist/agentRunRecord.test.js +49 -0
  38. package/dist/agentRunRecord.test.js.map +1 -0
  39. package/dist/aggregate.d.ts +3 -0
  40. package/dist/aggregate.d.ts.map +1 -0
  41. package/dist/aggregate.js +36 -0
  42. package/dist/aggregate.js.map +1 -0
  43. package/dist/assurance/assurancePathArgs.d.ts +10 -0
  44. package/dist/assurance/assurancePathArgs.d.ts.map +1 -0
  45. package/dist/assurance/assurancePathArgs.js +54 -0
  46. package/dist/assurance/assurancePathArgs.js.map +1 -0
  47. package/dist/assurance/checkStale.d.ts +14 -0
  48. package/dist/assurance/checkStale.d.ts.map +1 -0
  49. package/dist/assurance/checkStale.js +48 -0
  50. package/dist/assurance/checkStale.js.map +1 -0
  51. package/dist/assurance/findRepoRoot.d.ts +6 -0
  52. package/dist/assurance/findRepoRoot.d.ts.map +1 -0
  53. package/dist/assurance/findRepoRoot.js +27 -0
  54. package/dist/assurance/findRepoRoot.js.map +1 -0
  55. package/dist/assurance/runAssurance.d.ts +24 -0
  56. package/dist/assurance/runAssurance.d.ts.map +1 -0
  57. package/dist/assurance/runAssurance.js +105 -0
  58. package/dist/assurance/runAssurance.js.map +1 -0
  59. package/dist/bundleSignatureCodes.d.ts +13 -0
  60. package/dist/bundleSignatureCodes.d.ts.map +1 -0
  61. package/dist/bundleSignatureCodes.js +12 -0
  62. package/dist/bundleSignatureCodes.js.map +1 -0
  63. package/dist/canonicalParams.d.ts +3 -0
  64. package/dist/canonicalParams.d.ts.map +1 -0
  65. package/dist/canonicalParams.js +16 -0
  66. package/dist/canonicalParams.js.map +1 -0
  67. package/dist/ciLock.d.ts +52 -0
  68. package/dist/ciLock.d.ts.map +1 -0
  69. package/dist/ciLock.js +117 -0
  70. package/dist/ciLock.js.map +1 -0
  71. package/dist/ciLockWorkflow.d.ts +4 -0
  72. package/dist/ciLockWorkflow.d.ts.map +1 -0
  73. package/dist/ciLockWorkflow.js +278 -0
  74. package/dist/ciLockWorkflow.js.map +1 -0
  75. package/dist/cli.d.ts +3 -0
  76. package/dist/cli.d.ts.map +1 -0
  77. package/dist/cli.failureExplanationInvariant.test.d.ts +2 -0
  78. package/dist/cli.failureExplanationInvariant.test.d.ts.map +1 -0
  79. package/dist/cli.failureExplanationInvariant.test.js +40 -0
  80. package/dist/cli.failureExplanationInvariant.test.js.map +1 -0
  81. package/dist/cli.js +998 -0
  82. package/dist/cli.js.map +1 -0
  83. package/dist/cliArgv.d.ts +40 -0
  84. package/dist/cliArgv.d.ts.map +1 -0
  85. package/dist/cliArgv.js +149 -0
  86. package/dist/cliArgv.js.map +1 -0
  87. package/dist/cliOperationalCodes.d.ts +65 -0
  88. package/dist/cliOperationalCodes.d.ts.map +1 -0
  89. package/dist/cliOperationalCodes.js +64 -0
  90. package/dist/cliOperationalCodes.js.map +1 -0
  91. package/dist/commercial/licensePreflight.d.ts +7 -0
  92. package/dist/commercial/licensePreflight.d.ts.map +1 -0
  93. package/dist/commercial/licensePreflight.js +95 -0
  94. package/dist/commercial/licensePreflight.js.map +1 -0
  95. package/dist/commercial/licensePreflight.test.d.ts +2 -0
  96. package/dist/commercial/licensePreflight.test.d.ts.map +1 -0
  97. package/dist/commercial/licensePreflight.test.js +123 -0
  98. package/dist/commercial/licensePreflight.test.js.map +1 -0
  99. package/dist/compare.acceptance.test.d.ts +2 -0
  100. package/dist/compare.acceptance.test.d.ts.map +1 -0
  101. package/dist/compare.acceptance.test.js +80 -0
  102. package/dist/compare.acceptance.test.js.map +1 -0
  103. package/dist/correctnessDefinition.d.ts +23 -0
  104. package/dist/correctnessDefinition.d.ts.map +1 -0
  105. package/dist/correctnessDefinition.docParity.test.d.ts +2 -0
  106. package/dist/correctnessDefinition.docParity.test.d.ts.map +1 -0
  107. package/dist/correctnessDefinition.docParity.test.js +22 -0
  108. package/dist/correctnessDefinition.docParity.test.js.map +1 -0
  109. package/dist/correctnessDefinition.js +283 -0
  110. package/dist/correctnessDefinition.js.map +1 -0
  111. package/dist/correctnessDefinitionTemplates.d.ts +70 -0
  112. package/dist/correctnessDefinitionTemplates.d.ts.map +1 -0
  113. package/dist/correctnessDefinitionTemplates.js +121 -0
  114. package/dist/correctnessDefinitionTemplates.js.map +1 -0
  115. package/dist/debug-ui/app.css +188 -0
  116. package/dist/debug-ui/app.js +245 -0
  117. package/dist/debug-ui/index.html +79 -0
  118. package/dist/debugCorpus.d.ts +68 -0
  119. package/dist/debugCorpus.d.ts.map +1 -0
  120. package/dist/debugCorpus.js +544 -0
  121. package/dist/debugCorpus.js.map +1 -0
  122. package/dist/debugCorpus.test.d.ts +2 -0
  123. package/dist/debugCorpus.test.d.ts.map +1 -0
  124. package/dist/debugCorpus.test.js +159 -0
  125. package/dist/debugCorpus.test.js.map +1 -0
  126. package/dist/debugFocus.d.ts +16 -0
  127. package/dist/debugFocus.d.ts.map +1 -0
  128. package/dist/debugFocus.js +51 -0
  129. package/dist/debugFocus.js.map +1 -0
  130. package/dist/debugFocus.test.d.ts +2 -0
  131. package/dist/debugFocus.test.d.ts.map +1 -0
  132. package/dist/debugFocus.test.js +43 -0
  133. package/dist/debugFocus.test.js.map +1 -0
  134. package/dist/debugPanels.d.ts +13 -0
  135. package/dist/debugPanels.d.ts.map +1 -0
  136. package/dist/debugPanels.js +113 -0
  137. package/dist/debugPanels.js.map +1 -0
  138. package/dist/debugPanels.test.d.ts +2 -0
  139. package/dist/debugPanels.test.d.ts.map +1 -0
  140. package/dist/debugPanels.test.js +204 -0
  141. package/dist/debugPanels.test.js.map +1 -0
  142. package/dist/debugPatterns.d.ts +47 -0
  143. package/dist/debugPatterns.d.ts.map +1 -0
  144. package/dist/debugPatterns.js +113 -0
  145. package/dist/debugPatterns.js.map +1 -0
  146. package/dist/debugPatterns.test.d.ts +2 -0
  147. package/dist/debugPatterns.test.d.ts.map +1 -0
  148. package/dist/debugPatterns.test.js +48 -0
  149. package/dist/debugPatterns.test.js.map +1 -0
  150. package/dist/debugRunFilters.d.ts +31 -0
  151. package/dist/debugRunFilters.d.ts.map +1 -0
  152. package/dist/debugRunFilters.js +118 -0
  153. package/dist/debugRunFilters.js.map +1 -0
  154. package/dist/debugRunFilters.test.d.ts +2 -0
  155. package/dist/debugRunFilters.test.d.ts.map +1 -0
  156. package/dist/debugRunFilters.test.js +78 -0
  157. package/dist/debugRunFilters.test.js.map +1 -0
  158. package/dist/debugRunIndex.d.ts +27 -0
  159. package/dist/debugRunIndex.d.ts.map +1 -0
  160. package/dist/debugRunIndex.js +58 -0
  161. package/dist/debugRunIndex.js.map +1 -0
  162. package/dist/debugServer.d.ts +19 -0
  163. package/dist/debugServer.d.ts.map +1 -0
  164. package/dist/debugServer.js +315 -0
  165. package/dist/debugServer.js.map +1 -0
  166. package/dist/debugServer.test.d.ts +2 -0
  167. package/dist/debugServer.test.d.ts.map +1 -0
  168. package/dist/debugServer.test.js +207 -0
  169. package/dist/debugServer.test.js.map +1 -0
  170. package/dist/discovery-payload-v1.json +75 -0
  171. package/dist/distributionFooter.d.ts +3 -0
  172. package/dist/distributionFooter.d.ts.map +1 -0
  173. package/dist/distributionFooter.js +3 -0
  174. package/dist/distributionFooter.js.map +1 -0
  175. package/dist/documentationCopyConsistency.test.d.ts +2 -0
  176. package/dist/documentationCopyConsistency.test.d.ts.map +1 -0
  177. package/dist/documentationCopyConsistency.test.js +94 -0
  178. package/dist/documentationCopyConsistency.test.js.map +1 -0
  179. package/dist/enforceCli.d.ts +4 -0
  180. package/dist/enforceCli.d.ts.map +1 -0
  181. package/dist/enforceCli.js +93 -0
  182. package/dist/enforceCli.js.map +1 -0
  183. package/dist/eventSequenceIntegrity.d.ts +7 -0
  184. package/dist/eventSequenceIntegrity.d.ts.map +1 -0
  185. package/dist/eventSequenceIntegrity.js +47 -0
  186. package/dist/eventSequenceIntegrity.js.map +1 -0
  187. package/dist/eventSequenceIntegrity.test.d.ts +2 -0
  188. package/dist/eventSequenceIntegrity.test.d.ts.map +1 -0
  189. package/dist/eventSequenceIntegrity.test.js +65 -0
  190. package/dist/eventSequenceIntegrity.test.js.map +1 -0
  191. package/dist/executionPathFindings.d.ts +15 -0
  192. package/dist/executionPathFindings.d.ts.map +1 -0
  193. package/dist/executionPathFindings.js +299 -0
  194. package/dist/executionPathFindings.js.map +1 -0
  195. package/dist/executionPathFindings.requirements.test.d.ts +2 -0
  196. package/dist/executionPathFindings.requirements.test.d.ts.map +1 -0
  197. package/dist/executionPathFindings.requirements.test.js +332 -0
  198. package/dist/executionPathFindings.requirements.test.js.map +1 -0
  199. package/dist/executionTrace.d.ts +13 -0
  200. package/dist/executionTrace.d.ts.map +1 -0
  201. package/dist/executionTrace.js +272 -0
  202. package/dist/executionTrace.js.map +1 -0
  203. package/dist/executionTrace.test.d.ts +2 -0
  204. package/dist/executionTrace.test.d.ts.map +1 -0
  205. package/dist/executionTrace.test.js +200 -0
  206. package/dist/executionTrace.test.js.map +1 -0
  207. package/dist/failureAnalysis.d.ts +8 -0
  208. package/dist/failureAnalysis.d.ts.map +1 -0
  209. package/dist/failureAnalysis.js +337 -0
  210. package/dist/failureAnalysis.js.map +1 -0
  211. package/dist/failureAnalysis.test.d.ts +2 -0
  212. package/dist/failureAnalysis.test.d.ts.map +1 -0
  213. package/dist/failureAnalysis.test.js +196 -0
  214. package/dist/failureAnalysis.test.js.map +1 -0
  215. package/dist/failureCatalog.d.ts +26 -0
  216. package/dist/failureCatalog.d.ts.map +1 -0
  217. package/dist/failureCatalog.js +51 -0
  218. package/dist/failureCatalog.js.map +1 -0
  219. package/dist/failureCatalog.test.d.ts +2 -0
  220. package/dist/failureCatalog.test.d.ts.map +1 -0
  221. package/dist/failureCatalog.test.js +25 -0
  222. package/dist/failureCatalog.test.js.map +1 -0
  223. package/dist/failureExplanation.d.ts +52 -0
  224. package/dist/failureExplanation.d.ts.map +1 -0
  225. package/dist/failureExplanation.failureAnalysisMock.test.d.ts +2 -0
  226. package/dist/failureExplanation.failureAnalysisMock.test.d.ts.map +1 -0
  227. package/dist/failureExplanation.failureAnalysisMock.test.js +200 -0
  228. package/dist/failureExplanation.failureAnalysisMock.test.js.map +1 -0
  229. package/dist/failureExplanation.golden.test.d.ts +2 -0
  230. package/dist/failureExplanation.golden.test.d.ts.map +1 -0
  231. package/dist/failureExplanation.golden.test.js +530 -0
  232. package/dist/failureExplanation.golden.test.js.map +1 -0
  233. package/dist/failureExplanation.js +389 -0
  234. package/dist/failureExplanation.js.map +1 -0
  235. package/dist/failureExplanationDocumentationParity.test.d.ts +2 -0
  236. package/dist/failureExplanationDocumentationParity.test.d.ts.map +1 -0
  237. package/dist/failureExplanationDocumentationParity.test.js +56 -0
  238. package/dist/failureExplanationDocumentationParity.test.js.map +1 -0
  239. package/dist/failureOriginCatalog.d.ts +30 -0
  240. package/dist/failureOriginCatalog.d.ts.map +1 -0
  241. package/dist/failureOriginCatalog.js +106 -0
  242. package/dist/failureOriginCatalog.js.map +1 -0
  243. package/dist/failureOriginCatalog.test.d.ts +2 -0
  244. package/dist/failureOriginCatalog.test.d.ts.map +1 -0
  245. package/dist/failureOriginCatalog.test.js +17 -0
  246. package/dist/failureOriginCatalog.test.js.map +1 -0
  247. package/dist/failureOriginSchemaEnum.test.d.ts +2 -0
  248. package/dist/failureOriginSchemaEnum.test.d.ts.map +1 -0
  249. package/dist/failureOriginSchemaEnum.test.js +21 -0
  250. package/dist/failureOriginSchemaEnum.test.js.map +1 -0
  251. package/dist/failureOriginSchemaParity.test.d.ts +2 -0
  252. package/dist/failureOriginSchemaParity.test.d.ts.map +1 -0
  253. package/dist/failureOriginSchemaParity.test.js +33 -0
  254. package/dist/failureOriginSchemaParity.test.js.map +1 -0
  255. package/dist/failureOriginTypes.d.ts +4 -0
  256. package/dist/failureOriginTypes.d.ts.map +1 -0
  257. package/dist/failureOriginTypes.generated.d.ts +4 -0
  258. package/dist/failureOriginTypes.generated.d.ts.map +1 -0
  259. package/dist/failureOriginTypes.generated.js +10 -0
  260. package/dist/failureOriginTypes.generated.js.map +1 -0
  261. package/dist/failureOriginTypes.js +3 -0
  262. package/dist/failureOriginTypes.js.map +1 -0
  263. package/dist/generated/commercialBuildFlags.d.ts +4 -0
  264. package/dist/generated/commercialBuildFlags.d.ts.map +1 -0
  265. package/dist/generated/commercialBuildFlags.js +5 -0
  266. package/dist/generated/commercialBuildFlags.js.map +1 -0
  267. package/dist/index.d.ts +50 -0
  268. package/dist/index.d.ts.map +1 -0
  269. package/dist/index.js +34 -0
  270. package/dist/index.js.map +1 -0
  271. package/dist/jsonPointer.d.ts +3 -0
  272. package/dist/jsonPointer.d.ts.map +1 -0
  273. package/dist/jsonPointer.js +28 -0
  274. package/dist/jsonPointer.js.map +1 -0
  275. package/dist/jsonStableStringify.d.ts +3 -0
  276. package/dist/jsonStableStringify.d.ts.map +1 -0
  277. package/dist/jsonStableStringify.js +3 -0
  278. package/dist/jsonStableStringify.js.map +1 -0
  279. package/dist/loadEvents.d.ts +3 -0
  280. package/dist/loadEvents.d.ts.map +1 -0
  281. package/dist/loadEvents.eventFileAggregateCounts.test.d.ts +2 -0
  282. package/dist/loadEvents.eventFileAggregateCounts.test.d.ts.map +1 -0
  283. package/dist/loadEvents.eventFileAggregateCounts.test.js +18 -0
  284. package/dist/loadEvents.eventFileAggregateCounts.test.js.map +1 -0
  285. package/dist/loadEvents.js +85 -0
  286. package/dist/loadEvents.js.map +1 -0
  287. package/dist/multiEffectRollup.d.ts +43 -0
  288. package/dist/multiEffectRollup.d.ts.map +1 -0
  289. package/dist/multiEffectRollup.js +164 -0
  290. package/dist/multiEffectRollup.js.map +1 -0
  291. package/dist/multiEffectRollup.test.d.ts +2 -0
  292. package/dist/multiEffectRollup.test.d.ts.map +1 -0
  293. package/dist/multiEffectRollup.test.js +128 -0
  294. package/dist/multiEffectRollup.test.js.map +1 -0
  295. package/dist/noStepsMessage.d.ts +7 -0
  296. package/dist/noStepsMessage.d.ts.map +1 -0
  297. package/dist/noStepsMessage.js +12 -0
  298. package/dist/noStepsMessage.js.map +1 -0
  299. package/dist/noStepsMessage.test.d.ts +2 -0
  300. package/dist/noStepsMessage.test.d.ts.map +1 -0
  301. package/dist/noStepsMessage.test.js +15 -0
  302. package/dist/noStepsMessage.test.js.map +1 -0
  303. package/dist/operationalDisposition.d.ts +498 -0
  304. package/dist/operationalDisposition.d.ts.map +1 -0
  305. package/dist/operationalDisposition.js +490 -0
  306. package/dist/operationalDisposition.js.map +1 -0
  307. package/dist/operationalDispositionDerivation.test.d.ts +2 -0
  308. package/dist/operationalDispositionDerivation.test.d.ts.map +1 -0
  309. package/dist/operationalDispositionDerivation.test.js +19 -0
  310. package/dist/operationalDispositionDerivation.test.js.map +1 -0
  311. package/dist/operationalFailureDiagnosis.d.ts +3 -0
  312. package/dist/operationalFailureDiagnosis.d.ts.map +1 -0
  313. package/dist/operationalFailureDiagnosis.js +25 -0
  314. package/dist/operationalFailureDiagnosis.js.map +1 -0
  315. package/dist/pipeline.d.ts +38 -0
  316. package/dist/pipeline.d.ts.map +1 -0
  317. package/dist/pipeline.js +457 -0
  318. package/dist/pipeline.js.map +1 -0
  319. package/dist/planLogicalSteps.d.ts +16 -0
  320. package/dist/planLogicalSteps.d.ts.map +1 -0
  321. package/dist/planLogicalSteps.js +51 -0
  322. package/dist/planLogicalSteps.js.map +1 -0
  323. package/dist/planLogicalSteps.test.d.ts +2 -0
  324. package/dist/planLogicalSteps.test.d.ts.map +1 -0
  325. package/dist/planLogicalSteps.test.js +88 -0
  326. package/dist/planLogicalSteps.test.js.map +1 -0
  327. package/dist/planTransition.d.ts +88 -0
  328. package/dist/planTransition.d.ts.map +1 -0
  329. package/dist/planTransition.js +490 -0
  330. package/dist/planTransition.js.map +1 -0
  331. package/dist/planTransition.test.d.ts +2 -0
  332. package/dist/planTransition.test.d.ts.map +1 -0
  333. package/dist/planTransition.test.js +956 -0
  334. package/dist/planTransition.test.js.map +1 -0
  335. package/dist/planTransitionConstants.d.ts +3 -0
  336. package/dist/planTransitionConstants.d.ts.map +1 -0
  337. package/dist/planTransitionConstants.js +3 -0
  338. package/dist/planTransitionConstants.js.map +1 -0
  339. package/dist/planTransitionPathHarvest.d.ts +24 -0
  340. package/dist/planTransitionPathHarvest.d.ts.map +1 -0
  341. package/dist/planTransitionPathHarvest.js +273 -0
  342. package/dist/planTransitionPathHarvest.js.map +1 -0
  343. package/dist/planTransitionPathHarvest.test.d.ts +2 -0
  344. package/dist/planTransitionPathHarvest.test.d.ts.map +1 -0
  345. package/dist/planTransitionPathHarvest.test.js +232 -0
  346. package/dist/planTransitionPathHarvest.test.js.map +1 -0
  347. package/dist/prepareWorkflowEvents.d.ts +6 -0
  348. package/dist/prepareWorkflowEvents.d.ts.map +1 -0
  349. package/dist/prepareWorkflowEvents.js +8 -0
  350. package/dist/prepareWorkflowEvents.js.map +1 -0
  351. package/dist/publicDistribution.generated.d.ts +3 -0
  352. package/dist/publicDistribution.generated.d.ts.map +1 -0
  353. package/dist/publicDistribution.generated.js +9 -0
  354. package/dist/publicDistribution.generated.js.map +1 -0
  355. package/dist/quickVerify/atomicWrite.d.ts +6 -0
  356. package/dist/quickVerify/atomicWrite.d.ts.map +1 -0
  357. package/dist/quickVerify/atomicWrite.js +33 -0
  358. package/dist/quickVerify/atomicWrite.js.map +1 -0
  359. package/dist/quickVerify/buildQuickContractEventsNdjson.d.ts +14 -0
  360. package/dist/quickVerify/buildQuickContractEventsNdjson.d.ts.map +1 -0
  361. package/dist/quickVerify/buildQuickContractEventsNdjson.js +28 -0
  362. package/dist/quickVerify/buildQuickContractEventsNdjson.js.map +1 -0
  363. package/dist/quickVerify/canonicalJson.d.ts +5 -0
  364. package/dist/quickVerify/canonicalJson.d.ts.map +1 -0
  365. package/dist/quickVerify/canonicalJson.js +23 -0
  366. package/dist/quickVerify/canonicalJson.js.map +1 -0
  367. package/dist/quickVerify/decomposeUnits.d.ts +15 -0
  368. package/dist/quickVerify/decomposeUnits.d.ts.map +1 -0
  369. package/dist/quickVerify/decomposeUnits.js +50 -0
  370. package/dist/quickVerify/decomposeUnits.js.map +1 -0
  371. package/dist/quickVerify/exportTool.d.ts +6 -0
  372. package/dist/quickVerify/exportTool.d.ts.map +1 -0
  373. package/dist/quickVerify/exportTool.js +20 -0
  374. package/dist/quickVerify/exportTool.js.map +1 -0
  375. package/dist/quickVerify/forbiddenMutatingSql.d.ts +4 -0
  376. package/dist/quickVerify/forbiddenMutatingSql.d.ts.map +1 -0
  377. package/dist/quickVerify/forbiddenMutatingSql.js +6 -0
  378. package/dist/quickVerify/forbiddenMutatingSql.js.map +1 -0
  379. package/dist/quickVerify/formatQuickVerifyHumanReport.d.ts +17 -0
  380. package/dist/quickVerify/formatQuickVerifyHumanReport.d.ts.map +1 -0
  381. package/dist/quickVerify/formatQuickVerifyHumanReport.js +65 -0
  382. package/dist/quickVerify/formatQuickVerifyHumanReport.js.map +1 -0
  383. package/dist/quickVerify/formatQuickVerifyHumanReport.test.d.ts +2 -0
  384. package/dist/quickVerify/formatQuickVerifyHumanReport.test.d.ts.map +1 -0
  385. package/dist/quickVerify/formatQuickVerifyHumanReport.test.js +41 -0
  386. package/dist/quickVerify/formatQuickVerifyHumanReport.test.js.map +1 -0
  387. package/dist/quickVerify/ingest.d.ts +34 -0
  388. package/dist/quickVerify/ingest.d.ts.map +1 -0
  389. package/dist/quickVerify/ingest.js +327 -0
  390. package/dist/quickVerify/ingest.js.map +1 -0
  391. package/dist/quickVerify/noMutatingSqlInSources.test.d.ts +2 -0
  392. package/dist/quickVerify/noMutatingSqlInSources.test.d.ts.map +1 -0
  393. package/dist/quickVerify/noMutatingSqlInSources.test.js +34 -0
  394. package/dist/quickVerify/noMutatingSqlInSources.test.js.map +1 -0
  395. package/dist/quickVerify/postgresCatalog.d.ts +19 -0
  396. package/dist/quickVerify/postgresCatalog.d.ts.map +1 -0
  397. package/dist/quickVerify/postgresCatalog.js +107 -0
  398. package/dist/quickVerify/postgresCatalog.js.map +1 -0
  399. package/dist/quickVerify/quickVerifyHumanCopy.d.ts +9 -0
  400. package/dist/quickVerify/quickVerifyHumanCopy.d.ts.map +1 -0
  401. package/dist/quickVerify/quickVerifyHumanCopy.js +24 -0
  402. package/dist/quickVerify/quickVerifyHumanCopy.js.map +1 -0
  403. package/dist/quickVerify/quickVerifyProductTruth.d.ts +16 -0
  404. package/dist/quickVerify/quickVerifyProductTruth.d.ts.map +1 -0
  405. package/dist/quickVerify/quickVerifyProductTruth.js +19 -0
  406. package/dist/quickVerify/quickVerifyProductTruth.js.map +1 -0
  407. package/dist/quickVerify/quickVerifyScope.d.ts +12 -0
  408. package/dist/quickVerify/quickVerifyScope.d.ts.map +1 -0
  409. package/dist/quickVerify/quickVerifyScope.js +16 -0
  410. package/dist/quickVerify/quickVerifyScope.js.map +1 -0
  411. package/dist/quickVerify/relationalPlan.d.ts +10 -0
  412. package/dist/quickVerify/relationalPlan.d.ts.map +1 -0
  413. package/dist/quickVerify/relationalPlan.js +37 -0
  414. package/dist/quickVerify/relationalPlan.js.map +1 -0
  415. package/dist/quickVerify/rowUnit.d.ts +15 -0
  416. package/dist/quickVerify/rowUnit.d.ts.map +1 -0
  417. package/dist/quickVerify/rowUnit.js +132 -0
  418. package/dist/quickVerify/rowUnit.js.map +1 -0
  419. package/dist/quickVerify/runQuickVerify.d.ts +65 -0
  420. package/dist/quickVerify/runQuickVerify.d.ts.map +1 -0
  421. package/dist/quickVerify/runQuickVerify.js +320 -0
  422. package/dist/quickVerify/runQuickVerify.js.map +1 -0
  423. package/dist/quickVerify/schemaCatalogTypes.d.ts +22 -0
  424. package/dist/quickVerify/schemaCatalogTypes.d.ts.map +1 -0
  425. package/dist/quickVerify/schemaCatalogTypes.js +2 -0
  426. package/dist/quickVerify/schemaCatalogTypes.js.map +1 -0
  427. package/dist/quickVerify/sqliteCatalog.d.ts +13 -0
  428. package/dist/quickVerify/sqliteCatalog.d.ts.map +1 -0
  429. package/dist/quickVerify/sqliteCatalog.js +48 -0
  430. package/dist/quickVerify/sqliteCatalog.js.map +1 -0
  431. package/dist/quickVerify/tableScoring.d.ts +24 -0
  432. package/dist/quickVerify/tableScoring.d.ts.map +1 -0
  433. package/dist/quickVerify/tableScoring.js +156 -0
  434. package/dist/quickVerify/tableScoring.js.map +1 -0
  435. package/dist/quickVerify/thresholds.d.ts +11 -0
  436. package/dist/quickVerify/thresholds.d.ts.map +1 -0
  437. package/dist/quickVerify/thresholds.js +11 -0
  438. package/dist/quickVerify/thresholds.js.map +1 -0
  439. package/dist/quickVerify/verifyExecution.d.ts +15 -0
  440. package/dist/quickVerify/verifyExecution.d.ts.map +1 -0
  441. package/dist/quickVerify/verifyExecution.js +153 -0
  442. package/dist/quickVerify/verifyExecution.js.map +1 -0
  443. package/dist/reconciler.d.ts +25 -0
  444. package/dist/reconciler.d.ts.map +1 -0
  445. package/dist/reconciler.js +266 -0
  446. package/dist/reconciler.js.map +1 -0
  447. package/dist/reconciliationPresentation.d.ts +83 -0
  448. package/dist/reconciliationPresentation.d.ts.map +1 -0
  449. package/dist/reconciliationPresentation.js +195 -0
  450. package/dist/reconciliationPresentation.js.map +1 -0
  451. package/dist/registryValidation.d.ts +48 -0
  452. package/dist/registryValidation.d.ts.map +1 -0
  453. package/dist/registryValidation.js +254 -0
  454. package/dist/registryValidation.js.map +1 -0
  455. package/dist/registryValidation.test.d.ts +2 -0
  456. package/dist/registryValidation.test.d.ts.map +1 -0
  457. package/dist/registryValidation.test.js +186 -0
  458. package/dist/registryValidation.test.js.map +1 -0
  459. package/dist/relationalInvariant.d.ts +28 -0
  460. package/dist/relationalInvariant.d.ts.map +1 -0
  461. package/dist/relationalInvariant.existsSql.test.d.ts +2 -0
  462. package/dist/relationalInvariant.existsSql.test.d.ts.map +1 -0
  463. package/dist/relationalInvariant.existsSql.test.js +12 -0
  464. package/dist/relationalInvariant.existsSql.test.js.map +1 -0
  465. package/dist/relationalInvariant.js +347 -0
  466. package/dist/relationalInvariant.js.map +1 -0
  467. package/dist/relationalInvariant.test.d.ts +2 -0
  468. package/dist/relationalInvariant.test.d.ts.map +1 -0
  469. package/dist/relationalInvariant.test.js +32 -0
  470. package/dist/relationalInvariant.test.js.map +1 -0
  471. package/dist/remediationConsumptionGuard.test.d.ts +2 -0
  472. package/dist/remediationConsumptionGuard.test.d.ts.map +1 -0
  473. package/dist/remediationConsumptionGuard.test.js +80 -0
  474. package/dist/remediationConsumptionGuard.test.js.map +1 -0
  475. package/dist/remediationWireSurfaceGuard.test.d.ts +2 -0
  476. package/dist/remediationWireSurfaceGuard.test.d.ts.map +1 -0
  477. package/dist/remediationWireSurfaceGuard.test.js +39 -0
  478. package/dist/remediationWireSurfaceGuard.test.js.map +1 -0
  479. package/dist/resolveExpectation.d.ts +28 -0
  480. package/dist/resolveExpectation.d.ts.map +1 -0
  481. package/dist/resolveExpectation.js +654 -0
  482. package/dist/resolveExpectation.js.map +1 -0
  483. package/dist/resolveExpectation.test.d.ts +2 -0
  484. package/dist/resolveExpectation.test.d.ts.map +1 -0
  485. package/dist/resolveExpectation.test.js +434 -0
  486. package/dist/resolveExpectation.test.js.map +1 -0
  487. package/dist/resolveFailureCodes.d.ts +2 -0
  488. package/dist/resolveFailureCodes.d.ts.map +1 -0
  489. package/dist/resolveFailureCodes.js +7 -0
  490. package/dist/resolveFailureCodes.js.map +1 -0
  491. package/dist/runComparison.d.ts +168 -0
  492. package/dist/runComparison.d.ts.map +1 -0
  493. package/dist/runComparison.js +675 -0
  494. package/dist/runComparison.js.map +1 -0
  495. package/dist/runComparison.test.d.ts +2 -0
  496. package/dist/runComparison.test.d.ts.map +1 -0
  497. package/dist/runComparison.test.js +507 -0
  498. package/dist/runComparison.test.js.map +1 -0
  499. package/dist/runLevelDriftMessages.d.ts +4 -0
  500. package/dist/runLevelDriftMessages.d.ts.map +1 -0
  501. package/dist/runLevelDriftMessages.js +4 -0
  502. package/dist/runLevelDriftMessages.js.map +1 -0
  503. package/dist/schema-validation.test.d.ts +2 -0
  504. package/dist/schema-validation.test.d.ts.map +1 -0
  505. package/dist/schema-validation.test.js +531 -0
  506. package/dist/schema-validation.test.js.map +1 -0
  507. package/dist/schemaLoad.d.ts +5 -0
  508. package/dist/schemaLoad.d.ts.map +1 -0
  509. package/dist/schemaLoad.js +152 -0
  510. package/dist/schemaLoad.js.map +1 -0
  511. package/dist/shareReport/postPublicVerificationReport.d.ts +26 -0
  512. package/dist/shareReport/postPublicVerificationReport.d.ts.map +1 -0
  513. package/dist/shareReport/postPublicVerificationReport.js +38 -0
  514. package/dist/shareReport/postPublicVerificationReport.js.map +1 -0
  515. package/dist/slice6.compare.ac.test.d.ts +2 -0
  516. package/dist/slice6.compare.ac.test.d.ts.map +1 -0
  517. package/dist/slice6.compare.ac.test.js +81 -0
  518. package/dist/slice6.compare.ac.test.js.map +1 -0
  519. package/dist/sqlConnector.d.ts +15 -0
  520. package/dist/sqlConnector.d.ts.map +1 -0
  521. package/dist/sqlConnector.js +36 -0
  522. package/dist/sqlConnector.js.map +1 -0
  523. package/dist/sqlReadBackend.d.ts +19 -0
  524. package/dist/sqlReadBackend.d.ts.map +1 -0
  525. package/dist/sqlReadBackend.js +67 -0
  526. package/dist/sqlReadBackend.js.map +1 -0
  527. package/dist/standardVerifyWorkflowCli.d.ts +24 -0
  528. package/dist/standardVerifyWorkflowCli.d.ts.map +1 -0
  529. package/dist/standardVerifyWorkflowCli.js +95 -0
  530. package/dist/standardVerifyWorkflowCli.js.map +1 -0
  531. package/dist/taxonomyAuthority.test.d.ts +2 -0
  532. package/dist/taxonomyAuthority.test.d.ts.map +1 -0
  533. package/dist/taxonomyAuthority.test.js +44 -0
  534. package/dist/taxonomyAuthority.test.js.map +1 -0
  535. package/dist/toolsRegistryLoad.d.ts +7 -0
  536. package/dist/toolsRegistryLoad.d.ts.map +1 -0
  537. package/dist/toolsRegistryLoad.js +32 -0
  538. package/dist/toolsRegistryLoad.js.map +1 -0
  539. package/dist/truthLayerError.d.ts +8 -0
  540. package/dist/truthLayerError.d.ts.map +1 -0
  541. package/dist/truthLayerError.js +9 -0
  542. package/dist/truthLayerError.js.map +1 -0
  543. package/dist/types.d.ts +706 -0
  544. package/dist/types.d.ts.map +1 -0
  545. package/dist/types.js +24 -0
  546. package/dist/types.js.map +1 -0
  547. package/dist/valueVerification.d.ts +12 -0
  548. package/dist/valueVerification.d.ts.map +1 -0
  549. package/dist/valueVerification.js +112 -0
  550. package/dist/valueVerification.js.map +1 -0
  551. package/dist/valueVerification.test.d.ts +2 -0
  552. package/dist/valueVerification.test.d.ts.map +1 -0
  553. package/dist/valueVerification.test.js +112 -0
  554. package/dist/valueVerification.test.js.map +1 -0
  555. package/dist/verificationAgainstSystemState.requirements.test.d.ts +2 -0
  556. package/dist/verificationAgainstSystemState.requirements.test.d.ts.map +1 -0
  557. package/dist/verificationAgainstSystemState.requirements.test.js +326 -0
  558. package/dist/verificationAgainstSystemState.requirements.test.js.map +1 -0
  559. package/dist/verificationDiagnostics.d.ts +21 -0
  560. package/dist/verificationDiagnostics.d.ts.map +1 -0
  561. package/dist/verificationDiagnostics.js +141 -0
  562. package/dist/verificationDiagnostics.js.map +1 -0
  563. package/dist/verificationDiagnostics.test.d.ts +2 -0
  564. package/dist/verificationDiagnostics.test.d.ts.map +1 -0
  565. package/dist/verificationDiagnostics.test.js +228 -0
  566. package/dist/verificationDiagnostics.test.js.map +1 -0
  567. package/dist/verificationPolicy.d.ts +33 -0
  568. package/dist/verificationPolicy.d.ts.map +1 -0
  569. package/dist/verificationPolicy.js +495 -0
  570. package/dist/verificationPolicy.js.map +1 -0
  571. package/dist/verificationPolicy.test.d.ts +2 -0
  572. package/dist/verificationPolicy.test.d.ts.map +1 -0
  573. package/dist/verificationPolicy.test.js +252 -0
  574. package/dist/verificationPolicy.test.js.map +1 -0
  575. package/dist/verificationRunContext.d.ts +10 -0
  576. package/dist/verificationRunContext.d.ts.map +1 -0
  577. package/dist/verificationRunContext.js +111 -0
  578. package/dist/verificationRunContext.js.map +1 -0
  579. package/dist/verificationUserPhrases.d.ts +22 -0
  580. package/dist/verificationUserPhrases.d.ts.map +1 -0
  581. package/dist/verificationUserPhrases.js +99 -0
  582. package/dist/verificationUserPhrases.js.map +1 -0
  583. package/dist/verificationUserPhrases.test.d.ts +2 -0
  584. package/dist/verificationUserPhrases.test.d.ts.map +1 -0
  585. package/dist/verificationUserPhrases.test.js +47 -0
  586. package/dist/verificationUserPhrases.test.js.map +1 -0
  587. package/dist/verifyRunBundleSignature.d.ts +14 -0
  588. package/dist/verifyRunBundleSignature.d.ts.map +1 -0
  589. package/dist/verifyRunBundleSignature.js +139 -0
  590. package/dist/verifyRunBundleSignature.js.map +1 -0
  591. package/dist/verifyRunBundleSignature.test.d.ts +2 -0
  592. package/dist/verifyRunBundleSignature.test.d.ts.map +1 -0
  593. package/dist/verifyRunBundleSignature.test.js +169 -0
  594. package/dist/verifyRunBundleSignature.test.js.map +1 -0
  595. package/dist/wireReasonCodes.d.ts +57 -0
  596. package/dist/wireReasonCodes.d.ts.map +1 -0
  597. package/dist/wireReasonCodes.js +57 -0
  598. package/dist/wireReasonCodes.js.map +1 -0
  599. package/dist/wireReasonEmittersGuard.test.d.ts +2 -0
  600. package/dist/wireReasonEmittersGuard.test.d.ts.map +1 -0
  601. package/dist/wireReasonEmittersGuard.test.js +36 -0
  602. package/dist/wireReasonEmittersGuard.test.js.map +1 -0
  603. package/dist/withWorkflowVerification.persistBundle.test.d.ts +2 -0
  604. package/dist/withWorkflowVerification.persistBundle.test.d.ts.map +1 -0
  605. package/dist/withWorkflowVerification.persistBundle.test.js +104 -0
  606. package/dist/withWorkflowVerification.persistBundle.test.js.map +1 -0
  607. package/dist/workflowResultNormalize.d.ts +9 -0
  608. package/dist/workflowResultNormalize.d.ts.map +1 -0
  609. package/dist/workflowResultNormalize.js +40 -0
  610. package/dist/workflowResultNormalize.js.map +1 -0
  611. package/dist/workflowResultSignature.d.ts +8 -0
  612. package/dist/workflowResultSignature.d.ts.map +1 -0
  613. package/dist/workflowResultSignature.js +44 -0
  614. package/dist/workflowResultSignature.js.map +1 -0
  615. package/dist/workflowRunLevelConsistency.d.ts +5 -0
  616. package/dist/workflowRunLevelConsistency.d.ts.map +1 -0
  617. package/dist/workflowRunLevelConsistency.js +30 -0
  618. package/dist/workflowRunLevelConsistency.js.map +1 -0
  619. package/dist/workflowTruthReport.d.ts +24 -0
  620. package/dist/workflowTruthReport.d.ts.map +1 -0
  621. package/dist/workflowTruthReport.js +395 -0
  622. package/dist/workflowTruthReport.js.map +1 -0
  623. package/dist/workflowTruthReport.semantics.test.d.ts +2 -0
  624. package/dist/workflowTruthReport.semantics.test.d.ts.map +1 -0
  625. package/dist/workflowTruthReport.semantics.test.js +182 -0
  626. package/dist/workflowTruthReport.semantics.test.js.map +1 -0
  627. package/dist/workflowVerdictSurface.test.d.ts +2 -0
  628. package/dist/workflowVerdictSurface.test.d.ts.map +1 -0
  629. package/dist/workflowVerdictSurface.test.js +68 -0
  630. package/dist/workflowVerdictSurface.test.js.map +1 -0
  631. package/dist/writeRunBundleCli.d.ts +9 -0
  632. package/dist/writeRunBundleCli.d.ts.map +1 -0
  633. package/dist/writeRunBundleCli.js +28 -0
  634. package/dist/writeRunBundleCli.js.map +1 -0
  635. package/package.json +115 -0
  636. package/schemas/agent-run-record-v1.schema.json +51 -0
  637. package/schemas/agent-run-record-v2.schema.json +61 -0
  638. package/schemas/assurance-manifest-v1.schema.json +28 -0
  639. package/schemas/assurance-run-report-v1.schema.json +28 -0
  640. package/schemas/ci-lock-v1.schema.json +163 -0
  641. package/schemas/cli-error-envelope.schema.json +48 -0
  642. package/schemas/event.schema.json +111 -0
  643. package/schemas/execution-trace-view.schema.json +122 -0
  644. package/schemas/openapi-commercial-v1.in.yaml +215 -0
  645. package/schemas/openapi-commercial-v1.yaml +215 -0
  646. package/schemas/plan-validation-core.schema.json +95 -0
  647. package/schemas/public-verification-report-v1.schema.json +51 -0
  648. package/schemas/quick-verify-report.schema.json +251 -0
  649. package/schemas/registry-validation-result.schema.json +99 -0
  650. package/schemas/run-comparison-report.schema.json +513 -0
  651. package/schemas/tools-registry-export.schema.json +9 -0
  652. package/schemas/tools-registry.schema.json +284 -0
  653. package/schemas/workflow-engine-result.schema.json +591 -0
  654. package/schemas/workflow-result-compare-input.schema.json +15 -0
  655. package/schemas/workflow-result-signature.schema.json +20 -0
  656. package/schemas/workflow-result-v9.schema.json +85 -0
  657. package/schemas/workflow-result.schema.json +80 -0
  658. package/schemas/workflow-truth-report.schema.json +761 -0
  659. package/scripts/discovery-acquisition.lib.cjs +195 -0
  660. package/scripts/discovery-payload.lib.cjs +346 -0
  661. package/scripts/render-discovery-ci.mjs +103 -0
@@ -0,0 +1,956 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { writeFileSync, mkdirSync, readFileSync, mkdtempSync } from "node:fs";
3
+ import { tmpdir } from "node:os";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { describe, expect, it } from "vitest";
7
+ import { CLI_OPERATIONAL_CODES } from "./cliOperationalCodes.js";
8
+ import { loadSchemaValidator } from "./schemaLoad.js";
9
+ import { TruthLayerError } from "./truthLayerError.js";
10
+ import { buildPlanTransitionEventsNdjson, buildPlanTransitionWorkflowResult, evaluatePlanRules, loadPlanTransitionRules, parseGitNameStatusZ, parseGitVersionTriple, PLAN_RULE_CODES, preflightAllPlanPatterns, preflightPatternString, } from "./planTransition.js";
11
+ import { PLAN_TRANSITION_WORKFLOW_ID } from "./planTransitionConstants.js";
12
+ const root = path.join(path.dirname(fileURLToPath(import.meta.url)), "..");
13
+ /** Mirrors `DERIVED_CITATION_REQUIRE_ROW_KINDS` in planTransition.ts (derived citation obligations). */
14
+ const DERIVED_REQUIRE_MATCH_ROW_KINDS = [
15
+ "add",
16
+ "modify",
17
+ "delete",
18
+ "rename",
19
+ "copy",
20
+ "type_change",
21
+ ];
22
+ function gitConfig(repo) {
23
+ execFileSync("git", ["-C", repo, "config", "user.email", "pt@test.local"], { windowsHide: true });
24
+ execFileSync("git", ["-C", repo, "config", "user.name", "PlanTransition Test"], { windowsHide: true });
25
+ }
26
+ describe("planTransition", () => {
27
+ it("parseGitVersionTriple parses semver prefix", () => {
28
+ expect(parseGitVersionTriple("git version 2.43.0.windows.1")).toEqual([2, 43, 0]);
29
+ expect(parseGitVersionTriple("git version 2.30.0")).toEqual([2, 30, 0]);
30
+ expect(parseGitVersionTriple("git version 2.29.0")).toEqual([2, 29, 0]);
31
+ expect(parseGitVersionTriple("bogus")).toBeNull();
32
+ });
33
+ it("parseGitNameStatusZ parses golden NUL buffers per status class", () => {
34
+ const cases = [
35
+ {
36
+ buf: Buffer.from("A\0f.txt\0", "utf8"),
37
+ want: [{ rowKind: "add", paths: ["f.txt"] }],
38
+ },
39
+ {
40
+ buf: Buffer.from("M\0m.txt\0", "utf8"),
41
+ want: [{ rowKind: "modify", paths: ["m.txt"] }],
42
+ },
43
+ {
44
+ buf: Buffer.from("D\0d.txt\0", "utf8"),
45
+ want: [{ rowKind: "delete", paths: ["d.txt"] }],
46
+ },
47
+ {
48
+ buf: Buffer.from("T\0t.txt\0", "utf8"),
49
+ want: [{ rowKind: "type_change", paths: ["t.txt"] }],
50
+ },
51
+ {
52
+ buf: Buffer.from("U\0u.txt\0", "utf8"),
53
+ want: [{ rowKind: "unmerged", paths: ["u.txt"] }],
54
+ },
55
+ {
56
+ buf: Buffer.from("R100\0old/path.txt\0new/path.txt\0", "utf8"),
57
+ want: [{ rowKind: "rename", paths: ["old/path.txt", "new/path.txt"] }],
58
+ },
59
+ {
60
+ buf: Buffer.from("C095\0src/original.ts\0src/copy.ts\0", "utf8"),
61
+ want: [{ rowKind: "copy", paths: ["src/original.ts", "src/copy.ts"] }],
62
+ },
63
+ ];
64
+ for (const { buf, want } of cases) {
65
+ expect(parseGitNameStatusZ(buf)).toEqual(want);
66
+ }
67
+ });
68
+ it("parseGitNameStatusZ rejects unknown status", () => {
69
+ expect(() => parseGitNameStatusZ(Buffer.from("X\0a\0", "utf8"))).toThrow(TruthLayerError);
70
+ });
71
+ it("requireRenameFromTo includeCopy true vs false on injected copy row", () => {
72
+ const rows = [{ rowKind: "copy", paths: ["src/original.ts", "src/copy.ts"] }];
73
+ const okRule = {
74
+ id: "r1",
75
+ kind: "requireRenameFromTo",
76
+ fromPattern: "src/original.ts",
77
+ toPattern: "src/copy.ts",
78
+ includeCopy: true,
79
+ };
80
+ const badRule = { ...okRule, includeCopy: false };
81
+ expect(evaluatePlanRules(rows, [okRule])[0]?.status).toBe("verified");
82
+ expect(evaluatePlanRules(rows, [badRule])[0]?.status).toBe("inconsistent");
83
+ expect(evaluatePlanRules(rows, [badRule])[0]?.reasons[0]?.code).toBe(PLAN_RULE_CODES.RENAME_MISMATCH);
84
+ });
85
+ it("matchingRowsMustHaveRowKinds fails on add when modify required", () => {
86
+ const rows = [{ rowKind: "add", paths: ["x.txt"] }];
87
+ const rule = {
88
+ id: "r1",
89
+ kind: "matchingRowsMustHaveRowKinds",
90
+ pattern: "x.txt",
91
+ rowKinds: ["modify"],
92
+ };
93
+ const step = evaluatePlanRules(rows, [rule])[0];
94
+ expect(step.status).toBe("inconsistent");
95
+ expect(step.reasons[0]?.code).toBe(PLAN_RULE_CODES.ROW_KIND_MISMATCH);
96
+ });
97
+ it("evaluatePlanRules: foreign path fails when every changed path must match pattern set", () => {
98
+ const rows = [
99
+ { rowKind: "modify", paths: ["good.txt"] },
100
+ { rowKind: "add", paths: ["evil.txt"] },
101
+ ];
102
+ const rule = {
103
+ id: "r1",
104
+ kind: "allChangedPathsMustMatchAllowlist",
105
+ allowPatterns: ["good.txt"],
106
+ };
107
+ expect(evaluatePlanRules(rows, [rule])[0]?.status).toBe("inconsistent");
108
+ expect(evaluatePlanRules(rows, [rule])[0]?.reasons[0]?.code).toBe(PLAN_RULE_CODES.ALLOWLIST_VIOLATION);
109
+ });
110
+ it("every-path-must-match-patterns rule fails rename when destination outside pattern set", () => {
111
+ const rows = [{ rowKind: "rename", paths: ["allowed/old.txt", "outside/new.txt"] }];
112
+ const rule = {
113
+ id: "r1",
114
+ kind: "allChangedPathsMustMatchAllowlist",
115
+ allowPatterns: ["allowed/**"],
116
+ };
117
+ expect(evaluatePlanRules(rows, [rule])[0]?.status).toBe("inconsistent");
118
+ });
119
+ it("preflightPatternString rejects ..", () => {
120
+ expect(() => preflightPatternString("../x", "p")).toThrow(TruthLayerError);
121
+ });
122
+ it("preflightAllPlanPatterns labels allowPatterns by rule index and array index", () => {
123
+ const rules = [
124
+ { id: "r0", kind: "forbidMatchingRows", pattern: "safe" },
125
+ {
126
+ id: "r1",
127
+ kind: "allChangedPathsMustMatchAllowlist",
128
+ allowPatterns: ["ok/**", "../evil"],
129
+ },
130
+ ];
131
+ try {
132
+ preflightAllPlanPatterns(rules);
133
+ expect.fail("expected TruthLayerError");
134
+ }
135
+ catch (e) {
136
+ expect(e).toBeInstanceOf(TruthLayerError);
137
+ expect(e.message).toContain("rules[1].allowPatterns[1]");
138
+ expect(e.message).not.toContain("rules[2]");
139
+ }
140
+ });
141
+ it("plan-validation-core schema rejects requireRenameFromTo without includeCopy", () => {
142
+ const v = loadSchemaValidator("plan-validation-core");
143
+ const bad = {
144
+ schemaVersion: 1,
145
+ rules: [
146
+ {
147
+ id: "x",
148
+ kind: "requireRenameFromTo",
149
+ fromPattern: "a",
150
+ toPattern: "b",
151
+ },
152
+ ],
153
+ };
154
+ expect(v(bad)).toBe(false);
155
+ });
156
+ it("buildPlanTransitionEventsNdjson validates against event schema", () => {
157
+ const v = loadSchemaValidator("event");
158
+ const buf = buildPlanTransitionEventsNdjson({
159
+ workflowId: PLAN_TRANSITION_WORKFLOW_ID,
160
+ beforeRef: "main~1",
161
+ afterRef: "main",
162
+ beforeCommitSha: "a".repeat(40),
163
+ afterCommitSha: "b".repeat(40),
164
+ planResolvedPath: path.join(root, "Plan.md"),
165
+ planSha256: "c".repeat(64),
166
+ transitionRulesSource: "front_matter",
167
+ });
168
+ const line = JSON.parse(buf.toString("utf8").trim());
169
+ expect(v(line)).toBe(true);
170
+ expect(line.params.transitionRulesSource).toBe("front_matter");
171
+ expect(line.params.beforeCommitSha).toHaveLength(40);
172
+ expect(line.params.planSha256).toHaveLength(64);
173
+ });
174
+ it("buildPlanTransitionEventsNdjson accepts transitionRulesSource derived_citations", () => {
175
+ const v = loadSchemaValidator("event");
176
+ const buf = buildPlanTransitionEventsNdjson({
177
+ workflowId: PLAN_TRANSITION_WORKFLOW_ID,
178
+ beforeRef: "main~1",
179
+ afterRef: "main",
180
+ beforeCommitSha: "a".repeat(40),
181
+ afterCommitSha: "b".repeat(40),
182
+ planResolvedPath: path.join(root, "Plan.md"),
183
+ planSha256: "c".repeat(64),
184
+ transitionRulesSource: "derived_citations",
185
+ });
186
+ const line = JSON.parse(buf.toString("utf8").trim());
187
+ expect(v(line)).toBe(true);
188
+ expect(line.params.transitionRulesSource).toBe("derived_citations");
189
+ });
190
+ it("git subprocess: modify file with space in name matches parser", () => {
191
+ const dir = mkdtempSync(path.join(tmpdir(), "plan-tr-"));
192
+ execFileSync("git", ["init", dir], { windowsHide: true });
193
+ gitConfig(dir);
194
+ writeFileSync(path.join(dir, "a b.txt"), "1");
195
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
196
+ execFileSync("git", ["-C", dir, "commit", "-m", "c1"], { windowsHide: true });
197
+ writeFileSync(path.join(dir, "a b.txt"), "2");
198
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
199
+ execFileSync("git", ["-C", dir, "commit", "-m", "c2"], { windowsHide: true });
200
+ const h1 = execFileSync("git", ["-C", dir, "rev-parse", "HEAD~1"], { encoding: "utf8", windowsHide: true }).trim();
201
+ const h2 = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
202
+ const buf = execFileSync("git", ["-C", dir, "diff", "--no-ext-diff", "-z", "--name-status", `${h1}..${h2}`], {
203
+ windowsHide: true,
204
+ });
205
+ const rows = parseGitNameStatusZ(buf);
206
+ expect(rows.length).toBe(1);
207
+ expect(rows[0]?.rowKind).toBe("modify");
208
+ expect(rows[0]?.paths[0]).toBe("a b.txt");
209
+ }, 20_000);
210
+ it("integration: buildPlanTransitionWorkflowResult with Plan.md and two commits", () => {
211
+ const dir = mkdtempSync(path.join(tmpdir(), "plan-tr-int-"));
212
+ execFileSync("git", ["init", dir], { windowsHide: true });
213
+ gitConfig(dir);
214
+ mkdirSync(path.join(dir, "src"), { recursive: true });
215
+ writeFileSync(path.join(dir, "src", "x.txt"), "a");
216
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
217
+ execFileSync("git", ["-C", dir, "commit", "-m", "base"], { windowsHide: true });
218
+ const before = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
219
+ writeFileSync(path.join(dir, "src", "x.txt"), "b");
220
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
221
+ execFileSync("git", ["-C", dir, "commit", "-m", "chg"], { windowsHide: true });
222
+ const after = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
223
+ const planBody = `---
224
+ planValidation:
225
+ schemaVersion: 1
226
+ rules:
227
+ - id: must_modify
228
+ kind: matchingRowsMustHaveRowKinds
229
+ pattern: "src/x.txt"
230
+ rowKinds: [modify]
231
+ ---
232
+ # Plan
233
+ `;
234
+ const planPath = path.join(dir, "Plan.md");
235
+ writeFileSync(planPath, planBody, "utf8");
236
+ const { workflowResult: result } = buildPlanTransitionWorkflowResult({
237
+ repoRoot: dir,
238
+ beforeRef: before,
239
+ afterRef: after,
240
+ planPath,
241
+ workflowId: PLAN_TRANSITION_WORKFLOW_ID,
242
+ });
243
+ expect(result.workflowId).toBe(PLAN_TRANSITION_WORKFLOW_ID);
244
+ expect(result.status).toBe("complete");
245
+ expect(result.steps.length).toBe(1);
246
+ expect(result.steps[0]?.status).toBe("verified");
247
+ }, 20_000);
248
+ it("picomatch ** matches nested path for every-path-must-match-patterns rule", () => {
249
+ const rows = [{ rowKind: "modify", paths: ["src/nested/foo.ts"] }];
250
+ const rule = {
251
+ id: "r1",
252
+ kind: "allChangedPathsMustMatchAllowlist",
253
+ allowPatterns: ["src/**/*.ts"],
254
+ };
255
+ expect(evaluatePlanRules(rows, [rule])[0]?.status).toBe("verified");
256
+ });
257
+ it("evaluatePlanRules: requireMatchingRow is inconsistent when diff rows are empty", () => {
258
+ const rows = [];
259
+ const rule = {
260
+ id: "r1",
261
+ kind: "requireMatchingRow",
262
+ pattern: "any/path.ts",
263
+ rowKinds: ["modify"],
264
+ };
265
+ const step = evaluatePlanRules(rows, [rule])[0];
266
+ expect(step.status).toBe("inconsistent");
267
+ expect(step.reasons[0]?.code).toBe(PLAN_RULE_CODES.REQUIRED_ROW_MISSING);
268
+ });
269
+ it("integration: git mv satisfies requireRenameFromTo", () => {
270
+ const dir = mkdtempSync(path.join(tmpdir(), "plan-tr-mv-"));
271
+ execFileSync("git", ["init", dir], { windowsHide: true });
272
+ gitConfig(dir);
273
+ writeFileSync(path.join(dir, "old.txt"), "a");
274
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
275
+ execFileSync("git", ["-C", dir, "commit", "-m", "base"], { windowsHide: true });
276
+ const before = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
277
+ execFileSync("git", ["-C", dir, "mv", "old.txt", "new.txt"], { windowsHide: true });
278
+ execFileSync("git", ["-C", dir, "commit", "-m", "mv"], { windowsHide: true });
279
+ const after = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
280
+ const planBody = `---
281
+ planValidation:
282
+ schemaVersion: 1
283
+ rules:
284
+ - id: renamed
285
+ kind: requireRenameFromTo
286
+ fromPattern: "old.txt"
287
+ toPattern: "new.txt"
288
+ includeCopy: false
289
+ ---
290
+ `;
291
+ const planPath = path.join(dir, "Plan.md");
292
+ writeFileSync(planPath, planBody, "utf8");
293
+ const { workflowResult: result } = buildPlanTransitionWorkflowResult({
294
+ repoRoot: dir,
295
+ beforeRef: before,
296
+ afterRef: after,
297
+ planPath,
298
+ });
299
+ expect(result.status).toBe("complete");
300
+ expect(result.steps[0]?.status).toBe("verified");
301
+ }, 20_000);
302
+ it("integration: add file fails when rule requires modify only", () => {
303
+ const dir = mkdtempSync(path.join(tmpdir(), "plan-tr-add-"));
304
+ execFileSync("git", ["init", dir], { windowsHide: true });
305
+ gitConfig(dir);
306
+ writeFileSync(path.join(dir, "x.txt"), "a");
307
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
308
+ execFileSync("git", ["-C", dir, "commit", "-m", "base"], { windowsHide: true });
309
+ const before = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
310
+ writeFileSync(path.join(dir, "y.txt"), "new");
311
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
312
+ execFileSync("git", ["-C", dir, "commit", "-m", "add"], { windowsHide: true });
313
+ const after = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
314
+ const planBody = `---
315
+ planValidation:
316
+ schemaVersion: 1
317
+ rules:
318
+ - id: y_must_be_modify
319
+ kind: matchingRowsMustHaveRowKinds
320
+ pattern: "y.txt"
321
+ rowKinds: [modify]
322
+ ---
323
+ `;
324
+ const planPath = path.join(dir, "Plan.md");
325
+ writeFileSync(planPath, planBody, "utf8");
326
+ const { workflowResult: result } = buildPlanTransitionWorkflowResult({
327
+ repoRoot: dir,
328
+ beforeRef: before,
329
+ afterRef: after,
330
+ planPath,
331
+ });
332
+ expect(result.status).toBe("inconsistent");
333
+ expect(result.steps[0]?.status).toBe("inconsistent");
334
+ }, 20_000);
335
+ it("integration: body-section yaml rules match FM equivalent for modify", () => {
336
+ const dir = mkdtempSync(path.join(tmpdir(), "plan-tr-body-"));
337
+ execFileSync("git", ["init", dir], { windowsHide: true });
338
+ gitConfig(dir);
339
+ mkdirSync(path.join(dir, "src"), { recursive: true });
340
+ writeFileSync(path.join(dir, "src", "x.txt"), "a");
341
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
342
+ execFileSync("git", ["-C", dir, "commit", "-m", "base"], { windowsHide: true });
343
+ const before = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
344
+ writeFileSync(path.join(dir, "src", "x.txt"), "b");
345
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
346
+ execFileSync("git", ["-C", dir, "commit", "-m", "chg"], { windowsHide: true });
347
+ const after = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
348
+ const planBody = `---
349
+ name: Cursor plan
350
+ overview: test
351
+ ---
352
+ ## Repository transition validation
353
+ \`\`\`yaml
354
+ schemaVersion: 1
355
+ rules:
356
+ - id: must_modify
357
+ kind: matchingRowsMustHaveRowKinds
358
+ pattern: "src/x.txt"
359
+ rowKinds: [modify]
360
+ \`\`\`
361
+ `;
362
+ const planPath = path.join(dir, "Plan.md");
363
+ writeFileSync(planPath, planBody, "utf8");
364
+ const { workflowResult: result, transitionRulesProvenance } = buildPlanTransitionWorkflowResult({
365
+ repoRoot: dir,
366
+ beforeRef: before,
367
+ afterRef: after,
368
+ planPath,
369
+ workflowId: PLAN_TRANSITION_WORKFLOW_ID,
370
+ });
371
+ expect(transitionRulesProvenance).toBe("body_section");
372
+ expect(result.status).toBe("complete");
373
+ expect(result.steps[0]?.status).toBe("verified");
374
+ }, 20_000);
375
+ it("integration: FM planValidation wins over duplicate body headings and yaml", () => {
376
+ const dir = mkdtempSync(path.join(tmpdir(), "plan-tr-fmwin-"));
377
+ execFileSync("git", ["init", dir], { windowsHide: true });
378
+ gitConfig(dir);
379
+ mkdirSync(path.join(dir, "src"), { recursive: true });
380
+ writeFileSync(path.join(dir, "src", "x.txt"), "a");
381
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
382
+ execFileSync("git", ["-C", dir, "commit", "-m", "base"], { windowsHide: true });
383
+ const before = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
384
+ writeFileSync(path.join(dir, "src", "x.txt"), "b");
385
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
386
+ execFileSync("git", ["-C", dir, "commit", "-m", "chg"], { windowsHide: true });
387
+ const after = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
388
+ const planBody = `---
389
+ planValidation:
390
+ schemaVersion: 1
391
+ rules:
392
+ - id: must_modify
393
+ kind: matchingRowsMustHaveRowKinds
394
+ pattern: "src/x.txt"
395
+ rowKinds: [modify]
396
+ ---
397
+ ## Repository transition validation
398
+ ## Repository transition validation
399
+ \`\`\`yaml
400
+ schemaVersion: 1
401
+ rules:
402
+ - id: forbid_all
403
+ kind: forbidMatchingRows
404
+ pattern: "**/*"
405
+ \`\`\`
406
+ `;
407
+ const planPath = path.join(dir, "Plan.md");
408
+ writeFileSync(planPath, planBody, "utf8");
409
+ const { workflowResult: result, transitionRulesProvenance } = buildPlanTransitionWorkflowResult({
410
+ repoRoot: dir,
411
+ beforeRef: before,
412
+ afterRef: after,
413
+ planPath,
414
+ });
415
+ expect(transitionRulesProvenance).toBe("front_matter");
416
+ expect(result.status).toBe("complete");
417
+ expect(result.steps[0]?.status).toBe("verified");
418
+ }, 20_000);
419
+ it("integration: FM rules used when body would forbid all paths", () => {
420
+ const dir = mkdtempSync(path.join(tmpdir(), "plan-tr-prec-"));
421
+ execFileSync("git", ["init", dir], { windowsHide: true });
422
+ gitConfig(dir);
423
+ mkdirSync(path.join(dir, "src"), { recursive: true });
424
+ writeFileSync(path.join(dir, "src", "x.txt"), "a");
425
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
426
+ execFileSync("git", ["-C", dir, "commit", "-m", "base"], { windowsHide: true });
427
+ const before = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
428
+ writeFileSync(path.join(dir, "src", "x.txt"), "b");
429
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
430
+ execFileSync("git", ["-C", dir, "commit", "-m", "chg"], { windowsHide: true });
431
+ const after = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
432
+ const planBody = `---
433
+ planValidation:
434
+ schemaVersion: 1
435
+ rules:
436
+ - id: must_modify
437
+ kind: matchingRowsMustHaveRowKinds
438
+ pattern: "src/x.txt"
439
+ rowKinds: [modify]
440
+ ---
441
+ ## Repository transition validation
442
+ \`\`\`yaml
443
+ schemaVersion: 1
444
+ rules:
445
+ - id: forbid_all
446
+ kind: forbidMatchingRows
447
+ pattern: "**/*"
448
+ \`\`\`
449
+ `;
450
+ const planPath = path.join(dir, "Plan.md");
451
+ writeFileSync(planPath, planBody, "utf8");
452
+ const { workflowResult: result } = buildPlanTransitionWorkflowResult({
453
+ repoRoot: dir,
454
+ beforeRef: before,
455
+ afterRef: after,
456
+ planPath,
457
+ });
458
+ expect(result.status).toBe("complete");
459
+ expect(result.steps[0]?.status).toBe("verified");
460
+ }, 20_000);
461
+ it("integration: derived_citations passes when diff only touches cited file", () => {
462
+ const dir = mkdtempSync(path.join(tmpdir(), "plan-tr-derived-pass-"));
463
+ execFileSync("git", ["init", dir], { windowsHide: true });
464
+ gitConfig(dir);
465
+ mkdirSync(path.join(dir, "src"), { recursive: true });
466
+ writeFileSync(path.join(dir, "src", "tracked.ts"), "a");
467
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
468
+ execFileSync("git", ["-C", dir, "commit", "-m", "base"], { windowsHide: true });
469
+ const before = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
470
+ writeFileSync(path.join(dir, "src", "tracked.ts"), "b");
471
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
472
+ execFileSync("git", ["-C", dir, "commit", "-m", "chg"], { windowsHide: true });
473
+ const after = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
474
+ const planBody = `---
475
+ name: Plan
476
+ overview: x
477
+ isProject: false
478
+ ---
479
+
480
+ # Work
481
+
482
+ ## Implementation
483
+
484
+ Change \`src/tracked.ts\`.
485
+ `;
486
+ const planPath = path.join(dir, "Plan.md");
487
+ writeFileSync(planPath, planBody, "utf8");
488
+ const { workflowResult: result, transitionRulesProvenance } = buildPlanTransitionWorkflowResult({
489
+ repoRoot: dir,
490
+ beforeRef: before,
491
+ afterRef: after,
492
+ planPath,
493
+ });
494
+ expect(transitionRulesProvenance).toBe("derived_citations");
495
+ expect(result.status).toBe("complete");
496
+ expect(result.steps.length).toBe(1);
497
+ expect(result.steps[0]?.status).toBe("verified");
498
+ }, 20_000);
499
+ it("integration: derived_citations passes when diff adds uncited file if cited path changes", () => {
500
+ const dir = mkdtempSync(path.join(tmpdir(), "plan-tr-derived-fail-"));
501
+ execFileSync("git", ["init", dir], { windowsHide: true });
502
+ gitConfig(dir);
503
+ mkdirSync(path.join(dir, "src"), { recursive: true });
504
+ writeFileSync(path.join(dir, "src", "tracked.ts"), "a");
505
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
506
+ execFileSync("git", ["-C", dir, "commit", "-m", "base"], { windowsHide: true });
507
+ const before = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
508
+ writeFileSync(path.join(dir, "src", "tracked.ts"), "b");
509
+ writeFileSync(path.join(dir, "z_uncited.txt"), "x");
510
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
511
+ execFileSync("git", ["-C", dir, "commit", "-m", "chg"], { windowsHide: true });
512
+ const after = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
513
+ const planBody = `---
514
+ name: Plan
515
+ overview: x
516
+ isProject: false
517
+ ---
518
+
519
+ # Work
520
+
521
+ ## Implementation
522
+
523
+ Change \`src/tracked.ts\`.
524
+ `;
525
+ const planPath = path.join(dir, "Plan.md");
526
+ writeFileSync(planPath, planBody, "utf8");
527
+ const { workflowResult: result, transitionRulesProvenance } = buildPlanTransitionWorkflowResult({
528
+ repoRoot: dir,
529
+ beforeRef: before,
530
+ afterRef: after,
531
+ planPath,
532
+ });
533
+ expect(transitionRulesProvenance).toBe("derived_citations");
534
+ expect(result.status).toBe("complete");
535
+ expect(result.steps.length).toBe(1);
536
+ expect(result.steps.every((s) => s.status === "verified")).toBe(true);
537
+ }, 20_000);
538
+ it("integration: derived_citations fails when only uncited path changes", () => {
539
+ const dir = mkdtempSync(path.join(tmpdir(), "plan-tr-derived-uncited-only-"));
540
+ execFileSync("git", ["init", dir], { windowsHide: true });
541
+ gitConfig(dir);
542
+ mkdirSync(path.join(dir, "src"), { recursive: true });
543
+ writeFileSync(path.join(dir, "src", "tracked.ts"), "a");
544
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
545
+ execFileSync("git", ["-C", dir, "commit", "-m", "base"], { windowsHide: true });
546
+ const before = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
547
+ writeFileSync(path.join(dir, "z_extra.txt"), "x");
548
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
549
+ execFileSync("git", ["-C", dir, "commit", "-m", "add uncited only"], { windowsHide: true });
550
+ const after = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
551
+ const planBody = `---
552
+ name: Plan
553
+ overview: x
554
+ isProject: false
555
+ ---
556
+
557
+ # Work
558
+
559
+ ## Implementation
560
+
561
+ Change \`src/tracked.ts\`.
562
+ `;
563
+ const planPath = path.join(dir, "Plan.md");
564
+ writeFileSync(planPath, planBody, "utf8");
565
+ const { workflowResult: result, transitionRulesProvenance } = buildPlanTransitionWorkflowResult({
566
+ repoRoot: dir,
567
+ beforeRef: before,
568
+ afterRef: after,
569
+ planPath,
570
+ });
571
+ expect(transitionRulesProvenance).toBe("derived_citations");
572
+ expect(result.status).toBe("inconsistent");
573
+ expect(result.steps.length).toBe(1);
574
+ expect(result.steps[0]?.status).toBe("inconsistent");
575
+ expect(result.steps[0]?.reasons[0]?.code).toBe(PLAN_RULE_CODES.REQUIRED_ROW_MISSING);
576
+ }, 20_000);
577
+ });
578
+ describe("loadPlanTransitionRules", () => {
579
+ it("Cursor-like front matter without planValidation and no citations yields INSUFFICIENT_SPEC", () => {
580
+ const md = `---
581
+ name: Example plan
582
+ overview: x
583
+ todos: []
584
+ isProject: false
585
+ ---
586
+
587
+ # Body
588
+ `;
589
+ try {
590
+ loadPlanTransitionRules(md);
591
+ expect.fail("expected TruthLayerError");
592
+ }
593
+ catch (e) {
594
+ expect(e).toBeInstanceOf(TruthLayerError);
595
+ expect(e.code).toBe(CLI_OPERATIONAL_CODES.PLAN_VALIDATION_INSUFFICIENT_SPEC);
596
+ }
597
+ });
598
+ it("derived_citations: zero Repository transition heading and one backtick path yields requireMatchingRow rules", () => {
599
+ const md = `---
600
+ name: Example plan
601
+ overview: x
602
+ isProject: false
603
+ ---
604
+
605
+ # Body
606
+
607
+ ## Implementation
608
+
609
+ Change \`src/only.ts\`.
610
+ `;
611
+ const { rules, source } = loadPlanTransitionRules(md);
612
+ expect(source).toBe("derived_citations");
613
+ expect(rules).toEqual([
614
+ {
615
+ id: "derived.require.0",
616
+ kind: "requireMatchingRow",
617
+ pattern: "src/only.ts",
618
+ rowKinds: [...DERIVED_REQUIRE_MATCH_ROW_KINDS],
619
+ },
620
+ ]);
621
+ });
622
+ it("derived_citations: two backtick paths yield two requireMatchingRow rules in path sort order", () => {
623
+ const md = `---
624
+ name: Example plan
625
+ overview: x
626
+ isProject: false
627
+ ---
628
+
629
+ # Body
630
+
631
+ ## Implementation
632
+
633
+ Touch \`src/a.ts\` and \`src/b.ts\`.
634
+ `;
635
+ const { rules, source } = loadPlanTransitionRules(md);
636
+ expect(source).toBe("derived_citations");
637
+ expect(rules.length).toBe(2);
638
+ expect(rules[0]).toEqual({
639
+ id: "derived.require.0",
640
+ kind: "requireMatchingRow",
641
+ pattern: "src/a.ts",
642
+ rowKinds: [...DERIVED_REQUIRE_MATCH_ROW_KINDS],
643
+ });
644
+ expect(rules[1]).toEqual({
645
+ id: "derived.require.1",
646
+ kind: "requireMatchingRow",
647
+ pattern: "src/b.ts",
648
+ rowKinds: [...DERIVED_REQUIRE_MATCH_ROW_KINDS],
649
+ });
650
+ });
651
+ it("duplicate Repository transition validation headings yield AMBIGUOUS_BODY_RULES", () => {
652
+ const md = `---
653
+ name: x
654
+ ---
655
+ ## Repository transition validation
656
+ x
657
+ ## Repository transition validation
658
+ y
659
+ `;
660
+ try {
661
+ loadPlanTransitionRules(md);
662
+ expect.fail("expected TruthLayerError");
663
+ }
664
+ catch (e) {
665
+ expect(e).toBeInstanceOf(TruthLayerError);
666
+ expect(e.code).toBe(CLI_OPERATIONAL_CODES.PLAN_VALIDATION_AMBIGUOUS_BODY_RULES);
667
+ }
668
+ });
669
+ it("first fence not yaml yields INSUFFICIENT_SPEC", () => {
670
+ const md = `---
671
+ name: x
672
+ ---
673
+ ## Repository transition validation
674
+ \`\`\`json
675
+ {}
676
+ \`\`\`
677
+ `;
678
+ try {
679
+ loadPlanTransitionRules(md);
680
+ expect.fail("expected TruthLayerError");
681
+ }
682
+ catch (e) {
683
+ expect(e).toBeInstanceOf(TruthLayerError);
684
+ expect(e.code).toBe(CLI_OPERATIONAL_CODES.PLAN_VALIDATION_INSUFFICIENT_SPEC);
685
+ }
686
+ });
687
+ it("two yaml fences in section yield AMBIGUOUS_BODY_RULES", () => {
688
+ const md = `---
689
+ name: x
690
+ ---
691
+ ## Repository transition validation
692
+ \`\`\`yaml
693
+ schemaVersion: 1
694
+ rules: []
695
+ \`\`\`
696
+ \`\`\`yaml
697
+ schemaVersion: 1
698
+ rules: []
699
+ \`\`\`
700
+ `;
701
+ try {
702
+ loadPlanTransitionRules(md);
703
+ expect.fail("expected TruthLayerError");
704
+ }
705
+ catch (e) {
706
+ expect(e).toBeInstanceOf(TruthLayerError);
707
+ expect(e.code).toBe(CLI_OPERATIONAL_CODES.PLAN_VALIDATION_AMBIGUOUS_BODY_RULES);
708
+ }
709
+ });
710
+ it("invalid yaml in body fence yields PLAN_VALIDATION_YAML_INVALID with body prefix", () => {
711
+ const md = `---
712
+ name: x
713
+ ---
714
+ ## Repository transition validation
715
+ \`\`\`yaml
716
+ schemaVersion: 1
717
+ rules: [oops not closed
718
+ \`\`\`
719
+ `;
720
+ try {
721
+ loadPlanTransitionRules(md);
722
+ expect.fail("expected TruthLayerError");
723
+ }
724
+ catch (e) {
725
+ expect(e).toBeInstanceOf(TruthLayerError);
726
+ expect(e.code).toBe(CLI_OPERATIONAL_CODES.PLAN_VALIDATION_YAML_INVALID);
727
+ expect(e.message).toContain("body Repository transition validation:");
728
+ }
729
+ });
730
+ it("body yaml valid but schema invalid yields SCHEMA_INVALID with body prefix", () => {
731
+ const md = `---
732
+ name: x
733
+ ---
734
+ ## Repository transition validation
735
+ \`\`\`yaml
736
+ schemaVersion: 1
737
+ rules:
738
+ - id: x
739
+ kind: requireRenameFromTo
740
+ fromPattern: a
741
+ toPattern: b
742
+ \`\`\`
743
+ `;
744
+ try {
745
+ loadPlanTransitionRules(md);
746
+ expect.fail("expected TruthLayerError");
747
+ }
748
+ catch (e) {
749
+ expect(e).toBeInstanceOf(TruthLayerError);
750
+ expect(e.code).toBe(CLI_OPERATIONAL_CODES.PLAN_VALIDATION_SCHEMA_INVALID);
751
+ expect(e.message.startsWith("body Repository transition validation:")).toBe(true);
752
+ }
753
+ });
754
+ it("planValidation in front matter wins over body path citations", () => {
755
+ const md = `---
756
+ planValidation:
757
+ schemaVersion: 1
758
+ rules:
759
+ - id: fm_rule
760
+ kind: forbidMatchingRows
761
+ pattern: "nope.txt"
762
+ ---
763
+
764
+ ## Implementation
765
+
766
+ Also \`src/ignored.ts\` in prose.
767
+ `;
768
+ const { rules, source } = loadPlanTransitionRules(md);
769
+ expect(source).toBe("front_matter");
770
+ expect(rules).toHaveLength(1);
771
+ expect(rules[0]?.id).toBe("fm_rule");
772
+ });
773
+ });
774
+ describe("plan-transition CLI", () => {
775
+ const cliJs = path.join(root, "dist", "cli.js");
776
+ it("plan-transition emits WorkflowResult JSON", () => {
777
+ const dir = mkdtempSync(path.join(tmpdir(), "plan-cli-"));
778
+ execFileSync("git", ["init", dir], { windowsHide: true });
779
+ execFileSync("git", ["-C", dir, "config", "user.email", "c@test"], { windowsHide: true });
780
+ execFileSync("git", ["-C", dir, "config", "user.name", "c"], { windowsHide: true });
781
+ writeFileSync(path.join(dir, "f.txt"), "1");
782
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
783
+ execFileSync("git", ["-C", dir, "commit", "-m", "a"], { windowsHide: true });
784
+ const b = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
785
+ writeFileSync(path.join(dir, "f.txt"), "2");
786
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
787
+ execFileSync("git", ["-C", dir, "commit", "-m", "b"], { windowsHide: true });
788
+ const a = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
789
+ const plan = `---
790
+ planValidation:
791
+ schemaVersion: 1
792
+ rules:
793
+ - id: r1
794
+ kind: forbidMatchingRows
795
+ pattern: "nonexistent.zzz"
796
+ ---
797
+ `;
798
+ const planPath = path.join(dir, "Plan.md");
799
+ writeFileSync(planPath, plan, "utf8");
800
+ const out = execFileSync(process.execPath, [cliJs, "plan-transition", "--repo", dir, "--before", b, "--after", a, "--plan", planPath, "--no-truth-report"], { encoding: "utf8", windowsHide: true });
801
+ const wf = JSON.parse(out.trim());
802
+ expect(wf.workflowId).toBe(PLAN_TRANSITION_WORKFLOW_ID);
803
+ expect(wf.status).toBe("complete");
804
+ }, 20_000);
805
+ it("plan-transition --write-run-bundle writes three artifacts", () => {
806
+ const dir = mkdtempSync(path.join(tmpdir(), "plan-bundle-"));
807
+ execFileSync("git", ["init", dir], { windowsHide: true });
808
+ execFileSync("git", ["-C", dir, "config", "user.email", "c@test"], { windowsHide: true });
809
+ execFileSync("git", ["-C", dir, "config", "user.name", "c"], { windowsHide: true });
810
+ writeFileSync(path.join(dir, "f.txt"), "1");
811
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
812
+ execFileSync("git", ["-C", dir, "commit", "-m", "a"], { windowsHide: true });
813
+ const b = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
814
+ writeFileSync(path.join(dir, "f.txt"), "2");
815
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
816
+ execFileSync("git", ["-C", dir, "commit", "-m", "b"], { windowsHide: true });
817
+ const a = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
818
+ const plan = `---
819
+ planValidation:
820
+ schemaVersion: 1
821
+ rules:
822
+ - id: noop
823
+ kind: forbidMatchingRows
824
+ pattern: "__no_such_path_plan_bundle__.txt"
825
+ ---
826
+ `;
827
+ const planPath = path.join(dir, "Plan.md");
828
+ writeFileSync(planPath, plan, "utf8");
829
+ const bundleDir = path.join(dir, "bundle-out");
830
+ mkdirSync(bundleDir, { recursive: true });
831
+ execFileSync(process.execPath, [
832
+ cliJs,
833
+ "plan-transition",
834
+ "--repo",
835
+ dir,
836
+ "--before",
837
+ b,
838
+ "--after",
839
+ a,
840
+ "--plan",
841
+ planPath,
842
+ "--no-truth-report",
843
+ "--write-run-bundle",
844
+ bundleDir,
845
+ ], { encoding: "utf8", windowsHide: true });
846
+ const ev = readFileSync(path.join(bundleDir, "events.ndjson"), "utf8");
847
+ const v = loadSchemaValidator("event");
848
+ const evLine = JSON.parse(ev.trim());
849
+ expect(v(evLine)).toBe(true);
850
+ expect(evLine.params.transitionRulesSource).toBe("front_matter");
851
+ const ar = JSON.parse(readFileSync(path.join(bundleDir, "agent-run.json"), "utf8"));
852
+ const vAr = loadSchemaValidator("agent-run-record-v1");
853
+ expect(vAr(ar)).toBe(true);
854
+ }, 20_000);
855
+ it("plan-transition --write-run-bundle sets transitionRulesSource body_section for body rules", () => {
856
+ const dir = mkdtempSync(path.join(tmpdir(), "plan-bundle-body-"));
857
+ execFileSync("git", ["init", dir], { windowsHide: true });
858
+ execFileSync("git", ["-C", dir, "config", "user.email", "c@test"], { windowsHide: true });
859
+ execFileSync("git", ["-C", dir, "config", "user.name", "c"], { windowsHide: true });
860
+ writeFileSync(path.join(dir, "f.txt"), "1");
861
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
862
+ execFileSync("git", ["-C", dir, "commit", "-m", "a"], { windowsHide: true });
863
+ const b = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
864
+ writeFileSync(path.join(dir, "f.txt"), "2");
865
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
866
+ execFileSync("git", ["-C", dir, "commit", "-m", "b"], { windowsHide: true });
867
+ const a = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
868
+ const plan = `---
869
+ name: p
870
+ ---
871
+ ## Repository transition validation
872
+ \`\`\`yaml
873
+ schemaVersion: 1
874
+ rules:
875
+ - id: noop
876
+ kind: forbidMatchingRows
877
+ pattern: "__no_such_path_plan_bundle_body__.txt"
878
+ \`\`\`
879
+ `;
880
+ const planPath = path.join(dir, "Plan.md");
881
+ writeFileSync(planPath, plan, "utf8");
882
+ const bundleDir = path.join(dir, "bundle-out");
883
+ mkdirSync(bundleDir, { recursive: true });
884
+ execFileSync(process.execPath, [
885
+ cliJs,
886
+ "plan-transition",
887
+ "--repo",
888
+ dir,
889
+ "--before",
890
+ b,
891
+ "--after",
892
+ a,
893
+ "--plan",
894
+ planPath,
895
+ "--no-truth-report",
896
+ "--write-run-bundle",
897
+ bundleDir,
898
+ ], { encoding: "utf8", windowsHide: true });
899
+ const evLine = JSON.parse(readFileSync(path.join(bundleDir, "events.ndjson"), "utf8").trim());
900
+ expect(loadSchemaValidator("event")(evLine)).toBe(true);
901
+ expect(evLine.params.transitionRulesSource).toBe("body_section");
902
+ }, 20_000);
903
+ it("plan-transition --write-run-bundle sets transitionRulesSource derived_citations", () => {
904
+ const dir = mkdtempSync(path.join(tmpdir(), "plan-bundle-derived-"));
905
+ execFileSync("git", ["init", dir], { windowsHide: true });
906
+ execFileSync("git", ["-C", dir, "config", "user.email", "c@test"], { windowsHide: true });
907
+ execFileSync("git", ["-C", dir, "config", "user.name", "c"], { windowsHide: true });
908
+ mkdirSync(path.join(dir, "src"), { recursive: true });
909
+ writeFileSync(path.join(dir, "src", "t.ts"), "1");
910
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
911
+ execFileSync("git", ["-C", dir, "commit", "-m", "a"], { windowsHide: true });
912
+ const b = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
913
+ writeFileSync(path.join(dir, "src", "t.ts"), "2");
914
+ execFileSync("git", ["-C", dir, "add", "."], { windowsHide: true });
915
+ execFileSync("git", ["-C", dir, "commit", "-m", "b"], { windowsHide: true });
916
+ const a = execFileSync("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", windowsHide: true }).trim();
917
+ const plan = `---
918
+ name: p
919
+ overview: x
920
+ ---
921
+
922
+ # x
923
+
924
+ ## Implementation
925
+
926
+ Change \`src/t.ts\`.
927
+ `;
928
+ const planPath = path.join(dir, "Plan.md");
929
+ writeFileSync(planPath, plan, "utf8");
930
+ const bundleDir = path.join(dir, "bundle-out");
931
+ mkdirSync(bundleDir, { recursive: true });
932
+ execFileSync(process.execPath, [
933
+ cliJs,
934
+ "plan-transition",
935
+ "--repo",
936
+ dir,
937
+ "--before",
938
+ b,
939
+ "--after",
940
+ a,
941
+ "--plan",
942
+ planPath,
943
+ "--no-truth-report",
944
+ "--write-run-bundle",
945
+ bundleDir,
946
+ ], { encoding: "utf8", windowsHide: true });
947
+ const evLine = JSON.parse(readFileSync(path.join(bundleDir, "events.ndjson"), "utf8").trim());
948
+ expect(loadSchemaValidator("event")(evLine)).toBe(true);
949
+ expect(evLine.params.transitionRulesSource).toBe("derived_citations");
950
+ const wf = JSON.parse(readFileSync(path.join(bundleDir, "workflow-result.json"), "utf8"));
951
+ expect(wf.status).toBe("complete");
952
+ expect(wf.steps.length).toBe(1);
953
+ expect(wf.steps[0]?.status).toBe("verified");
954
+ }, 20_000);
955
+ });
956
+ //# sourceMappingURL=planTransition.test.js.map