@sdxc/kit 2026.10.17 → 2026.10.21
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.
- package/README.md +397 -22
- package/changelog.jsonl +1171 -1092
- package/config.schema.json +53 -1
- package/dist/cli.js +12 -0
- package/dist/commands/deploy.d.ts +23 -0
- package/dist/commands/deploy.js +167 -0
- package/dist/commands/destroy.d.ts +22 -0
- package/dist/commands/destroy.js +92 -0
- package/dist/commands/doctor.d.ts +26 -0
- package/dist/commands/doctor.js +65 -0
- package/dist/commands/initializers.d.ts +16 -0
- package/dist/commands/initializers.js +23 -0
- package/dist/commands/make.d.ts +78 -6
- package/dist/commands/make.js +134 -20
- package/dist/commands/middleware.d.ts +16 -0
- package/dist/commands/middleware.js +21 -0
- package/dist/commands/models.d.ts +18 -0
- package/dist/commands/models.js +29 -0
- package/dist/commands/notes.d.ts +17 -0
- package/dist/commands/notes.js +27 -0
- package/dist/commands/routes.d.ts +25 -0
- package/dist/commands/routes.js +50 -0
- package/dist/commands/run.d.ts +16 -0
- package/dist/commands/run.js +32 -11
- package/dist/commands/scaffold.d.ts +30 -0
- package/dist/commands/scaffold.js +34 -0
- package/dist/commands/schedule.d.ts +16 -0
- package/dist/commands/schedule.js +21 -0
- package/dist/commands/stats.d.ts +16 -0
- package/dist/commands/stats.js +21 -0
- package/dist/commands/ui/update.d.ts +6 -3
- package/dist/commands/ui/update.js +24 -7
- package/dist/commands/upgrade.d.ts +3 -1
- package/dist/commands/upgrade.js +88 -23
- package/dist/config.d.ts +20 -0
- package/dist/config.js +32 -1
- package/dist/contract.d.ts +101 -3
- package/dist/contract.js +371 -26
- package/dist/create/templates.js +3 -2
- package/dist/dependencies.d.ts +5 -1
- package/dist/dependencies.js +16 -1
- package/dist/deploy/plan.d.ts +49 -0
- package/dist/deploy/plan.js +68 -0
- package/dist/destroy.d.ts +40 -0
- package/dist/destroy.js +317 -0
- package/dist/doctor/check.d.ts +71 -0
- package/dist/doctor/check.js +53 -0
- package/dist/doctor/checks.d.ts +23 -0
- package/dist/doctor/checks.js +70 -0
- package/dist/doctor/define.d.ts +59 -0
- package/dist/doctor/define.js +16 -0
- package/dist/doctor/emails.d.ts +18 -0
- package/dist/doctor/emails.js +243 -0
- package/dist/doctor/env.d.ts +26 -0
- package/dist/doctor/env.js +88 -0
- package/dist/doctor/files.d.ts +14 -0
- package/dist/doctor/files.js +34 -0
- package/dist/doctor/fixture.d.ts +23 -0
- package/dist/doctor/fixture.js +46 -0
- package/dist/doctor/install.d.ts +17 -0
- package/dist/doctor/install.js +37 -0
- package/dist/doctor/installed.d.ts +11 -0
- package/dist/doctor/installed.js +79 -0
- package/dist/doctor/jsdoc.d.ts +44 -0
- package/dist/doctor/jsdoc.js +201 -0
- package/dist/doctor/layout.d.ts +23 -0
- package/dist/doctor/layout.js +83 -0
- package/dist/doctor/migrations.d.ts +16 -0
- package/dist/doctor/migrations.js +96 -0
- package/dist/doctor/models.d.ts +13 -0
- package/dist/doctor/models.js +69 -0
- package/dist/doctor/pins.d.ts +15 -0
- package/dist/doctor/pins.js +79 -0
- package/dist/doctor/project.d.ts +58 -0
- package/dist/doctor/project.js +261 -0
- package/dist/doctor/remix.d.ts +14 -0
- package/dist/doctor/remix.js +44 -0
- package/dist/doctor/routes.d.ts +11 -0
- package/dist/doctor/routes.js +49 -0
- package/dist/doctor/typegen.d.ts +13 -0
- package/dist/doctor/typegen.js +57 -0
- package/dist/doctor/ui.d.ts +14 -0
- package/dist/doctor/ui.js +51 -0
- package/dist/initializers.d.ts +25 -0
- package/dist/initializers.js +89 -0
- package/dist/lock.d.ts +2 -2
- package/dist/make/actions.d.ts +23 -0
- package/dist/make/actions.js +82 -0
- package/dist/make/declare.d.ts +31 -3
- package/dist/make/declare.js +284 -9
- package/dist/make/email.d.ts +23 -0
- package/dist/make/email.js +111 -0
- package/dist/make/from-fields.d.ts +30 -0
- package/dist/make/from-fields.js +162 -0
- package/dist/make/from-model.d.ts +39 -0
- package/dist/make/from-model.js +161 -0
- package/dist/make/generate.d.ts +25 -5
- package/dist/make/generate.js +76 -22
- package/dist/make/guard.d.ts +35 -0
- package/dist/make/guard.js +73 -0
- package/dist/make/imports.d.ts +6 -0
- package/dist/make/imports.js +19 -0
- package/dist/make/index.d.ts +49 -4
- package/dist/make/index.js +290 -29
- package/dist/make/kinds.d.ts +34 -2
- package/dist/make/kinds.js +92 -8
- package/dist/make/mount.d.ts +25 -0
- package/dist/make/mount.js +135 -0
- package/dist/make/schema-diff.d.ts +58 -0
- package/dist/make/schema-diff.js +609 -0
- package/dist/make/schema.d.ts +76 -0
- package/dist/make/schema.js +206 -0
- package/dist/make/stubs.d.ts +14 -7
- package/dist/make/stubs.js +24 -8
- package/dist/make/test.d.ts +43 -0
- package/dist/make/test.js +150 -0
- package/dist/make/trigger.d.ts +31 -0
- package/dist/make/trigger.js +163 -0
- package/dist/models.d.ts +42 -0
- package/dist/models.js +149 -0
- package/dist/notes.d.ts +28 -0
- package/dist/notes.js +66 -0
- package/dist/reference.d.ts +27 -0
- package/dist/reference.js +103 -0
- package/dist/releases.d.ts +9 -0
- package/dist/releases.js +29 -8
- package/dist/routes/chains.d.ts +34 -0
- package/dist/routes/chains.js +95 -0
- package/dist/routes/filter.d.ts +53 -0
- package/dist/routes/filter.js +147 -0
- package/dist/routes/format.d.ts +23 -0
- package/dist/routes/format.js +123 -0
- package/dist/routes/helpers.d.ts +21 -0
- package/dist/routes/helpers.js +165 -0
- package/dist/routes/index.d.ts +56 -0
- package/dist/routes/index.js +167 -0
- package/dist/routes/modules.d.ts +116 -0
- package/dist/routes/modules.js +235 -0
- package/dist/routes/parse.d.ts +161 -0
- package/dist/routes/parse.js +621 -0
- package/dist/routes/routers.d.ts +69 -0
- package/dist/routes/routers.js +327 -0
- package/dist/scaffold/fields.d.ts +129 -0
- package/dist/scaffold/fields.js +421 -0
- package/dist/scaffold/index.d.ts +39 -0
- package/dist/scaffold/index.js +622 -0
- package/dist/scaffold/render.d.ts +61 -0
- package/dist/scaffold/render.js +417 -0
- package/dist/schedule.d.ts +45 -0
- package/dist/schedule.js +124 -0
- package/dist/stats.d.ts +37 -0
- package/dist/stats.js +126 -0
- package/dist/ui/commands.d.ts +10 -3
- package/dist/ui/commands.js +85 -15
- package/dist/ui/registry.d.ts +8 -8
- package/dist/upgrade/agents.d.ts +49 -0
- package/dist/upgrade/agents.js +110 -0
- package/dist/upgrade/changelog.d.ts +2 -2
- package/dist/upgrade/project.d.ts +4 -0
- package/dist/upgrade/project.js +11 -1
- package/dist/upgrade/prompt.d.ts +11 -0
- package/dist/upgrade/prompt.js +50 -7
- package/package.json +6 -4
- package/registry/ui/alert-dialog.json +2 -2
- package/registry/ui/attachment.json +2 -2
- package/registry/ui/calendar.json +2 -2
- package/registry/ui/color-picker.json +2 -2
- package/registry/ui/command.json +2 -2
- package/registry/ui/date-picker.json +2 -2
- package/registry/ui/date-range-picker.json +2 -2
- package/registry/ui/dialog.json +2 -2
- package/registry/ui/file-trigger.json +2 -2
- package/registry/ui/heading-scope.json +2 -2
- package/registry/ui/message-scroller.json +2 -2
- package/registry/ui/number-field.json +2 -2
- package/registry/ui/range-calendar.json +2 -2
- package/registry/ui/resizable.json +2 -2
- package/registry/ui/select.json +2 -2
- package/registry/ui/shared-element.json +2 -2
- package/registry/ui/sidebar.json +3 -3
- package/registry/ui/typeset.json +3 -3
- package/stubs/command.spec.stub +15 -0
- package/stubs/controller.api.resource.stub +23 -0
- package/stubs/controller.api.spec.stub +15 -0
- package/stubs/controller.form.stub +2 -2
- package/stubs/controller.form.test.stub +2 -2
- package/stubs/controller.resource.form.stub +67 -0
- package/stubs/controller.resource.stub +28 -0
- package/stubs/controller.spec.stub +15 -0
- package/stubs/email.stub +9 -14
- package/stubs/email.test.stub +9 -9
- package/stubs/factory.stub +1 -1
- package/stubs/mcp.spec.stub +16 -0
- package/stubs/model.stub +3 -3
- package/stubs/policy.test.stub +34 -8
- package/stubs/scaffold.api.create.stub +34 -0
- package/stubs/scaffold.api.create.test.stub +37 -0
- package/stubs/scaffold.api.destroy.stub +34 -0
- package/stubs/scaffold.api.destroy.test.stub +44 -0
- package/stubs/scaffold.api.index.stub +23 -0
- package/stubs/scaffold.api.index.test.stub +31 -0
- package/stubs/scaffold.api.show.stub +27 -0
- package/stubs/scaffold.api.show.test.stub +41 -0
- package/stubs/scaffold.api.update.stub +44 -0
- package/stubs/scaffold.api.update.test.stub +46 -0
- package/stubs/scaffold.command.create.stub +22 -0
- package/stubs/scaffold.command.create.test.stub +30 -0
- package/stubs/scaffold.command.delete.stub +20 -0
- package/stubs/scaffold.command.delete.test.stub +39 -0
- package/stubs/scaffold.command.list.stub +18 -0
- package/stubs/scaffold.command.list.test.stub +31 -0
- package/stubs/scaffold.command.show.stub +19 -0
- package/stubs/scaffold.command.show.test.stub +37 -0
- package/stubs/scaffold.controller.destroy.stub +35 -0
- package/stubs/scaffold.controller.destroy.test.stub +65 -0
- package/stubs/scaffold.controller.edit.stub +97 -0
- package/stubs/scaffold.controller.edit.test.stub +91 -0
- package/stubs/scaffold.controller.index.stub +55 -0
- package/stubs/scaffold.controller.index.test.stub +32 -0
- package/stubs/scaffold.controller.new.stub +70 -0
- package/stubs/scaffold.controller.new.test.stub +81 -0
- package/stubs/scaffold.controller.show.stub +59 -0
- package/stubs/scaffold.controller.show.test.stub +43 -0
- package/stubs/scaffold.factory.stub +16 -0
- package/stubs/scaffold.form.stub +75 -0
- package/stubs/scaffold.mcp.create.stub +24 -0
- package/stubs/scaffold.mcp.create.test.stub +36 -0
- package/stubs/scaffold.mcp.delete.stub +31 -0
- package/stubs/scaffold.mcp.delete.test.stub +43 -0
- package/stubs/scaffold.mcp.get.stub +21 -0
- package/stubs/scaffold.mcp.get.test.stub +31 -0
- package/stubs/scaffold.mcp.list.stub +23 -0
- package/stubs/scaffold.mcp.list.test.stub +25 -0
- package/stubs/scaffold.mcp.update.stub +37 -0
- package/stubs/scaffold.mcp.update.test.stub +40 -0
- package/stubs/scaffold.migration.stub +3 -0
- package/stubs/scaffold.model.stub +35 -0
- package/stubs/scaffold.model.test.stub +25 -0
- package/stubs/scaffold.spec.stub +7 -0
- package/stubs/scaffold.test-database.stub +33 -0
- package/stubs/scaffold.test-mcp.stub +92 -0
- package/stubs/scaffold.validator.stub +18 -0
- package/stubs/scaffold.validator.test.stub +26 -0
- package/templates/app/AGENTS.md +167 -0
- package/templates/app/CLAUDE.md +1 -0
- package/templates/app/README.md +33 -15
- package/templates/app/app/commands/console.test.ts +26 -0
- package/templates/app/app/commands/console.ts +19 -0
- package/templates/app/app/commands/db/fresh.test.ts +57 -0
- package/templates/app/app/commands/db/fresh.ts +37 -0
- package/templates/app/app/commands/db/migrate.test.ts +17 -1
- package/templates/app/app/commands/db/migrate.ts +51 -18
- package/templates/app/app/commands/db/prepare.test.ts +39 -0
- package/templates/app/app/commands/db/prepare.ts +35 -0
- package/templates/app/app/commands/db/seed.test.ts +38 -0
- package/templates/app/app/commands/db/seed.ts +26 -0
- package/templates/app/app/commands/deploy.test.ts +34 -0
- package/templates/app/app/commands/deploy.ts +18 -0
- package/templates/app/app/commands/emails/preview.test.tsx +63 -0
- package/templates/app/app/commands/emails/preview.ts +24 -0
- package/templates/app/app/commands/index.ts +57 -2
- package/templates/app/app/commands/typegen.test.ts +20 -1
- package/templates/app/app/commands/typegen.ts +16 -2
- package/templates/app/app/emails/index.ts +10 -0
- package/templates/app/app/http/middleware/access.test.ts +43 -0
- package/templates/app/app/http/middleware/access.ts +41 -0
- package/templates/app/app/http/middleware/api.ts +12 -3
- package/templates/app/app/http/middleware/page.test.ts +4 -1
- package/templates/app/app/http/middleware/page.ts +7 -5
- package/templates/app/app/initializers/cli.ts +35 -2
- package/templates/app/app/initializers/dispatcher.ts +9 -1
- package/templates/app/app/initializers/mail-transport.test.ts +33 -0
- package/templates/app/app/initializers/mail-transport.ts +26 -0
- package/templates/app/app/initializers/mail.test.ts +17 -17
- package/templates/app/app/initializers/mail.ts +15 -7
- package/templates/app/app/initializers/router.test.ts +7 -0
- package/templates/app/app/initializers/router.tsx +13 -3
- package/templates/app/app/jobs/email.test.tsx +70 -0
- package/templates/app/app/jobs/email.ts +16 -0
- package/templates/app/app/jobs/index.ts +6 -2
- package/templates/app/app/policies/abilities.ts +13 -0
- package/templates/app/app/policies/policy.test.ts +15 -0
- package/templates/app/app/policies/policy.ts +30 -0
- package/templates/app/app/services/commands.ts +30 -0
- package/templates/app/app/services/migrations.test.ts +48 -1
- package/templates/app/app/services/migrations.ts +66 -9
- package/templates/app/app/test/cloudflare-workers.ts +2 -0
- package/templates/app/app/test/local-database.ts +67 -0
- package/templates/app/app/test/session.ts +28 -0
- package/templates/app/bootstrap/console.ts +13 -0
- package/templates/app/cloudflare.config.ts +3 -3
- package/templates/app/database/seed.ts +12 -0
- package/templates/app/package.json +3 -1
- package/templates/app/spec/config.jsonc +16 -0
- package/stubs/policy.stub +0 -16
package/dist/commands/make.d.ts
CHANGED
|
@@ -10,11 +10,15 @@
|
|
|
10
10
|
export declare const controller: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
|
|
11
11
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
12
12
|
}, {
|
|
13
|
-
readonly method: import("@sdxc/cli").ValueFlag<"delete" | "get" | "post" | "put" | "patch" | "form",
|
|
13
|
+
readonly method: import("@sdxc/cli").ValueFlag<"delete" | "get" | "post" | "put" | "patch" | "form", false, false, false>;
|
|
14
14
|
readonly path: import("@sdxc/cli").ValueFlag<string, false, false, false>;
|
|
15
15
|
readonly routes: import("@sdxc/cli").ValueFlag<string, false, false, false>;
|
|
16
|
+
readonly resource: import("@sdxc/cli").ValueFlag<string, false, false, false>;
|
|
17
|
+
readonly actions: import("@sdxc/cli").ValueFlag<"index" | "all" | "new" | "show" | "edit" | "create" | "update" | "destroy", false, true, false>;
|
|
16
18
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
19
|
+
readonly spec: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
17
20
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
21
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
18
22
|
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
19
23
|
key: typeof import("../middleware.js").CurrentProject;
|
|
20
24
|
value: import("../middleware.js").Project;
|
|
@@ -31,6 +35,7 @@ export declare const job: import("@sdxc/cli").CommandAction<import("@sdxc/cli").
|
|
|
31
35
|
readonly cron: import("@sdxc/cli").ValueFlag<string, false, false, false>;
|
|
32
36
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
33
37
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
38
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
34
39
|
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
35
40
|
key: typeof import("../middleware.js").CurrentProject;
|
|
36
41
|
value: import("../middleware.js").Project;
|
|
@@ -46,7 +51,9 @@ export declare const mcp: import("@sdxc/cli").CommandAction<import("@sdxc/cli").
|
|
|
46
51
|
}, {
|
|
47
52
|
readonly resource: import("@sdxc/cli").Flag<boolean>;
|
|
48
53
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
54
|
+
readonly spec: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
49
55
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
56
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
50
57
|
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
51
58
|
key: typeof import("../middleware.js").CurrentProject;
|
|
52
59
|
value: import("../middleware.js").Project;
|
|
@@ -59,8 +66,10 @@ export declare const mcp: import("@sdxc/cli").CommandAction<import("@sdxc/cli").
|
|
|
59
66
|
/** `sdxc make migration`, numbered within its chain. */
|
|
60
67
|
export declare const migration: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
|
|
61
68
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
69
|
+
readonly fields: import("@sdxc/cli").Argument<string[]>;
|
|
62
70
|
}, {
|
|
63
71
|
readonly chain: import("@sdxc/cli").ValueFlag<string, false, false, false>;
|
|
72
|
+
readonly fromModel: import("@sdxc/cli").ValueFlag<string, false, false, false>;
|
|
64
73
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
65
74
|
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
66
75
|
key: typeof import("../middleware.js").CurrentProject;
|
|
@@ -76,6 +85,7 @@ export declare const factory: import("@sdxc/cli").CommandAction<import("@sdxc/cl
|
|
|
76
85
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
77
86
|
}, {
|
|
78
87
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
88
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
79
89
|
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
80
90
|
key: typeof import("../middleware.js").CurrentProject;
|
|
81
91
|
value: import("../middleware.js").Project;
|
|
@@ -85,12 +95,14 @@ export declare const factory: import("@sdxc/cli").CommandAction<import("@sdxc/cl
|
|
|
85
95
|
value: string;
|
|
86
96
|
property: "packageRoot";
|
|
87
97
|
}>]>;
|
|
88
|
-
/** `sdxc make middleware`. */
|
|
98
|
+
/** `sdxc make middleware`, which mounts the middleware on a chain under `--mount`. */
|
|
89
99
|
export declare const middleware: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
|
|
90
100
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
91
101
|
}, {
|
|
102
|
+
readonly mount: import("@sdxc/cli").ValueFlag<string, false, false, false>;
|
|
92
103
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
93
104
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
105
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
94
106
|
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
95
107
|
key: typeof import("../middleware.js").CurrentProject;
|
|
96
108
|
value: import("../middleware.js").Project;
|
|
@@ -106,6 +118,7 @@ export declare const validator: import("@sdxc/cli").CommandAction<import("@sdxc/
|
|
|
106
118
|
}, {
|
|
107
119
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
108
120
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
121
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
109
122
|
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
110
123
|
key: typeof import("../middleware.js").CurrentProject;
|
|
111
124
|
value: import("../middleware.js").Project;
|
|
@@ -115,12 +128,16 @@ export declare const validator: import("@sdxc/cli").CommandAction<import("@sdxc/
|
|
|
115
128
|
value: string;
|
|
116
129
|
property: "packageRoot";
|
|
117
130
|
}>]>;
|
|
118
|
-
/** `sdxc make model
|
|
131
|
+
/** `sdxc make model`, with a column per field it is given, its migration and its factory. */
|
|
119
132
|
export declare const model: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
|
|
120
133
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
134
|
+
readonly fields: import("@sdxc/cli").Argument<string[]>;
|
|
121
135
|
}, {
|
|
136
|
+
readonly chain: import("@sdxc/cli").ValueFlag<string, false, false, false>;
|
|
137
|
+
readonly skip: import("@sdxc/cli").ValueFlag<"migration" | "factory", false, true, false>;
|
|
122
138
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
123
139
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
140
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
124
141
|
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
125
142
|
key: typeof import("../middleware.js").CurrentProject;
|
|
126
143
|
value: import("../middleware.js").Project;
|
|
@@ -136,6 +153,7 @@ export declare const service: import("@sdxc/cli").CommandAction<import("@sdxc/cl
|
|
|
136
153
|
}, {
|
|
137
154
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
138
155
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
156
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
139
157
|
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
140
158
|
key: typeof import("../middleware.js").CurrentProject;
|
|
141
159
|
value: import("../middleware.js").Project;
|
|
@@ -151,6 +169,7 @@ export declare const policy: import("@sdxc/cli").CommandAction<import("@sdxc/cli
|
|
|
151
169
|
}, {
|
|
152
170
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
153
171
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
172
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
154
173
|
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
155
174
|
key: typeof import("../middleware.js").CurrentProject;
|
|
156
175
|
value: import("../middleware.js").Project;
|
|
@@ -166,6 +185,7 @@ export declare const initializer: import("@sdxc/cli").CommandAction<import("@sdx
|
|
|
166
185
|
}, {
|
|
167
186
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
168
187
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
188
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
169
189
|
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
170
190
|
key: typeof import("../middleware.js").CurrentProject;
|
|
171
191
|
value: import("../middleware.js").Project;
|
|
@@ -176,11 +196,14 @@ export declare const initializer: import("@sdxc/cli").CommandAction<import("@sdx
|
|
|
176
196
|
property: "packageRoot";
|
|
177
197
|
}>]>;
|
|
178
198
|
/** `sdxc make email`. */
|
|
199
|
+
/** `sdxc make email`, which declares the email with its fields as props and maps its template. */
|
|
179
200
|
export declare const email: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
|
|
180
201
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
202
|
+
readonly fields: import("@sdxc/cli").Argument<string[]>;
|
|
181
203
|
}, {
|
|
182
204
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
183
205
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
206
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
184
207
|
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
185
208
|
key: typeof import("../middleware.js").CurrentProject;
|
|
186
209
|
value: import("../middleware.js").Project;
|
|
@@ -195,7 +218,24 @@ export declare const command: import("@sdxc/cli").CommandAction<import("@sdxc/cl
|
|
|
195
218
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
196
219
|
}, {
|
|
197
220
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
221
|
+
readonly spec: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
222
|
+
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
223
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
224
|
+
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
225
|
+
key: typeof import("../middleware.js").CurrentProject;
|
|
226
|
+
value: import("../middleware.js").Project;
|
|
227
|
+
property: "project";
|
|
228
|
+
}>, import("@sdxc/cli").CommandMiddleware<{
|
|
229
|
+
key: typeof import("../middleware.js").PackageRoot;
|
|
230
|
+
value: string;
|
|
231
|
+
property: "packageRoot";
|
|
232
|
+
}>]>;
|
|
233
|
+
/** `sdxc make test`, which writes the test of an existing file from its kind's test stub. */
|
|
234
|
+
export declare const test: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
|
|
235
|
+
readonly file: import("@sdxc/cli").Argument<string>;
|
|
236
|
+
}, {
|
|
198
237
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
238
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
199
239
|
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
200
240
|
key: typeof import("../middleware.js").CurrentProject;
|
|
201
241
|
value: import("../middleware.js").Project;
|
|
@@ -207,7 +247,7 @@ export declare const command: import("@sdxc/cli").CommandAction<import("@sdxc/cl
|
|
|
207
247
|
}>]>;
|
|
208
248
|
/** `sdxc make stubs`, which copies the built-in stubs of the named kinds, or every kind. */
|
|
209
249
|
export declare const stubs: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
|
|
210
|
-
readonly kinds: import("@sdxc/cli").Argument<import("../make/kinds.js").KindName[]>;
|
|
250
|
+
readonly kinds: import("@sdxc/cli").Argument<(import("../make/kinds.js").KindName | "scaffold")[]>;
|
|
211
251
|
}, Readonly<Record<string, import("@sdxc/cli").Flag<unknown>>>>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
212
252
|
key: typeof import("../middleware.js").CurrentProject;
|
|
213
253
|
value: import("../middleware.js").Project;
|
|
@@ -231,28 +271,36 @@ export declare const group: import("@sdxc/cli").CommandAction<import("@sdxc/cli"
|
|
|
231
271
|
readonly flags: {
|
|
232
272
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
233
273
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
274
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
234
275
|
};
|
|
235
276
|
readonly tasks: true;
|
|
236
277
|
readonly controller: import("@sdxc/cli").Command<{
|
|
237
278
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
238
279
|
}, {
|
|
239
|
-
readonly method: import("@sdxc/cli").ValueFlag<"delete" | "get" | "post" | "put" | "patch" | "form",
|
|
280
|
+
readonly method: import("@sdxc/cli").ValueFlag<"delete" | "get" | "post" | "put" | "patch" | "form", false, false, false>;
|
|
240
281
|
readonly path: import("@sdxc/cli").ValueFlag<string, false, false, false>;
|
|
241
282
|
readonly routes: import("@sdxc/cli").ValueFlag<string, false, false, false>;
|
|
283
|
+
readonly resource: import("@sdxc/cli").ValueFlag<string, false, false, false>;
|
|
284
|
+
readonly actions: import("@sdxc/cli").ValueFlag<"index" | "all" | "new" | "show" | "edit" | "create" | "update" | "destroy", false, true, false>;
|
|
242
285
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
286
|
+
readonly spec: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
243
287
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
288
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
244
289
|
}>;
|
|
245
290
|
readonly middleware: import("@sdxc/cli").Command<{
|
|
246
291
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
247
292
|
}, {
|
|
293
|
+
readonly mount: import("@sdxc/cli").ValueFlag<string, false, false, false>;
|
|
248
294
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
249
295
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
296
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
250
297
|
}>;
|
|
251
298
|
readonly validator: import("@sdxc/cli").Command<{
|
|
252
299
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
253
300
|
}, {
|
|
254
301
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
255
302
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
303
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
256
304
|
}>;
|
|
257
305
|
readonly job: import("@sdxc/cli").Command<{
|
|
258
306
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
@@ -260,63 +308,86 @@ export declare const group: import("@sdxc/cli").CommandAction<import("@sdxc/cli"
|
|
|
260
308
|
readonly cron: import("@sdxc/cli").ValueFlag<string, false, false, false>;
|
|
261
309
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
262
310
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
311
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
263
312
|
}>;
|
|
264
313
|
readonly model: import("@sdxc/cli").Command<{
|
|
265
314
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
315
|
+
readonly fields: import("@sdxc/cli").Argument<string[]>;
|
|
266
316
|
}, {
|
|
317
|
+
readonly chain: import("@sdxc/cli").ValueFlag<string, false, false, false>;
|
|
318
|
+
readonly skip: import("@sdxc/cli").ValueFlag<"migration" | "factory", false, true, false>;
|
|
267
319
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
268
320
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
321
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
269
322
|
}>;
|
|
270
323
|
readonly migration: import("@sdxc/cli").Command<{
|
|
271
324
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
325
|
+
readonly fields: import("@sdxc/cli").Argument<string[]>;
|
|
272
326
|
}, {
|
|
273
327
|
readonly chain: import("@sdxc/cli").ValueFlag<string, false, false, false>;
|
|
328
|
+
readonly fromModel: import("@sdxc/cli").ValueFlag<string, false, false, false>;
|
|
274
329
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
275
330
|
}>;
|
|
276
331
|
readonly factory: import("@sdxc/cli").Command<{
|
|
277
332
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
278
333
|
}, {
|
|
279
334
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
335
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
280
336
|
}>;
|
|
281
337
|
readonly service: import("@sdxc/cli").Command<{
|
|
282
338
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
283
339
|
}, {
|
|
284
340
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
285
341
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
342
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
286
343
|
}>;
|
|
287
344
|
readonly policy: import("@sdxc/cli").Command<{
|
|
288
345
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
289
346
|
}, {
|
|
290
347
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
291
348
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
349
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
292
350
|
}>;
|
|
293
351
|
readonly initializer: import("@sdxc/cli").Command<{
|
|
294
352
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
295
353
|
}, {
|
|
296
354
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
297
355
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
356
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
298
357
|
}>;
|
|
299
358
|
readonly email: import("@sdxc/cli").Command<{
|
|
300
359
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
360
|
+
readonly fields: import("@sdxc/cli").Argument<string[]>;
|
|
301
361
|
}, {
|
|
302
362
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
303
363
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
364
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
304
365
|
}>;
|
|
305
366
|
readonly mcp: import("@sdxc/cli").Command<{
|
|
306
367
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
307
368
|
}, {
|
|
308
369
|
readonly resource: import("@sdxc/cli").Flag<boolean>;
|
|
309
370
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
371
|
+
readonly spec: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
310
372
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
373
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
311
374
|
}>;
|
|
312
375
|
readonly command: import("@sdxc/cli").Command<{
|
|
313
376
|
readonly name: import("@sdxc/cli").Argument<string>;
|
|
314
377
|
}, {
|
|
315
378
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
379
|
+
readonly spec: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
380
|
+
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
381
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
382
|
+
}>;
|
|
383
|
+
readonly test: import("@sdxc/cli").Command<{
|
|
384
|
+
readonly file: import("@sdxc/cli").Argument<string>;
|
|
385
|
+
}, {
|
|
316
386
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
387
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
317
388
|
}>;
|
|
318
389
|
readonly stubs: import("@sdxc/cli").Command<{
|
|
319
|
-
readonly kinds: import("@sdxc/cli").Argument<import("../make/kinds.js").KindName[]>;
|
|
390
|
+
readonly kinds: import("@sdxc/cli").Argument<(import("../make/kinds.js").KindName | "scaffold")[]>;
|
|
320
391
|
}, Readonly<Record<string, import("@sdxc/cli").Flag<unknown>>>>;
|
|
321
392
|
}, "description" | "hidden" | "arguments" | "flags" | "tasks">, {
|
|
322
393
|
readonly kind: import("@sdxc/cli").Argument<import("../make/kinds.js").KindName>;
|
|
@@ -324,6 +395,7 @@ export declare const group: import("@sdxc/cli").CommandAction<import("@sdxc/cli"
|
|
|
324
395
|
}, {
|
|
325
396
|
readonly test: import("@sdxc/cli").Flag<boolean | undefined>;
|
|
326
397
|
readonly dryRun: import("@sdxc/cli").Flag<boolean>;
|
|
398
|
+
readonly force: import("@sdxc/cli").Flag<boolean>;
|
|
327
399
|
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
328
400
|
key: typeof import("../middleware.js").CurrentProject;
|
|
329
401
|
value: import("../middleware.js").Project;
|
package/dist/commands/make.js
CHANGED
|
@@ -6,11 +6,13 @@
|
|
|
6
6
|
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
7
|
* @copyright Sergio Xalambrí 2026
|
|
8
8
|
*/
|
|
9
|
-
import { createCommand, success } from "@sdxc/cli";
|
|
9
|
+
import { createCommand, success, usage } from "@sdxc/cli";
|
|
10
10
|
import { isFailure } from "@sdxc/result";
|
|
11
11
|
import { METHODS, SDXC_COMMANDS } from "../contract.js";
|
|
12
|
+
import { makeActions } from "../make/actions.js";
|
|
12
13
|
import { make } from "../make/index.js";
|
|
13
14
|
import { copyStubs } from "../make/stubs.js";
|
|
15
|
+
import { makeTest } from "../make/test.js";
|
|
14
16
|
import { packageRoot, project } from "../middleware.js";
|
|
15
17
|
/** The middleware every `make` handler runs behind. */
|
|
16
18
|
const MAKE_MIDDLEWARE = [project(), packageRoot()];
|
|
@@ -24,16 +26,47 @@ async function run(ctx, input) {
|
|
|
24
26
|
/** `sdxc make controller`, which declares the route and maps the controller. */
|
|
25
27
|
export const controller = createCommand(SDXC_COMMANDS.make.controller, {
|
|
26
28
|
middleware: MAKE_MIDDLEWARE,
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Asks for the method on a terminal, with `get` preselected; `--resource` guards the route,
|
|
31
|
+
* and `--actions` writes one controller per action, each with its own method and route.
|
|
32
|
+
*/
|
|
33
|
+
async handler(ctx) {
|
|
34
|
+
let { flags } = ctx;
|
|
35
|
+
let shared = {
|
|
36
|
+
name: ctx.arguments.name,
|
|
37
|
+
routes: flags.routes,
|
|
38
|
+
guardedBy: flags.resource,
|
|
39
|
+
test: flags.test,
|
|
40
|
+
spec: flags.spec,
|
|
41
|
+
dryRun: flags.dryRun,
|
|
42
|
+
force: flags.force,
|
|
43
|
+
};
|
|
44
|
+
if (flags.actions.length > 0) {
|
|
45
|
+
if (flags.method !== undefined || flags.path !== undefined) {
|
|
46
|
+
return usage("--actions gives each controller its method and route; drop --method and --path");
|
|
47
|
+
}
|
|
48
|
+
let made = await makeActions(ctx, ctx.project, ctx.packageRoot, {
|
|
49
|
+
...shared,
|
|
50
|
+
actions: flags.actions,
|
|
51
|
+
});
|
|
52
|
+
if (isFailure(made))
|
|
53
|
+
return made;
|
|
54
|
+
return success();
|
|
55
|
+
}
|
|
56
|
+
let method = flags.method;
|
|
57
|
+
if (method === undefined) {
|
|
58
|
+
let picked = await ctx.prompt.select({
|
|
59
|
+
message: "Which method?",
|
|
60
|
+
options: METHODS,
|
|
61
|
+
default: "get",
|
|
62
|
+
name: "method",
|
|
63
|
+
});
|
|
64
|
+
if (isFailure(picked))
|
|
65
|
+
return picked;
|
|
66
|
+
method = picked.data;
|
|
67
|
+
}
|
|
68
|
+
return run(ctx, { ...shared, kind: "controller", method, path: flags.path });
|
|
69
|
+
},
|
|
37
70
|
});
|
|
38
71
|
/** `sdxc make job`, which declares the job and maps its handler. */
|
|
39
72
|
export const job = createCommand(SDXC_COMMANDS.make.job, {
|
|
@@ -45,6 +78,7 @@ export const job = createCommand(SDXC_COMMANDS.make.job, {
|
|
|
45
78
|
cron: ctx.flags.cron,
|
|
46
79
|
test: ctx.flags.test,
|
|
47
80
|
dryRun: ctx.flags.dryRun,
|
|
81
|
+
force: ctx.flags.force,
|
|
48
82
|
}),
|
|
49
83
|
});
|
|
50
84
|
/** `sdxc make mcp`, which declares the tool or resource and maps its handler. */
|
|
@@ -56,17 +90,24 @@ export const mcp = createCommand(SDXC_COMMANDS.make.mcp, {
|
|
|
56
90
|
name: ctx.arguments.name,
|
|
57
91
|
resource: ctx.flags.resource,
|
|
58
92
|
test: ctx.flags.test,
|
|
93
|
+
spec: ctx.flags.spec,
|
|
59
94
|
dryRun: ctx.flags.dryRun,
|
|
95
|
+
force: ctx.flags.force,
|
|
60
96
|
}),
|
|
61
97
|
});
|
|
62
98
|
/** `sdxc make migration`, numbered within its chain. */
|
|
63
99
|
export const migration = createCommand(SDXC_COMMANDS.make.migration, {
|
|
64
100
|
middleware: MAKE_MIDDLEWARE,
|
|
65
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* `--chain` picks one of `make.migrations`; `--from-model` writes the SQL a model needs, and
|
|
103
|
+
* fields write the statements the name spells.
|
|
104
|
+
*/
|
|
66
105
|
handler: (ctx) => run(ctx, {
|
|
67
106
|
kind: "migration",
|
|
68
107
|
name: ctx.arguments.name,
|
|
108
|
+
fields: ctx.arguments.fields,
|
|
69
109
|
chain: ctx.flags.chain,
|
|
110
|
+
fromModel: ctx.flags.fromModel,
|
|
70
111
|
test: false,
|
|
71
112
|
dryRun: ctx.flags.dryRun,
|
|
72
113
|
}),
|
|
@@ -75,7 +116,13 @@ export const migration = createCommand(SDXC_COMMANDS.make.migration, {
|
|
|
75
116
|
export const factory = createCommand(SDXC_COMMANDS.make.factory, {
|
|
76
117
|
middleware: MAKE_MIDDLEWARE,
|
|
77
118
|
/** Writes the factory alone. */
|
|
78
|
-
handler: (ctx) => run(ctx, {
|
|
119
|
+
handler: (ctx) => run(ctx, {
|
|
120
|
+
kind: "factory",
|
|
121
|
+
name: ctx.arguments.name,
|
|
122
|
+
test: false,
|
|
123
|
+
dryRun: ctx.flags.dryRun,
|
|
124
|
+
force: ctx.flags.force,
|
|
125
|
+
}),
|
|
79
126
|
});
|
|
80
127
|
/**
|
|
81
128
|
* A handler for a kind that takes only `--test` and `--dry-run`.
|
|
@@ -85,21 +132,53 @@ export const factory = createCommand(SDXC_COMMANDS.make.factory, {
|
|
|
85
132
|
function plain(kind) {
|
|
86
133
|
return createCommand(SDXC_COMMANDS.make[kind], {
|
|
87
134
|
middleware: MAKE_MIDDLEWARE,
|
|
88
|
-
/**
|
|
135
|
+
/**
|
|
136
|
+
* Writes the file and, unless `--no-test` or `make.tests` says otherwise, its test; a
|
|
137
|
+
* command also takes `--spec` / `make.specs` for its pairing `.spec`.
|
|
138
|
+
*/
|
|
89
139
|
handler: (ctx) => run(ctx, {
|
|
90
140
|
kind,
|
|
91
141
|
name: ctx.arguments.name,
|
|
92
142
|
test: ctx.flags.test,
|
|
143
|
+
spec: "spec" in ctx.flags ? ctx.flags.spec : undefined,
|
|
93
144
|
dryRun: ctx.flags.dryRun,
|
|
145
|
+
force: ctx.flags.force,
|
|
94
146
|
}),
|
|
95
147
|
});
|
|
96
148
|
}
|
|
97
|
-
/** `sdxc make middleware`. */
|
|
98
|
-
export const middleware =
|
|
149
|
+
/** `sdxc make middleware`, which mounts the middleware on a chain under `--mount`. */
|
|
150
|
+
export const middleware = createCommand(SDXC_COMMANDS.make.middleware, {
|
|
151
|
+
middleware: MAKE_MIDDLEWARE,
|
|
152
|
+
/** `--mount` names a router initializer or a chain module the project has. */
|
|
153
|
+
handler: (ctx) => run(ctx, {
|
|
154
|
+
kind: "middleware",
|
|
155
|
+
name: ctx.arguments.name,
|
|
156
|
+
mount: ctx.flags.mount,
|
|
157
|
+
test: ctx.flags.test,
|
|
158
|
+
dryRun: ctx.flags.dryRun,
|
|
159
|
+
force: ctx.flags.force,
|
|
160
|
+
}),
|
|
161
|
+
});
|
|
99
162
|
/** `sdxc make validator`. */
|
|
100
163
|
export const validator = plain("validator");
|
|
101
|
-
/** `sdxc make model
|
|
102
|
-
export const model =
|
|
164
|
+
/** `sdxc make model`, with a column per field it is given, its migration and its factory. */
|
|
165
|
+
export const model = createCommand(SDXC_COMMANDS.make.model, {
|
|
166
|
+
middleware: MAKE_MIDDLEWARE,
|
|
167
|
+
/**
|
|
168
|
+
* Writes the model with its fields' columns, the migration creating its table and its factory,
|
|
169
|
+
* each unless `--skip` names it, and the model's test unless `--no-test` says otherwise.
|
|
170
|
+
*/
|
|
171
|
+
handler: (ctx) => run(ctx, {
|
|
172
|
+
kind: "model",
|
|
173
|
+
name: ctx.arguments.name,
|
|
174
|
+
fields: ctx.arguments.fields,
|
|
175
|
+
chain: ctx.flags.chain,
|
|
176
|
+
skip: ctx.flags.skip,
|
|
177
|
+
test: ctx.flags.test,
|
|
178
|
+
dryRun: ctx.flags.dryRun,
|
|
179
|
+
force: ctx.flags.force,
|
|
180
|
+
}),
|
|
181
|
+
});
|
|
103
182
|
/** `sdxc make service`. */
|
|
104
183
|
export const service = plain("service");
|
|
105
184
|
/** `sdxc make policy`. */
|
|
@@ -107,9 +186,37 @@ export const policy = plain("policy");
|
|
|
107
186
|
/** `sdxc make initializer`. */
|
|
108
187
|
export const initializer = plain("initializer");
|
|
109
188
|
/** `sdxc make email`. */
|
|
110
|
-
|
|
189
|
+
/** `sdxc make email`, which declares the email with its fields as props and maps its template. */
|
|
190
|
+
export const email = createCommand(SDXC_COMMANDS.make.email, {
|
|
191
|
+
middleware: MAKE_MIDDLEWARE,
|
|
192
|
+
/** Writes the template and, unless `--no-test` or `make.tests` says otherwise, its test. */
|
|
193
|
+
handler: (ctx) => run(ctx, {
|
|
194
|
+
kind: "email",
|
|
195
|
+
name: ctx.arguments.name,
|
|
196
|
+
fields: ctx.arguments.fields,
|
|
197
|
+
test: ctx.flags.test,
|
|
198
|
+
dryRun: ctx.flags.dryRun,
|
|
199
|
+
force: ctx.flags.force,
|
|
200
|
+
}),
|
|
201
|
+
});
|
|
111
202
|
/** `sdxc make command`, which declares the command and maps its handler on the command line. */
|
|
112
203
|
export const command = plain("command");
|
|
204
|
+
/** `sdxc make test`, which writes the test of an existing file from its kind's test stub. */
|
|
205
|
+
export const test = createCommand(SDXC_COMMANDS.make.test, {
|
|
206
|
+
middleware: MAKE_MIDDLEWARE,
|
|
207
|
+
/** Reads the kind from the file's folder; a controller's route comes from its router. */
|
|
208
|
+
async handler(ctx) {
|
|
209
|
+
let made = await makeTest(ctx, ctx.project, ctx.packageRoot, {
|
|
210
|
+
file: ctx.arguments.file,
|
|
211
|
+
cwd: ctx.cwd,
|
|
212
|
+
dryRun: ctx.flags.dryRun,
|
|
213
|
+
force: ctx.flags.force,
|
|
214
|
+
});
|
|
215
|
+
if (isFailure(made))
|
|
216
|
+
return made;
|
|
217
|
+
return success();
|
|
218
|
+
},
|
|
219
|
+
});
|
|
113
220
|
/** `sdxc make stubs`, which copies the built-in stubs of the named kinds, or every kind. */
|
|
114
221
|
export const stubs = createCommand(SDXC_COMMANDS.make.stubs, {
|
|
115
222
|
middleware: MAKE_MIDDLEWARE,
|
|
@@ -147,6 +254,13 @@ export const group = createCommand(SDXC_COMMANDS.make, {
|
|
|
147
254
|
return picked;
|
|
148
255
|
method = picked.data;
|
|
149
256
|
}
|
|
150
|
-
return run(ctx, {
|
|
257
|
+
return run(ctx, {
|
|
258
|
+
kind,
|
|
259
|
+
name,
|
|
260
|
+
method,
|
|
261
|
+
test: ctx.flags.test,
|
|
262
|
+
dryRun: ctx.flags.dryRun,
|
|
263
|
+
force: ctx.flags.force,
|
|
264
|
+
});
|
|
151
265
|
},
|
|
152
266
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `sdxc middleware` handler: prints each router's global middleware and every module in
|
|
3
|
+
* `app/http/middleware/`, chains expanded in run order, as text, or as JSON for an agent.
|
|
4
|
+
*
|
|
5
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
6
|
+
* @copyright Sergio Xalambrí 2026
|
|
7
|
+
*/
|
|
8
|
+
/** Reads the routers and the middleware folder and prints every chain. */
|
|
9
|
+
declare const _default: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<Readonly<Record<string, import("@sdxc/cli").Argument<unknown>>>, {
|
|
10
|
+
readonly json: import("@sdxc/cli").Flag<boolean>;
|
|
11
|
+
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
12
|
+
key: typeof import("../middleware.js").CurrentProject;
|
|
13
|
+
value: import("../middleware.js").Project;
|
|
14
|
+
property: "project";
|
|
15
|
+
}>]>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `sdxc middleware` handler: prints each router's global middleware and every module in
|
|
3
|
+
* `app/http/middleware/`, chains expanded in run order, as text, or as JSON for an agent.
|
|
4
|
+
*
|
|
5
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
6
|
+
* @copyright Sergio Xalambrí 2026
|
|
7
|
+
*/
|
|
8
|
+
import { createCommand, success } from "@sdxc/cli";
|
|
9
|
+
import { SDXC_COMMANDS } from "../contract.js";
|
|
10
|
+
import { project } from "../middleware.js";
|
|
11
|
+
import { formatMiddleware, listMiddleware } from "../routes/chains.js";
|
|
12
|
+
/** Reads the routers and the middleware folder and prints every chain. */
|
|
13
|
+
export default createCommand(SDXC_COMMANDS.middleware, {
|
|
14
|
+
middleware: [project()],
|
|
15
|
+
/** Always succeeds once the project is found; a project without routers says so. */
|
|
16
|
+
async handler(ctx) {
|
|
17
|
+
let listing = await listMiddleware(ctx.project.root);
|
|
18
|
+
ctx.stdout(ctx.flags.json ? `${JSON.stringify(listing, null, 2)}\n` : formatMiddleware(listing));
|
|
19
|
+
return success();
|
|
20
|
+
},
|
|
21
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `sdxc models` handler: loads each model in the project's runtime and prints its table and
|
|
3
|
+
* how the migrations compare with it, as a list, one model in full, or JSON for an agent.
|
|
4
|
+
*
|
|
5
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
6
|
+
* @copyright Sergio Xalambrí 2026
|
|
7
|
+
*/
|
|
8
|
+
/** Prints every model as a row, or each named one in full. */
|
|
9
|
+
declare const _default: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
|
|
10
|
+
readonly names: import("@sdxc/cli").Argument<string[]>;
|
|
11
|
+
}, {
|
|
12
|
+
readonly json: import("@sdxc/cli").Flag<boolean>;
|
|
13
|
+
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
14
|
+
key: typeof import("../middleware.js").CurrentProject;
|
|
15
|
+
value: import("../middleware.js").Project;
|
|
16
|
+
property: "project";
|
|
17
|
+
}>]>;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `sdxc models` handler: loads each model in the project's runtime and prints its table and
|
|
3
|
+
* how the migrations compare with it, as a list, one model in full, or JSON for an agent.
|
|
4
|
+
*
|
|
5
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
6
|
+
* @copyright Sergio Xalambrí 2026
|
|
7
|
+
*/
|
|
8
|
+
import { createCommand, success } from "@sdxc/cli";
|
|
9
|
+
import { isFailure } from "@sdxc/result";
|
|
10
|
+
import { SDXC_COMMANDS } from "../contract.js";
|
|
11
|
+
import { project } from "../middleware.js";
|
|
12
|
+
import { formatModel, formatModelList, summarizeModels } from "../models.js";
|
|
13
|
+
/** Prints every model as a row, or each named one in full. */
|
|
14
|
+
export default createCommand(SDXC_COMMANDS.models, {
|
|
15
|
+
middleware: [project()],
|
|
16
|
+
/** Fails naming the model when one is unknown or cannot be loaded. */
|
|
17
|
+
async handler(ctx) {
|
|
18
|
+
let models = await summarizeModels(ctx, ctx.project, ctx.arguments.names);
|
|
19
|
+
if (isFailure(models))
|
|
20
|
+
return models;
|
|
21
|
+
if (ctx.flags.json)
|
|
22
|
+
ctx.stdout(`${JSON.stringify(models.data, null, 2)}\n`);
|
|
23
|
+
else if (ctx.arguments.names.length === 0)
|
|
24
|
+
ctx.stdout(formatModelList(models.data));
|
|
25
|
+
else
|
|
26
|
+
ctx.stdout(models.data.map(formatModel).join("\n"));
|
|
27
|
+
return success();
|
|
28
|
+
},
|
|
29
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `sdxc notes` handler: lists every note comment in the project's layout folders, grouped
|
|
3
|
+
* by file, or as JSON for an agent, with `--tag` choosing the tags.
|
|
4
|
+
*
|
|
5
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
6
|
+
* @copyright Sergio Xalambrí 2026
|
|
7
|
+
*/
|
|
8
|
+
/** Reads the project's code and prints its notes. */
|
|
9
|
+
declare const _default: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<Readonly<Record<string, import("@sdxc/cli").Argument<unknown>>>, {
|
|
10
|
+
readonly tag: import("@sdxc/cli").ValueFlag<string, false, true, false>;
|
|
11
|
+
readonly json: import("@sdxc/cli").Flag<boolean>;
|
|
12
|
+
}>, readonly [import("@sdxc/cli").CommandMiddleware<{
|
|
13
|
+
key: typeof import("../middleware.js").CurrentProject;
|
|
14
|
+
value: import("../middleware.js").Project;
|
|
15
|
+
property: "project";
|
|
16
|
+
}>]>;
|
|
17
|
+
export default _default;
|