Add CircleCI token as first-class config option#210
Closed
schurchleycci wants to merge 3 commits intomainfrom
Closed
Add CircleCI token as first-class config option#210schurchleycci wants to merge 3 commits intomainfrom
schurchleycci wants to merge 3 commits intomainfrom
Conversation
3 tasks
9cc2b1d to
3234ded
Compare
6 tasks
43a66f4 to
6cfa14a
Compare
- Add CircleCIToken to UserConfig and ResolvedConfig with env-var > config-file precedence (CIRCLE_TOKEN > CIRCLECI_TOKEN > config file) - NewClient() now resolves token via config.Resolve() instead of reading env vars directly; add NewClientWithToken() for tests and explicit-token use cases (e.g. token validation during auth set) - Add `auth set circleci` command: prompts for token, validates via GET /api/v2/me, saves to config - Add ErrSilent so commands can exit non-zero without double-printing - Add GetCurrentUser() to CircleCI client for token validation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
NewClient() now uses config.Resolve() to look up the CircleCI token (env vars + config file) instead of only reading env vars directly. Also shows circleCIToken in config show output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rename "custom base URL" test to "default base URL" since it tests empty CIRCLECI_BASE_URL. Restore blank lines removed without reason in task_test.go. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6cfa14a to
034cc8a
Compare
4 tasks
Contributor
Author
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.
Summary
CircleCITokenfield toUserConfigwith env-var > config-file precedence (CIRCLE_TOKEN>CIRCLECI_TOKEN> config file)NewClient(token, baseURL string)to accept explicit params — the circleci package no longer reads env vars or imports confignewCircleCIClient()helper incmd/that resolves tokens viaconfig.Resolve()and passes them throughauth set circlecicommand that prompts for a token, validates it viaGET /api/v2/me, and saves to configGetCurrentUser()to the CircleCI client for token validationErrSilenterror type so commands can exit non-zero without double-printingcircleCITokeninconfig showoutputTest plan
task buildcompiles cleanlytask testpasses (746 tests)task lint— 0 issueschunk auth set circleciprompts for token, validates, and saves to configchunk config showdisplays circleCIToken with sourceCIRCLE_TOKEN/CIRCLECI_TOKENenv vars and config file🤖 Generated with Claude Code
Note
Part 1 of 2 — stacked PR series for multi-provider auth support