Skip to content

Add project file picker - #3985

Closed
jakeleventhal wants to merge 9 commits into
pingdotgg:mainfrom
jakeleventhal:t3code/add-command-p-file-picker
Closed

Add project file picker#3985
jakeleventhal wants to merge 9 commits into
pingdotgg:mainfrom
jakeleventhal:t3code/add-command-p-file-picker

Conversation

@jakeleventhal

@jakeleventhal jakeleventhal commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Screenshot 2026-07-15 at 12 29 32 AM Screenshot 2026-07-15 at 12 29 35 AM
  • add a centered project file picker opened with Cmd/Ctrl+P
  • use the server-backed workspace index for full-project fuzzy search, including ordered skipped-character matches
  • highlight matched characters in file names and paths
  • open selected files through the same scoped right-panel action used by the Files sidebar
  • register and document the configurable filePicker.toggle keybinding

Implementation

The picker reuses the existing command palette primitives and workspace search endpoint. Server result ordering is preserved, while the client matcher is intentionally limited to a linear pass that computes highlight positions and filters non-file entries.

Validation

  • pnpm exec vp test apps/web/src/components/files/ProjectFilePicker.logic.test.ts apps/web/src/components/CommandPalette.logic.test.ts apps/web/src/keybindings.test.ts packages/contracts/src/keybindings.test.ts apps/server/src/keybindings.test.ts (81 tests)
  • pnpm exec vp check
  • pnpm exec vp run typecheck
  • independent branch review found no actionable findings or publication blockers

Note

Add project file picker triggered by mod+p keybinding

  • Adds a new ProjectFilePicker component that lets users search and open project files via a fuzzy-matched dialog with highlighted results.
  • mod+p opens the file picker; mod+k opens the command palette. Both are managed by a new reduceCommandPaletteUiState reducer in CommandPalette.logic.ts with command and files modes.
  • Client-side fuzzy matching and result highlighting are handled by ProjectFilePicker.logic.ts; server-side search is extended with an optional kind filter (file | directory) to constrain results.
  • useProjectPathSearch generalizes the existing composer path search hook to support variable limits and kind filtering; useComposerPathSearch delegates to it unchanged.
  • filePicker.toggle is added to STATIC_KEYBINDING_COMMANDS and documented in keybindings.md.
📊 Macroscope summarized 276a18d. 1 file reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted

🗂️ Filtered Issues

No issues evaluated.


Note

Medium Risk
Touches workspace search/index behavior and a new global shortcut; removing OpenAddProjectCommandPaletteProvider from CommandPalette may break sidebar/draft “add project” unless the provider is wired elsewhere.

Overview
Adds a project file picker opened with mod+p (filePicker.toggle), alongside the existing command palette on mod+k. The shared command dialog now tracks a command vs files mode and renders ProjectFilePicker in files mode, with UI state centralized in reduceCommandPaletteUiState.

ProjectFilePicker searches the active project workspace (index listing when the query is empty; debounced server search when not), applies client-side file-only fuzzy matching with highlighted name/path matches, and opens the selection via the same right-panel file action as the Files sidebar.

Server/API: project search accepts optional kind: 'file' | 'directory'; WorkspaceSearchIndex routes to fileSearch / directorySearch / mixedSearch so file-only queries are limited before truncation. Query normalization uses shared normalizeSearchQuery (including stripping leading @./).

useProjectPathSearch generalizes composer path search (configurable limit + kind); useComposerPathSearch delegates to it. Keybindings and docs register filePicker.toggle.

Reviewed by Cursor Bugbot for commit 276a18d. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2893e19d-6398-43e5-ad95-1ff1e6b31cbc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jul 15, 2026
@jakeleventhal
jakeleventhal marked this pull request as ready for review July 15, 2026 04:30
Comment thread apps/web/src/components/files/ProjectFilePicker.logic.ts Outdated
Comment thread apps/web/src/components/files/ProjectFilePicker.tsx
@macroscopeapp

macroscopeapp Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

1 blocking correctness issue found. This PR introduces a new file picker feature with new UI components and keybindings. Additionally, unresolved review comments identify a critical bug: removing OpenAddProjectCommandPaletteProvider will crash authenticated routes that depend on that context.

You can customize Macroscope's approvability policy. Learn more.

