ddd-ts-kit 0.16.1 → 0.18.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 (329) hide show
  1. package/README.fr.md +14 -15
  2. package/README.md +13 -13
  3. package/dist/affected/reach-of.js +1 -1
  4. package/dist/affected/reach-of.js.map +1 -1
  5. package/dist/check/business-names/closing-parenthesis.d.ts +3 -0
  6. package/dist/check/business-names/closing-parenthesis.d.ts.map +1 -0
  7. package/dist/check/business-names/closing-parenthesis.js +16 -0
  8. package/dist/check/business-names/closing-parenthesis.js.map +1 -0
  9. package/dist/check/business-names/declared-bindings.d.ts +4 -0
  10. package/dist/check/business-names/declared-bindings.d.ts.map +1 -0
  11. package/dist/check/business-names/declared-bindings.js +41 -0
  12. package/dist/check/business-names/declared-bindings.js.map +1 -0
  13. package/dist/check/business-names/generic-words-of.d.ts +4 -0
  14. package/dist/check/business-names/generic-words-of.d.ts.map +1 -0
  15. package/dist/check/business-names/generic-words-of.js +7 -0
  16. package/dist/check/business-names/generic-words-of.js.map +1 -0
  17. package/dist/check/business-names/generic-words.d.ts +7 -0
  18. package/dist/check/business-names/generic-words.d.ts.map +1 -0
  19. package/dist/check/business-names/generic-words.js +26 -0
  20. package/dist/check/business-names/generic-words.js.map +1 -0
  21. package/dist/check/business-names/identifier-at.d.ts +3 -0
  22. package/dist/check/business-names/identifier-at.d.ts.map +1 -0
  23. package/dist/check/business-names/identifier-at.js +6 -0
  24. package/dist/check/business-names/identifier-at.js.map +1 -0
  25. package/dist/check/business-names/judges-names.d.ts +7 -0
  26. package/dist/check/business-names/judges-names.d.ts.map +1 -0
  27. package/dist/check/business-names/judges-names.js +14 -0
  28. package/dist/check/business-names/judges-names.js.map +1 -0
  29. package/dist/check/business-names/named-binding.d.ts +12 -0
  30. package/dist/check/business-names/named-binding.d.ts.map +1 -0
  31. package/dist/check/business-names/named-binding.js +2 -0
  32. package/dist/check/business-names/named-binding.js.map +1 -0
  33. package/dist/check/business-names/named-bindings.d.ts +4 -0
  34. package/dist/check/business-names/named-bindings.d.ts.map +1 -0
  35. package/dist/check/business-names/named-bindings.js +8 -0
  36. package/dist/check/business-names/named-bindings.js.map +1 -0
  37. package/dist/check/business-names/opening-bracket.d.ts +3 -0
  38. package/dist/check/business-names/opening-bracket.d.ts.map +1 -0
  39. package/dist/check/business-names/opening-bracket.js +16 -0
  40. package/dist/check/business-names/opening-bracket.js.map +1 -0
  41. package/dist/check/business-names/parameter-bindings.d.ts +4 -0
  42. package/dist/check/business-names/parameter-bindings.d.ts.map +1 -0
  43. package/dist/check/business-names/parameter-bindings.js +28 -0
  44. package/dist/check/business-names/parameter-bindings.js.map +1 -0
  45. package/dist/check/business-names/parameter-lists.d.ts +14 -0
  46. package/dist/check/business-names/parameter-lists.d.ts.map +1 -0
  47. package/dist/check/business-names/parameter-lists.js +109 -0
  48. package/dist/check/business-names/parameter-lists.js.map +1 -0
  49. package/dist/check/business-names/pattern-bindings.d.ts +7 -0
  50. package/dist/check/business-names/pattern-bindings.d.ts.map +1 -0
  51. package/dist/check/business-names/pattern-bindings.js +31 -0
  52. package/dist/check/business-names/pattern-bindings.js.map +1 -0
  53. package/dist/check/business-names/property-bindings.d.ts +7 -0
  54. package/dist/check/business-names/property-bindings.d.ts.map +1 -0
  55. package/dist/check/business-names/property-bindings.js +31 -0
  56. package/dist/check/business-names/property-bindings.js.map +1 -0
  57. package/dist/check/business-names/suggested-name.d.ts +8 -0
  58. package/dist/check/business-names/suggested-name.d.ts.map +1 -0
  59. package/dist/check/business-names/suggested-name.js +28 -0
  60. package/dist/check/business-names/suggested-name.js.map +1 -0
  61. package/dist/check/business-names/top-level-separator.d.ts +3 -0
  62. package/dist/check/business-names/top-level-separator.d.ts.map +1 -0
  63. package/dist/check/business-names/top-level-separator.js +23 -0
  64. package/dist/check/business-names/top-level-separator.js.map +1 -0
  65. package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
  66. package/dist/check/catalogue/architecture-rules.js +4 -0
  67. package/dist/check/catalogue/architecture-rules.js.map +1 -1
  68. package/dist/check/declarations/declared-event-handlers.d.ts +4 -9
  69. package/dist/check/declarations/declared-event-handlers.d.ts.map +1 -1
  70. package/dist/check/declarations/declared-event-handlers.js +5 -5
  71. package/dist/check/declarations/declared-event-handlers.js.map +1 -1
  72. package/dist/check/declarations/option-of.d.ts +0 -2
  73. package/dist/check/declarations/option-of.d.ts.map +1 -1
  74. package/dist/check/declarations/option-of.js +1 -7
  75. package/dist/check/declarations/option-of.js.map +1 -1
  76. package/dist/check/explain/authz-docs.d.ts.map +1 -1
  77. package/dist/check/explain/authz-docs.js +14 -1
  78. package/dist/check/explain/authz-docs.js.map +1 -1
  79. package/dist/check/explain/events-docs.d.ts.map +1 -1
  80. package/dist/check/explain/events-docs.js +31 -11
  81. package/dist/check/explain/events-docs.js.map +1 -1
  82. package/dist/check/explain/ports-docs.d.ts.map +1 -1
  83. package/dist/check/explain/ports-docs.js +11 -9
  84. package/dist/check/explain/ports-docs.js.map +1 -1
  85. package/dist/check/explain/scheduling-docs.d.ts.map +1 -1
  86. package/dist/check/explain/scheduling-docs.js +10 -5
  87. package/dist/check/explain/scheduling-docs.js.map +1 -1
  88. package/dist/check/explain/tree-docs.d.ts.map +1 -1
  89. package/dist/check/explain/tree-docs.js +11 -0
  90. package/dist/check/explain/tree-docs.js.map +1 -1
  91. package/dist/check/explain/wiring-docs.js +4 -4
  92. package/dist/check/explain/wiring-docs.js.map +1 -1
  93. package/dist/check/fixtures/authz-policy-fixtures.d.ts +3 -0
  94. package/dist/check/fixtures/authz-policy-fixtures.d.ts.map +1 -0
  95. package/dist/check/fixtures/authz-policy-fixtures.js +97 -0
  96. package/dist/check/fixtures/authz-policy-fixtures.js.map +1 -0
  97. package/dist/check/fixtures/business-name-fixtures.d.ts +3 -0
  98. package/dist/check/fixtures/business-name-fixtures.d.ts.map +1 -0
  99. package/dist/check/fixtures/business-name-fixtures.js +98 -0
  100. package/dist/check/fixtures/business-name-fixtures.js.map +1 -0
  101. package/dist/check/fixtures/declarations-fixtures.d.ts.map +1 -1
  102. package/dist/check/fixtures/declarations-fixtures.js +2 -42
  103. package/dist/check/fixtures/declarations-fixtures.js.map +1 -1
  104. package/dist/check/fixtures/declared.d.ts.map +1 -1
  105. package/dist/check/fixtures/declared.js +3 -3
  106. package/dist/check/fixtures/declared.js.map +1 -1
  107. package/dist/check/fixtures/domain-events-fixtures.js +1 -1
  108. package/dist/check/fixtures/domain-events-fixtures.js.map +1 -1
  109. package/dist/check/fixtures/fixtures.d.ts.map +1 -1
  110. package/dist/check/fixtures/fixtures.js +4 -0
  111. package/dist/check/fixtures/fixtures.js.map +1 -1
  112. package/dist/check/rules/authz-policy-asked.d.ts +3 -0
  113. package/dist/check/rules/authz-policy-asked.d.ts.map +1 -0
  114. package/dist/check/rules/authz-policy-asked.js +184 -0
  115. package/dist/check/rules/authz-policy-asked.js.map +1 -0
  116. package/dist/check/rules/declarations-role-declared.d.ts.map +1 -1
  117. package/dist/check/rules/declarations-role-declared.js +4 -35
  118. package/dist/check/rules/declarations-role-declared.js.map +1 -1
  119. package/dist/check/rules/events-consumer-idempotent.js +3 -3
  120. package/dist/check/rules/events-consumer-idempotent.js.map +1 -1
  121. package/dist/check/rules/naming-business-name.d.ts +3 -0
  122. package/dist/check/rules/naming-business-name.d.ts.map +1 -0
  123. package/dist/check/rules/naming-business-name.js +41 -0
  124. package/dist/check/rules/naming-business-name.js.map +1 -0
  125. package/dist/config/config.d.ts +8 -0
  126. package/dist/config/config.d.ts.map +1 -1
  127. package/dist/config/parse-business-names.d.ts +4 -0
  128. package/dist/config/parse-business-names.d.ts.map +1 -0
  129. package/dist/config/parse-business-names.js +14 -0
  130. package/dist/config/parse-business-names.js.map +1 -0
  131. package/dist/config/parse-config.d.ts.map +1 -1
  132. package/dist/config/parse-config.js +2 -0
  133. package/dist/config/parse-config.js.map +1 -1
  134. package/dist/config/serialize-config.js +9 -1
  135. package/dist/config/serialize-config.js.map +1 -1
  136. package/dist/generate/emit.d.ts.map +1 -1
  137. package/dist/generate/emit.js +2 -14
  138. package/dist/generate/emit.js.map +1 -1
  139. package/dist/generate/kinds/ask-policy-in-generated-use-case.d.ts +9 -0
  140. package/dist/generate/kinds/ask-policy-in-generated-use-case.d.ts.map +1 -0
  141. package/dist/generate/kinds/ask-policy-in-generated-use-case.js +102 -0
  142. package/dist/generate/kinds/ask-policy-in-generated-use-case.js.map +1 -0
  143. package/dist/generate/kinds/assert-declares-its-name.d.ts +9 -0
  144. package/dist/generate/kinds/assert-declares-its-name.d.ts.map +1 -0
  145. package/dist/generate/kinds/assert-declares-its-name.js +16 -0
  146. package/dist/generate/kinds/assert-declares-its-name.js.map +1 -0
  147. package/dist/generate/kinds/command-context.d.ts +12 -0
  148. package/dist/generate/kinds/command-context.d.ts.map +1 -0
  149. package/dist/generate/kinds/command-context.js +18 -0
  150. package/dist/generate/kinds/command-context.js.map +1 -0
  151. package/dist/generate/kinds/command-kind.d.ts.map +1 -1
  152. package/dist/generate/kinds/command-kind.js +7 -24
  153. package/dist/generate/kinds/command-kind.js.map +1 -1
  154. package/dist/generate/kinds/command-outputs.d.ts +6 -0
  155. package/dist/generate/kinds/command-outputs.d.ts.map +1 -0
  156. package/dist/generate/kinds/command-outputs.js +13 -0
  157. package/dist/generate/kinds/command-outputs.js.map +1 -0
  158. package/dist/generate/kinds/declares-its-name.d.ts +5 -0
  159. package/dist/generate/kinds/declares-its-name.d.ts.map +1 -0
  160. package/dist/generate/kinds/declares-its-name.js +7 -0
  161. package/dist/generate/kinds/declares-its-name.js.map +1 -0
  162. package/dist/generate/kinds/event-file-of.d.ts +5 -0
  163. package/dist/generate/kinds/event-file-of.d.ts.map +1 -0
  164. package/dist/generate/kinds/event-file-of.js +5 -0
  165. package/dist/generate/kinds/event-file-of.js.map +1 -0
  166. package/dist/generate/kinds/event-handler-kind.d.ts.map +1 -1
  167. package/dist/generate/kinds/event-handler-kind.js +2 -0
  168. package/dist/generate/kinds/event-handler-kind.js.map +1 -1
  169. package/dist/generate/kinds/event-name-reference.d.ts +4 -3
  170. package/dist/generate/kinds/event-name-reference.d.ts.map +1 -1
  171. package/dist/generate/kinds/event-name-reference.js +6 -6
  172. package/dist/generate/kinds/event-name-reference.js.map +1 -1
  173. package/dist/generate/kinds/integration-event-kind.d.ts.map +1 -1
  174. package/dist/generate/kinds/integration-event-kind.js +2 -0
  175. package/dist/generate/kinds/integration-event-kind.js.map +1 -1
  176. package/dist/generate/kinds/policy-kind.d.ts.map +1 -1
  177. package/dist/generate/kinds/policy-kind.js +2 -0
  178. package/dist/generate/kinds/policy-kind.js.map +1 -1
  179. package/dist/generate/kinds/query-context.d.ts +9 -0
  180. package/dist/generate/kinds/query-context.d.ts.map +1 -0
  181. package/dist/generate/kinds/query-context.js +27 -0
  182. package/dist/generate/kinds/query-context.js.map +1 -0
  183. package/dist/generate/kinds/query-kind.d.ts.map +1 -1
  184. package/dist/generate/kinds/query-kind.js +16 -51
  185. package/dist/generate/kinds/query-kind.js.map +1 -1
  186. package/dist/generate/kinds/query-outputs.d.ts +8 -0
  187. package/dist/generate/kinds/query-outputs.d.ts.map +1 -0
  188. package/dist/generate/kinds/query-outputs.js +20 -0
  189. package/dist/generate/kinds/query-outputs.js.map +1 -0
  190. package/dist/generate/kinds/reader-file.d.ts +8 -0
  191. package/dist/generate/kinds/reader-file.d.ts.map +1 -0
  192. package/dist/generate/kinds/reader-file.js +9 -0
  193. package/dist/generate/kinds/reader-file.js.map +1 -0
  194. package/dist/generate/kinds/route/write-controller.d.ts.map +1 -1
  195. package/dist/generate/kinds/route/write-controller.js +2 -1
  196. package/dist/generate/kinds/route/write-controller.js.map +1 -1
  197. package/dist/generate/kinds/route-kind.d.ts.map +1 -1
  198. package/dist/generate/kinds/route-kind.js +2 -1
  199. package/dist/generate/kinds/route-kind.js.map +1 -1
  200. package/dist/generate/mark-policy-questions.d.ts +10 -0
  201. package/dist/generate/mark-policy-questions.d.ts.map +1 -0
  202. package/dist/generate/mark-policy-questions.js +76 -0
  203. package/dist/generate/mark-policy-questions.js.map +1 -0
  204. package/dist/generate/permission-pattern.d.ts +4 -0
  205. package/dist/generate/permission-pattern.d.ts.map +1 -0
  206. package/dist/generate/permission-pattern.js +7 -0
  207. package/dist/generate/permission-pattern.js.map +1 -0
  208. package/dist/generate/refined-by-policy.d.ts +4 -0
  209. package/dist/generate/refined-by-policy.d.ts.map +1 -0
  210. package/dist/generate/refined-by-policy.js +9 -0
  211. package/dist/generate/refined-by-policy.js.map +1 -0
  212. package/dist/generate/rendered.d.ts +5 -0
  213. package/dist/generate/rendered.d.ts.map +1 -0
  214. package/dist/generate/rendered.js +18 -0
  215. package/dist/generate/rendered.js.map +1 -0
  216. package/dist/generate/searched-elements.d.ts +13 -0
  217. package/dist/generate/searched-elements.d.ts.map +1 -0
  218. package/dist/generate/searched-elements.js +63 -0
  219. package/dist/generate/searched-elements.js.map +1 -0
  220. package/dist/generate/wire.d.ts.map +1 -1
  221. package/dist/generate/wire.js +3 -25
  222. package/dist/generate/wire.js.map +1 -1
  223. package/dist/generate/wirings.d.ts +8 -0
  224. package/dist/generate/wirings.d.ts.map +1 -0
  225. package/dist/generate/wirings.js +28 -0
  226. package/dist/generate/wirings.js.map +1 -0
  227. package/dist/init/copilot-instruction.d.ts +6 -0
  228. package/dist/init/copilot-instruction.d.ts.map +1 -0
  229. package/dist/init/copilot-instruction.js +15 -0
  230. package/dist/init/copilot-instruction.js.map +1 -0
  231. package/dist/init/files/guidance-files.d.ts +1 -0
  232. package/dist/init/files/guidance-files.d.ts.map +1 -1
  233. package/dist/init/files/guidance-files.js +4 -3
  234. package/dist/init/files/guidance-files.js.map +1 -1
  235. package/dist/init/files/layer-rules.d.ts +3 -0
  236. package/dist/init/files/layer-rules.d.ts.map +1 -0
  237. package/dist/init/files/layer-rules.js +11 -0
  238. package/dist/init/files/layer-rules.js.map +1 -0
  239. package/dist/init/files/pipeline-files.d.ts.map +1 -1
  240. package/dist/init/files/pipeline-files.js +2 -0
  241. package/dist/init/files/pipeline-files.js.map +1 -1
  242. package/dist/init/json-object.d.ts +3 -0
  243. package/dist/init/json-object.d.ts.map +1 -0
  244. package/dist/init/json-object.js +12 -0
  245. package/dist/init/json-object.js.map +1 -0
  246. package/dist/init/manifest/versions.js +24 -24
  247. package/dist/init/run-init.d.ts.map +1 -1
  248. package/dist/init/run-init.js +4 -0
  249. package/dist/init/run-init.js.map +1 -1
  250. package/dist/init/write-agent-settings.d.ts.map +1 -1
  251. package/dist/init/write-agent-settings.js +3 -10
  252. package/dist/init/write-agent-settings.js.map +1 -1
  253. package/dist/init/write-copilot-instructions.d.ts +7 -0
  254. package/dist/init/write-copilot-instructions.d.ts.map +1 -0
  255. package/dist/init/write-copilot-instructions.js +16 -0
  256. package/dist/init/write-copilot-instructions.js.map +1 -0
  257. package/dist/init/write-copilot-settings.d.ts +8 -0
  258. package/dist/init/write-copilot-settings.d.ts.map +1 -0
  259. package/dist/init/write-copilot-settings.js +36 -0
  260. package/dist/init/write-copilot-settings.js.map +1 -0
  261. package/dist/markers/index.d.ts +1 -0
  262. package/dist/markers/index.d.ts.map +1 -1
  263. package/dist/markers/index.js +1 -0
  264. package/dist/markers/index.js.map +1 -1
  265. package/dist/markers/replace-in-region.d.ts +10 -0
  266. package/dist/markers/replace-in-region.d.ts.map +1 -0
  267. package/dist/markers/replace-in-region.js +30 -0
  268. package/dist/markers/replace-in-region.js.map +1 -0
  269. package/dist/naming/index.d.ts +2 -0
  270. package/dist/naming/index.d.ts.map +1 -1
  271. package/dist/naming/index.js +2 -0
  272. package/dist/naming/index.js.map +1 -1
  273. package/dist/naming/plural.d.ts +3 -0
  274. package/dist/naming/plural.d.ts.map +1 -0
  275. package/dist/naming/plural.js +8 -0
  276. package/dist/naming/plural.js.map +1 -0
  277. package/dist/naming/singular.d.ts +3 -0
  278. package/dist/naming/singular.d.ts.map +1 -0
  279. package/dist/naming/singular.js +11 -0
  280. package/dist/naming/singular.js.map +1 -0
  281. package/dist/naming/to-name.d.ts.map +1 -1
  282. package/dist/naming/to-name.js +1 -6
  283. package/dist/naming/to-name.js.map +1 -1
  284. package/dist/sdk/agent-instruction.d.ts +1 -1
  285. package/dist/sdk/agent-instruction.js +1 -1
  286. package/dist/sdk/instruct-agents.d.ts +1 -1
  287. package/dist/sdk/instruct-agents.d.ts.map +1 -1
  288. package/dist/sdk/instruct-agents.js +12 -8
  289. package/dist/sdk/instruct-agents.js.map +1 -1
  290. package/dist/version.d.ts +1 -1
  291. package/dist/version.js +1 -1
  292. package/package.json +24 -3
  293. package/templates/command/handler.declared.ts.tpl +32 -3
  294. package/templates/command/handler.spec.buses.ts.tpl +24 -1
  295. package/templates/command/handler.ts.tpl +32 -3
  296. package/templates/command/wiring.manual.tpl +2 -2
  297. package/templates/command/wiring.tsyringe.tpl +5 -2
  298. package/templates/controller/controller.search.ts.tpl +1 -1
  299. package/templates/event-handler/event-handler.declared.ts.tpl +1 -1
  300. package/templates/init/AGENTS.md.tpl +46 -0
  301. package/templates/init/CLAUDE.md.tpl +2 -45
  302. package/templates/init/README.md.tpl +1 -1
  303. package/templates/init/rules/application.md.tpl +2 -2
  304. package/templates/init/rules/domain.md.tpl +1 -1
  305. package/templates/init/scripts/events.ts.tpl +6 -6
  306. package/templates/init/scripts/openapi.ts.tpl +2 -2
  307. package/templates/integration-event/publisher.declared.ts.tpl +1 -1
  308. package/templates/pipeline/github/workflows/copilot-setup-steps.yml +26 -0
  309. package/templates/pipeline/package-scripts.json +1 -1
  310. package/templates/policy/policy.declared.ts.tpl +1 -1
  311. package/templates/policy/policy.ts.tpl +1 -1
  312. package/templates/presets/identity/context/application/integration/publishers/account-deactivated.publisher.ts.tpl +1 -1
  313. package/templates/presets/identity/context/application/integration/publishers/delegation-granted.publisher.ts.tpl +1 -1
  314. package/templates/presets/identity/context/application/integration/publishers/delegation-revoked.publisher.ts.tpl +1 -1
  315. package/templates/presets/identity/context/application/integration/publishers/member-joined.publisher.ts.tpl +1 -1
  316. package/templates/presets/identity/context/application/integration/publishers/member-removed.publisher.ts.tpl +1 -1
  317. package/templates/presets/identity/context/application/integration/publishers/member-role-changed.publisher.ts.tpl +1 -1
  318. package/templates/presets/identity/context/application/integration/publishers/organisation-opened.publisher.ts.tpl +1 -1
  319. package/templates/presets/identity/context/infrastructure/persistence/drizzle-search-members-reader.repository.drizzle.ts.tpl +2 -2
  320. package/templates/presets/identity/context/presentation/http/organisations/search-members/search-members.controller.ts.tpl +2 -2
  321. package/templates/presets/identity/context/test/integration/search-members-reader.spec.ts.tpl +1 -1
  322. package/templates/query/handler.declared.ts.tpl +19 -0
  323. package/templates/query/handler.spec.buses.ts.tpl +21 -0
  324. package/templates/query/handler.ts.tpl +19 -0
  325. package/templates/query/search.reader.fake.ts.tpl +1 -1
  326. package/templates/query/search.reader.in-memory.ts.tpl +20 -18
  327. package/templates/query/wiring.manual.tpl +1 -1
  328. package/templates/query/wiring.tsyringe.tpl +4 -1
  329. package/templates/route/route.search.ts.tpl +1 -1
