|
| 1 | +--- |
| 2 | +name: change-the-image |
| 3 | +description: Add, upgrade or remove a tool in the sandbox image, or change its layout. Covers where versions live, both architectures, the Lima VM that provision.sh also provisions, what fctl and derived images rely on, the image's size, and verifying a change with a local build or the pull request's Image workflow. Use for any change to Dockerfile, provision.sh or check.sh. |
| 4 | +--- |
| 5 | + |
| 6 | +# Changing the image |
| 7 | + |
| 8 | +- `provision.sh` installs everything, as root; the Dockerfile only runs it |
| 9 | + and sets the user and the PATH. The versions are at the top, as |
| 10 | + `NAME="${NAME:-default}"`, so a build can override one. |
| 11 | +- `check.sh` is the layout fctl and images built `FROM` this one rely on, |
| 12 | + checked in every build. |
| 13 | +- README.md lists the tools with their versions, and the layout. |
| 14 | + |
| 15 | +## Adding or upgrading a tool |
| 16 | + |
| 17 | +1. **Install it in `provision.sh`.** Prefer Debian's package: add it to the |
| 18 | + `apt-get install` list. Otherwise use the project's own installer or |
| 19 | + release archive, with the version pinned at the top of the script, and |
| 20 | + check the download against the checksum the project publishes, when it |
| 21 | + publishes one. A toolchain agents extend (more versions, targets, global |
| 22 | + tools) goes in the agent's home through `as_agent`, like rustup and Bun; |
| 23 | + anything else system-wide. |
| 24 | +2. **Make it work from the PATH alone.** fctl-agent passes Claude the PATH, |
| 25 | + HOME and the locale, nothing else from the image. A tool that needs an |
| 26 | + environment variable gets a wrapper or a config file instead. A new PATH |
| 27 | + entry is a layout change (below). |
| 28 | +3. **Check for it.** Add the command to `check.sh`'s list of tools, and to |
| 29 | + the `--version` runs when it could be there but broken (a proxy without |
| 30 | + its toolchain). |
| 31 | +4. **List it** in README.md's "What's inside", with its version. |
| 32 | +5. **Say what it costs.** The Image workflow's summary lists each |
| 33 | + architecture's size; put the difference in the pull request. |
| 34 | + |
| 35 | +An upgrade changes the version at the top of `provision.sh` and in README.md. |
| 36 | +Rust follows fctl's `rust-toolchain.toml`; Claude Code and fctl aren't pinned |
| 37 | +here (the workflow passes the versions it builds with). |
| 38 | + |
| 39 | +Removing a tool breaks images and sessions that use it: a breaking change |
| 40 | +(the `commit` skill) with a reason. |
| 41 | + |
| 42 | +## What bites |
| 43 | + |
| 44 | +- **Two architectures.** Every download works on amd64 and arm64: pick the |
| 45 | + file with `dpkg --print-architecture` (`amd64`, `arm64`) or `uname -m` |
| 46 | + (`x86_64`, `aarch64`). |
| 47 | +- **The Lima VM.** fctl's Lima driver runs `provision.sh` in a Debian 12 VM |
| 48 | + (Lima's cloud image, not `bookworm-slim`) as root, with `AGENT_USER` set |
| 49 | + to the VM's user, who already exists and may not be uid 1000. Use |
| 50 | + `$AGENT_USER` and `$AGENT_HOME`, never `agent` or `/home/agent`, and don't |
| 51 | + rely on what only the Dockerfile sets. |
| 52 | +- **Login shells.** Setup scripts and the Lima driver run `bash -l`, which |
| 53 | + reads `/etc/profile.d/fctl.sh`. Keep its PATH and the Dockerfile's |
| 54 | + `ENV PATH` the same. |
| 55 | +- **apt's lists** are removed after the first installs; a later |
| 56 | + `apt-get install` needs its own `apt-get update` and cleanup. |
| 57 | +- **Python is externally managed.** No `pip install` into the system: use |
| 58 | + `uv tool install` (as the agent) or a Debian package. |
| 59 | +- **No auto-updates and no daemons.** fctl turns off Claude Code's |
| 60 | + auto-updater, and sessions start only fctl-agent; a tool that expects a |
| 61 | + service running won't find one. |
| 62 | + |
| 63 | +## Changing the layout |
| 64 | + |
| 65 | +The user, its home, `~/workspace`, `/opt/fctl/bin` and the PATH are an |
| 66 | +interface: installed fctl hosts and images built `FROM` this one rely on |
| 67 | +them. Look for a way that keeps them first. If there is none: |
| 68 | + |
| 69 | +1. Make it a breaking change (`feat!:` with a `BREAKING CHANGE:` paragraph). |
| 70 | +2. Change `check.sh` and README.md's Layout with it. |
| 71 | +3. Change fctl's Sandbox images page (`docs/sandbox-images.md` in |
| 72 | + hyperstructure/fctl) to match, and fctl itself when hosts must adapt, |
| 73 | + released before this merges. An fctl session's token covers only its own |
| 74 | + repository: name what hyperstructure/fctl needs, and tell the person. |
| 75 | + |
| 76 | +The newest fctl release's tag is rebuilt from `main`, so its hosts get the |
| 77 | +change the next time they pull the image. |
| 78 | + |
| 79 | +## Verifying |
| 80 | + |
| 81 | +- **With Docker:** `docker build -t sandbox:dev .`, then |
| 82 | + `docker run --rm -i sandbox:dev sh -s < check.sh`, and try the tool: |
| 83 | + `docker run --rm sandbox:dev bash -lc 'psql --version'`. Add |
| 84 | + `--platform linux/amd64` (or `arm64`) to try the other architecture under |
| 85 | + emulation, slowly. |
| 86 | +- **In an fctl session** (no Docker): open the pull request. The Image |
| 87 | + workflow builds both architectures with the latest fctl and Claude Code |
| 88 | + and runs `check.sh` in each: `gh pr checks N --watch --fail-fast`, then |
| 89 | + the run's summary for the sizes. |
| 90 | +- **With fctl:** on a host, `docker build -t sandbox:dev .` and set it as a |
| 91 | + project's image (Settings → Sandbox → Image), or |
| 92 | + `fctl host image build --source .` from a checkout, which builds it under |
| 93 | + the host's image name (with Lima: provisions the base VM). Then start a |
| 94 | + session and use the tool. |
0 commit comments