Skip to content

Add Cloud Agent development environment - #2114

Open
Soph wants to merge 6 commits into
mainfrom
cursor/add-cloud-agent-environment-6eb0
Open

Add Cloud Agent development environment#2114
Soph wants to merge 6 commits into
mainfrom
cursor/add-cloud-agent-environment-6eb0

Conversation

@Soph

@Soph Soph commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

https://entire.io/gh/entireio/cli/trails/1134

Summary

Sets up a Cloud Agent development environment for the Entire CLI so future agents boot with the pinned toolchain ready, the CLI built, entire on PATH so this repo's committed hooks fire (Entire dogfoods itself here), and the generated token scoped to reach the checkpoint sync repo. Delivered as repository-managed config (versioned with code, follows branches/PRs).

  • .cursor/environment.jsoninstall: "bash .cursor/install.sh", repositoryDependencies: ["github.com/entireio/cli-checkpoints"].
  • .cursor/install.sh (idempotent): upgrades git to >= 2.45 from the git-core PPA when needed (the test suite creates a reftable repo with git init --ref-format=reftable; Ubuntu 24.04 ships 2.43); installs mise + the pinned toolchain from mise.toml (Go 1.26.6, golangci-lint, gotestsum, shellcheck, tmux, roger-roger E2E helpers); activates mise in interactive shells; runs go mod download and go build -o entire ./cmd/entire/; then symlinks the built binary onto PATH (/usr/local/bin/entire, falling back to ~/.local/bin).

No long-running services are needed, so start/terminals are omitted.

Why PATH is all the environment needs for hooks

This repo commits agent hook configs (.cursor/hooks.json, …) that invoke the bare entire command and silently no-op when it isn't on PATH. Putting the built binary on the standard system PATH is enough: on the first turn a Cursor agent takes, strategy.EnsureSetup (run at every turn-start) reinstalls Entire's git hooks when absent — so the environment does not install git hooks itself. Verified end-to-end: with entire on PATH, a real commit made during a captured session picks up an Entire-Checkpoint trailer automatically.

Why repositoryDependencies

Entire syncs checkpoint refs to the dedicated remote entireio/cli-checkpoints. The Cloud Agent's generated token (cursor[bot]) is scoped to entireio/cli, so the pre-push checkpoint push is denied (remote: Permission to entireio/cli-checkpoints.git denied to cursor[bot] / HTTP 403). Listing the checkpoint repo under repositoryDependencies widens the generated token's scope to include it (the Cursor GitHub app is installed org-wide on entireio).

Note: this takes effect once the environment is adopted — after this PR merges (the platform reads repositoryDependencies from the default-branch .cursor/environment.json before minting the token) or the environment is Saved in the dashboard. It does not apply to a just-in-time agent booted on an unmerged branch, because the token is minted before the branch is cloned. After adoption, if push is still denied, the Cursor GitHub app needs content:write on entireio/cli-checkpoints.

Validation (this VM / fresh agents)

Check Result
bash .cursor/install.sh from a fresh state Passed; idempotent
shellcheck .cursor/install.sh Clean
mise run lint 0 issues
mise run test:ci (unit + integration + -race + E2E canary) Passed
entire resolvable on minimal system PATH /usr/local/bin/entire
Git hook self-heal on turn-start All 5 hooks reinstalled
Real commit during captured session gets Entire-Checkpoint trailer Yes (Entire-Checkpoint: 01M0TPVTG0…, then reverted)
Fresh Cloud Agent (from tested build) toolchain/build/lint/product checks Passed

Note on running the full test suite in a Cloud Agent

A few URL-derivation unit tests read the global git config and assert exact SSH/HTTPS URLs. Cloud Agent VMs carry a Cursor-managed url.<token>.insteadOf rewrite (for GitHub auth) that rewrites those URLs, so mise run test:ci must be run with a neutral global git config:

GIT_CONFIG_GLOBAL=/tmp/neutral-gitconfig GIT_CONFIG_SYSTEM=/dev/null \
  ./.devcontainer/run-with-keyring.sh mise run test:ci

