feat(formula): add default formula configuration at rig level (#297)

Allow `gt formula run` to be called without a formula name by configuring
a default in the rig's settings/config.json under workflow.default_formula.

Co-authored-by: Brett VanderVeen <brett.vanderveen@gfs.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Brett VanderVeen
2026-01-10 02:22:45 -05:00
committed by GitHub
parent f90b58bc6d
commit 6016f15da9
3 changed files with 71 additions and 20 deletions

View File

@@ -1227,6 +1227,21 @@ func ExpectedPaneCommands(rc *RuntimeConfig) []string {
return []string{filepath.Base(rc.Command)}
}
// GetDefaultFormula returns the default formula for a rig from settings/config.json.
// Returns empty string if no default is configured.
// rigPath is the path to the rig directory (e.g., ~/gt/gastown).
func GetDefaultFormula(rigPath string) string {
settingsPath := RigSettingsPath(rigPath)
settings, err := LoadRigSettings(settingsPath)
if err != nil {
return ""
}
if settings.Workflow == nil {
return ""
}
return settings.Workflow.DefaultFormula
}
// GetRigPrefix returns the beads prefix for a rig from rigs.json.
// Falls back to "gt" if the rig isn't found or has no prefix configured.
// townRoot is the path to the town directory (e.g., ~/gt).