Skip to content
Closed
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ The command-line client for the [Proofline review API](https://proofline.sh/docs

Install with `curl -fsSL https://proofline.sh/cli | sh`, then run `proofline login`.
To register MCP without a prompt, run `proofline agent install CLIENT --yes`.
Clients include `claude-code` (or `claude`), `cursor`, `codex`, `gemini` and `kiro`.
Clients include `claude-code` (or `claude`), `cursor`, `codex`, `gemini`, `kiro` and `zed`.
Without `--yes`, the command previews the entry and asks for confirmation.
`--print` previews without writing. Existing Proofline entries remain unchanged.
New entries use this executable's absolute path and store no credentials.
Claude Code uses the top-level `mcpServers` in `~/.claude.json`.
Zed uses `context_servers` in `~/.config/zed/settings.json`.
A custom `CLAUDE_CONFIG_DIR` requires manual configuration with `--print`.

See the [CLI documentation](https://proofline.sh/docs/cli/) for commands.
Expand Down
3 changes: 3 additions & 0 deletions src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ enum Client {
Cursor,
Gemini,
Kiro,
Zed,
}

impl Client {
Expand All @@ -58,6 +59,7 @@ impl Client {
Self::Cursor => ".cursor/mcp.json",
Self::Gemini => ".gemini/settings.json",
Self::Kiro => ".kiro/settings/mcp.json",
Self::Zed => ".config/zed/settings.json",
}
}
}
Expand All @@ -70,6 +72,7 @@ impl fmt::Display for Client {
Self::Cursor => "Cursor",
Self::Gemini => "Gemini CLI",
Self::Kiro => "Kiro",
Self::Zed => "Zed",
})
}
}
Expand Down
20 changes: 9 additions & 11 deletions src/agent/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub(super) fn prepare(
) -> Result<Update, InstallError> {
match client {
Client::Codex => codex(original, origin),
Client::ClaudeCode | Client::Cursor | Client::Gemini | Client::Kiro => {
Client::ClaudeCode | Client::Cursor | Client::Gemini | Client::Kiro | Client::Zed => {
json(client, original, origin)
}
}
Expand Down Expand Up @@ -127,16 +127,14 @@ fn json(client: Client, original: Option<&[u8]>, origin: &Origin) -> Result<Upda
})?
}
};
let position = document.0.iter().position(|(key, _)| key == "mcpServers");
let member = match client {
Client::Zed => "context_servers",
_ => "mcpServers",
};
let position = document.0.iter().position(|(key, _)| key == member);
let mut servers = match position {
Some(index) => {
serde_json::from_str::<RawObject>(document.0[index].1.get()).map_err(|_| {
InstallError::ConfigShape {
client,
member: "mcpServers",
}
})?
}
Some(index) => serde_json::from_str::<RawObject>(document.0[index].1.get())
.map_err(|_| InstallError::ConfigShape { client, member })?,
None => RawObject(Vec::new()),
};
if servers.0.iter().any(|(key, _)| key == "proofline") {
Expand All @@ -158,7 +156,7 @@ fn json(client: Client, original: Option<&[u8]>, origin: &Origin) -> Result<Upda
let value = to_raw_value(&servers).map_err(|_| InstallError::InvalidConfig(client))?;
match position {
Some(index) => document.0[index].1 = value,
None => document.0.push(("mcpServers".to_owned(), value)),
None => document.0.push((member.to_owned(), value)),
}
let mut bytes =
serde_json::to_vec_pretty(&document).map_err(|_| InstallError::InvalidConfig(client))?;
Expand Down
54 changes: 53 additions & 1 deletion src/agent/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ use crate::origin::Origin;
use crate::{Cli, Command as CliCommand};

const PRIVATE: &str = "installer-private-config-canary";
const CLIENTS: [Client; 5] = [
const CLIENTS: [Client; 6] = [
Client::ClaudeCode,
Client::Codex,
Client::Cursor,
Client::Gemini,
Client::Kiro,
Client::Zed,
];

#[derive(Debug)]
Expand Down Expand Up @@ -103,6 +104,14 @@ fn configuration(client: Client) -> Vec<u8> {
},
"privateSetting": PRIVATE
})).unwrap(),
Client::Zed => serde_json::to_vec_pretty(&json!({
"theme": "chosen-theme",
"policy": {"trust": false, "autoApprove": [], "excluded": ["untrusted"]},
"context_servers": {
"other": {"command": "other-server", "args": ["a b"], "env": {"SECRET": PRIVATE}}
},
"privateSetting": PRIVATE
})).unwrap(),
}
}

