@ybotok/loam 0.1.0-beta.3 → 0.2.0-alpha.2

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 (1036) hide show
  1. package/CHANGELOG.md +2635 -86
  2. package/COMPARISON.md +80 -63
  3. package/CONTRIBUTING.md +84 -0
  4. package/MIGRATING-from-OpenSpec.md +213 -54
  5. package/QUICKSTART.md +125 -0
  6. package/README.md +450 -150
  7. package/ROADMAP.md +599 -0
  8. package/SCHEMA.md +2355 -256
  9. package/SECURITY.md +21 -3
  10. package/WORKFLOW.md +701 -0
  11. package/dist/cli.js +113 -19
  12. package/dist/cli.js.map +1 -1
  13. package/dist/commands/adopt/adopt.js +209 -0
  14. package/dist/commands/adopt/adopt.js.map +1 -0
  15. package/dist/commands/adopt/render.js +268 -0
  16. package/dist/commands/adopt/render.js.map +1 -0
  17. package/dist/commands/archive/archive.js +77 -0
  18. package/dist/commands/archive/archive.js.map +1 -0
  19. package/dist/commands/archive/plan/contracts/asyncapi.js +178 -0
  20. package/dist/commands/archive/plan/contracts/asyncapi.js.map +1 -0
  21. package/dist/commands/archive/plan/contracts/openapi.js +159 -0
  22. package/dist/commands/archive/plan/contracts/openapi.js.map +1 -0
  23. package/dist/commands/archive/plan/gate.js +323 -0
  24. package/dist/commands/archive/plan/gate.js.map +1 -0
  25. package/dist/commands/archive/plan/landscape.js +180 -0
  26. package/dist/commands/archive/plan/landscape.js.map +1 -0
  27. package/dist/commands/archive/plan/refusal.js +111 -0
  28. package/dist/commands/archive/plan/refusal.js.map +1 -0
  29. package/dist/commands/archive/plan/specs.js +237 -0
  30. package/dist/commands/archive/plan/specs.js.map +1 -0
  31. package/dist/commands/archive/plan/state.js +27 -0
  32. package/dist/commands/archive/plan/state.js.map +1 -0
  33. package/dist/commands/archive/run.js +252 -0
  34. package/dist/commands/archive/run.js.map +1 -0
  35. package/dist/commands/context/context.js +99 -0
  36. package/dist/commands/context/context.js.map +1 -0
  37. package/dist/commands/context/print.js +283 -0
  38. package/dist/commands/context/print.js.map +1 -0
  39. package/dist/commands/delta/delta.js +279 -0
  40. package/dist/commands/delta/delta.js.map +1 -0
  41. package/dist/commands/delta/print.js +205 -0
  42. package/dist/commands/delta/print.js.map +1 -0
  43. package/dist/commands/dependencies.js +9 -7
  44. package/dist/commands/dependencies.js.map +1 -1
  45. package/dist/commands/diff/diff.js +93 -0
  46. package/dist/commands/diff/diff.js.map +1 -0
  47. package/dist/commands/diff/print.js +38 -0
  48. package/dist/commands/diff/print.js.map +1 -0
  49. package/dist/commands/doctor.js +5 -4
  50. package/dist/commands/doctor.js.map +1 -1
  51. package/dist/commands/explain/explain.js +151 -0
  52. package/dist/commands/explain/explain.js.map +1 -0
  53. package/dist/commands/explore.js +29 -24
  54. package/dist/commands/explore.js.map +1 -1
  55. package/dist/commands/gate/gate.js +115 -0
  56. package/dist/commands/gate/gate.js.map +1 -0
  57. package/dist/commands/gate/print.js +54 -0
  58. package/dist/commands/gate/print.js.map +1 -0
  59. package/dist/commands/gherkin/commit.js +146 -0
  60. package/dist/commands/gherkin/commit.js.map +1 -0
  61. package/dist/commands/gherkin/gherkin.js +246 -0
  62. package/dist/commands/gherkin/gherkin.js.map +1 -0
  63. package/dist/commands/gherkin/reconcile.js +149 -0
  64. package/dist/commands/gherkin/reconcile.js.map +1 -0
  65. package/dist/commands/gherkin/render.js +77 -0
  66. package/dist/commands/gherkin/render.js.map +1 -0
  67. package/dist/commands/init/example.js +204 -0
  68. package/dist/commands/init/example.js.map +1 -0
  69. package/dist/commands/init/first-hour.js +28 -0
  70. package/dist/commands/init/first-hour.js.map +1 -0
  71. package/dist/commands/{init.js → init/init.js} +146 -71
  72. package/dist/commands/init/init.js.map +1 -0
  73. package/dist/commands/init/mcp.js +131 -0
  74. package/dist/commands/init/mcp.js.map +1 -0
  75. package/dist/commands/init/options.js +78 -0
  76. package/dist/commands/init/options.js.map +1 -0
  77. package/dist/commands/instructions.js +72 -14
  78. package/dist/commands/instructions.js.map +1 -1
  79. package/dist/commands/list/campaign/campaign.js +65 -0
  80. package/dist/commands/list/campaign/campaign.js.map +1 -0
  81. package/dist/commands/list/campaign/owners.js +65 -0
  82. package/dist/commands/list/campaign/owners.js.map +1 -0
  83. package/dist/commands/list/json.js +157 -0
  84. package/dist/commands/list/json.js.map +1 -0
  85. package/dist/commands/list/list.js +343 -0
  86. package/dist/commands/list/list.js.map +1 -0
  87. package/dist/commands/list/print.js +301 -0
  88. package/dist/commands/list/print.js.map +1 -0
  89. package/dist/commands/list/review.js +120 -0
  90. package/dist/commands/list/review.js.map +1 -0
  91. package/dist/commands/list/views.js +105 -0
  92. package/dist/commands/list/views.js.map +1 -0
  93. package/dist/commands/mcp/dispatch.js +183 -0
  94. package/dist/commands/mcp/dispatch.js.map +1 -0
  95. package/dist/commands/mcp/mcp.js +34 -0
  96. package/dist/commands/mcp/mcp.js.map +1 -0
  97. package/dist/commands/mcp/serve.js +55 -0
  98. package/dist/commands/mcp/serve.js.map +1 -0
  99. package/dist/commands/migrate-openspec/materialize/active.js +170 -0
  100. package/dist/commands/migrate-openspec/materialize/active.js.map +1 -0
  101. package/dist/commands/migrate-openspec/materialize/feature.js +41 -0
  102. package/dist/commands/migrate-openspec/materialize/feature.js.map +1 -0
  103. package/dist/commands/migrate-openspec/materialize/living.js +62 -0
  104. package/dist/commands/migrate-openspec/materialize/living.js.map +1 -0
  105. package/dist/commands/migrate-openspec/materialize/stage.js +142 -0
  106. package/dist/commands/migrate-openspec/materialize/stage.js.map +1 -0
  107. package/dist/commands/migrate-openspec/materialize/target.js +219 -0
  108. package/dist/commands/migrate-openspec/materialize/target.js.map +1 -0
  109. package/dist/commands/migrate-openspec/migrate-openspec.js +142 -0
  110. package/dist/commands/migrate-openspec/migrate-openspec.js.map +1 -0
  111. package/dist/commands/migrate-openspec/openspec/decisions.js +91 -0
  112. package/dist/commands/migrate-openspec/openspec/decisions.js.map +1 -0
  113. package/dist/commands/migrate-openspec/openspec/error.js +19 -0
  114. package/dist/commands/migrate-openspec/openspec/error.js.map +1 -0
  115. package/dist/commands/migrate-openspec/openspec/mapping.js +170 -0
  116. package/dist/commands/migrate-openspec/openspec/mapping.js.map +1 -0
  117. package/dist/commands/migrate-openspec/openspec/paths.js +43 -0
  118. package/dist/commands/migrate-openspec/openspec/paths.js.map +1 -0
  119. package/dist/commands/migrate-openspec/openspec/read.js +49 -0
  120. package/dist/commands/migrate-openspec/openspec/read.js.map +1 -0
  121. package/dist/commands/migrate-openspec/print.js +89 -0
  122. package/dist/commands/migrate-openspec/print.js.map +1 -0
  123. package/dist/commands/new/commit.js +76 -0
  124. package/dist/commands/new/commit.js.map +1 -0
  125. package/dist/commands/new/new.js +283 -0
  126. package/dist/commands/new/new.js.map +1 -0
  127. package/dist/commands/new/templates.js +355 -0
  128. package/dist/commands/new/templates.js.map +1 -0
  129. package/dist/commands/open.js +203 -0
  130. package/dist/commands/open.js.map +1 -0
  131. package/dist/commands/policy/format.js +152 -0
  132. package/dist/commands/policy/format.js.map +1 -0
  133. package/dist/commands/{docs-repo-gate.js → policy/gate.js} +11 -11
  134. package/dist/commands/policy/gate.js.map +1 -0
  135. package/dist/commands/rebase/edit.js +106 -0
  136. package/dist/commands/rebase/edit.js.map +1 -0
  137. package/dist/commands/rebase/living.js +185 -0
  138. package/dist/commands/rebase/living.js.map +1 -0
  139. package/dist/commands/rebase/plan.js +245 -0
  140. package/dist/commands/rebase/plan.js.map +1 -0
  141. package/dist/commands/rebase/rebase.js +275 -0
  142. package/dist/commands/rebase/rebase.js.map +1 -0
  143. package/dist/commands/seed/commit.js +192 -0
  144. package/dist/commands/seed/commit.js.map +1 -0
  145. package/dist/commands/seed/plan.js +133 -0
  146. package/dist/commands/seed/plan.js.map +1 -0
  147. package/dist/commands/seed/seed.js +172 -0
  148. package/dist/commands/seed/seed.js.map +1 -0
  149. package/dist/commands/show/feature.js +178 -0
  150. package/dist/commands/show/feature.js.map +1 -0
  151. package/dist/commands/show/marks.js +24 -0
  152. package/dist/commands/show/marks.js.map +1 -0
  153. package/dist/commands/{show.js → show/service.js} +63 -152
  154. package/dist/commands/show/service.js.map +1 -0
  155. package/dist/commands/show/show.js +77 -0
  156. package/dist/commands/show/show.js.map +1 -0
  157. package/dist/commands/status/json.js +45 -0
  158. package/dist/commands/status/json.js.map +1 -0
  159. package/dist/commands/status/print.js +157 -0
  160. package/dist/commands/status/print.js.map +1 -0
  161. package/dist/commands/status/status.js +119 -0
  162. package/dist/commands/status/status.js.map +1 -0
  163. package/dist/commands/steps/steps.js +189 -0
  164. package/dist/commands/steps/steps.js.map +1 -0
  165. package/dist/commands/subsystem/edit.js +192 -0
  166. package/dist/commands/subsystem/edit.js.map +1 -0
  167. package/dist/commands/subsystem/move.js +265 -0
  168. package/dist/commands/subsystem/move.js.map +1 -0
  169. package/dist/commands/subsystem/query.js +115 -0
  170. package/dist/commands/subsystem/query.js.map +1 -0
  171. package/dist/commands/subsystem/subsystem.js +101 -0
  172. package/dist/commands/subsystem/subsystem.js.map +1 -0
  173. package/dist/commands/subsystem/sync.js +103 -0
  174. package/dist/commands/subsystem/sync.js.map +1 -0
  175. package/dist/commands/subsystem/txn/txn.js +94 -0
  176. package/dist/commands/subsystem/txn/txn.js.map +1 -0
  177. package/dist/commands/subsystem/txn/views.js +70 -0
  178. package/dist/commands/subsystem/txn/views.js.map +1 -0
  179. package/dist/commands/unarchive/manifest.js +160 -0
  180. package/dist/commands/unarchive/manifest.js.map +1 -0
  181. package/dist/commands/{unarchive.js → unarchive/restore.js} +47 -160
  182. package/dist/commands/unarchive/restore.js.map +1 -0
  183. package/dist/commands/unarchive/unarchive.js +67 -0
  184. package/dist/commands/unarchive/unarchive.js.map +1 -0
  185. package/dist/commands/validate/arch-coverage.js +204 -0
  186. package/dist/commands/validate/arch-coverage.js.map +1 -0
  187. package/dist/commands/validate/checks/fleet-shape.js +296 -0
  188. package/dist/commands/validate/checks/fleet-shape.js.map +1 -0
  189. package/dist/commands/validate/checks/health-deps.js +55 -0
  190. package/dist/commands/validate/checks/health-deps.js.map +1 -0
  191. package/dist/commands/validate/checks/requirements.js +254 -0
  192. package/dist/commands/validate/checks/requirements.js.map +1 -0
  193. package/dist/commands/validate/checks/sources.js +76 -0
  194. package/dist/commands/validate/checks/sources.js.map +1 -0
  195. package/dist/commands/validate/checks/vocabulary.js +31 -0
  196. package/dist/commands/validate/checks/vocabulary.js.map +1 -0
  197. package/dist/commands/validate/feature.js +216 -0
  198. package/dist/commands/validate/feature.js.map +1 -0
  199. package/dist/commands/validate/fleet/census.js +69 -0
  200. package/dist/commands/validate/fleet/census.js.map +1 -0
  201. package/dist/commands/validate/fleet/kind-tags.js +39 -0
  202. package/dist/commands/validate/fleet/kind-tags.js.map +1 -0
  203. package/dist/commands/validate/fleet/landscape.js +353 -0
  204. package/dist/commands/validate/fleet/landscape.js.map +1 -0
  205. package/dist/commands/validate/fleet/load.js +52 -0
  206. package/dist/commands/validate/fleet/load.js.map +1 -0
  207. package/dist/commands/validate/fleet/obligations.js +270 -0
  208. package/dist/commands/validate/fleet/obligations.js.map +1 -0
  209. package/dist/commands/validate/fleet/scorecard/adoption.js +102 -0
  210. package/dist/commands/validate/fleet/scorecard/adoption.js.map +1 -0
  211. package/dist/commands/validate/fleet/scorecard/contracts.js +98 -0
  212. package/dist/commands/validate/fleet/scorecard/contracts.js.map +1 -0
  213. package/dist/commands/validate/fleet/scorecard/print.js +63 -0
  214. package/dist/commands/validate/fleet/scorecard/print.js.map +1 -0
  215. package/dist/commands/validate/fleet/scorecard/scorecard.js +156 -0
  216. package/dist/commands/validate/fleet/scorecard/scorecard.js.map +1 -0
  217. package/dist/commands/validate/fleet/usecases/capability-tag.js +94 -0
  218. package/dist/commands/validate/fleet/usecases/capability-tag.js.map +1 -0
  219. package/dist/commands/validate/fleet/usecases/place.js +13 -0
  220. package/dist/commands/validate/fleet/usecases/place.js.map +1 -0
  221. package/dist/commands/validate/fleet/usecases/requirement-tag.js +95 -0
  222. package/dist/commands/validate/fleet/usecases/requirement-tag.js.map +1 -0
  223. package/dist/commands/validate/fleet/usecases/steps.js +197 -0
  224. package/dist/commands/validate/fleet/usecases/steps.js.map +1 -0
  225. package/dist/commands/validate/fleet/usecases/usecases.js +99 -0
  226. package/dist/commands/validate/fleet/usecases/usecases.js.map +1 -0
  227. package/dist/commands/validate/fleet/views/ids.js +40 -0
  228. package/dist/commands/validate/fleet/views/ids.js.map +1 -0
  229. package/dist/commands/validate/fleet/views/stale.js +59 -0
  230. package/dist/commands/validate/fleet/views/stale.js.map +1 -0
  231. package/dist/commands/validate/links/corpus.js +92 -0
  232. package/dist/commands/validate/links/corpus.js.map +1 -0
  233. package/dist/commands/validate/links/glossary.js +75 -0
  234. package/dist/commands/validate/links/glossary.js.map +1 -0
  235. package/dist/commands/validate/report.js +269 -0
  236. package/dist/commands/validate/report.js.map +1 -0
  237. package/dist/commands/validate/service/api.js +338 -0
  238. package/dist/commands/validate/service/api.js.map +1 -0
  239. package/dist/commands/validate/service/events/events.js +219 -0
  240. package/dist/commands/validate/service/events/events.js.map +1 -0
  241. package/dist/commands/validate/service/events/message-producers.js +77 -0
  242. package/dist/commands/validate/service/events/message-producers.js.map +1 -0
  243. package/dist/commands/validate/service/evidence-pins.js +131 -0
  244. package/dist/commands/validate/service/evidence-pins.js.map +1 -0
  245. package/dist/commands/validate/service/service.js +251 -0
  246. package/dist/commands/validate/service/service.js.map +1 -0
  247. package/dist/commands/validate/service/specs.js +251 -0
  248. package/dist/commands/validate/service/specs.js.map +1 -0
  249. package/dist/commands/validate/service/spine.js +113 -0
  250. package/dist/commands/validate/service/spine.js.map +1 -0
  251. package/dist/commands/validate/validate.js +338 -0
  252. package/dist/commands/validate/validate.js.map +1 -0
  253. package/dist/commands/verify/cross/diff.js +182 -0
  254. package/dist/commands/verify/cross/diff.js.map +1 -0
  255. package/dist/commands/verify/evidence/contract.js +32 -0
  256. package/dist/commands/verify/evidence/contract.js.map +1 -0
  257. package/dist/commands/verify/evidence/pins.js +52 -0
  258. package/dist/commands/verify/evidence/pins.js.map +1 -0
  259. package/dist/commands/verify/evidence/read.js +72 -0
  260. package/dist/commands/verify/evidence/read.js.map +1 -0
  261. package/dist/commands/verify/frozen.js +241 -0
  262. package/dist/commands/verify/frozen.js.map +1 -0
  263. package/dist/commands/verify/record.js +226 -0
  264. package/dist/commands/verify/record.js.map +1 -0
  265. package/dist/commands/verify/report.js +223 -0
  266. package/dist/commands/verify/report.js.map +1 -0
  267. package/dist/commands/verify/results.js +246 -0
  268. package/dist/commands/verify/results.js.map +1 -0
  269. package/dist/commands/verify/verify.js +217 -0
  270. package/dist/commands/verify/verify.js.map +1 -0
  271. package/dist/commands/vouch/contract.js +11 -0
  272. package/dist/commands/vouch/contract.js.map +1 -0
  273. package/dist/commands/vouch/pack/contract.js +2 -0
  274. package/dist/commands/vouch/pack/contract.js.map +1 -0
  275. package/dist/commands/vouch/pack/pack.js +266 -0
  276. package/dist/commands/vouch/pack/pack.js.map +1 -0
  277. package/dist/commands/vouch/pack/print.js +271 -0
  278. package/dist/commands/vouch/pack/print.js.map +1 -0
  279. package/dist/commands/vouch/pack/sections.js +142 -0
  280. package/dist/commands/vouch/pack/sections.js.map +1 -0
  281. package/dist/commands/vouch/prompt/confirm.js +46 -0
  282. package/dist/commands/vouch/prompt/confirm.js.map +1 -0
  283. package/dist/commands/vouch/report.js +101 -0
  284. package/dist/commands/vouch/report.js.map +1 -0
  285. package/dist/commands/vouch/run.js +285 -0
  286. package/dist/commands/vouch/run.js.map +1 -0
  287. package/dist/commands/vouch/sample/plan.js +125 -0
  288. package/dist/commands/vouch/sample/plan.js.map +1 -0
  289. package/dist/commands/vouch/sample/print.js +109 -0
  290. package/dist/commands/vouch/sample/print.js.map +1 -0
  291. package/dist/commands/vouch/vet/verify.js +123 -0
  292. package/dist/commands/vouch/vet/verify.js.map +1 -0
  293. package/dist/commands/vouch/vouch.js +176 -0
  294. package/dist/commands/vouch/vouch.js.map +1 -0
  295. package/dist/core/agent/agents-md/artifacts.js +220 -0
  296. package/dist/core/agent/agents-md/artifacts.js.map +1 -0
  297. package/dist/core/agent/agents-md/command-map.js +324 -0
  298. package/dist/core/agent/agents-md/command-map.js.map +1 -0
  299. package/dist/core/agent/agents-md/cycle.js +165 -0
  300. package/dist/core/agent/agents-md/cycle.js.map +1 -0
  301. package/dist/core/agent/agents-md/map/explain.js +34 -0
  302. package/dist/core/agent/agents-md/map/explain.js.map +1 -0
  303. package/dist/core/agent/agents-md/map/lenses/context.js +41 -0
  304. package/dist/core/agent/agents-md/map/lenses/context.js.map +1 -0
  305. package/dist/core/agent/agents-md/map/lenses/diff.js +46 -0
  306. package/dist/core/agent/agents-md/map/lenses/diff.js.map +1 -0
  307. package/dist/core/agent/agents-md/map/lenses/gate.js +57 -0
  308. package/dist/core/agent/agents-md/map/lenses/gate.js.map +1 -0
  309. package/dist/core/agent/agents-md/map/mcp.js +41 -0
  310. package/dist/core/agent/agents-md/map/mcp.js.map +1 -0
  311. package/dist/core/agent/agents-md/map/status.js +62 -0
  312. package/dist/core/agent/agents-md/map/status.js.map +1 -0
  313. package/dist/core/agent/agents-md/map/subsystem.js +32 -0
  314. package/dist/core/agent/agents-md/map/subsystem.js.map +1 -0
  315. package/dist/core/agent/agents-md/map/usecases.js +60 -0
  316. package/dist/core/agent/agents-md/map/usecases.js.map +1 -0
  317. package/dist/core/agent/agents-md/refusals.js +246 -0
  318. package/dist/core/agent/agents-md/refusals.js.map +1 -0
  319. package/dist/core/agent/agents-md/shipped/archive-gate.js +98 -0
  320. package/dist/core/agent/agents-md/shipped/archive-gate.js.map +1 -0
  321. package/dist/core/agent/agents-md/spine.js +40 -0
  322. package/dist/core/agent/agents-md/spine.js.map +1 -0
  323. package/dist/core/agent/agents-md.js +170 -0
  324. package/dist/core/agent/agents-md.js.map +1 -0
  325. package/dist/core/{agents-stamp.js → agent/agents-stamp.js} +50 -0
  326. package/dist/core/agent/agents-stamp.js.map +1 -0
  327. package/dist/core/agent/contract.js +2 -0
  328. package/dist/core/agent/contract.js.map +1 -0
  329. package/dist/core/agent/protocol.js +193 -0
  330. package/dist/core/agent/protocol.js.map +1 -0
  331. package/dist/core/agent/scaffold.js +259 -0
  332. package/dist/core/agent/scaffold.js.map +1 -0
  333. package/dist/core/agent/support/report.js +103 -0
  334. package/dist/core/agent/support/report.js.map +1 -0
  335. package/dist/core/agent/tools/dialects.js +150 -0
  336. package/dist/core/agent/tools/dialects.js.map +1 -0
  337. package/dist/core/agent/tools/registry.js +228 -0
  338. package/dist/core/agent/tools/registry.js.map +1 -0
  339. package/dist/core/agent/workflows/adopt.js +133 -0
  340. package/dist/core/agent/workflows/adopt.js.map +1 -0
  341. package/dist/core/agent/workflows/check.js +337 -0
  342. package/dist/core/agent/workflows/check.js.map +1 -0
  343. package/dist/core/agent/workflows/closing.js +262 -0
  344. package/dist/core/agent/workflows/closing.js.map +1 -0
  345. package/dist/core/agent/workflows/feature.js +105 -0
  346. package/dist/core/agent/workflows/feature.js.map +1 -0
  347. package/dist/core/agent/workflows/implement.js +105 -0
  348. package/dist/core/agent/workflows/implement.js.map +1 -0
  349. package/dist/core/agent/workflows/reference/authoring.js +209 -0
  350. package/dist/core/agent/workflows/reference/authoring.js.map +1 -0
  351. package/dist/core/agent/workflows/reference/codes.js +65 -0
  352. package/dist/core/agent/workflows/reference/codes.js.map +1 -0
  353. package/dist/core/agent/workflows/reference/done-check.js +188 -0
  354. package/dist/core/agent/workflows/reference/done-check.js.map +1 -0
  355. package/dist/core/agent/workflows/reference/reference.js +16 -0
  356. package/dist/core/agent/workflows/reference/reference.js.map +1 -0
  357. package/dist/core/agent/workflows/reference/spine.js +297 -0
  358. package/dist/core/agent/workflows/reference/spine.js.map +1 -0
  359. package/dist/core/asyncapi/baseline/plan.js +110 -0
  360. package/dist/core/asyncapi/baseline/plan.js.map +1 -0
  361. package/dist/core/asyncapi/baseline/surfaces.js +54 -0
  362. package/dist/core/asyncapi/baseline/surfaces.js.map +1 -0
  363. package/dist/core/asyncapi/depth.js +164 -0
  364. package/dist/core/asyncapi/depth.js.map +1 -0
  365. package/dist/core/asyncapi/digest.js +141 -0
  366. package/dist/core/asyncapi/digest.js.map +1 -0
  367. package/dist/core/asyncapi/merge/components.js +91 -0
  368. package/dist/core/asyncapi/merge/components.js.map +1 -0
  369. package/dist/core/asyncapi/merge/error.js +33 -0
  370. package/dist/core/asyncapi/merge/error.js.map +1 -0
  371. package/dist/core/asyncapi/merge/markers.js +308 -0
  372. package/dist/core/asyncapi/merge/markers.js.map +1 -0
  373. package/dist/core/asyncapi/merge/merge.js +215 -0
  374. package/dist/core/asyncapi/merge/merge.js.map +1 -0
  375. package/dist/core/asyncapi/merge/pin.js +107 -0
  376. package/dist/core/asyncapi/merge/pin.js.map +1 -0
  377. package/dist/core/asyncapi/model.js +11 -0
  378. package/dist/core/asyncapi/model.js.map +1 -0
  379. package/dist/core/asyncapi/producers.js +50 -0
  380. package/dist/core/asyncapi/producers.js.map +1 -0
  381. package/dist/core/{asyncapi.js → asyncapi/read.js} +95 -109
  382. package/dist/core/asyncapi/read.js.map +1 -0
  383. package/dist/core/brief/brief.js +225 -0
  384. package/dist/core/brief/brief.js.map +1 -0
  385. package/dist/core/brief/checks.js +250 -0
  386. package/dist/core/brief/checks.js.map +1 -0
  387. package/dist/core/brief/landscape.js +194 -0
  388. package/dist/core/brief/landscape.js.map +1 -0
  389. package/dist/core/brief/targets.js +226 -0
  390. package/dist/core/brief/targets.js.map +1 -0
  391. package/dist/core/brief/unchecked.js +48 -0
  392. package/dist/core/brief/unchecked.js.map +1 -0
  393. package/dist/core/c4/arch.js +174 -0
  394. package/dist/core/c4/arch.js.map +1 -0
  395. package/dist/core/c4/likec4.js +90 -0
  396. package/dist/core/c4/likec4.js.map +1 -0
  397. package/dist/core/c4/parsed/deployment.js +158 -0
  398. package/dist/core/c4/parsed/deployment.js.map +1 -0
  399. package/dist/core/c4/parsed/dynamic-views.js +132 -0
  400. package/dist/core/c4/parsed/dynamic-views.js.map +1 -0
  401. package/dist/core/c4/parsed/specification.js +78 -0
  402. package/dist/core/c4/parsed/specification.js.map +1 -0
  403. package/dist/core/c4/parsed/values.js +57 -0
  404. package/dist/core/c4/parsed/values.js.map +1 -0
  405. package/dist/core/c4/parsed/view-ids.js +75 -0
  406. package/dist/core/c4/parsed/view-ids.js.map +1 -0
  407. package/dist/core/c4/project/architecture.js +45 -0
  408. package/dist/core/c4/project/architecture.js.map +1 -0
  409. package/dist/core/c4/project/documents.js +58 -0
  410. package/dist/core/c4/project/documents.js.map +1 -0
  411. package/dist/core/c4/project/load.js +187 -0
  412. package/dist/core/c4/project/load.js.map +1 -0
  413. package/dist/core/c4/project/staged.js +220 -0
  414. package/dist/core/c4/project/staged.js.map +1 -0
  415. package/dist/core/c4/resolve/service.js +159 -0
  416. package/dist/core/c4/resolve/service.js.map +1 -0
  417. package/dist/core/c4/resolve/steps.js +144 -0
  418. package/dist/core/c4/resolve/steps.js.map +1 -0
  419. package/dist/core/c4/seed/fleet-file.js +201 -0
  420. package/dist/core/c4/seed/fleet-file.js.map +1 -0
  421. package/dist/core/c4/seed/items.js +91 -0
  422. package/dist/core/c4/seed/items.js.map +1 -0
  423. package/dist/core/c4/seed/stamp.js +48 -0
  424. package/dist/core/c4/seed/stamp.js.map +1 -0
  425. package/dist/core/c4/seed/template.js +109 -0
  426. package/dist/core/c4/seed/template.js.map +1 -0
  427. package/dist/core/c4/source-mask.js +82 -0
  428. package/dist/core/c4/source-mask.js.map +1 -0
  429. package/dist/core/c4/source-scan.js +227 -0
  430. package/dist/core/c4/source-scan.js.map +1 -0
  431. package/dist/core/c4/splice/authored-source.js +101 -0
  432. package/dist/core/c4/splice/authored-source.js.map +1 -0
  433. package/dist/core/c4/splice/contract.js +10 -0
  434. package/dist/core/c4/splice/contract.js.map +1 -0
  435. package/dist/core/c4/splice/delta-blocks.js +139 -0
  436. package/dist/core/c4/splice/delta-blocks.js.map +1 -0
  437. package/dist/core/c4/splice/identity/edges.js +36 -0
  438. package/dist/core/c4/splice/identity/edges.js.map +1 -0
  439. package/dist/core/c4/splice/landscape-merge.js +269 -0
  440. package/dist/core/c4/splice/landscape-merge.js.map +1 -0
  441. package/dist/core/c4/splice/placement.js +194 -0
  442. package/dist/core/c4/splice/placement.js.map +1 -0
  443. package/dist/core/c4/workspace.js +174 -0
  444. package/dist/core/c4/workspace.js.map +1 -0
  445. package/dist/core/capabilities/authoring/notes.js +141 -0
  446. package/dist/core/capabilities/authoring/notes.js.map +1 -0
  447. package/dist/core/capabilities/capabilities.js +124 -0
  448. package/dist/core/capabilities/capabilities.js.map +1 -0
  449. package/dist/core/capabilities/delta/doc.js +50 -0
  450. package/dist/core/capabilities/delta/doc.js.map +1 -0
  451. package/dist/core/capabilities/delta/overlay.js +129 -0
  452. package/dist/core/capabilities/delta/overlay.js.map +1 -0
  453. package/dist/core/capabilities/delta/summary.js +57 -0
  454. package/dist/core/capabilities/delta/summary.js.map +1 -0
  455. package/dist/core/capabilities/delta/tree.js +43 -0
  456. package/dist/core/capabilities/delta/tree.js.map +1 -0
  457. package/dist/core/capabilities/delta/uncovered.js +222 -0
  458. package/dist/core/capabilities/delta/uncovered.js.map +1 -0
  459. package/dist/core/capabilities/findings.js +342 -0
  460. package/dist/core/capabilities/findings.js.map +1 -0
  461. package/dist/core/capabilities/realizes/findings.js +181 -0
  462. package/dist/core/capabilities/realizes/findings.js.map +1 -0
  463. package/dist/core/capabilities/realizes/join.js +143 -0
  464. package/dist/core/capabilities/realizes/join.js.map +1 -0
  465. package/dist/core/capabilities/rollup.js +199 -0
  466. package/dist/core/capabilities/rollup.js.map +1 -0
  467. package/dist/core/capabilities/tree.js +126 -0
  468. package/dist/core/capabilities/tree.js.map +1 -0
  469. package/dist/core/capabilities/usecase-join.js +277 -0
  470. package/dist/core/capabilities/usecase-join.js.map +1 -0
  471. package/dist/core/coherence/authoring/scaffold.js +177 -0
  472. package/dist/core/coherence/authoring/scaffold.js.map +1 -0
  473. package/dist/core/coherence/authoring/sentinels.js +74 -0
  474. package/dist/core/coherence/authoring/sentinels.js.map +1 -0
  475. package/dist/core/coherence/coherence.js +287 -0
  476. package/dist/core/coherence/coherence.js.map +1 -0
  477. package/dist/core/coherence/declared.js +269 -0
  478. package/dist/core/coherence/declared.js.map +1 -0
  479. package/dist/core/coherence/events/declared.js +206 -0
  480. package/dist/core/coherence/events/declared.js.map +1 -0
  481. package/dist/core/coherence/events/events.js +204 -0
  482. package/dist/core/coherence/events/events.js.map +1 -0
  483. package/dist/core/coherence/events/grades.js +166 -0
  484. package/dist/core/coherence/events/grades.js.map +1 -0
  485. package/dist/core/coherence/events/lookups.js +122 -0
  486. package/dist/core/coherence/events/lookups.js.map +1 -0
  487. package/dist/core/coherence/events/merged.js +40 -0
  488. package/dist/core/coherence/events/merged.js.map +1 -0
  489. package/dist/core/coherence/living.js +198 -0
  490. package/dist/core/coherence/living.js.map +1 -0
  491. package/dist/core/coherence/lookups.js +155 -0
  492. package/dist/core/coherence/lookups.js.map +1 -0
  493. package/dist/core/coherence/pending.js +39 -0
  494. package/dist/core/coherence/pending.js.map +1 -0
  495. package/dist/core/conflict-markers.js +60 -0
  496. package/dist/core/conflict-markers.js.map +1 -0
  497. package/dist/core/delta/claims.js +73 -0
  498. package/dist/core/delta/claims.js.map +1 -0
  499. package/dist/core/delta/delta.js +296 -0
  500. package/dist/core/delta/delta.js.map +1 -0
  501. package/dist/core/delta/document.js +177 -0
  502. package/dist/core/delta/document.js.map +1 -0
  503. package/dist/core/delta/scope.js +48 -0
  504. package/dist/core/delta/scope.js.map +1 -0
  505. package/dist/core/delta/select.js +237 -0
  506. package/dist/core/delta/select.js.map +1 -0
  507. package/dist/core/dependencies/dependencies.js +141 -0
  508. package/dist/core/dependencies/dependencies.js.map +1 -0
  509. package/dist/core/dependencies/facts.js +165 -0
  510. package/dist/core/dependencies/facts.js.map +1 -0
  511. package/dist/core/dependencies/fanin.js +88 -0
  512. package/dist/core/dependencies/fanin.js.map +1 -0
  513. package/dist/core/dependencies/graph.js +106 -0
  514. package/dist/core/dependencies/graph.js.map +1 -0
  515. package/dist/core/deployment/delta.js +188 -0
  516. package/dist/core/deployment/delta.js.map +1 -0
  517. package/dist/core/deployment/objects.js +145 -0
  518. package/dist/core/deployment/objects.js.map +1 -0
  519. package/dist/core/diff/base-git.js +148 -0
  520. package/dist/core/diff/base-git.js.map +1 -0
  521. package/dist/core/diff/base-state.js +209 -0
  522. package/dist/core/diff/base-state.js.map +1 -0
  523. package/dist/core/diff/current-state.js +96 -0
  524. package/dist/core/diff/current-state.js.map +1 -0
  525. package/dist/core/diff/scope/changed-paths.js +188 -0
  526. package/dist/core/diff/scope/changed-paths.js.map +1 -0
  527. package/dist/core/diff/semantic.js +243 -0
  528. package/dist/core/diff/semantic.js.map +1 -0
  529. package/dist/core/diff/victims.js +247 -0
  530. package/dist/core/diff/victims.js.map +1 -0
  531. package/dist/core/docs.js +7 -64
  532. package/dist/core/docs.js.map +1 -1
  533. package/dist/core/doctor/agents.js +222 -0
  534. package/dist/core/doctor/agents.js.map +1 -0
  535. package/dist/core/doctor/config.js +135 -0
  536. package/dist/core/doctor/config.js.map +1 -0
  537. package/dist/core/doctor/doctor.js +275 -0
  538. package/dist/core/doctor/doctor.js.map +1 -0
  539. package/dist/core/doctor/report.js +13 -0
  540. package/dist/core/doctor/report.js.map +1 -0
  541. package/dist/core/doctor/residue.js +110 -0
  542. package/dist/core/doctor/residue.js.map +1 -0
  543. package/dist/core/document/apply.js +77 -0
  544. package/dist/core/document/apply.js.map +1 -0
  545. package/dist/core/{frontmatter.js → document/frontmatter.js} +48 -2
  546. package/dist/core/document/frontmatter.js.map +1 -0
  547. package/dist/core/document/grammar/directives.js +143 -0
  548. package/dist/core/document/grammar/directives.js.map +1 -0
  549. package/dist/core/document/parse.js +263 -0
  550. package/dist/core/document/parse.js.map +1 -0
  551. package/dist/core/document/scenarios.js +221 -0
  552. package/dist/core/document/scenarios.js.map +1 -0
  553. package/dist/core/document/spec.js +241 -0
  554. package/dist/core/document/spec.js.map +1 -0
  555. package/dist/core/{config.js → envelope/config.js} +79 -18
  556. package/dist/core/envelope/config.js.map +1 -0
  557. package/dist/core/envelope/json.js +175 -0
  558. package/dist/core/envelope/json.js.map +1 -0
  559. package/dist/core/{version.js → envelope/version.js} +3 -3
  560. package/dist/core/envelope/version.js.map +1 -0
  561. package/dist/core/explain/families.js +175 -0
  562. package/dist/core/explain/families.js.map +1 -0
  563. package/dist/core/explain/fix-tables.js +178 -0
  564. package/dist/core/explain/fix-tables.js.map +1 -0
  565. package/dist/core/explain/lookup.js +181 -0
  566. package/dist/core/explain/lookup.js.map +1 -0
  567. package/dist/core/explain/refusals.js +49 -0
  568. package/dist/core/explain/refusals.js.map +1 -0
  569. package/dist/core/explain/terms.js +144 -0
  570. package/dist/core/explain/terms.js.map +1 -0
  571. package/dist/core/explore/describe.js +105 -0
  572. package/dist/core/explore/describe.js.map +1 -0
  573. package/dist/core/{explore.js → explore/explore.js} +50 -101
  574. package/dist/core/explore/explore.js.map +1 -0
  575. package/dist/core/fleet-context.js +120 -78
  576. package/dist/core/fleet-context.js.map +1 -1
  577. package/dist/core/gate/checks.js +201 -0
  578. package/dist/core/gate/checks.js.map +1 -0
  579. package/dist/core/gate/partners.js +205 -0
  580. package/dist/core/gate/partners.js.map +1 -0
  581. package/dist/core/gate/report.js +47 -0
  582. package/dist/core/gate/report.js.map +1 -0
  583. package/dist/core/gate/verification.js +113 -0
  584. package/dist/core/gate/verification.js.map +1 -0
  585. package/dist/core/gherkin/digest.js +60 -0
  586. package/dist/core/gherkin/digest.js.map +1 -0
  587. package/dist/core/gherkin/emit.js +177 -0
  588. package/dist/core/gherkin/emit.js.map +1 -0
  589. package/dist/core/gherkin/read.js +76 -0
  590. package/dist/core/gherkin/read.js.map +1 -0
  591. package/dist/core/gherkin/stale.js +234 -0
  592. package/dist/core/gherkin/stale.js.map +1 -0
  593. package/dist/core/gherkin/stamp.js +77 -0
  594. package/dist/core/gherkin/stamp.js.map +1 -0
  595. package/dist/core/gherkin/steps/catalogue.js +154 -0
  596. package/dist/core/gherkin/steps/catalogue.js.map +1 -0
  597. package/dist/core/gherkin/steps/inventory.js +98 -0
  598. package/dist/core/gherkin/steps/inventory.js.map +1 -0
  599. package/dist/core/gherkin/steps/phrase.js +72 -0
  600. package/dist/core/gherkin/steps/phrase.js.map +1 -0
  601. package/dist/core/glossary/delta.js +106 -0
  602. package/dist/core/glossary/delta.js.map +1 -0
  603. package/dist/core/glossary/tree.js +86 -0
  604. package/dist/core/glossary/tree.js.map +1 -0
  605. package/dist/core/kernel/concurrency.js.map +1 -0
  606. package/dist/core/{document-bytes.js → kernel/document-bytes.js} +1 -1
  607. package/dist/core/kernel/document-bytes.js.map +1 -0
  608. package/dist/core/kernel/fences.js +42 -0
  609. package/dist/core/kernel/fences.js.map +1 -0
  610. package/dist/core/kernel/ids/capability.js +72 -0
  611. package/dist/core/kernel/ids/capability.js.map +1 -0
  612. package/dist/core/kernel/ids/dirs.js +33 -0
  613. package/dist/core/kernel/ids/dirs.js.map +1 -0
  614. package/dist/core/kernel/ids/feature.js +75 -0
  615. package/dist/core/kernel/ids/feature.js.map +1 -0
  616. package/dist/core/kernel/ids/service.js +156 -0
  617. package/dist/core/kernel/ids/service.js.map +1 -0
  618. package/dist/core/kernel/ids/subsystem.js +63 -0
  619. package/dist/core/kernel/ids/subsystem.js.map +1 -0
  620. package/dist/core/{path-safety.js → kernel/path-safety.js} +18 -4
  621. package/dist/core/kernel/path-safety.js.map +1 -0
  622. package/dist/core/kernel/records.js.map +1 -0
  623. package/dist/core/links/backlinks.js +68 -0
  624. package/dist/core/links/backlinks.js.map +1 -0
  625. package/dist/core/links/case.js +74 -0
  626. package/dist/core/links/case.js.map +1 -0
  627. package/dist/core/links/corpus.js +104 -0
  628. package/dist/core/links/corpus.js.map +1 -0
  629. package/dist/core/links/findings.js +110 -0
  630. package/dist/core/links/findings.js.map +1 -0
  631. package/dist/core/links/parse.js +236 -0
  632. package/dist/core/links/parse.js.map +1 -0
  633. package/dist/core/mcp/argv.js +111 -0
  634. package/dist/core/mcp/argv.js.map +1 -0
  635. package/dist/core/mcp/author-tools.js +72 -0
  636. package/dist/core/mcp/author-tools.js.map +1 -0
  637. package/dist/core/mcp/framing.js +46 -0
  638. package/dist/core/mcp/framing.js.map +1 -0
  639. package/dist/core/mcp/protocol.js +280 -0
  640. package/dist/core/mcp/protocol.js.map +1 -0
  641. package/dist/core/mcp/tools.js +314 -0
  642. package/dist/core/mcp/tools.js.map +1 -0
  643. package/dist/core/obligations/obligations.js +106 -0
  644. package/dist/core/obligations/obligations.js.map +1 -0
  645. package/dist/core/openapi/baseline/gate.js +166 -0
  646. package/dist/core/openapi/baseline/gate.js.map +1 -0
  647. package/dist/core/openapi/baseline/plan.js +112 -0
  648. package/dist/core/openapi/baseline/plan.js.map +1 -0
  649. package/dist/core/openapi/baseline/record.js +175 -0
  650. package/dist/core/openapi/baseline/record.js.map +1 -0
  651. package/dist/core/openapi/depth.js +122 -0
  652. package/dist/core/openapi/depth.js.map +1 -0
  653. package/dist/core/openapi/digest.js +189 -0
  654. package/dist/core/openapi/digest.js.map +1 -0
  655. package/dist/core/{openapi.js → openapi/doc.js} +44 -106
  656. package/dist/core/openapi/doc.js.map +1 -0
  657. package/dist/core/openapi/merge/components.js +234 -0
  658. package/dist/core/openapi/merge/components.js.map +1 -0
  659. package/dist/core/openapi/merge/error.js +26 -0
  660. package/dist/core/openapi/merge/error.js.map +1 -0
  661. package/dist/core/openapi/merge/markers.js +208 -0
  662. package/dist/core/openapi/merge/markers.js.map +1 -0
  663. package/dist/core/openapi/merge/merge.js +256 -0
  664. package/dist/core/openapi/merge/merge.js.map +1 -0
  665. package/dist/core/openapi/merge/pin.js +128 -0
  666. package/dist/core/openapi/merge/pin.js.map +1 -0
  667. package/dist/core/openspec/decide/capabilities.js +244 -0
  668. package/dist/core/openspec/decide/capabilities.js.map +1 -0
  669. package/dist/core/openspec/decide/dispositions.js +63 -0
  670. package/dist/core/openspec/decide/dispositions.js.map +1 -0
  671. package/dist/core/openspec/decide/renames.js +179 -0
  672. package/dist/core/openspec/decide/renames.js.map +1 -0
  673. package/dist/core/openspec/decide/verdict.js +84 -0
  674. package/dist/core/openspec/decide/verdict.js.map +1 -0
  675. package/dist/core/openspec/inventory.js +221 -0
  676. package/dist/core/openspec/inventory.js.map +1 -0
  677. package/dist/core/openspec/model/mapping.js +76 -0
  678. package/dist/core/openspec/model/mapping.js.map +1 -0
  679. package/dist/core/openspec/model/model.js +65 -0
  680. package/dist/core/openspec/model/model.js.map +1 -0
  681. package/dist/core/openspec/scan/changes.js +235 -0
  682. package/dist/core/openspec/scan/changes.js.map +1 -0
  683. package/dist/core/openspec/scan/config.js +200 -0
  684. package/dist/core/openspec/scan/config.js.map +1 -0
  685. package/dist/core/openspec/scan/shape.js +260 -0
  686. package/dist/core/openspec/scan/shape.js.map +1 -0
  687. package/dist/core/openspec/scan/walk.js +133 -0
  688. package/dist/core/openspec/scan/walk.js.map +1 -0
  689. package/dist/core/openspec/scan/workspace.js +71 -0
  690. package/dist/core/openspec/scan/workspace.js.map +1 -0
  691. package/dist/core/owners/codeowners.js +141 -0
  692. package/dist/core/owners/codeowners.js.map +1 -0
  693. package/dist/core/pack/features.js +120 -0
  694. package/dist/core/pack/features.js.map +1 -0
  695. package/dist/core/pack/joins.js +112 -0
  696. package/dist/core/pack/joins.js.map +1 -0
  697. package/dist/core/pack/living.js +137 -0
  698. package/dist/core/pack/living.js.map +1 -0
  699. package/dist/core/pack/pack.js +76 -0
  700. package/dist/core/pack/pack.js.map +1 -0
  701. package/dist/core/permissions/permissions.js +87 -0
  702. package/dist/core/permissions/permissions.js.map +1 -0
  703. package/dist/core/projection/api.js +84 -0
  704. package/dist/core/projection/api.js.map +1 -0
  705. package/dist/core/projection/arch-slice.js +63 -0
  706. package/dist/core/projection/arch-slice.js.map +1 -0
  707. package/dist/core/projection/events.js +34 -0
  708. package/dist/core/projection/events.js.map +1 -0
  709. package/dist/core/provenance/findings.js +208 -0
  710. package/dist/core/provenance/findings.js.map +1 -0
  711. package/dist/core/provenance/git.js +225 -0
  712. package/dist/core/provenance/git.js.map +1 -0
  713. package/dist/core/provenance/gitq/moves.js +182 -0
  714. package/dist/core/provenance/gitq/moves.js.map +1 -0
  715. package/dist/core/provenance/gitq/vouched-ancestor.js +179 -0
  716. package/dist/core/provenance/gitq/vouched-ancestor.js.map +1 -0
  717. package/dist/core/provenance/sample/scope.js +238 -0
  718. package/dist/core/provenance/sample/scope.js.map +1 -0
  719. package/dist/core/provenance/sample/sections.js +61 -0
  720. package/dist/core/provenance/sample/sections.js.map +1 -0
  721. package/dist/core/provenance/sources.js +263 -0
  722. package/dist/core/provenance/sources.js.map +1 -0
  723. package/dist/core/provenance/stamp.js +232 -0
  724. package/dist/core/provenance/stamp.js.map +1 -0
  725. package/dist/core/provenance/walk.js +157 -0
  726. package/dist/core/provenance/walk.js.map +1 -0
  727. package/dist/core/repo/authored/paths.js +210 -0
  728. package/dist/core/repo/authored/paths.js.map +1 -0
  729. package/dist/core/repo/entries.js +126 -0
  730. package/dist/core/repo/entries.js.map +1 -0
  731. package/dist/core/repo/paths.js +277 -0
  732. package/dist/core/repo/paths.js.map +1 -0
  733. package/dist/core/repo/repo.js +248 -0
  734. package/dist/core/repo/repo.js.map +1 -0
  735. package/dist/core/repo/service-target.js +153 -0
  736. package/dist/core/repo/service-target.js.map +1 -0
  737. package/dist/core/repo/state.js +58 -0
  738. package/dist/core/repo/state.js.map +1 -0
  739. package/dist/core/repo/tree/find.js +52 -0
  740. package/dist/core/repo/tree/find.js.map +1 -0
  741. package/dist/core/repo/tree/fs.js +64 -0
  742. package/dist/core/repo/tree/fs.js.map +1 -0
  743. package/dist/core/repo/tree/marker.js +61 -0
  744. package/dist/core/repo/tree/marker.js.map +1 -0
  745. package/dist/core/repo/tree/views.js +172 -0
  746. package/dist/core/repo/tree/views.js.map +1 -0
  747. package/dist/core/repo/tree/walk.js +234 -0
  748. package/dist/core/repo/tree/walk.js.map +1 -0
  749. package/dist/core/results.js +99 -2
  750. package/dist/core/results.js.map +1 -1
  751. package/dist/core/scaffold/landscape.js +131 -0
  752. package/dist/core/scaffold/landscape.js.map +1 -0
  753. package/dist/core/scaffold/readme.js +84 -0
  754. package/dist/core/scaffold/readme.js.map +1 -0
  755. package/dist/core/staging/commit.js +241 -0
  756. package/dist/core/staging/commit.js.map +1 -0
  757. package/dist/core/staging/interrupted.js +96 -0
  758. package/dist/core/staging/interrupted.js.map +1 -0
  759. package/dist/core/staging/lock.js +206 -0
  760. package/dist/core/staging/lock.js.map +1 -0
  761. package/dist/core/staging/recovery/finding.js +35 -0
  762. package/dist/core/staging/recovery/finding.js.map +1 -0
  763. package/dist/core/staging/recovery/intent.js +98 -0
  764. package/dist/core/staging/recovery/intent.js.map +1 -0
  765. package/dist/core/staging/recovery/recover.js +126 -0
  766. package/dist/core/staging/recovery/recover.js.map +1 -0
  767. package/dist/core/staging/recovery/residue.js +62 -0
  768. package/dist/core/staging/recovery/residue.js.map +1 -0
  769. package/dist/core/staging/snapshot.js +202 -0
  770. package/dist/core/staging/snapshot.js.map +1 -0
  771. package/dist/core/staging/txn/forward.js +171 -0
  772. package/dist/core/staging/txn/forward.js.map +1 -0
  773. package/dist/core/staging/txn/journal.js +139 -0
  774. package/dist/core/staging/txn/journal.js.map +1 -0
  775. package/dist/core/staging/txn/transaction.js +75 -0
  776. package/dist/core/staging/txn/transaction.js.map +1 -0
  777. package/dist/core/staging/writes.js +113 -0
  778. package/dist/core/staging/writes.js.map +1 -0
  779. package/dist/core/status/actions/execution.js +49 -0
  780. package/dist/core/status/actions/execution.js.map +1 -0
  781. package/dist/core/status/contracts.js +102 -0
  782. package/dist/core/status/contracts.js.map +1 -0
  783. package/dist/core/status/feature/artifacts.js +196 -0
  784. package/dist/core/status/feature/artifacts.js.map +1 -0
  785. package/dist/core/status/feature/feature.js +207 -0
  786. package/dist/core/status/feature/feature.js.map +1 -0
  787. package/dist/core/status/feature/next.js +150 -0
  788. package/dist/core/status/feature/next.js.map +1 -0
  789. package/dist/core/status/feature/state.js +21 -0
  790. package/dist/core/status/feature/state.js.map +1 -0
  791. package/dist/core/status/fleet/fleet.js +197 -0
  792. package/dist/core/status/fleet/fleet.js.map +1 -0
  793. package/dist/core/status/fleet/next.js +207 -0
  794. package/dist/core/status/fleet/next.js.map +1 -0
  795. package/dist/core/status/interrupted.js +97 -0
  796. package/dist/core/status/interrupted.js.map +1 -0
  797. package/dist/core/status/report.js +31 -0
  798. package/dist/core/status/report.js.map +1 -0
  799. package/dist/core/status/scan.js +41 -0
  800. package/dist/core/status/scan.js.map +1 -0
  801. package/dist/core/status/verification.js +201 -0
  802. package/dist/core/status/verification.js.map +1 -0
  803. package/dist/core/usecases/capability.js +169 -0
  804. package/dist/core/usecases/capability.js.map +1 -0
  805. package/dist/core/usecases/delta/claims.js +116 -0
  806. package/dist/core/usecases/delta/claims.js.map +1 -0
  807. package/dist/core/usecases/delta/flows.js +103 -0
  808. package/dist/core/usecases/delta/flows.js.map +1 -0
  809. package/dist/core/usecases/delta/overlay.js +72 -0
  810. package/dist/core/usecases/delta/overlay.js.map +1 -0
  811. package/dist/core/usecases/fleet.js +137 -0
  812. package/dist/core/usecases/fleet.js.map +1 -0
  813. package/dist/core/usecases/operations.js +111 -0
  814. package/dist/core/usecases/operations.js.map +1 -0
  815. package/dist/core/usecases/place.js +44 -0
  816. package/dist/core/usecases/place.js.map +1 -0
  817. package/dist/core/usecases/touch.js +101 -0
  818. package/dist/core/usecases/touch.js.map +1 -0
  819. package/dist/core/verify/answers.js +173 -0
  820. package/dist/core/verify/answers.js.map +1 -0
  821. package/dist/core/verify/build.js +150 -0
  822. package/dist/core/verify/build.js.map +1 -0
  823. package/dist/core/verify/checklist.js +201 -0
  824. package/dist/core/verify/checklist.js.map +1 -0
  825. package/dist/core/verify/claims/identity.js +61 -0
  826. package/dist/core/verify/claims/identity.js.map +1 -0
  827. package/dist/core/verify/cross/diff.js +97 -0
  828. package/dist/core/verify/cross/diff.js.map +1 -0
  829. package/dist/core/verify/evidence/contract.js +169 -0
  830. package/dist/core/verify/evidence/contract.js.map +1 -0
  831. package/dist/core/verify/file.js +257 -0
  832. package/dist/core/verify/file.js.map +1 -0
  833. package/dist/core/verify/pins/lint.js +157 -0
  834. package/dist/core/verify/pins/lint.js.map +1 -0
  835. package/dist/core/verify/pins/pin.js +95 -0
  836. package/dist/core/verify/pins/pin.js.map +1 -0
  837. package/dist/core/verify/record.js +142 -0
  838. package/dist/core/verify/record.js.map +1 -0
  839. package/dist/core/verify/store/commit.js +89 -0
  840. package/dist/core/verify/store/commit.js.map +1 -0
  841. package/dist/core/verify/store/render.js +57 -0
  842. package/dist/core/verify/store/render.js.map +1 -0
  843. package/dist/core/vocabulary/health.js +91 -0
  844. package/dist/core/vocabulary/health.js.map +1 -0
  845. package/dist/core/vocabulary/issue.js +58 -0
  846. package/dist/core/vocabulary/issue.js.map +1 -0
  847. package/dist/core/vocabulary/maturity.js +145 -0
  848. package/dist/core/vocabulary/maturity.js.map +1 -0
  849. package/dist/core/{report.js → vocabulary/report.js} +30 -2
  850. package/dist/core/vocabulary/report.js.map +1 -0
  851. package/dist/core/vocabulary/steps.js +266 -0
  852. package/dist/core/vocabulary/steps.js.map +1 -0
  853. package/dist/core/workspace/discover.js +239 -0
  854. package/dist/core/workspace/discover.js.map +1 -0
  855. package/dist/core/workspace/render.js +52 -0
  856. package/dist/core/workspace/render.js.map +1 -0
  857. package/examples/README.md +189 -0
  858. package/examples/docs/architecture/adrs/0001-transactional-outbox.md +33 -0
  859. package/examples/docs/architecture/capabilities.yaml +31 -0
  860. package/examples/docs/architecture/landscape.likec4 +280 -0
  861. package/examples/docs/architecture/obligations.yaml +23 -0
  862. package/examples/docs/architecture/permissions.yaml +50 -0
  863. package/examples/docs/architecture/subsystems.likec4 +11 -0
  864. package/examples/docs/architecture/usecases/order-notification.likec4 +65 -0
  865. package/examples/docs/capabilities/checkout/spec.md +55 -0
  866. package/examples/docs/capabilities/identity/tokens/spec.md +42 -0
  867. package/examples/docs/capabilities/order-notifications/spec.md +43 -0
  868. package/examples/docs/features/FEAT-101-payment-splitting/adrs/0001-dedicated-split-service.md +18 -0
  869. package/examples/docs/features/FEAT-101-payment-splitting/delta.likec4 +94 -0
  870. package/examples/docs/features/FEAT-101-payment-splitting/intent.md +44 -0
  871. package/examples/docs/features/FEAT-101-payment-splitting/specs/checkout-web/spec.md +21 -0
  872. package/examples/docs/features/FEAT-101-payment-splitting/specs/payment-service/asyncapi.yaml +129 -0
  873. package/examples/docs/features/FEAT-101-payment-splitting/specs/payment-service/spec.md +36 -0
  874. package/examples/docs/features/FEAT-101-payment-splitting/specs/payment-split-service/arch.spec.md +40 -0
  875. package/examples/docs/features/FEAT-101-payment-splitting/specs/payment-split-service/openapi.yaml +116 -0
  876. package/examples/docs/features/FEAT-101-payment-splitting/specs/payment-split-service/spec.md +55 -0
  877. package/examples/docs/features/FEAT-112-retire-order-v1/intent.md +35 -0
  878. package/examples/docs/features/FEAT-112-retire-order-v1/specs/order-service/openapi.yaml +28 -0
  879. package/examples/docs/features/FEAT-112-retire-order-v1/specs/order-service/spec.md +17 -0
  880. package/examples/docs/features/archive/FEAT-088-refunds/.loam-before/files/architecture/landscape.likec4 +253 -0
  881. package/examples/docs/features/archive/FEAT-088-refunds/.loam-before/files/services/order-service/spec.md +121 -0
  882. package/examples/docs/features/archive/FEAT-088-refunds/.loam-before/files/services/payment-service/openapi.yaml +111 -0
  883. package/examples/docs/features/archive/FEAT-088-refunds/.loam-before/files/services/payment-service/spec.md +58 -0
  884. package/examples/docs/features/archive/FEAT-088-refunds/.loam-before/manifest.json +32 -0
  885. package/examples/docs/features/archive/FEAT-088-refunds/adrs/0001-refunds-stay-in-payment-service.md +26 -0
  886. package/examples/docs/features/archive/FEAT-088-refunds/delta.likec4 +28 -0
  887. package/examples/docs/features/archive/FEAT-088-refunds/intent.md +26 -0
  888. package/examples/docs/features/archive/FEAT-088-refunds/specs/order-service/spec.md +37 -0
  889. package/examples/docs/features/archive/FEAT-088-refunds/specs/payment-service/openapi.yaml +70 -0
  890. package/examples/docs/features/archive/FEAT-088-refunds/specs/payment-service/spec.md +23 -0
  891. package/examples/docs/features/archive/FEAT-088-refunds/verification.yaml +76 -0
  892. package/examples/docs/features/archive/FEAT-120-refund-notification/.loam-before/files/architecture/landscape.likec4 +275 -0
  893. package/examples/docs/features/archive/FEAT-120-refund-notification/.loam-before/files/services/payment-service/asyncapi.yaml +96 -0
  894. package/examples/docs/features/archive/FEAT-120-refund-notification/.loam-before/files/services/payment-service/spec.md +82 -0
  895. package/examples/docs/features/archive/FEAT-120-refund-notification/.loam-before/files/services/platform/notification-service/asyncapi.yaml +164 -0
  896. package/examples/docs/features/archive/FEAT-120-refund-notification/.loam-before/files/services/platform/notification-service/spec.md +91 -0
  897. package/examples/docs/features/archive/FEAT-120-refund-notification/.loam-before/manifest.json +46 -0
  898. package/examples/docs/features/archive/FEAT-120-refund-notification/delta.likec4 +36 -0
  899. package/examples/docs/features/archive/FEAT-120-refund-notification/intent.md +22 -0
  900. package/examples/docs/features/archive/FEAT-120-refund-notification/scenario-report.json +10 -0
  901. package/examples/docs/features/archive/FEAT-120-refund-notification/specs/notification-service/asyncapi.yaml +208 -0
  902. package/examples/docs/features/archive/FEAT-120-refund-notification/specs/notification-service/spec.md +24 -0
  903. package/examples/docs/features/archive/FEAT-120-refund-notification/specs/payment-service/asyncapi.yaml +137 -0
  904. package/examples/docs/features/archive/FEAT-120-refund-notification/specs/payment-service/spec.md +31 -0
  905. package/examples/docs/features/archive/FEAT-120-refund-notification/verification.yaml +84 -0
  906. package/examples/docs/glossary/order.md +15 -0
  907. package/examples/docs/glossary/payments/authorization.md +14 -0
  908. package/examples/docs/likec4.config.json +9 -0
  909. package/examples/docs/loam.json +3 -0
  910. package/examples/docs/services/checkout-web/model.likec4 +109 -0
  911. package/examples/docs/services/checkout-web/spec.md +91 -0
  912. package/examples/docs/services/checkout-web/ui/pages/checkout.page.yaml +40 -0
  913. package/examples/docs/services/checkout-web/ui/pages/order-status.page.yaml +24 -0
  914. package/examples/docs/services/checkout-web/ui/pages/split-payment.page.yaml +26 -0
  915. package/examples/docs/services/order-service/adrs/0001-orchestrated-order-lifecycle.md +52 -0
  916. package/examples/docs/services/order-service/arch.spec.md +127 -0
  917. package/examples/docs/services/order-service/asyncapi.yaml +108 -0
  918. package/examples/docs/services/order-service/health.yaml +57 -0
  919. package/examples/docs/services/order-service/model.likec4 +138 -0
  920. package/examples/docs/services/order-service/openapi.yaml +257 -0
  921. package/examples/docs/services/order-service/runbook.md +62 -0
  922. package/examples/docs/services/order-service/spec.md +134 -0
  923. package/examples/docs/services/payment-service/adrs/0001-payments-outbox.md +18 -0
  924. package/examples/docs/services/payment-service/adrs/0002-idempotency-keys-on-authorization.md +27 -0
  925. package/examples/docs/services/payment-service/arch.spec.md +73 -0
  926. package/examples/docs/services/payment-service/asyncapi.yaml +130 -0
  927. package/examples/docs/services/payment-service/health.yaml +39 -0
  928. package/examples/docs/services/payment-service/model.likec4 +67 -0
  929. package/examples/docs/services/payment-service/openapi.yaml +151 -0
  930. package/examples/docs/services/payment-service/runbook.md +37 -0
  931. package/examples/docs/services/payment-service/spec.md +88 -0
  932. package/examples/docs/services/platform/identity-service/adrs/0001-token-introspection-over-local-validation.md +60 -0
  933. package/examples/docs/services/platform/identity-service/arch.spec.md +117 -0
  934. package/examples/docs/services/platform/identity-service/health.yaml +70 -0
  935. package/examples/docs/services/platform/identity-service/model.likec4 +83 -0
  936. package/examples/docs/services/platform/identity-service/openapi.yaml +197 -0
  937. package/examples/docs/services/platform/identity-service/runbook.md +95 -0
  938. package/examples/docs/services/platform/identity-service/spec.md +119 -0
  939. package/examples/docs/services/platform/notification-service/asyncapi.yaml +199 -0
  940. package/examples/docs/services/platform/notification-service/health.yaml +35 -0
  941. package/examples/docs/services/platform/notification-service/model.likec4 +118 -0
  942. package/examples/docs/services/platform/notification-service/runbook.md +48 -0
  943. package/examples/docs/services/platform/notification-service/spec.md +112 -0
  944. package/examples/docs/services/platform/subsystem.yaml +2 -0
  945. package/examples/fleet.yaml +57 -0
  946. package/package.json +19 -6
  947. package/dist/commands/adopt.js +0 -240
  948. package/dist/commands/adopt.js.map +0 -1
  949. package/dist/commands/archive.js +0 -1313
  950. package/dist/commands/archive.js.map +0 -1
  951. package/dist/commands/delta.js +0 -388
  952. package/dist/commands/delta.js.map +0 -1
  953. package/dist/commands/docs-repo-gate.js.map +0 -1
  954. package/dist/commands/format.js +0 -17
  955. package/dist/commands/format.js.map +0 -1
  956. package/dist/commands/gherkin.js +0 -309
  957. package/dist/commands/gherkin.js.map +0 -1
  958. package/dist/commands/init.js.map +0 -1
  959. package/dist/commands/list.js +0 -295
  960. package/dist/commands/list.js.map +0 -1
  961. package/dist/commands/migrate-openspec.js +0 -950
  962. package/dist/commands/migrate-openspec.js.map +0 -1
  963. package/dist/commands/new.js +0 -413
  964. package/dist/commands/new.js.map +0 -1
  965. package/dist/commands/rebase.js +0 -356
  966. package/dist/commands/rebase.js.map +0 -1
  967. package/dist/commands/show.js.map +0 -1
  968. package/dist/commands/status.js +0 -262
  969. package/dist/commands/status.js.map +0 -1
  970. package/dist/commands/unarchive.js.map +0 -1
  971. package/dist/commands/validate.js +0 -1773
  972. package/dist/commands/validate.js.map +0 -1
  973. package/dist/commands/verify.js +0 -775
  974. package/dist/commands/verify.js.map +0 -1
  975. package/dist/commands/vouch.js +0 -421
  976. package/dist/commands/vouch.js.map +0 -1
  977. package/dist/core/agent.js +0 -2173
  978. package/dist/core/agent.js.map +0 -1
  979. package/dist/core/agents-stamp.js.map +0 -1
  980. package/dist/core/arch.js +0 -130
  981. package/dist/core/arch.js.map +0 -1
  982. package/dist/core/asyncapi.js.map +0 -1
  983. package/dist/core/brief.js +0 -755
  984. package/dist/core/brief.js.map +0 -1
  985. package/dist/core/coherence.js +0 -577
  986. package/dist/core/coherence.js.map +0 -1
  987. package/dist/core/concurrency.js.map +0 -1
  988. package/dist/core/config.js.map +0 -1
  989. package/dist/core/delta.js +0 -476
  990. package/dist/core/delta.js.map +0 -1
  991. package/dist/core/dependencies.js +0 -356
  992. package/dist/core/dependencies.js.map +0 -1
  993. package/dist/core/doctor.js +0 -596
  994. package/dist/core/doctor.js.map +0 -1
  995. package/dist/core/document-bytes.js.map +0 -1
  996. package/dist/core/explore.js.map +0 -1
  997. package/dist/core/frontmatter.js.map +0 -1
  998. package/dist/core/gherkin.js +0 -463
  999. package/dist/core/gherkin.js.map +0 -1
  1000. package/dist/core/health.js +0 -67
  1001. package/dist/core/health.js.map +0 -1
  1002. package/dist/core/ids.js +0 -122
  1003. package/dist/core/ids.js.map +0 -1
  1004. package/dist/core/issue.js +0 -9
  1005. package/dist/core/issue.js.map +0 -1
  1006. package/dist/core/json.js +0 -74
  1007. package/dist/core/json.js.map +0 -1
  1008. package/dist/core/likec4.js +0 -489
  1009. package/dist/core/likec4.js.map +0 -1
  1010. package/dist/core/maturity.js +0 -66
  1011. package/dist/core/maturity.js.map +0 -1
  1012. package/dist/core/openapi-merge.js +0 -552
  1013. package/dist/core/openapi-merge.js.map +0 -1
  1014. package/dist/core/openapi.js.map +0 -1
  1015. package/dist/core/openspec-inventory.js +0 -1440
  1016. package/dist/core/openspec-inventory.js.map +0 -1
  1017. package/dist/core/path-safety.js.map +0 -1
  1018. package/dist/core/provenance.js +0 -787
  1019. package/dist/core/provenance.js.map +0 -1
  1020. package/dist/core/records.js.map +0 -1
  1021. package/dist/core/repo.js +0 -438
  1022. package/dist/core/repo.js.map +0 -1
  1023. package/dist/core/report.js.map +0 -1
  1024. package/dist/core/spec.js +0 -505
  1025. package/dist/core/spec.js.map +0 -1
  1026. package/dist/core/staging.js +0 -890
  1027. package/dist/core/staging.js.map +0 -1
  1028. package/dist/core/status.js +0 -1132
  1029. package/dist/core/status.js.map +0 -1
  1030. package/dist/core/steps.js +0 -72
  1031. package/dist/core/steps.js.map +0 -1
  1032. package/dist/core/verify.js +0 -807
  1033. package/dist/core/verify.js.map +0 -1
  1034. package/dist/core/version.js.map +0 -1
  1035. /package/dist/core/{concurrency.js → kernel/concurrency.js} +0 -0
  1036. /package/dist/core/{records.js → kernel/records.js} +0 -0
