@wolfstar/cli 2.2.0 → 2.3.0-next-20261004142621
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/LICENSE +201 -201
- package/README.md +465 -304
- package/dist/{_shared-DJrpalNQ.js → _shared-BIQK0Bhm.js} +2 -2
- package/dist/_shared-BIQK0Bhm.js.map +1 -0
- package/dist/bridge-BvkmlAOZ.js +410 -0
- package/dist/bridge-BvkmlAOZ.js.map +1 -0
- package/dist/{build-CluOR8dJ.js → build-DJcc95Yq.js} +5 -5
- package/dist/build-DJcc95Yq.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/{codegen-D6V1i_fa.js → codegen-aJSyPz-J.js} +4 -4
- package/dist/codegen-aJSyPz-J.js.map +1 -0
- package/dist/command-diff-BK912Hjc.js +78 -0
- package/dist/command-diff-BK912Hjc.js.map +1 -0
- package/dist/commands-CIPWQtF0.js +3 -0
- package/dist/commands-Clpbqq3K.js +15 -0
- package/dist/commands-Clpbqq3K.js.map +1 -0
- package/dist/{commands-BJ589_AC.js → commands-DVC7ky6f.js} +259 -9
- package/dist/commands-DVC7ky6f.js.map +1 -0
- package/dist/completions-D2KYtrrv.js +161 -0
- package/dist/completions-D2KYtrrv.js.map +1 -0
- package/dist/{dev-DJJZN4NJ.js → dev-oPPVR7d_.js} +434 -28
- package/dist/dev-oPPVR7d_.js.map +1 -0
- package/dist/{diagnostics-3JRAy8Xj.js → diagnostics-BysbNnPD.js} +22 -1
- package/dist/diagnostics-BysbNnPD.js.map +1 -0
- package/dist/doctor-DkVUwgDd.js +334 -0
- package/dist/doctor-DkVUwgDd.js.map +1 -0
- package/dist/errors-COFWKKKw.js.map +1 -1
- package/dist/external-CxFKxwi3.js.map +1 -1
- package/dist/framework-auto-imports-Gu_PXSyr.js.map +1 -1
- package/dist/{hooks-BfDFM38k.js → hooks-Cy6F2bhH.js} +20 -4
- package/dist/hooks-Cy6F2bhH.js.map +1 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/{info-C1Kx_4Og.js → info-CKJVMWIT.js} +15 -4
- package/dist/info-CKJVMWIT.js.map +1 -0
- package/dist/{locales-BzOLRBVg.js → locales-BJAP4HYf.js} +5 -5
- package/dist/locales-BJAP4HYf.js.map +1 -0
- package/dist/log-view-B7uJEnMR.js +342 -0
- package/dist/log-view-B7uJEnMR.js.map +1 -0
- package/dist/{nitro-yjqZBh5L.js → nitro-B8u1iVgf.js} +2 -2
- package/dist/nitro-B8u1iVgf.js.map +1 -0
- package/dist/none-uC_wi_l4.js.map +1 -1
- package/dist/output-mode-Bp7Da8vJ.js.map +1 -1
- package/dist/{plain-B6z85uQP.js → plain-DG7cy0Kk.js} +7 -2
- package/dist/plain-DG7cy0Kk.js.map +1 -0
- package/dist/{prepare-Cb45Z4re.js → prepare-BM93i3Rm.js} +4 -4
- package/dist/prepare-BM93i3Rm.js.map +1 -0
- package/dist/{project-D-8VIcyF.js → project-zlQStwsf.js} +2 -2
- package/dist/project-zlQStwsf.js.map +1 -0
- package/dist/{run-BiLZqib3.js → run-DMM2YlP3.js} +2 -12
- package/dist/run-DMM2YlP3.js.map +1 -0
- package/dist/{theme-3Fc_LI-2.js → theme-yS2h5dd_.js} +25 -1
- package/dist/theme-yS2h5dd_.js.map +1 -0
- package/dist/tsc-C5l5TQGC.js +3 -0
- package/dist/{tsc-DEBcwIO0.js → tsc-puVAcwmo.js} +24 -5
- package/dist/tsc-puVAcwmo.js.map +1 -0
- package/dist/{tsdown-DrWXld54.js → tsdown-Dwt3JhPw.js} +2 -2
- package/dist/tsdown-Dwt3JhPw.js.map +1 -0
- package/dist/{tui-BRddrLQP.js → tui-nldGSD4c.js} +913 -141
- package/dist/tui-nldGSD4c.js.map +1 -0
- package/dist/version-BzclCE19.js.map +1 -1
- package/dist/{vite-Bf7nrJx7.js → vite-YZUtv2Hk.js} +2 -2
- package/dist/vite-YZUtv2Hk.js.map +1 -0
- package/package.json +5 -5
- package/dist/_shared-DJrpalNQ.js.map +0 -1
- package/dist/build-CluOR8dJ.js.map +0 -1
- package/dist/codegen-D6V1i_fa.js.map +0 -1
- package/dist/commands-BJ589_AC.js.map +0 -1
- package/dist/dev-DJJZN4NJ.js.map +0 -1
- package/dist/diagnostics-3JRAy8Xj.js.map +0 -1
- package/dist/hooks-BfDFM38k.js.map +0 -1
- package/dist/info-C1Kx_4Og.js.map +0 -1
- package/dist/locales-BzOLRBVg.js.map +0 -1
- package/dist/log-buffer-CY82aqnb.js +0 -72
- package/dist/log-buffer-CY82aqnb.js.map +0 -1
- package/dist/nitro-yjqZBh5L.js.map +0 -1
- package/dist/plain-B6z85uQP.js.map +0 -1
- package/dist/prepare-Cb45Z4re.js.map +0 -1
- package/dist/project-D-8VIcyF.js.map +0 -1
- package/dist/run-BiLZqib3.js.map +0 -1
- package/dist/theme-3Fc_LI-2.js.map +0 -1
- package/dist/tsc-B931Ezh7.js +0 -3
- package/dist/tsc-DEBcwIO0.js.map +0 -1
- package/dist/tsdown-DrWXld54.js.map +0 -1
- package/dist/tui-BRddrLQP.js.map +0 -1
- package/dist/tunnel-DHSxOZKr.js +0 -175
- package/dist/tunnel-DHSxOZKr.js.map +0 -1
- package/dist/vite-Bf7nrJx7.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,304 +1,465 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
# @wolfstar/cli
|
|
4
|
-
|
|
5
|
-
**The `stars` command line interface for [`@wolfstar/http-framework`](../http-framework) projects.**
|
|
6
|
-
|
|
7
|
-
[](https://github.com/wolfstar-project/stars-components/blob/main/LICENSE)
|
|
8
|
-
[](https://www.npmjs.com/package/@wolfstar/cli)
|
|
9
|
-
|
|
10
|
-
</div>
|
|
11
|
-
|
|
12
|
-
## Description
|
|
13
|
-
|
|
14
|
-
`stars` is a small, fast CLI that owns the developer workflow of a bot built with `@wolfstar/http-framework`. Like
|
|
15
|
-
Nuxt splits `nuxt.config`/`defineNuxtConfig` (owned by `@nuxt/schema`, which both `nuxt` and the separate `@nuxt/cli`
|
|
16
|
-
package depend on) from `nuxi`, the typed `stars.config.*` schema and loader live in their own package,
|
|
17
|
-
[`@wolfstar/schema`](../schema), which both [`@wolfstar/http-framework`](../http-framework) (re-exported
|
|
18
|
-
as `@wolfstar/http-framework/config`) and this package depend on — this package only consumes it to drive its
|
|
19
|
-
commands. `@wolfstar/http-framework` also depends on this package and exposes it as its own `stars` binary (the way
|
|
20
|
-
`nuxt` exposes `nuxi`'s), so installing it is enough to get `stars` without a separate `@wolfstar/cli` install; this
|
|
21
|
-
package has no install-time dependency on `@wolfstar/http-framework` in return, the same way `@nuxt/cli` has none on
|
|
22
|
-
`nuxt` — its own commands:
|
|
23
|
-
|
|
24
|
-
- `stars dev` builds the project, starts the bot, restarts it
|
|
25
|
-
- `stars build` runs the configured build tool once.
|
|
26
|
-
- `stars info` prints the resolved configuration and environment (`--json` for scripts).
|
|
27
|
-
- `stars codegen` runs the configured code generators (`--check` for CI).
|
|
28
|
-
- `stars prepare` generates `.stars/tsconfig.json` and the auto imports declaration file (`--check` for CI).
|
|
29
|
-
- `stars commands` inspects and cleans the application commands Discord has deployed.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
stars
|
|
73
|
-
stars
|
|
74
|
-
stars
|
|
75
|
-
stars
|
|
76
|
-
stars --
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
The
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
`
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
stars
|
|
151
|
-
stars
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
`
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
`
|
|
232
|
-
`
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
with
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
the
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# @wolfstar/cli
|
|
4
|
+
|
|
5
|
+
**The `stars` command line interface for [`@wolfstar/http-framework`](../http-framework) projects.**
|
|
6
|
+
|
|
7
|
+
[](https://github.com/wolfstar-project/stars-components/blob/main/LICENSE)
|
|
8
|
+
[](https://www.npmjs.com/package/@wolfstar/cli)
|
|
9
|
+
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
## Description
|
|
13
|
+
|
|
14
|
+
`stars` is a small, fast CLI that owns the developer workflow of a bot built with `@wolfstar/http-framework`. Like
|
|
15
|
+
Nuxt splits `nuxt.config`/`defineNuxtConfig` (owned by `@nuxt/schema`, which both `nuxt` and the separate `@nuxt/cli`
|
|
16
|
+
package depend on) from `nuxi`, the typed `stars.config.*` schema and loader live in their own package,
|
|
17
|
+
[`@wolfstar/schema`](../schema), which both [`@wolfstar/http-framework`](../http-framework) (re-exported
|
|
18
|
+
as `@wolfstar/http-framework/config`) and this package depend on — this package only consumes it to drive its
|
|
19
|
+
commands. `@wolfstar/http-framework` also depends on this package and exposes it as its own `stars` binary (the way
|
|
20
|
+
`nuxt` exposes `nuxi`'s), so installing it is enough to get `stars` without a separate `@wolfstar/cli` install; this
|
|
21
|
+
package has no install-time dependency on `@wolfstar/http-framework` in return, the same way `@nuxt/cli` has none on
|
|
22
|
+
`nuxt` — its own commands:
|
|
23
|
+
|
|
24
|
+
- `stars dev` builds the project, starts the bot, restarts it (or leaves the change to the bot's hot reload) and shows what is happening in a full-screen dashboard: status, log channels and levels you can filter, and a prompt before changed commands are redeployed (or plain logs).
|
|
25
|
+
- `stars build` runs the configured build tool once.
|
|
26
|
+
- `stars info` prints the resolved configuration and environment (`--json` for scripts).
|
|
27
|
+
- `stars codegen` runs the configured code generators (`--check` for CI).
|
|
28
|
+
- `stars prepare` generates `.stars/tsconfig.json` and the auto imports declaration file (`--check` for CI).
|
|
29
|
+
- `stars commands` inspects, compares, deploys and cleans the application commands Discord has deployed.
|
|
30
|
+
- `stars doctor` checks that the project is ready: runtime, framework, credentials, interactions endpoint, generated files.
|
|
31
|
+
- `stars completions` prints the shell completion script for bash, zsh or fish.
|
|
32
|
+
|
|
33
|
+
Everything is driven by a typed `stars.config.ts` file.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
pnpm add -D @wolfstar/cli
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Installing [`@wolfstar/http-framework`](../http-framework) already gives a project the `stars` binary, so this
|
|
42
|
+
explicit install is only needed to depend on this package directly — for its programmatic exports (`loadStarsConfig`,
|
|
43
|
+
diagnostics), or to pin its version independently of the framework's.
|
|
44
|
+
|
|
45
|
+
Projects scaffolded with [`@wolfstar/create-http-framework`](../create-http-framework) come with `@wolfstar/cli`, a `stars.config.ts` file and `dev`/`build` scripts already wired up.
|
|
46
|
+
|
|
47
|
+
## Configuration
|
|
48
|
+
|
|
49
|
+
`stars.config.{ts,mts,cts,js,mjs,cjs}` is defined and loaded by [`@wolfstar/http-framework`](../http-framework#project-configuration-starsconfig), not by this package — see its README for the full option reference (`root`, `entry`, `build`, `dev`, `codegen`) and the `defineConfig` helper. `stars` looks for it in the working directory (`--config <file>` overrides it, `--cwd <dir>` changes the working directory) and passes `ConfigError`s from the framework through as exit code `2`, with the offending option path and a hint printed to the terminal.
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
// stars.config.ts
|
|
53
|
+
import { defineConfig } from '@wolfstar/http-framework/config';
|
|
54
|
+
|
|
55
|
+
export default defineConfig({});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`stars dev`'s URL needs no configuration either — it is detected from `HTTP_PORT` (env var, `src/.env*`/`.env*`, or `dev.env`) or `3000`, the same way Vite's and Nuxt's dev servers do, and `localhost` is swapped for `127.0.0.1` at runtime if that is what is actually reachable. Set `dev.url` only to override it.
|
|
59
|
+
|
|
60
|
+
The resolved configuration is also available programmatically, exactly as the commands see it (re-exported from this package for convenience, or import it directly from `@wolfstar/http-framework/config`):
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import { loadStarsConfig } from '@wolfstar/cli';
|
|
64
|
+
|
|
65
|
+
const config = await loadStarsConfig({ cwd: process.cwd() });
|
|
66
|
+
console.log(config.entry, config.build.output);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Commands
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
stars dev [--no-tui] [--layout <auto|dashboard|panel>] [--channel <name>] [--level <level>] [--theme <name>] [--config <file>] [--cwd <dir>]
|
|
73
|
+
stars build [--config <file>] [--cwd <dir>]
|
|
74
|
+
stars info [--json] [--config <file>] [--cwd <dir>]
|
|
75
|
+
stars codegen [--check] [--json] [--config <file>] [--cwd <dir>]
|
|
76
|
+
stars prepare [--check] [--json] [--config <file>] [--cwd <dir>]
|
|
77
|
+
stars commands [list|clean|diff|deploy] [--guild <id>] [--name <name>] [--check] [--yes] [--json]
|
|
78
|
+
stars doctor [--online] [--json] [--config <file>] [--cwd <dir>]
|
|
79
|
+
stars completions <bash|zsh|fish>
|
|
80
|
+
stars --help | --version
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### `stars dev`
|
|
84
|
+
|
|
85
|
+
Watches the sources through the configured build tool (`tsdown` programmatically, configured from your `stars.config`, `tsc -b --watch`, or a plain file watcher for JavaScript projects), starts the bot after the first successful build and restarts it after every following one. Failed builds keep the previous process running and wait for the next change; a crashed bot waits for the next change or a manual restart.
|
|
86
|
+
|
|
87
|
+
The bot runs as a child `node` process with `STARS_DEV=1` and `NODE_ENV=development` in its environment.
|
|
88
|
+
|
|
89
|
+
**Dashboard** (default on a TTY of at least 90×20): a full-screen view in the alternate buffer.
|
|
90
|
+
|
|
91
|
+
```text
|
|
92
|
+
my-bot • stars v2.3.0 │ I 22:07:01 cli ● Build succeeded in 164ms
|
|
93
|
+
│ I 22:07:01 cli ● Starting (first build)
|
|
94
|
+
● running │─────────────────────────────────────────────────────────
|
|
95
|
+
my-bot is ready! │ D 22:07:01 commands ● Loaded commands: 1 global, 0 guild groups
|
|
96
|
+
http v6.1.0 │ │ ping
|
|
97
|
+
up 3m 35s │─────────────────────────────────────────────────────────
|
|
98
|
+
port 6967 │ I 22:07:02 lifecycle ● Listening on port 6967
|
|
99
|
+
tunnel live │ W 22:07:11 http ● POST / 401 in 1ms
|
|
100
|
+
logs .stars/dev.log │ D 22:07:31 interactions ● Processing slash:ping with ping
|
|
101
|
+
│ T 22:09:16 hmr ● UPDATE src/commands/ping.js
|
|
102
|
+
▾ channels │ D 22:09:16 hmr ● Reloaded ping from src/commands/ping.js
|
|
103
|
+
bot cli commands hmr http │┌────────────────────────────────────────────────────────┐
|
|
104
|
+
▾ levels ││ Commands updated: │
|
|
105
|
+
error warn info debug trace ││ - ping changed │
|
|
106
|
+
││ Refresh commands? (y/n) │
|
|
107
|
+
● live │└────────────────────────────────────────────────────────┘
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The sidebar shows the state of the session (`starting`, `building`, `running`, `stopped`, `error`), the framework
|
|
111
|
+
version, the uptime, the port, the tunnel and where the logs are written, then the two filters of the stream. The
|
|
112
|
+
stream prints one line per entry: a level badge (`T D I W E`), the time, the channel, and the message with URLs,
|
|
113
|
+
paths, names and numbers picked out. An entry with detail lines (the commands that were loaded, the paths that are
|
|
114
|
+
watched) is a block between two rules; the stack frames the bot prints after an error are folded under that error
|
|
115
|
+
and count as one. The percentage of a build follows actual build milestones, not a timer.
|
|
116
|
+
|
|
117
|
+
**Channels** say what an entry is about, so each can be switched off:
|
|
118
|
+
|
|
119
|
+
| Channel | What logs there |
|
|
120
|
+
| -------------- | ------------------------------------------------------------------------------- |
|
|
121
|
+
| `cli` | `stars dev` itself: builds, restarts, hooks, warnings |
|
|
122
|
+
| `build` | the build tool and the file watcher |
|
|
123
|
+
| `bot` | everything the bot writes to stdout and stderr |
|
|
124
|
+
| `types` | the type checker (`dev.typecheck`) |
|
|
125
|
+
| `tunnel` | the public tunnel |
|
|
126
|
+
| `lifecycle` | the bot is listening, the pieces it loaded |
|
|
127
|
+
| `hmr` | files left to the bot's hot reload, and what it reloaded |
|
|
128
|
+
| `commands` | the application commands the bot registers, changes to them, redeploys |
|
|
129
|
+
| `interactions` | each interaction: the route (`slash:ping`), the piece, how long it took, errors |
|
|
130
|
+
| `http` | each request to the interactions endpoint, with its status (`trace` when fine) |
|
|
131
|
+
|
|
132
|
+
The last five come from the bot itself: `stars dev` preloads a small bridge into it (`node --import`) that reports
|
|
133
|
+
its events over an IPC channel instead of leaving the CLI to guess from stdout. It needs `@wolfstar/http-framework`
|
|
134
|
+
6.1 or later, resolved from the project; without it (or with a build that bundles the framework, as Vite and Nitro
|
|
135
|
+
do) those channels stay empty and everything else works as before. A plugin can log on a channel of its own with
|
|
136
|
+
`process.send?.({ source: 'stars:bridge', type: 'log', channel: 'gateway', level: 'info', text: 'Shard 0 ready' })`.
|
|
137
|
+
|
|
138
|
+
`trace` is hidden at start, since it is one line per request. `dev.logs` in `stars.config`, or `--channel` and
|
|
139
|
+
`--level`, choose what a session starts with; the log file always receives everything:
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
export default defineConfig({
|
|
143
|
+
dev: {
|
|
144
|
+
logs: { channels: ['bot', 'commands', 'interactions'], levels: ['error', 'warn', 'info'] }
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
```sh
|
|
150
|
+
stars dev --channel hmr,http --channel commands # only these channels
|
|
151
|
+
stars dev --level trace # this level and every more severe one
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
| Key | Action |
|
|
155
|
+
| ------------------ | ---------------------------------------------------------------- |
|
|
156
|
+
| `←` / `→` | select a channel or a level |
|
|
157
|
+
| `Tab` | switch between channels and levels |
|
|
158
|
+
| `Space` | show or hide the selected one |
|
|
159
|
+
| `s` | solo: only the selected one; again for all |
|
|
160
|
+
| `a` | show every channel and level |
|
|
161
|
+
| `Enter` | fold or unfold the selected group |
|
|
162
|
+
| `b` | group the stream by channel |
|
|
163
|
+
| `↑` / `↓`, `j`/`k` | scroll (`PgUp`/`PgDn` by page); the footer turns to `paused` |
|
|
164
|
+
| `g` / `G` | top / back to live |
|
|
165
|
+
| `/` | search the stream (`Esc` clears) |
|
|
166
|
+
| `e` | jump to the last error, keeping its context |
|
|
167
|
+
| `y` / `n` | answer a prompt |
|
|
168
|
+
| `r` / `Ctrl+R` | restart the bot |
|
|
169
|
+
| `d` | disconnect: stop the bot until the next `r`, builds keep running |
|
|
170
|
+
| `o` | open the local URL in a browser |
|
|
171
|
+
| `t` | toggle a public `cloudflared` tunnel |
|
|
172
|
+
| `i` | show project, versions, URLs, health, types and session info |
|
|
173
|
+
| `T` | pick a colour theme (see **Themes** below) |
|
|
174
|
+
| `l` | browse the logs full width: select a line, copy it |
|
|
175
|
+
| `v` | switch between the dashboard and the panel |
|
|
176
|
+
| `c` / `Ctrl+L` | clear log history |
|
|
177
|
+
| `h` / `?` | show keyboard shortcuts |
|
|
178
|
+
| `q` / `Ctrl+D` | quit; confirm with `y` while a build/restart is in flight |
|
|
179
|
+
| `Ctrl+C` | quit immediately from any view |
|
|
180
|
+
|
|
181
|
+
**Hot reload.** When the bot runs with the framework's `hmr` option enabled, it tells `stars dev` which directories
|
|
182
|
+
it watches. A build that only changed pieces in those directories is then left to the bot: the process, its HTTP
|
|
183
|
+
server and its connections stay up, and the `hmr` channel shows what was reloaded. A piece is a file the bot loaded
|
|
184
|
+
one from, or a new file that could be one. A change to anything else still restarts the bot: the entry, a shared
|
|
185
|
+
module, a locale, and also a helper next to the pieces (`_shared.js`, or any file no piece came from), which the bot
|
|
186
|
+
imports once and cannot replace. So does a bot without `hmr`, or one that stopped it. `dev.hmr: false` always
|
|
187
|
+
restarts. What a build changed is judged by content, since a bundler such as `tsdown` rewrites its whole output on
|
|
188
|
+
every rebuild.
|
|
189
|
+
|
|
190
|
+
**Command refresh.** The bot reports the application commands it registers when it starts and after every hot
|
|
191
|
+
reload. When they differ from what it reported before, `stars dev` asks (`Refresh commands? (y/n)`) and, on `y`, has
|
|
192
|
+
the bot register them with Discord again. `dev.commands.refresh` picks the behaviour: `'prompt'` (default), `'auto'`
|
|
193
|
+
to redeploy without asking, `'off'` to only report the change. Without the interactive UI a `'prompt'` only reports.
|
|
194
|
+
A question that is still open survives a restart of the bot, and a `y` given while the bot is stopped or restarting
|
|
195
|
+
is carried out once it listens again. A refresh also empties a guild whose last command was removed since the last
|
|
196
|
+
deploy, which pushing the registry alone would leave as it was.
|
|
197
|
+
|
|
198
|
+
**Panel** (`dev.layout: 'panel'`, `--layout panel`, `v`, or a terminal smaller than 90×20): a bottom-aligned panel in
|
|
199
|
+
the normal buffer, following the layout and keyboard conventions of
|
|
200
|
+
[Nuxt CLI's dev TUI](https://github.com/nuxt/cli/tree/b4b366eafdd9ac4d5b81b6ae7dadda35364252c9/packages/nuxt-cli/src/dev/tui).
|
|
201
|
+
It shows a Stars wordmark, aligned URLs, a 20-cell progress bar with elapsed time, status and shortcuts, and folds
|
|
202
|
+
the logs away: `l` opens them and `e` the last error. Once ready, the bar gives way to diagnostics and the header
|
|
203
|
+
reports the load time. The keys that do not concern the stream are the same as in the dashboard.
|
|
204
|
+
|
|
205
|
+
Application output (including its banner), build-plugin output and diagnostics stay in the bounded log history and
|
|
206
|
+
`.stars/dev.log`. tsdown's entry list and output-size table are suppressed. Closing an overlay restores the view
|
|
207
|
+
under it without duplicating output in scrollback. `running` (`READY` in the panel) reports process state unless
|
|
208
|
+
`dev.health` is configured; it does not certify that every application plugin loaded successfully.
|
|
209
|
+
|
|
210
|
+
In the log browser (`l`): arrows or `j/k` select, `PgUp/PgDn` move a page, `g/G` go to the beginning/follow the tail,
|
|
211
|
+
`e/w/a` filter errors/warnings/all, `c/b/r` toggle CLI/build/runtime sources, `/` searches, `x` clears, and
|
|
212
|
+
`Enter`/`y` copies the selected line on terminals supporting OSC 52 clipboard writes. `q`, `Esc` or the view's
|
|
213
|
+
own shortcut closes an overlay rather than quitting the session.
|
|
214
|
+
|
|
215
|
+
Replace the default wordmark in `stars.config.ts` (up to four lines are displayed, clipped to the terminal width):
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
export default defineConfig({
|
|
219
|
+
dev: { banner: ['★ STARYL', 'Twitch notifications'] }
|
|
220
|
+
});
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
`dev.banner` also accepts a string containing newlines, or `false` to hide the wordmark. Omit it for Stars branding.
|
|
224
|
+
For the application's standalone banner outside the TUI, use `createStarsBanner` from `@wolfstar/start-banner`.
|
|
225
|
+
|
|
226
|
+
**Themes.** Press `T` to pick a colour theme, like Claude Code's `/theme`: arrows preview it live, `Enter` keeps and saves
|
|
227
|
+
it, `Esc` restores the previous one. Available themes are `auto` (follows the terminal background through
|
|
228
|
+
`COLORFGBG`, dark when unknown), `dark`, `light`, `dark-daltonized` and `light-daltonized` (blue/orange instead of
|
|
229
|
+
green/red, for colour-blind users), and `dark-ansi` and `light-ansi` (only the 16 ANSI colours, so your terminal
|
|
230
|
+
palette decides). The theme resolves as `--theme <name>` › `STARS_THEME` › the saved choice › `auto`. It is saved in
|
|
231
|
+
`preferences.json` under `$STARS_CONFIG_DIR`, `$XDG_CONFIG_HOME/stars`, `%APPDATA%\stars` or `~/.config/stars`.
|
|
232
|
+
`NO_COLOR` still disables colour altogether.
|
|
233
|
+
|
|
234
|
+
**Plain mode** prints prefixed lines instead (the channel, then the message, with detail lines indented under it;
|
|
235
|
+
the bot's own output is passed through untouched) and is selected by `--no-tui`, `STARS_TUI=plain`, redirected input/output,
|
|
236
|
+
CI, `TERM=dumb`, or terminals smaller than 40×10. `STARS_TUI=1` overrides CI/size checks, never redirected streams or
|
|
237
|
+
a dumb terminal. Both modes honour `NO_COLOR`/`FORCE_COLOR`; `STARS_REDUCED_MOTION=1` freezes the logo/spinner but
|
|
238
|
+
keeps the elapsed clock. Both stop the bot cleanly on `SIGINT`/`SIGTERM`. `SIGUSR2` restarts the bot (not on Windows).
|
|
239
|
+
|
|
240
|
+
### `stars commands`
|
|
241
|
+
|
|
242
|
+
Lists what Discord currently has deployed, which is not necessarily what the project registers today: renamed and
|
|
243
|
+
removed commands stay until something deletes them.
|
|
244
|
+
|
|
245
|
+
```sh
|
|
246
|
+
stars commands list # global commands
|
|
247
|
+
stars commands list --guild 1234 # a guild's commands
|
|
248
|
+
stars commands clean # wizard: pick from a checklist, then confirm
|
|
249
|
+
stars commands clean --name ping # delete one, asking first
|
|
250
|
+
stars commands clean --guild 1234 --yes
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
It reads `DISCORD_TOKEN` and `DISCORD_APPLICATION_ID` (or `APPLICATION_ID`) from the environment or the project's
|
|
254
|
+
`.env`, the same place the bot reads them from. `clean` deletes deployed commands, so on a terminal it opens a wizard —
|
|
255
|
+
a checklist of what is deployed, then a confirmation — and refuses to run without `--yes` (or `--name`) anywhere
|
|
256
|
+
else.
|
|
257
|
+
|
|
258
|
+
`diff` and `deploy` compare that with what the project defines:
|
|
259
|
+
|
|
260
|
+
```sh
|
|
261
|
+
stars commands diff # what a deploy would add (+), change (~) and remove (-)
|
|
262
|
+
stars commands diff --check # the same, failing when anything differs (CI)
|
|
263
|
+
stars commands deploy # show the difference, ask, then overwrite the global scope
|
|
264
|
+
stars commands deploy --guild 1234 --yes
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Commands are declared with builders and decorators that only exist once the bot's modules ran, so `stars` asks the
|
|
268
|
+
bot: it starts the built entry (run `stars build` first) with the dev bridge, which loads the pieces, reports the
|
|
269
|
+
registry and exits before the bot listens or talks to Discord. This needs `@wolfstar/http-framework` 6.1 or later.
|
|
270
|
+
The bot is started as `stars dev` would start it (the same env files, after the `env:options` hook), in the
|
|
271
|
+
`NODE_ENV` of the caller, `development` when unset: run `NODE_ENV=production stars commands deploy` to deploy what a
|
|
272
|
+
production start registers. It is not a dev session, so `STARS_DEV` is not set.
|
|
273
|
+
A command counts as changed when what the project defines no longer matches what is deployed; the fields Discord
|
|
274
|
+
fills in on its own (`id`, `version`, defaults such as `nsfw: false`) are ignored. `deploy` is Discord's bulk
|
|
275
|
+
overwrite: a deployed command the project no longer defines is deleted, which is why it asks first and refuses to
|
|
276
|
+
run without `--yes` outside a terminal, or with `--json`.
|
|
277
|
+
|
|
278
|
+
### `stars doctor`
|
|
279
|
+
|
|
280
|
+
Checks what a project needs before `stars dev` can do its job, and says what to do about each problem:
|
|
281
|
+
|
|
282
|
+
```text
|
|
283
|
+
stars doctor v2.3.0
|
|
284
|
+
✔ node Node.js v24.19.0
|
|
285
|
+
✔ config stars.config.ts
|
|
286
|
+
✔ framework @wolfstar/http-framework v6.1.0
|
|
287
|
+
✔ entry src/main.ts (tsdown)
|
|
288
|
+
✖ token DISCORD_TOKEN is not set
|
|
289
|
+
→ Set DISCORD_TOKEN in the environment or in the project .env file.
|
|
290
|
+
⚠ port Something already listens on http://localhost:3000
|
|
291
|
+
→ Stop it, or set another HTTP_PORT, unless it is this bot running.
|
|
292
|
+
ℹ tunnel No tunnel: Discord cannot reach a bot on localhost
|
|
293
|
+
→ Set `dev.tunnel: true` for a cloudflared quick tunnel, or press t in `stars dev`.
|
|
294
|
+
⚠ prepare Out of date: .stars/tsconfig.json
|
|
295
|
+
→ Run `stars prepare`.
|
|
296
|
+
|
|
297
|
+
1 error(s), 2 warning(s)
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
It covers the Node.js version (and the project's `engines.node`), the configuration and its warnings, the framework
|
|
301
|
+
(and whether it is recent enough for the dev bridge), the entry and the build output, `DISCORD_TOKEN`,
|
|
302
|
+
`DISCORD_PUBLIC_KEY` and the application id, whether the dev port is free, the tunnel, and whether `.stars/` is stale.
|
|
303
|
+
`--online` also asks Discord whether the token works and where the application sends its interactions. Nothing is
|
|
304
|
+
changed. `--json` prints `{ ok, checks }`; the exit code is `1` when a check fails.
|
|
305
|
+
|
|
306
|
+
### `stars completions`
|
|
307
|
+
|
|
308
|
+
```sh
|
|
309
|
+
eval "$(stars completions bash)" # ~/.bashrc
|
|
310
|
+
eval "$(stars completions zsh)" # ~/.zshrc
|
|
311
|
+
stars completions fish | source # ~/.config/fish/config.fish
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
The script is generated from the commands the CLI registers, so it completes every command, subcommand and flag
|
|
315
|
+
`--help` lists, with their short forms (`-c`) and the `--no-` form of the ones that are on by default (`--no-tui`).
|
|
316
|
+
|
|
317
|
+
### Type checking, tunnel and logs
|
|
318
|
+
|
|
319
|
+
Three `dev` options round out the dev loop (all documented in
|
|
320
|
+
[`@wolfstar/http-framework`](../http-framework#project-configuration-starsconfig)):
|
|
321
|
+
|
|
322
|
+
- `dev.typecheck: true` runs a type checker next to the bot and reports type errors on the UI's `types` channel,
|
|
323
|
+
without ever blocking a build or a restart — useful when building with `tsdown`, which does not type-check.
|
|
324
|
+
`dev.typecheck.checker` picks which one: `tsc` (the project's TypeScript, watch mode), `golar` (`golar tsc`, watch
|
|
325
|
+
mode), `tsz` (the tsc-compatible checker, re-run after every build since it has no watch mode), or `auto` — the
|
|
326
|
+
default, which uses `golar` when the project depends on it and `tsc` otherwise.
|
|
327
|
+
- Pressing `t` opens and closes a `cloudflared` quick tunnel without configuration. `dev.tunnel: true` opens it at startup so Discord can reach the bot's interactions endpoint from the
|
|
328
|
+
internet; a string is an https URL you already serve, which the CLI only probes. `dev.tunnel.updateEndpoint` writes
|
|
329
|
+
the URL to the Discord application, and is opt-in because it edits a live application.
|
|
330
|
+
- `dev.logFile` (default `.stars/dev.log`) mirrors the session's logs to disk, so a run can be read back after the
|
|
331
|
+
terminal UI is gone. Set it to `false` to disable it. It is truncated on every run; `dev.logs.dir` (for example
|
|
332
|
+
`'logs'`) adds one file per run, `dev-<timestamp>.log`, and `dev.logs.keep` (default `10`) says how many stay. Each
|
|
333
|
+
line is `<ISO time> <level> <channel> <message>`, with the detail lines of an entry indented under it, and no entry
|
|
334
|
+
is ever filtered out of a file.
|
|
335
|
+
|
|
336
|
+
### The build
|
|
337
|
+
|
|
338
|
+
`tsdown` is configured from `stars.config`, and a base project configures nothing: the entry's directory, one output
|
|
339
|
+
file per source file, ESM on Node, `build.outDir`, the tsconfig (`src/tsconfig.json` or `tsconfig.json`), the
|
|
340
|
+
extension `build.output` implies, sourcemaps, unbundled dependencies, Nuxt's `~`/`@`/`~~`/`@@` alias prefixes and
|
|
341
|
+
the auto imports plugin, and copying `src/locales` to `dist/locales` are all filled in
|
|
342
|
+
(the [framework README](../http-framework#the-build-tsdown) lists every default). The `tsdown` block is for what they
|
|
343
|
+
cannot know:
|
|
344
|
+
|
|
345
|
+
Every `@wolfstar/plugin-*` package listed in the project's `dependencies` or `optionalDependencies` is activated
|
|
346
|
+
automatically in bundler builds. `stars` injects its `/register` side-effect entrypoint before the application entry,
|
|
347
|
+
so projects do not need to maintain bare imports such as `import '@wolfstar/plugin-i18next/register'`. Packages used
|
|
348
|
+
only for development are intentionally not activated from `devDependencies`.
|
|
349
|
+
|
|
350
|
+
```typescript
|
|
351
|
+
export default defineConfig({
|
|
352
|
+
tsdown: { dts: true }
|
|
353
|
+
});
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
With `future.compatibilityVersion: 3` (end-of-life) an existing `tsdown.config.*` still drives the build and the block
|
|
357
|
+
is merged over it (values from `stars.config` win, `plugins` are appended); from `4` on the block is the whole
|
|
358
|
+
configuration. The
|
|
359
|
+
`vite` block works the same way for `build.tool: 'vite'`. `stars info` shows which file the build is configured from
|
|
360
|
+
and which options the block sets.
|
|
361
|
+
|
|
362
|
+
### Compatibility version
|
|
363
|
+
|
|
364
|
+
`future.compatibilityVersion` selects the legacy or current defaults, the way Nuxt's own compatibility setting does (see the
|
|
365
|
+
[framework README](../http-framework#compatibility-version) for the full reference):
|
|
366
|
+
|
|
367
|
+
| Version | What it changes |
|
|
368
|
+
| ------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
369
|
+
| `3` (EOL) | Legacy behaviour: a `tsdown.config.*` drives the build, auto imports off unless asked for; prints `COMPATIBILITY_VERSION_EOL` |
|
|
370
|
+
| `4` | `tsdown` configured from `stars.config` alone, auto imports on and wired in, `'auto'` picks `tsdown` for TypeScript |
|
|
371
|
+
| `5` (default) | Everything in `4`, plus `env` registered automatically when the project depends on `@wolfstar/env-utilities` |
|
|
372
|
+
|
|
373
|
+
### Environment and hooks
|
|
374
|
+
|
|
375
|
+
`env` mirrors the options of `setup()` from `@wolfstar/env-utilities`: `stars` calls it with them as the first import
|
|
376
|
+
of the built entry, before plugin registrations and the bot's own modules. tsdown, Vite and Nitro builds get it
|
|
377
|
+
through the entry transform; with `build.tool: 'tsc'` or `'none'` only `stars dev` preloads it (`node --import`).
|
|
378
|
+
Nitro leaves it off unless `env` is set explicitly.
|
|
379
|
+
|
|
380
|
+
```typescript
|
|
381
|
+
export default defineConfig({
|
|
382
|
+
env: { prefix: 'BOT_' },
|
|
383
|
+
hooks: {
|
|
384
|
+
'env:options'(options) {
|
|
385
|
+
if (process.env.CI) options.path = '.env.ci';
|
|
386
|
+
},
|
|
387
|
+
build: { done: (outcome) => void (outcome.ok || console.error(outcome.message)) }
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
`hooks` are CLI lifecycle hooks run with [`hookable`](https://github.com/unjs/hookable): `config:resolved`,
|
|
393
|
+
`env:options`, `prepare:before`/`prepare:done`, `builder:created`, `tsdown:options`, `build:before`/`build:done`,
|
|
394
|
+
`dev:start`/`dev:restart`/`dev:close`. They run in the CLI process, never in the bot, in the same order in `stars build` and
|
|
395
|
+
`stars dev` (see the framework README for how `stars dev` awaits them). `stars info` lists the env
|
|
396
|
+
options and the registered hooks. See the [framework README](../http-framework#environment-env) for the full
|
|
397
|
+
reference.
|
|
398
|
+
|
|
399
|
+
### Experimental flags
|
|
400
|
+
|
|
401
|
+
`experimental` in `stars.config.*` turns on work that is still landing (see the
|
|
402
|
+
[framework README](../http-framework#experimental-flags) for the full reference):
|
|
403
|
+
|
|
404
|
+
| Flag | What it changes |
|
|
405
|
+
| -------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
406
|
+
| `enableVite` | Builds through the project's own `vite` (and allows `build.tool: 'vite'`) instead of `tsdown` |
|
|
407
|
+
| `enableExternalVite` | The project runs Vite itself; `stars dev` only watches the build output and restarts the bot |
|
|
408
|
+
| `enableNitro` | Builds through [Nitro](https://nitro.build) (itself a Vite plugin) instead of `node:http`, deployable to any Nitro preset |
|
|
409
|
+
|
|
410
|
+
`stars info` prints which flags are on.
|
|
411
|
+
|
|
412
|
+
### Exit codes
|
|
413
|
+
|
|
414
|
+
| Code | Meaning |
|
|
415
|
+
| ----- | --------------------------------------------------------- |
|
|
416
|
+
| `0` | success |
|
|
417
|
+
| `1` | generic error (including `--check` and `doctor` failures) |
|
|
418
|
+
| `2` | invalid or missing configuration |
|
|
419
|
+
| `3` | build failed |
|
|
420
|
+
| `130` | interrupted with `SIGINT` |
|
|
421
|
+
| `143` | terminated with `SIGTERM`/`SIGHUP` |
|
|
422
|
+
|
|
423
|
+
### Generated TypeScript configuration
|
|
424
|
+
|
|
425
|
+
The generated compiler options combine `@sapphire/ts-config`, `@sapphire/ts-config/extra-strict`, and
|
|
426
|
+
`@sapphire/ts-config/decorators`. The CLI loads these presets and writes their options directly into the file,
|
|
427
|
+
so consumers do not need to install Sapphire. This enables strict checks, explicit overrides, and legacy decorators
|
|
428
|
+
with metadata. Stars targets ES2022, skips dependency declaration checks, and stores incremental build information
|
|
429
|
+
inside `.stars/`. Tsdown and Vite use `ESNext`/`Bundler` with `noEmit`; tsc retains Sapphire's Node16 emit settings.
|
|
430
|
+
Project compiler options can override these defaults.
|
|
431
|
+
|
|
432
|
+
Bundler builds also follow [Nitro's TypeScript configuration](https://github.com/nitrojs/nitro/blob/main/lib/tsconfig.json):
|
|
433
|
+
forced module detection, isolated modules, verbatim module syntax, JavaScript sources, `.ts` import extensions,
|
|
434
|
+
package.json imports, and ESNext/DOM libraries. Use `import type` and `export type` for type-only dependencies.
|
|
435
|
+
These options apply to tsdown and Vite; tsc keeps its emit-compatible settings. Sapphire's decorator options and
|
|
436
|
+
the ES2022 target remain in effect. This does not enable Stars' experimental Nitro runtime integration.
|
|
437
|
+
|
|
438
|
+
Run `stars prepare` and extend the generated config from your project's `tsconfig.json`:
|
|
439
|
+
|
|
440
|
+
```json
|
|
441
|
+
{
|
|
442
|
+
"extends": "./.stars/tsconfig.json"
|
|
443
|
+
}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
New tsdown projects already extend this file and run `stars prepare` through `postinstall`.
|
|
447
|
+
Keep your existing compiler options alongside `extends`. `stars dev` and `stars build` also regenerate this file.
|
|
448
|
+
For tsdown builds, `@/` and `~/` resolve to the entry file's directory (normally `src/`), while `@@/` and `~~/`
|
|
449
|
+
resolve to the project root. Filesystem aliases in `stars.config.ts`'s `tsdown.alias` are included too, with custom
|
|
450
|
+
values taking precedence. Legacy builds using a separate tsdown config only include aliases declared in
|
|
451
|
+
`stars.config.ts`. Other build tools do not get tsdown aliases, since TypeScript alone does not rewrite imports.
|
|
452
|
+
|
|
453
|
+
The generated config includes source files and the auto imports declaration, including a custom `imports.dts`
|
|
454
|
+
location. Explicit `include` or `compilerOptions.paths` in your own tsconfig replace the inherited values;
|
|
455
|
+
remove manually duplicated paths to use the generated aliases. Generation works with `imports: false` too.
|
|
456
|
+
Use `stars prepare --check` to check both generated files without writing them. Do not edit `.stars/tsconfig.json`
|
|
457
|
+
by hand; keep `.stars/` ignored by Git and run `stars prepare` after installing dependencies on a fresh checkout.
|
|
458
|
+
|
|
459
|
+
## Server integrations
|
|
460
|
+
|
|
461
|
+
`@wolfstar/vite-server` and `@wolfstar/nitro-server` provide the Vite and Nitro builders. The CLI loads the
|
|
462
|
+
selected integration lazily, passes the resolved `stars.config` and supplies project dependency loading and
|
|
463
|
+
plugin registration through `BuilderContext` from `@wolfstar/schema`. Neither server package depends on the CLI
|
|
464
|
+
or framework. Existing experimental flags, presets, output directories and `stars dev`/`stars build` commands
|
|
465
|
+
are unchanged; install Vite/Nitro in the consuming project as before.
|