Repository navigation
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 |
|---|---|---|---|---|---|
| 12 / 17 | 10 / 25 | 20 / 20 | 7 / 20 | 10 / 10 | 64 / 100 |
Drilldown
Presentation & Onboarding — 12 / 17
| Criterion | Max | Score | Notes |
|---|---|---|---|
| Configuration-mode examples | 12 | 12 | README documents multiple major modes with sensible defaults: default headless install, "Standalone mode with a launcher app" (coder_app), "MCP servers and rules" (mcp/rules_files), and downstream coder_script chaining via the scripts output. Each shows working .tf snippets. |
| Visual preview | 5 | 0 | No image, GIF, or video anywhere in the README; only an icon reference in frontmatter. |
Credential Hygiene — 20 / 20
| Criterion | Max | Score | Notes |
|---|---|---|---|
| Secrets marked sensitive | 16 | 16 | api_key variable is declared sensitive = true in main.tf. All README examples use api_key = var.cursor_api_key, never an inline literal key. |
| Non-hardcoded auth path | 4 | 4 | "Configuration" section documents an alternative to injecting a key: "run cursor-agent login in the workspace," and the API key is passed via coder_env rather than templated into scripts. |
Restricted-Environment Readiness — 7 / 20
| Criterion | Max | Score | Notes |
|---|---|---|---|
| Mirrorable artifact source | 5 | 0 | The installer URL https://cursor.com/install is hardcoded in scripts/install.sh.tftpl with no variable to override it. No module input overrides the download URL. |
| Bring-your-own binary | 10 | 5 | install_cursor_cli = false skips install and requires a pre-baked cursor-agent on PATH (validated in ensure_cursor_in_path), extensively exercised in tests. However, this is never mentioned or exampled in the README — only present in the variable's inline description — so it is under-documented. |
| Egress transparency | 3 | 0 | No dedicated README section enumerating external endpoints (e.g., cursor.com/install). Not mentioned anywhere in the README at all. |
| Runs without sudo | 2 | 2 | scripts/install.sh.tftpl never invokes sudo; uses curl, mktemp, jq, user-space $HOME/.local/bin and shell profile edits only. Confirmed from source. |
Engineering Quality — 10 / 10
| Criterion | Max | Score | Notes |
|---|---|---|---|
| Input quality | 6 | 6 | Variables have clear descriptions, sensible defaults (null, "", true, {}), and a validation block enforcing rules_files requires workdir. |
| Test coverage | 4 | 4 | main.tftest.hcl covers business logic (defaults, trimming, env var creation, validation failure, scripts ordering). main.test.ts covers extensive end-to-end container behavior (install paths, MCP merge/backup, trust marker, rules files, env var exposure). |
Agent track — 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 with icon, open_in, and launch command. |
| Session continuity | 5 | 0 | No documentation of session resume, reconnection, or a persistent session manager (tmux/screen/boo). |
| Managed configuration | 5 | 5 | mcp variable documents merging into ~/.cursor/mcp.json with existing-wins semantics, and rules_files documents writing to <workdir>/.cursor/rules/, both with a dedicated README example. |
Overall — 64 / 100
Raw 59 / 92 → round(59 / 92 × 100) = 64
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".
| description = "Workspace-specific MCP JSON to write to folder/.cursor/mcp.json. See https://docs.cursor.com/en/context/mcp#using-mcp-json" | ||
| default = null | ||
| validation { | ||
| condition = var.mcp == "" || can(jsondecode(var.mcp).mcpServers) |
There was a problem hiding this comment.
Require mcpServers to be an object
When mcp is valid JSON but mcpServers is a string, number, or array, this validation succeeds because it only checks that the attribute can be accessed. Workspace startup then fails in setup_mcp_config when jq evaluates $custom + (.mcpServers // {}); for example, {"mcpServers":[]} causes an array/object addition error. Validate the field's object/map type so this configuration fails during planning instead.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
No longer applicable: the mcp validation block was removed in d5cc3ed along with the other non-essential validations. A non-object mcpServers still fails workspace startup with the jq merge error in setup_mcp_config, so a bad value surfaces at startup rather than at plan time.
Generated with Coder Agents.
| } | ||
|
|
||
| locals { | ||
| workdir = var.workdir != null ? trimsuffix(var.workdir, "/") : "" |
There was a problem hiding this comment.
Preserve a root workdir during normalization
When a workspace intentionally uses / as its project directory, trimsuffix(var.workdir, "/") converts it to an empty string. The install script consequently skips directory trust setup, and if rules_files is configured it writes them under /.cursor/rules while treating the workdir as unset. Handle / specially or normalize trailing separators without erasing the root path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changed, intentionally. Using / as the project directory is an unusual edge case, and the normalization matches both the pre-migration module (trimsuffix(var.folder, "/")) and claude-code (trimsuffix(var.workdir, "/")). With workdir = "/", rules_files still lands in /.cursor/rules, which is the correct location for that workdir; only the directory trust entry is skipped.
Generated with Coder Agents.
…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. |
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.