Skip to content

Commit 2e5853e

Browse files
fix(server): accept Claude native installs under XDG_DATA_HOME
The native installer keeps versions in ${XDG_DATA_HOME:-~/.local/share}/claude/versions, so a launcher linked into a custom XDG data directory is still native. AI-assisted; verified with the tests and tools listed above.
1 parent 8f3fb78 commit 2e5853e

2 files changed

Lines changed: 19 additions & 9 deletions

File tree

‎apps/server/src/provider/Drivers/ClaudeMaintenance.test.ts‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const snapshot: ServerProvider = {
4242
};
4343

4444
const fixture = Effect.fn("ClaudeMaintenance.test.fixture")(function* (
45-
install: "native" | "npm" | "wrapper" = "native",
45+
install: "native" | "xdgNative" | "npm" | "wrapper" = "native",
4646
platform: NodeJS.Platform = "linux",
4747
programFiles?: string,
4848
) {
@@ -57,7 +57,9 @@ const fixture = Effect.fn("ClaudeMaintenance.test.fixture")(function* (
5757
const realBinaryPath =
5858
install === "native" && platform !== "win32"
5959
? path.join(directory, ".local/share/claude/versions/2.1.314")
60-
: binaryPath;
60+
: install === "xdgNative"
61+
? path.join(directory, "xdg/data/claude/versions/2.1.314")
62+
: binaryPath;
6163
yield* fs.makeDirectory(path.dirname(realBinaryPath), { recursive: true });
6264
yield* fs.writeFileString(realBinaryPath, "#!/bin/sh\n");
6365
yield* fs.chmod(realBinaryPath, 0o755);
@@ -298,16 +300,23 @@ it.layer(NodeServices.layer)("ClaudeMaintenance", (it) => {
298300
}).pipe(Effect.scoped),
299301
);
300302

301-
it.effect("keeps a wrapper script at the native launcher path manual-only", () =>
303+
it.effect.each([
304+
{ name: "a wrapper script", install: "wrapper", lockKey: undefined },
305+
{
306+
name: "a native install under XDG_DATA_HOME",
307+
install: "xdgNative",
308+
lockKey: "claudeAgent-native",
309+
},
310+
] as const)("resolves the native launcher path for $name", (row) =>
302311
Effect.gen(function* () {
303-
const f = yield* fixture("wrapper");
312+
const f = yield* fixture(row.install);
304313
const resolve = yield* f.makeResolution.pipe(
305314
Effect.provideService(
306315
HttpClient.HttpClient,
307-
HttpClient.make(() => Effect.die("an unowned install must not look up a version")),
316+
HttpClient.make(() => Effect.die("resolution must not look up a version")),
308317
),
309318
);
310-
expect((yield* resolve()).update).toBeNull();
319+
expect((yield* resolve()).update?.lockKey).toBe(row.lockKey);
311320
}).pipe(Effect.scoped),
312321
);
313322

‎apps/server/src/provider/Drivers/ClaudeMaintenance.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ const update = makePackageManagedProviderMaintenanceResolver({
3030
mise: { tool: "claude" },
3131
nativeUpdate: {
3232
args: ["update"],
33-
// On Unix the native launcher is a symlink into ~/.local/share/claude; a plain file at
34-
// ~/.local/bin/claude is a wrapper whose owner `claude update` cannot see.
33+
// On Unix the native launcher links into ${XDG_DATA_HOME:-~/.local/share}/claude/versions; a
34+
// plain file at ~/.local/bin/claude is a wrapper whose owner `claude update` cannot see.
3535
isCommandPath: (commandPath) => {
3636
const normalized = normalizeCommandPath(commandPath);
3737
return (
3838
normalized.endsWith("/.local/bin/claude.exe") ||
39-
normalized.includes("/.local/share/claude/")
39+
normalized.includes("/.local/share/claude/") ||
40+
normalized.includes("/claude/versions/")
4041
);
4142
},
4243
requiresCommandPath: true,

0 commit comments

Comments
 (0)