Expand Down Expand Up @@ -206,6 +215,21 @@ fn all_clients_preserve_private_settings_and_add_only_the_launcher() {
expected.as_object().unwrap().keys().collect::<Vec<_>>()
);
}
Client::Zed => {
let expected: Value = serde_json::from_slice(&original).unwrap();
let mut parsed: Value = serde_json::from_str(&actual).unwrap();
let server = parsed["context_servers"]
.as_object_mut()
.unwrap()
.remove("proofline")
.unwrap();
assert_new_server(client, &server, "https://proofline.sh");
assert_eq!(parsed, expected);
assert_eq!(
parsed.as_object().unwrap().keys().collect::<Vec<_>>(),
expected.as_object().unwrap().keys().collect::<Vec<_>>()
);
}
}
let lock = path.parent().unwrap().join(".proofline-agent-install.lock");
assert_eq!(fs::read(&lock).unwrap(), b"");
Expand Down Expand Up @@ -309,6 +333,7 @@ fn custom_existing_entries_and_codex_home_are_never_overwritten() {
let original = match client {
Client::Codex => format!("# {PRIVATE}\nmcp_servers.proofline = {{ command = \"custom-launcher\", args = [\"custom\"] }}\n").into_bytes(),
Client::ClaudeCode | Client::Cursor | Client::Gemini | Client::Kiro => format!("{{\"mcpServers\":{{\"proofline\":null}},\"private\":\"{PRIVATE}\"}}").into_bytes(),
Client::Zed => format!("{{\"context_servers\":{{\"proofline\":null}},\"private\":\"{PRIVATE}\"}}").into_bytes(),
};
let path = seed(home.path(), client, &original);
let modified = fs::metadata(&path).unwrap().modified().unwrap();
Expand Down Expand Up @@ -438,6 +463,26 @@ fn toml_inline_tables_and_separate_arguments_round_trip_in_unicode_homes() {
"http://[::1]:8080",
);
}
let precision = "{\"context_servers\":{\"other\":{\"value\":184467440737095516170}},\"precision\":1.2345678901234567890123456789}";
seed(&home, Client::Zed, precision.as_bytes());
let result = invoke(
&home,
Client::Zed,
false,
&mut Cursor::new(b"yes\n"),
&selected,
None,
);
assert_eq!(result.result.unwrap(), Outcome::Installed);
let actual = fs::read_to_string(target(&home, Client::Zed)).unwrap();
assert!(actual.contains("184467440737095516170"));
assert!(actual.contains("1.2345678901234567890123456789"));
let parsed: Value = serde_json::from_str(&actual).unwrap();
assert_new_server(
Client::Zed,
&parsed["context_servers"]["proofline"],
"http://[::1]:8080",
);
}

#[derive(Debug)]
Expand Down Expand Up @@ -705,6 +750,13 @@ fn invalid_duplicate_oversized_and_readonly_documents_stay_private_and_intact()
format!("{{\"private\":\"{PRIVATE}\",\"nested\":{{\"same\":1,\"same\":2}}}}"),
"{ /* comment */ \"mcpServers\": {} }".to_owned(),
],
Client::Zed => vec![
format!("{{\"private\":\"{PRIVATE}\", \"unfinished\": "),
"[]".to_owned(),
"{\"context_servers\": []}".to_owned(),
format!("{{\"private\":\"{PRIVATE}\",\"nested\":{{\"same\":1,\"same\":2}}}}"),
"{ /* comment */ \"context_servers\": {} }".to_owned(),
],
};
for document in invalid {
let path = seed(home.path(), client, document.as_bytes());
Expand Down
21 changes: 20 additions & 1 deletion tests/agent_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,16 @@ fn unattended_registration_preserves_settings_and_uses_the_installed_binary() {
("claude-code", ".claude.json"),
("cursor", ".cursor/mcp.json"),
("codex", ".codex/config.toml"),
("zed", ".config/zed/settings.json"),
] {
let path = home.join(relative);
fs::create_dir_all(path.parent().unwrap()).unwrap();
let original = if client == "codex" {
"# preserved\nmodel = 'chosen-model'\n".to_owned()
} else if client == "zed" {
json!({"theme": "One Dark",
"context_servers": {"other": {"command": "other-server", "args": []}}})
.to_string()
} else {
json!({"projects": {"private-project": {"hasTrustDialogAccepted": false}},
"mcpServers": {"other": {"command": "other-server"}}})
Expand All @@ -64,6 +69,15 @@ fn unattended_registration_preserves_settings_and_uses_the_installed_binary() {
assert!(bytes.starts_with(&original));
let config: toml::Value = toml::from_str(&bytes).unwrap();
serde_json::to_value(&config["mcp_servers"]["proofline"]).unwrap()
} else if client == "zed" {
let mut config: Value = serde_json::from_str(&bytes).unwrap();
let server = config["context_servers"]
.as_object_mut()
.unwrap()
.remove("proofline")
.unwrap();
assert_eq!(config, serde_json::from_str::<Value>(&original).unwrap());
server
} else {
let mut config: Value = serde_json::from_str(&bytes).unwrap();
let server = config["mcpServers"]
Expand All @@ -74,7 +88,12 @@ fn unattended_registration_preserves_settings_and_uses_the_installed_binary() {
assert_eq!(config, serde_json::from_str::<Value>(&original).unwrap());
server
};
assert_eq!(server["command"], executable.to_str().unwrap());
assert_eq!(
Path::new(server["command"].as_str().unwrap())
.canonicalize()
.unwrap(),
executable
);
assert_eq!(
server["args"],
json!(["--base-url", "https://proofline.sh", "mcp"])
Expand Down