scrybe_cli/rpc_client.rs
1//! Thin JSON-RPC client to talk to the running Scrybe GUI.
2//!
3//! The implementation now lives in [`scrybe_rpc::client`] so the CLI and the
4//! MCP server dial the live app through **one** shared dialer (two divergent
5//! clients is exactly the split `scrybe-rpc` exists to prevent). This module
6//! re-exports it to keep the existing `rpc_client::*` call sites unchanged.
7
8pub use scrybe_rpc::client::{is_live, send, send_to, socket_path, try_connect, try_connect_at};
9
10#[cfg(test)]
11mod tests {
12 use super::*;
13
14 #[test]
15 fn socket_path_reexported() {
16 // The re-export links and resolves to the shared implementation.
17 assert!(!socket_path().as_os_str().is_empty());
18 }
19
20 #[cfg(unix)]
21 #[test]
22 fn send_to_errors_when_no_server() {
23 let path = std::path::PathBuf::from("/tmp/scrybe-nonexistent-sock-cli-reexport-test");
24 let err = send_to(&path, "open", serde_json::json!({"path": "/tmp/foo.md"})).unwrap_err();
25 // The one blessed no-app check — typed, never message-text matching.
26 assert!(err.is_not_running());
27 }
28}