Repository navigation
[0.0.28] feat(init): theme picker live preview while navigating (#2435) - #2616
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 41 minutes. View limit details
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Picker frame preview hook crates/bitty-terminal/src/init.rs |
The option picker accepts an optional per-frame hook and renders the returned line in key-loop and line-loop frames. |
Theme preview and picker integration crates/bitty-terminal/src/init.rs |
Theme candidates update the in-memory preview without recording a step snapshot. When available, the runtime receives the changed palette. The theme picker supplies a themed strip, and preview setup requires TTY stdin and stdout while excluding --yes, --safe, --headless, and --test-mode. |
Preview behavior and CLI validation crates/bitty-terminal/src/tests.rs, crates/bitty-terminal/tests/cli_init_profile.rs, CHANGELOG.md |
Tests cover preview, commit, cancellation, invalid candidates, and non-interactive behavior. The changelog describes preview and restore behavior and the non-persistence boundary. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant User
participant Picker as bitty init theme picker
participant Preview as InitThemePreview
participant Runtime
User->>Picker: Move cursor to a theme
Picker->>Preview: Preview cursor candidate
Preview->>Runtime: Apply changed palette when runtime is available
Preview-->>Picker: Return themed strip
Picker-->>User: Render preview frame
User->>Picker: Press Enter, Esc, or end input
Picker-->>User: Commit selection or restore prior theme
Possibly related PRs
- bitty-terminal/bitty#2584: That PR adds focused and idle border colors to
ThemePalette; this change uses the theme-palette contract to update visible chrome during preview.
Merge Risk: 
Minimal · up to 410a5
-
No identified issue blocks merging the live theme preview after normal checks.
Pre-merge checks: 
3 · 
1 · 
1
-
Failed checks: 1 warning · 1 inconclusive Passed checks: 3 passed-
Full details: Out of Scope Changes check
-
Explanation
The changed implementation, tests, and changelog all support issue
#2435. The picker hook, runtime palette update, rollback behavior, TTY gates, and invalid-candidate handling are directly related to the requested preview. No unrelated change is demonstrated.
-
Full details: Linked Issues check
-
Explanation
Issue
#2435requires live preview on cursor movement, Esc rollback, Enter commit, no preview writes, safe non-TTY and--yesbehavior, revert and non-TTY tests, andbitty-manualdocumentation. The reviewed changes implement the preview hook, palette update, themed strip, rollback, commit, fail-soft invalid candidates, write protection, TTY gates, and tests. The whole-PR summary lists nobitty-manualchange, and thebitty-manualdiff is empty. The separate documentation PR does not establish completion in this PR.Resolution
Add the required live theme preview documentation to
bitty-manualin this pull request, then verify the documented behavior.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 70.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 20 functions across 2 files. (2 skipped: 1 unsupported, 1 too large.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
The theme step now previews the entry under the cursor on every picker frame instead of waiting for Enter: - apply the candidate through Runtime::set_theme_palette, the same sink theme.set, live config reload, and ThemeChanged use, resolved from the same effective-config mapping (no second renderer); - repaint one themed chrome strip from that resolved palette (background, foreground, 16 ANSI colors, cursor, selection, focused/idle borders); - keep the preview non-persistent: InitPreview::preview_theme records no step snapshot, and no config/profile/session state is written; - gate the preview overlay and live session on a TTY stdout as well as a TTY stdin, so --yes, preset seeds, and piped output stay unchanged; - ignore an unresolvable candidate (previous theme and existing retry diagnostic preserved). Enter commits the highlighted theme as before; Esc/EOF rolls the overlay back and restores the baseline palette.
28a100b to
410a5dd
Compare
Xuepoo
left a comment
There was a problem hiding this comment.
Guard verification (independent agent, bitty blitz guard tick, 2026-10-24 13:55 CST)
Checks performed on head 50d7061a (ctx-1499/feat-init-theme-live-preview):
gh pr checks 2616on the exact head SHA: 20 pass, 0 fail, 0 pending (Quality gates,
MSRV 1.85, Linux, Windows, macOS, Supply chain, CodeQL, VM tier all green).- Diff scope matches the PR body: CHANGELOG.md,
crates/bitty-terminal/src/init.rs,
src/tests.rs,tests/cli_init_profile.rs— no unrelated files. - Single-setter claim is consistent with the diff: the preview path funnels through
Runtime::set_theme_palette, andInitPreview::preview_themerecords no step snapshot,
so no config/profile/session/plugin-state write can occur during preview. - Non-interactive paths preserved: overlay and wizard live session gate on TTY stdout
and TTY stdin, so--yes, preset--profile, and piped output keep current behavior. - Determinism/authority scan: no hardcoded host paths, usernames, hosts, ports or repo
URLs added; no let-chains (if … && let …) introduced, so MSRV 1.85 is safe. - Failure path: unresolvable candidate leaves prior theme in place and surfaces the
existing Enter-retry diagnostic — no panic path added.
Verdict: merge-eligible on the evidence above. This is a CI-plus-diff verification, not a
line-by-line design review; the author's local evidence (cargo test -p bitty-terminal --bin bitty init 126 passed, --test cli_init_profile 26 passed) is consistent with the green
Quality gates run.
Closes #2435
Summary
bitty inittheme picker now previews the entry under the cursor onevery rendered frame instead of waiting for Enter. Each move installs the
candidate through
init_preview_push_theme_live, which resolves the sameeffective-config palette and calls
Runtime::set_theme_palette— the onesetter
theme.set, live config reload, andThemeChangedall end in (nosecond renderer).
background/foreground, the 16 ANSI colors, and the cursor, selection, and
focused/idle border swatches.
InitPreview::preview_themenever records astep snapshot, and no config, profile, session, or plugin-state file is
written. Enter commits the highlighted theme exactly as before; Esc or
end-of-input rolls the overlay back and restores the baseline palette.
stdout as well as a TTY stdin, so
--yes, preset--profileseeds, andpiped output keep their existing non-interactive behavior.
palette, and strip) and the existing Enter retry diagnostic still appears;
nothing panics.
Verification
cargo fmt --all -- --checkcargo clippy -p bitty-terminal --all-targets --locked -- -D warningscargo test -p bitty-terminal --bin bitty init→ 126 passedcargo test -p bitty-terminal --test cli_init_profile→ 26 passedno-snapshot/no-write, invalid candidate, non-TTY/
--yes) and 2binary-level tests (
--yesand piped stdin).bitty-manualguide:just checkgreen (separate docs-only PR).Pre-existing base failures (not introduced here)
Reproduced on a detached worktree at
origin/main(15006647):candidates::tests::plugins_union_state_and_store_sortedfails with thestale TOML fixture after the data-only Lua ledger change (feat(plugin): data-only Lua ledger and generated per-plugin defaults (#2576) #2600).
just markdownlintreportsMD024for the duplicate### Changedheadingunder
[Unreleased]inCHANGELOG.md.Priority: P2 | Area: cli/ui | Labels: feat,P2,area:cli,area:ui | Milestone: v0.0.28 | RFC: - | Task: CTX-1499
Summary by CodeRabbit
bitty initnow previews theme choices as you move through them in an interactive terminal, including an updated palette display.--yes,--safe,--headless, or--test-mode; these flows retain their existing behavior.