Skip to main content

Module auth

Module auth 

Source
Expand description

rpi auth subcommand — persistent credential management. Mirrors the Rust-relevant slice of the TS packages/coding-agent/src/cli/auth-command.ts

  • main.ts:runAuthCommand + core/auth-check.ts.

v1 ships three actions:

  • rpi auth login — prompt (no echo, via rpassword) for an Anthropic API key and persist it to ~/.rpi/auth.json (atomic write + 0o600 on Unix). Mirrors the upstream /login TUI’s type:"secret" prompt + modify.
  • rpi auth check — local-only probe of auth.json + the ANTHROPIC_* env vars; reports ready/not_ready (no network call — the upstream --no-refresh equivalent). --json emits a structured result.
  • rpi auth logout — drop the anthropic entry from auth.json (env vars are left untouched, matching upstream /logout semantics).

§Not ported (deferred — see docs/m6-cli-open-questions.md)

OAuth device-code login (Claude Pro/Max subscriptions), the full TUI --provider picker, and auth print-api-key/print-bearer-token. Only the anthropic provider id is handled.

Functions§

run
rpi auth <sub> [args] entry. args is the slice after auth (i.e. the subcommand + its flags). Returns the process exit code. Async to match the app::run shape, though v1 does no async work here.