Guidance for AI coding agents working on the Trusted Setup repository.
This repo contains a bash bootstrap script that prepares developer machines with baseline system tools. It is the first thing a new engineer runs — before any project repo is cloned. Reliability and simplicity are paramount.
setup.sh— Main entry point. Bash only. Detects OS, installs tools idempotently, then runs pending migrations.lib/migrate.sh— Migration runner. Sourced bysetup.sh. Tracks state in~/.local/state/trusted/setup/migrations/.migrations/*.sh— Run-once bash scripts for environment transitions. Named by Unix timestamp.
- All scripts must be bash. No Ruby, Python, or other runtimes. The whole point of this repo is to bootstrap those runtimes — they cannot be assumed to exist.
- Use POSIX-compatible constructs where practical, but bash-specific features (
[[ ]], arrays,set -euo pipefail) are acceptable since bash is the target shell.
- The base setup section in
setup.shmust be fully idempotent. Every tool installation must checkcmd_exists(or equivalent) before attempting to install. - Never assume a tool is missing. Never assume a tool is present. Always check.
- Migrations are for one-time transitions that are not naturally idempotent: removing deprecated tools, renaming config files, changing state directory structure, etc.
- Do NOT put idempotent "ensure X is installed" logic in migrations. That belongs in the base setup section of
setup.sh. - Migration filenames are
<timestamp>_<description>.sh— a Unix timestamp followed by a short snake_case description. Example:1740000000_remove_deprecated_tool.sh. Generate the timestamp withdate +%s. - Migrations are immutable once merged. Never edit a shipped migration. Ship a corrective migration instead.
- Each migration must be self-contained and defensive — check preconditions, don't assume prior state.
- Migrations must work on all supported platforms (macOS, Ubuntu, Arch) or explicitly check the OS and skip gracefully.
Three platforms are supported. All changes must account for all three:
| Platform | Detection | Package manager |
|---|---|---|
| macOS | uname -s = Darwin |
brew |
| Ubuntu/Debian | /etc/os-release ID = ubuntu or debian |
apt-get |
| Arch/Omarchy | /etc/os-release ID = arch, endeavouros, or manjaro |
pacman |
When adding a new tool installation, provide install commands for all three platforms.
This repo installs tool managers, CLI tools, and infrastructure dependencies:
- Package managers (Homebrew, apt, pacman)
- git, gh, mise, op, circleci
- Ruby (latest stable via mise, as global default for
bin/setupscripts) - Node.js (latest LTS via mise, as global default)
- Yarn (via corepack, ships with Node.js)
- Build essentials
- Docker, Docker Compose, Colima (macOS only)
- AWS CLI, AWS VPN Client
- Private registry configuration (Bundler for gems, Yarn for npm scopes)
It does NOT install:
- Python or other runtimes (left to project
bin/setupvia mise) - Project-specific Ruby or Node.js versions (handled by mise +
.mise.toml) - Application dependencies (gems, npm packages)
- Databases, Redis, Elasticsearch, etc.
- Editor configurations or dotfiles
- AWS credentials or VPN profiles
set -euo pipefailis set at the top ofsetup.sh. Do not disable it.- If a migration fails, the runner stops. It does not skip or continue.
- Provide clear error messages with actionable next steps.
doctor.shis a read-only diagnostic script that verifies all tools installed bysetup.share present and working. It never modifies anything.- CI runs on every PR via GitHub Actions (
.github/workflows/ci.yml). - Shellcheck lints all bash scripts (including
doctor.sh). - Setup (Ubuntu) runs
setup.shend-to-end on an Ubuntu runner, then runsdoctor.shto verify. - When adding a new tool to
setup.sh, add a corresponding check indoctor.sh. - Before merging changes, verify the script runs cleanly on at least macOS (the primary dev platform).
shellcheck -x setup.sh doctor.sh lib/*.sh migrations/*.sh ci/mock-op— Lint bash scriptsbash -n setup.sh— Check for syntax errors without executingbash doctor.sh— Run post-setup diagnostic checksdate +%s— Generate a migration timestamp
- Use
fmt_header,fmt_ok, andfmt_installfor user-facing output. - Use
cmd_existsto check for tool presence. - Use
case "$OS"blocks for platform-specific logic. - Keep functions small and focused.
- Comment non-obvious decisions, especially platform-specific workarounds.