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
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ jobs:
- run: cargo test --locked
- run: cargo install cargo-deny --locked --version 0.20.2 && cargo deny check

macos:
runs-on: macos-15
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- run: rustup show active-toolchain
- run: cargo fmt --check
- run: cargo clippy --locked --all-targets -- -D warnings
- run: cargo test --locked

windows:
runs-on: windows-2025
timeout-minutes: 30
Expand Down
79 changes: 76 additions & 3 deletions tests/agent_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ fn command(binary: &Path, home: &Path) -> Command {
#[test]
fn unattended_registration_preserves_settings_and_uses_the_installed_binary() {
let root = TempDir::new().unwrap();
let home = root.path().join("home");
let directory = root.path().join("install with spaces 東京");
let root_path = root.path().canonicalize().unwrap();
let home = root_path.join("home");
let directory = root_path.join("install with spaces 東京");
fs::create_dir_all(&home).unwrap();
fs::create_dir_all(&directory).unwrap();
let binary = directory.join(if cfg!(windows) {
Expand Down Expand Up @@ -75,6 +76,15 @@ fn unattended_registration_preserves_settings_and_uses_the_installed_binary() {
server
};
assert_eq!(server["command"], executable.to_str().unwrap());
let configured_cmd = server["command"].as_str().unwrap();
let check = command(Path::new(configured_cmd), &home)
.arg("--version")
.output()
.unwrap();
assert!(
check.status.success(),
"configured executable must be runnable at its configured path"
);
assert_eq!(
server["args"],
json!(["--base-url", "https://proofline.sh", "mcp"])
Expand All @@ -91,9 +101,10 @@ fn unattended_registration_preserves_settings_and_uses_the_installed_binary() {
#[test]
fn install_messages_name_the_configuration_by_its_plain_path() {
let root = TempDir::new().unwrap();
let root_path = root.path().canonicalize().unwrap();
// A space and a backslash would show as escapes in a quoted Debug path;
// Windows paths hold backslashes already.
let home = root.path().join(if cfg!(windows) {
let home = root_path.join(if cfg!(windows) {
"home with space"
} else {
"home with \\ space"
Expand Down Expand Up @@ -194,3 +205,65 @@ fn without_git_registration_names_the_recovery_and_a_repository_still_refuses()
assert!(refused.contains("Git working tree") && !refused.contains("install Git"));
assert_eq!(fs::read_dir(&home).unwrap().count(), 1);
}

#[cfg(unix)]
#[test]
fn unattended_registration_via_symlink_configures_runnable_binary() {
let root = TempDir::new().unwrap();
let root_path = root.path().canonicalize().unwrap();
let home = root_path.join("home");
let bin_dir = root_path.join("bin");
fs::create_dir_all(&home).unwrap();
fs::create_dir_all(&bin_dir).unwrap();
let binary = bin_dir.join("proofline-target");
fs::copy(env!("CARGO_BIN_EXE_proofline"), &binary).unwrap();
let symlink = bin_dir.join("proofline-symlink");
std::os::unix::fs::symlink(&binary, &symlink).unwrap();

let path = home.join(".claude.json");
let original = json!({"mcpServers": {}}).to_string();
fs::write(&path, &original).unwrap();

let installed = command(&symlink, &home)
.args(["agent", "install", "claude-code", "--yes"])
.output()
.unwrap();
assert!(
installed.status.success(),
"{}",
String::from_utf8_lossy(&installed.stderr)
);

let bytes = fs::read_to_string(&path).unwrap();
let mut config: Value = serde_json::from_str(&bytes).unwrap();
let server = config["mcpServers"]
.as_object_mut()
.unwrap()
.remove("proofline")
.unwrap();
let configured_cmd = server["command"].as_str().unwrap();
let configured_path = Path::new(configured_cmd);
#[cfg(target_os = "macos")]
assert_eq!(
configured_path, symlink,
"macOS preserves the invocation path through the symlink"
);
#[cfg(target_os = "linux")]
assert_eq!(
configured_path, binary,
"Linux resolves the symlink to the target binary"
);
assert_eq!(
configured_path.canonicalize().unwrap(),
binary.canonicalize().unwrap(),
"symlink invocation must configure a path resolving to the target binary"
);
let check = command(Path::new(configured_cmd), &home)
.arg("--version")
.output()
.unwrap();
assert!(
check.status.success(),
"configured executable must be runnable"
);
}