@@ -1,4 +1,5 @@
1
1
  export { insertInRegion } from './insert-in-region.js';
2
2
  export { parseWiring } from './parse-wiring.js';
3
+ export { replaceInRegion } from './replace-in-region.js';
3
4
  export { replaceRegion } from './replace-region.js';
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/markers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/markers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Replaces, inside a region, the lines a block was added as by the lines another block is added
3
+ * as, both laid out for the indentation of the region. Undefined when the file has no such region
4
+ * or the region no longer holds the first block as it was written.
5
+ */
6
+ export declare function replaceInRegion(content: string, region: string, { replaced, by }: {
7
+ readonly replaced: string;
8
+ readonly by: string;
9
+ }): string | undefined;
10
+ //# sourceMappingURL=replace-in-region.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replace-in-region.d.ts","sourceRoot":"","sources":["../../src/markers/replace-in-region.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACnE,MAAM,GAAG,SAAS,CAoBpB"}
@@ -0,0 +1,30 @@
1
+ import { fitBlock } from '../layout/index.js';
2
+ import { marker } from './marker.js';
3
+ /**
4
+ * Replaces, inside a region, the lines a block was added as by the lines another block is added
5
+ * as, both laid out for the indentation of the region. Undefined when the file has no such region
6
+ * or the region no longer holds the first block as it was written.
7
+ */
8
+ export function replaceInRegion(content, region, { replaced, by }) {
9
+ const lines = content.split('\n');
10
+ const open = lines.findIndex((line) => marker(region, false).test(line));
11
+ const close = lines.findIndex((line, index) => index > open && marker(region, true).test(line));
12
+ if (open === -1 || close === -1) {
13
+ return undefined;
14
+ }
15
+ const indent = /^\s*/.exec(lines[close] ?? '')?.[0] ?? '';
16
+ const inside = lines.slice(open + 1, close).join('\n');
17
+ const before = laidOut(replaced, indent);
18
+ if (before === '' || !inside.includes(before)) {
19
+ return undefined;
20
+ }
21
+ lines.splice(open + 1, close - open - 1, ...inside.replace(before, laidOut(by, indent)).split('\n'));
22
+ return lines.join('\n');
23
+ }
24
+ function laidOut(block, indent) {
25
+ const written = block.split('\n').filter((line) => line.trim() !== '');
26
+ return fitBlock(written, indent)
27
+ .map((line) => (line.trim() === '' ? '' : `${indent}${line}`))
28
+ .join('\n');
29
+ }
30
+ //# sourceMappingURL=replace-in-region.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replace-in-region.js","sourceRoot":"","sources":["../../src/markers/replace-in-region.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAe,EACf,MAAc,EACd,EAAE,QAAQ,EAAE,EAAE,EAAsD;IAEpE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACzE,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAEhG,IAAI,IAAI,KAAK,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QAChC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1D,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvD,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAEzC,IAAI,MAAM,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAErG,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,OAAO,CAAC,KAAa,EAAE,MAAc;IAC5C,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAEvE,OAAO,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;SAC7B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC;SAC7D,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
@@ -6,6 +6,8 @@ export { looksLikePastFact } from './looks-like-past-fact.js';
6
6
  export type { Name } from './name.js';
