Files
gastown/internal/cmd/formulas.go
gastown/crew/max 5be4255f35 Improve gt mol help and add gt formulas command
- Rewrote gt mol help to focus on agent operations (YOUR hook, YOUR work)
- Removed misleading "use bd mol pour" guidance (gt sling handles this)
- Added gt formulas command as convenience wrapper for bd formula list
- Agents no longer need to know about bd for common workflow operations

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 22:02:45 -08:00

46 lines
1019 B
Go

package cmd
import (
"os"
"os/exec"
"github.com/spf13/cobra"
)
var formulasCmd = &cobra.Command{
Use: "formulas",
Aliases: []string{"formula"},
GroupID: GroupWork,
Short: "List available workflow formulas",
Long: `List available workflow formulas (molecule templates).
Formulas are reusable workflow templates that can be instantiated via:
gt sling mol-xxx target # Pour formula and dispatch
This is a convenience alias for 'bd formula list'.
Examples:
gt formulas # List all formulas
gt formulas --json # JSON output`,
RunE: runFormulas,
}
var formulasJSON bool
func init() {
formulasCmd.Flags().BoolVar(&formulasJSON, "json", false, "Output as JSON")
rootCmd.AddCommand(formulasCmd)
}
func runFormulas(cmd *cobra.Command, args []string) error {
bdArgs := []string{"formula", "list"}
if formulasJSON {
bdArgs = append(bdArgs, "--json")
}
bdCmd := exec.Command("bd", bdArgs...)
bdCmd.Stdout = os.Stdout
bdCmd.Stderr = os.Stderr
return bdCmd.Run()
}