Merge pull request #2212 from alipgoldberg/setup-headless-auth-message
feat(setup): headless-aware Claude sign-in pre-message
This commit is contained in:
@@ -51,13 +51,34 @@ command -v script >/dev/null \
|
|||||||
tmpfile=$(mktemp -t claude-setup-token.XXXXXX)
|
tmpfile=$(mktemp -t claude-setup-token.XXXXXX)
|
||||||
trap 'rm -f "$tmpfile"' EXIT
|
trap 'rm -f "$tmpfile"' EXIT
|
||||||
|
|
||||||
cat <<'EOF'
|
# Detect headless. Mirrors `isHeadless()` in setup/platform.ts: on Linux
|
||||||
|
# with neither DISPLAY nor WAYLAND_DISPLAY set, no graphical session
|
||||||
|
# exists, so `claude setup-token` won't be able to auto-open a browser
|
||||||
|
# and the user will need to copy the printed sign-in URL by hand. The
|
||||||
|
# pre-message copy below is swapped accordingly so we don't promise a
|
||||||
|
# browser pop that will never happen.
|
||||||
|
is_headless=0
|
||||||
|
if [ "$(uname -s)" = "Linux" ] && [ -z "${DISPLAY:-}" ] && [ -z "${WAYLAND_DISPLAY:-}" ]; then
|
||||||
|
is_headless=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$is_headless" = "1" ]; then
|
||||||
|
cat <<'EOF'
|
||||||
|
A sign-in link will appear for you to sign in with your Claude account.
|
||||||
|
When you finish, we'll save the token to your OneCLI vault automatically.
|
||||||
|
|
||||||
|
Press Enter to continue, or edit the command first.
|
||||||
|
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
cat <<'EOF'
|
||||||
A browser window will open for you to sign in with your Claude account.
|
A browser window will open for you to sign in with your Claude account.
|
||||||
When you finish, we'll save the token to your OneCLI vault automatically.
|
When you finish, we'll save the token to your OneCLI vault automatically.
|
||||||
|
|
||||||
Press Enter to continue, or edit the command first.
|
Press Enter to continue, or edit the command first.
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
cmd="claude setup-token"
|
cmd="claude setup-token"
|
||||||
if [ "${BASH_VERSINFO[0]:-0}" -ge 4 ]; then
|
if [ "${BASH_VERSINFO[0]:-0}" -ge 4 ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user