feat(cli): add 'gt show' command for inspecting beads
Desire path: agents naturally try 'gt show <id>' to inspect beads. This wraps 'bd show' via syscall.Exec, passing all flags through. - Works with any prefix (gt-, bd-, hq-, etc.) - Routes to correct beads database automatically - DisableFlagParsing passes all flags to bd show Closes gt-82jxwx Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
39185f8d00
commit
618b0d9810
57
internal/cmd/show.go
Normal file
57
internal/cmd/show.go
Normal file
@@ -0,0 +1,57 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"syscall"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
showCmd.GroupID = GroupWork
|
||||
rootCmd.AddCommand(showCmd)
|
||||
}
|
||||
|
||||
var showCmd = &cobra.Command{
|
||||
Use: "show <bead-id> [flags]",
|
||||
Short: "Show details of a bead",
|
||||
Long: `Displays the full details of a bead by ID.
|
||||
|
||||
Delegates to 'bd show' - all bd show flags are supported.
|
||||
Works with any bead prefix (gt-, bd-, hq-, etc.) and routes
|
||||
to the correct beads database automatically.
|
||||
|
||||
Examples:
|
||||
gt show gt-abc123 # Show a gastown issue
|
||||
gt show hq-xyz789 # Show a town-level bead (convoy, mail, etc.)
|
||||
gt show bd-def456 # Show a beads issue
|
||||
gt show gt-abc123 --json # Output as JSON
|
||||
gt show gt-abc123 -v # Verbose output`,
|
||||
DisableFlagParsing: true, // Pass all flags through to bd show
|
||||
RunE: runShow,
|
||||
}
|
||||
|
||||
func runShow(cmd *cobra.Command, args []string) error {
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("bead ID required\n\nUsage: gt show <bead-id> [flags]")
|
||||
}
|
||||
|
||||
return execBdShow(args)
|
||||
}
|
||||
|
||||
// execBdShow replaces the current process with 'bd show'.
|
||||
func execBdShow(args []string) error {
|
||||
bdPath, err := exec.LookPath("bd")
|
||||
if err != nil {
|
||||
return fmt.Errorf("bd not found in PATH: %w", err)
|
||||
}
|
||||
|
||||
// Build args: bd show <all-args>
|
||||
// argv[0] must be the program name for exec
|
||||
fullArgs := append([]string{"bd", "show"}, args...)
|
||||
|
||||
// Replace process with bd show
|
||||
return syscall.Exec(bdPath, fullArgs, os.Environ())
|
||||
}
|
||||
Reference in New Issue
Block a user