✨ feat: onboard sets up cloud sessions, so the Setup script is pasted once

Merged
AT
1mo ago
+594-150

Slice: #51

Builds State #165 of P-22: process-rules onboard sets up a client's Claude cloud sessions, so the owner pastes the cloud environment's Setup script once, and a new release reaches cloud sessions through the pin bump onboard already writes.

Research. Claude Code has no API, CLI or repo file for a cloud environment's Setup script: the cloud environments docs say it is edited in claude.ai's environment dialog alone (/remote-env only picks the default environment). So onboard cannot write the field, and the version moves into a file the repo owns. The docs also say the environment's snapshot is rebuilt only when the Setup script changes or after about a week. A client's own cloud runs found the Setup script runs as root after the clone, from the VM's home, with the clone one folder down.

  • src/cloud.ts: cloudRepoScript(version, sha256) is the repo's .github/process-rules/cloud-setup.sh. It installs Node and the CLI, each checked against its sha256. The CLI's sha256 now comes from GitHub's digest for the release archive; before this change only Node's was checked. A Node already unpacked at its version is kept. Each release unpacks into a folder of its own, so a session that installs a new one doesn't delete the CLI that's running. cloudSetupSnippet() is what cloud-setup now prints: it names no version, and it runs that file in a shell of its own. releaseSha256 reads the digest.
  • src/onboard.ts: writes the file at the pin, in its pull request, on every run. The plan lists it under Pull request. The first time, it also gets a "Claude cloud — by hand, once" group with the one paste. When the release's sha256 can't be read, the plan warns and leaves the file alone. The refusal on a Mac that machine hasn't set up now names what is missing.
  • src/session-start.ts: in a cloud session whose CLI isn't the release the file installs, it runs the file itself and says so, because the snapshot lags. When the file is missing or isn't at the workflow's pin, it says to run onboard again, not to paste again. When the Setup field still holds an older paste (no /opt/process-rules/from-setup mark), it asks for the one paste.
  • src/onboard-pull.ts: CLOUD_SETUP_PATH is added to ONBOARD_FILES, so the work rules still pass an onboard pull request.
  • The Mac: onboard keeps refusing rather than offering machine in its plan. machine asks for the agent's token, pasted hidden, makes and registers the signing key, and asks its own questions. A --yes run, or one with no terminal, can do none of that. The reasons are in docs/decisions.md.
  • README and docs/decisions.md are updated. The version is not bumped; the coordinator does that.

pnpm check: 917 tests pass, 99.33% line coverage.

šŸ¤– Generated with Claude Code


Summary by cubic

onboard now sets up a client's Claude cloud sessions, so the cloud environment's Setup script is pasted once instead of on every release. Claude Code has no API for that field, so the pinned version moves into a repo file onboard writes.

  • onboard writes .github/process-rules/cloud-setup.sh at the version the workflow pins on every run; its plan lists the file and, the first time, the one paste.
  • cloud-setup now prints a snippet naming no version that finds the clone and runs that file; the CLI's download is checked against GitHub's digest for the release archive, as Node's already was.
  • A cloud session-start runs the file itself when the session's CLI is another release (the environment snapshot lags), and its warnings say to run onboard again, not to paste.
  • onboard still refuses a Mac machine has not set up, and now names what is missing.

Migration — Existing clients whose Setup script still holds a versioned paste get one line asking to paste the snippet over it, once; a missing or out-of-pin repo file says to run onboard again.