ddd-ts-kit 0.103.0 → 0.104.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 (220) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.fr.md +19 -7
  3. package/README.md +19 -6
  4. package/dist/check/canonical/stray-entry.d.ts.map +1 -1
  5. package/dist/check/canonical/stray-entry.js +14 -1
  6. package/dist/check/canonical/stray-entry.js.map +1 -1
  7. package/dist/check/catalogue/eslint-only-rules.d.ts.map +1 -1
  8. package/dist/check/catalogue/eslint-only-rules.js +1 -1
  9. package/dist/check/catalogue/eslint-only-rules.js.map +1 -1
  10. package/dist/check/commands/check-command.d.ts.map +1 -1
  11. package/dist/check/commands/check-command.js +24 -1
  12. package/dist/check/commands/check-command.js.map +1 -1
  13. package/dist/check/commands/check-file-command.d.ts.map +1 -1
  14. package/dist/check/commands/check-file-command.js +3 -0
  15. package/dist/check/commands/check-file-command.js.map +1 -1
  16. package/dist/check/commands/explain-command.d.ts.map +1 -1
  17. package/dist/check/commands/explain-command.js +8 -21
  18. package/dist/check/commands/explain-command.js.map +1 -1
  19. package/dist/check/explain/delegated-doc.d.ts +4 -0
  20. package/dist/check/explain/delegated-doc.d.ts.map +1 -0
  21. package/dist/check/explain/delegated-doc.js +11 -0
  22. package/dist/check/explain/delegated-doc.js.map +1 -0
  23. package/dist/check/explain/delegated-docs.d.ts +8 -0
  24. package/dist/check/explain/delegated-docs.d.ts.map +1 -0
  25. package/dist/check/explain/delegated-docs.js +292 -0
  26. package/dist/check/explain/delegated-docs.js.map +1 -0
  27. package/dist/check/explain/layer-docs.d.ts.map +1 -1
  28. package/dist/check/explain/layer-docs.js +6 -4
  29. package/dist/check/explain/layer-docs.js.map +1 -1
  30. package/dist/check/explain/ports-docs.js +1 -1
  31. package/dist/check/explain/ports-docs.js.map +1 -1
  32. package/dist/check/explain/tree-docs.js +2 -2
  33. package/dist/check/explain/tree-docs.js.map +1 -1
  34. package/dist/check/fixtures/fixtures.d.ts.map +1 -1
  35. package/dist/check/fixtures/fixtures.js +4 -0
  36. package/dist/check/fixtures/fixtures.js.map +1 -1
  37. package/dist/check/fixtures/layer-entry-fixtures.d.ts +4 -0
  38. package/dist/check/fixtures/layer-entry-fixtures.d.ts.map +1 -0
  39. package/dist/check/fixtures/layer-entry-fixtures.js +35 -0
  40. package/dist/check/fixtures/layer-entry-fixtures.js.map +1 -0
  41. package/dist/check/fixtures/layer-fixtures.d.ts.map +1 -1
  42. package/dist/check/fixtures/layer-fixtures.js.map +1 -1
  43. package/dist/check/fixtures/other-language-fixtures.d.ts.map +1 -1
  44. package/dist/check/fixtures/other-language-fixtures.js +1 -1
  45. package/dist/check/fixtures/other-language-fixtures.js.map +1 -1
  46. package/dist/check/fixtures/ports-fixtures.d.ts.map +1 -1
  47. package/dist/check/fixtures/ports-fixtures.js +1 -0
  48. package/dist/check/fixtures/ports-fixtures.js.map +1 -1
  49. package/dist/check/fixtures/purity-fixtures.d.ts.map +1 -1
  50. package/dist/check/fixtures/purity-fixtures.js +18 -0
  51. package/dist/check/fixtures/purity-fixtures.js.map +1 -1
  52. package/dist/check/fixtures/role-folder-fixtures.d.ts +4 -0
  53. package/dist/check/fixtures/role-folder-fixtures.d.ts.map +1 -0
  54. package/dist/check/fixtures/role-folder-fixtures.js +31 -0
  55. package/dist/check/fixtures/role-folder-fixtures.js.map +1 -0
  56. package/dist/check/fixtures/test-fixtures.d.ts.map +1 -1
  57. package/dist/check/fixtures/test-fixtures.js +9 -0
  58. package/dist/check/fixtures/test-fixtures.js.map +1 -1
  59. package/dist/check/fixtures/tree-fixtures.d.ts.map +1 -1
  60. package/dist/check/fixtures/tree-fixtures.js +0 -1
  61. package/dist/check/fixtures/tree-fixtures.js.map +1 -1
  62. package/dist/check/layers/outer-entry.d.ts +13 -0
  63. package/dist/check/layers/outer-entry.d.ts.map +1 -0
  64. package/dist/check/layers/outer-entry.js +29 -0
  65. package/dist/check/layers/outer-entry.js.map +1 -0
  66. package/dist/check/rules/clean-braces.js +1 -1
  67. package/dist/check/rules/clean-braces.js.map +1 -1
  68. package/dist/check/rules/layer-application-inward.d.ts.map +1 -1
  69. package/dist/check/rules/layer-application-inward.js +3 -1
  70. package/dist/check/rules/layer-application-inward.js.map +1 -1
  71. package/dist/check/rules/layer-domain-purity.d.ts.map +1 -1
  72. package/dist/check/rules/layer-domain-purity.js +3 -1
  73. package/dist/check/rules/layer-domain-purity.js.map +1 -1
  74. package/dist/check/rules/naming-suffix.js +7 -1
  75. package/dist/check/rules/naming-suffix.js.map +1 -1
  76. package/dist/check/rules/ports-abstract-class.d.ts.map +1 -1
  77. package/dist/check/rules/ports-abstract-class.js +16 -2
  78. package/dist/check/rules/ports-abstract-class.js.map +1 -1
  79. package/dist/check/rules/purity-no-ambient-randomness.d.ts.map +1 -1
  80. package/dist/check/rules/purity-no-ambient-randomness.js +4 -0
  81. package/dist/check/rules/purity-no-ambient-randomness.js.map +1 -1
  82. package/dist/check/rules/purity-no-environment.d.ts.map +1 -1
  83. package/dist/check/rules/purity-no-environment.js +5 -0
  84. package/dist/check/rules/purity-no-environment.js.map +1 -1
  85. package/dist/check/rules/purity-no-system-clock.d.ts.map +1 -1
  86. package/dist/check/rules/purity-no-system-clock.js +4 -0
  87. package/dist/check/rules/purity-no-system-clock.js.map +1 -1
  88. package/dist/check/rules/test-no-mocks.d.ts.map +1 -1
  89. package/dist/check/rules/test-no-mocks.js +16 -6
  90. package/dist/check/rules/test-no-mocks.js.map +1 -1
  91. package/dist/commands/affected.d.ts.map +1 -1
  92. package/dist/commands/affected.js +5 -4
  93. package/dist/commands/affected.js.map +1 -1
  94. package/dist/commands/cited.d.ts.map +1 -1
  95. package/dist/commands/cited.js +2 -1
  96. package/dist/commands/cited.js.map +1 -1
  97. package/dist/commands/depcruise-config.d.ts.map +1 -1
  98. package/dist/commands/depcruise-config.js +10 -7
  99. package/dist/commands/depcruise-config.js.map +1 -1
  100. package/dist/commands/digest.d.ts.map +1 -1
  101. package/dist/commands/digest.js +2 -1
  102. package/dist/commands/digest.js.map +1 -1
  103. package/dist/commands/drizzle-generate.d.ts.map +1 -1
  104. package/dist/commands/drizzle-generate.js +9 -2
  105. package/dist/commands/drizzle-generate.js.map +1 -1
  106. package/dist/commands/knex-generate.d.ts.map +1 -1
  107. package/dist/commands/knex-generate.js +8 -2
  108. package/dist/commands/knex-generate.js.map +1 -1
  109. package/dist/commands/lint.d.ts +2 -1
  110. package/dist/commands/lint.d.ts.map +1 -1
  111. package/dist/commands/lint.js +27 -4
  112. package/dist/commands/lint.js.map +1 -1
  113. package/dist/commands/mutation.d.ts.map +1 -1
  114. package/dist/commands/mutation.js +3 -2
  115. package/dist/commands/mutation.js.map +1 -1
  116. package/dist/commands/plan-waves.d.ts.map +1 -1
  117. package/dist/commands/plan-waves.js +2 -1
  118. package/dist/commands/plan-waves.js.map +1 -1
  119. package/dist/commands/prisma-generate.d.ts.map +1 -1
  120. package/dist/commands/prisma-generate.js +5 -4
  121. package/dist/commands/prisma-generate.js.map +1 -1
  122. package/dist/commands/typeorm-generate.d.ts.map +1 -1
  123. package/dist/commands/typeorm-generate.js +19 -16
  124. package/dist/commands/typeorm-generate.js.map +1 -1
  125. package/dist/commands/verify-slice.d.ts.map +1 -1
  126. package/dist/commands/verify-slice.js +3 -2
  127. package/dist/commands/verify-slice.js.map +1 -1
  128. package/dist/commit/resolved-trunk.d.ts +3 -0
  129. package/dist/commit/resolved-trunk.d.ts.map +1 -0
  130. package/dist/commit/resolved-trunk.js +7 -0
  131. package/dist/commit/resolved-trunk.js.map +1 -0
  132. package/dist/commit/trunk-example.d.ts +3 -0
  133. package/dist/commit/trunk-example.d.ts.map +1 -0
  134. package/dist/commit/trunk-example.js +6 -0
  135. package/dist/commit/trunk-example.js.map +1 -0
  136. package/dist/describe/context-description.d.ts +2 -0
  137. package/dist/describe/context-description.d.ts.map +1 -1
  138. package/dist/describe/describe-context.d.ts.map +1 -1
  139. package/dist/describe/describe-context.js +6 -0
  140. package/dist/describe/describe-context.js.map +1 -1
  141. package/dist/describe/format-description.js +1 -1
  142. package/dist/describe/format-description.js.map +1 -1
  143. package/dist/digest/branch-points.d.ts.map +1 -1
  144. package/dist/digest/branch-points.js +3 -2
  145. package/dist/digest/branch-points.js.map +1 -1
  146. package/dist/generate/errors/refuse-taken-class-name.d.ts +9 -0
  147. package/dist/generate/errors/refuse-taken-class-name.d.ts.map +1 -0
  148. package/dist/generate/errors/refuse-taken-class-name.js +22 -0
  149. package/dist/generate/errors/refuse-taken-class-name.js.map +1 -0
  150. package/dist/generate/errors/write-named-refusal.d.ts.map +1 -1
  151. package/dist/generate/errors/write-named-refusal.js +2 -0
  152. package/dist/generate/errors/write-named-refusal.js.map +1 -1
  153. package/dist/generate/kinds/generate-context.js +1 -0
  154. package/dist/generate/kinds/generate-context.js.map +1 -1
  155. package/dist/init/manifest/versions.js +24 -24
  156. package/dist/measures/format-measures.js +1 -1
  157. package/dist/measures/format-measures.js.map +1 -1
  158. package/dist/measures/measures-view.d.ts +1 -1
  159. package/dist/measures/measures-view.d.ts.map +1 -1
  160. package/dist/migration/answered-as-json.d.ts +13 -0
  161. package/dist/migration/answered-as-json.d.ts.map +1 -0
  162. package/dist/migration/answered-as-json.js +38 -0
  163. package/dist/migration/answered-as-json.js.map +1 -0
  164. package/dist/migration/audit-guard/run-orm-tool.d.ts.map +1 -1
  165. package/dist/migration/audit-guard/run-orm-tool.js +2 -1
  166. package/dist/migration/audit-guard/run-orm-tool.js.map +1 -1
  167. package/dist/migration/index.d.ts +1 -0
  168. package/dist/migration/index.d.ts.map +1 -1
  169. package/dist/migration/index.js +1 -0
  170. package/dist/migration/index.js.map +1 -1
  171. package/dist/migration/knex-schema-difference.d.ts.map +1 -1
  172. package/dist/migration/knex-schema-difference.js +2 -1
  173. package/dist/migration/knex-schema-difference.js.map +1 -1
  174. package/dist/migration/run-on-in-process-database.d.ts.map +1 -1
  175. package/dist/migration/run-on-in-process-database.js +2 -1
  176. package/dist/migration/run-on-in-process-database.js.map +1 -1
  177. package/dist/migration/tool-stdio.d.ts +6 -0
  178. package/dist/migration/tool-stdio.d.ts.map +1 -0
  179. package/dist/migration/tool-stdio.js +17 -0
  180. package/dist/migration/tool-stdio.js.map +1 -0
  181. package/dist/plan/batched-waves.d.ts +2 -0
  182. package/dist/plan/batched-waves.d.ts.map +1 -1
  183. package/dist/plan/batched-waves.js +6 -4
  184. package/dist/plan/batched-waves.js.map +1 -1
  185. package/dist/plan/plan-problems.d.ts +5 -0
  186. package/dist/plan/plan-problems.d.ts.map +1 -1
  187. package/dist/plan/plan-problems.js +6 -1
  188. package/dist/plan/plan-problems.js.map +1 -1
  189. package/dist/plan/plan-waves.d.ts +2 -0
  190. package/dist/plan/plan-waves.d.ts.map +1 -1
  191. package/dist/plan/plan-waves.js +1 -1
  192. package/dist/plan/plan-waves.js.map +1 -1
  193. package/dist/run.d.ts +2 -0
  194. package/dist/run.d.ts.map +1 -1
  195. package/dist/run.js +1 -1
  196. package/dist/run.js.map +1 -1
  197. package/dist/stories/open-story-scope.d.ts.map +1 -1
  198. package/dist/stories/open-story-scope.js +2 -1
  199. package/dist/stories/open-story-scope.js.map +1 -1
  200. package/dist/stories/origin-of.d.ts.map +1 -1
  201. package/dist/stories/origin-of.js +14 -2
  202. package/dist/stories/origin-of.js.map +1 -1
  203. package/dist/stories/origin-phase.js +4 -4
  204. package/dist/stories/origin-phase.js.map +1 -1
  205. package/dist/stories/read-story-phases.js +8 -4
  206. package/dist/stories/read-story-phases.js.map +1 -1
  207. package/dist/version.d.ts +1 -1
  208. package/dist/version.js +1 -1
  209. package/dist/worker/base-of.d.ts.map +1 -1
  210. package/dist/worker/base-of.js +2 -2
  211. package/dist/worker/base-of.js.map +1 -1
  212. package/dist/worker/briefing-of.js +2 -2
  213. package/dist/worker/briefing-of.js.map +1 -1
  214. package/dist/worker/open-worker-scope.js +1 -1
  215. package/dist/worker/open-worker-scope.js.map +1 -1
  216. package/dist/workspace/workspace.d.ts.map +1 -1
  217. package/dist/workspace/workspace.js +2 -1
  218. package/dist/workspace/workspace.js.map +1 -1
  219. package/package.json +5 -5
  220. package/templates/pipeline/package-scripts.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,54 @@ 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.104.0
