fix(crew): parse rig/name format in crew add command
The crew add command was not parsing rig/name format (e.g., "beads/emma"), which caused nested directories like crew/beads/emma to be created instead of properly routing to the beads rig. Now `gt crew add beads/emma` from any directory correctly creates the crew workspace in the beads rig at beads/crew/emma/. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,16 @@ import (
|
|||||||
func runCrewAdd(cmd *cobra.Command, args []string) error {
|
func runCrewAdd(cmd *cobra.Command, args []string) error {
|
||||||
name := args[0]
|
name := args[0]
|
||||||
|
|
||||||
|
// Parse rig/name format (e.g., "beads/emma" -> rig=beads, name=emma)
|
||||||
|
// This prevents creating nested directories like crew/beads/emma
|
||||||
|
rigName := crewRig
|
||||||
|
if parsedRig, crewName, ok := parseRigSlashName(name); ok {
|
||||||
|
if rigName == "" {
|
||||||
|
rigName = parsedRig
|
||||||
|
}
|
||||||
|
name = crewName
|
||||||
|
}
|
||||||
|
|
||||||
// Find workspace
|
// Find workspace
|
||||||
townRoot, err := workspace.FindFromCwdOrError()
|
townRoot, err := workspace.FindFromCwdOrError()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -29,8 +39,7 @@ func runCrewAdd(cmd *cobra.Command, args []string) error {
|
|||||||
rigsConfig = &config.RigsConfig{Rigs: make(map[string]config.RigEntry)}
|
rigsConfig = &config.RigsConfig{Rigs: make(map[string]config.RigEntry)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine rig
|
// Determine rig (if not already set from slash format or --rig flag)
|
||||||
rigName := crewRig
|
|
||||||
if rigName == "" {
|
if rigName == "" {
|
||||||
// Try to infer from cwd
|
// Try to infer from cwd
|
||||||
rigName, err = inferRigFromCwd(townRoot)
|
rigName, err = inferRigFromCwd(townRoot)
|
||||||
|
|||||||
Reference in New Issue
Block a user