project-tiny-context-harness 0.8.17 → 0.11.0

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 (488) hide show
  1. package/README.md +93 -30
  2. package/assets/README.md +158 -44
  3. package/assets/README.zh-CN.md +88 -29
  4. package/assets/agents/AGENTS_CORE.md +2 -2
  5. package/assets/context_templates/context.toml +6 -1
  6. package/assets/runtime/windows-job-supervisor/formal_process_supervisor_native_helpers.cs +301 -0
  7. package/assets/runtime/windows-job-supervisor/formal_process_supervisor_native_run.cs +197 -0
  8. package/assets/runtime/windows-job-supervisor/formal_process_supervisor_native_types.cs +215 -0
  9. package/assets/runtime/windows-job-supervisor/windows_job_process_supervisor.ps1 +117 -0
  10. package/assets/skills/design-resource-authoring/SKILL.md +6 -3
  11. package/assets/skills/design-resource-authoring/references/authority-delta-assessment.md +52 -0
  12. package/assets/skills/design-resource-authoring/references/downstream-handoff.md +5 -1
  13. package/assets/skills/design-system-authoring/SKILL.md +23 -17
  14. package/assets/skills/design-system-authoring/references/authority-adoption.md +19 -9
  15. package/assets/skills/design-system-authoring/references/open-design-design-system-provider.md +4 -0
  16. package/assets/skills/long-task-workflow/SKILL.md +6 -6
  17. package/assets/skills/long-task-workflow/references/authority-lifecycle.md +10 -4
  18. package/assets/skills/long-task-workflow/references/contract-authoring.md +5 -5
  19. package/assets/skills/long-task-workflow/references/evidence-design.md +14 -3
  20. package/assets/skills/long-task-workflow/references/source-authoring.md +11 -8
  21. package/assets/tools/context_rules.json +53 -0
  22. package/assets/tools/validate_context.py +302 -77
  23. package/dist/cli.js +2 -1
  24. package/dist/commands/context-create.d.ts +1 -0
  25. package/dist/commands/context-create.js +90 -0
  26. package/dist/commands/context-inspect.d.ts +1 -0
  27. package/dist/commands/context-inspect.js +98 -0
  28. package/dist/commands/context-move.d.ts +1 -0
  29. package/dist/commands/context-move.js +78 -0
  30. package/dist/commands/context-register.d.ts +1 -0
  31. package/dist/commands/context-register.js +110 -0
  32. package/dist/commands/context-transaction.d.ts +1 -0
  33. package/dist/commands/context-transaction.js +84 -0
  34. package/dist/commands/context.d.ts +1 -0
  35. package/dist/commands/context.js +36 -0
  36. package/dist/commands/design-authority-delta.d.ts +1 -0
  37. package/dist/commands/design-authority-delta.js +53 -0
  38. package/dist/commands/design-authority.d.ts +1 -0
  39. package/dist/commands/design-authority.js +104 -0
  40. package/dist/commands/design-resource.js +8 -1
  41. package/dist/commands/doctor.d.ts +1 -1
  42. package/dist/commands/doctor.js +61 -3
  43. package/dist/commands/index.js +19 -2
  44. package/dist/commands/long-task-authoring.js +20 -2
  45. package/dist/commands/long-task-workdir.d.ts +2 -0
  46. package/dist/commands/long-task-workdir.js +23 -0
  47. package/dist/commands/long-task.js +75 -6
  48. package/dist/commands/route.d.ts +15 -0
  49. package/dist/commands/route.js +142 -0
  50. package/dist/index.d.ts +3 -13
  51. package/dist/index.js +3 -12
  52. package/dist/lib/cli-exit.d.ts +14 -0
  53. package/dist/lib/cli-exit.js +19 -0
  54. package/dist/lib/context-catalog/catalog-default-footprint.d.ts +3 -0
  55. package/dist/lib/context-catalog/catalog-default-footprint.js +53 -0
  56. package/dist/lib/context-catalog/catalog-diagnostics.d.ts +9 -0
  57. package/dist/lib/context-catalog/catalog-diagnostics.js +34 -0
  58. package/dist/lib/context-catalog/catalog-discovery.d.ts +7 -0
  59. package/dist/lib/context-catalog/catalog-discovery.js +81 -0
  60. package/dist/lib/context-catalog/catalog-load.d.ts +8 -0
  61. package/dist/lib/context-catalog/catalog-load.js +187 -0
  62. package/dist/lib/context-catalog/catalog-path-validation.d.ts +7 -0
  63. package/dist/lib/context-catalog/catalog-path-validation.js +62 -0
  64. package/dist/lib/context-catalog/catalog-paths.d.ts +11 -0
  65. package/dist/lib/context-catalog/catalog-paths.js +41 -0
  66. package/dist/lib/context-catalog/catalog-portable-contract.d.ts +15 -0
  67. package/dist/lib/context-catalog/catalog-portable-contract.js +68 -0
  68. package/dist/lib/context-catalog/catalog-staged-path-safety.d.ts +1 -0
  69. package/dist/lib/context-catalog/catalog-staged-path-safety.js +36 -0
  70. package/dist/lib/context-catalog/catalog-types.d.ts +40 -0
  71. package/dist/lib/context-catalog/catalog-types.js +1 -0
  72. package/dist/lib/context-catalog/catalog-validation.d.ts +9 -0
  73. package/dist/lib/context-catalog/catalog-validation.js +148 -0
  74. package/dist/lib/context-create/context-create-path.d.ts +2 -0
  75. package/dist/lib/context-create/context-create-path.js +30 -0
  76. package/dist/lib/context-create/context-create-template.d.ts +2 -0
  77. package/dist/lib/context-create/context-create-template.js +95 -0
  78. package/dist/lib/context-create/context-create-types.d.ts +28 -0
  79. package/dist/lib/context-create/context-create-types.js +1 -0
  80. package/dist/lib/context-create/context-create-write.d.ts +1 -0
  81. package/dist/lib/context-create/context-create-write.js +85 -0
  82. package/dist/lib/context-create/context-create.d.ts +2 -0
  83. package/dist/lib/context-create/context-create.js +84 -0
  84. package/dist/lib/context-default-footprint.d.ts +2 -3
  85. package/dist/lib/context-default-footprint.js +49 -57
  86. package/dist/lib/context-doctor/context-doctor-types.d.ts +16 -0
  87. package/dist/lib/context-doctor/context-doctor-types.js +15 -0
  88. package/dist/lib/context-doctor/context-doctor.d.ts +2 -0
  89. package/dist/lib/context-doctor/context-doctor.js +130 -0
  90. package/dist/lib/context-graph-snapshot.d.ts +5 -0
  91. package/dist/lib/context-graph-snapshot.js +46 -25
  92. package/dist/lib/context-inspect/context-inspect-projection.d.ts +9 -0
  93. package/dist/lib/context-inspect/context-inspect-projection.js +49 -0
  94. package/dist/lib/context-inspect/context-inspect-render.d.ts +2 -0
  95. package/dist/lib/context-inspect/context-inspect-render.js +29 -0
  96. package/dist/lib/context-inspect/context-inspect-types.d.ts +43 -0
  97. package/dist/lib/context-inspect/context-inspect-types.js +1 -0
  98. package/dist/lib/context-inspect/context-inspect.d.ts +2 -0
  99. package/dist/lib/context-inspect/context-inspect.js +104 -0
  100. package/dist/lib/context-manifest-schema.d.ts +1 -1
  101. package/dist/lib/context-manifest-schema.js +4 -20
  102. package/dist/lib/context-markdown/context-markdown-analysis.d.ts +15 -0
  103. package/dist/lib/context-markdown/context-markdown-analysis.js +245 -0
  104. package/dist/lib/context-markdown/context-markdown-extract.d.ts +7 -0
  105. package/dist/lib/context-markdown/context-markdown-extract.js +114 -0
  106. package/dist/lib/context-markdown/context-markdown-types.d.ts +57 -0
  107. package/dist/lib/context-markdown/context-markdown-types.js +1 -0
  108. package/dist/lib/context-move/context-move-input.d.ts +8 -0
  109. package/dist/lib/context-move/context-move-input.js +17 -0
  110. package/dist/lib/context-move/context-move-literal-scan.d.ts +20 -0
  111. package/dist/lib/context-move/context-move-literal-scan.js +213 -0
  112. package/dist/lib/context-move/context-move-live-validation.d.ts +3 -0
  113. package/dist/lib/context-move/context-move-live-validation.js +56 -0
  114. package/dist/lib/context-move/context-move-markdown-plan.d.ts +22 -0
  115. package/dist/lib/context-move/context-move-markdown-plan.js +39 -0
  116. package/dist/lib/context-move/context-move-projection.d.ts +3 -0
  117. package/dist/lib/context-move/context-move-projection.js +11 -0
  118. package/dist/lib/context-move/context-move-reference-validation.d.ts +11 -0
  119. package/dist/lib/context-move/context-move-reference-validation.js +64 -0
  120. package/dist/lib/context-move/context-move-render.d.ts +2 -0
  121. package/dist/lib/context-move/context-move-render.js +24 -0
  122. package/dist/lib/context-move/context-move-support.d.ts +10 -0
  123. package/dist/lib/context-move/context-move-support.js +88 -0
  124. package/dist/lib/context-move/context-move-transaction-plan.d.ts +24 -0
  125. package/dist/lib/context-move/context-move-transaction-plan.js +108 -0
  126. package/dist/lib/context-move/context-move-types.d.ts +74 -0
  127. package/dist/lib/context-move/context-move-types.js +1 -0
  128. package/dist/lib/context-move/context-move.d.ts +8 -0
  129. package/dist/lib/context-move/context-move.js +180 -0
  130. package/dist/lib/context-mutation/manifest-lossless-patch.d.ts +28 -0
  131. package/dist/lib/context-mutation/manifest-lossless-patch.js +208 -0
  132. package/dist/lib/context-mutation/markdown-link-patch.d.ts +34 -0
  133. package/dist/lib/context-mutation/markdown-link-patch.js +143 -0
  134. package/dist/lib/context-mutation/markdown-link-spans.d.ts +10 -0
  135. package/dist/lib/context-mutation/markdown-link-spans.js +179 -0
  136. package/dist/lib/context-mutation/mutation-cas.d.ts +13 -0
  137. package/dist/lib/context-mutation/mutation-cas.js +365 -0
  138. package/dist/lib/context-mutation/mutation-command-support.d.ts +12 -0
  139. package/dist/lib/context-mutation/mutation-command-support.js +57 -0
  140. package/dist/lib/context-mutation/mutation-commit.d.ts +12 -0
  141. package/dist/lib/context-mutation/mutation-commit.js +89 -0
  142. package/dist/lib/context-mutation/mutation-directories.d.ts +5 -0
  143. package/dist/lib/context-mutation/mutation-directories.js +56 -0
  144. package/dist/lib/context-mutation/mutation-file-state.d.ts +14 -0
  145. package/dist/lib/context-mutation/mutation-file-state.js +137 -0
  146. package/dist/lib/context-mutation/mutation-journal-file-validation.d.ts +1 -0
  147. package/dist/lib/context-mutation/mutation-journal-file-validation.js +106 -0
  148. package/dist/lib/context-mutation/mutation-journal-io.d.ts +5 -0
  149. package/dist/lib/context-mutation/mutation-journal-io.js +55 -0
  150. package/dist/lib/context-mutation/mutation-journal-storage.d.ts +18 -0
  151. package/dist/lib/context-mutation/mutation-journal-storage.js +283 -0
  152. package/dist/lib/context-mutation/mutation-journal-validation-support.d.ts +16 -0
  153. package/dist/lib/context-mutation/mutation-journal-validation-support.js +140 -0
  154. package/dist/lib/context-mutation/mutation-journal-validation.d.ts +3 -0
  155. package/dist/lib/context-mutation/mutation-journal-validation.js +177 -0
  156. package/dist/lib/context-mutation/mutation-journal.d.ts +8 -0
  157. package/dist/lib/context-mutation/mutation-journal.js +111 -0
  158. package/dist/lib/context-mutation/mutation-live-validation.d.ts +3 -0
  159. package/dist/lib/context-mutation/mutation-live-validation.js +51 -0
  160. package/dist/lib/context-mutation/mutation-long-task-guard.d.ts +6 -0
  161. package/dist/lib/context-mutation/mutation-long-task-guard.js +57 -0
  162. package/dist/lib/context-mutation/mutation-recovery.d.ts +4 -0
  163. package/dist/lib/context-mutation/mutation-recovery.js +189 -0
  164. package/dist/lib/context-mutation/mutation-staged-fs.d.ts +5 -0
  165. package/dist/lib/context-mutation/mutation-staged-fs.js +56 -0
  166. package/dist/lib/context-mutation/mutation-types.d.ts +103 -0
  167. package/dist/lib/context-mutation/mutation-types.js +1 -0
  168. package/dist/lib/context-register/context-register-input.d.ts +11 -0
  169. package/dist/lib/context-register/context-register-input.js +43 -0
  170. package/dist/lib/context-register/context-register-render.d.ts +2 -0
  171. package/dist/lib/context-register/context-register-render.js +21 -0
  172. package/dist/lib/context-register/context-register-support.d.ts +6 -0
  173. package/dist/lib/context-register/context-register-support.js +46 -0
  174. package/dist/lib/context-register/context-register-types.d.ts +46 -0
  175. package/dist/lib/context-register/context-register-types.js +1 -0
  176. package/dist/lib/context-register/context-register.d.ts +8 -0
  177. package/dist/lib/context-register/context-register.js +155 -0
  178. package/dist/lib/context-router/context-route-budget.d.ts +15 -0
  179. package/dist/lib/context-router/context-route-budget.js +14 -0
  180. package/dist/lib/context-router/context-route-candidates.d.ts +15 -0
  181. package/dist/lib/context-router/context-route-candidates.js +112 -0
  182. package/dist/lib/context-router/context-route-order.d.ts +6 -0
  183. package/dist/lib/context-router/context-route-order.js +53 -0
  184. package/dist/lib/context-router/context-route-paths.d.ts +16 -0
  185. package/dist/lib/context-router/context-route-paths.js +109 -0
  186. package/dist/lib/context-router/context-route-render.d.ts +2 -0
  187. package/dist/lib/context-router/context-route-render.js +32 -0
  188. package/dist/lib/context-router/context-route-scan.d.ts +18 -0
  189. package/dist/lib/context-router/context-route-scan.js +156 -0
  190. package/dist/lib/context-router/context-route-selection.d.ts +16 -0
  191. package/dist/lib/context-router/context-route-selection.js +72 -0
  192. package/dist/lib/context-router/context-route-terms.d.ts +13 -0
  193. package/dist/lib/context-router/context-route-terms.js +202 -0
  194. package/dist/lib/context-router/context-route-types.d.ts +101 -0
  195. package/dist/lib/context-router/context-route-types.js +1 -0
  196. package/dist/lib/context-router/context-route.d.ts +2 -0
  197. package/dist/lib/context-router/context-route.js +127 -0
  198. package/dist/lib/context-units-migration.d.ts +13 -0
  199. package/dist/lib/context-units-migration.js +217 -0
  200. package/dist/lib/design-authority-binding.d.ts +7 -0
  201. package/dist/lib/design-authority-binding.js +96 -0
  202. package/dist/lib/design-authority-closure.d.ts +3 -0
  203. package/dist/lib/design-authority-closure.js +201 -0
  204. package/dist/lib/design-authority-delta-codec-primitives.d.ts +10 -0
  205. package/dist/lib/design-authority-delta-codec-primitives.js +58 -0
  206. package/dist/lib/design-authority-delta-codec.d.ts +2 -0
  207. package/dist/lib/design-authority-delta-codec.js +193 -0
  208. package/dist/lib/design-authority-delta-types.d.ts +65 -0
  209. package/dist/lib/design-authority-delta-types.js +6 -0
  210. package/dist/lib/design-authority-delta-validation.d.ts +2 -0
  211. package/dist/lib/design-authority-delta-validation.js +16 -0
  212. package/dist/lib/design-authority-digest.d.ts +8 -0
  213. package/dist/lib/design-authority-digest.js +36 -0
  214. package/dist/lib/design-authority-files.d.ts +9 -0
  215. package/dist/lib/design-authority-files.js +62 -0
  216. package/dist/lib/design-authority-format.d.ts +2 -0
  217. package/dist/lib/design-authority-format.js +93 -0
  218. package/dist/lib/design-authority-links.d.ts +10 -0
  219. package/dist/lib/design-authority-links.js +137 -0
  220. package/dist/lib/design-authority-manifest.d.ts +4 -0
  221. package/dist/lib/design-authority-manifest.js +144 -0
  222. package/dist/lib/design-authority-tokens.d.ts +9 -0
  223. package/dist/lib/design-authority-tokens.js +45 -0
  224. package/dist/lib/design-authority-types.d.ts +80 -0
  225. package/dist/lib/design-authority-types.js +23 -0
  226. package/dist/lib/design-md-tool-adapter.d.ts +9 -0
  227. package/dist/lib/design-md-tool-adapter.js +152 -0
  228. package/dist/lib/design-md-tool-normalization.d.ts +7 -0
  229. package/dist/lib/design-md-tool-normalization.js +78 -0
  230. package/dist/lib/design-md-tool-types.d.ts +99 -0
  231. package/dist/lib/design-md-tool-types.js +8 -0
  232. package/dist/lib/design-resource-handoff-input-types.d.ts +1 -1
  233. package/dist/lib/design-resource-handoff-manifest-projection.js +3 -0
  234. package/dist/lib/design-resource-handoff-shape.js +14 -2
  235. package/dist/lib/design-resource-handoff-types.d.ts +3 -0
  236. package/dist/lib/design-resource-handoff-validation.js +16 -4
  237. package/dist/lib/design-resource-implementation-feasibility-validation-support.js +1 -1
  238. package/dist/lib/design-resource-recovery-current.js +22 -0
  239. package/dist/lib/design-resource-recovery-shape.js +64 -7
  240. package/dist/lib/design-resource-recovery-types.d.ts +4 -1
  241. package/dist/lib/design-resource-symbolic-fact-shape.js +7 -1
  242. package/dist/lib/design-resource-symbolic-fact-types.d.ts +3 -0
  243. package/dist/lib/design-resource-symbolic-fact-validation.js +15 -3
  244. package/dist/lib/doctor.d.ts +2 -1
  245. package/dist/lib/doctor.js +29 -1
  246. package/dist/lib/fs.js +1 -1
  247. package/dist/lib/long-task-acceptance-reachability-claims.d.ts +2 -0
  248. package/dist/lib/long-task-acceptance-reachability-claims.js +279 -0
  249. package/dist/lib/long-task-acceptance-reachability-design.d.ts +2 -0
  250. package/dist/lib/long-task-acceptance-reachability-design.js +96 -0
  251. package/dist/lib/long-task-acceptance-reachability-external.d.ts +9 -0
  252. package/dist/lib/long-task-acceptance-reachability-external.js +123 -0
  253. package/dist/lib/long-task-acceptance-reachability-helpers.d.ts +64 -0
  254. package/dist/lib/long-task-acceptance-reachability-helpers.js +473 -0
  255. package/dist/lib/long-task-acceptance-reachability-semantic.d.ts +2 -0
  256. package/dist/lib/long-task-acceptance-reachability-semantic.js +122 -0
  257. package/dist/lib/long-task-acceptance-reachability-types.d.ts +91 -0
  258. package/dist/lib/long-task-acceptance-reachability-types.js +1 -0
  259. package/dist/lib/long-task-acceptance-reachability.d.ts +4 -0
  260. package/dist/lib/long-task-acceptance-reachability.js +115 -0
  261. package/dist/lib/long-task-activation-validation.d.ts +6 -0
  262. package/dist/lib/long-task-activation-validation.js +72 -69
  263. package/dist/lib/long-task-active-authority-lock-context.d.ts +4 -0
  264. package/dist/lib/long-task-active-authority-lock-context.js +29 -0
  265. package/dist/lib/long-task-applicability-identity.d.ts +25 -0
  266. package/dist/lib/long-task-applicability-identity.js +60 -0
  267. package/dist/lib/long-task-authoring-preflight-diagnostics.js +8 -0
  268. package/dist/lib/long-task-authoring-preflight-types.d.ts +2 -0
  269. package/dist/lib/long-task-authoring-preflight-types.js +9 -0
  270. package/dist/lib/long-task-authoring-preflight.js +18 -2
  271. package/dist/lib/long-task-authority-material-diff.js +4 -0
  272. package/dist/lib/long-task-authority-materials.js +19 -0
  273. package/dist/lib/long-task-authority-policy.d.ts +3 -0
  274. package/dist/lib/long-task-authority-policy.js +3 -0
  275. package/dist/lib/long-task-authority-revision-details.js +2 -1
  276. package/dist/lib/long-task-authority-types.d.ts +2 -0
  277. package/dist/lib/long-task-authority.js +2 -0
  278. package/dist/lib/long-task-check-shape.js +6 -1
  279. package/dist/lib/long-task-claim-definitions.js +1 -3
  280. package/dist/lib/long-task-claim-semantic-proof-floor.d.ts +3 -0
  281. package/dist/lib/long-task-claim-semantic-proof-floor.js +78 -0
  282. package/dist/lib/long-task-claims.d.ts +0 -18
  283. package/dist/lib/long-task-claims.js +15 -14
  284. package/dist/lib/long-task-command-process.js +3 -0
  285. package/dist/lib/long-task-compact-authoring.js +3 -0
  286. package/dist/lib/long-task-compact-projections.js +10 -0
  287. package/dist/lib/long-task-complete-delivery-evidence-types.d.ts +38 -0
  288. package/dist/lib/long-task-complete-delivery-evidence-types.js +1 -0
  289. package/dist/lib/long-task-completion-types.d.ts +109 -0
  290. package/dist/lib/long-task-completion-types.js +1 -0
  291. package/dist/lib/long-task-conformance-policy.d.ts +2 -1
  292. package/dist/lib/long-task-conformance-policy.js +11 -4
  293. package/dist/lib/long-task-context-authority-topology.js +6 -4
  294. package/dist/lib/long-task-contract-types.d.ts +52 -1
  295. package/dist/lib/long-task-counterfactual-sandbox.d.ts +7 -1
  296. package/dist/lib/long-task-counterfactual-sandbox.js +86 -6
  297. package/dist/lib/long-task-delivery-compiler-preflight.d.ts +24 -0
  298. package/dist/lib/long-task-delivery-compiler-preflight.js +32 -0
  299. package/dist/lib/long-task-delivery-compiler.d.ts +1 -0
  300. package/dist/lib/long-task-delivery-compiler.js +59 -44
  301. package/dist/lib/long-task-delivery-parser.d.ts +3 -0
  302. package/dist/lib/long-task-delivery-parser.js +26 -8
  303. package/dist/lib/long-task-delivery-types.d.ts +2 -0
  304. package/dist/lib/long-task-delivery-types.js +2 -0
  305. package/dist/lib/long-task-delivery-validation.d.ts +6 -1
  306. package/dist/lib/long-task-delivery-validation.js +19 -4
  307. package/dist/lib/long-task-design-feasibility-binding.d.ts +1 -0
  308. package/dist/lib/long-task-design-feasibility-binding.js +3 -3
  309. package/dist/lib/long-task-design-feasibility-source-closure.js +11 -2
  310. package/dist/lib/long-task-design-obligation.d.ts +50 -0
  311. package/dist/lib/long-task-design-obligation.js +99 -0
  312. package/dist/lib/long-task-design-resource-handoff.d.ts +3 -1
  313. package/dist/lib/long-task-design-resource-handoff.js +36 -12
  314. package/dist/lib/long-task-design-resource-method-binding.js +12 -0
  315. package/dist/lib/long-task-effective-external-takeover.d.ts +15 -0
  316. package/dist/lib/long-task-effective-external-takeover.js +109 -0
  317. package/dist/lib/long-task-effective-external-ui-takeover.d.ts +5 -0
  318. package/dist/lib/long-task-effective-external-ui-takeover.js +117 -0
  319. package/dist/lib/long-task-evidence-capability-codec.js +91 -0
  320. package/dist/lib/long-task-evidence-capability-runtime.js +62 -14
  321. package/dist/lib/long-task-evidence-capability-types.d.ts +3 -2
  322. package/dist/lib/long-task-evidence-v2.d.ts +6 -1
  323. package/dist/lib/long-task-evidence-v2.js +253 -170
  324. package/dist/lib/long-task-execution-observation.d.ts +7 -0
  325. package/dist/lib/long-task-execution-observation.js +21 -4
  326. package/dist/lib/long-task-expected-authority.d.ts +4 -0
  327. package/dist/lib/long-task-expected-authority.js +126 -0
  328. package/dist/lib/long-task-external-confirmation-artifacts.d.ts +9 -0
  329. package/dist/lib/long-task-external-confirmation-artifacts.js +138 -0
  330. package/dist/lib/long-task-external-confirmation-attestation.d.ts +20 -0
  331. package/dist/lib/long-task-external-confirmation-attestation.js +115 -0
  332. package/dist/lib/long-task-external-confirmation-challenge.d.ts +23 -0
  333. package/dist/lib/long-task-external-confirmation-challenge.js +164 -0
  334. package/dist/lib/long-task-external-confirmation-context.d.ts +14 -0
  335. package/dist/lib/long-task-external-confirmation-context.js +53 -0
  336. package/dist/lib/long-task-external-confirmation-evaluation.d.ts +11 -0
  337. package/dist/lib/long-task-external-confirmation-evaluation.js +454 -0
  338. package/dist/lib/long-task-external-confirmation-expected.d.ts +8 -0
  339. package/dist/lib/long-task-external-confirmation-expected.js +200 -0
  340. package/dist/lib/long-task-external-confirmation-identity.d.ts +10 -0
  341. package/dist/lib/long-task-external-confirmation-identity.js +77 -0
  342. package/dist/lib/long-task-external-confirmation-plan.d.ts +25 -0
  343. package/dist/lib/long-task-external-confirmation-plan.js +148 -0
  344. package/dist/lib/long-task-external-confirmation-preparation.d.ts +4 -0
  345. package/dist/lib/long-task-external-confirmation-preparation.js +100 -0
  346. package/dist/lib/long-task-external-confirmation-shape.d.ts +8 -0
  347. package/dist/lib/long-task-external-confirmation-shape.js +387 -0
  348. package/dist/lib/long-task-external-confirmation-state.d.ts +10 -0
  349. package/dist/lib/long-task-external-confirmation-state.js +109 -0
  350. package/dist/lib/long-task-external-confirmation-types.d.ts +195 -0
  351. package/dist/lib/long-task-external-confirmation-types.js +1 -0
  352. package/dist/lib/long-task-final-integrity.d.ts +2 -0
  353. package/dist/lib/long-task-final-integrity.js +21 -10
  354. package/dist/lib/long-task-final-v2.d.ts +7 -2
  355. package/dist/lib/long-task-final-v2.js +179 -55
  356. package/dist/lib/long-task-finalization-identity.d.ts +27 -0
  357. package/dist/lib/long-task-finalization-identity.js +58 -0
  358. package/dist/lib/long-task-finding-context.d.ts +1 -1
  359. package/dist/lib/long-task-finding-context.js +139 -13
  360. package/dist/lib/long-task-freshness.d.ts +27 -0
  361. package/dist/lib/long-task-freshness.js +128 -5
  362. package/dist/lib/long-task-git.js +3 -3
  363. package/dist/lib/long-task-material-input-closure.d.ts +3 -0
  364. package/dist/lib/long-task-material-input-closure.js +92 -0
  365. package/dist/lib/long-task-obligation-authority-resolution.d.ts +12 -0
  366. package/dist/lib/long-task-obligation-authority-resolution.js +57 -0
  367. package/dist/lib/long-task-obligation-semantic-identity.d.ts +16 -0
  368. package/dist/lib/long-task-obligation-semantic-identity.js +116 -0
  369. package/dist/lib/long-task-observation-authority.d.ts +11 -0
  370. package/dist/lib/long-task-observation-authority.js +137 -6
  371. package/dist/lib/long-task-process-table.d.ts +2 -5
  372. package/dist/lib/long-task-process-table.js +21 -53
  373. package/dist/lib/long-task-process-tree.d.ts +0 -1
  374. package/dist/lib/long-task-process-tree.js +24 -54
  375. package/dist/lib/long-task-proof-adequacy.d.ts +12 -0
  376. package/dist/lib/long-task-proof-adequacy.js +57 -0
  377. package/dist/lib/long-task-proof-capability-floor.d.ts +6 -0
  378. package/dist/lib/long-task-proof-capability-floor.js +137 -0
  379. package/dist/lib/long-task-repair-frontier-checks.d.ts +8 -0
  380. package/dist/lib/long-task-repair-frontier-checks.js +93 -0
  381. package/dist/lib/long-task-repair-frontier-groups.d.ts +2 -0
  382. package/dist/lib/long-task-repair-frontier-groups.js +64 -0
  383. package/dist/lib/long-task-repair-frontier-utils.d.ts +6 -0
  384. package/dist/lib/long-task-repair-frontier-utils.js +27 -0
  385. package/dist/lib/long-task-repair-frontier.d.ts +14 -0
  386. package/dist/lib/long-task-repair-frontier.js +132 -0
  387. package/dist/lib/long-task-risk.d.ts +3 -2
  388. package/dist/lib/long-task-risk.js +73 -24
  389. package/dist/lib/long-task-root-shape.js +148 -8
  390. package/dist/lib/long-task-runner-freeze.d.ts +2 -1
  391. package/dist/lib/long-task-runner-freeze.js +23 -8
  392. package/dist/lib/long-task-runtime-types.d.ts +34 -40
  393. package/dist/lib/long-task-semantic-assurance-policy.js +2 -11
  394. package/dist/lib/long-task-semantic-contract-types.d.ts +2 -1
  395. package/dist/lib/long-task-semantic-drift-migration.js +48 -2
  396. package/dist/lib/long-task-semantic-fact-binding-types.d.ts +20 -0
  397. package/dist/lib/long-task-semantic-fact-closure.d.ts +5 -1
  398. package/dist/lib/long-task-semantic-fact-closure.js +33 -5
  399. package/dist/lib/long-task-semantic-fact-contract-closure.js +176 -1
  400. package/dist/lib/long-task-semantic-fact-contract-proofs.js +18 -1
  401. package/dist/lib/long-task-semantic-fact-input-closure.d.ts +16 -2
  402. package/dist/lib/long-task-semantic-fact-input-closure.js +138 -15
  403. package/dist/lib/long-task-semantic-fact-provenance-closure.js +1 -1
  404. package/dist/lib/long-task-semantic-fact-shape.d.ts +2 -1
  405. package/dist/lib/long-task-semantic-fact-shape.js +35 -1
  406. package/dist/lib/long-task-semantic-proof-adequacy.d.ts +2 -0
  407. package/dist/lib/long-task-semantic-proof-adequacy.js +19 -0
  408. package/dist/lib/long-task-semantic-proof-profile.d.ts +5 -0
  409. package/dist/lib/long-task-semantic-proof-profile.js +187 -0
  410. package/dist/lib/long-task-shape-primitives.d.ts +1 -1
  411. package/dist/lib/long-task-shape-primitives.js +5 -0
  412. package/dist/lib/long-task-source-anchors.d.ts +10 -0
  413. package/dist/lib/long-task-source-anchors.js +102 -0
  414. package/dist/lib/long-task-source-authority-types.d.ts +46 -0
  415. package/dist/lib/long-task-source-claim-validation.js +36 -0
  416. package/dist/lib/long-task-source-conservation-facts.d.ts +8 -0
  417. package/dist/lib/long-task-source-conservation-facts.js +57 -0
  418. package/dist/lib/long-task-source-conservation-types.d.ts +34 -0
  419. package/dist/lib/long-task-source-conservation-types.js +1 -0
  420. package/dist/lib/long-task-source-conservation.d.ts +7 -0
  421. package/dist/lib/long-task-source-conservation.js +110 -0
  422. package/dist/lib/long-task-source-fragments.d.ts +6 -0
  423. package/dist/lib/long-task-source-fragments.js +219 -0
  424. package/dist/lib/long-task-source-projection-resolution.d.ts +5 -0
  425. package/dist/lib/long-task-source-projection-resolution.js +57 -0
  426. package/dist/lib/long-task-source-projection-validation.d.ts +17 -0
  427. package/dist/lib/long-task-source-projection-validation.js +154 -0
  428. package/dist/lib/long-task-source-shape.js +14 -6
  429. package/dist/lib/long-task-source-supersession.d.ts +5 -0
  430. package/dist/lib/long-task-source-supersession.js +138 -0
  431. package/dist/lib/long-task-stage-policy.d.ts +7 -2
  432. package/dist/lib/long-task-stage-policy.js +67 -23
  433. package/dist/lib/long-task-state.d.ts +18 -4
  434. package/dist/lib/long-task-state.js +319 -33
  435. package/dist/lib/long-task-static-observation-freeze.js +4 -3
  436. package/dist/lib/long-task-status-projection.d.ts +3 -1
  437. package/dist/lib/long-task-status-projection.js +44 -13
  438. package/dist/lib/long-task-status-v2.d.ts +10 -6
  439. package/dist/lib/long-task-status-v2.js +70 -58
  440. package/dist/lib/long-task-target-policy.d.ts +8 -3
  441. package/dist/lib/long-task-target-policy.js +40 -9
  442. package/dist/lib/long-task-terminal-finalization.d.ts +12 -0
  443. package/dist/lib/long-task-terminal-finalization.js +190 -0
  444. package/dist/lib/long-task-ui-design-policy.js +15 -4
  445. package/dist/lib/long-task-verifier-counterfactuals.d.ts +11 -0
  446. package/dist/lib/long-task-verifier-counterfactuals.js +96 -0
  447. package/dist/lib/long-task-verifier-execution.d.ts +9 -0
  448. package/dist/lib/long-task-verifier-execution.js +67 -0
  449. package/dist/lib/long-task-verifier-identity.js +16 -5
  450. package/dist/lib/long-task-verifier-v2.js +52 -65
  451. package/dist/lib/long-task-windows-job-supervisor-helper.d.ts +1 -0
  452. package/dist/lib/long-task-windows-job-supervisor-helper.js +104 -0
  453. package/dist/lib/long-task-windows-job-supervisor-protocol.d.ts +28 -0
  454. package/dist/lib/long-task-windows-job-supervisor-protocol.js +124 -0
  455. package/dist/lib/long-task-windows-job-supervisor-result.d.ts +11 -0
  456. package/dist/lib/long-task-windows-job-supervisor-result.js +152 -0
  457. package/dist/lib/long-task-windows-job-supervisor.d.ts +2 -0
  458. package/dist/lib/long-task-windows-job-supervisor.js +126 -0
  459. package/dist/lib/long-task-workspace-scope.d.ts +1 -0
  460. package/dist/lib/long-task-workspace-scope.js +4 -1
  461. package/dist/lib/long-task-workspace.d.ts +1 -0
  462. package/dist/lib/long-task-workspace.js +10 -0
  463. package/dist/lib/migrations.js +43 -2
  464. package/dist/lib/repository-path-safety.d.ts +1 -0
  465. package/dist/lib/repository-path-safety.js +3 -3
  466. package/dist/lib/semantic-fact-input-shape.d.ts +7 -2
  467. package/dist/lib/semantic-fact-input-shape.js +25 -1
  468. package/dist/lib/semantic-fact-inventory-types.d.ts +8 -2
  469. package/dist/lib/semantic-fact-policy-census.d.ts +1 -1
  470. package/dist/lib/semantic-fact-policy-census.js +5 -2
  471. package/dist/lib/semantic-fact-policy.d.ts +1 -1
  472. package/dist/lib/semantic-fact-policy.js +2 -2
  473. package/dist/lib/semantic-fact-proof-shape.d.ts +1 -1
  474. package/dist/lib/semantic-fact-property-shape.d.ts +1 -1
  475. package/dist/lib/validators.d.ts +3 -0
  476. package/dist/lib/validators.js +45 -157
  477. package/dist/public-api-core.d.ts +12 -0
  478. package/dist/public-api-core.js +12 -0
  479. package/dist/public-api-long-task.d.ts +10 -0
  480. package/dist/public-api-long-task.js +10 -0
  481. package/dist/public-types.d.ts +5 -1
  482. package/dist/schemas/design-authority-delta-assessment-v1.schema.json +191 -0
  483. package/dist/schemas/long-task-delivery-v2/long-task-delivery-v2.schema.json +166 -2
  484. package/dist/schemas/long-task-external-confirmation-record-v1.schema.json +155 -0
  485. package/dist/schemas/long-task-external-confirmation-record-v2.schema.json +209 -0
  486. package/migrations/README.md +99 -0
  487. package/package.json +7 -5
  488. package/source-mappings.yaml +18 -0
