Skip to content

[codex] Add file-open logging and picker support#11

Merged
rmarinsky merged 1 commit into
mainfrom
feat/file-associations
Jun 3, 2026
Merged

[codex] Add file-open logging and picker support#11
rmarinsky merged 1 commit into
mainfrom
feat/file-associations

Conversation

@rmarinsky

@rmarinsky rmarinsky commented Jun 3, 2026

Copy link
Copy Markdown
Owner

What changed

  • Adds BrowserCat handling for local file open events from Finder/LaunchServices.
  • Shows matching browsers/apps in the picker for supported web/dev files.
  • Records opened items in history as either link or file, including file name, extension, display format, and UTType identifier.
  • Keeps file rule UX out of scope for now: no separate File Associations settings screen and no file-rule suggestions yet.
  • Resolves .webloc and .url shortcut files before routing/logging.

Release candidate

This PR should use release:minor. On merge, the release workflow should tag v1.8.0 from the latest v1.7.3 tag. The app version is intentionally not hand-edited in project.yml; the repository release flow treats git tags as the version source of truth.

Validation

  • xcodegen generate
  • xcodebuild -project BrowserCat.xcodeproj -scheme "BrowserCat DEV" -configuration Debug -destination 'platform=macOS' -derivedDataPath /tmp/codex-browsercat-dd-logging test -quiet
  • git diff --check

Manual QA still needed

  • Finder double-click for .env, Dockerfile, .webloc, .url.
  • Multi-file open from Finder.
  • Confirm history records file metadata and chosen target app/browser correctly.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added file shortcut resolution support (.webloc, .inetloc, .url formats)
    • Added multi-URL opening in a single action
    • Added file type associations and default handler configuration
    • Extended history tracking to include files alongside links
    • Enhanced picker and menu bar to display files
  • Documentation

    • Updated settings descriptions to clarify file handling and associations
  • Tests

    • Added comprehensive test coverage for file shortcut resolution
    • Extended history entry tests for file metadata
  • Chores

    • Updated project configuration for file type support
    • Expanded localization strings for new file handling features

@rmarinsky rmarinsky added the release:minor New user-facing capability — bumps minor version label Jun 3, 2026
@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a603ebc7-0965-4ca9-9db8-f62deb12d81b

📥 Commits

Reviewing files that changed from the base of the PR and between b32c49f and 308e23f.

📒 Files selected for processing (29)
  • BrowserCat.xcodeproj/project.pbxproj
  • BrowserCat/App/AppDelegate.swift
  • BrowserCat/App/AppState.swift
  • BrowserCat/Features/MenuBar/MenuBarContentView.swift
  • BrowserCat/Features/Picker/PickerView.swift
  • BrowserCat/Features/Picker/PickerWindowController.swift
  • BrowserCat/Features/Picker/URLBar.swift
  • BrowserCat/Features/Settings/AppsSettingsView.swift
  • BrowserCat/Features/Settings/GeneralSettingsView.swift
  • BrowserCat/Features/Settings/HistorySettingsView.swift
  • BrowserCat/Features/Settings/SettingsView.swift
  • BrowserCat/Managers/DefaultBrowserManager.swift
  • BrowserCat/Managers/HistoryManager.swift
  • BrowserCat/Managers/PickerCoordinator.swift
  • BrowserCat/Managers/StatsManager.swift
  • BrowserCat/Models/AppDefinition.swift
  • BrowserCat/Models/BrowserFileType.swift
  • BrowserCat/Models/HistoryEntry.swift
  • BrowserCat/Models/InstalledApp.swift
  • BrowserCat/Resources/Info.plist
  • BrowserCat/Resources/en.lproj/Localizable.strings
  • BrowserCat/Resources/uk.lproj/Localizable.strings
  • BrowserCat/Services/BrowserLauncher.swift
  • BrowserCat/Services/FileShortcutResolver.swift
  • BrowserCat/Services/SuggestionEngine.swift
  • BrowserCatTests/FileShortcutResolverTests.swift
  • BrowserCatTests/HistoryEntryCodableTests.swift
  • BrowserCatTests/URLRuleMatcherTests.swift
  • BrowserCatTests/URLRulesManagerTests.swift

📝 Walkthrough

Walkthrough

This PR introduces file-handling capabilities and multi-URL support to BrowserCat. It adds file-type classification, shortcut resolution, history tracking with file metadata, file-aware app/browser matching, multi-URL state management, and updates the entire picker/launch flow to handle multiple files and URLs in a single action.

Changes

File Handling and Multi-URL Open Flow