8
+
9
+ **A role folder holds its role files and nothing else: a barrel, a JavaScript file and a port with no abstract class are reported.** `naming/suffix` no longer lets an `index.ts` through in a role folder that has a suffix, alias or not; `tree/closed` reports a `.js`, `.mjs`, `.cjs`, `.jsx`, `.tsx`, `.mts` or `.cts` file anywhere in a context, which no rule read; `ports/abstract-class`, in `ddd-ts-kit check` and in ESLint, reports a port file that declares no class at all, such as `export type InvoiceRepository = { ... }` or a token alone.
10
+
11
+ To move: import each file of a role folder by its own path and delete its `index.ts`; write a `.js` file of a context in TypeScript, or delete it if a build wrote it; declare each port as `export abstract class` with abstract members.
12
+
13
+ **`layer/application-inward` and `layer/domain-purity` read the entry imported, not only its package.** An allow-list that names `@ddd-ts-kit/auth` or `@ddd-ts-kit/kernel` let every entry of the package through, so a handler could import `@ddd-ts-kit/auth/passport` or `/jwt` and an aggregate the test doubles of `@ddd-ts-kit/kernel/testing` with no report from `ddd-ts-kit check` or ESLint. The entries of the kit that hold an adapter, the wiring of a container or test doubles (`@ddd-ts-kit/auth/jwt`, `/passport`, `/rebac`, `/di`, `/testing`, `@ddd-ts-kit/kernel/testing`) are now reported in `domain/` and `application/`, unless the allow-list names that entry itself.
14
+
15
+ To move: move the import to `infrastructure/` or `src/platform` (an adapter, the wiring) or to a test (a test double); or name the entry in `domainAllowedPackages` or `applicationAllowedPackages`, with its deviation recorded.
16
+
17
+ **ESLint reads `<module>/<module>.module.ts` as a module file, as `ddd-ts-kit check` does.** The module file of a module of the model was read as a file at the root of its context: `clean/function-size` reported its `register` past 30 lines, which a generated project with a large module failed on in its own lint, and `events/consumer-idempotent` did not see a bare `subscribe` there. Every rule of the plugin now reads it as the module file of the context.
18
+
19
+ **`ddd-ts-kit explain` gives a reason and both examples for every rule, the ones ESLint or the formatter decides included.** The 19 rules of `@ddd-ts-kit/eslint-plugin` that `ddd-ts-kit check` does not judge, `domain/no-generic-error` among them, and `clean/formatted`, which Biome decides, printed their description and the tool that checks them, and nothing else. They now print why the rule exists, a bad and a good example, then the tool that checks them; under `--json` they carry `why`, `bad` and `good` beside `checkedBy`.
20
+
21
+ **`domain/no-generic-error` names the step of the form of the project, and `generate error` refuses a refusal named after another class of the context.** Under `"stack.refusals": "named"`, which `init` writes, the message sent to `generate error <context> <Concept> <refusal>`, the step of `factories`, which the named form refuses; it now says `generate error <context> <Refusal> for<Subject>`. `generate error billing Invoice forOverdue` wrote a refusal class `Invoice` beside the aggregate `Invoice`; it now stops and asks for a name of what is refused.
22
+
23
+ **`domain/no-generic-error`, the `purity/*` rules, `test/no-mocks` and `test/no-only-no-skip` read the obvious variants of what they forbid.** `throw new TypeError(..)` and the other errors of the language, and an error thrown through a `const` (`const failure = new Error(..); throw failure;`), are reported by `domain/no-generic-error`; `const { env } = process`, `const { now } = Date` and `const { random } = Math` by the `purity/*` rules, in ESLint and in `ddd-ts-kit check`, and a `const` alias of the global (`const clock = Date; clock.now()`) in ESLint; `vi`, `jest` and `it` under an import alias (`import { vi as mocks, it as scenario } from 'vitest'`) by `test/no-mocks` and `test/no-only-no-skip`, and by every rule of the plugin that reads a test.
24
+
25
+ To move: throw a refusal of the context where a `TypeError` or a `RangeError` was thrown in `domain/` or `application/`; take what a destructuring read from `process`, `Date`, `Math` or `crypto` from a port (`Clock`, `IdGenerator`, a configuration value); replace the mocks and the `.only` or `.skip` an alias hid, as for the runner under its own name.
26
+
27
+ **`describe` names the lines of `CONTEXT.md` that people write, and a worker reads no more.** Its `language:` line reads `src/contexts/<context>/CONTEXT.md:1-76 (4 terms)`, and `describe --json` carries `docHead`, the last of those lines. The briefing of `worker-scope`, the `context-builder` agent and the `use-case` skill read `CONTEXT.md` above its generated `## Reference`, then `describe` once, instead of reading the same facts twice.
28
+
29
+ **`plan-waves` orders a row whose Context is `platform` (the work of `src/platform/`) or `all` (a slice across every context).** Both names are accepted without a declared context and refused as the name of a context by `generate context` and `init --context`, the `plan-slices` skill documents them, and no worker brief is written for such a row: the conductor owns it. The slices of the scheduling example (M1.10, M1.38, M1.39) are planned again.
30
+
31
+ **The session preamble names `pnpm exec ddd-ts-kit` on a pnpm project, not `npx ddd-ts-kit`.** The commands it suggests are the ones `AGENTS.md` documents and the allow list of `.claude/settings.json` permits, so none asks for a permission. An npm project keeps `npx`.
32
+
33
+ **`story` no longer prints `met` beside an open box for a story with no specification, and `measures` no longer says "Measures of none".** The acceptance phases say `not evaluated: no specification`, and a repository with no branch to read is titled `Measures of the repository (no branch)`.
34
+
35
+ **`story` no longer ticks "origin recorded" and "report" on the untouched template.** A `From:` or `Built with:` line, or the `npm run verify` line of `### Verification`, that still holds a `<placeholder>` is not written, and the close gate stays shut until the story skill fills it.
36
+
37
+ **`story-scope --from` refuses an intent whose status is `draft` even when the comment of the template says `Status: accepted`.** The gate reads the status line of the intent, no longer the comment copied from `intent-template.md`.
38
+
39
+ **The `use-case` skill names the command that prints the spec titles of a slice.** Before the pull request it reads `npx ddd-ts-kit digest --base <trunk>`, which lists the titles under `New spec titles`, instead of asking for a section of the behaviour page with no way to read one.
40
+
41
+ **The briefing of `worker-scope` asks a worker for `describe <context>` as text and for the `todos` each generator prints.** It named `describe --json`, which says the same in more size, and a `next` place that no generator prints. It now says what the `parallel-work` briefing template says.
42
+
43
+ **`check` and `check-file` refuse a path that exists nowhere, and `check` a folder that holds no TypeScript file to read.** A mistyped or moved path used to read as "0 errors" with exit 0, which the skills take as the proof that a file is clean; it is now an error naming the path, with exit 2. `check-file --content-from` still accepts a path that is not written yet. `lint` of a pattern that matches no file already answered with one sentence and no stack.
44
+
45
+ To move: a hook or a script that called `check-file` on a path that may not exist yet passes the text with `--content-from`.
46
+
47
+ **A checkout with CRLF line ends passes `check` and `docs --check` on code nobody edited.** Under `core.autocrlf=true` (Git for Windows, WSL 2 clones) `clean/braces` reported every multi-line body and `docs --check` listed every generated page as stale, with nothing to commit after `ddd-ts-kit docs`. Files are now read with any line end, and a file the kit writes again is written with LF, as before. `init` writes no `.gitattributes` and `doctor` does not ask for one: reading with any line end covers the gates.
48
+
49
+ **`--json` now holds on `lint`, `drizzle-generate`, `knex-generate`, `prisma-generate`, `typeorm-generate` and `depcruise-config`, as `--help` says of every command.** `lint --json` answers `{ errors, warnings, inTransition, report }` on one line, `report` being the JSON report of ESLint; the four `*-generate` commands answer `{ code, written, messages }` and send the output of the ORM tool to stderr; `depcruise-config --json` answers `{ file, config }` (and `{ file, written }` with `--write`). A spec holds every command of the table to one line of JSON.
50
+
51
+ **`cited`, `digest`, `verify-slice`, `mutation`, `affected` and `story-scope` give `origin/main` as the example of a ref only where it resolves.** In a repository with no remote their refusals now say `<branch, tag or commit>`, as `plan-waves` and `worker-scope` do, instead of a ref the next command would refuse.
52
+
53
+ **`plan-waves` prints `--base origin/main` only when that ref resolves.** In a repository with no remote (before its first push) the briefs it prints left out a base that `worker-scope` refused, and the refusal repeated it as its example. The briefs now carry no `--base` there (`worker-scope` cuts from the current branch), and the refusals of `worker-scope` say `--base <branch, tag or commit>`.
54
+
7
55
  ## 0.103.0
