Skip to content

Add live picker for bare qr go - #50

Merged
baanish merged 7 commits into
masterfrom
qr-g-live-picker
Jul 23, 2026
Merged

Add live picker for bare qr go#50
baanish merged 7 commits into
masterfrom
qr-g-live-picker

Conversation

@baanish

@baanish baanish commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • open a lightweight live filter picker for bare qr go / qr g
  • keep qr go <project> direct lookup behavior unchanged
  • keep picker UI on stderr so --print-path stdout remains shell-wrapper safe

Verification

  • cargo fmt --all -- --check
  • cargo test
  • cargo clippy --all-targets --locked -- -D warnings
  • PTY smoke: bare qr go --print-path, typed api, selected /tmp/orion-api
  • Direct smoke: qr go quick-runner --print-path printed only /tmp/quick-runner

Summary by CodeRabbit

  • New Features
    • Added an interactive live-filter picker for qr go/qr g when no project argument is provided, using cached projects.
    • Tracks picker interaction time and includes it in the command result.
  • Bug Fixes
    • Empty input no longer errors in a terminal; it now opens the picker. Esc or Ctrl-C cancels cleanly.
  • Documentation
    • Updated README and changelog to describe the new picker and wrapper flow.
  • Tests
    • Added coverage for picker label formatting, index-to-project mapping, and live-filter rendering/truncation (including Unicode/emoji width).

@kilo-code-bot

kilo-code-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The incremental change (commit range 38aac1d..20ea952) extends key-release filtering to the numbered picker: pick_index now routes event::read results through the new numbered_picker_key_code helper, which returns None for KeyEventKind::Release, so release events are skipped via continue. This mirrors the existing should_handle_key_event guard already used in pick_live_index (src/picker.rs:216). A new unit test (numbered_picker_ignores_key_release_events) confirms release returns None and press returns the KeyCode. No new issues found in the changed code.

Files Reviewed (1 file)
  • src/picker.rs
Previous Review Summaries (6 snapshots, latest commit 38aac1d)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 38aac1d)

Status: No Issues Found | Recommendation: Merge

The incremental change (commit range a4da6f4..38aac1d) refactors pick_live_index so the interactive loop runs inside an immediately-invoked closure whose Result is funneled through the new complete_live_filter helper. This guarantees clear_live_filter(rendered_lines) runs on both the success and error paths, fixing the previously-flagged issue where render_live_filter/event::read failures could leave stale picker lines on the terminal. An added unit test (live_filter_cleanup_runs_when_the_picker_loop_errors) confirms cleanup runs when the loop errors. No new issues found in the changed code.

Files Reviewed (1 file)
  • src/picker.rs

Previous review (commit a4da6f4)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (6 files)
  • Cargo.toml
  • src/ai/client.rs
  • src/commands/go.rs
  • src/config.rs
  • src/picker.rs
  • src/project_profile.rs

Previous review (commit fd65294)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file)
  • src/picker.rs

Previous review (commit 910cfa9)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • src/commands/go.rs
  • src/picker.rs

Previous review (commit 2cec2aa)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (5 files)
  • CHANGELOG.md
  • README.md
  • src/commands/go.rs
  • src/main.rs
  • src/picker.rs

Previous review (commit 25c9b35)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (5 files)
  • CHANGELOG.md
  • README.md
  • src/commands/go.rs
  • src/main.rs
  • src/picker.rs

Reviewed by glm-5.2-short · Input: 11.6K · Output: 1.8K · Cached: 167.9K

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 776f5f8c-4e90-49ab-bee2-587cd506741d

📥 Commits

Reviewing files that changed from the base of the PR and between ba8af48 and 20ea952.

📒 Files selected for processing (4)
  • src/ai/client.rs
  • src/config.rs
  • src/picker.rs
  • src/project_profile.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/picker.rs

📝 Walkthrough

Walkthrough

Adds a live-filter picker for qr go/qr g, routes empty queries to the interactive path, updates picker rendering and documentation, isolates environment-dependent tests, and simplifies npm script command selection.

Changes

Live Picker Feature

