✨ feat: cloud setup goes first in a shared Setup script, and says when it drifts

Merged
AT
1mo ago
+156-23

Slice: #51

A Claude cloud environment's Setup field holds one script. With only cloud-setup's output in it, the repo's own setup never ran. Pasted ahead of a repo's own script, its set -euo pipefail and any failure would stop what follows. And the field can install an older release than the repo's workflow pins, with nothing saying so.

  • src/cloud.ts: cloudSetupScript runs the install in a shell of its own, bash <<'PROCESS_RULES' … PROCESS_RULES || echo "<INSTALL_FAILED>" >&2. Its shell options and failures stay inside, and the commands after it run. Its last command, process-rules version, reads /dev/null, because the rest of the heredoc is on standard input. The stderr hint now says: if the repo has its own Setup script, put this first, then the repo's own, because a repo's script may end with exit.
  • src/onboard.ts: the by-hand and later lines use the same wording (SETUP_FIRST).
  • src/session-start.ts: in a cloud session (CLAUDE_CODE_REMOTE=true) it compares the installed CLI's version with the one version .github/workflows/process-rules.yml pins. When they differ it prints a second line naming the fix: print process-rules cloud-setup again from that version and paste it over the process-rules part. This is a warning only. The agent check, the guard's record (still the first line alone) and exit 0 are unchanged. A missing or unreadable workflow, or one that pins several versions or none, gets no line.
  • README (cloud sessions) and docs/decisions.md: the shared Setup field and the drift warning.
  • Tests, written first and failing before the change: the install's own shell, and no set outside it. A real bash run of the script followed by a repo's own echo …; exit 0: the repo's part runs when the install works, when Node's sha256 is wrong (nothing unpacked) and when there is no Node build. The new stderr wording, and onboard's lines. session-start: no line when the versions match, the drift line when they differ (also after a STOP, and the record stays the first line). No line without a workflow, with a workflow that pins none or several, with an unreadable workflow, or outside a repository.

pnpm check passes (903 tests). No version bump or tag: the coordinator releases.

🤖 Generated with Claude Code


Summary by cubic

A Claude cloud environment's Setup field now works when the repo has its own setup script, and a cloud session says when the installed CLI is not the version the repo's workflow pins.

  • The install runs in its own shell, so its set -euo pipefail and a failed download no longer stop the commands after it.
  • cloud-setup, onboard, and the README say to put the script first, then the repo's own, since a repo's script may end with exit.
  • session-start compares the installed CLI with the one version .github/workflows/process-rules.yml pins and, when they differ, prints a second line naming the fix: print process-rules cloud-setup again from that version and paste it over the process-rules part.
  • The drift check is a warning only and says nothing when the workflow is missing, unreadable, or pins no single version.