@mpfrontend/nx-plugin 0.0.0-stage → 0.1.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 (116) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +87 -2
  3. package/dist/feature-generator.d.ts +7 -0
  4. package/dist/feature-generator.js +9 -0
  5. package/dist/feature-generator.js.map +1 -0
  6. package/dist/generator.d.ts +6 -0
  7. package/dist/generator.js +14 -0
  8. package/dist/generator.js.map +1 -0
  9. package/dist/index.d.ts +22 -0
  10. package/dist/index.js +46 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/nx-tree.d.ts +5 -0
  13. package/dist/nx-tree.js +12 -0
  14. package/dist/nx-tree.js.map +1 -0
  15. package/dist/package-generator.d.ts +8 -0
  16. package/dist/package-generator.js +9 -0
  17. package/dist/package-generator.js.map +1 -0
  18. package/dist/route-generator.d.ts +8 -0
  19. package/dist/route-generator.js +9 -0
  20. package/dist/route-generator.js.map +1 -0
  21. package/dist/scaffold.d.ts +96 -0
  22. package/dist/scaffold.js +227 -0
  23. package/dist/scaffold.js.map +1 -0
  24. package/dist/templates.d.ts +21 -0
  25. package/dist/templates.js +83 -0
  26. package/dist/templates.js.map +1 -0
  27. package/dist/workspace.d.ts +41 -0
  28. package/dist/workspace.js +213 -0
  29. package/dist/workspace.js.map +1 -0
  30. package/generators.json +24 -0
  31. package/package.json +37 -3
  32. package/schema.json +18 -0
  33. package/schemas/feature-schema.json +25 -0
  34. package/schemas/package-schema.json +28 -0
  35. package/schemas/route-schema.json +31 -0
  36. package/templates/feature/list/api/server/__resource__.ts.template +24 -0
  37. package/templates/feature/list/app/api/__resource__/route.ts.template +24 -0
  38. package/templates/feature/list/entities/__resource__/index.ts.template +12 -0
  39. package/templates/feature/list/entities/__resource__/model/__resource__-list.test.ts.template +23 -0
  40. package/templates/feature/list/entities/__resource__/model/__resource__-list.ts.template +24 -0
  41. package/templates/feature/list/entities/__resource__/model/__resource__.test.ts.template +17 -0
  42. package/templates/feature/list/entities/__resource__/model/__resource__.ts.template +19 -0
  43. package/templates/feature/list/features/__feature__/api/__feature__-read.ts.template +12 -0
  44. package/templates/feature/list/features/__feature__/api/__feature__.ts.template +28 -0
  45. package/templates/feature/list/features/__feature__/hooks/use-__feature__-list.ts.template +22 -0
  46. package/templates/feature/list/features/__feature__/index.ts.template +3 -0
  47. package/templates/feature/list/features/__feature__/model/__feature__-fields.ts.template +4 -0
  48. package/templates/feature/list/features/__feature__/model/overrides/index.ts.template +3 -0
  49. package/templates/feature/list/features/__feature__/ui/__feature__-detail-screen.tsx.template +16 -0
  50. package/templates/feature/list/features/__feature__/ui/__feature__-detail.test.tsx.template +28 -0
  51. package/templates/feature/list/features/__feature__/ui/__feature__-detail.tsx.template +44 -0
  52. package/templates/feature/list/features/__feature__/ui/__feature__-list.tsx.template +75 -0
  53. package/templates/feature/list/features/__feature__/ui/__feature__-screen.tsx.template +31 -0
  54. package/templates/feature/list/features/__feature__/utils/__feature__-href.test.ts.template +7 -0
  55. package/templates/feature/list/features/__feature__/utils/__feature__-href.ts.template +4 -0
  56. package/templates/feature/screen/features/__feature__/api/__feature__.ts.template +13 -0
  57. package/templates/feature/screen/features/__feature__/hooks/use-__feature__.ts.template +27 -0
  58. package/templates/feature/screen/features/__feature__/index.ts.template +3 -0
  59. package/templates/feature/screen/features/__feature__/model/__feature__.test.ts.template +12 -0
  60. package/templates/feature/screen/features/__feature__/model/__feature__.ts.template +12 -0
  61. package/templates/feature/screen/features/__feature__/ui/__feature__-panel.tsx.template +22 -0
  62. package/templates/feature/screen/features/__feature__/ui/__feature__-screen.tsx.template +15 -0
  63. package/templates/feature/screen/features/__feature__/ui/__feature__-view.test.tsx.template +25 -0
  64. package/templates/feature/screen/features/__feature__/ui/__feature__-view.tsx.template +38 -0
  65. package/templates/feature/screen/features/__feature__/utils/__feature__.test.ts.template +9 -0
  66. package/templates/feature/screen/features/__feature__/utils/__feature__.ts.template +6 -0
  67. package/templates/next/README.md.template +10 -0
  68. package/templates/next/docs/api-contracts.md.template +22 -0
  69. package/templates/next/docs/overview.md.template +67 -0
  70. package/templates/next/eslint.config.mjs.template +4 -0
  71. package/templates/next/ftg.config.json.template +11 -0
  72. package/templates/next/next-env.d.ts.template +2 -0
  73. package/templates/next/next.config.mjs.template +9 -0
  74. package/templates/next/package.json.template +27 -0
  75. package/templates/next/postcss.config.mjs.template +2 -0
  76. package/templates/next/prepare-runtime.mjs.template +11 -0
  77. package/templates/next/project.json.template +113 -0
  78. package/templates/next/src/api/server/transfer.test.ts.template +153 -0
  79. package/templates/next/src/api/server/transfer.ts.template +25 -0
  80. package/templates/next/src/app/api/access/route.ts.template +6 -0
  81. package/templates/next/src/app/api/docs/assets/[file]/route.ts.template +23 -0
  82. package/templates/next/src/app/api/docs/route.ts.template +8 -0
  83. package/templates/next/src/app/api/openapi/route.ts.template +12 -0
  84. package/templates/next/src/app/api/transfer/[...path]/route.ts.template +22 -0
  85. package/templates/next/src/app/components/page.tsx.template +32 -0
  86. package/templates/next/src/app/globals.css.template +32 -0
  87. package/templates/next/src/app/layout.tsx.template +53 -0
  88. package/templates/next/src/app/page.tsx.template +6 -0
  89. package/templates/next/src/app/providers.tsx.template +31 -0
  90. package/templates/next/src/config/access.ts.template +21 -0
  91. package/templates/next/src/config/app.ts.template +33 -0
  92. package/templates/next/src/config/server.ts.template +13 -0
  93. package/templates/next/src/features/preferences/api/preference-cookie.ts.template +14 -0
  94. package/templates/next/src/features/preferences/hooks/use-preferences.ts.template +30 -0
  95. package/templates/next/src/features/preferences/index.ts.template +3 -0
  96. package/templates/next/src/features/preferences/model/messages/en.ts.template +10 -0
  97. package/templates/next/src/features/preferences/model/messages.ts.template +13 -0
  98. package/templates/next/src/features/preferences/model/preferences.test.ts.template +32 -0
  99. package/templates/next/src/features/preferences/model/preferences.ts.template +22 -0
  100. package/templates/next/src/features/preferences/ui/preference-controls.tsx.template +50 -0
  101. package/templates/next/src/i18n/index.ts.template +13 -0
  102. package/templates/next/src/i18n/messages/en.ts.template +18 -0
  103. package/templates/next/src/i18n/server.ts.template +8 -0
  104. package/templates/next/src/theme/config.test.ts.template +9 -0
  105. package/templates/next/src/theme/config.ts.template +7 -0
  106. package/templates/next/src/theme/theme.css.template +8 -0
  107. package/templates/next/tsconfig.json.template +11 -0
  108. package/templates/package/README.md.template +10 -0
  109. package/templates/package/eslint.config.mjs.template +4 -0
  110. package/templates/package/package.json.template +15 -0
  111. package/templates/package/project.json.template +51 -0
  112. package/templates/package/src/index.ts.template +2 -0
  113. package/templates/package/src/package-name.test.ts.template +7 -0
  114. package/templates/package/src/package-name.ts.template +2 -0
  115. package/templates/package/tsconfig.json.template +7 -0
  116. package/templates/package/tsconfig.lib.json.template +9 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,88 @@
