Skip to content

feat: whoami: updated whoami to show the path to the config if that is what is being used#84

Merged
felipefreitag merged 5 commits intoresend:mainfrom
kevkevinpal:addConfigPathToWhoAmI
Mar 18, 2026
Merged

feat: whoami: updated whoami to show the path to the config if that is what is being used#84
felipefreitag merged 5 commits intoresend:mainfrom
kevkevinpal:addConfigPathToWhoAmI

Conversation

@kevkevinpal
Copy link
Contributor

@kevkevinpal kevkevinpal commented Mar 13, 2026

Summary

I wanted a way to know where my config/api keys were stored other than on login/logout. So I added a new output to whoami to show the config path if we are using a config.

Example

$ pnpm dev whoami --json

> resend-cli@1.4.1 dev /mnt/shared_drive/DEVDIR/resend-cli
> tsx src/cli.ts whoami --json

{
  "authenticated": true,
  "profile": "default",
  "api_key": "re_...JMBH",
  "source": "config",
  "config_path": "/home/kevkevin/.config/resend/credentials.json"
}

With no --json

$ pnpm dev whoami

> resend-cli@1.4.1 dev /mnt/shared_drive/DEVDIR/resend-cli
> tsx src/cli.ts whoami


  Profile: default
  API Key: re_...JMBH
  Source:  config file
  Config:  /home/kevkevin/.config/resend/credentials.json

Summary by cubic

Updated whoami to always show the full path to credentials.json in both JSON and standard output. This makes it easy to find where profile data is stored across all key sources.

  • New Features

    • Always includes config_path in JSON and a "Config:" line in interactive output, pointing to the credentials file from getConfigDir.
  • Bug Fixes

    • Removed duplicate "Source:" line in interactive output.

Written for commit 30849b6. Summary will update on new commits.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@kevkevinpal kevkevinpal force-pushed the addConfigPathToWhoAmI branch from 3dcb707 to c0bdae3 Compare March 13, 2026 19:11
@kevkevinpal kevkevinpal force-pushed the addConfigPathToWhoAmI branch from c0bdae3 to 7e73419 Compare March 13, 2026 23:54
@felipefreitag
Copy link
Contributor

Thanks for this contribution!

Since this was opened, we've landed secure credential storage (#97), which stores API keys in the OS keychain (macOS Keychain, Linux secret-service, Windows Credential Manager) rather than in credentials.json. With that change, pointing users to the credentials file wouldn't be accurate for keychain users.
With that in mind, do you feel the need for the path to the file?

@kevkevinpal
Copy link
Contributor Author

Since this was opened, we've landed secure credential storage (#97), which stores API keys in the OS keychain (macOS Keychain, Linux secret-service, Windows Credential Manager) rather than in credentials.json.

Awesome, that looks like a significant improvement.

With that change, pointing users to the credentials file wouldn't be accurate for keychain users. With that in mind, do you feel the need for the path to the file?

Is there a chance that it can be still saved to a credentials.json file? I think just in that case we should show it. If there is no chance of that happening then we can close this PR.

@felipefreitag
Copy link
Contributor

Since this was opened, we've landed secure credential storage (#97), which stores API keys in the OS keychain (macOS Keychain, Linux secret-service, Windows Credential Manager) rather than in credentials.json.

Awesome, that looks like a significant improvement.

With that change, pointing users to the credentials file wouldn't be accurate for keychain users. With that in mind, do you feel the need for the path to the file?

Is there a chance that it can be still saved to a credentials.json file? I think just in that case we should show it. If there is no chance of that happening then we can close this PR.

We still use the config file for storing profiles, and it's possible for users to choose insecure storage manually

@kevkevinpal
Copy link
Contributor Author

We still use the config file for storing profiles, and it's possible for users to choose insecure storage manually

I think it then makes sense to still display this in those cases where the config is used

@kevkevinpal kevkevinpal changed the title whoami: updated whoami to show the path to the config if that is what is being used feat: whoami: updated whoami to show the path to the config if that is what is being used Mar 17, 2026
kevkevinpal and others added 3 commits March 17, 2026 08:53
The credentials.json file holds profile metadata for all storage
backends, so config_path is always relevant. Also fixes the duplicate
Source line in interactive output and adds secure_storage test coverage.
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/commands/whoami.ts">

<violation number="1" location="src/commands/whoami.ts:83">
P1: config_path is always output unconditionally, contradicting the PR's stated purpose of showing the config path "if we are using a config". The value now appears for all sources (env, secure_storage, flag) where it provides misleading information.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

profile,
api_key: maskKey(resolved.key),
source: resolved.source,
config_path: configPath,
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: config_path is always output unconditionally, contradicting the PR's stated purpose of showing the config path "if we are using a config". The value now appears for all sources (env, secure_storage, flag) where it provides misleading information.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/commands/whoami.ts, line 83:

<comment>config_path is always output unconditionally, contradicting the PR's stated purpose of showing the config path "if we are using a config". The value now appears for all sources (env, secure_storage, flag) where it provides misleading information.</comment>

<file context>
@@ -80,9 +80,7 @@ Shows which profile is active and where the API key comes from.`,
-          ...(resolved.source === 'config'
-            ? { config_path: credentialsPath }
-            : {}),
+          config_path: configPath,
         },
         { json: globalOpts.json },
</file context>
Suggested change
config_path: configPath,
...(resolved.source === 'config'
? { config_path: configPath }
: {}),
Fix with Cubic

@felipefreitag felipefreitag merged commit d0bb48e into resend:main Mar 18, 2026
8 checks passed
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.

2 participants