fix: bd cook now looks up formula names from registry (bd-hp8g)

bd cook previously treated its argument as a file path only. Now it first
tries to load by name from the formula registry (.beads/formulas/), and
only falls back to parsing as a file path if that fails.

This enables commands like `bd cook beads-release` to work without
specifying the full path to the formula file.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
beads/polecats/jade
2025-12-30 22:05:52 -08:00
committed by Steve Yegge
parent 23be8684bd
commit 44853d1690

View File

@@ -151,14 +151,20 @@ func parseCookFlags(cmd *cobra.Command, args []string) (*cookFlags, error) {
}, nil
}
// loadAndResolveFormula parses a formula file and applies all transformations
// loadAndResolveFormula parses a formula file and applies all transformations.
// It first tries to load by name from the formula registry (.beads/formulas/),
// and falls back to parsing as a file path if that fails.
func loadAndResolveFormula(formulaPath string, searchPaths []string) (*formula.Formula, error) {
parser := formula.NewParser(searchPaths...)
// Parse the formula file
f, err := parser.ParseFile(formulaPath)
// Try to load by name first (from .beads/formulas/ registry)
f, err := parser.LoadByName(formulaPath)
if err != nil {
return nil, fmt.Errorf("parsing formula: %w", err)
// Fall back to parsing as a file path
f, err = parser.ParseFile(formulaPath)
if err != nil {
return nil, fmt.Errorf("parsing formula: %w", err)
}
}
// Resolve inheritance