Skip to content

[FEATURE] Color the git branch icon when the workspace is dirty or has unpushed commits #1157

Description

@edenreich

Summary

Color the git branch icon in the input box top border (⎇ fix/issue-1147 ─ #1148) when the workspace is dirty or has unpushed commits, so the user sees the state at a glance without running git status.

Behaviour:

  • Uncommitted changes (git status --porcelain non-empty): icon in the theme warning color.
  • Unpushed commits (git rev-list --count @{u}..HEAD > 0, or no upstream at all): icon in the theme accent color.
  • Both: warning wins (uncommitted is the more urgent signal).
  • Clean and pushed: icon stays in the current status color, unchanged from today.
  • Only applies when the working directory is a git repository. Outside a repo the branch label is already omitted, and the status check must not run or surface any error.

Implementation notes (reuse what exists, no new goroutines or tickers):

  • Follow the fetchGitPRCmd pattern in internal/presentation/tui/components/input_view.go: a fetchGitStatusCmd tea.Cmd that shells out via utils.RunGit off the UI goroutine and returns a new tui.GitStatusResolvedEvent{Dirty, Unpushed bool} (defined in internal/presentation/tui/state_events.go next to GitPRResolvedEvent).
  • Trigger on the same event-loop points the PR fetch uses: Init, BashCommandCompletedEvent, and ToolExecutionCompletedEvent. Unlike the PR fetch, fire it for every completed tool result, not only Bash, because Write/Edit/Delete also dirty the tree. It is a cheap local git call.
  • Render: buildGitBranchLabel keeps producing the plain label; RenderInputField / spliceBranchIntoTopBorder in internal/presentation/tui/styles/provider.go receive the state and color only the icon rune. Truncation in truncateBorderLabel must keep working with the colored icon (color after truncation, not before).
  • Gate on the existing chat.status_bar.indicators.git_branch flag; no new config key.
  • Changes made outside the TUI (editor, another terminal) stay unknown until the next event-loop trigger. That is acceptable for v1; a slow tea.Tick refetch can be added later if it matters.

Acceptance Criteria

  • tui.GitStatusResolvedEvent and fetchGitStatusCmd added, following the GitPRResolvedEvent / fetchGitPRCmd pattern
  • Status refetched on Init, BashCommandCompletedEvent, and every ToolExecutionCompletedEvent
  • Icon rendered in warning color when there are uncommitted changes, accent color when only unpushed commits, default status color when clean
  • No status command runs and nothing is rendered when the cwd is not a git repository
  • Label truncation still works with the colored icon; PR number still survives long branch names
  • Respects chat.status_bar.indicators.git_branch: false
  • Unit tests in input_view_test.go for the event handling and in provider tests for the coloring
  • docs/configuration-reference.md status bar indicator description updated

Activity

  1. added
    enhancement
    on Sep 2, 2026
  2. added theissue type on Sep 2, 2026
  3. moved this to Todo in 2026on Sep 2, 2026
  4. inference-gateway-releaser commented on Sep 2, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.188.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  5. moved this from Todo to Done in 2026on Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementreleased

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions