@vite-hub/cli 0.6.1 → 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;
@@ -161,6 +163,13 @@ interface SetupProject {
161
163
  * Throws `SETUP_NOT_A_PROJECT` when `root` has no package.json and no Vite or Nuxt config.
162
164
  */
163
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
+ }
164
173
  interface SetupFeatureStatus {
165
174
  id: FeatureId;
166
175
  enabled: "on" | "off" | "unknown";
@@ -256,11 +265,18 @@ interface SetupAddPlanned {
256
265
  prod: string[];
257
266
  dev: string[];
258
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;
259
272
  }
260
273
  /** Plans `vitehub add` without writing anything. Throws `SetupFailure` when the change needs input or is not possible. */
261
274
  export declare function planSetupAdd(project: SetupProject, args: SetupAddArgs, env: NodeJS.ProcessEnv, rerun?: SetupRerun): Promise<SetupAddPlanned>;
262
- /** Applies a `vitehub add` plan: installs the packages, writes the starter Definitions, and writes the config last. */
263
- 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>;
264
280
  export declare const addCommand: ViteHubCliCommand;
265
281
  interface SetupCatalog {
266
282
  schemaVersion: 1;
@@ -271,9 +287,9 @@ interface SetupCatalog {
271
287
  export declare function setupCatalog(): SetupCatalog;
272
288
  /** The setup commands. They run before the CLI loads the project config. */
273
289
  export declare const setupCommands: readonly ViteHubCliCommand[];
274
- /** 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. */
275
291
  export declare const defaultConsoleUrl = "https://console.vitehub.dev";
276
- /** 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. */
277
293
  export declare const consoleTokenVariable = "VITEHUB_CONSOLE_TOKEN";
278
294
  export declare const consoleUrlVariable = "VITEHUB_CONSOLE_URL";
279
295
  /** What `vitehub login` keeps for one Console. The file is readable only by its owner. */
@@ -283,7 +299,7 @@ interface ConsoleCredential {
283
299
  user: {
284
300
  id: string;
285
301
  name: string;
286
- email: string;
302
+ email?: string;
287
303
  };
288
304
  team: {
289
305
  id: string;
@@ -296,17 +312,14 @@ interface ConsoleCredential {
296
312
  export declare function consoleCredentialsFile(env: NodeJS.ProcessEnv): string;
297
313
  /** The origin of a Console URL. Plain `http` is accepted only for a Console on this machine. */
298
314
  export declare function consoleOrigin(value: string): string;
299
- /**
300
- * The key that a command sends to a Console, and where it came from: `VITEHUB_CONSOLE_TOKEN`, else the key that
301
- * `vitehub login` saved for the Console. Without `console`, the Console is `VITEHUB_CONSOLE_URL`, else the only saved
302
- * Console, else console.vitehub.dev. `undefined` when there is no key.
303
- */
304
- 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 = {
305
318
  origin: string;
306
319
  token: string;
307
320
  source: "env" | "file";
308
321
  saved?: ConsoleCredential;
309
- } | undefined>;
322
+ };
310
323
  export declare const loginCommand: ViteHubCliCommand;
311
324
  export declare const whoamiCommand: ViteHubCliCommand;
312
325
  export declare const logoutCommand: ViteHubCliCommand;
@@ -362,6 +375,7 @@ interface SetupLinkTarget {
362
375
  id?: string;
363
376
  name: string;
364
377
  };
378
+ resourceScope?: string;
365
379
  /** True when the host API confirmed that the project exists. */
366
380
  verified: boolean;
367
381
  linkedAt: string;
@@ -436,8 +450,16 @@ interface SetupLinkStatus {
436
450
  /** The host that `vitehub deploy` uses without `--host`. */
437
451
  default: SetupLinkHost | null;
438
452
  /** For the `link` host, else the config host. Never includes the token. `null` on a host without credentials (Node). */
439
- credentials: HostCredentialsDescription | null;
453
+ credentials: SetupCredentialsStatus | null;
440
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
+ };
441
463
  /** The link file and the credentials that `vitehub status` reads. `credentials` holds the token and never goes in output. */
442
464
  interface SetupLinkState {
443
465
  status: SetupLinkStatus;
@@ -942,4 +964,4 @@ export declare function setupRequestArgs(request: unknown): {
942
964
  * `add`, and `remove` do, with the same documents, and keeps each plan until one `apply()` uses it.
943
965
  */
944
966
  export declare function createSetupSession(options: SetupSessionOptions): SetupSession;
945
- 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-FOmqEZUi.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-YzxNsbhs.js";
3
- import { a as deploymentsCommand, i as STATUS_HOST_TIMEOUT_MS, r as readDeployArgs, s as readSetupLive, t as deployCommand } from "../deploy-DDen0JC0.js";
4
- import { B 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-DzYHxq9A.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.1",
3
+ "version": "0.7.0",
4
4
  "description": "Command-line workflows for ViteHub projects.",
5
5
  "keywords": [
6
6
  "agent",
@@ -46,7 +46,7 @@
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.1",
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",
@@ -56,9 +56,10 @@
56
56
  "yaml": "^2.9.1"
57
57
  },
58
58
  "devDependencies": {
59
+ "@clack/prompts": "^1.9.0",
59
60
  "@types/node": "^24.19.2",
60
61
  "@types/semver": "^7.8.0",
61
- "@vite-hub/forge": "0.6.1",
62
+ "@vite-hub/forge": "0.7.0",
62
63
  "@vite-hub/internal": "0.0.1",
63
64
  "nuxt": "npm:nuxt-nightly@5.0.0-2611222336-0ed8910",
64
65
  "typescript": "^6.0.3",
@@ -68,7 +69,7 @@
68
69
  "vitest": "5.1.0"
69
70
  },
70
71
  "peerDependencies": {
71
- "@vite-hub/forge": "0.6.1",
72
+ "@vite-hub/forge": "0.7.0",
72
73
  "nuxt": "^4.7.0 || >=5.0.0-0",
73
74
  "vite": ">=8.0.0"
74
75
  },