Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 32 additions & 30 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,26 +76,33 @@ var (

// renderTitleBar renders a title bar with left title and right-aligned user status
func renderTitleBar(screen, username, organization string, innerWidth int) string {
leftTitle := fmt.Sprintf("GitHub Brain %s / %s", Version, screen)
var rightStatus string
leftTitle := fmt.Sprintf("GitHub Brain / %s", screen)

// Build right side: @username · 🏢 org · version
var rightParts []string
if username != "" {
if organization != "" {
rightStatus = fmt.Sprintf("👤 @%s (%s)", username, organization)
} else {
rightStatus = fmt.Sprintf("👤 @%s (no org)", username)
}
} else {
rightStatus = "👤 Not logged in"
rightParts = append(rightParts, fmt.Sprintf("👤 @%s", username))
}
if organization != "" {
rightParts = append(rightParts, fmt.Sprintf("🏢 %s", organization))
}

// Join parts with separator
rightStatus := strings.Join(rightParts, " · ")
if rightStatus != "" {
rightStatus += " · "
}

leftWidth := lipgloss.Width(leftTitle)
rightWidth := lipgloss.Width(rightStatus)
versionText := Version
versionWidth := lipgloss.Width(versionText)
rightWidth := lipgloss.Width(rightStatus) + versionWidth
spacing := innerWidth - leftWidth - rightWidth
if spacing < 1 {
spacing = 1
}

return titleStyle.Render(leftTitle) + strings.Repeat(" ", spacing) + titleStyle.Render(rightStatus)
return titleStyle.Render(leftTitle) + strings.Repeat(" ", spacing) + titleStyle.Render(rightStatus) + dimStyle.Render(versionText)
}

// Removed ConsoleHandler - not needed with Bubble Tea
Expand Down Expand Up @@ -4814,7 +4821,7 @@ func (m model) View() string {
}

// Add title as first line of content
leftTitle := fmt.Sprintf("GitHub Brain %s / 📥 Pull", Version)
leftTitle := fmt.Sprintf("GitHub Brain %s / 🔄 Pull", Version)
var rightStatus string
if m.username != "" {
if m.organization != "" {
Expand Down Expand Up @@ -4960,9 +4967,9 @@ func newMainMenuModel(homeDir string) mainMenuModel {
return mainMenuModel{
homeDir: homeDir,
choices: []menuChoice{
{icon: "🔧", name: "Setup", description: "Configure authentication and settings"},
{icon: "📥", name: "Pull", description: "Sync GitHub data to local database"},
{icon: "🚪", name: "Quit", description: "Exit"},
{icon: "🔧", name: "Setup", description: "Configure GitHub username and organization"},
{icon: "🔄", name: "Pull", description: "Sync GitHub data to local database"},
{icon: "🚪", name: "Quit", description: "Ctrl+C"},
},
cursor: 0,
status: "Checking authentication...",
Expand Down Expand Up @@ -5084,28 +5091,23 @@ func (m mainMenuModel) View() string {
b.WriteString("\n")

// Menu items
selectorStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("12")) // Blue selector
for i, choice := range m.choices {
cursor := " "
style := dimStyle
descStyle := dimStyle
if m.cursor == i {
cursor = "> "
style = selectedStyle
cursor = selectorStyle.Render("▶") + " "
descStyle = selectedStyle
}
line := fmt.Sprintf("%s%s %s", cursor, choice.icon, choice.name)
if choice.description != "" {
line += " " + choice.description
}
b.WriteString(style.Render(line) + "\n")
// Pad name to 5 characters for alignment
paddedName := fmt.Sprintf("%-5s", choice.name)
// Name is always bold (titleStyle), description uses current selection style
b.WriteString(fmt.Sprintf("%s%s %s %s", cursor, choice.icon, titleStyle.Render(paddedName), descStyle.Render(choice.description)))
if i < len(m.choices)-1 {
b.WriteString("\n")
b.WriteString("\n\n")
}
}

b.WriteString("\n")

// Help text
b.WriteString(dimStyle.Render("Press Enter to select, Ctrl+C to quit"))

// Create border style
borderStyle := lipgloss.NewStyle().
Border(lipgloss.RoundedBorder()).
Expand Down Expand Up @@ -5457,7 +5459,7 @@ func (m orgPromptModel) View() string {

var b strings.Builder

b.WriteString(titleStyle.Render(fmt.Sprintf("GitHub Brain %s / 📥 Pull", Version)) + "\n")
b.WriteString(titleStyle.Render(fmt.Sprintf("GitHub Brain %s / 🔄 Pull", Version)) + "\n")
b.WriteString("\n")
b.WriteString(" Enter your GitHub organization:\n")
b.WriteString(" " + m.textInput.View() + "\n")
Expand Down
61 changes: 26 additions & 35 deletions main.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,73 +33,64 @@ When `github-brain` is run without arguments, display an interactive menu:

```
╭────────────────────────────────────────────────────────────────╮
│ GitHub Brain 1.0.0 / 🏠 Home 👤 Not logged in │
│ │
│ > 🔧 Setup Configure authentication and settings │
│ 📥 Pull Sync GitHub data to local database │
│ 🚪 Quit Exit │
│ │
│ Press Enter to select, Ctrl+C to quit │
│ GitHub Brain / 🏠 Home 1.0.0 │
│ │
│ ▶ 🔧 Setup Configure GitHub username and organization │
│ 🔄 Pull Sync GitHub data to local database │
│ 🚪 Quit Ctrl+C │
╰────────────────────────────────────────────────────────────────╯
```

After login but no organization configured:

```
╭────────────────────────────────────────────────────────────────╮
│ GitHub Brain 1.0.0 / 🏠 Home 👤 @wham (no org) │
│ │
│ > 🔧 Setup Configure authentication and settings │
│ 📥 Pull Sync GitHub data to local database │
│ 🚪 Quit Exit │
│ │
│ Press Enter to select, Ctrl+C to quit │
│ GitHub Brain / 🏠 Home 👤 @wham · 1.0.0 │
│ │
│ ▶ 🔧 Setup Configure GitHub username and organization │
│ 🔄 Pull Sync GitHub data to local database │
│ 🚪 Quit Ctrl+C │
╰────────────────────────────────────────────────────────────────╯
```

After successful login with organization configured:

```
╭────────────────────────────────────────────────────────────────╮
│ GitHub Brain 1.0.0 / 🏠 Home 👤 @wham (my-org) │
│ │
│ 🔧 Setup Configure authentication and settings │
│ > 📥 Pull Sync GitHub data to local database │
│ 🚪 Quit Exit │
│ │
│ Press Enter to select, Ctrl+C to quit │
│ GitHub Brain / 🏠 Home 👤 @wham · 🏢 my-org · 1.0.0 │
│ │
│ 🔧 Setup Configure GitHub username and organization │
│ ▶ 🔄 Pull Sync GitHub data to local database │
│ 🚪 Quit Ctrl+C │
╰────────────────────────────────────────────────────────────────╯
```

### Title Bar Format

The title bar contains:

- Left side: `GitHub Brain <version> / <emoji> <screen>`
- Right side: `👤 <status>` (right-aligned)
- Left side: `GitHub Brain / <emoji> <screen>`
- Right side: `👤 @<username> · 🏢 <org> · <version>` (right-aligned, version in dim style)

User status values:
Right side components (shown only when available):

- `👤 Not logged in` - No GITHUB_TOKEN in .env or token invalid
- `👤 @username (no org)` - Token valid but no organization configured
- `👤 @username (org)` - Token and organization configured
- `👤 @username` - Shown when logged in
- `🏢 org` - Shown when organization is configured
- `<version>` - Always shown, in dim style

### Menu Navigation

- Use arrow keys (↑/↓) or j/k to navigate
- Press Enter to select
- Press Esc to go back (in submenus)
- Press Ctrl+C to quit
- Highlight current selection with `>`
- Highlight current selection with `▶` (blue)

### Menu Items

1. **🔧 Setup** - Opens the setup submenu (see [Setup Menu](#setup-menu) section)
2. **📥 Pull** - Runs the pull operation (see [pull](#pull) section)
3. **🚪 Quit** - Exit the application
2. **🔄 Pull** - Runs the pull operation (see [pull](#pull) section)
3. **🚪 Quit** - Exit the application (Ctrl+C)

### Default Selection

Expand Down Expand Up @@ -388,7 +379,7 @@ Console at the beginning of pull:

```
╭────────────────────────────────────────────────────────────────╮
│ GitHub Brain 1.0.0 / 📥 Pull 👤 @wham (my-org) │
│ GitHub Brain 1.0.0 / 🔄 Pull 👤 @wham (my-org) │
│ │
│ 📋 Repositories │
│ 📋 Discussions │
Expand All @@ -412,7 +403,7 @@ Console during first item pull:

```
╭────────────────────────────────────────────────────────────────╮
│ GitHub Brain 1.0.0 / 📥 Pull 👤 @wham (my-org) │
│ GitHub Brain 1.0.0 / 🔄 Pull 👤 @wham (my-org) │
│ │
│ ⠋ Repositories: 1,247 │
│ 📋 Discussions │
Expand All @@ -436,7 +427,7 @@ Console when first item completes:

```
╭────────────────────────────────────────────────────────────────╮
│ GitHub Brain 1.0.0 / 📥 Pull 👤 @wham (my-org) │
│ GitHub Brain 1.0.0 / 🔄 Pull 👤 @wham (my-org) │
│ │
│ ✅ Repositories: 2,847 │
│ ⠙ Discussions: 156 │
Expand All @@ -460,7 +451,7 @@ Console when an error occurs:

```
╭────────────────────────────────────────────────────────────────╮
│ GitHub Brain 1.0.0 / 📥 Pull 👤 @wham (my-org) │
│ GitHub Brain 1.0.0 / 🔄 Pull 👤 @wham (my-org) │
│ │
│ ✅ Repositories: 2,847 │
│ ❌ Discussions: 156 (errors) │
Expand Down Expand Up @@ -1317,7 +1308,7 @@ Download the appropriate archive for your platform from [releases](https://githu

```bash
# Specific version
curl -L https://github.com/wham/github-brain/releases/download/v1.2.3/github-brain-darwin-arm64.tar.gz | tar xz
curl -L https://github.com/wham/github-brain/releases/download/v1.2.3/github-brain-darwin-arm64.tar.gz · tar xz
```

## Code Quality
Expand Down