Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
test: cover Pi OMP installer aliases
AkitaOnRailscc115f927089
diff --git a/crates/ai-memory-cli/src/cli.rs b/crates/ai-memory-cli/src/cli.rsindex 6dc21aba..f866f595 100644--- a/crates/ai-memory-cli/src/cli.rs+++ b/crates/ai-memory-cli/src/cli.rs@@ -624,3 +624,55 @@ pub struct WritePageArgs {#[arg(long, default_value_t = crate::config::DEFAULT_PROJECT.to_string())]pub project: String,}++#[cfg(test)]+mod tests {+ use super::*;+ use clap::Parser;++ #[test]+ fn pi_mcp_client_aliases_parse_to_same_variant() {+ for alias in ["pi", "omp", "oh-my-pi"] {+ let cli = Cli::try_parse_from([+ "ai-memory",+ "install-mcp",+ "--client",+ alias,+ "--server-url",+ "http://example.test:49374/mcp",+ ])+ .unwrap_or_else(|e| panic!("failed to parse install-mcp alias {alias}: {e}"));++ let Command::InstallMcp(args) = cli.command else {+ panic!("expected install-mcp command for alias {alias}");+ };+ assert!(+ matches!(args.client, McpClient::Pi),+ "alias {alias} must resolve to the Pi/OMP MCP client"+ );+ }+ }++ #[test]+ fn pi_hook_agent_aliases_parse_to_same_variant() {+ for alias in ["omp", "pi", "oh-my-pi"] {+ let cli = Cli::try_parse_from([+ "ai-memory",+ "install-hooks",+ "--agent",+ alias,+ "--server-url",+ "http://example.test:49374",+ ])+ .unwrap_or_else(|e| panic!("failed to parse install-hooks alias {alias}: {e}"));++ let Command::InstallHooks(args) = cli.command else {+ panic!("expected install-hooks command for alias {alias}");+ };+ assert!(+ matches!(args.agent, AgentChoice::Omp),+ "alias {alias} must resolve to the OMP hook agent"+ );+ }+ }+}diff --git a/crates/ai-memory-cli/src/commands/install_hooks.rs b/crates/ai-memory-cli/src/commands/install_hooks.rsindex b379c465..90f3441c 100644--- a/crates/ai-memory-cli/src/commands/install_hooks.rs+++ b/crates/ai-memory-cli/src/commands/install_hooks.rs@@ -1114,6 +1114,8 @@ fn render_claude_code(hooks_dir: &Path, server_url: &str, auth_token: Option<&stmod tests {use super::*;use std::fs;+ #[cfg(unix)]+ use std::process::Command;use tempfile::TempDir;fn stub_scripts(dir: &Path, names: &[&str]) {@@ -1222,6 +1224,44 @@ mod tests {);}+ #[cfg(unix)]+ #[test]+ fn curl_installer_accepts_pi_aliases_as_omp_extension() {+ let script = Path::new(env!("CARGO_MANIFEST_DIR"))+ .join("..")+ .join("..")+ .join("scripts")+ .join("install-hooks.sh");++ for alias in ["pi", "oh-my-pi"] {+ let output = Command::new("bash")+ .arg(&script)+ .arg("--agent")+ .arg(alias)+ .output()+ .unwrap_or_else(|e| {+ panic!("failed to run {} for alias {alias}: {e}", script.display())+ });++ assert!(+ output.status.success(),+ "script rejected alias {alias}: stdout={}, stderr={}",+ String::from_utf8_lossy(&output.stdout),+ String::from_utf8_lossy(&output.stderr)+ );++ let stdout = String::from_utf8_lossy(&output.stdout);+ assert!(+ stdout.contains("install-hooks --agent omp --apply"),+ "script should route alias {alias} to the generated OMP extension path; stdout={stdout}"+ );+ assert!(+ stdout.contains("~/.omp/agent/extensions/ai-memory.ts"),+ "script should describe the OMP extension file for alias {alias}; stdout={stdout}"+ );+ }+ }+// ----------------------------------------------------------------// Cursor tests// ----------------------------------------------------------------