Skip to content

Add utilities module with bootstrap TUI, style guide and agent guidance - #41

Open
bmorton wants to merge 1 commit into
mainfrom
bmorton/bootstrap-utility
Open

bmorton wants to merge 1 commit into
mainfrom
bmorton/bootstrap-utility

Conversation

@bmorton

@bmorton bmorton commented Oct 30, 2026

Copy link
Copy Markdown
Owner

What

A new utilities/ Go module for in-container terminal tools, compiled into the image and installed to /usr/local/bin, plus the first tool: bootstrap.

bootstrap

A Bubble Tea v2 TUI that checks and steps through the setup an image cannot bake in:

Step Check Fix (enter)
Toolchain mise ls --missing empty mise install
Git identity GIT_AUTHOR_* or git config --global user.* in-TUI huh form → writes git config
GitHub CLI gh auth status gh auth login
Git credential helper gh is the helper and its path exists (catches the stale /usr/bin/gh from the old image) gh auth setup-git
Claude Code claude auth status --json claude auth login
Copilot CLI (optional) token env vars copilot login --device-code (unverifiable, recorded on clean exit)
opencode (optional) opencode auth list opencode auth login
pi (optional) pi auth check --provider … --json per configured provider launches pi with a /login note
Namespace (optional) nsc auth check-login nsc login
Azure (optional) az account show az login --use-device-code

Checks run concurrently with timeouts; interactive fixes hand the terminal over via tea.ExecProcess and are re-checked afterwards. bootstrap --check prints the same report non-interactively (also chosen automatically off-TTY) and exits 1 while required steps are outstanding; postCreateCommand runs it so the report lands in the creation log.

Screenshot (captured via tmux, colors stripped):

  ⟫  B O O T S T R A P
  Finish wiring this devcontainer: identity, logins and tooling.
  ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌
  ALL SYSTEMS ONLINE  optional steps below if you want them
    ✓ Toolchain  all pinned tools installed
    ✓ Git identity  Brian Morton <…>
  ▌ ✓ GitHub CLI  logged in to github.com as bmorton
    ✓ Git credential helper  gh handles github.com credentials
    ✓ Claude Code  logged in (… via claude.ai)
    ○ GitHub Copilot CLI optional  no token in environment; stored login unverified
    ○ opencode optional  no providers authenticated
    ○ pi optional  configured providers are not ready: synthetic
    ✓ Namespace (nsc) optional  authenticated
    ○ Azure CLI optional  not logged in
  ╭──────────────────────────────────────────────────────────────────────╮
  │  ◆ GitHub CLI                                                        │
  │  gh is authenticated; it also feeds credentials to git and the …     │
  │  ✓ nothing to do                                                     │
  ╰──────────────────────────────────────────────────────────────────────╯
   ↑↓  move   enter  fix   r  re-check   q  quit

Patterns for the next utilities

  • cmd/<tool>/main.go is flags only → internal/<tool>.Run(Options) int.
  • internal/ui/theme is the only place hex colors live (neon cyberpunk palette, glyph set, shared styles, theme.Huh() form theme).
  • internal/sh runner interface + FakeRunner; every step has unit tests, and a headless model test drives Update/View without a terminal.
  • utilities/STYLEGUIDE.md (palette, glyphs, layout, behaviour, copy) and utilities/AGENTS.md (+ CLAUDE.md import) are the contract for agents. A root AGENTS.md captures the repo-level lessons (feature-free image, mise, login-shell PATH, how to validate).

Build wiring

  • devcontainer.json build.context → repo root (envbuilder supports it) with a .dockerignore allowlist; Dockerfile COPY paths are now repo-relative. CI builds with docker build -f .devcontainer/Dockerfile ..
  • Dockerfile compiles ./cmd/... with the mise-managed Go as node (module cache in node-owned /go), then installs binaries to /usr/local/bin.
  • New CI job for the Go module (gofmt, vet, test, build); Dependabot gomod for /utilities; verify script checks bootstrap --version.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AihTX41wWUjfBk3c2A9h2Z

utilities/ is a Go module of in-container terminal tools built into the image
and installed to /usr/local/bin. The first is `bootstrap`, a Bubble Tea v2 app
that checks and walks through the setup an image cannot bake in: mise tool
health, git identity (in-TUI huh form), GitHub CLI login and git credential
helper (flags stale helper paths from the old image), Claude Code login, and
optional Copilot, opencode, pi, Namespace and Azure logins. Interactive fixes
run the tool's own login command via tea.ExecProcess and are re-checked.
`bootstrap --check` (used automatically off-TTY and in postCreateCommand)
prints the same report and exits 1 while required steps are outstanding.

Patterns for future utilities: thin cmd/<tool> → internal/<tool>, shared
internal/ui/theme (single home for the neon cyberpunk palette, glyphs, huh
theme), internal/sh runner with a FakeRunner for tests, headless model tests.
utilities/STYLEGUIDE.md and utilities/AGENTS.md (+CLAUDE.md) document the
contract; a root AGENTS.md captures the repo-level rules learned so far.

Build wiring: devcontainer.json build.context is now the repo root (with a
.dockerignore allowlist) so the Dockerfile can COPY utilities/ and compile it
with the mise-managed Go as node; binaries are installed system-wide. CI gains
a Go job (gofmt, vet, test, build), Dependabot gets gomod for /utilities, and
the verify script checks `bootstrap --version` via the shims and login shells.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AihTX41wWUjfBk3c2A9h2Z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant