Skip to content

Preview zoxide#3

Merged
Pajn merged 1 commit into
mainfrom
preview-zoxide
Mar 25, 2026
Merged

Preview zoxide#3
Pajn merged 1 commit into
mainfrom
preview-zoxide

Conversation

@Pajn

@Pajn Pajn commented Mar 24, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Zoxide directory integration: search zoxide from the picker, create sessions from matched directories, and show a distinct "Z" marker.
    • Session naming: prefer a basename and append a stable hashed suffix on name collisions.
    • Unified preview handling with directory previews for zoxide entries and clearer "preview not supported" fallback messages.
  • Tests

    • Added tests for zoxide selection, directory preview rendering, and session-naming collision cases.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d2f3bd5b-d35d-4bea-b7a2-9596764df14a

📥 Commits

Reviewing files that changed from the base of the PR and between 3e97d2a and c7950c4.

📒 Files selected for processing (4)
  • crates/wisp-bin/src/git.rs
  • crates/wisp-bin/src/main.rs
  • crates/wisp-core/src/view.rs
  • crates/wisp-ui/src/lib.rs

📝 Walkthrough

Walkthrough

Routes previews through a new CombinedPreviewProvider, adds zoxide directory matches as SessionListItemKind::Zoxide, changes session creation to create_session_with_basename (basename or basename+hash from canonical path), updates picker filtering/preview generation for zoxide, and adjusts tests/stubs accordingly.

Changes

Cohort / File(s) Summary
Picker, session creation & preview
crates/wisp-bin/src/main.rs
Added CombinedPreviewProvider and PreviewContent import; always use combined provider. Replaced create_session_from_worktree_path with create_session_with_basename (use basename unless collision → append hash from canonicalized path; tmux target dir = canonicalized path). Extended activate_filter_selection to handle Worktree and new Zoxide items; updated picker filtering to query zoxide (cached across frames) and append synthetic SessionListItemKind::Zoxide. Updated generate_preview to handle Zoxide previews and to check provider capability for Worktree. Tests updated for session-name logic, zoxide behaviors, and StubTmuxClient.
Core model
crates/wisp-core/src/view.rs
Added SessionListItemKind::Zoxide enum variant to represent zoxide directory matches.
UI rendering
crates/wisp-ui/src/lib.rs
render_list updated to render marker "Z" for SessionListItemKind::Zoxide; existing markers for Worktree, current, previous, and default remain.
Tests & helpers
crates/wisp-bin/src/main.rs (tests), crates/wisp-bin/src/git.rs (tests)
StubTmuxClient now supports configurable existing_sessions; replaced prior worktree-collision test with create_session_with_basename_* collision/no-collision tests; added tests for activate_filter_selection with Zoxide items and directory preview generation for zoxide entries. In git tests, temp-dir naming uses process id + AtomicU64 counter and ensures removal/creation of the directory.

Sequence Diagram

sequenceDiagram
    actor User
    participant Input as Filter Input
    participant Zoxide as Zoxide
    participant Picker as Picker / SessionList
    participant Preview as CombinedPreviewProvider
    participant Tmux as Tmux Client
    participant Creator as create_session_with_basename

    User->>Input: type query
    Input->>Zoxide: query_directory(trimmed_query)
    Zoxide-->>Input: directory match (path) / none
    Input->>Picker: append SessionListItem(kind=Zoxide) if match
    Picker->>Preview: request preview for selected item
    Preview-->>Picker: render preview (dir/file/session) or "preview not supported"
    User->>Picker: select Zoxide item
    Picker->>Tmux: list_sessions()
    Tmux-->>Picker: existing session names
    Picker->>Creator: create_session_with_basename(basename, path)
    Creator->>Tmux: create/attach session (basename or basename-hash) at canonicalized path
    Tmux-->>User: session created/attached
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped through zoxide’s lane tonight,

Basenames checked, collisions solved by light;
Canonical paths and previews entwine,
A tiny “Z” marks the hopping line;
Cheers — I nibble bugs away with delight.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 34.78% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Preview zoxide' directly describes the main change: adding zoxide directory preview support alongside existing preview providers.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Pajn

Pajn commented Mar 24, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

