Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bin/omarchy-agent-account-add
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ while [[ ${1:-} == --* ]]; do
--events) events=true ;;
--reauth)
reauth="${2:-}"
if [[ -z $reauth || $reauth == --* ]]; then
echo "Usage: omarchy-agent-account-add --reauth <account> [claude|codex|grok]" >&2
exit 1
fi
shift
;;
*) break ;;
Expand Down
14 changes: 14 additions & 0 deletions test/shell.d/agent-account-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,20 @@ grep -qx "@@omarchy done Signed in to Claude again." "$test_tmp/reauth-output" |
[[ $(omarchy-agent-account-list claude --json | jq '.[0].accounts | length') == "$before" ]] || fail "--reauth adds no account"
grep -qx -- "--private https://claude.com/oauth/authorize" "$OMARCHY_TEST_BROWSER_LOG" || fail "--reauth of an added account uses a private window"

# --reauth without an account is a mistake, not a request to add one.
: >"$OMARCHY_TEST_BROWSER_LOG"
before=$(omarchy-agent-account-list claude --json | jq '.[0].accounts | length')
for args in "--reauth" "--reauth --events"; do
# shellcheck disable=SC2086
if OMARCHY_TEST_LOGIN_UUID=u-stray OMARCHY_TEST_LOGIN_EMAIL=stray@example.com \
omarchy-agent-account-add $args </dev/null >/dev/null 2>&1; then
fail "--reauth needs an account: $args"
fi
done
[[ $(omarchy-agent-account-list claude --json | jq '.[0].accounts | length') == "$before" && ! -s $OMARCHY_TEST_BROWSER_LOG ]] ||
fail "--reauth without an account adds nothing and opens no sign-in"
pass "--reauth without an account is refused"

: >"$OMARCHY_TEST_BROWSER_LOG"
OMARCHY_TEST_LOGIN_UUID=u-main OMARCHY_TEST_LOGIN_EMAIL=me@example.com \
omarchy-agent-account-add --reauth main claude </dev/null >/dev/null
Expand Down