Layer / File(s) Summary
File type classification and utilities
BrowserCat/Models/BrowserFileType.swift
BrowserFileType enum defines content-type lists (browser-readable, developer, generic) and filename patterns; implements fileMatchTokens, isBrowserReadableFile, and isDeveloperFile using UTType conformance and token matching.
File shortcut resolution
BrowserCat/Services/FileShortcutResolver.swift, BrowserCatTests/FileShortcutResolverTests.swift
FileShortcutResolver resolves .webloc, .inetloc, and .url shortcut files by parsing property lists or INI format; test suite covers all formats and fallback behavior.
History model and file metadata
BrowserCat/Models/HistoryEntry.swift, BrowserCat/Managers/HistoryManager.swift, BrowserCatTests/HistoryEntryCodableTests.swift
HistoryEntry gains ItemKind enum and file metadata fields (name, extension, format, content type); HistoryManager extracts metadata via EntryMetadata helpers and logs per entry kind.
App and browser file matching
BrowserCat/Models/AppDefinition.swift, BrowserCat/Models/InstalledApp.swift
AppDefinition adds file-pattern fields and matchesFile logic; registry expanded with developer tool entries; InstalledApp delegates to app definition for file matching and priority sorting.
Multi-URL state management
BrowserCat/App/AppState.swift
AppState refactored from single pendingOriginalURL to separate pendingDisplayURLs and pendingLaunchURLs; adds computed helpers and setPendingOpen/clearPendingOpen lifecycle methods.
App launch entry and URL normalization
BrowserCat/App/AppDelegate.swift
Adds application(_:open:) delegate entry point; implements handleIncomingURLs and normalizeIncomingURL to resolve shortcuts and split each URL into display/launch pair.
Default web file handler registration
BrowserCat/Managers/DefaultBrowserManager.swift
Extends setAsDefault to register web file type handlers via new setAsDefaultForWebFiles and isDefaultForWebFileTypes helpers; updates state with isDefaultWebFileHandler.
Picker UI for files and multiple URLs
BrowserCat/Features/Picker/PickerView.swift, BrowserCat/Features/Picker/URLBar.swift, BrowserCat/Features/Picker/PickerWindowController.swift
URLBar displays file paths with primary/secondary text and additional count badge; PickerView uses file-aware browser/app matching helpers; hides hint bar for file URLs.
Multi-URL launching flows
BrowserCat/Services/BrowserLauncher.swift, BrowserCat/Managers/PickerCoordinator.swift
BrowserLauncher accepts URL arrays for all launch modes; PickerCoordinator refactored to derive/record/launch multiple display/launch URL pairs per entry.
History and menu display for files
BrowserCat/Features/MenuBar/MenuBarContentView.swift, BrowserCat/Features/Settings/HistorySettingsView.swift
MenuBarContentView uses file-aware icon and preview helpers; HistorySettingsView renders file metadata (format, path) separately; rule creation logic checks entry kind.
Settings and default handler UI
BrowserCat/Features/Settings/GeneralSettingsView.swift, BrowserCat/Features/Settings/AppsSettingsView.swift, BrowserCat/Features/Settings/SettingsView.swift
Adds captions for default browser and web file handler behavior; updates native apps visibility description; adjusts About tab frame.
Stats and suggestion filtering
BrowserCat/Managers/StatsManager.swift, BrowserCat/Services/SuggestionEngine.swift
Tightens filtering to require itemKind == .link before URL-rule matching and suggestion scoring.
Project configuration and localization
BrowserCat.xcodeproj/project.pbxproj, BrowserCat/Resources/Info.plist, BrowserCat/Resources/en.lproj/Localizable.strings, BrowserCat/Resources/uk.lproj/Localizable.strings, BrowserCatTests/URLRuleMatcherTests.swift, BrowserCatTests/URLRulesManagerTests.swift
Adds new source files to build targets; extends Info.plist with custom UTI for environment files and broader type support; updates English and Ukrainian strings for file associations, empty states, and new UI; fixes test pattern matching for refactored enum.

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • rmarinsky/BrowserCat#5: Prior refactor of URL handling and SuggestionEngine filtering that introduced the pending-state and suggestion mechanisms now extended by this PR.
  • rmarinsky/BrowserCat#2: Earlier updates to picker component browser/app matching that are complemented by this PR's URL-aware matching helpers.

Poem

🐰 Hops through files with flair so bright,
Multi-URLs in one swift flight,
Shortcuts resolved, histories grown,
File handlers claimed, defaults shown.
Dev tools and browsers now align,
BrowserCat's file game feels divine!

✨ 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 feat/file-associations

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.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

🔖 On merge this PR will release v1.9.0 (release:minor).

@rmarinsky rmarinsky marked this pull request as ready for review June 3, 2026 20:06
@rmarinsky rmarinsky merged commit 496bb43 into main Jun 3, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:minor New user-facing capability — bumps minor version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant