Skip to content

Show a lazy git dirty-count on the highlighted New-screen row #1

Closed

Description

@roypadina

What

New-screen rows already show the git branch (src/core/git.ts readGitBranch, zero-spawn). It'd be nice to also show an uncommitted-changes indicator (e.g. ±3) — but only for the currently highlighted row, so we never shell out to git for every row on the hot scan path.

Why lazy / highlighted-only

CLAUDE.md calls this out explicitly: don't spawn git per row on the scan path; "a future lazy dirty-count for the highlighted row only is the sole allowed exception." So this is the sanctioned way to add it.

Pointers

  • src/core/git.ts — add a small countDirty(dir): Promise<number> that runs git status --porcelain once for a single dir (this is the one allowed spawn).
  • src/cli/screens/NewScreen.tsx — fetch the count for the highlighted dir only (debounced on cursor move), render it next to the branch (e.g. ⎇ main ±3).
  • Add a unit test for parsing git status --porcelain output → count.

Acceptance

  • Highlighted row shows ±N when the repo has uncommitted changes; nothing for clean repos.
  • No extra git spawns for non-highlighted rows.
  • Test covers the porcelain-count parser.
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions