diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35feebc..8bcc588 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,8 @@ jobs: run: bun install --frozen-lockfile - name: Check tool count drift run: bun run scripts/check-tool-count.ts + - name: Test + run: bun test - name: Build run: bun run build - name: Lint diff --git a/src/tool-configs.ts b/src/tool-configs.ts index 03fabd9..8255e57 100644 --- a/src/tool-configs.ts +++ b/src/tool-configs.ts @@ -72,7 +72,7 @@ function cliExists(name: string): boolean { return false; } -const VSCODE_VARIANTS = ["Code", "Code - Insiders", "Cursor", "VSCodium", "Windsurf"]; +const VSCODE_VARIANTS = ["Code", "Code - Insiders", "Cursor", "Cursor Nightly", "VSCodium", "Windsurf", "Windsurf Next", "Trae", "Void", "Positron"]; function vscodeExtensionStorageExists(extensionId: string): boolean { let bases: string[]; diff --git a/tests/tool-configs.test.ts b/tests/tool-configs.test.ts new file mode 100644 index 0000000..9f82eea --- /dev/null +++ b/tests/tool-configs.test.ts @@ -0,0 +1,59 @@ +import { beforeAll, describe, expect, mock, test } from "bun:test"; + +let activeVariant = ""; +let activeExtensionId = ""; + +mock.module("os", () => ({ + homedir: () => "/home/agentfiles-test", + platform: () => "linux", +})); + +mock.module("fs", () => ({ + existsSync: (path: unknown) => { + const normalized = String(path).replaceAll("\\", "/"); + return normalized.endsWith( + `/${activeVariant}/User/globalStorage/${activeExtensionId}`, + ); + }, + readdirSync: () => [], +})); + +let toolConfigs: typeof import("../src/tool-configs"); + +beforeAll(async () => { + toolConfigs = await import("../src/tool-configs"); +}); + +const VSCODE_VARIANTS = [ + "Code", + "Code - Insiders", + "Cursor", + "Cursor Nightly", + "VSCodium", + "Windsurf", + "Windsurf Next", + "Trae", + "Void", + "Positron", +] as const; + +const VSCODE_EXTENSION_TOOLS = [ + { id: "cline", extensionId: "saoudrizwan.claude-dev" }, + { id: "roo-code", extensionId: "RooVeterinaryInc.roo-cline" }, +] as const; + +describe("VS Code fork extension storage detection", () => { + for (const variant of VSCODE_VARIANTS) { + test(`detects extension-backed tools in ${variant}`, () => { + for (const tool of VSCODE_EXTENSION_TOOLS) { + activeVariant = variant; + activeExtensionId = tool.extensionId; + toolConfigs.clearInstallCache(); + + const config = toolConfigs.TOOL_CONFIGS.find(({ id }) => id === tool.id); + expect(config).toBeDefined(); + expect(config?.isInstalled()).toBe(true); + } + }); + } +});