@@ -0,0 +1,270 @@
1
+ /**
2
+ * The architectural obligation axis, graded against the fleet it is about.
3
+ *
4
+ * `core/obligations/obligations.ts` states what the axis IS and why it has this
5
+ * shape. This module is the four questions asked of a fleet that has one, and
6
+ * the order they are asked in — the same division `checks/fleet-shape.ts` keeps
7
+ * for the authorization and capability vocabularies, which this sits beside on
8
+ * the `landscape` target for their reason: an obligation crosses services by
9
+ * construction, so no service target can answer for it.
10
+ *
11
+ * THE FOUR ARE TWO PAIRS, and each pair is one join read in both directions.
12
+ * A tag nothing declares is an ERROR (`obligation.unknown`) and a declaration
13
+ * nothing tags is a WARNING (`obligation.unapplied`) — exactly the asymmetry
14
+ * `permissions.unknown`/`permissions.unenforced` already carry, and for the
15
+ * same reason: a typo in a tag reads like a rule, while a word nobody has
16
+ * adopted yet is an honest state. Then a tagged object no requirement covers is
17
+ * a WARNING (`obligation.uncovered`) and an `adr:` naming no file is an ERROR
18
+ * (`obligation.adr-missing`): the team's work being outstanding is normal, and
19
+ * a pointer at a decision nobody can read is not.
20
+ *
21
+ * `obligation.uncovered` IS THE PREREQUISITE THE ROADMAP NAMED. `c4.uncovered`
22
+ * has always been able to say "this architecture object owes a requirement",
23
+ * but only about a NEW tagged element in a feature's `delta.likec4` — never
24
+ * about the map the fleet actually runs on. This asks the same question of the
25
+ * LIVING landscape, against the union of every service's living `arch.spec.md`
26
+ * `Covers:` lines, which is the index that did not exist before.
27
+ */
28
+ import { existsSync } from "node:fs";
29
+ import { join } from "node:path";
30
+ import {} from "../../../core/c4/likec4.js";
31
+ import { closeIds, coversDeployEdge, coversDeployNode, coversEdge, coversElement, } from "../../../core/c4/arch.js";
32
+ import { NO_DEPLOYMENT } from "../../../core/c4/parsed/deployment.js";
33
+ import { taggedDeployment } from "../../../core/deployment/objects.js";
34
+ import { elementService } from "../../../core/c4/resolve/service.js";
35
+ import { OBLIGATION_TAG_PREFIX } from "../../../core/obligations/obligations.js";
36
+ import { servicePathsAt } from "../../../core/repo/paths.js";
37
+ import {} from "../../../core/repo/entries.js";
38
+ import {} from "../../../core/vocabulary/report.js";
39
+ import { FleetContext } from "../../../core/fleet-context.js";
40
+ import { readRequirementsDocument, parseRequirements } from "../../../core/document/parse.js";
41
+ import { coversEntries } from "../checks/requirements.js";
42
+ /**
43
+ * The half that does not depend on the map: the file reads, and its `adr:`
44
+ * pointers resolve.
45
+ *
46
+ * Separate from the map questions because the landscape target returns early
47
+ * twice — an absent map, and one that did not parse — and a broken vocabulary
48
+ * must still be named in exactly the runs where somebody is fixing something
49
+ * else. The same placement `permissionFindings` and `capabilityFleetFindings`
50
+ * already have, one level of precision finer.
51
+ */
52
+ export function obligationVocabularyFindings(docsDir, vocabulary) {
53
+ if (!vocabulary.present)
54
+ return [];
55
+ if (vocabulary.invalid !== undefined) {
56
+ // Reported ALONE, exactly as `permissions.invalid` and `capability.invalid`
57
+ // are: every `#obl-` tag in the fleet resolves against this file, so grading
58
+ // them on top of a broken vocabulary is a cascade, not a diagnosis.
59
+ return [
60
+ {
61
+ severity: "error",
62
+ code: "obligation.invalid",
63
+ message: `landscape: architecture/obligations.yaml does not read as a vocabulary — ${vocabulary.invalid}. ` +
64
+ "Every `#obl-` tag on the fleet map resolves against this file, so none of them can be graded until it parses. " +
65
+ "The shape is `obligations: {<id>: {description, adr}}`, ids spelled with letters, digits, `_` and `-` only.",
66
+ },
67
+ ];
68
+ }
69
+ return adrFindings(docsDir, [...vocabulary.byId.values()]);
70
+ }
71
+ /** The three questions that need the map, suspended entirely when it could not be read. */
72
+ export async function obligationFindings(check) {
73
+ const { vocabulary } = check;
74
+ if (!vocabulary.present || vocabulary.invalid !== undefined)
75
+ return [];
76
+ const findings = [];
77
+ // Which objects carry which obligation. Elements and edges are collected
78
+ // together because every question below treats them alike: an obligation
79
+ // applies to a thing on the map, and whether that thing is a box or an arrow
80
+ // changes only how the message spells it and how `Covers:` matches it.
81
+ // The enumerated fleet rides in for the deployment half of the walk: an
82
+ // instance deploys a CONTAINER more often than a whole system, and resolving
83
+ // which service owns one needs the ancestor walk `serviceResolver` performs.
84
+ // It is the same set `uncoveredFindings` resolves edge endpoints with, or the
85
+ // message would name one service and the coverage check count another.
86
+ const known = new Set(check.services.map((s) => s.id));
87
+ const tagged = taggedObjects(check.land, known);
88
+ const applied = new Set(tagged.map((t) => t.obligation));
89
+ for (const id of [...applied].sort()) {
90
+ if (vocabulary.byId.has(id))
91
+ continue;
92
+ const close = closeIds(id, [...vocabulary.byId.keys()]);
93
+ findings.push({
94
+ severity: "error",
95
+ code: "obligation.unknown",
96
+ subject: id,
97
+ message: `landscape: #${OBLIGATION_TAG_PREFIX}${id} tags ${count(tagged.filter((t) => t.obligation === id).length, "object")} on the fleet map, ` +
98
+ `and architecture/obligations.yaml declares no obligation '${id}'` +
99
+ (close.length > 0 ? ` — did you mean: ${close.join(", ")}?` : "") +
100
+ ". A tag that resolves to nothing reads exactly like a rule the fleet keeps: declare it, or fix the tag.",
101
+ details: tagged.filter((t) => t.obligation === id).map((t) => t.where),
102
+ });
103
+ }
104
+ const unapplied = [...vocabulary.byId.keys()].filter((id) => !applied.has(id)).sort();
105
+ if (unapplied.length > 0) {
106
+ findings.push({
107
+ severity: "warn",
108
+ code: "obligation.unapplied",
109
+ message: `landscape: ${unapplied.length} declared obligation(s) that no \`#${OBLIGATION_TAG_PREFIX}\` tag applies anywhere on the fleet map — ` +
110
+ "either a decision that was reversed and left its word behind, or one nobody has placed yet. " +
111
+ "Tag the elements and edges it governs, or drop the declaration; a vocabulary is worth what cites it.",
112
+ details: unapplied,
113
+ });
114
+ }
115
+ // ONLY A RESOLVED APPLICATION IS ASKED ABOUT COVERAGE. A tag naming no
116
+ // declared obligation has already earned its error above, and "no requirement
117
+ // covers #obl-typo" is not a second breach — it is the same one restated in
118
+ // words that ask the reader to write a requirement for a rule that does not
119
+ // exist. The use-case axis draws this line in the same place: only a resolved
120
+ // `#cap-` claim keeps a promise.
121
+ findings.push(...(await uncoveredFindings(check, tagged.filter((t) => vocabulary.byId.has(t.obligation)))));
122
+ return findings;
123
+ }
124
+ /**
125
+ * Every `#obl-` tag on the living map, one entry per (obligation, object) pair.
126
+ *
127
+ * A bare `#obl-` slugs to the empty string and is kept as an application on
128
+ * purpose, exactly as a bare `#cap-` is kept as a claim: the prefix is the
129
+ * author's opt-in however little follows it, and dropping it as unreserved
130
+ * would leave an object that asked to be graded silently ungraded. It then
131
+ * resolves to `obligation.unknown` in every fleet that did not declare an empty
132
+ * id, which is the honest answer.
133
+ */
134
+ function taggedObjects(land, known) {
135
+ const out = [];
136
+ for (const element of land.elements) {
137
+ for (const tag of element.tags.filter((t) => t.startsWith(OBLIGATION_TAG_PREFIX))) {
138
+ out.push({
139
+ obligation: tag.slice(OBLIGATION_TAG_PREFIX.length),
140
+ element,
141
+ where: element.id,
142
+ subject: elementService(element),
143
+ });
144
+ }
145
+ }
146
+ for (const edge of land.relationships) {
147
+ for (const tag of edge.tags.filter((t) => t.startsWith(OBLIGATION_TAG_PREFIX))) {
148
+ out.push({
149
+ obligation: tag.slice(OBLIGATION_TAG_PREFIX.length),
150
+ edge,
151
+ where: `${edge.source} -> ${edge.target}`,
152
+ subject: edge.target,
153
+ });
154
+ }
155
+ }
156
+ // The topology, walked by the same rule and for the reason the rule exists: a
157
+ // tag is a claim about the object it sits on, and which MODEL that object
158
+ // lives in is not something a reader of the tag can see. Until this walk the
159
+ // same undeclared tag was an error on a container and silence on a
160
+ // datacenter — fail-open, and the case FEAT-1's ARCH-LOAM-DEPLOY-TAGGED was
161
+ // written about. A fleet that draws no topology contributes nothing here.
162
+ for (const d of taggedDeployment(land.deployment ?? NO_DEPLOYMENT, land.elements, known, OBLIGATION_TAG_PREFIX)) {
163
+ out.push({
164
+ obligation: d.obligation,
165
+ deployed: d,
166
+ where: d.where,
167
+ ...(d.service === undefined ? {} : { subject: d.service }),
168
+ });
169
+ }
170
+ return out;
171
+ }
172
+ /**
173
+ * `obligation.uncovered` — a tagged object no living arch requirement covers.
174
+ *
175
+ * The index is the union of EVERY service's living `arch.spec.md` `Covers:`
176
+ * lines, because an obligation is placed by the architect on the map and met by
177
+ * whichever team owns the thing it sits on — and a per-service index would
178
+ * report an edge as uncovered because the requirement that covers it lives in
179
+ * the service at the other end. `coversEntries` already drops REMOVED
180
+ * requirements: a retired requirement covers nothing.
181
+ *
182
+ * ONE FINDING PER TAGGED OBJECT, subject = the service that owns it, so a
183
+ * fleet-wide report reads as a worklist per team rather than as one line naming
184
+ * forty edges.
185
+ */
186
+ async function uncoveredFindings(check, tagged) {
187
+ if (tagged.length === 0)
188
+ return [];
189
+ const covers = await livingCovers(check);
190
+ const elements = check.land.elements;
191
+ const known = new Set(check.services.map((s) => s.id));
192
+ const covered = (t) => {
193
+ if (t.element !== undefined)
194
+ return covers.some((c) => coversElement(c, t.element));
195
+ if (t.edge !== undefined)
196
+ return covers.some((c) => coversEdge(c, t.edge, elements, known));
197
+ const d = t.deployed;
198
+ return d.edge === undefined
199
+ ? covers.some((c) => coversDeployNode(c, d.id))
200
+ : covers.some((c) => coversDeployEdge(c, d.edge.source, d.edge.target));
201
+ };
202
+ return tagged
203
+ .filter((t) => !covered(t))
204
+ .map((t) => ({
205
+ severity: "warn",
206
+ code: "obligation.uncovered",
207
+ ...(t.subject === undefined ? {} : { subject: t.subject }),
208
+ message: `${t.where} carries #${OBLIGATION_TAG_PREFIX}${t.obligation} and no living arch requirement covers it — ` +
209
+ `the obligation is placed and nothing says it is met. Write the requirement in ` +
210
+ // A region, a datacenter or a cluster is owned by no service, so the
211
+ // sentence stays general rather than naming a team at random. Every
212
+ // other object here has a real owner and keeps the actionable form.
213
+ `${t.subject === undefined ? "the arch.spec.md of whichever service answers for this topology" : `${t.subject}'s arch.spec.md`}` +
214
+ ` with \`Covers: ${t.where}\` and a scenario that proves it, or drop the tag if the decision no longer applies here.`,
215
+ }));
216
+ }
217
+ /**
218
+ * Every `Covers:` entry the LIVING fleet writes, across both requirement
219
+ * documents of every service.
220
+ *
221
+ * Existence is checked for both files and for the same reason
222
+ * `permissionFindings` checks it: `arch.spec.md` is optional and most of a
223
+ * legacy fleet has none, while `spec.md` is missing on a half-adopted service —
224
+ * and `FleetContext.readRequirements` throws ENOENT, which surfaces as
225
+ * `repository-unavailable` and takes the whole `--all` run down. Both axes are
226
+ * read, not only the architecture one: `Covers:` is parsed everywhere for one
227
+ * grammar's sake, and a fleet that wrote its outbox requirement in `spec.md`
228
+ * has said the thing loam is asking about.
229
+ */
230
+ async function livingCovers(check) {
231
+ const entries = [];
232
+ for (const service of check.services) {
233
+ const paths = servicePathsAt(service.dir);
234
+ for (const path of [paths.spec, paths.archSpec]) {
235
+ if (!existsSync(path))
236
+ continue;
237
+ const reqs = check.fleet === undefined
238
+ ? parseRequirements(await readRequirementsDocument(path))
239
+ : await check.fleet.readRequirements(path);
240
+ entries.push(...coversEntries(reqs));
241
+ }
242
+ }
243
+ return entries;
244
+ }
245
+ /**
246
+ * `obligation.adr-missing` — an `adr:` path that names no file.
247
+ *
248
+ * The path is relative to the docs repo root rather than to
249
+ * `architecture/obligations.yaml`, because that is how a reader of a fleet
250
+ * document thinks about a fleet path, and because the value is a YAML field
251
+ * rather than a markdown link — `link.unresolved` grades links written in prose,
252
+ * and this one is written in a slot loam defined.
253
+ */
254
+ function adrFindings(docsDir, obligations) {
255
+ return obligations
256
+ .filter((o) => o.adr !== undefined && !existsSync(join(docsDir, o.adr)))
257
+ .map((o) => ({
258
+ severity: "error",
259
+ code: "obligation.adr-missing",
260
+ subject: o.id,
261
+ message: `landscape: obligation '${o.id}' names \`adr: ${o.adr}\` and no such file exists — ` +
262
+ "the ADR is where the decision itself is written, so a pointer at nothing leaves every tag citing a rule nobody can read. " +
263
+ "Fix the path (it is relative to the docs repo root), write the record, or drop the field.",
264
+ }));
265
+ }
266
+ /** `1 object` / `3 objects` — the plural spelled once, because three messages count things. */
267
+ function count(n, noun) {
268
+ return `${n} ${noun}${n === 1 ? "" : "s"}`;
269
+ }
270
+ //# sourceMappingURL=obligations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"obligations.js","sourceRoot":"","sources":["../../../../src/commands/validate/fleet/obligations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAuC,MAAM,4BAA4B,CAAC;AACjF,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,aAAa,GAEd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAyB,MAAM,qCAAqC,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAA6B,MAAM,0CAA0C,CAAC;AAC5G,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAqB,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAgB,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAsB1D;;;;;;;;;GASG;AACH,MAAM,UAAU,4BAA4B,CAAC,OAAgB,EAAE,UAAgC;IAC7F,IAAI,CAAC,UAAU,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACnC,IAAI,UAAU,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACrC,4EAA4E;QAC5E,6EAA6E;QAC7E,oEAAoE;QACpE,OAAO;YACL;gBACE,QAAQ,E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,wBAAwB;QAC9B,OAAO,EAAE,CAAC,CAAC,EAAE;QACb,OAAO,EACL,0BAA0B,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,GAAI,+BAA+B;YACrF,2HAA2H;YAC3H,2FAA2F;KAC9F,CAAC,CAAC,CAAC;AACR,CAAC;AAED,+FAA+F;AAC/F,SAAS,KAAK,CAAC,CAAS,EAAE,IAAY;IACpC,OAAO,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAC7C,CAAC","sourcesContent":["/**\n * The architectural obligation axis, graded against the fleet it is about.\n *\n * `core/obligations/obligations.ts` states what the axis IS and why it has this\n * shape. This module is the four questions asked of a fleet that has one, and\n * the order they are asked in — the same division `checks/fleet-shape.ts` keeps\n * for the authorization and capability vocabularies, which this sits beside on\n * the `landscape` target for their reason: an obligation crosses services by\n * construction, so no service target can answer for it.\n *\n * THE FOUR ARE TWO PAIRS, and each pair is one join read in both directions.\n * A tag nothing declares is an ERROR (`obligation.unknown`) and a declaration\n * nothing tags is a WARNING (`obligation.unapplied`) — exactly the asymmetry\n * `permissions.unknown`/`permissions.unenforced` already carry, and for the\n * same reason: a typo in a tag reads like a rule, while a word nobody has\n * adopted yet is an honest state. Then a tagged object no requirement covers is\n * a WARNING (`obligation.uncovered`) and an `adr:` naming no file is an ERROR\n * (`obligation.adr-missing`): the team's work being outstanding is normal, and\n * a pointer at a decision nobody can read is not.\n *\n * `obligation.uncovered` IS THE PREREQUISITE THE ROADMAP NAMED. `c4.uncovered`\n * has always been able to say \"this architecture object owes a requirement\",\n * but only about a NEW tagged element in a feature's `delta.likec4` — never\n * about the map the fleet actually runs on. This asks the same question of the\n * LIVING landscape, against the union of every service's living `arch.spec.md`\n * `Covers:` lines, which is the index that did not exist before.\n */\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { type Elem, type LoadedDoc, type Rel } from \"../../../core/c4/likec4.js\";\nimport {\n closeIds,\n coversDeployEdge,\n coversDeployNode,\n coversEdge,\n coversElement,\n type CoversEntry,\n} from \"../../../core/c4/arch.js\";\nimport { NO_DEPLOYMENT } from \"../../../core/c4/parsed/deployment.js\";\nimport { taggedDeployment, type TaggedDeployment } from \"../../../core/deployment/objects.js\";\nimport { elementService } from \"../../../core/c4/resolve/service.js\";\nimport { OBLIGATION_TAG_PREFIX, type ObligationVocabulary } from \"../../../core/obligations/obligations.js\";\nimport { servicePathsAt } from \"../../../core/repo/paths.js\";\nimport { type ServiceEntry } from \"../../../core/repo/entries.js\";\nimport { type Finding } from \"../../../core/vocabulary/report.js\";\nimport { FleetContext } from \"../../../core/fleet-context.js\";\nimport { readRequirementsDocument, parseRequirements } from \"../../../core/document/parse.js\";\nimport { coversEntries } from \"../checks/requirements.js\";\nimport type { DocsDir } from \"../../../core/kernel/ids/dirs.js\";\n\nexport interface ObligationCheck {\n docsDir: DocsDir;\n vocabulary: ObligationVocabulary;\n /**\n * The living landscape, PARSED. Not nullable, and the absence is the point:\n * the landscape target returns before it reaches this call when the map is\n * missing or did not parse, so a run that could not read the map asks none of\n * the three questions below rather than answering them empty. \"Loam did not\n * look\" is never the same answer as \"there is nothing there\" — an unreadable\n * map graded as empty would report every declared obligation as applied\n * nowhere — and the suspension lives at the call site because that is where\n * the fact is known. It is also why the vocabulary half is a separate\n * function: those two verdicts must survive exactly those early returns.\n */\n land: LoadedDoc;\n services: ServiceEntry[];\n fleet?: FleetContext;\n}\n\n/**\n * The half that does not depend on the map: the file reads, and its `adr:`\n * pointers resolve.\n *\n * Separate from the map questions because the landscape target returns early\n * twice — an absent map, and one that did not parse — and a broken vocabulary\n * must still be named in exactly the runs where somebody is fixing something\n * else. The same placement `permissionFindings` and `capabilityFleetFindings`\n * already have, one level of precision finer.\n */\nexport function obligationVocabularyFindings(docsDir: DocsDir, vocabulary: ObligationVocabulary): Finding[] {\n if (!vocabulary.present) return [];\n if (vocabulary.invalid !== undefined) {\n // Reported ALONE, exactly as `permissions.invalid` and `capability.invalid`\n // are: every `#obl-` tag in the fleet resolves against this file, so grading\n // them on top of a broken vocabulary is a cascade, not a diagnosis.\n return [\n {\n severity: \"error\",\n code: \"obligation.invalid\",\n message:\n `landscape: architecture/obligations.yaml does not read as a vocabulary — ${vocabulary.invalid}. ` +\n \"Every `#obl-` tag on the fleet map resolves against this file, so none of them can be graded until it parses. \" +\n \"The shape is `obligations: {<id>: {description, adr}}`, ids spelled with letters, digits, `_` and `-` only.\",\n },\n ];\n }\n\n return adrFindings(docsDir, [...vocabulary.byId.values()]);\n}\n\n/** The three questions that need the map, suspended entirely when it could not be read. */\nexport async function obligationFindings(check: ObligationCheck): Promise<Finding[]> {\n const { vocabulary } = check;\n if (!vocabulary.present || vocabulary.invalid !== undefined) return [];\n const findings: Finding[] = [];\n\n // Which objects carry which obligation. Elements and edges are collected\n // together because every question below treats them alike: an obligation\n // applies to a thing on the map, and whether that thing is a box or an arrow\n // changes only how the message spells it and how `Covers:` matches it.\n // The enumerated fleet rides in for the deployment half of the walk: an\n // instance deploys a CONTAINER more often than a whole system, and resolving\n // which service owns one needs the ancestor walk `serviceResolver` performs.\n // It is the same set `uncoveredFindings` resolves edge endpoints with, or the\n // message would name one service and the coverage check count another.\n const known = new Set(check.services.map((s) => s.id));\n const tagged = taggedObjects(check.land, known);\n const applied = new Set(tagged.map((t) => t.obligation));\n\n for (const id of [...applied].sort()) {\n if (vocabulary.byId.has(id)) continue;\n const close = closeIds(id, [...vocabulary.byId.keys()]);\n findings.push({\n severity: \"error\",\n code: \"obligation.unknown\",\n subject: id,\n message:\n `landscape: #${OBLIGATION_TAG_PREFIX}${id} tags ${count(tagged.filter((t) => t.obligation === id).length, \"object\")} on the fleet map, ` +\n `and architecture/obligations.yaml declares no obligation '${id}'` +\n (close.length > 0 ? ` — did you mean: ${close.join(\", \")}?` : \"\") +\n \". A tag that resolves to nothing reads exactly like a rule the fleet keeps: declare it, or fix the tag.\",\n details: tagged.filter((t) => t.obligation === id).map((t) => t.where),\n });\n }\n\n const unapplied = [...vocabulary.byId.keys()].filter((id) => !applied.has(id)).sort();\n if (unapplied.length > 0) {\n findings.push({\n severity: \"warn\",\n code: \"obligation.unapplied\",\n message:\n `landscape: ${unapplied.length} declared obligation(s) that no \\`#${OBLIGATION_TAG_PREFIX}\\` tag applies anywhere on the fleet map — ` +\n \"either a decision that was reversed and left its word behind, or one nobody has placed yet. \" +\n \"Tag the elements and edges it governs, or drop the declaration; a vocabulary is worth what cites it.\",\n details: unapplied,\n });\n }\n\n // ONLY A RESOLVED APPLICATION IS ASKED ABOUT COVERAGE. A tag naming no\n // declared obligation has already earned its error above, and \"no requirement\n // covers #obl-typo\" is not a second breach — it is the same one restated in\n // words that ask the reader to write a requirement for a rule that does not\n // exist. The use-case axis draws this line in the same place: only a resolved\n // `#cap-` claim keeps a promise.\n findings.push(...(await uncoveredFindings(check, tagged.filter((t) => vocabulary.byId.has(t.obligation)))));\n return findings;\n}\n\n/** One place an obligation is applied: which obligation, on what, and how a message names it. */\ninterface TaggedObject {\n obligation: string;\n /** The element, the edge, or the deployment object — exactly one is set. */\n element?: Elem;\n edge?: Rel;\n deployed?: TaggedDeployment;\n /**\n * How the finding spells this object, and how a `Covers:` line has to: an\n * element id, `source -> target`, or the `node:` forms.\n */\n where: string;\n /**\n * What the finding is filed under — the service that owns it, where one\n * does. ABSENT for a region, a datacenter or a cluster: nobody-s service\n * runs one, and naming a team that did not ask for the work is worse than\n * leaving the sentence general.\n */\n subject?: string;\n}\n\n/**\n * Every `#obl-` tag on the living map, one entry per (obligation, object) pair.\n *\n * A bare `#obl-` slugs to the empty string and is kept as an application on\n * purpose, exactly as a bare `#cap-` is kept as a claim: the prefix is the\n * author's opt-in however little follows it, and dropping it as unreserved\n * would leave an object that asked to be graded silently ungraded. It then\n * resolves to `obligation.unknown` in every fleet that did not declare an empty\n * id, which is the honest answer.\n */\nfunction taggedObjects(land: LoadedDoc, known: ReadonlySet<string>): TaggedObject[] {\n const out: TaggedObject[] = [];\n for (const element of land.elements) {\n for (const tag of element.tags.filter((t) => t.startsWith(OBLIGATION_TAG_PREFIX))) {\n out.push({\n obligation: tag.slice(OBLIGATION_TAG_PREFIX.length),\n element,\n where: element.id,\n subject: elementService(element),\n });\n }\n }\n for (const edge of land.relationships) {\n for (const tag of edge.tags.filter((t) => t.startsWith(OBLIGATION_TAG_PREFIX))) {\n out.push({\n obligation: tag.slice(OBLIGATION_TAG_PREFIX.length),\n edge,\n where: `${edge.source} -> ${edge.target}`,\n subject: edge.target,\n });\n }\n }\n // The topology, walked by the same rule and for the reason the rule exists: a\n // tag is a claim about the object it sits on, and which MODEL that object\n // lives in is not something a reader of the tag can see. Until this walk the\n // same undeclared tag was an error on a container and silence on a\n // datacenter — fail-open, and the case FEAT-1's ARCH-LOAM-DEPLOY-TAGGED was\n // written about. A fleet that draws no topology contributes nothing here.\n for (const d of taggedDeployment(land.deployment ?? NO_DEPLOYMENT, land.elements, known, OBLIGATION_TAG_PREFIX)) {\n out.push({\n obligation: d.obligation,\n deployed: d,\n where: d.where,\n ...(d.service === undefined ? {} : { subject: d.service }),\n });\n }\n return out;\n}\n\n/**\n * `obligation.uncovered` — a tagged object no living arch requirement covers.\n *\n * The index is the union of EVERY service's living `arch.spec.md` `Covers:`\n * lines, because an obligation is placed by the architect on the map and met by\n * whichever team owns the thing it sits on — and a per-service index would\n * report an edge as uncovered because the requirement that covers it lives in\n * the service at the other end. `coversEntries` already drops REMOVED\n * requirements: a retired requirement covers nothing.\n *\n * ONE FINDING PER TAGGED OBJECT, subject = the service that owns it, so a\n * fleet-wide report reads as a worklist per team rather than as one line naming\n * forty edges.\n */\nasync function uncoveredFindings(check: ObligationCheck, tagged: TaggedObject[]): Promise<Finding[]> {\n if (tagged.length === 0) return [];\n const covers = await livingCovers(check);\n const elements = check.land.elements;\n const known = new Set(check.services.map((s) => s.id));\n const covered = (t: TaggedObject): boolean => {\n if (t.element !== undefined) return covers.some((c) => coversElement(c, t.element!));\n if (t.edge !== undefined) return covers.some((c) => coversEdge(c, t.edge!, elements, known));\n const d = t.deployed!;\n return d.edge === undefined\n ? covers.some((c) => coversDeployNode(c, d.id!))\n : covers.some((c) => coversDeployEdge(c, d.edge!.source, d.edge!.target));\n };\n return tagged\n .filter((t) => !covered(t))\n .map((t) => ({\n severity: \"warn\" as const,\n code: \"obligation.uncovered\",\n ...(t.subject === undefined ? {} : { subject: t.subject }),\n message:\n `${t.where} carries #${OBLIGATION_TAG_PREFIX}${t.obligation} and no living arch requirement covers it — ` +\n `the obligation is placed and nothing says it is met. Write the requirement in ` +\n // A region, a datacenter or a cluster is owned by no service, so the\n // sentence stays general rather than naming a team at random. Every\n // other object here has a real owner and keeps the actionable form.\n `${t.subject === undefined ? \"the arch.spec.md of whichever service answers for this topology\" : `${t.subject}'s arch.spec.md`}` +\n ` with \\`Covers: ${t.where}\\` and a scenario that proves it, or drop the tag if the decision no longer applies here.`,\n }));\n}\n\n/**\n * Every `Covers:` entry the LIVING fleet writes, across both requirement\n * documents of every service.\n *\n * Existence is checked for both files and for the same reason\n * `permissionFindings` checks it: `arch.spec.md` is optional and most of a\n * legacy fleet has none, while `spec.md` is missing on a half-adopted service —\n * and `FleetContext.readRequirements` throws ENOENT, which surfaces as\n * `repository-unavailable` and takes the whole `--all` run down. Both axes are\n * read, not only the architecture one: `Covers:` is parsed everywhere for one\n * grammar's sake, and a fleet that wrote its outbox requirement in `spec.md`\n * has said the thing loam is asking about.\n */\nasync function livingCovers(check: ObligationCheck): Promise<CoversEntry[]> {\n const entries: CoversEntry[] = [];\n for (const service of check.services) {\n const paths = servicePathsAt(service.dir);\n for (const path of [paths.spec, paths.archSpec]) {\n if (!existsSync(path)) continue;\n const reqs =\n check.fleet === undefined\n ? parseRequirements(await readRequirementsDocument(path))\n : await check.fleet.readRequirements(path);\n entries.push(...coversEntries(reqs));\n }\n }\n return entries;\n}\n\n/**\n * `obligation.adr-missing` — an `adr:` path that names no file.\n *\n * The path is relative to the docs repo root rather than to\n * `architecture/obligations.yaml`, because that is how a reader of a fleet\n * document thinks about a fleet path, and because the value is a YAML field\n * rather than a markdown link — `link.unresolved` grades links written in prose,\n * and this one is written in a slot loam defined.\n */\nfunction adrFindings(docsDir: DocsDir, obligations: readonly { id: string; adr?: string }[]): Finding[] {\n return obligations\n .filter((o) => o.adr !== undefined && !existsSync(join(docsDir, o.adr)))\n .map((o) => ({\n severity: \"error\" as const,\n code: \"obligation.adr-missing\",\n subject: o.id,\n message:\n `landscape: obligation '${o.id}' names \\`adr: ${o.adr!}\\` and no such file exists — ` +\n \"the ADR is where the decision itself is written, so a pointer at nothing leaves every tag citing a rule nobody can read. \" +\n \"Fix the path (it is relative to the docs repo root), write the record, or drop the field.\",\n }));\n}\n\n/** `1 object` / `3 objects` — the plural spelled once, because three messages count things. */\nfunction count(n: number, noun: string): string {\n return `${n} ${noun}${n === 1 ? \"\" : \"s\"}`;\n}\n"]}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * The adoption vocabulary of the fleet scorecard: which contract axes a
3
+ * service PARTICIPATES in, summed to the fleet's per-axis participation
4
+ * counts, and the mechanical rule for which warnings the `--all` text report
5
+ * may fold under a per-axis "not started" banner.
6
+ *
7
+ * A leaf on purpose: it imports nothing, so `../report.ts` (the text
8
+ * renderer) and `./contracts.js` (which computes the per-service booleans)
9
+ * can both use it without closing a cycle — `adoptionOf` takes the smallest
10
+ * structural parameter it needs instead of the ContractCounts type,
11
+ * core/vocabulary/maturity.ts's EdgeSource precedent for staying a leaf.
12
+ */
13
+ /**
14
+ * The six contract axes a service adopts one at a time, in the order every
15
+ * rendering walks them. Participation is a per-service boolean with one
16
+ * mechanical rule per axis, spelled on `Scorecard.adoption` (./scorecard.js)
17
+ * where the payload key freezes them.
18
+ */
19
+ export const ADOPTION_AXES = [
20
+ "requirements",
21
+ "arch",
22
+ "openapi",
23
+ "asyncapi",
24
+ "permissions",
25
+ "capabilities",
26
+ ];
27
+ /** Sum the per-service participation booleans into the fleet's counts. */
28
+ export function adoptionOf(perService) {
29
+ const out = { requirements: 0, arch: 0, openapi: 0, asyncapi: 0, permissions: 0, capabilities: 0 };
30
+ for (const svc of perService) {
31
+ for (const axis of ADOPTION_AXES)
32
+ if (svc.participates[axis])
33
+ out[axis] += 1;
34
+ }
35
+ return out;
36
+ }
37
+ /**
38
+ * THE QUALIFICATION RULE — this table IS the rule, and it is mechanical and
39
+ * fail-closed. A finding is grouped under an axis's "not started" banner iff
40
+ * (1) its severity is `warn`, (2) its code is listed in this table's row for
41
+ * the axis, (3) this run's `adoption[axis] === 0`, and (4) the run could
42
+ * measure that zero at all — a fleet with at least one service and no
43
+ * `service.unreadable` subject (report.ts enforces this half, beside the
44
+ * banner it gates: "0 of 0" is no fleet, and an unreadable service's
45
+ * all-false participation must not manufacture the zero). Anything else —
46
+ * every error, every warn code not listed here, every warn on an axis with
47
+ * even one participating service — prints ungrouped, exactly as before. When
48
+ * in doubt a code stays OUT of the table: the cost of a wrongly-ungrouped
49
+ * warning is noise, the cost of a wrongly-grouped one is a hidden defect.
50
+ *
51
+ * A row lists exactly the warn codes whose SOLE cause is the axis not being
52
+ * started fleet-wide — codes whose remedy presupposes starting the axis at
53
+ * all, so with zero participating services the per-target repetition carries
54
+ * no information the one banner does not:
55
+ *
56
+ * - requirements: `service.no-spec` and `spec.no-requirements` fire once per
57
+ * service when nobody in the fleet has written a requirement block.
58
+ * - openapi: `service.no-openapi`'s WARN form (the error form — dangling
59
+ * authored links into the absent file — never groups, by condition 1), and
60
+ * `spine.op-link-missing`, which never reads the contract (service/spine.ts
61
+ * documents exactly that) and so fires per titled Calls-edge even with zero
62
+ * contracts fleet-wide.
63
+ * - permissions: `permissions.unenforced` — one finding whose whole content
64
+ * is "the vocabulary exists and nothing cites it yet".
65
+ * - capabilities: `capability.unrealized` — deliberately one warn PER
66
+ * declared capability (core/capabilities/findings.ts), so a freshly landed
67
+ * vocabulary warns M times before the first requirement names any of them.
68
+ * - arch and asyncapi have NO code whose sole cause is fleet-wide absence
69
+ * (an absent arch.spec.md is silent; an absent asyncapi.yaml is silent or
70
+ * an error when authored links strand on it), so their rows are empty and
71
+ * those axes surface only in the scorecard's not-started one-liner.
72
+ *
73
+ * Rows are disjoint — a code belongs to exactly one axis — which is what lets
74
+ * `groupedWarnCodes` invert the table into a Map. Not prose alone:
75
+ * test/adoption-rollup.test.ts asserts the flattened rows hold no duplicate,
76
+ * because a code filed under two axes would be grouped under whichever
77
+ * happens to sit at zero — possibly hiding it behind a fully adopted axis.
78
+ */
79
+ export const AXIS_GROUPED_WARNS = {
80
+ requirements: ["service.no-spec", "spec.no-requirements"],
81
+ arch: [],
82
+ openapi: ["service.no-openapi", "spine.op-link-missing"],
83
+ asyncapi: [],
84
+ permissions: ["permissions.unenforced"],
85
+ capabilities: ["capability.unrealized"],
86
+ };
87
+ /**
88
+ * The table inverted for this run: warn code → its axis, for exactly the axes
89
+ * this run's adoption counts put at zero. Insertion order is ADOPTION_AXES
90
+ * order then row order, so every walk over the Map renders deterministically.
91
+ */
92
+ export function groupedWarnCodes(adoption) {
93
+ const out = new Map();
94
+ for (const axis of ADOPTION_AXES) {
95
+ if (adoption[axis] !== 0)
96
+ continue;
97
+ for (const code of AXIS_GROUPED_WARNS[axis])
98
+ out.set(code, axis);
99
+ }
100
+ return out;
101
+ }
102
+ //# sourceMappingURL=adoption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adoption.js","sourceRoot":"","sources":["../../../../../src/commands/validate/fleet/scorecard/adoption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,cAAc;IACd,MAAM;IACN,SAAS;IACT,UAAU;IACV,aAAa;IACb,cAAc;CACN,CAAC;AAaX,0EAA0E;AAC1E,MAAM,UAAU,UAAU,CACxB,UAA6F;IAE7F,MAAM,GAAG,GAAa,EAAE,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC;IAC7G,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,KAAK,MAAM,IAAI,IAAI,aAAa;YAAE,IAAI,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC;gBAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA4C;IACzE,YAAY,EAAE,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;IACzD,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,CAAC,oBAAoB,EAAE,uBAAuB,CAAC;IACxD,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE,CAAC,wBAAwB,CAAC;IACvC,YAAY,EAAE,CAAC,uBAAuB,CAAC;CACxC,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAkB;IACjD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC5C,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QACjC,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,SAAS;QACnC,KAAK,MAAM,IAAI,IAAI,kBAAkB,CAAC,IAAI,CAAC;YAAE,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * The adoption vocabulary of the fleet scorecard: which contract axes a\n * service PARTICIPATES in, summed to the fleet's per-axis participation\n * counts, and the mechanical rule for which warnings the `--all` text report\n * may fold under a per-axis \"not started\" banner.\n *\n * A leaf on purpose: it imports nothing, so `../report.ts` (the text\n * renderer) and `./contracts.js` (which computes the per-service booleans)\n * can both use it without closing a cycle — `adoptionOf` takes the smallest\n * structural parameter it needs instead of the ContractCounts type,\n * core/vocabulary/maturity.ts's EdgeSource precedent for staying a leaf.\n */\n\n/**\n * The six contract axes a service adopts one at a time, in the order every\n * rendering walks them. Participation is a per-service boolean with one\n * mechanical rule per axis, spelled on `Scorecard.adoption` (./scorecard.js)\n * where the payload key freezes them.\n */\nexport const ADOPTION_AXES = [\n \"requirements\",\n \"arch\",\n \"openapi\",\n \"asyncapi\",\n \"permissions\",\n \"capabilities\",\n] as const;\n\nexport type AdoptionAxis = (typeof ADOPTION_AXES)[number];\n\n/**\n * Participating services per axis. Flat counts — the denominator is\n * `Scorecard.services`, carried once so two copies cannot disagree. An axis\n * at 0 reads \"not started\"; 0 < N < M is \"partially adopted\", and the two\n * must never be conflated: a banner that grouped a partially-adopted axis's\n * warnings would hide the exact services the count says are missing.\n */\nexport type Adoption = Record<AdoptionAxis, number>;\n\n/** Sum the per-service participation booleans into the fleet's counts. */\nexport function adoptionOf(\n perService: ReadonlyArray<{ readonly participates: Readonly<Record<AdoptionAxis, boolean>> }>,\n): Adoption {\n const out: Adoption = { requirements: 0, arch: 0, openapi: 0, asyncapi: 0, permissions: 0, capabilities: 0 };\n for (const svc of perService) {\n for (const axis of ADOPTION_AXES) if (svc.participates[axis]) out[axis] += 1;\n }\n return out;\n}\n\n/**\n * THE QUALIFICATION RULE — this table IS the rule, and it is mechanical and\n * fail-closed. A finding is grouped under an axis's \"not started\" banner iff\n * (1) its severity is `warn`, (2) its code is listed in this table's row for\n * the axis, (3) this run's `adoption[axis] === 0`, and (4) the run could\n * measure that zero at all — a fleet with at least one service and no\n * `service.unreadable` subject (report.ts enforces this half, beside the\n * banner it gates: \"0 of 0\" is no fleet, and an unreadable service's\n * all-false participation must not manufacture the zero). Anything else —\n * every error, every warn code not listed here, every warn on an axis with\n * even one participating service — prints ungrouped, exactly as before. When\n * in doubt a code stays OUT of the table: the cost of a wrongly-ungrouped\n * warning is noise, the cost of a wrongly-grouped one is a hidden defect.\n *\n * A row lists exactly the warn codes whose SOLE cause is the axis not being\n * started fleet-wide — codes whose remedy presupposes starting the axis at\n * all, so with zero participating services the per-target repetition carries\n * no information the one banner does not:\n *\n * - requirements: `service.no-spec` and `spec.no-requirements` fire once per\n * service when nobody in the fleet has written a requirement block.\n * - openapi: `service.no-openapi`'s WARN form (the error form — dangling\n * authored links into the absent file — never groups, by condition 1), and\n * `spine.op-link-missing`, which never reads the contract (service/spine.ts\n * documents exactly that) and so fires per titled Calls-edge even with zero\n * contracts fleet-wide.\n * - permissions: `permissions.unenforced` — one finding whose whole content\n * is \"the vocabulary exists and nothing cites it yet\".\n * - capabilities: `capability.unrealized` — deliberately one warn PER\n * declared capability (core/capabilities/findings.ts), so a freshly landed\n * vocabulary warns M times before the first requirement names any of them.\n * - arch and asyncapi have NO code whose sole cause is fleet-wide absence\n * (an absent arch.spec.md is silent; an absent asyncapi.yaml is silent or\n * an error when authored links strand on it), so their rows are empty and\n * those axes surface only in the scorecard's not-started one-liner.\n *\n * Rows are disjoint — a code belongs to exactly one axis — which is what lets\n * `groupedWarnCodes` invert the table into a Map. Not prose alone:\n * test/adoption-rollup.test.ts asserts the flattened rows hold no duplicate,\n * because a code filed under two axes would be grouped under whichever\n * happens to sit at zero — possibly hiding it behind a fully adopted axis.\n */\nexport const AXIS_GROUPED_WARNS: Record<AdoptionAxis, readonly string[]> = {\n requirements: [\"service.no-spec\", \"spec.no-requirements\"],\n arch: [],\n openapi: [\"service.no-openapi\", \"spine.op-link-missing\"],\n asyncapi: [],\n permissions: [\"permissions.unenforced\"],\n capabilities: [\"capability.unrealized\"],\n};\n\n/**\n * The table inverted for this run: warn code → its axis, for exactly the axes\n * this run's adoption counts put at zero. Insertion order is ADOPTION_AXES\n * order then row order, so every walk over the Map renders deterministically.\n */\nexport function groupedWarnCodes(adoption: Adoption): Map<string, AdoptionAxis> {\n const out = new Map<string, AdoptionAxis>();\n for (const axis of ADOPTION_AXES) {\n if (adoption[axis] !== 0) continue;\n for (const code of AXIS_GROUPED_WARNS[axis]) out.set(code, axis);\n }\n return out;\n}\n"]}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * One service's contract-axis contributions to the fleet scorecard: the HTTP
3
+ * and event counts off its living documents, its arch `Covers:` entries for
4
+ * the C4 census, and the per-axis adoption booleans (`participates`).
5
+ * `./scorecard.js` sums these across the fleet; this module owns the
6
+ * per-service reads and their containment, and never prints.
7
+ */
8
+ import { existsSync } from "node:fs";
9
+ import { readAsyncapi } from "../../../../core/asyncapi/read.js";
10
+ import {} from "../../../../core/c4/arch.js";
11
+ import {} from "../../../../core/fleet-context.js";
12
+ import { readOpenapi } from "../../../../core/openapi/doc.js";
13
+ import {} from "../../../../core/repo/entries.js";
14
+ import { servicePathsAt } from "../../../../core/repo/paths.js";
15
+ import { coversEntries } from "../../checks/requirements.js";
16
+ import {} from "./adoption.js";
17
+ export async function contractCounts(svc, fleet, inbound) {
18
+ try {
19
+ return await readContracts(svc, fleet, inbound);
20
+ }
21
+ catch {
22
+ // `guarded`'s doctrine, one rollup down: these are the same memoized reads
23
+ // this service's own target already failed on, and a memoized REJECTION
24
+ // rejects again on every await — so a spec.md that is not UTF-8, or an
25
+ // openapi.yaml that is a directory, deleted the whole fleet's card from
26
+ // inside Promise.all. The service's `service.unreadable` finding names the
27
+ // cause; here the one unreadable service contributes zeros and the
28
+ // fleet's rollup survives. Participation is all-false the way the counts
29
+ // are zero — NOT because the service started nothing (an unreadable
30
+ // service proves nothing, least of all that), but because no claim can be
31
+ // made; the text renderer therefore refuses to group warnings on any run
32
+ // with an unreadable service (report.ts), since a false `false` here
33
+ // could manufacture the fleet-wide N=0 that licenses suppression.
34
+ return {
35
+ operations: { defined: 0, governed: 0, deprecated: 0, deprecatedStillConsumed: 0 },
36
+ messages: { defined: 0, linked: 0 },
37
+ covers: [],
38
+ participates: { requirements: false, arch: false, openapi: false, asyncapi: false, permissions: false, capabilities: false },
39
+ };
40
+ }
41
+ }
42
+ async function readContracts(svc, fleet, inbound) {
43
+ const paths = servicePathsAt(svc.dir);
44
+ const reqs = existsSync(paths.spec) ? await fleet.readRequirements(paths.spec) : [];
45
+ const archReqs = existsSync(paths.archSpec) ? await fleet.readRequirements(paths.archSpec) : [];
46
+ // The living rule the service target applies (service/specs.ts): a REMOVED
47
+ // requirement is on its way out and governs nothing. Hoisted for BOTH
48
+ // documents because the `linked` join and the participation booleans below
49
+ // read the same non-REMOVED sets.
50
+ const living = reqs.filter((r) => r.kind !== "REMOVED");
51
+ const archLiving = archReqs.filter((r) => r.kind !== "REMOVED");
52
+ const api = await readOpenapi(paths.openapi, fleet);
53
+ // Removal markers are never callable operations (service/api.ts's liveOps
54
+ // rule), and an unreadable contract defines nothing this census may count —
55
+ // swallowing it into its parsed subset would grade a broken file as a thin one.
56
+ const ops = api.unreadable ? [] : api.ops.filter((o) => !o.remove);
57
+ const governed = new Set(living.flatMap((r) => r.operations));
58
+ const deprecated = new Set(ops.filter((o) => o.deprecated).map((o) => o.id));
59
+ const events = await readAsyncapi(paths.asyncapi, fleet);
60
+ // Distinct names — every join on the event spine is by NAME, so a duplicate
61
+ // slot is one message — and the governance join is requirement lines from
62
+ // BOTH documents, never landscape edges: an edge is a claim about traffic,
63
+ // a requirement is governance (service/events/events.ts).
64
+ const declared = events.unreadable
65
+ ? []
66
+ : [...new Set(events.messages.filter((m) => m.remove !== true).map((m) => m.name))];
67
+ const linked = new Set([...living, ...archLiving].flatMap((r) => [...r.publishes, ...r.consumes]));
68
+ // The per-axis participation booleans, each the one-line rule the Scorecard
69
+ // doc comment pins. Requirements/arch count ANY parsed block (REMOVED
70
+ // included — a spec retiring its last requirement still started the axis),
71
+ // while permissions/capabilities apply the non-REMOVED rule their fleet
72
+ // checks apply (fleet-shape.ts's used sets), so "participates" and "cites"
73
+ // cannot disagree about the same line.
74
+ const participates = {
75
+ requirements: reqs.length > 0,
76
+ arch: archReqs.length > 0,
77
+ openapi: existsSync(paths.openapi),
78
+ asyncapi: existsSync(paths.asyncapi),
79
+ permissions: [...living, ...archLiving].some((r) => r.requires.length > 0),
80
+ capabilities: [...living, ...archLiving].some((r) => r.capabilities.length > 0),
81
+ };
82
+ return {
83
+ operations: {
84
+ defined: ops.length,
85
+ governed: ops.filter((o) => governed.has(o.id)).length,
86
+ deprecated: deprecated.size,
87
+ deprecatedStillConsumed: [...deprecated].filter((id) => governed.has(id) || inbound.has(id)).length,
88
+ },
89
+ messages: {
90
+ defined: declared.length,
91
+ linked: declared.filter((name) => linked.has(name)).length,
92
+ },
93
+ // coversEntries already drops REMOVED requirements.
94
+ covers: coversEntries(archReqs),
95
+ participates,
96
+ };
97
+ }
98
+ //# sourceMappingURL=contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../../../src/commands/validate/fleet/scorecard/contracts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAoB,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAqB,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAqB,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAqB,MAAM,eAAe,CAAC;AAsBlD,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAiB,EACjB,KAAmB,EACnB,OAA4B;IAE5B,IAAI,CAAC;QACH,OAAO,MAAM,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAClD,CAAC;IAAC,MAAM,CAAC;QACP,2EAA2E;QAC3E,wEAAwE;QAC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AE,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;SACpG;QACD,QAAQ,EAAE;YACR,OAAO,EAAE,QAAQ,CAAC,MAAM;YACxB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM;SAC3D;QACD,oDAAoD;QACpD,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC;QAC/B,YAAY;KACb,CAAC;AACJ,CAAC","sourcesContent":["/**\n * One service's contract-axis contributions to the fleet scorecard: the HTTP\n * and event counts off its living documents, its arch `Covers:` entries for\n * the C4 census, and the per-axis adoption booleans (`participates`).\n * `./scorecard.js` sums these across the fleet; this module owns the\n * per-service reads and their containment, and never prints.\n */\nimport { existsSync } from \"node:fs\";\nimport { readAsyncapi } from \"../../../../core/asyncapi/read.js\";\nimport { type CoversEntry } from \"../../../../core/c4/arch.js\";\nimport { type FleetContext } from \"../../../../core/fleet-context.js\";\nimport { readOpenapi } from \"../../../../core/openapi/doc.js\";\nimport { type ServiceEntry } from \"../../../../core/repo/entries.js\";\nimport { servicePathsAt } from \"../../../../core/repo/paths.js\";\nimport { coversEntries } from \"../../checks/requirements.js\";\nimport { type AdoptionAxis } from \"./adoption.js\";\n\n/**\n * One service's contributions. Structurally identical to the `operations` and\n * `messages` sections of the Scorecard payload — spelled here rather than\n * imported from `./scorecard.js`, because that import would close a file\n * cycle with the module that sums these.\n */\nexport interface ContractCounts {\n operations: { defined: number; governed: number; deprecated: number; deprecatedStillConsumed: number };\n messages: { defined: number; linked: number };\n covers: CoversEntry[];\n /**\n * Whether THIS service has started each adoption axis — the per-service\n * booleans `adoptionOf` (./adoption.js) sums into the fleet's participation\n * counts. The six rules are spelled on `Scorecard.adoption` (./scorecard.js),\n * where the payload key freezes them; every input is a read this function\n * already pays for.\n */\n participates: Record<AdoptionAxis, boolean>;\n}\n\nexport async function contractCounts(\n svc: ServiceEntry,\n fleet: FleetContext,\n inbound: ReadonlySet<string>,\n): Promise<ContractCounts> {\n try {\n return await readContracts(svc, fleet, inbound);\n } catch {\n // `guarded`'s doctrine, one rollup down: these are the same memoized reads\n // this service's own target already failed on, and a memoized REJECTION\n // rejects again on every await — so a spec.md that is not UTF-8, or an\n // openapi.yaml that is a directory, deleted the whole fleet's card from\n // inside Promise.all. The service's `service.unreadable` finding names the\n // cause; here the one unreadable service contributes zeros and the\n // fleet's rollup survives. Participation is all-false the way the counts\n // are zero — NOT because the service started nothing (an unreadable\n // service proves nothing, least of all that), but because no claim can be\n // made; the text renderer therefore refuses to group warnings on any run\n // with an unreadable service (report.ts), since a false `false` here\n // could manufacture the fleet-wide N=0 that licenses suppression.\n return {\n operations: { defined: 0, governed: 0, deprecated: 0, deprecatedStillConsumed: 0 },\n messages: { defined: 0, linked: 0 },\n covers: [],\n participates: { requirements: false, arch: false, openapi: false, asyncapi: false, permissions: false, capabilities: false },\n };\n }\n}\n\nasync function readContracts(\n svc: ServiceEntry,\n fleet: FleetContext,\n inbound: ReadonlySet<string>,\n): Promise<ContractCounts> {\n const paths = servicePathsAt(svc.dir);\n const reqs = existsSync(paths.spec) ? await fleet.readRequirements(paths.spec) : [];\n const archReqs = existsSync(paths.archSpec) ? await fleet.readRequirements(paths.archSpec) : [];\n // The living rule the service target applies (service/specs.ts): a REMOVED\n // requirement is on its way out and governs nothing. Hoisted for BOTH\n // documents because the `linked` join and the participation booleans below\n // read the same non-REMOVED sets.\n const living = reqs.filter((r) => r.kind !== \"REMOVED\");\n const archLiving = archReqs.filter((r) => r.kind !== \"REMOVED\");\n\n const api = await readOpenapi(paths.openapi, fleet);\n // Removal markers are never callable operations (service/api.ts's liveOps\n // rule), and an unreadable contract defines nothing this census may count —\n // swallowing it into its parsed subset would grade a broken file as a thin one.\n const ops = api.unreadable ? [] : api.ops.filter((o) => !o.remove);\n const governed = new Set(living.flatMap((r) => r.operations));\n const deprecated = new Set(ops.filter((o) => o.deprecated).map((o) => o.id));\n\n const events = await readAsyncapi(paths.asyncapi, fleet);\n // Distinct names — every join on the event spine is by NAME, so a duplicate\n // slot is one message — and the governance join is requirement lines from\n // BOTH documents, never landscape edges: an edge is a claim about traffic,\n // a requirement is governance (service/events/events.ts).\n const declared = events.unreadable\n ? []\n : [...new Set(events.messages.filter((m) => m.remove !== true).map((m) => m.name))];\n const linked = new Set(\n [...living, ...archLiving].flatMap((r) => [...r.publishes, ...r.consumes]),\n );\n\n // The per-axis participation booleans, each the one-line rule the Scorecard\n // doc comment pins. Requirements/arch count ANY parsed block (REMOVED\n // included — a spec retiring its last requirement still started the axis),\n // while permissions/capabilities apply the non-REMOVED rule their fleet\n // checks apply (fleet-shape.ts's used sets), so \"participates\" and \"cites\"\n // cannot disagree about the same line.\n const participates: Record<AdoptionAxis, boolean> = {\n requirements: reqs.length > 0,\n arch: archReqs.length > 0,\n openapi: existsSync(paths.openapi),\n asyncapi: existsSync(paths.asyncapi),\n permissions: [...living, ...archLiving].some((r) => r.requires.length > 0),\n capabilities: [...living, ...archLiving].some((r) => r.capabilities.length > 0),\n };\n\n return {\n operations: {\n defined: ops.length,\n governed: ops.filter((o) => governed.has(o.id)).length,\n deprecated: deprecated.size,\n deprecatedStillConsumed: [...deprecated].filter((id) => governed.has(id) || inbound.has(id)).length,\n },\n messages: {\n defined: declared.length,\n linked: declared.filter((name) => linked.has(name)).length,\n },\n // coversEntries already drops REMOVED requirements.\n covers: coversEntries(archReqs),\n participates,\n };\n}\n"]}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The fleet scorecard's one table — how the `--all` text report renders what
3
+ * `./scorecard.js` derived. A module of its own for validate's own discipline
4
+ * (validate.ts's header: the checks produce findings and none of them print;
5
+ * printing happens after the last target is graded), and so the derivation
6
+ * and the formatting do not share a file whose one seam is exactly that.
7
+ *
8
+ * One line per axis, ceiling before actual, read left to right the way the
9
+ * numbers are read in a CI log — except the adoption row, which states
10
+ * participation over the denominator (`requirements 3/40`): adoption is an
11
+ * N-of-M spread, not a ceiling chased by an actual, and forcing it into the
12
+ * arrow idiom would read as one. It prints under `--errors-only` too, on
13
+ * purpose: like the summary footer it is a rollup, not a finding, and
14
+ * `--errors-only` is a findings-rendering lever (report.ts).
15
+ */
16
+ import { ARTIFACT_STATUSES } from "../../../../core/status/report.js";
17
+ import { ANSWERED_BY } from "../../../../core/verify/answers.js";
18
+ import { VERIFICATION_VERDICTS } from "../../../../core/verify/record.js";
19
+ import { MATURITY_LADDER } from "../../../../core/vocabulary/maturity.js";
20
+ import { ADOPTION_AXES } from "./adoption.js";
21
+ import {} from "./scorecard.js";
22
+ export function printScorecard(card) {
23
+ const { maturity, provenance: p, verification: v, operations: o, messages: m, c4, features: f } = card;
24
+ console.log("\nfleet scorecard (ceiling → actual)");
25
+ console.log(` services ${card.services} — ` +
26
+ MATURITY_LADDER.map((rung) => `${maturity[rung]} ${rung}`).join(" · "));
27
+ console.log(
28
+ // The sampled count rides INSIDE the vouched number rather than after it,
29
+ // because that is where it changes the reading: "120 vouched" and "120
30
+ // vouched (100 sampled)" are different fleets, and a reader who stops at
31
+ // the first number must not have been told the stronger of the two.
32
+ ` provenance ${p.vouched} vouched${p.sampledVouched > 0 ? ` (${p.sampledVouched} sampled)` : ""} — ` +
33
+ `${p.staleDigests} stale digest(s) · ${p.unverifiableFromHere} unverifiable from here`);
34
+ // The ceiling is the features axis's `active` — the payload deliberately
35
+ // carries that denominator once, so this line reads it from there.
36
+ console.log(` verification ${f.active} feature(s) → ${v.recorded} recorded — ` +
37
+ VERIFICATION_VERDICTS.map((verdict) => `${v.verdicts[verdict]} ${verdict}`).join(" · ") +
38
+ ` — claims ${v.claims.confirmed}/${v.claims.total} confirmed ` +
39
+ // Every provenance, under its own `answered_by` spelling and always all
40
+ // three — the same stable-shape rendering as the verdicts before it. Two
41
+ // buckets could not name what they held: the line said "runner" over
42
+ // claims no runner answered, and no label short of the real one fixes
43
+ // that, because `external-runner` is neither of the other two.
44
+ `(${ANSWERED_BY.map((who) => `${v.claims.answered[who]} ${who}`).join(" · ")})`);
45
+ console.log(` operations ${o.defined} defined → ${o.governed} governed · ` +
46
+ `${o.deprecated} deprecated (${o.deprecatedStillConsumed} still consumed)`);
47
+ console.log(` messages ${m.defined} defined → ${m.linked} linked`);
48
+ console.log(` c4 ${c4.elements} elements → ${c4.covered} covered`);
49
+ // Participation per axis over the one denominator, then the same facts as
50
+ // the sentence a standup reads out: which axes the fleet has started at
51
+ // all. "adopted" here means at least one participating service — the
52
+ // per-axis counts on the line above say how many.
53
+ const a = card.adoption;
54
+ console.log(` adoption ` +
55
+ ADOPTION_AXES.map((axis) => `${axis} ${a[axis]}/${card.services}`).join(" · "));
56
+ const adopted = ADOPTION_AXES.filter((axis) => a[axis] > 0);
57
+ const notStarted = ADOPTION_AXES.filter((axis) => a[axis] === 0);
58
+ console.log(` axes adopted: ${adopted.length === 0 ? "none" : adopted.join(", ")}` +
59
+ (notStarted.length === 0 ? "" : ` · not started: ${notStarted.join(", ")}`));
60
+ console.log(` features ${f.active} active — ` +
61
+ ARTIFACT_STATUSES.map((stage) => `${f.stages[stage]} ${stage}`).join(" · "));
62
+ }
63
+ //# sourceMappingURL=print.js.map