Repository navigation
feat(install): add cloud.bash for Claude Code cloud environments - #14
Conversation
A cloud environment's setup script can now set ShellTime up with one line:
curl -fsSL https://raw.githubusercontent.com/shelltime/installation/main/cloud.bash | bash
instead of the long block the guide had people paste. The script does the
same thing: installs the Linux CLI and daemon into ~/.shelltime/bin, runs
`shelltime cc install`, and registers a SessionStart hook that signs in with
SHELLTIME_TOKEN and starts the daemon in every session. Fixes now reach an
environment whenever it rebuilds its snapshot.
A setup script that exits non-zero keeps sessions from starting, so an EXIT
trap reports any failure and exits 0, and nothing runs before the final main
call, so a truncated download installs nothing. raw.githubusercontent.com is
on the cloud environments' default allowlist, so no new domain is needed.
CI runs it twice on x86_64 and arm64 Linux and checks the binaries, the OTEL
settings, a single SessionStart hook and a silent hook without a token.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CXwVbjYvMsYbyyrcZnyJYV
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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
☁️ Claude Code cloud · Add reusable Claude Cloud initialization scriptAdded a reusable cloud initialization script for ShellTime and updated CI to test it, using
10.3M tokens: 1.1K input · 45.3K output · 9.9M cache read · 344.8K cache write 📝 AI summaryCreated Updated the script’s environment guard to check that View this session on ShellTime → Updated 2026-10-23 11:13 UTC by ShellTime · totals for the whole session so far · the session page is visible to its owner |
Cloud environments set CLAUDE_CODE_REMOTE=true, and it is never true on a user's own machine (https://code.claude.com/docs/en/cloud-environments). That is the check that matters: run by mistake on a laptop, cloud.bash would swap in Linux binaries and add a SessionStart hook, and a Linux desktop passed the old uname check. The setup script inherits the variable from environment-manager, which runs it. CI now checks that nothing is installed without the variable, and sets it for the real runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CXwVbjYvMsYbyyrcZnyJYV
|
@claude review |
|
Claude finished @AnnatarHe's task in 28s —— View job Review of PR #14:
|
Summary
Until now, tracking Claude Code cloud sessions meant pasting a 60-line block into the cloud environment's setup script. This PR moves that block into this repo as
cloud.bash, so the setup script needs one line:curl -fsSL https://raw.githubusercontent.com/shelltime/installation/main/cloud.bash | bashIt does the same three things the block did:
~/.shelltime/bin, and linksshelltimeinto~/.local/bin.shelltime cc install.~/.shelltime/bin/cloud-session-start.shand registers it as a Claude Code SessionStart hook. Running it again replaces the hook instead of adding a second one. The hook signs in withSHELLTIME_TOKENand starts the daemon in each session. It prints nothing and does nothing when the variable isn't set.Why it's safe to pipe into a setup script
CLAUDE_CODE_REMOTEistrue. Cloud environments set it, and it's never true on your own machine (cloud environments docs). The docs only state this for the session's environment. In a cloud VM I confirmed thatenvironment-manager, which runs the setup script (itssetup_scriptstep), hasCLAUDE_CODE_REMOTE=truebut not the environment's own variables, so the setup script inherits it. Run by mistake on a laptop, the script prints how to use the regular installer and changes nothing.EXITtrap at the top printsShellTime setup failed; sessions will not be trackedand exits 0. That covers every case I tried: a failed download, a syntax error from a truncated file, running outside a cloud environment, and an outer script runningset -euo pipefail. Ifcurlitself fails, bash gets empty input and also exits 0.main "$@"on the last line.raw.githubusercontent.comand the GitHub release hosts are on the cloud environments' default (Trusted) list, which the guide already has users tick.Also in this PR
test-cloudCI job onubuntu-latestandubuntu-24.04-arm. It first checks that nothing is installed withoutCLAUDE_CODE_REMOTE. Then it pipes the script into bash twice withCLAUDE_CODE_REMOTE=trueand checks the binaries, the OTEL env insettings.json, that exactly one SessionStart hook is registered, and that the hook prints nothing without a token.Merge order
Merge this before shelltime/web#721. The guide links to
main/cloud.bash, which only exists once this is merged.Test plan
curl | bash-style run against a throwawayHOMEin a Claude Code cloud VM: binaries installed, OTEL settings written, one hook after two runs, hook prints nothing without a tokenCLAUDE_CODE_REMOTEunset orfalse: exits 0, nothing createdset -euo pipefail. All exit 0 with a messageshellcheck0.11 is clean oncloud.bashand on the embedded hookHOMEtest-cloudCI on x86_64 and arm64🤖 Generated with Claude Code
https://claude.ai/code/session_01CXwVbjYvMsYbyyrcZnyJYV