ddd-ts-kit 0.84.0 → 0.85.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.fr.md +60 -27
  3. package/README.md +57 -28
  4. package/dist/check/canonical/stray-entry.js +3 -2
  5. package/dist/check/canonical/stray-entry.js.map +1 -1
  6. package/dist/check/explain/layout-docs.js +1 -1
  7. package/dist/check/explain/layout-docs.js.map +1 -1
  8. package/dist/check/explain/tree-docs.d.ts.map +1 -1
  9. package/dist/check/explain/tree-docs.js +3 -2
  10. package/dist/check/explain/tree-docs.js.map +1 -1
  11. package/dist/check/explain/wiring-docs.d.ts.map +1 -1
  12. package/dist/check/explain/wiring-docs.js +17 -6
  13. package/dist/check/explain/wiring-docs.js.map +1 -1
  14. package/dist/check/fixtures/authz-policy-fixtures.d.ts.map +1 -1
  15. package/dist/check/fixtures/authz-policy-fixtures.js +4 -4
  16. package/dist/check/fixtures/authz-policy-fixtures.js.map +1 -1
  17. package/dist/check/fixtures/constructor-injection-fixtures.d.ts.map +1 -1
  18. package/dist/check/fixtures/constructor-injection-fixtures.js +10 -8
  19. package/dist/check/fixtures/constructor-injection-fixtures.js.map +1 -1
  20. package/dist/check/fixtures/declarations-fixtures.d.ts.map +1 -1
  21. package/dist/check/fixtures/declarations-fixtures.js +54 -9
  22. package/dist/check/fixtures/declarations-fixtures.js.map +1 -1
  23. package/dist/check/fixtures/declared-declarations.d.ts +7 -0
  24. package/dist/check/fixtures/declared-declarations.d.ts.map +1 -0
  25. package/dist/check/fixtures/declared-declarations.js +21 -0
  26. package/dist/check/fixtures/declared-declarations.js.map +1 -0
  27. package/dist/check/fixtures/declared-project.d.ts +4 -1
  28. package/dist/check/fixtures/declared-project.d.ts.map +1 -1
  29. package/dist/check/fixtures/declared-project.js +17 -9
  30. package/dist/check/fixtures/declared-project.js.map +1 -1
  31. package/dist/check/fixtures/paths.d.ts +1 -0
  32. package/dist/check/fixtures/paths.d.ts.map +1 -1
  33. package/dist/check/fixtures/paths.js +1 -0
  34. package/dist/check/fixtures/paths.js.map +1 -1
  35. package/dist/check/fixtures/signature-project.d.ts +3 -3
  36. package/dist/check/fixtures/signature-project.js +3 -3
  37. package/dist/check/fixtures/signature.d.ts +2 -1
  38. package/dist/check/fixtures/signature.d.ts.map +1 -1
  39. package/dist/check/fixtures/signature.js +2 -1
  40. package/dist/check/fixtures/signature.js.map +1 -1
  41. package/dist/check/fixtures/single-file-declarations.d.ts +7 -0
  42. package/dist/check/fixtures/single-file-declarations.d.ts.map +1 -0
  43. package/dist/check/fixtures/single-file-declarations.js +21 -0
  44. package/dist/check/fixtures/single-file-declarations.js.map +1 -0
  45. package/dist/check/rules/clean-file-size.d.ts.map +1 -1
  46. package/dist/check/rules/clean-file-size.js +9 -1
  47. package/dist/check/rules/clean-file-size.js.map +1 -1
  48. package/dist/check/rules/declarations-barrel-current.d.ts.map +1 -1
  49. package/dist/check/rules/declarations-barrel-current.js +56 -23
  50. package/dist/check/rules/declarations-barrel-current.js.map +1 -1
  51. package/dist/check/rules/naming-suffix.d.ts.map +1 -1
  52. package/dist/check/rules/naming-suffix.js +7 -3
  53. package/dist/check/rules/naming-suffix.js.map +1 -1
  54. package/dist/check/support/is-generated-context-file.d.ts +5 -1
  55. package/dist/check/support/is-generated-context-file.d.ts.map +1 -1
  56. package/dist/check/support/is-generated-context-file.js +11 -5
  57. package/dist/check/support/is-generated-context-file.js.map +1 -1
  58. package/dist/commands/docs.d.ts.map +1 -1
  59. package/dist/commands/docs.js +23 -11
  60. package/dist/commands/docs.js.map +1 -1
  61. package/dist/commands/generate.d.ts.map +1 -1
  62. package/dist/commands/generate.js +7 -4
  63. package/dist/commands/generate.js.map +1 -1
  64. package/dist/commands/print-report.js +1 -0
  65. package/dist/commands/print-report.js.map +1 -1
  66. package/dist/commit/is-derived.js +4 -4
  67. package/dist/commit/is-derived.js.map +1 -1
  68. package/dist/declared/barrel-file.d.ts +4 -1
  69. package/dist/declared/barrel-file.d.ts.map +1 -1
  70. package/dist/declared/barrel-file.js +4 -1
  71. package/dist/declared/barrel-file.js.map +1 -1
  72. package/dist/declared/context-declarations.d.ts +24 -0
  73. package/dist/declared/context-declarations.d.ts.map +1 -0
  74. package/dist/declared/context-declarations.js +22 -0
  75. package/dist/declared/context-declarations.js.map +1 -0
  76. package/dist/declared/declarations-folder-of.d.ts +10 -0
  77. package/dist/declared/declarations-folder-of.d.ts.map +1 -0
  78. package/dist/declared/declarations-folder-of.js +13 -0
  79. package/dist/declared/declarations-folder-of.js.map +1 -0
  80. package/dist/declared/folder-declarations-file.d.ts +7 -0
  81. package/dist/declared/folder-declarations-file.d.ts.map +1 -0
  82. package/dist/declared/folder-declarations-file.js +10 -0
  83. package/dist/declared/folder-declarations-file.js.map +1 -0
  84. package/dist/declared/index.d.ts +8 -1
  85. package/dist/declared/index.d.ts.map +1 -1
  86. package/dist/declared/index.js +8 -1
  87. package/dist/declared/index.js.map +1 -1
  88. package/dist/declared/is-declarations-file.d.ts +7 -0
  89. package/dist/declared/is-declarations-file.d.ts.map +1 -0
  90. package/dist/declared/is-declarations-file.js +20 -0
  91. package/dist/declared/is-declarations-file.js.map +1 -0
  92. package/dist/declared/keeps-single-file.d.ts +11 -0
  93. package/dist/declared/keeps-single-file.d.ts.map +1 -0
  94. package/dist/declared/keeps-single-file.js +23 -0
  95. package/dist/declared/keeps-single-file.js.map +1 -0
  96. package/dist/declared/render-declarations.d.ts +18 -0
  97. package/dist/declared/render-declarations.d.ts.map +1 -0
  98. package/dist/declared/render-declarations.js +37 -0
  99. package/dist/declared/render-declarations.js.map +1 -0
  100. package/dist/declared/render-folder-declarations.d.ts +11 -0
  101. package/dist/declared/render-folder-declarations.d.ts.map +1 -0
  102. package/dist/declared/render-folder-declarations.js +23 -0
  103. package/dist/declared/render-folder-declarations.js.map +1 -0
  104. package/dist/declared/single-file-declarations.d.ts +9 -0
  105. package/dist/declared/single-file-declarations.d.ts.map +1 -0
  106. package/dist/declared/single-file-declarations.js +14 -0
  107. package/dist/declared/single-file-declarations.js.map +1 -0
  108. package/dist/declared/single-file-notice.d.ts +8 -0
  109. package/dist/declared/single-file-notice.d.ts.map +1 -0
  110. package/dist/declared/single-file-notice.js +9 -0
  111. package/dist/declared/single-file-notice.js.map +1 -0
  112. package/dist/derived/is-derived.d.ts +4 -3
  113. package/dist/derived/is-derived.d.ts.map +1 -1
  114. package/dist/derived/is-derived.js +8 -8
  115. package/dist/derived/is-derived.js.map +1 -1
  116. package/dist/describe/read-consumed-events.js +7 -2
  117. package/dist/describe/read-consumed-events.js.map +1 -1
  118. package/dist/dev/refresh-declarations.d.ts.map +1 -1
  119. package/dist/dev/refresh-declarations.js +3 -2
  120. package/dist/dev/refresh-declarations.js.map +1 -1
  121. package/dist/docs/write-docs.d.ts +3 -1
  122. package/dist/docs/write-docs.d.ts.map +1 -1
  123. package/dist/docs/write-docs.js +4 -2
  124. package/dist/docs/write-docs.js.map +1 -1
  125. package/dist/generate/context-imports.d.ts.map +1 -1
  126. package/dist/generate/context-imports.js +2 -1
  127. package/dist/generate/context-imports.js.map +1 -1
  128. package/dist/generate/kind.d.ts +2 -0
  129. package/dist/generate/kind.d.ts.map +1 -1
  130. package/dist/generate/kinds/e2e/reaction-of.d.ts +14 -0
  131. package/dist/generate/kinds/e2e/reaction-of.d.ts.map +1 -0
  132. package/dist/generate/kinds/e2e/reaction-of.js +93 -0
  133. package/dist/generate/kinds/e2e/reaction-of.js.map +1 -0
  134. package/dist/generate/kinds/e2e-kind.d.ts.map +1 -1
  135. package/dist/generate/kinds/e2e-kind.js +30 -18
  136. package/dist/generate/kinds/e2e-kind.js.map +1 -1
  137. package/dist/generate/refresh-barrels.d.ts +11 -4
  138. package/dist/generate/refresh-barrels.d.ts.map +1 -1
  139. package/dist/generate/refresh-barrels.js +41 -15
  140. package/dist/generate/refresh-barrels.js.map +1 -1
  141. package/dist/generate/refuse-shared-writes.js +1 -1
  142. package/dist/generate/refuse-shared-writes.js.map +1 -1
  143. package/dist/help/notes.d.ts +1 -1
  144. package/dist/help/notes.d.ts.map +1 -1
  145. package/dist/help/notes.js +19 -16
  146. package/dist/help/notes.js.map +1 -1
  147. package/dist/init/manifest/versions.js +24 -24
  148. package/dist/merge/classify-conflict.d.ts +2 -1
  149. package/dist/merge/classify-conflict.d.ts.map +1 -1
  150. package/dist/merge/classify-conflict.js +9 -0
  151. package/dist/merge/classify-conflict.js.map +1 -1
  152. package/dist/merge/higher-version.d.ts +7 -0
  153. package/dist/merge/higher-version.d.ts.map +1 -0
  154. package/dist/merge/higher-version.js +59 -0
  155. package/dist/merge/higher-version.js.map +1 -0
  156. package/dist/merge/merge-client-manifest.d.ts +16 -0
  157. package/dist/merge/merge-client-manifest.d.ts.map +1 -0
  158. package/dist/merge/merge-client-manifest.js +39 -0
  159. package/dist/merge/merge-client-manifest.js.map +1 -0
  160. package/dist/merge/merge-exclusions.d.ts +4 -3
  161. package/dist/merge/merge-exclusions.d.ts.map +1 -1
  162. package/dist/merge/merge-exclusions.js +6 -3
  163. package/dist/merge/merge-exclusions.js.map +1 -1
  164. package/dist/merge/resolve-conflict.d.ts +3 -2
  165. package/dist/merge/resolve-conflict.d.ts.map +1 -1
  166. package/dist/merge/resolve-conflict.js +29 -7
  167. package/dist/merge/resolve-conflict.js.map +1 -1
  168. package/dist/plan/batched-waves.d.ts +2 -0
  169. package/dist/plan/batched-waves.d.ts.map +1 -1
  170. package/dist/plan/batched-waves.js +20 -7
  171. package/dist/plan/batched-waves.js.map +1 -1
  172. package/dist/plan/format-plan.d.ts +1 -1
  173. package/dist/plan/format-plan.d.ts.map +1 -1
  174. package/dist/plan/format-plan.js +33 -8
  175. package/dist/plan/format-plan.js.map +1 -1
  176. package/dist/plan/other-stories.d.ts +9 -0
  177. package/dist/plan/other-stories.d.ts.map +1 -0
  178. package/dist/plan/other-stories.js +31 -0
  179. package/dist/plan/other-stories.js.map +1 -0
  180. package/dist/plan/plan-waves.d.ts +2 -1
  181. package/dist/plan/plan-waves.d.ts.map +1 -1
  182. package/dist/plan/plan-waves.js +13 -4
  183. package/dist/plan/plan-waves.js.map +1 -1
  184. package/dist/plan/wave-plan.d.ts +28 -0
  185. package/dist/plan/wave-plan.d.ts.map +1 -1
  186. package/dist/version.d.ts +1 -1
  187. package/dist/version.js +1 -1
  188. package/dist/worker/briefing-of.js +4 -2
  189. package/dist/worker/briefing-of.js.map +1 -1
  190. package/dist/workspace/workspace-report.d.ts +2 -0
  191. package/dist/workspace/workspace-report.d.ts.map +1 -1
  192. package/dist/workspace/workspace.d.ts +8 -0
  193. package/dist/workspace/workspace.d.ts.map +1 -1
  194. package/dist/workspace/workspace.js +24 -3
  195. package/dist/workspace/workspace.js.map +1 -1
  196. package/package.json +2 -2
  197. package/templates/e2e/e2e-reaction.spec.ts.tpl +68 -0
  198. package/templates/init/AGENTS.md.tpl +1 -1
  199. package/templates/init/README.md.tpl +2 -1
  200. package/templates/init/e2e/start-application.database.ts.tpl +22 -2
  201. package/templates/init/e2e/start-application.memory.ts.tpl +22 -2
  202. package/templates/init/platform/events/custom-event-bus.ts.tpl +1 -1
  203. package/templates/init/platform/events/in-process-events.ts.tpl +1 -1
  204. package/templates/init/rules/tests.md.tpl +1 -1
  205. package/templates/pipeline/biome.json.tpl +1 -0
  206. package/templates/pipeline/github/actions/setup/action.yml.tpl +3 -0
  207. package/templates/pipeline/github/workflows/ci.yml.tpl +12 -12
  208. package/templates/pipeline/github/workflows/codeql.yml +1 -1
  209. package/templates/pipeline/github/workflows/copilot-setup-steps.yml +1 -1
  210. package/templates/pipeline/github/workflows/pr-title.yml +1 -1
  211. package/templates/pipeline/package-scripts.json +1 -1
  212. package/templates/presets/identity/context/test/worlds/__context__.world.ts.tpl +1 -0
  213. package/templates/test-world/world.buses.ts.tpl +1 -1
  214. package/templates/test-world/world.tsyringe.ts.tpl +1 -0
  215. package/dist/check/fixtures/declared-barrel.d.ts +0 -3
  216. package/dist/check/fixtures/declared-barrel.d.ts.map +0 -1
  217. package/dist/check/fixtures/declared-barrel.js +0 -4
  218. package/dist/check/fixtures/declared-barrel.js.map +0 -1
  219. package/dist/declared/render-barrel.d.ts +0 -11
  220. package/dist/declared/render-barrel.d.ts.map +0 -1
  221. package/dist/declared/render-barrel.js +0 -29
  222. package/dist/declared/render-barrel.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,56 @@ What each version changes for someone who uses the kit. The packages of `package
4
4
  together, under one version; the notes of each [GitHub release](https://github.com/gbourgeat/ddd-ts-kit/releases)
5
5
  list the pull requests behind it.
6
6
 
7
+ ## 0.85.0
8
+
9
+ **The `biome.json` that `init` writes leaves out `.ddd-ts-kit/`, so `npm run format:check` and `verify` pass while the guard keeps its state there.** The guard and the workers write their state in `.ddd-ts-kit/` (git-ignored) as JSON on one line, and the formatter, which formats every `.json` file, reported each of them: `verify` failed in a project where an agent had run. The template now has `"!**/.ddd-ts-kit"` in `files.includes`, as the kit has.
10
+
11
+ To move: add `"!**/.ddd-ts-kit"` to `files.includes` of `biome.json`, next to `"!**/.worktrees"`. `doctor` does not judge `biome.json`: the line is added by hand.
12
+
13
+ **`plan-waves` gives the status of every row a row waits for, and lists apart the rows of another story that the plan waits for.** A row of the waves names what it waits for with its status, `after #US1.02 (todo)`, and with its context and its story when that row belongs to another story or to a context not shown: `after #US1.04 (todo, billing, story US1)`. After the waves, `Rows another story waits for, not done` lists each row of one story that a row of another story depends on, with its owner, its status, the batch that holds it (or the `plan-waves <context>` that shows it) and the rows that wait for it, so that a conductor sees before launching a wave that it waits on work of another story, and whether anyone carries it. `--json` adds `story` and `waitingForRows` (`{ id, context, story, status }`) to each row, and `otherStories` to the plan; `waitingFor` is unchanged.
14
+
15
+ **`InMemoryEventBus` can rethrow the failure of a single handler as it is, and new projects ask for it.** `new InMemoryEventBus({ failures: 'as-thrown' })` still runs every handler of an event when one fails; when exactly one failed, `publish` rejects with that error itself instead of an `AggregateError` holding it, so its class and its `code` reach the caller; several failures still come together in an `AggregateError`. The default, `failures: 'aggregated'`, keeps the behaviour of the previous version: nothing changes until a project opts in. The same choice is given to the buses the kit builds: `eventBusFailures` of `kernelModule()`, of `createTestApplication()` (`@ddd-ts-kit/di`) and of `createTestBuses()` (`@ddd-ts-kit/testing`).
16
+
17
+ What `as-thrown` changes where events are delivered in the process: a refusal (`DomainError`) or a lost update raised in a handler reaches the caller with its own class and code. An HTTP request whose events are handled in the process is answered with the status mapped to that code (409 for `CONCURRENCY_CONFLICT`) instead of 500; a refusal is no longer reported to the error reporter as an unexpected failure, and the dead-letter reports give it the severity `warning` instead of `error`; the outbox relay records its code as `lastErrorCode` instead of `AggregateError`, and the logs describe the error of the handler. A spec that asserted the `AggregateError` of a single failure receives the error of the handler.
18
+
19
+ A project created by `ddd-ts-kit init` gets it: `src/platform/events/in-process-events.ts` and the stub `custom-event-bus.ts` build the bus with `{ failures: 'as-thrown' }`, and the worlds written by `generate test-world` (and the worlds of the identity preset) pass `eventBusFailures: 'as-thrown'`.
20
+
21
+ To move: nothing is required in this version. To opt in, build the bus with `new InMemoryEventBus({ failures: 'as-thrown' })` (in `src/platform/events/in-process-events.ts`, and in a custom bus that delivers through one), give `kernelModule({ eventBusFailures: 'as-thrown' })` when it builds the default bus, and add `eventBusFailures: 'as-thrown'` to the options of `createTestApplication(...)` and `createTestBuses(...)` in the worlds and specs. Then update the assertions on a single failure: `rejects.toThrow(AggregateError)`, `rejects.toBeInstanceOf(AggregateError)` and `rejects.toThrow('1 event handler(s) failed')` become an assertion on the error of the handler (`rejects.toThrow('the message')`, `rejects.toBeInstanceOf(ItsClass)`), and `rejects.toMatchObject({ errors: [{ code: 'X' }] })` becomes `rejects.toMatchObject({ code: 'X' })`. The default becomes `as-thrown` in a later minor version.
22
+
23
+ **`generate e2e` writes the end-to-end spec of a use case no route reaches, started by an integration event of an upstream.** Until now it refused a use case without a route. When an integration event handler of the context sends the command of the use case, the spec publishes the event of the upstream, built from its declaration in the published language, through the running application (`await application.publish([event])`), awaits `application.settled()`, and leaves `it.todo` entries for what a client or another context observes: the `GET` routes of the context, or the integration events it publishes (`collectEvents(application.events, [...])`). `--event <eventType>` names the event when handlers of several events send the command, or when the handler does not send it yet; without a route or such a handler, the refusal names both. `RunningApplication` of `test/e2e/support/start-application.ts` gains `publish(events)`, which hands the events to the handlers of the application as the relay of the upstream would. `describe` also names the event a handler receives when the module file of its context subscribes it with `consume(...)` behind a broker, where it named none.
24
+
25
+ To move (when a spec publishes an event): `generate e2e` notes a `start-application.ts` without `publish`. Add `import type { IntegrationEvent } from '@ddd-ts-kit/kernel';` (or add `type IntegrationEvent` to the import of `@ddd-ts-kit/kernel` already there), then `publish(events: readonly IntegrationEvent[]): Promise<void>;` to the interface `RunningApplication` (and to `Started`, when the file has it), `publish: (events) => application.eventBus.publish(events),` to the object `start` returns next to `events: application.eventSubscriber`, and `publish: (events) => current.publish(events),` (`started.publish(events)` in the database variant) to the object `startApplication` returns. Do not run `init --force` for this: it writes every file of the platform again from the templates, losing what the generators and the team added there.
26
+
27
+ **The guard lets a long end-to-end spec be split into parts named after it, and a context worker keep the support of its end-to-end specs in `test/e2e/support/<context>/`.** `clean/file-size` asks to split a spec past 350 lines by behaviour, but the guard refused every new `*.e2e.spec.ts` but a journey, and `generate e2e` writes one name per use case: the split could not be written. The guard now accepts `test/e2e/<use-case>-<behaviour>.e2e.spec.ts` when `test/e2e/<use-case>.e2e.spec.ts` exists, beside `test/e2e/journey-<name>.e2e.spec.ts` as before, and its refusal of any other new end-to-end spec names both forms; the fix of `clean/file-size` on an end-to-end spec says the same. A `context-builder` worker may now write `test/e2e/support/<its context>/`, the helpers and worlds its own end-to-end specs share, instead of copying them into each spec; the rest of `test/e2e/support/` stays the conductor's. The briefing `worker-scope` prints, the `context-builder` agent and the `parallel-work` and `testing` skills say so.
28
+
29
+ **`merge-trunk` keeps the higher version of a generated client when both sides changed its `package.json`.** Everything under `clients/` is derived, so on a conflict `merge-trunk` took the trunk's side, and `npm run regenerate` keeps the version it finds: a branch that raised the version of `clients/<document>/package.json` lost it, without a word, whenever the trunk changed that file too. A conflict on that file now keeps the trunk's file at the higher of the two versions, by the precedence of Semantic Versioning, and the report of `merge-trunk` says which version it kept and why (`client package.json: trunk side, version 1.3.0 kept, the higher of 1.3.0 on this branch and 1.2.1 on the trunk`). When the version of either side is not a semantic version, the file is left to you as a conflict to resolve.
30
+
31
+ **In the declared style, the declarations of a context are written per role folder: `<context>.declarations.ts` only re-exports them.** With `"stack.assembly": "barrel"`, `generate`, `docs` and `npm run dev` write a `<folder>.declarations.ts` in every role folder of a context that holds a declared role file, next to the classes it registers: `application/commands/commands.declarations.ts`, `application/queries/queries.declarations.ts`, `infrastructure/persistence/persistence.declarations.ts`, `presentation/http/http.declarations.ts`. A role folder is the folder at `<layer>/<folder>/` under the context: the files of a use case or of a route roll up to it, and a role file sitting directly in its layer goes to `<layer>/<layer>.declarations.ts`. Each file holds the imports it needs, one `export *` per role file of its folder, then the `injected(Class, [Tokens])` of the classes of that folder. `<context>.declarations.ts` stays at the root of the context and holds one `export *` per folder file, nothing else, so the composition root, `contextModule(...)` and the worlds of the tests import it as before. Following one handler no longer means reading three distant places of one long file, and two use cases of different folders no longer touch the same generated file. The declarations of a folder that holds no role file any more are deleted by the next `generate`, `docs` or `npm run dev`, and listed under `deleted` in their output. `declarations/barrel-current` compares every generated file and reports one that is missing, stale or left in an emptied folder; `tree/closed`, `naming/suffix`, `clean/one-export-per-file`, `clean/file-size`, the commit size, `merge-trunk` and the guard of the plugin treat the folder files as generated, like the root one. The coverage of `governedCoverage()` and `governedJestCoverage()` (`@ddd-ts-kit/testing/coverage`) leaves them out of the measure (`exclude`, a negated `collectCoverageFrom`): they sit in the layers it measures, and a spec of an adapter does not load them. Under `"stack.assembly": "discovery"` nothing changes: `<context>.dependencies.ts` still holds the lists. There is no option: the layout is derived from the tree.
32
+
33
+ To move: run `npx ddd-ts-kit docs` (or any `generate` without `--local-only`, or `npm run dev`), which writes the folder files and rewrites `<context>.declarations.ts` as their summary, and commit the result. Upgrading alone fails nothing: for one minor version, a context still declared in the single `<context>.declarations.ts` of 0.84 is accepted, as long as that file is exactly what 0.84 would write for the current role files and constructors and no role folder holds a declarations file yet. `ddd-ts-kit check` reports it as a warning of `declarations/barrel-current` (exit 0) that says how to move, `docs --check` and `docs:check` pass and print the same warning, and `generate --local-only` leaves it as it is and says so in a note; the move removes the warning. A later minor version reports the single file as an error. A single file that is itself stale (a role file added or a constructor changed since it was written) or a context half moved (the single file next to the declarations of a role folder) is an error now, as any stale generated file. A branch open during the move regenerates them as for any derived file: `merge-trunk` takes the trunk side and `npm run regenerate` writes them again. A project that formats at another width than 120 and left `**/*.declarations.ts` out of its formatter needs nothing more: the pattern matches the folder files too.
34
+
35
+ **The GitHub pipeline `init` writes runs on the newest patch of its Node release line.** `setup-node`
36
+ used the Node the runner image already holds, which lags behind a security release of Node: on
37
+ 2026-10-22 the runners still held 24.21.0, two days after 24.22.1 fixed CVE-2026-111497 (remote
38
+ code execution in the Brotli decoder) and nine other vulnerabilities. The setup action now asks for
39
+ `check-latest: true`, and each run installs the newest 22.x or 24.x. The GitLab pipeline already
40
+ followed the image tag, which carries the newest patch, and the image builds of both pipelines
41
+ read the `node` base image from the registry at each run.
42
+
43
+ An image already built keeps the Node it was built with, and `docker build` reuses the base image
44
+ the machine already holds: the guide of the commands now ships with `docker build --pull .`.
45
+
46
+ To move: in `.github/actions/setup/action.yml`, add `check-latest: true` under the `node-version`
47
+ of the `actions/setup-node` step. Rebuild with `docker build --pull .` (or
48
+ `docker compose build --pull`) every image built before 2026-10-21 that runs somewhere, and update
49
+ the Node of each machine to 22.23.4, 24.22.1 or 26.12.1.
50
+
51
+ ## 0.84.1
52
+
53
+ **The GitHub workflows `init` writes run on `ubuntu-26.04`, pinned instead of `ubuntu-latest`.** GitHub moves `ubuntu-latest` from Ubuntu 24.04 to 26.04 between 2026-10-19 and 2026-11-19; the whole pipeline of the kit, generated projects on npm and pnpm included, was run on 26.04 first. With the label pinned, a new image of GitHub reaches a project when its team changes the label, not on a day GitHub chooses. The kit runs its own workflows on the same label.
54
+
55
+ To move: replace `runs-on: ubuntu-latest` by `runs-on: ubuntu-26.04` in `.github/workflows/`. Do not run `init --force` for this: it writes every file of the platform again from the templates, losing what the generators added there (a grant of a role, the settings of a job, a policy), and replaces a workflow the team changed.
56
+
7
57
  ## 0.84.0
