@ybotok/loam 0.2.0-alpha.5 → 0.2.0-alpha.7
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 +1063 -0
- package/MIGRATING-from-OpenSpec.md +7 -4
- package/QUICKSTART.md +8 -3
- package/README.md +13 -7
- package/ROADMAP.md +285 -11
- package/SCHEMA.md +566 -45
- package/WORKFLOW.md +23 -10
- package/dist/commands/adopt/render.js +47 -8
- package/dist/commands/adopt/render.js.map +1 -1
- package/dist/commands/archive/plan/landscape.js +45 -1
- 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/run.js +53 -23
- package/dist/commands/archive/run.js.map +1 -1
- package/dist/commands/context/print.js +11 -1
- package/dist/commands/context/print.js.map +1 -1
- package/dist/commands/doctor.js +46 -0
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/explore.js +12 -2
- package/dist/commands/explore.js.map +1 -1
- package/dist/commands/list/views.js +5 -1
- package/dist/commands/list/views.js.map +1 -1
- package/dist/commands/seed/commit.js +34 -1
- 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 +7 -2
- package/dist/commands/seed/seed.js.map +1 -1
- package/dist/commands/show/feature.js +2 -1
- package/dist/commands/show/feature.js.map +1 -1
- package/dist/commands/show/marks.js +3 -5
- package/dist/commands/show/marks.js.map +1 -1
- package/dist/commands/show/service.js +39 -18
- package/dist/commands/show/service.js.map +1 -1
- package/dist/commands/subsystem/edit.js +4 -2
- package/dist/commands/subsystem/edit.js.map +1 -1
- package/dist/commands/subsystem/move.js +55 -17
- package/dist/commands/subsystem/move.js.map +1 -1
- package/dist/commands/subsystem/sync.js +238 -87
- 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/report.js +174 -0
- package/dist/commands/subsystem/txn/report.js.map +1 -0
- package/dist/commands/subsystem/txn/txn.js +126 -22
- package/dist/commands/subsystem/txn/txn.js.map +1 -1
- package/dist/commands/subsystem/txn/views.js +159 -19
- package/dist/commands/subsystem/txn/views.js.map +1 -1
- package/dist/commands/validate/arch-coverage.js +16 -9
- package/dist/commands/validate/arch-coverage.js.map +1 -1
- package/dist/commands/validate/checks/fleet-shape.js +30 -77
- 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/vocabulary.js +4 -19
- package/dist/commands/validate/checks/vocabulary.js.map +1 -1
- package/dist/commands/validate/feature.js +1 -1
- 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 +131 -120
- 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 +102 -0
- package/dist/commands/validate/fleet/map/attest.js.map +1 -0
- package/dist/commands/validate/fleet/map/bindings.js +109 -0
- package/dist/commands/validate/fleet/map/bindings.js.map +1 -0
- package/dist/commands/validate/fleet/map/consumers.js +219 -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 +56 -0
- package/dist/commands/validate/fleet/map/usecases.js.map +1 -0
- package/dist/commands/validate/fleet/scorecard/scorecard.js.map +1 -1
- package/dist/commands/validate/fleet/usecases/steps.js +49 -17
- package/dist/commands/validate/fleet/usecases/steps.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 +45 -15
- package/dist/commands/validate/fleet/views/ids.js.map +1 -1
- package/dist/commands/validate/fleet/views/projects.js +258 -70
- package/dist/commands/validate/fleet/views/projects.js.map +1 -1
- package/dist/commands/validate/fleet/views/root-documents.js +99 -0
- package/dist/commands/validate/fleet/views/root-documents.js.map +1 -0
- package/dist/commands/validate/fleet/views/stale.js +32 -15
- package/dist/commands/validate/fleet/views/stale.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 +110 -34
- package/dist/commands/validate/service/service.js.map +1 -1
- package/dist/commands/validate/service/specs.js +39 -5
- package/dist/commands/validate/service/specs.js.map +1 -1
- package/dist/commands/validate/service/spine.js +41 -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 +10 -24
- package/dist/commands/validate/validate.js.map +1 -1
- package/dist/core/agent/agents-md/artifacts.js +1 -0
- package/dist/core/agent/agents-md/artifacts.js.map +1 -1
- package/dist/core/agent/agents-md/command-map.js +19 -5
- package/dist/core/agent/agents-md/command-map.js.map +1 -1
- package/dist/core/agent/agents-md/cycle.js +24 -9
- package/dist/core/agent/agents-md/cycle.js.map +1 -1
- package/dist/core/agent/agents-md/map/lenses/context.js +4 -3
- package/dist/core/agent/agents-md/map/lenses/context.js.map +1 -1
- package/dist/core/agent/agents-md/map/subsystem.js +70 -17
- package/dist/core/agent/agents-md/map/subsystem.js.map +1 -1
- package/dist/core/agent/agents-md/map/usecases.js +45 -3
- package/dist/core/agent/agents-md/map/usecases.js.map +1 -1
- package/dist/core/agent/agents-md/refusals.js +5 -3
- package/dist/core/agent/agents-md/refusals.js.map +1 -1
- package/dist/core/agent/agents-md.js +26 -7
- package/dist/core/agent/agents-md.js.map +1 -1
- package/dist/core/agent/support/report.js +39 -5
- package/dist/core/agent/support/report.js.map +1 -1
- package/dist/core/agent/workflows/adopt.js +123 -14
- package/dist/core/agent/workflows/adopt.js.map +1 -1
- package/dist/core/agent/workflows/check.js +34 -20
- package/dist/core/agent/workflows/check.js.map +1 -1
- package/dist/core/agent/workflows/closing.js +3 -1
- package/dist/core/agent/workflows/closing.js.map +1 -1
- package/dist/core/agent/workflows/reference/spine.js +12 -6
- package/dist/core/agent/workflows/reference/spine.js.map +1 -1
- package/dist/core/brief/brief.js +88 -19
- package/dist/core/brief/brief.js.map +1 -1
- package/dist/core/brief/checks.js +133 -7
- package/dist/core/brief/checks.js.map +1 -1
- package/dist/core/brief/landscape.js +212 -129
- package/dist/core/brief/landscape.js.map +1 -1
- package/dist/core/brief/map/extend.js +81 -0
- package/dist/core/brief/map/extend.js.map +1 -0
- package/dist/core/brief/map/owed.js +284 -0
- package/dist/core/brief/map/owed.js.map +1 -0
- package/dist/core/brief/targets.js +94 -29
- package/dist/core/brief/targets.js.map +1 -1
- package/dist/core/brief/unchecked.js +13 -3
- package/dist/core/brief/unchecked.js.map +1 -1
- package/dist/core/c4/likec4.js +23 -1
- package/dist/core/c4/likec4.js.map +1 -1
- package/dist/core/c4/parsed/deployment.js +5 -3
- package/dist/core/c4/parsed/deployment.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 +142 -0
- package/dist/core/c4/prefetch/fleet.js.map +1 -0
- package/dist/core/c4/project/architecture.js +77 -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 +12 -6
- package/dist/core/c4/project/documents.js.map +1 -1
- package/dist/core/c4/project/load.js +85 -42
- package/dist/core/c4/project/load.js.map +1 -1
- package/dist/core/c4/project/staged.js +53 -15
- package/dist/core/c4/project/staged.js.map +1 -1
- package/dist/core/c4/resolve/attested.js +0 -0
- package/dist/core/c4/resolve/attested.js.map +1 -0
- package/dist/core/c4/resolve/service.js +8 -17
- package/dist/core/c4/resolve/service.js.map +1 -1
- package/dist/core/c4/resolve/steps.js +18 -0
- package/dist/core/c4/resolve/steps.js.map +1 -1
- 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/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 +126 -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-scan.js +26 -0
- package/dist/core/c4/source-scan.js.map +1 -1
- package/dist/core/c4/splice/authored-source.js +60 -13
- package/dist/core/c4/splice/authored-source.js.map +1 -1
- package/dist/core/c4/splice/contract.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 +17 -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 +154 -100
- package/dist/core/c4/splice/landscape-merge.js.map +1 -1
- package/dist/core/c4/splice/model/merge.js +140 -0
- package/dist/core/c4/splice/model/merge.js.map +1 -0
- package/dist/core/c4/splice/placement.js +14 -4
- package/dist/core/c4/splice/placement.js.map +1 -1
- package/dist/core/c4/workspace.js +2 -1
- package/dist/core/c4/workspace.js.map +1 -1
- package/dist/core/coherence/coherence.js +7 -0
- package/dist/core/coherence/coherence.js.map +1 -1
- package/dist/core/delta/delta.js +9 -0
- package/dist/core/delta/delta.js.map +1 -1
- package/dist/core/deployment/delta.js +16 -10
- package/dist/core/deployment/delta.js.map +1 -1
- package/dist/core/diff/base-state.js +21 -5
- package/dist/core/diff/base-state.js.map +1 -1
- package/dist/core/diff/victims.js +10 -1
- package/dist/core/diff/victims.js.map +1 -1
- package/dist/core/docs.js +29 -24
- package/dist/core/docs.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 +36 -8
- 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/explain/refusals.js +1 -1
- package/dist/core/explain/refusals.js.map +1 -1
- package/dist/core/explore/explore.js +44 -9
- package/dist/core/explore/explore.js.map +1 -1
- package/dist/core/fleet-context.js +47 -0
- package/dist/core/fleet-context.js.map +1 -1
- package/dist/core/gate/checks.js +5 -1
- package/dist/core/gate/checks.js.map +1 -1
- package/dist/core/gate/partners.js +65 -26
- package/dist/core/gate/partners.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/pack/living.js +47 -13
- package/dist/core/pack/living.js.map +1 -1
- package/dist/core/pack/pack.js +9 -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/repo/paths.js +45 -38
- package/dist/core/repo/paths.js.map +1 -1
- package/dist/core/repo/tree/render/body.js +45 -6
- package/dist/core/repo/tree/render/body.js.map +1 -1
- package/dist/core/repo/tree/render/projects.js +93 -35
- package/dist/core/repo/tree/render/projects.js.map +1 -1
- 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 +20 -4
- package/dist/core/repo/tree/render/stale.js.map +1 -1
- package/dist/core/repo/tree/render/views.js +149 -32
- package/dist/core/repo/tree/render/views.js.map +1 -1
- package/dist/core/repo/tree/walk.js +45 -2
- package/dist/core/repo/tree/walk.js.map +1 -1
- package/dist/core/scaffold/landscape.js +219 -9
- package/dist/core/scaffold/landscape.js.map +1 -1
- package/dist/core/staging/writes.js.map +1 -1
- package/dist/core/usecases/delta/claims.js +1 -0
- package/dist/core/usecases/delta/claims.js.map +1 -1
- package/dist/core/usecases/delta/overlay.js +4 -0
- package/dist/core/usecases/delta/overlay.js.map +1 -1
- package/dist/core/usecases/fleet.js +18 -6
- package/dist/core/usecases/fleet.js.map +1 -1
- package/dist/core/usecases/operations.js +7 -0
- package/dist/core/usecases/operations.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 +161 -0
- package/dist/core/usecases/service/flows.js.map +1 -0
- package/dist/core/verify/checklist.js +42 -10
- package/dist/core/verify/checklist.js.map +1 -1
- package/dist/core/vocabulary/issue.js.map +1 -1
- package/dist/core/vocabulary/maturity.js +51 -1
- package/dist/core/vocabulary/maturity.js.map +1 -1
- package/examples/README.md +30 -8
- package/examples/docs/architecture/landscape.likec4 +47 -0
- package/examples/docs/architecture/services.likec4 +70 -0
- package/examples/docs/architecture/subsystems.likec4 +3 -0
- package/examples/docs/architecture/usecases/order-notification.likec4 +5 -2
- 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/model.likec4 +58 -70
- package/examples/docs/services/payment-service/arch.spec.md +7 -4
- package/examples/docs/services/payment-service/model.likec4 +38 -39
- 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/health.yaml +8 -3
- package/examples/docs/services/platform/notification-service/model.likec4 +43 -64
- package/package.json +1 -1
- package/examples/docs/services/checkout-web/likec4.config.json +0 -4
- package/examples/docs/services/order-service/likec4.config.json +0 -4
- package/examples/docs/services/payment-service/likec4.config.json +0 -4
- package/examples/docs/services/platform/identity-service/likec4.config.json +0 -4
- package/examples/docs/services/platform/notification-service/likec4.config.json +0 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extend.js","sourceRoot":"","sources":["../../../../src/core/brief/map/extend.ts"],"names":[],"mappings":"AAiBA,uFAAuF;AACvF,MAAM,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC;AAC3B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC;AAE3B,6GAA6G;AAC7G,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAgBxC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,WAAW,CAAC,SAA2B;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CAAC;IACzB,IAAI,IAAI,GAAG,IAAI,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5C,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,KAAK,EAAE,CAAC;YAC3D,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACf,IAAI,GAAG,MAAM,IAAI,EAAE,CAAC;QACtB,CAAC;;YAAM,IAAI,GAAG,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC;IAClC,CAAC;IACD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC","sourcesContent":["/**\n * Which element of the fleet map an extending `model.likec4` says it is inside,\n * and what the brief's model example prints where the map has no answer.\n *\n * A module of its own beside `./owed.ts` for the reason that package exists: the\n * two are the fleet map's half of the brief, and `brief.ts` — which resolves the\n * artifact list against a docs repo — went past the file cap carrying the\n * substitution and its three-state reasoning. The subjects are distinct: this\n * one is about the ONE token an agent copies into three code positions, and\n * getting it wrong writes a model that cannot parse.\n *\n * Type-only import from `../` (`LandscapeContext`), which `verbatimModuleSyntax`\n * erases — so this package still value-imports nothing from its parent and the\n * package graph stays acyclic.\n */\nimport type { LandscapeContext } from \"../landscape.js\";\n\n/** The literals `targets.ts` leaves in the model target for this module to fill in. */\nexport const FQN = \"<fqn>\";\n/**\n * The service being adopted, in the model example's header. It is a placeholder\n * for the same reason `<fqn>` is: the example is handed to an agent that copies\n * it, and a header naming payment-service travelled verbatim into every other\n * service's model — the more convincingly for sitting one line above an\n * `extend` the brief HAD substituted.\n */\nexport const SVC = \"<svc>\";\n\n/** The token an example carries where loam has no id to substitute. Short on purpose — see `ExtendPoint`. */\nconst PLACEHOLDER = \"<your-element-id>\";\n\n/** What every `<fqn>` becomes, and the sentence that explains a placeholder. */\nexport interface ExtendPoint {\n id: string;\n /**\n * Why `id` is a placeholder, carried ONCE as a comment above the example\n * rather than substituted into it. `<fqn>` occupies three code positions —\n * the `extend` line, the source of a container edge, and `view of` — and the\n * explanation only reads as an instruction in the first: a 103-character\n * English sentence standing in for an id inside `view of … { include * }` is\n * noise the agent has to read past, on the command's most common invocation.\n */\n note?: string;\n}\n\n/**\n * Which element an extending `model.likec4` says it is inside — the id, when\n * the map leaves no doubt, and a placeholder plus the doubt when it does.\n *\n * Four answers because the map is in four states and only one of them has an\n * answer to give. With exactly ONE service-level element resolving to this\n * service, `extend <that id> {` is the file's first line and printing anything\n * else makes an agent go and look it up. With NONE, there is nothing to extend\n * yet — the landscape target below this one is what the agent must do first, and\n * saying so is what stops it inventing an id and writing a model that cannot\n * parse. With SEVERAL — `landscape.binding-duplicate`, a real and reported\n * state — loam must not choose: every element→service join in the fleet picks\n * one of them arbitrarily, so a brief that named one would be teaching an agent\n * the arbitrary answer as the right one. And when the map could not be READ\n * (`modelled === null`) the empty element list is evidence of nothing: \"write\n * the element into the map first\" is exactly the instruction that draws a second\n * box for a service the map already holds, so that arm says the map is\n * unreadable and asks for no map write at all.\n */\nexport function extendPoint(landscape: LandscapeContext): ExtendPoint {\n if (landscape.modelled === null) {\n return {\n id: PLACEHOLDER,\n note:\n \"the fleet map (architecture/) does not parse, so loam cannot say which element binds this directory. \" +\n \"Fix the map first — the landscape section of this brief names the documents that failed — then write \" +\n \"the id of the element that resolves to this service here.\",\n };\n }\n const ids = landscape.elements.map((e) => e.id);\n const [only, ...rest] = ids;\n if (only === undefined) {\n return {\n id: PLACEHOLDER,\n note:\n \"nothing in the fleet map resolves to this directory yet. Add the element to \" +\n \"architecture/landscape.likec4 first — the landscape target below — then write its id here.\",\n };\n }\n return { id: rest.length === 0 ? only : `<one of: ${ids.join(\", \")}>` };\n}\n\n/**\n * An example with its placeholders resolved, and the placeholder's explanation\n * prepended as a comment when there is one.\n *\n * Guarded on the example actually containing `<fqn>`: the note is about that\n * substitution, and heading an example that never had one with it would answer a\n * question its reader did not ask.\n */\nexport function exampleFor(example: string, extend: ExtendPoint, service: string): string {\n const body = example.replaceAll(FQN, extend.id).replaceAll(SVC, service);\n if (extend.note === undefined || !example.includes(FQN)) return body;\n return `${commentLines(`${extend.id} is a placeholder: ${extend.note}`)}\\n\\n${body}`;\n}\n\n/** One sentence as `//` lines, wrapped to the width the examples around it are written at. */\nfunction commentLines(text: string, width = 76): string {\n const out: string[] = [];\n let line = \"//\";\n for (const word of text.trim().split(/\\s+/)) {\n if (line !== \"//\" && line.length + 1 + word.length > width) {\n out.push(line);\n line = `// ${word}`;\n } else line = `${line} ${word}`;\n }\n out.push(line);\n return out.join(\"\\n\");\n}\n"]}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The write one service still owes `architecture/landscape.likec4`: the
|
|
3
|
+
* target the brief hands over (`landscapeArtifact` — its shape rules and the
|
|
4
|
+
* example block or edges) and the instruction in prose (`instructionFor` —
|
|
5
|
+
* the file, the block, and the consequence, in the four states a landscape
|
|
6
|
+
* can be in). Both exist to stop an agent inventing a parallel model: the
|
|
7
|
+
* fleet has already drawn some of these boxes and edges, and a baseline has to
|
|
8
|
+
* attach.
|
|
9
|
+
*
|
|
10
|
+
* A sub-package of `core/brief/` because that package sits at its five-file
|
|
11
|
+
* cap and `landscape.ts` — which READS what the map already says about the
|
|
12
|
+
* service and decides which state it is in — had parked at the file ceiling
|
|
13
|
+
* with its object literals collapsed onto single lines to fit. The two halves
|
|
14
|
+
* are distinct subjects: one is the derivation over a parsed document, the
|
|
15
|
+
* other is all of the prose plus the vocabulary that prose reads (`BrokenMap`
|
|
16
|
+
* and its builder live here for that reason — beside the arm that spends them,
|
|
17
|
+
* not in the caller that fills them). The only tie back to the parent is
|
|
18
|
+
* `import type { BriefTarget }`, which `verbatimModuleSyntax` erases, so this
|
|
19
|
+
* package value-imports nothing from `../` and the package graph stays acyclic.
|
|
20
|
+
*/
|
|
21
|
+
import { relative } from "node:path";
|
|
22
|
+
import { spellCall, edgeTemplates } from "../../c4/resolve/attested.js";
|
|
23
|
+
/**
|
|
24
|
+
* The LikeC4 identifier the fleet map's element for a service conventionally
|
|
25
|
+
* carries: the directory name, camel-cased. A suggestion and nothing more —
|
|
26
|
+
* `metadata { service '<id>' }` is what joins the element to the directory —
|
|
27
|
+
* but a brief handing over a concrete block gets followed, and one describing
|
|
28
|
+
* a block in prose gets improvised on.
|
|
29
|
+
*/
|
|
30
|
+
function elementIdFor(service) {
|
|
31
|
+
const parts = service.split(/[^A-Za-z0-9]+/).filter((p) => p !== "");
|
|
32
|
+
if (parts.length === 0)
|
|
33
|
+
return "service";
|
|
34
|
+
const head = parts[0].toLowerCase();
|
|
35
|
+
const tail = parts.slice(1).map((p) => p[0].toUpperCase() + p.slice(1).toLowerCase());
|
|
36
|
+
const id = head + tail.join("");
|
|
37
|
+
// LikeC4 identifiers cannot open with a digit; a service id can.
|
|
38
|
+
return /^[0-9]/.test(id) ? `svc${id[0].toUpperCase()}${id.slice(1)}` : id;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The write this service still owes `architecture/landscape.likec4`.
|
|
42
|
+
*
|
|
43
|
+
* `expects` is what the fleet ALREADY calls on the service — those edges exist
|
|
44
|
+
* in the map today, so the example draws the outbound side as a comment rather
|
|
45
|
+
* than telling an agent to duplicate an edge that is already there. With
|
|
46
|
+
* `elementId` set the example is EDGES ONLY, on the element that exists: a
|
|
47
|
+
* block here would be the second box the edgeless state exists to refuse, and
|
|
48
|
+
* the attested calls are listed as comments the agent turns into edges by
|
|
49
|
+
* naming the other party as the map spells it.
|
|
50
|
+
*/
|
|
51
|
+
function landscapeBlock(req) {
|
|
52
|
+
const { service, expects, present } = req;
|
|
53
|
+
if (req.elementId !== undefined) {
|
|
54
|
+
const id = req.elementId;
|
|
55
|
+
return [
|
|
56
|
+
"model {",
|
|
57
|
+
` // ... every element stays exactly as it is — ${id} already resolves to ${req.servicePath}/ ...`,
|
|
58
|
+
"",
|
|
59
|
+
" // every call in or out of it, one edge each, on the existing element:",
|
|
60
|
+
` // ${id} -> <callee> 'Calls <operationId>' { metadata { op '<operationId>' } }`,
|
|
61
|
+
` // <caller> -> ${id} 'Calls <operationId>' { metadata { op '<operationId>' } }`,
|
|
62
|
+
...(req.attested.length > 0
|
|
63
|
+
? [
|
|
64
|
+
` // the calls ${req.servicePath}/model.likec4 already attests, as the model spells the other party:`,
|
|
65
|
+
...req.attested.map((c) => ` // ${id} ${spellCall(c)}`),
|
|
66
|
+
]
|
|
67
|
+
: []),
|
|
68
|
+
"}",
|
|
69
|
+
].join("\n");
|
|
70
|
+
}
|
|
71
|
+
const id = elementIdFor(service);
|
|
72
|
+
const calls = expects.length > 0
|
|
73
|
+
? expects.map((op) => `// <caller> -> ${id} 'Calls ${op}' { metadata { op '${op}' } }`)
|
|
74
|
+
: [`// <caller> -> ${id} 'Calls <operationId>' { metadata { op '<operationId>' } }`];
|
|
75
|
+
const model = [
|
|
76
|
+
"model {",
|
|
77
|
+
...(present ? [" // ... the fleet's other services stay exactly as they are ...", ""] : []),
|
|
78
|
+
` ${id} = softwareSystem '${service}' {`,
|
|
79
|
+
" description '<one line: what this service is responsible for>'",
|
|
80
|
+
` metadata { service '${service}' }`,
|
|
81
|
+
" }",
|
|
82
|
+
"",
|
|
83
|
+
" // every call in or out of it, one edge each:",
|
|
84
|
+
...calls.map((line) => ` ${line}`),
|
|
85
|
+
"}",
|
|
86
|
+
];
|
|
87
|
+
// When the file does not exist the example is the WHOLE file, so it carries
|
|
88
|
+
// the `specification` block a bare `model` would be rejected without: the
|
|
89
|
+
// brief must never hand over a document `loam validate` refuses. When the file
|
|
90
|
+
// does exist the example is a fragment to splice, and repeating a
|
|
91
|
+
// `specification` block there would invite a second one.
|
|
92
|
+
return present
|
|
93
|
+
? model.join("\n")
|
|
94
|
+
: ["specification {", " element softwareSystem", "}", "", ...model].join("\n");
|
|
95
|
+
}
|
|
96
|
+
const OP_EDGE_RULE = "Draw every cross-service call as an edge carrying the operation it uses: `a -> b 'Calls createSplit' { metadata { op 'createSplit' } }`. The `op` must be an operationId the TARGET's openapi.yaml defines, or `spine.op-undefined` (error) — a broken contract between services.";
|
|
97
|
+
/** What the edgeless state costs when a check is watching — the ordinary case. */
|
|
98
|
+
const ISOLATED_RULE = (servicePath) => `\`loam validate --all\` reports \`landscape.service-isolated\` (warn) while this element has no edge and ` +
|
|
99
|
+
`\`${servicePath}/model.likec4\` declares a call across its boundary; with no such call it stays silent, so ` +
|
|
100
|
+
`an edgeless service that truly calls nothing is correct, and this brief says so.`;
|
|
101
|
+
/**
|
|
102
|
+
* The same state under `#external`, where NO check is watching.
|
|
103
|
+
*
|
|
104
|
+
* `landscape.service-isolated` removes every `#external` element from its
|
|
105
|
+
* subject set — the fix that stopped a foreign box answering for one of our
|
|
106
|
+
* directories — so on this tree the warning the brief used to promise cannot
|
|
107
|
+
* fire, measured: `validate --all` reports `landscape.matched` and the full
|
|
108
|
+
* `--json` findings walk holds no isolation finding at all. A brief that names
|
|
109
|
+
* a warning nothing will raise is worse than one that says nothing, because the
|
|
110
|
+
* agent budgets against the check instead of against the sentence.
|
|
111
|
+
*/
|
|
112
|
+
const EXTERNAL_RULE = (elementId, servicePath) => `\`${elementId}\` carries \`#external\`, so \`landscape.service-isolated\` will NOT fire here whatever this ` +
|
|
113
|
+
`element's edges are — the check skips every element the map marks as somebody else's, exactly as the two ` +
|
|
114
|
+
`binding checks do. Nothing in \`loam validate --all\` names this state; this brief is the only place it is ` +
|
|
115
|
+
`said. If \`${servicePath}/\` is ours, drop \`#external\` from the element and the check applies again; if it ` +
|
|
116
|
+
`is genuinely somebody else's, the calls belong on the element of the service that makes them.`;
|
|
117
|
+
/** The fleet map's own brief — assembled per service, because the write it owes names the service. */
|
|
118
|
+
export function landscapeArtifact(req) {
|
|
119
|
+
const { service, servicePath, elementId } = req;
|
|
120
|
+
const whole = "This file is the WHOLE FLEET's, not this service's. Add to it; never rewrite it. Everything already in `model { ... }` belongs to the other services, and replacing the file destroys their map along with their edges.";
|
|
121
|
+
return {
|
|
122
|
+
artifact: "landscape.likec4",
|
|
123
|
+
required: true,
|
|
124
|
+
purpose: `the fleet map — ${elementId === undefined
|
|
125
|
+
? "until an element here resolves to this directory, the service is documented"
|
|
126
|
+
: "an element here resolves to this directory and no edge touches it, so the service is drawn"} and invisible to every cross-service check`,
|
|
127
|
+
shape: elementId === undefined
|
|
128
|
+
? [
|
|
129
|
+
whole,
|
|
130
|
+
`Add one top-level element for the service, bound to its directory: \`metadata { service '${service}' }\`. Until an element resolves to \`${servicePath}/\`, \`loam validate --all\` reports \`landscape.service-unmodelled\` (error).`,
|
|
131
|
+
"Bind rather than rename: a binding whose id names no directory is `landscape.binding-unknown` (error), and two elements binding the SAME directory is `landscape.binding-duplicate` (warn) — every element→service join then picks one of them arbitrarily.",
|
|
132
|
+
OP_EDGE_RULE,
|
|
133
|
+
"If the file does not exist yet, create it with a `specification { ... }` block declaring the kinds you use, then the `model { ... }` block. A landscape that does not parse is `landscape.invalid` (error) and blinds every cross-service check at once.",
|
|
134
|
+
]
|
|
135
|
+
: [
|
|
136
|
+
whole,
|
|
137
|
+
`An element already resolves to \`${servicePath}/\` (\`${elementId}\`). Do NOT add a second one — two elements resolving to one directory is \`landscape.binding-duplicate\` (warn) and every element→service join then picks one of them arbitrarily. What the map lacks is every call in or out of it.`,
|
|
138
|
+
OP_EDGE_RULE,
|
|
139
|
+
req.external === true ? EXTERNAL_RULE(elementId, servicePath) : ISOLATED_RULE(servicePath),
|
|
140
|
+
],
|
|
141
|
+
example: landscapeBlock(req),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* That record, built from a project's diagnostics — beside the type it fills and
|
|
146
|
+
* the arm that reads it, rather than in the caller.
|
|
147
|
+
*
|
|
148
|
+
* Spelled exactly as `commands/validate/fleet/landscape.ts` spells it for
|
|
149
|
+
* `landscape.invalid` — deduped, relative to the docs root, `/`-joined — because
|
|
150
|
+
* the two surfaces are read one after the other on the same tree and an agent
|
|
151
|
+
* has to be able to tell that they name the same file.
|
|
152
|
+
*/
|
|
153
|
+
export function brokenDocuments(docsDir, land) {
|
|
154
|
+
const paths = [...new Set(land.errors.map((e) => e.sourceFsPath).filter((p) => p !== undefined))]
|
|
155
|
+
.map((abs) => relative(docsDir, abs).split(/[\\/]/).join("/"))
|
|
156
|
+
.sort();
|
|
157
|
+
return { paths, errors: land.errors.length };
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The fleet-map instruction, in the four states a landscape can be in. It says
|
|
161
|
+
* the file, the block, and the consequence, in that order. The consequence is
|
|
162
|
+
* the part agents acted on: "add an element" reads as tidiness, "until you do,
|
|
163
|
+
* `loam validate --all` fails and no cross-service check can see this service"
|
|
164
|
+
* reads as work.
|
|
165
|
+
*/
|
|
166
|
+
export function instructionFor(req) {
|
|
167
|
+
const { service, state, expects, servicePath } = req;
|
|
168
|
+
const id = elementIdFor(service);
|
|
169
|
+
const bind = `an element bound with \`metadata { service '${service}' }\``;
|
|
170
|
+
const consequence = `Until one resolves, \`loam validate --all\` reports \`landscape.service-unmodelled\` (error) for ` +
|
|
171
|
+
`${servicePath}/: the service is documented and invisible — no edge into it can be checked ` +
|
|
172
|
+
`against its openapi.yaml, and no feature can draw a call to it.`;
|
|
173
|
+
// `expects` is reachable only through inbound edges, so it is empty in every
|
|
174
|
+
// state that ASKS for an element — the edgeless one by definition. (The
|
|
175
|
+
// unparseable state can carry it, off the landscape-file fallback, and that
|
|
176
|
+
// arm deliberately does not append this sentence: it asks for no element, so
|
|
177
|
+
// "your element is what they will resolve to" would name one loam has not
|
|
178
|
+
// read.) It is threaded through anyway rather than dropped: the caller
|
|
179
|
+
// computes it once, and the day an unmodelled service can inherit an edge (a
|
|
180
|
+
// container-level binding, say) the sentence is already here.
|
|
181
|
+
const owed = expects.length > 0
|
|
182
|
+
? ` The fleet already calls ${expects.map((o) => `'${o}'`).join(", ")} on this service, so those edges exist; your element is what they will resolve to.`
|
|
183
|
+
: "";
|
|
184
|
+
if (state === "absent") {
|
|
185
|
+
return (`architecture/landscape.likec4 does not exist yet. Create it with a \`specification { ... }\` block ` +
|
|
186
|
+
`declaring the kinds you use and a \`model { ... }\` block containing ${bind} ` +
|
|
187
|
+
`(conventionally \`${id} = softwareSystem '${service}'\`), plus one edge per cross-service call, each ` +
|
|
188
|
+
`carrying \`metadata { op '<operationId>' }\`. ${consequence}${owed}`);
|
|
189
|
+
}
|
|
190
|
+
if (state === "unparseable") {
|
|
191
|
+
// The map is the whole `architecture/` project, so the document that broke
|
|
192
|
+
// is usually a SIBLING of the landscape — a use case, a palette. This arm
|
|
193
|
+
// named `architecture/landscape.likec4` regardless and told an agent to go
|
|
194
|
+
// and fix parse errors in a file that has none, contradicting the
|
|
195
|
+
// `landscape.invalid` that `validate --all` prints on the same tree one
|
|
196
|
+
// second later. The EDGELESS arm below carries the same rule in its own WHY:
|
|
197
|
+
// never name bytes loam did not read.
|
|
198
|
+
const b = req.broken;
|
|
199
|
+
const named = b === undefined || b.paths.length === 0
|
|
200
|
+
? "The fleet map (architecture/) does not parse"
|
|
201
|
+
: `${b.paths.join(", ")} ${b.paths.length === 1 ? "does" : "do"} not parse (${String(b.errors)} error(s)` +
|
|
202
|
+
`${b.paths.length === 1 ? "" : " between them"}), so the fleet map (architecture/) cannot be read`;
|
|
203
|
+
return (`${named} (\`landscape.invalid\`). Nothing can be said about what the map already models — not that it ` +
|
|
204
|
+
`lacks an element for ${servicePath}/, and not that it holds one — so this brief asks for no edit to it. ` +
|
|
205
|
+
`Fix the parse errors first (they blind every cross-service check at once, and \`loam validate --all\` ` +
|
|
206
|
+
`names the same file), then re-run \`loam adopt --service ${service}\`: it will say whether the map already ` +
|
|
207
|
+
`holds ${bind}, and adding one before then risks a second box for a service the map already draws ` +
|
|
208
|
+
`(\`landscape.binding-duplicate\`).`);
|
|
209
|
+
}
|
|
210
|
+
if (state === "edgeless")
|
|
211
|
+
return edgelessInstruction(req);
|
|
212
|
+
return (`Nothing in architecture/landscape.likec4 resolves to ${servicePath}/. ADD to that file — do not rewrite ` +
|
|
213
|
+
`it, every other service's map is in there — ${bind}, conventionally ` +
|
|
214
|
+
`\`${id} = softwareSystem '${service}'\`, inside the existing \`model { ... }\` block, and draw each ` +
|
|
215
|
+
`cross-service call as an edge carrying \`metadata { op '<operationId>' }\`. ${consequence}${owed}`);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* The fourth state, in two arms: with attested calls it names each and says to
|
|
219
|
+
* carry it up as ONE edge on the existing element; without, it points at the
|
|
220
|
+
* walk stops that produce the evidence and otherwise says draw NOTHING — an
|
|
221
|
+
* invented edge is a dependency the fleet then plans against. Neither arm asks
|
|
222
|
+
* for a second element, and both name the tags loam does not read.
|
|
223
|
+
*/
|
|
224
|
+
/**
|
|
225
|
+
* Which sentence the attested arm may end on: what will hold the agent to this
|
|
226
|
+
* edit, or the admission that nothing will.
|
|
227
|
+
*
|
|
228
|
+
* `landscape.service-isolated` skips every `#external` element, so on such a
|
|
229
|
+
* tree the promise "reports it until an edge lands" is one the check cannot
|
|
230
|
+
* keep — and the brief was making it on exactly the tree that fix was written
|
|
231
|
+
* for (verification 2026-09-04). The `#external` arm says so instead, and says
|
|
232
|
+
* how to make the check apply.
|
|
233
|
+
*/
|
|
234
|
+
function accountability(req, id) {
|
|
235
|
+
if (req.external === true) {
|
|
236
|
+
return (`\`${id}\` carries \`#external\`, so \`landscape.service-isolated\` will NOT fire here whatever you draw — ` +
|
|
237
|
+
`the check skips every element the map marks as somebody else's. Nothing in \`loam validate --all\` names ` +
|
|
238
|
+
`this state; this brief is the only place it is said. Drop \`#external\` from the element if ` +
|
|
239
|
+
`${req.servicePath}/ is ours, and the check applies again.`);
|
|
240
|
+
}
|
|
241
|
+
return ("`loam validate --all` reports `landscape.service-isolated` (warn) until an edge lands — ONE edge, on any " +
|
|
242
|
+
"of them: the check is touched/untouched, not a set difference, so nothing will name the calls you leave " +
|
|
243
|
+
"undrawn.");
|
|
244
|
+
}
|
|
245
|
+
function edgelessInstruction(req) {
|
|
246
|
+
const { servicePath, attested, foreignTags } = req;
|
|
247
|
+
const id = req.elementId ?? elementIdFor(req.service);
|
|
248
|
+
// "the fleet map (architecture/)" rather than the landscape FILE: the map is
|
|
249
|
+
// the whole project, an element may be declared in any document of it, and
|
|
250
|
+
// LikeC4 hands back no source document for an element — so naming a file
|
|
251
|
+
// here would be a claim about bytes loam did not read. The write still lands
|
|
252
|
+
// in `architecture/landscape.likec4`; the target's `path` says so.
|
|
253
|
+
const opening = `\`${id}\` in the fleet map (architecture/) resolves to ${servicePath}/ and no edge in the map touches it — ` +
|
|
254
|
+
`the service is drawn and invisible to every cross-service check.`;
|
|
255
|
+
const tags = foreignTags.length === 0
|
|
256
|
+
? ""
|
|
257
|
+
: ` The element carries ${foreignTags.map((t) => `#${t}`).join(", ")} — tags loam does not read; if one marks a ` +
|
|
258
|
+
`placeholder drawn ahead of adoption, clearing it is part of this edit, because a view written ` +
|
|
259
|
+
`\`exclude element.tag = #<that>\` keeps an adopted service hidden.`;
|
|
260
|
+
if (attested.length > 0) {
|
|
261
|
+
// The edge form follows the calls' direction (`edgeTemplates`): this arm
|
|
262
|
+
// used to spell the outbound form alone, so an inbound call was carried
|
|
263
|
+
// up backwards.
|
|
264
|
+
const forms = edgeTemplates(id, attested)
|
|
265
|
+
.map((t) => `\`${t}\``)
|
|
266
|
+
.join(" or ");
|
|
267
|
+
return (`${opening} ${servicePath}/model.likec4 already declares ${attested.length} call(s) across its boundary: ` +
|
|
268
|
+
`${attested.map(spellCall).join(", ")}. Carry each one up as ONE edge on \`${id}\`, collapsed to the ` +
|
|
269
|
+
`service — ${forms} for a call, \`publishes\`/\`consumes\` ` +
|
|
270
|
+
`for an event — naming the other party as the map already spells it; where the model's word names a ` +
|
|
271
|
+
`different thing in the map, say so in the hand-back instead of drawing it. Do not add a second element: ` +
|
|
272
|
+
`one already resolves. ${accountability(req, id)} Carry all of them up now, or say in the hand-back which ` +
|
|
273
|
+
`you did not and why.${tags}`);
|
|
274
|
+
}
|
|
275
|
+
return (`${opening} Nothing in ${servicePath}/model.likec4 attests a call across its boundary — absent, unparseable ` +
|
|
276
|
+
`and internal-only read alike here, because this brief may only name calls already attested. Draw the ones ` +
|
|
277
|
+
`the walk's outbound and message stops (stops 4 and 7) find, each as one edge on \`${id}\` carrying ` +
|
|
278
|
+
`\`metadata { op '<operationId>' }\` for a call or \`publishes\`/\`consumes\` for an event; if the service ` +
|
|
279
|
+
`genuinely makes and receives no call, draw NOTHING — an invented edge is a dependency the fleet then plans ` +
|
|
280
|
+
`against, and an edgeless element that is TRUE is a fact. Do not add a second element: one already resolves. ` +
|
|
281
|
+
`Nothing in \`loam validate --all\` names this state while the model attests no call; this brief is the only ` +
|
|
282
|
+
`place it is said.${tags}`);
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=owed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owed.js","sourceRoot":"","sources":["../../../../src/core/brief/map/owed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAqB,MAAM,8BAA8B,CAAC;AAG3F;;;;;;GAMG;AACH,SAAS,YAAY,CAAC,OAAe;IACnC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IACrE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACzC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC,WAAW,EAAE,CAAC;IACrC,MAAM,IAAI,GAAG,KAAK,CA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,CAC9B,CAAC;IACJ,CAAC;IACD,OAAO,CACL,GAAG,OAAO,eAAe,WAAW,yEAAyE;QAC7G,4GAA4G;QAC5G,qFAAqF,EAAE,cAAc;QACrG,4GAA4G;QAC5G,6GAA6G;QAC7G,8GAA8G;QAC9G,8GAA8G;QAC9G,oBAAoB,IAAI,EAAE,CAC3B,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The write one service still owes `architecture/landscape.likec4`: the\n * target the brief hands over (`landscapeArtifact` — its shape rules and the\n * example block or edges) and the instruction in prose (`instructionFor` —\n * the file, the block, and the consequence, in the four states a landscape\n * can be in). Both exist to stop an agent inventing a parallel model: the\n * fleet has already drawn some of these boxes and edges, and a baseline has to\n * attach.\n *\n * A sub-package of `core/brief/` because that package sits at its five-file\n * cap and `landscape.ts` — which READS what the map already says about the\n * service and decides which state it is in — had parked at the file ceiling\n * with its object literals collapsed onto single lines to fit. The two halves\n * are distinct subjects: one is the derivation over a parsed document, the\n * other is all of the prose plus the vocabulary that prose reads (`BrokenMap`\n * and its builder live here for that reason — beside the arm that spends them,\n * not in the caller that fills them). The only tie back to the parent is\n * `import type { BriefTarget }`, which `verbatimModuleSyntax` erases, so this\n * package value-imports nothing from `../` and the package graph stays acyclic.\n */\nimport { relative } from \"node:path\";\nimport type { LikeC4Error } from \"../../c4/likec4.js\";\nimport { spellCall, edgeTemplates, type AttestedCall } from \"../../c4/resolve/attested.js\";\nimport type { BriefTarget } from \"../targets.js\";\n\n/**\n * The LikeC4 identifier the fleet map's element for a service conventionally\n * carries: the directory name, camel-cased. A suggestion and nothing more —\n * `metadata { service '<id>' }` is what joins the element to the directory —\n * but a brief handing over a concrete block gets followed, and one describing\n * a block in prose gets improvised on.\n */\nfunction elementIdFor(service: string): string {\n const parts = service.split(/[^A-Za-z0-9]+/).filter((p) => p !== \"\");\n if (parts.length === 0) return \"service\";\n const head = parts[0]!.toLowerCase();\n const tail = parts.slice(1).map((p) => p[0]!.toUpperCase() + p.slice(1).toLowerCase());\n const id = head + tail.join(\"\");\n // LikeC4 identifiers cannot open with a digit; a service id can.\n return /^[0-9]/.test(id) ? `svc${id[0]!.toUpperCase()}${id.slice(1)}` : id;\n}\n\n/* ------------------------------------------------------------------ */\n/* The target */\n/* ------------------------------------------------------------------ */\n\n/** What `landscapeArtifact` needs — one record, because the fields only ever travel together. */\nexport interface LandscapeArtifactRequest {\n service: string;\n expects: string[];\n present: boolean;\n servicePath: string;\n /** The element that already resolves to the service — set only in the edgeless state — and the calls its model attests. */\n elementId?: string;\n /**\n * Whether that element carries `#external`. It changes what the brief may\n * PROMISE and nothing else: `landscape.service-isolated` removes every\n * `#external` element from its subject set, so on such a tree no warning holds\n * the agent accountable, and saying one will is the false promise this flag\n * exists to stop (verification 2026-09-04).\n */\n external?: boolean;\n attested: AttestedCall[];\n}\n\n/**\n * The write this service still owes `architecture/landscape.likec4`.\n *\n * `expects` is what the fleet ALREADY calls on the service — those edges exist\n * in the map today, so the example draws the outbound side as a comment rather\n * than telling an agent to duplicate an edge that is already there. With\n * `elementId` set the example is EDGES ONLY, on the element that exists: a\n * block here would be the second box the edgeless state exists to refuse, and\n * the attested calls are listed as comments the agent turns into edges by\n * naming the other party as the map spells it.\n */\nfunction landscapeBlock(req: LandscapeArtifactRequest): string {\n const { service, expects, present } = req;\n if (req.elementId !== undefined) {\n const id = req.elementId;\n return [\n \"model {\",\n ` // ... every element stays exactly as it is — ${id} already resolves to ${req.servicePath}/ ...`,\n \"\",\n \" // every call in or out of it, one edge each, on the existing element:\",\n ` // ${id} -> <callee> 'Calls <operationId>' { metadata { op '<operationId>' } }`,\n ` // <caller> -> ${id} 'Calls <operationId>' { metadata { op '<operationId>' } }`,\n ...(req.attested.length > 0\n ? [\n ` // the calls ${req.servicePath}/model.likec4 already attests, as the model spells the other party:`,\n ...req.attested.map((c) => ` // ${id} ${spellCall(c)}`),\n ]\n : []),\n \"}\",\n ].join(\"\\n\");\n }\n const id = elementIdFor(service);\n const calls =\n expects.length > 0\n ? expects.map((op) => `// <caller> -> ${id} 'Calls ${op}' { metadata { op '${op}' } }`)\n : [`// <caller> -> ${id} 'Calls <operationId>' { metadata { op '<operationId>' } }`];\n const model = [\n \"model {\",\n ...(present ? [\" // ... the fleet's other services stay exactly as they are ...\", \"\"] : []),\n ` ${id} = softwareSystem '${service}' {`,\n \" description '<one line: what this service is responsible for>'\",\n ` metadata { service '${service}' }`,\n \" }\",\n \"\",\n \" // every call in or out of it, one edge each:\",\n ...calls.map((line) => ` ${line}`),\n \"}\",\n ];\n // When the file does not exist the example is the WHOLE file, so it carries\n // the `specification` block a bare `model` would be rejected without: the\n // brief must never hand over a document `loam validate` refuses. When the file\n // does exist the example is a fragment to splice, and repeating a\n // `specification` block there would invite a second one.\n return present\n ? model.join(\"\\n\")\n : [\"specification {\", \" element softwareSystem\", \"}\", \"\", ...model].join(\"\\n\");\n}\n\nconst OP_EDGE_RULE =\n \"Draw every cross-service call as an edge carrying the operation it uses: `a -> b 'Calls createSplit' { metadata { op 'createSplit' } }`. The `op` must be an operationId the TARGET's openapi.yaml defines, or `spine.op-undefined` (error) — a broken contract between services.\";\n\n/** What the edgeless state costs when a check is watching — the ordinary case. */\nconst ISOLATED_RULE = (servicePath: string): string =>\n `\\`loam validate --all\\` reports \\`landscape.service-isolated\\` (warn) while this element has no edge and ` +\n `\\`${servicePath}/model.likec4\\` declares a call across its boundary; with no such call it stays silent, so ` +\n `an edgeless service that truly calls nothing is correct, and this brief says so.`;\n\n/**\n * The same state under `#external`, where NO check is watching.\n *\n * `landscape.service-isolated` removes every `#external` element from its\n * subject set — the fix that stopped a foreign box answering for one of our\n * directories — so on this tree the warning the brief used to promise cannot\n * fire, measured: `validate --all` reports `landscape.matched` and the full\n * `--json` findings walk holds no isolation finding at all. A brief that names\n * a warning nothing will raise is worse than one that says nothing, because the\n * agent budgets against the check instead of against the sentence.\n */\nconst EXTERNAL_RULE = (elementId: string, servicePath: string): string =>\n `\\`${elementId}\\` carries \\`#external\\`, so \\`landscape.service-isolated\\` will NOT fire here whatever this ` +\n `element's edges are — the check skips every element the map marks as somebody else's, exactly as the two ` +\n `binding checks do. Nothing in \\`loam validate --all\\` names this state; this brief is the only place it is ` +\n `said. If \\`${servicePath}/\\` is ours, drop \\`#external\\` from the element and the check applies again; if it ` +\n `is genuinely somebody else's, the calls belong on the element of the service that makes them.`;\n\n/** The fleet map's own brief — assembled per service, because the write it owes names the service. */\nexport function landscapeArtifact(req: LandscapeArtifactRequest): Omit<BriefTarget, \"path\" | \"exists\" | \"action\"> {\n const { service, servicePath, elementId } = req;\n const whole =\n \"This file is the WHOLE FLEET's, not this service's. Add to it; never rewrite it. Everything already in `model { ... }` belongs to the other services, and replacing the file destroys their map along with their edges.\";\n return {\n artifact: \"landscape.likec4\",\n required: true,\n purpose: `the fleet map — ${\n elementId === undefined\n ? \"until an element here resolves to this directory, the service is documented\"\n : \"an element here resolves to this directory and no edge touches it, so the service is drawn\"\n } and invisible to every cross-service check`,\n shape:\n elementId === undefined\n ? [\n whole,\n `Add one top-level element for the service, bound to its directory: \\`metadata { service '${service}' }\\`. Until an element resolves to \\`${servicePath}/\\`, \\`loam validate --all\\` reports \\`landscape.service-unmodelled\\` (error).`,\n \"Bind rather than rename: a binding whose id names no directory is `landscape.binding-unknown` (error), and two elements binding the SAME directory is `landscape.binding-duplicate` (warn) — every element→service join then picks one of them arbitrarily.\",\n OP_EDGE_RULE,\n \"If the file does not exist yet, create it with a `specification { ... }` block declaring the kinds you use, then the `model { ... }` block. A landscape that does not parse is `landscape.invalid` (error) and blinds every cross-service check at once.\",\n ]\n : [\n whole,\n `An element already resolves to \\`${servicePath}/\\` (\\`${elementId}\\`). Do NOT add a second one — two elements resolving to one directory is \\`landscape.binding-duplicate\\` (warn) and every element→service join then picks one of them arbitrarily. What the map lacks is every call in or out of it.`,\n OP_EDGE_RULE,\n req.external === true ? EXTERNAL_RULE(elementId, servicePath) : ISOLATED_RULE(servicePath),\n ],\n example: landscapeBlock(req),\n };\n}\n\n/* ------------------------------------------------------------------ */\n/* The instruction */\n/* ------------------------------------------------------------------ */\n\n/** Which documents of `architecture/` failed, and how many errors they carry between them. */\nexport interface BrokenMap {\n /** Docs-relative POSIX paths, deduped and sorted — spelled as `landscape.invalid` spells them. */\n paths: string[];\n errors: number;\n}\n\n/**\n * That record, built from a project's diagnostics — beside the type it fills and\n * the arm that reads it, rather than in the caller.\n *\n * Spelled exactly as `commands/validate/fleet/landscape.ts` spells it for\n * `landscape.invalid` — deduped, relative to the docs root, `/`-joined — because\n * the two surfaces are read one after the other on the same tree and an agent\n * has to be able to tell that they name the same file.\n */\nexport function brokenDocuments(docsDir: string, land: { errors: readonly LikeC4Error[] }): BrokenMap {\n const paths = [...new Set(land.errors.map((e) => e.sourceFsPath).filter((p): p is string => p !== undefined))]\n .map((abs) => relative(docsDir, abs).split(/[\\\\/]/).join(\"/\"))\n .sort();\n return { paths, errors: land.errors.length };\n}\n\n/** The inputs of `instructionFor` — a record, because the function sat at the parameter cap. */\nexport interface InstructionRequest {\n service: string;\n state: \"absent\" | \"unparseable\" | \"unmodelled\" | \"edgeless\";\n expects: string[];\n servicePath: string;\n /**\n * The documents that failed (`unparseable` state only). Optional so the other\n * three arms need not carry it, and the arm degrades to naming the project\n * rather than guessing a file when a caller has none.\n */\n broken?: BrokenMap;\n /** The element that already resolves to the service (edgeless state only), and its tags loam does not read. */\n elementId?: string;\n /** Whether that element carries `#external` — see `LandscapeArtifactRequest.external`. */\n external?: boolean;\n attested: AttestedCall[];\n foreignTags: string[];\n}\n\n/**\n * The fleet-map instruction, in the four states a landscape can be in. It says\n * the file, the block, and the consequence, in that order. The consequence is\n * the part agents acted on: \"add an element\" reads as tidiness, \"until you do,\n * `loam validate --all` fails and no cross-service check can see this service\"\n * reads as work.\n */\nexport function instructionFor(req: InstructionRequest): string {\n const { service, state, expects, servicePath } = req;\n const id = elementIdFor(service);\n const bind = `an element bound with \\`metadata { service '${service}' }\\``;\n const consequence =\n `Until one resolves, \\`loam validate --all\\` reports \\`landscape.service-unmodelled\\` (error) for ` +\n `${servicePath}/: the service is documented and invisible — no edge into it can be checked ` +\n `against its openapi.yaml, and no feature can draw a call to it.`;\n // `expects` is reachable only through inbound edges, so it is empty in every\n // state that ASKS for an element — the edgeless one by definition. (The\n // unparseable state can carry it, off the landscape-file fallback, and that\n // arm deliberately does not append this sentence: it asks for no element, so\n // \"your element is what they will resolve to\" would name one loam has not\n // read.) It is threaded through anyway rather than dropped: the caller\n // computes it once, and the day an unmodelled service can inherit an edge (a\n // container-level binding, say) the sentence is already here.\n const owed =\n expects.length > 0\n ? ` The fleet already calls ${expects.map((o) => `'${o}'`).join(\", \")} on this service, so those edges exist; your element is what they will resolve to.`\n : \"\";\n\n if (state === \"absent\") {\n return (\n `architecture/landscape.likec4 does not exist yet. Create it with a \\`specification { ... }\\` block ` +\n `declaring the kinds you use and a \\`model { ... }\\` block containing ${bind} ` +\n `(conventionally \\`${id} = softwareSystem '${service}'\\`), plus one edge per cross-service call, each ` +\n `carrying \\`metadata { op '<operationId>' }\\`. ${consequence}${owed}`\n );\n }\n if (state === \"unparseable\") {\n // The map is the whole `architecture/` project, so the document that broke\n // is usually a SIBLING of the landscape — a use case, a palette. This arm\n // named `architecture/landscape.likec4` regardless and told an agent to go\n // and fix parse errors in a file that has none, contradicting the\n // `landscape.invalid` that `validate --all` prints on the same tree one\n // second later. The EDGELESS arm below carries the same rule in its own WHY:\n // never name bytes loam did not read.\n const b = req.broken;\n const named =\n b === undefined || b.paths.length === 0\n ? \"The fleet map (architecture/) does not parse\"\n : `${b.paths.join(\", \")} ${b.paths.length === 1 ? \"does\" : \"do\"} not parse (${String(b.errors)} error(s)` +\n `${b.paths.length === 1 ? \"\" : \" between them\"}), so the fleet map (architecture/) cannot be read`;\n return (\n `${named} (\\`landscape.invalid\\`). Nothing can be said about what the map already models — not that it ` +\n `lacks an element for ${servicePath}/, and not that it holds one — so this brief asks for no edit to it. ` +\n `Fix the parse errors first (they blind every cross-service check at once, and \\`loam validate --all\\` ` +\n `names the same file), then re-run \\`loam adopt --service ${service}\\`: it will say whether the map already ` +\n `holds ${bind}, and adding one before then risks a second box for a service the map already draws ` +\n `(\\`landscape.binding-duplicate\\`).`\n );\n }\n if (state === \"edgeless\") return edgelessInstruction(req);\n return (\n `Nothing in architecture/landscape.likec4 resolves to ${servicePath}/. ADD to that file — do not rewrite ` +\n `it, every other service's map is in there — ${bind}, conventionally ` +\n `\\`${id} = softwareSystem '${service}'\\`, inside the existing \\`model { ... }\\` block, and draw each ` +\n `cross-service call as an edge carrying \\`metadata { op '<operationId>' }\\`. ${consequence}${owed}`\n );\n}\n\n/**\n * The fourth state, in two arms: with attested calls it names each and says to\n * carry it up as ONE edge on the existing element; without, it points at the\n * walk stops that produce the evidence and otherwise says draw NOTHING — an\n * invented edge is a dependency the fleet then plans against. Neither arm asks\n * for a second element, and both name the tags loam does not read.\n */\n/**\n * Which sentence the attested arm may end on: what will hold the agent to this\n * edit, or the admission that nothing will.\n *\n * `landscape.service-isolated` skips every `#external` element, so on such a\n * tree the promise \"reports it until an edge lands\" is one the check cannot\n * keep — and the brief was making it on exactly the tree that fix was written\n * for (verification 2026-09-04). The `#external` arm says so instead, and says\n * how to make the check apply.\n */\nfunction accountability(req: InstructionRequest, id: string): string {\n if (req.external === true) {\n return (\n `\\`${id}\\` carries \\`#external\\`, so \\`landscape.service-isolated\\` will NOT fire here whatever you draw — ` +\n `the check skips every element the map marks as somebody else's. Nothing in \\`loam validate --all\\` names ` +\n `this state; this brief is the only place it is said. Drop \\`#external\\` from the element if ` +\n `${req.servicePath}/ is ours, and the check applies again.`\n );\n }\n return (\n \"`loam validate --all` reports `landscape.service-isolated` (warn) until an edge lands — ONE edge, on any \" +\n \"of them: the check is touched/untouched, not a set difference, so nothing will name the calls you leave \" +\n \"undrawn.\"\n );\n}\n\nfunction edgelessInstruction(req: InstructionRequest): string {\n const { servicePath, attested, foreignTags } = req;\n const id = req.elementId ?? elementIdFor(req.service);\n // \"the fleet map (architecture/)\" rather than the landscape FILE: the map is\n // the whole project, an element may be declared in any document of it, and\n // LikeC4 hands back no source document for an element — so naming a file\n // here would be a claim about bytes loam did not read. The write still lands\n // in `architecture/landscape.likec4`; the target's `path` says so.\n const opening =\n `\\`${id}\\` in the fleet map (architecture/) resolves to ${servicePath}/ and no edge in the map touches it — ` +\n `the service is drawn and invisible to every cross-service check.`;\n const tags =\n foreignTags.length === 0\n ? \"\"\n : ` The element carries ${foreignTags.map((t) => `#${t}`).join(\", \")} — tags loam does not read; if one marks a ` +\n `placeholder drawn ahead of adoption, clearing it is part of this edit, because a view written ` +\n `\\`exclude element.tag = #<that>\\` keeps an adopted service hidden.`;\n if (attested.length > 0) {\n // The edge form follows the calls' direction (`edgeTemplates`): this arm\n // used to spell the outbound form alone, so an inbound call was carried\n // up backwards.\n const forms = edgeTemplates(id, attested)\n .map((t) => `\\`${t}\\``)\n .join(\" or \");\n return (\n `${opening} ${servicePath}/model.likec4 already declares ${attested.length} call(s) across its boundary: ` +\n `${attested.map(spellCall).join(\", \")}. Carry each one up as ONE edge on \\`${id}\\`, collapsed to the ` +\n `service — ${forms} for a call, \\`publishes\\`/\\`consumes\\` ` +\n `for an event — naming the other party as the map already spells it; where the model's word names a ` +\n `different thing in the map, say so in the hand-back instead of drawing it. Do not add a second element: ` +\n `one already resolves. ${accountability(req, id)} Carry all of them up now, or say in the hand-back which ` +\n `you did not and why.${tags}`\n );\n }\n return (\n `${opening} Nothing in ${servicePath}/model.likec4 attests a call across its boundary — absent, unparseable ` +\n `and internal-only read alike here, because this brief may only name calls already attested. Draw the ones ` +\n `the walk's outbound and message stops (stops 4 and 7) find, each as one edge on \\`${id}\\` carrying ` +\n `\\`metadata { op '<operationId>' }\\` for a call or \\`publishes\\`/\\`consumes\\` for an event; if the service ` +\n `genuinely makes and receives no call, draw NOTHING — an invented edge is a dependency the fleet then plans ` +\n `against, and an edgeless element that is TRUE is a fact. Do not add a second element: one already resolves. ` +\n `Nothing in \\`loam validate --all\\` names this state while the model attests no call; this brief is the only ` +\n `place it is said.${tags}`\n );\n}\n"]}
|
|
@@ -5,8 +5,23 @@
|
|
|
5
5
|
* one a later check depends on, and test/agent-contract.test.ts pins the
|
|
6
6
|
* mapping. This module is the list alone — `serviceBrief` (brief.ts) resolves
|
|
7
7
|
* it against a docs repo, and the fleet map's own target, whose block names
|
|
8
|
-
* the service, is assembled per service in
|
|
8
|
+
* the service, is assembled per service in map/owed.ts.
|
|
9
9
|
*/
|
|
10
|
+
/**
|
|
11
|
+
* The service-local use-case directory, and the one artifact key `ServicePaths`
|
|
12
|
+
* deliberately does NOT carry.
|
|
13
|
+
*
|
|
14
|
+
* `repo/paths.ts` spells the paths loam JOINS ON — the ones a check resolves, a
|
|
15
|
+
* writer writes and the tree walk classifies a directory by. This is not one of
|
|
16
|
+
* them: the slot a service's flows are graded out of is the service's whole
|
|
17
|
+
* LikeC4 project, every `.likec4` under its directory
|
|
18
|
+
* (`core/usecases/service/flows.ts`), and `usecases/<name>.likec4` is the
|
|
19
|
+
* CONVENTION the brief publishes for it. Putting the directory in
|
|
20
|
+
* `ARTIFACT_FILES` would be worse than redundant — `isServiceArtifactName`
|
|
21
|
+
* reads that table, so a `usecases/` directory anywhere under `services/` would
|
|
22
|
+
* mint a service.
|
|
23
|
+
*/
|
|
24
|
+
export const USECASES_DIR = "usecases";
|
|
10
25
|
/** The artifacts, in the order a baseline is best written in. */
|
|
11
26
|
export const ARTIFACTS = [
|
|
12
27
|
{
|
|
@@ -21,41 +36,41 @@ export const ARTIFACTS = [
|
|
|
21
36
|
// `loam validate` passing means more than it does. They now live in
|
|
22
37
|
// UNCHECKED, where their status is the point.
|
|
23
38
|
shape: [
|
|
24
|
-
"
|
|
25
|
-
"A `model { ... }` block
|
|
26
|
-
"
|
|
27
|
-
"
|
|
39
|
+
"No `specification` block of its own: the kinds and tags come from `architecture/landscape.likec4` (a kind this model needs that the map does not declare — `element database`, `element queue` — is added there, once). A model that declares its own element kinds is the standalone shape: it still parses, alone, and loam then reports where its copies of the map's elements diverge (`c4.declaration-diverged`). New models never use it.",
|
|
40
|
+
"A `model { ... }` block whose body is `extend <id> { ... }` — the fully-qualified id of the element the fleet map already binds to this directory (the landscape section of this brief names it; write the element into the map first when none resolves) — with containers and components nested inside. The binding and the description live on the map's element; this file may add `#tags` and metadata to it and never a description. The whole file has to parse: `loam validate` runs LikeC4 in-process over the map plus this file and reports `c4.invalid` with line numbers.",
|
|
41
|
+
"A store or component this service OWNS goes INSIDE the `extend <fqn> { }` block, where its id becomes `<fqn>.<name>`: that is the only place an extending model may declare an element, and one declared anywhere else is `c4.element-unowned` (warn) — the fleet project then carries this service's private copy of somebody else's box. A call to another system is an edge from the container that makes it to the other party's element as the map spells it — `marketplace.paymentService.api -> stripe 'Authorizes cards'` — never a copy of that element: the map declares a system this service merely REACHES once, and another service's internals belong in that service's own model. The map still carries the service-level edge the fleet checks read (`metadata { op '<operationId>' }` graded by `spine.op-undefined`); draw it there too.",
|
|
42
|
+
"The map's element is the binding: `metadata { service '<id>' }` on the element you extend (the landscape target below). Without it the element's title has to equal the directory name — and then renaming the box silently unlinks every check that joined the two. Until something in the map resolves to `services/<id>/`, `loam validate --all` reports `landscape.service-unmodelled` and there is no element for this file to extend.",
|
|
28
43
|
],
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
44
|
+
// `<fqn>` and `<svc>` are PLACEHOLDERS this module leaves literal:
|
|
45
|
+
// `serviceBrief` (brief.ts) substitutes the landscape element's real id and
|
|
46
|
+
// the service being adopted, and for `<fqn>` the "the element's id in
|
|
47
|
+
// architecture/landscape.likec4" wording where the map holds none. ARTIFACTS
|
|
48
|
+
// stays a static constant — a target list that varied per repository would
|
|
49
|
+
// be a second thing to keep true. The header carried the literal
|
|
50
|
+
// `payment-service` for every service, beside an `extend` line that WAS
|
|
51
|
+
// substituted, so the half of the example that was personalised taught an
|
|
52
|
+
// agent the other half had been too.
|
|
53
|
+
example: `// <svc>'s own C4 — what is INSIDE the element the fleet map binds to
|
|
54
|
+
// this directory. The map declares the kinds and the element; this
|
|
55
|
+
// file extends it and re-declares nothing.
|
|
34
56
|
model {
|
|
35
|
-
|
|
36
|
-
description 'Owns payment authorization and capture'
|
|
37
|
-
metadata { service 'payment-service' }
|
|
38
|
-
|
|
57
|
+
extend <fqn> {
|
|
39
58
|
api = container 'HTTP API'
|
|
40
|
-
ledger =
|
|
59
|
+
ledger = database 'Ledger store'
|
|
60
|
+
api -> ledger 'Writes every authorization'
|
|
41
61
|
}
|
|
62
|
+
// 'stripe' stands for the OTHER party, spelled as the fleet map already
|
|
63
|
+
// declares it — loam has no id to substitute here, and inventing one is
|
|
64
|
+
// the edge that makes the model unresolvable. The containers above are
|
|
65
|
+
// this example's own: name yours after what they are.
|
|
66
|
+
<fqn>.api -> stripe 'Authorizes cards'
|
|
42
67
|
}
|
|
43
68
|
|
|
44
|
-
// Views are LikeC4's, not loam's
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
// a dynamic view's declared steps, and only in the fleet landscape).
|
|
48
|
-
// Keep it for the renderer, which does draw it — 'npx likec4 start' from the docs
|
|
49
|
-
// repo ROOT, once 'loam subsystem sync' has written services/<id>/likec4.config.json:
|
|
50
|
-
// that file is loam's, never yours, and it is what registers this model as a
|
|
51
|
-
// LikeC4 project of its own beside the fleet map. The root project stays scoped
|
|
52
|
-
// to architecture/ (the root likec4.config.json) because every model declares
|
|
53
|
-
// its own 'specification' block, and a root that merged them would read each
|
|
54
|
-
// declaration as a duplicate.
|
|
55
|
-
// Scoped to one service 'include *' is cheap; the same line in
|
|
56
|
-
// architecture/landscape.likec4 walks every call in the fleet and takes minutes.
|
|
69
|
+
// Views are LikeC4's, not loam's (docs/DESIGN.md rule 26). Render with
|
|
70
|
+
// 'npx likec4 start' from the docs repo root: this file is part of the root
|
|
71
|
+
// project, beside the map — nothing else to write.
|
|
57
72
|
views {
|
|
58
|
-
view of
|
|
73
|
+
view of <fqn> {
|
|
59
74
|
include *
|
|
60
75
|
}
|
|
61
76
|
}
|
|
@@ -127,6 +142,7 @@ Operations: refundPayment
|
|
|
127
142
|
shape: [
|
|
128
143
|
"Same grammar and frontmatter as spec.md: `## Requirements`, `### Requirement:` + `#### Scenario:` with Given/When/Then. The same checks read it.",
|
|
129
144
|
"A `Covers:` line per requirement names what its scenarios exercise: a C4 element id (`paymentService.db`), an edge (`paymentService -> kafka`), or a health signal from health.yaml (`alert:<id>` / `sli:<id>`). Every entry must resolve, or `covers.unknown` (warn) flags the typo.",
|
|
145
|
+
"A requirement whose `Covers:` names containers may have its hop sequence drawn as a `dynamic view` in a `.likec4` beside model.likec4 (`usecases/<name>.likec4` by convention; the renderer's per-service project reads every `.likec4` under the directory, and loam reads the same set), tagged `#req-<Requirement-ID>` — with the tag declared in `architecture/landscape.likec4`'s `specification` where the model extends the map, or in model.likec4's own block where it declares one; declaring it in BOTH is a duplicate, and the code lands where the second declaration's FILE is, not at fleet altitude: `c4.invalid` (an ERROR, and the model's grading is suspended behind it) when the tags-only block is in model.likec4, `usecase.flow-invalid` when it is in a sibling. `c4.fleet-project-invalid` is the fleet-scope class one step out — TWO SERVICES each declaring the same tag locally, which no per-service project sees. Graded by `loam validate --service <id>` (`usecase.step-unbacked` when a hop names a call the model does not declare, `usecase.requirement-unresolved` when the tag names no `Requirement-ID` here or in spec.md). Optional; nothing grades its absence. Never `architecture/usecases/`, which cannot resolve a container.",
|
|
130
146
|
"Optional, but expected for a service with real architecture: every alert/SLI health.yaml declares wants a covering requirement here (`health.uncovered`, warn) — a signal nothing tests is dashboard decoration.",
|
|
131
147
|
"Write the obligations no business requirement states — the transactional outbox, what a caller's retry may assume, what pages whom. An arch scenario becomes an integration/ops test, not an acceptance test.",
|
|
132
148
|
],
|
|
@@ -152,6 +168,55 @@ Covers: paymentService.db, paymentService -> kafka
|
|
|
152
168
|
- **Given** an event in the outbox
|
|
153
169
|
- **When** the broker is unavailable
|
|
154
170
|
- **Then** the state stays committed and the event is published once it returns
|
|
171
|
+
`,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
artifact: "usecases/<name>.likec4",
|
|
175
|
+
key: "usecasesDir",
|
|
176
|
+
// Never required, and here the optionality is a RULE rather than a
|
|
177
|
+
// judgement. docs/DESIGN.md rule 26 — "presence is never owed. A model with
|
|
178
|
+
// no views is missing nothing loam wants, and no check may grade its
|
|
179
|
+
// absence" — is enforced by scripts/arch-check.mjs, not merely written, so
|
|
180
|
+
// there is no `service.usecases-missing` and there never will be one.
|
|
181
|
+
//
|
|
182
|
+
// The slot is briefed anyway because a team cannot choose a slot nobody
|
|
183
|
+
// named. The grader landed 2026-09-03 (`core/usecases/service/flows.ts`) and
|
|
184
|
+
// `c4.valid` has been reporting ` · K tagged flow(s) graded` ever since, on
|
|
185
|
+
// an axis nothing scaffolded, briefed or named — so the only way to discover
|
|
186
|
+
// it was to read the source. Publication is the whole of this entry: every
|
|
187
|
+
// rule below is either a check that already exists or a convention loam
|
|
188
|
+
// states and never grades, and each says which it is.
|
|
189
|
+
required: false,
|
|
190
|
+
purpose: "optional — one requirement's hop sequence, drawn as a LikeC4 dynamic view over this service's own containers",
|
|
191
|
+
shape: [
|
|
192
|
+
"A `dynamic view` in a `.likec4` under this service's directory. THE SLOT IS THE PROJECT: `loam subsystem sync` registers every `.likec4` under `services/<…>/<id>/` as one LikeC4 project, and loam reads exactly the set the renderer reads — `model.likec4` plus every sibling, recursively. `usecases/<name>.likec4` is the convention this brief publishes, and `<name>` is yours. Never `architecture/usecases/`, which is a different project: it holds the map and no service's containers, so a hop naming one is `landscape.invalid` for the whole fleet.",
|
|
193
|
+
"`#req-<Requirement-ID>` as the FIRST thing in the view body, before `title` — written after it, LikeC4 reports five parse errors and none of them mentions tags. The tag is the opt-in: an untagged view is somebody's hand-drawn diagram and loam never says a word about it. The slug is the `Requirement-ID` from this service's own `spec.md` or `arch.spec.md` with every character outside `[A-Za-z0-9_-]` flattened to `-`; a slug naming no requirement of this service is `usecase.requirement-unresolved`. Several `#req-` tags on one view are legal and normal.",
|
|
194
|
+
"DECLARE the tag exactly once — in `architecture/landscape.likec4`'s `specification` block when this model EXTENDS the map (the usual shape, and the block the whole root project shares), or in `model.likec4`'s own `specification` when the model STANDS ALONE. Declaring it in both is a duplicate, and the code lands where the SECOND declaration's file is: `c4.invalid` when a tags-only block sits in model.likec4, `usecase.flow-invalid` when it sits in a sibling. Two SERVICES each declaring the same tag locally is the fleet-scope class one step out, `c4.fleet-project-invalid`.",
|
|
195
|
+
"Every hop must be backed by a relationship the model already declares, or it is `usecase.step-unbacked` — LikeC4 itself reports nothing for an unbacked hop, so the diagram renders and every other check stays green. A return step is written `<target> <- <source>`: a reply is attributed to the CALL it answers. A hop whose caller and provider resolve to the SAME service never owes an `operationId`, which is what makes this altitude cheap: `usecase.step-unlinked` is silent inside one service.",
|
|
196
|
+
"Namespace the view id by the service — `uc_payment_service_authorize`, not `uc_authorize`. An EXTENDING model's views live in the ROOT project beside the map, so view ids are one flat namespace across the whole fleet: two services minting `uc_authorize` makes the renderer refuse the entire project. Ids beginning `subsystem_` or `service_` are loam's own (`subsystem.view-id-collision`).",
|
|
197
|
+
"Title it `'<subsystem path> / <service id> / <use case>'`. LikeC4 has no view-folder syntax — it splits a view title on `/` into browser folders and shows only the last segment (measured at 1.59.2) — so that convention lands the flow in the same folder as the generated overview of its service in `architecture/services.likec4`. **Nothing checks this**: it is a convention loam states and never grades, exactly like the EARS form in spec.md.",
|
|
198
|
+
"OPTIONAL, and its absence is graded by nothing, ever. That is docs/DESIGN.md rule 26 and it is enforced. Write one where a requirement's `Covers:` names containers and the sequence is the thing that is hard to hold in the head; write none otherwise. `c4.valid` reports ` · K tagged flow(s) graded` when the project declares any, and that count is the only place a healthy flow appears at all.",
|
|
199
|
+
],
|
|
200
|
+
example: `// One of <svc>'s own use cases: the hops behind ONE requirement of its
|
|
201
|
+
// arch.spec.md, over its OWN containers. Optional — nothing grades the
|
|
202
|
+
// absence of this file, and an untagged view here is never graded either.
|
|
203
|
+
views {
|
|
204
|
+
// Namespace the id by the service, underscores for hyphens: an extending
|
|
205
|
+
// model's views share ONE flat id namespace with the whole root project.
|
|
206
|
+
dynamic view uc_authorize_payment {
|
|
207
|
+
// The tag comes FIRST. Written after 'title' this is five parse errors.
|
|
208
|
+
// AUTH-1 is a Requirement-ID in this service's spec.md or arch.spec.md.
|
|
209
|
+
#req-AUTH-1
|
|
210
|
+
title '<subsystem path> / <svc> / Authorize a payment'
|
|
211
|
+
description 'What the service does between the request and the answer'
|
|
212
|
+
|
|
213
|
+
// Every hop is backed by a relationship model.likec4 declares. Both of
|
|
214
|
+
// these are inside one service, so neither owes an operationId.
|
|
215
|
+
<fqn>.api -> <fqn>.ledger 'Records the authorization'
|
|
216
|
+
// A reply is attributed to the call it answers, hence the '<-'.
|
|
217
|
+
<fqn>.api <- <fqn>.ledger 'Confirms the write'
|
|
218
|
+
}
|
|
219
|
+
}
|
|
155
220
|
`,
|
|
156
221
|
},
|
|
157
222
|
{
|