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
22 changes: 22 additions & 0 deletions src/features/permissions/zed-permissions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,28 @@ describe("ZedPermissions", () => {
expect(json.permission.webfetch).toEqual({ "domain:github.com": "allow" });
});

it("should round-trip websearch via Zed's search_web tool name", async () => {
const rulesyncPermissions = createRulesyncPermissions({
websearch: { "*": "allow" },
});

const generated = await ZedPermissions.fromRulesyncPermissions({
outputRoot: testDir,
rulesyncPermissions,
});

// `websearch` must map to Zed's built-in `search_web` tool, not `web_search`.
const generatedJson = JSON.parse(generated.getFileContent());
expect(generatedJson.agent.tool_permissions.tools.search_web.default).toBe("allow");
expect(generatedJson.agent.tool_permissions.tools.web_search).toBeUndefined();

await writeFileContent(join(testDir, ".zed", "settings.json"), generated.getFileContent());
const imported = await ZedPermissions.fromFile({ outputRoot: testDir });
const json = JSON.parse(imported.toRulesyncPermissions().getFileContent());

expect(json.permission.websearch).toEqual({ "*": "allow" });
});

it("should pass through non-canonical mcp tool keys across generate → import", async () => {
const rulesyncPermissions = createRulesyncPermissions({
"mcp:context7:get-docs": { "*": "allow", secret: "deny" },
Expand Down
2 changes: 1 addition & 1 deletion src/features/permissions/zed-permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const CANONICAL_TO_ZED_TOOL_NAMES: Record<string, string> = {
read: "read_file",
edit: "edit_file",
webfetch: "fetch",
websearch: "web_search",
websearch: "search_web",
};

const ZED_TO_CANONICAL_TOOL_NAMES: Record<string, string> = Object.fromEntries(
Expand Down
Loading