1 similar comment
@Pajn

Pajn commented Mar 24, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Pajn

Pajn commented Mar 24, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Pajn

Pajn commented Mar 24, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Pajn

Pajn commented Mar 24, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Pajn

Pajn commented Mar 24, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Pajn

Pajn commented Mar 24, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

1 similar comment
@Pajn

Pajn commented Mar 24, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

1 similar comment
@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Pajn

Pajn commented Mar 24, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

1 similar comment
@Pajn

Pajn commented Mar 24, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

1 similar comment
@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/wisp-bin/src/main.rs`:
- Around line 877-879: The zoxide.query_directory(&query) call is being invoked
on every UI redraw when InputMode::Filter is active, causing repeated
shell/zoxide invocations; introduce a small cache (e.g., last_query: String and
last_zoxide_match: Option<...>) at the enclosing scope (where the main UI loop
and InputMode::Filter handling live) and only call
zoxide.query_directory(&query) when query.trim() != last_query.trim(); update
last_query and last_zoxide_match when you perform the lookup, and use
last_zoxide_match in place of re-calling zoxide.query_directory (preserving the
existing handling of Ok(Some(zoxide_match))). Ensure comparisons use trimmed
query and handle clearing the cache when the filter becomes empty or InputMode
changes.
- Around line 877-905: The zoxide match is being pushed into filtered
unconditionally when InputMode::Filter is active, which lets zoxide directories
appear even in worktree-only picker mode; update the condition that wraps the
zoxide.query_directory and filtered.push (the block creating SessionListItem) to
also require the picker mode be PickerMode::AllSessions (or the equivalent
variable representing the current PickerMode) before adding the zoxide item, so
that in worktree-only mode the zoxide row is skipped (or alternatively, change
the picker mode contract and associated help text if surfacing zoxide entries in
worktree mode is intended).

In `@crates/wisp-core/src/view.rs`:
- Line 84: The preview code currently treats SessionListItemKind::Zoxide as an
unknown kind and falls through to the session-preview branch; update
generate_preview to add a dedicated arm/case for SessionListItemKind::Zoxide
that uses the entry's worktree_path to produce a directory preview (instead of
constructing a synthetic tmux session like "zoxide:/..."). Locate the
generate_preview function and the match on SessionListItemKind, add a branch for
Zoxide that calls the same directory-preview logic used for worktree entries
(using worktree_path) so highlighting a Zoxide row shows the directory contents.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3c571b31-1873-42cf-bb27-0474714dac05

📥 Commits

Reviewing files that changed from the base of the PR and between 48b4d47 and 1bcd9c3.

📒 Files selected for processing (3)
  • crates/wisp-bin/src/main.rs
  • crates/wisp-core/src/view.rs
  • crates/wisp-ui/src/lib.rs

Comment thread crates/wisp-bin/src/main.rs Outdated
Comment thread crates/wisp-bin/src/main.rs
Comment thread crates/wisp-core/src/view.rs
@Pajn

Pajn commented Mar 24, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

1 similar comment
@Pajn

Pajn commented Mar 24, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

1 similar comment
@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Pajn

Pajn commented Mar 25, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 25, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/wisp-bin/src/git.rs`:
- Around line 224-226: The temp cleanup currently swallows errors from
fs::remove_dir_all when removing `path`, which can leave stale files; change
this to handle the Result: call fs::remove_dir_all(&path) and if it Errs,
inspect the io::ErrorKind — ignore only NotFound but return/propagate or panic
on any other error so tests fail fast; update the code around the existing
path.exists() / fs::remove_dir_all call to check and handle the error instead of
discarding it.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b298cf8d-7a5b-4c52-b5d7-0297034d917d

📥 Commits

Reviewing files that changed from the base of the PR and between bec5c1e and 3e97d2a.

📒 Files selected for processing (4)
  • crates/wisp-bin/src/git.rs
  • crates/wisp-bin/src/main.rs
  • crates/wisp-core/src/view.rs
  • crates/wisp-ui/src/lib.rs

Comment thread crates/wisp-bin/src/git.rs Outdated
@Pajn Pajn merged commit 3f2619e into main Mar 25, 2026
2 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