feat: add whoami command#657
Merged
Merged
Conversation
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>
a084c44 to
8bcd612
Compare
tarqd
approved these changes
May 29, 2026
Contributor
tarqd
left a comment
There was a problem hiding this comment.
Tested, looks good to me! One thing that would be great to add is the organization name vs just the account id but enhancement not a blocker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requirements
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-tokenexplicitly (similar togh auth status).Describe alternatives you've considered
N/A
Additional context
Note
Low Risk
Read-only API calls using the user's existing token; no auth or persistence changes beyond registering a new CLI command.
Overview
Adds
ldcli whoami, a top-level command that reports which LaunchDarkly identity your configured access token represents (similar in spirit togh auth status).The command reads
LD_ACCESS_TOKEN/ config like other commands, and is registered on the root CLI withwhoamiincluded in the set that does not require the global--access-tokenflag at parse time. It callsGET /api/v2/caller-identity; with default plaintext output it best-effort enriches the result via/api/v2/members/{id}and/api/v2/account(member name/email/role, token label/kind including service tokens, organization or account id).--output jsonreturns only the raw caller-identity payload. Help temporarily hides persistent flags that are irrelevant for this subcommand.Tests cover the happy path, account/org fallback, non-member tokens, missing token error, and JSON output.
Reviewed by Cursor Bugbot for commit fd669a4. Bugbot is set up for automated code reviews on this repo. Configure here.