Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions packages/provider-core/src/server/maintenanceResolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
9 changes: 8 additions & 1 deletion packages/provider-core/src/server/maintenanceResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}

function isBunGlobalCommandPath(commandPath: string): boolean {
Expand Down
Loading