Skip to content

feat(tui): color the git branch icon when the workspace is dirty or unpushed - #1164

Merged
edenreich merged 4 commits into
mainfrom
feat/git-status-icon-color
Sep 2, 2026
Merged

edenreich merged 4 commits into
mainfrom
feat/git-status-icon-color

Conversation

@edenreich

@edenreich edenreich commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1157

  • New tui.GitStatusResolvedEvent{Dirty, Unpushed} and fetchGitStatusCmd (mirrors fetchGitPRCmd, uses utils.RunGit).
  • Refetched on Init, BashCommandCompletedEvent, every ToolExecutionCompletedEvent (PR refetch stays gated on Bash), and the new app heartbeat.
  • Single app heartbeat: runUIHeartbeat in cmd/chat pushes agentdomain.HeartbeatEvent through the UI notifier every 10s (constants.UIHeartbeatInterval) and stops on context cancel. It is the one clock feeding Update, in line with refactor(tui): single event-loop ingress - one notifier, no self-rescheduling pollers #700's no-self-rearming-ticks design; components that need periodic freshness subscribe to it. Handlers only return a tea.Cmd, no inline I/O.
  • RenderInputField takes an iconColor; only the leading ⎇ rune is colored, applied after truncation so long branch names and the PR number behave as before.
  • Warning color = uncommitted changes (wins), accent = unpushed commits or no upstream, default status color = clean.
  • Not a repo: git status fails, zero event returned, rev-list skipped, nothing rendered. git_branch: false skips the git process entirely.
  • Tests in input_view_test.go, provider_test.go, cmd/chat/heartbeat_test.go; docs updated.

…npushed

Adds GitStatusResolvedEvent and fetchGitStatusCmd following the PR-fetch
pattern: git status --porcelain and rev-list --count @{u}..HEAD run off the
UI goroutine on Init, bash completion, and every tool completion. The input
box top border renders the branch icon in the warning color when the tree
has uncommitted changes, accent when only unpushed commits exist, and the
default status color when clean. Outside a repo nothing runs or renders.

Closes #1157
@edenreich
edenreich requested a review from a team as a code owner September 2, 2026 23:21
One background goroutine in cmd/chat pushes agentdomain.HeartbeatEvent through
the UI notifier every 10 seconds. It is the only clock feeding the Update loop,
so periodic freshness checks subscribe to it instead of re-arming private
tea.Ticks (the pattern PR #700 removed). The input view uses it to refetch git
status for changes made outside the TUI; the git call stays in a tea.Cmd and is
skipped entirely when the git_branch indicator is disabled.
@edenreich
edenreich merged commit 2fbed93 into main Sep 2, 2026
1 check passed
@edenreich
edenreich deleted the feat/git-status-icon-color branch September 2, 2026 23:42
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.188.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant