qyjqio/dsh-cursor-toolkit

cursor-cli

把编码任务交给本机 Cursor CLI 代理在工作目录中执行,并可按 chat id 续跑。

ツールと機能cursorcursor-agentdeepseek-harness

@qyjqio/dsh-cursor-cli

DSH host plugin that adds the cursor_agent tool: run the Cursor CLI (cursor-agent) headlessly on a task in a workspace, straight from any DSH agent session.

Cursor runs its own agent loop (reads/edits files, calls tools) and the tool returns its final message plus the Cursor chat id, so a run can be continued later with resume.

Install

# from a DSH session with the plugin manager available — git source, pinned by the market index
plugin_manager install_bundle target="git+https://github.com/qyjqio/dsh-cursor-toolkit.git#<commit>&path:/packages/dsh-cursor-cli"
# or plain pnpm, inside a DSH profile directory
pnpm add "git+https://github.com/qyjqio/dsh-cursor-toolkit.git#<commit>&path:/packages/dsh-cursor-cli"

Then enable the bundle (include:cursor-cli) in Settings → Plugins, or add @qyjqio/dsh-cursor-cli to the profile's dsh.profile.bundles.

Requirements

  • Cursor CLI installed and logged in: cursor-agent --version, cursor-agent login.
  • The executable is resolved from, in order: PATH, ~/.local/bin, /usr/local/bin, /usr/bin (override with the executable config field).
  • Headless runs need the workspace trusted, so the tool always passes --trust.

Parameters

nametypemeaning
promptstring (required)Task for Cursor; be explicit about goal and done criteria
cwdstringWorkspace dir; defaults to the session working directory, accepts ~
modeagent | plan | askagent edits/runs tools; plan/ask are read-only
modelstringCursor model id (e.g. auto, composer-2.5); default = CLI default
forcebooleanPass --force (auto-approve tool calls). Default true; ignored for read-only modes
resumestringCursor chat id returned by a previous run
continueSessionbooleanContinue the most recent chat in the workspace
timeoutSecondsinteger 1..3600Run budget; default 900

Result

{ ok, result, cwd, mode, truncated, timedOut, aborted,
  sessionId?, model?, durationMs?, exitCode?, stderr? }

ok is false when the process exits non-zero, Cursor reports is_error, or the run times out / is aborted. The rendered card shows the final message plus a footer with session id, model, mode, duration and cwd.

Config

Optional bundle config (all values are defaults in code when omitted):

keydefaultmeaning
executableauto-detectedPath to cursor-agent
allowForcetrueWhether force may be passed at all
modelCLI defaultDefault model when the call omits one
maxOutputChars60000Result truncation limit
timeoutMs900000Default timeout

Examples

  • cursor_agent({ prompt: "Fix the failing test in tests/auth.spec.ts" })
  • cursor_agent({ prompt: "Review src/api for error handling gaps", mode: "plan" })
  • cursor_agent({ prompt: "Now apply the plan", resume: "<sessionId>" })

Notes

  • Tools run with the host process environment, so CURSOR_API_KEY is honored.
  • Timeout: the tool kills the CLI with SIGTERM, then SIGKILL after 3 s.
  • cwd is validated before spawning; a missing directory fails fast instead of letting Cursor create one.