@wolfstar/cli 0.2.0-next-20260905171401 → 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.
Files changed (46) hide show
  1. package/README.md +45 -15
  2. package/dist/{build-CvSvbsYN.js → build-DbGs9-s8.js} +4 -4
  3. package/dist/{build-CvSvbsYN.js.map → build-DbGs9-s8.js.map} +1 -1
  4. package/dist/{build-B6xw00Ee.js → build-DkMulM4f.js} +2 -2
  5. package/dist/{build-B6xw00Ee.js.map → build-DkMulM4f.js.map} +1 -1
  6. package/dist/{builders-D97Uqjwg.js → builders-NkAoPRdw.js} +2 -2
  7. package/dist/{builders-D97Uqjwg.js.map → builders-NkAoPRdw.js.map} +1 -1
  8. package/dist/cli.js +6 -6
  9. package/dist/{codegen-mYkL-GBf.js → codegen-1kW_OnrL.js} +2 -2
  10. package/dist/{codegen-mYkL-GBf.js.map → codegen-1kW_OnrL.js.map} +1 -1
  11. package/dist/{codegen-DjPOn7cp.js → codegen-DHQH83M3.js} +2 -2
  12. package/dist/{codegen-DjPOn7cp.js.map → codegen-DHQH83M3.js.map} +1 -1
  13. package/dist/{commands-Dw2LFWV-.js → commands-BkZNThm8.js} +2 -2
  14. package/dist/{commands-Dw2LFWV-.js.map → commands-BkZNThm8.js.map} +1 -1
  15. package/dist/{commands-BkGKs_Bg.js → commands-DwqViJ2V.js} +4 -4
  16. package/dist/{commands-BkGKs_Bg.js.map → commands-DwqViJ2V.js.map} +1 -1
  17. package/dist/{dev-BCgaVd0m.js → dev-BazJrPZ3.js} +2 -2
  18. package/dist/{dev-BCgaVd0m.js.map → dev-BazJrPZ3.js.map} +1 -1
  19. package/dist/{dev-CWA_JVTb.js → dev-C6HogNjR.js} +80 -65
  20. package/dist/dev-C6HogNjR.js.map +1 -0
  21. package/dist/index.d.ts +4 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/{info-Czh4LUsD.js → info-BrxKCcUW.js} +2 -2
  25. package/dist/{info-Czh4LUsD.js.map → info-BrxKCcUW.js.map} +1 -1
  26. package/dist/{info-BqxpktLG.js → info-rYRLITnv.js} +2 -2
  27. package/dist/{info-BqxpktLG.js.map → info-rYRLITnv.js.map} +1 -1
  28. package/dist/log-buffer-D-nj2ZEU.js +72 -0
  29. package/dist/log-buffer-D-nj2ZEU.js.map +1 -0
  30. package/dist/{output-mode-ChrOf0LO.js → output-mode-Cxes6YUW.js} +4 -2
  31. package/dist/output-mode-Cxes6YUW.js.map +1 -0
  32. package/dist/{prepare-BXcm2Ukp.js → prepare-90XQCoak.js} +1 -1
  33. package/dist/{prepare-D5NZ0w4t.js → prepare-CHLrneYU.js} +2 -2
  34. package/dist/{prepare-D5NZ0w4t.js.map → prepare-CHLrneYU.js.map} +1 -1
  35. package/dist/{prepare-CVf88_Or.js → prepare-hOwjyelr.js} +2 -2
  36. package/dist/{prepare-CVf88_Or.js.map → prepare-hOwjyelr.js.map} +1 -1
  37. package/dist/{tsdown-BEFq2API.js → tsdown-Do8vjnIK.js} +23 -6
  38. package/dist/tsdown-Do8vjnIK.js.map +1 -0
  39. package/dist/tui-C2P91TgW.js +938 -0
  40. package/dist/tui-C2P91TgW.js.map +1 -0
  41. package/package.json +7 -6
  42. package/dist/dev-CWA_JVTb.js.map +0 -1
  43. package/dist/output-mode-ChrOf0LO.js.map +0 -1
  44. package/dist/tsdown-BEFq2API.js.map +0 -1
  45. package/dist/tui-BTRFsLQR.js +0 -770
  46. package/dist/tui-BTRFsLQR.js.map +0 -1
@@ -1,69 +1,20 @@
1
1
  import { n as ExitCode, t as CliError } from "./errors-Bket6XFn.js";
2
- import { i as shouldUseColor, n as prefersReducedMotion, r as resolveOutputMode } from "./output-mode-ChrOf0LO.js";
2
+ import { i as shouldUseColor, n as prefersReducedMotion, r as resolveOutputMode } from "./output-mode-Cxes6YUW.js";
3
3
  import { n as resolveCwd } from "./args-Ch1KXUMn.js";
4
4
  import { n as createLineSplitter, t as ProcessSupervisor } from "./process-supervisor-CJOdmp0W.js";
5
5
  import { r as resolveBinary } from "./project-DHF3qdm-.js";
6
6
  import { n as resolveTscBinary } from "./tsc-BqZfDTD0.js";
7
- import { n as createBuilder, t as assertSupportedExperiments } from "./builders-D97Uqjwg.js";
8
- import { t as prepareAutoImports } from "./prepare-D5NZ0w4t.js";
7
+ import { n as createBuilder, t as assertSupportedExperiments } from "./builders-NkAoPRdw.js";
8
+ import { t as prepareAutoImports } from "./prepare-CHLrneYU.js";
9
9
  import { t as Tunnel } from "./tunnel-B8Id4-lR.js";
10
- import { loadStarsConfig } from "@wolfstar/http-framework/config";
10
+ import { n as classifyAppLine, t as LogBuffer } from "./log-buffer-D-nj2ZEU.js";
11
+ import { displayPath, loadStarsConfig } from "@wolfstar/http-framework/config";
11
12
  import { createWriteStream, mkdirSync } from "node:fs";
12
13
  import { dirname } from "node:path";
13
14
  import { EventEmitter } from "node:events";
14
15
  import { spawn } from "node:child_process";
15
16
  import { lookup } from "node:dns/promises";
16
17
 
