Repository navigation
AST-180812 - Add configureApiKey and clearApiKey for a shared CLI login - #1046
Open
cx-rahul-pidde wants to merge 3 commits into
Open
cx-rahul-pidde wants to merge 3 commits into
cx-rahul-pidde wants to merge 3 commits into
Conversation
Add CxWrapper.configureApiKey(key) and clearApiKey(), which run `cx configure set --prop-name cx_apikey`, so an IDE can save its sign-in as the CLI's own login. Other cx processes of the same user, such as the cx-devassist plugin, then use the same login. cx decides where to store it. Both run through the new ExecutionService.executeSensitiveCommands, which passes the arguments unchanged and never logs or returns cx's output (cx prints the value it sets), only the exit code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 of 3 tasks
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
An empty configure set is not the CLI logout. authLogout already runs cx auth logout, which clears the stored login. Signed-off-by: Rahul Pidde <206018639+cx-rahul-pidde@users.noreply.github.com>
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.
Description
Adds a way for an IDE to save its sign-in as the cx CLI's own login, so other cx processes of the same user (for example the cx-devassist Copilot plugin) use the same login without a second sign-in.
CxWrapper.configureApiKey(key)runscx configure set --prop-name cx_apikey --prop-value <key>. cx decides where the login is stored.CxWrapper.clearApiKey()setscx_apikeyto an empty value, for sign-out.ExecutionService.executeSensitiveCommands(...), used by both. UnlikeexecuteCommands, it passes the arguments unchanged (no quote stripping) and never logs or returns cx's stdout or stderr, only the exit code. This matters becausecx configure setprints the value it sets, so the existing path would write the key to the log.--apikey, so only the given value is sent.Not changed: existing commands and
executeCommandsbehave as before.References
Testing
src/tests/ConfigureApiKeyTest.test.ts(5 tests, passing). They do not need the real cx binary or credentials:configureApiKeyandclearApiKeysend exactlyconfigure set --prop-name cx_apikey --prop-value <value>.executeSensitiveCommandsreturns the exit code and never puts the output in the log or the result (checked with a child process that prints a secret).tscandeslintpass on the changed files.cx_apikey. Please confirm.