@sdxc/kit 0.0.0-pre.1

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 (144) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +93 -0
  3. package/config.schema.json +89 -0
  4. package/dist/bin.d.ts +9 -0
  5. package/dist/bin.js +10 -0
  6. package/dist/cli.d.ts +33 -0
  7. package/dist/cli.js +58 -0
  8. package/dist/commands/create.d.ts +20 -0
  9. package/dist/commands/create.js +164 -0
  10. package/dist/commands/init.d.ts +16 -0
  11. package/dist/commands/init.js +27 -0
  12. package/dist/commands/make.d.ts +335 -0
  13. package/dist/commands/make.js +152 -0
  14. package/dist/commands/run.d.ts +23 -0
  15. package/dist/commands/run.js +51 -0
  16. package/dist/commands/ui/add.d.ts +23 -0
  17. package/dist/commands/ui/add.js +50 -0
  18. package/dist/commands/ui/diff.d.ts +20 -0
  19. package/dist/commands/ui/diff.js +28 -0
  20. package/dist/commands/ui/list.d.ts +24 -0
  21. package/dist/commands/ui/list.js +45 -0
  22. package/dist/commands/ui/remove.d.ts +22 -0
  23. package/dist/commands/ui/remove.js +48 -0
  24. package/dist/commands/ui/update.d.ts +23 -0
  25. package/dist/commands/ui/update.js +37 -0
  26. package/dist/commands/upgrade.d.ts +30 -0
  27. package/dist/commands/upgrade.js +184 -0
  28. package/dist/config.d.ts +81 -0
  29. package/dist/config.js +157 -0
  30. package/dist/contract.d.ts +161 -0
  31. package/dist/contract.js +308 -0
  32. package/dist/create/github.d.ts +63 -0
  33. package/dist/create/github.js +172 -0
  34. package/dist/create/target.d.ts +31 -0
  35. package/dist/create/target.js +56 -0
  36. package/dist/create/templates.d.ts +62 -0
  37. package/dist/create/templates.js +228 -0
  38. package/dist/dependencies.d.ts +34 -0
  39. package/dist/dependencies.js +76 -0
  40. package/dist/diff.d.ts +14 -0
  41. package/dist/diff.js +103 -0
  42. package/dist/format.d.ts +21 -0
  43. package/dist/format.js +40 -0
  44. package/dist/init.d.ts +38 -0
  45. package/dist/init.js +92 -0
  46. package/dist/lock.d.ts +74 -0
  47. package/dist/lock.js +214 -0
  48. package/dist/make/declare.d.ts +54 -0
  49. package/dist/make/declare.js +495 -0
  50. package/dist/make/generate.d.ts +56 -0
  51. package/dist/make/generate.js +139 -0
  52. package/dist/make/imports.d.ts +43 -0
  53. package/dist/make/imports.js +104 -0
  54. package/dist/make/index.d.ts +43 -0
  55. package/dist/make/index.js +136 -0
  56. package/dist/make/kinds.d.ts +39 -0
  57. package/dist/make/kinds.js +95 -0
  58. package/dist/make/migrations.d.ts +21 -0
  59. package/dist/make/migrations.js +48 -0
  60. package/dist/make/names.d.ts +31 -0
  61. package/dist/make/names.js +47 -0
  62. package/dist/make/stubs.d.ts +44 -0
  63. package/dist/make/stubs.js +89 -0
  64. package/dist/middleware.d.ts +44 -0
  65. package/dist/middleware.js +49 -0
  66. package/dist/package-manager.d.ts +41 -0
  67. package/dist/package-manager.js +80 -0
  68. package/dist/project.d.ts +19 -0
  69. package/dist/project.js +42 -0
  70. package/dist/releases.d.ts +40 -0
  71. package/dist/releases.js +110 -0
  72. package/dist/testing.d.ts +47 -0
  73. package/dist/testing.js +126 -0
  74. package/dist/ui/commands.d.ts +114 -0
  75. package/dist/ui/commands.js +432 -0
  76. package/dist/ui/imports.d.ts +46 -0
  77. package/dist/ui/imports.js +160 -0
  78. package/dist/ui/layout.d.ts +48 -0
  79. package/dist/ui/layout.js +138 -0
  80. package/dist/ui/registry.d.ts +58 -0
  81. package/dist/ui/registry.js +82 -0
  82. package/dist/upgrade/changelog.d.ts +50 -0
  83. package/dist/upgrade/changelog.js +69 -0
  84. package/dist/upgrade/project.d.ts +62 -0
  85. package/dist/upgrade/project.js +132 -0
  86. package/dist/upgrade/prompt.d.ts +51 -0
  87. package/dist/upgrade/prompt.js +227 -0
  88. package/dist/upgrade/registry.d.ts +33 -0
  89. package/dist/upgrade/registry.js +50 -0
  90. package/lock.schema.json +60 -0
  91. package/package.json +45 -0
  92. package/stubs/command.stub +12 -0
  93. package/stubs/command.test.stub +18 -0
  94. package/stubs/controller.form.stub +33 -0
  95. package/stubs/controller.stub +17 -0
  96. package/stubs/controller.test.stub +15 -0
  97. package/stubs/email.stub +44 -0
  98. package/stubs/email.test.stub +16 -0
  99. package/stubs/factory.stub +10 -0
  100. package/stubs/initializer.stub +7 -0
  101. package/stubs/initializer.test.stub +13 -0
  102. package/stubs/job.cron.stub +12 -0
  103. package/stubs/job.stub +11 -0
  104. package/stubs/job.test.stub +15 -0
  105. package/stubs/mcp.resource.stub +12 -0
  106. package/stubs/mcp.stub +10 -0
  107. package/stubs/mcp.test.stub +15 -0
  108. package/stubs/middleware.stub +11 -0
  109. package/stubs/middleware.test.stub +13 -0
  110. package/stubs/migration.stub +1 -0
  111. package/stubs/model.stub +24 -0
  112. package/stubs/model.test.stub +15 -0
  113. package/stubs/policy.stub +13 -0
  114. package/stubs/policy.test.stub +17 -0
  115. package/stubs/service.stub +13 -0
  116. package/stubs/service.test.stub +14 -0
  117. package/stubs/validator.stub +14 -0
  118. package/stubs/validator.test.stub +22 -0
  119. package/templates/app/README.md +57 -0
  120. package/templates/app/app/commands/about.test.ts +29 -0
  121. package/templates/app/app/commands/about.ts +34 -0
  122. package/templates/app/app/commands/index.ts +15 -0
  123. package/templates/app/app/http/controllers/home.tsx +22 -0
  124. package/templates/app/app/http/controllers/not-found.tsx +25 -0
  125. package/templates/app/app/initializers/assets.ts +11 -0
  126. package/templates/app/app/initializers/cli.ts +35 -0
  127. package/templates/app/app/initializers/dispatcher.ts +18 -0
  128. package/templates/app/app/initializers/logger.ts +10 -0
  129. package/templates/app/app/initializers/mcp.ts +16 -0
  130. package/templates/app/app/initializers/router.tsx +65 -0
  131. package/templates/app/app/jobs/index.ts +10 -0
  132. package/templates/app/app/mcp/resources/index.ts +9 -0
  133. package/templates/app/app/mcp/tools/index.ts +10 -0
  134. package/templates/app/bootstrap/browser.ts +27 -0
  135. package/templates/app/bootstrap/cli.ts +9 -0
  136. package/templates/app/bootstrap/worker.ts +31 -0
  137. package/templates/app/cloudflare.config.ts +28 -0
  138. package/templates/app/config/router-context.d.ts +20 -0
  139. package/templates/app/gitignore +9 -0
  140. package/templates/app/package.json +38 -0
  141. package/templates/app/resources/layouts/document.tsx +58 -0
  142. package/templates/app/routes/web.ts +12 -0
  143. package/templates/app/tsconfig.json +40 -0
  144. package/templates/app/vite.config.ts +40 -0
