Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

feat(cli): add top-level setup command (#5397)

Louis Beaumontf1dd4b679342
diff --git a/crates/screenpipe-engine/src/bin/screenpipe-engine.rs b/crates/screenpipe-engine/src/bin/screenpipe-engine.rs
index b88e3f361..142de5532 100644
--- a/crates/screenpipe-engine/src/bin/screenpipe-engine.rs
+++ b/crates/screenpipe-engine/src/bin/screenpipe-engine.rs
@@ -314,6 +314,10 @@ async fn main() -> anyhow::Result<()> {
screenpipe_engine::cli::agent::handle_agent_command(subcommand).await?;
return Ok(());
}
+ Command::Setup { ref api_url } => {
+ screenpipe_engine::cli::agent::setup_all_detected(api_url)?;
+ return Ok(());
+ }
Command::Service { ref subcommand } => {
screenpipe_engine::cli::service::handle_service_command(subcommand).await?;
return Ok(());
diff --git a/crates/screenpipe-engine/src/cli/agent.rs b/crates/screenpipe-engine/src/cli/agent.rs
index a657d2e82..ac88c5168 100644
--- a/crates/screenpipe-engine/src/cli/agent.rs
+++ b/crates/screenpipe-engine/src/cli/agent.rs
@@ -163,15 +163,12 @@ pub fn maybe_prompt_connect_detected(data_dir: &Path) {
"\n {} {error}",
"some tools were not connected:".yellow().bold()
);
- eprintln!(
- " retry with {}",
- "screenpipe agent setup --all".green().bold()
- );
+ eprintln!(" retry with {}", "screenpipe setup".green().bold());
}
} else {
eprintln!(
" not now — run {} whenever you're ready.\n",
- "screenpipe agent setup --all".green().bold()
+ "screenpipe setup".green().bold()
);
}
}
@@ -250,7 +247,7 @@ fn has_screenpipe_mcp(layout: &AgentLayout) -> bool {
}
}
-fn setup_all_detected(api_url: &str) -> Result<()> {
+pub fn setup_all_detected(api_url: &str) -> Result<()> {
let home = dirs::home_dir().context("could not resolve home dir")?;
let detected = detected_agents_in(&home);
if detected.is_empty() {
diff --git a/crates/screenpipe-engine/src/cli/mod.rs b/crates/screenpipe-engine/src/cli/mod.rs
index ffa34dc20..530dc56d6 100644
--- a/crates/screenpipe-engine/src/cli/mod.rs
+++ b/crates/screenpipe-engine/src/cli/mod.rs
@@ -250,6 +250,13 @@ pub enum Command {
subcommand: agent::AgentCommand,
},
+ /// Connect screenpipe to every supported AI tool detected on this computer
+ Setup {
+ /// screenpipe REST API base URL the skills + MCP should target.
+ #[arg(long, default_value = "http://localhost:3030")]
+ api_url: String,
+ },
+
/// Run screenpipe as a background service that starts at boot + stays up
/// (systemd on Linux, launchd on macOS). For always-on boxes / VPS.
Service {
@@ -2361,6 +2368,34 @@ mod tests {
}
}
+ #[test]
+ fn test_setup_command_parses_with_default_api_url() {
+ let cli = Cli::try_parse_from(["screenpipe", "setup"]).unwrap();
+ match cli.command {
+ Command::Setup { api_url } => {
+ assert_eq!(api_url, "http://localhost:3030");
+ }
+ _ => panic!("expected Setup command"),
+ }
+ }
+
+ #[test]
+ fn test_setup_command_accepts_remote_api_url() {
+ let cli = Cli::try_parse_from([
+ "screenpipe",
+ "setup",
+ "--api-url",
+ "https://screenpipe.example",
+ ])
+ .unwrap();
+ match cli.command {
+ Command::Setup { api_url } => {
+ assert_eq!(api_url, "https://screenpipe.example");
+ }
+ _ => panic!("expected Setup command"),
+ }
+ }
+
#[test]
fn test_profile_command_parses_with_defaults() {
let cli = Cli::try_parse_from(["screenpipe", "profile"]).unwrap();
diff --git a/crates/screenpipe-engine/src/cli_reminder.rs b/crates/screenpipe-engine/src/cli_reminder.rs
index 8621b2558..5b0ca53e7 100644
--- a/crates/screenpipe-engine/src/cli_reminder.rs
+++ b/crates/screenpipe-engine/src/cli_reminder.rs
@@ -117,10 +117,7 @@ fn print_mcp_tip() {
" {} connect screenpipe to every AI tool detected on this computer:",
"tip:".cyan().bold(),
);
- eprintln!(
- " {}",
- "npx screenpipe@latest agent setup --all".green().bold(),
- );
+ eprintln!(" {}", "npx screenpipe@latest setup".green().bold());
eprintln!(
" adds MCP + supported skills to Claude, Codex, Cursor, OpenClaw, Hermes, and Windsurf/Devin",
);