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
2 changes: 1 addition & 1 deletion main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/tool-configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export 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[];
Expand Down
70 changes: 60 additions & 10 deletions tests/tool-configs.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,68 @@
import { expect, mock, test } from "bun:test";
import { homedir } from "os";
import { describe, expect, mock, test } from "bun:test";
import { join } from "path";

const existsSync = mock(() => false);
mock.module("fs", () => ({ existsSync, readdirSync: () => [] }));
const { cliExists } = await import("../src/tool-configs");
const HOME = "/home/agentfiles-test";
let existsPredicate = (_path: string) => false;
const existsSync = mock((path: unknown) =>
existsPredicate(String(path).replaceAll("\\", "/")),
);

mock.module("os", () => ({
homedir: () => HOME,
platform: () => "linux",
}));

mock.module("fs", () => ({
existsSync,
readdirSync: () => [],
}));

const toolConfigs = await import("../src/tool-configs");

test("finds CLIs installed by supported package managers", () => {
for (const parts of [
[".local", "share", "pnpm"], [".volta", "bin"],
[".fnm", "aliases", "default", "bin"], [".asdf", "shims"], [".proto", "bin"],
[".local", "share", "pnpm"],
[".volta", "bin"],
[".fnm", "aliases", "default", "bin"],
[".asdf", "shims"],
[".proto", "bin"],
]) {
const expected = join(homedir(), ...parts, "example-cli");
existsSync.mockImplementation((path) => path === expected);
expect(cliExists("example-cli")).toBe(true);
const expected = join(HOME, ...parts, "example-cli").replaceAll("\\", "/");
existsPredicate = (path) => path === expected;
expect(toolConfigs.cliExists("example-cli")).toBe(true);
}
});

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) {
existsPredicate = (path) =>
path.endsWith(`/${variant}/User/globalStorage/${tool.extensionId}`);
toolConfigs.clearInstallCache();

const config = toolConfigs.TOOL_CONFIGS.find(({ id }) => id === tool.id);
expect(config).toBeDefined();
expect(config?.isInstalled()).toBe(true);
}
});
}
});
Loading