Skip to content

fix(ui): honor custom themes in static pager#352

Merged
benvinegar merged 1 commit into
mainfrom
fix/static-pager-custom-theme
May 23, 2026
Merged

fix(ui): honor custom themes in static pager#352
benvinegar merged 1 commit into
mainfrom
fix/static-pager-custom-theme

Conversation

@benvinegar
Copy link
Copy Markdown
Member

Summary

  • Carry configured custom theme data through the static diff pager startup plan.
  • Pass custom themes into static pager theme resolution so captured pager hosts render the selected palette.
  • Add regression coverage and a changelog entry.

Testing

  • bun test src/core/startup.test.ts src/ui/staticDiffPager.test.ts
  • bun run typecheck

This PR description was generated by Pi using OpenAI GPT-5

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 23, 2026

Greptile Summary

This PR fixes a missing custom-theme propagation in the static diff pager path. Previously, resolveConfiguredCliInput was called in the pager startup branch but only its .input field was read, causing the resolved customTheme to be silently discarded; the static pager always rendered with the fallback built-in palette regardless of user configuration.

  • startup.ts: Destructures the full resolveConfiguredCliInput result and conditionally attaches customTheme to the static-diff-pager plan.
  • main.tsx: Threads startupPlan.customTheme through to renderStaticDiffPager via the deps bag, alongside the existing stderr handle.
  • staticDiffPager.ts: Forwards deps.customTheme to the already-capable resolveTheme call, enabling the custom palette to be applied during ANSI rendering.

Confidence Score: 5/5

Safe to merge — the change threads a single optional field through an existing data path and touches no diff-parsing or rendering logic.

The root cause (only reading .input from resolveConfiguredCliInput and discarding .customTheme) is well-understood, the fix is minimal, and both the startup plan and the render function now have direct regression tests. The rest of the static pager render pipeline is unchanged, and built-in theme behavior is unaffected.

No files require special attention; all changed files are self-contained and well-covered by the new tests.

Important Files Changed

Filename Overview
src/core/startup.ts Extracts full configuredStatic object (not just .input) and conditionally attaches customTheme to the static-diff-pager plan; logic is correct and the conditional spread avoids polluting the type when no custom theme is set.
src/ui/staticDiffPager.ts Adds customTheme to StaticDiffPagerDeps and forwards it as the third argument to the already-capable resolveTheme; no logic changes to the render path itself.
src/main.tsx Passes customTheme and stderr explicitly to renderStaticDiffPager, replacing the previously implicit single-argument call; change is minimal and correct.
src/core/startup.test.ts Updates the captured-pager test to use theme: "custom" and a customTheme fixture, then asserts both the plan shape and that loadAppBootstrap is never called — good regression coverage.
src/ui/staticDiffPager.test.ts New test passes a custom theme with text: "#123456" and asserts both the strip-ANSI semantic output and the exact truecolor ANSI escape sequence, providing concrete end-to-end coverage of the rendering fix.
CHANGELOG.md Adds a one-line entry under the existing "Fixed" section; accurate and concise.

Sequence Diagram

sequenceDiagram
    participant CLI as CLI argv
    participant startup as prepareStartupPlan
    participant config as resolveConfiguredCliInput
    participant main as main.tsx
    participant pager as renderStaticDiffPager
    participant theme as resolveTheme

    CLI->>startup: argv (pager mode)
    startup->>config: resolveConfiguredCliInputImpl(staticPatchInput)
    config-->>startup: "{ input, customTheme? }"
    Note over startup: NEW: read customTheme from full result object
    startup-->>main: "StartupPlan { kind: static-diff-pager, options, customTheme? }"
    Note over main: NEW: pass customTheme via deps bag
    main->>pager: "renderStaticDiffPager(text, options, { customTheme, stderr })"
    pager->>theme: resolveTheme(options.theme, null, deps.customTheme)
    Note over theme: Already supported custom theme resolution
    theme-->>pager: AppTheme (custom palette applied)
    pager-->>main: ANSI-colored diff output
Loading

Reviews (1): Last reviewed commit: "fix(ui): honor custom themes in static p..." | Re-trigger Greptile

@benvinegar benvinegar force-pushed the fix/static-pager-custom-theme branch from 142fe63 to fc9ee89 Compare May 23, 2026 16:57
@benvinegar benvinegar merged commit 4d7a0da into main May 23, 2026
4 of 5 checks passed
@benvinegar benvinegar deleted the fix/static-pager-custom-theme branch May 23, 2026 17:06
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