@vite-hub/cli 0.6.0 → 0.7.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.
@@ -1,4 +1,4 @@
1
- import { l as HostCredentials, o as CredentialHost, r as ViteHubCliContext, s as CredentialSource, t as ViteHubCliCommand, u as HostCredentialsDescription } from "../provision-kiD8Emd7.js";
1
+ import { c as CredentialSource, d as HostCredentialsDescription, r as ViteHubCliContext, s as CredentialHost, t as ViteHubCliCommand, u as HostCredentials } from "../provision-ByxmUa19.js";
2
2
  type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
3
3
  readonly [key: string]: JsonValue;
4
4
  };
@@ -19,6 +19,7 @@ interface ViteHubConfigSite {
19
19
  start: number;
20
20
  end: number;
21
21
  };
22
+ consoleUrl?: string;
22
23
  keys: Readonly<Record<string, ConfigValue>>;
23
24
  /** True when a spread can supply keys that are not in `keys`. */
24
25
  spread: boolean;
@@ -27,6 +28,7 @@ interface ViteHubConfigSite {
27
28
  keys: Readonly<Record<string, ConfigValue>>;
28
29
  spread: boolean;
29
30
  };
31
+ viteRoot?: string | false;
30
32
  }
31
33
  type LocateResult = {
32
34
  ok: true;
@@ -149,6 +151,8 @@ interface SetupProject {
149
151
  configSource?: string;
150
152
  /** True when the target manifest declares `name` for production, or for development when `dev` is true. */
151
153
  declared: (name: string, dev: boolean) => boolean;
154
+ /** The `nuxt` range from the manifest or its pnpm catalog. */
155
+ nuxt?: string;
152
156
  /** Static discovery directories; undefined when Nuxt directories or layers need evaluation. */
153
157
  serverDirs?: readonly string[];
154
158
  /** True when `name` is resolvable from the project or present in an ancestor's node_modules. */
@@ -159,6 +163,13 @@ interface SetupProject {
159
163
  * Throws `SETUP_NOT_A_PROJECT` when `root` has no package.json and no Vite or Nuxt config.
160
164
  */
161
165
  export declare function readSetupProject(root: string, env: NodeJS.ProcessEnv): Promise<SetupProject>;
166
+ /** A change to the pnpm build policy. `path` is relative to the project root, and `file` is absolute. */
167
+ interface PnpmBuildsChange {
168
+ path: string;
169
+ file: string;
170
+ before?: string;
171
+ after: string;
172
+ }
162
173
  interface SetupFeatureStatus {
163
174
  id: FeatureId;
164
175
  enabled: "on" | "off" | "unknown";
@@ -254,11 +265,18 @@ interface SetupAddPlanned {
254
265
  prod: string[];
255
266
  dev: string[];
256
267
  };
268
+ /** The features that are on after the change. */
269
+ enabled: FeatureId[];
270
+ /** The pnpm build policy that the install needs. It is written before the install. */
271
+ workspace?: PnpmBuildsChange;
257
272
  }
258
273
  /** Plans `vitehub add` without writing anything. Throws `SetupFailure` when the change needs input or is not possible. */
259
274
  export declare function planSetupAdd(project: SetupProject, args: SetupAddArgs, env: NodeJS.ProcessEnv, rerun?: SetupRerun): Promise<SetupAddPlanned>;
260
- /** Applies a `vitehub add` plan: installs the packages, writes the starter Definitions, and writes the config last. */
261
- export declare function applySetupAdd(project: SetupProject, planned: SetupAddPlanned, args: Pick<SetupAddArgs, "install">, context: Pick<ViteHubCliContext, "env" | "spawn">): Promise<void>;
275
+ /**
276
+ * Applies a `vitehub add` plan: writes the pnpm build policy, installs the packages, writes the starter Definitions,
277
+ * and writes the config last.
278
+ */
279
+ export declare function applySetupAdd(project: SetupProject, planned: SetupAddPlanned, args: Pick<SetupAddArgs, "install">, context: Pick<ViteHubCliContext, "env" | "spawn"> & Partial<Pick<ViteHubCliContext, "stderr">>): Promise<void>;
262
280
  export declare const addCommand: ViteHubCliCommand;
263
281
  interface SetupCatalog {
264
282
  schemaVersion: 1;
@@ -269,9 +287,9 @@ interface SetupCatalog {
269
287
  export declare function setupCatalog(): SetupCatalog;
270
288
  /** The setup commands. They run before the CLI loads the project config. */
271
289
  export declare const setupCommands: readonly ViteHubCliCommand[];
272
- /** The hosted Console. `--console` and `VITEHUB_CONSOLE_URL` name a self-hosted one. */
290
+ /** The hosted Console. `--console`, `VITEHUB_CONSOLE_URL`, and `vitehub({ console: { url } })` name a self-hosted one. */
273
291
  export declare const defaultConsoleUrl = "https://console.vitehub.dev";
274
- /** An API key for CI. It wins over the saved key, and `vitehub logout` does not remove it. */
292
+ /** An API key for CI. It wins over the saved key for its origin, and `vitehub logout` does not remove it. */
275
293
  export declare const consoleTokenVariable = "VITEHUB_CONSOLE_TOKEN";
276
294
  export declare const consoleUrlVariable = "VITEHUB_CONSOLE_URL";
277
295
  /** What `vitehub login` keeps for one Console. The file is readable only by its owner. */
@@ -281,7 +299,7 @@ interface ConsoleCredential {
281
299
  user: {
282
300
  id: string;
283
301
  name: string;
284
- email: string;
302
+ email?: string;
285
303
  };
286
304
  team: {
287
305
  id: string;
@@ -294,17 +312,14 @@ interface ConsoleCredential {
294
312
  export declare function consoleCredentialsFile(env: NodeJS.ProcessEnv): string;
295
313
  /** The origin of a Console URL. Plain `http` is accepted only for a Console on this machine. */
296
314
  export declare function consoleOrigin(value: string): string;
297
- /**
298
- * The key that a command sends to a Console, and where it came from: `VITEHUB_CONSOLE_TOKEN`, else the key that
299
- * `vitehub login` saved for the Console. Without `console`, the Console is `VITEHUB_CONSOLE_URL`, else the only saved
300
- * Console, else console.vitehub.dev. `undefined` when there is no key.
301
- */
302
- export declare function readConsoleCredential(env: NodeJS.ProcessEnv, console?: string, signal?: AbortSignal): Promise<{
315
+ /** Reads the key for an explicit Console or the saved-login fallback, without consulting app config. */
316
+ export declare function readConsoleCredential(env: NodeJS.ProcessEnv, console?: string, signal?: AbortSignal): Promise<ResolvedCredential | undefined>;
317
+ type ResolvedCredential = {
303
318
  origin: string;
304
319
  token: string;
305
320
  source: "env" | "file";
306
321
  saved?: ConsoleCredential;
307
- } | undefined>;
322
+ };
308
323
  export declare const loginCommand: ViteHubCliCommand;
309
324
  export declare const whoamiCommand: ViteHubCliCommand;
310
325
  export declare const logoutCommand: ViteHubCliCommand;
@@ -360,6 +375,7 @@ interface SetupLinkTarget {
360
375
  id?: string;
361
376
  name: string;
362
377
  };
378
+ resourceScope?: string;
363
379
  /** True when the host API confirmed that the project exists. */
364
380
  verified: boolean;
365
381
  linkedAt: string;
@@ -434,8 +450,16 @@ interface SetupLinkStatus {
434
450
  /** The host that `vitehub deploy` uses without `--host`. */
435
451
  default: SetupLinkHost | null;
436
452
  /** For the `link` host, else the config host. Never includes the token. `null` on a host without credentials (Node). */
437
- credentials: HostCredentialsDescription | null;
453
+ credentials: SetupCredentialsStatus | null;
438
454
  }
455
+ /** The credentials of `vitehub status`. `unknown: "timeout"` when the host CLI login check ran past the status deadline, so a login can still exist. */
456
+ type SetupCredentialsStatus = HostCredentialsDescription | {
457
+ ok: false;
458
+ host: CredentialHost;
459
+ missing: readonly string[];
460
+ fix: string;
461
+ unknown: "timeout";
462
+ };
439
463
  /** The link file and the credentials that `vitehub status` reads. `credentials` holds the token and never goes in output. */
440
464
  interface SetupLinkState {
441
465
  status: SetupLinkStatus;
@@ -685,7 +709,7 @@ interface SetupStack {
685
709
  command: string | null;
686
710
  omits: readonly {
687
711
  path: string;
688
- reason: "opaque-config" | "spread" | "expression" | "unresolved-host" | "unresolved-feature" | "disabled-feature" | "unsupported-feature" | "non-replayable-option" | "credential-option" | "required-option" | "unplannable-stack";
712
+ reason: "opaque-config" | "spread" | "expression" | "unresolved-host" | "unresolved-feature" | "disabled-feature" | "unsupported-feature" | "non-replayable-option" | "credential-option" | "required-option" | "unplannable-stack" | "unresolved-nuxt-version";
689
713
  }[];
690
714
  }
691
715
  declare const initHosts: readonly ["cloudflare", "vercel", "netlify", "deno", "node"];
@@ -693,7 +717,7 @@ type InitHost = typeof initHosts[number];
693
717
  type InitFramework = "vite" | "nuxt";
694
718
  /**
695
719
  * The packages of a new app, as `getting-started/installation.md` installs them. The Nitro and H3 versions match the
696
- * server integration of ViteHub. Nuxt 5 supplies Nitro 3, and a Nuxt 4.7 app also gets `nuxtNitroPackage`. The
720
+ * server integration of ViteHub. A new Nuxt app is Nuxt 4.7, so it also gets `nuxtNitroPackage`. Nuxt 5 supplies Nitro 3. The
697
721
  * tutorials import H3 2. Valibot validates request bodies in the docs' route examples.
698
722
  */
699
723
  export declare const initPackages: Readonly<Record<InitFramework, {
@@ -710,6 +734,8 @@ interface SetupInitArgs {
710
734
  /** Raw `--option` values, such as `email.driver=resend`. */
711
735
  options: string[];
712
736
  framework?: InitFramework;
737
+ /** A new Nuxt app gets the Nuxt 5 nightly instead of Nuxt 4.7. An existing app keeps its Nuxt version. */
738
+ nuxtNightly: boolean;
713
739
  pm?: SetupPackageManager;
714
740
  install: boolean;
715
741
  dryRun: boolean;
@@ -938,4 +964,4 @@ export declare function setupRequestArgs(request: unknown): {
938
964
  * `add`, and `remove` do, with the same documents, and keeps each plan until one `apply()` uses it.
939
965
  */
940
966
  export declare function createSetupSession(options: SetupSessionOptions): SetupSession;
941
- export type { ConsoleCredential, DeployCommit, HostDeployment, HostDeploymentSource, PlannedRemove, SetupAddArgs, SetupAddPlan, SetupAddPlanned, SetupCatalog, SetupChange, SetupChoice, SetupCommandRunner, SetupDeployArgs, SetupDeployOutput, SetupDeploymentsOutput, SetupError, SetupFailure, SetupFailureDetails, SetupFeatureStatus, SetupFramework, SetupInitArgs, SetupInitPlan, SetupLink, SetupLinkAccount, SetupLinkFile, SetupLinkHost, SetupLinkOptions, SetupLinkResult, SetupLinkSelection, SetupLinkState, SetupLinkStatus, SetupLinkSummary, SetupLinkTarget, SetupLinks, SetupLive, SetupLiveReason, SetupLiveStatus, SetupMissing, SetupOptions, SetupPackageManager, SetupPlanRequest, SetupProject, SetupReference, SetupRemoveArgs, SetupRemovePlan, SetupRerun, SetupSession, SetupSessionOptions, SetupSessionPlanFields, SetupSessionResult, SetupStatus, SetupUpdateArgs, SetupUpdatePlan };
967
+ export type { ConsoleCredential, DeployCommit, HostDeployment, HostDeploymentSource, PlannedRemove, SetupAddArgs, SetupAddPlan, SetupAddPlanned, SetupCatalog, SetupChange, SetupChoice, SetupCommandRunner, SetupCredentialsStatus, SetupDeployArgs, SetupDeployOutput, SetupDeploymentsOutput, SetupError, SetupFailure, SetupFailureDetails, SetupFeatureStatus, SetupFramework, SetupInitArgs, SetupInitPlan, SetupLink, SetupLinkAccount, SetupLinkFile, SetupLinkHost, SetupLinkOptions, SetupLinkResult, SetupLinkSelection, SetupLinkState, SetupLinkStatus, SetupLinkSummary, SetupLinkTarget, SetupLinks, SetupLive, SetupLiveReason, SetupLiveStatus, SetupMissing, SetupOptions, SetupPackageManager, SetupPlanRequest, SetupProject, SetupReference, SetupRemoveArgs, SetupRemovePlan, SetupRerun, SetupSession, SetupSessionOptions, SetupSessionPlanFields, SetupSessionResult, SetupStatus, SetupUpdateArgs, SetupUpdatePlan };
@@ -1,7 +1,6 @@
1
- import { _ as applySetupAdd, a as updateCommand, c as planSetupRemove, d as initCommandDefinition, f as initPackages, g as addCommand, h as setupCatalog, i as readUpdateArgs, l as readRemoveArgs, m as readInitArgs, n as setupCommands, o as updateInstallArgs, p as nuxiPackage, r as planSetupUpdate, s as applySetupRemove, u as removeCommand, v as planSetupAdd, y as readAddArgs } from "../commands-D0WSlS7h.js";
2
- import { B as readConsoleCredential, D as shellQuote, E as setupStatus, F as consoleTokenVariable, G as setupFailure, I as consoleUrlVariable, L as defaultConsoleUrl, N as consoleCredentialsFile, P as consoleOrigin, R as loginCommand, V as whoamiCommand, W as setupExitCodes, Y as cliErrorDiagnostics, q as writeSetupError, z as logoutCommand } from "../provision-akHsvf-B.js";
3
- import { a as deploymentsCommand, i as STATUS_HOST_TIMEOUT_MS, r as readDeployArgs, s as readSetupLive, t as deployCommand } from "../deploy-DwNjKrHq.js";
4
- import { L as readSetupProject, d as readSetupLinkState, f as readSetupLinkStatus, h as unlinkSetupProject, i as SETUP_LINK_FILE, l as linkSetupProject, m as selectSetupLink, p as readSetupLinks } from "../env-BiVwma4a.js";
1
+ import { _ as applySetupAdd, a as updateCommand, c as planSetupRemove, d as initCommandDefinition, f as initPackages, g as addCommand, h as setupCatalog, i as readUpdateArgs, l as readRemoveArgs, m as readInitArgs, n as setupCommands, o as updateInstallArgs, p as nuxiPackage, r as planSetupUpdate, s as applySetupRemove, u as removeCommand, v as planSetupAdd, y as readAddArgs } from "../commands-o_CHzNS9.js";
2
+ import { Dt as readSetupProject, Ft as setupFailure, Lt as writeSetupError, Pt as setupExitCodes, St as whoamiCommand, _ as readSetupLinks, _t as defaultConsoleUrl, bt as readConsoleCredential, ct as setupStatus, g as readSetupLinkStatus, gt as consoleUrlVariable, h as readSetupLinkState, ht as consoleTokenVariable, lt as shellQuote, mt as consoleOrigin, p as linkSetupProject, pt as consoleCredentialsFile, s as SETUP_LINK_FILE, v as selectSetupLink, vt as loginCommand, y as unlinkSetupProject, yt as logoutCommand, zt as cliErrorDiagnostics } from "../provision-DWEZYLWJ.js";
3
+ import { a as deploymentsCommand, i as STATUS_HOST_TIMEOUT_MS, r as readDeployArgs, s as readSetupLive, t as deployCommand } from "../deploy-CGRf9Pq-.js";
5
4
  import { join } from "pathe";
6
5
  import { readFile } from "node:fs/promises";
7
6
  import { createHash, randomUUID } from "node:crypto";
@@ -179,7 +178,10 @@ function createSetupSession(options) {
179
178
  const spawn = async (command, args, spawnOptions) => await options.run(command, args, {
180
179
  cwd: spawnOptions?.cwd ?? project.root,
181
180
  env: spawnOptions?.env ?? options.env,
182
- onOutput
181
+ onOutput: (text, stream) => {
182
+ onOutput(text, stream);
183
+ spawnOptions?.onOutput?.(text, stream);
184
+ }
183
185
  });
184
186
  const context = {
185
187
  env: options.env,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vite-hub/cli",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Command-line workflows for ViteHub projects.",
5
5
  "keywords": [
6
6
  "agent",
@@ -46,18 +46,20 @@
46
46
  "@dotenvx/primitives": "^4.4.0",
47
47
  "@noble/ciphers": "^2.4.0",
48
48
  "@noble/hashes": "^2.4.0",
49
- "@vite-hub/runtime": "0.6.0",
49
+ "@vite-hub/runtime": "0.7.0",
50
50
  "birpc": "^4.2.0",
51
51
  "diff": "^9.0.0",
52
52
  "nostics": "1.4.0",
53
53
  "pathe": "^2.0.3",
54
54
  "rc9": "^3.1.0",
55
- "semver": "^7.8.6"
55
+ "semver": "^7.8.6",
56
+ "yaml": "^2.9.1"
56
57
  },
57
58
  "devDependencies": {
59
+ "@clack/prompts": "^1.9.0",
58
60
  "@types/node": "^24.19.2",
59
61
  "@types/semver": "^7.8.0",
60
- "@vite-hub/forge": "0.6.0",
62
+ "@vite-hub/forge": "0.7.0",
61
63
  "@vite-hub/internal": "0.0.1",
62
64
  "nuxt": "npm:nuxt-nightly@5.0.0-2611222336-0ed8910",
63
65
  "typescript": "^6.0.3",
@@ -67,7 +69,7 @@
67
69
  "vitest": "5.1.0"
68
70
  },
69
71
  "peerDependencies": {
70
- "@vite-hub/forge": "0.6.0",
72
+ "@vite-hub/forge": "0.7.0",
71
73
  "nuxt": "^4.7.0 || >=5.0.0-0",
72
74
  "vite": ">=8.0.0"
73
75
  },