@@ -0,0 +1,98 @@
1
+ import { CLI_EXIT_CODES, CliCommandError } from "../lib/cli-exit.js";
2
+ import { inspectContext } from "../lib/context-inspect/context-inspect.js";
3
+ import { renderContextInspectText } from "../lib/context-inspect/context-inspect-render.js";
4
+ export async function contextInspect(args) {
5
+ const options = parseInspectArgs(args);
6
+ if (options.help) {
7
+ console.log(contextInspectHelp());
8
+ return;
9
+ }
10
+ if (!options.target)
11
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, "context inspect requires <project_context/file.md>");
12
+ let result;
13
+ try {
14
+ result = await inspectContext({
15
+ project_root: process.cwd(),
16
+ context_path: options.target,
17
+ route_task: options.task,
18
+ route_paths: options.route_paths,
19
+ route_terms: options.terms,
20
+ route_case_sensitive: options.case_sensitive,
21
+ });
22
+ }
23
+ catch (error) {
24
+ if (error instanceof CliCommandError)
25
+ throw error;
26
+ throw new CliCommandError(CLI_EXIT_CODES.internal, `context inspect failed internally: ${message(error)}`, { cause: error });
27
+ }
28
+ if (options.format === "json")
29
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
30
+ else
31
+ process.stdout.write(renderContextInspectText(result));
32
+ if (result.diagnostics.some((entry) => entry.severity === "error"))
33
+ process.exitCode = CLI_EXIT_CODES.catalog;
34
+ else if (result.route && !result.route.complete)
35
+ process.exitCode = CLI_EXIT_CODES.incomplete;
36
+ }
37
+ function parseInspectArgs(args) {
38
+ const options = {
39
+ route_paths: [],
40
+ terms: [],
41
+ case_sensitive: false,
42
+ format: "text",
43
+ help: false,
44
+ };
45
+ for (let index = 0; index < args.length; index += 1) {
46
+ const argument = args[index];
47
+ if (argument === "--help" || argument === "-h")
48
+ options.help = true;
49
+ else if (argument === "--json")
50
+ options.format = "json";
51
+ else if (argument === "--case-sensitive")
52
+ options.case_sensitive = true;
53
+ else if (argument === "--task")
54
+ index = readValue(args, index, argument, (value) => {
55
+ options.task = value;
56
+ });
57
+ else if (argument === "--route-path")
58
+ index = readValue(args, index, argument, (value) => {
59
+ options.route_paths.push(value);
60
+ });
61
+ else if (argument === "--term")
62
+ index = readValue(args, index, argument, (value) => {
63
+ options.terms.push(value);
64
+ });
65
+ else if (argument === "--format")
66
+ index = readValue(args, index, argument, (value) => {
67
+ if (value !== "text" && value !== "json")
68
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, "context inspect --format must be text or json");
69
+ options.format = value;
70
+ });
71
+ else if (argument.startsWith("--"))
72
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, `unknown context inspect argument: ${argument}`);
73
+ else if (options.target)
74
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, "context inspect accepts exactly one Context path");
75
+ else
76
+ options.target = argument;
77
+ }
78
+ return options;
79
+ }
80
+ function readValue(args, index, flag, apply) {
81
+ const value = args[index + 1];
82
+ if (value === undefined || value.startsWith("--") || value.length === 0)
83
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, `context inspect ${flag} requires a value`);
84
+ apply(value);
85
+ return index + 1;
86
+ }
87
+ function contextInspectHelp() {
88
+ return `ty-context context inspect <project_context/file.md>
89
+ [--task <text>] [--route-path <repo-path>] [--term <literal>]
90
+ [--case-sensitive] [--format text|json]
91
+
92
+ Reports ownership metadata, default-footprint membership, explicit Markdown
93
+ references, opt-in stable-key declarations and an optional experimental Router
94
+ explanation without modifying Context or Manifest files.`;
95
+ }
96
+ function message(error) {
97
+ return error instanceof Error ? error.message : String(error);
98
+ }
@@ -0,0 +1 @@
1
+ export declare function contextMove(args: string[]): Promise<void>;
@@ -0,0 +1,78 @@
1
+ import { CLI_EXIT_CODES, CliCommandError } from "../lib/cli-exit.js";
2
+ import { renderContextMoveText } from "../lib/context-move/context-move-render.js";
3
+ import { moveContext } from "../lib/context-move/context-move.js";
4
+ export async function contextMove(args) {
5
+ const options = parseMoveArgs(args);
6
+ if (options.help) {
7
+ console.log(contextMoveHelp());
8
+ return;
9
+ }
10
+ if (!options.from || !options.to)
11
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, "context move requires --from and --to");
12
+ let result;
13
+ try {
14
+ result = await moveContext({
15
+ project_root: process.cwd(),
16
+ from_path: options.from,
17
+ to_path: options.to,
18
+ apply: options.apply,
19
+ });
20
+ }
21
+ catch (error) {
22
+ if (error instanceof CliCommandError)
23
+ throw error;
24
+ throw new CliCommandError(CLI_EXIT_CODES.internal, `context move failed internally: ${message(error)}`, { cause: error });
25
+ }
26
+ if (options.format === "json")
27
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
28
+ else
29
+ process.stdout.write(renderContextMoveText(result));
30
+ }
31
+ function parseMoveArgs(args) {
32
+ const options = {
33
+ apply: false,
34
+ format: "text",
35
+ help: false,
36
+ };
37
+ for (let index = 0; index < args.length; index += 1) {
38
+ const argument = args[index];
39
+ if (argument === "--help" || argument === "-h")
40
+ options.help = true;
41
+ else if (argument === "--apply")
42
+ options.apply = true;
43
+ else if (argument === "--json")
44
+ options.format = "json";
45
+ else if (argument === "--from" || argument === "--to") {
46
+ const value = args[index + 1];
47
+ if (!value || value.startsWith("--"))
48
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, `context move ${argument} requires a value`);
49
+ const key = argument === "--from" ? "from" : "to";
50
+ if (options[key] !== undefined)
51
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, `context move ${argument} may be provided only once`);
52
+ options[key] = value;
53
+ index += 1;
54
+ }
55
+ else if (argument === "--format") {
56
+ const value = args[index + 1];
57
+ if (value !== "text" && value !== "json")
58
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, "context move --format must be text or json");
59
+ options.format = value;
60
+ index += 1;
61
+ }
62
+ else
63
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, `unknown context move argument: ${argument}`);
64
+ }
65
+ return options;
66
+ }
67
+ function contextMoveHelp() {
68
+ return `ty-context context move --from <project_context/file.md> --to <project_context/file.md>
69
+ [--apply] [--format text|json]
70
+
71
+ Dry-run is the default. Move losslessly patches the Manifest and explicit local
72
+ Markdown links, reports unstructured exact references, validates a staged
73
+ Catalog, and applies only through the recoverable CAS/journal transaction.
74
+ There is no --force or whole-Manifest rewrite path.`;
75
+ }
76
+ function message(error) {
77
+ return error instanceof Error ? error.message : String(error);
78
+ }
@@ -0,0 +1 @@
1
+ export declare function contextRegister(args: string[]): Promise<void>;
@@ -0,0 +1,110 @@
1
+ import { CLI_EXIT_CODES, CliCommandError } from "../lib/cli-exit.js";
2
+ import { registerContext } from "../lib/context-register/context-register.js";
3
+ import { renderContextRegisterText } from "../lib/context-register/context-register-render.js";
4
+ export async function contextRegister(args) {
5
+ const options = parseRegisterArgs(args);
6
+ if (options.help) {
7
+ console.log(contextRegisterHelp());
8
+ return;
9
+ }
10
+ if (!options.path || !options.role)
11
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, "context register requires --path and --role");
12
+ let result;
13
+ try {
14
+ result = await registerContext({
15
+ project_root: process.cwd(),
16
+ context_path: options.path,
17
+ role: options.role,
18
+ read_policy: options.read_policy,
19
+ read_when: options.read_when,
20
+ triggers: options.triggers,
21
+ default_children: options.default_children,
22
+ apply: options.apply,
23
+ });
24
+ }
25
+ catch (error) {
26
+ if (error instanceof CliCommandError)
27
+ throw error;
28
+ throw new CliCommandError(CLI_EXIT_CODES.internal, `context register failed internally: ${message(error)}`, { cause: error });
29
+ }
30
+ if (options.format === "json")
31
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
32
+ else
33
+ process.stdout.write(renderContextRegisterText(result));
34
+ }
35
+ function parseRegisterArgs(args) {
36
+ const options = {
37
+ triggers: [],
38
+ default_children: [],
39
+ apply: false,
40
+ format: "text",
41
+ help: false,
42
+ };
43
+ for (let index = 0; index < args.length; index += 1) {
44
+ const argument = args[index];
45
+ if (argument === "--help" || argument === "-h")
46
+ options.help = true;
47
+ else if (argument === "--apply")
48
+ options.apply = true;
49
+ else if (argument === "--json")
50
+ options.format = "json";
51
+ else if (argument === "--path")
52
+ index = readValue(args, index, argument, (value) => {
53
+ options.path = singleValue(options.path, value, argument);
54
+ });
55
+ else if (argument === "--role")
56
+ index = readValue(args, index, argument, (value) => {
57
+ options.role = singleValue(options.role, value, argument);
58
+ });
59
+ else if (argument === "--read-policy")
60
+ index = readValue(args, index, argument, (value) => {
61
+ options.read_policy = singleValue(options.read_policy, value, argument);
62
+ });
63
+ else if (argument === "--read-when")
64
+ index = readValue(args, index, argument, (value) => {
65
+ options.read_when = singleValue(options.read_when, value, argument);
66
+ });
67
+ else if (argument === "--trigger")
68
+ index = readValue(args, index, argument, (value) => {
69
+ options.triggers.push(value);
70
+ });
71
+ else if (argument === "--default-child")
72
+ index = readValue(args, index, argument, (value) => {
73
+ options.default_children.push(value);
74
+ });
75
+ else if (argument === "--format")
76
+ index = readValue(args, index, argument, (value) => {
77
+ if (value !== "text" && value !== "json")
78
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, "context register --format must be text or json");
79
+ options.format = value;
80
+ });
81
+ else
82
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, `unknown context register argument: ${argument}`);
83
+ }
84
+ return options;
85
+ }
86
+ function readValue(args, index, flag, apply) {
87
+ const value = args[index + 1];
88
+ if (value === undefined || value.startsWith("--") || value.length === 0)
89
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, `context register ${flag} requires a value`);
90
+ apply(value);
91
+ return index + 1;
92
+ }
93
+ function singleValue(previous, value, flag) {
94
+ if (previous !== undefined)
95
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, `context register ${flag} may be provided only once`);
96
+ return value;
97
+ }
98
+ function contextRegisterHelp() {
99
+ return `ty-context context register --path <project_context/file.md> --role <role>
100
+ [--read-policy default|on-demand] [--read-when <text>]
101
+ [--trigger <literal>]... [--default-child <context-path>]...
102
+ [--apply] [--format text|json]
103
+
104
+ Dry-run is the default. Registration requires an existing unregistered,
105
+ recoverable Context file and a valid staged Catalog. --apply commits through
106
+ the CAS/journal transaction engine; there is no --force bypass.`;
107
+ }
108
+ function message(error) {
109
+ return error instanceof Error ? error.message : String(error);
110
+ }
@@ -0,0 +1 @@
1
+ export declare function contextTransaction(args: string[]): Promise<void>;
@@ -0,0 +1,84 @@
1
+ import { CLI_EXIT_CODES, CliCommandError } from "../lib/cli-exit.js";
2
+ import { completeContextMutation, contextMutationStatus, rollbackContextMutation, } from "../lib/context-mutation/mutation-recovery.js";
3
+ export async function contextTransaction(args) {
4
+ const options = parseTransactionArgs(args);
5
+ if (options.help || options.action === "help") {
6
+ console.log(contextTransactionHelp());
7
+ return;
8
+ }
9
+ let result;
10
+ try {
11
+ if (options.action === "status")
12
+ result = await contextMutationStatus(process.cwd());
13
+ else if (options.action === "rollback")
14
+ result = await rollbackContextMutation(process.cwd());
15
+ else
16
+ result = await completeContextMutation(process.cwd());
17
+ }
18
+ catch (error) {
19
+ if (error instanceof CliCommandError)
20
+ throw error;
21
+ throw new CliCommandError(CLI_EXIT_CODES.io, `context transaction ${options.action} failed: ${message(error)}`, { cause: error });
22
+ }
23
+ if (options.format === "json")
24
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
25
+ else
26
+ process.stdout.write(renderTransactionStatus(result, options.action));
27
+ }
28
+ function parseTransactionArgs(args) {
29
+ const [actionInput = "help", ...rest] = args;
30
+ if (actionInput !== "help" &&
31
+ actionInput !== "status" &&
32
+ actionInput !== "rollback" &&
33
+ actionInput !== "complete")
34
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, `unknown context transaction action: ${actionInput}`);
35
+ const options = {
36
+ action: actionInput,
37
+ format: "text",
38
+ help: false,
39
+ };
40
+ for (let index = 0; index < rest.length; index += 1) {
41
+ const argument = rest[index];
42
+ if (argument === "--help" || argument === "-h")
43
+ options.help = true;
44
+ else if (argument === "--json")
45
+ options.format = "json";
46
+ else if (argument === "--format") {
47
+ const value = rest[index + 1];
48
+ if (value !== "text" && value !== "json")
49
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, "context transaction --format must be text or json");
50
+ options.format = value;
51
+ index += 1;
52
+ }
53
+ else
54
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, `unknown context transaction argument: ${argument}`);
55
+ }
56
+ return options;
57
+ }
58
+ function renderTransactionStatus(result, action) {
59
+ if (!result.journal_present)
60
+ return action === "status"
61
+ ? "No unfinished Context mutation transaction.\n"
62
+ : `Context mutation ${action} completed; no journal remains.\n`;
63
+ const lines = [
64
+ `Context mutation transaction: ${result.transaction_id}`,
65
+ `Operation: ${result.operation}`,
66
+ `Journal state: ${result.state}`,
67
+ ];
68
+ for (const directory of result.directories)
69
+ lines.push(`- ${directory.path}: ${directory.state} (directory)`);
70
+ for (const file of result.files)
71
+ lines.push(`- ${file.path}: ${file.state}${file.current_sha256 ? ` (${file.current_sha256})` : ""}`);
72
+ lines.push("Recovery:", ...result.recovery_commands.map((entry) => `- ${entry}`));
73
+ return `${lines.join("\n")}\n`;
74
+ }
75
+ function contextTransactionHelp() {
76
+ return `ty-context context transaction status|rollback|complete [--format text|json]
77
+
78
+ Reports or resolves the single recoverable Context mutation journal. A new
79
+ register/move transaction is refused until this journal is completed or rolled
80
+ back. Recovery never overwrites a file whose bytes match neither side.`;
81
+ }
82
+ function message(error) {
83
+ return error instanceof Error ? error.message : String(error);
84
+ }
@@ -0,0 +1 @@
1
+ export declare function context(args: string[]): Promise<void>;
@@ -0,0 +1,36 @@
1
+ import { CLI_EXIT_CODES, CliCommandError } from "../lib/cli-exit.js";
2
+ import { contextCreate } from "./context-create.js";
3
+ import { contextInspect } from "./context-inspect.js";
4
+ import { contextMove } from "./context-move.js";
5
+ import { contextRegister } from "./context-register.js";
6
+ import { contextTransaction } from "./context-transaction.js";
7
+ export async function context(args) {
8
+ const [subcommand = "help", ...rest] = args;
9
+ if (subcommand === "help" || subcommand === "--help" || subcommand === "-h") {
10
+ console.log(contextHelp());
11
+ return;
12
+ }
13
+ if (subcommand === "create")
14
+ return contextCreate(rest);
15
+ if (subcommand === "inspect")
16
+ return contextInspect(rest);
17
+ if (subcommand === "move")
18
+ return contextMove(rest);
19
+ if (subcommand === "register")
20
+ return contextRegister(rest);
21
+ if (subcommand === "transaction")
22
+ return contextTransaction(rest);
23
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, `unknown context subcommand: ${subcommand}`);
24
+ }
25
+ function contextHelp() {
26
+ return `ty-context context commands:
27
+ context create --path <project_context/file.md> --role <role> [--format text|json]
28
+ context inspect <project_context/file.md> [options]
29
+ context move --from <project_context/file.md> --to <project_context/file.md> [--apply]
30
+ context register --path <project_context/file.md> --role <role> [--apply] [options]
31
+ context transaction status|rollback|complete [--format text|json]
32
+
33
+ Create publishes an unregistered TODO-only scaffold and never edits the
34
+ Manifest. Register and move are dry-run-first and commit only through the
35
+ recoverable CAS/journal transaction engine; neither has a force bypass.`;
36
+ }
@@ -0,0 +1 @@
1
+ export declare function designAuthorityDeltaCommand(args: string[]): Promise<void>;
@@ -0,0 +1,53 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { parseDesignAuthorityDeltaAssessment } from "../lib/design-authority-delta-codec.js";
4
+ import { validateDesignAuthorityDeltaAssessmentCurrent } from "../lib/design-authority-delta-validation.js";
5
+ import { CLI_EXIT_CODES, CliCommandError } from "../lib/cli-exit.js";
6
+ import { normalizeRepositoryFile } from "../lib/long-task-paths.js";
7
+ import { assertProtectedRepositoryFile } from "../lib/repository-path-safety.js";
8
+ import { canonicalJson } from "../lib/strict-codec.js";
9
+ export async function designAuthorityDeltaCommand(args) {
10
+ const [subcommand = "help", ...rest] = args;
11
+ if (subcommand === "help" || subcommand === "--help" || subcommand === "-h") {
12
+ console.log(help());
13
+ return;
14
+ }
15
+ if (subcommand !== "validate")
16
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, `unknown authority-delta subcommand: ${subcommand}`);
17
+ const json = rest.includes("--json");
18
+ const positional = rest.filter((item) => item !== "--json");
19
+ if (positional.length !== 1)
20
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, "usage: ty-context design-resource authority-delta validate <assessment.json> [--json]");
21
+ const repository = process.cwd();
22
+ const relative = normalizeRepositoryFile(positional[0], "design_authority_delta_assessment");
23
+ try {
24
+ const file = await assertProtectedRepositoryFile(repository, path.resolve(repository, ...relative.split("/")), "design_authority_delta_assessment");
25
+ const assessment = parseDesignAuthorityDeltaAssessment(await readFile(file, "utf8"));
26
+ const result = await validateDesignAuthorityDeltaAssessmentCurrent(repository, assessment);
27
+ if (json)
28
+ process.stdout.write(canonicalJson(result));
29
+ else {
30
+ console.log(`Authority Delta Assessment: ${result.assessment}`);
31
+ console.log(`Authority closure current: ${result.authority_identity.closure_digest}`);
32
+ console.log("Authority adoption: not performed");
33
+ console.log("Repository writes: none");
34
+ }
35
+ }
36
+ catch (error) {
37
+ throw new CliCommandError(CLI_EXIT_CODES.catalog, message(error), {
38
+ cause: error,
39
+ });
40
+ }
41
+ }
42
+ function help() {
43
+ return `ty-context design-resource authority-delta commands:
44
+ validate <assessment.json> [--json]
45
+ Strictly validate a non-authoritative assessment
46
+ against the current complete Design Authority closure
47
+
48
+ Validation is read-only. It does not select, adopt or update Authority and it
49
+ does not start Design System Authoring.`;
50
+ }
51
+ function message(error) {
52
+ return error instanceof Error ? error.message : String(error);
53
+ }
@@ -0,0 +1 @@
1
+ export declare function designAuthority(args: string[]): Promise<void>;
@@ -0,0 +1,104 @@
1
+ import { inspectDesignAuthorityClosure, loadCurrentDesignAuthorityClosure, } from "../lib/design-authority-closure.js";
2
+ import { CLI_EXIT_CODES, CliCommandError } from "../lib/cli-exit.js";
3
+ import { canonicalJson } from "../lib/strict-codec.js";
4
+ import { projectDesignAuthorityTokensFromEntry } from "../lib/design-authority-tokens.js";
5
+ export async function designAuthority(args) {
6
+ const [subcommand = "help", ...rest] = args;
7
+ if (subcommand === "help" || subcommand === "--help" || subcommand === "-h") {
8
+ console.log(help());
9
+ return;
10
+ }
11
+ if (subcommand === "inspect")
12
+ return inspect(rest);
13
+ if (subcommand === "tokens")
14
+ return tokens(rest);
15
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, `unknown design-authority subcommand: ${subcommand}`);
16
+ }
17
+ async function inspect(args) {
18
+ const format = parseFormat(args, "inspect");
19
+ const result = await inspectDesignAuthorityClosure(process.cwd());
20
+ if (format === "json")
21
+ process.stdout.write(canonicalJson(result));
22
+ else
23
+ process.stdout.write(renderInspection(result));
24
+ if (result.status !== "valid")
25
+ process.exitCode = CLI_EXIT_CODES.catalog;
26
+ }
27
+ async function tokens(args) {
28
+ const fromEntry = args.length === 1 && args[0] === "--from-entry";
29
+ if (args.length && !fromEntry)
30
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, "design-authority tokens accepts only --from-entry");
31
+ let projected = null;
32
+ try {
33
+ if (fromEntry) {
34
+ const result = await projectDesignAuthorityTokensFromEntry(process.cwd());
35
+ if (!result.success)
36
+ throw new Error(`DESIGN.md is not locally exportable: ${result.error}`);
37
+ projected = result.content;
38
+ }
39
+ else {
40
+ const closure = await loadCurrentDesignAuthorityClosure(process.cwd());
41
+ projected = closure.generated_tokens;
42
+ }
43
+ }
44
+ catch (error) {
45
+ throw new CliCommandError(CLI_EXIT_CODES.catalog, `cannot project Design Authority Tokens: ${message(error)}`, { cause: error });
46
+ }
47
+ if (projected === null)
48
+ throw new CliCommandError(CLI_EXIT_CODES.catalog, "cannot project Design Authority Tokens: DESIGN.md is not locally exportable");
49
+ process.stdout.write(projected);
50
+ }
51
+ function parseFormat(args, command) {
52
+ let format = "text";
53
+ for (let index = 0; index < args.length; index += 1) {
54
+ const argument = args[index];
55
+ if (argument === "--json")
56
+ format = "json";
57
+ else if (argument === "--format") {
58
+ const value = args[index + 1];
59
+ if (value !== "text" && value !== "json")
60
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, `design-authority ${command} --format must be text or json`);
61
+ format = value;
62
+ index += 1;
63
+ }
64
+ else
65
+ throw new CliCommandError(CLI_EXIT_CODES.arguments, `unknown design-authority ${command} argument: ${argument}`);
66
+ }
67
+ return format;
68
+ }
69
+ function renderInspection(result) {
70
+ const lines = [`Design Authority: ${result.status}`, `Mode: ${result.mode}`];
71
+ if (result.identity) {
72
+ lines.push(`Entry: ${result.identity.entry_path}`);
73
+ lines.push(`Manifest: ${result.identity.manifest_path ?? "none (legacy)"}`);
74
+ lines.push(`Closure digest: ${result.identity.closure_digest}`);
75
+ lines.push(`Revision: ${result.identity.revision ?? "not declared"}`);
76
+ lines.push(`Members: ${result.members.length}`);
77
+ for (const member of result.members)
78
+ lines.push(` - ${member.path} (${member.kind}, ${member.normalized_bytes} bytes)`);
79
+ }
80
+ if (result.diagnostics.length) {
81
+ lines.push("Diagnostics:");
82
+ for (const diagnostic of result.diagnostics)
83
+ lines.push(` - ${diagnostic.severity} ${diagnostic.code}${diagnostic.path ? ` [${diagnostic.path}]` : ""}: ${diagnostic.detail}`);
84
+ }
85
+ else
86
+ lines.push("Diagnostics: none");
87
+ lines.push("Authority adoption: not performed");
88
+ return `${lines.join("\n")}\n`;
89
+ }
90
+ function help() {
91
+ return `ty-context design-authority commands:
92
+ design-authority inspect [--format text|json]
93
+ Validate and explain the current complete closure
94
+ design-authority tokens [--from-entry]
95
+ Print the deterministic DTCG projection from DESIGN.md;
96
+ --from-entry permits read-only projection while a bundle
97
+ is being revised and its old digest is intentionally stale
98
+
99
+ Both commands are read-only. They never create a manifest, update a digest,
100
+ select a design direction or adopt a Design Authority revision.`;
101
+ }
102
+ function message(error) {
103
+ return error instanceof Error ? error.message : String(error);
104
+ }
@@ -3,6 +3,7 @@ import { preflightDesignResourceHandoff } from "../lib/design-resource-handoff-v
3
3
  import { designResourceRecoveryCommand } from "./design-resource-recovery.js";
