Skip to content

Implement TUI with binaries list, versions view, add binary workflow, tab navigation, and intelligent defaults - #2

Merged
cturner8 merged 10 commits into
devfrom
copilot/implement-tui-plan
Feb 4, 2026
Merged

Implement TUI with binaries list, versions view, add binary workflow, tab navigation, and intelligent defaults#2
cturner8 merged 10 commits into
devfrom
copilot/implement-tui-plan

Conversation

Copilot AI commented Jan 31, 2026

Copy link
Copy Markdown
Contributor

Implements the TUI specification from tui.plan.md. Provides interactive management of binary configurations with read-only browsing, URL-based binary addition, and tab-based navigation with intelligent environment-based defaults.

Architecture

View State Management

  • Bubble Tea message-based architecture with typed view states
  • Separate rendering functions per view (view_*.go)
  • Data layer uses repository pattern with optimized JOIN queries
  • Window size tracking for responsive layout

URL Parser

  • Extracts owner/repo/version/asset from GitHub release URLs
  • Auto-generates binary ID from asset prefix (e.g., copilot-linux-x64.tar.gzcopilot)
  • Supports .tar.gz, .zip, .tgz formats

Styling

  • Orange color scheme (#F97316) matching the box icon
  • Responsive proportional column widths that adapt to terminal size
  • Tab navigation system with visual highlighting

Components

Binaries List

  • Displays configured binaries with active version and install count
  • Proportional column widths (35%, 15%, 30%, 20%) adapt to terminal size
  • Arrow navigation, press a to add, Enter to view versions
  • Tab bar below header for quick view switching

Versions View

  • Shows all installed versions for a binary with proportional columns (5%, 20%, 20%, 15%, 40%)
  • Active version indicator, human-readable sizes, intelligent date formatting
  • Responsive layout adapts to terminal width
  • Auto-detects date format from system locale/timezone

Add Binary Workflow

  1. URL input with real-time validation
  2. Parsed config form (8 editable fields)
  3. Tab navigation, Ctrl+S to save to database
  4. Duplicate ID detection, required field validation

Tab Navigation

  • Accessible views: Binaries, Downloads, Configuration, Help
  • Active tab highlighted in orange
  • Multiple navigation methods:
    • Number keys (1-4) for direct access
    • Shift+Tab to cycle to next tab
    • Ctrl+Shift+Tab to cycle to previous tab
  • Placeholder views for future functionality

Technical Notes

Dependencies

  • Uses bubbles/textinput for form inputs
  • Leverages Bubble Tea and Lipgloss for TUI framework

Database Integration

  • Config digest calculation via crypto.ComputeDigest
  • Auto-syncs config.json to database on launch
  • ConfigVersionManual = 0 distinguishes TUI-added binaries from config-sourced
  • Repository pattern with ListWithVersionDetails() method for optimized queries

Date Formatting

  • Intelligent default detection from environment variables (LC_TIME, LC_ALL, LANG)
  • Falls back to timezone detection for European vs US formats
  • User can override via config.json dateFormat field
  • Examples:
    • ISO format (default): "2006-01-02 15:04"
    • UK/EU format: "02/01/2006 15:04"
    • US format: "01/02/2006 15:04"

Code Quality

  • Text truncation utilities with named constants
  • No magic numbers - all layout values extracted to constants
  • Reusable helper functions for common operations
  • Comprehensive documentation and comments

Example URL parsing:

parsed, _ := url.ParseGitHubReleaseURL(
    "https://github.com/cli/cli/releases/download/v2.0.0/gh_2.0.0_linux_amd64.tar.gz")
// parsed.Owner = "cli"
// parsed.Repo = "cli" 
// parsed.Version = "v2.0.0"
// GenerateBinaryID(parsed.AssetName) = "gh"

Example config.json with date format override:

{
  "version": 1,
  "dateFormat": "02/01/2006 15:04",
  "binaries": [...]
}

Performance Optimizations

  • Replaced N+1 database queries with single JOIN query in repository layer
  • Uses computed columns for install count aggregation
  • Reduces database overhead significantly for large binary collections
  • Responsive layout calculations cached per render

Key Bindings

Tab Navigation:

  • 1-4: Jump to specific tab
  • Shift+Tab: Next tab
  • Ctrl+Shift+Tab: Previous tab

Binaries List:

  • ↑/↓: Navigate entries
  • Enter: View versions
  • a: Add binary
  • q: Quit

Versions View:

  • Esc: Back to list
  • q: Quit

Add Binary:

  • Tab/Shift+Tab: Navigate form fields
  • Ctrl+S: Save
  • Esc: Cancel

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Jan 31, 2026
Copilot AI and others added 5 commits January 31, 2026 18:48
…ns views

Co-authored-by: cturner8 <17177161+cturner8@users.noreply.github.com>
Co-authored-by: cturner8 <17177161+cturner8@users.noreply.github.com>
… text input

Co-authored-by: cturner8 <17177161+cturner8@users.noreply.github.com>
Co-authored-by: cturner8 <17177161+cturner8@users.noreply.github.com>
Co-authored-by: cturner8 <17177161+cturner8@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement the plan from tui.plan.md Implement TUI with binaries list, versions view, and add binary workflow Jan 31, 2026
Copilot AI requested a review from cturner8 January 31, 2026 18:59
Comment thread internal/tui/data.go
Comment thread internal/tui/styles.go Outdated
Comment thread internal/tui/view_binaries_list.go
Comment thread internal/tui/views.go
Comment thread internal/tui/view_versions.go Outdated
Copilot AI and others added 2 commits January 31, 2026 19:35
…tional widths, configurable date format

Co-authored-by: cturner8 <17177161+cturner8@users.noreply.github.com>
… field

Co-authored-by: cturner8 <17177161+cturner8@users.noreply.github.com>
Copilot AI changed the title Implement TUI with binaries list, versions view, and add binary workflow Implement TUI with binaries list, versions view, add binary workflow, and tab navigation Jan 31, 2026
Copilot AI requested a review from cturner8 January 31, 2026 19:40

@cturner8 cturner8 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

please update with the latest changes from the dev branch

Comment thread internal/tui/view_versions.go Outdated
Comment thread internal/tui/view_versions.go Outdated
Comment thread internal/tui/view_versions.go Outdated
Comment thread internal/tui/views.go
Comment thread internal/tui/data.go Outdated
…rmat detection, query moved to repository

Co-authored-by: cturner8 <17177161+cturner8@users.noreply.github.com>

Copilot AI commented Feb 3, 2026

Copy link
Copy Markdown
Contributor Author

please update with the latest changes from the dev branch

I've implemented all the requested changes from the PR feedback. However, I'm unable to perform git merge operations directly. Could you please merge the latest changes from the dev branch into this branch? Once that's done, I can help resolve any conflicts if they arise.

…prove comments

Co-authored-by: cturner8 <17177161+cturner8@users.noreply.github.com>
Copilot AI changed the title Implement TUI with binaries list, versions view, add binary workflow, and tab navigation Implement TUI with binaries list, versions view, add binary workflow, tab navigation, and intelligent defaults Feb 3, 2026
Copilot AI requested a review from cturner8 February 3, 2026 19:06
@cturner8
cturner8 marked this pull request as ready for review February 4, 2026 19:39
@cturner8
cturner8 merged commit c0c5b47 into dev Feb 4, 2026
@cturner8
cturner8 deleted the copilot/implement-tui-plan branch February 4, 2026 19:46
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