Skip to content

feat: add interactive TUI and abstract display output for OAuth flows#6

Merged
appleboy merged 3 commits intomainfrom
tui
Feb 28, 2026
Merged

feat: add interactive TUI and abstract display output for OAuth flows#6
appleboy merged 3 commits intomainfrom
tui

Conversation

@appleboy
Copy link
Member

  • Add a new TUI interface using BubbleTea and Lipgloss for interactive terminal OAuth flows
  • Refactor all CLI output to use a Displayer abstraction
  • Support both TUI and plain text output based on terminal detection
  • Replace direct stdout printing with Displayer calls throughout the OAuth logic
  • Implement device flow progress, token info, and error handling visually in the TUI
  • Integrate new Displayer implementations (TUI, plain, test/noop) and message types
  • Update tests to use NoopDisplayer for refresh and polling flows
  • Add BubbleTea, Lipgloss, and Charm libraries to dependencies
  • Improve UX with status logs, spinners, and styled banners for each OAuth phase

- Add a new TUI interface using BubbleTea and Lipgloss for interactive terminal OAuth flows
- Refactor all CLI output to use a Displayer abstraction
- Support both TUI and plain text output based on terminal detection
- Replace direct stdout printing with Displayer calls throughout the OAuth logic
- Implement device flow progress, token info, and error handling visually in the TUI
- Integrate new Displayer implementations (TUI, plain, test/noop) and message types
- Update tests to use NoopDisplayer for refresh and polling flows
- Add BubbleTea, Lipgloss, and Charm libraries to dependencies
- Improve UX with status logs, spinners, and styled banners for each OAuth phase

Signed-off-by: appleboy <appleboy.tw@gmail.com>
Copilot AI review requested due to automatic review settings February 28, 2026 04:17
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

This PR introduces a terminal UI (BubbleTea/Lipgloss) for interactive OAuth device flows and refactors OAuth-related CLI output behind a Displayer abstraction to support both TUI and plain-text output depending on terminal detection.

Changes:

  • Added a new tui package (model + message types) and Displayer implementations (TUI program sender, plain text, noop for tests).
  • Refactored the OAuth flow in main.go to emit output exclusively via tui.Displayer and to select TUI vs plain mode at runtime.
  • Updated tests to pass a NoopDisplayer into refactored functions.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tui/model.go BubbleTea model rendering OAuth device flow phases and status log.
tui/messages.go Message types sent from OAuth logic to the TUI model.
tui/displayer.go Displayer interface + Plain/Program/Noop implementations.
main.go Refactors flow to use Displayer; adds TUI bootstrapping and terminal detection.
polling_test.go Updates polling tests for new pollForTokenWithProgress(..., Displayer) signature.
main_test.go Updates refresh token tests for new refreshAccessToken(..., Displayer) signature.
go.mod / go.sum Adds Charm/BubbleTea/Lipgloss dependencies and indirect transitive deps.

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

- Change isTTY to check stderr instead of stdout, matching TUI rendering output
- Correct the goroutine WaitGroup usage for proper parallel execution in main
- Truncate and display token info with a character limit on verification success in the TUI

Signed-off-by: appleboy <appleboy.tw@gmail.com>
- Refactor goroutine launching to use wg.Go instead of manual goroutine creation and wg.Add for TUI program execution

Signed-off-by: appleboy <appleboy.tw@gmail.com>
@appleboy appleboy merged commit 3bb030d into main Feb 28, 2026
16 checks passed
@appleboy appleboy deleted the tui branch February 28, 2026 05:26
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.

2 participants