8
56
 
9
57
  **A `merge-trunk` stopped half way can be continued with `merge-trunk --continue`.** The state of the merge is written as soon as the merge starts and after each step, not only at the first stop for a person, so a merge killed on the automatic path no longer needs a plain `git commit`, which skips the steps merge-trunk runs (regenerate, the migrations replay). A merge in progress that holds no state is now refused with `npx ddd-ts-kit merge-trunk --abort` named first.
package/README.fr.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [English](README.md) · **Français**
2
- <!-- translation-of: README.md sha256:68d7243caa5c60a6 -->
2
+ <!-- translation-of: README.md sha256:22ed5ec81932d2fa -->
3
3
 
4
4
  # ddd-ts-kit
5
5
 
@@ -720,7 +720,9 @@ toute la base : typecheck, lint, `format:check`, `test:coverage`, tests de bout
720
720
  commençant par une lettre ou un chiffre (`npm run db:generate add-invoices`, sous TypeORM
721
721
  `migrations/add-invoices`) : `drizzle-generate`, `knex-generate`, `prisma-generate` et
722
722
  `typeorm-generate` refusent tout autre nom avant que l'ORM ne le lise, puisqu'une valeur qui commence par un tiret serait l'une
723
- de ses options ; `typeorm-generate` refuse aussi un dossier hors du projet.
723
+ de ses options ; `typeorm-generate` refuse aussi un dossier hors du projet. Avec `--json`, elles répondent
724
+ `{ code, written, messages }` sur une ligne : le code de sortie, les fichiers du dossier de migrations
725
+ nouveaux ou modifiés, et ce que la commande a dit ; la sortie de l'outil de l'ORM va sur stderr.
724
726
 
