CodeVetter
← All unpacks
CodeVetter · Repo Unpack evidence

clash-verge-rev/clash-verge-rev

Scanned commit fd06fbb3b7 dated 2026-09-22 — last upstream commit. Generated by codevetter 1.12.0 on 2026-09-22.

github.com/clash-verge-rev/clash-verge-rev ↗ · 673 files · 4.2 MB

Continuation of Clash Verge A Clash Meta GUI based on Tauri .

Deep analysis by cli:grok via the grok CLI on 2026-09-22 (388s) — every claim below links to its cited source files.

Overview

Clash Verge Rev (package clash-verge 2.5.5, GPL-3.0) is a Tauri 2 desktop GUI for the Mihomo/Clash.Meta core, aimed at people who run a local rule-based proxy on Windows, macOS, and Linux. A React 19 frontend drives profiles, proxies, rules, connections, and settings, while the Rust backend owns config enhancement, the system proxy, TUN, and either a privileged helper service or a bundled verge-mihomo sidecar. What sets it apart from a thin Mihomo wrapper is the profile chain (merge and sandboxed JavaScript), copy-on-write drafts, service-or-sidecar core lifecycle, and local-only storage of config and logs.

System map

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.

Feature catalog

The user-facing surface is an eight-route desktop shell plus a tray menu and global hotkeys. Profiles can be remote subscriptions, local YAML, merge patches, or JavaScript enhancers. Clash controls cover mode, ports, DNS override, system proxy, TUN, and switching between the stable and alpha Mihomo cores. Backup is local files or WebDAV. A media-unlock page probes streaming and AI sites through the mixed port. There is no first-party cloud account; the external integrations are Mihomo, the OS proxy APIs, the helper service, WebDAV, and the GitHub updater.

All 14 feature catalog claims →

Data flow

User input enters through Tauri invoke, the Mihomo plugin's local socket, deep links, or the localhost warp server. Rust turns profiles and verge/clash settings into one runtime YAML via enhance::enhance, validates it by executing the Mihomo sidecar with -t, then applies it to the running core. Live proxy and traffic data flow the other way: the UI polls get_proxy_view and Mihomo HTTP, and the backend pushes verge:// events. Durable files are YAML under the app home. WebDAV credentials are encrypted only while the task-local encryption flag is on.

All 13 data flow claims →

Behavior traces

Startup is a singleton check, then a Tauri setup that always tries to open a window even if pre-init panics, then resolve_setup which starts the core in parallel with tray, hotkeys, timers, and the updater. The primary proxy action is a Mihomo select followed by a profile selection write and a tray refresh. Persistence of a subscription is download, append to profiles.yaml, then a forced enhance-and-apply. Quitting is not window-close: close hides the window, and a real exit runs feat::quit, which can cancel if the core will not stop.

All 13 behavior traces claims →

Testing signals

Tests are real but narrow and mostly not wired into CI. Vitest covers a handful of frontend delay, event, and proxy-sort units. Rust tests sit next to the core manager, run state, enhancer, and command-error types and are the safety net for lifecycle decisions. The workflows that were read format-check or build release artifacts; they do not invoke pnpm test or cargo test. CONTRIBUTING.md treats new tests as optional and asks for clippy, eslint, and rustfmt instead.

Risk map

The highest-impact code is the core lifecycle and the system-proxy/TUN apply path: a bad transition can leave the OS proxy half-set or the core unguarded. The webview is loosely sandboxed (CSP off, filesystem scope **). Profile JavaScript is sandboxed in Boa but can still rewrite the config that Mihomo will load. Secrets at rest are only as private as the app-data directory, because the AES key sits beside verge.yaml. Deep links import remote subscriptions immediately, and a user-configured startup script is executed as a shell.

All 13 risk map claims →

Extension points

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.

Contributor handoff

Read AGENTS.md before editing: non-trivial work needs an existing issue, the diff must match that issue, and tests are not a default. Start from lib.rs generate_handlers, cmds.ts, and the config/core modules that own the behavior you touch. Respect draft transactions and the config-then-lifecycle lock order. Verify with pnpm typecheck, pnpm lint, and targeted cargo tests; do not assume CI runs the suite. Do not hand-edit the AI-slop review lockfile, and do not treat the webview capability set as a tight sandbox.

Languages

LanguageFilesShare of source
TypeScript23555%
JSON150docs/config
Rust14133%
YAML36docs/config
JavaScript235%
Markdown21docs/config
TOML153%
Shell102%

Start reading here

Probable source entrypoint: src/main.tsx — inferred from the directory tree and manifest, not the upstream docs.

Source roots

src/ (389 files) crates/ (45 files)

Source layout — src/

PathFiles
src/locales/42
src/types/7
src/index.html1
src/main.tsx1

Repository structure

Top-level pathFiles
src/389
src-tauri/139
crates/45
scripts/30
.github/26
docs/8
scripts-workflow/3
.devcontainer/2

Docs found: AGENTS.mdCLAUDE.mdCONTRIBUTING.mdREADME.mddocs/CONTRIBUTING_i18n.mddocs/Changelog.history.mddocs/README_en.mddocs/README_es.mddocs/README_fa.mddocs/README_ja.md

Package

Cargo.toml — , 0 declared dependencies.

CI & config entrypoints

Structural health signals

Average score 5.9/10 across 96 analyzed source files; 69 hotspots surfaced.

These are deterministic review leads — size, churn, and structural signals — not proof of a bug in this project.

Recent history