@sun-asterisk/sungen 3.2.34-beta.1 → 3.3.0-alpha.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 (858) hide show
  1. package/dist/basis/anchor-grammar.d.ts +32 -0
  2. package/dist/basis/anchor-grammar.d.ts.map +1 -0
  3. package/dist/basis/anchor-grammar.js +82 -0
  4. package/dist/basis/anchor-grammar.js.map +1 -0
  5. package/dist/basis/anchor-hash.d.ts +6 -0
  6. package/dist/basis/anchor-hash.d.ts.map +1 -0
  7. package/dist/basis/anchor-hash.js +28 -0
  8. package/dist/basis/anchor-hash.js.map +1 -0
  9. package/dist/basis/bm51-tables.d.ts +20 -0
  10. package/dist/basis/bm51-tables.d.ts.map +1 -0
  11. package/dist/basis/bm51-tables.js +71 -0
  12. package/dist/basis/bm51-tables.js.map +1 -0
  13. package/dist/basis/extract-spec-anchors.d.ts +39 -0
  14. package/dist/basis/extract-spec-anchors.d.ts.map +1 -0
  15. package/dist/basis/extract-spec-anchors.js +81 -0
  16. package/dist/basis/extract-spec-anchors.js.map +1 -0
  17. package/dist/basis/migration-sentinel.d.ts +47 -0
  18. package/dist/basis/migration-sentinel.d.ts.map +1 -0
  19. package/dist/basis/migration-sentinel.js +219 -0
  20. package/dist/basis/migration-sentinel.js.map +1 -0
  21. package/dist/basis/spec-frontmatter.d.ts +18 -0
  22. package/dist/basis/spec-frontmatter.d.ts.map +1 -0
  23. package/dist/basis/spec-frontmatter.js +55 -0
  24. package/dist/basis/spec-frontmatter.js.map +1 -0
  25. package/dist/basis/spec-sections.d.ts +18 -0
  26. package/dist/basis/spec-sections.d.ts.map +1 -0
  27. package/dist/basis/spec-sections.js +27 -0
  28. package/dist/basis/spec-sections.js.map +1 -0
  29. package/dist/basis/test-basis-schema.d.ts +28 -0
  30. package/dist/basis/test-basis-schema.d.ts.map +1 -0
  31. package/dist/basis/test-basis-schema.js +141 -0
  32. package/dist/basis/test-basis-schema.js.map +1 -0
  33. package/dist/capabilities/registry.d.ts +15 -0
  34. package/dist/capabilities/registry.d.ts.map +1 -1
  35. package/dist/capabilities/registry.js.map +1 -1
  36. package/dist/cli/commands/audit.d.ts.map +1 -1
  37. package/dist/cli/commands/audit.js +3 -29
  38. package/dist/cli/commands/audit.js.map +1 -1
  39. package/dist/cli/commands/capability.js +1 -1
  40. package/dist/cli/commands/capability.js.map +1 -1
  41. package/dist/cli/commands/contract-derive-command.d.ts +10 -0
  42. package/dist/cli/commands/contract-derive-command.d.ts.map +1 -0
  43. package/dist/cli/commands/contract-derive-command.js +99 -0
  44. package/dist/cli/commands/contract-derive-command.js.map +1 -0
  45. package/dist/cli/commands/contract.d.ts +17 -0
  46. package/dist/cli/commands/contract.d.ts.map +1 -0
  47. package/dist/cli/commands/contract.js +162 -0
  48. package/dist/cli/commands/contract.js.map +1 -0
  49. package/dist/cli/commands/delivery.d.ts.map +1 -1
  50. package/dist/cli/commands/delivery.js +52 -3
  51. package/dist/cli/commands/delivery.js.map +1 -1
  52. package/dist/cli/commands/generate.d.ts.map +1 -1
  53. package/dist/cli/commands/generate.js +3 -1
  54. package/dist/cli/commands/generate.js.map +1 -1
  55. package/dist/cli/commands/journey.d.ts.map +1 -1
  56. package/dist/cli/commands/journey.js +41 -13
  57. package/dist/cli/commands/journey.js.map +1 -1
  58. package/dist/cli/commands/next.d.ts +8 -0
  59. package/dist/cli/commands/next.d.ts.map +1 -1
  60. package/dist/cli/commands/next.js +64 -6
  61. package/dist/cli/commands/next.js.map +1 -1
  62. package/dist/cli/commands/update.d.ts +11 -0
  63. package/dist/cli/commands/update.d.ts.map +1 -1
  64. package/dist/cli/commands/update.js +31 -6
  65. package/dist/cli/commands/update.js.map +1 -1
  66. package/dist/cli/index.js +20 -35
  67. package/dist/cli/index.js.map +1 -1
  68. package/dist/contract/approve-contract.d.ts +31 -0
  69. package/dist/contract/approve-contract.d.ts.map +1 -0
  70. package/dist/contract/approve-contract.js +87 -0
  71. package/dist/contract/approve-contract.js.map +1 -0
  72. package/dist/contract/assertion-matcher-vocabulary.d.ts +24 -0
  73. package/dist/contract/assertion-matcher-vocabulary.d.ts.map +1 -0
  74. package/dist/contract/assertion-matcher-vocabulary.js +100 -0
  75. package/dist/contract/assertion-matcher-vocabulary.js.map +1 -0
  76. package/dist/contract/build-contract-verdict.d.ts +32 -0
  77. package/dist/contract/build-contract-verdict.d.ts.map +1 -0
  78. package/dist/contract/build-contract-verdict.js +123 -0
  79. package/dist/contract/build-contract-verdict.js.map +1 -0
  80. package/dist/contract/build-trace-conformance.d.ts +18 -0
  81. package/dist/contract/build-trace-conformance.d.ts.map +1 -0
  82. package/dist/contract/build-trace-conformance.js +153 -0
  83. package/dist/contract/build-trace-conformance.js.map +1 -0
  84. package/dist/contract/classify-contract-change.d.ts +23 -0
  85. package/dist/contract/classify-contract-change.d.ts.map +1 -0
  86. package/dist/contract/classify-contract-change.js +98 -0
  87. package/dist/contract/classify-contract-change.js.map +1 -0
  88. package/dist/contract/classify-contract-unit.d.ts +18 -0
  89. package/dist/contract/classify-contract-unit.d.ts.map +1 -0
  90. package/dist/contract/classify-contract-unit.js +49 -0
  91. package/dist/contract/classify-contract-unit.js.map +1 -0
  92. package/dist/contract/classify-trace-conformance.d.ts +32 -0
  93. package/dist/contract/classify-trace-conformance.d.ts.map +1 -0
  94. package/dist/contract/classify-trace-conformance.js +117 -0
  95. package/dist/contract/classify-trace-conformance.js.map +1 -0
  96. package/dist/contract/contract-git.d.ts +24 -0
  97. package/dist/contract/contract-git.d.ts.map +1 -0
  98. package/dist/contract/contract-git.js +144 -0
  99. package/dist/contract/contract-git.js.map +1 -0
  100. package/dist/contract/contract-hash.d.ts +7 -0
  101. package/dist/contract/contract-hash.d.ts.map +1 -0
  102. package/dist/contract/contract-hash.js +38 -0
  103. package/dist/contract/contract-hash.js.map +1 -0
  104. package/dist/contract/contract-report-file.d.ts +4 -0
  105. package/dist/contract/contract-report-file.d.ts.map +1 -0
  106. package/dist/contract/contract-report-file.js +60 -0
  107. package/dist/contract/contract-report-file.js.map +1 -0
  108. package/dist/contract/contract-schema.d.ts +71 -0
  109. package/dist/contract/contract-schema.d.ts.map +1 -0
  110. package/dist/contract/contract-schema.js +102 -0
  111. package/dist/contract/contract-schema.js.map +1 -0
  112. package/dist/contract/contract-units.d.ts +12 -0
  113. package/dist/contract/contract-units.d.ts.map +1 -0
  114. package/dist/contract/contract-units.js +96 -0
  115. package/dist/contract/contract-units.js.map +1 -0
  116. package/dist/contract/contracts-lock-file.d.ts +24 -0
  117. package/dist/contract/contracts-lock-file.d.ts.map +1 -0
  118. package/dist/contract/contracts-lock-file.js +140 -0
  119. package/dist/contract/contracts-lock-file.js.map +1 -0
  120. package/dist/contract/data-normalize.d.ts +10 -0
  121. package/dist/contract/data-normalize.d.ts.map +1 -0
  122. package/dist/contract/data-normalize.js +110 -0
  123. package/dist/contract/data-normalize.js.map +1 -0
  124. package/dist/contract/derive-free-feature.d.ts +30 -0
  125. package/dist/contract/derive-free-feature.d.ts.map +1 -0
  126. package/dist/contract/derive-free-feature.js +145 -0
  127. package/dist/contract/derive-free-feature.js.map +1 -0
  128. package/dist/contract/field-semantic-redaction.d.ts +21 -0
  129. package/dist/contract/field-semantic-redaction.d.ts.map +1 -0
  130. package/dist/contract/field-semantic-redaction.js +118 -0
  131. package/dist/contract/field-semantic-redaction.js.map +1 -0
  132. package/dist/contract/free-feature-blocks.d.ts +10 -0
  133. package/dist/contract/free-feature-blocks.d.ts.map +1 -0
  134. package/dist/contract/free-feature-blocks.js +94 -0
  135. package/dist/contract/free-feature-blocks.js.map +1 -0
  136. package/dist/contract/lock-secret-guard.d.ts +22 -0
  137. package/dist/contract/lock-secret-guard.d.ts.map +1 -0
  138. package/dist/contract/lock-secret-guard.js +134 -0
  139. package/dist/contract/lock-secret-guard.js.map +1 -0
  140. package/dist/contract/lock-vs-git-head.d.ts +26 -0
  141. package/dist/contract/lock-vs-git-head.d.ts.map +1 -0
  142. package/dist/contract/lock-vs-git-head.js +28 -0
  143. package/dist/contract/lock-vs-git-head.js.map +1 -0
  144. package/dist/contract/normalize-contract-step.d.ts +21 -0
  145. package/dist/contract/normalize-contract-step.d.ts.map +1 -0
  146. package/dist/contract/normalize-contract-step.js +70 -0
  147. package/dist/contract/normalize-contract-step.js.map +1 -0
  148. package/dist/contract/normalize-feature-steps.d.ts +7 -0
  149. package/dist/contract/normalize-feature-steps.d.ts.map +1 -0
  150. package/dist/contract/normalize-feature-steps.js +127 -0
  151. package/dist/contract/normalize-feature-steps.js.map +1 -0
  152. package/dist/contract/oracle-strength.d.ts +12 -0
  153. package/dist/contract/oracle-strength.d.ts.map +1 -0
  154. package/dist/contract/oracle-strength.js +88 -0
  155. package/dist/contract/oracle-strength.js.map +1 -0
  156. package/dist/contract/project-contract-blockers.d.ts +10 -0
  157. package/dist/contract/project-contract-blockers.d.ts.map +1 -0
  158. package/dist/contract/project-contract-blockers.js +73 -0
  159. package/dist/contract/project-contract-blockers.js.map +1 -0
  160. package/dist/contract/record-contract-approval.d.ts +21 -0
  161. package/dist/contract/record-contract-approval.d.ts.map +1 -0
  162. package/dist/contract/record-contract-approval.js +98 -0
  163. package/dist/contract/record-contract-approval.js.map +1 -0
  164. package/dist/contract/render-free-gherkin.d.ts +40 -0
  165. package/dist/contract/render-free-gherkin.d.ts.map +1 -0
  166. package/dist/contract/render-free-gherkin.js +141 -0
  167. package/dist/contract/render-free-gherkin.js.map +1 -0
  168. package/dist/contract/render-trace-sentence.d.ts +20 -0
  169. package/dist/contract/render-trace-sentence.d.ts.map +1 -0
  170. package/dist/contract/render-trace-sentence.js +109 -0
  171. package/dist/contract/render-trace-sentence.js.map +1 -0
  172. package/dist/contract/render-trace-target.d.ts +14 -0
  173. package/dist/contract/render-trace-target.d.ts.map +1 -0
  174. package/dist/contract/render-trace-target.js +70 -0
  175. package/dist/contract/render-trace-target.js.map +1 -0
  176. package/dist/contract/resolve-unit-trace-identities.d.ts +8 -0
  177. package/dist/contract/resolve-unit-trace-identities.d.ts.map +1 -0
  178. package/dist/contract/resolve-unit-trace-identities.js +78 -0
  179. package/dist/contract/resolve-unit-trace-identities.js.map +1 -0
  180. package/dist/contract/trace/collect-trace-evidence.d.ts +33 -0
  181. package/dist/contract/trace/collect-trace-evidence.d.ts.map +1 -0
  182. package/dist/contract/trace/collect-trace-evidence.js +161 -0
  183. package/dist/contract/trace/collect-trace-evidence.js.map +1 -0
  184. package/dist/contract/trace/identity-cache.d.ts +19 -0
  185. package/dist/contract/trace/identity-cache.d.ts.map +1 -0
  186. package/dist/contract/trace/identity-cache.js +104 -0
  187. package/dist/contract/trace/identity-cache.js.map +1 -0
  188. package/dist/contract/trace/select-final-attempt.d.ts +27 -0
  189. package/dist/contract/trace/select-final-attempt.d.ts.map +1 -0
  190. package/dist/contract/trace/select-final-attempt.js +116 -0
  191. package/dist/contract/trace/select-final-attempt.js.map +1 -0
  192. package/dist/contract/trace/snapshot-html-renderer.d.ts +31 -0
  193. package/dist/contract/trace/snapshot-html-renderer.d.ts.map +1 -0
  194. package/dist/contract/trace/snapshot-html-renderer.js +172 -0
  195. package/dist/contract/trace/snapshot-html-renderer.js.map +1 -0
  196. package/dist/contract/trace/snapshot-resolver.d.ts +21 -0
  197. package/dist/contract/trace/snapshot-resolver.d.ts.map +1 -0
  198. package/dist/contract/trace/snapshot-resolver.js +65 -0
  199. package/dist/contract/trace/snapshot-resolver.js.map +1 -0
  200. package/dist/contract/trace/snapshot-store.d.ts +66 -0
  201. package/dist/contract/trace/snapshot-store.d.ts.map +1 -0
  202. package/dist/contract/trace/snapshot-store.js +173 -0
  203. package/dist/contract/trace/snapshot-store.js.map +1 -0
  204. package/dist/contract/trace/target-identity.d.ts +74 -0
  205. package/dist/contract/trace/target-identity.d.ts.map +1 -0
  206. package/dist/contract/trace/target-identity.js +68 -0
  207. package/dist/contract/trace/target-identity.js.map +1 -0
  208. package/dist/contract/trace/test-step-join.d.ts +65 -0
  209. package/dist/contract/trace/test-step-join.d.ts.map +1 -0
  210. package/dist/contract/trace/test-step-join.js +80 -0
  211. package/dist/contract/trace/test-step-join.js.map +1 -0
  212. package/dist/contract/trace/trace-binding.d.ts +21 -0
  213. package/dist/contract/trace/trace-binding.d.ts.map +1 -0
  214. package/dist/contract/trace/trace-binding.js +88 -0
  215. package/dist/contract/trace/trace-binding.js.map +1 -0
  216. package/dist/contract/trace/trace-file-reader.d.ts +35 -0
  217. package/dist/contract/trace/trace-file-reader.d.ts.map +1 -0
  218. package/dist/contract/trace/trace-file-reader.js +155 -0
  219. package/dist/contract/trace/trace-file-reader.js.map +1 -0
  220. package/dist/contract/trace/trace-fingerprint.d.ts +22 -0
  221. package/dist/contract/trace/trace-fingerprint.d.ts.map +1 -0
  222. package/dist/contract/trace/trace-fingerprint.js +96 -0
  223. package/dist/contract/trace/trace-fingerprint.js.map +1 -0
  224. package/dist/contract/trace/trace-identity-resolution.d.ts +26 -0
  225. package/dist/contract/trace/trace-identity-resolution.d.ts.map +1 -0
  226. package/dist/contract/trace/trace-identity-resolution.js +84 -0
  227. package/dist/contract/trace/trace-identity-resolution.js.map +1 -0
  228. package/dist/contract/trace/trace-run-record.d.ts +27 -0
  229. package/dist/contract/trace/trace-run-record.d.ts.map +1 -0
  230. package/dist/contract/trace/trace-run-record.js +115 -0
  231. package/dist/contract/trace/trace-run-record.js.map +1 -0
  232. package/dist/contract/trace/trace-steps.d.ts +19 -0
  233. package/dist/contract/trace/trace-steps.d.ts.map +1 -0
  234. package/dist/contract/trace/trace-steps.js +79 -0
  235. package/dist/contract/trace/trace-steps.js.map +1 -0
  236. package/dist/contract/trace/trace-zip-limits.d.ts +41 -0
  237. package/dist/contract/trace/trace-zip-limits.d.ts.map +1 -0
  238. package/dist/contract/trace/trace-zip-limits.js +48 -0
  239. package/dist/contract/trace/trace-zip-limits.js.map +1 -0
  240. package/dist/contract/trace/trace-zip-reader.d.ts +10 -0
  241. package/dist/contract/trace/trace-zip-reader.d.ts.map +1 -0
  242. package/dist/contract/trace/trace-zip-reader.js +186 -0
  243. package/dist/contract/trace/trace-zip-reader.js.map +1 -0
  244. package/dist/contract/verify-approval-decisions.d.ts +5 -0
  245. package/dist/contract/verify-approval-decisions.d.ts.map +1 -0
  246. package/dist/contract/verify-approval-decisions.js +104 -0
  247. package/dist/contract/verify-approval-decisions.js.map +1 -0
  248. package/dist/decisions/append-decision.d.ts +12 -0
  249. package/dist/decisions/append-decision.d.ts.map +1 -0
  250. package/dist/decisions/append-decision.js +73 -0
  251. package/dist/decisions/append-decision.js.map +1 -0
  252. package/dist/decisions/confirmed-decision-commands.d.ts +30 -0
  253. package/dist/decisions/confirmed-decision-commands.d.ts.map +1 -0
  254. package/dist/decisions/confirmed-decision-commands.js +172 -0
  255. package/dist/decisions/confirmed-decision-commands.js.map +1 -0
  256. package/dist/decisions/decision-file.d.ts +31 -0
  257. package/dist/decisions/decision-file.d.ts.map +1 -0
  258. package/dist/decisions/decision-file.js +139 -0
  259. package/dist/decisions/decision-file.js.map +1 -0
  260. package/dist/decisions/decision-identity.d.ts +12 -0
  261. package/dist/decisions/decision-identity.d.ts.map +1 -0
  262. package/dist/decisions/decision-identity.js +78 -0
  263. package/dist/decisions/decision-identity.js.map +1 -0
  264. package/dist/decisions/decision-integrity-check.d.ts +12 -0
  265. package/dist/decisions/decision-integrity-check.d.ts.map +1 -0
  266. package/dist/decisions/decision-integrity-check.js +102 -0
  267. package/dist/decisions/decision-integrity-check.js.map +1 -0
  268. package/dist/decisions/decision-schema.d.ts +42 -0
  269. package/dist/decisions/decision-schema.d.ts.map +1 -0
  270. package/dist/decisions/decision-schema.js +75 -0
  271. package/dist/decisions/decision-schema.js.map +1 -0
  272. package/dist/decisions/decision-source.d.ts +2 -0
  273. package/dist/decisions/decision-source.d.ts.map +1 -0
  274. package/dist/decisions/decision-source.js +18 -0
  275. package/dist/decisions/decision-source.js.map +1 -0
  276. package/dist/decisions/exclusive-file-create.d.ts +3 -0
  277. package/dist/decisions/exclusive-file-create.d.ts.map +1 -0
  278. package/dist/decisions/exclusive-file-create.js +84 -0
  279. package/dist/decisions/exclusive-file-create.js.map +1 -0
  280. package/dist/decisions/git-head-trust.d.ts +7 -0
  281. package/dist/decisions/git-head-trust.d.ts.map +1 -0
  282. package/dist/decisions/git-head-trust.js +76 -0
  283. package/dist/decisions/git-head-trust.js.map +1 -0
  284. package/dist/decisions/human-confirmation.d.ts +33 -0
  285. package/dist/decisions/human-confirmation.d.ts.map +1 -0
  286. package/dist/decisions/human-confirmation.js +155 -0
  287. package/dist/decisions/human-confirmation.js.map +1 -0
  288. package/dist/decisions/legacy-waiver-migration.d.ts +31 -0
  289. package/dist/decisions/legacy-waiver-migration.d.ts.map +1 -0
  290. package/dist/decisions/legacy-waiver-migration.js +170 -0
  291. package/dist/decisions/legacy-waiver-migration.js.map +1 -0
  292. package/dist/decisions/read-decisions.d.ts +19 -0
  293. package/dist/decisions/read-decisions.d.ts.map +1 -0
  294. package/dist/decisions/read-decisions.js +90 -0
  295. package/dist/decisions/read-decisions.js.map +1 -0
  296. package/dist/decisions/viewpoint-baseline-adapter.d.ts +7 -0
  297. package/dist/decisions/viewpoint-baseline-adapter.d.ts.map +1 -0
  298. package/dist/decisions/viewpoint-baseline-adapter.js +109 -0
  299. package/dist/decisions/viewpoint-baseline-adapter.js.map +1 -0
  300. package/dist/decisions/waiver-decisions.d.ts +24 -0
  301. package/dist/decisions/waiver-decisions.d.ts.map +1 -0
  302. package/dist/decisions/waiver-decisions.js +46 -0
  303. package/dist/decisions/waiver-decisions.js.map +1 -0
  304. package/dist/exporters/matrix/build.d.ts +3 -0
  305. package/dist/exporters/matrix/build.d.ts.map +1 -1
  306. package/dist/exporters/matrix/build.js +10 -9
  307. package/dist/exporters/matrix/build.js.map +1 -1
  308. package/dist/exporters/matrix/export.d.ts +3 -0
  309. package/dist/exporters/matrix/export.d.ts.map +1 -1
  310. package/dist/exporters/matrix/export.js +2 -0
  311. package/dist/exporters/matrix/export.js.map +1 -1
  312. package/dist/exporters/matrix/gates.d.ts +6 -1
  313. package/dist/exporters/matrix/gates.d.ts.map +1 -1
  314. package/dist/exporters/matrix/gates.js +57 -128
  315. package/dist/exporters/matrix/gates.js.map +1 -1
  316. package/dist/exporters/matrix/render-csv.d.ts.map +1 -1
  317. package/dist/exporters/matrix/render-csv.js +3 -0
  318. package/dist/exporters/matrix/render-csv.js.map +1 -1
  319. package/dist/exporters/matrix/render-gate-overrides-sheet.d.ts +13 -0
  320. package/dist/exporters/matrix/render-gate-overrides-sheet.d.ts.map +1 -0
  321. package/dist/exporters/matrix/render-gate-overrides-sheet.js +44 -0
  322. package/dist/exporters/matrix/render-gate-overrides-sheet.js.map +1 -0
  323. package/dist/exporters/matrix/render-xlsx.d.ts +1 -0
  324. package/dist/exporters/matrix/render-xlsx.d.ts.map +1 -1
  325. package/dist/exporters/matrix/render-xlsx.js +3 -0
  326. package/dist/exporters/matrix/render-xlsx.js.map +1 -1
  327. package/dist/exporters/matrix/types.d.ts +4 -1
  328. package/dist/exporters/matrix/types.d.ts.map +1 -1
  329. package/dist/exporters/matrix/types.js.map +1 -1
  330. package/dist/generators/test-generator/code-generator.d.ts.map +1 -1
  331. package/dist/generators/test-generator/code-generator.js +13 -0
  332. package/dist/generators/test-generator/code-generator.js.map +1 -1
  333. package/dist/graph/evaluate-graph.d.ts +21 -0
  334. package/dist/graph/evaluate-graph.d.ts.map +1 -0
  335. package/dist/graph/evaluate-graph.js +49 -0
  336. package/dist/graph/evaluate-graph.js.map +1 -0
  337. package/dist/graph/locate-finding.d.ts +20 -0
  338. package/dist/graph/locate-finding.d.ts.map +1 -0
  339. package/dist/graph/locate-finding.js +137 -0
  340. package/dist/graph/locate-finding.js.map +1 -0
  341. package/dist/graph/node-decl.d.ts +59 -0
  342. package/dist/graph/node-decl.d.ts.map +1 -0
  343. package/dist/graph/node-decl.js +8 -0
  344. package/dist/graph/node-decl.js.map +1 -0
  345. package/dist/graph/nodes/core-node-catalog.d.ts +7 -0
  346. package/dist/graph/nodes/core-node-catalog.d.ts.map +1 -0
  347. package/dist/graph/nodes/core-node-catalog.js +13 -0
  348. package/dist/graph/nodes/core-node-catalog.js.map +1 -0
  349. package/dist/graph/nodes/test-case-contract-nodes.d.ts +19 -0
  350. package/dist/graph/nodes/test-case-contract-nodes.d.ts.map +1 -0
  351. package/dist/graph/nodes/test-case-contract-nodes.js +56 -0
  352. package/dist/graph/nodes/test-case-contract-nodes.js.map +1 -0
  353. package/dist/graph/nodes/test-case-nodes.d.ts +26 -0
  354. package/dist/graph/nodes/test-case-nodes.d.ts.map +1 -0
  355. package/dist/graph/nodes/test-case-nodes.js +66 -0
  356. package/dist/graph/nodes/test-case-nodes.js.map +1 -0
  357. package/dist/graph/nodes/unit-audit-nodes.d.ts +18 -0
  358. package/dist/graph/nodes/unit-audit-nodes.d.ts.map +1 -0
  359. package/dist/graph/nodes/unit-audit-nodes.js +95 -0
  360. package/dist/graph/nodes/unit-audit-nodes.js.map +1 -0
  361. package/dist/graph/nodes/unit-contract-node.d.ts +20 -0
  362. package/dist/graph/nodes/unit-contract-node.d.ts.map +1 -0
  363. package/dist/graph/nodes/unit-contract-node.js +81 -0
  364. package/dist/graph/nodes/unit-contract-node.js.map +1 -0
  365. package/dist/graph/nodes/unit-design-nodes.d.ts +14 -0
  366. package/dist/graph/nodes/unit-design-nodes.d.ts.map +1 -0
  367. package/dist/graph/nodes/unit-design-nodes.js +90 -0
  368. package/dist/graph/nodes/unit-design-nodes.js.map +1 -0
  369. package/dist/graph/nodes/unit-execution-nodes.d.ts +16 -0
  370. package/dist/graph/nodes/unit-execution-nodes.d.ts.map +1 -0
  371. package/dist/graph/nodes/unit-execution-nodes.js +79 -0
  372. package/dist/graph/nodes/unit-execution-nodes.js.map +1 -0
  373. package/dist/graph/test-case-identity.d.ts +13 -0
  374. package/dist/graph/test-case-identity.d.ts.map +1 -0
  375. package/dist/graph/test-case-identity.js +106 -0
  376. package/dist/graph/test-case-identity.js.map +1 -0
  377. package/dist/graph/test-case-results.d.ts +11 -0
  378. package/dist/graph/test-case-results.d.ts.map +1 -0
  379. package/dist/graph/test-case-results.js +137 -0
  380. package/dist/graph/test-case-results.js.map +1 -0
  381. package/dist/graph/test-case-satisfied.d.ts +25 -0
  382. package/dist/graph/test-case-satisfied.d.ts.map +1 -0
  383. package/dist/graph/test-case-satisfied.js +51 -0
  384. package/dist/graph/test-case-satisfied.js.map +1 -0
  385. package/dist/graph/test-case-state-shape.d.ts +67 -0
  386. package/dist/graph/test-case-state-shape.d.ts.map +1 -0
  387. package/dist/graph/test-case-state-shape.js +3 -0
  388. package/dist/graph/test-case-state-shape.js.map +1 -0
  389. package/dist/graph/test-case-states.d.ts +9 -0
  390. package/dist/graph/test-case-states.d.ts.map +1 -0
  391. package/dist/graph/test-case-states.js +116 -0
  392. package/dist/graph/test-case-states.js.map +1 -0
  393. package/dist/graph/unit-artifact-probes.d.ts +19 -0
  394. package/dist/graph/unit-artifact-probes.d.ts.map +1 -0
  395. package/dist/graph/unit-artifact-probes.js +133 -0
  396. package/dist/graph/unit-artifact-probes.js.map +1 -0
  397. package/dist/graph/unit-state-facts.d.ts +43 -0
  398. package/dist/graph/unit-state-facts.d.ts.map +1 -0
  399. package/dist/graph/unit-state-facts.js +87 -0
  400. package/dist/graph/unit-state-facts.js.map +1 -0
  401. package/dist/harness/audit.d.ts +11 -0
  402. package/dist/harness/audit.d.ts.map +1 -1
  403. package/dist/harness/audit.js +18 -17
  404. package/dist/harness/audit.js.map +1 -1
  405. package/dist/harness/catalog/gate-rules.yaml +647 -0
  406. package/dist/harness/gates/audit-gate-terms.d.ts +41 -0
  407. package/dist/harness/gates/audit-gate-terms.d.ts.map +1 -0
  408. package/dist/harness/gates/audit-gate-terms.js +72 -0
  409. package/dist/harness/gates/audit-gate-terms.js.map +1 -0
  410. package/dist/harness/gates/audit-gate-verdict.d.ts +31 -0
  411. package/dist/harness/gates/audit-gate-verdict.d.ts.map +1 -0
  412. package/dist/harness/gates/audit-gate-verdict.js +101 -0
  413. package/dist/harness/gates/audit-gate-verdict.js.map +1 -0
  414. package/dist/harness/gates/audit-input-hash.d.ts +4 -0
  415. package/dist/harness/gates/audit-input-hash.d.ts.map +1 -0
  416. package/dist/harness/gates/audit-input-hash.js +96 -0
  417. package/dist/harness/gates/audit-input-hash.js.map +1 -0
  418. package/dist/harness/gates/audit-report-verification.d.ts +32 -0
  419. package/dist/harness/gates/audit-report-verification.d.ts.map +1 -0
  420. package/dist/harness/gates/audit-report-verification.js +207 -0
  421. package/dist/harness/gates/audit-report-verification.js.map +1 -0
  422. package/dist/harness/gates/decisions-hash.d.ts +13 -0
  423. package/dist/harness/gates/decisions-hash.d.ts.map +1 -0
  424. package/dist/harness/gates/decisions-hash.js +72 -0
  425. package/dist/harness/gates/decisions-hash.js.map +1 -0
  426. package/dist/harness/gates/delivery-checklist.d.ts +21 -0
  427. package/dist/harness/gates/delivery-checklist.d.ts.map +1 -0
  428. package/dist/harness/gates/delivery-checklist.js +128 -0
  429. package/dist/harness/gates/delivery-checklist.js.map +1 -0
  430. package/dist/harness/gates/delivery-decision-gate.d.ts +29 -0
  431. package/dist/harness/gates/delivery-decision-gate.d.ts.map +1 -0
  432. package/dist/harness/gates/delivery-decision-gate.js +91 -0
  433. package/dist/harness/gates/delivery-decision-gate.js.map +1 -0
  434. package/dist/harness/gates/delivery-decision-step.d.ts +16 -0
  435. package/dist/harness/gates/delivery-decision-step.d.ts.map +1 -0
  436. package/dist/harness/gates/delivery-decision-step.js +71 -0
  437. package/dist/harness/gates/delivery-decision-step.js.map +1 -0
  438. package/dist/harness/gates/gate-override-report.d.ts +59 -0
  439. package/dist/harness/gates/gate-override-report.d.ts.map +1 -0
  440. package/dist/harness/gates/gate-override-report.js +86 -0
  441. package/dist/harness/gates/gate-override-report.js.map +1 -0
  442. package/dist/harness/gates/gate-override-scope.d.ts +18 -0
  443. package/dist/harness/gates/gate-override-scope.d.ts.map +1 -0
  444. package/dist/harness/gates/gate-override-scope.js +98 -0
  445. package/dist/harness/gates/gate-override-scope.js.map +1 -0
  446. package/dist/harness/gates/gate-override-validation.d.ts +25 -0
  447. package/dist/harness/gates/gate-override-validation.d.ts.map +1 -0
  448. package/dist/harness/gates/gate-override-validation.js +81 -0
  449. package/dist/harness/gates/gate-override-validation.js.map +1 -0
  450. package/dist/harness/gates/gate-rule-catalog.d.ts +24 -0
  451. package/dist/harness/gates/gate-rule-catalog.d.ts.map +1 -0
  452. package/dist/harness/gates/gate-rule-catalog.js +112 -0
  453. package/dist/harness/gates/gate-rule-catalog.js.map +1 -0
  454. package/dist/harness/gates/gate-terms.d.ts +33 -0
  455. package/dist/harness/gates/gate-terms.d.ts.map +1 -0
  456. package/dist/harness/gates/gate-terms.js +41 -0
  457. package/dist/harness/gates/gate-terms.js.map +1 -0
  458. package/dist/harness/gates/in-run-decision-check.d.ts +21 -0
  459. package/dist/harness/gates/in-run-decision-check.d.ts.map +1 -0
  460. package/dist/harness/gates/in-run-decision-check.js +138 -0
  461. package/dist/harness/gates/in-run-decision-check.js.map +1 -0
  462. package/dist/harness/gates/journey-gate-inputs.d.ts +37 -0
  463. package/dist/harness/gates/journey-gate-inputs.d.ts.map +1 -0
  464. package/dist/harness/gates/journey-gate-inputs.js +81 -0
  465. package/dist/harness/gates/journey-gate-inputs.js.map +1 -0
  466. package/dist/harness/gates/migrated-waiver-review.d.ts +6 -0
  467. package/dist/harness/gates/migrated-waiver-review.d.ts.map +1 -0
  468. package/dist/harness/gates/migrated-waiver-review.js +116 -0
  469. package/dist/harness/gates/migrated-waiver-review.js.map +1 -0
  470. package/dist/harness/gates/resolve-rule.d.ts +59 -0
  471. package/dist/harness/gates/resolve-rule.d.ts.map +1 -0
  472. package/dist/harness/gates/resolve-rule.js +41 -0
  473. package/dist/harness/gates/resolve-rule.js.map +1 -0
  474. package/dist/harness/gates/unit-gate-overrides.d.ts +25 -0
  475. package/dist/harness/gates/unit-gate-overrides.d.ts.map +1 -0
  476. package/dist/harness/gates/unit-gate-overrides.js +122 -0
  477. package/dist/harness/gates/unit-gate-overrides.js.map +1 -0
  478. package/dist/harness/journey.d.ts +24 -1
  479. package/dist/harness/journey.d.ts.map +1 -1
  480. package/dist/harness/journey.js +114 -23
  481. package/dist/harness/journey.js.map +1 -1
  482. package/dist/harness/manifest.d.ts +12 -0
  483. package/dist/harness/manifest.d.ts.map +1 -1
  484. package/dist/harness/manifest.js +71 -43
  485. package/dist/harness/manifest.js.map +1 -1
  486. package/dist/harness/next-step.d.ts +39 -6
  487. package/dist/harness/next-step.d.ts.map +1 -1
  488. package/dist/harness/next-step.js +34 -218
  489. package/dist/harness/next-step.js.map +1 -1
  490. package/dist/harness/parse.d.ts +10 -6
  491. package/dist/harness/parse.d.ts.map +1 -1
  492. package/dist/harness/parse.js +22 -11
  493. package/dist/harness/parse.js.map +1 -1
  494. package/dist/harness/script-check.d.ts.map +1 -1
  495. package/dist/harness/script-check.js +22 -5
  496. package/dist/harness/script-check.js.map +1 -1
  497. package/dist/harness/sensors.d.ts +14 -3
  498. package/dist/harness/sensors.d.ts.map +1 -1
  499. package/dist/harness/sensors.js +50 -49
  500. package/dist/harness/sensors.js.map +1 -1
  501. package/dist/harness/viewpoint-baseline.d.ts.map +1 -1
  502. package/dist/harness/viewpoint-baseline.js +1 -7
  503. package/dist/harness/viewpoint-baseline.js.map +1 -1
  504. package/dist/harness/viewpoint-ledger.d.ts +3 -13
  505. package/dist/harness/viewpoint-ledger.d.ts.map +1 -1
  506. package/dist/harness/viewpoint-ledger.js +8 -38
  507. package/dist/harness/viewpoint-ledger.js.map +1 -1
  508. package/dist/hooks/bash-write-targets.d.ts +15 -0
  509. package/dist/hooks/bash-write-targets.d.ts.map +1 -0
  510. package/dist/hooks/bash-write-targets.js +173 -0
  511. package/dist/hooks/bash-write-targets.js.map +1 -0
  512. package/dist/hooks/claude-hook-entry.d.ts +11 -0
  513. package/dist/hooks/claude-hook-entry.d.ts.map +1 -0
  514. package/dist/hooks/claude-hook-entry.js +137 -0
  515. package/dist/hooks/claude-hook-entry.js.map +1 -0
  516. package/dist/hooks/claude-transcript-turn.d.ts +11 -0
  517. package/dist/hooks/claude-transcript-turn.d.ts.map +1 -0
  518. package/dist/hooks/claude-transcript-turn.js +143 -0
  519. package/dist/hooks/claude-transcript-turn.js.map +1 -0
  520. package/dist/hooks/guard-delivery-contract-rule.d.ts +10 -0
  521. package/dist/hooks/guard-delivery-contract-rule.d.ts.map +1 -0
  522. package/dist/hooks/guard-delivery-contract-rule.js +152 -0
  523. package/dist/hooks/guard-delivery-contract-rule.js.map +1 -0
  524. package/dist/hooks/guard-protected-paths.d.ts +9 -0
  525. package/dist/hooks/guard-protected-paths.d.ts.map +1 -0
  526. package/dist/hooks/guard-protected-paths.js +106 -0
  527. package/dist/hooks/guard-protected-paths.js.map +1 -0
  528. package/dist/hooks/guard-rules.d.ts +37 -0
  529. package/dist/hooks/guard-rules.d.ts.map +1 -0
  530. package/dist/hooks/guard-rules.js +61 -0
  531. package/dist/hooks/guard-rules.js.map +1 -0
  532. package/dist/hooks/guard-tty-spoof-rule.d.ts +15 -0
  533. package/dist/hooks/guard-tty-spoof-rule.d.ts.map +1 -0
  534. package/dist/hooks/guard-tty-spoof-rule.js +21 -0
  535. package/dist/hooks/guard-tty-spoof-rule.js.map +1 -0
  536. package/dist/hooks/hand-back-core.d.ts +37 -0
  537. package/dist/hooks/hand-back-core.d.ts.map +1 -0
  538. package/dist/hooks/hand-back-core.js +115 -0
  539. package/dist/hooks/hand-back-core.js.map +1 -0
  540. package/dist/hooks/hook-cli-command.d.ts +9 -0
  541. package/dist/hooks/hook-cli-command.d.ts.map +1 -0
  542. package/dist/hooks/hook-cli-command.js +46 -0
  543. package/dist/hooks/hook-cli-command.js.map +1 -0
  544. package/dist/hooks/hook-registry.d.ts +10 -0
  545. package/dist/hooks/hook-registry.d.ts.map +1 -0
  546. package/dist/hooks/hook-registry.js +24 -0
  547. package/dist/hooks/hook-registry.js.map +1 -0
  548. package/dist/hooks/hook-result-contract.d.ts +50 -0
  549. package/dist/hooks/hook-result-contract.d.ts.map +1 -0
  550. package/dist/hooks/hook-result-contract.js +80 -0
  551. package/dist/hooks/hook-result-contract.js.map +1 -0
  552. package/dist/hooks/hook-toggles.d.ts +10 -0
  553. package/dist/hooks/hook-toggles.d.ts.map +1 -0
  554. package/dist/hooks/hook-toggles.js +107 -0
  555. package/dist/hooks/hook-toggles.js.map +1 -0
  556. package/dist/hooks/pre-tool-guard-hook.d.ts +10 -0
  557. package/dist/hooks/pre-tool-guard-hook.d.ts.map +1 -0
  558. package/dist/hooks/pre-tool-guard-hook.js +105 -0
  559. package/dist/hooks/pre-tool-guard-hook.js.map +1 -0
  560. package/dist/hooks/session-start-unit-state-hook.d.ts +13 -0
  561. package/dist/hooks/session-start-unit-state-hook.d.ts.map +1 -0
  562. package/dist/hooks/session-start-unit-state-hook.js +55 -0
  563. package/dist/hooks/session-start-unit-state-hook.js.map +1 -0
  564. package/dist/hooks/stop-next-step-hook.d.ts +16 -0
  565. package/dist/hooks/stop-next-step-hook.d.ts.map +1 -0
  566. package/dist/hooks/stop-next-step-hook.js +42 -0
  567. package/dist/hooks/stop-next-step-hook.js.map +1 -0
  568. package/dist/hooks/sungen-project-root.d.ts +19 -0
  569. package/dist/hooks/sungen-project-root.d.ts.map +1 -0
  570. package/dist/hooks/sungen-project-root.js +130 -0
  571. package/dist/hooks/sungen-project-root.js.map +1 -0
  572. package/dist/orchestrator/ai-skills/command-partial-includes.d.ts +15 -0
  573. package/dist/orchestrator/ai-skills/command-partial-includes.d.ts.map +1 -0
  574. package/dist/orchestrator/ai-skills/command-partial-includes.js +106 -0
  575. package/dist/orchestrator/ai-skills/command-partial-includes.js.map +1 -0
  576. package/dist/orchestrator/ai-skills/commands.d.ts +5 -1
  577. package/dist/orchestrator/ai-skills/commands.d.ts.map +1 -1
  578. package/dist/orchestrator/ai-skills/commands.js +16 -6
  579. package/dist/orchestrator/ai-skills/commands.js.map +1 -1
  580. package/dist/orchestrator/ai-skills/golden-skills.test.js +29 -0
  581. package/dist/orchestrator/ai-skills/golden-skills.test.js.map +1 -1
  582. package/dist/orchestrator/claude-hooks-install.d.ts +27 -0
  583. package/dist/orchestrator/claude-hooks-install.d.ts.map +1 -0
  584. package/dist/orchestrator/claude-hooks-install.js +203 -0
  585. package/dist/orchestrator/claude-hooks-install.js.map +1 -0
  586. package/dist/orchestrator/flow-manager.d.ts +1 -0
  587. package/dist/orchestrator/flow-manager.d.ts.map +1 -1
  588. package/dist/orchestrator/flow-manager.js +52 -3
  589. package/dist/orchestrator/flow-manager.js.map +1 -1
  590. package/dist/orchestrator/lockstep-version.d.ts +15 -5
  591. package/dist/orchestrator/lockstep-version.d.ts.map +1 -1
  592. package/dist/orchestrator/lockstep-version.js +30 -17
  593. package/dist/orchestrator/lockstep-version.js.map +1 -1
  594. package/dist/orchestrator/project-initializer.d.ts +6 -0
  595. package/dist/orchestrator/project-initializer.d.ts.map +1 -1
  596. package/dist/orchestrator/project-initializer.js +23 -0
  597. package/dist/orchestrator/project-initializer.js.map +1 -1
  598. package/dist/orchestrator/screen-manager.d.ts.map +1 -1
  599. package/dist/orchestrator/screen-manager.js +52 -4
  600. package/dist/orchestrator/screen-manager.js.map +1 -1
  601. package/dist/orchestrator/templates/ai-src/commands/add-api.md +2 -0
  602. package/dist/orchestrator/templates/ai-src/commands/add-flow.md +2 -0
  603. package/dist/orchestrator/templates/ai-src/commands/add-screen.md +2 -0
  604. package/dist/orchestrator/templates/ai-src/commands/create-data-test.md +1 -0
  605. package/dist/orchestrator/templates/ai-src/commands/create-test.md +36 -46
  606. package/dist/orchestrator/templates/ai-src/commands/dashboard.md +2 -0
  607. package/dist/orchestrator/templates/ai-src/commands/delivery.md +2 -0
  608. package/dist/orchestrator/templates/ai-src/commands/design.md +2 -0
  609. package/dist/orchestrator/templates/ai-src/commands/feedback.md +2 -0
  610. package/dist/orchestrator/templates/ai-src/commands/locale.md +2 -0
  611. package/dist/orchestrator/templates/ai-src/commands/review.md +2 -0
  612. package/dist/orchestrator/templates/ai-src/commands/run-test.md +6 -8
  613. package/dist/orchestrator/templates/ai-src/config/claude.md +20 -7
  614. package/dist/orchestrator/templates/ai-src/config/copilot.md +20 -7
  615. package/dist/orchestrator/templates/ai-src/partials/hand-back-rule.claude.md +20 -0
  616. package/dist/orchestrator/templates/ai-src/partials/hand-back-rule.codex.md +20 -0
  617. package/dist/orchestrator/templates/ai-src/partials/hand-back-rule.copilot.md +20 -0
  618. package/dist/orchestrator/templates/ai-src/skills/sungen-api-coverage-model/SKILL.md +1 -1
  619. package/dist/orchestrator/templates/ai-src/skills/sungen-capture-mobile/SKILL.md +3 -3
  620. package/dist/orchestrator/templates/ai-src/skills/sungen-data-factory/SKILL.md +9 -0
  621. package/dist/orchestrator/templates/ai-src/skills/sungen-harness-audit/SKILL.md +1 -3
  622. package/dist/orchestrator/templates/ai-src/skills/sungen-tc-generation/SKILL.md +1 -1
  623. package/dist/orchestrator/templates/ai-src/skills/sungen-viewpoint/SKILL.md +0 -18
  624. package/dist/orchestrator/templates/claude-hooks/sungen-hook.cjs +64 -0
  625. package/dist/orchestrator/viewpoint-pattern-catalog.d.ts +1 -4
  626. package/dist/orchestrator/viewpoint-pattern-catalog.d.ts.map +1 -1
  627. package/dist/orchestrator/viewpoint-pattern-catalog.js +2 -5
  628. package/dist/orchestrator/viewpoint-pattern-catalog.js.map +1 -1
  629. package/dist/utils/safe-yaml-parse.d.ts +8 -0
  630. package/dist/utils/safe-yaml-parse.d.ts.map +1 -0
  631. package/dist/utils/safe-yaml-parse.js +51 -0
  632. package/dist/utils/safe-yaml-parse.js.map +1 -0
  633. package/package.json +3 -3
  634. package/src/basis/anchor-grammar.ts +83 -0
  635. package/src/basis/anchor-hash.ts +27 -0
  636. package/src/basis/bm51-tables.ts +65 -0
  637. package/src/basis/extract-spec-anchors.ts +95 -0
  638. package/src/basis/migration-sentinel.ts +175 -0
  639. package/src/basis/spec-frontmatter.ts +68 -0
  640. package/src/basis/spec-sections.ts +35 -0
  641. package/src/basis/test-basis-schema.ts +81 -0
  642. package/src/capabilities/registry.ts +16 -0
  643. package/src/cli/commands/audit.ts +3 -26
  644. package/src/cli/commands/capability.ts +1 -1
  645. package/src/cli/commands/contract-derive-command.ts +60 -0
  646. package/src/cli/commands/contract.ts +130 -0
  647. package/src/cli/commands/delivery.ts +52 -3
  648. package/src/cli/commands/generate.ts +3 -1
  649. package/src/cli/commands/journey.ts +39 -14
  650. package/src/cli/commands/next.ts +60 -8
  651. package/src/cli/commands/update.ts +35 -8
  652. package/src/cli/index.ts +20 -32
  653. package/src/contract/approve-contract.ts +94 -0
  654. package/src/contract/assertion-matcher-vocabulary.ts +93 -0
  655. package/src/contract/build-contract-verdict.ts +108 -0
  656. package/src/contract/build-trace-conformance.ts +100 -0
  657. package/src/contract/classify-contract-change.ts +92 -0
  658. package/src/contract/classify-contract-unit.ts +47 -0
  659. package/src/contract/classify-trace-conformance.ts +116 -0
  660. package/src/contract/contract-git.ts +106 -0
  661. package/src/contract/contract-hash.ts +34 -0
  662. package/src/contract/contract-report-file.ts +25 -0
  663. package/src/contract/contract-schema.ts +137 -0
  664. package/src/contract/contract-units.ts +52 -0
  665. package/src/contract/contracts-lock-file.ts +97 -0
  666. package/src/contract/data-normalize.ts +66 -0
  667. package/src/contract/derive-free-feature.ts +110 -0
  668. package/src/contract/field-semantic-redaction.ts +80 -0
  669. package/src/contract/free-feature-blocks.ts +56 -0
  670. package/src/contract/lock-secret-guard.ts +95 -0
  671. package/src/contract/lock-vs-git-head.ts +38 -0
  672. package/src/contract/normalize-contract-step.ts +74 -0
  673. package/src/contract/normalize-feature-steps.ts +93 -0
  674. package/src/contract/oracle-strength.ts +80 -0
  675. package/src/contract/project-contract-blockers.ts +36 -0
  676. package/src/contract/record-contract-approval.ts +70 -0
  677. package/src/contract/render-free-gherkin.ts +113 -0
  678. package/src/contract/render-trace-sentence.ts +98 -0
  679. package/src/contract/render-trace-target.ts +68 -0
  680. package/src/contract/resolve-unit-trace-identities.ts +35 -0
  681. package/src/contract/trace/collect-trace-evidence.ts +109 -0
  682. package/src/contract/trace/identity-cache.ts +61 -0
  683. package/src/contract/trace/select-final-attempt.ts +70 -0
  684. package/src/contract/trace/snapshot-html-renderer.ts +136 -0
  685. package/src/contract/trace/snapshot-resolver.ts +66 -0
  686. package/src/contract/trace/snapshot-store.ts +151 -0
  687. package/src/contract/trace/target-identity.ts +104 -0
  688. package/src/contract/trace/test-step-join.ts +103 -0
  689. package/src/contract/trace/trace-binding.ts +56 -0
  690. package/src/contract/trace/trace-file-reader.ts +123 -0
  691. package/src/contract/trace/trace-fingerprint.ts +68 -0
  692. package/src/contract/trace/trace-identity-resolution.ts +74 -0
  693. package/src/contract/trace/trace-run-record.ts +74 -0
  694. package/src/contract/trace/trace-steps.ts +88 -0
  695. package/src/contract/trace/trace-zip-limits.ts +73 -0
  696. package/src/contract/trace/trace-zip-reader.ts +127 -0
  697. package/src/contract/verify-approval-decisions.ts +60 -0
  698. package/src/decisions/append-decision.ts +35 -0
  699. package/src/decisions/confirmed-decision-commands.ts +128 -0
  700. package/src/decisions/decision-file.ts +93 -0
  701. package/src/decisions/decision-identity.ts +73 -0
  702. package/src/decisions/decision-integrity-check.ts +61 -0
  703. package/src/decisions/decision-schema.ts +76 -0
  704. package/src/decisions/decision-source.ts +14 -0
  705. package/src/decisions/exclusive-file-create.ts +42 -0
  706. package/src/decisions/git-head-trust.ts +32 -0
  707. package/src/decisions/human-confirmation.ts +114 -0
  708. package/src/decisions/legacy-waiver-migration.ts +135 -0
  709. package/src/decisions/read-decisions.ts +61 -0
  710. package/src/decisions/viewpoint-baseline-adapter.ts +74 -0
  711. package/src/decisions/waiver-decisions.ts +56 -0
  712. package/src/exporters/matrix/build.ts +11 -9
  713. package/src/exporters/matrix/export.ts +5 -0
  714. package/src/exporters/matrix/gates.ts +62 -129
  715. package/src/exporters/matrix/render-csv.ts +3 -0
  716. package/src/exporters/matrix/render-gate-overrides-sheet.ts +50 -0
  717. package/src/exporters/matrix/render-xlsx.ts +3 -0
  718. package/src/exporters/matrix/types.ts +4 -1
  719. package/src/generators/test-generator/code-generator.ts +13 -0
  720. package/src/graph/evaluate-graph.ts +62 -0
  721. package/src/graph/locate-finding.ts +93 -0
  722. package/src/graph/node-decl.ts +65 -0
  723. package/src/graph/nodes/core-node-catalog.ts +15 -0
  724. package/src/graph/nodes/test-case-contract-nodes.ts +69 -0
  725. package/src/graph/nodes/test-case-nodes.ts +68 -0
  726. package/src/graph/nodes/unit-audit-nodes.ts +95 -0
  727. package/src/graph/nodes/unit-contract-node.ts +82 -0
  728. package/src/graph/nodes/unit-design-nodes.ts +88 -0
  729. package/src/graph/nodes/unit-execution-nodes.ts +77 -0
  730. package/src/graph/test-case-identity.ts +75 -0
  731. package/src/graph/test-case-results.ts +90 -0
  732. package/src/graph/test-case-satisfied.ts +55 -0
  733. package/src/graph/test-case-state-shape.ts +62 -0
  734. package/src/graph/test-case-states.ts +84 -0
  735. package/src/graph/unit-artifact-probes.ts +77 -0
  736. package/src/graph/unit-state-facts.ts +112 -0
  737. package/src/harness/audit.ts +29 -18
  738. package/src/harness/catalog/gate-rules.yaml +647 -0
  739. package/src/harness/gates/audit-gate-terms.ts +80 -0
  740. package/src/harness/gates/audit-gate-verdict.ts +78 -0
  741. package/src/harness/gates/audit-input-hash.ts +55 -0
  742. package/src/harness/gates/audit-report-verification.ts +173 -0
  743. package/src/harness/gates/decisions-hash.ts +42 -0
  744. package/src/harness/gates/delivery-checklist.ts +120 -0
  745. package/src/harness/gates/delivery-decision-gate.ts +111 -0
  746. package/src/harness/gates/delivery-decision-step.ts +73 -0
  747. package/src/harness/gates/gate-override-report.ts +114 -0
  748. package/src/harness/gates/gate-override-scope.ts +66 -0
  749. package/src/harness/gates/gate-override-validation.ts +75 -0
  750. package/src/harness/gates/gate-rule-catalog.ts +82 -0
  751. package/src/harness/gates/gate-terms.ts +59 -0
  752. package/src/harness/gates/in-run-decision-check.ts +99 -0
  753. package/src/harness/gates/journey-gate-inputs.ts +89 -0
  754. package/src/harness/gates/migrated-waiver-review.ts +68 -0
  755. package/src/harness/gates/resolve-rule.ts +94 -0
  756. package/src/harness/gates/unit-gate-overrides.ts +99 -0
  757. package/src/harness/journey.ts +122 -27
  758. package/src/harness/manifest.ts +67 -43
  759. package/src/harness/next-step.ts +59 -210
  760. package/src/harness/parse.ts +25 -15
  761. package/src/harness/script-check.ts +20 -5
  762. package/src/harness/sensors.ts +55 -49
  763. package/src/harness/viewpoint-baseline.ts +1 -7
  764. package/src/harness/viewpoint-ledger.ts +11 -52
  765. package/src/hooks/bash-write-targets.ts +109 -0
  766. package/src/hooks/claude-hook-entry.ts +85 -0
  767. package/src/hooks/claude-transcript-turn.ts +96 -0
  768. package/src/hooks/guard-delivery-contract-rule.ts +110 -0
  769. package/src/hooks/guard-protected-paths.ts +70 -0
  770. package/src/hooks/guard-rules.ts +98 -0
  771. package/src/hooks/guard-tty-spoof-rule.ts +31 -0
  772. package/src/hooks/hand-back-core.ts +106 -0
  773. package/src/hooks/hook-cli-command.ts +17 -0
  774. package/src/hooks/hook-registry.ts +24 -0
  775. package/src/hooks/hook-result-contract.ts +114 -0
  776. package/src/hooks/hook-toggles.ts +66 -0
  777. package/src/hooks/pre-tool-guard-hook.ts +67 -0
  778. package/src/hooks/session-start-unit-state-hook.ts +54 -0
  779. package/src/hooks/stop-next-step-hook.ts +37 -0
  780. package/src/hooks/sungen-project-root.ts +80 -0
  781. package/src/orchestrator/ai-skills/command-partial-includes.ts +72 -0
  782. package/src/orchestrator/ai-skills/commands.ts +22 -8
  783. package/src/orchestrator/ai-skills/golden-skills.test.ts +23 -0
  784. package/src/orchestrator/claude-hooks-install.ts +168 -0
  785. package/src/orchestrator/flow-manager.ts +53 -3
  786. package/src/orchestrator/lockstep-version.ts +28 -15
  787. package/src/orchestrator/project-initializer.ts +21 -0
  788. package/src/orchestrator/screen-manager.ts +52 -4
  789. package/src/orchestrator/templates/ai-src/commands/add-api.md +2 -0
  790. package/src/orchestrator/templates/ai-src/commands/add-flow.md +2 -0
  791. package/src/orchestrator/templates/ai-src/commands/add-screen.md +2 -0
  792. package/src/orchestrator/templates/ai-src/commands/create-data-test.md +1 -0
  793. package/src/orchestrator/templates/ai-src/commands/create-test.md +36 -46
  794. package/src/orchestrator/templates/ai-src/commands/dashboard.md +2 -0
  795. package/src/orchestrator/templates/ai-src/commands/delivery.md +2 -0
  796. package/src/orchestrator/templates/ai-src/commands/design.md +2 -0
  797. package/src/orchestrator/templates/ai-src/commands/feedback.md +2 -0
  798. package/src/orchestrator/templates/ai-src/commands/locale.md +2 -0
  799. package/src/orchestrator/templates/ai-src/commands/review.md +2 -0
  800. package/src/orchestrator/templates/ai-src/commands/run-test.md +6 -8
  801. package/src/orchestrator/templates/ai-src/config/claude.md +20 -7
  802. package/src/orchestrator/templates/ai-src/config/copilot.md +20 -7
  803. package/src/orchestrator/templates/ai-src/partials/hand-back-rule.claude.md +20 -0
  804. package/src/orchestrator/templates/ai-src/partials/hand-back-rule.codex.md +20 -0
  805. package/src/orchestrator/templates/ai-src/partials/hand-back-rule.copilot.md +20 -0
  806. package/src/orchestrator/templates/ai-src/skills/sungen-api-coverage-model/SKILL.md +1 -1
  807. package/src/orchestrator/templates/ai-src/skills/sungen-capture-mobile/SKILL.md +3 -3
  808. package/src/orchestrator/templates/ai-src/skills/sungen-data-factory/SKILL.md +9 -0
  809. package/src/orchestrator/templates/ai-src/skills/sungen-harness-audit/SKILL.md +1 -3
  810. package/src/orchestrator/templates/ai-src/skills/sungen-tc-generation/SKILL.md +1 -1
  811. package/src/orchestrator/templates/ai-src/skills/sungen-viewpoint/SKILL.md +0 -18
  812. package/src/orchestrator/templates/claude-hooks/sungen-hook.cjs +64 -0
  813. package/src/orchestrator/viewpoint-pattern-catalog.ts +2 -5
  814. package/src/utils/safe-yaml-parse.ts +44 -0
  815. package/dist/cli/commands/viewpoint.d.ts +0 -7
  816. package/dist/cli/commands/viewpoint.d.ts.map +0 -1
  817. package/dist/cli/commands/viewpoint.js +0 -70
  818. package/dist/cli/commands/viewpoint.js.map +0 -1
  819. package/dist/harness/viewpoint-draft-header.d.ts +0 -7
  820. package/dist/harness/viewpoint-draft-header.d.ts.map +0 -1
  821. package/dist/harness/viewpoint-draft-header.js +0 -100
  822. package/dist/harness/viewpoint-draft-header.js.map +0 -1
  823. package/dist/harness/viewpoint-mode.d.ts +0 -9
  824. package/dist/harness/viewpoint-mode.d.ts.map +0 -1
  825. package/dist/harness/viewpoint-mode.js +0 -52
  826. package/dist/harness/viewpoint-mode.js.map +0 -1
  827. package/dist/harness/viewpoint-priority.d.ts +0 -19
  828. package/dist/harness/viewpoint-priority.d.ts.map +0 -1
  829. package/dist/harness/viewpoint-priority.js +0 -36
  830. package/dist/harness/viewpoint-priority.js.map +0 -1
  831. package/dist/harness/viewpoint-review-open.d.ts +0 -6
  832. package/dist/harness/viewpoint-review-open.d.ts.map +0 -1
  833. package/dist/harness/viewpoint-review-open.js +0 -90
  834. package/dist/harness/viewpoint-review-open.js.map +0 -1
  835. package/dist/harness/viewpoint-scan-refs.d.ts +0 -50
  836. package/dist/harness/viewpoint-scan-refs.d.ts.map +0 -1
  837. package/dist/harness/viewpoint-scan-refs.js +0 -200
  838. package/dist/harness/viewpoint-scan-refs.js.map +0 -1
  839. package/dist/harness/viewpoint-scan.d.ts +0 -41
  840. package/dist/harness/viewpoint-scan.d.ts.map +0 -1
  841. package/dist/harness/viewpoint-scan.js +0 -118
  842. package/dist/harness/viewpoint-scan.js.map +0 -1
  843. package/dist/orchestrator/templates/ai-src/skills/sungen-viewpoint/review-checklist.md +0 -63
  844. package/dist/orchestrator/templates/ai-src/skills/sungen-viewpoint/viewpoint-template.md +0 -158
  845. package/dist/orchestrator/viewpoint-scaffold.d.ts +0 -3
  846. package/dist/orchestrator/viewpoint-scaffold.d.ts.map +0 -1
  847. package/dist/orchestrator/viewpoint-scaffold.js +0 -70
  848. package/dist/orchestrator/viewpoint-scaffold.js.map +0 -1
  849. package/src/cli/commands/viewpoint.ts +0 -58
  850. package/src/harness/viewpoint-draft-header.ts +0 -55
  851. package/src/harness/viewpoint-mode.ts +0 -49
  852. package/src/harness/viewpoint-priority.ts +0 -38
  853. package/src/harness/viewpoint-review-open.ts +0 -51
  854. package/src/harness/viewpoint-scan-refs.ts +0 -154
  855. package/src/harness/viewpoint-scan.ts +0 -111
  856. package/src/orchestrator/templates/ai-src/skills/sungen-viewpoint/review-checklist.md +0 -63
  857. package/src/orchestrator/templates/ai-src/skills/sungen-viewpoint/viewpoint-template.md +0 -158
  858. package/src/orchestrator/viewpoint-scaffold.ts +0 -36
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.VIEWPOINT_TEMPLATE_PATH = void 0;
37
- exports.viewpointScaffold = viewpointScaffold;
38
- /**
39
- * The `requirements/test-viewpoint.md` that `sungen add` and `sungen add-flow` write.
40
- *
41
- * It IS the QA template the AI drafts from (`skills/sungen-viewpoint/viewpoint-template.md`), read
42
- * at run time so QA and AI always start from the same file. Two substitutions only: the title, and
43
- * the template's sample UI-pattern rows → the full catalog for the project's platform (#842).
44
- *
45
- * Every sample row sits inside `<!-- -->`, so an untouched scaffold declares no viewpoint and the
46
- * audit reports VIEWPOINT-MISSING instead of measuring the suite against samples (#841). The
47
- * scaffold never carries an active `drafted-by: ai` line: that marks an AI draft, and this is not one.
48
- */
49
- const fs = __importStar(require("fs"));
50
- const path = __importStar(require("path"));
51
- const viewpoint_pattern_catalog_1 = require("./viewpoint-pattern-catalog");
52
- exports.VIEWPOINT_TEMPLATE_PATH = path.join(__dirname, 'templates', 'ai-src', 'skills', 'sungen-viewpoint', 'viewpoint-template.md');
53
- /** A UI-pattern row: `| 12 | Modal / Dialog | … |`. Only section 1 of the template has them. */
54
- const PATTERN_ROW = /^\|\s*\d+\s*\|/;
55
- function viewpointScaffold(title, isMobile) {
56
- const lines = fs.readFileSync(exports.VIEWPOINT_TEMPLATE_PATH, 'utf-8').replace(/\r\n?/g, '\n').split('\n');
57
- const titleAt = lines.findIndex((l) => l.startsWith('# '));
58
- const rowsAt = lines.findIndex((l) => PATTERN_ROW.test(l));
59
- // A template edit that drops either anchor must fail here, not ship a scaffold without them.
60
- if (titleAt < 0 || rowsAt < 0) {
61
- throw new Error(`viewpoint-template.md has no title or no UI-pattern sample rows: ${exports.VIEWPOINT_TEMPLATE_PATH}`);
62
- }
63
- let rowsEnd = rowsAt;
64
- while (rowsEnd < lines.length && PATTERN_ROW.test(lines[rowsEnd]))
65
- rowsEnd++;
66
- lines[titleAt] = `# Test Viewpoint — ${title}`;
67
- lines.splice(rowsAt, rowsEnd - rowsAt, ...(0, viewpoint_pattern_catalog_1.uiPatternRows)(isMobile));
68
- return lines.join('\n');
69
- }
70
- //# sourceMappingURL=viewpoint-scaffold.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"viewpoint-scaffold.js","sourceRoot":"","sources":["../../src/orchestrator/viewpoint-scaffold.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,8CAaC;AAnCD;;;;;;;;;;GAUG;AACH,uCAAyB;AACzB,2CAA6B;AAC7B,2EAA4D;AAE/C,QAAA,uBAAuB,GAAG,IAAI,CAAC,IAAI,CAC9C,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,uBAAuB,CACxF,CAAC;AAEF,gGAAgG;AAChG,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAErC,SAAgB,iBAAiB,CAAC,KAAa,EAAE,QAAiB;IAChE,MAAM,KAAK,GAAG,EAAE,CAAC,YAAY,CAAC,+BAAuB,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACpG,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,6FAA6F;IAC7F,IAAI,OAAO,GAAG,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,oEAAoE,+BAAuB,EAAE,CAAC,CAAC;IACjH,CAAC;IACD,IAAI,OAAO,GAAG,MAAM,CAAC;IACrB,OAAO,OAAO,GAAG,KAAK,CAAC,MAAM,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IAC7E,KAAK,CAAC,OAAO,CAAC,GAAG,sBAAsB,KAAK,EAAE,CAAC;IAC/C,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,IAAA,yCAAa,EAAC,QAAQ,CAAC,CAAC,CAAC;IACnE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,58 +0,0 @@
1
- import { Command } from 'commander';
2
- import { resolveUnit } from '../resolve-unit';
3
- import { scanViewpointUnit, ViewpointScan } from '../../harness/viewpoint-scan';
4
-
5
- const SHOWN = 10;
6
-
7
- /** `a, b, c … +N more` — a list long enough to scroll past is a count plus a sample. */
8
- const sample = (xs: string[]): string => (xs.length <= SHOWN ? xs.join(', ') : `${xs.slice(0, SHOWN).join(', ')} … +${xs.length - SHOWN} more`);
9
-
10
- function printScan(name: string, s: ViewpointScan): void {
11
- const L = console.log;
12
- L(`\n━━━ Viewpoint scan: ${name} ━━━`);
13
- L(` mode ${s.mode} (${s.modeReason}) — ${s.mode === 2 ? 'the AI drafts / revises its own draft' : 'review only, the file is never edited'}`);
14
- L(` ${s.vpRows.length} rows (${s.distinctIds} distinct ids) without Kỳ vọng: ${s.rowsWithoutExpected.length} manual: ${s.manualRows.length}`);
15
- if (s.note) L(` ⚠ ${s.note}`);
16
- if (s.rowsWithoutExpected.length) L(` no Kỳ vọng: ${sample(s.rowsWithoutExpected)}`);
17
- if (s.manualRows.length) L(` manual: ${sample(s.manualRows)}`);
18
- if (s.itemSource === 'none') L(' item source: none (the viewpoint cites no spec id, spec item or UI-NNN)');
19
- else L(` item source: ${s.itemSource} uncited items: ${s.uncitedItems.length}`);
20
- if (s.uncitedItems.length) L(` ${sample(s.uncitedItems.map((i) => (i.name ? `${i.ref} (${i.name})` : i.ref)))}`);
21
- if (s.withoutScenario === null) L(' scenarios: no feature file yet');
22
- else L(` VP ids with no scenario: ${s.withoutScenario.length}${s.withoutScenario.length ? `\n ${sample(s.withoutScenario)}` : ''}`);
23
- L('');
24
- }
25
-
26
- /**
27
- * `sungen viewpoint scan` — ids and item refs only. Read-only: no audit finding, no score, no
28
- * baseline effect; the file is never edited. What the rows MEAN is the review skill's job.
29
- */
30
- export function registerViewpointCommand(program: Command): void {
31
- const viewpoint = program
32
- .command('viewpoint')
33
- .description('Read a unit\'s requirements/test-viewpoint.md');
34
-
35
- viewpoint
36
- .command('scan')
37
- .description('List VP rows (full-id first cell), the item numbers they cite, uncited spec items and VP ids no scenario carries — read-only')
38
- .option('-s, --screen <name>', 'Screen (or flow) name')
39
- .option('--flow <name>', 'Flow name (qa/flows/<name>)')
40
- .option('--json', 'Output the scan as JSON')
41
- .action((o: { screen?: string; flow?: string; json?: boolean }) => {
42
- try {
43
- if (o.screen && o.flow) throw new Error('Provide --screen <name> or --flow <name>, not both');
44
- const name = o.screen || o.flow;
45
- if (!name) throw new Error('Provide --screen <name> or --flow <name>');
46
- const unit = resolveUnit(name);
47
- if (!unit) throw new Error(`Not found: qa/screens/${name} or qa/flows/${name}`);
48
- if (o.flow && unit.kind !== 'flow') throw new Error(`Not a flow: ${name} resolves to qa/${unit.unitId} (use --screen)`);
49
-
50
- const scan = scanViewpointUnit(unit.dir, name);
51
- if (o.json) console.log(JSON.stringify(scan, null, 2));
52
- else printScan(name, scan);
53
- } catch (e) {
54
- console.error('Error:', e instanceof Error ? e.message : e);
55
- process.exit(1);
56
- }
57
- });
58
- }
@@ -1,55 +0,0 @@
1
- import * as fs from 'fs';
2
- import { stripHtmlComments } from './read-text';
3
- import { writeFileAtomic } from './write-atomic';
4
-
5
- /**
6
- * `drafted-by: ai` — provenance, not acceptance. The AI writes it as the first header line of a
7
- * viewpoint it drafted; while it is there the file is an unreviewed draft: the audit records no
8
- * baseline for it and holds the two axes measured against it. `--accept-viewpoint` removes it.
9
- *
10
- * Read by a line scan, not by the viewpoint parser: the key must be found in a file the parser
11
- * judges nothing about, and in a QA-written file it simply is not there.
12
- */
13
- const DRAFT_KEY = /^\s*drafted-by:\s*ai\b/i;
14
- /** The key is a header line: looking further down would read prose that merely mentions it. */
15
- const HEADER_LINES = 15;
16
-
17
- /** A line with its own terminator, so a removal keeps CRLF and a lone `\r` exactly as written. */
18
- const withTerminator = (raw: string): string[] => raw.match(/[^\r\n]*(?:\r\n|\r|\n)|[^\r\n]+$/g) ?? [];
19
-
20
- /** Index of the draft line in `raw`, or -1. Comments are blanked line-for-line, so indexes agree with the raw file. */
21
- function draftLineIndex(raw: string): number {
22
- const visible = stripHtmlComments(raw.replace(/\r\n?/g, '\n')).split('\n');
23
- let seen = 0;
24
- for (let i = 0; i < visible.length && seen < HEADER_LINES; i++) {
25
- if (visible[i].trim() === '') continue;
26
- if (DRAFT_KEY.test(visible[i])) return i;
27
- seen++;
28
- }
29
- return -1;
30
- }
31
-
32
- export function isAiDraft(text: string): boolean {
33
- return draftLineIndex(text) >= 0;
34
- }
35
-
36
- /** `raw` without the one draft line; every other byte is untouched. A file with no draft line comes back as is. */
37
- export function removeDraftLine(raw: string): string {
38
- const at = draftLineIndex(raw);
39
- if (at < 0) return raw;
40
- return withTerminator(raw).filter((_, i) => i !== at).join('');
41
- }
42
-
43
- export function viewpointFileIsAiDraft(viewpointPath: string): boolean {
44
- try { return isAiDraft(fs.readFileSync(viewpointPath, 'utf-8')); } catch { return false; }
45
- }
46
-
47
- /** Remove the draft line from the file, atomically. True when a line was removed; throws a clear error when the write fails. */
48
- export function removeDraftLineFromFile(viewpointPath: string): boolean {
49
- const raw = fs.readFileSync(viewpointPath, 'utf-8');
50
- if (!isAiDraft(raw)) return false;
51
- try { writeFileAtomic(viewpointPath, removeDraftLine(raw)); } catch (err) {
52
- throw new Error(`could not remove the \`drafted-by: ai\` line from ${viewpointPath} (${err instanceof Error ? err.message : err}) — the file is unchanged; remove the line by hand`);
53
- }
54
- return true;
55
- }
@@ -1,49 +0,0 @@
1
- /**
2
- * Which create-test mode a unit's test-viewpoint.md calls for — the table in create-test.md,
3
- * computed so the agent reads it from `sungen viewpoint scan` instead of inferring it.
4
- *
5
- * mode 2 (AI drafts / re-reviews its draft): file missing · untouched scaffold · first line
6
- * `drafted-by: ai` · VP rows exist but none has a Kỳ vọng
7
- * mode 1 (review only, never edit): anything else — a QA-written file, with or without VP ids
8
- *
9
- * "Untouched scaffold" is checked on RAW lines against the template the scaffold is written from:
10
- * apart from the first `# ` line (the title), every non-blank line must be a template line —
11
- * comments included, so a QA note inside `<!-- -->` or under its own `# ` heading makes the file
12
- * the QA's (owner decision 2026-10-14: a QA file is never overwritten). Every doubt falls to
13
- * mode 1: a scaffold from an older sungen (other template lines) or an unreadable template.
14
- */
15
- import { isAiDraft } from './viewpoint-draft-header';
16
- import { viewpointScaffold } from '../orchestrator/viewpoint-scaffold';
17
-
18
- export type ViewpointMode = 1 | 2;
19
-
20
- /** Trimmed non-blank lines without the title (the first `# ` line), BOM and CRLF ignored. */
21
- function bodyLines(text: string): string[] {
22
- const lines = text.replace(/^/, '').replace(/\r\n?/g, '\n').split('\n').map((l) => l.trim()).filter(Boolean);
23
- const title = lines.findIndex((l) => l.startsWith('# '));
24
- if (title >= 0) lines.splice(title, 1);
25
- return lines;
26
- }
27
-
28
- let templateLines: Set<string> | null = null;
29
- function isUntouchedScaffold(raw: string): boolean {
30
- if (!templateLines) {
31
- try {
32
- templateLines = new Set([false, true].flatMap((mobile) => bodyLines(viewpointScaffold('', mobile))));
33
- } catch {
34
- return false; // no template to compare with → treat the file as the QA's
35
- }
36
- }
37
- const known = templateLines;
38
- return bodyLines(raw).every((l) => known.has(l));
39
- }
40
-
41
- /** `raw` is the file as written (null when missing); `rows` are its VP rows from the scan. */
42
- export function viewpointMode(raw: string | null, rows: { hasExpected: boolean }[]): { mode: ViewpointMode; reason: string } {
43
- if (raw === null) return { mode: 2, reason: 'file missing' };
44
- if (isAiDraft(raw)) return { mode: 2, reason: 'drafted-by: ai (re-review)' };
45
- if (rows.length > 0) {
46
- return rows.some((r) => r.hasExpected) ? { mode: 1, reason: 'QA-written' } : { mode: 2, reason: 'VP rows without Kỳ vọng' };
47
- }
48
- return isUntouchedScaffold(raw) ? { mode: 2, reason: 'untouched scaffold' } : { mode: 1, reason: 'QA-written, no VP ids' };
49
- }
@@ -1,38 +0,0 @@
1
- /**
2
- * One reading of a priority — a viewpoint row's cell or a scenario's tag.
3
- *
4
- * The overview parser, the ledger's uniform-priority check and PRIORITY-CONTRADICTED each read a
5
- * priority their own way (`/high/i` substrings, raw words, a one-off medium→normal), so the same
6
- * row could be `Medium` to one and `Unknown` to another — `Med`, which QA writes, was `Unknown`.
7
- * The vocabulary is `high | normal | low`; `critical`, `medium` and `med` are read as aliases.
8
- */
9
- export type PriorityLevel = 'high' | 'normal' | 'low' | 'deferred' | 'skip' | 'unknown';
10
-
11
- const WORD: Record<string, PriorityLevel> = {
12
- critical: 'high', high: 'high',
13
- medium: 'normal', med: 'normal', normal: 'normal',
14
- low: 'low', deferred: 'deferred',
15
- };
16
- /** "Declared not applicable" — one level, so every consumer checks one word. */
17
- const NOT_APPLICABLE = /^(?:skip(?:ped)?|n\/a|none|not applicable)$/;
18
-
19
- /**
20
- * A priority cell or tag → its level. The whole cell being a word is the clean case; otherwise the
21
- * overview has always read prose by SUBSTRING in precedence order (`High — complex form`,
22
- * `Medium-High`), and keeps doing so. The substring words stay unbounded for `high|medium|low`
23
- * (existing behaviour); the newer `critical|normal|med` need word boundaries (`Medical` is not `Med`).
24
- */
25
- export function parsePriority(cell: string): PriorityLevel {
26
- const w = cell.replace(/[*_`]/g, '').replace(/\.+$/, '').trim().toLowerCase();
27
- if (WORD[w]) return WORD[w];
28
- if (NOT_APPLICABLE.test(w)) return 'skip';
29
- if (/high|\bcritical\b/.test(w)) return 'high';
30
- if (/medium|\bnormal\b|\bmed\b/.test(w)) return 'normal';
31
- if (/low/.test(w)) return 'low';
32
- return 'unknown';
33
- }
34
-
35
- /** The public `ViewpointEntry.priority` spelling of a level — the exported type is unchanged. */
36
- export function toEntryPriority(level: PriorityLevel): 'High' | 'Medium' | 'Low' | 'Unknown' {
37
- return level === 'high' ? 'High' : level === 'normal' ? 'Medium' : level === 'low' ? 'Low' : 'Unknown';
38
- }
@@ -1,51 +0,0 @@
1
- /**
2
- * VIEWPOINT-REVIEW-OPEN (info) — the audit's one line about `requirements/viewpoint-review.md`.
3
- *
4
- * create-test reviews test-viewpoint.md with the sungen-viewpoint checklist and writes each point a
5
- * QA should look at as a table row whose last cell is `[ ]`; the QA ticks it `[x]` or deletes the
6
- * row. While rows stay unticked the audit says how many, once. Advisory only: no score, no gate, no
7
- * baseline effect. A missing or unreadable file says nothing — the review is optional input.
8
- */
9
- import * as fs from 'fs';
10
- import * as path from 'path';
11
- import { stripHtmlComments } from './read-text';
12
-
13
- export const VIEWPOINT_REVIEW_FILE = 'viewpoint-review.md';
14
-
15
- const SEPARATOR = /^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/;
16
- /** A table separator, not a `---` rule under a row. */
17
- const isSeparator = (line: string): boolean => SEPARATOR.test(line) && line.includes('|');
18
- const UNTICKED = /^\[\s?\]$/;
19
-
20
- /** The last cell of a markdown table row, or null for a line that is not one. */
21
- function lastCell(line: string): string | null {
22
- const t = line.trim();
23
- if (!t.startsWith('|') || !t.endsWith('|') || t.length < 2) return null;
24
- const cells = t.slice(1, -1).split(/(?<!\\)\|/);
25
- return cells[cells.length - 1].trim();
26
- }
27
-
28
- /** Body rows whose last cell is `[ ]`. The header row (`… | [ ] |` above `|---|`) is not a point. */
29
- export function openReviewPoints(text: string): number {
30
- const lines = stripHtmlComments(text.replace(/\r\n?/g, '\n')).split('\n');
31
- let open = 0;
32
- for (let i = 0; i < lines.length; i++) {
33
- if (isSeparator(lines[i]) || isSeparator(lines[i + 1] ?? '')) continue;
34
- const last = lastCell(lines[i]);
35
- if (last !== null && UNTICKED.test(last)) open++;
36
- }
37
- return open;
38
- }
39
-
40
- /** The info finding for one unit's `requirements/` directory; empty when nothing is open. */
41
- export function viewpointReviewOpenFindings(requirementsDir: string): string[] {
42
- let text: string;
43
- try {
44
- text = fs.readFileSync(path.join(requirementsDir, VIEWPOINT_REVIEW_FILE), 'utf-8');
45
- } catch {
46
- return [];
47
- }
48
- const open = openReviewPoints(text);
49
- if (open === 0) return [];
50
- return [`VIEWPOINT-REVIEW-OPEN (info): ${open} open point(s) in requirements/${VIEWPOINT_REVIEW_FILE} — the checklist review of test-viewpoint.md is waiting for QA. QA: fix the viewpoint where you agree, then tick the row \`[x]\` or delete it. Not scored; an agent does not tick rows for the QA.`];
51
- }
@@ -1,154 +0,0 @@
1
- /**
2
- * Building blocks of `sungen viewpoint scan` (viewpoint-scan.ts): the markdown table walker, the
3
- * item-reference reader and the item universe. Pure, read-only, format-tolerant by design — a
4
- * QA-written file is never judged here, only its ids and item numbers are read.
5
- */
6
- import * as fs from 'fs';
7
- import * as path from 'path';
8
- import { readTextFile, stripHtmlComments } from './read-text';
9
- import { parseUiInventory } from './ui-inventory';
10
- import { parseSpecClauses } from './spec-coverage';
11
-
12
- export interface TableRow {
13
- /** 1-based line in the (comment-stripped, newline-preserving) text. */
14
- line: number;
15
- raw: string;
16
- /** Cells with `**`, backticks and edge spaces removed. */
17
- cells: string[];
18
- /** The table's header cells; null for a table with no separator line. */
19
- header: string[] | null;
20
- /** Text of every heading enclosing the row (outermost first) — where a `# MANUAL/ENV` mark may sit. */
21
- section: string;
22
- }
23
-
24
- const SEPARATOR = /^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/;
25
- const splitCells = (line: string): string[] => line.trim().replace(/^\|/, '').replace(/\|$/, '')
26
- .split(/(?<!\\)\|/).map((c) => c.replace(/\*\*|`/g, '').trim());
27
-
28
- /** Every body row of every markdown table, with its header and enclosing headings. */
29
- export function tableRows(text: string): TableRow[] {
30
- const lines = text.split('\n');
31
- const out: TableRow[] = [];
32
- const headings: string[] = []; // index = level − 1
33
- let header: string[] | null = null;
34
- for (let i = 0; i < lines.length; i++) {
35
- const raw = lines[i];
36
- const h = raw.match(/^(#{1,6})\s+(.*)$/);
37
- if (h) { headings.length = h[1].length - 1; headings[h[1].length - 1] = h[2]; header = null; continue; }
38
- if (!raw.includes('|')) { header = null; continue; }
39
- if (SEPARATOR.test(raw)) continue;
40
- if (i + 1 < lines.length && SEPARATOR.test(lines[i + 1])) { header = splitCells(raw); continue; }
41
- out.push({ line: i + 1, raw, cells: splitCells(raw), header, section: headings.join(' ') });
42
- }
43
- return out;
44
- }
45
-
46
- const NUM = String.raw`(?<!\d)\d{1,3}(?:\.\d{1,3})*(?![\d])`;
47
- const LIST = new RegExp(`(?:\\bitems?|項目|(?<![\\w-])UI[\\s-]*#?|#)\\s*(${NUM}(?:\\s*(?:[-–—~〜~,;&/]|(?<![\\p{L}\\p{N}])(?:và|and)(?![\\p{L}\\p{N}]))\\s*${NUM})*)`, 'giu');
48
-
49
- /** `009` → `9`, `4.03` → `4.3`; null when the text is not a plain (dotted) number. */
50
- export function normRef(s: string): string | null {
51
- const t = s.replace(/[[\]§#]/g, '').trim();
52
- return /^\d+(\.\d+)*$/.test(t) ? t.split('.').map((p) => String(Number(p))).join('.') : null;
53
- }
54
-
55
- /**
56
- * The refs strictly between `a` and `b` (normalised): `4`–`6` → `5`, `5.4`–`5.8` → `5.5 … 5.7`.
57
- * Only the last level steps, so both ends need the same prefix; `5.4–6.2` or `3–5.2` cannot be
58
- * enumerated without the item list and give nothing.
59
- */
60
- function between(a: string, b: string): string[] {
61
- const pa = a.split('.');
62
- const pb = b.split('.');
63
- if (pa.length !== pb.length || pa.slice(0, -1).join('.') !== pb.slice(0, -1).join('.')) return [];
64
- const lo = Number(pa[pa.length - 1]);
65
- const hi = Number(pb[pb.length - 1]);
66
- if (!(hi > lo && hi - lo < 200)) return [];
67
- const prefix = pa.slice(0, -1).map((p) => `${p}.`).join('');
68
- return Array.from({ length: hi - lo - 1 }, (_, k) => `${prefix}${lo + 1 + k}`);
69
- }
70
-
71
- /**
72
- * Item numbers a cell cites: `item 9`, `item 2, 3, 7`, `item 4–6`, `item 5.4–5.8`, `項目 4.3〜4.6`, `UI #9`,
73
- * `UI-009`, `[9]`, `§4.3.2`. Prose (`Auth guard`), message codes (`M02`) and question ids
74
- * (`Q-01`) are not refs.
75
- */
76
- export function extractRefs(text: string): string[] {
77
- const refs = new Set<string>();
78
- const add = (s: string): void => { const r = normRef(s); if (r) refs.add(r); };
79
- for (const m of text.matchAll(LIST)) {
80
- let prev: string | null = null;
81
- let range = false;
82
- for (const tok of m[1].matchAll(new RegExp(`(${NUM})|([-–—~〜~])`, 'g'))) {
83
- if (tok[2]) { range = prev !== null; continue; }
84
- const n = normRef(tok[1]);
85
- if (!n) continue;
86
- if (range && prev) for (const r of between(prev, n)) refs.add(r);
87
- refs.add(n); prev = n; range = false;
88
- }
89
- }
90
- for (const m of text.matchAll(/\[(\d{1,3})\]/g)) add(m[1]);
91
- for (const m of text.matchAll(/§\s*(\d{1,3}(?:\.\d{1,3})*)/g)) add(m[1]);
92
- return [...refs];
93
- }
94
-
95
- export type ItemSource = 'spec-ids' | 'spec-table' | 'spec-ids+spec-table' | 'ui-inventory' | 'none';
96
- export interface UniverseItem { ref: string; name: string }
97
- /** Every list a citation could point at, each in its own notation. */
98
- export interface ItemUniverses { specIds: UniverseItem[]; specTable: UniverseItem[]; inventory: UniverseItem[] }
99
-
100
- const NO_COL = /^(no\.?|#|stt|№|番号)$/i;
101
- const TYPE_COL = /種別|\b(type|kind)\b|loại/i;
102
- const NAME_COL = /item|name|tên|項目|名|field|label|trường|thành phần|component/i;
103
-
104
- /**
105
- * The unit's lists, by where each id is DECLARED: requirement ids spec.md declares (`**FR-BC-03**:`),
106
- * the spec's item table (`No` + name + type columns), and ui-inventory ids (`UI-NNN`). An id's shape
107
- * says nothing about which list it belongs to — `item 9` on a mockup and `UI-009` in the inventory
108
- * number different things.
109
- */
110
- export function itemUniverses(reqDir: string): ItemUniverses {
111
- const read = (f: string): string | null => {
112
- const p = path.join(reqDir, f);
113
- return fs.existsSync(p) ? stripHtmlComments(readTextFile(p)) : null;
114
- };
115
- const out: ItemUniverses = { specIds: [], specTable: [], inventory: [] };
116
- const spec = read('spec.md');
117
- if (spec) {
118
- out.specIds = parseSpecClauses(path.join(reqDir, 'spec.md')).frs.map((f) => ({ ref: f.id, name: f.text.slice(0, 80) }));
119
- for (const row of tableRows(spec)) {
120
- const h = row.header;
121
- const no = h?.findIndex((c) => NO_COL.test(c)) ?? -1;
122
- const type = h?.findIndex((c) => TYPE_COL.test(c)) ?? -1;
123
- const name = h?.findIndex((c, i) => i !== no && i !== type && NAME_COL.test(c)) ?? -1;
124
- if (no < 0 || type < 0 || name < 0) continue;
125
- const ref = normRef(row.cells[no] ?? '');
126
- if (ref) out.specTable.push({ ref, name: row.cells[name] ?? '' });
127
- }
128
- }
129
- const inv = read('ui-inventory.md');
130
- if (inv) {
131
- out.inventory = parseUiInventory(inv).items.flatMap((i) => {
132
- const ref = normRef(i.id.replace(/^UI-/i, ''));
133
- return ref ? [{ ref, name: i.item }] : [];
134
- });
135
- }
136
- return out;
137
- }
138
-
139
- /**
140
- * The list(s) the viewpoint actually cites — a list nobody cites says nothing about gaps. The spec's
141
- * ids and its item table, each when cited (both when both are: the notations cannot collide, and
142
- * dropping one would under-report); the table also when nothing is cited at all (then every item is
143
- * uncited, which is true); the inventory only when the viewpoint writes `UI-NNN`; else none.
144
- */
145
- export function citedUniverse(u: ItemUniverses, cited: ReadonlySet<string>, writesInventoryIds: boolean): { source: ItemSource; items: UniverseItem[] } {
146
- const hits = (items: UniverseItem[]): boolean => items.some((i) => cited.has(i.ref));
147
- const ids = hits(u.specIds);
148
- const table = u.specTable.length > 0 && (cited.size === 0 || hits(u.specTable));
149
- if (ids && table) return { source: 'spec-ids+spec-table', items: [...u.specIds, ...u.specTable] };
150
- if (ids) return { source: 'spec-ids', items: u.specIds };
151
- if (table) return { source: 'spec-table', items: u.specTable };
152
- if (writesInventoryIds && hits(u.inventory)) return { source: 'ui-inventory', items: u.inventory };
153
- return { source: 'none', items: [] };
154
- }
@@ -1,111 +0,0 @@
1
- /**
2
- * `sungen viewpoint scan` — the code half of reviewing a QA-written test-viewpoint.md.
3
- *
4
- * It does set arithmetic on ids and nothing else: which VP rows exist, what each cites, which spec
5
- * items nobody cites, which ids no scenario carries. It never judges meaning, never edits the file,
6
- * and feeds no audit finding, score or baseline.
7
- *
8
- * A VP row is a markdown table row whose FIRST cell is a full id (`VP-UI-001`, `FL-LOGIN-3`).
9
- * Priority-table rows (`VP-LOGIN (Auth)`), bullets and appendix text are not rows. This is
10
- * deliberately NOT `parseViewpointItems` (viewpoint-ledger.ts), which also reads id-less rows.
11
- */
12
- import * as fs from 'fs';
13
- import * as path from 'path';
14
- import { readViewpointText, readTextFile } from './read-text';
15
- import { featureFilesFor } from './unit-paths';
16
- import { tableRows, extractRefs, itemUniverses, citedUniverse, ItemSource } from './viewpoint-scan-refs';
17
- import { viewpointMode, ViewpointMode } from './viewpoint-mode';
18
-
19
- export interface VpRow {
20
- id: string;
21
- line: number;
22
- /** Item numbers the row cites (normalised: `009` → `9`), and spec-declared ids it cites (`FR-BC-03`). */
23
- refs: string[];
24
- /** `# MANUAL/ENV` or `@manual` on the row or an enclosing heading. */
25
- manual: boolean;
26
- /** The Kỳ vọng / Expected cell has text (best effort when the table has no such header). */
27
- hasExpected: boolean;
28
- }
29
-
30
- export interface ViewpointScan {
31
- /** The create-test mode this file calls for (viewpoint-mode.ts): 2 = AI drafts, 1 = review only. */
32
- mode: ViewpointMode;
33
- modeReason: string;
34
- vpRows: VpRow[];
35
- /** Distinct VP ids among `vpRows` — a reused id is several rows but one id. */
36
- distinctIds: number;
37
- rowsWithoutExpected: string[];
38
- manualRows: string[];
39
- itemSource: ItemSource;
40
- /** Spec/inventory items no VP row cites — a hint for the review, not a verdict. */
41
- uncitedItems: { ref: string; name: string }[];
42
- /** VP ids no feature file mentions; null when the unit has no feature file yet. */
43
- withoutScenario: string[] | null;
44
- /** Why `vpRows` is empty, else null. */
45
- note: string | null;
46
- }
47
-
48
- const VP_ID = /^(VP|FL)-[A-Z][A-Z0-9]*(-[A-Z0-9]+)*-\d+$/;
49
- const MANUAL = /\bMANUAL\/ENV\b|@manual\b/i;
50
- const EXPECTED_COL = /kỳ vọng|kết quả mong đợi|expected|期待/i;
51
- /** Whole-word match (Unicode-aware: `\b` fails on `ồ`) so `Resource` / `Datasource` are not a source column. */
52
- const SOURCE_COL = /(?<![\p{L}\p{N}])(?:nguồn|source|tham chiếu|ref|出典|根拠)(?![\p{L}\p{N}])/iu;
53
- const PRIORITY = /^(critical|high|med(?:ium)?|low|cao|trung bình|thấp)$/i;
54
- const BLANK = /^[\s\-–—…]*$/;
55
- const SPEC_ID = /(?<![\w-])[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)*-\d+[A-Z]?(?![\w-])/gi;
56
- export const NO_VP_IDS_NOTE = 'file has no VP ids; review falls back to AI-only';
57
-
58
- /**
59
- * VP rows of one viewpoint text (already comment-stripped, as `readViewpointText` returns it).
60
- * `specIds`: the requirement ids spec.md declares — only those count as spec citations.
61
- */
62
- export function scanViewpointText(text: string, specIds: ReadonlySet<string> = new Set()): VpRow[] {
63
- const rows: VpRow[] = [];
64
- for (const r of tableRows(text)) {
65
- const id = r.cells[0];
66
- if (!VP_ID.test(id)) continue;
67
- const exp = r.header?.findIndex((c) => EXPECTED_COL.test(c)) ?? -1;
68
- const src = r.header?.findIndex((c) => SOURCE_COL.test(c)) ?? -1;
69
- const cites = src > 0 ? r.cells[src] ?? '' : r.cells.slice(1).join(' | ');
70
- rows.push({
71
- id,
72
- line: r.line,
73
- refs: [...extractRefs(cites), ...[...cites.matchAll(SPEC_ID)].map((m) => m[0].toUpperCase()).filter((id) => specIds.has(id))],
74
- manual: MANUAL.test(r.raw) || MANUAL.test(r.section),
75
- // Without a Kỳ vọng header: any later cell with text that is neither a priority word nor a ref.
76
- hasExpected: exp > 0
77
- ? !BLANK.test(r.cells[exp] ?? '')
78
- : r.cells.slice(2).some((c) => !BLANK.test(c) && !PRIORITY.test(c) && extractRefs(c).length === 0),
79
- });
80
- }
81
- return rows;
82
- }
83
-
84
- /** Scan one unit directory (`qa/screens/<n>`, `qa/flows/<n>`, …); `unit` names its feature files. */
85
- export function scanViewpointUnit(unitDir: string, unit: string): ViewpointScan {
86
- const reqDir = path.join(unitDir, 'requirements');
87
- const vpPath = path.join(reqDir, 'test-viewpoint.md');
88
- const vpText = readViewpointText(vpPath);
89
- const universes = itemUniverses(reqDir);
90
- const vpRows = scanViewpointText(vpText, new Set(universes.specIds.map((i) => i.ref)));
91
- const { mode, reason } = viewpointMode(fs.existsSync(vpPath) ? readTextFile(vpPath) : null, vpRows);
92
- const cited = new Set(vpRows.flatMap((r) => r.refs));
93
- const { source, items } = citedUniverse(universes, cited, /(?<![\w-])UI-\d{1,3}\b/i.test(vpText));
94
- const features = featureFilesFor(unitDir, unit).filter((f) => fs.existsSync(f));
95
- // Same rule as the ledger (viewpoint-ledger.ts): an id is carried when the feature text contains it.
96
- const featureText = features.map((f) => readTextFile(f).toLowerCase()).join('\n');
97
-
98
- return {
99
- mode,
100
- modeReason: reason,
101
- vpRows,
102
- distinctIds: new Set(vpRows.map((r) => r.id)).size,
103
- rowsWithoutExpected: vpRows.filter((r) => !r.hasExpected).map((r) => r.id),
104
- manualRows: vpRows.filter((r) => r.manual).map((r) => r.id),
105
- itemSource: source,
106
- uncitedItems: items.filter((i) => !cited.has(i.ref)),
107
- withoutScenario: features.length === 0 ? null : vpRows.filter((r) => !featureText.includes(r.id.toLowerCase())).map((r) => r.id),
108
- note: vpRows.length > 0 ? null
109
- : fs.existsSync(vpPath) ? NO_VP_IDS_NOTE : 'requirements/test-viewpoint.md is missing',
110
- };
111
- }