@sculptor/cli 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +138 -419
- package/bin/sc.js +0 -0
- package/dist/agents.d.ts +2 -0
- package/dist/agents.js +100 -0
- package/dist/agents.js.map +1 -0
- package/dist/cli.js +212 -19
- package/dist/cli.js.map +1 -1
- package/dist/diagnostics.d.ts +16 -0
- package/dist/diagnostics.js +275 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/package-commands.d.ts +24 -0
- package/dist/package-commands.js +299 -0
- package/dist/package-commands.js.map +1 -0
- package/dist/package-registry.d.ts +37 -0
- package/dist/package-registry.js +477 -0
- package/dist/package-registry.js.map +1 -0
- package/dist/scaffold.d.ts +3 -1
- package/dist/scaffold.js +39 -0
- package/dist/scaffold.js.map +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -4,40 +4,51 @@ The SculptorTS CLI is the user-facing command line for the framework.
|
|
|
4
4
|
|
|
5
5
|
It handles:
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
7
|
+
- new app scaffolding
|
|
8
|
+
- package-aware and unpackaged resource generation
|
|
9
|
+
- test generation and registry syncing
|
|
10
|
+
- dev and production startup paths
|
|
11
|
+
- package registry maintenance
|
|
12
|
+
- diagnostics and compatibility checks
|
|
13
|
+
- `AGENTS.md` generation
|
|
14
|
+
- app dependency recovery with `sc install deps`
|
|
15
|
+
- global CLI refresh with `sc update`
|
|
16
|
+
- scaffolded `.gitignore` generation
|
|
15
17
|
|
|
16
18
|
## Version Policy
|
|
17
19
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
- Reason: the earlier release predates the current template-registry layout, the `sc config` command set, the `sc install deps` and `sc update` commands, and the route/handler generation contract used by the current CLI.
|
|
20
|
+
- Release line: `v0.3.x`
|
|
21
|
+
- This line adds package-aware generation, `sc doctor`, `sc agents`, `sculptor.packages.json`, and package alias commands.
|
|
21
22
|
|
|
22
23
|
## Quick Command Sheet
|
|
23
24
|
|
|
24
25
|
| Command | What it does |
|
|
25
26
|
| --- | --- |
|
|
26
27
|
| `sc new <app>` | Creates a new app |
|
|
28
|
+
| `sc agents` | Generates `AGENTS.md` |
|
|
29
|
+
| `sc agents refresh` | Regenerates `AGENTS.md` |
|
|
27
30
|
| `sc dev` | Starts the app from source |
|
|
28
31
|
| `sc start` | Starts the app in production-style mode |
|
|
29
32
|
| `sc build` | Builds the app |
|
|
30
33
|
| `sc lint` | Lints the app |
|
|
31
34
|
| `sc test` | Runs the test suite |
|
|
35
|
+
| `sc sync` | Syncs and validates `sculptor.packages.json` |
|
|
36
|
+
| `sc ls` / `sc list` | Prints the tree and package diagnostics |
|
|
37
|
+
| `sc pkg` / `sc package` | Prints package diagnostics |
|
|
32
38
|
| `sc config get <path>` | Reads a config value |
|
|
33
39
|
| `sc config set <path=value>` | Writes a config value |
|
|
34
40
|
| `sc config list` | Lists the merged config |
|
|
41
|
+
| `sc reg` / `sc register` / `sc r` | Registers a file in the package registry |
|
|
42
|
+
| `sc ureg` / `sc unreg` / `sc unregister` / `sc ur` | Unregisters a file from the package registry |
|
|
43
|
+
| `sc rm` / `sc remove` | Deletes a file and syncs the registry |
|
|
35
44
|
| `sc install deps` | Replays app dependency installs inside a Sculptor app |
|
|
36
45
|
| `sc i deps` | Alias for `sc install deps` |
|
|
37
|
-
| `sc update` | Updates globally installed Sculptor
|
|
46
|
+
| `sc update` | Updates the globally installed Sculptor CLI only |
|
|
47
|
+
| `sc doctor` | Runs project, registry, and compatibility diagnostics |
|
|
38
48
|
| `sc generate` / `sc g` | Generates framework resources |
|
|
39
49
|
| `sc g c user` | Generates a controller resource |
|
|
40
50
|
| `sc g r user` | Generates a functional route and handler pair |
|
|
51
|
+
| `sc g pkg user` | Generates a package index and package-local resources |
|
|
41
52
|
| `sc g c user in src/app/users` | Generates into a custom path |
|
|
42
53
|
| `sc g c in src/app/users` | Infers the name from the path and generates there |
|
|
43
54
|
| `sc g t user -e` | Generates an enum type file |
|
|
@@ -53,18 +64,20 @@ It handles:
|
|
|
53
64
|
- Temporary Execution (via Package Runner): `npx sc` or `npx sculptor`
|
|
54
65
|
- Programmatic API: `runCli()`
|
|
55
66
|
|
|
56
|
-
|
|
67
|
+
If `sc` conflicts with another command on your system, use `sculptor` instead.
|
|
57
68
|
|
|
58
69
|
## Command Reference
|
|
59
70
|
|
|
60
71
|
### `sc new <app>`
|
|
61
72
|
|
|
62
73
|
What it does:
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
74
|
+
|
|
75
|
+
- creates a new Sculptor app in a sibling folder
|
|
76
|
+
- writes the initial framework files
|
|
77
|
+
- installs the package dependencies
|
|
66
78
|
|
|
67
79
|
How it is used:
|
|
80
|
+
|
|
68
81
|
```bash
|
|
69
82
|
sc new my-app
|
|
70
83
|
```
|
|
@@ -87,506 +100,212 @@ Flags:
|
|
|
87
100
|
| `--tsx` | Shortcut for `tsx` dev server |
|
|
88
101
|
| `--nodemon` | Shortcut for `nodemon` dev server |
|
|
89
102
|
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
sc new api
|
|
93
|
-
sc new api --style=hybrid
|
|
94
|
-
sc new api --dev-server=nodemon
|
|
95
|
-
sc new api --framework-lock=false
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
What it solves:
|
|
99
|
-
- You get a ready-to-run app with the framework defaults already wired
|
|
103
|
+
### `sc agents` and `sc agents refresh`
|
|
100
104
|
|
|
101
|
-
|
|
102
|
-
- [packages/cli/src/cli.ts](src/cli.ts)
|
|
103
|
-
- [packages/cli/src/scaffold.ts](src/scaffold.ts)
|
|
104
|
-
- [packages/cli/src/runtime-dependencies.ts](src/runtime-dependencies.ts)
|
|
105
|
+
What they do:
|
|
105
106
|
|
|
106
|
-
|
|
107
|
+
- generate a concise `AGENTS.md`
|
|
108
|
+
- capture package-aware, registry-aware, DI-aware, and CLI-aware guidance for AI coding agents
|
|
107
109
|
|
|
108
|
-
|
|
109
|
-
- Starts the app from source
|
|
110
|
-
- Prints the CLI banner
|
|
110
|
+
Behavior:
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
sc dev --port=4000
|
|
116
|
-
```
|
|
112
|
+
- `sc agents` writes the file if it is missing
|
|
113
|
+
- `sc agents refresh` rewrites the file with the latest framework guidance
|
|
114
|
+
- both commands are safe to run repeatedly
|
|
117
115
|
|
|
118
|
-
|
|
116
|
+
### `sc dev`
|
|
119
117
|
|
|
120
|
-
|
|
121
|
-
| --- | --- |
|
|
122
|
-
| `--port=<number>` | Sets `PORT` for the dev process |
|
|
118
|
+
What it does:
|
|
123
119
|
|
|
124
|
-
|
|
125
|
-
-
|
|
120
|
+
- starts the app from source
|
|
121
|
+
- prints the CLI banner
|
|
126
122
|
|
|
127
123
|
Behavior:
|
|
128
|
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
124
|
+
|
|
125
|
+
- uses `nodemon` when `project.devServer` is `nodemon`
|
|
126
|
+
- uses `tsx` when `project.devServer` is `tsx`
|
|
127
|
+
- refuses to run outside a Sculptor app root
|
|
128
|
+
- suppresses the runtime banner by setting `SCULPTOR_SUPPRESS_BANNER=1`
|
|
132
129
|
|
|
133
130
|
### `sc start`
|
|
134
131
|
|
|
135
132
|
What it does:
|
|
136
|
-
- Starts the app in production-style mode
|
|
137
|
-
|
|
138
|
-
How it is used:
|
|
139
|
-
```bash
|
|
140
|
-
sc start
|
|
141
|
-
sc start --port=4000
|
|
142
|
-
sc start --watch
|
|
143
|
-
```
|
|
144
133
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
| Flag | Meaning |
|
|
148
|
-
| --- | --- |
|
|
149
|
-
| `--port=<number>` | Sets `PORT` for the process |
|
|
150
|
-
| `--watch` | Forces the dev path instead of the built path |
|
|
134
|
+
- starts the app in production-style mode
|
|
151
135
|
|
|
152
136
|
Behavior:
|
|
153
|
-
- If `dist/main.js` exists and `--watch` is not set, it runs the built app
|
|
154
|
-
- If `--watch` is set, it behaves like `sc dev`
|
|
155
|
-
- If no build output exists, it falls back to `tsx src/main.ts`
|
|
156
137
|
|
|
157
|
-
|
|
158
|
-
-
|
|
138
|
+
- if `dist/main.js` exists and `--watch` is not set, it runs the built app
|
|
139
|
+
- if `--watch` is set, it behaves like `sc dev`
|
|
140
|
+
- if no build output exists, it falls back to `tsx src/main.ts`
|
|
159
141
|
|
|
160
142
|
### `sc build`
|
|
161
143
|
|
|
162
144
|
What it does:
|
|
163
|
-
- Runs TypeScript build for the current app
|
|
164
|
-
|
|
165
|
-
How it is used:
|
|
166
|
-
```bash
|
|
167
|
-
sc build
|
|
168
|
-
```
|
|
169
145
|
|
|
170
|
-
|
|
171
|
-
-
|
|
172
|
-
|
|
173
|
-
Behavior:
|
|
174
|
-
- Only works inside a Sculptor app root
|
|
175
|
-
- Uses the app-local `tsconfig.json`
|
|
146
|
+
- runs TypeScript build for the current app
|
|
147
|
+
- runs package validation before TypeScript compile in the current release line
|
|
176
148
|
|
|
177
149
|
### `sc lint`
|
|
178
150
|
|
|
179
151
|
What it does:
|
|
180
|
-
- Runs ESLint from the app root
|
|
181
|
-
|
|
182
|
-
How it is used:
|
|
183
|
-
```bash
|
|
184
|
-
sc lint
|
|
185
|
-
```
|
|
186
152
|
|
|
187
|
-
|
|
188
|
-
- Gives a single framework-aligned lint command
|
|
153
|
+
- runs ESLint from the app root
|
|
189
154
|
|
|
190
155
|
### `sc test`
|
|
191
156
|
|
|
192
157
|
What it does:
|
|
193
|
-
- Runs the app test suite
|
|
194
158
|
|
|
195
|
-
|
|
196
|
-
```bash
|
|
197
|
-
sc test
|
|
198
|
-
```
|
|
159
|
+
- runs the app test suite
|
|
199
160
|
|
|
200
161
|
Behavior:
|
|
201
|
-
- If `src/tests/runner.spec.ts` exists, runs `vitest run src/tests/runner.spec.ts`
|
|
202
|
-
- If the runner does not exist, falls back to `vitest run`
|
|
203
162
|
|
|
204
|
-
|
|
205
|
-
-
|
|
163
|
+
- if `src/tests/runner.spec.ts` exists, it runs that entrypoint
|
|
164
|
+
- otherwise it falls back to `vitest run`
|
|
206
165
|
|
|
207
|
-
### `sc
|
|
166
|
+
### `sc sync`
|
|
208
167
|
|
|
209
168
|
What it does:
|
|
210
|
-
- Reads, writes, and lists app config
|
|
211
169
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
sc config get logging
|
|
215
|
-
sc config set logging.dogMode=false
|
|
216
|
-
sc config list
|
|
217
|
-
```
|
|
170
|
+
- validates and refreshes `sculptor.packages.json`
|
|
171
|
+
- checks package ownership, stale files, missing files, and registry consistency
|
|
218
172
|
|
|
219
173
|
Behavior:
|
|
220
|
-
- `get` reads a dot-path from the merged config
|
|
221
|
-
- `set` writes a dot-path assignment while preserving JSON formatting when possible
|
|
222
|
-
- `list` prints the flattened merged config
|
|
223
|
-
- `sculptor` supports the same command set as `sc`
|
|
224
174
|
|
|
225
|
-
|
|
175
|
+
- supports `-p`, `--p`, `-pkg`, `--pkg`, `-package`, and `--package`
|
|
176
|
+
- package targeting is exact and does not singularize or pluralize names
|
|
177
|
+
- warnings do not block the build path unless metadata is malformed or irrecoverable
|
|
226
178
|
|
|
227
|
-
|
|
228
|
-
- Replays the standard Sculptor app dependency installation sequence
|
|
229
|
-
- Runs inside an existing Sculptor app root
|
|
230
|
-
- Helps recover after an interrupted `npm i` during setup
|
|
179
|
+
### `sc ls` / `sc list`
|
|
231
180
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
```
|
|
181
|
+
What they do:
|
|
182
|
+
|
|
183
|
+
- print package and tree diagnostics
|
|
184
|
+
- show registered files, missing files, and unregistered files
|
|
237
185
|
|
|
238
186
|
Behavior:
|
|
239
|
-
- Uses `npm i` for the app package.json dependencies first
|
|
240
|
-
- Installs the Sculptor runtime dependencies next
|
|
241
|
-
- Reinstalls the Sculptor CLI/config/router dev dependencies last
|
|
242
|
-
- Refuses to run outside a Sculptor app root
|
|
243
187
|
|
|
244
|
-
|
|
188
|
+
- `-t`, `--tree`, `-tree`, and `--t` enable tree output
|
|
189
|
+
- package targeting uses the same exact-name flags as `sc sync`
|
|
245
190
|
|
|
246
|
-
|
|
247
|
-
- Updates globally installed Sculptor packages to their latest versions
|
|
191
|
+
### `sc pkg` / `sc package`
|
|
248
192
|
|
|
249
|
-
|
|
250
|
-
```bash
|
|
251
|
-
sc update
|
|
252
|
-
```
|
|
193
|
+
What they do:
|
|
253
194
|
|
|
254
|
-
|
|
255
|
-
-
|
|
256
|
-
- Uses the active package manager when possible
|
|
257
|
-
- Updates the global Sculptor package set in one pass
|
|
195
|
+
- print package diagnostics
|
|
196
|
+
- show package path, index path, and tracked files
|
|
258
197
|
|
|
259
|
-
### `sc
|
|
198
|
+
### `sc reg` / `sc register` / `sc r`
|
|
260
199
|
|
|
261
|
-
What
|
|
262
|
-
- Generates framework resources in the current app
|
|
200
|
+
What they do:
|
|
263
201
|
|
|
264
|
-
|
|
265
|
-
```bash
|
|
266
|
-
sc generate controller user
|
|
267
|
-
sc g c user
|
|
268
|
-
```
|
|
202
|
+
- register a file in `sculptor.packages.json`
|
|
269
203
|
|
|
270
|
-
|
|
204
|
+
### `sc ureg` / `sc unreg` / `sc unregister` / `sc ur`
|
|
271
205
|
|
|
272
|
-
|
|
273
|
-
| --- | --- |
|
|
274
|
-
| controller | `c`, `controller` |
|
|
275
|
-
| service | `s`, `service` |
|
|
276
|
-
| module | `m`, `mo`, `module` |
|
|
277
|
-
| middleware | `mw`, `middleware` |
|
|
278
|
-
| type | `t`, `type` |
|
|
279
|
-
| route | `r`, `route`, `resource` |
|
|
206
|
+
What they do:
|
|
280
207
|
|
|
281
|
-
|
|
282
|
-
- Refuses to run outside a Sculptor app root
|
|
283
|
-
- Controller generation is controller-first by default and can opt into paired functional route files with `--functional`
|
|
284
|
-
- Route generation always writes the paired functional route and handler files
|
|
285
|
-
- Rewrites the test registry when test generation is enabled
|
|
208
|
+
- unregister a file from `sculptor.packages.json`
|
|
286
209
|
|
|
287
|
-
|
|
288
|
-
- Your app stays consistent as it grows
|
|
210
|
+
### `sc rm` / `sc remove`
|
|
289
211
|
|
|
290
|
-
|
|
212
|
+
What they do:
|
|
291
213
|
|
|
292
|
-
|
|
293
|
-
-
|
|
214
|
+
- delete a file
|
|
215
|
+
- sync the registry after removal
|
|
294
216
|
|
|
295
|
-
|
|
296
|
-
```bash
|
|
297
|
-
sc help
|
|
298
|
-
sc help generate
|
|
299
|
-
sc help controller
|
|
300
|
-
sc help module
|
|
301
|
-
sc help middleware
|
|
302
|
-
sc help type
|
|
303
|
-
sc help route
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
### `sc version`
|
|
217
|
+
### `sc config`
|
|
307
218
|
|
|
308
219
|
What it does:
|
|
309
|
-
- Prints the CLI version and the banner
|
|
310
220
|
|
|
311
|
-
|
|
312
|
-
```bash
|
|
313
|
-
sc version
|
|
314
|
-
sc v
|
|
315
|
-
sc -v
|
|
316
|
-
sc --v
|
|
317
|
-
sc --version
|
|
318
|
-
```
|
|
221
|
+
- reads, writes, and lists app config
|
|
319
222
|
|
|
320
|
-
|
|
223
|
+
Behavior:
|
|
321
224
|
|
|
322
|
-
|
|
225
|
+
- `get` reads a dot-path from the merged config
|
|
226
|
+
- `set` writes a dot-path assignment while preserving JSON formatting when possible
|
|
227
|
+
- `list` prints the flattened merged config
|
|
228
|
+
- `sculptor` supports the same command set as `sc`
|
|
323
229
|
|
|
324
|
-
|
|
325
|
-
| --- | --- |
|
|
326
|
-
| `-v` | Print version |
|
|
327
|
-
| `--v` | Print version |
|
|
328
|
-
| `--version` | Print version |
|
|
329
|
-
| `version` | Print version |
|
|
330
|
-
| `v` | Print version |
|
|
331
|
-
| `-h` | Print help |
|
|
332
|
-
| `--help` | Print help |
|
|
230
|
+
### `sc install deps` and `sc i deps`
|
|
333
231
|
|
|
334
|
-
|
|
232
|
+
What it does:
|
|
335
233
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
| `--version` | Scaffold version |
|
|
340
|
-
| `--style` | Routing style |
|
|
341
|
-
| `--decorator` | Decorator routing shortcut |
|
|
342
|
-
| `--functional` | Functional routing shortcut |
|
|
343
|
-
| `--hybrid` | Hybrid routing shortcut |
|
|
344
|
-
| `--frameworkLock` | Framework lock |
|
|
345
|
-
| `--frameworklock` | Framework lock |
|
|
346
|
-
| `--framework-lock` | Framework lock |
|
|
347
|
-
| `--dev-server` | Dev server selection |
|
|
348
|
-
| `--devserver` | Dev server selection |
|
|
349
|
-
| `--tsx` | Dev server shortcut |
|
|
350
|
-
| `--nodemon` | Dev server shortcut |
|
|
351
|
-
|
|
352
|
-
### `sc dev` / `sc start` flags
|
|
234
|
+
- replays the standard Sculptor app dependency installation sequence
|
|
235
|
+
- runs inside an existing Sculptor app root
|
|
236
|
+
- helps recover after an interrupted `npm i` during setup
|
|
353
237
|
|
|
354
|
-
|
|
355
|
-
| --- | --- |
|
|
356
|
-
| `--port` | Sets the process port |
|
|
357
|
-
| `--watch` | Only used by `sc start` |
|
|
238
|
+
Behavior:
|
|
358
239
|
|
|
359
|
-
|
|
240
|
+
- uses `npm i` for the app package.json dependencies first
|
|
241
|
+
- installs the Sculptor runtime dependencies next
|
|
242
|
+
- reinstalls the Sculptor CLI/config/router dev dependencies last
|
|
243
|
+
- refuses to run outside a Sculptor app root
|
|
360
244
|
|
|
361
|
-
|
|
362
|
-
| --- | --- |
|
|
363
|
-
| `--functional` | Use functional routing mode |
|
|
364
|
-
| `--with-routes` | Alias for paired functional route generation |
|
|
365
|
-
| `--decorator` | Use decorator routing mode |
|
|
366
|
-
| `--hybrid` | Use hybrid routing mode |
|
|
367
|
-
| `--style` | Explicitly set routing mode |
|
|
368
|
-
| `in <path>` | Write files into a custom directory |
|
|
369
|
-
| `-i` | Type generator creates `*.interface.ts` |
|
|
370
|
-
| `-interface` | Type generator creates `*.interface.ts` |
|
|
371
|
-
| `-c` | Type generator creates `*.class.ts` |
|
|
372
|
-
| `-class` | Type generator creates `*.class.ts` |
|
|
373
|
-
| `-e` | Type generator creates `*.enum.ts` |
|
|
374
|
-
| `-enum` | Type generator creates `*.enum.ts` |
|
|
375
|
-
|
|
376
|
-
## Generator Behavior
|
|
377
|
-
|
|
378
|
-
### Controller generation
|
|
245
|
+
### `sc update`
|
|
379
246
|
|
|
380
247
|
What it does:
|
|
381
|
-
- Writes `*.controller.ts` by default
|
|
382
|
-
- Pass `--functional` or `--with-routes` to also write paired `*.route.ts` and `*.route.handler.ts` files
|
|
383
|
-
- In functional-first app flows, the paired functional route files are the standard route shape
|
|
384
|
-
|
|
385
|
-
Examples:
|
|
386
|
-
```bash
|
|
387
|
-
sc generate controller user
|
|
388
|
-
sc g c user
|
|
389
|
-
sc g c user in src/app/users
|
|
390
|
-
sc g c in src/app/users
|
|
391
|
-
sc g c user --functional
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
If you use `in <path>`:
|
|
395
|
-
- the file location changes to that path
|
|
396
|
-
- the file name still follows the generator suffix
|
|
397
|
-
- if you do not provide a name, the CLI infers it from the last path segment
|
|
398
|
-
- the generated test file, when enabled, is written under `src/tests`
|
|
399
248
|
|
|
400
|
-
|
|
249
|
+
- updates the globally installed Sculptor CLI package only
|
|
401
250
|
|
|
402
|
-
|
|
403
|
-
- Writes `*.service.ts`
|
|
251
|
+
How it is used:
|
|
404
252
|
|
|
405
|
-
Examples:
|
|
406
253
|
```bash
|
|
407
|
-
sc
|
|
408
|
-
sc g s user
|
|
409
|
-
sc g s user in src/app/services
|
|
254
|
+
sc update
|
|
410
255
|
```
|
|
411
256
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
What it does:
|
|
415
|
-
- Writes `*.module.ts`
|
|
257
|
+
Behavior:
|
|
416
258
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
sc g m user
|
|
421
|
-
sc g mo user
|
|
422
|
-
```
|
|
259
|
+
- only installs `@sculptor/cli`
|
|
260
|
+
- does not mutate runtime package dependencies globally
|
|
261
|
+
- remains separate from scaffold-time template-registry recovery
|
|
423
262
|
|
|
424
|
-
|
|
263
|
+
## Alias Notes
|
|
425
264
|
|
|
426
|
-
|
|
427
|
-
-
|
|
265
|
+
- `sc g` -> `sc generate`
|
|
266
|
+
- `pkg` -> `package`
|
|
267
|
+
- `ls` -> `list`
|
|
268
|
+
- `reg` -> `register`
|
|
269
|
+
- `ureg` -> `unreg` -> `unregister` -> `ur`
|
|
270
|
+
- `rm` -> `remove`
|
|
428
271
|
|
|
429
|
-
|
|
430
|
-
```bash
|
|
431
|
-
sc generate middleware auth
|
|
432
|
-
sc g mw auth
|
|
433
|
-
sc g mw auth in src/app/middlewares
|
|
434
|
-
```
|
|
272
|
+
## Package Target Flags
|
|
435
273
|
|
|
436
|
-
|
|
274
|
+
Package-targeting flags accept either `=value` or separate `value` forms:
|
|
437
275
|
|
|
438
|
-
|
|
439
|
-
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
276
|
+
- `-p`
|
|
277
|
+
- `--p`
|
|
278
|
+
- `-pkg`
|
|
279
|
+
- `--pkg`
|
|
280
|
+
- `-package`
|
|
281
|
+
- `--package`
|
|
444
282
|
|
|
445
283
|
Examples:
|
|
446
|
-
```bash
|
|
447
|
-
sc g t
|
|
448
|
-
sc generate type user
|
|
449
|
-
sc g t user
|
|
450
|
-
sc generate type user -interface
|
|
451
|
-
sc g t user -i
|
|
452
|
-
sc generate type user -class
|
|
453
|
-
sc g t user -c
|
|
454
|
-
sc generate type user -enum
|
|
455
|
-
sc g t user -e
|
|
456
|
-
```
|
|
457
|
-
|
|
458
|
-
If you omit the name, the CLI falls back to `index` unless a custom output path lets it infer a name from the directory.
|
|
459
284
|
|
|
460
|
-
### Route generation
|
|
461
|
-
|
|
462
|
-
What it does:
|
|
463
|
-
- Writes `*.route.ts` and `*.route.handler.ts`
|
|
464
|
-
- Uses the Sculptor functional router builder
|
|
465
|
-
- Generates a paired handler with try/catch and error middleware boilerplate
|
|
466
|
-
|
|
467
|
-
Examples:
|
|
468
285
|
```bash
|
|
469
|
-
sc
|
|
470
|
-
sc g
|
|
471
|
-
sc g
|
|
286
|
+
sc g pkg user -p=user
|
|
287
|
+
sc g pkg user --pkg user
|
|
288
|
+
sc g pkg user -package=user
|
|
289
|
+
sc ls -t --package user
|
|
472
290
|
```
|
|
473
291
|
|
|
474
|
-
##
|
|
292
|
+
## App Root Rule
|
|
475
293
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
| Setting | Result |
|
|
479
|
-
| --- | --- |
|
|
480
|
-
| `true` | Matching `*.spec.ts` files are generated |
|
|
481
|
-
| `false` | No new spec files are generated |
|
|
482
|
-
|
|
483
|
-
Generated spec names:
|
|
484
|
-
|
|
485
|
-
- `user.controller.spec.ts`
|
|
486
|
-
- `user.service.spec.ts`
|
|
487
|
-
- `user.route.spec.ts`
|
|
488
|
-
- `auth.middleware.spec.ts`
|
|
489
|
-
|
|
490
|
-
Default scaffold test files:
|
|
491
|
-
|
|
492
|
-
- `src/tests/main.spec.ts`
|
|
493
|
-
- `src/tests/health.controller.spec.ts`
|
|
494
|
-
- `src/tests/health.route.spec.ts`
|
|
495
|
-
- `src/tests/registry.ts`
|
|
496
|
-
- `src/tests/runner.ts`
|
|
497
|
-
- `src/tests/runner.spec.ts`
|
|
498
|
-
|
|
499
|
-
## Test Harness Behavior
|
|
500
|
-
|
|
501
|
-
What it does:
|
|
502
|
-
- Discovers every `*.spec.ts` file under `src/tests`
|
|
503
|
-
- Writes `src/tests/registry.ts`
|
|
504
|
-
- Writes `src/tests/runner.ts`
|
|
505
|
-
- Writes `src/tests/runner.spec.ts`
|
|
506
|
-
|
|
507
|
-
How it is used:
|
|
508
|
-
- `sc test` runs the registry runner when it exists
|
|
509
|
-
|
|
510
|
-
What it solves:
|
|
511
|
-
- You do not have to manually keep your test suite entrypoint updated
|
|
512
|
-
|
|
513
|
-
## App Root Rules
|
|
514
|
-
|
|
515
|
-
Only these commands work from outside a Sculptor app root:
|
|
294
|
+
The CLI only allows certain commands outside a Sculptor app root:
|
|
516
295
|
|
|
517
296
|
- `sc new`
|
|
297
|
+
- `sc agents`
|
|
298
|
+
- `sc agents refresh`
|
|
518
299
|
- `sc help`
|
|
519
300
|
- `sc version`
|
|
301
|
+
- `sc doctor`
|
|
520
302
|
- `sc update`
|
|
521
303
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
Everything else requires `sculptor.json` in the current directory.
|
|
525
|
-
|
|
526
|
-
If you try to run a restricted command outside an app root, the CLI stops with a clear error.
|
|
527
|
-
|
|
528
|
-
## CLI Banner Behavior
|
|
529
|
-
|
|
530
|
-
The version line in the banner is automatic.
|
|
531
|
-
|
|
532
|
-
If the package version changes, the banner version changes too.
|
|
533
|
-
|
|
534
|
-
## Programmatic Use
|
|
535
|
-
|
|
536
|
-
```ts
|
|
537
|
-
import { runCli } from "@sculptor/cli";
|
|
538
|
-
|
|
539
|
-
await runCli(["node", "sc", "help"]);
|
|
540
|
-
```
|
|
541
|
-
|
|
542
|
-
## Exports
|
|
543
|
-
|
|
544
|
-
`@sculptor/cli` re-exports:
|
|
545
|
-
|
|
546
|
-
- `runCli`
|
|
547
|
-
- `resolveProjectMetadata`
|
|
548
|
-
- `scaffoldProject`
|
|
549
|
-
- `generateResourceFiles`
|
|
550
|
-
- `writeGeneratedFiles`
|
|
551
|
-
- `syncTestHarness`
|
|
552
|
-
- the scaffold help strings
|
|
553
|
-
|
|
554
|
-
These generator helpers now resolve `@sculptor/template-registry` at runtime and can prompt to install it if the package is missing.
|
|
555
|
-
Call them with `await` when using the package programmatically.
|
|
556
|
-
|
|
557
|
-
## Package Scripts
|
|
558
|
-
|
|
559
|
-
- `npm run cli` runs the CLI source with `tsx`
|
|
560
|
-
- `npm run build` compiles the package
|
|
561
|
-
- `npm run prepack` builds before packaging
|
|
562
|
-
|
|
563
|
-
## Runtime Boundaries
|
|
564
|
-
|
|
565
|
-
- `@sculptor/template-registry` is a runtime dependency, not a dev-only helper
|
|
566
|
-
- the CLI loads it lazily so global installs can recover cleanly when the package is missing
|
|
567
|
-
- future plugin/template loaders should follow the same pattern: detect, explain, recover, then retry
|
|
568
|
-
- publish `@sculptor/template-registry` before `@sculptor/cli` so global installs never see a missing runtime dependency during rollout
|
|
569
|
-
|
|
570
|
-
## If You Only Remember One Thing
|
|
571
|
-
|
|
572
|
-
If you are inside a Sculptor app root, use:
|
|
573
|
-
|
|
574
|
-
```bash
|
|
575
|
-
sc dev
|
|
576
|
-
sc generate controller user
|
|
577
|
-
sc generate route user
|
|
578
|
-
sc config list
|
|
579
|
-
sc test
|
|
580
|
-
```
|
|
581
|
-
|
|
582
|
-
If you are outside an app root, only use:
|
|
583
|
-
|
|
584
|
-
```bash
|
|
585
|
-
sc new
|
|
586
|
-
sc help
|
|
587
|
-
sc version
|
|
588
|
-
```
|
|
304
|
+
The runtime commands require `sculptor.json` in the current app root.
|
|
589
305
|
|
|
590
|
-
|
|
306
|
+
Next:
|
|
591
307
|
|
|
592
|
-
|
|
308
|
+
- [packages/core/README.md](../core/README.md)
|
|
309
|
+
- [packages/di/README.md](../di/README.md)
|
|
310
|
+
- [packages/router/README.md](../router/README.md)
|
|
311
|
+
- [packages/template-registry/README.md](../template-registry/README.md)
|