feat: Add gt crew start command as alias for gt start crew
Users naturally expect "gt crew start <name>" to work alongside "gt start crew <name>". This adds the alias, handling all input formats: "name", "rig/name", and "rig/crew/name". 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,7 @@ Unlike polecats which are witness-managed and transient, crew workers are:
|
|||||||
- Tmux optional: Can work in terminal directly
|
- Tmux optional: Can work in terminal directly
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
|
gt crew start <name> Start a crew workspace (creates if needed)
|
||||||
gt crew add <name> Create a new crew workspace
|
gt crew add <name> Create a new crew workspace
|
||||||
gt crew list List crew workspaces with status
|
gt crew list List crew workspaces with status
|
||||||
gt crew at <name> Attach to crew workspace session
|
gt crew at <name> Attach to crew workspace session
|
||||||
@@ -211,6 +212,25 @@ var crewPrevCmd = &cobra.Command{
|
|||||||
RunE: runCrewPrev,
|
RunE: runCrewPrev,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var crewStartCmd = &cobra.Command{
|
||||||
|
Use: "start <name>",
|
||||||
|
Short: "Start a crew workspace (creates if needed)",
|
||||||
|
Long: `Start a crew workspace, creating it if it doesn't exist.
|
||||||
|
|
||||||
|
This is an alias for 'gt start crew'. It combines 'gt crew add' and 'gt crew at --detached'.
|
||||||
|
The crew session starts in the background with Claude running and ready.
|
||||||
|
|
||||||
|
The name can include the rig in slash format (e.g., gastown/joe).
|
||||||
|
If not specified, the rig is inferred from the current directory.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
gt crew start joe # Start joe in current rig
|
||||||
|
gt crew start gastown/joe # Start joe in gastown rig
|
||||||
|
gt crew start joe --rig beads # Start joe in beads rig`,
|
||||||
|
Args: cobra.ExactArgs(1),
|
||||||
|
RunE: runCrewStart,
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
// Add flags
|
// Add flags
|
||||||
crewAddCmd.Flags().StringVar(&crewRig, "rig", "", "Rig to create crew workspace in")
|
crewAddCmd.Flags().StringVar(&crewRig, "rig", "", "Rig to create crew workspace in")
|
||||||
@@ -240,6 +260,9 @@ func init() {
|
|||||||
|
|
||||||
crewRestartCmd.Flags().StringVar(&crewRig, "rig", "", "Rig to use")
|
crewRestartCmd.Flags().StringVar(&crewRig, "rig", "", "Rig to use")
|
||||||
|
|
||||||
|
crewStartCmd.Flags().StringVar(&crewRig, "rig", "", "Rig to use")
|
||||||
|
crewStartCmd.Flags().StringVar(&crewAccount, "account", "", "Claude Code account handle to use")
|
||||||
|
|
||||||
// Add subcommands
|
// Add subcommands
|
||||||
crewCmd.AddCommand(crewAddCmd)
|
crewCmd.AddCommand(crewAddCmd)
|
||||||
crewCmd.AddCommand(crewListCmd)
|
crewCmd.AddCommand(crewListCmd)
|
||||||
@@ -252,6 +275,7 @@ func init() {
|
|||||||
crewCmd.AddCommand(crewRestartCmd)
|
crewCmd.AddCommand(crewRestartCmd)
|
||||||
crewCmd.AddCommand(crewNextCmd)
|
crewCmd.AddCommand(crewNextCmd)
|
||||||
crewCmd.AddCommand(crewPrevCmd)
|
crewCmd.AddCommand(crewPrevCmd)
|
||||||
|
crewCmd.AddCommand(crewStartCmd)
|
||||||
|
|
||||||
rootCmd.AddCommand(crewCmd)
|
rootCmd.AddCommand(crewCmd)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@@ -155,6 +156,26 @@ func runCrewRefresh(cmd *cobra.Command, args []string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// runCrewStart is an alias for runStartCrew, handling multiple input formats.
|
||||||
|
// It supports: "name", "rig/name", and "rig/crew/name" formats.
|
||||||
|
func runCrewStart(cmd *cobra.Command, args []string) error {
|
||||||
|
name := args[0]
|
||||||
|
|
||||||
|
// Handle rig/crew/name format (e.g., "gastown/crew/joe" -> "gastown/joe")
|
||||||
|
if strings.Contains(name, "/crew/") {
|
||||||
|
parts := strings.SplitN(name, "/crew/", 2)
|
||||||
|
if len(parts) == 2 && parts[0] != "" && parts[1] != "" {
|
||||||
|
name = parts[0] + "/" + parts[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the start.go flags from crew.go flags before calling
|
||||||
|
startCrewRig = crewRig
|
||||||
|
startCrewAccount = crewAccount
|
||||||
|
|
||||||
|
return runStartCrew(cmd, []string{name})
|
||||||
|
}
|
||||||
|
|
||||||
func runCrewRestart(cmd *cobra.Command, args []string) error {
|
func runCrewRestart(cmd *cobra.Command, args []string) error {
|
||||||
name := args[0]
|
name := args[0]
|
||||||
// Parse rig/name format (e.g., "beads/emma" -> rig=beads, name=emma)
|
// Parse rig/name format (e.g., "beads/emma" -> rig=beads, name=emma)
|
||||||
|
|||||||
Reference in New Issue
Block a user