@domain-first/project-structure 8.10.1 → 8.12.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 (58) hide show
  1. package/README.md +17 -7
  2. package/dist/287.js +406 -788
  3. package/dist/364.js +79 -0
  4. package/dist/38.js +31 -14
  5. package/dist/561.js +179 -96
  6. package/dist/783.js +1147 -0
  7. package/dist/{201.js → 878.js} +465 -2
  8. package/dist/agent-cli.d.ts +17 -6
  9. package/dist/agent-requests.d.ts +82 -8
  10. package/dist/config-file.d.ts +25 -1
  11. package/dist/frontend-cli.d.ts +3 -0
  12. package/dist/frontend-modules.d.ts +14 -0
  13. package/dist/graph.cjs +125 -5
  14. package/dist/graph.js +1 -1
  15. package/dist/index.cjs +3545 -2930
  16. package/dist/index.js +1 -1
  17. package/dist/init.cjs +368 -83
  18. package/dist/init.js +1 -1
  19. package/dist/integration.cjs +3545 -2930
  20. package/dist/integration.js +1 -1
  21. package/dist/integrations/openapi.d.ts +19 -2
  22. package/dist/integrations/orval.d.ts +31 -4
  23. package/dist/integrations/rest-endpoint-generator.d.ts +11 -7
  24. package/dist/integrations/storybook.d.ts +19 -1
  25. package/dist/lint.cjs +159 -22
  26. package/dist/lint.js +2 -2
  27. package/dist/page-router.d.ts +18 -0
  28. package/dist/react-module-move.d.ts +47 -14
  29. package/dist/react.cjs +1645 -999
  30. package/dist/react.js +2 -102
  31. package/dist/rest-adapters.d.ts +13 -0
  32. package/dist/svelte-agent-cli.spec.d.ts +1 -0
  33. package/dist/svelte.cjs +7373 -0
  34. package/dist/svelte.d.ts +2 -0
  35. package/dist/svelte.js +3 -0
  36. package/dist/sveltekit-app.d.ts +7 -0
  37. package/dist/upgrade-steps.d.ts +6 -1
  38. package/dist/upgrade-svelte.d.ts +15 -0
  39. package/dist/upgrade-svelte.spec.d.ts +1 -0
  40. package/dist/upgrade.cjs +307 -42
  41. package/dist/upgrade.js +132 -13
  42. package/dist/use-cases/add-integration.d.ts +1 -1
  43. package/dist/use-cases/delete-react-module.d.ts +4 -4
  44. package/dist/use-cases/index.d.ts +1 -0
  45. package/dist/use-cases/move-react-module.d.ts +2 -2
  46. package/dist/use-cases/rest-endpoint-generator.d.ts +6 -4
  47. package/dist/use-cases/scaffold-svelte-modules.d.ts +27 -0
  48. package/package.json +2 -1
  49. package/skills/df-ps-implement/SKILL.md +3 -3
  50. package/skills/df-ps-plan-feature/SKILL.md +1 -1
  51. package/skills/df-ps-scaffold/SKILL.md +9 -8
  52. package/skills/df-ps-scaffold/references/agent-mode.md +1 -1
  53. package/skills/df-ps-scaffold/references/agent-operations.md +8 -4
  54. package/skills/df-ps-scaffold/references/generators.md +1 -1
  55. package/skills/df-ps-scaffold/references/work-plan.md +1 -1
  56. package/skills/df-ps-svelte/SKILL.md +54 -0
  57. package/skills/df-ps-svelte/references/generators.md +56 -0
  58. package/dist/115.js +0 -615
package/README.md CHANGED
@@ -29,7 +29,7 @@ The full technical specification lives in [API.md](./API.md).
29
29
 
30
30
  ### Non-interactive mode for agents
31
31
 
32
- `df-scaffold`, `df-react` and `df-integration` accept JSON requests. Humans can keep using the interactive menus. Agents can discover schemas and project IDs first:
32
+ `df-scaffold`, `df-react`, `df-svelte` and `df-integration` accept JSON requests. Humans can keep using the interactive menus. Agents can discover schemas and project IDs first:
33
33
 
34
34
  ```bash
35
35
  npx df-scaffold --describe
@@ -53,7 +53,7 @@ npx df-init --section backend
53
53
  npx df-init --section frontend
54
54
  ```
55
55
 
