Skip to content

feat(tokenstore): adopt shared tokenstore with configurable backends#13

Merged
appleboy merged 3 commits intomainfrom
token
Mar 9, 2026
Merged

feat(tokenstore): adopt shared tokenstore with configurable backends#13
appleboy merged 3 commits intomainfrom
token

Conversation

@appleboy
Copy link
Member

@appleboy appleboy commented Mar 9, 2026

  • Remove the custom file-based locking implementation and its tests.
  • Introduce a shared tokenstore dependency and add keyring-related indirect dependencies.
  • Replace manual token file read/write logic with tokenstore abstractions for loading and saving tokens.
  • Add a configurable token storage backend with support for auto, file, and OS keyring modes.
  • Update CLI flags and configuration to select and initialize the token storage backend.
  • Refactor tests to use the new tokenstore API instead of direct file and JSON handling.
  • Simplify TUI token types by aliasing them to the shared tokenstore token type.

- Remove the custom file-based locking implementation and its tests.
- Introduce a shared tokenstore dependency and add keyring-related indirect dependencies.
- Replace manual token file read/write logic with tokenstore abstractions for loading and saving tokens.
- Add a configurable token storage backend with support for auto, file, and OS keyring modes.
- Update CLI flags and configuration to select and initialize the token storage backend.
- Refactor tests to use the new tokenstore API instead of direct file and JSON handling.
- Simplify TUI token types by aliasing them to the shared tokenstore token type.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Copilot AI review requested due to automatic review settings March 9, 2026 08:44
@codecov-commenter
Copy link

codecov-commenter commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 65.78947% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
main.go 65.78% 13 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link

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

Adopts the shared sdk-go/tokenstore package to manage OAuth token persistence, replacing the CLI’s bespoke JSON + file-locking implementation and adding a configurable backend (file vs OS keyring vs auto fallback).

Changes:

  • Replace tui.TokenStorage with an alias to tokenstore.Token and remove the local multi-client JSON map types.
  • Initialize a configurable tokenstore.Store in initConfig (modes: auto, file, keyring) and wire it into the TUI deps.
  • Remove the custom file-lock implementation/tests; refactor token save/load tests to use the new tokenstore API.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tui/types.go Aliases TokenStorage to the shared tokenstore.Token.
main.go Adds -token-store config and routes token load/save through tokenstore.Store; removes bespoke file token logic.
main_test.go Updates token persistence tests to use tokenstore.NewFileStore + Save/Load.
go.mod Adds github.com/go-authgate/sdk-go and keyring-related indirect deps.
go.sum Records checksums for the newly introduced dependencies.
filelock.go Deletes the custom cross-process lock implementation.
filelock_test.go Removes tests for the deleted file-locking implementation.

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

appleboy and others added 2 commits March 9, 2026 22:48
- Extract initTokenStore function from initConfig for testability
- Add tests for file, keyring, auto, and invalid token store modes
- Verify correct backend types and fallback warning behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@appleboy appleboy merged commit fa66658 into main Mar 9, 2026
16 checks passed
@appleboy appleboy deleted the token branch March 9, 2026 15:41
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