CodeVetter · Repo Unpack · Extension points
clash-verge-rev/clash-verge-rev
New behavior is expected to plug into a few explicit tables rather than into new processes. IPC commands go in cmd/ and generate_handlers. UI routes go in navigationItems. Hotkeys, tray items, URI schemes, and media-unlock checks are enums or maps. Profile enhancement is a fixed chain of merge and script items plus two builtin JS files, not a dynamic plugin loader. The Draft type and Run State are the shared extension surfaces for config and service status.
- New Tauri commands must be added as #[tauri::command] functions under src-tauri/src/cmd/ and listed in app_init::generate_handlers. The module re-exports each command module from cmd/mod.rs.
- Frontend routes are data, not a nested route file tree. Adding a page means a navigationItems entry plus a navItems Component. The router maps those path/Component pairs and nothing else.
- Hotkey functions are the HotkeyFunction enum plus FromStr names. Adding a shortcut means extending that enum and the register path in core/hotkey.rs; unknown names bail with invalid hotkey function.
- Tray labels and ids are generated by the define_menu! macro in core/tray/menu_def.rs, with display strings looked up through clash_verge_i18n::t. A new tray row is a new macro entry, not a free-form menu builder at the call site.
- Share-link import extends URI_PARSERS in src/utils/uri-parser/index.ts. Each scheme maps to a function (uri) => IProxyConfig.
- A new streaming check is an UnlockCheck variant in crates/clash-verge-media-unlock/src/lib.rs, a name() match arm, an ALL entry, and a module such as netflix.rs. The UI calls get_unlock_items and check_media_unlock; it does not hardcode the list.
- Profile enhancement extension points are per-profile and global ChainItems of type merge, script, rules, proxies, and groups, applied by process_seq_items, process_global_items, and process_profile_items. Builtin JS is the fixed pair meta_guard.js and meta_hy_alpn.js under enhance/builtin/, gated by enable_builtin_enhanced.
- Backend user-visible strings go through crates/clash-verge-i18n, which loads YAML locales with rust_i18n and falls back to zh. Frontend strings are JSON under src/locales, with generated key types from pnpm i18n:types.
- Service vs sidecar policy is the startup_decision function over ServiceStatus, plus Run State in core/runstate. New install/repair outcomes should map there rather than grow a second status enum in the UI.
- Verge and profile mutations are supposed to go through DraftTransaction and Config::lock_config_write, not direct YAML writes. patch_verge and generate_with_profiles are the two patterns.
- Frontend event names are the VergeEvents map in src/services/events.ts. A new backend emit is invisible to React until that map and a subscribeVergeEvents handler both include it.
- Command failures that the UI can classify should use CommandFailure::coded or SysproxyFailure codes. proxy_aware_coded_error lets a proxy classification outrank the operation fallback such as CORE_RESTART_FAILED.