7
7
  export { parseConceptName } from './parse-concept-name.js';
8
8
  export { parseContextName } from './parse-context-name.js';
9
+ export { plural } from './plural.js';
10
+ export { singular } from './singular.js';
9
11
  export { splitWords } from './split-words.js';
10
12
  export { toName } from './to-name.js';
11
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/naming/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/naming/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"}
@@ -5,6 +5,8 @@ export { eventName } from './event-name.js';
5
5
  export { looksLikePastFact } from './looks-like-past-fact.js';
6
6
  export { parseConceptName } from './parse-concept-name.js';
7
7
  export { parseContextName } from './parse-context-name.js';
8
+ export { plural } from './plural.js';
9
+ export { singular } from './singular.js';
8
10
  export { splitWords } from './split-words.js';
9
11
  export { toName } from './to-name.js';
10
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/naming/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/naming/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** The plural of an English word, as the generator writes table names: `purchase_orders`, `deliveries`. */
2
+ export declare function plural(word: string): string;
3
+ //# sourceMappingURL=plural.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plural.d.ts","sourceRoot":"","sources":["../../src/naming/plural.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM3C"}
@@ -0,0 +1,8 @@
1
+ /** The plural of an English word, as the generator writes table names: `purchase_orders`, `deliveries`. */
2
+ export function plural(word) {
3
+ if (/[^aeiou]y$/.test(word)) {
4
+ return `${word.slice(0, -1)}ies`;
5
+ }
6
+ return /(?:s|x|z|ch|sh)$/.test(word) ? `${word}es` : `${word}s`;
7
+ }
8
+ //# sourceMappingURL=plural.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plural.js","sourceRoot":"","sources":["../../src/naming/plural.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,MAAM,UAAU,MAAM,CAAC,IAAY;IACjC,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IACnC,CAAC;IAED,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC;AAClE,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** The singular of a plural English word (`reminders`, `deliveries`, `boxes`), or undefined when it does not read as one. */
2
+ export declare function singular(word: string): string | undefined;
3
+ //# sourceMappingURL=singular.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"singular.d.ts","sourceRoot":"","sources":["../../src/naming/singular.ts"],"names":[],"mappings":"AAAA,6HAA6H;AAC7H,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUzD"}
@@ -0,0 +1,11 @@
1
+ /** The singular of a plural English word (`reminders`, `deliveries`, `boxes`), or undefined when it does not read as one. */
2
+ export function singular(word) {
3
+ if (/[^aeiou]ies$/.test(word)) {
4
+ return `${word.slice(0, -3)}y`;
5
+ }
6
+ if (/(?:ss|x|z|ch|sh)es$/.test(word)) {
7
+ return word.slice(0, -2);
8
+ }
9
+ return /[^su]s$/.test(word) ? word.slice(0, -1) : undefined;
10
+ }
11
+ //# sourceMappingURL=singular.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"singular.js","sourceRoot":"","sources":["../../src/naming/singular.ts"],"names":[],"mappings":"AAAA,6HAA6H;AAC7H,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IACjC,CAAC;IAED,IAAI,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"to-name.d.ts","sourceRoot":"","sources":["../../src/naming/to-name.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGtC,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAgB1C"}
1
+ {"version":3,"file":"to-name.d.ts","sourceRoot":"","sources":["../../src/naming/to-name.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAItC,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAgB1C"}
@@ -1,4 +1,5 @@
1
1
  import { capitalize } from './capitalize.js';
2
+ import { plural as pluralize } from './plural.js';
2
3
  import { splitWords } from './split-words.js';
3
4
  export function toName(input) {
4
5
  const words = splitWords(input);
@@ -16,10 +17,4 @@ export function toName(input) {
16
17
  tableCamel: plural.map((word, index) => (index === 0 ? word : capitalize(word))).join(''),
17
18
  };
18
19
  }
19
- function pluralize(word) {
20
- if (/[^aeiou]y$/.test(word)) {
21
- return `${word.slice(0, -1)}ies`;
22
- }
23
- return /(?:s|x|z|ch|sh)$/.test(word) ? `${word}es` : `${word}s`;
24
- }
25
20
  //# sourceMappingURL=to-name.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"to-name.js","sourceRoot":"","sources":["../../src/naming/to-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,UAAU,MAAM,CAAC,KAAa;IAClC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAEtE,OAAO;QACL,MAAM;QACN,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACvD,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;QACtB,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE;QACvC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;QACtB,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG;QACrD,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;KAC1F,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IACnC,CAAC;IAED,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC;AAClE,CAAC"}
1
+ {"version":3,"file":"to-name.js","sourceRoot":"","sources":["../../src/naming/to-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,UAAU,MAAM,CAAC,KAAa;IAClC,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAEtE,OAAO;QACL,MAAM;QACN,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACvD,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;QACtB,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE;QACvC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;QACtB,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG;QACrD,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;KAC1F,CAAC;AACJ,CAAC"}
@@ -1,3 +1,3 @@
1
- /** What the CLAUDE.md of a project with clients tells its agents, at `init --sdk` and when `ddd-ts-kit sdk` asks for them later. */
1
+ /** What the AGENTS.md of a project with clients tells its agents, at `init --sdk` and when `ddd-ts-kit sdk` asks for them later. */
2
2
  export declare const AGENT_INSTRUCTION = "Never edit the clients under `clients/`, except the version and your own keys in their `package.json`: `npm run docs:generate` (`npx ddd-ts-kit sdk`) rewrites them from the contract, `docs:check` fails while they differ from it. A spec or a script calls the API through a client by its package name, which the command resolves to its sources under `paths` in `tsconfig.json`.";
3
3
  //# sourceMappingURL=agent-instruction.d.ts.map
@@ -1,3 +1,3 @@
1
- /** What the CLAUDE.md of a project with clients tells its agents, at `init --sdk` and when `ddd-ts-kit sdk` asks for them later. */
1
+ /** What the AGENTS.md of a project with clients tells its agents, at `init --sdk` and when `ddd-ts-kit sdk` asks for them later. */
2
2
  export const AGENT_INSTRUCTION = 'Never edit the clients under `clients/`, except the version and your own keys in their `package.json`: `npm run docs:generate` (`npx ddd-ts-kit sdk`) rewrites them from the contract, `docs:check` fails while they differ from it. A spec or a script calls the API through a client by its package name, which the command resolves to its sources under `paths` in `tsconfig.json`.';
3
3
  //# sourceMappingURL=agent-instruction.js.map
@@ -1,7 +1,7 @@
1
1
  import type { Workspace } from '../workspace/index.js';
2
2
  /**
3
3
  * What `init --sdk` writes for the agents of a project, in one that asks for clients later: the
4
- * instruction of CLAUDE.md, appended once, and a note for the paths of the presentation rule,
4
+ * instruction of its guide, appended once, and a note for the paths of the presentation rules,
5
5
  * which the team may have rewritten.
6
6
  */
7
7
  export declare function instructAgents(ws: Workspace): void;
@@ -1 +1 @@
1
- {"version":3,"file":"instruct-agents.d.ts","sourceRoot":"","sources":["../../src/sdk/instruct-agents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAMvD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI,CAWlD"}
1
+ {"version":3,"file":"instruct-agents.d.ts","sourceRoot":"","sources":["../../src/sdk/instruct-agents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAOvD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI,CAclD"}
@@ -1,19 +1,23 @@
1
1
  import { AGENT_INSTRUCTION } from './agent-instruction.js';
2
- const INSTRUCTIONS = 'CLAUDE.md';
3
- const PRESENTATION_RULE = '.claude/rules/presentation.md';
2
+ /** The guide of every agent; a project written before it kept its instructions in CLAUDE.md. */
3
+ const GUIDES = ['AGENTS.md', 'CLAUDE.md'];
4
+ const PRESENTATION_RULES = ['.claude/rules/presentation.md', '.github/instructions/presentation.instructions.md'];
4
5
  /**
5
6
  * What `init --sdk` writes for the agents of a project, in one that asks for clients later: the
6
- * instruction of CLAUDE.md, appended once, and a note for the paths of the presentation rule,
7
+ * instruction of its guide, appended once, and a note for the paths of the presentation rules,
7
8
  * which the team may have rewritten.
8
9
  */
9
10
  export function instructAgents(ws) {
10
- const instructions = ws.read(INSTRUCTIONS);
11
+ const guide = GUIDES.find((file) => ws.exists(file));
12
+ const instructions = guide === undefined ? undefined : ws.read(guide);
11
13
  const instruction = ws.spoken(AGENT_INSTRUCTION);
12
- if (instructions !== undefined && !instructions.includes(instruction)) {
13
- ws.update(INSTRUCTIONS, `${instructions}${instructions.endsWith('\n') ? '' : '\n'}\n${instruction}\n`);
14
+ if (guide !== undefined && instructions !== undefined && !instructions.includes(instruction)) {
15
+ ws.update(guide, `${instructions}${instructions.endsWith('\n') ? '' : '\n'}\n${instruction}\n`);
14
16
  }
15
- if (!(ws.read(PRESENTATION_RULE) ?? '"clients/**"').includes('"clients/**"')) {
16
- ws.note(`${PRESENTATION_RULE}: add "clients/**" to its paths, so that an agent editing a client reads it.`);
17
+ for (const rule of PRESENTATION_RULES) {
18
+ if (!(ws.read(rule) ?? 'clients/**').includes('clients/**')) {
19
+ ws.note(`${rule}: add "clients/**" to its paths, so that an agent editing a client reads it.`);
20
+ }
17
21
  }
18
22
  }
19
23
  //# sourceMappingURL=instruct-agents.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"instruct-agents.js","sourceRoot":"","sources":["../../src/sdk/instruct-agents.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,YAAY,GAAG,WAAW,CAAC;AACjC,MAAM,iBAAiB,GAAG,+BAA+B,CAAC;AAE1D;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,EAAa;IAC1C,MAAM,YAAY,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3C,MAAM,WAAW,GAAG,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAEjD,IAAI,YAAY,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QACtE,EAAE,CAAC,MAAM,CAAC,YAAY,EAAE,GAAG,YAAY,GAAG,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,IAAI,CAAC,CAAC;IACzG,CAAC;IAED,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,cAAc,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QAC7E,EAAE,CAAC,IAAI,CAAC,GAAG,iBAAiB,8EAA8E,CAAC,CAAC;IAC9G,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"instruct-agents.js","sourceRoot":"","sources":["../../src/sdk/instruct-agents.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,gGAAgG;AAChG,MAAM,MAAM,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAC1C,MAAM,kBAAkB,GAAG,CAAC,+BAA+B,EAAE,mDAAmD,CAAC,CAAC;AAElH;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,EAAa;IAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,MAAM,YAAY,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtE,MAAM,WAAW,GAAG,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAEjD,IAAI,KAAK,KAAK,SAAS,IAAI,YAAY,KAAK,SAAS,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7F,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,YAAY,GAAG,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,IAAI,CAAC,CAAC;IAClG,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,kBAAkB,EAAE,CAAC;QACtC,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YAC5D,EAAE,CAAC,IAAI,CAAC,GAAG,IAAI,8EAA8E,CAAC,CAAC;QACjG,CAAC;IACH,CAAC;AACH,CAAC"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.16.1";
1
+ export declare const VERSION = "0.18.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.16.1';
1
+ export const VERSION = '0.18.0';
2
2
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,7 +1,28 @@
1
1
  {
2
2
  "name": "ddd-ts-kit",
3
- "version": "0.16.1",
4
- "description": "Bootstrap, scaffold and verify DDD and Clean Architecture TypeScript projects.",
3
+ "version": "0.18.0",
4
+ "description": "Bootstrap, scaffold and verify Domain-Driven Design (DDD), Clean Architecture and hexagonal TypeScript backends on Node.js: project and code generators, architecture checks, OpenAPI and AsyncAPI documents, for developers and AI coding agents (Claude Code, Codex, GitHub Copilot).",
5
+ "keywords": [
6
+ "ddd",
7
+ "domain-driven-design",
8
+ "clean-architecture",
9
+ "hexagonal-architecture",
10
+ "typescript",
11
+ "cli",
12
+ "scaffolding",
13
+ "code-generator",
14
+ "project-generator",
15
+ "architecture-testing",
16
+ "cqrs",
17
+ "event-sourcing",
18
+ "modular-monolith",
19
+ "microservices",
20
+ "nodejs",
21
+ "claude-code",
22
+ "codex",
23
+ "github-copilot",
24
+ "ai-agents"
25
+ ],
5
26
  "license": "MIT",
6
27
  "repository": {
7
28
  "type": "git",
@@ -29,6 +50,6 @@
29
50
  "clean:packages": "node dist/bin.js check --clean-only ../kernel/src ../validation/src ../http/src ../tracing/src ../di/src ../events/src ../testing/src ../s3/src ../drizzle/src ../knex/src ../prisma/src ../typeorm/src ../aspects/src ../rabbitmq/src ../auth/src ../audit/src ../redis/src ../scheduling/src ../pino/src ../winston/src ../sentry/src ../kafka/src ../nats/src ../eslint-plugin/src"
30
51
  },
31
52
  "devDependencies": {
32
- "@ddd-ts-kit/kernel": "^0.16.1"
53
+ "@ddd-ts-kit/kernel": "^0.18.0"
33
54
  }
34
55
  }
@@ -1,8 +1,14 @@
1
1
  {{#if command.hasAggregate}}
2
+ {{#if access.policy}}
3
+ import type { Access } from '@ddd-ts-kit/auth';
4
+ {{/if}}
2
5
  import type { Clock, IdGenerator } from '@ddd-ts-kit/kernel';
3
6
  import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
4
7
  import { {{aggregate.pascal}} } from '{{alias.context}}/domain/aggregates/{{aggregate.kebab}}.aggregate{{alias.ext}}';
5
8
  import type { {{aggregate.pascal}}Repository } from '{{alias.context}}/domain/repositories/{{aggregate.kebab}}.repository{{alias.ext}}';
9
+ {{#if access.policy}}
10
+ {{access.useCasePermissionsImport}}
11
+ {{/if}}
6
12
  import { {{name.pascal}}Command } from '{{alias.context}}/application/commands/{{name.kebab}}/{{name.kebab}}.command{{alias.ext}}';
7
13
 
8
14
  @CommandHandler({{name.pascal}}Command)
@@ -11,30 +17,53 @@ export class {{name.pascal}}Handler implements CommandHandler<{{name.pascal}}Com
11
17
  private readonly {{aggregate.camel}}Repository: {{aggregate.pascal}}Repository,
12
18
  private readonly ids: IdGenerator,
13
19
  private readonly clock: Clock,
20
+ {{#if access.policy}}
21
+ private readonly access: Access,
22
+ {{/if}}
14
23
  ) {}
15
24
 
16
25
  async execute(command: {{name.pascal}}Command): Promise<string> {
26
+ {{#if access.policy}}
27
+ // TODO(domain): a policy refines {{access.reference}}: ask it about the element "{{name.words}}" acts on once it is loaded, in place of `command`.
28
+ await this.access.authorize(command.actor, {{access.reference}}, command);
29
+
30
+ {{/if}}
17
31
  {{#if refusals.factories}}
18
32
  // TODO(domain): decide what "{{name.words}}" does to a {{aggregate.pascal}}: either it gives birth to one (keep `create`, pass the facts of `command` as value objects), or it changes an existing one (load it with `findById`, throw its not-found refusal, `{{aggregate.pascal}}Error.notFound(id)` (`ddd-ts-kit generate error {{context.kebab}} {{aggregate.pascal}} notFound`), call ONE intention method). The events it records leave with the save: nothing else to do here.
19
33
  {{/if}}
20
34
  {{#if refusals.classes}}
21
35
  // TODO(domain): decide what "{{name.words}}" does to a {{aggregate.pascal}}: either it gives birth to one (keep `create`, pass the facts of `command` as value objects), or it changes an existing one (load it with `findById`, throw a not-found DomainError, call ONE intention method). The events it records leave with the save: nothing else to do here.
22
36
  {{/if}}
23
- const target = {{aggregate.pascal}}.create(this.ids.next(), this.clock.now());
37
+ const {{aggregate.camel}} = {{aggregate.pascal}}.create(this.ids.next(), this.clock.now());
24
38
 
25
- await this.{{aggregate.camel}}Repository.save(target);
39
+ await this.{{aggregate.camel}}Repository.save({{aggregate.camel}});
26
40
 
27
- return target.id;
41
+ return {{aggregate.camel}}.id;
28
42
  }
29
43
  }
30
44
  {{/if}}
31
45
  {{#unless command.hasAggregate}}
46
+ {{#if access.policy}}
47
+ import type { Access } from '@ddd-ts-kit/auth';
48
+ {{/if}}
32
49
  import { CommandHandler } from '@ddd-ts-kit/kernel/declarations';
50
+ {{#if access.policy}}
51
+ {{access.useCasePermissionsImport}}
52
+ {{/if}}
33
53
  import { {{name.pascal}}Command } from '{{alias.context}}/application/commands/{{name.kebab}}/{{name.kebab}}.command{{alias.ext}}';
34
54
 
35
55
  @CommandHandler({{name.pascal}}Command)
36
56
  export class {{name.pascal}}Handler implements CommandHandler<{{name.pascal}}Command> {
57
+ {{#if access.policy}}
58
+ constructor(private readonly access: Access) {}
59
+
60
+ {{/if}}
37
61
  async execute(command: {{name.pascal}}Command): Promise<void> {
62
+ {{#if access.policy}}
63
+ // TODO(domain): a policy refines {{access.reference}}: ask it about the element "{{name.words}}" acts on once it is loaded, in place of `command`.
64
+ await this.access.authorize(command.actor, {{access.reference}}, command);
65
+
66
+ {{/if}}
38
67
  // TODO(domain): receive the repository of the aggregate "{{name.words}}" acts on in the constructor, typed by its port (rerun with --aggregate <Name> --force to get it declared), load or create the aggregate from `command`, call its intention method and save it (its events leave with the save); the unit of work is opened by the command bus.
39
68
  }
40
69
  }
@@ -1,6 +1,11 @@
1
1
  import { describe, expect, it } from '{{tests.module}}';
2
2
  {{#if access.protected}}
3
+ {{#if access.policy}}
4
+ import { AuthorizationMap, PolicyAccess, RoleBasedAuthorizer, authorizationMiddleware, requires } from '@ddd-ts-kit/auth';
5
+ {{/if}}
6
+ {{#unless access.policy}}
3
7
  import { AuthorizationMap, RoleBasedAuthorizer, authorizationMiddleware, requires } from '@ddd-ts-kit/auth';
8
+ {{/unless}}
4
9
  import { anActor } from '@ddd-ts-kit/auth/testing';
5
10
  {{/if}}
6
11
  import { createTestBuses } from '@ddd-ts-kit/testing';
@@ -14,12 +19,22 @@ import { Fake{{aggregate.pascal}}Repository } from '{{alias.context}}/test/fakes
14
19
  {{/if}}
15
20
  {{#if access.protected}}
16
21
 
22
+ {{#if access.policy}}
23
+ const authorizer = new RoleBasedAuthorizer({ roles: { holder: [{{context.camel}}Permissions['{{access.permission}}']] } });
24
+
25
+ const holders = authorizationMiddleware({
26
+ authorizer,
27
+ map: AuthorizationMap.of(requires({{name.pascal}}Command, {{context.camel}}Permissions['{{access.permission}}'])),
28
+ });
29
+ {{/if}}
30
+ {{#unless access.policy}}
17
31
  const holders = authorizationMiddleware({
18
32
  authorizer: new RoleBasedAuthorizer({
19
33
  roles: { holder: [{{context.camel}}Permissions['{{access.permission}}']] },
20
34
  }),
21
35
  map: AuthorizationMap.of(requires({{name.pascal}}Command, {{context.camel}}Permissions['{{access.permission}}'])),
22
36
  });
37
+ {{/unless}}
23
38
 
24
39
  const holder = anActor().withRole('holder').build();
25
40
  {{/if}}
@@ -71,16 +86,24 @@ function arrange() {
71
86
  // As the application hands it to the handler: the save announces the events of the {{aggregate.words}} to `domainEvents`.
72
87
  const {{aggregate.camel}}Repository = dispatching(new Fake{{aggregate.pascal}}Repository());
73
88
 
74
- const handler = new {{name.pascal}}Handler({{aggregate.camel}}Repository, ids, clock);
89
+ const handler = new {{name.pascal}}Handler({{aggregate.camel}}Repository, ids, clock{{#if access.policy}}, new PolicyAccess({ authorizer, clock }){{/if}});
75
90
 
76
91
  commandBus{{spec.guard}}.register({{name.pascal}}Command, handler);
77
92
 
78
93
  return { commandBus, {{aggregate.camel}}Repository, domainEvents };
79
94
  {{/if}}
80
95
  {{#unless command.hasAggregate}}
96
+ {{#if access.policy}}
97
+ const { commandBus, clock } = createTestBuses();
98
+ const handler = new {{name.pascal}}Handler(new PolicyAccess({ authorizer, clock }));
99
+
100
+ commandBus{{spec.guard}}.register({{name.pascal}}Command, handler);
101
+ {{/if}}
102
+ {{#unless access.policy}}
81
103
  const { commandBus } = createTestBuses();
82
104
 
83
105
  commandBus{{spec.guard}}.register({{name.pascal}}Command, new {{name.pascal}}Handler());
106
+ {{/unless}}
84
107
 
85
108
  return { commandBus };
86
109
  {{/unless}}
@@ -1,7 +1,13 @@
1
1
  {{#if command.hasAggregate}}
2
+ {{#if access.policy}}
3
+ import type { Access } from '@ddd-ts-kit/auth';
4
+ {{/if}}
2
5
  import type { Clock, CommandHandler, IdGenerator } from '@ddd-ts-kit/kernel';
3
6
  import { {{aggregate.pascal}} } from '{{alias.context}}/domain/aggregates/{{aggregate.kebab}}.aggregate{{alias.ext}}';
4
7
  import type { {{aggregate.pascal}}Repository } from '{{alias.context}}/domain/repositories/{{aggregate.kebab}}.repository{{alias.ext}}';
8
+ {{#if access.policy}}
9
+ {{access.useCasePermissionsImport}}
10
+ {{/if}}
5
11
  import type { {{name.pascal}}Command } from '{{alias.context}}/application/commands/{{name.kebab}}/{{name.kebab}}.command{{alias.ext}}';
6
12
 
7
13
  export class {{name.pascal}}Handler implements CommandHandler<{{name.pascal}}Command> {
@@ -9,29 +15,52 @@ export class {{name.pascal}}Handler implements CommandHandler<{{name.pascal}}Com
9
15
  private readonly {{aggregate.camel}}Repository: {{aggregate.pascal}}Repository,
10
16
  private readonly ids: IdGenerator,
11
17
  private readonly clock: Clock,
18
+ {{#if access.policy}}
19
+ private readonly access: Access,
20
+ {{/if}}
12
21
  ) {}
13
22
 
14
23
  async execute(command: {{name.pascal}}Command): Promise<string> {
24
+ {{#if access.policy}}
25
+ // TODO(domain): a policy refines {{access.reference}}: ask it about the element "{{name.words}}" acts on once it is loaded, in place of `command`.
26
+ await this.access.authorize(command.actor, {{access.reference}}, command);
27
+
28
+ {{/if}}
15
29
  {{#if refusals.factories}}
16
30
  // TODO(domain): decide what "{{name.words}}" does to a {{aggregate.pascal}}: either it gives birth to one (keep `create`, pass the facts of `command` as value objects), or it changes an existing one (load it with `findById`, throw its not-found refusal, `{{aggregate.pascal}}Error.notFound(id)` (`ddd-ts-kit generate error {{context.kebab}} {{aggregate.pascal}} notFound`), call ONE intention method). The events it records leave with the save: nothing else to do here.
17
31
  {{/if}}
18
32
  {{#if refusals.classes}}
19
33
  // TODO(domain): decide what "{{name.words}}" does to a {{aggregate.pascal}}: either it gives birth to one (keep `create`, pass the facts of `command` as value objects), or it changes an existing one (load it with `findById`, throw a not-found DomainError, call ONE intention method). The events it records leave with the save: nothing else to do here.
20
34
  {{/if}}
21
- const target = {{aggregate.pascal}}.create(this.ids.next(), this.clock.now());
35
+ const {{aggregate.camel}} = {{aggregate.pascal}}.create(this.ids.next(), this.clock.now());
22
36
 
23
- await this.{{aggregate.camel}}Repository.save(target);
37
+ await this.{{aggregate.camel}}Repository.save({{aggregate.camel}});
24
38
 
25
- return target.id;
39
+ return {{aggregate.camel}}.id;
26
40
  }
27
41
  }
28
42
  {{/if}}
29
43
  {{#unless command.hasAggregate}}
44
+ {{#if access.policy}}
45
+ import type { Access } from '@ddd-ts-kit/auth';
46
+ {{/if}}
30
47
  import type { CommandHandler } from '@ddd-ts-kit/kernel';
48
+ {{#if access.policy}}
49
+ {{access.useCasePermissionsImport}}
50
+ {{/if}}
31
51
  import type { {{name.pascal}}Command } from '{{alias.context}}/application/commands/{{name.kebab}}/{{name.kebab}}.command{{alias.ext}}';
32
52
 
33
53
  export class {{name.pascal}}Handler implements CommandHandler<{{name.pascal}}Command> {
54
+ {{#if access.policy}}
55
+ constructor(private readonly access: Access) {}
56
+
57
+ {{/if}}
34
58
  async execute(command: {{name.pascal}}Command): Promise<void> {
59
+ {{#if access.policy}}
60
+ // TODO(domain): a policy refines {{access.reference}}: ask it about the element "{{name.words}}" acts on once it is loaded, in place of `command`.
61
+ await this.access.authorize(command.actor, {{access.reference}}, command);
62
+
63
+ {{/if}}
35
64
  // TODO(domain): receive the repository of the aggregate "{{name.words}}" acts on in the constructor (rerun with --aggregate <Name> --force to get it wired), load or create the aggregate from `command`, call its intention method and save it (its events leave with the save); the unit of work is opened by the command bus.
36
65
  }
37
66
  }
@@ -5,10 +5,10 @@ import { {{name.pascal}}Command } from '{{alias.context}}/application/commands/{
5
5
  import { {{name.pascal}}Handler } from '{{alias.context}}/application/commands/{{name.kebab}}/{{name.kebab}}.handler{{alias.ext}}';
6
6
  @@registrations
7
7
  {{#if command.hasAggregate}}
8
- platform.commands.register({{name.pascal}}Command, new {{name.pascal}}Handler({{aggregate.camel}}Repository, platform.ids, platform.clock), { context: '{{context.kebab}}' });
8
+ platform.commands.register({{name.pascal}}Command, new {{name.pascal}}Handler({{aggregate.camel}}Repository, platform.ids, platform.clock{{#if access.policy}}, platform.access{{/if}}), { context: '{{context.kebab}}' });
9
9
  {{/if}}
10
10
  {{#unless command.hasAggregate}}
11
- platform.commands.register({{name.pascal}}Command, new {{name.pascal}}Handler(), { context: '{{context.kebab}}' });
11
+ platform.commands.register({{name.pascal}}Command, new {{name.pascal}}Handler({{#if access.policy}}platform.access{{/if}}), { context: '{{context.kebab}}' });
12
12
  {{/unless}}
13
13
  @@authorization
14
14
  {{access.manualDeclaration}}
@@ -1,4 +1,7 @@
1
1
  @@imports
2
+ {{#if access.policy}}
3
+ import { Access } from '@ddd-ts-kit/auth';
4
+ {{/if}}
2
5
  {{#if command.hasAggregate}}
3
6
  import { Clock, IdGenerator } from '@ddd-ts-kit/kernel';
4
7
  import { {{aggregate.pascal}}Repository } from '{{alias.context}}/domain/repositories/{{aggregate.kebab}}.repository{{alias.ext}}';
@@ -8,8 +11,8 @@ import { {{name.pascal}}Command } from '{{alias.context}}/application/commands/{
8
11
  import { {{name.pascal}}Handler } from '{{alias.context}}/application/commands/{{name.kebab}}/{{name.kebab}}.handler{{alias.ext}}';
9
12
  @@registrations
10
13
  {{#if command.hasAggregate}}
11
- builder.command({{name.pascal}}Command){{access.declaration}}.handledBy({{name.pascal}}Handler, [{{aggregate.pascal}}Repository, IdGenerator, Clock]);
14
+ builder.command({{name.pascal}}Command){{access.declaration}}.handledBy({{name.pascal}}Handler, [{{aggregate.pascal}}Repository, IdGenerator, Clock{{#if access.policy}}, Access{{/if}}]);
12
15
  {{/if}}
13
16
  {{#unless command.hasAggregate}}
14
- builder.command({{name.pascal}}Command){{access.declaration}}.handledBy({{name.pascal}}Handler);
17
+ builder.command({{name.pascal}}Command){{access.declaration}}.handledBy({{name.pascal}}Handler{{#if access.policy}}, [Access]{{/if}});
15
18
  {{/unless}}
@@ -90,7 +90,7 @@ export class {{name.pascal}}Controller {
90
90
  // TODO(domain): hand the criteria of the query over too, once the query schema declares them next to the page (a request mapper is their place); map each line to its public fields.
91
91
  const page = await this.queries.execute(new {{route.input}}(request.actor, request.query));
92
92
 
93
- return pageResponse(page, (item) => ({ id: item.id }));
93
+ return pageResponse(page, ({{search.element}}) => ({ id: {{search.element}}.id }));
94
94
  }
95
95
  }
96
96
  {{#if search.customSchema}}
@@ -1,7 +1,7 @@
1
1
  import { DomainEventHandler } from '@ddd-ts-kit/kernel/declarations';
2
2
  import { {{event.pascal}} } from '{{alias.context}}/domain/events/{{event.kebab}}.event{{alias.ext}}';
3
3
 
4
- @DomainEventHandler({{event.pascal}}, { name: {{event.reference}}{{#if handler.afterCommit}}, phase: 'after-commit'{{/if}} })
4
+ @DomainEventHandler({{event.pascal}}{{#if handler.afterCommit}}, { phase: 'after-commit' }{{/if}})
5
5
  export class {{event.pascal}}EventHandler implements DomainEventHandler<{{event.pascal}}> {
6
6
  async handle(event: {{event.pascal}}): Promise<void> {
7
7
  {{#unless handler.afterCommit}}
@@ -0,0 +1,46 @@
1
+ # {{project.name}}
2
+
3
+ A ddd-ts-kit project: one bounded context per directory of `{{config.contextsDir}}/`, each described by its `CONTEXT.md`. The plan and what is next: `docs/architecture/plan.md`, when the project follows the method.
4
+
5
+ ## Commands
6
+
7
+ - `npm run verify`: types, lint, format, tests with the coverage thresholds of `ddd-ts-kit.config.json` (per context and layer), architecture rules, import graph, dead code, documentation drift. Once, before a commit that closes a slice. A layer under its threshold gets the missing test, never an exclusion.
8
+ - `npx ddd-ts-kit check --changed-since <ref>`: the architecture rules on what changed; `npx ddd-ts-kit explain <rule-id>` gives the reason and an example.
9
+ - `npx ddd-ts-kit list --json`: the map of the contexts. `npx ddd-ts-kit describe <context> --json`: one context as data (use cases, routes, events, ports, dependencies).
10
+ - `npx ddd-ts-kit status`: the next step of the plan, the slices by status, the markers left per context. `npx ddd-ts-kit todo [<context>]`: each remaining `TODO(domain)` and `it.todo` as `file:line`.
11
+ - `npx ddd-ts-kit docs`: regenerates the context map and the generated sections of each `CONTEXT.md`; `npm run docs:generate` the OpenAPI contract, the forms and the event catalog.
12
+
13
+ ## Read less
14
+
15
+ 1. `describe <context> --json` and the `CONTEXT.md` of the context before the tree: do not browse `{{config.sourceRoot}}/` to learn what exists.
16
+ 2. Open only what the `next` list of a generator (`file:line`) or a violation names.
17
+ 3. `check --changed-since <ref>` and the tests of the context while iterating; `npm run verify` once at the end.
18
+
19
+ ## Rules by layer
20
+
21
+ One file per layer in `.claude/rules/`: `domain.md` (`domain/`, the shared kernel), `application.md`, `published-language.md`, `infrastructure.md`, `presentation.md` (and the OpenAPI contract), `platform.md` (`{{config.platformDir}}/`, `main.ts`, `apps/`{{#if style.explicit}}, module files{{/if}}), `tests.md` (specs, fakes, builders, `test/`). The same text is in `.github/instructions/<layer>.instructions.md`. Claude Code and GitHub Copilot load it with the files it applies to; an agent that does not (Codex) reads the file of a layer before it edits a file of that layer.
22
+
23
+ ## Generated files
24
+
25
+ Create every file of a role with `npx ddd-ts-kit generate <kind> ... --json`, then fill the `TODO(domain)` places it lists; never write one by hand, never restructure what a generator wrote.
26
+ {{#if assembly.barrel}}
27
+ Never edit `<context>.declarations.ts`: `generate`, `docs` and `npm run dev` rewrite it, from the role files and from the constructor signatures (it registers what each constructor is injected). After changing a constructor by hand, `npx ddd-ts-kit docs`.
28
+ {{/if}}
29
+ {{#if assembly.discovery}}
30
+ Never edit `<context>.dependencies.ts`: `generate`, `docs` and `npm run dev` rewrite it from the constructor signatures (it registers what each constructor is injected). After changing a constructor by hand, `npx ddd-ts-kit docs`.
31
+ {{/if}}
32
+ Never edit the contracts under `openapi/` (`openapi/openapi.yaml`, one file per document when `openapi.documents` splits it, the forms of `openapi/forms/`), `docs/integration/asyncapi.yaml`, `docs/integration/event-catalog.md`, `{{config.platformDir}}/http/openapi-documents.ts`, `.dependency-cruiser.cjs` or the generated sections of a `CONTEXT.md`: change the code or the config, then `npm run docs:generate`, `npx ddd-ts-kit docs` and `npx ddd-ts-kit depcruise-config --write`. `stored-events.lock.json` is written by `npx ddd-ts-kit docs --stored-events` once the shape of a version is final (`docs --check` fails while one is unrecorded), never by hand: a stored shape changes only by a new version with its upcaster (`event-sourcing/upcaster-required`).
33
+ {{#if sdk.on}}
34
+ {{sdk.instruction}}
35
+ {{/if}}
36
+ Imports: a file of the project is imported by its alias from the project root, never by a relative path, the same directory included: `{{alias.source}}/...` for `{{config.sourceRoot}}/`, `{{alias.test}}/...` for `test/`, `{{alias.scripts}}/...` for `scripts/`, {{#if alias.extensionless}}never ending in `.js` or `.ts`, and naming a file, never a directory{{/if}}{{#unless alias.extensionless}}always ending in `.js`{{/unless}} (`imports/alias-only`, `imports/extension`; `npm run lint:fix` rewrites a relative import and a wrong ending). The alias is declared once, under `paths` in `tsconfig.json`, from `importAlias` of `ddd-ts-kit.config.json`, and the ending follows `importExtension`: never add a second entry or mapping, never change `module` or `moduleResolution` in `tsconfig.json`, and never compile without `npm run build`, which rewrites the aliases of `dist/` into relative paths ending in `.js` for Node (`imports/alias-declared`).
37
+ Everywhere: one exported class, interface or function per file, named after it in kebab-case; at most 350 lines a file, 30 lines and 3 parameters a function; `private` members, never `#name`; a blank line before a `return` and around `if`, `for`, `try` (`npm run lint:fix`); braces around the body of every `if`, `else`, `for`, `while` and `do`, on its own lines: a branch is visible at a glance, and a statement added to it later cannot silently fall outside it. `npm run format` (Biome, line width 120) lays out every file: do not spend tokens on line breaks.
38
+
39
+ ## TypeScript
40
+
41
+ The compiler is the native TypeScript 7, installed as `@typescript/native`; `typescript` 6 is there for the tools that need its API (ESLint, dependency-cruiser). Use `npm run typecheck` and `npm run build`, never `npx tsc`, which would run version 6.
42
+
43
+ ## Workflow
44
+
45
+ Follow the recommended steps in order, the supported path (`README.md`, "Recommended steps"): discover the domain, bounded contexts, glossaries, context map, bootstrap, plan the slices, build slice by slice, quality gate, document. `npx ddd-ts-kit status` says where the project stands. When asked to skip a step, say which one and what it costs, and record it in `docs/architecture/plan.md`.
46
+ With the ddd-ts-kit plugin: `/ddd-ts-kit:start` for a new project or to resume one, `/ddd-ts-kit:glossary` before a new name, `/ddd-ts-kit:use-case` for a feature, `/ddd-ts-kit:document` for the contracts, `/ddd-ts-kit:quality-gate` before a pull or merge request. The plugin installs in Claude Code, Codex and the Copilot CLI from the marketplace `gbourgeat/ddd-ts-kit`; Codex calls a skill by its name, `$start`, `$use-case`.