fix: doctor ignore install dir in legacy workspace check
This commit is contained in:
37
src/commands/doctor-workspace.test.ts
Normal file
37
src/commands/doctor-workspace.test.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import path from "node:path";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { detectLegacyWorkspaceDirs } from "./doctor-workspace.js";
|
||||
|
||||
describe("detectLegacyWorkspaceDirs", () => {
|
||||
it("ignores ~/clawdbot when it doesn't look like a workspace (e.g. install dir)", () => {
|
||||
const home = "/home/user";
|
||||
const workspaceDir = "/home/user/clawd";
|
||||
const candidate = path.join(home, "clawdbot");
|
||||
|
||||
const detection = detectLegacyWorkspaceDirs({
|
||||
workspaceDir,
|
||||
homedir: () => home,
|
||||
exists: (value) => value === candidate,
|
||||
});
|
||||
|
||||
expect(detection.activeWorkspace).toBe(path.resolve(workspaceDir));
|
||||
expect(detection.legacyDirs).toEqual([]);
|
||||
});
|
||||
|
||||
it("flags ~/clawdis when it contains workspace markers", () => {
|
||||
const home = "/home/user";
|
||||
const workspaceDir = "/home/user/clawd";
|
||||
const candidate = path.join(home, "clawdis");
|
||||
const agentsPath = path.join(candidate, "AGENTS.md");
|
||||
|
||||
const detection = detectLegacyWorkspaceDirs({
|
||||
workspaceDir,
|
||||
homedir: () => home,
|
||||
exists: (value) => value === candidate || value === agentsPath,
|
||||
});
|
||||
|
||||
expect(detection.legacyDirs).toEqual([candidate]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user