Remove deprecated builtin molecules infrastructure

- Delete builtin_molecules.go (empty stubs)
- Remove `mol export` command (exported 0 molecules)
- Clean dead code in catalog.go iterating empty BuiltinMolecules()
- Update docs to reference formula files instead of Go code

Molecules are now defined as .beads/formulas/*.formula.json files
and cooked into proto beads via `bd cook`.

🤖 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-25 11:29:27 -08:00
parent 18a4a6a3e1
commit e0a2187636
7 changed files with 15 additions and 99 deletions

View File

@@ -1,28 +0,0 @@
// Package beads provides a wrapper for the bd (beads) CLI.
package beads
// BuiltinMolecule defines a built-in molecule template.
// Deprecated: Molecules are now defined as formula files in .beads/formulas/
// and cooked into proto beads via `bd cook`. This type remains for backward
// compatibility but is no longer used.
type BuiltinMolecule struct {
ID string // Well-known ID (e.g., "mol-engineer-in-box")
Title string
Description string
}
// BuiltinMolecules returns all built-in molecule definitions.
// Deprecated: Molecules are now defined as formula files (.beads/formulas/*.formula.json)
// and cooked into proto beads via `bd cook`. This function returns an empty slice.
// Use `bd cook` to create proto beads from formulas instead.
func BuiltinMolecules() []BuiltinMolecule {
return []BuiltinMolecule{}
}
// SeedBuiltinMolecules is deprecated and does nothing.
// Molecules are now created by cooking formula files with `bd cook`.
// This function remains for backward compatibility with existing installations.
func (b *Beads) SeedBuiltinMolecules() (int, error) {
// No-op: formulas are cooked on-demand, not seeded at install time
return 0, nil
}

View File

@@ -16,15 +16,14 @@ type CatalogMolecule struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Source string `json:"source,omitempty"` // "builtin", "town", "rig", "project"
Source string `json:"source,omitempty"` // "town", "rig", "project"
}
// MoleculeCatalog provides hierarchical molecule template loading.
// It loads molecules from multiple sources in priority order:
// 1. Built-in molecules (shipped with the binary)
// 2. Town-level: <town>/.beads/molecules.jsonl
// 3. Rig-level: <town>/<rig>/.beads/molecules.jsonl
// 4. Project-level: .beads/molecules.jsonl in current directory
// 1. Town-level: <town>/.beads/molecules.jsonl
// 2. Rig-level: <town>/<rig>/.beads/molecules.jsonl
// 3. Project-level: .beads/molecules.jsonl in current directory
//
// Later sources can override earlier ones by ID.
type MoleculeCatalog struct {
@@ -46,21 +45,11 @@ func NewMoleculeCatalog() *MoleculeCatalog {
// - rigPath: Path to the rig directory (e.g., ~/gt/gastown). Empty to skip rig-level.
// - projectPath: Path to the project directory. Empty to skip project-level.
//
// Built-in molecules are always loaded first.
// Molecules are loaded from town, rig, and project levels (no builtin molecules).
func LoadCatalog(townRoot, rigPath, projectPath string) (*MoleculeCatalog, error) {
catalog := NewMoleculeCatalog()
// 1. Load built-in molecules
for _, builtin := range BuiltinMolecules() {
catalog.Add(&CatalogMolecule{
ID: builtin.ID,
Title: builtin.Title,
Description: builtin.Description,
Source: "builtin",
})
}
// 2. Load town-level molecules
// 1. Load town-level molecules
if townRoot != "" {
townMolsPath := filepath.Join(townRoot, ".beads", "molecules.jsonl")
if err := catalog.LoadFromFile(townMolsPath, "town"); err != nil && !os.IsNotExist(err) {
@@ -68,7 +57,7 @@ func LoadCatalog(townRoot, rigPath, projectPath string) (*MoleculeCatalog, error
}
}
// 3. Load rig-level molecules
// 2. Load rig-level molecules
if rigPath != "" {
rigMolsPath := filepath.Join(rigPath, ".beads", "molecules.jsonl")
if err := catalog.LoadFromFile(rigMolsPath, "rig"); err != nil && !os.IsNotExist(err) {
@@ -76,7 +65,7 @@ func LoadCatalog(townRoot, rigPath, projectPath string) (*MoleculeCatalog, error
}
}
// 4. Load project-level molecules
// 3. Load project-level molecules
if projectPath != "" {
projectMolsPath := filepath.Join(projectPath, ".beads", "molecules.jsonl")
if err := catalog.LoadFromFile(projectMolsPath, "project"); err != nil && !os.IsNotExist(err) {
@@ -196,17 +185,3 @@ func (mol *CatalogMolecule) ToIssue() *Issue {
}
}
// ExportBuiltinMolecules writes all built-in molecules to a JSONL file.
// This is useful for creating a base molecules.jsonl file.
func ExportBuiltinMolecules(path string) error {
catalog := NewMoleculeCatalog()
for _, builtin := range BuiltinMolecules() {
catalog.Add(&CatalogMolecule{
ID: builtin.ID,
Title: builtin.Title,
Description: builtin.Description,
Source: "builtin",
})
}
return catalog.SaveToFile(path)
}