Skip to content

feat: add cursor agent support#48

Open
bobobobo wants to merge 1 commit intoMiniCodeMonkey:mainfrom
bobobobo:add-cursor-support
Open

feat: add cursor agent support#48
bobobobo wants to merge 1 commit intoMiniCodeMonkey:mainfrom
bobobobo:add-cursor-support

Conversation

@bobobobo
Copy link

PR Summary: Add Cursor agent support

Overview

Adds Cursor CLI as a fourth agent backend for Chief. Users can run PRD loops with Cursor's agent CLI in addition to Claude Code, Codex, and OpenCode.

What's included

Agent integration

  • internal/agent/cursor.go — New CursorProvider implementing loop.Provider:
    • Loop command invokes agent -p --output-format stream-json --force --workspace <dir> --trust with prompt on stdin
    • Interactive, convert, and fix-JSON commands wired for Cursor
    • CleanOutput handles both single JSON and NDJSON (finds last result/success)
    • Log file: cursor.log
  • internal/agent/resolve.go — Added "cursor" case to Resolve(); resolution order unchanged (flag → CHIEF_AGENT → config → default). Error message updated to list all four providers.

Output parsing

  • internal/loop/cursor_parser.go — Parser for Cursor CLI stream-json NDJSON:
    • Maps system/init → iteration start, assistant → assistant text / story status / <chief-complete/>, tool_call → tool start/result
    • Supports all Cursor tool types: read, write, edit, shell, grep, glob, ls, delete, web fetch, web search, function (with display names and result summaries for the TUI)

Configuration & CLI

  • internal/config/config.goAgentConfig comment updated to include Cursor.
  • cmd/chief/main.go--agent accepts cursor; help and error strings updated to mention all four agents.

Tests

  • internal/agent/cursor_test.go — Tests for CursorProvider (commands, CleanOutput, ParseLine).
  • internal/agent/resolve_test.go — Tests for resolving cursor (and path/config).
  • internal/loop/cursor_parser_test.go — Tests for Cursor NDJSON parsing (events and tool calls).

Documentation

  • Installation — New "Option D: Cursor CLI" (install, PATH/agent.cliPath, agent login, chief --agent cursor / config).
  • Quick start — Cursor CLI in prerequisites and agent --version in verify step.
  • Configurationagent.provider and flags table include cursor; Cursor auth and headless/trust/force usage noted.
  • Troubleshooting — Cursor in "Agent not found", log file names, and "Permission denied" / "Stuck" log references.
  • PRD format — Log file list includes cursor.log.
  • AgentSupport.vue — Cursor CLI added to the agents list.

How to use

  • chief --agent cursor or CHIEF_AGENT=cursor or agent.provider: cursor in .chief/config.yaml
  • Optional agent.cliPath (or CHIEF_AGENT_PATH) if agent isn't on PATH
  • Cursor is run headless with --trust and --force so Chief can drive it without interactive prompts.

Testing

  • New and updated unit tests for Cursor provider, resolver, and cursor parser; existing agent flow unchanged.

@bobobobo bobobobo marked this pull request as ready for review March 14, 2026 11:37
@MiniCodeMonkey
Copy link
Owner

@bobobobo This is amazing. Thanks for adding this PR! I will review and get this merged in!

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