CodeVetter · Repo Unpack · System map
clash-verge-rev/clash-verge-rev
The process starts in src-tauri/src/main.rs, which installs a capped Tokio runtime and calls app_lib::run in src-tauri/src/lib.rs. That builder registers Tauri plugins and the IPC command table, then resolve_setup brings up config, the core, the tray, and the window. The UI is a Vite app rooted at src/ on port 3000. Persistent state lives in the OS data directory under the bundle id, not in the repo. The Mihomo core is an external binary, started either by clash-verge-service over IPC or as a sidecar. Release builds are GitHub Actions tag workflows; day-to-day dev is pnpm plus Cargo.
- Product identity is Clash Verge, npm name clash-verge and Rust package clash-verge version 2.5.5, bundle id io.github.clash-verge-rev.clash-verge-rev, license GPL-3.0-only, with lib app_lib built as staticlib, cdylib, and rlib.
- main() in src-tauri/src/main.rs builds a multi-thread Tokio runtime named clash-verge-runtime-* with at most 8 worker threads and twice that many blocking threads, sets it as the Tauri async runtime, then calls app_lib::run(). The perf-harness feature on macOS swaps in scripts/perf/app.rs instead.
- app_init::setup_plugins registers sysinfo, notification, updater (with a custom comparator that also treats build-to-stable as newer), clipboard, process, global-shortcut, fs, dialog, shell, opener, deep-link, http, and tauri-plugin-mihomo over a local socket at IClashTemp::guard_external_controller_ipc. Devtools load only for debug builds with tauri-dev and without tokio-trace.
- The only IPC command table is app_init::generate_handlers, covering listener probes, proxy ports, profiles, clash/DNS, service install, runtime YAML, UWP, backups, WebDAV, and media-unlock checks.
- Frontend bootstrap is src/main.tsx: Vite root src, dev server port 3000, React 19 StrictMode, SWR, WindowProvider, AppDataProvider, and a createBrowserRouter whose children come from navItems. beforeDevCommand is pnpm run web:dev and frontendDist is ../dist.
- The Cargo workspace members are src-tauri plus crates clash-verge-draft, clash-verge-media-unlock, clash-verge-logging, clash-verge-signal, tauri-plugin-clash-verge-sysinfo, clash-verge-i18n, and clash-verge-limiter. tray-icon is patched from Tunglies/tray-icon branch fix/macos-27-click-reentrancy.
- Bundled externalBin sidecars are sidecar/verge-mihomo and sidecar/verge-mihomo-alpha. scripts/prebuild.mjs downloads the Mihomo core and the clash-verge-service binary into src-tauri/sidecar or src-tauri/resources (Linux service binaries go to the sidecar dir).
- App home is dirs::data_dir() joined with APP_ID (the .dev id when feature verge-dev is on). Files there include verge.yaml, config.yaml, profiles.yaml, profiles/, logs/, icons/, clash-verge.yaml, dns_config.yaml, and window_state.json.
- Privileged core control uses clash_verge_service_ipc 2.7.3 with the client feature. Feature verge-dev also enables that crate's development-channel. CoreManager::start_core_inner picks StartupDecision::Service or Sidecar from ServiceStatus, with a Windows sidecar fallback.
- Deep-link desktop schemes are clash and clash-verge. The updater plugin pins a minisign pubkey and three endpoints, trying update.hwdns.net and gh-proxy.org before the GitHub update.json. Windows install mode is passive.
- Rust toolchain file pins channel 1.98.1 with rustfmt and clippy. The crate rust-version is 1.95 and edition 2024. pnpm scripts are dev, dev:service, dev:sidecar, build, web:build, typecheck, lint, and test (vitest run).
- Release workflow .github/workflows/release.yml runs on tags v*.*.*, requires the tag commit to be on main, and requires the tag to equal v plus package.json version. dev.yml is a manual matrix of Windows, macOS aarch64, and Linux deb/nsis/dmg bundles and does not run unit tests.