725
727
  `package.json` porte deux compilateurs : `typescript ~6.0.3`, que les outils chargent comme une
726
728
  bibliothèque, et `@typescript/native` (`npm:typescript@~7.0.2`), que `build` et `typecheck`
@@ -1130,7 +1132,8 @@ Affiche la configuration de dependency-cruiser dérivée de `ddd-ts-kit.config.j
1130
1132
  langages publiés, amonts déclarés, *packages* autorisés, cycles et orphelins. `--write` la
1131
1133
  sauvegarde sous `.dependency-cruiser.cjs` ; `--check` sort avec le code 1 quand le fichier
1132
1134
  manque ou est périmé, ce que `npm run depcruise` exécute en premier. Modifiez la configuration,
1133
- pas le fichier.
1135
+ pas le fichier. Avec `--json`, l'affichage est `{ file, config }` et `--write` répond
1136
+ `{ file, written }`.
1134
1137
 
1135
1138
  ## value-objects
1136
1139
 
@@ -1428,8 +1431,9 @@ ses commandes de générateur : `--aggregate <Name>`, `aggregate <context> <Name
1428
1431
  `repository <context> <Name>`. Deux lots d'un contexte dans une vague sont dits susceptibles de
1429
1432
  toucher les mêmes fichiers quand ils nomment le même agrégat ; quand l'un d'eux n'en nomme aucun,
1430
1433
  le chevauchement est dit inconnu plutôt que deviné. Chaque lot du *worker* d'un contexte vient avec
1431
- la commande qui le consigne, `npx ddd-ts-kit worker-scope <context> --base origin/main --rows <ids>`,
1432
- avec ses propres `--worktree` et `--branch` quand sa vague porte un autre lot de ce contexte ; un
1434
+ la commande qui le consigne, `npx ddd-ts-kit worker-scope <context> --base origin/main --rows <ids>` (sans
1435
+ `--base` dans un dépôt où `origin/main` n'existe pas encore : le *worker* part alors de la branche
1436
+ courante), avec ses propres `--worktree` et `--branch` quand sa vague porte un autre lot de ce contexte ; un
1433
1437
  lot du chef d'orchestre se construit sur le tronc ; une personne reçoit sa consigne à la main.
1434
1438
  Puis l'ordre des fusions : par vague, et dans une vague d'abord le lot que le plus de lignes
1435
1439
  attendent, directement ou non, et ce qui se lance avant chaque fusion :
