INNER CODE UNIT · Python

_claude_auth_state

ghost-in-the-droid/android-agent · gitd/cli.py:732

def _claude_auth_state() -> str:
    """Check Claude subscription sign-in.

    Returns 'not_installed' | 'logged_out' | 'logged_in'. NEVER reads the token
    value — only whether the CLI is signed in. Ghost does not store or manage
    the token; the claude CLI owns it (and its refresh).

    Fast path: the plain-file credential (Linux, and macOS when the CLI uses the
    file) — no subprocess. If that's absent the CLI may keep creds elsewhere
    (e.g. the macOS Keychain), so we ask `claude auth status`, which respects its
    own storage. On Linux this only costs a subprocess when NOT signed in.
    """
    if shutil.which("claude") is None:
        return "not_installed"
    creds = Path.home() / ".claude" / ".credentials.json"
    try:
        if creds.exists() and json.loads(creds.read_text()).get("claudeAiOauth"):
            return "logged_in"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…