17
- //#region src/lib/log-buffer.ts
18
- /**
19
- * A bounded, in-memory log store shared by the dev service and its renderers.
20
- */
21
- var LogBuffer = class extends EventEmitter {
22
- capacity;
23
- #entries = [];
24
- #nextId = 1;
25
- constructor(capacity = 2e3) {
26
- super();
27
- this.capacity = capacity;
28
- }
29
- push(input) {
30
- const entry = {
31
- id: this.#nextId++,
32
- time: Date.now(),
33
- ...input
34
- };
35
- this.#entries.push(entry);
36
- if (this.#entries.length > this.capacity) this.#entries.splice(0, this.#entries.length - this.capacity);
37
- this.emit("entry", entry);
38
- return entry;
39
- }
40
- entries() {
41
- return this.#entries;
42
- }
43
- filter(filter) {
44
- const query = filter.query?.toLowerCase() ?? null;
45
- return this.#entries.filter((entry) => (!filter.source || entry.source === filter.source) && (!filter.level || matchesLevel(entry.level, filter.level)) && (!query || entry.text.toLowerCase().includes(query)));
46
- }
47
- clear() {
48
- this.#entries = [];
49
- this.emit("clear");
50
- }
51
- };
52
- const LEVEL_ORDER = {
53
- debug: 0,
54
- info: 1,
55
- success: 1,
56
- warn: 2,
57
- error: 3
58
- };
59
- /**
60
- * Whether `level` is at least as severe as `minimum`.
61
- */
62
- function matchesLevel(level, minimum) {
63
- return LEVEL_ORDER[level] >= LEVEL_ORDER[minimum];
64
- }
65
-
66
- //#endregion
67
18
  //#region src/lib/typechecker.ts
68
19
  const WATCH_START = /Starting (incremental )?compilation/;
69
20
  const WATCH_DONE = /Found (\d+) errors?\. Watching for file changes/;
@@ -288,6 +239,12 @@ var DevService = class extends EventEmitter {
288
239
  #pendingReason = null;
289
240
  #stopped = false;
290
241
  #queue = Promise.resolve();
242
+ #progress = {
243
+ fraction: 0,
244
+ message: "preparing your app",
245
+ startedAt: Date.now(),
246
+ readyMs: null
247
+ };
291
248
  constructor(config, options) {
292
249
  super();
293
250
  this.config = config;
@@ -296,13 +253,35 @@ var DevService = class extends EventEmitter {
296
253
  this.supervisor = options.supervisor ?? createSupervisor(config);
297
254
  this.typechecker = options.typechecker ?? new Typechecker(config);
298
255
  this.tunnel = options.tunnel ?? new Tunnel(config);
299
- this.builder.on("start", () => this.#setBuild("building"));
256
+ this.builder.on("start", () => {
257
+ this.#progress = {
258
+ fraction: 0,
259
+ message: "preparing build",
260
+ startedAt: Date.now(),
261
+ readyMs: null
262
+ };
263
+ this.#setBuild("building");
264
+ });
265
+ this.builder.on("progress", (fraction, message) => {
266
+ this.#progress = {
267
+ ...this.#progress,
268
+ fraction: Math.max(this.#progress.fraction, Math.min(.75, fraction)),
269
+ message
270
+ };
271
+ this.#emitStatus();
272
+ });
300
273
  this.builder.on("success", (outcome) => this.#onBuildSuccess(outcome));
301
274
  this.builder.on("failure", (outcome) => this.#onBuildFailure(outcome));
302
275
  this.builder.on("log", (level, text) => this.log("build", level, text));
303
- this.supervisor.on("state", () => this.#emitStatus());
304
- this.supervisor.on("stdout", (line) => this.log("app", "info", line));
305
- this.supervisor.on("stderr", (line) => this.log("app", "error", line));
276
+ this.supervisor.on("state", () => {
277
+ if (this.supervisor.state === "running") {
278
+ this.#settleProgress();
279
+ this.#checkHealth();
280
+ }
281
+ this.#emitStatus();
282
+ });
283
+ this.supervisor.on("stdout", (line) => this.log("app", classifyAppLine(line, "info"), line));
284
+ this.supervisor.on("stderr", (line) => this.log("app", classifyAppLine(line, "error"), line));
306
285
  this.supervisor.on("error", (error) => this.log("stars", "error", `Failed to start the bot: ${error.message}`));
307
286
  this.supervisor.on("exit", (exit) => this.#onExit(exit));
308
287
  this.typechecker.on("log", (level, text) => this.log("tsc", level, text));
@@ -317,6 +296,7 @@ var DevService = class extends EventEmitter {
317
296
  }
318
297
  get status() {
319
298
  return {
299
+ progress: this.#progress,
320
300
  process: this.supervisor.state,
321
301
  build: this.#build,
322
302
  health: this.#health,
@@ -345,7 +325,8 @@ var DevService = class extends EventEmitter {
345
325
  */
346
326
  async start() {
347
327
  this.#stopped = false;
348
- this.log("stars", "info", `Watching ${this.config.build.tool === "none" ? "sources" : `with ${this.config.build.tool}`}, entry ${this.config.entry}`);
328
+ const entry = displayPath(this.config.root, this.config.entry);
329
+ this.log("stars", "info", this.config.build.tool === "none" ? `Watching ${entry}` : `Watching ${entry} with ${this.config.build.tool}`);
349
330
  if (this.config.dev.typecheck.enabled) this.typechecker.start();
350
331
  this.tunnel.start();
351
332
  await this.builder.watch();
@@ -357,6 +338,12 @@ var DevService = class extends EventEmitter {
357
338
  this.#clearRestartTimer();
358
339
  return this.#enqueue(async () => {
359
340
  if (this.#stopped) return;
341
+ if (reason === "manual" || reason === "crash") this.#progress = {
342
+ fraction: 0,
343
+ message: "restarting the bot",
344
+ startedAt: Date.now(),
345
+ readyMs: null
346
+ };
360
347
  this.#lastRestartReason = reason;
361
348
  if (this.supervisor.running) {
362
349
  this.#restarts++;
@@ -364,8 +351,13 @@ var DevService = class extends EventEmitter {
364
351
  await this.supervisor.stop();
365
352
  } else this.log("stars", "info", `Starting (${describeReason(reason)})`);
366
353
  if (this.#stopped) return;
367
- this.supervisor.start();
354
+ this.#progress = {
355
+ ...this.#progress,
356
+ fraction: .75,
357
+ message: "starting the bot"
358
+ };
368
359
  this.#health = "unknown";
360
+ this.supervisor.start();
369
361
  this.#emitStatus();
370
362
  });
371
363
  }
@@ -391,6 +383,11 @@ var DevService = class extends EventEmitter {
391
383
  }
392
384
  #onBuildSuccess(outcome) {
393
385
  this.#lastBuild = outcome;
386
+ this.#progress = {
387
+ ...this.#progress,
388
+ fraction: .75,
389
+ message: "starting the bot"
390
+ };
394
391
  this.#setBuild("ok");
395
392
  if (this.#stopped) return;
396
393
  this.typechecker.check();
@@ -437,17 +434,30 @@ var DevService = class extends EventEmitter {
437
434
  }
438
435
  async #checkHealth() {
439
436
  if (!this.supervisor.running || !this.config.dev.url || !this.config.dev.health) return;
437
+ const pid = this.supervisor.pid;
440
438
  let next;
441
439
  try {
442
440
  next = (await fetch(new URL(this.config.dev.health, this.config.dev.url), { signal: AbortSignal.timeout(2e3) })).status < 500 ? "ok" : "down";
443
441
  } catch {
444
442
  next = "down";
445
443
  }
444
+ if (this.#stopped || pid !== this.supervisor.pid) return;
446
445
  if (next !== this.#health) {
447
446
  this.#health = next;
447
+ if (next === "ok") this.#settleProgress();
448
448
  this.#emitStatus();
449
449
  }
450
450
  }
451
+ #settleProgress() {
452
+ if (this.config.dev.health && this.#health !== "ok") return;
453
+ if (this.#build !== "ok") return;
454
+ this.#progress = {
455
+ ...this.#progress,
456
+ fraction: 1,
457
+ message: "watching for changes",
458
+ readyMs: this.#progress.readyMs ?? Date.now() - this.#progress.startedAt
459
+ };
460
+ }
451
461
  #emitStatus() {
452
462
  this.emit("status", this.status);
453
463
  }
@@ -465,7 +475,7 @@ function createSupervisor(config) {
465
475
  ...process.env,
466
476
  ...config.dev.env,
467
477
  STARS_DEV: "1",
468
- FORCE_COLOR: process.env.FORCE_COLOR ?? (process.stdout.isTTY ? "1" : void 0)
478
+ FORCE_COLOR: process.env.NO_COLOR !== void 0 ? void 0 : process.env.FORCE_COLOR ?? (process.stdout.isTTY ? "1" : void 0)
469
479
  },
470
480
  killTimeout: config.dev.killTimeout
471
481
  });
@@ -554,13 +564,12 @@ async function runDev(options) {
554
564
  configFile: options.config
555
565
  }));
556
566
  assertSupportedExperiments(config);
557
- await prepareAutoImports(config);
558
567
  const mode = resolveOutputMode({ tui: options.tui });
559
568
  const color = shouldUseColor();
560
569
  const service = new DevService(config, { builder: await createBuilder(config) });
561
570
  const logFile = config.dev.logFile ? new LogFileWriter(config.dev.logFile, service.logs) : null;
562
571
  logFile?.open();
563
- const renderer = mode === "tui" ? (await import("./tui-BTRFsLQR.js")).createTuiRenderer(service, {
572
+ const renderer = mode === "tui" ? (await import("./tui-C2P91TgW.js")).createTuiRenderer(service, {
564
573
  color,
565
574
  reducedMotion: prefersReducedMotion()
566
575
  }) : (await import("./plain-CEe4X_Cz.js")).createPlainRenderer(service, { color });
@@ -579,7 +588,13 @@ async function runDev(options) {
579
588
  process.once("SIGHUP", () => void shutdown(ExitCode.Terminated));
580
589
  if (process.platform !== "win32") process.on("SIGUSR2", () => void service.restart("manual"));
581
590
  const finished = renderer.start().then(() => shutdown(ExitCode.Ok));
582
- await service.start();
591
+ try {
592
+ await prepareAutoImports(config);
593
+ await service.start();
594
+ } catch (error) {
595
+ service.log("stars", "error", error instanceof Error ? error.stack ?? error.message : String(error));
596
+ await shutdown(ExitCode.Error);
597
+ }
583
598
  await finished;
584
599
  }
585
600
  /**
@@ -601,4 +616,4 @@ async function resolveDevConfig(config) {
601
616
 
602
617
  //#endregion
603
618
  export { runDev };
604
- //# sourceMappingURL=dev-CWA_JVTb.js.map
619
+ //# sourceMappingURL=dev-C6HogNjR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev-C6HogNjR.js","names":["#state","#errors","#run","#child","#pending","#setState","#handleLine","#progress","#setBuild","#emitStatus","#onBuildSuccess","#onBuildFailure","#settleProgress","#checkHealth","#onExit","#healthTimer","#build","#health","#restarts","#lastRestartReason","#lastBuild","#lastExit","#stopped","#clearRestartTimer","#enqueue","#scheduleRestart","#pendingReason","#restartTimer","#queue","#stream","#write"],"sources":["../src/lib/typechecker.ts","../src/lib/dev-service.ts","../src/lib/host.ts","../src/lib/log-file.ts","../src/lib/tasks/dev.ts"],"sourcesContent":["import type { ResolvedStarsConfig, StarsTypechecker } from '@wolfstar/http-framework/config';\nimport { spawn, type ChildProcess } from 'node:child_process';\nimport { EventEmitter } from 'node:events';\nimport { resolveTscBinary } from './builders/tsc.js';\nimport { CliError } from './errors.js';\nimport type { LogLevel } from './log-buffer.js';\nimport { createLineSplitter } from './process-supervisor.js';\nimport { resolveBinary } from './project.js';\n\nconst WATCH_START = /Starting (incremental )?compilation/;\nconst WATCH_DONE = /Found (\\d+) errors?\\. Watching for file changes/;\nconst ONE_SHOT_DONE = /Found (\\d+) errors?/;\nconst ERROR_LINE = /error TS\\d+:/;\n\nexport type TypecheckState = 'idle' | 'checking' | 'ok' | 'failed';\n\nexport interface TypecheckerEvents {\n\tlog: [level: LogLevel, text: string];\n\tstate: [state: TypecheckState, errors: number];\n}\n\nexport interface TypecheckCommand {\n\t/** The executable, and whether it is a script `node` has to run. */\n\treadonly command: string;\n\treadonly args: readonly string[];\n\treadonly node: boolean;\n\t/** Whether the checker watches the project itself, or has to be re-run after every build. */\n\treadonly watch: boolean;\n}\n\n/**\n * Runs a type checker next to the bot and reports type errors on their own channel, without ever blocking builds or\n * restarts: `stars dev` keeps running whatever the build tool produced, the way Seedcord's `hmr.typecheck` and\n * Vite's `checker` plugin do.\n *\n * `tsc` and `golar` (which forwards to TypeScript) watch the project themselves; `tsz` has no watch mode, so\n * {@link Typechecker.check} re-runs it after every build instead.\n */\nexport class Typechecker extends EventEmitter<TypecheckerEvents> {\n\t#child: ChildProcess | null = null;\n\t#state: TypecheckState = 'idle';\n\t#errors = 0;\n\t#pending = false;\n\n\tpublic constructor(private readonly config: ResolvedStarsConfig) {\n\t\tsuper();\n\t}\n\n\tpublic get state(): TypecheckState {\n\t\treturn this.#state;\n\t}\n\n\tpublic get errors(): number {\n\t\treturn this.#errors;\n\t}\n\n\t/** Whether the checker re-runs per build instead of watching on its own. */\n\tpublic get oneShot(): boolean {\n\t\treturn this.config.dev.typecheck.enabled && !resolveTypecheckCommand(this.config).watch;\n\t}\n\n\tpublic start(): void {\n\t\tif (!this.config.dev.typecheck.enabled) return;\n\t\tthis.#run();\n\t}\n\n\t/**\n\t * Re-runs a checker that cannot watch. Called after every successful build; a run already in flight is replaced,\n\t * so a fast series of builds only leaves the last check standing.\n\t */\n\tpublic check(): void {\n\t\tif (!this.oneShot) return;\n\t\tif (this.#child) {\n\t\t\tthis.#pending = true;\n\t\t\tthis.#child.kill();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#run();\n\t}\n\n\tpublic close(): Promise<void> {\n\t\tconst child = this.#child;\n\t\tthis.#child = null;\n\t\tthis.#pending = false;\n\t\tif (!child || child.exitCode !== null) return Promise.resolve();\n\n\t\treturn new Promise((resolve) => {\n\t\t\tchild.once('exit', () => resolve());\n\t\t\tchild.kill();\n\t\t});\n\t}\n\n\t#run(): void {\n\t\tconst { command, args, node, watch } = resolveTypecheckCommand(this.config);\n\t\tconst child = spawn(node ? process.execPath : command, node ? [command, ...args] : [...args], {\n\t\t\tcwd: this.config.root,\n\t\t\tenv: process.env,\n\t\t\tstdio: ['ignore', 'pipe', 'pipe'],\n\t\t\twindowsHide: true\n\t\t});\n\t\tthis.#child = child;\n\t\tthis.#setState('checking', 0);\n\n\t\tlet errors = 0;\n\t\tconst handleLine = (line: string) => {\n\t\t\tif (ERROR_LINE.test(line)) errors++;\n\t\t\tthis.#handleLine(line);\n\t\t};\n\n\t\tconst stdout = createLineSplitter(handleLine);\n\t\tconst stderr = createLineSplitter(handleLine);\n\t\tchild.stdout?.on('data', stdout.push);\n\t\tchild.stderr?.on('data', stderr.push);\n\n\t\tchild.once('exit', (code) => {\n\t\t\tstdout.flush();\n\t\t\tstderr.flush();\n\t\t\tthis.#child = null;\n\n\t\t\tif (!watch && this.#state === 'checking') {\n\t\t\t\t// A one-shot checker only reports through its exit code when it prints no summary line.\n\t\t\t\tthis.#setState(code === 0 && errors === 0 ? 'ok' : 'failed', errors);\n\t\t\t}\n\n\t\t\tif (this.#pending) {\n\t\t\t\tthis.#pending = false;\n\t\t\t\tthis.#run();\n\t\t\t}\n\t\t});\n\t\tchild.once('error', (error: NodeJS.ErrnoException) => {\n\t\t\tthis.#child = null;\n\t\t\tthis.emit('log', 'error', error.code === 'ENOENT' ? `${command} is not installed` : error.message);\n\t\t\tthis.#setState('failed', this.#errors);\n\t\t});\n\t}\n\n\t#handleLine(line: string): void {\n\t\tconst text = line.trim();\n\t\tif (text.length === 0) return;\n\n\t\tif (WATCH_START.test(text)) {\n\t\t\tthis.#setState('checking', 0);\n\t\t\treturn;\n\t\t}\n\n\t\tif (ERROR_LINE.test(text)) {\n\t\t\tthis.emit('log', 'error', text);\n\t\t\treturn;\n\t\t}\n\n\t\tconst done = WATCH_DONE.exec(text) ?? ONE_SHOT_DONE.exec(text);\n\t\tif (done) {\n\t\t\tconst errors = Number(done[1]);\n\t\t\tthis.#setState(errors === 0 ? 'ok' : 'failed', errors);\n\t\t\tthis.emit('log', errors === 0 ? 'success' : 'error', errors === 0 ? 'No type errors' : `${errors} type error${errors === 1 ? '' : 's'}`);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.emit('log', 'info', text);\n\t}\n\n\t#setState(state: TypecheckState, errors: number): void {\n\t\tthis.#state = state;\n\t\tthis.#errors = errors;\n\t\tthis.emit('state', state, errors);\n\t}\n}\n\n/**\n * Builds the command line of the configured type checker, resolved from the project's own `node_modules`.\n *\n * @throws {CliError} when the checker is not installed in the project.\n */\nexport function resolveTypecheckCommand(config: ResolvedStarsConfig): TypecheckCommand {\n\tconst { checker, tsconfig } = config.dev.typecheck;\n\tconst project = tsconfig!;\n\n\tswitch (checker) {\n\t\tcase 'golar': {\n\t\t\t// `golar tsc` forwards everything after it to the TypeScript CLI, watch mode included.\n\t\t\tconst golar = resolveBinary(config.root, 'golar', 'golar');\n\t\t\tif (!golar) throw missing(config, 'golar', 'Install it with `pnpm add -D golar`');\n\n\t\t\treturn { command: golar, args: ['tsc', ...WATCH_ARGS, '-p', project], node: true, watch: true };\n\t\t}\n\n\t\tcase 'tsz': {\n\t\t\t// `tsz` is an early, tsc-compatible checker with no watch mode; `try-tsz` is its comparison harness.\n\t\t\tconst tsz = resolveBinary(config.root, '@mohsen-azimi/tsz-dev', 'tsz');\n\t\t\tif (tsz) return { command: tsz, args: ['--noEmit', '-p', project], node: true, watch: false };\n\n\t\t\tconst tryTsz = resolveBinary(config.root, 'try-tsz', 'try-tsz');\n\t\t\tif (tryTsz) return { command: tryTsz, args: ['-p', project], node: true, watch: false };\n\n\t\t\tthrow missing(config, 'tsz', 'Install it with `pnpm add -D @mohsen-azimi/tsz-dev` (or `try-tsz`)');\n\t\t}\n\n\t\tdefault: {\n\t\t\tconst tsc = resolveTscBinary(config.root);\n\t\t\tif (!tsc) throw missing(config, 'typescript', 'Install it with `pnpm add -D typescript`');\n\n\t\t\treturn { command: tsc, args: [...WATCH_ARGS, '-p', project], node: true, watch: true };\n\t\t}\n\t}\n}\n\nconst WATCH_ARGS = ['--noEmit', '--watch', '--preserveWatchOutput', '--pretty', 'false'] as const;\n\nfunction missing(config: ResolvedStarsConfig, name: string, install: string): CliError {\n\treturn new CliError(`\"${name}\" is not installed in ${config.root}`, {\n\t\tcode: 'DEPENDENCY_MISSING',\n\t\thint: `${install}, pick another \\`dev.typecheck.checker\\`, or set \\`dev.typecheck\\` to false.`\n\t});\n}\n\nexport type { StarsTypechecker };\n","import { EventEmitter } from 'node:events';\nimport type { Builder, BuildOutcome } from './builders/types.js';\nimport { displayPath, type ResolvedStarsConfig } from '@wolfstar/http-framework/config';\nimport { classifyAppLine, LogBuffer, type LogLevel, type LogSource } from './log-buffer.js';\nimport { ProcessSupervisor, type ProcessExit, type ProcessState } from './process-supervisor.js';\nimport { Tunnel, type TunnelState } from './tunnel.js';\nimport { Typechecker, type TypecheckState } from './typechecker.js';\n\nexport type BuildState = 'idle' | 'building' | 'ok' | 'failed';\nexport type HealthState = 'unknown' | 'ok' | 'down';\nexport type RestartReason = 'initial' | 'build' | 'manual' | 'crash';\n\nexport interface DevStatus {\n\treadonly progress: { readonly fraction: number; readonly message: string; readonly startedAt: number; readonly readyMs: number | null };\n\treadonly process: ProcessState;\n\treadonly build: BuildState;\n\treadonly health: HealthState;\n\treadonly pid: number | null;\n\treadonly startedAt: number | null;\n\treadonly restarts: number;\n\treadonly lastRestartReason: RestartReason | null;\n\treadonly lastBuild: BuildOutcome | null;\n\treadonly lastExit: ProcessExit | null;\n\treadonly url: string | null;\n\treadonly typecheck: TypecheckState;\n\treadonly typeErrors: number;\n\treadonly tunnel: TunnelState;\n\treadonly tunnelUrl: string | null;\n}\n\nexport interface DevServiceEvents {\n\tstatus: [status: DevStatus];\n}\n\nexport interface DevServiceOptions {\n\tbuilder: Builder;\n\tlogs?: LogBuffer;\n\t/** Overrides for tests. */\n\tsupervisor?: ProcessSupervisor;\n\ttypechecker?: Typechecker;\n\ttunnel?: Tunnel;\n\thealthInterval?: number;\n}\n\n/**\n * The headless heart of `stars dev`: builds, (re)starts the bot and exposes state and logs.\n * Renderers (plain or TUI) only subscribe to it, they never own behaviour.\n */\nexport class DevService extends EventEmitter<DevServiceEvents> {\n\tpublic readonly logs: LogBuffer;\n\tpublic readonly builder: Builder;\n\tpublic readonly supervisor: ProcessSupervisor;\n\tpublic readonly typechecker: Typechecker;\n\tpublic readonly tunnel: Tunnel;\n\n\t#build: BuildState = 'idle';\n\t#health: HealthState = 'unknown';\n\t#restarts = 0;\n\t#lastRestartReason: RestartReason | null = null;\n\t#lastBuild: BuildOutcome | null = null;\n\t#lastExit: ProcessExit | null = null;\n\t#restartTimer: NodeJS.Timeout | null = null;\n\t#healthTimer: NodeJS.Timeout | null = null;\n\t#pendingReason: RestartReason | null = null;\n\t#stopped = false;\n\t#queue: Promise<void> = Promise.resolve();\n\t#progress = { fraction: 0, message: 'preparing your app', startedAt: Date.now(), readyMs: null as number | null };\n\n\tpublic constructor(\n\t\tpublic readonly config: ResolvedStarsConfig,\n\t\toptions: DevServiceOptions\n\t) {\n\t\tsuper();\n\t\tthis.logs = options.logs ?? new LogBuffer();\n\t\tthis.builder = options.builder;\n\t\tthis.supervisor = options.supervisor ?? createSupervisor(config);\n\t\tthis.typechecker = options.typechecker ?? new Typechecker(config);\n\t\tthis.tunnel = options.tunnel ?? new Tunnel(config);\n\n\t\tthis.builder.on('start', () => {\n\t\t\tthis.#progress = { fraction: 0, message: 'preparing build', startedAt: Date.now(), readyMs: null };\n\t\t\tthis.#setBuild('building');\n\t\t});\n\t\tthis.builder.on('progress', (fraction, message) => {\n\t\t\tthis.#progress = { ...this.#progress, fraction: Math.max(this.#progress.fraction, Math.min(0.75, fraction)), message };\n\t\t\tthis.#emitStatus();\n\t\t});\n\t\tthis.builder.on('success', (outcome) => this.#onBuildSuccess(outcome));\n\t\tthis.builder.on('failure', (outcome) => this.#onBuildFailure(outcome));\n\t\tthis.builder.on('log', (level, text) => this.log('build', level, text));\n\n\t\tthis.supervisor.on('state', () => {\n\t\t\tif (this.supervisor.state === 'running') {\n\t\t\t\tthis.#settleProgress();\n\t\t\t\tvoid this.#checkHealth();\n\t\t\t}\n\t\t\tthis.#emitStatus();\n\t\t});\n\t\tthis.supervisor.on('stdout', (line) => this.log('app', classifyAppLine(line, 'info'), line));\n\t\tthis.supervisor.on('stderr', (line) => this.log('app', classifyAppLine(line, 'error'), line));\n\t\tthis.supervisor.on('error', (error) => this.log('stars', 'error', `Failed to start the bot: ${error.message}`));\n\t\tthis.supervisor.on('exit', (exit) => this.#onExit(exit));\n\n\t\tthis.typechecker.on('log', (level, text) => this.log('tsc', level, text));\n\t\tthis.typechecker.on('state', () => this.#emitStatus());\n\t\tthis.tunnel.on('log', (level, text) => this.log('tunnel', level, text));\n\t\tthis.tunnel.on('state', () => this.#emitStatus());\n\n\t\tif (config.dev.url && config.dev.health) {\n\t\t\tconst interval = options.healthInterval ?? 5000;\n\t\t\tthis.#healthTimer = setInterval(() => void this.#checkHealth(), interval);\n\t\t\tthis.#healthTimer.unref();\n\t\t}\n\t}\n\n\tpublic get status(): DevStatus {\n\t\treturn {\n\t\t\tprogress: this.#progress,\n\t\t\tprocess: this.supervisor.state,\n\t\t\tbuild: this.#build,\n\t\t\thealth: this.#health,\n\t\t\tpid: this.supervisor.pid,\n\t\t\tstartedAt: this.supervisor.startedAt,\n\t\t\trestarts: this.#restarts,\n\t\t\tlastRestartReason: this.#lastRestartReason,\n\t\t\tlastBuild: this.#lastBuild,\n\t\t\tlastExit: this.#lastExit,\n\t\t\turl: this.config.dev.url,\n\t\t\ttypecheck: this.typechecker.state,\n\t\t\ttypeErrors: this.typechecker.errors,\n\t\t\ttunnel: this.tunnel.state,\n\t\t\ttunnelUrl: this.tunnel.url\n\t\t};\n\t}\n\n\tpublic log(source: LogSource, level: LogLevel, text: string): void {\n\t\tthis.logs.push({ source, level, text });\n\t}\n\n\t/**\n\t * Starts watching; the bot starts after the first successful build.\n\t */\n\tpublic async start(): Promise<void> {\n\t\tthis.#stopped = false;\n\t\tconst entry = displayPath(this.config.root, this.config.entry);\n\t\tthis.log('stars', 'info', this.config.build.tool === 'none' ? `Watching ${entry}` : `Watching ${entry} with ${this.config.build.tool}`);\n\t\tif (this.config.dev.typecheck.enabled) this.typechecker.start();\n\t\t// The tunnel comes up next to the build: neither waits for the other, and a failed tunnel never stops the bot.\n\t\tvoid this.tunnel.start();\n\t\tawait this.builder.watch();\n\t}\n\n\t/**\n\t * Restarts the bot immediately (used by the `r` key and by `SIGUSR2`).\n\t */\n\tpublic restart(reason: RestartReason = 'manual'): Promise<void> {\n\t\tthis.#clearRestartTimer();\n\t\treturn this.#enqueue(async () => {\n\t\t\tif (this.#stopped) return;\n\t\t\tif (reason === 'manual' || reason === 'crash') {\n\t\t\t\tthis.#progress = { fraction: 0, message: 'restarting the bot', startedAt: Date.now(), readyMs: null };\n\t\t\t}\n\t\t\tthis.#lastRestartReason = reason;\n\t\t\tif (this.supervisor.running) {\n\t\t\t\tthis.#restarts++;\n\t\t\t\tthis.log('stars', 'info', `Restarting (${describeReason(reason)})`);\n\t\t\t\tawait this.supervisor.stop();\n\t\t\t} else {\n\t\t\t\tthis.log('stars', 'info', `Starting (${describeReason(reason)})`);\n\t\t\t}\n\n\t\t\tif (this.#stopped) return;\n\t\t\tthis.#progress = { ...this.#progress, fraction: 0.75, message: 'starting the bot' };\n\t\t\tthis.#health = 'unknown';\n\t\t\tthis.supervisor.start();\n\t\t\tthis.#emitStatus();\n\t\t});\n\t}\n\n\t/**\n\t * Stops the watcher and the bot. Safe to call more than once.\n\t */\n\tpublic async stop(): Promise<void> {\n\t\tthis.#stopped = true;\n\t\tthis.#clearRestartTimer();\n\t\tif (this.#healthTimer) clearInterval(this.#healthTimer);\n\t\tthis.#healthTimer = null;\n\t\tawait this.#enqueue(async () => {\n\t\t\tawait Promise.allSettled([this.builder.close(), this.supervisor.stop(), this.typechecker.close(), this.tunnel.close()]);\n\t\t});\n\t}\n\n\tpublic clearLogs(): void {\n\t\tthis.logs.clear();\n\t}\n\n\t#onBuildSuccess(outcome: BuildOutcome): void {\n\t\tthis.#lastBuild = outcome;\n\t\tthis.#progress = { ...this.#progress, fraction: 0.75, message: 'starting the bot' };\n\t\tthis.#setBuild('ok');\n\t\tif (this.#stopped) return;\n\t\t// A checker without a watch mode (`tsz`) only knows about the change once the build is through.\n\t\tthis.typechecker.check();\n\t\tthis.log('stars', 'success', this.builder.tool === 'none' ? 'Sources changed' : `Build succeeded in ${outcome.durationMs}ms`);\n\t\tthis.#scheduleRestart(this.supervisor.state === 'idle' ? 'initial' : 'build');\n\t}\n\n\t#onBuildFailure(outcome: BuildOutcome): void {\n\t\tthis.#lastBuild = outcome;\n\t\tthis.#setBuild('failed');\n\t\tthis.#clearRestartTimer();\n\t\tthis.log('stars', 'error', `Build failed${outcome.message ? `: ${outcome.message}` : ''}, waiting for changes`);\n\t}\n\n\t#onExit(exit: ProcessExit): void {\n\t\tthis.#lastExit = exit;\n\t\tthis.#health = 'unknown';\n\t\tif (!exit.requested) {\n\t\t\tconst how = exit.signal ? `signal ${exit.signal}` : `code ${exit.code}`;\n\t\t\tthis.log('stars', exit.code === 0 ? 'warn' : 'error', `The bot exited with ${how}, waiting for changes (press r to restart)`);\n\t\t}\n\t\tthis.#emitStatus();\n\t}\n\n\t#scheduleRestart(reason: RestartReason): void {\n\t\tthis.#pendingReason = reason;\n\t\tthis.#clearRestartTimer();\n\t\tthis.#restartTimer = setTimeout(() => {\n\t\t\tthis.#restartTimer = null;\n\t\t\tconst pending = this.#pendingReason ?? reason;\n\t\t\tthis.#pendingReason = null;\n\t\t\tvoid this.restart(pending);\n\t\t}, this.config.dev.debounce);\n\t}\n\n\t#clearRestartTimer(): void {\n\t\tif (this.#restartTimer) clearTimeout(this.#restartTimer);\n\t\tthis.#restartTimer = null;\n\t}\n\n\t#enqueue(task: () => Promise<void>): Promise<void> {\n\t\tthis.#queue = this.#queue.then(task, task);\n\t\treturn this.#queue;\n\t}\n\n\t#setBuild(state: BuildState): void {\n\t\tif (this.#build === state) return;\n\t\tthis.#build = state;\n\t\tthis.#emitStatus();\n\t}\n\n\tasync #checkHealth(): Promise<void> {\n\t\tif (!this.supervisor.running || !this.config.dev.url || !this.config.dev.health) return;\n\t\tconst pid = this.supervisor.pid;\n\n\t\tlet next: HealthState;\n\t\ttry {\n\t\t\tconst response = await fetch(new URL(this.config.dev.health, this.config.dev.url), { signal: AbortSignal.timeout(2000) });\n\t\t\tnext = response.status < 500 ? 'ok' : 'down';\n\t\t} catch {\n\t\t\tnext = 'down';\n\t\t}\n\n\t\tif (this.#stopped || pid !== this.supervisor.pid) return;\n\t\tif (next !== this.#health) {\n\t\t\tthis.#health = next;\n\t\t\tif (next === 'ok') this.#settleProgress();\n\t\t\tthis.#emitStatus();\n\t\t}\n\t}\n\n\t#settleProgress(): void {\n\t\tif (this.config.dev.health && this.#health !== 'ok') return;\n\t\tif (this.#build !== 'ok') return;\n\t\tthis.#progress = {\n\t\t\t...this.#progress,\n\t\t\tfraction: 1,\n\t\t\tmessage: 'watching for changes',\n\t\t\treadyMs: this.#progress.readyMs ?? Date.now() - this.#progress.startedAt\n\t\t};\n\t}\n\n\t#emitStatus(): void {\n\t\tthis.emit('status', this.status);\n\t}\n}\n\nexport function createSupervisor(config: ResolvedStarsConfig): ProcessSupervisor {\n\treturn new ProcessSupervisor({\n\t\tcommand: process.execPath,\n\t\targs: [...config.dev.nodeArgs, config.build.output, ...config.dev.args],\n\t\tcwd: config.root,\n\t\tenv: {\n\t\t\t...process.env,\n\t\t\t...config.dev.env,\n\t\t\tSTARS_DEV: '1',\n\t\t\tFORCE_COLOR: process.env.NO_COLOR !== undefined ? undefined : (process.env.FORCE_COLOR ?? (process.stdout.isTTY ? '1' : undefined))\n\t\t},\n\t\tkillTimeout: config.dev.killTimeout\n\t});\n}\n\nexport function describeReason(reason: RestartReason): string {\n\tswitch (reason) {\n\t\tcase 'initial':\n\t\t\treturn 'first build';\n\t\tcase 'build':\n\t\t\treturn 'sources changed';\n\t\tcase 'manual':\n\t\t\treturn 'manual restart';\n\t\tcase 'crash':\n\t\t\treturn 'after crash';\n\t}\n}\n","import { lookup } from 'node:dns/promises';\n\n/**\n * Resolves `localhost` the way Vite's dev server does: Node's default DNS result order (`dns.lookup('localhost')`)\n * can disagree with the OS's own, \"verbatim\" resolution order — a well known source of a dev URL that prints fine\n * but is not the address the bot actually bound to (e.g. an IPv6-first system where the server listens on IPv4\n * only). When the two disagree this returns the OS's own address instead of the literal `localhost` hostname.\n */\nexport async function resolveLocalhost(): Promise<string> {\n\ttry {\n\t\tconst [ordered, verbatim] = await Promise.all([lookup('localhost'), lookup('localhost', { verbatim: true })]);\n\t\treturn ordered.family === verbatim.family && ordered.address === verbatim.address ? 'localhost' : verbatim.address;\n\t} catch {\n\t\treturn 'localhost';\n\t}\n}\n\n/**\n * Replaces a `localhost` hostname in `url` with {@link resolveLocalhost}'s result. Any other hostname (an explicit\n * `dev.url` override, a LAN address, …) is returned untouched.\n */\nexport async function withResolvedLocalhost(url: string): Promise<string> {\n\tconst parsed = new URL(url);\n\tif (parsed.hostname !== 'localhost') return url;\n\n\tconst host = await resolveLocalhost();\n\tif (host === 'localhost') return url;\n\n\tparsed.hostname = host.includes(':') ? `[${host}]` : host;\n\treturn parsed.href;\n}\n","import { createWriteStream, mkdirSync, type WriteStream } from 'node:fs';\nimport { dirname } from 'node:path';\nimport type { LogBuffer, LogEntry } from './log-buffer.js';\n\n/**\n * Mirrors a dev session's logs into a file, so a run can be read back after the terminal UI is gone (the TUI takes\n * over the alternate screen and its scrollback disappears on exit). Seedcord keeps a `logs/` directory for the same\n * reason; this writes a single, truncated-per-run file instead.\n */\nexport class LogFileWriter {\n\t#stream: WriteStream | null = null;\n\n\tpublic constructor(\n\t\tpublic readonly file: string,\n\t\tprivate readonly logs: LogBuffer\n\t) {}\n\n\tpublic open(): void {\n\t\tif (this.#stream) return;\n\n\t\tmkdirSync(dirname(this.file), { recursive: true });\n\t\tthis.#stream = createWriteStream(this.file, { flags: 'w' });\n\t\t// A broken pipe or a read-only directory must never take the dev session down with it.\n\t\tthis.#stream.on('error', () => this.close());\n\n\t\tfor (const entry of this.logs.entries()) this.#write(entry);\n\t\tthis.logs.on('entry', this.#write);\n\t}\n\n\tpublic close(): void {\n\t\tconst stream = this.#stream;\n\t\tthis.#stream = null;\n\t\tif (!stream) return;\n\n\t\tthis.logs.off('entry', this.#write);\n\t\tstream.end();\n\t}\n\n\t#write = (entry: LogEntry): void => {\n\t\tthis.#stream?.write(`${format(entry)}\\n`);\n\t};\n}\n\nfunction format(entry: LogEntry): string {\n\treturn `${new Date(entry.time).toISOString()} ${entry.level.padEnd(7)} ${entry.source.padEnd(6)} ${entry.text}`;\n}\n","import { loadStarsConfig, type ResolvedStarsConfig } from '@wolfstar/http-framework/config';\nimport type { ProjectArgs } from '../args.js';\nimport { resolveCwd } from '../args.js';\nimport { assertSupportedExperiments, createBuilder } from '../builders/index.js';\nimport { DevService } from '../dev-service.js';\nimport { ExitCode } from '../errors.js';\nimport { withResolvedLocalhost } from '../host.js';\nimport { LogFileWriter } from '../log-file.js';\nimport { prefersReducedMotion, resolveOutputMode, shouldUseColor } from '../output-mode.js';\nimport { prepareAutoImports } from './prepare.js';\n\nexport interface DevTaskOptions extends ProjectArgs {\n\ttui?: boolean;\n}\n\nexport async function runDev(options: DevTaskOptions): Promise<void> {\n\tconst config = await resolveDevConfig(await loadStarsConfig({ cwd: resolveCwd(options), configFile: options.config }));\n\tassertSupportedExperiments(config);\n\tconst mode = resolveOutputMode({ tui: options.tui });\n\tconst color = shouldUseColor();\n\n\tconst service = new DevService(config, { builder: await createBuilder(config) });\n\tconst logFile = config.dev.logFile ? new LogFileWriter(config.dev.logFile, service.logs) : null;\n\tlogFile?.open();\n\tconst renderer =\n\t\tmode === 'tui'\n\t\t\t? (await import('../../renderers/tui.js')).createTuiRenderer(service, { color, reducedMotion: prefersReducedMotion() })\n\t\t\t: (await import('../../renderers/plain.js')).createPlainRenderer(service, { color });\n\n\tlet exiting: Promise<never> | null = null;\n\tconst shutdown = (code: ExitCode): Promise<never> => {\n\t\texiting ??= (async () => {\n\t\t\trenderer.stop();\n\t\t\tawait service.stop();\n\t\t\tlogFile?.close();\n\t\t\tprocess.exit(code);\n\t\t})();\n\t\treturn exiting;\n\t};\n\n\tprocess.once('SIGINT', () => void shutdown(ExitCode.Interrupted));\n\tprocess.once('SIGTERM', () => void shutdown(ExitCode.Terminated));\n\tprocess.once('SIGHUP', () => void shutdown(ExitCode.Terminated));\n\tif (process.platform !== 'win32') process.on('SIGUSR2', () => void service.restart('manual'));\n\n\tconst finished = renderer.start().then(() => shutdown(ExitCode.Ok));\n\ttry {\n\t\tawait prepareAutoImports(config);\n\t\tawait service.start();\n\t} catch (error) {\n\t\tservice.log('stars', 'error', error instanceof Error ? (error.stack ?? error.message) : String(error));\n\t\tawait shutdown(ExitCode.Error);\n\t}\n\tawait finished;\n}\n\n/**\n * Resolves `dev.url`'s `localhost` to the address that is actually reachable (see {@link withResolvedLocalhost}),\n * the way Vite's dev server does when it starts. Only `stars dev` pays this DNS lookup; `stars info`/`stars build`\n * show or use the unresolved config as-is, since they never talk to the bot.\n */\nasync function resolveDevConfig(config: ResolvedStarsConfig): Promise<ResolvedStarsConfig> {\n\tif (!config.dev.url) return config;\n\n\tconst url = await withResolvedLocalhost(config.dev.url);\n\treturn url === config.dev.url ? config : { ...config, dev: { ...config.dev, url } };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AASA,MAAM,cAAc;AACpB,MAAM,aAAa;AACnB,MAAM,gBAAgB;AACtB,MAAM,aAAa;;;;;;;;;AA0BnB,IAAa,cAAb,cAAiC,aAAgC;CAM5B;CALpC,SAA8B;CAC9B,SAAyB;CACzB,UAAU;CACV,WAAW;CAEX,AAAO,YAAY,AAAiB,QAA6B;EAChE,MAAM;EAD6B;CAEpC;CAEA,IAAW,QAAwB;EAClC,OAAO,KAAKA;CACb;CAEA,IAAW,SAAiB;EAC3B,OAAO,KAAKC;CACb;;CAGA,IAAW,UAAmB;EAC7B,OAAO,KAAK,OAAO,IAAI,UAAU,WAAW,CAAC,wBAAwB,KAAK,MAAM,CAAC,CAAC;CACnF;CAEA,AAAO,QAAc;EACpB,IAAI,CAAC,KAAK,OAAO,IAAI,UAAU,SAAS;EACxC,KAAKC,KAAK;CACX;;;;;CAMA,AAAO,QAAc;EACpB,IAAI,CAAC,KAAK,SAAS;EACnB,IAAI,KAAKC,QAAQ;GAChB,KAAKC,WAAW;GAChB,KAAKD,OAAO,KAAK;GACjB;EACD;EAEA,KAAKD,KAAK;CACX;CAEA,AAAO,QAAuB;EAC7B,MAAM,QAAQ,KAAKC;EACnB,KAAKA,SAAS;EACd,KAAKC,WAAW;EAChB,IAAI,CAAC,SAAS,MAAM,aAAa,MAAM,OAAO,QAAQ,QAAQ;EAE9D,OAAO,IAAI,SAAS,YA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AS,SAAS,KAAK;CAC9B;CACA,MAAM;AACP;;;;;;AAOA,eAAe,iBAAiB,QAA2D;CAC1F,IAAI,CAAC,OAAO,IAAI,KAAK,OAAO;CAE5B,MAAM,MAAM,MAAM,sBAAsB,OAAO,IAAI,GAAG;CACtD,OAAO,QAAQ,OAAO,IAAI,MAAM,SAAS;EAAE,GAAG;EAAQ,KAAK;GAAE,GAAG,OAAO;GAAK;EAAI;CAAE;AACnF"}
package/dist/index.d.ts CHANGED
@@ -43,6 +43,10 @@ interface ResolveOutputModeOptions {
43
43
  env?: NodeJS.ProcessEnv;
44
44
  /** Whether stdout is an interactive terminal. */
45
45
  isTTY?: boolean;
46
+ /** Raw-key input requires a terminal too, even when the output is a TTY. */
47
+ isInputTTY?: boolean;
48
+ columns?: number;
49
+ rows?: number;
46
50
  /** Whether the process runs in a CI environment. */
47
51
  isCI?: boolean;
48
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/lib/errors.ts","../src/lib/output-mode.ts"],"mappings":";;cAEa;WACZ;WACA;WACA;WACA;WACA;WACA;;KAGW,mBAAmB,uBAAuB;UAErC;;EAEhB;;EAEA;EACA,WAAW;EACX;;;;;cAMY,iBAAiB;WACb;WACA;WACA,UAAU;EAE1B,YAAmB,iBAAiB,SAAS;;;;;;;;iBAe9B,YAAY;iBAgBZ,WAAW,iBAAiB;;;KC7DhC;UAEK;;EAEhB;EACA,MAAM,OAAO;;EAEb;;EAEA;;;;;;;iBAUe,kBAAkB,UAAS,2BAAgC;iBAgB3D,gBAAgB,MAAK,OAAO;;;;iBAU5B,eAAe,MAAK,OAAO,YAA0B;;;;iBASrD,qBAAqB,MAAK,OAAO"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/lib/errors.ts","../src/lib/output-mode.ts"],"mappings":";;cAEa;WACZ;WACA;WACA;WACA;WACA;WACA;;KAGW,mBAAmB,uBAAuB;UAErC;;EAEhB;;EAEA;EACA,WAAW;EACX;;;;;cAMY,iBAAiB;WACb;WACA;WACA,UAAU;EAE1B,YAAmB,iBAAiB,SAAS;;;;;;;;iBAe9B,YAAY;iBAgBZ,WAAW,iBAAiB;;;KC7DhC;UAEK;;EAEhB;EACA,MAAM,OAAO;;EAEb;;EAEA;EACA;EACA;;EAEA;;;;;;;iBAUe,kBAAkB,UAAS,2BAAgC;iBAkB3D,gBAAgB,MAAK,OAAO;;;;iBAU5B,eAAe,MAAK,OAAO,YAA0B;;;;iBASrD,qBAAqB,MAAK,OAAO"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { i as formatError, n as ExitCode, r as exitCodeOf, t as CliError } from "./errors-Bket6XFn.js";
2
- import { i as shouldUseColor, n as prefersReducedMotion, r as resolveOutputMode, t as isCIEnvironment } from "./output-mode-ChrOf0LO.js";
2
+ import { i as shouldUseColor, n as prefersReducedMotion, r as resolveOutputMode, t as isCIEnvironment } from "./output-mode-Cxes6YUW.js";
3
3
  import { ConfigError, loadStarsConfig } from "@wolfstar/http-framework/config";
4
4
 
5
5
  export { CliError, ConfigError, ExitCode, exitCodeOf, formatError, isCIEnvironment, loadStarsConfig, prefersReducedMotion, resolveOutputMode, shouldUseColor };
@@ -1,5 +1,5 @@
1
1
  import { t as readOwnPackageJson } from "./version-DN6Uho-Y.js";
2
- import { i as shouldUseColor, r as resolveOutputMode } from "./output-mode-ChrOf0LO.js";
2
+ import { i as shouldUseColor, r as resolveOutputMode } from "./output-mode-Cxes6YUW.js";
3
3
  import { n as resolveCwd } from "./args-Ch1KXUMn.js";
4
4
  import { t as findInstalledVersion } from "./project-DHF3qdm-.js";
5
5
  import { displayPath, loadStarsConfig } from "@wolfstar/http-framework/config";
@@ -115,4 +115,4 @@ async function runInfo(options) {
115
115
 
116
116
  //#endregion
117
117
  export { runInfo };
118
- //# sourceMappingURL=info-Czh4LUsD.js.map
118
+ //# sourceMappingURL=info-BrxKCcUW.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"info-Czh4LUsD.js","names":[],"sources":["../src/lib/tasks/info.ts"],"sourcesContent":["import { createColors } from 'colorette';\nimport { arch, platform } from 'node:os';\nimport { relative } from 'node:path';\nimport type { ProjectArgs } from '../args.js';\nimport { resolveCwd } from '../args.js';\nimport { loadStarsConfig } from '@wolfstar/http-framework/config';\nimport { displayPath, type ResolvedStarsConfig } from '@wolfstar/http-framework/config';\nimport { resolveOutputMode, shouldUseColor } from '../output-mode.js';\nimport { findInstalledVersion } from '../project.js';\nimport { readOwnPackageJson } from '../version.js';\n\nexport interface InfoOptions extends ProjectArgs {\n\tjson?: boolean;\n\tstdout?: NodeJS.WritableStream;\n}\n\nexport interface ProjectInfo {\n\tcli: { version: string; node: string; platform: string; outputMode: 'tui' | 'plain' };\n\tproject: {\n\t\tcwd: string;\n\t\troot: string;\n\t\tconfigFile: string | null;\n\t\tname: string | null;\n\t\tversion: string | null;\n\t\tentry: string;\n\t\tframeworkVersion: string | null;\n\t};\n\tbuild: ResolvedStarsConfig['build'];\n\tdev: ResolvedStarsConfig['dev'];\n\tcodegen: ResolvedStarsConfig['codegen'];\n\timports: ResolvedStarsConfig['imports'];\n\texperimental: ResolvedStarsConfig['experimental'];\n\tfuture: ResolvedStarsConfig['future'];\n\t/**\n\t * The option names set in the `tsdown`/`vite` blocks. Only the names: the values hold plugins and callbacks,\n\t * which neither serialize to JSON nor read usefully on a terminal.\n\t */\n\toptions: { tsdown: string[]; vite: string[] };\n}\n\nexport function collectInfo(config: ResolvedStarsConfig): ProjectInfo {\n\treturn {\n\t\tcli: {\n\t\t\tversion: readOwnPackageJson().version,\n\t\t\tnode: process.version,\n\t\t\tplatform: `${platform()} ${arch()}`,\n\t\t\toutputMode: resolveOutputMode()\n\t\t},\n\t\tproject: {\n\t\t\tcwd: config.cwd,\n\t\t\troot: config.root,\n\t\t\tconfigFile: config.configFile,\n\t\t\tname: config.packageJson?.name ?? null,\n\t\t\tversion: config.packageJson?.version ?? null,\n\t\t\tentry: config.entry,\n\t\t\tframeworkVersion: findInstalledVersion(config.root, '@wolfstar/http-framework')\n\t\t},\n\t\tbuild: config.build,\n\t\tdev: config.dev,\n\t\tcodegen: config.codegen,\n\t\timports: config.imports,\n\t\texperimental: config.experimental,\n\t\tfuture: config.future,\n\t\toptions: { tsdown: Object.keys(config.tsdown), vite: Object.keys(config.vite) }\n\t};\n}\n\nexport function formatInfo(info: ProjectInfo, useColor: boolean): string {\n\tconst colors = createColors({ useColor });\n\tconst { root } = info.project;\n\tconst show = (path: string | null) => (path === null ? colors.dim('none') : displayPath(root, path));\n\tconst row = (label: string, value: string) => ` ${colors.dim(label.padEnd(12))}${value}`;\n\tconst section = (title: string, rows: string[]) => [colors.bold(title), ...rows].join('\\n');\n\n\treturn [\n\t\tsection(`stars ${colors.green(`v${info.cli.version}`)}`, [\n\t\t\trow('node', info.cli.node),\n\t\t\trow('platform', info.cli.platform),\n\t\t\trow('output', info.cli.outputMode),\n\t\t\trow(\n\t\t\t\t'framework',\n\t\t\t\tinfo.project.frameworkVersion\n\t\t\t\t\t? `@wolfstar/http-framework v${info.project.frameworkVersion}`\n\t\t\t\t\t: colors.yellow('@wolfstar/http-framework not installed')\n\t\t\t)\n\t\t]),\n\t\tsection('Project', [\n\t\t\trow(\n\t\t\t\t'name',\n\t\t\t\tinfo.project.name\n\t\t\t\t\t? `${info.project.name}${info.project.version ? colors.dim(` v${info.project.version}`) : ''}`\n\t\t\t\t\t: colors.dim('unnamed')\n\t\t\t),\n\t\t\trow('root', root),\n\t\t\trow(\n\t\t\t\t'config',\n\t\t\t\tinfo.project.configFile ? relative(root, info.project.configFile) || info.project.configFile : colors.dim('none (defaults)')\n\t\t\t),\n\t\t\trow('entry', show(info.project.entry))\n\t\t]),\n\t\tsection('Build', [\n\t\t\trow('tool', info.build.tool),\n\t\t\t// Which file the build tool is configured from: its own, or this project's `stars.config`.\n\t\t\trow('config', info.build.configFile ? show(info.build.configFile) : colors.dim('stars.config')),\n\t\t\trow('options', describeOptions(info, colors)),\n\t\t\trow('outDir', show(info.build.outDir)),\n\t\t\trow('tsconfig', show(info.build.tsconfig)),\n\t\t\trow('runs', show(info.build.output))\n\t\t]),\n\t\tsection('Dev', [\n\t\t\trow('watch', info.dev.watch.map(show).join(', ')),\n\t\t\trow('debounce', `${info.dev.debounce}ms`),\n\t\t\trow('node args', info.dev.nodeArgs.join(' ') || colors.dim('none')),\n\t\t\trow('args', info.dev.args.join(' ') || colors.dim('none')),\n\t\t\trow('url', info.dev.url ?? colors.dim('unknown, set dev.url or HTTP_PORT')),\n\t\t\trow('health', info.dev.health ?? colors.dim('none')),\n\t\t\trow(\n\t\t\t\t'typecheck',\n\t\t\t\tinfo.dev.typecheck.enabled ? `${info.dev.typecheck.checker} → ${show(info.dev.typecheck.tsconfig)}` : colors.dim('disabled')\n\t\t\t),\n\t\t\trow('tunnel', describeTunnel(info.dev.tunnel, colors)),\n\t\t\trow('log file', info.dev.logFile ? show(info.dev.logFile) : colors.dim('disabled'))\n\t\t]),\n\t\tsection('Codegen', [\n\t\t\trow('i18n', info.codegen.i18n ? `${show(info.codegen.i18n.locales)} → ${show(info.codegen.i18n.output)}` : colors.dim('disabled'))\n\t\t]),\n\t\tsection('Future', [row('compat', `v${info.future.compatibilityVersion} defaults`)]),\n\t\tsection('Experimental', [\n\t\t\trow('vite', flag(info.experimental.enableVite, colors)),\n\t\t\trow('nitro', flag(info.experimental.enableNitro, colors)),\n\t\t\trow('external', flag(info.experimental.enableExternalVite, colors))\n\t\t]),\n\t\tsection('Imports', [\n\t\t\trow('auto', info.imports.enabled ? colors.green('enabled') : colors.dim('disabled')),\n\t\t\trow('dirs', info.imports.dirs.map(show).join(', ')),\n\t\t\trow('presets', info.imports.presets.join(', ') || colors.dim('none')),\n\t\t\trow('dts', show(info.imports.dts))\n\t\t])\n\t].join('\\n\\n');\n}\n\nfunction describeOptions(info: ProjectInfo, colors: ReturnType<typeof createColors>): string {\n\tconst names = info.build.tool === 'vite' ? info.options.vite : info.options.tsdown;\n\treturn names.length > 0 ? names.join(', ') : colors.dim('none');\n}\n\nfunction flag(enabled: boolean, colors: ReturnType<typeof createColors>): string {\n\treturn enabled ? colors.green('enabled') : colors.dim('disabled');\n}\n\nfunction describeTunnel(tunnel: ResolvedStarsConfig['dev']['tunnel'], colors: ReturnType<typeof createColors>): string {\n\tswitch (tunnel.mode) {\n\t\tcase 'quick':\n\t\t\treturn 'cloudflared quick tunnel';\n\t\tcase 'url':\n\t\t\treturn tunnel.url;\n\t\tdefault:\n\t\t\treturn colors.dim('disabled');\n\t}\n}\n\nexport async function runInfo(options: InfoOptions): Promise<void> {\n\tconst stdout = options.stdout ?? process.stdout;\n\tconst config = await loadStarsConfig({ cwd: resolveCwd(options), configFile: options.config });\n\tconst info = collectInfo(config);\n\tstdout.write(`${options.json ? JSON.stringify(info, null, 2) : formatInfo(info, shouldUseColor())}\\n`);\n}\n"],"mappings":";;;;;;;;;;AAwCA,SAAgB,YAAY,QAA0C;CACrE,OAAO;EACN,KAAK;GACJ,SAAS,mBAAmB,CAAC,CAAC;GAC9B,MAAM,QAAQ;GACd,UAAU,GAAG,SAAS,EAAE,GAAG,KAAK;GAChC,YAAY,kBAAkB;EAC/B;EACA,SAAS;GACR,KAAK,OAAO;GACZ,MAAM,OAAO;GACb,YAAY,OAAO;GACnB,MAAM,OAAO,aAAa,QAAQ;GAClC,SAAS,OAAO,aAAa,WAAW;GACxC,OAAO,OAAO;GACd,kBAAkB,qBAAqB,OAAO,MAAM,0BAA0B;EAC/E;EACA,OAAO,OAAO;EACd,KAAK,OAAO;EACZ,SAAS,OAAO;EAChB,SAAS,OAAO;EAChB,cAAc,OAAO;EACrB,QAAQ,OAAO;EACf,SAAS;GAAE,QAAQ,OAAO,KAAK,OAAO,MAAM;GAAG,MAAM,OAAO,KAAK,OAAO,IAAI;EAAE;CAC/E;AACD;AAEA,SAAgB,WAAW,MAAmB,UAA2B;CACxE,MAAM,SAAS,aAAa,EAAE,SAAS,CAAC;CACxC,MAAM,EAAE,SAAS,KAAK;CACtB,MA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B,IAAI,QAAQ,KAAK,QAAQ,UAAU,OAAO,MAAM,SAAS,IAAI,OAAO,IAAI,UAAU,CAAC;GACnF,IAAI,QAAQ,KAAK,QAAQ,KAAK,IAAI,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC;GAClD,IAAI,WAAW,KAAK,QAAQ,QAAQ,KAAK,IAAI,KAAK,OAAO,IAAI,MAAM,CAAC;GACpE,IAAI,OAAO,KAAK,KAAK,QAAQ,GAAG,CAAC;EAClC,CAAC;CACF,CAAC,CAAC,KAAK,MAAM;AACd;AAEA,SAAS,gBAAgB,MAAmB,QAAiD;CAC5F,MAAM,QAAQ,KAAK,MAAM,SAAS,SAAS,KAAK,QAAQ,OAAO,KAAK,QAAQ;CAC5E,OAAO,MAAM,SAAS,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,IAAI,MAAM;AAC/D;AAEA,SAAS,KAAK,SAAkB,QAAiD;CAChF,OAAO,UAAU,OAAO,MAAM,SAAS,IAAI,OAAO,IAAI,UAAU;AACjE;AAEA,SAAS,eAAe,QAA8C,QAAiD;CACtH,QAAQ,OAAO,MAAf;EACC,KAAK,SACJ,OAAO;EACR,KAAK,OACJ,OAAO,OAAO;EACf,SACC,OAAO,OAAO,IAAI,UAAU;CAC9B;AACD;AAEA,eAAsB,QAAQ,SAAqC;CAClE,MAAM,SAAS,QAAQ,UAAU,QAAQ;CAEzC,MAAM,OAAO,YAAY,MADJ,gBAAgB;EAAE,KAAK,WAAW,OAAO;EAAG,YAAY,QAAQ;CAAO,CAAC,CAC9D;CAC/B,OAAO,MAAM,GAAG,QAAQ,OAAO,KAAK,UAAU,MAAM,MAAM,CAAC,IAAI,WAAW,MAAM,eAAe,CAAC,EAAE,GAAG;AACtG"}
1
+ {"version":3,"file":"info-BrxKCcUW.js","names":[],"sources":["../src/lib/tasks/info.ts"],"sourcesContent":["import { createColors } from 'colorette';\nimport { arch, platform } from 'node:os';\nimport { relative } from 'node:path';\nimport type { ProjectArgs } from '../args.js';\nimport { resolveCwd } from '../args.js';\nimport { loadStarsConfig } from '@wolfstar/http-framework/config';\nimport { displayPath, type ResolvedStarsConfig } from '@wolfstar/http-framework/config';\nimport { resolveOutputMode, shouldUseColor } from '../output-mode.js';\nimport { findInstalledVersion } from '../project.js';\nimport { readOwnPackageJson } from '../version.js';\n\nexport interface InfoOptions extends ProjectArgs {\n\tjson?: boolean;\n\tstdout?: NodeJS.WritableStream;\n}\n\nexport interface ProjectInfo {\n\tcli: { version: string; node: string; platform: string; outputMode: 'tui' | 'plain' };\n\tproject: {\n\t\tcwd: string;\n\t\troot: string;\n\t\tconfigFile: string | null;\n\t\tname: string | null;\n\t\tversion: string | null;\n\t\tentry: string;\n\t\tframeworkVersion: string | null;\n\t};\n\tbuild: ResolvedStarsConfig['build'];\n\tdev: ResolvedStarsConfig['dev'];\n\tcodegen: ResolvedStarsConfig['codegen'];\n\timports: ResolvedStarsConfig['imports'];\n\texperimental: ResolvedStarsConfig['experimental'];\n\tfuture: ResolvedStarsConfig['future'];\n\t/**\n\t * The option names set in the `tsdown`/`vite` blocks. Only the names: the values hold plugins and callbacks,\n\t * which neither serialize to JSON nor read usefully on a terminal.\n\t */\n\toptions: { tsdown: string[]; vite: string[] };\n}\n\nexport function collectInfo(config: ResolvedStarsConfig): ProjectInfo {\n\treturn {\n\t\tcli: {\n\t\t\tversion: readOwnPackageJson().version,\n\t\t\tnode: process.version,\n\t\t\tplatform: `${platform()} ${arch()}`,\n\t\t\toutputMode: resolveOutputMode()\n\t\t},\n\t\tproject: {\n\t\t\tcwd: config.cwd,\n\t\t\troot: config.root,\n\t\t\tconfigFile: config.configFile,\n\t\t\tname: config.packageJson?.name ?? null,\n\t\t\tversion: config.packageJson?.version ?? null,\n\t\t\tentry: config.entry,\n\t\t\tframeworkVersion: findInstalledVersion(config.root, '@wolfstar/http-framework')\n\t\t},\n\t\tbuild: config.build,\n\t\tdev: config.dev,\n\t\tcodegen: config.codegen,\n\t\timports: config.imports,\n\t\texperimental: config.experimental,\n\t\tfuture: config.future,\n\t\toptions: { tsdown: Object.keys(config.tsdown), vite: Object.keys(config.vite) }\n\t};\n}\n\nexport function formatInfo(info: ProjectInfo, useColor: boolean): string {\n\tconst colors = createColors({ useColor });\n\tconst { root } = info.project;\n\tconst show = (path: string | null) => (path === null ? colors.dim('none') : displayPath(root, path));\n\tconst row = (label: string, value: string) => ` ${colors.dim(label.padEnd(12))}${value}`;\n\tconst section = (title: string, rows: string[]) => [colors.bold(title), ...rows].join('\\n');\n\n\treturn [\n\t\tsection(`stars ${colors.green(`v${info.cli.version}`)}`, [\n\t\t\trow('node', info.cli.node),\n\t\t\trow('platform', info.cli.platform),\n\t\t\trow('output', info.cli.outputMode),\n\t\t\trow(\n\t\t\t\t'framework',\n\t\t\t\tinfo.project.frameworkVersion\n\t\t\t\t\t? `@wolfstar/http-framework v${info.project.frameworkVersion}`\n\t\t\t\t\t: colors.yellow('@wolfstar/http-framework not installed')\n\t\t\t)\n\t\t]),\n\t\tsection('Project', [\n\t\t\trow(\n\t\t\t\t'name',\n\t\t\t\tinfo.project.name\n\t\t\t\t\t? `${info.project.name}${info.project.version ? colors.dim(` v${info.project.version}`) : ''}`\n\t\t\t\t\t: colors.dim('unnamed')\n\t\t\t),\n\t\t\trow('root', root),\n\t\t\trow(\n\t\t\t\t'config',\n\t\t\t\tinfo.project.configFile ? relative(root, info.project.configFile) || info.project.configFile : colors.dim('none (defaults)')\n\t\t\t),\n\t\t\trow('entry', show(info.project.entry))\n\t\t]),\n\t\tsection('Build', [\n\t\t\trow('tool', info.build.tool),\n\t\t\t// Which file the build tool is configured from: its own, or this project's `stars.config`.\n\t\t\trow('config', info.build.configFile ? show(info.build.configFile) : colors.dim('stars.config')),\n\t\t\trow('options', describeOptions(info, colors)),\n\t\t\trow('outDir', show(info.build.outDir)),\n\t\t\trow('tsconfig', show(info.build.tsconfig)),\n\t\t\trow('runs', show(info.build.output))\n\t\t]),\n\t\tsection('Dev', [\n\t\t\trow('watch', info.dev.watch.map(show).join(', ')),\n\t\t\trow('debounce', `${info.dev.debounce}ms`),\n\t\t\trow('node args', info.dev.nodeArgs.join(' ') || colors.dim('none')),\n\t\t\trow('args', info.dev.args.join(' ') || colors.dim('none')),\n\t\t\trow('url', info.dev.url ?? colors.dim('unknown, set dev.url or HTTP_PORT')),\n\t\t\trow('health', info.dev.health ?? colors.dim('none')),\n\t\t\trow(\n\t\t\t\t'typecheck',\n\t\t\t\tinfo.dev.typecheck.enabled ? `${info.dev.typecheck.checker} → ${show(info.dev.typecheck.tsconfig)}` : colors.dim('disabled')\n\t\t\t),\n\t\t\trow('tunnel', describeTunnel(info.dev.tunnel, colors)),\n\t\t\trow('log file', info.dev.logFile ? show(info.dev.logFile) : colors.dim('disabled'))\n\t\t]),\n\t\tsection('Codegen', [\n\t\t\trow('i18n', info.codegen.i18n ? `${show(info.codegen.i18n.locales)} → ${show(info.codegen.i18n.output)}` : colors.dim('disabled'))\n\t\t]),\n\t\tsection('Future', [row('compat', `v${info.future.compatibilityVersion} defaults`)]),\n\t\tsection('Experimental', [\n\t\t\trow('vite', flag(info.experimental.enableVite, colors)),\n\t\t\trow('nitro', flag(info.experimental.enableNitro, colors)),\n\t\t\trow('external', flag(info.experimental.enableExternalVite, colors))\n\t\t]),\n\t\tsection('Imports', [\n\t\t\trow('auto', info.imports.enabled ? colors.green('enabled') : colors.dim('disabled')),\n\t\t\trow('dirs', info.imports.dirs.map(show).join(', ')),\n\t\t\trow('presets', info.imports.presets.join(', ') || colors.dim('none')),\n\t\t\trow('dts', show(info.imports.dts))\n\t\t])\n\t].join('\\n\\n');\n}\n\nfunction describeOptions(info: ProjectInfo, colors: ReturnType<typeof createColors>): string {\n\tconst names = info.build.tool === 'vite' ? info.options.vite : info.options.tsdown;\n\treturn names.length > 0 ? names.join(', ') : colors.dim('none');\n}\n\nfunction flag(enabled: boolean, colors: ReturnType<typeof createColors>): string {\n\treturn enabled ? colors.green('enabled') : colors.dim('disabled');\n}\n\nfunction describeTunnel(tunnel: ResolvedStarsConfig['dev']['tunnel'], colors: ReturnType<typeof createColors>): string {\n\tswitch (tunnel.mode) {\n\t\tcase 'quick':\n\t\t\treturn 'cloudflared quick tunnel';\n\t\tcase 'url':\n\t\t\treturn tunnel.url;\n\t\tdefault:\n\t\t\treturn colors.dim('disabled');\n\t}\n}\n\nexport async function runInfo(options: InfoOptions): Promise<void> {\n\tconst stdout = options.stdout ?? process.stdout;\n\tconst config = await loadStarsConfig({ cwd: resolveCwd(options), configFile: options.config });\n\tconst info = collectInfo(config);\n\tstdout.write(`${options.json ? JSON.stringify(info, null, 2) : formatInfo(info, shouldUseColor())}\\n`);\n}\n"],"mappings":";;;;;;;;;;AAwCA,SAAgB,YAAY,QAA0C;CACrE,OAAO;EACN,KAAK;GACJ,SAAS,mBAAmB,CAAC,CAAC;GAC9B,MAAM,QAAQ;GACd,UAAU,GAAG,SAAS,EAAE,GAAG,KAAK;GAChC,YAAY,kBAAkB;EAC/B;EACA,SAAS;GACR,KAAK,OAAO;GACZ,MAAM,OAAO;GACb,YAAY,OAAO;GACnB,MAAM,OAAO,aAAa,QAAQ;GAClC,SAAS,OAAO,aAAa,WAAW;GACxC,OAAO,OAAO;GACd,kBAAkB,qBAAqB,OAAO,MAAM,0BAA0B;EAC/E;EACA,OAAO,OAAO;EACd,KAAK,OAAO;EACZ,SAAS,OAAO;EAChB,SAAS,OAAO;EAChB,cAAc,OAAO;EACrB,QAAQ,OAAO;EACf,SAAS;GAAE,QAAQ,OAAO,KAAK,OAAO,MAAM;GAAG,MAAM,OAAO,KAAK,OAAO,IAAI;EAAE;CAC/E;AACD;AAEA,SAAgB,WAAW,MAAmB,UAA2B;CACxE,MAAM,SAAS,aAAa,EAAE,SAAS,CAAC;CACxC,MAAM,EAAE,SAAS,KAAK;CACtB,MAAM,QAAQ,SAAyB,SAAS,OAAO,OAAO,IAAI,MAAM,IAAI,YAAY,MAAM,IAAI;CAClG,MAAM,OAAO,OAAe,UAAkB,KAAK,OAAO,IAAI,MAAM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,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC;GAClD,IAAI,WAAW,KAAK,QAAQ,QAAQ,KAAK,IAAI,KAAK,OAAO,IAAI,MAAM,CAAC;GACpE,IAAI,OAAO,KAAK,KAAK,QAAQ,GAAG,CAAC;EAClC,CAAC;CACF,CAAC,CAAC,KAAK,MAAM;AACd;AAEA,SAAS,gBAAgB,MAAmB,QAAiD;CAC5F,MAAM,QAAQ,KAAK,MAAM,SAAS,SAAS,KAAK,QAAQ,OAAO,KAAK,QAAQ;CAC5E,OAAO,MAAM,SAAS,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,IAAI,MAAM;AAC/D;AAEA,SAAS,KAAK,SAAkB,QAAiD;CAChF,OAAO,UAAU,OAAO,MAAM,SAAS,IAAI,OAAO,IAAI,UAAU;AACjE;AAEA,SAAS,eAAe,QAA8C,QAAiD;CACtH,QAAQ,OAAO,MAAf;EACC,KAAK,SACJ,OAAO;EACR,KAAK,OACJ,OAAO,OAAO;EACf,SACC,OAAO,OAAO,IAAI,UAAU;CAC9B;AACD;AAEA,eAAsB,QAAQ,SAAqC;CAClE,MAAM,SAAS,QAAQ,UAAU,QAAQ;CAEzC,MAAM,OAAO,YAAY,MADJ,gBAAgB;EAAE,KAAK,WAAW,OAAO;EAAG,YAAY,QAAQ;CAAO,CAAC,CAC9D;CAC/B,OAAO,MAAM,GAAG,QAAQ,OAAO,KAAK,UAAU,MAAM,MAAM,CAAC,IAAI,WAAW,MAAM,eAAe,CAAC,EAAE,GAAG;AACtG"}
@@ -16,7 +16,7 @@ var info_default = defineCommand({
16
16
  }
17
17
  },
18
18
  async run({ args }) {
19
- const { runInfo } = await import("./info-Czh4LUsD.js");
19
+ const { runInfo } = await import("./info-BrxKCcUW.js");
20
20
  await runInfo({
21
21
  config: args.config,
22
22
  cwd: args.cwd,
@@ -27,4 +27,4 @@ var info_default = defineCommand({
27
27
 
28
28
  //#endregion
29
29
  export { info_default as default };
30
- //# sourceMappingURL=info-BqxpktLG.js.map
30
+ //# sourceMappingURL=info-rYRLITnv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"info-BqxpktLG.js","names":[],"sources":["../src/commands/info.ts"],"sourcesContent":["import { defineCommand } from 'citty';\nimport { projectArgs } from '../lib/args.js';\n\nexport default defineCommand({\n\tmeta: {\n\t\tname: 'info',\n\t\tdescription: 'Print the resolved project configuration and environment'\n\t},\n\targs: {\n\t\t...projectArgs,\n\t\tjson: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Print machine-readable JSON',\n\t\t\tdefault: false\n\t\t}\n\t},\n\tasync run({ args }) {\n\t\tconst { runInfo } = await import('../lib/tasks/info.js');\n\t\tawait runInfo({ config: args.config, cwd: args.cwd, json: args.json });\n\t}\n});\n"],"mappings":";;;;AAGA,mBAAe,cAAc;CAC5B,MAAM;EACL,MAAM;EACN,aAAa;CACd;CACA,MAAM;EACL,GAAG;EACH,MAAM;GACL,MAAM;GACN,aAAa;GACb,SAAS;EACV;CACD;CACA,MAAM,IAAI,EAAE,QAAQ;EACnB,MAAM,EAAE,YAAY,MAAM,OAAO;EACjC,MAAM,QAAQ;GAAE,QAAQ,KAAK;GAAQ,KAAK,KAAK;GAAK,MAAM,KAAK;EAAK,CAAC;CACtE;AACD,CAAC"}
1
+ {"version":3,"file":"info-rYRLITnv.js","names":[],"sources":["../src/commands/info.ts"],"sourcesContent":["import { defineCommand } from 'citty';\nimport { projectArgs } from '../lib/args.js';\n\nexport default defineCommand({\n\tmeta: {\n\t\tname: 'info',\n\t\tdescription: 'Print the resolved project configuration and environment'\n\t},\n\targs: {\n\t\t...projectArgs,\n\t\tjson: {\n\t\t\ttype: 'boolean',\n\t\t\tdescription: 'Print machine-readable JSON',\n\t\t\tdefault: false\n\t\t}\n\t},\n\tasync run({ args }) {\n\t\tconst { runInfo } = await import('../lib/tasks/info.js');\n\t\tawait runInfo({ config: args.config, cwd: args.cwd, json: args.json });\n\t}\n});\n"],"mappings":";;;;AAGA,mBAAe,cAAc;CAC5B,MAAM;EACL,MAAM;EACN,aAAa;CACd;CACA,MAAM;EACL,GAAG;EACH,MAAM;GACL,MAAM;GACN,aAAa;GACb,SAAS;EACV;CACD;CACA,MAAM,IAAI,EAAE,QAAQ;EACnB,MAAM,EAAE,YAAY,MAAM,OAAO;EACjC,MAAM,QAAQ;GAAE,QAAQ,KAAK;GAAQ,KAAK,KAAK;GAAK,MAAM,KAAK;EAAK,CAAC;CACtE;AACD,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { EventEmitter } from "node:events";
2
+ import { stripVTControlCharacters } from "node:util";
3
+
4
+ //#region src/lib/log-buffer.ts
5
+ /**
6
+ * A bounded, in-memory log store shared by the dev service and its renderers.
7
+ */
8
+ var LogBuffer = class extends EventEmitter {
9
+ capacity;
10
+ #entries = [];
11
+ #nextId = 1;
12
+ constructor(capacity = 2e3) {
13
+ super();
14
+ this.capacity = capacity;
15
+ }
16
+ push(input) {
17
+ const entry = {
18
+ id: this.#nextId++,
19
+ time: Date.now(),
20
+ ...input
21
+ };
22
+ this.#entries.push(entry);
23
+ if (this.#entries.length > this.capacity) this.#entries.splice(0, this.#entries.length - this.capacity);
24
+ this.emit("entry", entry);
25
+ return entry;
26
+ }
27
+ entries() {
28
+ return this.#entries;
29
+ }
30
+ filter(filter) {
31
+ const query = filter.query?.toLowerCase() ?? null;
32
+ return this.#entries.filter((entry) => (!filter.source || entry.source === filter.source) && (!filter.level || matchesLevel(entry.level, filter.level)) && (!query || entry.text.toLowerCase().includes(query)));
33
+ }
34
+ clear() {
35
+ this.#entries = [];
36
+ this.emit("clear");
37
+ }
38
+ };
39
+ const LEVEL_ORDER = {
40
+ debug: 0,
41
+ info: 1,
42
+ success: 1,
43
+ warn: 2,
44
+ error: 3
45
+ };
46
+ /**
47
+ * Whether `level` is at least as severe as `minimum`.
48
+ */
49
+ function matchesLevel(level, minimum) {
50
+ return LEVEL_ORDER[level] >= LEVEL_ORDER[minimum];
51
+ }
52
+ /**
53
+ * Whether an application stderr line only continues the preceding JavaScript error. Stack frames and the fields
54
+ * Node prints after an `Error` are useful log lines, but they must not each increment the panel's error counter.
55
+ */
56
+ function isErrorDetail(entry) {
57
+ if (entry.source !== "app" || entry.level !== "error") return false;
58
+ const text = stripVTControlCharacters(entry.text);
59
+ return /^\s+at\s/.test(text) || /^\s+(?:type|path|code|cause|errno|syscall|address|port):/.test(text) || /^\s*}\s*$/.test(text) || !text.trim();
60
+ }
61
+ /** stderr is a transport, not a severity: Node and many loggers also send warnings there. */
62
+ function classifyAppLine(text, fallback) {
63
+ const plain = stripVTControlCharacters(text);
64
+ if (/\b(?:Error|ERROR|FATAL)\b|\bERR_[A-Z_]+\b/.test(plain)) return "error";
65
+ if (/\b(?:Warning|WARN|WARNING|DeprecationWarning|ExperimentalWarning)\b/.test(plain) || /^\(node:\d+\).*warning/i.test(plain)) return "warn";
66
+ if (/^\s*(?:\(Use .*--trace-warnings|\[(?:info|debug)\]|INFO\b|DEBUG\b|[◇ℹ✔])/.test(plain)) return "info";
67
+ return fallback;
68
+ }
69
+
70
+ //#endregion
71
+ export { classifyAppLine as n, isErrorDetail as r, LogBuffer as t };
72
+ //# sourceMappingURL=log-buffer-D-nj2ZEU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-buffer-D-nj2ZEU.js","names":["#nextId","#entries"],"sources":["../src/lib/log-buffer.ts"],"sourcesContent":["import { EventEmitter } from 'node:events';\nimport { stripVTControlCharacters } from 'node:util';\n\nexport type LogSource = 'stars' | 'build' | 'app' | 'tsc' | 'tunnel';\nexport type LogLevel = 'debug' | 'info' | 'success' | 'warn' | 'error';\n\nexport interface LogEntry {\n\treadonly id: number;\n\treadonly time: number;\n\treadonly source: LogSource;\n\treadonly level: LogLevel;\n\treadonly text: string;\n}\n\nexport interface LogFilter {\n\tsource?: LogSource | null;\n\tlevel?: LogLevel | null;\n\tquery?: string | null;\n}\n\nexport type LogInput = Omit<LogEntry, 'id' | 'time'>;\n\n/**\n * A bounded, in-memory log store shared by the dev service and its renderers.\n */\nexport class LogBuffer extends EventEmitter<{ entry: [LogEntry]; clear: [] }> {\n\t#entries: LogEntry[] = [];\n\t#nextId = 1;\n\n\tpublic constructor(public readonly capacity = 2000) {\n\t\tsuper();\n\t}\n\n\tpublic push(input: LogInput): LogEntry {\n\t\tconst entry: LogEntry = { id: this.#nextId++, time: Date.now(), ...input };\n\t\tthis.#entries.push(entry);\n\t\tif (this.#entries.length > this.capacity) this.#entries.splice(0, this.#entries.length - this.capacity);\n\t\tthis.emit('entry', entry);\n\t\treturn entry;\n\t}\n\n\tpublic entries(): readonly LogEntry[] {\n\t\treturn this.#entries;\n\t}\n\n\tpublic filter(filter: LogFilter): LogEntry[] {\n\t\tconst query = filter.query?.toLowerCase() ?? null;\n\t\treturn this.#entries.filter(\n\t\t\t(entry) =>\n\t\t\t\t(!filter.source || entry.source === filter.source) &&\n\t\t\t\t(!filter.level || matchesLevel(entry.level, filter.level)) &&\n\t\t\t\t(!query || entry.text.toLowerCase().includes(query))\n\t\t);\n\t}\n\n\tpublic clear(): void {\n\t\tthis.#entries = [];\n\t\tthis.emit('clear');\n\t}\n}\n\nconst LEVEL_ORDER: Record<LogLevel, number> = { debug: 0, info: 1, success: 1, warn: 2, error: 3 };\n\n/**\n * Whether `level` is at least as severe as `minimum`.\n */\nexport function matchesLevel(level: LogLevel, minimum: LogLevel): boolean {\n\treturn LEVEL_ORDER[level] >= LEVEL_ORDER[minimum];\n}\n\n/**\n * Whether an application stderr line only continues the preceding JavaScript error. Stack frames and the fields\n * Node prints after an `Error` are useful log lines, but they must not each increment the panel's error counter.\n */\nexport function isErrorDetail(entry: Pick<LogEntry, 'source' | 'level' | 'text'>): boolean {\n\tif (entry.source !== 'app' || entry.level !== 'error') return false;\n\tconst text = stripVTControlCharacters(entry.text);\n\treturn /^\\s+at\\s/.test(text) || /^\\s+(?:type|path|code|cause|errno|syscall|address|port):/.test(text) || /^\\s*}\\s*$/.test(text) || !text.trim();\n}\n\n/** stderr is a transport, not a severity: Node and many loggers also send warnings there. */\nexport function classifyAppLine(text: string, fallback: LogLevel): LogLevel {\n\tconst plain = stripVTControlCharacters(text);\n\tif (/\\b(?:Error|ERROR|FATAL)\\b|\\bERR_[A-Z_]+\\b/.test(plain)) return 'error';\n\tif (/\\b(?:Warning|WARN|WARNING|DeprecationWarning|ExperimentalWarning)\\b/.test(plain) || /^\\(node:\\d+\\).*warning/i.test(plain)) return 'warn';\n\tif (/^\\s*(?:\\(Use .*--trace-warnings|\\[(?:info|debug)\\]|INFO\\b|DEBUG\\b|[◇ℹ✔])/.test(plain)) return 'info';\n\treturn fallback;\n}\n"],"mappings":";;;;;;;AAyBA,IAAa,YAAb,cAA+B,aAA+C;CAI1C;CAHnC,WAAuB,CAAC;CACxB,UAAU;CAEV,AAAO,YAAY,AAAgB,WAAW,KAAM;EACnD,MAAM;EAD4B;CAEnC;CAEA,AAAO,KAAK,OAA2B;EACtC,MAAM,QAAkB;GAAE,IAAI,KAAKA;GAAW,MAAM,KAAK,IAAI;GAAG,GAAG;EAAM;EACzE,KAAKC,SAAS,KAAK,KAAK;EACxB,IAAI,KAAKA,SAAS,SAAS,KAAK,UAAU,KAAKA,SAAS,OAAO,GAAG,KAAKA,SAAS,SAAS,KAAK,QAAQ;EACtG,KAAK,KAAK,SAAS,KAAK;EACxB,OAAO;CACR;CAEA,AAAO,UAA+B;EACrC,OAAO,KAAKA;CACb;CAEA,AAAO,OAAO,QAA+B;EAC5C,MAAM,QAAQ,OAAO,OAAO,YAAY,KAAK;EAC7C,OAAO,KAAKA,SAAS,QACnB,WACC,CAAC,OAAO,UAAU,MAAM,WAAW,OAAO,YAC1C,CAAC,OAAO,SAAS,aAAa,MAAM,OAAO,OAAO,KAAK,OACvD,CAAC,SAAS,MAAM,KAAK,YAAY,CAAC,CAAC,SAAS,KAAK,EACpD;CACD;CAEA,AAAO,QAAc;EACpB,KAAKA,WAAW,CAAC;EACjB,KAAK,KAAK,OAAO;CAClB;AACD;AAEA,MAAM,cAAwC;CAAE,OAAO;CAAG,MAAM;CAAG,SAAS;CAAG,MAAM;CAAG,OAAO;AAAE;;;;AAKjG,SAAgB,aAAa,OAAiB,SAA4B;CACzE,OAAO,YAAY,UAAU,YAAY;AAC1C;;;;;AAMA,SAAgB,cAAc,OAA6D;CAC1F,IAAI,MAAM,WAAW,SAAS,MAAM,UAAU,SAAS,OAAO;CAC9D,MAAM,OAAO,yBAAyB,MAAM,IAAI;CAChD,OAAO,WAAW,KAAK,IAAI,KAAK,2DAA2D,KAAK,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,KAAK,KAAK;AAC/I;;AAGA,SAAgB,gBAAgB,MAAc,UAA8B;CAC3E,MAAM,QAAQ,yBAAyB,IAAI;CAC3C,IAAI,4CAA4C,KAAK,KAAK,GAAG,OAAO;CACpE,IAAI,sEAAsE,KAAK,KAAK,KAAK,0BAA0B,KAAK,KAAK,GAAG,OAAO;CACvI,IAAI,2EAA2E,KAAK,KAAK,GAAG,OAAO;CACnG,OAAO;AACR"}
@@ -13,13 +13,15 @@ const truthy = /* @__PURE__ */ new Set([
13
13
  function resolveOutputMode(options = {}) {
14
14
  const env = options.env ?? process.env;
15
15
  const isTTY = options.isTTY ?? Boolean(process.stdout.isTTY);
16
+ const isInputTTY = options.isInputTTY ?? options.isTTY ?? Boolean(process.stdin.isTTY);
16
17
  const isCI = options.isCI ?? isCIEnvironment(env);
17
18
  if (options.tui === false) return "plain";
18
19
  const forced = env.STARS_TUI?.trim().toLowerCase();
19
20
  if (forced === "plain" || forced === "0" || forced === "false" || forced === "off") return "plain";
21
+ if (!isTTY || !isInputTTY || env.TERM === "dumb") return "plain";
20
22
  if (forced === "tui" || forced && truthy.has(forced)) return isTTY ? "tui" : "plain";
21
23
  if (options.tui === true) return isTTY ? "tui" : "plain";
22
- if (!isTTY || isCI || env.TERM === "dumb") return "plain";
24
+ if (isCI || (options.columns ?? process.stdout.columns ?? 80) < 40 || (options.rows ?? process.stdout.rows ?? 24) < 10) return "plain";
23
25
  return "tui";
24
26
  }
25
27
  function isCIEnvironment(env = process.env) {
@@ -43,4 +45,4 @@ function prefersReducedMotion(env = process.env) {
43
45
 
44
46
  //#endregion
45
47
  export { shouldUseColor as i, prefersReducedMotion as n, resolveOutputMode as r, isCIEnvironment as t };
46
- //# sourceMappingURL=output-mode-ChrOf0LO.js.map
48
+ //# sourceMappingURL=output-mode-Cxes6YUW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-mode-Cxes6YUW.js","names":[],"sources":["../src/lib/output-mode.ts"],"sourcesContent":["export type OutputMode = 'tui' | 'plain';\n\nexport interface ResolveOutputModeOptions {\n\t/** `--no-tui` (`tui: false`) or `--tui` (`tui: true`) from the command line. */\n\ttui?: boolean;\n\tenv?: NodeJS.ProcessEnv;\n\t/** Whether stdout is an interactive terminal. */\n\tisTTY?: boolean;\n\t/** Raw-key input requires a terminal too, even when the output is a TTY. */\n\tisInputTTY?: boolean;\n\tcolumns?: number;\n\trows?: number;\n\t/** Whether the process runs in a CI environment. */\n\tisCI?: boolean;\n}\n\nconst truthy = new Set(['1', 'true', 'yes', 'on']);\n\n/**\n * Decides between the interactive TUI and plain line output.\n *\n * Precedence: `--no-tui` › `STARS_TUI=plain` › non-interactive stdout, CI or `TERM=dumb`.\n */\nexport function resolveOutputMode(options: ResolveOutputModeOptions = {}): OutputMode {\n\tconst env = options.env ?? process.env;\n\tconst isTTY = options.isTTY ?? Boolean(process.stdout.isTTY);\n\tconst isInputTTY = options.isInputTTY ?? options.isTTY ?? Boolean(process.stdin.isTTY);\n\tconst isCI = options.isCI ?? isCIEnvironment(env);\n\n\tif (options.tui === false) return 'plain';\n\n\tconst forced = env.STARS_TUI?.trim().toLowerCase();\n\tif (forced === 'plain' || forced === '0' || forced === 'false' || forced === 'off') return 'plain';\n\tif (!isTTY || !isInputTTY || env.TERM === 'dumb') return 'plain';\n\tif (forced === 'tui' || (forced && truthy.has(forced))) return isTTY ? 'tui' : 'plain';\n\n\tif (options.tui === true) return isTTY ? 'tui' : 'plain';\n\tif (isCI || (options.columns ?? process.stdout.columns ?? 80) < 40 || (options.rows ?? process.stdout.rows ?? 24) < 10) return 'plain';\n\treturn 'tui';\n}\n\nexport function isCIEnvironment(env: NodeJS.ProcessEnv = process.env): boolean {\n\treturn (\n\t\tBoolean(env.CI && !['false', '0'].includes(env.CI.toLowerCase())) ||\n\t\tBoolean(env.GITHUB_ACTIONS || env.GITLAB_CI || env.BUILDKITE || env.CIRCLECI)\n\t);\n}\n\n/**\n * Whether colours should be emitted, honouring `NO_COLOR` and `FORCE_COLOR`.\n */\nexport function shouldUseColor(env: NodeJS.ProcessEnv = process.env, isTTY = Boolean(process.stdout.isTTY)): boolean {\n\tif (env.NO_COLOR !== undefined && env.NO_COLOR !== '') return false;\n\tif (env.FORCE_COLOR !== undefined) return env.FORCE_COLOR !== '0';\n\treturn isTTY && env.TERM !== 'dumb';\n}\n\n/**\n * Whether animations (spinners, blinking status) should be avoided.\n */\nexport function prefersReducedMotion(env: NodeJS.ProcessEnv = process.env): boolean {\n\tconst value = env.STARS_REDUCED_MOTION ?? env.REDUCED_MOTION;\n\treturn value !== undefined && value !== '' && value !== '0' && value.toLowerCase() !== 'false';\n}\n"],"mappings":";AAgBA,MAAM,yBAAS,IAAI,IAAI;CAAC;CAAK;CAAQ;CAAO;AAAI,CAAC;;;;;;AAOjD,SAAgB,kBAAkB,UAAoC,CAAC,GAAe;CACrF,MAAM,MAAM,QAAQ,OAAO,QAAQ;CACnC,MAAM,QAAQ,QAAQ,SAAS,QAAQ,QAAQ,OAAO,KAAK;CAC3D,MAAM,aAAa,QAAQ,cAAc,QAAQ,SAAS,QAAQ,QAAQ,MAAM,KAAK;CACrF,MAAM,OAAO,QAAQ,QAAQ,gBAAgB,GAAG;CAEhD,IAAI,QAAQ,QAAQ,OAAO,OAAO;CAElC,MAAM,SAAS,IAAI,WAAW,KAAK,CAAC,CAAC,YAAY;CACjD,IAAI,WAAW,WAAW,WAAW,OAAO,WAAW,WAAW,WAAW,OAAO,OAAO;CAC3F,IAAI,CAAC,SAAS,CAAC,cAAc,IAAI,SAAS,QAAQ,OAAO;CACzD,IAAI,WAAW,SAAU,UAAU,OAAO,IAAI,MAAM,GAAI,OAAO,QAAQ,QAAQ;CAE/E,IAAI,QAAQ,QAAQ,MAAM,OAAO,QAAQ,QAAQ;CACjD,IAAI,SAAS,QAAQ,WAAW,QAAQ,OAAO,WAAW,MAAM,OAAO,QAAQ,QAAQ,QAAQ,OAAO,QAAQ,MAAM,IAAI,OAAO;CAC/H,OAAO;AACR;AAEA,SAAgB,gBAAgB,MAAyB,QAAQ,KAAc;CAC9E,OACC,QAAQ,IAAI,MAAM,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,IAAI,GAAG,YAAY,CAAC,CAAC,KAChE,QAAQ,IAAI,kBAAkB,IAAI,aAAa,IAAI,aAAa,IAAI,QAAQ;AAE9E;;;;AAKA,SAAgB,eAAe,MAAyB,QAAQ,KAAK,QAAQ,QAAQ,QAAQ,OAAO,KAAK,GAAY;CACpH,IAAI,IAAI,aAAa,UAAa,IAAI,aAAa,IAAI,OAAO;CAC9D,IAAI,IAAI,gBAAgB,QAAW,OAAO,IAAI,gBAAgB;CAC9D,OAAO,SAAS,IAAI,SAAS;AAC9B;;;;AAKA,SAAgB,qBAAqB,MAAyB,QAAQ,KAAc;CACnF,MAAM,QAAQ,IAAI,wBAAwB,IAAI;CAC9C,OAAO,UAAU,UAAa,UAAU,MAAM,UAAU,OAAO,MAAM,YAAY,MAAM;AACxF"}
@@ -1,3 +1,3 @@
1
- import { n as runPrepare, t as prepareAutoImports } from "./prepare-D5NZ0w4t.js";
1
+ import { n as runPrepare, t as prepareAutoImports } from "./prepare-CHLrneYU.js";
2
2
 
3
3
  export { runPrepare };
@@ -1,5 +1,5 @@
1
1
  import { n as ExitCode, t as CliError } from "./errors-Bket6XFn.js";
2
- import { i as shouldUseColor } from "./output-mode-ChrOf0LO.js";
2
+ import { i as shouldUseColor } from "./output-mode-Cxes6YUW.js";
3
3
  import { n as resolveCwd } from "./args-Ch1KXUMn.js";
4
4
  import { displayPath, loadStarsConfig } from "@wolfstar/http-framework/config";
5
5
  import { dirname } from "node:path";
@@ -65,4 +65,4 @@ async function prepareAutoImports(config, check = false) {
65
65
 
66
66
  //#endregion
67
67
  export { runPrepare as n, prepareAutoImports as t };
68
- //# sourceMappingURL=prepare-D5NZ0w4t.js.map
68
+ //# sourceMappingURL=prepare-CHLrneYU.js.map