feat: implement account management for multi-account Claude Code (gt-3133)

Adds support for managing multiple Claude Code accounts in Gas Town:

- accounts.json config parsing in mayor/ directory
- gt account list/add/default commands
- GT_ACCOUNT env var support with priority resolution
- --account flag on gt spawn and gt crew at commands
- CLAUDE_CONFIG_DIR injection into tmux sessions

Priority order: GT_ACCOUNT env var > --account flag > default from config

🤖 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-23 04:04:59 -08:00
parent a9ee102606
commit ba2db2bc11
10 changed files with 634 additions and 18 deletions

View File

@@ -46,6 +46,13 @@ type StartOptions struct {
// Command overrides the default "claude" command.
Command string
// Account specifies the account handle to use (overrides default).
Account string
// ClaudeConfigDir is resolved CLAUDE_CONFIG_DIR for the account.
// If set, this is injected as an environment variable.
ClaudeConfigDir string
}
// Info contains information about a running session.
@@ -133,6 +140,11 @@ func (m *Manager) Start(polecat string, opts StartOptions) error {
_ = m.tmux.SetEnvironment(sessionID, "GT_RIG", m.rig.Name)
_ = m.tmux.SetEnvironment(sessionID, "GT_POLECAT", polecat)
// Set CLAUDE_CONFIG_DIR for account selection
if opts.ClaudeConfigDir != "" {
_ = m.tmux.SetEnvironment(sessionID, "CLAUDE_CONFIG_DIR", opts.ClaudeConfigDir)
}
// CRITICAL: Set beads environment for worktree polecats
// Polecats share the rig's beads directory (at rig root, not mayor/rig)
// BEADS_NO_DAEMON=1 prevents daemon from committing to wrong branch