Repository navigation
feat: stored credential profiles with OS keyring - #1
Merged
Merged
Conversation
Add `groundcover auth` commands for managing named credential profiles. API keys are stored in the OS keyring (Keychain / libsecret / Credential Manager); only non-secret metadata (backend ID, base URL, tenant UUID) is written to ~/.config/groundcover/profiles.yaml. Credential precedence: explicit --api-key/GROUNDCOVER_API_KEY env, then --profile <name>, then the default profile. Combining an explicit key with --profile is rejected as ambiguous. Env-var auth remains the simple/CI path and takes precedence over stored profiles. Commands: auth login/list/default/logout/token/status. login validates the key against the API before persisting. First profile added becomes default. Design mirrors schpet/linear-cli (file holds no secrets) adapted to Go: go-keyring backend behind a Backend interface for test injection, YAML to match the existing yaml.v3 dep. Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.
What
Adds a
groundcover authcommand group for managing named credential profiles, as an alternative to exportingGROUNDCOVER_API_KEYevery session.~/.config/groundcover/profiles.yaml(XDG-aware;%AppData%on Windows). The file never contains a key.Credential precedence
--api-keyflag /GROUNDCOVER_API_KEYenv--profile <name>→ stored profileExplicit key +
--profileis rejected as ambiguous. Env-var auth stays the simple/CI path and takes precedence. First profile added becomes the default.Design
Mirrors schpet/linear-cli (on-disk file holds no secrets) adapted to Go:
go-keyringbehind aBackendinterface so tests inject an in-memory fake.yaml.v3dep (no new TOML lib).internal/credstorepackage;config.Resolvecentralizes the precedence chain.Testing
auth tokenreads back from the keychain,--profileand default-profile both resolve realmonitors listcalls,auth logoutremoves the keychain entry (confirmed viasecurity find-generic-password).🤖 Generated with Claude Code