Skip to content

chore(deps): upgrade sdk-go to v0.2.0 (credstore API)#14

Merged
appleboy merged 1 commit intomainfrom
upgrade-sdk-go-v0.2.0
Mar 10, 2026
Merged

chore(deps): upgrade sdk-go to v0.2.0 (credstore API)#14
appleboy merged 1 commit intomainfrom
upgrade-sdk-go-v0.2.0

Conversation

@appleboy
Copy link
Copy Markdown
Member

Summary

  • Upgrade github.com/go-authgate/sdk-go from pseudo-version to v0.2.0
  • Migrate from the old tokenstore package to the new generic credstore package
  • Bump Go version from 1.24.2 → 1.25.0 and update transitive dependencies

Changes

File Change
go.mod / go.sum Bump sdk-go to v0.2.0; update deps
tui/types.go Import credstore; update TokenStorage type alias
main.go Use credstore.Store[credstore.Token]; new store init helpers; updated Save/Load call signatures
main_test.go Update to credstore API (NewTokenFileStore, Save(id, Token{}))

API differences (v0.1.0 → v0.2.0)

Old (tokenstore) New (credstore)
Store (concrete) Store[T any] (generic)
NewFileStore(path) NewTokenFileStore(path)
NewKeyringStore(svc) NewTokenKeyringStore(svc)
NewSecureStore(kr, file) + type assertion DefaultTokenSecureStore(svc, path)
Save(*Token) Save(clientID string, data Token)
Load(id) (*Token, error) Load(id) (Token, error)

Test plan

  • go build ./... passes
  • go test ./... passes (all tests green)

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings March 10, 2026 08:12
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 10, 2026

Codecov Report

❌ Patch coverage is 42.85714% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
main.go 42.85% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Upgrades the AuthGate Go SDK dependency to sdk-go v0.2.0 and migrates the CLI from the legacy tokenstore API to the new generic credstore API for token persistence (including optional keyring-backed storage).

Changes:

  • Bump github.com/go-authgate/sdk-go to v0.2.0 and update transitive deps / Go version.
  • Replace custom token file JSON + locking with credstore stores and updated Save/Load signatures.
  • Introduce -token-store / TOKEN_STORE to select auto|file|keyring storage backend.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
go.mod Bumps Go version and pins sdk-go v0.2.0 plus new indirect deps for credstore/keyring support.
go.sum Updates module checksums to match the dependency upgrades.
tui/types.go Switches TokenStorage to alias the new credstore.Token type.
main.go Adds credstore-backed token storage (auto/file/keyring) and wires SaveTokens/LoadTokens through the new API.
main_test.go Updates token persistence tests to use credstore.NewTokenFileStore and new Save/Load signatures.
filelock.go Removes now-unneeded custom lockfile implementation (replaced by credstore).
filelock_test.go Removes tests for the deleted lockfile implementation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +90 to +94
flagTokenStore = flag.String(
"token-store",
"",
"Token storage backend: auto, file, keyring (default: auto or TOKEN_STORE env)",
)
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

The new TOKEN_STORE / -token-store configuration is introduced here, but the repo’s user-facing configuration docs/examples (e.g., .env.example and/or README token storage section) don’t mention it. Please update the docs so users can discover and correctly set the new backend selection option.

Copilot uses AI. Check for mistakes.
- Bump github.com/go-authgate/sdk-go to v0.2.0; update Go version
  (1.24.2 → 1.25.0) and transitive dependencies
- Migrate from sdk-go/tokenstore to sdk-go/credstore throughout:
  - tui/types.go: TokenStorage aliases credstore.Token
  - main.go: tokenStore typed as credstore.Store[credstore.Token];
    initTokenStore updated to credstore constructors
  - Save/Load call sites updated to new generic API signatures
    (Save takes explicit clientID + value, Load returns value not pointer)
- Update tests: credstore.NewTokenFileStore, Save/Load signatures,
  type assertions updated to generic credstore concrete types
- Document TOKEN_STORE env var in .env.example

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@appleboy appleboy force-pushed the upgrade-sdk-go-v0.2.0 branch from ac5e05d to 4443c73 Compare March 10, 2026 08:40
@appleboy appleboy merged commit f23459e into main Mar 10, 2026
16 checks passed
@appleboy appleboy deleted the upgrade-sdk-go-v0.2.0 branch March 10, 2026 09:00
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.

3 participants