cursor-setup
One-shot, per-environment setup for the cursor skill.
The skill itself is bash + Unix coreutils; this command makes it run smoothly on
each host by detecting the OS, checking dependencies, and wiring permissions.
The heavy lifting lives in one bash engine:
bash ${CLAUDE_PLUGIN_ROOT}/skills/cursor/lib/setup.sh \
[--check | --print-permissions | --apply-permissions | --init-config [--force]]
bash ${CLAUDE_PLUGIN_ROOT}/skills/cursor/lib/cursor.sh setup … (alias doctor) routes to
the same script.
What it checks (no agent call — zero token cost)
| Check | Hard dep? | macOS note |
|---|---|---|
bash version |
no (advisory) | stock /bin/bash is 3.2 — fully supported; ≥4.3 only speeds fanout --local-parallel |
agent (Cursor CLI) |
yes | curl https://cursor.com/install -fsS | bash |
jq |
yes | brew install jq |
timeout / gtimeout |
yes | brew install coreutils provides gtimeout |
GNU vs BSD date |
no | skill is BSD-tolerant; gdate used when present |
auth (CURSOR_API_KEY or ~/.cursor session) |
yes | agent login |
~/.cursor writable |
yes | sandbox / read-only fs hint if not |
| permission allowlist present | no (advisory) | generated by this command |
Platform support
- WSL Ubuntu / native Linux — first-class.
apt-get install -y jq coreutils. - macOS — first-class on stock bash 3.2 (no upgrade needed); install
jq+coreutilsvia Homebrew. - Windows (native) — not supported (no bash + Unix coreutils). The doctor
detects MSYS/Cygwin/MinGW and prints WSL bootstrap steps. Git Bash / Cygwin are
not officially supported; use
wsl --install -d Ubuntuand run everything inside WSL.
Protocol (how Claude should run this)
Run the doctor:
bash ${CLAUDE_PLUGIN_ROOT}/skills/cursor/lib/setup.sh. Read its stdout. Relay the Verdict (READY ✓/NEEDS SETUP ✗) and any[MISSING]/[WARN]lines to the user.If
NEEDS SETUP ✗(one or more blocking items) — stop here, do not proceed to permissions or config generation:- Surface the per-OS Fix-it steps the doctor printed.
- Do not silently auto-install — these touch the user's system. Offer to run a specific command only with explicit confirmation (Windows → recommend WSL; do not attempt a native install).
- Close by telling the user explicitly: after installing the missing pieces,
re-run
/cursor-setupto re-check. The setup is not complete until the verdict isREADY ✓.
If
READY ✓(all hard deps present) — finish the setup in two steps:a. Permissions: if the doctor warns that no cursor allow rules exist, preview them with
--print-permissions, explain that they auto-approve read-only delegation only (review/plan/investigate/security/status/fanout --collect) whileimplement/cancel/resumestill prompt, then ask before running--apply-permissions(it edits the global~/.claude/settings.json, backing it up tosettings.json.cursor-setup.bak).b. Seed the
~/.cursor.jsonconfig so the user's routing tweaks live outside the plugin. Marketplace updates overwrite the skill default (layer 1) but never~/.cursor.json— that is the whole point of writing an override. Config is user-scoped only (applies to every repo for this user); there is no per-project config file. Use AskUserQuestion to ask whether to seed it (header e.g.Seed config):- Yes → write
~/.cursor.json(a ready-to-use copy of the defaults). - Skip → keep using the built-in skill default (no file written).
On yes, run:
bash ${CLAUDE_PLUGIN_ROOT}/skills/cursor/lib/setup.sh --init-configThe file is a ready-to-use copy of the shipped defaults — it already holds real values (models, modes, preambles) the user can edit in place, not an empty stub that looks configured but does nothing until edited. (A full copy pins those values into the override layer, so a field the user keeps no longer tracks future skill-default updates; deleting a field re-enables default tracking for it.)
- stdout
WROTE\t<path>→ tell the user the path, and that the file works as-is — they edit values in place to customize (e.g. a task'smodel/mode/preamble); point them at the schema + examples inconfiguration.md. - stdout
EXISTS\t<path>→ the file already exists. Ask via AskUserQuestion whether to overwrite; only on yes re-run with--init-config --force(the old file is backed up to<path>.cursor-setup.bak).
- Yes → write
Confirm: optionally re-run
bash …/setup.shand show the verdict isREADY ✓.
Notes
--checkis the default and is purely diagnostic (read-only; never invokesagent). Exit code:0ready,1needs setup.--apply-permissionsand--init-configare the mutating modes — always confirm with the user first (the AskUserQuestion in step 3b covers whether to seed the config).--apply-permissionswrites~/.claude/settings.json;--init-configwrites a ready-to-use copy of the shipped defaults to~/.cursor.jsonand never overwrites an existing file unless--force(which backs the old one up to<path>.cursor-setup.bak)..cursor.jsonmust never contain aCURSOR_API_KEY— keep secrets in the environment.- After setup, drive real work through the
cursorskill (/cursor review …,/cursor fanout …, etc.).