finicky: fix v4 rewrite API, route more domains to Chrome - #97
Conversation
📝 WalkthroughWalkthroughThe macOS Finicky configuration now uses Google Chrome by default, accepts direct URL arguments in rewrite callbacks, and routes ChangesFinicky routing configuration
Estimated code review effort: 2 (Simple) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
Updates the repository’s Finicky macOS URL-routing configuration to align with Finicky v4’s rewrite handler API and to prefer Chrome for more destinations, reducing day-to-day auth/browser-compat friction.
Changes:
- Fixes the
rewritehandler signatures to accept aURLinstance directly (Finicky v4 API). - Routes additional Meta/GitHub-related domains to Google Chrome.
- Switches
defaultBrowserfrom Microsoft Edge to Google Chrome.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
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 `@mac/.finicky.js`:
- Around line 59-60: Update the URL matchers in the Finicky configuration to
match hostnames rather than arbitrary text in full URLs, using
finicky.matchHostnames for ghe.oculus-rep.com and github.com or equivalent
host-anchored expressions. Preserve any required subdomain matching by listing
those subdomains explicitly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| /ghe\.oculus-rep\.com/i, | ||
| /github\.com/i, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== repo files matching finicky.js =="
fd -a 'finicky\.js$' . || true
echo "== mac/.finicky.js line count and relevant sections =="
if [ -f mac/.finicky.js ]; then
wc -l mac/.finicky.js
nl -ba mac/.finicky.js | sed -n '1,140p'
fi
echo "== search for finicky matchers/config in mac/.finicky.js =="
if [ -f mac/.finicky.js ]; then
rg -n "def|exports|matchHostnames|matchURL|match|ghe\.oculus-rep\.com|github\.com|chrome|Firefox" mac/.finicky.js
fi
echo "== finicky dependency references in repo =="
rg -n "finicky|\.finicky\.js" -S .Repository: idvorkin/Settings
Length of output: 307
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== mac/.finicky.js contents =="
if [ -f mac/.finicky.js ]; then
cat -n mac/.finicky.js
fi
echo "== repository references to Finicky/finicky =="
git ls-files | xargs grep -l -i 'finicky\|\.finicky\.js\|matchHostnames\|matchURL' || true
echo "== relevant line contexts in mac/.finicky.js =="
if [ -f mac/.finicky.js ]; then
grep -n -i 'ghe\.oculus-rep\.com\|github\.com\|finicky\.|match\|chrome|Firefox' mac/.finicky.js -C 3 || true
fiRepository: idvorkin/Settings
Length of output: 3117
🌐 Web query:
Finicky .finicky.js matchHostnames matchURL Regular expression matches URL text
💡 Result:
In Finicky, URL matching for handlers and rewrites can be performed using strings (glob patterns), regular expressions (RegExp), or custom functions [1][2][3]. For matching specific hostnames, Finicky provides a utility function: finicky.matchHostnames(matchers) This utility simplifies matching against the domain part of a URL [1]. It accepts a string, a RegExp, or an array of these [1]. Example usage in your.finicky.js: module.exports = { handlers: [{ match: finicky.matchHostnames(["apple.com", /example.(com|org|net)/]), browser: "Safari" }] }; Beyond this utility, you can match URLs directly using various methods: 1. String patterns: Simple glob-like patterns such as "example.com/" or ".google.com*" are supported directly in the match property [2][4]. 2. Regular expressions: You can provide a native JavaScript RegExp object directly to the match property to match the full URL string [1][3]. 3. Custom functions: For complex logic, you can provide a function that receives the URL (as an object) and other context (like the opener), returning a boolean [1][3]. Example using a function: match: ({ url }) => url.host === "example.com" && url.pathname.startsWith("/path") For troubleshooting, you can use the logRequests option or a custom rewrite rule to log incoming URL objects to the console, allowing you to inspect the exact structure being matched [5].
Citations:
- 1: https://github.com/johnste/finicky/wiki/Archive:-Configuration-(v3)
- 2: https://github.com/johnste/finicky/blob/master/README.md
- 3: https://github.com/johnste/finicky/blob/main/packages/config-api/src/configSchema.ts
- 4: https://github.com/johnste/finicky/
- 5: https://github.com/johnste/finicky/wiki/Troubleshooting-&-Tips
Match the target hostnames, not arbitrary URL text.
Handlers use matchers against the full URL string, so /ghe\.oculus-rep\.com/i and /github\.com/i can also match URLs that contain those strings in a path, query string, or unrelated hostname. Use finicky.matchHostnames(...) or anchor each expression to the URL host. Add subdomains explicitly if they are required.
Suggested fix
- /ghe\.oculus-rep\.com/i,
- /github\.com/i,
+ finicky.matchHostnames([
+ "ghe.oculus-rep.com",
+ "github.com",
+ ]),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /ghe\.oculus-rep\.com/i, | |
| /github\.com/i, | |
| finicky.matchHostnames([ | |
| "ghe.oculus-rep.com", | |
| "github.com", | |
| ]), |
🤖 Prompt for 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.
In `@mac/.finicky.js` around lines 59 - 60, Update the URL matchers in the Finicky
configuration to match hostnames rather than arbitrary text in full URLs, using
finicky.matchHostnames for ghe.oculus-rep.com and github.com or equivalent
host-anchored expressions. Preserve any required subdomain matching by listing
those subdomains explicitly.
What
Three finicky changes, split out of a long-lived local branch.
finicky: pass URL instance directly to rewrite fns (v4 API)— the real bug fix. Therewritehandlers were destructuring({ url }), which is the v3 signature; finicky v4 passes theURLinstance directly. Without this the http→https rewrite silently stops firing.finicky: route internalmeta, GHE, and github to Chrome— addsinternalmeta.com,ghe.oculus-rep.com, andgithub.comto the existing Chrome match list, alongside thefburl.com/internalfb.com/fb.okta.comentries already there.finicky: default to Chrome to avoid auth issues— flipsdefaultBrowserfrom Microsoft Edge to Google Chrome.Test plan
~/.finicky.jssymlinks tomac/.finicky.js, so this config has been running live on my Mac since June.Summary by CodeRabbit