8
58
 
9
59
  **`src/platform/auth/` holds one folder per question, and `ddd-ts-kit platform-folders` moves a project there.** A new project writes its authentication in `auth/authentication/` (the authenticator, the session of a request, the HTTP boundary), what a caller may do whatever the model in `auth/authorization/` (the authorizer behind the port, the guard of the buses, the access policies, `role.ts`, `permissions.ts`, `signed-in-grants.ts`, `log-decisions.ts`), and its model in the one folder `stack.authz` names: `roles/`, `attributes/`, `relationships/` or `custom/`. The names of the files do not change. A project generated before keeps working as it is: the generators, the presets, `init --force` and the rules `authz/granted` and `authz/scope-narrows` read and write its files flat, and `ddd-ts-kit doctor` reports `folder src/platform: flat` without failing `--strict`. `ddd-ts-kit platform-folders` moves the files the kit writes and rewrites every import of them under the source root, `test/` and `scripts/`, by alias or relative path, keeping the extension as written; it names the files of the team it leaves flat, and `--place <file>=<folder>` moves those too; `--dry-run` shows the plan.
package/README.fr.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [English](README.md) · **Français**
2
- <!-- translation-of: README.md sha256:d8d11066d69637d5 -->
2
+ <!-- translation-of: README.md sha256:7f7fe3fe2a615f20 -->
3
3
 
