TypeScript
fix(server): Vite+ provider installs get update prompts on Windows (#19887)
tonankd1b4ce93f259
diff --git a/packages/provider-core/src/server/maintenanceResolver.test.ts b/packages/provider-core/src/server/maintenanceResolver.test.tsindex 940e22a664e..aeba8b9187c 100644--- a/packages/provider-core/src/server/maintenanceResolver.test.ts+++ b/packages/provider-core/src/server/maintenanceResolver.test.ts@@ -544,6 +544,49 @@ it.layer(NodeServices.layer)("providerMaintenance", (it) => {}),);+ it.effect.each([+ {+ name: "the default home",+ resolved: "/Users/theo/.vite-plus/bin/claude",+ real: "/Users/theo/.vite-plus/current/bin/vp",+ platform: "darwin",+ },+ {+ name: "the XDG home",+ resolved: "/home/theo/.local/share/vite-plus/bin/claude",+ real: "/home/theo/.local/share/vite-plus/current/bin/vp",+ platform: "linux",+ },+ {+ name: "the Windows home",+ resolved: "C:\\Users\\Theo\\AppData\\Local\\vite-plus\\bin\\claude.cmd",+ real: "C:\\Users\\Theo\\AppData\\Local\\vite-plus\\packages\\@anthropic-ai\\claude-code\\lib\\node_modules\\@anthropic-ai\\claude-code\\cli.js",+ platform: "win32",+ },+ ] as const)("updates a Vite+ global install in $name with vp", (fixture) =>+ Effect.gen(function* () {+ const capabilities = yield* resolveInstall({ definition: claudeUpdate, ...fixture });++ expect(capabilities.update).toMatchObject({+ command: "vp i -g @anthropic-ai/claude-code",+ lockKey: "vite-plus-global",+ });+ }),+ );++ it.effect("keeps a project folder named vite-plus manual-only", () =>+ Effect.gen(function* () {+ const capabilities = yield* resolveInstall({+ definition: claudeUpdate,+ resolved: "/work/vite-plus/bin/claude",+ real: "/work/vite-plus/node_modules/@anthropic-ai/claude-code/cli.js",+ platform: "linux",+ });++ expect(capabilities.update).toBeNull();+ }),+ );+it.effect("proves Windows npm ownership from the package manifest beside the shim", () =>Effect.gen(function* () {const tempDir = yield* makeTempDir("t3-npm-windows-capabilities");diff --git a/packages/provider-core/src/server/maintenanceResolver.ts b/packages/provider-core/src/server/maintenanceResolver.tsindex dec8e6ea8a1..efd61804139 100644--- a/packages/provider-core/src/server/maintenanceResolver.ts+++ b/packages/provider-core/src/server/maintenanceResolver.ts@@ -211,8 +211,15 @@ export function normalizeCommandPath(commandPath: string): string {return commandPath.replaceAll("\\", "/").toLowerCase();}+/**+ * Vite+ shims live in `<VP_HOME>/bin`: `~/.vite-plus` by default,+ * `~/.local/share/vite-plus` with the XDG layout, and `%LOCALAPPDATA%\vite-plus`+ * on Windows.+ */function isVitePlusGlobalCommandPath(commandPath: string): boolean {- return normalizeCommandPath(commandPath).includes("/.vite-plus/bin/");+ return /\/(?:\.vite-plus|\.local\/share\/vite-plus|appdata\/local\/vite-plus)\/bin\//.test(+ normalizeCommandPath(commandPath),+ );}function isBunGlobalCommandPath(commandPath: string): boolean {