Skip to content

feat: add 'auth status' subcommand - #9

Merged
DTTerastar merged 1 commit into
mainfrom
feat/auth-status
Apr 25, 2026
Merged

feat: add 'auth status' subcommand#9
DTTerastar merged 1 commit into
mainfrom
feat/auth-status

Conversation

@DTTerastar

Copy link
Copy Markdown
Contributor

Summary

Per CONTRACT §5, every quantcli CLI exposes `auth status` printing a one-line readiness summary, exit 0 if usable.

```
$ withings-export auth status
logged in as user 1629692 (token expires 2026-04-25T20:24:22-04:00)
$ echo $?
0
```

Three states:

Condition Output Exit
Token saved, unexpired `logged in as user X (token expires …)` 0
No saved token `not logged in — run: withings-export auth login` 1
Saved token, expired `token expired … — run: withings-export auth refresh` 1

Local check only — no network call. Adds exported `auth.Load()` so `cmd/` can read the token store without going through `GetToken`'s auto-refresh path. Reports the Withings numeric user ID (`UserID` is what the OAuth flow actually persists; we don't store the email).

Test plan

  • `go build ./...`, `go vet ./...`, `go test ./...` pass
  • Logged-in state returns exit 0 with user ID + expiry

🤖 Generated with Claude Code

Per quantcli shared contract §5, every CLI exposes 'auth status'
printing a one-line readiness summary, exit 0 if usable.
https://github.com/quantcli/common/blob/main/CONTRACT.md#5-auth

  withings-export auth status
  → "logged in as user 1234567 (token expires 2026-04-25T20:24:22-04:00)" / 0
  → "not logged in — run: withings-export auth login" / 1
  → "token expired YYYY-... — run: ... auth refresh" / 1

Local check only — no network call, no refresh attempted. Adds an
exported auth.Load() so cmd/ can read the token store without going
through GetToken's auto-refresh path. Includes the Withings user_id
(numeric account identifier) in the readout for parity with what the
auth subcommand actually knows about; we don't store the email.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant