This repository bootstraps a personal coding-agent command-line environment in every new GitHub Codespace, independently of the repository opened in that Codespace. It installs:
- OpenAI Codex CLI from the official
@openai/codexnpm package; - Google Antigravity CLI using Google's official CLI install script;
- OpenCode with its official install script and an OpenRouter configuration that reads
OPENROUTER_API_KEYfrom the environment; - Cursor CLI using Cursor's official install script, which links the
agentcommand into$HOME/.local/bin; - everyday shell, git, and editor defaults for the Codespace you are working in.
The Antigravity installer uses Google's current CLI endpoint, https://antigravity.google/cli/install.sh. This replaces the repository's earlier Gemini CLI fallback; no npm package name is inferred for Antigravity.
install.sh also applies a set of defaults that only exist in the Codespace, so you do not have to reconfigure each one:
~/.bashrcgains a marker-delimited block that puts$HOME/.opencode/bin,$HOME/.local/bin, and$HOME/binback onPATHfor new terminals, raises history to 100,000 entries, switches history to append mode so two terminals do not clobber each other, and adds aliases (gs,gd,gl,gp,gco,gcm,gca,la,ll,..,...,..3) plusmkcdandgitbranch. It deliberately does not overridePS1, because the Codespaces prompt already carries useful remote context.~/.gitconfiggains an[include]pointing atconfig/git/gitconfigin this repository, which setsinit.defaultBranch=main,pull.rebase=true,push.autoSetupRemote=true,fetch.prune=true,fetch.pruneTags=true, andrerere.enabled=true.- VS Code gets machine settings at
~/.vscode-server/data/Machine/settings.jsonwith a 14px editor font, 1.5 line height, format-on-save, trimmed whitespace, and a 13px terminal font. This is a per-user path, so it applies to every Codespace without a.devcontainerin each project.
~/.bashrc and ~/.gitconfig are not replaced. Each install writes a single block between these markers:
# >>> dotfiles managed block >>>
# <<< dotfiles managed block <<<
Everything outside the markers is preserved byte for byte, so rerunning install.sh refreshes the repository-owned settings and keeps your own edits. The block is always appended last, which means keys you add yourself with git config --global user.name land after it and survive every rerun.
Keep edits outside the markers. Anything inside them is overwritten on the next run.
Your original ~/.bashrc and ~/.gitconfig are copied to ~/.bashrc.pre-dotfiles and ~/.gitconfig.pre-dotfiles once, before the first modification.
Author identity is deliberately not committed to this public repository. Set it once per Codespace:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"install.sh and scripts/doctor.sh both warn when it is unset, because an unset identity makes git commit prompt — or fail outright — partway through a class.
GitHub can clone a selected public or private dotfiles repository into each new Codespace and run a recognized setup script such as install.sh. This does not require .devcontainer changes in each project. See GitHub's Codespaces dotfiles documentation.
- On GitHub, open Settings → Codespaces.
- Under Dotfiles, select Automatically install dotfiles.
- Choose this repository and save the setting.
- Create a new Codespace for an authorized repository. Dotfiles setup runs during creation; existing Codespaces are not retroactively rebuilt.
The installer only writes beneath the user's home/configuration directories. It determines this repository's location from the script itself and never edits the checked-out project.
- Create an OpenRouter API key in your OpenRouter account.
- On GitHub, open Settings → Codespaces → Secrets → New secret.
- Name it exactly
OPENROUTER_API_KEYand paste the key as its value. - Grant the secret access to every repository where it should be available (or select all repositories if that matches your security policy).
- Create a new Codespace, or restart an existing one after changing secret access.
The committed OpenCode config contains only {env:OPENROUTER_API_KEY}. During startup OpenCode resolves that expression from the environment; the installer neither prints nor writes the secret. If a user config already exists at ${XDG_CONFIG_HOME:-~/.config}/opencode/opencode.json, installation preserves it and prints instructions instead of overwriting it.
- Codex: run
codexand follow its supported ChatGPT or API-key authentication flow. Provisioning never launches login. - Antigravity: run
agyand follow Google's authentication flow. Provisioning never launches an interactive login or writes credentials to this repository. - OpenCode/OpenRouter: no
/connectis needed when the Codespaces secret is available. If it is absent, add the secret as described above and recreate/restart the Codespace. - Cursor: run
agent login, or setCURSOR_API_KEYas a Codespaces secret. Provisioning never launches login or writes credentials to this repository.
No OAuth sessions, API keys, auth.json files, or authentication caches belong in this repository.
The best end-to-end test is a brand-new Codespace for a repository with no .devcontainer. In its terminal, run:
command -v codex && codex --version
command -v agy && agy --version
command -v opencode && opencode --version
command -v agent && agent --version
test -n "${OPENROUTER_API_KEY:-}" && echo 'OpenRouter secret available' || echo 'OpenRouter secret missing'For a single read-only health check with actionable output, run:
bash scripts/doctor.shThe doctor checks prerequisites, executable paths and version commands, the OpenCode configuration, the managed blocks in ~/.bashrc and ~/.gitconfig, whether the git author identity is set, whether VS Code machine settings exist, whether gh is authenticated, and whether the OpenRouter secret is present. It never prints the secret value.
Repository checks can be run without installing or authenticating any agent CLI:
bash -n install.sh scripts/*.sh tests/*.sh
shellcheck install.sh scripts/*.sh tests/*.sh
python3 -m json.tool config/opencode/opencode.json >/dev/null
python3 -m json.tool config/vscode/settings.json >/dev/null
bash tests/test-install.shThe mocked test suite covers rerun idempotency, agy and agent detection, dependency and download failures, existing-config preservation, doctor health checks, secret non-disclosure, managed-block idempotency, preservation of pre-existing ~/.bashrc and ~/.gitconfig content, and preservation of existing VS Code settings. GitHub Actions runs the same checks on every push and pull request.
To rerun setup manually from the dotfiles clone, locate it and execute its installer. GitHub commonly places the clone in its Codespaces persisted-share area, but the exact location is implementation-managed; this portable command finds the script without touching the project:
find /workspaces/.codespaces -path '*/dotfiles/install.sh' -type f -exec bash {} \;Running ./install.sh from a manual clone is also supported. Existing commands and the existing OpenCode link are detected, making reruns safe.
The bootstrap skips tools already on PATH so routine shell starts stay fast. To update explicitly using each project's official channel:
npm install --global @openai/codex
curl -fsSL https://antigravity.google/cli/install.sh | bash
curl --proto '=https' --tlsv1.2 -fsSL https://opencode.ai/install | bash
agent updateA newly created disposable Codespace receives the current release available from those channels at creation time.
- Treat this repository as public: store credentials only in GitHub Codespaces secrets or the tools' interactive user-level stores.
- Limit
OPENROUTER_API_KEYrepository access to repositories that genuinely need it. A Codespace and code running inside it can read secrets authorized for that repository. - Review third-party install scripts before use if your threat model requires pinning. This setup intentionally follows OpenCode's current official rolling installer.
- Never commit
.env, private keys, agent state, or home-directory configuration dumps..gitignoreprovides defense in depth, but it is not a substitute for checking commits.
- A command is missing: rerun
install.shand read the component-specific error. Node/npm is required for Codex;curlis required for Antigravity, OpenCode, and Cursor CLI. Standard Codespaces images provide these prerequisites. - A global npm permission error occurs: use the Codespaces image's user-managed Node installation rather than
sudo; do not install agent CLIs as root. opencodeis installed but not found in an old shell: start a new shell or add$HOME/.opencode/binto that shell'sPATH. The root installer includes it while validating.- A CLI worked during install but is missing in a new terminal: the installers only set
PATHfor their own process. The managed block in~/.bashrcrestores it; runsource ~/.bashrcor reruninstall.shif the block is gone. git commitprompts for a name and email: author identity is never committed here. Run the twogit config --globalcommands in Set your git identity.- VS Code settings did not apply: if
~/.vscode-server/data/Machine/settings.jsonalready existed, installation left it untouched. Mergeconfig/vscode/settings.jsoninto it by hand, or delete it and reruninstall.sh. - A personal edit disappeared: edits inside the managed-block markers are overwritten on every run. Move them below the closing marker. The pre-dotfiles copies
~/.bashrc.pre-dotfilesand~/.gitconfig.pre-dotfileshold the originals. ghis not authenticated: rungh auth login. Codespaces normally pre-authenticates it, and an expired session blocksgit push.- OpenRouter is not authenticated: confirm
printenv OPENROUTER_API_KEY >/dev/nullsucceeds (do not print the value), confirm the secret is authorized for the current repository, and restart or recreate the Codespace. - OpenCode says config already exists: merge the
provider.openrouter.options.apiKeysetting fromconfig/opencode/opencode.jsoninto the existing file. The installer intentionally will not destroy personal configuration. - Dotfiles did not run: verify the repository selection under GitHub Settings, inspect Codespace creation logs, and test with a newly created Codespace.
.
├── .github/workflows/test.yml
├── install.sh
├── README.md
├── config/
│ ├── git/gitconfig
│ ├── opencode/opencode.json
│ ├── shell/dotfiles.bash
│ └── vscode/settings.json
├── scripts/
│ ├── doctor.sh
│ ├── install-antigravity.sh
│ ├── install-codex.sh
│ ├── install-cursor.sh
│ ├── install-opencode.sh
│ ├── install-shell.sh
│ └── lib-managed-block.sh
└── tests/
└── test-install.sh
For a Codespace with the SSH server feature enabled (for example, ghcr.io/devcontainers/features/sshd:1), these optional scripts let its ADB client talk to the ADB server on your Windows laptop. They do not expose ADB on a public Codespaces port.
On Windows PowerShell, with GitHub CLI authenticated and Android SDK Platform-Tools on PATH:
gh codespace list
pwsh -File ./scripts/start-codespace-adb-tunnel.ps1 -Codespace YOUR_CODESPACE_NAMERun the PowerShell script from a local checkout of this dotfiles repository. Keep that terminal open; press Ctrl+C to stop the tunnel. It generates a temporary SSH configuration and removes it on exit.
Inside the Codespace, install the lightweight ADB client if needed, then check the tunnel:
sudo apt-get update && sudo apt-get install -y adb
bash scripts/check-codespace-adb.sh
export ADB_SERVER_SOCKET=tcp:127.0.0.1:15037
adb devices -lThe check script path above is relative to a checkout of this dotfiles repository inside the Codespace; alternatively invoke it using its full path. An empty device list is normal until a device is connected to the Windows ADB server. Pair the phone on Windows with the owner's permission, and disable/revoke wireless debugging when finished. The tunnel requires your Windows computer and SSH process to remain running.
Security: ADB grants powerful device access. Use only authorized test devices, keep the forwarded socket on 127.0.0.1, and never commit SSH keys, pairing codes, or device credentials. The scripts do not install SSHD or make a Codespace's devcontainer changes for you. Agent-device integration must be tested separately.
The Codespaces dotfiles installer runs in Linux and cannot install tools on your Windows laptop. On a Windows machine, download the standalone PowerShell bootstrap and review it before running:
Invoke-WebRequest https://raw.githubusercontent.com/aoyn1xw/dotfiles/main/scripts/setup-windows-codespaces-adb.ps1 -OutFile "$env:TEMP\\setup-windows-codespaces-adb.ps1"
& "$env:TEMP\\setup-windows-codespaces-adb.ps1"The bootstrap installs portable GitHub CLI and ADB in %LOCALAPPDATA%\\CodespacesAdbTools\\bin, adds that folder to the current user's PATH, and checks whether ssh.exe is already available. It skips tools already installed, does not need elevation, and does not install an SSH server on Windows. It downloads official GitHub CLI release ZIPs and Google's Android Platform-Tools ZIP. It does not authenticate, pair devices, or start a tunnel. A managed school laptop may block unsigned scripts or executable downloads through organizational policy.
Then run gh auth login and, if required, gh auth refresh -h github.com -s codespace. Clone this dotfiles repository locally and run scripts/start-codespace-adb-tunnel.ps1 to start the bridge.