Files
gitea-axi/.claude/adr/0001-diff-auth-via-tea-login-list.md
alexion 38026f963d feat: scaffold CLI and minimal issue list (task 0001)
Tracer bullet for gitea-axi: runnable npm package on axi-sdk-js with
gitea-js as the sole HTTP layer, ESM on Node 20+.

- issue list with --state/--limit, default fields, count line from
  X-Total-Count, type=issues guard, explicit empty state, and next-step
  suggestions
- repo context detection from the git origin remote (SSH/scp/HTTPS),
  tea credential discovery with the three-way login-matching split, and
  -R/--repo and --login overrides (flag > env > auto)
- token retrieval via tea login helper get: tea's login list JSON
  carries no token (ADR 0001 amended)
- full AxiError classification table with path-based 404 split, TOON
  errors on stdout, exit codes 0/1/2
- test mode (GITEA_AXI_API_URL/TOKEN/REPO) suppressing subprocesses,
  fixture server, and vitest suites driving the CLI seam (50 tests)
2026-07-11 07:11:07 -04:00

1.6 KiB

Authenticate diff HTTP GET via tea login list --output json

pr get --diff fetches diff content with a direct HTTP GET, bypassing the tea subprocess. To get the auth token for that request, gitea-axi calls tea login list --output json, matches the login entry whose URL matches the current repo's hostname, and uses its token.

Considered Options

Read ~/.config/tea/config.yml directly — one fewer subprocess call, but couples gitea-axi to tea's internal storage format rather than its stable JSON output interface.

Shell out to tea login list --output json (chosen) — consistent with the rest of the architecture, which goes through tea's JSON interface for everything; decoupled from tea's file format internals.

Amendment (2026-07-10): token comes from tea login helper get, not the list output

The original decision assumed tea login list --output json includes the token. It does not: the list output carries only name, url, ssh_host, user, and default (verified against tea 0.14.2 and current tea main).

tea login list --output json remains the discovery interface (profile names, URLs, default flag, hostname matching). The token for the selected login is fetched via tea login helper get --login <name>, tea's git-credential-protocol interface (host= on stdin, password= on stdout). This stays on tea's stable machine interfaces rather than its YAML internals, and additionally gets OAuth token refresh for free — helper get refreshes near-expiry OAuth tokens in place, which reading config.yml directly could never do.