Skip to content
Open
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ curl -fsSL https://proofline.sh/cli | sh
proofline init
```

`curl -fsSL https://proofline.sh/cli | sh -s -- --setup` also registers the MCP server with Claude Code, Cursor and Codex, then runs `proofline init`. When `proofline agent install` refuses one of those agents, for example because `CLAUDE_CONFIG_DIR` or a non-default `CODEX_HOME` is set, the installer prints the reason and the `proofline agent install CLIENT --print` command, skips that agent and continues; its last line names each skipped agent. A download or checksum failure still stops the installer.
`curl -fsSL https://proofline.sh/cli | sh -s -- --setup` also registers the MCP server with Claude Code, Cursor and Codex, then runs `proofline init`. When `proofline agent install` refuses one of those agents, for example because a non-default `CODEX_HOME` is set, the installer prints the reason and the `proofline agent install CLIENT --print` command, skips that agent and continues; its last line names each skipped agent. A download or checksum failure still stops the installer.

If you started on the signup page, use the `proofline init` command it gives you. Its organization options select the team shown on that page. Approve sign-in if prompted and install the GitHub App if it is missing. Once Proofline records the installation, the CLI prints the setup brief. Run `proofline setup status` to see the current gaps.

Expand Down Expand Up @@ -44,7 +44,7 @@ set as `PROOFLINE_TOKEN`. A token that works in one organization needs no

### MCP agent registration

To register MCP without a prompt, run `proofline agent install CLIENT --yes`. Supported clients include `claude-code` (or `claude`), `cursor`, `codex`, `gemini`, and `kiro`. Without `--yes`, the command previews the entry and asks for confirmation, while `--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`; a custom `CLAUDE_CONFIG_DIR` requires manual configuration with `--print`.
To register MCP without a prompt, run `proofline agent install CLIENT --yes`. Supported clients include `claude-code` (or `claude`), `cursor`, `codex`, `gemini`, and `kiro`. Without `--yes`, the command previews the entry and asks for confirmation, while `--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`, or in `.claude.json` inside the existing directory an absolute `CLAUDE_CONFIG_DIR` names; a relative `CLAUDE_CONFIG_DIR` or a directory Claude Code has not created yet requires manual configuration with `--print`.

For Codex's default configuration, add the entry to `~/.codex/config.toml` with this command.

Expand Down
19 changes: 14 additions & 5 deletions src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ enum InstallError {
#[error("the running Proofline executable path is not UTF-8")]
ExecutableEncoding,
#[error(
"CLAUDE_CONFIG_DIR selects custom configuration; use --print and configure Claude Code manually"
"CLAUDE_CONFIG_DIR is a relative path, which Claude Code resolves from the directory it starts in; use --print and configure Claude Code manually"
)]
CustomClaudeHome,
RelativeClaudeHome,
#[error("CLAUDE_CONFIG_DIR is not an existing directory: {}; start Claude Code once to create it, or use --print and configure Claude Code manually", .0.display())]
MissingClaudeHome(PathBuf),
#[error("could not find an absolute user home directory")]
Home,
#[error(
Expand Down Expand Up @@ -161,13 +163,20 @@ enum Outcome {
pub(crate) async fn run(args: AgentArgs, origin: Origin) -> anyhow::Result<()> {
tokio::task::spawn_blocking(move || {
let AgentCommand::Install(args) = args.command;
let home = std::env::home_dir().ok_or(InstallError::Home)?;
let mut home = std::env::home_dir().ok_or(InstallError::Home)?;
let codex_home = std::env::var_os("CODEX_HOME");
if args.client == Client::ClaudeCode
&& !args.print
&& std::env::var_os("CLAUDE_CONFIG_DIR").is_some()
&& let Some(selected) =
std::env::var_os("CLAUDE_CONFIG_DIR").filter(|selected| !selected.is_empty())
{
return Err(InstallError::CustomClaudeHome);
home = PathBuf::from(selected);
if !home.is_absolute() {
return Err(InstallError::RelativeClaudeHome);
}
if !home.is_dir() {
return Err(InstallError::MissingClaudeHome(home));
}
}
let stdin = io::stdin();
let stdout = io::stdout();
Expand Down
64 changes: 62 additions & 2 deletions tests/agent_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,20 @@ fn unattended_confirmation_keeps_refusals_and_manual_preview() {
fs::remove_file(&path).unwrap();
let custom = home.path().join("custom");
let refused = command(binary, home.path())
.env("CLAUDE_CONFIG_DIR", &custom)
.current_dir(home.path())
.env("CLAUDE_CONFIG_DIR", "custom")
.args(["agent", "install", "claude-code", "--yes"])
.output()
.unwrap();
assert!(!refused.status.success());
assert!(
String::from_utf8_lossy(&refused.stderr).contains("CLAUDE_CONFIG_DIR is a relative path")
);
assert!(!path.exists());
assert!(!custom.exists());
let preview = command(binary, home.path())
.env("CLAUDE_CONFIG_DIR", &custom)
.current_dir(home.path())
.env("CLAUDE_CONFIG_DIR", "custom")
.args(["agent", "install", "claude-code", "--print"])
.output()
.unwrap();
Expand All @@ -164,6 +169,61 @@ fn unattended_confirmation_keeps_refusals_and_manual_preview() {
assert!(!custom.exists());
}

#[test]
fn claude_config_dir_selects_the_file_claude_code_reads() {
let root = TempDir::new().unwrap();
let home = root.path().join("home");
let custom = root.path().join("work profile");
fs::create_dir_all(&home).unwrap();
fs::create_dir_all(&custom).unwrap();
let binary = Path::new(env!("CARGO_BIN_EXE_proofline"));
let original = json!({"projects": {"private-project": {"hasTrustDialogAccepted": false}}});
fs::write(custom.join(".claude.json"), original.to_string()).unwrap();
let install = |selected: &Path| {
let output = command(binary, &home)
.env("CLAUDE_CONFIG_DIR", selected)
.args(["agent", "install", "claude-code", "--yes"])
.output()
.unwrap();
assert!(
output.status.success(),
"{}",
String::from_utf8_lossy(&output.stderr)
);
};

install(&custom);
let mut config: Value =
serde_json::from_str(&fs::read_to_string(custom.join(".claude.json")).unwrap()).unwrap();
let servers = config
.as_object_mut()
.unwrap()
.remove("mcpServers")
.unwrap();
assert_eq!(config, original);
assert_eq!(
servers["proofline"]["args"],
json!(["--base-url", "https://proofline.sh", "mcp"])
);
assert!(!home.join(".claude.json").exists());

install(Path::new(""));
assert!(home.join(".claude.json").exists());

let missing = root.path().join("new profile");
let refused = command(binary, &home)
.env("CLAUDE_CONFIG_DIR", &missing)
.args(["agent", "install", "claude-code", "--yes"])
.output()
.unwrap();
assert!(!refused.status.success());
assert!(
String::from_utf8_lossy(&refused.stderr)
.contains("CLAUDE_CONFIG_DIR is not an existing directory")
);
assert!(!missing.exists());
}

#[cfg(unix)]
#[test]
fn without_git_registration_names_the_recovery_and_a_repository_still_refuses() {
Expand Down