1
- # Temporary Holding Version
1
+ # @mpfrontend/nx-plugin
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Local development package. Runtime: tooling. Public API is exported from src/index.ts and compiled
4
+ into dist. Nx owns build, typecheck, lint and test targets. Consumer applications install packed artifacts.
5
+ See ../../docs/IMPLEMENTATION-STATUS.md for observed evidence and remaining work.
6
+
7
+ `createWorkspace`/`workspaceFiles` implement the CLI `init` shell. `createApplication`/`applicationFiles`
8
+ implement the application template. `createFeature`/`featureFiles`, `createRoute`/`routeFiles` and
9
+ `createPackage`/`packageFiles` implement `mpfrontend create feature|route|package`, and the Nx generators
10
+ `application`, `feature`, `route` and `package` in `generators.json` write the same files through the
11
+ Nx tree. The template's catalog example is the output of the feature generator (a list feature over the
12
+ generated `catalog` read) and of the route generator (`/catalog` and `/catalog/[position]`). These functions refuse existing destinations rather than
13
+ merging into user files. Creation is not a filesystem transaction: a write failure can leave an owned
14
+ partial **new** directory to inspect, never automatically delete or overwrite. Dry-run writes nothing.
15
+ Workspace initialization does not invent an API/DLS, authorization, runtime profile, Git history or
16
+ deployment. It records one explicit design-source mode: `none` (disabled/code-first) or `existing`
17
+ (pending consumer-owned DLS attachment). The MVP does not ship or require a public Figma DLS. No mode
18
+ reads or writes Figma. The independently installed packed CLI now creates the verification workspace itself;
19
+ the harness supplies only local unpublished-artifact overrides and an explicit synthetic API fixture.
20
+
21
+ `workspaceFiles` writes the quality profile of a new workspace: root `eslint.config.mjs` and
22
+ `prettier.config.mjs` that re-export `@mpfrontend/workspace-config`, a root `tsconfig.base.json` that
23
+ extends its base profile (the module boundary rule reads it), a `.prettierignore` for tool-owned,
24
+ hash-bound and generated files, `nx.json` target defaults with caching for `build`, `typecheck`, `lint`,
25
+ `test`, `format:check` and `catalog-check`, a `check` script (format check, then lint, typecheck, test,
26
+ build, generated-check and catalog-check of every project), the CI-neutral `tools/ci/check.sh` and a GitHub Actions workflow that
27
+ runs it. `applicationFiles` gives every app `format`, `format:check`, `lint` and `test` targets, an
28
+ `eslint.config.mjs` that spreads the workspace profile, a `tsconfig.json` that extends
29
+ `@mpfrontend/workspace-config/tsconfig/next.json`, a Tailwind CSS v4 PostCSS entry, and a global style
30
+ entry that holds only imports and base element rules. Every file that init writes, and every file that
31
+ create app writes through the workspace formatter, is in the shared format for the shortest and the
32
+ longest valid names, and the generated app passes the shared lint rules; all three are tested.
33
+
34
+ An existing workspace adopts the profile through the `mpfrontend-upgrade-project` procedure: create a
35
+ scratch workspace and app with the upgraded CLI outside the repository, copy the profile files and pinned
36
+ dependencies from it, add the four targets to each project, run `pnpm format` once in a separate
37
+ formatting-only change, and then make `pnpm check` pass without weakening a rule.
38
+
39
+ A feature is `src/features/<feature>/` with `ui/`, `model/`, `hooks/`, `api/`, `utils/` and an `index.ts`
40
+ public entry; a list feature also writes its entity in `src/entities/<resource>/` and its server boundary
41
+ in `src/api/server/<resource>.ts` when they do not exist, and keeps them when they do. A route is one
42
+ thin `page.tsx` that renders a feature screen with the route's base path. A package has the tags
43
+ `type:package`, `scope:shared` and `runtime:<runtime>`, a public entry and the quality targets. Every
44
+ generator validates names and paths, refuses an existing destination and formats its output with the
45
+ workspace's Prettier configuration (the CLI resolves Prettier from the workspace root; the Nx generators
46
+ use `formatFiles`). Generated contracts default to `src/api/generated/<contract>`; an existing app's
47
+ feature-local output stays valid. Init also writes `CODEOWNERS` with placeholder owners and
48
+ `.agents/skills/README.md`; create app writes `.env.example` (names only) and `docs/`. See
49
+ [the CLI guide](../../docs/CLI-GUIDE.md).
50
+
51
+ Every visible text of the application template is a catalog message: the app-wide set in
52
+ `src/i18n/messages/<locale>.ts` and one set per feature in `model/messages/<locale>.ts`. The template ships
53
+ English only (`en`, the default); the product adds its own locales, left to right or right to left, to the
54
+ registry in `src/config/app.ts` and a catalog per added locale to every set, or makes its own locale the
55
+ default and only locale. The app's `catalog-check` target runs `mpfrontend catalog check`. A generated
56
+ feature gets a catalog per locale of the app's registry, with the default locale's catalog as the base;
57
+ locales other than the default start with the default text and are reported as `untranslated`. A list
58
+ feature shows booleans with its own `yes` and `no` messages.
59
+
60
+ Upgrade note for the `ar` locale: the previous cohort shipped `ar` as a built-in locale, with its catalogs,
61
+ its core messages and its place in the Security BFF's default upstream locales. MP Frontend now ships
62
+ English only, so a product that keeps `ar` adds it in its own repository:
63
+
64
+ 1. Register it in the app's locale registry (`src/config/app.ts`): `ar: { direction: 'rtl' }`, with a
65
+ `numberingSystem` when its digits must differ from the Intl default.
66
+ 2. Keep or add `messages/ar.ts` in every catalog set, typed `Translation<typeof base>`, list it in the
67
+ `translations` of each set, and give it the text of every key the set uses, including the neutral keys
68
+ that the core messages no longer hold for it; then run the app's `catalog-check` target.
69
+ 3. In the Security BFF set `apiLocales: { supported: ['en', 'ar'], defaultLocale: 'en' }`. A BFF without
70
+ `apiLocales` now sends the default locale, `en`, upstream whatever the browser asks for. Add `ar` to
71
+ `supportedUiLocales` for the identity provider's pages and to `preferenceCookie.locales` (the app's
72
+ own preference cookie takes its locales from the registry).
73
+ 4. Pass the app's registry to `formatNumber` and `formatValue`, and the product's `labels` for booleans;
74
+ the built-in `locale`, `direction` and `translator` know English only.
75
+
76
+ The application template relays the BFF's streamed routes for uploads and downloads in
77
+ `src/app/api/transfer/[...path]/route.ts`, through `src/api/server/transfer.ts` and `createRelay` of
78
+ `@mpfrontend/presentation-server/relay`, as streams in both directions; its test sends and receives
79
+ 8 MiB through a fake BFF. `BFF_SESSION_COOKIE` names the session cookie it forwards.
80
+
81
+ The application template is framed by `@mpfrontend/app-layout` and compiles Tailwind CSS v4 with the UI
82
+ and shell outputs as sources. `src/app/globals.css` imports Tailwind, the neutral tokens, the component
83
+ styles and, last, the app theme `src/theme/theme.css`; it holds no class rule. Upgrade note: apps created
84
+ before this template keep their own `globals.css` with the `.mp-shell`, `.mp-controls`, `.mp-status` and
85
+ `.mp-alert` classes, which were template classes, not a contract of `@mpfrontend/ui`. Such an app adopts
86
+ the shell by adding `@mpfrontend/app-layout`, importing its CSS from the global stylesheet, wrapping the
87
+ layout in `AppFrame` and each screen in `PageFrame`, and replacing those classes with utility classes.
88
+ The `.mp-*` classes of the UI components are unchanged.
@@ -0,0 +1,7 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ /** `nx g @mpfrontend/nx-plugin:feature`: the same files as `mpfrontend create feature`. */
3
+ export default function featureGenerator(tree: Tree, options: {
4
+ app: string;
5
+ name: string;
6
+ resource?: string;
7
+ }): Promise<void>;
@@ -0,0 +1,9 @@
1
+ import { formatFiles } from '@nx/devkit';
2
+ import { planFeature } from './scaffold.js';
3
+ import { treeReader, writeTree } from './nx-tree.js';
4
+ /** `nx g @mpfrontend/nx-plugin:feature`: the same files as `mpfrontend create feature`. */
5
+ export default async function featureGenerator(tree, options) {
6
+ writeTree(tree, (await planFeature(treeReader(tree), options)).files);
7
+ await formatFiles(tree);
8
+ }
9
+ //# sourceMappingURL=feature-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature-generator.js","sourceRoot":"","sources":["../src/feature-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACrD,2FAA2F;AAC3F,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAS,EAAC,OAAiD;IACxG,SAAS,CAAC,IAAI,EAAC,CAAC,MAAM,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,EAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACpE,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ /** `nx g @mpfrontend/nx-plugin:application`: the same files as `mpfrontend create app`. */
3
+ export default function applicationGenerator(tree: Tree, options: {
4
+ name: string;
5
+ directory: string;
6
+ }): Promise<void>;
@@ -0,0 +1,14 @@
1
+ import { formatFiles } from '@nx/devkit';
2
+ import { applicationFiles } from './index.js';
3
+ import { writeTree } from './nx-tree.js';
4
+ /** `nx g @mpfrontend/nx-plugin:application`: the same files as `mpfrontend create app`. */
5
+ export default async function applicationGenerator(tree, options) {
6
+ if (!options.directory || options.directory.startsWith('/') || options.directory.split('/').includes('..'))
7
+ throw new Error('INVALID_DIRECTORY');
8
+ const files = await applicationFiles(options.name);
9
+ if (tree.exists(options.directory) || Object.keys(files).some(path => tree.exists(options.directory + '/' + path)))
10
+ throw new Error('DESTINATION_EXISTS');
11
+ writeTree(tree, Object.fromEntries(Object.entries(files).map(([path, content]) => [options.directory + '/' + path, content])));
12
+ await formatFiles(tree);
13
+ }
14
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../src/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,2FAA2F;AAC3F,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAAS,EAAC,OAAsC;IACjG,IAAG,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAC,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC/I,MAAM,KAAK,GAAC,MAAM,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,IAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,IAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAA,EAAE,CAAA,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,GAAC,GAAG,GAAC,IAAI,CAAC,CAAC;QAAC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAChJ,SAAS,CAAC,IAAI,EAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAC,OAAO,CAAC,EAAC,EAAE,CAAA,CAAC,OAAO,CAAC,SAAS,GAAC,GAAG,GAAC,IAAI,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACtH,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { type Formatter } from './templates.js';
2
+ export { createWorkspace, workspaceFiles, type DesignSource, type WorkspaceOptions } from './workspace.js';
3
+ export { featureFiles, routeFiles, packageFiles, planFeature, planRoute, planPackage, createFeature, createRoute, createPackage, diskReader, type FeatureKind, type FeatureRequest, type RouteRequest, type PackageRequest, type PackageRuntime, type CreateOptions, type Plan, type WorkspaceReader } from './scaffold.js';
4
+ export { workspaceFormatter, type Formatter } from './templates.js';
5
+ export type ApplicationOptions = {
6
+ name: string;
7
+ directory: string;
8
+ dryRun?: boolean;
9
+ formatter?: Formatter;
10
+ };
11
+ /**
12
+ * The application template. Its catalog example is produced by the feature generator (a list feature over
13
+ * the generated `catalog` read) and its two screens by the route generator: one list route and one detail route.
14
+ */
15
+ export declare function applicationFiles(name: string): Promise<Record<string, string>>;
16
+ export declare function createApplication(options: ApplicationOptions): Promise<{
17
+ ok: boolean;
18
+ name: string;
19
+ files: string[];
20
+ dryRun: boolean;
21
+ formatted: boolean;
22
+ }>;
package/dist/index.js ADDED
@@ -0,0 +1,46 @@
1
+ import { mkdir, lstat } from 'node:fs/promises';
2
+ import { resolve, dirname } from 'node:path';
3
+ import { templateFiles, workspaceFormatter, writeNew } from './templates.js';
4
+ import { featureFiles, routeFiles } from './scaffold.js';
5
+ export { createWorkspace, workspaceFiles } from './workspace.js';
6
+ export { featureFiles, routeFiles, packageFiles, planFeature, planRoute, planPackage, createFeature, createRoute, createPackage, diskReader } from './scaffold.js';
7
+ export { workspaceFormatter } from './templates.js';
8
+ /** Names only: values are deployment configuration and never belong in the repository. */
9
+ const envExample = '# Environment variables this app reads. Supply values from the deployment, never from this file.\nBFF_ORIGIN=\nBFF_SESSION_COOKIE=\nENABLE_API_DOCS=\n';
10
+ /**
11
+ * The application template. Its catalog example is produced by the feature generator (a list feature over
12
+ * the generated `catalog` read) and its two screens by the route generator: one list route and one detail route.
13
+ */
14
+ export async function applicationFiles(name) {
15
+ if (!/^[a-z][a-z0-9-]{1,48}$/.test(name))
16
+ throw new Error('INVALID_APP_NAME');
17
+ // The template's own files come last; its example feature is used exactly as generated.
18
+ return {
19
+ ...await featureFiles('catalog', { resource: 'catalog', operationId: 'listCatalog', generatedOutput: 'src/api/generated/catalog' }),
20
+ ...routeFiles('catalog', 'catalog', 'CatalogScreen'),
21
+ ...routeFiles('catalog/[position]', 'catalog', 'CatalogDetailScreen'),
22
+ ...await templateFiles('next', { __APP_NAME__: name }),
23
+ '.env.example': envExample,
24
+ };
25
+ }
26
+ export async function createApplication(options) {
27
+ const directory = resolve(options.directory);
28
+ try {
29
+ await lstat(directory);
30
+ throw new Error('DESTINATION_EXISTS');
31
+ }
32
+ catch (error) {
33
+ if (error.code !== 'ENOENT')
34
+ throw error;
35
+ }
36
+ const files = await applicationFiles(options.name);
37
+ let formatted = false;
38
+ if (!options.dryRun) {
39
+ // Exclusive creation of the app directory refuses a competing creator; files are formatted by the
40
+ // workspace formatter found above the new app, when there is one.
41
+ await mkdir(directory, { recursive: false });
42
+ formatted = await writeNew(directory, files, options.formatter ?? await workspaceFormatter(dirname(dirname(directory))));
43
+ }
44
+ return { ok: true, name: options.name, files: Object.keys(files).sort(), dryRun: options.dryRun === true, formatted };
45
+ }
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,QAAQ,EAAkB,MAAM,gBAAgB,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAC,eAAe,EAAC,cAAc,EAAyC,MAAM,gBAAgB,CAAC;AACtG,OAAO,EAAC,YAAY,EAAC,UAAU,EAAC,YAAY,EAAC,WAAW,EAAC,SAAS,EAAC,WAAW,EAAC,aAAa,EAAC,WAAW,EAAC,aAAa,EAAC,UAAU,EACkB,MAAM,eAAe,CAAC;AACzK,OAAO,EAAC,kBAAkB,EAAgB,MAAM,gBAAgB,CAAC;AAEjE,0FAA0F;AAC1F,MAAM,UAAU,GAAC,wJAAwJ,CAAC;AAC1K;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAW;IAChD,IAAG,CAAC,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAC5E,wFAAwF;IACxF,OAAO;QACL,GAAG,MAAM,YAAY,CAAC,SAAS,EAAC,EAAC,QAAQ,EAAC,SAAS,EAAC,WAAW,EAAC,aAAa,EAAC,eAAe,EAAC,2BAA2B,EAAC,CAAC;QAC3H,GAAG,UAAU,CAAC,SAAS,EAAC,SAAS,EAAC,eAAe,CAAC;QAClD,GAAG,UAAU,CAAC,oBAAoB,EAAC,SAAS,EAAC,qBAAqB,CAAC;QACnE,GAAG,MAAM,aAAa,CAAC,MAAM,EAAC,EAAC,YAAY,EAAC,IAAI,EAAC,CAAC;QAClD,cAAc,EAAC,UAAU;KAC1B,CAAC;AACJ,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAA0B;IAChE,MAAM,SAAS,GAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3C,IAAI,CAAC;QAAA,MAAM,KAAK,CAAC,SAAS,CAAC,CAAC;QAAA,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAAA,CAAC;IAAA,OAAM,KAAK,EAAC,CAAC;QAAA,IAAI,KAA+B,CAAC,IAAI,KAAG,QAAQ;YAAC,MAAM,KAAK,CAAC;IAAA,CAAC;IACjJ,MAAM,KAAK,GAAC,MAAM,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,IAAI,SAAS,GAAC,KAAK,CAAC;IACpB,IAAG,CAAC,OAAO,CAAC,MAAM,EAAC,CAAC;QAClB,kGAAkG;QAClG,kEAAkE;QAClE,MAAM,KAAK,CAAC,SAAS,EAAC,EAAC,SAAS,EAAC,KAAK,EAAC,CAAC,CAAC;QACzC,SAAS,GAAC,MAAM,QAAQ,CAAC,SAAS,EAAC,KAAK,EAAC,OAAO,CAAC,SAAS,IAAE,MAAM,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACrH,CAAC;IACD,OAAO,EAAC,EAAE,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,CAAC,IAAI,EAAC,KAAK,EAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAC,MAAM,EAAC,OAAO,CAAC,MAAM,KAAG,IAAI,EAAC,SAAS,EAAC,CAAC;AAC5G,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { Tree } from '@nx/devkit';
2
+ import type { WorkspaceReader } from './scaffold.js';
3
+ export declare function treeReader(tree: Tree): WorkspaceReader;
4
+ /** Writes only new files; an existing file in the tree is a collision, never an overwrite. */
5
+ export declare function writeTree(tree: Tree, files: Record<string, string>): void;
@@ -0,0 +1,12 @@
1
+ export function treeReader(tree) {
2
+ return { exists: async (path) => tree.exists(path), read: async (path) => tree.exists(path) ? tree.read(path, 'utf-8') ?? undefined : undefined };
3
+ }
4
+ /** Writes only new files; an existing file in the tree is a collision, never an overwrite. */
5
+ export function writeTree(tree, files) {
6
+ for (const path of Object.keys(files))
7
+ if (tree.exists(path))
8
+ throw new Error('DESTINATION_EXISTS');
9
+ for (const [path, content] of Object.entries(files))
10
+ tree.write(path, content);
11
+ }
12
+ //# sourceMappingURL=nx-tree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nx-tree.js","sourceRoot":"","sources":["../src/nx-tree.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,UAAU,CAAC,IAAS;IAClC,OAAO,EAAC,MAAM,EAAC,KAAK,EAAC,IAAI,EAAA,EAAE,CAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAC,IAAI,EAAC,KAAK,EAAC,IAAI,EAAA,EAAE,CAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA,CAAC,CAAA,IAAI,CAAC,IAAI,CAAC,IAAI,EAAC,OAAO,CAAC,IAAE,SAAS,CAAA,CAAC,CAAA,SAAS,EAAC,CAAC;AAChI,CAAC;AACD,8FAA8F;AAC9F,MAAM,UAAU,SAAS,CAAC,IAAS,EAAC,KAA2B;IAC7D,KAAI,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;QAAC,IAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YAAC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAChG,KAAI,MAAM,CAAC,IAAI,EAAC,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAC,OAAO,CAAC,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ import { type PackageRuntime } from './scaffold.js';
3
+ /** `nx g @mpfrontend/nx-plugin:package`: the same files as `mpfrontend create package`. */
4
+ export default function packageGenerator(tree: Tree, options: {
5
+ name: string;
6
+ directory?: string;
7
+ runtime?: PackageRuntime;
8
+ }): Promise<void>;
@@ -0,0 +1,9 @@
1
+ import { formatFiles } from '@nx/devkit';
2
+ import { planPackage } from './scaffold.js';
3
+ import { treeReader, writeTree } from './nx-tree.js';
4
+ /** `nx g @mpfrontend/nx-plugin:package`: the same files as `mpfrontend create package`. */
5
+ export default async function packageGenerator(tree, options) {
6
+ writeTree(tree, (await planPackage(treeReader(tree), options)).files);
7
+ await formatFiles(tree);
8
+ }
9
+ //# sourceMappingURL=package-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-generator.js","sourceRoot":"","sources":["../src/package-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,WAAW,EAAuB,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACrD,2FAA2F;AAC3F,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAS,EAAC,OAA+D;IACtH,SAAS,CAAC,IAAI,EAAC,CAAC,MAAM,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,EAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACpE,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ /** `nx g @mpfrontend/nx-plugin:route`: the same file as `mpfrontend create route`. */
3
+ export default function routeGenerator(tree: Tree, options: {
4
+ app: string;
5
+ path: string;
6
+ feature: string;
7
+ screen?: string;
8
+ }): Promise<void>;
@@ -0,0 +1,9 @@
1
+ import { formatFiles } from '@nx/devkit';
2
+ import { planRoute } from './scaffold.js';
3
+ import { treeReader, writeTree } from './nx-tree.js';
4
+ /** `nx g @mpfrontend/nx-plugin:route`: the same file as `mpfrontend create route`. */
5
+ export default async function routeGenerator(tree, options) {
6
+ writeTree(tree, (await planRoute(treeReader(tree), options)).files);
7
+ await formatFiles(tree);
8
+ }
9
+ //# sourceMappingURL=route-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-generator.js","sourceRoot":"","sources":["../src/route-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACrD,sFAAsF;AACtF,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,cAAc,CAAC,IAAS,EAAC,OAA8D;IACnH,SAAS,CAAC,IAAI,EAAC,CAAC,MAAM,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAClE,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,96 @@
1
+ import { type Formatter } from './templates.js';
2
+ /** Read access to a workspace: the disk for the CLI, the Nx tree for Nx generators. Paths are workspace-relative. */
3
+ export type WorkspaceReader = Readonly<{
4
+ exists: (path: string) => Promise<boolean>;
5
+ read: (path: string) => Promise<string | undefined>;
6
+ }>;
7
+ export declare function diskReader(root: string): WorkspaceReader;
8
+ /** Files to create, workspace-relative, and shared files that already exist and are kept as they are. */
9
+ export type Plan = Readonly<{
10
+ files: Record<string, string>;
11
+ kept: string[];
12
+ untranslated?: string[];
13
+ }>;
14
+ /** The locales of an app: the base catalog is the default locale's. */
15
+ export type AppLocales = Readonly<{
16
+ defaultLocale: string;
17
+ locales: readonly string[];
18
+ }>;
19
+ /** The application template ships English only; a product adds its own locales to its registry. */
20
+ export declare const TEMPLATE_LOCALES: AppLocales;
21
+ /** Reads the registry of `src/config/app.ts` as the application template writes it. */
22
+ export declare function readAppLocales(source: string): AppLocales | undefined;
23
+ /**
24
+ * The catalog set of a feature: one module per app locale under `model/messages/`, and `model/messages.ts`.
25
+ * The base locale holds the starter text; every other locale starts with the same text, to be translated.
26
+ */
27
+ export declare function messageFiles(directory: string, base: Readonly<Record<string, string>>, locales: AppLocales, depth: number): Record<string, string>;
28
+ export type FeatureKind = 'screen' | 'list';
29
+ /**
30
+ * Files of a feature, relative to the app directory. Without a resource it is a `screen` feature: a view, a
31
+ * hook, a model, a request boundary and a helper. With a resource of the app's `ftg.config.json` it is a
32
+ * `list` feature: a URL-driven list and detail over that generated read, its entity and its server boundary.
33
+ */
34
+ export declare function featureFiles(name: string, options?: {
35
+ resource?: string;
36
+ operationId?: string;
37
+ generatedOutput?: string;
38
+ locales?: AppLocales;
39
+ }): Promise<Record<string, string>>;
40
+ export type FeatureRequest = Readonly<{
41
+ app: string;
42
+ name: string;
43
+ resource?: string;
44
+ }>;
45
+ export declare function planFeature(reader: WorkspaceReader, request: FeatureRequest): Promise<Plan>;
46
+ /** One Next.js route per screen: a thin page that renders a feature screen with the route's base path. */
47
+ export declare function routeFiles(path: string, feature: string, screen: string): Record<string, string>;
48
+ export type RouteRequest = Readonly<{
49
+ app: string;
50
+ path: string;
51
+ feature: string;
52
+ screen?: string;
53
+ }>;
54
+ export declare function planRoute(reader: WorkspaceReader, request: RouteRequest): Promise<Plan>;
55
+ export type PackageRuntime = 'universal' | 'client' | 'server';
56
+ /** A shared package: tags, a public entry, a build to dist and the quality targets of the workspace. */
57
+ export declare function packageFiles(name: string, scope: string, directory: string, runtime?: PackageRuntime): Promise<Record<string, string>>;
58
+ export type PackageRequest = Readonly<{
59
+ name: string;
60
+ directory?: string;
61
+ runtime?: PackageRuntime;
62
+ }>;
63
+ export declare function planPackage(reader: WorkspaceReader, request: PackageRequest): Promise<Plan>;
64
+ export type CreateOptions = Readonly<{
65
+ dryRun?: boolean;
66
+ root?: string;
67
+ formatter?: Formatter;
68
+ }>;
69
+ export declare function createFeature(request: FeatureRequest & CreateOptions): Promise<{
70
+ dryRun: boolean;
71
+ formatted: boolean;
72
+ untranslated?: string[];
73
+ files: string[];
74
+ kept: string[];
75
+ ok: boolean;
76
+ kind: FeatureKind;
77
+ name: string;
78
+ }>;
79
+ export declare function createRoute(request: RouteRequest & CreateOptions): Promise<{
80
+ dryRun: boolean;
81
+ formatted: boolean;
82
+ untranslated?: string[];
83
+ files: string[];
84
+ kept: string[];
85
+ ok: boolean;
86
+ path: string;
87
+ }>;
88
+ export declare function createPackage(request: PackageRequest & CreateOptions): Promise<{
89
+ dryRun: boolean;
90
+ formatted: boolean;
91
+ untranslated?: string[];
92
+ files: string[];
93
+ kept: string[];
94
+ ok: boolean;
95
+ name: string;
96
+ }>;