56
- Project asks for the source folder. Backend asks for the `@domain-first` packages, the [`envBranchedWire` branches](#how-to-switch-implementations) with `wire`, shared in-memory DB and testing library, then adds the required Shared Kernel files. With `@domain-first/handlers-rest`, it adds the [endpoint generator](#how-to-add-a-rest-endpoint). Frontend offers **React** or **Next.js**, then Storybook. Enabling Storybook runs the existing React + Vite integration: it creates `.storybook` configs, package scripts and the build-output `.gitignore` entry. Selecting Next.js with a configured backend asks **Use @domain-first/handlers-next for REST endpoints** once. Yes adds `handlers-rest` to the backend packages if needed, connects `nextAdapter` and creates the catch-all route. This works before `next` is installed. With backend deferred, REST setup waits until backend configuration. Missing packages are printed as an install command; nothing is installed automatically.
56
+ Project asks for the source folder. Backend asks for the `@domain-first` packages, the [`envBranchedWire` branches](#how-to-switch-implementations) with `wire`, shared in-memory DB and testing library, then adds the required Shared Kernel files. With `@domain-first/handlers-rest`, it adds the [endpoint generator](#how-to-add-a-rest-endpoint). Frontend offers **React**, **Next.js**, **Svelte** or **SvelteKit**, then Storybook. Enabling Storybook runs the existing React + Vite integration: it creates `.storybook` configs, package scripts and the build-output `.gitignore` entry. Selecting Next.js with a configured backend asks **Use @domain-first/handlers-next for REST endpoints** once. Yes adds `handlers-rest` to the backend packages if needed, connects `nextAdapter` and creates the catch-all route. SvelteKit asks **Use @domain-first/handlers-svelte for REST endpoints** the same way: `svelteAdapter` and `src/routes/api/[...path]/+server.ts` with `svelteEndpoints`. This works before `next` is installed. With backend deferred, REST setup waits until backend configuration. Missing packages are printed as an install command; nothing is installed automatically.
57
57
 
58
58
  All settings and saved implementation types live in `domain-first.project-structure.config.json`:
59
59
 
@@ -99,7 +99,7 @@ All settings and saved implementation types live in `domain-first.project-struct
99
99
  }
100
100
  ```
101
101
 
102
- Commit the config to share it with your team. Rerunning `df-init` offers **Project**, **Backend**, **Frontend** and **All sections**, using current values as defaults. A single-section update keeps the other sections and saved choices. Backend setup writes all standard dependency lists and enabled lint checks into `backend.rules`, so they can be edited directly. On reconfiguration, only missing rules are filled; existing lists, `add`/`remove` patches and disabled checks are preserved. Backend setup preserves existing support files and restores missing ones. Changing the source folder affects future generation; existing source is not moved. React is enabled by the presence of `frontend.react`; its `framework` is `react` or `next`, so Next.js uses the same React generators. Frontend selection is prefilled from the saved value, falling back to Next.js when `next` is declared in `package.json`. Both choices use `@storybook/react-vite` from the Storybook integration; there is no separate Storybook framework prompt. Framework settings remain grouped under `frontend.<framework>`.
102
+ Commit the config to share it with your team. Rerunning `df-init` offers **Project**, **Backend**, **Frontend** and **All sections**, using current values as defaults. A single-section update keeps the other sections and saved choices. Backend setup writes all standard dependency lists and enabled lint checks into `backend.rules`, so they can be edited directly. On reconfiguration, only missing rules are filled; existing lists, `add`/`remove` patches and disabled checks are preserved. Backend setup preserves existing support files and restores missing ones. Changing the source folder affects future generation; existing source is not moved. React is enabled by the presence of `frontend.react`; its `framework` is `react` or `next`, so Next.js uses the same React generators. Frontend selection is prefilled from the saved value, falling back to Next.js when `next` is declared in `package.json`. Both choices use `@storybook/react-vite` from the Storybook integration; there is no separate Storybook framework prompt. Svelte is enabled by `frontend.svelte` the same way: its `framework` is `svelte` or `sveltekit`, both use `df-svelte`, and stories use `@storybook/svelte-vite` or `@storybook/sveltekit`. A project has one of the two sections; selecting the other framework replaces it. Framework settings remain grouped under `frontend.<framework>`.
103
103
 
104
104
  A config of an earlier major version is not read: commands stop and ask you to run [`df-upgrade`](#how-to-upgrade-to-a-new-major-version). An absent backend or React section produces a message pointing to the corresponding `df-init --section` command. Initialization and configuration are performed by the project owner; agent skills only read these settings and ask the owner to configure missing sections.
105
105
 
@@ -274,9 +274,19 @@ With Next.js, a new page also gets its App Router route, `app/admin/panel/users/
274
274
 
275
275
  **Move or rename page** and **Move or rename widget** move the files and update every import in the project. **Delete page** and **Delete widget** remove them once nothing imports them, a Next.js page's own route included if you say so. UI-kit components and shared hooks can be moved, renamed and deleted the same way. With Next.js, moving a page also offers to move its route, `app/admin/users/` → `app/backoffice/users/`, since its URL changes with it.
276
276
 
277
+ ### How to scaffold Svelte modules
278
+
279
+ With `frontend.svelte` configured (Svelte or SvelteKit), run `npx df-svelte`: the same pages, widgets and UI-kit components as `df-react`, written as Svelte 5 components with runes into `presentation/svelte`. Svelte has no hooks: reusable logic is a shared model, `shared/model/create-<name>.svelte.ts`, and a widget's UI model is `model/create-<name>-ui-model.svelte.ts`, which returns getters so the UI follows the props. Components export their props types from `<script lang="ts" module>`, and stories follow `@storybook/svelte-vite` or `@storybook/sveltekit`.
280
+
281
+ ```text
282
+ admin/panel/users → pages/admin/panel/admin-panel-users-page.svelte (AdminPanelUsersPage)
283
+ ```
284
+
285
+ With SvelteKit, a new page also gets its route, `src/routes/admin/panel/users/+page.svelte`, which renders `AdminPanelUsersPage`. Moving and deleting work as in `df-react`, and a SvelteKit page's route folder can follow the page.
286
+
277
287
  ### How to add tooling
278
288
 
279
- Run `npx df-integration` to configure one or several of the REST endpoint generator, the shared in-memory DB, Storybook, Prisma 8, Drizzle, Vitest, Playwright, integration tests on PostgreSQL in Testcontainers, OpenAPI generation or an Orval API client (typed client and React Query hooks). Integrations add config files, package scripts and `.gitignore` entries, then print one install command to copy. Nothing is installed or run for you.
289
+ Run `npx df-integration` to configure one or several of the REST endpoint generator, the shared in-memory DB, Storybook, Prisma 8, Drizzle, Vitest, Playwright, integration tests on PostgreSQL in Testcontainers, OpenAPI generation or an Orval API client (typed client and React Query or Svelte Query hooks). Integrations add config files, package scripts and `.gitignore` entries, then print one install command to copy. Nothing is installed or run for you.
280
290
 
281
291
  The endpoint generator and the in-memory DB are what `df-init` scaffolds; as integrations they add them later or restore missing files, and never overwrite existing ones.
282
292
 
@@ -288,13 +298,13 @@ With Testcontainers, the CLI asks which implementation types get integration tes
288
298
  npx df-lint
289
299
  ```
290
300
 
291
- It reports what breaks the Domain-First rules: forbidden imports between bounded contexts, imports against the layers, modules using kinds the dependency rules don't allow (in imports and in wiring), React modules importing what they shouldn't, and reading the time or environment variables without the clock and config ports. It exits with 1 when something is found, so you can run it in CI.
301
+ It reports what breaks the Domain-First rules: forbidden imports between bounded contexts, imports against the layers, modules using kinds the dependency rules don't allow (in imports and in wiring), React and Svelte modules importing what they shouldn't, and reading the time or environment variables without the clock and config ports. It exits with 1 when something is found, so you can run it in CI.
292
302
 
293
303
  `df-init` scaffolds all standard rules into `backend.rules` during backend setup. Teams can edit these entries directly: what each kind of module may depend on (`backend.rules.dependencies`) and which checks run (`backend.rules.lint`). `df-scaffold` offers dependencies by the same rules. For older or manually shortened configs without `backend.rules`, the defaults apply and every check runs; kinds and checks you don't mention keep their defaults.
294
304
 
295
305
  - Kinds in `backend.rules.dependencies` (as keys and in lists): `repositories`, `domain-services`, `application-ports`, `application-services`, `use-cases`, `commands`, `queries`, `infrastructure-services`, `presentation-services`.
296
306
  - A kind's value: a list that replaces its defaults, or `{ "add": [...], "remove": [...] }`.
297
- - Checks in `backend.rules.lint`: `context-isolation`, `shared-kernel`, `layers`, `dependencies`, `react`, `clock`, `config`.
307
+ - Checks in `backend.rules.lint`: `context-isolation`, `shared-kernel`, `layers`, `dependencies`, `react`, `svelte`, `clock`, `config`.
298
308
 
299
309
  Defaults and details: [Dependency rules](API.md#dependency-rules), [`df-lint`](API.md#df-lint).
300
310
 
@@ -343,7 +353,7 @@ From 7.x it splits the config into `project`, `backend` and `frontend`, records
343
353
 
344
354
  ### How to teach your coding agent
345
355
 
346
- The package ships skills that teach coding agents to plan features, scaffold with `df-scaffold`, build the React part with `df-react` and implement the generated code.
356
+ The package ships skills that teach coding agents to plan features, scaffold with `df-scaffold`, build the React part with `df-react` or the Svelte part with `df-svelte` and implement the generated code.
347
357
 
348
358
  ```
349
359
  npx df-skills --claude