Expand description
Zed editor (Zed Agent) integration.
Requested in issue #38. Zed has no PreToolUse-style hook that could rewrite terminal commands, so the integration has two surfaces, mirroring the Codex integration’s shape:
-
Project instructions — Zed’s Agent reads the first matching file of
.rules,.cursorrules,.windsurfrules,.clinerules,.github/copilot-instructions.md,AGENT.md,AGENTS.md,CLAUDE.md,GEMINI.md(per zed.dev/docs/ai/instructions). sqz appends a sentinel-bracketed guidance block to.ruleswhen that file exists (it shadows everything else), otherwise toAGENTS.md. -
MCP registration — Zed reads MCP servers from the
context_serversmap in itssettings.json(~/.config/zed/settings.jsonon macOS/Linux,%APPDATA%\Zed\on Windows). Registeringsqz-mcpgives the Zed Agent thecompress/passthrough/expandtools plus the losslesssqz_read_file/sqz_grep/sqz_list_dirfile tools — which is the part that matters for local models with small context windows.
Zed’s settings.json is JSONC (Zed’s own template ships comments).
Lesson learned on issue #6 (OpenCode): never round-trip a user’s
commented config through serde_json — it silently strips their
comments. When the settings file doesn’t parse as strict JSON we
REFUSE to edit it and return ZedMcpInstall::SkippedJsonc so the
CLI can print copy-paste instructions instead.
Enums§
- ZedMcp
Install - Outcome of
install_zed_mcp_config, surfaced so the CLI can tell the user what actually happened — especially the JSONC case where we deliberately don’t touch their file. - ZedMcp
Remove - Outcome of
remove_zed_mcp_config.
Functions§
- install_
zed_ guidance - Install sqz’s Zed guidance block into the project’s effective Zed
instruction file (
.ruleswhen present, elseAGENTS.md). - install_
zed_ mcp_ config - Register sqz-mcp under
context_servers.sqzin Zed’s settings.json. - remove_
zed_ guidance - Remove sqz’s Zed guidance block from BOTH
.rulesandAGENTS.md(whichever contain it) — the target can have moved between installs if the user created.ruleslater. The shared block inAGENTS.mdstays while Codex is registered. - remove_
zed_ mcp_ config - Remove
context_servers.sqzfrom Zed’s settings.json. Never deletes the file itself — it’s the user’s editor config, and an emptycontext_serverskey is simply dropped. - zed_
guidance_ block - Build the markdown block sqz appends to the Zed instruction file.
- zed_
guidance_ target - The project file Zed will actually read sqz’s guidance from.
- zed_
mcp_ snippet - The
context_serverssnippet for manual installation, printed when sqz can’t safely edit a JSONC settings file. - zed_
settings_ path - Path of Zed’s user settings file.