cloverleaf-larry/larry-auth.sh
Bryan Johnson 61f1500492 v0.3.1: OAuth subscription auth + offline manual cheat sheet
Two additions:

1. OAuth subscription auth (lib/oauth.sh + larry-auth.sh)
   - PKCE-based out-of-band flow against Claude.ai (no localhost server
     needed; works behind any firewall).
   - Uses the same client_id Claude Code uses, so calls bill against your
     Max/Pro subscription quota instead of pay-as-you-go API metering.
   - Tokens stored at $LARRY_HOME/.oauth.json (mode 0600), auto-refresh.
   - larry.sh now detects oauth file at startup and uses Bearer auth.
   - First-run flow now offers OAuth or API key; /login, /logout, /auth
     slash commands in the REPL.
   - Transparent fallback to API key if OAuth flow fails.

2. MANUAL.md — offline tool cheat sheet
   - Documents every lib/*.sh script with copy-paste examples.
   - Bryan's backup plan: when Anthropic is unreachable (no internet, on
     a plane, etc.), all the underlying tools work standalone from the
     shell. Larry just sequences them; they do not need Larry to run.
   - Quick-recipe table at the bottom for the common day-to-day asks.

Files added:
  - lib/oauth.sh
  - larry-auth.sh
  - MANUAL.md

Files modified:
  - larry.sh — auth-mode detection, /auth /login /logout commands
  - install-larry.sh — fetch new files

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 09:57:44 -07:00

17 lines
568 B
Bash
Executable File

#!/usr/bin/env bash
# larry-auth.sh — top-level wrapper for OAuth subscription auth.
# Forwards to lib/oauth.sh, which contains the actual implementation.
set -e
SELF_DIR="$(cd "$(dirname "$0")" && pwd)"
LARRY_HOME="${LARRY_HOME:-$HOME/.larry}"
# Locate oauth.sh: prefer sibling-of-this-script, then $LARRY_HOME/lib
OAUTH=""
for c in "$SELF_DIR/lib/oauth.sh" "$LARRY_HOME/lib/oauth.sh"; do
[ -x "$c" ] && { OAUTH="$c"; break; }
done
[ -n "$OAUTH" ] || { echo "larry-auth: cannot find lib/oauth.sh — reinstall larry-anywhere" >&2; exit 1; }
exec "$OAUTH" "$@"