Add mol-bootstrap molecule for Gas Town installation

Defines a multi-step workflow for bootstrapping a new Gas Town installation:
- locate-harness: Interactive harness location selection
- create-harness: Directory structure creation
- setup-rigs: Rig configuration and cloning
- build-gt: Go binary compilation
- install-paths: PATH configuration
- init-beads: Beads database initialization
- sync-beads: Remote sync and doctor fixes
- verify: Installation verification

Note: Requires bd to support 'molecule' issue type (see gt-qn4l)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-19 18:26:13 -08:00
parent 4cecebd91e
commit 3dca0eb4c9
2 changed files with 523 additions and 346 deletions

View File

@@ -15,6 +15,7 @@ func BuiltinMolecules() []BuiltinMolecule {
QuickFixMolecule(),
ResearchMolecule(),
InstallGoBinaryMolecule(),
BootstrapGasTownMolecule(),
}
}
@@ -123,6 +124,181 @@ gt --version # if version command exists
}
}
// BootstrapGasTownMolecule returns the bootstrap molecule for new Gas Town installations.
// This walks a user through setting up Gas Town from scratch after brew install.
func BootstrapGasTownMolecule() BuiltinMolecule {
return BuiltinMolecule{
ID: "mol-bootstrap",
Title: "Bootstrap Gas Town",
Description: `Complete setup of a new Gas Town installation.
Run this after installing gt and bd via Homebrew. This molecule guides you through
creating a harness, setting up rigs, and configuring your environment.
## Step: locate-harness
Determine where to install the Gas Town harness.
Ask the user for their preferred location. Common choices:
- ~/gt (recommended - short, easy to type)
- ~/gastown
- ~/workspace/gt
Validate the path:
- Must not already exist (or be empty)
- Parent directory must be writable
- Avoid paths with spaces
Store the chosen path for subsequent steps.
## Step: create-harness
Create the harness directory structure.
` + "```" + `bash
mkdir -p {{harness_path}}
cd {{harness_path}}
gt install . --name {{harness_name}}
` + "```" + `
If the user wants to track the harness in git:
` + "```" + `bash
gt git-init --github={{github_repo}} --private
` + "```" + `
The harness now has:
- mayor/ directory
- .beads/ for town-level tracking
- CLAUDE.md for mayor context
Needs: locate-harness
## Step: setup-rigs
Configure which rigs to add to the harness.
Default rigs for Gas Town development:
- gastown (git@github.com:steveyegge/gastown.git)
- beads (git@github.com:steveyegge/beads.git)
For each rig, run:
` + "```" + `bash
gt rig add <name> <git-url> --prefix <prefix>
` + "```" + `
This creates the full rig structure:
- refinery/rig/ (canonical main clone)
- mayor/rig/ (mayor's working clone)
- crew/main/ (default human workspace)
- witness/ (polecat monitor)
- polecats/ (worker directory)
Needs: create-harness
## Step: build-gt
Build the gt binary from source.
` + "```" + `bash
cd {{harness_path}}/gastown/mayor/rig
go build -o gt ./cmd/gt
` + "```" + `
Verify the build succeeded:
` + "```" + `bash
./gt version
` + "```" + `
Needs: setup-rigs
Tier: haiku
## Step: install-paths
Install gt to a location in PATH.
Check if ~/bin or ~/.local/bin is in PATH:
` + "```" + `bash
echo $PATH | tr ':' '\n' | grep -E '(~/bin|~/.local/bin|/home/.*/bin)'
` + "```" + `
Copy the binary:
` + "```" + `bash
mkdir -p ~/bin
cp {{harness_path}}/gastown/mayor/rig/gt ~/bin/gt
` + "```" + `
If ~/bin is not in PATH, add to shell config:
` + "```" + `bash
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc
# or ~/.bashrc for bash users
` + "```" + `
Verify:
` + "```" + `bash
which gt
gt version
` + "```" + `
Needs: build-gt
Tier: haiku
## Step: init-beads
Initialize beads databases in all clones.
For each rig's mayor clone:
` + "```" + `bash
cd {{harness_path}}/<rig>/mayor/rig
bd init --prefix <rig-prefix>
` + "```" + `
For the town-level beads:
` + "```" + `bash
cd {{harness_path}}
bd init --prefix gm
` + "```" + `
Configure sync-branch for multi-clone setups:
` + "```" + `bash
echo "sync-branch: beads-sync" >> .beads/config.yaml
` + "```" + `
Needs: setup-rigs
Tier: haiku
## Step: sync-beads
Sync beads from remotes and fix any issues.
For each initialized beads database:
` + "```" + `bash
bd sync
bd doctor --fix
` + "```" + `
This imports existing issues from JSONL and sets up git hooks.
Needs: init-beads
Tier: haiku
## Step: verify
Verify the installation is complete and working.
Run health checks:
` + "```" + `bash
gt status # Should show rigs with crew/refinery/mayor
gt doctor # Check for issues
bd list # Should show issues from synced beads
` + "```" + `
Test spawning capability (dry run):
` + "```" + `bash
gt spawn --help
` + "```" + `
Print summary:
- Harness location
- Installed rigs
- gt version
- bd version
Needs: sync-beads, install-paths`,
}
}
// SeedBuiltinMolecules creates all built-in molecules in the beads database.
// It skips molecules that already exist (by title match).
// Returns the number of molecules created.