collet 0.1.1

Relentless agentic coding orchestrator with zero-drop agent loops
Documentation
/// Platform-specific utility functions for the CLI.
/// Path to launchd plist file (macOS).
#[cfg(target_os = "macos")]
pub fn launchd_plist_path() -> std::path::PathBuf {
    dirs::home_dir()
        .unwrap_or_else(|| std::path::PathBuf::from("/tmp"))
        .join("Library/LaunchAgents/com.collet.remote.plist")
}

/// Dummy path for non-macOS systems (never actually used).
#[cfg(not(target_os = "macos"))]
pub fn launchd_plist_path() -> std::path::PathBuf {
    std::path::PathBuf::from("/dev/null/com.collet.remote.plist")
}

/// Path to systemd user service file (Linux).
#[cfg(target_os = "linux")]
pub fn systemd_unit_path() -> std::path::PathBuf {
    dirs::home_dir()
        .unwrap_or_else(|| std::path::PathBuf::from("/tmp"))
        .join(".config/systemd/user/collet-remote.service")
}

/// Read a line, hiding input (for tokens).
pub fn read_password_line() -> anyhow::Result<String> {
    let line = rpassword::read_password()
        .map_err(|e| crate::common::AgentError::Config(format!("Failed to read input: {e}")))?;
    Ok(line.trim().to_string())
}

/// Open a URL in the default browser.
pub fn open_url(url: &str) -> std::io::Result<()> {
    #[cfg(target_os = "macos")]
    {
        std::process::Command::new("open").arg(url).spawn()?;
    }
    #[cfg(target_os = "linux")]
    {
        std::process::Command::new("xdg-open").arg(url).spawn()?;
    }
    #[cfg(target_os = "windows")]
    {
        std::process::Command::new("cmd")
            .args(["/C", "start", url])
            .spawn()?;
    }
    Ok(())
}