@ybotok/loam 0.2.0-alpha.1 → 0.2.0-alpha.13
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.
- package/CHANGELOG.md +3448 -0
- package/COMPARISON.md +91 -3
- package/CONTRIBUTING.md +37 -0
- package/MIGRATING-from-OpenSpec.md +47 -23
- package/QUICKSTART.md +189 -12
- package/README.md +274 -65
- package/ROADMAP.md +572 -31
- package/SCHEMA.md +1709 -155
- package/WORKFLOW.md +298 -72
- package/dist/cli.js +26 -8
- package/dist/cli.js.map +1 -1
- package/dist/commands/adopt/adopt.js +5 -10
- package/dist/commands/adopt/adopt.js.map +1 -1
- package/dist/commands/adopt/render.js +50 -9
- package/dist/commands/adopt/render.js.map +1 -1
- package/dist/commands/archive/archive.js +16 -19
- package/dist/commands/archive/archive.js.map +1 -1
- package/dist/commands/archive/closing.js +42 -0
- package/dist/commands/archive/closing.js.map +1 -0
- package/dist/commands/archive/plan/contracts/asyncapi.js +36 -42
- package/dist/commands/archive/plan/contracts/asyncapi.js.map +1 -1
- package/dist/commands/archive/plan/contracts/consumers.js +56 -0
- package/dist/commands/archive/plan/contracts/consumers.js.map +1 -0
- package/dist/commands/archive/plan/contracts/openapi.js +77 -43
- package/dist/commands/archive/plan/contracts/openapi.js.map +1 -1
- package/dist/commands/archive/plan/contracts/verdict-lines.js +103 -0
- package/dist/commands/archive/plan/contracts/verdict-lines.js.map +1 -0
- package/dist/commands/archive/plan/document/head.js +151 -0
- package/dist/commands/archive/plan/document/head.js.map +1 -0
- package/dist/commands/archive/plan/document/links.js +284 -0
- package/dist/commands/archive/plan/document/links.js.map +1 -0
- package/dist/commands/archive/plan/document/run.js +136 -0
- package/dist/commands/archive/plan/document/run.js.map +1 -0
- package/dist/commands/archive/plan/gate.js +21 -19
- package/dist/commands/archive/plan/gate.js.map +1 -1
- package/dist/commands/archive/plan/landscape.js +167 -30
- package/dist/commands/archive/plan/landscape.js.map +1 -1
- package/dist/commands/archive/plan/model/extending.js +85 -0
- package/dist/commands/archive/plan/model/extending.js.map +1 -0
- package/dist/commands/archive/plan/refusal.js +14 -19
- package/dist/commands/archive/plan/refusal.js.map +1 -1
- package/dist/commands/archive/plan/specs.js +137 -56
- package/dist/commands/archive/plan/specs.js.map +1 -1
- package/dist/commands/archive/plan/state.js +3 -0
- package/dist/commands/archive/plan/state.js.map +1 -1
- package/dist/commands/archive/run.js +134 -30
- package/dist/commands/archive/run.js.map +1 -1
- package/dist/commands/archive/shipped.js +49 -0
- package/dist/commands/archive/shipped.js.map +1 -0
- package/dist/commands/context/context.js +85 -18
- package/dist/commands/context/context.js.map +1 -1
- package/dist/commands/context/print.js +29 -7
- package/dist/commands/context/print.js.map +1 -1
- package/dist/commands/delta/delta.js +102 -14
- package/dist/commands/delta/delta.js.map +1 -1
- package/dist/commands/delta/print.js +17 -1
- package/dist/commands/delta/print.js.map +1 -1
- package/dist/commands/dependencies.js +3 -7
- package/dist/commands/dependencies.js.map +1 -1
- package/dist/commands/diff/diff.js +20 -27
- package/dist/commands/diff/diff.js.map +1 -1
- package/dist/commands/doctor.js +60 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/explain/explain.js +89 -13
- package/dist/commands/explain/explain.js.map +1 -1
- package/dist/commands/explore.js +16 -10
- package/dist/commands/explore.js.map +1 -1
- package/dist/commands/gate/gate.js +45 -8
- package/dist/commands/gate/gate.js.map +1 -1
- package/dist/commands/gate/print.js +15 -3
- package/dist/commands/gate/print.js.map +1 -1
- package/dist/commands/gherkin/commit.js +13 -54
- package/dist/commands/gherkin/commit.js.map +1 -1
- package/dist/commands/gherkin/gherkin.js +36 -20
- package/dist/commands/gherkin/gherkin.js.map +1 -1
- package/dist/commands/gherkin/reconcile.js +10 -13
- package/dist/commands/gherkin/reconcile.js.map +1 -1
- package/dist/commands/init/first-hour.js +44 -0
- package/dist/commands/init/first-hour.js.map +1 -1
- package/dist/commands/init/init.js +18 -22
- package/dist/commands/init/init.js.map +1 -1
- package/dist/commands/list/campaign/campaign.js +4 -6
- package/dist/commands/list/campaign/campaign.js.map +1 -1
- package/dist/commands/list/json.js +5 -7
- package/dist/commands/list/json.js.map +1 -1
- package/dist/commands/list/list.js +44 -29
- package/dist/commands/list/list.js.map +1 -1
- package/dist/commands/list/print.js +52 -9
- package/dist/commands/list/print.js.map +1 -1
- package/dist/commands/list/suites/suites.js +140 -0
- package/dist/commands/list/suites/suites.js.map +1 -0
- package/dist/commands/list/views.js +37 -34
- package/dist/commands/list/views.js.map +1 -1
- package/dist/commands/mcp/dispatch.js +91 -36
- package/dist/commands/mcp/dispatch.js.map +1 -1
- package/dist/commands/mcp/mcp.js +56 -15
- package/dist/commands/mcp/mcp.js.map +1 -1
- package/dist/commands/mcp/serve.js.map +1 -1
- package/dist/commands/migrate-openspec/materialize/active.js +27 -22
- package/dist/commands/migrate-openspec/materialize/active.js.map +1 -1
- package/dist/commands/migrate-openspec/materialize/stage.js +4 -3
- package/dist/commands/migrate-openspec/materialize/stage.js.map +1 -1
- package/dist/commands/migrate-openspec/materialize/target.js +2 -2
- package/dist/commands/migrate-openspec/materialize/target.js.map +1 -1
- package/dist/commands/migrate-openspec/openspec/decisions.js +9 -14
- package/dist/commands/migrate-openspec/openspec/decisions.js.map +1 -1
- package/dist/commands/migrate-openspec/openspec/error.js +7 -8
- package/dist/commands/migrate-openspec/openspec/error.js.map +1 -1
- package/dist/commands/migrate-openspec/openspec/mapping.js +1 -9
- package/dist/commands/migrate-openspec/openspec/mapping.js.map +1 -1
- package/dist/commands/migrate-openspec/openspec/paths.js +3 -6
- package/dist/commands/migrate-openspec/openspec/paths.js.map +1 -1
- package/dist/commands/new/capability-template.js +118 -0
- package/dist/commands/new/capability-template.js.map +1 -0
- package/dist/commands/new/commit.js +8 -22
- package/dist/commands/new/commit.js.map +1 -1
- package/dist/commands/new/modifies.js +206 -0
- package/dist/commands/new/modifies.js.map +1 -0
- package/dist/commands/new/new.js +59 -14
- package/dist/commands/new/new.js.map +1 -1
- package/dist/commands/new/templates.js +48 -124
- package/dist/commands/new/templates.js.map +1 -1
- package/dist/commands/open.js +3 -7
- package/dist/commands/open.js.map +1 -1
- package/dist/commands/policy/gate.js +27 -0
- package/dist/commands/policy/gate.js.map +1 -1
- package/dist/commands/rebase/plan.js +2 -2
- package/dist/commands/rebase/plan.js.map +1 -1
- package/dist/commands/rebase/rebase.js +60 -35
- package/dist/commands/rebase/rebase.js.map +1 -1
- package/dist/commands/seed/commit.js +55 -26
- package/dist/commands/seed/commit.js.map +1 -1
- package/dist/commands/seed/plan.js +158 -13
- package/dist/commands/seed/plan.js.map +1 -1
- package/dist/commands/seed/seed.js +13 -11
- package/dist/commands/seed/seed.js.map +1 -1
- package/dist/commands/show/feature.js +9 -5
- package/dist/commands/show/feature.js.map +1 -1
- package/dist/commands/show/introduced.js +157 -0
- package/dist/commands/show/introduced.js.map +1 -0
- package/dist/commands/show/marks.js +35 -6
- package/dist/commands/show/marks.js.map +1 -1
- package/dist/commands/show/service.js +41 -33
- package/dist/commands/show/service.js.map +1 -1
- package/dist/commands/show/show.js +17 -7
- package/dist/commands/show/show.js.map +1 -1
- package/dist/commands/status/fleet-next.js +90 -0
- package/dist/commands/status/fleet-next.js.map +1 -0
- package/dist/commands/status/json.js +2 -0
- package/dist/commands/status/json.js.map +1 -1
- package/dist/commands/status/print.js +89 -37
- package/dist/commands/status/print.js.map +1 -1
- package/dist/commands/status/status.js +3 -7
- package/dist/commands/status/status.js.map +1 -1
- package/dist/commands/steps/steps.js +103 -23
- package/dist/commands/steps/steps.js.map +1 -1
- package/dist/commands/subsystem/edit.js +7 -7
- package/dist/commands/subsystem/edit.js.map +1 -1
- package/dist/commands/subsystem/move.js +106 -46
- package/dist/commands/subsystem/move.js.map +1 -1
- package/dist/commands/subsystem/query.js +2 -4
- package/dist/commands/subsystem/query.js.map +1 -1
- package/dist/commands/subsystem/subsystem.js +4 -7
- package/dist/commands/subsystem/subsystem.js.map +1 -1
- package/dist/commands/subsystem/sync.js +289 -74
- package/dist/commands/subsystem/sync.js.map +1 -1
- package/dist/commands/subsystem/txn/exclude.js +132 -0
- package/dist/commands/subsystem/txn/exclude.js.map +1 -0
- package/dist/commands/subsystem/txn/links.js +128 -0
- package/dist/commands/subsystem/txn/links.js.map +1 -0
- package/dist/commands/subsystem/txn/report.js +174 -0
- package/dist/commands/subsystem/txn/report.js.map +1 -0
- package/dist/commands/subsystem/txn/txn.js +147 -45
- package/dist/commands/subsystem/txn/txn.js.map +1 -1
- package/dist/commands/subsystem/txn/views.js +200 -21
- package/dist/commands/subsystem/txn/views.js.map +1 -1
- package/dist/commands/tasks/actions.js +107 -0
- package/dist/commands/tasks/actions.js.map +1 -0
- package/dist/commands/tasks/render.js +253 -0
- package/dist/commands/tasks/render.js.map +1 -0
- package/dist/commands/tasks/tasks.js +119 -0
- package/dist/commands/tasks/tasks.js.map +1 -0
- package/dist/commands/unarchive/manifest.js +42 -26
- package/dist/commands/unarchive/manifest.js.map +1 -1
- package/dist/commands/unarchive/restore.js +83 -33
- package/dist/commands/unarchive/restore.js.map +1 -1
- package/dist/commands/unarchive/unarchive.js +22 -30
- package/dist/commands/unarchive/unarchive.js.map +1 -1
- package/dist/commands/validate/arch-coverage.js +78 -27
- package/dist/commands/validate/arch-coverage.js.map +1 -1
- package/dist/commands/validate/checks/fleet-shape.js +34 -126
- package/dist/commands/validate/checks/fleet-shape.js.map +1 -1
- package/dist/commands/validate/checks/health-deps.js +9 -6
- package/dist/commands/validate/checks/health-deps.js.map +1 -1
- package/dist/commands/validate/checks/introduced.js +102 -0
- package/dist/commands/validate/checks/introduced.js.map +1 -0
- package/dist/commands/validate/checks/requirements.js +18 -8
- package/dist/commands/validate/checks/requirements.js.map +1 -1
- package/dist/commands/validate/checks/sources.js +11 -2
- package/dist/commands/validate/checks/sources.js.map +1 -1
- package/dist/commands/validate/coverage/covers-after.js +105 -0
- package/dist/commands/validate/coverage/covers-after.js.map +1 -0
- package/dist/commands/validate/feature.js +26 -20
- package/dist/commands/validate/feature.js.map +1 -1
- package/dist/commands/validate/fleet/census.js +37 -13
- package/dist/commands/validate/fleet/census.js.map +1 -1
- package/dist/commands/validate/fleet/landscape.js +144 -126
- package/dist/commands/validate/fleet/landscape.js.map +1 -1
- package/dist/commands/validate/fleet/load.js +66 -0
- package/dist/commands/validate/fleet/load.js.map +1 -1
- package/dist/commands/validate/fleet/map/attest.js +98 -0
- package/dist/commands/validate/fleet/map/attest.js.map +1 -0
- package/dist/commands/validate/fleet/map/bindings.js +107 -0
- package/dist/commands/validate/fleet/map/bindings.js.map +1 -0
- package/dist/commands/validate/fleet/map/consumers.js +244 -0
- package/dist/commands/validate/fleet/map/consumers.js.map +1 -0
- package/dist/commands/validate/fleet/map/isolation.js +116 -0
- package/dist/commands/validate/fleet/map/isolation.js.map +1 -0
- package/dist/commands/validate/fleet/map/usecases.js +54 -0
- package/dist/commands/validate/fleet/map/usecases.js.map +1 -0
- package/dist/commands/validate/fleet/obligations.js +44 -14
- package/dist/commands/validate/fleet/obligations.js.map +1 -1
- package/dist/commands/validate/fleet/scorecard/print.js +10 -2
- package/dist/commands/validate/fleet/scorecard/print.js.map +1 -1
- package/dist/commands/validate/fleet/scorecard/scorecard.js +17 -11
- package/dist/commands/validate/fleet/scorecard/scorecard.js.map +1 -1
- package/dist/commands/validate/fleet/usecases/place.js.map +1 -1
- package/dist/commands/validate/fleet/views/fleet-project.js +217 -0
- package/dist/commands/validate/fleet/views/fleet-project.js.map +1 -0
- package/dist/commands/validate/fleet/views/ids.js +50 -15
- package/dist/commands/validate/fleet/views/ids.js.map +1 -1
- package/dist/commands/validate/fleet/views/projects.js +278 -0
- package/dist/commands/validate/fleet/views/projects.js.map +1 -0
- package/dist/commands/validate/fleet/views/root-documents.js +83 -0
- package/dist/commands/validate/fleet/views/root-documents.js.map +1 -0
- package/dist/commands/validate/fleet/views/stale.js +40 -47
- package/dist/commands/validate/fleet/views/stale.js.map +1 -1
- package/dist/commands/validate/links/corpus.js +1 -4
- package/dist/commands/validate/links/corpus.js.map +1 -1
- package/dist/commands/validate/links/glossary.js.map +1 -1
- package/dist/commands/validate/render/repeats.js +63 -0
- package/dist/commands/validate/render/repeats.js.map +1 -0
- package/dist/commands/validate/render/rollups.js +115 -0
- package/dist/commands/validate/render/rollups.js.map +1 -0
- package/dist/commands/validate/render/text.js +199 -0
- package/dist/commands/validate/render/text.js.map +1 -0
- package/dist/commands/validate/report.js +36 -160
- package/dist/commands/validate/report.js.map +1 -1
- package/dist/commands/validate/scope.js +113 -0
- package/dist/commands/validate/scope.js.map +1 -0
- package/dist/commands/validate/service/api.js +21 -107
- package/dist/commands/validate/service/api.js.map +1 -1
- package/dist/commands/validate/service/contracts/generated.js +134 -0
- package/dist/commands/validate/service/contracts/generated.js.map +1 -0
- package/dist/commands/validate/service/events/events.js +36 -14
- package/dist/commands/validate/service/events/events.js.map +1 -1
- package/dist/commands/validate/service/events/message-producers.js +1 -1
- package/dist/commands/validate/service/events/message-producers.js.map +1 -1
- package/dist/commands/validate/service/evidence-pins.js +56 -10
- package/dist/commands/validate/service/evidence-pins.js.map +1 -1
- package/dist/commands/validate/service/model/diverged.js +226 -0
- package/dist/commands/validate/service/model/diverged.js.map +1 -0
- package/dist/commands/validate/service/model/grade.js +163 -0
- package/dist/commands/validate/service/model/grade.js.map +1 -0
- package/dist/commands/validate/service/service.js +121 -61
- package/dist/commands/validate/service/service.js.map +1 -1
- package/dist/commands/validate/service/specs.js +88 -28
- package/dist/commands/validate/service/specs.js.map +1 -1
- package/dist/commands/validate/service/spine.js +38 -3
- package/dist/commands/validate/service/spine.js.map +1 -1
- package/dist/commands/validate/service/usecases/tags.js +113 -0
- package/dist/commands/validate/service/usecases/tags.js.map +1 -0
- package/dist/commands/validate/service/usecases/usecases.js +209 -0
- package/dist/commands/validate/service/usecases/usecases.js.map +1 -0
- package/dist/commands/validate/validate.js +85 -60
- package/dist/commands/validate/validate.js.map +1 -1
- package/dist/commands/verify/cross/diff.js +2 -6
- package/dist/commands/verify/cross/diff.js.map +1 -1
- package/dist/commands/verify/evidence/contract.js +1 -1
- package/dist/commands/verify/evidence/contract.js.map +1 -1
- package/dist/commands/verify/evidence/read.js +12 -3
- package/dist/commands/verify/evidence/read.js.map +1 -1
- package/dist/commands/verify/frozen.js +45 -23
- package/dist/commands/verify/frozen.js.map +1 -1
- package/dist/commands/verify/record.js +69 -17
- package/dist/commands/verify/record.js.map +1 -1
- package/dist/commands/verify/report.js +27 -44
- package/dist/commands/verify/report.js.map +1 -1
- package/dist/commands/verify/results.js +112 -30
- package/dist/commands/verify/results.js.map +1 -1
- package/dist/commands/verify/verify.js +55 -52
- package/dist/commands/verify/verify.js.map +1 -1
- package/dist/commands/vouch/pack/pack.js +2 -2
- package/dist/commands/vouch/pack/pack.js.map +1 -1
- package/dist/commands/vouch/pack/print.js +1 -6
- package/dist/commands/vouch/pack/print.js.map +1 -1
- package/dist/commands/vouch/pack/sections.js +1 -2
- package/dist/commands/vouch/pack/sections.js.map +1 -1
- package/dist/commands/vouch/run.js +26 -81
- package/dist/commands/vouch/run.js.map +1 -1
- package/dist/commands/vouch/sample/plan.js +20 -34
- package/dist/commands/vouch/sample/plan.js.map +1 -1
- package/dist/commands/vouch/vet/verify.js +39 -7
- package/dist/commands/vouch/vet/verify.js.map +1 -1
- package/dist/commands/vouch/vouch.js +10 -17
- package/dist/commands/vouch/vouch.js.map +1 -1
- package/dist/core/agent/agents-md/command-map.js +81 -106
- package/dist/core/agent/agents-md/command-map.js.map +1 -1
- package/dist/core/agent/agents-md/map/explain.js +21 -9
- package/dist/core/agent/agents-md/map/explain.js.map +1 -1
- package/dist/core/agent/agents-md/map/lenses/context.js +17 -8
- package/dist/core/agent/agents-md/map/lenses/context.js.map +1 -1
- package/dist/core/agent/agents-md/map/lenses/diff.js +33 -20
- package/dist/core/agent/agents-md/map/lenses/diff.js.map +1 -1
- package/dist/core/agent/agents-md/map/lenses/gate.js +13 -5
- package/dist/core/agent/agents-md/map/lenses/gate.js.map +1 -1
- package/dist/core/agent/agents-md/map/mcp.js +10 -7
- package/dist/core/agent/agents-md/map/mcp.js.map +1 -1
- package/dist/core/agent/agents-md/map/status.js +24 -8
- package/dist/core/agent/agents-md/map/status.js.map +1 -1
- package/dist/core/agent/agents-md/map/subsystem.js +80 -8
- package/dist/core/agent/agents-md/map/subsystem.js.map +1 -1
- package/dist/core/agent/agents-md/map/usecases.js +88 -10
- package/dist/core/agent/agents-md/map/usecases.js.map +1 -1
- package/dist/core/agent/agents-md/refusals.js +49 -22
- package/dist/core/agent/agents-md/refusals.js.map +1 -1
- package/dist/core/agent/agents-md.js +39 -6
- package/dist/core/agent/agents-md.js.map +1 -1
- package/dist/core/agent/agents-stamp.js +10 -0
- package/dist/core/agent/agents-stamp.js.map +1 -1
- package/dist/core/agent/protocol.js +1 -1
- package/dist/core/agent/protocol.js.map +1 -1
- package/dist/core/agent/scaffold.js +10 -15
- package/dist/core/agent/scaffold.js.map +1 -1
- package/dist/core/agent/support/report.js +46 -5
- package/dist/core/agent/support/report.js.map +1 -1
- package/dist/core/agent/tools/dialects.js +1 -0
- package/dist/core/agent/tools/dialects.js.map +1 -1
- package/dist/core/agent/tools/registry.js +41 -76
- package/dist/core/agent/tools/registry.js.map +1 -1
- package/dist/core/agent/workflows/adopt.js +158 -11
- package/dist/core/agent/workflows/adopt.js.map +1 -1
- package/dist/core/agent/workflows/check.js +78 -39
- package/dist/core/agent/workflows/check.js.map +1 -1
- package/dist/core/agent/workflows/closing.js +88 -27
- package/dist/core/agent/workflows/closing.js.map +1 -1
- package/dist/core/agent/workflows/feature.js +128 -13
- package/dist/core/agent/workflows/feature.js.map +1 -1
- package/dist/core/agent/workflows/implement.js +96 -13
- package/dist/core/agent/workflows/implement.js.map +1 -1
- package/dist/core/agent/workflows/reference/authoring.js +106 -4
- package/dist/core/agent/workflows/reference/authoring.js.map +1 -1
- package/dist/core/agent/workflows/reference/codes.js +8 -6
- package/dist/core/agent/workflows/reference/codes.js.map +1 -1
- package/dist/core/agent/workflows/reference/done-check.js +37 -15
- package/dist/core/agent/workflows/reference/done-check.js.map +1 -1
- package/dist/core/agent/workflows/reference/drawing/drawing.js +253 -0
- package/dist/core/agent/workflows/reference/drawing/drawing.js.map +1 -0
- package/dist/core/agent/workflows/reference/reference.js +6 -3
- package/dist/core/agent/workflows/reference/reference.js.map +1 -1
- package/dist/core/agent/workflows/reference/spine.js +68 -27
- package/dist/core/agent/workflows/reference/spine.js.map +1 -1
- package/dist/core/asyncapi/baseline/plan.js +14 -81
- package/dist/core/asyncapi/baseline/plan.js.map +1 -1
- package/dist/core/asyncapi/digest.js +30 -25
- package/dist/core/asyncapi/digest.js.map +1 -1
- package/dist/core/asyncapi/merge/components.js +5 -4
- package/dist/core/asyncapi/merge/components.js.map +1 -1
- package/dist/core/asyncapi/merge/error.js +7 -2
- package/dist/core/asyncapi/merge/error.js.map +1 -1
- package/dist/core/asyncapi/merge/markers.js +32 -50
- package/dist/core/asyncapi/merge/markers.js.map +1 -1
- package/dist/core/asyncapi/merge/merge.js +33 -53
- package/dist/core/asyncapi/merge/merge.js.map +1 -1
- package/dist/core/asyncapi/merge/pin.js +12 -36
- package/dist/core/asyncapi/merge/pin.js.map +1 -1
- package/dist/core/asyncapi/model.js.map +1 -1
- package/dist/core/asyncapi/read.js +36 -12
- package/dist/core/asyncapi/read.js.map +1 -1
- package/dist/core/brief/brief.js +96 -36
- package/dist/core/brief/brief.js.map +1 -1
- package/dist/core/brief/checks.js +138 -3
- package/dist/core/brief/checks.js.map +1 -1
- package/dist/core/brief/landscape.js +209 -130
- package/dist/core/brief/landscape.js.map +1 -1
- package/dist/core/brief/map/extend.js +84 -0
- package/dist/core/brief/map/extend.js.map +1 -0
- package/dist/core/brief/map/owed.js +266 -0
- package/dist/core/brief/map/owed.js.map +1 -0
- package/dist/core/brief/targets.js +109 -31
- package/dist/core/brief/targets.js.map +1 -1
- package/dist/core/brief/unchecked.js +14 -3
- package/dist/core/brief/unchecked.js.map +1 -1
- package/dist/core/c4/arch.js +90 -182
- package/dist/core/c4/arch.js.map +1 -1
- package/dist/core/c4/direction/direction.js +114 -0
- package/dist/core/c4/direction/direction.js.map +1 -0
- package/dist/core/c4/likec4.js +169 -14
- package/dist/core/c4/likec4.js.map +1 -1
- package/dist/core/c4/locate/unlocated.js +150 -0
- package/dist/core/c4/locate/unlocated.js.map +1 -0
- package/dist/core/c4/parsed/deployment.js +160 -0
- package/dist/core/c4/parsed/deployment.js.map +1 -0
- package/dist/core/c4/parsed/dynamic-views.js.map +1 -1
- package/dist/core/c4/parsed/values.js +54 -1
- package/dist/core/c4/parsed/values.js.map +1 -1
- package/dist/core/c4/parsed/view-ids.js +39 -1
- package/dist/core/c4/parsed/view-ids.js.map +1 -1
- package/dist/core/c4/prefetch/fleet.js +134 -0
- package/dist/core/c4/prefetch/fleet.js.map +1 -0
- package/dist/core/c4/project/architecture.js +123 -7
- package/dist/core/c4/project/architecture.js.map +1 -1
- package/dist/core/c4/project/batch.js +140 -0
- package/dist/core/c4/project/batch.js.map +1 -0
- package/dist/core/c4/project/documents.js +43 -12
- package/dist/core/c4/project/documents.js.map +1 -1
- package/dist/core/c4/project/load.js +79 -43
- package/dist/core/c4/project/load.js.map +1 -1
- package/dist/core/c4/project/staged.js +277 -0
- package/dist/core/c4/project/staged.js.map +1 -0
- package/dist/core/c4/resolve/attested.js +0 -0
- package/dist/core/c4/resolve/attested.js.map +1 -0
- package/dist/core/c4/resolve/external.js +51 -0
- package/dist/core/c4/resolve/external.js.map +1 -0
- package/dist/core/c4/resolve/service.js +78 -17
- package/dist/core/c4/resolve/service.js.map +1 -1
- package/dist/core/c4/resolve/steps.js +290 -0
- package/dist/core/c4/resolve/steps.js.map +1 -0
- package/dist/core/c4/resolve/systems.js +154 -0
- package/dist/core/c4/resolve/systems.js.map +1 -0
- package/dist/core/c4/root-project/exclude.js +352 -0
- package/dist/core/c4/root-project/exclude.js.map +1 -0
- package/dist/core/c4/seed/template.js +65 -1
- package/dist/core/c4/seed/template.js.map +1 -1
- package/dist/core/c4/service-model/created/models.js +96 -0
- package/dist/core/c4/service-model/created/models.js.map +1 -0
- package/dist/core/c4/service-model/documents.js +47 -0
- package/dist/core/c4/service-model/documents.js.map +1 -0
- package/dist/core/c4/service-model/fleet/extending.js +82 -0
- package/dist/core/c4/service-model/fleet/extending.js.map +1 -0
- package/dist/core/c4/service-model/load.js +165 -0
- package/dist/core/c4/service-model/load.js.map +1 -0
- package/dist/core/c4/service-model/renderer.js +128 -0
- package/dist/core/c4/service-model/renderer.js.map +1 -0
- package/dist/core/c4/service-model/shape.js +106 -0
- package/dist/core/c4/service-model/shape.js.map +1 -0
- package/dist/core/c4/service-model/slice.js +188 -0
- package/dist/core/c4/service-model/slice.js.map +1 -0
- package/dist/core/c4/source-mask.js +297 -10
- package/dist/core/c4/source-mask.js.map +1 -1
- package/dist/core/c4/source-scan.js +222 -141
- package/dist/core/c4/source-scan.js.map +1 -1
- package/dist/core/c4/splice/authored-source.js +79 -13
- package/dist/core/c4/splice/authored-source.js.map +1 -1
- package/dist/core/c4/splice/contract.js +20 -0
- package/dist/core/c4/splice/contract.js.map +1 -1
- package/dist/core/c4/splice/delta-blocks.js +20 -20
- package/dist/core/c4/splice/delta-blocks.js.map +1 -1
- package/dist/core/c4/splice/identity/declared.js +87 -0
- package/dist/core/c4/splice/identity/declared.js.map +1 -0
- package/dist/core/c4/splice/identity/edges.js +37 -0
- package/dist/core/c4/splice/identity/edges.js.map +1 -1
- package/dist/core/c4/splice/identity/existing.js +80 -0
- package/dist/core/c4/splice/identity/existing.js.map +1 -0
- package/dist/core/c4/splice/identity/interior.js +80 -0
- package/dist/core/c4/splice/identity/interior.js.map +1 -0
- package/dist/core/c4/splice/identity/owner.js +50 -0
- package/dist/core/c4/splice/identity/owner.js.map +1 -0
- package/dist/core/c4/splice/landscape-merge.js +182 -114
- package/dist/core/c4/splice/landscape-merge.js.map +1 -1
- package/dist/core/c4/splice/model/merge.js +151 -0
- package/dist/core/c4/splice/model/merge.js.map +1 -0
- package/dist/core/c4/splice/placement.js +160 -56
- package/dist/core/c4/splice/placement.js.map +1 -1
- package/dist/core/c4/splice/text/spot.js +131 -0
- package/dist/core/c4/splice/text/spot.js.map +1 -0
- package/dist/core/c4/workspace.js +13 -19
- package/dist/core/c4/workspace.js.map +1 -1
- package/dist/core/capabilities/capabilities.js +6 -6
- package/dist/core/capabilities/capabilities.js.map +1 -1
- package/dist/core/capabilities/delta/doc.js +7 -10
- package/dist/core/capabilities/delta/doc.js.map +1 -1
- package/dist/core/capabilities/delta/uncovered.js +2 -2
- package/dist/core/capabilities/delta/uncovered.js.map +1 -1
- package/dist/core/capabilities/findings.js +18 -22
- package/dist/core/capabilities/findings.js.map +1 -1
- package/dist/core/capabilities/realizes/findings.js +12 -19
- package/dist/core/capabilities/realizes/findings.js.map +1 -1
- package/dist/core/capabilities/realizes/join.js +0 -20
- package/dist/core/capabilities/realizes/join.js.map +1 -1
- package/dist/core/capabilities/rollup.js +6 -0
- package/dist/core/capabilities/rollup.js.map +1 -1
- package/dist/core/capabilities/tree.js +6 -28
- package/dist/core/capabilities/tree.js.map +1 -1
- package/dist/core/capabilities/usecase-join.js +3 -13
- package/dist/core/capabilities/usecase-join.js.map +1 -1
- package/dist/core/coherence/authoring/scaffold.js +11 -3
- package/dist/core/coherence/authoring/scaffold.js.map +1 -1
- package/dist/core/coherence/authoring/sentinels.js +2 -1
- package/dist/core/coherence/authoring/sentinels.js.map +1 -1
- package/dist/core/coherence/calls/called.js +52 -0
- package/dist/core/coherence/calls/called.js.map +1 -0
- package/dist/core/coherence/coherence.js +103 -22
- package/dist/core/coherence/coherence.js.map +1 -1
- package/dist/core/coherence/consumed/operations.js +70 -0
- package/dist/core/coherence/consumed/operations.js.map +1 -0
- package/dist/core/coherence/consumed/refusal.js +38 -0
- package/dist/core/coherence/consumed/refusal.js.map +1 -0
- package/dist/core/coherence/covers/health.js +85 -0
- package/dist/core/coherence/covers/health.js.map +1 -0
- package/dist/core/coherence/declared.js +60 -34
- package/dist/core/coherence/declared.js.map +1 -1
- package/dist/core/coherence/events/declared.js +44 -59
- package/dist/core/coherence/events/declared.js.map +1 -1
- package/dist/core/coherence/events/events.js +147 -16
- package/dist/core/coherence/events/events.js.map +1 -1
- package/dist/core/coherence/events/grades.js +31 -8
- package/dist/core/coherence/events/grades.js.map +1 -1
- package/dist/core/coherence/events/lookups.js +28 -87
- package/dist/core/coherence/events/lookups.js.map +1 -1
- package/dist/core/coherence/events/produced.js +100 -0
- package/dist/core/coherence/events/produced.js.map +1 -0
- package/dist/core/coherence/lookups.js +18 -78
- package/dist/core/coherence/lookups.js.map +1 -1
- package/dist/core/coherence/retired/archived.js +285 -0
- package/dist/core/coherence/retired/archived.js.map +1 -0
- package/dist/core/coherence/retired/event-pair.js +62 -0
- package/dist/core/coherence/retired/event-pair.js.map +1 -0
- package/dist/core/coherence/retired/merged.js +79 -0
- package/dist/core/coherence/retired/merged.js.map +1 -0
- package/dist/core/coherence/retired/retirement.js +49 -0
- package/dist/core/coherence/retired/retirement.js.map +1 -0
- package/dist/core/coherence/retired/revival/arrivals.js +131 -0
- package/dist/core/coherence/retired/revival/arrivals.js.map +1 -0
- package/dist/core/coherence/retired/revival/revived.js +297 -0
- package/dist/core/coherence/retired/revival/revived.js.map +1 -0
- package/dist/core/consumers/after.js +113 -0
- package/dist/core/consumers/after.js.map +1 -0
- package/dist/core/consumers/consumers.js +296 -0
- package/dist/core/consumers/consumers.js.map +1 -0
- package/dist/core/consumers/current.js +211 -0
- package/dist/core/consumers/current.js.map +1 -0
- package/dist/core/consumers/scan.js +46 -0
- package/dist/core/consumers/scan.js.map +1 -0
- package/dist/core/consumers/state.js +27 -0
- package/dist/core/consumers/state.js.map +1 -0
- package/dist/core/delta/delta.js +51 -6
- package/dist/core/delta/delta.js.map +1 -1
- package/dist/core/dependencies/fanin.js +2 -2
- package/dist/core/dependencies/fanin.js.map +1 -1
- package/dist/core/deployment/delta.js +191 -0
- package/dist/core/deployment/delta.js.map +1 -0
- package/dist/core/deployment/objects.js +145 -0
- package/dist/core/deployment/objects.js.map +1 -0
- package/dist/core/diff/base-git.js +94 -12
- package/dist/core/diff/base-git.js.map +1 -1
- package/dist/core/diff/base-state.js +49 -21
- package/dist/core/diff/base-state.js.map +1 -1
- package/dist/core/diff/joins.js +136 -0
- package/dist/core/diff/joins.js.map +1 -0
- package/dist/core/diff/scope/changed-paths.js +22 -6
- package/dist/core/diff/scope/changed-paths.js.map +1 -1
- package/dist/core/diff/scope/edges.js +82 -0
- package/dist/core/diff/scope/edges.js.map +1 -0
- package/dist/core/diff/semantic.js +100 -31
- package/dist/core/diff/semantic.js.map +1 -1
- package/dist/core/docs.js +31 -22
- package/dist/core/docs.js.map +1 -1
- package/dist/core/doctor/agents.js +34 -18
- package/dist/core/doctor/agents.js.map +1 -1
- package/dist/core/doctor/config.js +7 -3
- package/dist/core/doctor/config.js.map +1 -1
- package/dist/core/doctor/doctor.js +91 -11
- package/dist/core/doctor/doctor.js.map +1 -1
- package/dist/core/doctor/report.js.map +1 -1
- package/dist/core/doctor/reports/scan.js +242 -0
- package/dist/core/doctor/reports/scan.js.map +1 -0
- package/dist/core/document/apply.js +158 -11
- package/dist/core/document/apply.js.map +1 -1
- package/dist/core/document/frontmatter.js +55 -0
- package/dist/core/document/frontmatter.js.map +1 -1
- package/dist/core/document/parse.js +29 -6
- package/dist/core/document/parse.js.map +1 -1
- package/dist/core/document/scenarios.js +17 -0
- package/dist/core/document/scenarios.js.map +1 -1
- package/dist/core/document/spec.js +4 -11
- package/dist/core/document/spec.js.map +1 -1
- package/dist/core/envelope/config.js +10 -0
- package/dist/core/envelope/config.js.map +1 -1
- package/dist/core/envelope/json.js +34 -0
- package/dist/core/envelope/json.js.map +1 -1
- package/dist/core/explain/families.js +26 -21
- package/dist/core/explain/families.js.map +1 -1
- package/dist/core/explain/lookup.js +14 -1
- package/dist/core/explain/lookup.js.map +1 -1
- package/dist/core/explain/refusals.js +5 -5
- package/dist/core/explain/refusals.js.map +1 -1
- package/dist/core/explain/terms/documents.js +227 -0
- package/dist/core/explain/terms/documents.js.map +1 -0
- package/dist/core/explain/terms/done-check.js +144 -0
- package/dist/core/explain/terms/done-check.js.map +1 -0
- package/dist/core/explain/terms/entry.js +14 -0
- package/dist/core/explain/terms/entry.js.map +1 -0
- package/dist/core/explain/terms/stages.js +71 -0
- package/dist/core/explain/terms/stages.js.map +1 -0
- package/dist/core/explain/terms/tasks.js +97 -0
- package/dist/core/explain/terms/tasks.js.map +1 -0
- package/dist/core/explain/terms.js +68 -109
- package/dist/core/explain/terms.js.map +1 -1
- package/dist/core/explore/explore.js +40 -10
- package/dist/core/explore/explore.js.map +1 -1
- package/dist/core/fleet-context.js +81 -95
- package/dist/core/fleet-context.js.map +1 -1
- package/dist/core/gate/checks.js +11 -4
- package/dist/core/gate/checks.js.map +1 -1
- package/dist/core/gate/partners.js +69 -28
- package/dist/core/gate/partners.js.map +1 -1
- package/dist/core/gate/report.js.map +1 -1
- package/dist/core/gate/verification.js +75 -12
- package/dist/core/gate/verification.js.map +1 -1
- package/dist/core/gherkin/stale.js +13 -37
- package/dist/core/gherkin/stale.js.map +1 -1
- package/dist/core/glossary/delta.js +10 -7
- package/dist/core/glossary/delta.js.map +1 -1
- package/dist/core/glossary/tree.js +6 -19
- package/dist/core/glossary/tree.js.map +1 -1
- package/dist/core/kernel/concurrency.js +19 -0
- package/dist/core/kernel/concurrency.js.map +1 -1
- package/dist/core/kernel/ids/fqn/ancestors.js +65 -0
- package/dist/core/kernel/ids/fqn/ancestors.js.map +1 -0
- package/dist/core/kernel/path-safety.js +38 -0
- package/dist/core/kernel/path-safety.js.map +1 -1
- package/dist/core/kernel/records.js +11 -0
- package/dist/core/kernel/records.js.map +1 -1
- package/dist/core/links/backlinks.js +1 -3
- package/dist/core/links/backlinks.js.map +1 -1
- package/dist/core/links/corpus.js +51 -37
- package/dist/core/links/corpus.js.map +1 -1
- package/dist/core/links/findings.js.map +1 -1
- package/dist/core/links/parse.js +38 -9
- package/dist/core/links/parse.js.map +1 -1
- package/dist/core/mcp/argv.js +101 -0
- package/dist/core/mcp/argv.js.map +1 -1
- package/dist/core/mcp/author-tools.js +2 -1
- package/dist/core/mcp/author-tools.js.map +1 -1
- package/dist/core/mcp/protocol.js +2 -2
- package/dist/core/mcp/protocol.js.map +1 -1
- package/dist/core/mcp/tools.js +43 -33
- package/dist/core/mcp/tools.js.map +1 -1
- package/dist/core/openapi/baseline/gate.js +53 -12
- package/dist/core/openapi/baseline/gate.js.map +1 -1
- package/dist/core/openapi/baseline/plan.js +40 -10
- package/dist/core/openapi/baseline/plan.js.map +1 -1
- package/dist/core/openapi/baseline/record.js +0 -1
- package/dist/core/openapi/baseline/record.js.map +1 -1
- package/dist/core/openapi/contract-text.js +33 -0
- package/dist/core/openapi/contract-text.js.map +1 -0
- package/dist/core/openapi/contract-tree.js +301 -0
- package/dist/core/openapi/contract-tree.js.map +1 -0
- package/dist/core/openapi/depth.js +38 -24
- package/dist/core/openapi/depth.js.map +1 -1
- package/dist/core/openapi/digest.js +52 -2
- package/dist/core/openapi/digest.js.map +1 -1
- package/dist/core/openapi/doc.js +12 -4
- package/dist/core/openapi/doc.js.map +1 -1
- package/dist/core/openapi/merge/components.js +25 -60
- package/dist/core/openapi/merge/components.js.map +1 -1
- package/dist/core/openapi/merge/error.js +3 -13
- package/dist/core/openapi/merge/error.js.map +1 -1
- package/dist/core/openapi/merge/markers.js +26 -30
- package/dist/core/openapi/merge/markers.js.map +1 -1
- package/dist/core/openapi/merge/merge.js +28 -52
- package/dist/core/openapi/merge/merge.js.map +1 -1
- package/dist/core/openapi/merge/pin.js +17 -35
- package/dist/core/openapi/merge/pin.js.map +1 -1
- package/dist/core/openspec/decide/verdict.js.map +1 -1
- package/dist/core/openspec/inventory.js +4 -5
- package/dist/core/openspec/inventory.js.map +1 -1
- package/dist/core/openspec/model/mapping.js +30 -28
- package/dist/core/openspec/model/mapping.js.map +1 -1
- package/dist/core/openspec/model/model.js +12 -7
- package/dist/core/openspec/model/model.js.map +1 -1
- package/dist/core/openspec/scan/changes.js +10 -4
- package/dist/core/openspec/scan/changes.js.map +1 -1
- package/dist/core/openspec/scan/config.js +7 -16
- package/dist/core/openspec/scan/config.js.map +1 -1
- package/dist/core/openspec/scan/shape.js +63 -19
- package/dist/core/openspec/scan/shape.js.map +1 -1
- package/dist/core/openspec/scan/walk.js +21 -38
- package/dist/core/openspec/scan/walk.js.map +1 -1
- package/dist/core/pack/living.js +43 -4
- package/dist/core/pack/living.js.map +1 -1
- package/dist/core/pack/pack.js +50 -6
- package/dist/core/pack/pack.js.map +1 -1
- package/dist/core/projection/arch-slice.js +2 -2
- package/dist/core/projection/arch-slice.js.map +1 -1
- package/dist/core/projection/introduced.js +14 -0
- package/dist/core/projection/introduced.js.map +1 -0
- package/dist/core/provenance/findings.js +48 -12
- package/dist/core/provenance/findings.js.map +1 -1
- package/dist/core/provenance/git.js +33 -57
- package/dist/core/provenance/git.js.map +1 -1
- package/dist/core/provenance/gitq/moves.js +71 -114
- package/dist/core/provenance/gitq/moves.js.map +1 -1
- package/dist/core/provenance/gitq/vouched-ancestor.js +2 -2
- package/dist/core/provenance/gitq/vouched-ancestor.js.map +1 -1
- package/dist/core/provenance/sources.js +23 -6
- package/dist/core/provenance/sources.js.map +1 -1
- package/dist/core/provenance/stamp.js +5 -17
- package/dist/core/provenance/stamp.js.map +1 -1
- package/dist/core/repo/authored/paths.js +18 -0
- package/dist/core/repo/authored/paths.js.map +1 -1
- package/dist/core/repo/entries.js.map +1 -1
- package/dist/core/repo/paths.js +92 -6
- package/dist/core/repo/paths.js.map +1 -1
- package/dist/core/repo/repo.js +74 -14
- package/dist/core/repo/repo.js.map +1 -1
- package/dist/core/repo/tree/find.js +12 -3
- package/dist/core/repo/tree/find.js.map +1 -1
- package/dist/core/repo/tree/fs.js +27 -1
- package/dist/core/repo/tree/fs.js.map +1 -1
- package/dist/core/repo/tree/render/body.js +258 -0
- package/dist/core/repo/tree/render/body.js.map +1 -0
- package/dist/core/repo/tree/render/projects.js +182 -0
- package/dist/core/repo/tree/render/projects.js.map +1 -0
- package/dist/core/repo/tree/render/service/header.js +125 -0
- package/dist/core/repo/tree/render/service/header.js.map +1 -0
- package/dist/core/repo/tree/render/service/peers.js +28 -0
- package/dist/core/repo/tree/render/service/peers.js.map +1 -0
- package/dist/core/repo/tree/render/service/view-id.js +67 -0
- package/dist/core/repo/tree/render/service/view-id.js.map +1 -0
- package/dist/core/repo/tree/render/service/views.js +78 -0
- package/dist/core/repo/tree/render/service/views.js.map +1 -0
- package/dist/core/repo/tree/render/stale.js +42 -0
- package/dist/core/repo/tree/render/stale.js.map +1 -0
- package/dist/core/repo/tree/render/text.js +84 -0
- package/dist/core/repo/tree/render/text.js.map +1 -0
- package/dist/core/repo/tree/render/views.js +293 -0
- package/dist/core/repo/tree/render/views.js.map +1 -0
- package/dist/core/repo/tree/walk.js +53 -32
- package/dist/core/repo/tree/walk.js.map +1 -1
- package/dist/core/results.js +47 -12
- package/dist/core/results.js.map +1 -1
- package/dist/core/scaffold/landscape.js +121 -13
- package/dist/core/scaffold/landscape.js.map +1 -1
- package/dist/core/scaffold/legacy.js +271 -0
- package/dist/core/scaffold/legacy.js.map +1 -0
- package/dist/core/staging/commit.js +26 -15
- package/dist/core/staging/commit.js.map +1 -1
- package/dist/core/staging/lock.js +74 -12
- package/dist/core/staging/lock.js.map +1 -1
- package/dist/core/staging/recovery/intent.js +2 -5
- package/dist/core/staging/recovery/intent.js.map +1 -1
- package/dist/core/staging/recovery/recover.js +84 -6
- package/dist/core/staging/recovery/recover.js.map +1 -1
- package/dist/core/staging/snapshot/manifest.js +188 -0
- package/dist/core/staging/snapshot/manifest.js.map +1 -0
- package/dist/core/staging/{snapshot.js → snapshot/snapshot.js} +39 -45
- package/dist/core/staging/snapshot/snapshot.js.map +1 -0
- package/dist/core/staging/txn/forward.js +24 -14
- package/dist/core/staging/txn/forward.js.map +1 -1
- package/dist/core/staging/writes.js.map +1 -1
- package/dist/core/status/actions/execution.js +11 -0
- package/dist/core/status/actions/execution.js.map +1 -1
- package/dist/core/status/contracts.js +39 -15
- package/dist/core/status/contracts.js.map +1 -1
- package/dist/core/status/feature/artifacts.js +33 -8
- package/dist/core/status/feature/artifacts.js.map +1 -1
- package/dist/core/status/feature/feature.js +24 -17
- package/dist/core/status/feature/feature.js.map +1 -1
- package/dist/core/status/feature/next.js +20 -7
- package/dist/core/status/feature/next.js.map +1 -1
- package/dist/core/status/feature/words.js +96 -0
- package/dist/core/status/feature/words.js.map +1 -0
- package/dist/core/status/fleet/fleet.js +43 -14
- package/dist/core/status/fleet/fleet.js.map +1 -1
- package/dist/core/status/fleet/next.js +153 -58
- package/dist/core/status/fleet/next.js.map +1 -1
- package/dist/core/status/report.js.map +1 -1
- package/dist/core/status/scan.js.map +1 -1
- package/dist/core/status/verification.js +30 -15
- package/dist/core/status/verification.js.map +1 -1
- package/dist/core/tasks/packet.js +199 -0
- package/dist/core/tasks/packet.js.map +1 -0
- package/dist/core/tasks/record.js +43 -0
- package/dist/core/tasks/record.js.map +1 -0
- package/dist/core/tasks/sources.js +181 -0
- package/dist/core/tasks/sources.js.map +1 -0
- package/dist/core/tasks/stamps.js +76 -0
- package/dist/core/tasks/stamps.js.map +1 -0
- package/dist/core/tasks/unit.js +0 -0
- package/dist/core/tasks/unit.js.map +1 -0
- package/dist/core/usecases/capability.js +11 -14
- package/dist/core/usecases/capability.js.map +1 -1
- package/dist/core/usecases/delta/claims.js +31 -7
- package/dist/core/usecases/delta/claims.js.map +1 -1
- package/dist/core/usecases/delta/flows.js +5 -7
- package/dist/core/usecases/delta/flows.js.map +1 -1
- package/dist/core/usecases/delta/modified.js +315 -0
- package/dist/core/usecases/delta/modified.js.map +1 -0
- package/dist/core/usecases/delta/overlay.js +32 -191
- package/dist/core/usecases/delta/overlay.js.map +1 -1
- package/dist/core/usecases/fleet.js +195 -36
- package/dist/core/usecases/fleet.js.map +1 -1
- package/dist/{commands/validate/fleet/usecases → core/usecases/grade}/capability-tag.js +8 -9
- package/dist/core/usecases/grade/capability-tag.js.map +1 -0
- package/dist/core/usecases/grade/feature.js +88 -0
- package/dist/core/usecases/grade/feature.js.map +1 -0
- package/dist/{commands/validate/fleet/usecases → core/usecases/grade}/requirement-tag.js +3 -4
- package/dist/core/usecases/grade/requirement-tag.js.map +1 -0
- package/dist/{commands/validate/fleet/usecases → core/usecases/grade}/steps.js +102 -33
- package/dist/core/usecases/grade/steps.js.map +1 -0
- package/dist/{commands/validate/fleet/usecases → core/usecases/grade}/usecases.js +23 -10
- package/dist/core/usecases/grade/usecases.js.map +1 -0
- package/dist/core/usecases/operations.js +26 -14
- package/dist/core/usecases/operations.js.map +1 -1
- package/dist/core/usecases/place.js.map +1 -1
- package/dist/core/usecases/service/exclude.js +119 -0
- package/dist/core/usecases/service/exclude.js.map +1 -0
- package/dist/core/usecases/service/flows.js +164 -0
- package/dist/core/usecases/service/flows.js.map +1 -0
- package/dist/core/usecases/suites/participants.js +83 -0
- package/dist/core/usecases/suites/participants.js.map +1 -0
- package/dist/core/usecases/suites/suites.js +45 -0
- package/dist/core/usecases/suites/suites.js.map +1 -0
- package/dist/core/verify/answers.js +12 -5
- package/dist/core/verify/answers.js.map +1 -1
- package/dist/core/verify/build.js +102 -82
- package/dist/core/verify/build.js.map +1 -1
- package/dist/core/verify/checklist.js +70 -12
- package/dist/core/verify/checklist.js.map +1 -1
- package/dist/core/verify/location.js +67 -0
- package/dist/core/verify/location.js.map +1 -0
- package/dist/core/verify/pins/lint.js +3 -2
- package/dist/core/verify/pins/lint.js.map +1 -1
- package/dist/core/verify/pins/pin.js +1 -1
- package/dist/core/verify/pins/pin.js.map +1 -1
- package/dist/core/verify/read/file.js +224 -0
- package/dist/core/verify/read/file.js.map +1 -0
- package/dist/core/verify/{file.js → read/shape.js} +16 -104
- package/dist/core/verify/read/shape.js.map +1 -0
- package/dist/core/verify/read/union.js +105 -0
- package/dist/core/verify/read/union.js.map +1 -0
- package/dist/core/verify/record.js +35 -12
- package/dist/core/verify/record.js.map +1 -1
- package/dist/core/verify/store/commit.js +40 -30
- package/dist/core/verify/store/commit.js.map +1 -1
- package/dist/core/verify/store/render.js +8 -4
- package/dist/core/verify/store/render.js.map +1 -1
- package/dist/core/vocabulary/issue.js +4 -0
- package/dist/core/vocabulary/issue.js.map +1 -1
- package/dist/core/vocabulary/maturity.js +75 -4
- package/dist/core/vocabulary/maturity.js.map +1 -1
- package/dist/core/vocabulary/report.js +16 -1
- package/dist/core/vocabulary/report.js.map +1 -1
- package/examples/README.md +54 -11
- package/examples/docs/architecture/landscape.likec4 +62 -6
- package/examples/docs/architecture/services.likec4 +70 -0
- package/examples/docs/architecture/subsystems.likec4 +7 -0
- package/examples/docs/architecture/usecases/order-notification.likec4 +16 -7
- package/examples/docs/features/FEAT-101-payment-splitting/specs/payment-service/asyncapi.yaml +11 -8
- package/examples/docs/features/FEAT-101-payment-splitting/specs/payment-split-service/openapi.yaml +6 -6
- package/examples/docs/features/FEAT-112-retire-order-v1/specs/order-service/openapi.yaml +4 -1
- package/examples/docs/features/archive/FEAT-088-refunds/specs/payment-service/openapi.yaml +13 -10
- package/examples/docs/likec4.config.json +0 -1
- package/examples/docs/services/checkout-web/model.likec4 +39 -56
- package/examples/docs/services/order-service/arch.spec.md +13 -6
- package/examples/docs/services/order-service/asyncapi.yaml +3 -2
- package/examples/docs/services/order-service/model.likec4 +58 -70
- package/examples/docs/services/payment-service/arch.spec.md +7 -4
- package/examples/docs/services/payment-service/model.likec4 +38 -37
- package/examples/docs/services/platform/identity-service/arch.spec.md +7 -4
- package/examples/docs/services/platform/identity-service/model.likec4 +35 -37
- package/examples/docs/services/platform/notification-service/asyncapi.yaml +2 -1
- package/examples/docs/services/platform/notification-service/health.yaml +8 -3
- package/examples/docs/services/platform/notification-service/model.likec4 +43 -64
- package/package.json +1 -1
- package/dist/commands/validate/checks/vocabulary.js +0 -31
- package/dist/commands/validate/checks/vocabulary.js.map +0 -1
- package/dist/commands/validate/fleet/usecases/capability-tag.js.map +0 -1
- package/dist/commands/validate/fleet/usecases/requirement-tag.js.map +0 -1
- package/dist/commands/validate/fleet/usecases/steps.js.map +0 -1
- package/dist/commands/validate/fleet/usecases/usecases.js.map +0 -1
- package/dist/core/agent/agents-md/artifacts.js +0 -220
- package/dist/core/agent/agents-md/artifacts.js.map +0 -1
- package/dist/core/agent/agents-md/cycle.js +0 -165
- package/dist/core/agent/agents-md/cycle.js.map +0 -1
- package/dist/core/agent/agents-md/shipped/archive-gate.js +0 -98
- package/dist/core/agent/agents-md/shipped/archive-gate.js.map +0 -1
- package/dist/core/agent/agents-md/spine.js +0 -40
- package/dist/core/agent/agents-md/spine.js.map +0 -1
- package/dist/core/coherence/events/merged.js +0 -40
- package/dist/core/coherence/events/merged.js.map +0 -1
- package/dist/core/diff/current-state.js +0 -96
- package/dist/core/diff/current-state.js.map +0 -1
- package/dist/core/diff/victims.js +0 -247
- package/dist/core/diff/victims.js.map +0 -1
- package/dist/core/repo/tree/views.js +0 -172
- package/dist/core/repo/tree/views.js.map +0 -1
- package/dist/core/staging/snapshot.js.map +0 -1
- package/dist/core/verify/file.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate.js","sourceRoot":"","sources":["../../../../src/commands/archive/plan/gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAc,MAAM,mCAAmC,CAAC;AAC/F,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,O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B,MAAM,GAAG,GAAG,WAAW,EAAE,eAAe,OAAO,CAAC,MAAM,kDAAkD,CAAC;QACzG,IAAI,IAAI,EAAE,CAAC;YACT,UAAU,CAAC,6BAA6B,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY,OAAO,EAAE,CAAC,CAAC;YAC/E,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;QACzB,KAAK,MAAM,CAAC,IAAI,OAAO;YAAE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3D,OAAO,CAAC,KAAK,CAAC,0FAA0F,CAAC,CAAC;QAC1G,UAAU,CAAC,6BAA6B,CAAC,CAAC;QAC1C,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,iFAAiF;IACjF,gDAAgD;IAChD,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC9C,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,EAAE,gBAAgB,EAAE,WAAW,EAAE,gCAAgC,OAAO,oDAAoD,CAAC,CAAC;QACvI,OAAO,IAAI,CAAC;IACd,CAAC;IAED,GAAG,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAErD,OAAO;QACL,EAAE;QACF,OAAO;QACP,UAAU;QACV,QAAQ;QACR,aAAa;QACb,gBAAgB;QAChB,MAAM;QACN,QAAQ;QACR,UAAU;QACV,WAAW;QACX,SAAS;QACT,MAAM;KACP,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Every refusal that happens before a byte is planned.\n *\n * They are gathered here because they share one doctrine that is easy to lose:\n * `--approve` overrides judgments about the FEATURE, and nothing else. A service\n * directory whose name the id grammar refuses, a living document holding git\n * conflict markers, a requirement outside `## Requirements` — those are\n * mechanical facts about paths and files, so `--approve` does not reach them,\n * and the dry run is gated too, since a plan built on one describes a merge loam\n * must never perform.\n *\n * `null` means the refusal has already been printed and the exit code set.\n */\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { fail, repoPath, sayExplain } from \"../../../core/envelope/json.js\";\nimport { approveOverrides, gatesArchive, type Issue } from \"../../../core/vocabulary/issue.js\";\nimport { recoverInterruptedCommit } from \"../../../core/staging/recovery/recover.js\";\nimport { readUtf8 } from \"../../../core/staging/writes.js\";\nimport { loadFile } from \"../../../core/c4/likec4.js\";\nimport { archiveDir as archiveRoot, featurePaths, featureSpecPaths, SPEC_AXES } from \"../../../core/repo/paths.js\";\nimport { livingCapabilityPaths } from \"../../../core/repo/authored/paths.js\";\nimport { featureCapabilityDeltas } from \"../../../core/capabilities/delta/tree.js\";\nimport { locateServicePaths } from \"../../../core/repo/service-target.js\";\nimport { featureSpecServices, missingFeatureMessage, resolveFeature } from \"../../../core/repo/repo.js\";\nimport { featureCoherence } from \"../../../core/coherence/coherence.js\";\nimport {\n invalidSpecServiceFindings,\n livingMergeConflicts,\n unknownDeltaServices,\n} from \"../../../core/coherence/living.js\";\nimport { SEVERITY_MARK } from \"../../../core/vocabulary/report.js\";\nimport { isRequirementsHeading, parseRequirements } from \"../../../core/document/parse.js\";\nimport { refuseFindings, refuseJson, sayRecovery, type ArchiveOptions } from \"./refusal.js\";\nimport { type Gated } from \"./state.js\";\nimport type { DocsDir } from \"../../../core/kernel/ids/dirs.js\";\nimport type { FleetContext } from \"../../../core/fleet-context.js\";\n\nexport async function gate(\n config: { docsDir: DocsDir; fleet?: FleetContext },\n featureId: string,\n opts: ArchiveOptions,\n say: (line?: string) => void,\n): Promise<Gated | null> {\n const json = opts.json === true;\n const dryRun = opts.dryRun === true;\n // the living docs half-written, and every other command in loam would have\n // planned against them as if they were the truth. Under the same lock, so the\n // repair cannot race a writer. It refuses when the half-merged files have been\n // edited since — that is a human's call, not a merge's.\n const recovered = await recoverInterruptedCommit(config.docsDir);\n if (recovered !== null && !json) sayRecovery(recovered);\n\n const feature = await resolveFeature(config.docsDir, featureId, \"exclude\");\n if (!feature) {\n fail(json, \"unknown-target\", await missingFeatureMessage(config.docsDir, featureId));\n return null;\n }\n // The raw argument's last appearance: from here on the feature answers only to\n // its canonical id — tags, coherence, and the self-exclusion scans all match\n // on `id`, and `archive FEAT-5-slug` must plan exactly like `archive FEAT-5`.\n const { id, dirName, dir: featureDir } = feature;\n\n // Parse delta.likec4 ONCE for the whole run: the coherence gate and the\n // architecture merge below read the same file, and loading it spins up a\n // fresh Langium workspace each time. Nothing writes it in between.\n const deltaLikec4 = featurePaths(featureDir).delta;\n const deltaDoc = existsSync(deltaLikec4) ? await loadFile(deltaLikec4) : undefined;\n\n const deltaServices = await featureSpecServices(featureDir);\n // The business corpus's delta tree, walked once HERE and carried on `Gated`:\n // the conflict-marker scan, the strayed-requirement scan and the merge itself\n // all ask which capability documents this feature rewrites, and three walks\n // are three chances to answer differently. `featureCoherence` below walks it\n // again on its own — it is called without `config.fleet`, the same\n // no-context path `core/coherence/declared.ts` already documents paying for\n // the arch delta — so this is not the run's only walk, only the one every\n // phase downstream of the gate shares.\n const capabilityDeltas = (\n config.fleet === undefined\n ? await featureCapabilityDeltas(featureDir)\n : await config.fleet.featureCapabilityDeltas(featureDir)\n ).docs;\n\n // A `specs/<svc>/` whose NAME is not a legal service id, refused before\n // anything joins that name into a path: the conflict scan below probes\n // `services/<svc>/<axis>` with it, and the requirements merge would\n // materialise `services/<svc>/` from it — a directory `service.id-invalid`\n // then calls an error on the next `validate --all`, and one no loam command\n // can address or re-create. The set comes from coherence/living.ts's\n // `invalidSpecServiceFindings` — the same function validate reads — so the\n // two gates cannot drift.\n //\n // --approve does not apply, exactly as with the conflict-marker refusal\n // below: --approve overrides judgments about the FEATURE, and a name the id\n // grammar refuses is a mechanical fact about the path it would become. The\n // dry run is gated too: a plan built on that name describes a merge loam\n // must never perform.\n const illegalServices = await invalidSpecServiceFindings(featureDir);\n if (illegalServices.length > 0) {\n const msg = `archive ${id} — BLOCKED: ${illegalServices.length} per-service delta(s) named by an illegal service id; --approve does not override this`;\n if (json) {\n refuseFindings(\"not-coherent\", msg, illegalServices, `features/${dirName}`);\n return null;\n }\n console.error(`${msg}:`);\n for (const f of illegalServices) console.error(` ✗ ${f.message}`);\n console.error(`\\n--approve does not override this — the directory the merge would create is one loam can never address, mechanically.`);\n // Every arm in this file refuses by hand — it prints a headline, a list and\n // a closing sentence rather than the one message `fail()` takes — so the\n // code and its lookup have to be asked for explicitly. `sayExplain` is\n // called rather than the format being copied six times, and the code passed\n // is the SAME one the `--json` branch a few lines up emits: text and\n // envelope must name one refusal, or a reader who switches modes to find\n // the code is handed a different answer than the one they saw.\n sayExplain(\"not-coherent\");\n process.exitCode = 1;\n return null;\n }\n\n // Git conflict markers in a LIVING document this merge would rewrite, before\n // anything else is asked of it. Both sides of somebody's merge are in the\n // file, so nothing it says is anyone's text — and the requirements rewrite\n // deletes whichever marker lines fall inside the section it owns, turning a\n // conflict anyone can see into a file nobody can tell is wrong. Checked ahead\n // of the coherence gate for `inspectLandscape`'s reason: a conflicted\n // document parses, so every verdict downstream of it is an opinion about half\n // of two people's work.\n //\n // --approve does not apply, exactly as with the strayed-requirement refusal\n // below: --approve overrides judgments about the FEATURE, and this is a fact\n // about the living document.\n const conflicted = await livingMergeConflicts(config.docsDir, deltaServices, capabilityDeltas.map((d) => d.id));\n if (conflicted.length > 0) {\n const msg = `archive ${id} — BLOCKED: ${conflicted.length} living document(s) still hold git conflict markers`;\n if (json) {\n refuseFindings(\"merge-failed\", msg, conflicted, `features/${dirName}`);\n return null;\n }\n console.error(`${msg}:`);\n for (const f of conflicted) console.error(` ✗ ${f.message}`);\n console.error(`\\n--approve does not override this — the loss is mechanical, not a judgment call.`);\n sayExplain(\"merge-failed\");\n process.exitCode = 1;\n return null;\n }\n\n // Gate: GATING issues block the archive. Severity and gating are two\n // different questions (issue.ts): errors gate because the merge would write\n // something wrong, and the rare warning marked `gates` blocks too — the\n // document is legal but the merge would drop authored content. Advisory\n // warnings are printed (and carried into --json) but never block, matching\n // validate's own doctrine (report.ts: \"warnings never gate\"). --approve\n // overrides the gating issues ONLY, and must say exactly which ones it is\n // walking past. A dry run is gated too: a plan for a merge that would be\n // refused describes nothing that will happen.\n const issues = await featureCoherence({ docsDir: config.docsDir, featureDir, featureId: id, preloadedDelta: deltaDoc });\n // The issues --approve cannot move, carved out before the gate below reads\n // the rest. The register is issue.ts's `approveOverrides` — the same data\n // the `overridable` key in the envelope is resolved from — never a code\n // string spelled here, because two spellings of \"what the flag moves\" would\n // drift. Today the register holds one code: a `metadata { service }` binding\n // the id grammar refuses, anywhere in a tagged element's spliced block. The\n // landscape merge would splice that name into the living map verbatim, and\n // the new-service scan would probe `services/<binding>/` with it — a '../'\n // collapses the probe out of services/ altogether — so the refusal is a\n // mechanical fact about the path the name becomes, not a judgment about the\n // feature. Same doctrine as the illegal-specs-name refusal above; the dry\n // run is gated the same way, and the --json envelope stays not-coherent\n // with every issue attached, exactly like the overridable branch below, so\n // a consumer branches on the code and not on which refusal path fired.\n const nonOverridable = issues.filter((i) => !approveOverrides(i));\n if (nonOverridable.length > 0) {\n const msg = `archive ${id} — BLOCKED: ${nonOverridable.length} element binding(s) name an illegal service id; --approve does not override this`;\n if (json) {\n refuseJson(\"not-coherent\", msg, issues, `features/${dirName}`);\n return null;\n }\n console.error(`${msg}:`);\n // The whole list, not just the carve-out: the reader is about to fix the\n // feature, and the issues --approve COULD have moved are work they still\n // owe — hiding them here made the second refusal a surprise. The closing\n // line says which of the marks the flag cannot move.\n for (const i of issues) console.error(` ${SEVERITY_MARK[i.severity]} ${i.message}`);\n console.error(\n `\\nOf these, --approve does not override the ${nonOverridable.length} illegal binding(s) — the merge would write a name loam can never resolve into services/, mechanically. Fix the binding(s); the other issues gate as usual.`,\n );\n sayExplain(\"not-coherent\");\n process.exitCode = 1;\n return null;\n }\n const gating = issues.filter(gatesArchive);\n const advisory = issues.filter((i) => !gatesArchive(i));\n if (gating.length > 0 && !opts.approve) {\n const msg = `archive ${id} — BLOCKED: not coherent (${gating.length} gating issue(s), ${advisory.length} advisory warning(s))`;\n if (json) {\n refuseJson(\"not-coherent\", msg, issues, `features/${dirName}`);\n return null;\n }\n console.error(`${msg}:`);\n for (const i of issues) console.error(` ${SEVERITY_MARK[i.severity]} ${i.message}`);\n console.error(`\\nFix the gating issues (advisory warnings never block), or re-run with --approve to override them (may corrupt the living docs).`);\n sayExplain(\"not-coherent\");\n process.exitCode = 1;\n return null;\n }\n if (gating.length > 0) {\n say(`⚠ archiving despite ${gating.length} gating issue(s) (--approve):`);\n for (const i of gating) say(` ${SEVERITY_MARK[i.severity]} ${i.message}`);\n say();\n }\n if (advisory.length > 0) {\n say(`⚠ ${advisory.length} warning(s) (non-blocking):`);\n for (const i of advisory) say(` ⚠ ${i.message}`);\n say();\n }\n\n // A `specs/<svc>/` addressed to a service that exists nowhere. `validate`\n // graded this and archive did not, which is the half that costs something:\n // `specs/<svc>/` is what the merge MATERIALISES `services/<svc>/` from, so a\n // one-character slip in `--touches` archived at exit 0 and left the fleet a\n // living service nobody meant to adopt. The set comes from coherence/living.ts's\n // `unknownDeltaServices` — the same function validate reads — so the two\n // gates cannot drift into disagreeing about which ids are real.\n //\n // Gated exactly like a coherence error, --approve included: which service you\n // meant is a judgment about the FEATURE. A feature that genuinely introduces\n // one has a better escape hatch than --approve anyway — tag its element in\n // delta.likec4, which is also what makes the fleet map true afterwards.\n const unknownServices = await unknownDeltaServices(config.docsDir, featureDir, id, { preloadedDelta: deltaDoc });\n if (unknownServices.length > 0 && !opts.approve) {\n const msg = `archive ${id} — BLOCKED: ${unknownServices.length} per-service delta(s) address a service that does not exist`;\n if (json) {\n refuseFindings(\"not-coherent\", msg, unknownServices, `features/${dirName}`);\n return null;\n }\n console.error(`${msg}:`);\n for (const f of unknownServices) console.error(` ✗ ${f.message}`);\n console.error(`\\nFix the id, or introduce the service in this feature's delta.likec4 — or re-run with --approve to create it anyway.`);\n sayExplain(\"not-coherent\");\n process.exitCode = 1;\n return null;\n }\n if (unknownServices.length > 0) {\n say(`⚠ archiving despite ${unknownServices.length} unknown service(s) (--approve) — this merge creates them:`);\n for (const f of unknownServices) say(` ✗ ${f.message}`);\n say();\n }\n\n // A LIVING requirement outside `## Requirements` is a merge loam cannot do\n // correctly: the rewrite replaces only the requirements RUN inside that\n // section (rewriteRequirementsRun) while parseRequirements collects from\n // every section — so the strayed requirement keeps its authored copy in the\n // preserved prose AND lands again in the rewritten run, and the next\n // archive's MODIFIED replaces only one of them. Refused rather than\n // repaired: excising blocks from prose programmatically would be archive\n // editing text it does not understand. --approve does not apply — it\n // overrides judgments about the FEATURE, and this is neither.\n const strayed: Issue[] = [];\n const scanStrayed = async (livingPath: string, subject: string): Promise<void> => {\n if (!existsSync(livingPath)) return;\n for (const r of parseRequirements(await readUtf8(livingPath))) {\n // The ONE definition of the heading (spec.ts): the guard and the rewrite\n // boundary match the same way, so they cannot disagree about \"outside\".\n if (r.section !== undefined && isRequirementsHeading(r.section)) continue;\n const where = r.section === undefined ? \"above every heading\" : `under '${r.section}'`;\n strayed.push({\n severity: \"error\",\n code: \"living.requirement-outside-requirements\",\n subject,\n message: `${subject}: living requirement '${r.name}' sits ${where} in ${repoPath(config.docsDir, livingPath)} — the merge rewrites only '## Requirements', so it would land in the file twice. Re-home it under '## Requirements' first, then re-run.`,\n });\n }\n };\n for (const svc of deltaServices) {\n for (const axis of SPEC_AXES) {\n if (!existsSync(featureSpecPaths(featureDir, svc)[axis.key])) continue;\n // The shared context, because this sits in a deltaServices × SPEC_AXES\n // loop: without it every iteration re-walks and re-reads the fleet.\n await scanStrayed((await locateServicePaths(config.docsDir, svc, config.fleet))[axis.key], svc);\n }\n }\n // The business corpus, for the identical mechanical reason: a capability\n // document is narrative ABOVE `## Requirements`, `rewriteRequirementsRun`\n // rewrites only the run inside that heading, and a requirement filed under\n // `## Notes` would keep its authored copy in the preserved prose AND land\n // again in the rewritten run.\n for (const doc of capabilityDeltas) {\n await scanStrayed(livingCapabilityPaths(config.docsDir, doc.id).spec, doc.id);\n }\n if (strayed.length > 0) {\n const msg = `archive ${id} — BLOCKED: ${strayed.length} living requirement(s) outside '## Requirements'`;\n if (json) {\n refuseJson(\"living-outside-requirements\", msg, strayed, `features/${dirName}`);\n return null;\n }\n console.error(`${msg}:`);\n for (const i of strayed) console.error(` ✗ ${i.message}`);\n console.error(`\\n--approve does not override this — the duplication is mechanical, not a judgment call.`);\n sayExplain(\"living-outside-requirements\");\n process.exitCode = 1;\n return null;\n }\n\n // Pre-flight: the archive destination must be free, or the final move would fail\n // after the living docs were already rewritten.\n const archiveDir = archiveRoot(config.docsDir);\n const archiveDest = join(archiveDir, dirName);\n if (existsSync(archiveDest)) {\n fail(json, \"archive-exists\", `archive ${id} — BLOCKED: features/archive/${dirName} already exists. Remove or rename it, then re-run.`);\n return null;\n }\n\n say(`archive ${id}${dryRun ? \" (dry run)\" : \"\"}\\n`);\n\n return {\n id,\n dirName,\n featureDir,\n deltaDoc,\n deltaServices,\n capabilityDeltas,\n gating,\n advisory,\n archiveDir,\n archiveDest,\n recovered,\n issues,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"gate.js","sourceRoot":"","sources":["../../../../src/commands/archive/plan/gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAc,MAAM,mCAAmC,CAAC;AAC/F,OAAO,EAAE,wBAAwB,E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ACT,MAAM;KACP,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Every refusal that happens before a byte is planned.\n *\n * They are gathered here because they share one doctrine that is easy to lose:\n * `--approve` overrides judgments about the FEATURE, and nothing else. A service\n * directory whose name the id grammar refuses, a living document holding git\n * conflict markers, a requirement outside `## Requirements` — those are\n * mechanical facts about paths and files, so `--approve` does not reach them,\n * and the dry run is gated too, since a plan built on one describes a merge loam\n * must never perform.\n *\n * `null` means the refusal has already been printed and the exit code set.\n */\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { fail, repoPath, sayExplain } from \"../../../core/envelope/json.js\";\nimport { approveOverrides, gatesArchive, type Issue } from \"../../../core/vocabulary/issue.js\";\nimport { recoverInterruptedCommit } from \"../../../core/staging/recovery/recover.js\";\nimport { readUtf8 } from \"../../../core/staging/writes.js\";\nimport { loadFile } from \"../../../core/c4/likec4.js\";\nimport { archiveDir as archiveRoot, featurePaths, featureSpecPaths, SPEC_AXES } from \"../../../core/repo/paths.js\";\nimport { livingCapabilityPaths } from \"../../../core/repo/authored/paths.js\";\nimport { locateServicePaths } from \"../../../core/repo/service-target.js\";\nimport { featureSpecServices, missingFeatureMessage, resolveFeature } from \"../../../core/repo/repo.js\";\nimport { featureCoherence } from \"../../../core/coherence/coherence.js\";\nimport {\n invalidSpecServiceFindings,\n livingMergeConflicts,\n unknownDeltaServices,\n} from \"../../../core/coherence/living.js\";\nimport { SEVERITY_MARK } from \"../../../core/vocabulary/report.js\";\nimport { isRequirementsHeading, parseRequirements } from \"../../../core/document/parse.js\";\nimport { refuseFindings, refuseJson, sayRecovery, type ArchiveOptions } from \"./refusal.js\";\nimport { type Gated } from \"./state.js\";\nimport type { DocsDir } from \"../../../core/kernel/ids/dirs.js\";\nimport type { FleetContext } from \"../../../core/fleet-context.js\";\n\nexport async function gate(\n config: { docsDir: DocsDir; fleet: FleetContext },\n featureId: string,\n opts: ArchiveOptions,\n say: (line?: string) => void,\n): Promise<Gated | null> {\n const json = opts.json === true;\n // Before anything is read: a commit that was killed between two renames left\n // the living docs half-written, and every other command in loam would have\n // planned against them as if they were the truth. Under the same lock, so the\n // repair cannot race a writer. It refuses when the half-merged files have been\n // edited since — that is a human's call, not a merge's.\n const recovered = await recoverInterruptedCommit(config.docsDir);\n if (recovered !== null && !json) sayRecovery(recovered);\n\n const feature = await resolveFeature(config.docsDir, featureId, \"exclude\");\n if (!feature) {\n fail(json, \"unknown-target\", await missingFeatureMessage(config.docsDir, featureId));\n return null;\n }\n // The raw argument's last appearance: from here on the feature answers only to\n // its canonical id — tags, coherence, and the self-exclusion scans all match\n // on `id`, and `archive FEAT-5-slug` must plan exactly like `archive FEAT-5`.\n const { id, dirName, dir: featureDir } = feature;\n\n // Parse delta.likec4 ONCE for the whole run: the coherence gate and the\n // architecture merge below read the same file, and loading it spins up a\n // fresh Langium workspace each time. Nothing writes it in between.\n const deltaLikec4 = featurePaths(featureDir).delta;\n const deltaDoc = existsSync(deltaLikec4) ? await loadFile(deltaLikec4) : undefined;\n\n const deltaServices = await featureSpecServices(featureDir);\n // The business corpus's delta tree, walked once HERE and carried on `Gated`:\n // the conflict-marker scan, the strayed-requirement scan and the merge itself\n // all ask which capability documents this feature rewrites, and three walks\n // are three chances to answer differently. `featureCoherence` below walks it\n // again on its own — it is called without `config.fleet`, the same\n // no-context path `core/coherence/declared.ts` already documents paying for\n // the arch delta — so this is not the run's only walk, only the one every\n // phase downstream of the gate shares.\n const capabilityDeltas = (await config.fleet.featureCapabilityDeltas(featureDir)).docs;\n\n // A `specs/<svc>/` whose NAME is not a legal service id, refused before\n // anything joins that name into a path: the conflict scan below probes\n // `services/<svc>/<axis>` with it, and the requirements merge would\n // materialise `services/<svc>/` from it — a directory `service.id-invalid`\n // then calls an error on the next `validate --all`, and one no loam command\n // can address or re-create. The set comes from coherence/living.ts's\n // `invalidSpecServiceFindings` — the same function validate reads — so the\n // two gates cannot drift.\n //\n // --approve does not apply, exactly as with the conflict-marker refusal\n // below: --approve overrides judgments about the FEATURE, and a name the id\n // grammar refuses is a mechanical fact about the path it would become. The\n // dry run is gated too: a plan built on that name describes a merge loam\n // must never perform.\n const illegalServices = await invalidSpecServiceFindings(featureDir);\n if (illegalServices.length > 0) {\n const msg = `archive ${id} — BLOCKED: ${illegalServices.length} per-service delta(s) named by an illegal service id; --approve does not override this`;\n if (json) {\n refuseFindings(\"not-coherent\", msg, illegalServices, `features/${dirName}`);\n return null;\n }\n console.error(`${msg}:`);\n for (const f of illegalServices) console.error(` ✗ ${f.message}`);\n console.error(`\\n--approve does not override this — the directory the merge would create is one loam can never address, mechanically.`);\n // Every arm in this file refuses by hand — it prints a headline, a list and\n // a closing sentence rather than the one message `fail()` takes — so the\n // code and its lookup have to be asked for explicitly. `sayExplain` is\n // called rather than the format being copied six times, and the code passed\n // is the SAME one the `--json` branch a few lines up emits: text and\n // envelope must name one refusal, or a reader who switches modes to find\n // the code is handed a different answer than the one they saw.\n sayExplain(\"not-coherent\");\n process.exitCode = 1;\n return null;\n }\n\n // Git conflict markers in a LIVING document this merge would rewrite, before\n // anything else is asked of it. Both sides of somebody's merge are in the\n // file, so nothing it says is anyone's text — and the requirements rewrite\n // deletes whichever marker lines fall inside a requirement it replaces, turning a\n // conflict anyone can see into a file nobody can tell is wrong. Checked ahead\n // of the coherence gate for `inspectLandscape`'s reason: a conflicted\n // document parses, so every verdict downstream of it is an opinion about half\n // of two people's work.\n //\n // --approve does not apply, exactly as with the strayed-requirement refusal\n // below: --approve overrides judgments about the FEATURE, and this is a fact\n // about the living document.\n const conflicted = await livingMergeConflicts(config.docsDir, deltaServices, capabilityDeltas.map((d) => d.id));\n if (conflicted.length > 0) {\n const msg = `archive ${id} — BLOCKED: ${conflicted.length} living document(s) still hold git conflict markers`;\n if (json) {\n refuseFindings(\"merge-failed\", msg, conflicted, `features/${dirName}`);\n return null;\n }\n console.error(`${msg}:`);\n for (const f of conflicted) console.error(` ✗ ${f.message}`);\n console.error(`\\n--approve does not override this — the loss is mechanical, not a judgment call.`);\n sayExplain(\"merge-failed\");\n process.exitCode = 1;\n return null;\n }\n\n // Gate: GATING issues block the archive. Severity and gating are two\n // different questions (issue.ts): errors gate because the merge would write\n // something wrong, and the rare warning marked `gates` blocks too — the\n // document is legal but the merge would drop authored content. Advisory\n // warnings are printed (and carried into --json) but never block, matching\n // validate's own doctrine (report.ts: \"warnings never gate\"). --approve\n // overrides the gating issues ONLY, and must say exactly which ones it is\n // walking past. A dry run is gated too: a plan for a merge that would be\n // refused describes nothing that will happen.\n const issues = await featureCoherence({ docsDir: config.docsDir, featureDir, featureId: id, preloadedDelta: deltaDoc });\n // The issues --approve cannot move, carved out before the gate below reads\n // the rest. The register is issue.ts's `approveOverrides` — the same data\n // the `overridable` key in the envelope is resolved from — never a code\n // string spelled here, because two spellings of \"what the flag moves\" would\n // drift. What the register HOLDS has grown: it began as one code (a\n // `metadata { service }` binding the id grammar refuses, where the merge\n // would splice the name into the living map verbatim and probe\n // `services/<binding>/` with it) and now holds the create-only collisions of\n // every whole-file axis besides. They share the doctrine and nothing else —\n // each is a mechanical fact about what the merge would write, never a\n // judgment about the feature — which is why the message below counts them\n // and lets each issue say its own sentence.\n //\n // IT USED TO NAME BINDINGS, and had been wrong for every other code in the\n // register since the use-case slot landed: a feature whose flow collided\n // with a living one was refused with \"1 element binding(s) name an illegal\n // service id\", about a feature that binds nothing. A refusal headline that\n // describes the wrong breach sends its reader to the wrong file first.\n const nonOverridable = issues.filter((i) => !approveOverrides(i));\n if (nonOverridable.length > 0) {\n const msg = `archive ${id} — BLOCKED: ${nonOverridable.length} issue(s) --approve does not override; each names what the merge would write`;\n if (json) {\n refuseJson(\"not-coherent\", msg, issues, `features/${dirName}`);\n return null;\n }\n console.error(`${msg}:`);\n // The whole list, not just the carve-out: the reader is about to fix the\n // feature, and the issues --approve COULD have moved are work they still\n // owe — hiding them here made the second refusal a surprise. The closing\n // line says which of the marks the flag cannot move.\n for (const i of issues) console.error(` ${SEVERITY_MARK[i.severity]} ${i.message}`);\n console.error(\n `\\nOf these, --approve does not override ${nonOverridable.length}: ${[...new Set(nonOverridable.map((i) => i.code))].sort().join(\", \")}. ` +\n \"Each is a mechanical fact about what the merge would write — a name loam cannot resolve, or a file it would replace wholesale — not a judgement the flag can move. \" +\n \"Fix those; the other issues gate as usual.\",\n );\n sayExplain(\"not-coherent\");\n process.exitCode = 1;\n return null;\n }\n const gating = issues.filter(gatesArchive);\n const advisory = issues.filter((i) => !gatesArchive(i));\n if (gating.length > 0 && !opts.approve) {\n const msg = `archive ${id} — BLOCKED: not coherent (${gating.length} gating issue(s), ${advisory.length} advisory warning(s))`;\n if (json) {\n refuseJson(\"not-coherent\", msg, issues, `features/${dirName}`);\n return null;\n }\n console.error(`${msg}:`);\n for (const i of issues) console.error(` ${SEVERITY_MARK[i.severity]} ${i.message}`);\n console.error(`\\nFix the gating issues (advisory warnings never block), or re-run with --approve to override them (may corrupt the living docs).`);\n sayExplain(\"not-coherent\");\n process.exitCode = 1;\n return null;\n }\n if (gating.length > 0) {\n say(`⚠ archiving despite ${gating.length} gating issue(s) (--approve):`);\n for (const i of gating) say(` ${SEVERITY_MARK[i.severity]} ${i.message}`);\n say();\n }\n if (advisory.length > 0) {\n say(`⚠ ${advisory.length} warning(s) (non-blocking):`);\n for (const i of advisory) say(` ⚠ ${i.message}`);\n say();\n }\n\n // A `specs/<svc>/` addressed to a service that exists nowhere. `validate`\n // graded this and archive did not, which is the half that costs something:\n // `specs/<svc>/` is what the merge MATERIALISES `services/<svc>/` from, so a\n // one-character slip in `--touches` archived at exit 0 and left the fleet a\n // living service nobody meant to adopt. The set comes from coherence/living.ts's\n // `unknownDeltaServices` — the same function validate reads — so the two\n // gates cannot drift into disagreeing about which ids are real.\n //\n // Gated exactly like a coherence error, --approve included: which service you\n // meant is a judgment about the FEATURE. A feature that genuinely introduces\n // one has a better escape hatch than --approve anyway — tag its element in\n // delta.likec4, which is also what makes the fleet map true afterwards.\n const unknownServices = await unknownDeltaServices(config.docsDir, featureDir, id, { preloadedDelta: deltaDoc });\n if (unknownServices.length > 0 && !opts.approve) {\n const msg = `archive ${id} — BLOCKED: ${unknownServices.length} per-service delta(s) address a service that does not exist`;\n if (json) {\n refuseFindings(\"not-coherent\", msg, unknownServices, `features/${dirName}`);\n return null;\n }\n console.error(`${msg}:`);\n for (const f of unknownServices) console.error(` ✗ ${f.message}`);\n console.error(`\\nFix the id, or introduce the service in this feature's delta.likec4 — or re-run with --approve to create it anyway.`);\n sayExplain(\"not-coherent\");\n process.exitCode = 1;\n return null;\n }\n if (unknownServices.length > 0) {\n say(`⚠ archiving despite ${unknownServices.length} unknown service(s) (--approve) — this merge creates them:`);\n for (const f of unknownServices) say(` ✗ ${f.message}`);\n say();\n }\n\n // A LIVING requirement outside `## Requirements` is a merge loam cannot do\n // correctly: the rewrite replaces only the requirements RUN inside that\n // section (rewriteRequirementsRun) while parseRequirements collects from\n // every section — so the strayed requirement keeps its authored copy in the\n // preserved prose AND lands again in the rewritten run, and the next\n // archive's MODIFIED replaces only one of them. Refused rather than\n // repaired: excising blocks from prose programmatically would be archive\n // editing text it does not understand. --approve does not apply — it\n // overrides judgments about the FEATURE, and this is neither.\n const strayed: Issue[] = [];\n const scanStrayed = async (livingPath: string, subject: string): Promise<void> => {\n if (!existsSync(livingPath)) return;\n for (const r of parseRequirements(await readUtf8(livingPath))) {\n // The ONE definition of the heading (spec.ts): the guard and the rewrite\n // boundary match the same way, so they cannot disagree about \"outside\".\n if (r.section !== undefined && isRequirementsHeading(r.section)) continue;\n const where = r.section === undefined ? \"above every heading\" : `under '${r.section}'`;\n strayed.push({\n severity: \"error\",\n code: \"living.requirement-outside-requirements\",\n subject,\n message: `${subject}: living requirement '${r.name}' sits ${where} in ${repoPath(config.docsDir, livingPath)} — the merge rewrites only '## Requirements', so it would land in the file twice. Re-home it under '## Requirements' first, then re-run.`,\n });\n }\n };\n for (const svc of deltaServices) {\n for (const axis of SPEC_AXES) {\n if (!existsSync(featureSpecPaths(featureDir, svc)[axis.key])) continue;\n // The shared context, because this sits in a deltaServices × SPEC_AXES\n // loop: without it every iteration re-walks and re-reads the fleet.\n await scanStrayed((await locateServicePaths(config.docsDir, svc, config.fleet))[axis.key], svc);\n }\n }\n // The business corpus, for the identical mechanical reason: a capability\n // document is narrative ABOVE `## Requirements`, `rewriteRequirementsRun`\n // rewrites only the run inside that heading, and a requirement filed under\n // `## Notes` would keep its authored copy in the preserved prose AND land\n // again in the rewritten run.\n for (const doc of capabilityDeltas) {\n await scanStrayed(livingCapabilityPaths(config.docsDir, doc.id).spec, doc.id);\n }\n if (strayed.length > 0) {\n const msg = `archive ${id} — BLOCKED: ${strayed.length} living requirement(s) outside '## Requirements'`;\n if (json) {\n refuseJson(\"living-outside-requirements\", msg, strayed, `features/${dirName}`);\n return null;\n }\n console.error(`${msg}:`);\n for (const i of strayed) console.error(` ✗ ${i.message}`);\n console.error(`\\n--approve does not override this — the duplication is mechanical, not a judgment call.`);\n sayExplain(\"living-outside-requirements\");\n process.exitCode = 1;\n return null;\n }\n\n // Pre-flight: the archive destination must be free, or the final move would fail\n // after the living docs were already rewritten.\n const archiveDir = archiveRoot(config.docsDir);\n const archiveDest = join(archiveDir, dirName);\n if (existsSync(archiveDest)) {\n fail(json, \"archive-exists\", `archive ${id} — BLOCKED: features/archive/${dirName} already exists. Remove or rename it, then re-run.`);\n return null;\n }\n\n return {\n id,\n dirName,\n featureDir,\n deltaDoc,\n deltaServices,\n capabilityDeltas,\n gating,\n advisory,\n archiveDir,\n archiveDest,\n recovered,\n issues,\n };\n}\n"]}
|
|
@@ -5,9 +5,15 @@
|
|
|
5
5
|
* The landscape is the one document every feature writes into, so it is spliced
|
|
6
6
|
* rather than rewritten: the authored file keeps its shape and the delta's
|
|
7
7
|
* elements are placed into it. A service arriving on the architecture axis alone
|
|
8
|
-
* has no `model.likec4` yet, and the
|
|
9
|
-
* — `validate` would report it next, and reporting it here
|
|
10
|
-
* being a surprise.
|
|
8
|
+
* has no `model.likec4` yet, and the finding for that is carried out of the plan
|
|
9
|
+
* — `validate` would report it next, at the same severity, and reporting it here
|
|
10
|
+
* is what stops that being a surprise.
|
|
11
|
+
*
|
|
12
|
+
* The map is not the only document the C4 axis writes. What a delta nests
|
|
13
|
+
* INSIDE a service belongs to that service's `model.likec4` when the model
|
|
14
|
+
* extends the map — the splicer routes it there, this stages the write, and
|
|
15
|
+
* `./model/extending.ts` proves the result parses beside the merged map before
|
|
16
|
+
* anything lands.
|
|
11
17
|
*
|
|
12
18
|
* `planFlows` at the bottom is the other half of the same axis and shares this
|
|
13
19
|
* module for that reason rather than for the file cap: both write into
|
|
@@ -17,21 +23,47 @@
|
|
|
17
23
|
* there is nothing to merge partially.
|
|
18
24
|
*/
|
|
19
25
|
import { existsSync } from "node:fs";
|
|
26
|
+
import { join } from "node:path";
|
|
20
27
|
import { planWrite, readUtf8 } from "../../../core/staging/writes.js";
|
|
21
28
|
import { planLandscapeMerge } from "../../../core/c4/splice/landscape-merge.js";
|
|
29
|
+
import { spliceModel } from "../../../core/c4/splice/model/merge.js";
|
|
22
30
|
import { titleOf } from "../../../core/c4/splice/identity/edges.js";
|
|
23
31
|
import { parseServiceId } from "../../../core/kernel/ids/service.js";
|
|
24
|
-
import {
|
|
32
|
+
import { isPathInside } from "../../../core/kernel/path-safety.js";
|
|
33
|
+
import { landscapePath as landscapeFile, unfiledServicePaths } from "../../../core/repo/paths.js";
|
|
25
34
|
import { enumeratedServiceIds } from "../../../core/repo/service-target.js";
|
|
35
|
+
import { createdServiceModels } from "../../../core/c4/service-model/created/models.js";
|
|
36
|
+
import { extendingModels } from "../../../core/c4/service-model/fleet/extending.js";
|
|
37
|
+
import { modelMergeErrors } from "./model/extending.js";
|
|
26
38
|
import {} from "./state.js";
|
|
27
|
-
import {
|
|
39
|
+
import { CodedFailure } from "../../../core/envelope/json.js";
|
|
28
40
|
import { featurePaths } from "../../../core/repo/paths.js";
|
|
29
41
|
import { featureFlows, livingFlowPath, USECASE_SUBDIR } from "../../../core/usecases/delta/flows.js";
|
|
42
|
+
import { featureDeployments, livingDeploymentPath } from "../../../core/deployment/delta.js";
|
|
30
43
|
export async function planLandscape(config, gated, plan, say) {
|
|
31
44
|
const { id, featureDir, deltaDoc, deltaServices } = gated;
|
|
32
45
|
const deltaLikec4 = featurePaths(featureDir).delta;
|
|
33
46
|
const { writes, planWarns, architectureServices } = plan;
|
|
34
47
|
const landscapePath = landscapeFile(config.docsDir);
|
|
48
|
+
// "New" is enumeration membership, not an existsSync of services/<svc>/ at
|
|
49
|
+
// the root: a FILED service exists wherever the tree walk found it, and the
|
|
50
|
+
// root probe would grade every filed service as newly created here.
|
|
51
|
+
const enumerated = new Set(await enumeratedServiceIds(config.docsDir));
|
|
52
|
+
// The empty extending model of every service this archive creates and the
|
|
53
|
+
// merged map draws — the rule, and the case for writing it, are
|
|
54
|
+
// `createdServiceModels`'s. With no delta or no map there is no merge, and
|
|
55
|
+
// no model.
|
|
56
|
+
const fresh = deltaDoc === undefined || !existsSync(landscapePath)
|
|
57
|
+
? []
|
|
58
|
+
: await createdServiceModels({
|
|
59
|
+
docsDir: config.docsDir,
|
|
60
|
+
featureDir,
|
|
61
|
+
featureId: id,
|
|
62
|
+
drawn: [...(await config.fleet.loadLikeC4(landscapePath)).elements, ...deltaDoc.elements.filter((e) => e.tags.includes(id))],
|
|
63
|
+
fleet: config.fleet,
|
|
64
|
+
});
|
|
65
|
+
// The services that leave this archive with a model.likec4 it wrote.
|
|
66
|
+
const modelled = new Set();
|
|
35
67
|
if (deltaDoc !== undefined) {
|
|
36
68
|
const delta = deltaDoc;
|
|
37
69
|
if (delta.errors.length > 0) {
|
|
@@ -39,7 +71,7 @@ export async function planLandscape(config, gated, plan, say) {
|
|
|
39
71
|
// read an axis. Skipping here would silently drop one merge axis in the one
|
|
40
72
|
// command engineered against quiet partial merges — same rule as an
|
|
41
73
|
// unparseable landscape or openapi: the plan stops before anything is written.
|
|
42
|
-
throw new
|
|
74
|
+
throw new CodedFailure("merge-failed", `delta.likec4 has ${delta.errors.length} parse error(s) — the architecture axis cannot be merged; fix it (\`loam validate --feature ${id}\`) or delete the file`);
|
|
43
75
|
}
|
|
44
76
|
// The feature tag is the whole selection mechanism of this merge, and since
|
|
45
77
|
// LikeC4 1.59.0 a specification KIND can carry a tag that every element or
|
|
@@ -54,7 +86,7 @@ export async function planLandscape(config, gated, plan, say) {
|
|
|
54
86
|
...Object.entries(delta.specification?.relationshipKindTags ?? {}),
|
|
55
87
|
].find(([, tags]) => tags.includes(id));
|
|
56
88
|
if (kindTagged !== undefined) {
|
|
57
|
-
throw new
|
|
89
|
+
throw new CodedFailure("merge-failed", `delta.likec4 declares the feature tag '#${id}' on kind '${kindTagged[0]}' in its specification block, so every ` +
|
|
58
90
|
`'${kindTagged[0]}' in the file inherits it — the merge would treat the whole document as this feature's ` +
|
|
59
91
|
`additions, context elements included, and splice them into architecture/landscape.likec4. Nothing was ` +
|
|
60
92
|
`written. Remove '#${id}' from the kind and tag only the declarations ${id} actually adds.`);
|
|
@@ -62,13 +94,22 @@ export async function planLandscape(config, gated, plan, say) {
|
|
|
62
94
|
const newEls = delta.elements.filter((e) => e.tags.includes(id));
|
|
63
95
|
const newRels = delta.relationships.filter((r) => r.tags.includes(id));
|
|
64
96
|
if (existsSync(landscapePath)) {
|
|
97
|
+
const deltaText = await readUtf8(deltaLikec4);
|
|
65
98
|
const plan = await planLandscapeMerge({
|
|
66
99
|
landscapeText: await readUtf8(landscapePath),
|
|
67
|
-
deltaText
|
|
100
|
+
deltaText,
|
|
68
101
|
deltaElements: delta.elements,
|
|
69
102
|
newEls,
|
|
70
103
|
newRels,
|
|
71
104
|
featureId: id,
|
|
105
|
+
// The tags a relationship kind gives every edge of it: the parsed
|
|
106
|
+
// additions carry them, the delta's statements do not.
|
|
107
|
+
deltaKindTags: delta.specification?.relationshipKindTags ?? {},
|
|
108
|
+
// A service whose model EXTENDS the map owns its own interior, so the
|
|
109
|
+
// merge routes what is nested under it into that model instead of the
|
|
110
|
+
// map (verification 2026-09-04, E1) — and so does a service this
|
|
111
|
+
// archive creates, whose model is written below.
|
|
112
|
+
models: [...(await extendingModels(config.docsDir, config.fleet)), ...fresh],
|
|
72
113
|
});
|
|
73
114
|
// A service can arrive on the ARCHITECTURE axis alone: an element this
|
|
74
115
|
// merge ADDS, carrying a `metadata { service }` binding, with no
|
|
@@ -97,40 +138,118 @@ export async function planLandscape(config, gated, plan, say) {
|
|
|
97
138
|
for (const r of plan.addedRels) {
|
|
98
139
|
say(` + ${titleOf(delta.elements, r.source)} -> ${titleOf(delta.elements, r.target)} "${r.title ?? ""}"`);
|
|
99
140
|
}
|
|
141
|
+
for (const additions of plan.models) {
|
|
142
|
+
const content = spliceModel({
|
|
143
|
+
additions,
|
|
144
|
+
deltaText,
|
|
145
|
+
featureId: id,
|
|
146
|
+
deltaKindTags: delta.specification?.relationshipKindTags ?? {},
|
|
147
|
+
});
|
|
148
|
+
// The model's own parse net, and it has to be a PROJECT one: an
|
|
149
|
+
// extending model resolves against the map, and against the map this
|
|
150
|
+
// very archive would leave — so the merged landscape goes into the set
|
|
151
|
+
// beside it. Refused here, at plan time, nothing written, exactly as an
|
|
152
|
+
// unparseable merged landscape is.
|
|
153
|
+
const errors = await modelMergeErrors({
|
|
154
|
+
docsDir: config.docsDir,
|
|
155
|
+
landscape: plan.content,
|
|
156
|
+
model: { path: additions.model.path, content },
|
|
157
|
+
});
|
|
158
|
+
if (errors.length > 0) {
|
|
159
|
+
throw new CodedFailure("merge-failed", `the merged ${additions.model.path} would not parse (${errors.length} error(s): ${errors.slice(0, 3).join("; ")}) — ` +
|
|
160
|
+
`nothing was written. This model is read beside architecture/landscape.likec4 and nothing else, so an addition ` +
|
|
161
|
+
`fits only if the map declares its kind and every element it names. Most often it is a kind or tag missing from ` +
|
|
162
|
+
`the map's specification block, or a reference to ANOTHER service's interior, which lives in that service's own ` +
|
|
163
|
+
`model and is not in this project — draw that call service to service on the map instead. Fix the map's ` +
|
|
164
|
+
`specification or the delta, then re-run`);
|
|
165
|
+
}
|
|
166
|
+
writes.push(planWrite(join(config.docsDir, ...additions.model.path.split("/")), content));
|
|
167
|
+
const created = fresh.some((m) => m.path === additions.model.path);
|
|
168
|
+
if (created)
|
|
169
|
+
modelled.add(additions.model.service);
|
|
170
|
+
say(` architecture: ${created ? "created" : "merged into"} ${additions.model.path} — ` +
|
|
171
|
+
`+${additions.els.length} element(s), +${additions.rels.length} relationship(s)`);
|
|
172
|
+
for (const e of additions.els)
|
|
173
|
+
say(` + ${e.title} (${e.kind})`);
|
|
174
|
+
for (const r of additions.rels) {
|
|
175
|
+
say(` + ${titleOf(delta.elements, r.source)} -> ${titleOf(delta.elements, r.target)} "${r.title ?? ""}"`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
100
178
|
}
|
|
101
179
|
else {
|
|
102
180
|
say(`\n architecture: no landscape.likec4 — ${newEls.length} element(s) not merged`);
|
|
103
181
|
}
|
|
104
182
|
}
|
|
105
|
-
// A service
|
|
106
|
-
//
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
|
|
183
|
+
// A created service the delta drew no interior for still gets its model:
|
|
184
|
+
// empty, which is the whole of what the archive knows about its inside.
|
|
185
|
+
for (const model of fresh.filter((m) => !modelled.has(m.service))) {
|
|
186
|
+
writes.push(planWrite(join(config.docsDir, ...model.path.split("/")), model.text));
|
|
187
|
+
modelled.add(model.service);
|
|
188
|
+
say(` architecture: created ${model.path} — empty; ${model.service}'s containers go in an \`extend\` block there`);
|
|
189
|
+
}
|
|
190
|
+
// A service this archive BRINGS INTO EXISTENCE without writing its model
|
|
191
|
+
// arrives without the one file `validate` demands of every service. Two
|
|
192
|
+
// shapes: one arriving on the architecture axis alone — a binding the map
|
|
193
|
+
// gains with no `specs/<svc>/` in the feature, so no directory either, and a
|
|
194
|
+
// model would be the one document in a directory the archive invented — and
|
|
195
|
+
// a `specs/<svc>/` the merged map never draws, which the gate calls an unknown
|
|
196
|
+
// service and only `--approve` brings here. The archive says so instead, and
|
|
197
|
+
// stops claiming the docs are complete. Non-gating: the merge is correct;
|
|
198
|
+
// what is missing is the next step, and refusing here would make onboarding
|
|
199
|
+
// a new service impossible in one command.
|
|
117
200
|
const newServices = [...new Set([...deltaServices, ...architectureServices])].filter((svc) => !enumerated.has(svc));
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
201
|
+
await sayUnfiled(config, fresh.map((m) => m.service), say);
|
|
202
|
+
// Whether a planned write lands in the service's would-be directory — the
|
|
203
|
+
// spec merge writes nothing for a delta that leaves no requirements, and then
|
|
204
|
+
// there is no directory to speak of.
|
|
205
|
+
const createsDir = (svc) => {
|
|
206
|
+
const dir = unfiledServicePaths(config.docsDir, svc).dir;
|
|
207
|
+
return writes.some((w) => w.content !== null && isPathInside(dir, w.path));
|
|
208
|
+
};
|
|
209
|
+
for (const svc of newServices.filter((s) => !modelled.has(s))) {
|
|
210
|
+
// `validate --all` reports the two under different codes, both errors: the
|
|
211
|
+
// directory a requirement delta creates with no model in it is the service
|
|
212
|
+
// target's `service.no-model`; a binding with no directory behind it, the
|
|
213
|
+
// fleet map's `landscape.binding-unknown`. The message names the one that
|
|
214
|
+
// fires, and a service for which neither lands is owed nothing.
|
|
215
|
+
const createsItsDir = deltaServices.some((d) => d === svc) && createsDir(svc);
|
|
216
|
+
if (!createsItsDir && !architectureServices.has(svc))
|
|
217
|
+
continue;
|
|
218
|
+
const owed = createsItsDir
|
|
219
|
+
? { creates: `this archive creates services/${svc}/, but nothing writes services/${svc}/model.likec4`, reports: "service.no-model" }
|
|
220
|
+
: { creates: `this archive puts '${svc}' in the landscape, but the fleet has no services/${svc}/ at all`, reports: "landscape.binding-unknown" };
|
|
221
|
+
// An ERROR that does not gate — the two questions `Issue` keeps apart
|
|
222
|
+
// (core/vocabulary/issue.ts). Severity says whether the documents are valid,
|
|
223
|
+
// and validate files either shape as an error: the plan used to call it a
|
|
224
|
+
// warning, so the same fact read as advice here and as a failure one
|
|
225
|
+
// command later (the real-fleet review, 2026-10-21). Gating says whether the
|
|
226
|
+
// MERGE is safe, and it is — what is missing is the next step, as above.
|
|
126
227
|
planWarns.push({
|
|
127
|
-
severity: "
|
|
228
|
+
severity: "error",
|
|
229
|
+
gates: false,
|
|
128
230
|
code: "service.no-model",
|
|
129
231
|
subject: svc,
|
|
130
|
-
message: `${svc}: ${creates} — 'loam validate --all' will report
|
|
232
|
+
message: `${svc}: ${owed.creates} — 'loam validate --all' will report ${owed.reports}, an error, until it exists. Run 'loam adopt --service ${svc}' from the service repo, or write the model by hand.`,
|
|
131
233
|
});
|
|
132
234
|
}
|
|
133
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* The one step left for a service the archive creates in a tree that files its
|
|
238
|
+
* services: moving it there. Printed only when the tree has a subsystem — in a
|
|
239
|
+
* flat tree every service is unfiled and that is normal, never a finding — and
|
|
240
|
+
* never as a guess at WHICH subsystem: the map's nesting is not a placement the
|
|
241
|
+
* tree may read.
|
|
242
|
+
*/
|
|
243
|
+
async function sayUnfiled(config, created, say) {
|
|
244
|
+
// No `services/` yet is a flat tree too — and the walk refuses a docs repo without one.
|
|
245
|
+
if (created.length === 0 || !existsSync(join(config.docsDir, "services")))
|
|
246
|
+
return;
|
|
247
|
+
if ((await config.fleet.fleetTree(config.docsDir)).subsystems.length === 0)
|
|
248
|
+
return;
|
|
249
|
+
for (const svc of created) {
|
|
250
|
+
say(` ${svc}: created unfiled, at services/${svc}/ — 'loam subsystem move ${svc} --into <subsystem>' files it`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
134
253
|
/**
|
|
135
254
|
* The flows this feature brings, copied into `architecture/usecases/`.
|
|
136
255
|
*
|
|
@@ -158,4 +277,22 @@ export async function planFlows(config, gated, plan, say) {
|
|
|
158
277
|
say(` use case: ${flow.rel} — created architecture/${USECASE_SUBDIR}/${flow.rel}`);
|
|
159
278
|
}
|
|
160
279
|
}
|
|
280
|
+
/**
|
|
281
|
+
* The same copy for the third whole-file axis: the topology a feature brings.
|
|
282
|
+
*
|
|
283
|
+
* Beside `planFlows` rather than folded into it, because the two write to
|
|
284
|
+
* different places — a flow into `architecture/usecases/`, a topology straight
|
|
285
|
+
* into `architecture/` — and one function taking a subdirectory argument would
|
|
286
|
+
* make that difference a parameter instead of a decision each axis states.
|
|
287
|
+
* `unarchive` needs nothing here either: a create is undone by deleting.
|
|
288
|
+
*/
|
|
289
|
+
export async function planDeployments(config, gated, plan, say) {
|
|
290
|
+
const docs = await featureDeployments(gated.featureDir);
|
|
291
|
+
if (docs.length === 0)
|
|
292
|
+
return;
|
|
293
|
+
for (const doc of docs) {
|
|
294
|
+
plan.writes.push(planWrite(livingDeploymentPath(config.docsDir, doc.rel), await readUtf8(doc.path)));
|
|
295
|
+
say(` deployment: ${doc.rel} — created architecture/${doc.rel}`);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
161
298
|
//# sourceMappingURL=landscape.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"landscape.js","sourceRoot":"","sources":["../../../../src/commands/archive/plan/landscape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAyB,MAAM,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,CAAC,GAAG,CAAC,EAAE,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjG,GAAG,CAAC,eAAe,IAAI,CAAC,GAAG,2BAA2B,cAAc,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IACtF,CAAC;AACH,CAAC","sourcesContent":["/**\n * The fleet map merge, the flows drawn over it, and the services this archive\n * brings into existence.\n *\n * The landscape is the one document every feature writes into, so it is spliced\n * rather than rewritten: the authored file keeps its shape and the delta's\n * elements are placed into it. A service arriving on the architecture axis alone\n * has no `model.likec4` yet, and the warning for that is carried out of the plan\n * — `validate` would report it next, and reporting it here is what stops that\n * being a surprise.\n *\n * `planFlows` at the bottom is the other half of the same axis and shares this\n * module for that reason rather than for the file cap: both write into\n * `architecture/`, and the two merges are read together — the map gains the\n * elements, the flow gains the ordered hops over them. It is a whole-file copy\n * where the landscape is a splice, because a flow is a document of its own and\n * there is nothing to merge partially.\n */\nimport { existsSync } from \"node:fs\";\nimport { planWrite, readUtf8 } from \"../../../core/staging/writes.js\";\nimport { planLandscapeMerge } from \"../../../core/c4/splice/landscape-merge.js\";\nimport { titleOf } from \"../../../core/c4/splice/identity/edges.js\";\nimport { parseServiceId } from \"../../../core/kernel/ids/service.js\";\nimport { landscapePath as landscapeFile } from \"../../../core/repo/paths.js\";\nimport { enumeratedServiceIds } from \"../../../core/repo/service-target.js\";\nimport { type Gated, type Plan } from \"./state.js\";\nimport { ArchiveFailure } from \"./refusal.js\";\nimport { featurePaths } from \"../../../core/repo/paths.js\";\nimport { featureFlows, livingFlowPath, USECASE_SUBDIR } from \"../../../core/usecases/delta/flows.js\";\nimport type { DocsDir } from \"../../../core/kernel/ids/dirs.js\";\n\nexport async function planLandscape(\n config: { docsDir: DocsDir },\n gated: Gated,\n plan: Plan,\n say: (line?: string) => void,\n): Promise<void> {\n const { id, featureDir, deltaDoc, deltaServices } = gated;\n const deltaLikec4 = featurePaths(featureDir).delta;\n const { writes, planWarns, architectureServices } = plan;\n const landscapePath = landscapeFile(config.docsDir);\n if (deltaDoc !== undefined) {\n const delta = deltaDoc;\n if (delta.errors.length > 0) {\n // --approve overrides loam's JUDGMENT about coherence, never its ability to\n // read an axis. Skipping here would silently drop one merge axis in the one\n // command engineered against quiet partial merges — same rule as an\n // unparseable landscape or openapi: the plan stops before anything is written.\n throw new ArchiveFailure(\n \"merge-failed\",\n `delta.likec4 has ${delta.errors.length} parse error(s) — the architecture axis cannot be merged; fix it (\\`loam validate --feature ${id}\\`) or delete the file`,\n );\n }\n // The feature tag is the whole selection mechanism of this merge, and since\n // LikeC4 1.59.0 a specification KIND can carry a tag that every element or\n // edge of that kind then inherits. A delta declaring its own feature tag on\n // a kind makes `newEls`/`newRels` below select the entire document —\n // including the context declarations the scaffold ships commented out\n // precisely so they are NOT merged — and archive would splice somebody\n // else's services into the fleet map at exit 0. Mechanical, so `--approve`\n // does not reach it, and refused before the merge is even planned.\n const kindTagged = [\n ...Object.entries(delta.specification?.elementKindTags ?? {}),\n ...Object.entries(delta.specification?.relationshipKindTags ?? {}),\n ].find(([, tags]) => tags.includes(id));\n if (kindTagged !== undefined) {\n throw new ArchiveFailure(\n \"merge-failed\",\n `delta.likec4 declares the feature tag '#${id}' on kind '${kindTagged[0]}' in its specification block, so every ` +\n `'${kindTagged[0]}' in the file inherits it — the merge would treat the whole document as this feature's ` +\n `additions, context elements included, and splice them into architecture/landscape.likec4. Nothing was ` +\n `written. Remove '#${id}' from the kind and tag only the declarations ${id} actually adds.`,\n );\n }\n const newEls = delta.elements.filter((e) => e.tags.includes(id));\n const newRels = delta.relationships.filter((r) => r.tags.includes(id));\n if (existsSync(landscapePath)) {\n const plan = await planLandscapeMerge({\n landscapeText: await readUtf8(landscapePath),\n deltaText: await readUtf8(deltaLikec4),\n deltaElements: delta.elements,\n newEls,\n newRels,\n featureId: id,\n });\n // A service can arrive on the ARCHITECTURE axis alone: an element this\n // merge ADDS, carrying a `metadata { service }` binding, with no\n // `specs/<svc>/` anywhere in the feature. It is a service the fleet gate\n // will demand a directory for the moment this merge lands, so it owes the\n // same warning as one arriving with a requirement delta — and until it\n // did, the closing \"complete + current\" line printed over a landscape\n // this very archive had just made red. Read off the ADDED elements, not\n // the tagged ones: an element the living landscape already had is not\n // arriving, and one that is never merged is not there to demand anything.\n // A binding is document text, which the service path builders no longer accept.\n // The parse cannot actually filter anything here: an illegal binding is\n // `c4.service-binding-invalid`, a coherence ERROR `--approve` does not\n // override, refused before any merge is planned — so the `ok` test only\n // carries the compiler's proof that document text never reaches a path.\n for (const e of plan.addedEls) {\n const parsed = e.service === undefined ? undefined : parseServiceId(e.service);\n if (parsed?.ok === true) architectureServices.add(parsed.id);\n }\n if (plan.content !== null) writes.push(planWrite(landscapePath, plan.content));\n say(`\\n architecture: merged into landscape.likec4 — +${plan.addedEls.length} element(s), +${plan.addedRels.length} relationship(s)`);\n for (const e of plan.addedEls) say(` + ${e.title} (${e.kind})`);\n for (const r of plan.addedRels) {\n say(` + ${titleOf(delta.elements, r.source)} -> ${titleOf(delta.elements, r.target)} \"${r.title ?? \"\"}\"`);\n }\n } else {\n say(`\\n architecture: no landscape.likec4 — ${newEls.length} element(s) not merged`);\n }\n }\n\n // A service this archive BRINGS INTO EXISTENCE arrives without the one file\n // `validate` demands of every service: its own model.likec4. The merge cannot\n // write it — the delta's tagged subtree is a landscape-level box, not a\n // container model, and inventing a plausible one is the kind of quiet fiction\n // the rest of loam exists to prevent — so the archive says so instead, and\n // stops claiming the docs are complete. Non-gating: the feature is coherent\n // and the merge is correct; what is missing is the next step, and refusing\n // here would make onboarding a new service impossible in one command.\n // \"New\" is enumeration membership, not an existsSync of services/<svc>/ at\n // the root: a FILED service exists wherever the tree walk found it, and the\n // root probe would grade every filed service as newly created here.\n const enumerated = new Set<string>(await enumeratedServiceIds(config.docsDir));\n const newServices = [...new Set([...deltaServices, ...architectureServices])].filter(\n (svc) => !enumerated.has(svc),\n );\n for (const svc of newServices) {\n // Two shapes of the same debt: a service with a requirement delta gets its\n // directory from this merge, one that arrives only in the landscape gets no\n // directory at all — and `validate --all` fails the second harder\n // (`landscape.service-unmodelled` names the binding with nothing behind it).\n const creates = deltaServices.some((d) => d === svc)\n ? `this archive creates services/${svc}/, but nothing writes services/${svc}/model.likec4`\n : `this archive puts '${svc}' in the landscape, but the fleet has no services/${svc}/ at all`;\n planWarns.push({\n severity: \"warn\",\n code: \"service.no-model\",\n subject: svc,\n message: `${svc}: ${creates} — 'loam validate --all' will report the service as incomplete until it exists. Run 'loam adopt --service ${svc}' from the service repo, or write the model by hand.`,\n });\n }\n}\n\n/**\n * The flows this feature brings, copied into `architecture/usecases/`.\n *\n * A create-only whole-file copy, and the smallest merge in the command: the\n * document is views-only, it names nothing the landscape merge has not already\n * placed (`planFlowOverlay` in the gate is what proves that, before this runs),\n * and a flow the living tree already holds was refused at the gate\n * (`usecase.flow-exists`, `core/usecases/delta/flows.ts` has the reasoning). So\n * by the time this runs every path here is a file that does not exist, and\n * `planWrite` marks it `exclusive` — a race that created it between the gate and\n * the commit fails the write rather than overwriting somebody.\n *\n * It lives beside `planLandscape` rather than beside the requirement merges\n * because it writes into `architecture/`, and the two merges are read together:\n * the landscape gains the elements, the flow gains the hops over them.\n * `unarchive` needs nothing new — a create is undone by deleting, which the\n * snapshot manifest already records for every write in the plan.\n */\nexport async function planFlows(\n config: { docsDir: DocsDir },\n gated: Gated,\n plan: Plan,\n say: (line?: string) => void,\n): Promise<void> {\n const flows = await featureFlows(gated.featureDir);\n if (flows.length === 0) return;\n for (const flow of flows) {\n plan.writes.push(planWrite(livingFlowPath(config.docsDir, flow.rel), await readUtf8(flow.path)));\n say(` use case: ${flow.rel} — created architecture/${USECASE_SUBDIR}/${flow.rel}`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"landscape.js","sourceRoot":"","sources":["../../../../src/commands/archive/plan/landscape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,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AC,KAAK,CAAC,UAAU,CAAC,CAAC;IACxD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAC9B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACrG,GAAG,CAAC,iBAAiB,GAAG,CAAC,GAAG,2BAA2B,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;IACpE,CAAC;AACH,CAAC","sourcesContent":["/**\n * The fleet map merge, the flows drawn over it, and the services this archive\n * brings into existence.\n *\n * The landscape is the one document every feature writes into, so it is spliced\n * rather than rewritten: the authored file keeps its shape and the delta's\n * elements are placed into it. A service arriving on the architecture axis alone\n * has no `model.likec4` yet, and the finding for that is carried out of the plan\n * — `validate` would report it next, at the same severity, and reporting it here\n * is what stops that being a surprise.\n *\n * The map is not the only document the C4 axis writes. What a delta nests\n * INSIDE a service belongs to that service's `model.likec4` when the model\n * extends the map — the splicer routes it there, this stages the write, and\n * `./model/extending.ts` proves the result parses beside the merged map before\n * anything lands.\n *\n * `planFlows` at the bottom is the other half of the same axis and shares this\n * module for that reason rather than for the file cap: both write into\n * `architecture/`, and the two merges are read together — the map gains the\n * elements, the flow gains the ordered hops over them. It is a whole-file copy\n * where the landscape is a splice, because a flow is a document of its own and\n * there is nothing to merge partially.\n */\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { planWrite, readUtf8 } from \"../../../core/staging/writes.js\";\nimport { planLandscapeMerge } from \"../../../core/c4/splice/landscape-merge.js\";\nimport { spliceModel } from \"../../../core/c4/splice/model/merge.js\";\nimport { titleOf } from \"../../../core/c4/splice/identity/edges.js\";\nimport { parseServiceId, type PathableService } from \"../../../core/kernel/ids/service.js\";\nimport { isPathInside } from \"../../../core/kernel/path-safety.js\";\nimport { landscapePath as landscapeFile, unfiledServicePaths } from \"../../../core/repo/paths.js\";\nimport { enumeratedServiceIds } from \"../../../core/repo/service-target.js\";\nimport { createdServiceModels } from \"../../../core/c4/service-model/created/models.js\";\nimport { extendingModels } from \"../../../core/c4/service-model/fleet/extending.js\";\nimport { modelMergeErrors } from \"./model/extending.js\";\nimport { type Gated, type Plan } from \"./state.js\";\nimport { CodedFailure } from \"../../../core/envelope/json.js\";\nimport { featurePaths } from \"../../../core/repo/paths.js\";\nimport { featureFlows, livingFlowPath, USECASE_SUBDIR } from \"../../../core/usecases/delta/flows.js\";\nimport { featureDeployments, livingDeploymentPath } from \"../../../core/deployment/delta.js\";\nimport type { DocsDir } from \"../../../core/kernel/ids/dirs.js\";\nimport type { FleetContext } from \"../../../core/fleet-context.js\";\n\nexport async function planLandscape(\n config: { docsDir: DocsDir; fleet: FleetContext },\n gated: Gated,\n plan: Plan,\n say: (line?: string) => void,\n): Promise<void> {\n const { id, featureDir, deltaDoc, deltaServices } = gated;\n const deltaLikec4 = featurePaths(featureDir).delta;\n const { writes, planWarns, architectureServices } = plan;\n const landscapePath = landscapeFile(config.docsDir);\n // \"New\" is enumeration membership, not an existsSync of services/<svc>/ at\n // the root: a FILED service exists wherever the tree walk found it, and the\n // root probe would grade every filed service as newly created here.\n const enumerated = new Set<string>(await enumeratedServiceIds(config.docsDir));\n // The empty extending model of every service this archive creates and the\n // merged map draws — the rule, and the case for writing it, are\n // `createdServiceModels`'s. With no delta or no map there is no merge, and\n // no model.\n const fresh =\n deltaDoc === undefined || !existsSync(landscapePath)\n ? []\n : await createdServiceModels({\n docsDir: config.docsDir,\n featureDir,\n featureId: id,\n drawn: [...(await config.fleet.loadLikeC4(landscapePath)).elements, ...deltaDoc.elements.filter((e) => e.tags.includes(id))],\n fleet: config.fleet,\n });\n // The services that leave this archive with a model.likec4 it wrote.\n const modelled = new Set<string>();\n if (deltaDoc !== undefined) {\n const delta = deltaDoc;\n if (delta.errors.length > 0) {\n // --approve overrides loam's JUDGMENT about coherence, never its ability to\n // read an axis. Skipping here would silently drop one merge axis in the one\n // command engineered against quiet partial merges — same rule as an\n // unparseable landscape or openapi: the plan stops before anything is written.\n throw new CodedFailure(\n \"merge-failed\",\n `delta.likec4 has ${delta.errors.length} parse error(s) — the architecture axis cannot be merged; fix it (\\`loam validate --feature ${id}\\`) or delete the file`,\n );\n }\n // The feature tag is the whole selection mechanism of this merge, and since\n // LikeC4 1.59.0 a specification KIND can carry a tag that every element or\n // edge of that kind then inherits. A delta declaring its own feature tag on\n // a kind makes `newEls`/`newRels` below select the entire document —\n // including the context declarations the scaffold ships commented out\n // precisely so they are NOT merged — and archive would splice somebody\n // else's services into the fleet map at exit 0. Mechanical, so `--approve`\n // does not reach it, and refused before the merge is even planned.\n const kindTagged = [\n ...Object.entries(delta.specification?.elementKindTags ?? {}),\n ...Object.entries(delta.specification?.relationshipKindTags ?? {}),\n ].find(([, tags]) => tags.includes(id));\n if (kindTagged !== undefined) {\n throw new CodedFailure(\n \"merge-failed\",\n `delta.likec4 declares the feature tag '#${id}' on kind '${kindTagged[0]}' in its specification block, so every ` +\n `'${kindTagged[0]}' in the file inherits it — the merge would treat the whole document as this feature's ` +\n `additions, context elements included, and splice them into architecture/landscape.likec4. Nothing was ` +\n `written. Remove '#${id}' from the kind and tag only the declarations ${id} actually adds.`,\n );\n }\n const newEls = delta.elements.filter((e) => e.tags.includes(id));\n const newRels = delta.relationships.filter((r) => r.tags.includes(id));\n if (existsSync(landscapePath)) {\n const deltaText = await readUtf8(deltaLikec4);\n const plan = await planLandscapeMerge({\n landscapeText: await readUtf8(landscapePath),\n deltaText,\n deltaElements: delta.elements,\n newEls,\n newRels,\n featureId: id,\n // The tags a relationship kind gives every edge of it: the parsed\n // additions carry them, the delta's statements do not.\n deltaKindTags: delta.specification?.relationshipKindTags ?? {},\n // A service whose model EXTENDS the map owns its own interior, so the\n // merge routes what is nested under it into that model instead of the\n // map (verification 2026-09-04, E1) — and so does a service this\n // archive creates, whose model is written below.\n models: [...(await extendingModels(config.docsDir, config.fleet)), ...fresh],\n });\n // A service can arrive on the ARCHITECTURE axis alone: an element this\n // merge ADDS, carrying a `metadata { service }` binding, with no\n // `specs/<svc>/` anywhere in the feature. It is a service the fleet gate\n // will demand a directory for the moment this merge lands, so it owes the\n // same warning as one arriving with a requirement delta — and until it\n // did, the closing \"complete + current\" line printed over a landscape\n // this very archive had just made red. Read off the ADDED elements, not\n // the tagged ones: an element the living landscape already had is not\n // arriving, and one that is never merged is not there to demand anything.\n // A binding is document text, which the service path builders no longer accept.\n // The parse cannot actually filter anything here: an illegal binding is\n // `c4.service-binding-invalid`, a coherence ERROR `--approve` does not\n // override, refused before any merge is planned — so the `ok` test only\n // carries the compiler's proof that document text never reaches a path.\n for (const e of plan.addedEls) {\n const parsed = e.service === undefined ? undefined : parseServiceId(e.service);\n if (parsed?.ok === true) architectureServices.add(parsed.id);\n }\n if (plan.content !== null) writes.push(planWrite(landscapePath, plan.content));\n say(`\\n architecture: merged into landscape.likec4 — +${plan.addedEls.length} element(s), +${plan.addedRels.length} relationship(s)`);\n for (const e of plan.addedEls) say(` + ${e.title} (${e.kind})`);\n for (const r of plan.addedRels) {\n say(` + ${titleOf(delta.elements, r.source)} -> ${titleOf(delta.elements, r.target)} \"${r.title ?? \"\"}\"`);\n }\n for (const additions of plan.models) {\n const content = spliceModel({\n additions,\n deltaText,\n featureId: id,\n deltaKindTags: delta.specification?.relationshipKindTags ?? {},\n });\n // The model's own parse net, and it has to be a PROJECT one: an\n // extending model resolves against the map, and against the map this\n // very archive would leave — so the merged landscape goes into the set\n // beside it. Refused here, at plan time, nothing written, exactly as an\n // unparseable merged landscape is.\n const errors = await modelMergeErrors({\n docsDir: config.docsDir,\n landscape: plan.content,\n model: { path: additions.model.path, content },\n });\n if (errors.length > 0) {\n throw new CodedFailure(\n \"merge-failed\",\n `the merged ${additions.model.path} would not parse (${errors.length} error(s): ${errors.slice(0, 3).join(\"; \")}) — ` +\n `nothing was written. This model is read beside architecture/landscape.likec4 and nothing else, so an addition ` +\n `fits only if the map declares its kind and every element it names. Most often it is a kind or tag missing from ` +\n `the map's specification block, or a reference to ANOTHER service's interior, which lives in that service's own ` +\n `model and is not in this project — draw that call service to service on the map instead. Fix the map's ` +\n `specification or the delta, then re-run`,\n );\n }\n writes.push(planWrite(join(config.docsDir, ...additions.model.path.split(\"/\")), content));\n const created = fresh.some((m) => m.path === additions.model.path);\n if (created) modelled.add(additions.model.service);\n say(\n ` architecture: ${created ? \"created\" : \"merged into\"} ${additions.model.path} — ` +\n `+${additions.els.length} element(s), +${additions.rels.length} relationship(s)`,\n );\n for (const e of additions.els) say(` + ${e.title} (${e.kind})`);\n for (const r of additions.rels) {\n say(` + ${titleOf(delta.elements, r.source)} -> ${titleOf(delta.elements, r.target)} \"${r.title ?? \"\"}\"`);\n }\n }\n } else {\n say(`\\n architecture: no landscape.likec4 — ${newEls.length} element(s) not merged`);\n }\n }\n // A created service the delta drew no interior for still gets its model:\n // empty, which is the whole of what the archive knows about its inside.\n for (const model of fresh.filter((m) => !modelled.has(m.service))) {\n writes.push(planWrite(join(config.docsDir, ...model.path.split(\"/\")), model.text));\n modelled.add(model.service);\n say(` architecture: created ${model.path} — empty; ${model.service}'s containers go in an \\`extend\\` block there`);\n }\n\n // A service this archive BRINGS INTO EXISTENCE without writing its model\n // arrives without the one file `validate` demands of every service. Two\n // shapes: one arriving on the architecture axis alone — a binding the map\n // gains with no `specs/<svc>/` in the feature, so no directory either, and a\n // model would be the one document in a directory the archive invented — and\n // a `specs/<svc>/` the merged map never draws, which the gate calls an unknown\n // service and only `--approve` brings here. The archive says so instead, and\n // stops claiming the docs are complete. Non-gating: the merge is correct;\n // what is missing is the next step, and refusing here would make onboarding\n // a new service impossible in one command.\n const newServices = [...new Set([...deltaServices, ...architectureServices])].filter(\n (svc) => !enumerated.has(svc),\n );\n await sayUnfiled(config, fresh.map((m) => m.service), say);\n // Whether a planned write lands in the service's would-be directory — the\n // spec merge writes nothing for a delta that leaves no requirements, and then\n // there is no directory to speak of.\n const createsDir = (svc: PathableService): boolean => {\n const dir = unfiledServicePaths(config.docsDir, svc).dir;\n return writes.some((w) => w.content !== null && isPathInside(dir, w.path));\n };\n for (const svc of newServices.filter((s) => !modelled.has(s))) {\n // `validate --all` reports the two under different codes, both errors: the\n // directory a requirement delta creates with no model in it is the service\n // target's `service.no-model`; a binding with no directory behind it, the\n // fleet map's `landscape.binding-unknown`. The message names the one that\n // fires, and a service for which neither lands is owed nothing.\n const createsItsDir = deltaServices.some((d) => d === svc) && createsDir(svc);\n if (!createsItsDir && !architectureServices.has(svc)) continue;\n const owed = createsItsDir\n ? { creates: `this archive creates services/${svc}/, but nothing writes services/${svc}/model.likec4`, reports: \"service.no-model\" }\n : { creates: `this archive puts '${svc}' in the landscape, but the fleet has no services/${svc}/ at all`, reports: \"landscape.binding-unknown\" };\n // An ERROR that does not gate — the two questions `Issue` keeps apart\n // (core/vocabulary/issue.ts). Severity says whether the documents are valid,\n // and validate files either shape as an error: the plan used to call it a\n // warning, so the same fact read as advice here and as a failure one\n // command later (the real-fleet review, 2026-10-21). Gating says whether the\n // MERGE is safe, and it is — what is missing is the next step, as above.\n planWarns.push({\n severity: \"error\",\n gates: false,\n code: \"service.no-model\",\n subject: svc,\n message: `${svc}: ${owed.creates} — 'loam validate --all' will report ${owed.reports}, an error, until it exists. Run 'loam adopt --service ${svc}' from the service repo, or write the model by hand.`,\n });\n }\n}\n\n/**\n * The one step left for a service the archive creates in a tree that files its\n * services: moving it there. Printed only when the tree has a subsystem — in a\n * flat tree every service is unfiled and that is normal, never a finding — and\n * never as a guess at WHICH subsystem: the map's nesting is not a placement the\n * tree may read.\n */\nasync function sayUnfiled(config: { docsDir: DocsDir; fleet: FleetContext }, created: string[], say: (line?: string) => void): Promise<void> {\n // No `services/` yet is a flat tree too — and the walk refuses a docs repo without one.\n if (created.length === 0 || !existsSync(join(config.docsDir, \"services\"))) return;\n if ((await config.fleet.fleetTree(config.docsDir)).subsystems.length === 0) return;\n for (const svc of created) {\n say(` ${svc}: created unfiled, at services/${svc}/ — 'loam subsystem move ${svc} --into <subsystem>' files it`);\n }\n}\n\n/**\n * The flows this feature brings, copied into `architecture/usecases/`.\n *\n * A create-only whole-file copy, and the smallest merge in the command: the\n * document is views-only, it names nothing the landscape merge has not already\n * placed (`planFlowOverlay` in the gate is what proves that, before this runs),\n * and a flow the living tree already holds was refused at the gate\n * (`usecase.flow-exists`, `core/usecases/delta/flows.ts` has the reasoning). So\n * by the time this runs every path here is a file that does not exist, and\n * `planWrite` marks it `exclusive` — a race that created it between the gate and\n * the commit fails the write rather than overwriting somebody.\n *\n * It lives beside `planLandscape` rather than beside the requirement merges\n * because it writes into `architecture/`, and the two merges are read together:\n * the landscape gains the elements, the flow gains the hops over them.\n * `unarchive` needs nothing new — a create is undone by deleting, which the\n * snapshot manifest already records for every write in the plan.\n */\nexport async function planFlows(\n config: { docsDir: DocsDir },\n gated: Gated,\n plan: Plan,\n say: (line?: string) => void,\n): Promise<void> {\n const flows = await featureFlows(gated.featureDir);\n if (flows.length === 0) return;\n for (const flow of flows) {\n plan.writes.push(planWrite(livingFlowPath(config.docsDir, flow.rel), await readUtf8(flow.path)));\n say(` use case: ${flow.rel} — created architecture/${USECASE_SUBDIR}/${flow.rel}`);\n }\n}\n\n/**\n * The same copy for the third whole-file axis: the topology a feature brings.\n *\n * Beside `planFlows` rather than folded into it, because the two write to\n * different places — a flow into `architecture/usecases/`, a topology straight\n * into `architecture/` — and one function taking a subdirectory argument would\n * make that difference a parameter instead of a decision each axis states.\n * `unarchive` needs nothing here either: a create is undone by deleting.\n */\nexport async function planDeployments(\n config: { docsDir: DocsDir },\n gated: Gated,\n plan: Plan,\n say: (line?: string) => void,\n): Promise<void> {\n const docs = await featureDeployments(gated.featureDir);\n if (docs.length === 0) return;\n for (const doc of docs) {\n plan.writes.push(planWrite(livingDeploymentPath(config.docsDir, doc.rel), await readUtf8(doc.path)));\n say(` deployment: ${doc.rel} — created architecture/${doc.rel}`);\n }\n}\n"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the model this merge would leave behind is one LikeC4 can read.
|
|
3
|
+
*
|
|
4
|
+
* It is here because this is the seam that HAS the other document: an extending
|
|
5
|
+
* model is never parsed alone, it is parsed beside the `architecture/` project,
|
|
6
|
+
* and the project the merge must be proven against is the one this very archive
|
|
7
|
+
* would leave behind — the merged map, not the living one. `core/c4/splice` is
|
|
8
|
+
* a pure text-to-text computation — texts in, texts out — so proving the result
|
|
9
|
+
* stays with the command that decides to write.
|
|
10
|
+
*
|
|
11
|
+
* READING the fleet's extending models used to be here too, as the other half
|
|
12
|
+
* of one seam. It moved to `core/c4/service-model/fleet/extending.ts` when the
|
|
13
|
+
* archive stopped being the only reader: `core/c4/project/staged.ts` previews
|
|
14
|
+
* the same merge for every feature-side gate, and `core/` may not import
|
|
15
|
+
* `commands/`. That module's header carries the fail-open the move closes.
|
|
16
|
+
*/
|
|
17
|
+
import { copyFile, mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
18
|
+
import { tmpdir } from "node:os";
|
|
19
|
+
import { dirname, join, resolve } from "node:path";
|
|
20
|
+
import { errorText } from "../../../../core/c4/likec4.js";
|
|
21
|
+
import { architectureProjectDocuments } from "../../../../core/c4/project/architecture.js";
|
|
22
|
+
import { asLoadedDoc, loadProject } from "../../../../core/c4/project/load.js";
|
|
23
|
+
import { repoPath } from "../../../../core/envelope/json.js";
|
|
24
|
+
import { landscapePath } from "../../../../core/repo/paths.js";
|
|
25
|
+
/**
|
|
26
|
+
* What LikeC4 says about the model this merge would leave, read the way the
|
|
27
|
+
* per-service grade reads it — the `architecture/` project plus this one file.
|
|
28
|
+
*
|
|
29
|
+
* Empty means clean. Anything else refuses the archive at plan time, with
|
|
30
|
+
* nothing written, for the reason the landscape's own parse net exists:
|
|
31
|
+
* splicing is text surgery, and a document that does not parse takes a whole
|
|
32
|
+
* service's grade down (`c4.invalid`) the moment it lands.
|
|
33
|
+
*
|
|
34
|
+
* Errors carry the path the author wrote rather than the staged copy's, and a
|
|
35
|
+
* staging failure is reported as an error rather than swallowed: a merge that
|
|
36
|
+
* could not be proven is not one that passed.
|
|
37
|
+
*/
|
|
38
|
+
export async function modelMergeErrors(proof) {
|
|
39
|
+
const { docsDir, landscape, model } = proof;
|
|
40
|
+
let root;
|
|
41
|
+
try {
|
|
42
|
+
root = await mkdtemp(join(tmpdir(), "loam-model-merge-"));
|
|
43
|
+
const map = resolve(landscapePath(docsDir));
|
|
44
|
+
const authored = new Map();
|
|
45
|
+
const staged = [];
|
|
46
|
+
for (const path of await architectureProjectDocuments(docsDir)) {
|
|
47
|
+
const rel = repoPath(docsDir, path);
|
|
48
|
+
const at = landscape !== null && resolve(path) === map
|
|
49
|
+
? await write(root, rel, landscape)
|
|
50
|
+
: await copy(root, rel, path);
|
|
51
|
+
authored.set(at, rel);
|
|
52
|
+
staged.push(at);
|
|
53
|
+
}
|
|
54
|
+
const at = await write(root, model.path, model.content);
|
|
55
|
+
authored.set(at, model.path);
|
|
56
|
+
staged.push(at);
|
|
57
|
+
const doc = asLoadedDoc(await loadProject(root, staged));
|
|
58
|
+
return doc.errors.map((e) => {
|
|
59
|
+
const where = e.sourceFsPath === undefined ? undefined : authored.get(resolve(e.sourceFsPath));
|
|
60
|
+
return where === undefined ? errorText(e) : `${where} ${errorText(e)}`;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
return [err instanceof Error ? err.message : String(err)];
|
|
65
|
+
}
|
|
66
|
+
finally {
|
|
67
|
+
if (root !== undefined)
|
|
68
|
+
await rm(root, { recursive: true, force: true });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** Mirror one authored document into the staged tree at its docs-relative path. */
|
|
72
|
+
async function copy(root, rel, path) {
|
|
73
|
+
const dest = join(root, ...rel.split("/"));
|
|
74
|
+
await mkdir(dirname(dest), { recursive: true });
|
|
75
|
+
await copyFile(path, dest);
|
|
76
|
+
return resolve(dest);
|
|
77
|
+
}
|
|
78
|
+
/** The same for bytes loam holds rather than a file — the merge previews. */
|
|
79
|
+
async function write(root, rel, content) {
|
|
80
|
+
const dest = join(root, ...rel.split("/"));
|
|
81
|
+
await mkdir(dirname(dest), { recursive: true });
|
|
82
|
+
await writeFile(dest, content, "utf8");
|
|
83
|
+
return resolve(dest);
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=extending.js.map
|