feat: whoami: updated whoami to show the path to the config if that is what is being used#84
Conversation
3dcb707 to
c0bdae3
Compare
c0bdae3 to
7e73419
Compare
|
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. |
Awesome, that looks like a significant improvement.
Is there a chance that it can be still saved to a |
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 |
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.
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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>
| config_path: configPath, | |
| ...(resolved.source === 'config' | |
| ? { config_path: configPath } | |
| : {}), |
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
whoamito show the config path if we are using a config.Example
With no
--jsonSummary by cubic
Updated
whoamito always show the full path tocredentials.jsonin both JSON and standard output. This makes it easy to find where profile data is stored across all key sources.New Features
config_pathin JSON and a "Config:" line in interactive output, pointing to the credentials file fromgetConfigDir.Bug Fixes
Written for commit 30849b6. Summary will update on new commits.