4
4
  import { normalizeRepositoryCwd, normalizeRepositoryFile, } from "../lib/long-task-paths.js";
5
5
  import { canonicalJson } from "../lib/strict-codec.js";
6
+ import { designAuthorityDeltaCommand } from "./design-authority-delta.js";
6
7
  export async function designResource(args) {
7
8
  const [subcommand = "help", ...rest] = args;
8
9
  if (subcommand === "help") {
@@ -17,6 +18,10 @@ export async function designResource(args) {
17
18
  await designResourceRecoveryCommand(rest);
18
19
  return;
19
20
  }
21
+ if (subcommand === "authority-delta") {
22
+ await designAuthorityDeltaCommand(rest);
23
+ return;
24
+ }
20
25
  if (subcommand !== "preflight")
21
26
  throw new Error(`Unknown design-resource subcommand: ${subcommand}`);
22
27
  const json = rest.includes("--json");
@@ -121,5 +126,7 @@ function help() {
121
126
  recovery reconcile <session> --audit <audit.json> [--json]
122
127
  Read-only reconciliation for a no-writeback checkpoint
123
128
  recovery remove <session> --expected-sha256 <sha256> [--json]
124
- Remove only the digest-matched helper-owned checkpoint`);
129
+ Remove only the digest-matched helper-owned checkpoint
130
+ authority-delta validate <assessment.json> [--json]
131
+ Validate one read-only, non-adopting Authority assessment`);
125
132
  }
@@ -1 +1 @@
1
- export declare function doctor(): Promise<void>;
1
+ export declare function doctor(args?: string[]): Promise<void>;