@@ -0,0 +1,335 @@
1
+ /**
2
+ * The `sdxc make` handlers: one per kind, each reading only the flags its kind declares, one for
3
+ * `make stubs`, and one for `make` alone, which asks for the kind and the name on a terminal.
4
+ * `createSDXC()` maps each named export through `lazy()`.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ /** `sdxc make controller`, which declares the route and maps the controller. */
10
+ export declare const controller: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
11
+ readonly name: import("@sdxc/cli").Argument<string>;
12
+ }, {
13
+ readonly method: import("@sdxc/cli").ValueFlag<"delete" | "get" | "post" | "put" | "patch" | "form", true, false, false>;
14
+ readonly path: import("@sdxc/cli").ValueFlag<string, false, false, false>;
15
+ readonly routes: import("@sdxc/cli").ValueFlag<string, false, false, false>;
16
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
17
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
18
+ }>, readonly [import("@sdxc/cli").CommandMiddleware<{
19
+ key: typeof import("../middleware.js").CurrentProject;
20
+ value: import("../middleware.js").Project;
21
+ property: "project";
22
+ }>, import("@sdxc/cli").CommandMiddleware<{
23
+ key: typeof import("../middleware.js").PackageRoot;
24
+ value: string;
25
+ property: "packageRoot";
26
+ }>]>;
27
+ /** `sdxc make job`, which declares the job and maps its handler. */
28
+ export declare const job: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
29
+ readonly name: import("@sdxc/cli").Argument<string>;
30
+ }, {
31
+ readonly cron: import("@sdxc/cli").ValueFlag<string, false, false, false>;
32
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
33
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
34
+ }>, readonly [import("@sdxc/cli").CommandMiddleware<{
35
+ key: typeof import("../middleware.js").CurrentProject;
36
+ value: import("../middleware.js").Project;
37
+ property: "project";
38
+ }>, import("@sdxc/cli").CommandMiddleware<{
39
+ key: typeof import("../middleware.js").PackageRoot;
40
+ value: string;
41
+ property: "packageRoot";
42
+ }>]>;
43
+ /** `sdxc make mcp`, which declares the tool or resource and maps its handler. */
44
+ export declare const mcp: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
45
+ readonly name: import("@sdxc/cli").Argument<string>;
46
+ }, {
47
+ readonly resource: import("@sdxc/cli").Flag<boolean>;
48
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
49
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
50
+ }>, readonly [import("@sdxc/cli").CommandMiddleware<{
51
+ key: typeof import("../middleware.js").CurrentProject;
52
+ value: import("../middleware.js").Project;
53
+ property: "project";
54
+ }>, import("@sdxc/cli").CommandMiddleware<{
55
+ key: typeof import("../middleware.js").PackageRoot;
56
+ value: string;
57
+ property: "packageRoot";
58
+ }>]>;
59
+ /** `sdxc make migration`, numbered within its chain. */
60
+ export declare const migration: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
61
+ readonly name: import("@sdxc/cli").Argument<string>;
62
+ }, {
63
+ readonly chain: import("@sdxc/cli").ValueFlag<string, false, false, false>;
64
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
65
+ }>, readonly [import("@sdxc/cli").CommandMiddleware<{
66
+ key: typeof import("../middleware.js").CurrentProject;
67
+ value: import("../middleware.js").Project;
68
+ property: "project";
69
+ }>, import("@sdxc/cli").CommandMiddleware<{
70
+ key: typeof import("../middleware.js").PackageRoot;
71
+ value: string;
72
+ property: "packageRoot";
73
+ }>]>;
74
+ /** `sdxc make factory`, which writes no test. */
75
+ export declare const factory: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
76
+ readonly name: import("@sdxc/cli").Argument<string>;
77
+ }, {
78
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
79
+ }>, readonly [import("@sdxc/cli").CommandMiddleware<{
80
+ key: typeof import("../middleware.js").CurrentProject;
81
+ value: import("../middleware.js").Project;
82
+ property: "project";
83
+ }>, import("@sdxc/cli").CommandMiddleware<{
84
+ key: typeof import("../middleware.js").PackageRoot;
85
+ value: string;
86
+ property: "packageRoot";
87
+ }>]>;
88
+ /** `sdxc make middleware`. */
89
+ export declare const middleware: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
90
+ readonly name: import("@sdxc/cli").Argument<string>;
91
+ }, {
92
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
93
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
94
+ }>, readonly [import("@sdxc/cli").CommandMiddleware<{
95
+ key: typeof import("../middleware.js").CurrentProject;
96
+ value: import("../middleware.js").Project;
97
+ property: "project";
98
+ }>, import("@sdxc/cli").CommandMiddleware<{
99
+ key: typeof import("../middleware.js").PackageRoot;
100
+ value: string;
101
+ property: "packageRoot";
102
+ }>]>;
103
+ /** `sdxc make validator`. */
104
+ export declare const validator: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
105
+ readonly name: import("@sdxc/cli").Argument<string>;
106
+ }, {
107
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
108
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
109
+ }>, readonly [import("@sdxc/cli").CommandMiddleware<{
110
+ key: typeof import("../middleware.js").CurrentProject;
111
+ value: import("../middleware.js").Project;
112
+ property: "project";
113
+ }>, import("@sdxc/cli").CommandMiddleware<{
114
+ key: typeof import("../middleware.js").PackageRoot;
115
+ value: string;
116
+ property: "packageRoot";
117
+ }>]>;
118
+ /** `sdxc make model`. */
119
+ export declare const model: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
120
+ readonly name: import("@sdxc/cli").Argument<string>;
121
+ }, {
122
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
123
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
124
+ }>, readonly [import("@sdxc/cli").CommandMiddleware<{
125
+ key: typeof import("../middleware.js").CurrentProject;
126
+ value: import("../middleware.js").Project;
127
+ property: "project";
128
+ }>, import("@sdxc/cli").CommandMiddleware<{
129
+ key: typeof import("../middleware.js").PackageRoot;
130
+ value: string;
131
+ property: "packageRoot";
132
+ }>]>;
133
+ /** `sdxc make service`. */
134
+ export declare const service: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
135
+ readonly name: import("@sdxc/cli").Argument<string>;
136
+ }, {
137
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
138
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
139
+ }>, readonly [import("@sdxc/cli").CommandMiddleware<{
140
+ key: typeof import("../middleware.js").CurrentProject;
141
+ value: import("../middleware.js").Project;
142
+ property: "project";
143
+ }>, import("@sdxc/cli").CommandMiddleware<{
144
+ key: typeof import("../middleware.js").PackageRoot;
145
+ value: string;
146
+ property: "packageRoot";
147
+ }>]>;
148
+ /** `sdxc make policy`. */
149
+ export declare const policy: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
150
+ readonly name: import("@sdxc/cli").Argument<string>;
151
+ }, {
152
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
153
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
154
+ }>, readonly [import("@sdxc/cli").CommandMiddleware<{
155
+ key: typeof import("../middleware.js").CurrentProject;
156
+ value: import("../middleware.js").Project;
157
+ property: "project";
158
+ }>, import("@sdxc/cli").CommandMiddleware<{
159
+ key: typeof import("../middleware.js").PackageRoot;
160
+ value: string;
161
+ property: "packageRoot";
162
+ }>]>;
163
+ /** `sdxc make initializer`. */
164
+ export declare const initializer: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
165
+ readonly name: import("@sdxc/cli").Argument<string>;
166
+ }, {
167
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
168
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
169
+ }>, readonly [import("@sdxc/cli").CommandMiddleware<{
170
+ key: typeof import("../middleware.js").CurrentProject;
171
+ value: import("../middleware.js").Project;
172
+ property: "project";
173
+ }>, import("@sdxc/cli").CommandMiddleware<{
174
+ key: typeof import("../middleware.js").PackageRoot;
175
+ value: string;
176
+ property: "packageRoot";
177
+ }>]>;
178
+ /** `sdxc make email`. */
179
+ export declare const email: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
180
+ readonly name: import("@sdxc/cli").Argument<string>;
181
+ }, {
182
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
183
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
184
+ }>, readonly [import("@sdxc/cli").CommandMiddleware<{
185
+ key: typeof import("../middleware.js").CurrentProject;
186
+ value: import("../middleware.js").Project;
187
+ property: "project";
188
+ }>, import("@sdxc/cli").CommandMiddleware<{
189
+ key: typeof import("../middleware.js").PackageRoot;
190
+ value: string;
191
+ property: "packageRoot";
192
+ }>]>;
193
+ /** `sdxc make command`, which declares the command and maps its handler on the command line. */
194
+ export declare const command: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
195
+ readonly name: import("@sdxc/cli").Argument<string>;
196
+ }, {
197
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
198
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
199
+ }>, readonly [import("@sdxc/cli").CommandMiddleware<{
200
+ key: typeof import("../middleware.js").CurrentProject;
201
+ value: import("../middleware.js").Project;
202
+ property: "project";
203
+ }>, import("@sdxc/cli").CommandMiddleware<{
204
+ key: typeof import("../middleware.js").PackageRoot;
205
+ value: string;
206
+ property: "packageRoot";
207
+ }>]>;
208
+ /** `sdxc make stubs`, which copies the built-in stubs of the named kinds, or every kind. */
209
+ export declare const stubs: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
210
+ readonly kinds: import("@sdxc/cli").Argument<import("../make/kinds.js").KindName[]>;
211
+ }, Readonly<Record<string, import("@sdxc/cli").Flag<unknown>>>>, readonly [import("@sdxc/cli").CommandMiddleware<{
212
+ key: typeof import("../middleware.js").CurrentProject;
213
+ value: import("../middleware.js").Project;
214
+ property: "project";
215
+ }>, import("@sdxc/cli").CommandMiddleware<{
216
+ key: typeof import("../middleware.js").PackageRoot;
217
+ value: string;
218
+ property: "packageRoot";
219
+ }>]>;
220
+ /**
221
+ * `sdxc make` with no kind: the contract asks for the kind and the name on a terminal, and this
222
+ * asks a controller's method, then makes it with every flag of the kind at its default. Without
223
+ * a terminal the missing kind is a usage error, which prints the list of kinds.
224
+ */
225
+ export declare const group: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Group<Omit<{
226
+ readonly description: "Write a controller, job, model or other file where the app layout puts it";
227
+ readonly arguments: {
228
+ readonly kind: import("@sdxc/cli").Argument<import("../make/kinds.js").KindName>;
229
+ readonly name: import("@sdxc/cli").Argument<string>;
230
+ };
231
+ readonly flags: {
232
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
233
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
234
+ };
235
+ readonly tasks: true;
236
+ readonly controller: import("@sdxc/cli").Command<{
237
+ readonly name: import("@sdxc/cli").Argument<string>;
238
+ }, {
239
+ readonly method: import("@sdxc/cli").ValueFlag<"delete" | "get" | "post" | "put" | "patch" | "form", true, false, false>;
240
+ readonly path: import("@sdxc/cli").ValueFlag<string, false, false, false>;
241
+ readonly routes: import("@sdxc/cli").ValueFlag<string, false, false, false>;
242
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
243
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
244
+ }>;
245
+ readonly middleware: import("@sdxc/cli").Command<{
246
+ readonly name: import("@sdxc/cli").Argument<string>;
247
+ }, {
248
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
249
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
250
+ }>;
251
+ readonly validator: import("@sdxc/cli").Command<{
252
+ readonly name: import("@sdxc/cli").Argument<string>;
253
+ }, {
254
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
255
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
256
+ }>;
257
+ readonly job: import("@sdxc/cli").Command<{
258
+ readonly name: import("@sdxc/cli").Argument<string>;
259
+ }, {
260
+ readonly cron: import("@sdxc/cli").ValueFlag<string, false, false, false>;
261
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
262
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
263
+ }>;
264
+ readonly model: import("@sdxc/cli").Command<{
265
+ readonly name: import("@sdxc/cli").Argument<string>;
266
+ }, {
267
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
268
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
269
+ }>;
270
+ readonly migration: import("@sdxc/cli").Command<{
271
+ readonly name: import("@sdxc/cli").Argument<string>;
272
+ }, {
273
+ readonly chain: import("@sdxc/cli").ValueFlag<string, false, false, false>;
274
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
275
+ }>;
276
+ readonly factory: import("@sdxc/cli").Command<{
277
+ readonly name: import("@sdxc/cli").Argument<string>;
278
+ }, {
279
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
280
+ }>;
281
+ readonly service: import("@sdxc/cli").Command<{
282
+ readonly name: import("@sdxc/cli").Argument<string>;
283
+ }, {
284
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
285
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
286
+ }>;
287
+ readonly policy: import("@sdxc/cli").Command<{
288
+ readonly name: import("@sdxc/cli").Argument<string>;
289
+ }, {
290
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
291
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
292
+ }>;
293
+ readonly initializer: import("@sdxc/cli").Command<{
294
+ readonly name: import("@sdxc/cli").Argument<string>;
295
+ }, {
296
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
297
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
298
+ }>;
299
+ readonly email: import("@sdxc/cli").Command<{
300
+ readonly name: import("@sdxc/cli").Argument<string>;
301
+ }, {
302
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
303
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
304
+ }>;
305
+ readonly mcp: import("@sdxc/cli").Command<{
306
+ readonly name: import("@sdxc/cli").Argument<string>;
307
+ }, {
308
+ readonly resource: import("@sdxc/cli").Flag<boolean>;
309
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
310
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
311
+ }>;
312
+ readonly command: import("@sdxc/cli").Command<{
313
+ readonly name: import("@sdxc/cli").Argument<string>;
314
+ }, {
315
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
316
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
317
+ }>;
318
+ readonly stubs: import("@sdxc/cli").Command<{
319
+ readonly kinds: import("@sdxc/cli").Argument<import("../make/kinds.js").KindName[]>;
320
+ }, Readonly<Record<string, import("@sdxc/cli").Flag<unknown>>>>;
321
+ }, "description" | "hidden" | "arguments" | "flags" | "tasks">, {
322
+ readonly kind: import("@sdxc/cli").Argument<import("../make/kinds.js").KindName>;
323
+ readonly name: import("@sdxc/cli").Argument<string>;
324
+ }, {
325
+ readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
326
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
327
+ }>, readonly [import("@sdxc/cli").CommandMiddleware<{
328
+ key: typeof import("../middleware.js").CurrentProject;
329
+ value: import("../middleware.js").Project;
330
+ property: "project";
331
+ }>, import("@sdxc/cli").CommandMiddleware<{
332
+ key: typeof import("../middleware.js").PackageRoot;
333
+ value: string;
334
+ property: "packageRoot";
335
+ }>]>;
@@ -0,0 +1,152 @@
1
+ /**
2
+ * The `sdxc make` handlers: one per kind, each reading only the flags its kind declares, one for
3
+ * `make stubs`, and one for `make` alone, which asks for the kind and the name on a terminal.
4
+ * `createSDXC()` maps each named export through `lazy()`.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import { createCommand, success } from "@sdxc/cli";
10
+ import { isFailure } from "@sdxc/result";
11
+ import { METHODS, SDXC_COMMANDS } from "../contract.js";
12
+ import { make } from "../make/index.js";
13
+ import { copyStubs } from "../make/stubs.js";
14
+ import { packageRoot, project } from "../middleware.js";
15
+ /** The middleware every `make` handler runs behind. */
16
+ const MAKE_MIDDLEWARE = [project(), packageRoot()];
17
+ /** Makes one file of `input.kind` in the project the middleware found. */
18
+ async function run(ctx, input) {
19
+ let made = await make(ctx, ctx.project, ctx.packageRoot, input);
20
+ if (isFailure(made))
21
+ return made;
22
+ return success();
23
+ }
24
+ /** `sdxc make controller`, which declares the route and maps the controller. */
25
+ export const controller = createCommand(SDXC_COMMANDS.make.controller, {
26
+ middleware: MAKE_MIDDLEWARE,
27
+ /** Asks for the method on a terminal, with `get` preselected. */
28
+ handler: (ctx) => run(ctx, {
29
+ kind: "controller",
30
+ name: ctx.arguments.name,
31
+ method: ctx.flags.method,
32
+ path: ctx.flags.path,
33
+ routes: ctx.flags.routes,
34
+ test: ctx.flags.test,
35
+ dryRun: ctx.flags.dryRun,
36
+ }),
37
+ });
38
+ /** `sdxc make job`, which declares the job and maps its handler. */
39
+ export const job = createCommand(SDXC_COMMANDS.make.job, {
40
+ middleware: MAKE_MIDDLEWARE,
41
+ /** `--cron` writes a scheduled job. */
42
+ handler: (ctx) => run(ctx, {
43
+ kind: "job",
44
+ name: ctx.arguments.name,
45
+ cron: ctx.flags.cron,
46
+ test: ctx.flags.test,
47
+ dryRun: ctx.flags.dryRun,
48
+ }),
49
+ });
50
+ /** `sdxc make mcp`, which declares the tool or resource and maps its handler. */
51
+ export const mcp = createCommand(SDXC_COMMANDS.make.mcp, {
52
+ middleware: MAKE_MIDDLEWARE,
53
+ /** `--resource` writes a resource instead of a tool. */
54
+ handler: (ctx) => run(ctx, {
55
+ kind: "mcp",
56
+ name: ctx.arguments.name,
57
+ resource: ctx.flags.resource,
58
+ test: ctx.flags.test,
59
+ dryRun: ctx.flags.dryRun,
60
+ }),
61
+ });
62
+ /** `sdxc make migration`, numbered within its chain. */
63
+ export const migration = createCommand(SDXC_COMMANDS.make.migration, {
64
+ middleware: MAKE_MIDDLEWARE,
65
+ /** `--chain` picks one of `make.migrations`. */
66
+ handler: (ctx) => run(ctx, {
67
+ kind: "migration",
68
+ name: ctx.arguments.name,
69
+ chain: ctx.flags.chain,
70
+ test: false,
71
+ dryRun: ctx.flags.dryRun,
72
+ }),
73
+ });
74
+ /** `sdxc make factory`, which writes no test. */
75
+ export const factory = createCommand(SDXC_COMMANDS.make.factory, {
76
+ middleware: MAKE_MIDDLEWARE,
77
+ /** Writes the factory alone. */
78
+ handler: (ctx) => run(ctx, { kind: "factory", name: ctx.arguments.name, test: false, dryRun: ctx.flags.dryRun }),
79
+ });
80
+ /**
81
+ * A handler for a kind that takes only `--test` and `--dry-run`.
82
+ *
83
+ * @param kind - The kind it writes
84
+ */
85
+ function plain(kind) {
86
+ return createCommand(SDXC_COMMANDS.make[kind], {
87
+ middleware: MAKE_MIDDLEWARE,
88
+ /** Writes the file and, unless `--no-test` or `make.tests` says otherwise, its test. */
89
+ handler: (ctx) => run(ctx, {
90
+ kind,
91
+ name: ctx.arguments.name,
92
+ test: ctx.flags.test,
93
+ dryRun: ctx.flags.dryRun,
94
+ }),
95
+ });
96
+ }
97
+ /** `sdxc make middleware`. */
98
+ export const middleware = plain("middleware");
99
+ /** `sdxc make validator`. */
100
+ export const validator = plain("validator");
101
+ /** `sdxc make model`. */
102
+ export const model = plain("model");
103
+ /** `sdxc make service`. */
104
+ export const service = plain("service");
105
+ /** `sdxc make policy`. */
106
+ export const policy = plain("policy");
107
+ /** `sdxc make initializer`. */
108
+ export const initializer = plain("initializer");
109
+ /** `sdxc make email`. */
110
+ export const email = plain("email");
111
+ /** `sdxc make command`, which declares the command and maps its handler on the command line. */
112
+ export const command = plain("command");
113
+ /** `sdxc make stubs`, which copies the built-in stubs of the named kinds, or every kind. */
114
+ export const stubs = createCommand(SDXC_COMMANDS.make.stubs, {
115
+ middleware: MAKE_MIDDLEWARE,
116
+ /** Prints each stub written, and each one kept because the project already edits it. */
117
+ async handler(ctx) {
118
+ let copied = await copyStubs(ctx.arguments.kinds, ctx.project.root, ctx.project.config.make.stubs, ctx.packageRoot);
119
+ if (isFailure(copied))
120
+ return copied;
121
+ for (let path of copied.data.written)
122
+ ctx.stdout(`Wrote ${path}\n`);
123
+ for (let path of copied.data.kept)
124
+ ctx.stdout(`Kept ${path}, which already exists\n`);
125
+ return success();
126
+ },
127
+ });
128
+ /**
129
+ * `sdxc make` with no kind: the contract asks for the kind and the name on a terminal, and this
130
+ * asks a controller's method, then makes it with every flag of the kind at its default. Without
131
+ * a terminal the missing kind is a usage error, which prints the list of kinds.
132
+ */
133
+ export const group = createCommand(SDXC_COMMANDS.make, {
134
+ middleware: MAKE_MIDDLEWARE,
135
+ /** Takes `get` for a controller's method without a terminal. */
136
+ async handler(ctx) {
137
+ let { kind, name } = ctx.arguments;
138
+ let method;
139
+ if (kind === "controller") {
140
+ let picked = await ctx.prompt.select({
141
+ message: "Which method?",
142
+ options: METHODS,
143
+ default: "get",
144
+ name: "method",
145
+ });
146
+ if (isFailure(picked))
147
+ return picked;
148
+ method = picked.data;
149
+ }
150
+ return run(ctx, { kind, name, method, test: ctx.flags.test, dryRun: ctx.flags.dryRun });
151
+ },
152
+ });
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The `sdxc run` handler: runs the project's own command line, `bootstrap/cli.ts`, with the
3
+ * project's runtime and every token after `run` as typed, so a globally installed `sdxc` reaches
4
+ * any project's commands without a package script.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ /** Where the app layout puts an app's command line, relative to the project root. */
10
+ export declare const CLI_ENTRY = "bootstrap/cli.ts";
11
+ /**
12
+ * Runs `bootstrap/cli.ts` under Bun for a project on Bun and under Node otherwise, with its
13
+ * output on the terminal; the app's exit code is `sdxc run`'s, and its own messages are the only
14
+ * ones printed when it fails.
15
+ */
16
+ declare const _default: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
17
+ readonly args: import("@sdxc/cli").Argument<string[]>;
18
+ }, Readonly<Record<string, import("@sdxc/cli").Flag<unknown>>>>, readonly [import("@sdxc/cli").CommandMiddleware<{
19
+ key: typeof import("../middleware.js").CurrentProject;
20
+ value: import("../middleware.js").Project;
21
+ property: "project";
22
+ }>]>;
23
+ export default _default;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * The `sdxc run` handler: runs the project's own command line, `bootstrap/cli.ts`, with the
3
+ * project's runtime and every token after `run` as typed, so a globally installed `sdxc` reaches
4
+ * any project's commands without a package script.
5
+ *
6
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
7
+ * @copyright Sergio Xalambrí 2026
8
+ */
9
+ import { stat } from "node:fs/promises";
10
+ import { join } from "node:path";
11
+ import { createCommand, ExecError, exit, failure, success } from "@sdxc/cli";
12
+ import { isFailure, isSuccess, wrap } from "@sdxc/result";
13
+ import { SDXC_COMMANDS } from "../contract.js";
14
+ import { project } from "../middleware.js";
15
+ import { lockFileAtOrAbove, packageManager } from "../package-manager.js";
16
+ import { readManifest } from "../upgrade/project.js";
17
+ /** Where the app layout puts an app's command line, relative to the project root. */
18
+ export const CLI_ENTRY = "bootstrap/cli.ts";
19
+ /**
20
+ * Runs `bootstrap/cli.ts` under Bun for a project on Bun and under Node otherwise, with its
21
+ * output on the terminal; the app's exit code is `sdxc run`'s, and its own messages are the only
22
+ * ones printed when it fails.
23
+ */
24
+ export default createCommand(SDXC_COMMANDS.run, {
25
+ middleware: [project()],
26
+ /** Fails naming the missing entry; otherwise hands the app's exit code back unchanged. */
27
+ async handler(ctx) {
28
+ let root = ctx.project.root;
29
+ let entry = join(root, CLI_ENTRY);
30
+ if (!isSuccess(await wrap(() => stat(entry)))) {
31
+ return failure(new Error(`${CLI_ENTRY} not found in ${root}; an app's command line starts there`));
32
+ }
33
+ let manifest = await readManifest(root);
34
+ if (isFailure(manifest))
35
+ return manifest;
36
+ let manager = await packageManager({
37
+ declared: manifest.data.manifest.packageManager,
38
+ findLockFile: lockFileAtOrAbove(root),
39
+ });
40
+ let runtime = manager.name === "bun" ? "bun" : "node";
41
+ let ran = await ctx.exec([runtime, CLI_ENTRY, ...ctx.arguments.args], {
42
+ cwd: root,
43
+ stdio: "inherit",
44
+ });
45
+ if (isSuccess(ran))
46
+ return success();
47
+ if (ran.error instanceof ExecError && ran.error.code !== null)
48
+ return exit(ran.error.code);
49
+ return ran;
50
+ },
51
+ });
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The `sdxc ui add` handler: copies components into `ui.directory` and points the project's
3
+ * imports at the copies. Without names, a terminal searches the registry for them.
4
+ *
5
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
6
+ * @copyright Sergio Xalambrí 2026
7
+ */
8
+ /** Copies the named components, or the ones picked on a terminal, and prints what it did. */
9
+ declare const _default: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
10
+ readonly components: import("@sdxc/cli").Argument<string[]>;
11
+ }, {
12
+ readonly withDeps: import("@sdxc/cli").Flag<boolean>;
13
+ readonly dryRun: import("@sdxc/cli").Flag<boolean>;
14
+ }>, readonly [import("@sdxc/cli").CommandMiddleware<{
15
+ key: typeof import("../../middleware.js").CurrentProject;
16
+ value: import("../../middleware.js").Project;
17
+ property: "project";
18
+ }>, import("@sdxc/cli").CommandMiddleware<{
19
+ key: typeof import("../../middleware.js").PackageRoot;
20
+ value: string;
21
+ property: "packageRoot";
22
+ }>]>;
23
+ export default _default;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * The `sdxc ui add` handler: copies components into `ui.directory` and points the project's
3
+ * imports at the copies. Without names, a terminal searches the registry for them.
4
+ *
5
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
6
+ * @copyright Sergio Xalambrí 2026
7
+ */
8
+ import { createCommand, success, usage } from "@sdxc/cli";
9
+ import { isFailure } from "@sdxc/result";
10
+ import { SDXC_COMMANDS } from "../../contract.js";
11
+ import { uiEntry } from "../../lock.js";
12
+ import { packageRoot, project } from "../../middleware.js";
13
+ import { finishPlan, loadContext, planAdd } from "../../ui/commands.js";
14
+ /** Copies the named components, or the ones picked on a terminal, and prints what it did. */
15
+ export default createCommand(SDXC_COMMANDS.ui.add, {
16
+ middleware: [project(), packageRoot()],
17
+ /** Exits 2 when no component is named and none is picked. */
18
+ async handler(ctx) {
19
+ let context = await loadContext(ctx.project, ctx.packageRoot);
20
+ if (isFailure(context))
21
+ return context;
22
+ let names = ctx.arguments.components;
23
+ if (names.length === 0) {
24
+ let lock = context.data.lock;
25
+ let picked = await ctx.prompt.search({
26
+ message: "Add which components?",
27
+ placeholder: "Type to filter",
28
+ multiple: true,
29
+ options: [...context.data.registry.entries.keys()].sort().map((name) => {
30
+ let copied = uiEntry(lock, name) !== undefined;
31
+ return copied ? { value: name, hint: "copied", disabled: true } : { value: name };
32
+ }),
33
+ default: [],
34
+ name: "components",
35
+ });
36
+ if (isFailure(picked))
37
+ return picked;
38
+ names = picked.data;
39
+ }
40
+ if (names.length === 0)
41
+ return usage("Name at least one component to add");
42
+ let plan = await planAdd(context.data, names, { withDeps: ctx.flags.withDeps });
43
+ if (isFailure(plan))
44
+ return plan;
45
+ let finished = await finishPlan(ctx, context.data, plan.data, ctx.flags.dryRun);
46
+ if (isFailure(finished))
47
+ return finished;
48
+ return success();
49
+ },
50
+ });
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The `sdxc ui diff` handler: prints how a copy differs from the installed version as a unified
3
+ * diff, or says that it matches.
4
+ *
5
+ * @author [Sergio Xalambrí](https://sergiodxa.com)
6
+ * @copyright Sergio Xalambrí 2026
7
+ */
8
+ /** Writes the diff, from the installed file to the local one, to stdout. */
9
+ declare const _default: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
10
+ readonly component: import("@sdxc/cli").Argument<string>;
11
+ }, Readonly<Record<string, import("@sdxc/cli").Flag<unknown>>>>, readonly [import("@sdxc/cli").CommandMiddleware<{
12
+ key: typeof import("../../middleware.js").CurrentProject;
13
+ value: import("../../middleware.js").Project;
14
+ property: "project";
15
+ }>, import("@sdxc/cli").CommandMiddleware<{
16
+ key: typeof import("../../middleware.js").PackageRoot;
17
+ value: string;
18
+ property: "packageRoot";
19
+ }>]>;
20
+ export default _default;