Skip to content

feat: add whoami command#657

Open
apucacao wants to merge 4 commits into
mainfrom
ag/whoami-cmd
Open

feat: add whoami command#657
apucacao wants to merge 4 commits into
mainfrom
ag/whoami-cmd

Conversation

@apucacao
Copy link
Copy Markdown
Contributor

@apucacao apucacao commented Mar 11, 2026

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

N/A

Describe the solution you've provided

Adds ldcli whoami — shows who your current access token belongs to. Reads from config/env like other commands, so you don't need to pass --access-token explicitly (similar to gh auth status).

$ ldcli whoami
Ariel Flores <ariel@acme.com>
Role:    admin
Token:   my-api-token (personal)
Account: abc123

Describe alternatives you've considered

N/A

Additional context


Note

Low Risk
Low risk: adds a new read-only CLI command and minimal root-command wiring, with no changes to auth flows beyond calling existing APIs using the configured token.

Overview
Adds a new ldcli whoami command that calls GET /api/v2/caller-identity using the configured access token and prints the current caller identity.

Supports --output json by returning the raw API response, and for plaintext output optionally enriches display by fetching member details from GET /api/v2/members/{id}. Root command wiring is updated to register whoami and exempt it from required-flag parsing; new tests cover plaintext, JSON, and missing-token behavior.

Reviewed by Cursor Bugbot for commit 8bcd612. Bugbot is set up for automated code reviews on this repo. Configure here.

apucacao and others added 4 commits May 20, 2026 17:06
Adds `ldcli whoami` which calls /api/v2/caller-identity to show
information about the identity associated with the current access token
(token name, auth kind, member ID, scopes, etc.).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Removes --access-token requirement from whoami — the command reads
the token from config/env (like ldcli login sets up), matching the
pattern of gh auth status and similar commands.

Also hides --access-token, --base-uri, and --analytics-opt-out from
whoami's help output since they're not relevant to this command.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fetches /api/v2/members/{id} after caller-identity when a memberId
is present, giving plaintext output like:

  Ariel Flores <ariel@acme.com>
  Role:    admin
  Token:   my-api-token (personal)

JSON output remains the raw caller-identity response for scripting.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@apucacao apucacao marked this pull request as ready for review May 20, 2026 17:23
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