@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: 72f5b0e988

ℹ️ 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 apps/web/src/components/CommandPalette.logic.ts
Comment thread apps/web/src/components/files/projectFilesQueryState.ts Outdated
Comment thread apps/web/src/components/files/ProjectFilePicker.logic.ts
@github-actions github-actions Bot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Jul 15, 2026

@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: 0765a5faad

ℹ️ 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".

{ key: "mod+-", command: "preview.zoomOut", when: "previewFocus" },
{ key: "mod+0", command: "preview.resetZoom", when: "previewFocus" },
{ key: "mod+k", command: "commandPalette.toggle", when: "!terminalFocus" },
{ key: "mod+p", command: "filePicker.toggle", when: "!terminalFocus" },

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 Preserve existing mod+p bindings

When an existing keybindings config already uses mod+p globally (or with another broader when clause), startup still treats this new default as non-conflicting because the sync check only skips rules with the exact same shortcut and raw when string, then appends the missing default. Since resolveShortcutCommand scans later rules first, the appended filePicker.toggle rule will silently steal those users' mod+p shortcut outside terminal focus. Please avoid backfilling this default when an existing rule can overlap the same shortcut context, or choose an unassigned default.

Useful? React with 👍 / 👎.

}, [keybindings, terminalOpen, toggleOpen]);
}, [keybindings, terminalOpen, toggleCommand, toggleFiles]);

return (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 Critical components/CommandPalette.tsx:382

The CommandPalette component no longer renders OpenAddProjectCommandPaletteProvider, but its children (which include AppSidebarLayout and route Outlet) still consume the OpenAddProjectCommandPalette context via useOpenAddProjectCommandPalette(). That hook throws when the context value is absent, so authenticated app-shell routes crash during render instead of displaying the UI. Consider re-wrapping children in OpenAddProjectCommandPaletteProvider (passing openAddProject) before rendering CommandDialog.

🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/web/src/components/CommandPalette.tsx around line 382:

The `CommandPalette` component no longer renders `OpenAddProjectCommandPaletteProvider`, but its `children` (which include `AppSidebarLayout` and route `Outlet`) still consume the `OpenAddProjectCommandPalette` context via `useOpenAddProjectCommandPalette()`. That hook throws when the context value is absent, so authenticated app-shell routes crash during render instead of displaying the UI. Consider re-wrapping `children` in `OpenAddProjectCommandPaletteProvider` (passing `openAddProject`) before rendering `CommandDialog`.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 276a18d. Configure here.

clearOpenIntent={clearOpenIntent}
/>
</CommandDialog>
</ComposerHandleContext>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add-project provider removal crashes shell

High Severity

Removing OpenAddProjectCommandPaletteProvider causes useOpenAddProjectCommandPalette to access a null context. This leads to crashes in the authenticated app shell when components like Sidebar or DraftHeroHeadline mount, and breaks external 'Add project' entry points.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 276a18d. Configure here.

@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: 276a18ddfe

ℹ️ 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 on lines 382 to +384
return (
<OpenAddProjectCommandPaletteProvider openAddProject={openAddProject}>
<ComposerHandleContext value={composerHandleRef}>
<CommandDialog open={state.open} onOpenChange={setOpen}>
{children}
<CommandPaletteDialog
open={state.open}
openIntent={state.openIntent}
setOpen={setOpen}
clearOpenIntent={clearOpenIntent}
/>
</CommandDialog>
</ComposerHandleContext>
</OpenAddProjectCommandPaletteProvider>
<ComposerHandleContext value={composerHandleRef}>
<CommandDialog open={state.open} onOpenChange={setOpen}>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restore the add-project context provider

Wrapping children directly in ComposerHandleContext removes the only OpenAddProjectCommandPaletteProvider, while Sidebar, DraftHeroHeadline, and NoProjectsHero still call useOpenAddProjectCommandPalette(). That hook now receives the context's null default and throws during normal authenticated app rendering, preventing the web shell from loading; retain the provider around this subtree or migrate all consumers in the same change. The required integrated web verification for this user-visible change should cover this render path.

AGENTS.md reference: AGENTS.md:L10-L14

Useful? React with 👍 / 👎.

@jakeleventhal

Copy link
Copy Markdown
Contributor Author

Closing in favor of #4855

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant