* Apply agent account selection to CLI subprocesses * Fix account dispatch edge cases and remove redundant shell wrappers * Use the current account when launching a new agent session
26 lines
1013 B
Bash
Executable File
26 lines
1013 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Print the config home of the active Claude, Codex, or Grok account
|
|
# omarchy:args=<claude|codex|grok>
|
|
# omarchy:hidden=true
|
|
|
|
# Prints nothing while the primary account (~/.claude, ~/.codex) is active, so
|
|
# a launch only sets CLAUDE_CONFIG_DIR / CODEX_HOME when there's somewhere
|
|
# else to point it. Without a registry, no Python starts at all: this runs on
|
|
# every `claude` and `codex` typed at a prompt.
|
|
registry="${XDG_STATE_HOME:-$HOME/.local/state}/omarchy/agents/accounts/${1:-}.json"
|
|
|
|
if [[ ${1:-} != "claude" && ${1:-} != "codex" && ${1:-} != "grok" ]]; then
|
|
echo "Usage: omarchy-agent-account-home <claude|codex|grok>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# A running session pins its home, including an empty value for Main. Claude's
|
|
# implicit default also selects ~/.claude.json, so Main must stay implicit.
|
|
account_pin="OMARCHY_AGENT_${1^^}_HOME"
|
|
if [[ -v $account_pin ]]; then
|
|
printf '%s' "${!account_pin}"
|
|
elif [[ -f $registry ]]; then
|
|
exec omarchy-agent-account-state home "$1"
|
|
fi
|