Skip to content

fix(link): add pi and cursor to agent auto-detection#3309

Open
la14-1 wants to merge 1 commit intomainfrom
code-health-fix
Open

fix(link): add pi and cursor to agent auto-detection#3309
la14-1 wants to merge 1 commit intomainfrom
code-health-fix

Conversation

@la14-1
Copy link
Copy Markdown
Member

@la14-1 la14-1 commented Apr 15, 2026

Why: spawn link cannot auto-detect Pi or Cursor CLI agents on remote servers — users must manually specify --agent pi or --agent cursor. This is because KNOWN_AGENTS in link.ts was never updated when these agents were added.

Changes

  • Add "pi" and "cursor" to KNOWN_AGENTS array
  • Add AGENT_BINARY mapping for cursor (agent binary) so command -v checks the correct binary name
  • Update ps aux grep pattern to include pi (cursor's agent binary is intentionally excluded from ps grep — too generic)
  • Bump CLI version to 1.0.14

-- refactor/code-health

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 <noreply@anthropic.com>
Copy link
Copy Markdown

@perry-the-pr-reviewer perry-the-pr-reviewer bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds pi and cursor to spawn link auto-detection so users no longer need to pass --agent pi/cursor manually on remote servers.

CI: All 6 checks pass (Biome, ShellCheck, Unit Tests, Mock Tests, macOS Compatibility, membership).

Code quality:

The implementation is correct and the manifest confirms both binary names:

  • pi: manifest launch = "pi"command -v pi is the right check; added to ps grep since pi isn't ambiguous.
  • cursor: manifest launch = "agent"AGENT_BINARY correctly maps cursor → "agent"; intentionally excluded from ps grep since agent is too generic (comment explains this clearly at link.ts:92–93).

The agentBinary() helper at link.ts:85–87 is a clean, zero-footprint abstraction — the Partial<Record<KnownAgent, string>> type ensures exhaustive safety at the call site.

No injection risk: agentBinary(agent) is bounded by the KNOWN_AGENTS const tuple.

One observation (non-blocking): command -v agent (run when checking cursor) could match any host binary named agent unrelated to Cursor. In practice the risk is low — cursor is checked last in KNOWN_AGENTS order, so any earlier-installed agent wins first. Worth keeping in mind if false positives surface in the wild; a follow-up heuristic (e.g. checking ~/.cursor existence) could disambiguate.

Missing tests (non-blocking): agentBinary() and the cursor/pi detection paths have no dedicated unit tests. The existing SSH_DETECT_AGENT_VIA_WHICH fixture in cmd-link-cov.test.ts:44 only covers the command -v claude path. Worth adding command -v agent → cursor and command -v pi → pi branches in a follow-up.

✅ LGTM — fix is correct, well-scoped, and ready to ship.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants