From 3ac96a029e6334790da7423ff19b0aa523a434a3 Mon Sep 17 00:00:00 2001 From: B <6723574+louisgv@users.noreply.github.com> Date: Wed, 15 Apr 2026 12:30:28 +0000 Subject: [PATCH] fix(link): add pi and cursor to agent auto-detection KNOWN_AGENTS was missing pi and cursor, so `spawn link` could not auto-detect these agents on remote servers. Also adds a binary-name mapping for cursor (whose CLI binary is `agent`). Bump CLI to 1.0.14. Agent: code-health Co-Authored-By: Claude Sonnet 4.5 --- packages/cli/package.json | 2 +- packages/cli/src/commands/link.ts | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 0b4a8d719..6c9379edd 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@openrouter/spawn", - "version": "1.0.13", + "version": "1.0.14", "type": "module", "bin": { "spawn": "cli.js" diff --git a/packages/cli/src/commands/link.ts b/packages/cli/src/commands/link.ts index bafa02277..9eaf60444 100644 --- a/packages/cli/src/commands/link.ts +++ b/packages/cli/src/commands/link.ts @@ -71,14 +71,28 @@ const KNOWN_AGENTS = [ "kilocode", "hermes", "junie", + "pi", + "cursor", ] as const; type KnownAgent = (typeof KNOWN_AGENTS)[number]; +/** Map manifest agent key → CLI binary name (only where they differ). */ +const AGENT_BINARY: Partial> = { + cursor: "agent", +}; + +/** Get the CLI binary name for an agent (defaults to the agent key itself). */ +function agentBinary(agent: KnownAgent): string { + return AGENT_BINARY[agent] ?? agent; +} + /** Auto-detect which agent is installed/running on the remote host. */ function detectAgent(host: string, user: string, keyOpts: string[], runCmd: SshCommandFn): string | null { // First: check running processes + // Note: cursor's binary is "agent" which is too generic for ps grep, so it's + // detected only via the installed-binary check below. const psCmd = - "ps aux 2>/dev/null | grep -oE 'claude(-code)?|openclaw|codex|opencode|kilocode|hermes|junie' | grep -v grep | head -1 || true"; + "ps aux 2>/dev/null | grep -oE 'claude(-code)?|openclaw|codex|opencode|kilocode|hermes|junie|pi' | grep -v grep | head -1 || true"; const psOut = runCmd(host, user, keyOpts, psCmd); if (psOut) { const match = KNOWN_AGENTS.find((b: KnownAgent) => psOut.includes(b)); @@ -89,7 +103,7 @@ function detectAgent(host: string, user: string, keyOpts: string[], runCmd: SshC // Second: check installed binaries — one SSH call per agent to avoid shell injection for (const agent of KNOWN_AGENTS) { - const whichOut = runCmd(host, user, keyOpts, `command -v ${agent}`); + const whichOut = runCmd(host, user, keyOpts, `command -v ${agentBinary(agent)}`); if (whichOut) { return agent; }