Updated July 2026 · 6 min read
Transform profiles with Script
A Script extension is real JavaScript: the core hands your parsed subscription to a function and uses whatever object you return. That power also means one bad line takes the whole profile down.
What the script actually receives
A Script is not a config fragment, it is code that runs. The core parses the subscription file into an object, passes it to your function alongside the current config, and whatever you hand back is what takes effect.
That means the function has to return the whole object at the end. Forget the return statement and the core receives nothing, so the entire profile fails to load rather than simply ignoring your edit.
Things Merge simply cannot do
Merge does static appends and overrides: you write a fixed block of YAML and it gets grafted on as written. Node names change with every subscription update, though. What reads Hong Kong 01 today may be HK-01 tomorrow, and the hardcoded block stops matching.
A Script can walk the proxy list, pull out everything with Hong Kong or Japan in the name, and build the matching groups automatically. It can also drop nodes with a high multiplier or the word expired in their title.
The script re-runs on every subscription update. After editing, force one update by hand and check the group and node counts on the proxies page before you walk away.
One error breaks everything
A thrown exception, a syntax slip, a field that does not exist — the outcome is identical. The profile fails to load, the proxies page is empty when you switch to it, the home page reports nothing running, and no line of the interface tells you which statement did it.
The script does not run only once either. Every automatic or manual subscription update executes it again, so a provider quietly renaming their nodes can take your whole setup down overnight while you touch nothing.
Change one thing, then look
Edit a single behaviour at a time. Save, go straight to the proxies page and count the groups and nodes, then scan the log page for a parse error. That beats writing fifty lines and guessing which one broke.
If Merge can do the job, do not reach for Script. Adding a rule, changing DNS, pinning one extra group — Merge handles all of that, and a mistake there kills only that block while the config still loads.
What is the project?
Clash Verge Rev is a Tauri-based GUI for Mihomo with profile management, system proxy, TUN mode, rule editing and WebDAV backups.