feat(agents): add Cursor CLI agent support - #187
Open
ioqr wants to merge 1 commit into
Open
Conversation
ioqr
force-pushed
the
cursor
branch
3 times, most recently
from
August 4, 2026 08:31
df68827 to
3ff29ad
Compare
Wire `--agent cursor` to the Cursor `agent` binary with stream-json output, schema prompt recovery, force/trust/approve-mcps defaults, and post-success process shutdown for non-interactive runs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
--agent cursorintegration that invokes Cursor'sagentCLI in non-interactive--printstream-json mode, with schema-in-prompt recovery, default--force/--trust/--approve-mcps(unless overridden), reserved-arg rejection, and post-success lingering process shutdown.cursorthrough agent factory, config/bootstrap overrides, CLI agent lists, and docs (README Agents table, AGENTS.md, skill process scan, bug report template).Risk Assessment
✅ Low: Well-bounded Cursor agent integration that mirrors existing Claude/Pi spawn, schema-prompt, and linger-shutdown patterns, with parsing aligned to Cursor's last-assistant vs concatenated-result semantics and broad unit/e2e coverage.
Testing
Built the CLI, ran the Cursor-focused unit/integration/e2e suite (all passed), then manually drove a one-iteration
--agent cursorrun through the mock Cursor binary; help text lists cursor, spawn used-p --output-format stream-json --force --trust --approve-mcpswith schema/objective on stdin, committedhello.txt, and the exit summary reportedcursor ran/ max iterations reached.Evidence: CLI help and unknown-agent error listing cursor
--agent <agent> ... copilot, pi, cursor, or acp:<target-or-command> Unknown agent: not-a-real-agent. Use "claude", "codex", "rovodev", "opencode", "copilot", "pi", or "cursor", or "acp:<target-or-command>"Evidence: End-user gnhf --agent cursor CLI transcript (TUI + exit summary + workspace)
Evidence: Readable exit summary proving cursor iteration succeeded
× gnhf stopped cursor ran for 0s before: max iterations reached (1) iterations 1 total / 1 good / 0 failed branch diff 1 commit +1 hello.txt -> hello from cursor mock commit: gnhf 1: cursor mock wrote hello.txt spawn argv: -p --output-format stream-json --force --trust --approve-mcpsEvidence: Mock Cursor spawn/done JSONL (defaults + schema contract)
{"event":"spawn","argv":["-p","--output-format","stream-json","--force","--trust","--approve-mcps"],"hasSchemaContract":true,"stdinHasObjective":true} {"event":"done","wrote":"hello.txt"}Evidence: Committed hello.txt content from mock cursor agent
hello from cursor mockEvidence: Intent demonstration summary
Pipeline
Updates from git push no-mistakes
⏭️ **intent** - skipped
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
pnpm run buildpnpm exec vitest run src/core/agents/cursor.test.ts src/core/agents/cursor.linger.integration.test.ts src/core/agents/factory.test.ts src/core/config.test.ts e2e/e2e-cursor.test.tsnode dist/cli.mjs --help(confirmscursorin--agentlist)node dist/cli.mjs --agent not-a-real-agent "x"(error listscursor)Manual:node dist/cli.mjs "add a hello.txt via cursor agent" --agent cursor --max-iterations 1 --current-branch --prevent-sleep offwithagentPathOverride.cursorpointing ate2e/fixtures/mock-cursor-agent✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.