Skip to content

feat(ui): group history by day - #1011

Merged
benvinegar merged 9 commits into
mainfrom
feat/github-style-log-history
Sep 6, 2026
Merged

benvinegar merged 9 commits into
mainfrom
feat/github-style-log-history

Conversation

@benvinegar

@benvinegar benvinegar commented Sep 6, 2026 •

Copy link
Copy Markdown
Member

Problem

Interactive hunk log used a per-commit topology graph and full author names/dates, which made ordinary chronological browsing busier than GitHub’s grouped commit history. Its content also used only a few generic colors instead of carrying the active Hunk theme through the history surface.

Approach

  • make a quiet day-grouped timeline the default interactive presentation
  • render title-first, three-line entries with account-like author handles and relative timestamps
  • apply visibly distinct semantic theme roles to the timeline, headings, authors, timestamps, refs, IDs, copy actions, selection, and graph lanes
  • add breathing room below each day heading while continuing the chronological rail
  • open the shared theme picker with t or View → Theme…
  • keep commit IDs and copy actions right-aligned across terminal widths without wrapping; reserve edge slack for terminals that render the copy glyph wider
  • preserve the grouped timeline at narrow widths and truncate text/IDs within explicit column bounds
  • preserve compact branch/tag context below the wide breakpoint; prefer a complete HEAD ref summary when full decorations do not fit, otherwise use a real ellipsis and preserve the closing delimiter
  • preserve commit topology, including merge-lane convergence, as an optional View → Graph view presentation without day headings
  • account for non-selectable day headings in scrolling, paging, search, prefetch, refresh, and EOF backfill with viewport-bounded planning for deep history jumps
  • preserve strict monochrome rendering for --color never, NO_COLOR, and dumb terminals
  • leave static and redirected hunk log output unchanged

Exact forge usernames are not always present in offline commit metadata. GitHub noreply addresses use their embedded username; other addresses fall back to the email local part, then the author name.

Visual evidence

Real Hunk TUI, Linux/tmux, 100×20:

  File  View  Navigate  Commit  Help                      hunk-b · Git history

 ○─ Commits on Sep 6, 2026
 │
 │  refactor: extract bundled Sapling provider (#1003)                                   d27260e3 ⧉
 │  benvinegar · 29 minutes ago
 │
 │  refactor: extract bundled Jujutsu provider (#1002)                                   68a8fb9f ⧉
 │  benvinegar · 29 minutes ago
 │
 │  refactor: extract bundled Git provider (#1001)                                       0bd9b870 ⧉
 │  benvinegar · 29 minutes ago

A colored Dracula-theme real-TTY run emitted nine distinct active-theme foreground/background SGR roles, including cyan, green, white, and layered grays, and exited cleanly. Reference design: https://glance.sh/0ixtgYKAPiI1Yrg5irfb.png

Validation

  • bun run typecheck
  • bun run lint
  • bun run deps:check
  • bun run test — 2,100 passed, 2 skipped
  • bun run test:integration — 153 passed, 1 platform skip
  • bun run test:tty-smoke — 9 passed
  • focused PTY coverage for t, the theme picker, grouped rendering, live resizing, no-wrap SHA placement, narrow timeline preservation, copy hit-testing, and Graph view
  • real 100×20 tmux TTY smoke runs in themed and monochrome modes — rendered history and exited cleanly

One unrelated note-composer PTY test timed out during an earlier integration run; it passed both an isolated rerun and subsequent complete integration runs. macOS and Windows were not tested locally.

This PR description was generated by Pi using gpt-5.6-sol

@vercel

vercel Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
hunk-web Ignored Ignored Preview Sep 6, 2026 11:42pm UTC

Request Review

@benvinegar
benvinegar marked this pull request as ready for review September 6, 2026 23:31
@greptile-apps

greptile-apps Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR redesigns interactive hunk log around day-grouped, theme-aware history entries while retaining topology as an optional graph view.

  • Adds local-day headings, account-like author labels, relative timestamps, compact decorations, and responsive right-aligned commit actions.
  • Introduces viewport geometry that accounts for non-selectable headings across navigation, refresh, paging, and prefetch.
  • Adds semantic history colors, strict monochrome theme projection, a theme shortcut, documentation, and focused unit/PTY coverage.
  • The new viewport planner has a quadratic path when jumping through large, fully loaded histories.

Confidence Score: 4/5

The PR should not merge until large-history viewport jumps are made bounded enough to avoid freezing the interactive log.

Jump-to-last and search can load the full history and then invoke a quadratic viewport-fitting loop several times during selection and rendering.

Files Needing Attention: packages/hunk/src/ui/log/geometry.ts

Important Files Changed

Filename Overview
packages/hunk/src/ui/log/LogApp.tsx Renders grouped headings, semantic colors, responsive entries, graph lanes, and revised mouse interactions.
packages/hunk/src/ui/log/controller.ts Integrates body-height-aware viewport planning with navigation, search, refresh, paging, and graph toggling.
packages/hunk/src/ui/log/geometry.ts Adds grouped viewport measurement and EOF backfilling, but selection fitting becomes quadratic during large jumps.
packages/hunk/src/ui/log/responsiveLayout.ts Projects three-line history entries with bounded graph, metadata, decorations, IDs, and copy actions.
packages/hunk/src/ui/log/formatting.ts Adds validated-date grouping, relative-time formatting, and offline account-like author labels.
packages/hunk/src/ui/log/colorPolicy.ts Maps history roles to active theme colors and fully neutralizes theme fields in monochrome mode.
test/pty/log-integration.test.ts Expands terminal integration coverage for grouped history, resizing, theme selection, ASCII output, and graph view.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    Input[Keyboard, mouse, search, or refresh] --> Controller[LogController]
    Controller --> Load[Load history pages]
    Load --> Rows[History graph rows]
    Rows --> Geometry[Plan viewport geometry]
    Geometry --> Grouped{Graph view enabled?}
    Grouped -->|No| Days[Day headings and timeline]
    Grouped -->|Yes| Graph[Topology lanes]
    Days --> Projection[Responsive row projection]
    Graph --> Projection
    Projection --> Render[Themed interactive log]
    Geometry -. quadratic jump near EOF .-> Controller
Loading
Prompt To Fix All With AI
### Issue 1
packages/hunk/src/ui/log/geometry.ts:72-73
**Quadratic viewport planning**

When `G` or search loads a large history and moves from an early viewport to a commit near EOF, this loop advances `top` one row at a time while `selectionFits` rescans every remaining row. This makes viewport planning quadratic in the number of commits. Because planning also runs multiple times during selection and rendering, repositories with thousands of commits can freeze the interactive log. Please compute the fitting start directly or limit each scan to the few entries that can fit within `bodyHeight`.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "fix(ui): preserve responsive history con..." | Re-trigger Greptile

Comment thread packages/hunk/src/ui/log/geometry.ts Outdated
@benvinegar
benvinegar enabled auto-merge (squash) September 6, 2026 23:44
@benvinegar
benvinegar merged commit bf3c2a7 into main Sep 6, 2026
17 of 18 checks passed
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.

1 participant