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:
Steve Yegge
2025-12-25 14:32:29 -08:00
parent eba8d8d112
commit 5c5e242084

View File

@@ -16,6 +16,16 @@ import (
func runCrewAdd(cmd *cobra.Command, args []string) error {
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
townRoot, err := workspace.FindFromCwdOrError()
if err != nil {
@@ -29,8 +39,7 @@ func runCrewAdd(cmd *cobra.Command, args []string) error {
rigsConfig = &config.RigsConfig{Rigs: make(map[string]config.RigEntry)}
}
// Determine rig
rigName := crewRig
// Determine rig (if not already set from slash format or --rig flag)
if rigName == "" {
// Try to infer from cwd
rigName, err = inferRigFromCwd(townRoot)