Skip to content

Add Google lookup for selected folders - #28

Open
ryatkins wants to merge 1 commit into
tobi:mainfrom
ryatkins:JRMERRITT-14/folder-web-search
Open

ryatkins wants to merge 1 commit into
tobi:mainfrom
ryatkins:JRMERRITT-14/folder-web-search

Conversation

@ryatkins

Copy link
Copy Markdown

Adds a search icon beside the selected folder's path so users can investigate an unfamiliar directory before deciding whether to remove it. Clicking it opens Google in the default browser with the platform name, the displayed path, and questions about the folder's purpose, which application it belongs to, and the risks of deleting it.

For example, selecting ~/Library/Application Support/Claude/vm_bundles on macOS searches for:

macOS "~/Library/Application Support/Claude/vm_bundles" what is this folder, what application does it belong to, and what are the risks of deleting it?

Why use a browser search?

This is the smallest implementation that lets users research an unfamiliar folder:

  • No service setup or operating cost for disktree. Opening a normal Google search URL requires no API key, account setup, subscription, quota management, or backend. A Brave Search API integration would need credentials, request/error handling, and an in-app results interface. A shared service key would also need a backend to keep it out of distributed binaries; user-provided keys would add setup friction.
  • No LLM integration to operate or evaluate. An LLM lookup would add model configuration, credentials or local runtime requirements, latency, and potentially inference costs. A useful sourced answer would also need retrieval and citation handling. Users can inspect search results directly without disktree generating a potentially incorrect deletion recommendation.
  • Uses the existing cross-platform browser opener. GPUI's open_url hands the URL to the user's default browser. There is no embedded browser engine, platform-specific webview integration, or search-page scraping to maintain.
  • Keeps the action explicit. The displayed path is sent to Google only when the icon is clicked. Home-directory prefixes remain shortened to ~, as in the panel; other path components are included for useful context. Lookup does not mark or delete anything, change removal guards, or certify that a folder is safe to delete.

The tradeoff is that users read results in their browser rather than receiving an explanation inside disktree. Search results may be ambiguous or incomplete; this feature provides research, not a safety assessment of the folder's actual contents.

Implementation

  • Directory-only icon with an accessible label and explanatory tooltip beside the path.
  • Platform names of macOS, Windows, or Linux, and the path captured from the displayed selection.
  • URL query encoding preserves spaces, punctuation, and Unicode in folder names.
  • README documents the action.

Validation

  • cargo xtask lint passed.
  • cargo xtask test passed: 167 tests passed, 2 ignored.
  • Added a window-harness test that clicks the icon and checks the Google URL, displayed path, platform, research questions, and encoding of &, +, #, and Unicode.
  • Manually confirmed working on macOS. Windows and Linux runtime behavior has not been manually verified.

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