@vite-hub/cli 0.3.1 → 0.4.1

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.
@@ -89,13 +89,6 @@ type HostSupport = NativeHostSupport | {
89
89
  /** A feature that this feature turns on, unless the app sets the other feature to `false`. */
90
90
  interface FeatureImplication {
91
91
  feature: FeatureId;
92
- /** Hosts where the implication does not apply. */
93
- except?: readonly ViteHubHost[];
94
- /**
95
- * Hosts where the implied feature needs no provider option, because it runs inline in the request process. A
96
- * restart loses its work. The feature still needs its option when the app turns it on itself.
97
- */
98
- inline?: readonly ViteHubHost[];
99
92
  }
100
93
  /** The starter Definition file that `vitehub add <feature> --name <name>` creates. */
101
94
  interface FeatureStarter {
@@ -124,7 +117,10 @@ interface FeatureDefinition<TId extends FeatureId = FeatureId> {
124
117
  docs: `/docs/${string}`;
125
118
  /** Whether the feature is unconditionally on when the app does not set its key. */
126
119
  enabledByDefault: boolean;
127
- /** File names in the configured server directories (default `server/`) that enable an unset feature. `false` disables discovery. */
120
+ /**
121
+ * Files and folders in the configured server directories (default `server/`) that turn on a feature whose key is
122
+ * unset. A key of `false` keeps the feature off.
123
+ */
128
124
  enabledByDiscovery?: readonly string[];
129
125
  /** Packages that the app installs for this feature, in `pnpm add` order. */
130
126
  packages: readonly string[];
@@ -205,7 +201,7 @@ interface SetupStatus {
205
201
  features: readonly SetupFeatureStatus[];
206
202
  }
207
203
  /** What the project enables, on which host, and what each enabled feature still needs. Reads the config without running it. */
208
- export declare function setupStatus(project: SetupProject, env: NodeJS.ProcessEnv): SetupStatus;
204
+ export declare function setupStatus(project: SetupProject, env: NodeJS.ProcessEnv, withoutDefinitions?: ReadonlySet<FeatureId>): SetupStatus;
209
205
  //#endregion
210
206
  //#region src/setup/add.d.ts
211
207
  interface SetupAddArgs {
@@ -259,6 +255,7 @@ interface SetupAddPlanned {
259
255
  before: string;
260
256
  after: string;
261
257
  };
258
+ restartRequired: boolean;
262
259
  files: {
263
260
  path: string;
264
261
  content: string;
@@ -821,6 +818,7 @@ interface PlannedRemove {
821
818
  before: string;
822
819
  after: string;
823
820
  };
821
+ restartRequired: boolean;
824
822
  /** Starter Definitions to delete. */
825
823
  deletes: {
826
824
  path: string;
@@ -836,6 +834,52 @@ export declare function applySetupRemove(project: SetupProject, planned: Planned
836
834
  }): Promise<void>;
837
835
  export declare const removeCommand: ViteHubCliCommand;
838
836
  //#endregion
837
+ //#region src/setup/update.d.ts
838
+ interface SetupUpdateArgs {
839
+ dryRun: boolean;
840
+ help: boolean;
841
+ install: boolean;
842
+ json: boolean;
843
+ /** A commit of vite-hub/vitehub. Its pkg.pr.new build replaces the npm release. */
844
+ preview?: string;
845
+ }
846
+ interface SetupUpdatePlan {
847
+ /** `planned` for a dry run, `applied` when done, `unchanged` when every package is already on the target. */
848
+ status: "planned" | "applied" | "unchanged";
849
+ /** The npm version, such as `0.2.0`, or the pkg.pr.new commit of `--preview`. */
850
+ target: {
851
+ version: string;
852
+ } | {
853
+ preview: string;
854
+ };
855
+ /** The root of the workspace that the command updated. */
856
+ root: string;
857
+ /** Each ViteHub package that the project names, with the specifier it now uses. */
858
+ packages: Readonly<Record<string, string>>;
859
+ changes: readonly Pick<SetupChange, "diff" | "kind" | "path">[];
860
+ install: {
861
+ command: string;
862
+ };
863
+ }
864
+ interface WorkspaceFile {
865
+ path: string;
866
+ before: string;
867
+ after: string;
868
+ }
869
+ /** The command that installs the new specifiers. pnpm resolves ViteHub peers again only with `update`. */
870
+ export declare function updateInstallArgs(packageManager: SetupPackageManager, workspace: boolean): string[];
871
+ /** Reads the arguments. Throws `CLI_R0003` for an unknown flag or a value that is not a commit. */
872
+ export declare function readUpdateArgs(args: readonly string[]): SetupUpdateArgs;
873
+ interface PlannedUpdate {
874
+ plan: SetupUpdatePlan;
875
+ files: readonly WorkspaceFile[];
876
+ packageManager: SetupPackageManager;
877
+ installArgs: string[];
878
+ }
879
+ /** Plans the update: finds every ViteHub specifier, resolves the target, and computes the new files. Writes nothing. */
880
+ export declare function planSetupUpdate(rootDir: string, args: Pick<SetupUpdateArgs, "preview">, context: Pick<ViteHubCliContext, "env" | "fetch">): Promise<PlannedUpdate>;
881
+ export declare const updateCommand: ViteHubCliCommand;
882
+ //#endregion
839
883
  //#region src/setup/session.d.ts
840
884
  /**
841
885
  * Runs the package manager with an argument array and no shell. `onOutput` gets its stdout and stderr as they arrive.
@@ -885,6 +929,7 @@ interface SetupSessionPlanFields {
885
929
  command: string;
886
930
  /** True when applying writes the config file, so the dev server restarts. */
887
931
  restart: boolean;
932
+ restartRequired?: true;
888
933
  }
889
934
  interface SetupSession {
890
935
  catalog: () => SetupSessionResult;
@@ -916,4 +961,4 @@ export declare function setupRequestArgs(request: unknown): {
916
961
  */
917
962
  export declare function createSetupSession(options: SetupSessionOptions): SetupSession;
918
963
  //#endregion
919
- 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 };
964
+ 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 };
@@ -1,8 +1,9 @@
1
- import { P as setupStatus, R as readSetupProject, c as linkSetupProject, d as readSetupLinkStatus, f as readSetupLinks, m as unlinkSetupProject, p as selectSetupLink, r as SETUP_LINK_FILE, u as readSetupLinkState } from "../env-DzoVtVJO.js";
2
- import { m as cliErrorDiagnostics } from "../provision-D8OvBBzi.js";
3
- import { i as setupFailure, o as writeSetupError, r as setupExitCodes } from "../envelope-Cf56AJLa.js";
4
- import { S as shellQuote, _ as setupCatalog, a as readRemoveArgs, b as planSetupAdd, c as initPackages, d as readSetupStack, f as deployCommand, g as readSetupLive, h as deploymentsCommand, i as planSetupRemove, l as nuxiPackage, m as STATUS_HOST_TIMEOUT_MS, n as setupCommands, o as removeCommand, p as readDeployArgs, r as applySetupRemove, s as initCommandDefinition, u as readInitArgs, v as addCommand, x as readAddArgs, y as applySetupAdd } from "../commands-DPg3kL8m.js";
5
- import { a as defaultConsoleUrl, c as readConsoleCredential, i as consoleUrlVariable, l as whoamiCommand, n as consoleOrigin, o as loginCommand, r as consoleTokenVariable, s as logoutCommand, t as consoleCredentialsFile } from "../console-auth-xl7kLQNt.js";
1
+ import { B as readSetupProject, P as setupStatus, c as linkSetupProject, d as readSetupLinkStatus, f as readSetupLinks, m as unlinkSetupProject, p as selectSetupLink, r as SETUP_LINK_FILE, u as readSetupLinkState } from "../env-B1Gg-WnA.js";
2
+ import { m as cliErrorDiagnostics } from "../provision-DXl97xG0.js";
3
+ import { i as setupFailure, o as writeSetupError, r as setupExitCodes } from "../envelope-B4mPbSbj.js";
4
+ import { _ as addCommand, a as updateCommand, b as readAddArgs, c as planSetupRemove, d as initCommandDefinition, f as initPackages, g as setupCatalog, h as readSetupStack, 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 applySetupAdd, x as shellQuote, y as planSetupAdd } from "../commands-BQucvYlq.js";
5
+ import { a as defaultConsoleUrl, c as readConsoleCredential, i as consoleUrlVariable, l as whoamiCommand, n as consoleOrigin, o as loginCommand, r as consoleTokenVariable, s as logoutCommand, t as consoleCredentialsFile } from "../console-auth-B0HxFFiX.js";
6
+ import { a as deploymentsCommand, i as STATUS_HOST_TIMEOUT_MS, r as readDeployArgs, s as readSetupLive, t as deployCommand } from "../deploy-C0RdI5OK.js";
6
7
  import { join } from "pathe";
7
8
  import { readFile } from "node:fs/promises";
8
9
  import { createHash, randomUUID } from "node:crypto";
@@ -116,7 +117,8 @@ function createSetupSession(options) {
116
117
  args,
117
118
  fields: {
118
119
  command,
119
- restart: !!planned.configFile
120
+ restart: !!planned.configFile,
121
+ ...planned.restartRequired ? { restartRequired: true } : {}
120
122
  },
121
123
  files: /* @__PURE__ */ new Map(),
122
124
  planned
@@ -133,7 +135,8 @@ function createSetupSession(options) {
133
135
  args,
134
136
  fields: {
135
137
  command,
136
- restart: !!planned.configFile
138
+ restart: !!planned.configFile,
139
+ ...planned.restartRequired ? { restartRequired: true } : {}
137
140
  },
138
141
  files: /* @__PURE__ */ new Map(),
139
142
  planned
@@ -228,4 +231,4 @@ function createSetupSession(options) {
228
231
  };
229
232
  }
230
233
  //#endregion
231
- export { SETUP_LINK_FILE, STATUS_HOST_TIMEOUT_MS, addCommand, applySetupAdd, applySetupRemove, consoleCredentialsFile, consoleOrigin, consoleTokenVariable, consoleUrlVariable, createSetupSession, defaultConsoleUrl, deployCommand, deploymentsCommand, initCommandDefinition, initPackages, linkSetupProject, loginCommand, logoutCommand, nuxiPackage, planSetupAdd, planSetupRemove, readAddArgs, readConsoleCredential, readDeployArgs, readInitArgs, readRemoveArgs, readSetupLinkState, readSetupLinkStatus, readSetupLinks, readSetupLive, readSetupProject, readSetupStack, removeCommand, selectSetupLink, setupCatalog, setupCommands, setupExitCodes, setupRequestArgs, setupStatus, unlinkSetupProject, whoamiCommand };
234
+ export { SETUP_LINK_FILE, STATUS_HOST_TIMEOUT_MS, addCommand, applySetupAdd, applySetupRemove, consoleCredentialsFile, consoleOrigin, consoleTokenVariable, consoleUrlVariable, createSetupSession, defaultConsoleUrl, deployCommand, deploymentsCommand, initCommandDefinition, initPackages, linkSetupProject, loginCommand, logoutCommand, nuxiPackage, planSetupAdd, planSetupRemove, planSetupUpdate, readAddArgs, readConsoleCredential, readDeployArgs, readInitArgs, readRemoveArgs, readSetupLinkState, readSetupLinkStatus, readSetupLinks, readSetupLive, readSetupProject, readSetupStack, readUpdateArgs, removeCommand, selectSetupLink, setupCatalog, setupCommands, setupExitCodes, setupRequestArgs, setupStatus, unlinkSetupProject, updateCommand, updateInstallArgs, whoamiCommand };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vite-hub/cli",
3
- "version": "0.3.1",
3
+ "version": "0.4.1",
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.3.1",
49
+ "@vite-hub/runtime": "0.4.1",
50
50
  "birpc": "^4.2.0",
51
51
  "diff": "^9.0.0",
52
52
  "nostics": "1.4.0",
@@ -56,7 +56,7 @@
56
56
  "devDependencies": {
57
57
  "@types/node": "^24.19.1",
58
58
  "@types/semver": "^7.8.0",
59
- "@vite-hub/forge": "0.3.1",
59
+ "@vite-hub/forge": "0.4.1",
60
60
  "@vite-hub/internal": "0.0.1",
61
61
  "nuxt": "npm:nuxt-nightly@5.0.0-2611052317-a04317f",
62
62
  "typescript": "^6.0.3",
@@ -66,12 +66,12 @@
66
66
  "vitest": "^4.1.11"
67
67
  },
68
68
  "peerDependencies": {
69
- "@vite-hub/forge": "0.3.1",
69
+ "@vite-hub/forge": "0.4.1",
70
70
  "nuxt": ">=5.0.0-0",
71
71
  "vite": ">=8.0.0"
72
72
  },
73
73
  "engines": {
74
- "node": ">=22.18.0"
74
+ "node": ">=24.15.0"
75
75
  },
76
76
  "peerDependenciesMeta": {
77
77
  "@vite-hub/forge": {