4
4
  # ddd-ts-kit
5
5
 
@@ -144,8 +144,9 @@ la racine de composition l'assemble en une ligne. Dans le style `explicit`, chaq
144
144
  `--style declared` est refusé avec `--di manual` et `--di nest` : les déclarations sont de simples
145
145
  métadonnées, et seul `@ddd-ts-kit/di` (sur tsyringe) les transforme en liaisons.
146
146
  `--assembly` dit comment un contexte déclaré rejoint la racine de composition : `barrel` (par
147
- défaut) est un fichier généré par contexte, `<context>.declarations.ts`, statique, que suivent un
148
- bundler, knip et dependency-cruiser ; `discovery` écrit à la place `await discoverContext(...)`,
147
+ défaut) est fait de fichiers générés, `<context>.declarations.ts` à la racine du contexte qui
148
+ réexporte les déclarations de chaque dossier de rôle, statiques, que suivent un bundler, knip et
149
+ dependency-cruiser ; `discovery` écrit à la place `await discoverContext(...)`,
149
150
  avec l'entrée knip et l'exception dependency-cruiser dont les fichiers découverts ont besoin
150
151
  (*publishers* et *jobs* compris : ils sont découverts comme le reste), et intègre
151
152
  `@ddd-ts-kit/di` en ligne (inline) dans les deux configurations vitest, afin que les fichiers
@@ -311,7 +312,8 @@ rien dans son décorateur (`@CommandHandler(IssueInvoiceCommand)`) : chaque para
311
312
  constructeur est typé par une classe, son jeton (`declarations/constructor-injection`).
312
313
  `generate`, `docs` et le script `dev` lisent les signatures, avec le scanner sans dépendance du
313
314
  *checker* et sans compilateur, et écrivent des instructions `injected(Class, [Tokens])` dans le
314
- fichier généré de chaque contexte : le barrel `<context>.declarations.ts`, ou
315
+ fichiers générés de chaque contexte : le `<folder>.declarations.ts` de chaque dossier de rôle, à
316
+ côté des classes qu'il enregistre, que réexporte `<context>.declarations.ts`, ou
315
317
  `<context>.dependencies.ts` sous discovery. `@ddd-ts-kit/di` injecte à partir de là. Rien ne
316
318
  repose sur `emitDecoratorMetadata` : il est absent avec les décorateurs standard et sous `tsx`.
317
319
  `init` écrit `"stack.dependencies": "signature"` ; une configuration sans la clé vaut `listed`,
@@ -320,26 +322,35 @@ la forme de 0.1 (`@CommandHandler(M, [Ports])`), qui continue de fonctionner san
320
322
  liste ce que reçoit chaque classe. Chaque fichier généré exporte une classe, une interface ou une
321
323
  fonction, et porte son nom.
322
324
 