This is a test-harness/environment interaction only (normal CI has no such rewrite); it is not baked into the environment because the managed rewrite is what authenticates git push. mise run lint and the bulk of tests are unaffected.

Open in Web Open in Cursor 

Configure a Cloud Agent development environment via .cursor/environment.json
and an idempotent .cursor/install.sh that:

- upgrades git to >= 2.45 when needed (reftable support used by the test suite)
- installs mise and the pinned toolchain (Go 1.26.6, golangci-lint, gotestsum,
  shellcheck, tmux, roger-roger E2E helpers)
- activates mise in interactive shells, downloads Go modules, and builds the CLI

No long-running services are needed, so start/terminals are omitted.

Co-authored-by: Stefan Haubold <Soph@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 24, 2026 15:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Cursor Cloud Agent development environment setup for the Entire CLI, so automated/dev agent sessions start with the expected toolchain installed and the CLI prebuilt.

Changes:

  • Introduces a Cursor environment definition that runs a repo-local install script on environment creation.
  • Adds an install script to (optionally) upgrade git for reftable support, install/activate mise, install pinned tools, download Go modules, and build entire.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.cursor/install.sh Idempotent environment bootstrap: git version gating, mise/toolchain install, module download, and CLI build.
.cursor/environment.json Cursor environment definition that invokes the install script.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .cursor/install.sh Outdated
This repo dogfoods Entire: it commits agent hook configs (.cursor/hooks.json,
etc.) and Entire git hooks that all invoke the bare 'entire' command and no-op
when it is not on PATH. The environment now makes those hooks actually fire.

- Add .cursor/wire-entire-hooks.sh: symlinks the built binary onto PATH
  (/usr/local/bin, falling back to ~/.local/bin) and installs Entire's git
  hooks via 'entire configure --force', restoring .entire/settings.json
  byte-for-byte so the committed file is never churned. Idempotent, best-effort.
- install.sh runs it after building.
- Add .cursor/start.sh (wired as environment.json 'start') to re-run it per
  boot, because Cursor regenerates the git hooksPath on each boot.
Re-applies the environment.json 'start' entry and the install.sh call to
.cursor/wire-entire-hooks.sh (the accompanying commit added the scripts).
Entire installs its own git hooks on the first turn-start hook
(strategy.EnsureSetup reinstalls them when absent, reached via the committed
agent hooks such as Cursor's beforeSubmitPrompt). So the environment only needs
the built 'entire' on PATH for the committed hooks to fire; wiring git hooks
from the environment was redundant.

- install.sh: symlink the built binary onto PATH (/usr/local/bin, fallback
  ~/.local/bin) instead of calling a wiring script.
- Remove .cursor/wire-entire-hooks.sh and .cursor/start.sh; drop 'start' from
  environment.json (no per-boot reconciliation needed).
Checkpoint sync pushes entire/checkpoints refs to the dedicated remote
entireio/cli-checkpoints, but the Cloud Agent's generated GitHub token is
scoped to entireio/cli, so the pre-push checkpoint push is denied (403,
'denied to cursor[bot]'). Add entireio/cli-checkpoints to
repositoryDependencies so the generated token's scope includes it (the Cursor
GitHub app is installed org-wide on entireio).

Entire-Checkpoint: 01M0TQV7RBDJ3G82MGNRNWSQ2R
Address PR review feedback:
- Replace the brittle git version-string parse with a real feature probe
  (git init --ref-format=reftable in a temp dir), matching how the repo's own
  tests detect reftable support. Handles backported/nonstandard version strings
  and a missing git binary (probe returns unsupported, triggering install).
- Use 'apt-get install -y git' instead of '--only-upgrade git' so it also
  installs git on images where it is absent.

Entire-Checkpoint: 01M0TR7PJG8HDKE14Y2Z1HXGYC
@Soph
Soph marked this pull request as ready for review August 24, 2026 20:47
@Soph
Soph requested a review from a team as a code owner August 24, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants