crew at: don't link windows by default, add --detached flag

When running `gt crew at` from inside tmux:
- No longer auto-links the target session as a tab
- Just prints "Started X. Use C-b s to switch."
- User stays in their current pane

When running from outside tmux:
- Default: attach to the session (existing behavior)
- With -d/--detached: start session without attaching

This gives users more control over tmux session navigation and
reduces confusion for tmux newcomers.

🤖 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-24 15:22:12 -08:00
parent b930704b5f
commit e8dff71b37
3 changed files with 31 additions and 23 deletions

View File

@@ -160,6 +160,18 @@ func runCrewAt(cmd *cobra.Command, args []string) error {
return execClaude("gt prime")
}
// Attach to session using exec to properly forward TTY
// If inside tmux (but different session), don't switch - just inform user
if tmux.IsInsideTmux() {
fmt.Printf("Started %s/%s. Use C-b s to switch.\n", r.Name, name)
return nil
}
// Outside tmux: attach unless --detached flag is set
if crewDetached {
fmt.Printf("Started %s/%s. Run 'gt crew at %s' to attach.\n", r.Name, name, name)
return nil
}
// Attach to session
return attachToTmuxSession(sessionID)
}