Fix: Unknown subcommands now error instead of silently showing help

Parent commands (mol, mail, crew, polecat, etc.) previously showed help
and exited 0 for unknown subcommands like "gt mol foobar". This masked
errors in scripts and confused users.

Added requireSubcommand() helper to root.go and applied it to all parent
commands. Now unknown subcommands properly error with exit code 1.

Example before: gt mol unhook → shows help, exits 0
Example after:  gt mol unhook → "Error: unknown command "unhook"", exits 1

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gastown/crew/joe
2025-12-30 20:52:23 -08:00
committed by Steve Yegge
parent 3d09c679e2
commit df46e75a51
16 changed files with 29 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ var moleculeCmd = &cobra.Command{
Aliases: []string{"molecule"},
GroupID: GroupWork,
Short: "Agent molecule workflow commands",
RunE: requireSubcommand,
Long: `Agent-specific molecule workflow operations.
These commands operate on the current agent's hook and attached molecules.
@@ -204,6 +205,7 @@ a permanent (but compact) record.`,
var moleculeStepCmd = &cobra.Command{
Use: "step",
Short: "Molecule step operations",
RunE: requireSubcommand,
Long: `Commands for working with molecule steps.
A molecule is a DAG of steps. Each step is a beads issue with the molecule root