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:
@@ -1,7 +1,10 @@
|
||||
// Package config provides configuration types and serialization for Gas Town.
|
||||
package config
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
// TownConfig represents the main town identity (mayor/town.json).
|
||||
type TownConfig struct {
|
||||
@@ -208,3 +211,27 @@ func DefaultNamepoolConfig() *NamepoolConfig {
|
||||
MaxBeforeNumbering: 50,
|
||||
}
|
||||
}
|
||||
|
||||
// AccountsConfig represents Claude Code account configuration (mayor/accounts.json).
|
||||
// This enables Gas Town to manage multiple Claude Code accounts with easy switching.
|
||||
type AccountsConfig struct {
|
||||
Version int `json:"version"` // schema version
|
||||
Accounts map[string]Account `json:"accounts"` // handle -> account details
|
||||
Default string `json:"default"` // default account handle
|
||||
}
|
||||
|
||||
// Account represents a single Claude Code account.
|
||||
type Account struct {
|
||||
Email string `json:"email"` // account email
|
||||
Description string `json:"description,omitempty"` // human description
|
||||
ConfigDir string `json:"config_dir"` // path to CLAUDE_CONFIG_DIR
|
||||
}
|
||||
|
||||
// CurrentAccountsVersion is the current schema version for AccountsConfig.
|
||||
const CurrentAccountsVersion = 1
|
||||
|
||||
// DefaultAccountsConfigDir returns the default base directory for account configs.
|
||||
func DefaultAccountsConfigDir() string {
|
||||
home, _ := os.UserHomeDir()
|
||||
return home + "/.claude-accounts"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user