Merge remote-tracking branch 'origin/polecat/Doof'

This commit is contained in:
Steve Yegge
2025-12-19 17:42:05 -08:00
9 changed files with 1230 additions and 346 deletions

View File

@@ -14,6 +14,7 @@ func BuiltinMolecules() []BuiltinMolecule {
EngineerInBoxMolecule(),
QuickFixMolecule(),
ResearchMolecule(),
InstallGoBinaryMolecule(),
}
}
@@ -97,6 +98,31 @@ Needs: investigate`,
}
}
// InstallGoBinaryMolecule returns the install-go-binary molecule definition.
// This is a single step to rebuild and install the gt binary after code changes.
func InstallGoBinaryMolecule() BuiltinMolecule {
return BuiltinMolecule{
ID: "mol-install-go-binary",
Title: "Install Go Binary",
Description: `Single step to rebuild and install the gt binary after code changes.
## Step: install
Build and install the gt binary locally.
Run from the rig directory:
` + "```" + `
go build -o gt ./cmd/gt
go install ./cmd/gt
` + "```" + `
Verify the installed binary is updated:
` + "```" + `
which gt
gt --version # if version command exists
` + "```",
}
}
// 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.

View File

@@ -5,8 +5,8 @@ import "testing"
func TestBuiltinMolecules(t *testing.T) {
molecules := BuiltinMolecules()
if len(molecules) != 3 {
t.Errorf("expected 3 built-in molecules, got %d", len(molecules))
if len(molecules) != 4 {
t.Errorf("expected 4 built-in molecules, got %d", len(molecules))
}
// Verify each molecule can be parsed and validated
@@ -141,3 +141,34 @@ func TestResearchMolecule(t *testing.T) {
t.Errorf("document should need investigate, got %v", steps[1].Needs)
}
}
func TestInstallGoBinaryMolecule(t *testing.T) {
mol := InstallGoBinaryMolecule()
if mol.ID != "mol-install-go-binary" {
t.Errorf("expected ID 'mol-install-go-binary', got %q", mol.ID)
}
if mol.Title != "Install Go Binary" {
t.Errorf("expected Title 'Install Go Binary', got %q", mol.Title)
}
steps, err := ParseMoleculeSteps(mol.Description)
if err != nil {
t.Fatalf("failed to parse: %v", err)
}
// Should have 1 step: install
if len(steps) != 1 {
t.Errorf("expected 1 step, got %d", len(steps))
}
if steps[0].Ref != "install" {
t.Errorf("expected ref 'install', got %q", steps[0].Ref)
}
// install has no deps
if len(steps[0].Needs) != 0 {
t.Errorf("install should have no deps, got %v", steps[0].Needs)
}
}