Repository navigation
refactor(registry/coder-labs/modules/cursor-cli)!: remove agentapi, tasks and start logic - #1152
Conversation
…ent modules off AgentAPI
…asks and start logic Make cursor-cli an install-only module built on coder-utils. The user now launches Cursor CLI with their own coder_app. - Drop the agentapi module, Tasks inputs, start script and the task-reporting MCP server. - Install via the official installer (temp file, bash -n validation). - Rename folder to optional workdir; create it and write Cursor's workspace trust marker. - Merge mcp into ~/.cursor/mcp.json with existing servers winning. - Keep rules_files (requires workdir) and api_key (CURSOR_API_KEY). - Remove model, force and ai_prompt in favor of launcher CLI flags. - Add scripts output; rewrite README and tests; bump to 1.0.0.
Module Scorecard Check
|
| Presentation & Onboarding | Agent Integration | Credential Hygiene | Restricted-Environment Readiness | Engineering Quality | Overall |
|---|---|---|---|---|---|
| 6 / 17 | 10 / 25 | 20 / 20 | 7 / 20 | 10 / 10 | 58 / 100 |
Drilldown
Presentation & Onboarding — 6 / 17
| Criterion | Max | Score | Notes |
|---|---|---|---|
| Configuration-mode examples | 12 | 6 | README shows 4 examples (minimal api_key, standalone w/ coder_app launcher, MCP+rules, downstream coder_script chaining), but no dedicated example demonstrates install_cursor_cli = false (BYOB) or login-only auth, so not every major mode gets a documented example. |
| Visual preview | 5 | 0 | No image, GIF, or video anywhere in the README. |
Credential Hygiene — 20 / 20
| Criterion | Max | Score | Notes |
|---|---|---|---|
| Secrets marked sensitive | 16 | 16 | api_key is declared sensitive = true in main.tf; all README examples reference var.cursor_api_key with no inline literal/placeholder keys. |
| Non-hardcoded auth path | 4 | 4 | README's Configuration section documents cursor-agent login as an alternative to passing api_key, an interactive auth flow that avoids pasting raw keys. |
Restricted-Environment Readiness — 7 / 20
| Criterion | Max | Score | Notes |
|---|---|---|---|
| Mirrorable artifact source | 5 | 0 | Install script hardcodes https://cursor.com/install in scripts/install.sh.tftpl; no module variable overrides this download URL. |
| Bring-your-own binary | 10 | 5 | install_cursor_cli = false skips installation and validates an existing cursor-agent on PATH (tested in main.test.ts and main.tftest.hcl), but this mode is only documented via the main.tf variable description, not demonstrated as a README example/section. |
| Egress transparency | 3 | 0 | No dedicated network/offline section in README; the cursor.com/install endpoint is never enumerated anywhere in the docs. |
| Runs without sudo | 2 | 2 | scripts/install.sh.tftpl never invokes sudo; installs to $HOME/.local, writes to $HOME/.cursor, all as the unprivileged user. |
Engineering Quality — 10 / 10
| Criterion | Max | Score | Notes |
|---|---|---|---|
| Input quality | 6 | 6 | All variables have clear descriptions and sensible defaults (install_cursor_cli=true, api_key="", etc.); rules_files has a validation block requiring workdir to be set. |
| Test coverage | 4 | 4 | main.tftest.hcl covers defaults, trimming, validation failure, env var creation, and scripts output ordering; main.test.ts thoroughly covers end-to-end install, MCP merge/backup, trust marker, and rules-file behavior in containers. |
Agent Integration — 10 / 25
| Criterion | Max | Score | Notes |
|---|---|---|---|
| AI governance | 10 | 0 | No mention of Coder AI Gateway or Agent Firewall anywhere in the README. |
| Dashboard entry point | 5 | 5 | README's "Standalone mode with a launcher app" example shows a full coder_app resource (slug, display_name, icon, open_in, launch command). |
| Session continuity | 5 | 0 | No documentation of resuming/continuing sessions, nor use of a persistent session manager (tmux/screen/boo). |
| Managed configuration | 5 | 5 | mcp variable merges into ~/.cursor/mcp.json and rules_files writes to <workdir>/.cursor/rules/, both documented with a dedicated example ("MCP servers and rules"). |
Overall — 58 / 100
Raw 53 / 92 → round(53 / 92 × 100) = 58
Tip
You can run this locally by telling your agent: "review this module against .github/scorecard/SCORECARD.md".
Scored against SCORECARD.md with solstice-1. Language-model scores are advisory.
…o set CURSOR_CONFIG_DIR
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Lets also allow passing arbitrary flags as |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 61be2d3032
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…l variable validations Drop the mcp shape and rules_files name checks. Keep the rules_files workdir requirement, since workdir is optional and rules are written under it.
|
Automated review requested by @matifali. Please sanity-check before acting on it.
CI and existing reviews
CorrectnessThe Terraform is coherent. [SHOULD-FIX] Stale v0 project-level Fix: when [SHOULD-FIX] Add [SHOULD-FIX / verify] The trust marker depends on undocumented CLI internals Leftovers
Breaking changes and migration
Tests
Consistency and other nits
|
@matifali With this change the module only installs and configures Cursor CLI; it no longer launches Flags now belong in the template's own launcher, which the README shows: command = <<-EOT
#!/usr/bin/env bash
set -e
cd "${local.cursor_workdir}"
exec cursor-agent --model gpt-5 --force
EOTSo I'm not adding an Generated with Coder Agents. |
|
Makes sense. Thanks |
|
Thanks for the automated review. Its verdict is "approve with nits, no blockers", and nothing in it is blocking enough to change in this PR:
@DevelopmentCats could you take a look when you get a chance? Generated with Coder Agents. |
DevelopmentCats
left a comment
There was a problem hiding this comment.
I agree with you on the above and have tested it on my end
Closes REG-84
Refactor
coder-labs/cursor-clito install and configure Cursor CLI only, matching the codex v5 and copilot (#1117) migrations.order,group,install_agentapi,agentapi_version,ai_prompt), the start script, and the task-reportingcoderMCP server.https://cursor.com/install, temp file +bash -nvalidation, retrying curl). Skipped whencursor-agentis already onPATH; fails clearly wheninstall_cursor_cli = falseand no binary exists.folderto optionalworkdir; create it and write Cursor's workspace trust marker so the trust prompt is skipped.mcpinto user-level~/.cursor/mcp.json(existing on-disk servers win on duplicate names; invalid JSON is backed up tomcp.json.bak).rules_files(now requiresworkdir) andapi_key(CURSOR_API_KEY, never rendered into the script).cursor_config_dir(default""): setsCURSOR_CONFIG_DIRviacoder_envonly when non-empty, so an existing value is never overwritten. It movescli-config.jsononly; Cursor CLI always reads the user-levelmcp.jsonfrom~/.cursor, so the module keeps writingmcpthere (verified against the binary).modelandforce: Cursor CLI has no model env var, so both become--model/--forceflags in the user'scoder_app.scriptsoutput; rewrite README (v1 warning, launcher example) and tests. Bump to1.0.0.Important
The trust marker (
${CURSOR_DATA_DIR:-~/.cursor}/projects/<slug>/.workspace-trusted) is derived from the CLI bundle, not public docs. The path matches what the CLI creates, but suppression of the prompt could not be verified end to end without a real Cursor API key (auth is checked before trust). Worth a manual check.Decision log
Verified against the installed CLI (
2026.09.26-dd393fe) and Cursor docs:VERSIONto official installer--modelflag //modelonlymodel, document flagmanaged_settingsroot-owned policy~/.cursor/policy.jsonis sign-in enforcement onlymcp addduplicate semanticsmcp add; config is.cursor/mcp.jsonor~/.cursor/mcp.json--trustor the promptagent(primary) andcursor-agent(legacy)cursor-agent(unambiguous)Testing
terraform validate,terraform test(8 passed)bun test main.test.ts(14 passed, container-based)codercom/enterprise-nodevia the rendered install script: installed, validated, workdir trusted, PATH updatedreadmevalidationGenerated with Coder Agents.