@@ -2299,6 +2303,10 @@ ddd-ts-kit check --clean-only <dir>... [--rule <id>]... [--format text|json|gith
2299
2303
  ddd-ts-kit check --commit-size [--staged] [--strict]
2300
2304
  ```
2301
2305
 
2306
+ Un chemin qui n'existe nulle part, ou un dossier sans fichier TypeScript sous la racine des
2307
+ sources, est une erreur de l'appelant : `check` le refuse (code 2) au lieu de déclarer le projet
2308
+ propre.
2309
+
2302
2310
  Chaque violation a un identifiant de règle, une sévérité, un fichier, une ligne, un message et un
2303
2311
  `fix` : une phrase qui dit quoi faire à la place. Code de sortie 1 quand il y a au moins une
2304
2312
  erreur. Supposons que l'agrégat `Reminder` de l'application d'exemple lise l'horloge système dans
@@ -2679,7 +2687,7 @@ ddd-ts-kit check-file <path> [--content-from <file>] [--rule <id>]...
2679
2687
  Exécute les règles par fichier (couches, contextes, nommage, événements, langage, pureté, code
2680
2688
  propre, *mocks*, composition, désactivations) sur un fichier sans parcourir le projet : conçu pour
2681
2689
  un *hook* d'éditeur ou d'agent après chaque écriture. Un fichier qui n'est pas une source du
2682
- projet est ignoré. `--content-from <file>` juge le texte de ce fichier comme le contenu de
2690
+ projet est ignoré ; un chemin qui n'existe nulle part est refusé (code 2), comme pour `check`. `--content-from <file>` juge le texte de ce fichier comme le contenu de
2683
2691
  `<path>`, qui n'a pas besoin d'exister encore : ce qu'une session s'apprête à écrire, comme la
2684
2692
  garde du *plugin* le lit avant l'écriture sous `"dependenciesBeforeWrite": true`. `--rule`
2685
2693
  restreint les règles ; la *baseline* du projet s'applique comme pour un fichier sur le disque.
@@ -2699,6 +2707,9 @@ nomme la version où elle devient une erreur. Ceux-là sont affichés dans le ra
2699
2707
  après lui, une ligne par règle, sans échouer : une mise à jour du kit ne fait jamais passer au
2700
2708
  rouge un lint vert. Sans ESLint installé, il sort en 2 et nomme l'installation. Voir
2701
2709
  [Base de qualité](../../docs/tools/quality-baseline.fr.md#un-avertissement-fait-échouer-le-lint).
2710
+ Avec `--json`, ESLint rapporte dans son format JSON et la commande répond, sur une ligne,
2711
+ `{ errors, warnings, inTransition, report }` (`report` est le rapport JSON d'ESLint), avec le même
2712
+ code de sortie et rien sur stderr.
2702
2713
 
2703
2714
  La commande linte avec le cache d'ESLint, indexé par le contenu de chaque fichier
2704
2715
  (`.eslintcache/`, ignoré par git) : une seconde exécution sur un arbre qui n'a pas changé ne
@@ -2720,7 +2731,8 @@ ddd-ts-kit explain <rule-id>
2720
2731
 
2721
2732
  `rules` liste les identifiants, les descriptions et les sévérités actuelles, et dit lesquels
2722
2733
  ESLint vérifie. `explain` affiche la règle, pourquoi elle existe, un mauvais et un bon exemple,
2723
- et la syntaxe de désactivation.
2734
+ et la syntaxe de désactivation ; pour une règle que décide ESLint ou le formateur, la même raison
2735
+ et les mêmes exemples, puis l'outil qui la vérifie (`checkedBy` sous `--json`).
2724
2736
 
2725
2737
  ## Développement
2726
2738
 
package/README.md CHANGED
@@ -688,7 +688,9 @@ pipelines call, `test:coverage` (every spec once, each context and layer held to
688
688
  with a letter or a digit (`npm run db:generate add-invoices`, on TypeORM
689
689
  `migrations/add-invoices`): `drizzle-generate`, `knex-generate`, `prisma-generate` and
690
690
  `typeorm-generate` refuse any other name before the ORM reads it, since a value that starts with a dash would be one of its
691
- options; `typeorm-generate` also refuses a folder outside the project.
691
+ options; `typeorm-generate` also refuses a folder outside the project. With `--json` they answer
692
+ `{ code, written, messages }` on one line: the exit code, the files of the migrations folder that are new
693
+ or changed, and what the command said; the output of the ORM tool goes to stderr.
692
694
 
693
695
  `package.json` carries two compilers: `typescript ~6.0.3`, which the tools load as a library,
694
696
  and `@typescript/native` (`npm:typescript@~7.0.2`), which `build` and `typecheck` call by path
@@ -1067,7 +1069,8 @@ ddd-ts-kit depcruise-config [--check | --write]
1067
1069
  Prints the dependency-cruiser configuration derived from `ddd-ts-kit.config.json`: layers,
1068
1070
  published languages, declared upstreams, allowed packages, cycles and orphans. `--write` saves
1069
1071
  it as `.dependency-cruiser.cjs`; `--check` exits 1 when the file is missing or stale, which is
1070
- what `npm run depcruise` runs first. Edit the config, not the file.
1072
+ what `npm run depcruise` runs first. Edit the config, not the file. With `--json`, the print is
1073
+ `{ file, config }` and `--write` answers `{ file, written }`.
1071
1074
 
1072
1075
  ## value-objects
1073
1076
 
@@ -1348,8 +1351,9 @@ from its generator commands: `--aggregate <Name>`, `aggregate <context> <Name>`
1348
1351
  `repository <context> <Name>`. Two batches of one context in one wave are said likely to touch the
1349
1352
  same files when they name the same aggregate; when one of them names none, the overlap is said to
1350
1353
  be unknown rather than guessed. Each batch of a context's worker comes with the command that briefs
1351
- it, `npx ddd-ts-kit worker-scope <context> --base origin/main --rows <ids>`, with its own
1352
- `--worktree` and `--branch` when its wave holds another batch of that context; a batch of the
1354
+ it, `npx ddd-ts-kit worker-scope <context> --base origin/main --rows <ids>` (without `--base` in a
1355
+ repository where `origin/main` does not resolve yet: the worker is then cut from the current branch),
1356
+ with its own `--worktree` and `--branch` when its wave holds another batch of that context; a batch of the
1353
1357
  conductor is built on the trunk; a person is briefed by hand. Then the merge order: by wave, and in
1354
1358
  a wave the batch that the most rows wait for, directly or not, first, and what runs before each
1355
1359
  merge: `npx ddd-ts-kit merge-trunk --to-land --cwd <worktree>`, then the squash merge. With a context, only its rows
@@ -2154,6 +2158,9 @@ ddd-ts-kit check --clean-only <dir>... [--rule <id>]... [--format text|json|gith
2154
2158
  ddd-ts-kit check --commit-size [--staged] [--strict]
2155
2159
  ```
2156
2160
 
2161
+ A path that exists nowhere, or a folder that holds no TypeScript file under the source root, is a
2162
+ mistake of the caller: `check` refuses it (exit 2) in place of reporting a clean project.
2163
+
2157
2164
  Each violation has a rule id, a severity, a file, a line, a message and a `fix`: one sentence
2158
2165
  saying what to do instead. Exit code 1 when there is at least one error. Suppose that the
2159
2166
  `Reminder` aggregate of the example application read the system clock in its domain: an `isDue()`
@@ -2501,7 +2508,8 @@ ddd-ts-kit check-file <path> [--content-from <file>] [--rule <id>]...
2501
2508
 
2502
2509
  Runs the per-file rules (layers, contexts, naming, events, language, purity, clean code, mocks,
2503
2510
  composition, suppressions) on one file without walking the project: meant for an editor or
2504
- agent hook after each write. A file that is not a source of the project is ignored.
2511
+ agent hook after each write. A file that is not a source of the project is ignored; a path that
2512
+ exists nowhere is refused (exit 2), as for `check`.
2505
2513
  `--content-from <file>` judges the text of that file as the content of `<path>`, which need not
2506
2514
  exist yet: what a session is about to write, as the guard of the plugin reads it before the write
2507
2515
  under `"dependenciesBeforeWrite": true`. `--rule` narrows the rules; the baseline of the project
@@ -2521,6 +2529,9 @@ transition: a rule new in this version, whose documentation names the version in
2521
2529
  an error. Those are shown in the report and listed after it, one line per rule, without failing:
2522
2530
  an upgrade of the kit never turns a green lint red. Without ESLint installed it exits 2 and names
2523
2531
  the install. See [Quality baseline](../../docs/tools/quality-baseline.md#warnings-fail-the-lint).
2532
+ With `--json` ESLint reports in its JSON format and the command answers, on one line,
2533
+ `{ errors, warnings, inTransition, report }` (`report` is the JSON report of ESLint), with the same
2534
+ exit code and nothing on stderr.
2524
2535
 
2525
2536
  The command lints with the cache of ESLint, keyed by the content of each file (`.eslintcache/`,
2526
2537
  ignored by git): a second run on a tree that did not change lints the files that changed since.
@@ -2539,7 +2550,9 @@ ddd-ts-kit explain <rule-id>
2539
2550
  ```
2540
2551
 
2541
2552
  `rules` lists the ids, descriptions and current severities, and says which ones ESLint checks.
2542
- `explain` prints the rule, why it exists, a bad and a good example, and the suppression syntax.
2553
+ `explain` prints the rule, why it exists, a bad and a good example, and the suppression syntax;
2554
+ for a rule ESLint or the formatter decides, the same reason and examples, then the tool that
2555
+ checks it (`checkedBy` under `--json`).
2543
2556
 
2544
2557
  ## Development
2545
2558
 
@@ -1 +1 @@
1
- {"version":3,"file":"stray-entry.d.ts","sourceRoot":"","sources":["../../../src/check/canonical/stray-entry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAK3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAmB1C;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAc1E"}
1
+ {"version":3,"file":"stray-entry.d.ts","sourceRoot":"","sources":["../../../src/check/canonical/stray-entry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAK3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAsB1C;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAkB1E"}
@@ -7,6 +7,8 @@ import { isCanonicalDirectory } from './is-canonical-directory.js';
7
7
  import { OPEN_DIRECTORIES } from './open-directories.js';
8
8
  import { roleOf } from './role-of.js';
9
9
  import { ownEntry } from '../../config/values/own-entry.js';
10
+ /** JavaScript, and TypeScript in another form than `.ts`: code no rule of the tree reads. */
11
+ const OTHER_CODE = /\.(?:[mc]?js|jsx|tsx|[mc]ts)$/;
10
12
  /**
11
13
  * Why an entry of a context, a directory (ending with `/`) or a file, has no place in the
12
14
  * canonical tree; undefined when it has one, or when it is the context itself.
@@ -21,7 +23,10 @@ export function strayEntry(entry, config) {
21
23
  if (moduleOfModuleFile(placed.inside, placed.modules) !== undefined) {
22
24
  return undefined;
23
25
  }
24
- return entry.endsWith('/') ? strayDirectory(placed) : straySource(placed);
26
+ if (entry.endsWith('/')) {
27
+ return strayDirectory(placed);
28
+ }
29
+ return OTHER_CODE.test(placed.inside) ? notTypeScript(placed.inside) : straySource(placed);
25
30
  }
26
31
  /** A dot-directory of a context (the `.claude/` a sandbox leaves) is written by a tool: it is no part of the tree. */
27
32
  function inDotDirectory(entry) {
@@ -90,6 +95,14 @@ function straySource(placed) {
90
95
  fix: `Move it one level down into the directory of its role (for example ${directory.split('/')[0] ?? directory}/<role>/), so that its suffix and its tests can be checked.`,
91
96
  };
92
97
  }
98
+ /** A source no rule reads: the checker, ESLint and the compiler of the project read `.ts` files only. */
99
+ function notTypeScript(inside) {
100
+ const name = path.posix.basename(inside);
101
+ return {
102
+ message: `"${inside}" is a source that is not a .ts file.`,
103
+ fix: `Write it in TypeScript, ${name.replace(OTHER_CODE, '.ts')}, in the directory of its role, or delete it if a build wrote it: a context holds .ts files only, the build writes to dist/.`,
104
+ };
105
+ }
93
106
  function atContextRoot({ context, declared, inside: file }) {
94
107
  const generated = [barrelFile(context), dependenciesFile(context)];
95
108
  const ofTheContext = CONTEXT_FILES.map((candidate) => candidate.root(context));
@@ -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,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErH,OAAO,EAAE,oBAAoB,EAAE,MA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AAI,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"eslint-only-rules.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/eslint-only-rules.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,EAyF7F,CAAC"}
1
+ {"version":3,"file":"eslint-only-rules.d.ts","sourceRoot":"","sources":["../../../src/check/catalogue/eslint-only-rules.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,EA0F7F,CAAC"}
@@ -13,7 +13,7 @@ export const ESLINT_ONLY_RULES = [
13
13
  },
14
14
  {
15
15
  id: 'domain/no-generic-error',
16
- description: 'domain/ and application/ never `throw new Error(...)`: a business failure is a DomainError subclass.',
16
+ description: 'domain/ and application/ never `throw new Error(...)`, nor another error of the language, directly or through a `const`: a business failure is a DomainError subclass.',
17
17
  },
18
18
  {
19
19
  id: 'errors/through-factory',
@@ -1 +1 @@
1
- {"version":3,"file":"eslint-only-rules.js","sourceRoot":"","sources":["../../../src/check/catalogue/eslint-only-rules.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAqE;IACjG;QACE,EAAE,EAAE,gCAAgC;QACpC,WAAW,EACT,0GAA0G;KAC7G;IACD;QACE,EAAE,EAAE,kCAAkC;QACtC,WAAW,EAAE,kGAAkG;KAChH;IACD;QACE,EAAE,EAAE,yBAAyB;QAC7B,WAAW,EAAE,sGAAsG;KACpH;IACD;QACE,EAAE,EAAE,wBAAwB;QAC5B,WAAW,EACT,6MAA6M;KAChN;IACD;QACE,EAAE,EAAE,+BAA+B;QACnC,WAAW,EACT,4NAA4N;KAC/N;IACD;QACE,EAAE,EAAE,qBAAqB;QACzB,WAAW,EACT,2ZAA2Z;KAC9Z;IACD;QACE,EAAE,EAAE,uBAAuB;QAC3B,WAAW,EACT,gLAAgL;KACnL;IACD;QACE,EAAE,EAAE,2BAA2B;QAC/B,WAAW,EAAE,6EAA6E;KAC3F;IACD,EAAE,EAAE,EAAE,sCAAsC,EAAE,WAAW,EAAE,oDAAoD,EAAE;IACjH;QACE,EAAE,EAAE,+BAA+B;QACnC,WAAW,EACT,sHAAsH;KACzH;IACD;QACE,EAAE,EAAE,mCAAmC;QACvC,WAAW,EACT,kKAAkK;KACrK;IACD;QACE,EAAE,EAAE,kCAAkC;QACtC,WAAW,EACT,wMAAwM;KAC3M;IACD;QACE,EAAE,EAAE,gCAAgC;QACpC,WAAW,EACT,uHAAuH;KAC1H;IACD;QACE,EAAE,EAAE,sBAAsB;QAC1B,WAAW,EACT,wMAAwM;KAC3M;IACD;QACE,EAAE,EAAE,0BAA0B;QAC9B,WAAW,EACT,qMAAqM;KACxM;IACD;QACE,EAAE,EAAE,eAAe;QACnB,WAAW,EACT,sIAAsI;KACzI;IACD;QACE,EAAE,EAAE,wBAAwB;QAC5B,WAAW,EACT,uKAAuK;KAC1K;IACD;QACE,EAAE,EAAE,sBAAsB;QAC1B,WAAW,EACT,mRAAmR;KACtR;IACD;QACE,EAAE,EAAE,kBAAkB;QACtB,WAAW,EACT,8HAA8H;KACjI;CACF,CAAC"}
1
+ {"version":3,"file":"eslint-only-rules.js","sourceRoot":"","sources":["../../../src/check/catalogue/eslint-only-rules.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAq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":3,"file":"check-command.d.ts","sourceRoot":"","sources":["../../../src/check/commands/check-command.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,wBAAwB,CAAC;AA+BtD,eAAO,MAAM,YAAY,EAAE,OA8B1B,CAAC"}
1
+ {"version":3,"file":"check-command.d.ts","sourceRoot":"","sources":["../../../src/check/commands/check-command.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAgCtD,eAAO,MAAM,YAAY,EAAE,OA8B1B,CAAC"}
@@ -1,3 +1,4 @@
1
+ import fs from 'node:fs';
1
2
  import path from 'node:path';
2
3
  import { CliError } from '../../cli-error.js';
3
4
  import { Arguments } from '../../commands/arguments.js';
@@ -60,6 +61,7 @@ function formatOf(args) {
60
61
  /** The rules that judge a file on its own, on any directories: no project, no config. */
61
62
  function checkCleanliness(args, rules) {
62
63
  const directories = args.positionals.length > 0 ? args.positionals : ['.'];
64
+ refuseMissingPaths(args);
63
65
  const selected = rules.length > 0 ? rules.filter((id) => CLEAN_RULE_IDS.includes(id)) : CLEAN_RULE_IDS;
64
66
  const project = loadLooseProject(args.workingDirectory, directories.map((entry) => toPosix(path.normalize(entry))));
65
67
  return runCheck(project, { rules: selected });
@@ -67,13 +69,34 @@ function checkCleanliness(args, rules) {
67
69
  function checkProject(args, rules) {
68
70
  const cwd = args.workingDirectory;
69
71
  const root = findRoot(cwd);
70
- const result = withBaseline(root, runCheck(loadProject(root), { rules }), rules);
72
+ refuseMissingPaths(args);
73
+ const project = loadProject(root);
74
+ const result = withBaseline(root, runCheck(project, { rules }), rules);
71
75
  const scopes = args.positionals.map((entry) => toPosix(path.relative(root, path.resolve(cwd, entry))).replace(/\/$/, ''));
76
+ refuseScopeWithoutSources(project, args.positionals, scopes);
72
77
  const ref = args.text('changed-since');
73
78
  const changed = ref === undefined ? undefined : changedFiles(root, knownCommit(root, ref, CHANGED_SINCE_FIX));
74
79
  const reported = result.violations.filter((violation) => isInScope(violation, scopes) && isReportedSince(violation, changed));
75
80
  return summarize(reported, result);
76
81
  }
82
+ /** A path that exists nowhere is a slip of the caller; an empty report on it would read as clean. */
83
+ function refuseMissingPaths(args) {
84
+ const missing = args.positionals.filter((entry) => !fs.existsSync(path.resolve(args.workingDirectory, entry)));
85
+ if (missing.length > 0) {
86
+ throw new CliError(`No such path: ${missing.join(', ')}.`, 'Name a file or a folder of the project (`ddd-ts-kit check src`), or leave the path out to check the whole project.');
87
+ }
88
+ }
89
+ /**
90
+ * A path that exists but holds no source the checker reads would report "0 errors" like a clean one.
91
+ * Only a path asked for is judged: `check` alone on a project with no context yet reads its sources
92
+ * and reports them, which is not the same as being asked about a place that has none.
93
+ */
94
+ function refuseScopeWithoutSources(project, asked, scopes) {
95
+ const empty = asked.filter((_, index) => !project.files.some((file) => scopes[index] === '' || file.path === scopes[index] || file.path.startsWith(`${scopes[index]}/`)));
96
+ if (empty.length > 0) {
97
+ throw new CliError(`${empty.join(', ')} holds nothing to check.`, `The checker reads the TypeScript files (*.ts) under ${project.config.sourceRoot}/: name one of them or a folder that holds some, or leave the path out to check the whole project.`);
98
+ }
99
+ }
77
100
  /** The errors the baseline of the project records stay quiet; a count it no longer reaches is judged when every rule ran. */
78
101
  function withBaseline(root, result, rules) {
79
102
  const baseline = readBaseline(root);
@@ -1 +1 @@
1
- {"version":3,"file":"check-command.js","sourceRoot":"","sources":["../../../src/check/commands/check-command.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAgB,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM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MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,IAAI,SAAS,CAAC,IAAI,KAAK,KAAK,IAAI,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAC3G,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"check-file-command.d.ts","sourceRoot":"","sources":["../../../src/check/commands/check-file-command.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAatD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,OAgC9B,CAAC"}
1
+ {"version":3,"file":"check-file-command.d.ts","sourceRoot":"","sources":["../../../src/check/commands/check-file-command.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAatD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,OAuC9B,CAAC"}
@@ -32,6 +32,9 @@ export const checkFileCommand = (argv, io) => {
32
32
  const root = findRoot(path.dirname(absolute));
33
33
  const file = toPosix(path.relative(root, absolute));
34
34
  const contentFrom = args.text('content-from');
35
+ if (contentFrom === undefined && !fs.existsSync(absolute)) {
36
+ throw new CliError(`No such file: ${target}.`, 'Name a file that exists (`ddd-ts-kit check-file src/contexts/billing/domain/services/x.ts`), or give the text it will hold with --content-from <file>.');
37
+ }
35
38
  const text = contentFrom === undefined ? undefined : fs.readFileSync(path.resolve(args.workingDirectory, contentFrom), 'utf8');
36
39
  const rules = knownRules(args.many('rule'));
37
40
  const result = isProjectSource(root, file, text !== undefined)
@@ -1 +1 @@
1
- {"version":3,"file":"check-file-command.js","sourceRoot":"","sources":["../../../src/check/commands/check-file-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,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,QAAQ,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AACtF,CAAC;AAED,kHAAkH;AAClH,SAAS,eAAe,CAAC,IAAY,EAAE,IAAY,EAAE,KAAc;IACjE,oGAAoG;IACpG,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IAE5D,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AACvH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"explain-command.d.ts","sourceRoot":"","sources":["../../../src/check/commands/explain-command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAOtD,eAAO,MAAM,cAAc,EAAE,OAyB5B,CAAC"}
1
+ {"version":3,"file":"explain-command.d.ts","sourceRoot":"","sources":["../../../src/check/commands/explain-command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAQtD,eAAO,MAAM,cAAc,EAAE,OAyB5B,CAAC"}
@@ -3,6 +3,7 @@ import { Arguments } from '../../commands/arguments.js';
3
3
  import {} from '../../commands/command.js';
4
4
  import { DELEGATED_RULES } from '../catalogue/delegated-rules.js';
5
5
  import { KNOWN_RULE_IDS } from '../catalogue/known-rule-ids.js';
6
+ import { delegatedDoc } from '../explain/delegated-doc.js';
6
7
  import { documentedRule } from '../explain/documented-rule.js';
7
8
  import { knownRules } from './known-rules.js';
8
9
  import { stdoutJson } from '../../json/stdout-json.js';
@@ -14,40 +15,26 @@ export const explainCommand = (argv, io) => {
14
15
  }
15
16
  const delegated = DELEGATED_RULES.find((rule) => rule.id === id);
16
17
  if (delegated !== undefined) {
17
- io.out(args.json
18
- ? stdoutJson({ id, description: delegated.description, checkedBy: delegated.checkedBy })
19
- : [id, '', delegated.description, '', delegated.where].join('\n'));
18
+ const explanation = { ...delegatedDoc(id), id, description: delegated.description, checkedBy: delegated.checkedBy };
19
+ io.out(args.json ? stdoutJson(explanation) : formatExplanation(explanation, delegated.where));
20
20
  return 0;
21
21
  }
22
22
  const explanation = explanationOf(id);
23
- io.out(args.json ? stdoutJson(explanation) : formatExplanation(explanation));
23
+ const suppress = `Suppress one line (with a reason): // ddd-ts-kit-disable-next-line ${id} -- <reason>`;
24
+ io.out(args.json ? stdoutJson(explanation) : formatExplanation(explanation, suppress));
24
25
  return 0;
25
26
  };
26
27
  function explanationOf(id) {
27
28
  knownRules([id]);
28
29
  return documentedRule(id);
29
30
  }
30
- function formatExplanation(explanation) {
31
+ /** The reason and the examples of a rule, then `closing`: how to suppress a line, or which tool decides. */
32
+ function formatExplanation(explanation, closing) {
31
33
  const indent = (block) => block
32
34
  .split('\n')
33
35
  .map((line) => ` ${line}`)
34
36
  .join('\n');
35
- const suppress = `Suppress one line (with a reason): // ddd-ts-kit-disable-next-line ${explanation.id} -- <reason>`;
36
37
  const { id, description, why, bad, good } = explanation;
37
- return [
38
- id,
39
- '',
40
- description,
41
- '',
42
- `Why: ${why}`,
43
- '',
44
- 'Bad:',
45
- indent(bad),
46
- '',
47
- 'Good:',
48
- indent(good),
49
- '',
50
- suppress,
51
- ].join('\n');
38
+ return [id, '', description, '', `Why: ${why}`, '', 'Bad:', indent(bad), '', 'Good:', indent(good), '', closing].join('\n');
52
39
  }
53
40
  //# sourceMappingURL=explain-command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"explain-command.js","sourceRoot":"","sources":["../../../src/check/commands/explain-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,S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GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;IAEtC,MAAM,QAAQ,GAAG,sEAAsE,EAAE,cAAc,CAAC;IAExG,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEvF,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,SAAS,aAAa,CAAC,EAAU;IAC/B,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEjB,OAAO,cAAc,CAAC,EAAE,CAAC,CAAC;AAC5B,CAAC;AAED,4GAA4G;AAC5G,SAAS,iBAAiB,CAAC,WAA2B,EAAE,OAAe;IACrE,MAAM,MAAM,GAAG,CAAC,KAAa,EAAU,EAAE,CACvC,KAAK;SACF,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,EAAE,CAAC;SAC5B,IAAI,CAAC,IAAI,CAAC,CAAC;IAEhB,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC;IAExD,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,GAAG,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC,IAAI,CACnH,IAAI,CACL,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { RuleDoc } from '../model/rule-doc.js';
2
+ /** The reason and the examples of a rule another tool decides; a rule without them is a bug of the kit. */
3
+ export declare function delegatedDoc(id: string): RuleDoc;
4
+ //# sourceMappingURL=delegated-doc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegated-doc.d.ts","sourceRoot":"","sources":["../../../src/check/explain/delegated-doc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGjD,2GAA2G;AAC3G,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAQhD"}
@@ -0,0 +1,11 @@
1
+ import { CliError } from '../../cli-error.js';
2
+ import { DELEGATED_DOCS } from './delegated-docs.js';
3
+ /** The reason and the examples of a rule another tool decides; a rule without them is a bug of the kit. */
4
+ export function delegatedDoc(id) {
5
+ const doc = DELEGATED_DOCS[id];
6
+ if (doc === undefined) {
7
+ throw new CliError(`The rule "${id}" has no explanation.`, 'Report this as a bug of ddd-ts-kit.');
8
+ }
9
+ return doc;
10
+ }
11
+ //# sourceMappingURL=delegated-doc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegated-doc.js","sourceRoot":"","sources":["../../../src/check/explain/delegated-doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,2GAA2G;AAC3G,MAAM,UAAU,YAAY,CAAC,EAAU;IACrC,MAAM,GAAG,GAAG,cAAc,CAAC,EAAE,CAAC,CAAC;IAE/B,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,MAAM,IAAI,QAAQ,CAAC,aAAa,EAAE,uBAAuB,EAAE,qCAAqC,CAAC,CAAC;IACpG,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { RuleDoc } from '../model/rule-doc.js';
2
+ /**
3
+ * The rules another tool decides (the ESLint plugin, the formatter), explained as the rules of
4
+ * the checker are: the reason, written as `docs/ARCHITECTURE.md` and the page of the rule say it,
5
+ * and one example each way.
6
+ */
7
+ export declare const DELEGATED_DOCS: Readonly<Record<string, RuleDoc>>;
8
+ //# sourceMappingURL=delegated-docs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delegated-docs.d.ts","sourceRoot":"","sources":["../../../src/check/explain/delegated-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA6R5D,CAAC"}