Layer / File(s) Summary
Live filter state and matching logic
src/picker.rs, src/commands/go.rs
Adds case-insensitive live filtering, selection movement, key-event handling, and project choice labels.
Picker entry point and rendering
src/picker.rs, Cargo.toml
Adds the raw-mode picker loop, terminal cleanup, pagination, styled rendering, and Unicode-aware width handling.
Live go command and project lookup
src/commands/go.rs
Loads cached projects, invokes the picker, measures interaction time, and maps the selected index to a project.
Empty-query dispatch wiring
src/main.rs
Routes empty Go queries to execute_live while retaining direct lookup for non-empty queries.
Documentation and changelog
CHANGELOG.md, README.md
Documents live filtering, direct lookup, and shell-wrapper behavior.

Test Isolation and npm Handling

Layer / File(s) Summary
Environment isolation for tests
src/ai/client.rs, src/config.rs
Adds environment locking and QR variable cleanup to environment-dependent tests.
npm test command selection
src/project_profile.rs
Uses an explicit special case for npm test and preserves npm run for other script names.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant run_with_config
  participant execute_live
  participant pick_live_index
  participant ProjectCache

  User->>run_with_config: qr go
  run_with_config->>execute_live: empty query
  execute_live->>ProjectCache: load cached projects
  execute_live->>pick_live_index: project labels
  pick_live_index-->>execute_live: selected project index
  execute_live-->>run_with_config: GoResult with path
  run_with_config-->>User: formatted result
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.21% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a live picker for bare qr go.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch qr-g-live-picker

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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 25c9b35c1a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/picker.rs Outdated

loop {
render_live_filter(&state, per_page)?;
if let Event::Key(key) = event::read()? {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Ignore release key events in live picker

On Windows, Crossterm sets key event kinds and emits release events as well as presses; because the new bare-qr go live picker handles every Event::Key, a single typed character can be inserted twice (for example api becomes aappii, and arrow/backspace actions can also apply twice). Please skip KeyEventKind::Release events before matching so filtering remains usable on Windows.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed in 910cfa9: live picker now ignores KeyEventKind::Release while still handling press/repeat events.

@baanish
baanish force-pushed the qr-g-live-picker branch from 25c9b35 to 2cec2aa Compare July 7, 2026 15:59

@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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/commands/go.rs`:
- Around line 19-26: The empty-cache path in `go` is being misreported as a user
cancellation because `picker::pick_live_index` returns `Ok(None)` when `labels`
is empty and `project_at_picker_index` turns that into “Selection cancelled.”
Add an explicit check in the `go` command flow before calling
`picker::pick_live_index`/`project_at_picker_index` so an empty `cache.projects`
returns a clear “no projects found” style error instead of cancellation, and
keep the normal `Selection cancelled` behavior only for real picker aborts.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5bd2f6c7-7c57-4477-b673-707c6ab67046

📥 Commits

Reviewing files that changed from the base of the PR and between a5980d6 and 25c9b35.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • README.md
  • src/commands/go.rs
  • src/main.rs
  • src/picker.rs

Comment thread src/commands/go.rs

@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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/picker.rs`:
- Around line 193-234: The live picker in pick_live_index leaves stale terminal
output if render_live_filter or event::read fails because the ? operator exits
before cleanup. Update pick_live_index to ensure
clear_live_filter(rendered_lines) runs on every error path before propagating
the failure, preserving the same cleanup used for Enter/Esc/Ctrl-C and keeping
the UI consistent even when rendering or input reading fails.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cc03ce42-10f3-4b2c-a1b2-ced3e9f1a6e8

📥 Commits

Reviewing files that changed from the base of the PR and between 25c9b35 and ba8af48.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • CHANGELOG.md
  • Cargo.toml
  • README.md
  • src/commands/go.rs
  • src/main.rs
  • src/picker.rs
✅ Files skipped from review due to trivial changes (2)
  • CHANGELOG.md
  • README.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main.rs
  • src/commands/go.rs

Comment thread src/picker.rs
@baanish
baanish merged commit 57a85cd into master Jul 23, 2026
6 checks passed
@baanish
baanish deleted the qr-g-live-picker branch July 23, 2026 21:23
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