Skip to content

feat(path-cli): native ratatui picker — Atuin-style selection, skim removed - #155

Open
od0 wants to merge 14 commits into
mainfrom
bryan/native-picker
Open

feat(path-cli): native ratatui picker — Atuin-style selection, skim removed#155
od0 wants to merge 14 commits into
mainfrom
bryan/native-picker

Conversation

@od0

@od0 od0 commented Aug 4, 2026

Copy link
Copy Markdown

Replaces the embedded skim backend with a first-party ratatui picker behind the existing fuzzy::pick seam — all ~26 call sites (p import, share, resume) upgrade with zero call-site changes. UX inspired by Atuin. External fzf stays untouched as the escape hatch (--picker fzf).

What's in the box

  • crates/path-cli/src/tui/mod.rs (event loop, terminal lifecycle), state.rs (pure handle_event, event-vector testable), render.rs (layout ladder, match-highlight spans), matcher.rs (nucleo-matcher + a real parser for fzf --with-nth notation), preview.rs (debounced async preview via std::thread + mpsc, per-row cache, kill-on-supersede).
  • Adaptive layout ladder (DEFAULT_LAYOUT, one-line constant): inline compact at the bottom of the terminal when no preview is configured (Atuin-style); fullscreen when a preview is configured — side-by-side ≥100 cols, stacked below.
  • nucleo matching brings fzf-style query operators everywhere: space=AND, 'exact, ^prefix, !negate. Hidden columns (with_nth) are neither shown nor searchable, same as fzf.
  • Previews run the same {exe} show --ansi … shell templates as before, 100 ms debounce, ANSI → ratatui via ansi-to-tui with plain-text fallback; loading/error states render in-pane and never kill the picker.
  • Terminal hygiene: renders to stderr (stdout stays clean for piped results), idempotent restore on drop and panic, raw mode undone even when setup fails mid-way, inline viewport cleared with the cursor homed so the shell resumes exactly where the picker sat.
  • skim removed: skim_picker.rs deleted; embedded-picker feature repointed to ratatui/crossterm/nucleo-matcher/ansi-to-tui/unicode-segmentation — all already in the tree (skim 4.x was itself a ratatui app), and the lockfile sheds skim/tui-term/portable-pty/frizbee. --picker skim is a hidden alias for native with a one-time deprecation note.

Verification

  • Full suite green under RUSTFLAGS="-D warnings"; scripts/quality_gates.sh -site 7/7 PASS.
  • Event-vector tests pin the transition table (marks survive query changes, Ctrl-D-on-empty cancels, hidden-column non-searchability, equal-score tiebreak by input order); insta TestBackend snapshots pin 8 render states, plus style-level assertions that highlight spans are grapheme-correct (emoji-ZWJ titles highlight the matched text, not the emoji) and carry bold/underline.
  • Opt-in real-PTY smoke tests (cargo test -p path-cli --test picker_pty -- --ignored): accept-first-row exits 0 with a cache id on stdout; Esc exits 130. Both pass locally.
  • Adversarially reviewed pre-push; all findings fixed (grapheme index space, raw-mode leak on setup failure, preview kill-slot race, dishonest tiebreak test, missing style assertions, cursor homing, hidden-pane preview spawns).

Rebase notes

Spec + plan: docs/superpowers/{specs,plans}/2026-08-03-native-picker*.

Sibling PR: bare path resume (#110) adds a session picker above this same seam — independent; either merges first.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

od0 added 14 commits August 3, 2026 15:44
…eview hygiene

Adversarial-review findings: nucleo reports grapheme positions, so
highlight spans now segment identically (unicode-segmentation);
TermGuard::new undoes raw mode on partial failure; preview kill slot
parks replace-and-kill keyed by spawn generation (no zombie or ABA
reap); honest equal-score tiebreak test; style-level assertions on
highlight spans; inline restore homes the cursor to the viewport
origin; preview jobs pause while the pane is hidden.
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

🔍 Preview deployed: https://51d61dcc.toolpath.pages.dev

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