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