From 94a6784c1e512360fd201a27e780075fb822048b Mon Sep 17 00:00:00 2001 From: gastown/crew/max Date: Tue, 30 Dec 2025 21:48:14 -0800 Subject: [PATCH] Add gt hook status alias for gt mol status MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Makes 'gt hook' (no args) show hook status instead of requiring a bead ID. Also adds 'gt hook status' subcommand for explicit usage. The hook concept is user-facing while molecules are implementation details. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- internal/cmd/hook.go | 53 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/internal/cmd/hook.go b/internal/cmd/hook.go index 79f85835..5b72e0d0 100644 --- a/internal/cmd/hook.go +++ b/internal/cmd/hook.go @@ -12,31 +12,47 @@ import ( ) var hookCmd = &cobra.Command{ - Use: "hook ", + Use: "hook [bead-id]", GroupID: GroupWork, - Short: "Attach work to your hook (durable across restarts)", - Long: `Attach a bead (issue) to your hook for durable work tracking. + Short: "Show or attach work on your hook", + Long: `Show what's on your hook, or attach new work. + +With no arguments, shows your current hook status (alias for 'gt mol status'). +With a bead ID, attaches that work to your hook. The hook is the "durability primitive" - work on your hook survives session restarts, context compaction, and handoffs. When you restart (via gt handoff), your SessionStart hook finds the attached work and you continue from where you left off. -This is "assign without action" - use gt sling to also start immediately, -or gt handoff to hook and restart with fresh context. - Examples: + gt hook # Show what's on my hook + gt hook status # Same as above gt hook gt-abc # Attach issue gt-abc to your hook gt hook gt-abc -s "Fix the bug" # With subject for handoff mail - gt hook gt-abc -m "Check tests" # With context message Related commands: - gt mol status # See what's on your hook gt sling # Hook + start now (keep context) gt handoff # Hook + restart (fresh context) - gt nudge # Send message to trigger execution`, - Args: cobra.ExactArgs(1), - RunE: runHook, + gt unsling # Remove work from hook`, + Args: cobra.MaximumNArgs(1), + RunE: runHookOrStatus, +} + +// hookStatusCmd shows hook status (alias for mol status) +var hookStatusCmd = &cobra.Command{ + Use: "status [target]", + Short: "Show what's on your hook", + Long: `Show what's slung on your hook. + +This is an alias for 'gt mol status'. Shows what work is currently +attached to your hook, along with progress information. + +Examples: + gt hook status # Show my hook + gt hook status greenplace/nux # Show nux's hook`, + Args: cobra.MaximumNArgs(1), + RunE: runMoleculeStatus, } var ( @@ -51,9 +67,24 @@ func init() { hookCmd.Flags().StringVarP(&hookMessage, "message", "m", "", "Message for handoff mail (optional)") hookCmd.Flags().BoolVarP(&hookDryRun, "dry-run", "n", false, "Show what would be done") hookCmd.Flags().BoolVarP(&hookForce, "force", "f", false, "Replace existing incomplete pinned bead") + + // Add status subcommand (shares --json flag with mol status) + hookStatusCmd.Flags().BoolVar(&moleculeJSON, "json", false, "Output as JSON") + hookCmd.AddCommand(hookStatusCmd) + rootCmd.AddCommand(hookCmd) } +// runHookOrStatus dispatches to status or hook based on args +func runHookOrStatus(cmd *cobra.Command, args []string) error { + if len(args) == 0 { + // No args - show status + return runMoleculeStatus(cmd, args) + } + // Has arg - attach work + return runHook(cmd, args) +} + func runHook(cmd *cobra.Command, args []string) error { beadID := args[0]