323
- ![Comment un contexte déclaré rejoint la racine de composition : les fichiers de rôle portent leur décorateur et typent les paramètres de leur constructeur par des classes ; generate, docs et le script dev lisent ces signatures et écrivent le barrel, un export par fichier de rôle et une instruction injected par classe qui reçoit quelque chose ; la racine de composition inclut le barrel avec contextModule et @ddd-ts-kit/di injecte à partir de lui ; check et docs --check signalent un barrel qui ne correspond plus aux fichiers de rôle](https://raw.githubusercontent.com/gbourgeat/ddd-ts-kit/main/docs/assets/diagrams/cli-declared-barrel.fr.svg)
325
+ ![Comment un contexte déclaré rejoint la racine de composition : les fichiers de rôle portent leur décorateur et typent les paramètres de leur constructeur par des classes ; generate, docs et le script dev lisent ces signatures et écrivent les déclarations de chaque dossier de rôle, un export par fichier de rôle du dossier et une instruction injected par classe qui reçoit quelque chose, et un récapitulatif à la racine du contexte qui les réexporte ; la racine de composition inclut le récapitulatif avec contextModule et @ddd-ts-kit/di injecte à partir de lui ; check et docs --check signalent des déclarations générées qui ne correspondent plus aux fichiers de rôle](https://raw.githubusercontent.com/gbourgeat/ddd-ts-kit/main/docs/assets/diagrams/cli-declared-barrel.fr.svg)
324
326
 
325
- Un extrait du barrel du contexte `notification` de l'application d'exemple, tel que la CLI
326
- l'écrit (jamais à la main) :
327
+ Un extrait des déclarations du contexte `notification` de l'application d'exemple, telles que
328
+ la CLI les écrit (jamais à la main) : un fichier par dossier de rôle, à côté des classes qu'il
329
+ enregistre, et un récapitulatif à la racine du contexte qui ne fait que les réexporter.
327
330
 
328
331
  ```ts
329
- // src/contexts/notification/notification.declarations.ts
332
+ // src/contexts/notification/application/commands/commands.declarations.ts
330
333
  import { injected } from '@ddd-ts-kit/kernel/declarations';
331
334
  import { WithdrawReminderHandler } from '@/contexts/notification/application/commands/withdraw-reminder/withdraw-reminder.handler';
332
335
  import { ReminderRepository } from '@/contexts/notification/domain/repositories/reminder.repository';
336
+
337
+ export * from '@/contexts/notification/application/commands/withdraw-reminder/withdraw-reminder.command';
338
+ export * from '@/contexts/notification/application/commands/withdraw-reminder/withdraw-reminder.handler';
339
+
340
+ injected(WithdrawReminderHandler, [ReminderRepository]);
341
+
342
+ // src/contexts/notification/infrastructure/persistence/persistence.declarations.ts
333
343
  import { KnexReminderRepository } from '@/contexts/notification/infrastructure/persistence/knex-reminder.repository';
334
344
  import { Clock, ExecutionScope } from '@ddd-ts-kit/kernel';
335
345
  import { KnexContext } from '@ddd-ts-kit/knex';
336
346
 
337
- export * from '@/contexts/notification/application/commands/withdraw-reminder/withdraw-reminder.command';
338
- export * from '@/contexts/notification/application/commands/withdraw-reminder/withdraw-reminder.handler';
339
347
  export * from '@/contexts/notification/infrastructure/persistence/knex-reminder.repository';
340
348
 
341
- injected(WithdrawReminderHandler, [ReminderRepository]);
342
349
  injected(KnexReminderRepository, [KnexContext, ExecutionScope, Clock]);
350
+
351
+ // src/contexts/notification/notification.declarations.ts
352
+ export * from '@/contexts/notification/application/commands/commands.declarations';
353
+ export * from '@/contexts/notification/infrastructure/persistence/persistence.declarations';
343
354
  ```
344
355
 
345
356
  et l'unique ligne de la racine de composition qui ajoute tout le contexte :
@@ -549,7 +560,7 @@ choix sont enregistrés sous `stack` dans la configuration, `docsUi`, `ci` et `l
549
560
  | outillage des migrations | `drizzle.config.ts`, `knexfile.js` et `migrations/00000000000000_initial.js`, `prisma/schema.prisma` et `prisma.config.ts`, ou `data-source.ts` |
550
561
  | `scripts/openapi.ts`, `scripts/events.ts` | écrivent `openapi/openapi.yaml` (un fichier par document de `openapi.documents`), `docs/integration/asyncapi.yaml` et `docs/integration/event-catalog.md`, en JSON sous `openapi.format: json` ; `--check` échoue sur une différence |
551
562
  | `docker-compose.yml`, `.env.example`, `Dockerfile`, `.dockerignore` | la base de données avec un contrôle de santé et un volume nommé, `jaegertracing/jaeger:2.22.0` derrière le profil `observability` (son interface et son port OTLP liés à 127.0.0.1), les ports depuis `.env` ; une image multi-étapes, sans root, avec les seules dépendances de production |
552
- | `vitest.e2e.config.ts`, `test/e2e/support/` | `start-application.ts` (l'application entière sur un port libre, sur une base de données dans le processus sauf si `DATABASE_URL` est définie, aucun *job* lancé par le temps ; `settled()` se résout quand l'outbox a relayé ce que les requêtes HTTP ont enregistré), `create-credentials.ts`, `auth-environment.ts`, `test-environment.ts`, `story-of.ts` (`storyOf(trace)` : une trace sans les appels qu'un adaptateur fait sur lui-même, la forme que vérifie `expectSpanTree`) |
563
+ | `vitest.e2e.config.ts`, `test/e2e/support/` | `start-application.ts` (l'application entière sur un port libre, sur une base de données dans le processus sauf si `DATABASE_URL` est définie, aucun *job* lancé par le temps ; `settled()` se résout quand l'outbox a relayé ce que les requêtes HTTP ont enregistré ; `publish(events)` remet des événements d'intégration de l'amont à ses gestionnaires, comme le ferait le relais de cet amont), `create-credentials.ts`, `auth-environment.ts`, `test-environment.ts`, `story-of.ts` (`storyOf(trace)` : une trace sans les appels qu'un adaptateur fait sur lui-même, la forme que vérifie `expectSpanTree`) |
553
564
  | `docs/context-map.md`, `docs/integration/README.md` | voir `docs` |
554
565
  | `test/architecture/extractable.spec.ts` | écrit avec le premier contexte : démarre chaque contexte seul sur le kernel et la plateforme, ses *jobs* compris |
555
566
  | `eslint.config.mjs` | le preset `dddTsKit` de `@ddd-ts-kit/eslint-plugin`, lint typé sur le tsconfig du projet |
@@ -658,7 +669,7 @@ would create src/contexts/notification/application/commands/archive-notification
658
669
  would create src/contexts/notification/test/unit/archive-notification.handler.spec.ts
659
670
  would update src/contexts/notification/CONTEXT.md
660
671
  would update src/contexts/notification/application/authorization/notification.permissions.ts
661
- would update src/contexts/notification/notification.declarations.ts
672
+ would update src/contexts/notification/application/commands/commands.declarations.ts
662
673
 
663
674
  Next, in this order: the language of the context first, then the business decisions only you can make
664
675
  src/contexts/notification/application/commands/archive-notification/archive-notification.command.ts:9 declare the input of "archive notification" as a constructor with the actor first, ...
@@ -700,7 +711,7 @@ Next, in this order: the language of the context first, then the business decisi
700
711
  | `background-job` | `<context> <Name> --command <UseCaseName>` | `application/background/<name>.background-job.ts`, une classe `<Name>BackgroundJob implements BackgroundJob<<Name>Payload>` nommée par son `jobName` statique `<context>.<name>`, qui envoie la commande en tant que `execution.actor` quand elle est protégée, suivi d'un champ de `<Name>Payload` par autre paramètre du constructeur de la commande (chaînes, nombres, booléens, littéraux et listes de ceux-ci tels qu'écrits, une `Date` sous forme de son texte ISO ; tout le reste est refusé) ; `test/unit/<name>.background-job.spec.ts`, qui le met en file avec une charge utile de chaque champ en tant qu'utilisateur détenant la permission et exécute ce qui est dû ; son enregistrement (`@Background()`, ou `builder.backgroundJob(..)` dans le fichier de module). `--di tsyringe` seulement |
701
712
  | `process` (`process-manager`) | `<context> <Name>` | `application/processes/<name>.process.ts` (son état, `processName`, `timeoutJob`, `isState`, une première étape qui arme une échéance, une étape qui y met fin à temps, l'étape de l'échéance), `application/background/<name>-timeout.background-job.ts`, qui livre ses expirations au moyen de `ProcessRunner`, et les *specs* des deux (`givenProcess`, la file d'attente de l'application de test). `--di tsyringe` seulement |
702
713
  | `acl` | `<context> <upstreamOrSystemName>` | traducteur dans `infrastructure/anti-corruption/`, *spec* |
703
- | `e2e` | `<context> <UseCaseName>` | `test/e2e/<use-case>.e2e.spec.ts` qui pilote la route du cas d'usage : 401 sans identifiant de connexion, 403 sans la permission, le statut documenté avec elle ; pour une commande, un test de plus vérifie la trace de la requête HTTP, exacte sur les noms et la structure, avec `installTestTracing()` et `expectSpanTree(storyOf(trace), [...])` de `@ddd-ts-kit/tracing/testing` (`POST /invoices`, puis `command IssueInvoiceCommand`, puis `repository InvoiceRepository.save`) ; demande la route |
714
+ | `e2e` | `<context> <UseCaseName> [--event <eventType>]` | `test/e2e/<use-case>.e2e.spec.ts` qui pilote la route du cas d'usage : 401 sans identifiant de connexion, 403 sans la permission, le statut documenté avec elle ; pour une commande, un test de plus vérifie la trace de la requête HTTP, exacte sur les noms et la structure, avec `installTestTracing()` et `expectSpanTree(storyOf(trace), [...])` de `@ddd-ts-kit/tracing/testing` (`POST /invoices`, puis `command IssueInvoiceCommand`, puis `repository InvoiceRepository.save`). Un cas d'usage qu'aucune route n'atteint, lancé par un gestionnaire d'événement d'intégration du contexte, reçoit une spec qui publie l'événement de l'amont, construit depuis sa déclaration, avec `application.publish([event])`, attend `application.settled()` et laisse des `it.todo` pour ce qu'un client observe (les routes `GET` du contexte, ou les événements qu'il publie, avec `collectEvents`) ; le gestionnaire qui envoie `<UseCase>Command` est cherché dans `application/integration/handlers/`, et `--event billing.invoice.issued` nomme l'événement quand des gestionnaires de plusieurs l'envoient, ou quand le gestionnaire ne l'envoie pas encore. Demande la route, ou ce gestionnaire |
704
715
  | `policy` | `<context> <Name> --permission <aggregate>.<action>` | `application/authorization/<name>.policy.ts`, *spec* ; déclaré : la classe porte `@Policy(permission, { name })` et rien d'autre n'est écrit ; explicite : l'enregistrement dans `platform/auth/authorization/access-policies.ts` |
705
716
  | `gateway` | `<context> <upstreamContext> <Name>` | le contrat de lecture dans le langage publié de l'amont (`<name>.contract.ts`, une classe abstraite et le jeton de la valeur de l'amont), le port `application/ports/<name>-gateway.port.ts`, un adaptateur dans le processus dans `infrastructure/external/` lié `.as('gateway')`, un *fake*, une suite de contrat ; refusé sauf si l'amont est déclaré |
706
717
  | `adapter` | `<context> <Port> [--kind external\|gateway] [--decorators]` | `infrastructure/external/remote-<port>.adapter.ts` pour un port existant, sa *spec*, et sur tsyringe sa liaison `builder.bind(<Port>).toClass(Remote<Port>).as(<kind>).with(ownPolicy(retry(...), timeout(...)))` ; avec `--decorators`, sur toute *stack*, la classe porte `@Retry` et `@Timeout` de `@ddd-ts-kit/aspects/decorators` sur son unique méthode sortante et est liée `.with(ownPolicy())`. Explicite : un port déjà lié, ou le câblage manuel, reçoit une note au lieu d'une liaison. Déclaré : la classe porte `@Adapter(<Port>, { kind, aspects })`, ou `@Gateway(<Port>, { aspects })` dans `remote-<port>.gateway.ts` avec `--kind gateway`, et un port qui a déjà un adaptateur déclaré est refusé |
@@ -762,13 +773,21 @@ Next, in this order: the language of the context first, then the business decisi
762
773
  un sujet `system` opérer un contexte. Avec `--authz custom`, une région supprimée, un schéma de
763
774
  relations remodelé ou une permission que le générateur ne sait pas lire, rien n'est écrit et le
764
775
  fichier du *job* porte le `TODO(domain)` qui nomme l'acteur et la permission.
765
- - **Le barrel est dérivé.** `<context>.declarations.ts` contient un `export *` par fichier de
766
- rôle, trié par chemin, puis un `injected(Class, [Tokens])` par classe dont le constructeur
767
- reçoit quelque chose, lu depuis sa signature, avec les imports dont ils ont besoin. Chaque
768
- `generate`, et `docs`, le réécrivent ; `docs --check` et `check`
769
- (`declarations/barrel-current`) signalent un barrel qu'un fichier de rôle écrit à la main a
770
- laissé en arrière ou dont un constructeur a changé depuis, en nommant la classe
771
- (`stale src/contexts/billing/billing.declarations.ts: the dependency list of IssueInvoiceHandler is stale: ...`).
776
+ - **Les déclarations sont dérivées.** Chaque dossier de rôle d'un contexte qui contient un
777
+ fichier de rôle déclaré a son `<folder>.declarations.ts`, dans ce dossier :
778
+ `application/commands/commands.declarations.ts`,
779
+ `infrastructure/persistence/persistence.declarations.ts`, `presentation/http/http.declarations.ts`
780
+ (les fichiers d'un cas d'utilisation ou d'une route remontent au dossier `<layer>/<folder>/` ;
781
+ un fichier de rôle posé directement dans sa couche va dans `<layer>/<layer>.declarations.ts`).
782
+ Il contient un `export *` par fichier de rôle du dossier, trié par chemin, puis un
783
+ `injected(Class, [Tokens])` par classe dont le constructeur reçoit quelque chose, lu depuis sa
784
+ signature, avec les imports dont ils ont besoin. `<context>.declarations.ts`, à la racine du
785
+ contexte, ne fait que réexporter ces fichiers, triés par chemin. Chaque `generate`, et `docs`,
786
+ les réécrivent et suppriment les déclarations d'un dossier qui ne contient plus aucun fichier
787
+ de rôle ; `docs --check` et `check` (`declarations/barrel-current`) signalent celles qu'un
788
+ fichier de rôle écrit à la main a laissées en arrière ou dont un constructeur a changé depuis,
789
+ en nommant la classe
790
+ (`stale src/contexts/billing/application/commands/commands.declarations.ts: the dependency list of IssueInvoiceHandler is stale: ...`).
772
791
  Le script `dev` charge `ddd-ts-kit/dist/refresh-declarations.js` avant l'application, à chaque
773
792
  démarrage et à chaque rechargement de `tsx watch` : un port ajouté à un constructeur est injecté
774
793
  au rechargement qui suit l'enregistrement du fichier. Le même module est le binaire
@@ -868,9 +887,11 @@ Régénère ce qui dérive de la configuration et du code, et rien d'autre :
868
887
  sections écrites sont posées avec des indications.
869
888
  - les listes générées de chaque `CONTEXT.md` (agrégats, événements publiés, permissions, *jobs*
870
889
  planifiés en tableau de nom, planning et commande, relations) ;
871
- - le fichier généré de chaque contexte déclaré : le barrel `<context>.declarations.ts`, avec ce
872
- que reçoit chaque constructeur, lu depuis sa signature, ou sous discovery
873
- `<context>.dependencies.ts`, qui ne contient que cela ;
890
+ - les déclarations générées de chaque contexte déclaré : le `<folder>.declarations.ts` de chaque
891
+ dossier de rôle, avec ce que reçoit chaque constructeur, lu depuis sa signature, et
892
+ `<context>.declarations.ts`, qui les réexporte (les déclarations d'un dossier resté sans fichier
893
+ de rôle sont supprimées), ou sous discovery `<context>.dependencies.ts`, qui ne contient que
894
+ les listes ;
874
895
  - la référence de chaque `CONTEXT.md` : les faits de `describe`, en tableaux sous
875
896
  `## Reference`, entre des marqueurs `ddd-ts-kit:reference` ; un `CONTEXT.md` qui n'a pas cette
876
897
  section la reçoit après sa dernière liste générée ;
@@ -1221,11 +1242,23 @@ attendent, directement ou non, et ce qui se lance avant chaque fusion :
1221
1242
  contexte, seules ses lignes sont montrées ; les lignes
1222
1243
  d'autres contextes qu'elles attendent comptent dans la numérotation des vagues.
1223
1244
 
1245
+ Une ligne dit les lignes qu'elle attend, chacune avec son statut : `after #US1.02 (todo)`. Une ligne
1246
+ attendue qui appartient à une autre story (son identifiant sans son dernier `.<numéro>`, `US1` pour
1247
+ `US1.04`) ou à un contexte qui n'est pas montré porte aussi son contexte et sa story :
1248
+ `after #US1.04 (todo, billing, story US1)`. Les lignes d'une story qu'une ligne planifiée d'une
1249
+ autre story attend sont listées à nouveau, après les vagues, sous
1250
+ `Rows another story waits for, not done`, avec leur responsable, leur statut, le lot qui les porte
1251
+ (ou le `plan-waves <context>` qui les montre) et les lignes qui attendent : avant de lancer une
1252
+ vague, le chef d'orchestre voit qu'elle attend le travail d'une autre story, et si quelqu'un le
1253
+ porte.
1254
+
1224
1255
  Un cycle dans `Depends on`, une dépendance vers un identifiant qu'aucune ligne ne porte, une ligne
1225
1256
  sans responsable et un identifiant que portent deux lignes rendent les lignes impossibles à
1226
1257
  ordonner : ils sont signalés seuls, sans vagues, et la commande sort avec 1. Un fichier sans table
1227
1258
  de tranches, ou un contexte qu'aucune ligne ne nomme, est refusé. `--json` affiche
1228
- `{ file, context, problems: [{ kind, rows, message }], waves: [{ wave, batches: [{ id, owner, context, rows: [{ id, kind, slice, status, waitingFor }], aggregates, brief, sameFiles, unknownOverlap }] }], mergeOrder }`.
1259
+ `{ file, context, problems: [{ kind, rows, message }], waves: [{ wave, batches: [{ id, owner, context, rows: [{ id, kind, slice, status, story, waitingFor, waitingForRows: [{ id, context, story, status }] }], aggregates, brief, sameFiles, unknownOverlap }] }], mergeOrder, otherStories: [{ id, context, story, kind, slice, owner, status, batch, waitedForBy }] }`,
1260
+ `story` valant `null` pour une ligne dont l'identifiant n'en nomme aucune, et `batch` `null` pour
1261
+ une ligne que le contexte demandé ne montre pas.
1229
1262
 
1230
1263
  ## story-check
1231
1264
 
@@ -1803,7 +1836,7 @@ règle.
1803
1836
  | `context/declared-relationship` | un import d'un langage publié dont le contexte n'est pas un amont déclaré |
1804
1837
  | `context/published-language-is-a-contract` | `published-language/` qui importe autre chose que sa liste autorisée et d'autres langages publiés |
1805
1838
  | `context/no-cycle` | un cycle dans les amonts déclarés, avec son chemin |
1806
- | `tree/closed` | un répertoire hors de l'arbre canonique et de `extraDirectories` ; un fichier source hors d'un répertoire de rôle ; dans le style déclaré, `<context>.declarations.ts` est accepté à la racine d'un contexte |
1839
+ | `tree/closed` | un répertoire hors de l'arbre canonique et de `extraDirectories` ; un fichier source hors d'un répertoire de rôle ; dans le style déclaré, `<context>.declarations.ts` est accepté à la racine d'un contexte, et le `<folder>.declarations.ts` d'un dossier de rôle dans ce dossier |
1807
1840
  | `tree/context-doc` | un `CONTEXT.md` manquant, une section manquante, une classification qui contredit la configuration |
1808
1841
  | `naming/suffix` | un fichier sans le suffixe de son rôle, ou pas en kebab-case. `application/scheduling/` contient des `*.job.ts` ; un dossier de cas d'usage accepte un `*.result.ts` à côté de son message et de son gestionnaire ; `presentation/http/<context>.routes.ts`, nommé d'après son contexte au lieu d'un rôle, est accepté dans les deux styles |
1809
1842
  | `naming/one-concept-per-file` | plusieurs classes exportées dans un fichier d'agrégat, d'entité, d'objet-valeur, d'événement, de commande, de requête, de gestionnaire, de gestionnaire d'événement, de gestionnaire d'événement d'intégration ou de *job* ; dans le style déclaré, plusieurs classes portant un décorateur de déclaration dans un même fichier de rôle |
@@ -1861,7 +1894,7 @@ règle.
1861
1894
  | `context/extractable` | un fichier de module qui importe un autre contexte hors de son langage publié ; une persistance qui importe l'infrastructure d'un autre contexte ou nomme son schéma ; un gestionnaire qui importe le *repository* d'un autre contexte ; `export let` ou un `new Map`, `Set`, `WeakMap` exporté au niveau du module ; `deployable: true` sans `apps/<context>/main.ts` ; dans le style déclaré, un fichier de rôle qui importe quoi que ce soit d'un fichier de port d'un autre contexte |
1862
1895
  | `governance/recorded-deviation` | un commentaire `ddd-ts-kit-disable` ou `eslint-disable` dont la raison ne nomme aucun `ADR-<number>` avec un fichier `docs/adr/<number>-*.md` ; une règle mise à `off` (ou à `warn` en dessous de sa valeur par défaut), un répertoire supplémentaire, un *package* autorisé supplémentaire, un `guard` autre que `enforce` ou `stack.events` hors de l'outbox, sans entrée `deviations` `{ what, adr, reason }` qui pointe vers un enregistrement existant |
1863
1896
  | `declarations/role-declared` | style déclaré seulement : un fichier de rôle (autre que `*.command.ts` et `*.query.ts`, tenus par `authz/declared` ; `*.job.ts` sous `application/scheduling/` avec `@Scheduled` et `*.publisher.ts` avec `@DomainEventHandler` sont des rôles) qui n'exporte aucune classe portant le décorateur de son suffixe et de son dossier, ou une classe qui en porte une autre ; une classe déclarée dans un fichier qui n'est pas un fichier de rôle ; une option `consumer` ou `name` manquante, vide, une variable, une concaténation ou un template literal avec une substitution ; tout décorateur de déclaration sur une classe sous `domain/` |
1864
- | `declarations/barrel-current` | style déclaré seulement : avec `stack.assembly: barrel`, un `<context>.declarations.ts` manquant ou qui diffère d'un `export *` par fichier de rôle trié par chemin, suivi d'un `injected(Class, [Tokens])` par classe dont le constructeur reçoit quelque chose (lu depuis les signatures, avec leurs imports) ; avec `discovery`, un barrel qui existe encore, et un `<context>.dependencies.ts` qui diffère de ces instructions `injected` (son absence est acceptée tant qu'il n'en contiendrait aucune). Le message nomme le fichier de rôle manquant ou la classe dont la liste est périmée. Elle a besoin de l'arbre, c'est pourquoi `check-file` ne l'exécute pas |
1897
+ | `declarations/barrel-current` | style déclaré seulement : avec `stack.assembly: barrel`, un `<folder>.declarations.ts` d'un dossier de rôle manquant ou qui diffère d'un `export *` par fichier de rôle du dossier trié par chemin, suivi d'un `injected(Class, [Tokens])` par classe du dossier dont le constructeur reçoit quelque chose (lu depuis les signatures, avec leurs imports), un `<context>.declarations.ts` manquant ou qui diffère d'un `export *` par tel fichier trié par chemin, et les déclarations d'un dossier qui ne contient plus aucun fichier de rôle ; avec `discovery`, des déclarations générées qui existent encore, et un `<context>.dependencies.ts` qui diffère de ces instructions `injected` (son absence est acceptée tant qu'il n'en contiendrait aucune). Le message nomme le fichier de rôle manquant ou la classe dont la liste est périmée. Un contexte encore déclaré dans le fichier unique `<context>.declarations.ts` de 0.84, exactement tel que l'écrirait cette version et sans aucun fichier de déclarations dans un dossier de rôle, est un avertissement dans cette version (`docs --check` passe et l'affiche, `docs` le déplace) et une erreur dans une version mineure ultérieure. Elle a besoin de l'arbre, c'est pourquoi `check-file` ne l'exécute pas |
1865
1898
  | `declarations/constructor-injection` | style déclaré seulement, dans un fichier de rôle : sur une classe dont le décorateur ne liste rien, un paramètre de constructeur optionnel, qui a une valeur par défaut, est un paramètre du reste ou est déstructuré, n'a pas de type, ou est typé par autre chose qu'un nom de classe (arguments de type mis à part) : une union, une intersection, un tableau, un nom qualifié, un type du langage, une interface, un alias de type, une enum ou une classe non exportée du fichier ou du fichier du projet d'où elle est importée ; une classe qui hérite son constructeur d'une classe que le projet ne sait pas lire. Sous `stack.dependencies: signature`, un décorateur qui porte une liste alors que le constructeur peut être lu : une liste qui le répète, une qui en diffère |
1866
1899
  | `declarations/port-adapter-wired` | une classe de `infrastructure/` qui implémente un port et que rien ne câble : ni `@Repository`, `@Gateway` ou `@Adapter` dans le style déclaré, ni fichier de la racine de composition (`<context>.module.ts`, `main.ts`, `apps/<context>/main.ts`, la plateforme) qui l'importe, une fois que le fichier ne porte plus de `TODO(domain)` ni de `TODO(platform)` ; celle gardée à dessein porte `// ddd-ts-kit-disable-next-line declarations/port-adapter-wired -- ADR-NNNN: <why>` |
1867
1900
  | `ports/abstract-class` | dans un fichier de port (`domain/repositories/*.repository.ts`, `application/ports/*.port.ts`) : une classe qui n'est pas `abstract` ; un membre qui n'est pas une méthode ou une propriété abstraite (`static readonly tokenKey = '<text>'` mis à part) : un constructeur, un corps, un initialiseur, un membre `private`, `protected` ou `#` ; une `interface` exportée (un alias `type`, une forme de données, n'est pas signalé) |
package/README.md CHANGED
@@ -134,9 +134,9 @@ module file of the context: `builder.bind(Port).toClass(Adapter, [Ports])`,
134
134
  `builder.command(Message).requires(...).handledBy(Handler, [Ports])`, `builder.job(name, schedule)`.
135
135
  `--style declared` is refused with `--di manual` and `--di nest`: the declarations are plain
136
136
  metadata, and only `@ddd-ts-kit/di` (on tsyringe) turns them into bindings.
137
- `--assembly` says how a declared context reaches the composition root: `barrel` (the default) is one
138
- generated file per context, `<context>.declarations.ts`, static, followed by a bundler, by knip and
139
- by dependency-cruiser; `discovery` writes `await discoverContext(...)` instead, with the knip entry
137
+ `--assembly` says how a declared context reaches the composition root: `barrel` (the default) is
138
+ generated files, `<context>.declarations.ts` at the root of the context re-exporting the
139
+ declarations of each role folder, static, followed by a bundler, by knip and by dependency-cruiser; `discovery` writes `await discoverContext(...)` instead, with the knip entry
140
140
  and the dependency-cruiser exception the discovered files need (publishers and jobs included: they
141
141
  are discovered like the rest), and inlines `@ddd-ts-kit/di` in the two vitest configs, so that the
142
142
  files it imports itself are compiled by the runner. Discovery is accepted behind a broker: a
@@ -297,9 +297,9 @@ export class SettleInvoiceHandler {
297
297
  nothing in its decorator (`@CommandHandler(IssueInvoiceCommand)`): each constructor parameter
298
298
  is typed by one class, its token (`declarations/constructor-injection`). `generate`, `docs` and
299
299
  the `dev` script read the signatures, with the zero-dependency scanner of the checker and no
300
- compiler, and write `injected(Class, [Tokens])` statements in the generated file of each
301
- context: the barrel `<context>.declarations.ts`, or `<context>.dependencies.ts` under
302
- discovery. `@ddd-ts-kit/di` injects from there. `emitDecoratorMetadata` is never relied on: it
300
+ compiler, and write `injected(Class, [Tokens])` statements in the generated files of each
301
+ context: the `<folder>.declarations.ts` of each role folder, next to the classes it registers,
302
+ which `<context>.declarations.ts` re-exports, or `<context>.dependencies.ts` under discovery. `@ddd-ts-kit/di` injects from there. `emitDecoratorMetadata` is never relied on: it
303
303
  is absent with standard decorators and under `tsx`. `init` writes
304
304
  `"stack.dependencies": "signature"`; a config without the key is `listed`, the 0.1 form
305
305
  (`@CommandHandler(M, [Ports])`), which keeps working untouched, and
@@ -307,26 +307,35 @@ is absent with standard decorators and under `tsx`. `init` writes
307
307
  what each class is given. Every generated file exports one class, interface or function and is named
308
308
  after it.
309
309
 
310
- ![How a declared context reaches the composition root: the role files carry their decorator and type their constructor parameters by classes; generate, docs and the dev script read those signatures and write the barrel, one export per role file and one injected statement per class that takes something; the composition root includes the barrel with contextModule and @ddd-ts-kit/di injects from it; check and docs --check report a barrel that no longer matches the role files](https://raw.githubusercontent.com/gbourgeat/ddd-ts-kit/main/docs/assets/diagrams/cli-declared-barrel.svg)
310
+ ![How a declared context reaches the composition root: the role files carry their decorator and type their constructor parameters by classes; generate, docs and the dev script read those signatures and write the declarations of each role folder, one export per role file of the folder and one injected statement per class that takes something, and a summary at the root of the context that re-exports them; the composition root includes the summary with contextModule and @ddd-ts-kit/di injects from it; check and docs --check report generated declarations that no longer match the role files](https://raw.githubusercontent.com/gbourgeat/ddd-ts-kit/main/docs/assets/diagrams/cli-declared-barrel.svg)
311
311
 
312
- An excerpt of the barrel of the `notification` context of the example application, as the CLI
313
- writes it (never by hand):
312
+ An excerpt of the declarations of the `notification` context of the example application, as
313
+ the CLI writes them (never by hand): one file per role folder, next to the classes it registers,
314
+ and a summary at the root of the context that only re-exports them.
314
315
 
315
316
  ```ts
316
- // src/contexts/notification/notification.declarations.ts
317
+ // src/contexts/notification/application/commands/commands.declarations.ts
317
318
  import { injected } from '@ddd-ts-kit/kernel/declarations';
318
319
  import { WithdrawReminderHandler } from '@/contexts/notification/application/commands/withdraw-reminder/withdraw-reminder.handler';
319
320
  import { ReminderRepository } from '@/contexts/notification/domain/repositories/reminder.repository';
321
+
322
+ export * from '@/contexts/notification/application/commands/withdraw-reminder/withdraw-reminder.command';
323
+ export * from '@/contexts/notification/application/commands/withdraw-reminder/withdraw-reminder.handler';
324
+
325
+ injected(WithdrawReminderHandler, [ReminderRepository]);
326
+
327
+ // src/contexts/notification/infrastructure/persistence/persistence.declarations.ts
320
328
  import { KnexReminderRepository } from '@/contexts/notification/infrastructure/persistence/knex-reminder.repository';
321
329
  import { Clock, ExecutionScope } from '@ddd-ts-kit/kernel';
322
330
  import { KnexContext } from '@ddd-ts-kit/knex';
323
331
 
324
- export * from '@/contexts/notification/application/commands/withdraw-reminder/withdraw-reminder.command';
325
- export * from '@/contexts/notification/application/commands/withdraw-reminder/withdraw-reminder.handler';
326
332
  export * from '@/contexts/notification/infrastructure/persistence/knex-reminder.repository';
327
333
 
328
- injected(WithdrawReminderHandler, [ReminderRepository]);
329
334
  injected(KnexReminderRepository, [KnexContext, ExecutionScope, Clock]);
335
+
336
+ // src/contexts/notification/notification.declarations.ts
337
+ export * from '@/contexts/notification/application/commands/commands.declarations';
338
+ export * from '@/contexts/notification/infrastructure/persistence/persistence.declarations';
330
339
  ```
331
340
 
332
341
  and the one line of the composition root that adds the whole context:
@@ -532,7 +541,7 @@ config, `docsUi`, `ci` and `logger` included.
532
541
  | migration tooling | `drizzle.config.ts`, `knexfile.js` and `migrations/00000000000000_initial.js`, `prisma/schema.prisma` and `prisma.config.ts`, or `data-source.ts` |
533
542
  | `scripts/openapi.ts`, `scripts/events.ts` | write `openapi/openapi.yaml` (one file per document of `openapi.documents`), `docs/integration/asyncapi.yaml` and `docs/integration/event-catalog.md`, in JSON under `openapi.format: json`; `--check` fails on a difference |
534
543
  | `docker-compose.yml`, `.env.example`, `Dockerfile`, `.dockerignore` | the database with a healthcheck and a named volume, `jaegertracing/jaeger:2.22.0` behind the `observability` profile (its UI and its OTLP port bound to 127.0.0.1), ports from `.env`; a multi-stage, non-root image with production dependencies only |
535
- | `vitest.e2e.config.ts`, `test/e2e/support/` | `start-application.ts` (the whole application on a free port, on an in-process database unless `DATABASE_URL` is set, no job run by time; `settled()` resolves once the outbox has relayed what the requests stored), `create-credentials.ts`, `auth-environment.ts`, `test-environment.ts`, `story-of.ts` (`storyOf(trace)`: a trace without the calls an adapter makes on itself, the form `expectSpanTree` asserts) |
544
+ | `vitest.e2e.config.ts`, `test/e2e/support/` | `start-application.ts` (the whole application on a free port, on an in-process database unless `DATABASE_URL` is set, no job run by time; `settled()` resolves once the outbox has relayed what the requests stored; `publish(events)` hands integration events of an upstream to its handlers, as the relay of that upstream would), `create-credentials.ts`, `auth-environment.ts`, `test-environment.ts`, `story-of.ts` (`storyOf(trace)`: a trace without the calls an adapter makes on itself, the form `expectSpanTree` asserts) |
536
545
  | `docs/context-map.md`, `docs/integration/README.md` | see `docs` |
537
546
  | `test/architecture/extractable.spec.ts` | written with the first context: boots each context alone on the kernel and the platform, its jobs included |
538
547
  | `eslint.config.mjs` | the `dddTsKit` preset of `@ddd-ts-kit/eslint-plugin`, typed linting on the project's tsconfig |
@@ -637,7 +646,7 @@ would create src/contexts/notification/application/commands/archive-notification
637
646
  would create src/contexts/notification/test/unit/archive-notification.handler.spec.ts
638
647
  would update src/contexts/notification/CONTEXT.md
639
648
  would update src/contexts/notification/application/authorization/notification.permissions.ts
640
- would update src/contexts/notification/notification.declarations.ts
649
+ would update src/contexts/notification/application/commands/commands.declarations.ts
641
650
 
642
651
  Next, in this order: the language of the context first, then the business decisions only you can make
643
652
  src/contexts/notification/application/commands/archive-notification/archive-notification.command.ts:9 declare the input of "archive notification" as a constructor with the actor first, ...
@@ -679,7 +688,7 @@ Next, in this order: the language of the context first, then the business decisi
679
688
  | `background-job` | `<context> <Name> --command <UseCaseName>` | `application/background/<name>.background-job.ts`, a class `<Name>BackgroundJob implements BackgroundJob<<Name>Payload>` named by its static `jobName` `<context>.<name>`, that sends the command as `execution.actor` when it is protected, followed by one field of `<Name>Payload` per other parameter of the constructor of the command (strings, numbers, booleans, literals and lists of them as written, a `Date` as its ISO text; anything else is refused); `test/unit/<name>.background-job.spec.ts`, which enqueues it with a payload of every field as a user holding the permission and runs what is due; its registration (`@Background()`, or `builder.backgroundJob(..)` in the module file). `--di tsyringe` only |
680
689
  | `process` (`process-manager`) | `<context> <Name>` | `application/processes/<name>.process.ts` (its state, `processName`, `timeoutJob`, `isState`, a first step that arms a deadline, a step that ends it in time, the step of the deadline), `application/background/<name>-timeout.background-job.ts`, which delivers its timeouts through `ProcessRunner`, and the specs of both (`givenProcess`, the queue of the test application). `--di tsyringe` only |
681
690
  | `acl` | `<context> <upstreamOrSystemName>` | translator in `infrastructure/anti-corruption/`, spec |
682
- | `e2e` | `<context> <UseCaseName>` | `test/e2e/<use-case>.e2e.spec.ts` driving the route of the use case: 401 without a credential, 403 without the permission, the documented status with it; for a command, one more test asserts the trace of the request, exact on names and structure, with `installTestTracing()` and `expectSpanTree(storyOf(trace), [...])` of `@ddd-ts-kit/tracing/testing` (`POST /invoices`, then `command IssueInvoiceCommand`, then `repository InvoiceRepository.save`); needs the route |
691
+ | `e2e` | `<context> <UseCaseName> [--event <eventType>]` | `test/e2e/<use-case>.e2e.spec.ts` driving the route of the use case: 401 without a credential, 403 without the permission, the documented status with it; for a command, one more test asserts the trace of the request, exact on names and structure, with `installTestTracing()` and `expectSpanTree(storyOf(trace), [...])` of `@ddd-ts-kit/tracing/testing` (`POST /invoices`, then `command IssueInvoiceCommand`, then `repository InvoiceRepository.save`). A use case no route reaches, started by an integration event handler of the context, gets a spec that publishes the upstream event, built from its declaration, with `application.publish([event])`, awaits `application.settled()` and leaves `it.todo` for what a client observes (the `GET` routes of the context, or the events it publishes with `collectEvents`); the handler that sends `<UseCase>Command` is found in `application/integration/handlers/`, and `--event billing.invoice.issued` names the event when handlers of several send it, or when the handler does not send it yet. Needs the route, or that handler |
683
692
  | `policy` | `<context> <Name> --permission <aggregate>.<action>` | `application/authorization/<name>.policy.ts`, spec; declared: the class carries `@Policy(permission, { name })` and nothing else is written; explicit: registration in `platform/auth/authorization/access-policies.ts` |
684
693
  | `gateway` | `<context> <upstreamContext> <Name>` | the read contract in the upstream's published language (`<name>.contract.ts`, an abstract class and the token of the upstream value), the port `application/ports/<name>-gateway.port.ts`, an in-process adapter in `infrastructure/external/` bound `.as('gateway')`, a fake, one contract suite; refused unless the upstream is declared |
685
694
  | `adapter` | `<context> <Port> [--kind external\|gateway] [--decorators]` | `infrastructure/external/remote-<port>.adapter.ts` for an existing port, its spec, and on tsyringe its binding `builder.bind(<Port>).toClass(Remote<Port>).as(<kind>).with(ownPolicy(retry(...), timeout(...)))`; with `--decorators`, on every stack, the class carries `@Retry` and `@Timeout` of `@ddd-ts-kit/aspects/decorators` on its one outbound method and is bound `.with(ownPolicy())`. Explicit: a port that is already bound, or hand wiring, gets a note instead of a binding. Declared: the class carries `@Adapter(<Port>, { kind, aspects })`, or `@Gateway(<Port>, { aspects })` in `remote-<port>.gateway.ts` with `--kind gateway`, and a port that already has a declared adapter is refused |
@@ -737,12 +746,19 @@ Next, in this order: the language of the context first, then the business decisi
737
746
  `system` subject operate a context. With `--authz custom`, a removed region, a remodelled
738
747
  relationship schema or a permission the generator cannot read, nothing is written and the job
739
748
  file carries the `TODO(domain)` naming the actor and the permission.
740
- - **The barrel is derived.** `<context>.declarations.ts` holds one `export *` per role file, sorted
741
- by path, then one `injected(Class, [Tokens])` per class whose constructor takes something,
742
- read from its signature, with the imports they need. Every `generate`, and `docs`, rewrite it;
743
- `docs --check` and `check` (`declarations/barrel-current`) report one that a role file written
744
- by hand left behind or whose constructor changed since, naming the class
745
- (`stale src/contexts/billing/billing.declarations.ts: the dependency list of IssueInvoiceHandler is stale: ...`).
749
+ - **The declarations are derived.** Each role folder of a context that holds a declared role
750
+ file has its `<folder>.declarations.ts`, in that folder: `application/commands/commands.declarations.ts`,
751
+ `infrastructure/persistence/persistence.declarations.ts`, `presentation/http/http.declarations.ts`
752
+ (the files of a use case or of a route roll up to the folder at `<layer>/<folder>/`; a role file
753
+ sitting directly in its layer goes to `<layer>/<layer>.declarations.ts`). It holds one
754
+ `export *` per role file of the folder, sorted by path, then one `injected(Class, [Tokens])` per
755
+ class whose constructor takes something, read from its signature, with the imports they need.
756
+ `<context>.declarations.ts`, at the root of the context, only re-exports these files, sorted by
757
+ path. Every `generate`, and `docs`, rewrite them and delete the declarations of a folder that
758
+ holds no role file any more; `docs --check` and `check` (`declarations/barrel-current`) report
759
+ one that a role file written by hand left behind or whose constructor changed since, naming the
760
+ class
761
+ (`stale src/contexts/billing/application/commands/commands.declarations.ts: the dependency list of IssueInvoiceHandler is stale: ...`).
746
762
  The `dev` script loads `ddd-ts-kit/dist/refresh-declarations.js` before the application, on
747
763
  every start and reload of `tsx watch`: a port added to a constructor is injected on the
748
764
  reload that follows the save. The same module is the binary `ddd-ts-kit-refresh-declarations`.
@@ -829,9 +845,11 @@ Regenerates what is derived from the config and the code, and nothing else:
829
845
  kept; on first creation the four written sections are laid out with hints.
830
846
  - the generated lists of every `CONTEXT.md` (aggregates, published events, permissions, scheduled
831
847
  jobs as a table of name, schedule and command, relationships);
832
- - the generated file of every declared context: the barrel `<context>.declarations.ts`, with
833
- what each constructor is injected, read from its signature, or under discovery
834
- `<context>.dependencies.ts`, which holds that alone;
848
+ - the generated declarations of every declared context: the `<folder>.declarations.ts` of each
849
+ role folder, with what each constructor is injected, read from its signature, and
850
+ `<context>.declarations.ts`, which re-exports them (the declarations of a folder left without a
851
+ role file are deleted), or under discovery `<context>.dependencies.ts`, which holds the lists
852
+ alone;
835
853
  - the reference of every `CONTEXT.md`: the facts of `describe`, as tables under `## Reference`,
836
854
  between `ddd-ts-kit:reference` markers; a `CONTEXT.md` that has no such section gets it after its
837
855
  last generated list;
@@ -1161,11 +1179,22 @@ a wave the batch that the most rows wait for, directly or not, first, and what r
1161
1179
  merge: `npx ddd-ts-kit merge-trunk --to-land --cwd <worktree>`, then the squash merge. With a context, only its rows
1162
1180
  are shown; the rows of other contexts it waits for count in the numbering of the waves.
1163
1181
 
1182
+ A row says the rows it waits for, each with its status: `after #US1.02 (todo)`. A row it waits for
1183
+ that belongs to another story (its id without the last `.<number>`, `US1` for `US1.04`) or to a
1184
+ context that is not shown also gets its context and its story: `after #US1.04 (todo, billing, story
1185
+ US1)`. The rows of one story that a planned row of another story waits for are listed again, after
1186
+ the waves, under `Rows another story waits for, not done`, with their owner, their status, the
1187
+ batch that holds them (or the `plan-waves <context>` that shows them) and the rows that wait:
1188
+ before launching a wave, the conductor sees that it waits on the work of another story, and whether
1189
+ anyone carries it.
1190
+
1164
1191
  A cycle in `Depends on`, a dependency on an id no row carries, a row without owner and an id two
1165
1192
  rows carry make the rows impossible to order: they are reported alone, without waves, and the
1166
1193
  command exits 1. A file without a slices table, or a context no row names, is refused. `--json`
1167
1194
  prints
1168
- `{ file, context, problems: [{ kind, rows, message }], waves: [{ wave, batches: [{ id, owner, context, rows: [{ id, kind, slice, status, waitingFor }], aggregates, brief, sameFiles, unknownOverlap }] }], mergeOrder }`.
1195
+ `{ file, context, problems: [{ kind, rows, message }], waves: [{ wave, batches: [{ id, owner, context, rows: [{ id, kind, slice, status, story, waitingFor, waitingForRows: [{ id, context, story, status }] }], aggregates, brief, sameFiles, unknownOverlap }] }], mergeOrder, otherStories: [{ id, context, story, kind, slice, owner, status, batch, waitedForBy }] }`,
1196
+ `story` being `null` for a row whose id names none and `batch` `null` for a row the context asked
1197
+ for does not show.
1169
1198
 
1170
1199
  ## story-check
1171
1200
 
@@ -1701,7 +1730,7 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
1701
1730
  | `context/declared-relationship` | an import of a published language whose context is not a declared upstream |
1702
1731
  | `context/published-language-is-a-contract` | `published-language/` importing anything but its allow-list and other published languages |
1703
1732
  | `context/no-cycle` | a cycle in the declared upstreams, with its path |
1704
- | `tree/closed` | a directory outside the canonical tree and `extraDirectories`; a source file outside a role directory; in the declared style `<context>.declarations.ts` is accepted at the root of a context |
1733
+ | `tree/closed` | a directory outside the canonical tree and `extraDirectories`; a source file outside a role directory; in the declared style `<context>.declarations.ts` is accepted at the root of a context, and the `<folder>.declarations.ts` of a role folder in that folder |
1705
1734
  | `tree/context-doc` | a missing `CONTEXT.md`, a missing section, a classification that contradicts the config |
1706
1735
  | `naming/suffix` | a file without the suffix of its role, or not in kebab-case. `application/scheduling/` holds `*.job.ts`; a use case folder accepts `*.result.ts` next to its message and its handler; `presentation/http/<context>.routes.ts`, named after its context instead of a role, is accepted in both styles |
1707
1736
  | `naming/one-concept-per-file` | several exported classes in an aggregate, entity, value object, event, command, query, handler, event handler, integration event handler or job file; in the declared style, several classes carrying a declaration decorator in one role file |
@@ -1759,7 +1788,7 @@ const due = handler.isDueNow(new Reminder(new Date('2026-03-01T09:00:00Z'))); //
1759
1788
  | `context/extractable` | a module file importing another context outside its published language; persistence importing another context's infrastructure or naming its schema; a handler importing another context's repository; `export let` or an exported `new Map`, `Set`, `WeakMap` at module level; `deployable: true` without `apps/<context>/main.ts`; in the declared style, a role file importing anything of a port file of another context |
1760
1789
  | `governance/recorded-deviation` | a `ddd-ts-kit-disable` or `eslint-disable` comment whose reason names no `ADR-<number>` with a file `docs/adr/<number>-*.md`; a rule set to `off` (or to `warn` below its default), an extra directory, an extra allowed package, a `guard` other than `enforce` or `stack.events` off the outbox, without a `deviations` entry `{ what, adr, reason }` pointing to an existing record |
1761
1790
  | `declarations/role-declared` | declared style only: a role file (other than `*.command.ts` and `*.query.ts`, held by `authz/declared`; `*.job.ts` under `application/scheduling/` with `@Scheduled` and `*.publisher.ts` with `@DomainEventHandler` are roles) exporting no class with the decorator of its suffix and folder, or one carrying another declaration; a declared class in a file that is not a role file; a `consumer` or `name` option that is missing, empty, a variable, a concatenation or a template with a substitution; any declaration decorator on a class under `domain/` |
1762
- | `declarations/barrel-current` | declared style only: with `stack.assembly: barrel`, a missing `<context>.declarations.ts` or one that differs from one `export *` per role file sorted by path followed by one `injected(Class, [Tokens])` per class whose constructor takes something (read from the signatures, with their imports); with `discovery`, a barrel that still exists, and a `<context>.dependencies.ts` that differs from those `injected` statements (absent is accepted while it would hold none). The message names the missing role file or the class whose list is stale. It needs the tree, so `check-file` does not run it |
1791
+ | `declarations/barrel-current` | declared style only: with `stack.assembly: barrel`, a missing `<folder>.declarations.ts` of a role folder or one that differs from one `export *` per role file of the folder sorted by path followed by one `injected(Class, [Tokens])` per class of the folder whose constructor takes something (read from the signatures, with their imports), a `<context>.declarations.ts` that is missing or differs from one `export *` per such file sorted by path, and the declarations of a folder that holds no role file any more; with `discovery`, generated declarations that still exist, and a `<context>.dependencies.ts` that differs from those `injected` statements (absent is accepted while it would hold none). The message names the missing role file or the class whose list is stale. A context still declared in the single `<context>.declarations.ts` of 0.84, exactly as that version would write it and with no declarations file in a role folder yet, is a warning in this version (`docs --check` passes and prints it, `docs` moves it) and an error in a later minor version. It needs the tree, so `check-file` does not run it |
1763
1792
  | `declarations/constructor-injection` | declared style only, in a role file: on a class whose decorator lists nothing, a constructor parameter that is optional, has a default value, is a rest parameter or is destructured, has no type, or is typed by anything but one class name (type arguments aside): a union, an intersection, an array, a qualified name, a type of the language, an interface, a type alias, an enum or an unexported class of the file or of the file of the project it is imported from; a class that inherits its constructor from a class the project cannot read. Under `stack.dependencies: signature`, a decorator that carries a list although the constructor can be read: one that repeats it, one that differs |
1764
1793
  | `declarations/port-adapter-wired` | a class of `infrastructure/` implementing a port that nothing wires: no `@Repository`, `@Gateway` or `@Adapter` in the declared style, and no file of the composition root (`<context>.module.ts`, `main.ts`, `apps/<context>/main.ts`, the platform) importing it, once the file carries no `TODO(domain)` or `TODO(platform)` left; one kept on purpose carries `// ddd-ts-kit-disable-next-line declarations/port-adapter-wired -- ADR-NNNN: <why>` |
1765
1794
  | `ports/abstract-class` | in a port file (`domain/repositories/*.repository.ts`, `application/ports/*.port.ts`): a class that is not `abstract`; a member that is not an abstract method or property (`static readonly tokenKey = '<text>'` apart): a constructor, a body, an initializer, a `private`, `protected` or `#` member; an exported `interface` (a `type` alias, a data shape, is not reported) |
@@ -1,5 +1,5 @@
1
1
  import path from 'node:path';
2
- import { barrelFile, dependenciesFile } from '../../declared/index.js';
2
+ import { barrelFile, dependenciesFile, isDeclarationsFile } from '../../declared/index.js';
3
3
  import { isCanonicalDirectory } from './is-canonical-directory.js';
4
4
  import { OPEN_DIRECTORIES } from './open-directories.js';
5
5
  import { roleOf } from './role-of.js';
@@ -48,7 +48,8 @@ function straySource(placed) {
48
48
  return atContextRoot(placed);
49
49
  }
50
50
  const open = OPEN_DIRECTORIES.some((root) => directory === root || directory.startsWith(`${root}/`));
51
- if (open || roleOf(directory) !== undefined || coveredByExtra(extras, directory)) {
51
+ const generated = placed.declared && isDeclarationsFile(placed.context, inside);
52
+ if (open || generated || roleOf(directory) !== undefined || coveredByExtra(extras, directory)) {
52
53
  return undefined;
53
54
  }
54
55
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"stray-entry.js","sourceRoot":"","sources":["../../../src/check/canonical/stray-entry.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,MAAM,EAA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,IAAI,oCAAoC;QACrD,GAAG,EAAE,gDAAgD,OAAO,iCAAiC;KAC9F,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,MAAyB,EAAE,SAAiB;IAClE,OAAO,MAAM,CAAC,IAAI,CAChB,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,KAAK,KAAK,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,SAAS,GAAG,CAAC,CACzG,CAAC;AACJ,CAAC"}
@@ -63,7 +63,7 @@ export abstract class TaxGateway {}
63
63
  export interface IssueInvoiceResult { readonly invoiceId: string }`,
64
64
  },
65
65
  'clean/file-size': {
66
- why: 'Past a few hundred lines a file holds more than one responsibility: nobody reads it whole, and every change touches something unrelated. The limit is 350 physical lines, for sources and tests alike, and is not configurable. A long test file is split by behaviour, a long source by concept. An aggregate keeps its intention methods and moves a decision out: a domain service that takes the state and returns the new state and its events, which the aggregate applies, or a value object for fields that travel together; never a public method that sets its state from outside. Generated files (a path segment named generated, the <context>.declarations.ts and <context>.dependencies.ts at the root of a context) and declaration files are not judged.',
66
+ why: 'Past a few hundred lines a file holds more than one responsibility: nobody reads it whole, and every change touches something unrelated. The limit is 350 physical lines, for sources and tests alike, and is not configurable. A long test file is split by behaviour, a long source by concept. A long end-to-end spec is split into parts named after it, test/e2e/<use-case>-<behaviour>.e2e.spec.ts beside test/e2e/<use-case>.e2e.spec.ts (the one name of a new end-to-end spec the guard of the plugin lets be written by hand, with test/e2e/journey-<name>.e2e.spec.ts for a journey across use cases), and what its parts share goes to test/e2e/support/<context>/. An aggregate keeps its intention methods and moves a decision out: a domain service that takes the state and returns the new state and its events, which the aggregate applies, or a value object for fields that travel together; never a public method that sets its state from outside. Generated files (a path segment named generated, the <context>.declarations.ts and <context>.dependencies.ts at the root of a context, the <folder>.declarations.ts of its role folders) and declaration files are not judged.',
67
67
  bad: `// application/commands/issue-invoice/issue-invoice.handler.ts, 600 lines:
68
68
  // the handler, its validation, its mapping and three helpers`,
69
69
  good: `// issue-invoice.handler.ts orchestrates, in 40 lines;
@@ -1 +1 @@
1
- {"version":3,"file":"layout-docs.js","sourceRoot":"","sources":["../../../src/check/explain/layout-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,uBAAuB,EAAE;QACvB,GAAG,EAAE,qXAAqX;QAC1X,GAAG,EAAE;;;;;;EAMP;QACE,IAAI,EAAE;;;;;;EAMR;KACC;IACD,mBAAmB,EAAE;QACnB,GAAG,EAAE,qgBAAqgB;QAC1gB,GAAG,EAAE;;;;EAIP;QACE,IAAI,EAAE;;;;EAIR;KACC;IACD,cAAc,EAAE;QACd,GAAG,EAAE,ieAAie;QACte,GAAG,EAAE;;;;0CAIiC;QACtC,IAAI,EAAE;;;;;;;;;;EAUR;KACC;IACD,2BAA2B,EAAE;QAC3B,GAAG,EAAE,yrBAAyrB;QAC9rB,GAAG,EAAE;;;;iCAIwB;QAC7B,IAAI,EAAE;;;;;mEAKyD;KAChE;IACD,iBAAiB,EAAE;QACjB,GAAG,EAAE,2uBAA2uB;QAChvB,GAAG,EAAE;8DACqD;QAC1D,IAAI,EAAE;wFAC8E;KACrF;CACF,CAAC"}
1
+ {"version":3,"file":"layout-docs.js","sourceRoot":"","sources":["../../../src/check/explain/layout-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAsC;IAC5D,uBAAuB,EAAE;QACvB,GAAG,EAAE,qXAAqX;QAC1X,GAAG,EAAE;;;;;;EAMP;QACE,IAAI,EAAE;;;;;;EAMR;KACC;IACD,mBAAmB,EAAE;QACnB,GAAG,EAAE,qgBAAqgB;QAC1gB,GAAG,EAAE;;;;EAIP;QACE,IAAI,EAAE;;;;EAIR;KACC;IACD,cAAc,EAAE;QACd,GAAG,EAAE,ieAAie;QACte,GAAG,EAAE;;;;0CAIiC;QACtC,IAAI,EAAE;;;;;;;;;;EAUR;KACC;IACD,2BAA2B,EAAE;QAC3B,GAAG,EAAE,yrBAAyrB;QAC9rB,GAAG,EAAE;;;;iCAIwB;QAC7B,IAAI,EAAE;;;;;mEAKyD;KAChE;IACD,iBAAiB,EAAE;QACjB,GAAG,EAAE,2oCAA2oC;QAChpC,GAAG,EAAE;8DACqD;QAC1D,IAAI,EAAE;wFAC8E;KACrF;CACF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"tree-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/tree-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiHvD,CAAC"}
1
+ {"version":3,"file":"tree-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/tree-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkHvD,CAAC"}
@@ -1,9 +1,10 @@
1
1
  export const TREE_DOCS = {
2
2
  'tree/closed': {
3
- why: 'A fixed tree means every concept has one obvious place, so people and tools find it without reading the code. An ad hoc folder (utils, helpers, common, types, functions) is where unnamed concepts go to hide: a function that reads a value is a method of that value object, a decision over several objects a domain service, a shared shape of data a value object, an interchangeable rule an abstract class of domain/services with one service per variant (docs/ARCHITECTURE.md, a concept with no role of its own). A real new need is declared in extraDirectories with its reason. In the declared style the generated barrel <context>.declarations.ts lives at the root of the context, next to CONTEXT.md; a module file may stay there when the wiring of a context is unusual.',
3
+ why: 'A fixed tree means every concept has one obvious place, so people and tools find it without reading the code. An ad hoc folder (utils, helpers, common, types, functions) is where unnamed concepts go to hide: a function that reads a value is a method of that value object, a decision over several objects a domain service, a shared shape of data a value object, an interchangeable rule an abstract class of domain/services with one service per variant (docs/ARCHITECTURE.md, a concept with no role of its own). A real new need is declared in extraDirectories with its reason. In the declared style the generated summary <context>.declarations.ts lives at the root of the context, next to CONTEXT.md, and the generated <folder>.declarations.ts of each role folder in that folder; a module file may stay at the root when the wiring of a context is unusual.',
4
4
  bad: `contexts/billing/domain/utils/rounding.ts`,
5
5
  good: `contexts/billing/domain/value-objects/money.vo.ts
6
- contexts/billing/billing.declarations.ts // declared style only`,
6
+ contexts/billing/billing.declarations.ts // declared style only
7
+ contexts/billing/application/commands/commands.declarations.ts // declared style only`,
7
8
  },
8
9
  'tree/context-doc': {
9
10
  why: 'CONTEXT.md is where the vocabulary and the boundaries are agreed with the domain experts. Without it, names drift and nobody can tell whether a concept belongs here. The classification says how much design effort the context deserves.',
@@ -1 +1 @@
1
- {"version":3,"file":"tree-docs.js","sourceRoot":"","sources":["../../../src/check/explain/tree-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAsC;IAC1D,aAAa,EAAE;QACb,GAAG,EAAE,iwBAAiwB;QACtwB,GAAG,EAAE,2CAA2C;QAChD,IAAI,EAAE;kEACwD;KAC/D;IACD,kBAAkB,EAAE;QAClB,GAAG,EAAE,4OAA4O;QACjP,GAAG,EAAE,6GAA6G;QAClH,IAAI,EAAE,6GAA6G;KACpH;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,83BAA83B;QACn4B,GAAG,EAAE,iHAAiH;QACtH,IAAI,EAAE,2HAA2H;KAClI;IACD,eAAe,EAAE;QACf,GAAG,EAAE,y3BAAy3B;QAC93B,GAAG,EAAE,8BAA8B;QACnC,IAAI,EAAE;;;;qEAI2D;KAClE;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,kyBAAkyB;QACvyB,GAAG,EAAE;;;;kCAIyB;QAC9B,IAAI,EAAE;;;;;oCAK0B;KACjC;IACD,sBAAsB,EAAE;QACtB,GAAG,EAAE,svCAAsvC;QAC3vC,GAAG,EAAE;;;EAGP;QACE,IAAI,EAAE;;;EAGR;KACC;IACD,6BAA6B,EAAE;QAC7B,GAAG,EAAE,kYAAkY;QACvY,GAAG,EAAE;;;;;;;2CAOkC;QACvC,IAAI,EAAE;;;4BAGkB;KACzB;IACD,oBAAoB,EAAE;QACpB,GAAG,EAAE,kaAAka;QACva,GAAG,EAAE,kFAAkF;QACvF,IAAI,EAAE,qCAAqC;KAC5C;IACD,wBAAwB,EAAE;QACxB,GAAG,EAAE,y9BAAy9B;QAC99B,GAAG,EAAE;;;uBAGc;QACnB,IAAI,EAAE;;;;;;uFAM6E;KACpF;IACD,eAAe,EAAE;QACf,GAAG,EAAE,4SAA4S;QACjT,GAAG,EAAE;gDACuC;QAC5C,IAAI,EAAE;qDAC2C;KAClD;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,gUAAgU;QACrU,GAAG,EAAE,iFAAiF;QACtF,IAAI,EAAE;8BACoB;KAC3B;IACD,2BAA2B,EAAE;QAC3B,GAAG,EAAE,uvBAAuvB;QAC5vB,GAAG,EAAE;qFAC4E;QACjF,IAAI,EAAE;;;KAGL;KACF;IACD,oBAAoB,EAAE;QACpB,GAAG,EAAE,yqBAAyqB;QAC9qB,GAAG,EAAE,yEAAyE;QAC9E,IAAI,EAAE;qFAC2E;KAClF;CACF,CAAC"}
1
+ {"version":3,"file":"tree-docs.js","sourceRoot":"","sources":["../../../src/check/explain/tree-docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAsC;IAC1D,aAAa,EAAE;QACb,GAAG,EAAE,u1BAAu1B;QAC51B,GAAG,EAAE,2CAA2C;QAChD,IAAI,EAAE;;yFAE+E;KACtF;IACD,kBAAkB,EAAE;QAClB,GAAG,EAAE,4OAA4O;QACjP,GAAG,EAAE,6GAA6G;QAClH,IAAI,EAAE,6GAA6G;KACpH;IACD,uBAAuB,EAAE;QACvB,GAAG,EAAE,83BAA83B;QACn4B,GAAG,EAAE,iHAAiH;QACtH,IAAI,EAAE,2HAA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