
wt-radar 发布:用 Rust 实时检测 Git worktree 中的代码冲突
来源标题:Wt-radar: Real-time Git worktree collision radar (Rust, Tree-sitter, MCP)
开源工具 wt-radar 用 Rust 编写,可实时监控多个 Git worktree,在提交前发现并行 AI 编码代理和团队成员对同一函数、代码块、锁文件及数据库迁移的冲突。它提供 CLI、TUI 和原生 MCP Server,另有可选的协调 Hub 支持团队级监控。示例中它扫描 3 个 worktree 用时 38ms,内存占用 15MB,报告了 3 处冲突。
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
Stop parallel AI coding agents and teammates in Git worktrees from silently colliding on the same functions, hunks, lockfiles, and database migrations—before anyone hits git commit.
wt-radar is a lightweight, open-source Rust daemon, CLI, TUI, Native MCP Server, and optional zero-code coordination Hub (wt-radar-hub) that monitors all linked Git worktrees locally and across your engineering team in real time.
Rendered with VHS from docs/vhs/mcp-collision-demo.tape against the real wt-radar binary and its stdio MCP server (demo repo seeded by docs/vhs/setup-demo-repo.sh).
acme-billing (cursor) $ wt-radar status wt-radar status | repo: c9abac72d811 | worktrees: 3 | collisions: 3 | scan: 38ms | rss: 15.0 MB
COLLISIONS +----------+-------------+-----------------+----------------------------+---------------------------------+ | SEVERITY | TIER | WORKTREES | FILE | LINES / SYMBOLS | +----------+-------------+-----------------+----------------------------+---------------------------------+ | BLOCK | T4:Critical | cursor ↔ claude | db/migrations/001_init.sql | L5 | rule:builtin:migration:dir | | WARN | T3:AST | cursor ↔ claude | src/billing.ts | L12-13 | 2 sym(s) | | WARN | T2:Hunk | cursor ↔ claude | config/routes.txt | L4-5 | +----------+-------------+-----------------+----------------------------+---------------------------------+
acme-billing (cursor) $ mcp-call check_collision '{"file_path":"db/migrations/001_init.sql"}' | jq '{action, critical_rule_id}' { "action": "block", "critical_rule_id": "builtin:migration:dir" }
Interactive TUI dashboard
Rendered from docs/vhs/tui-demo.tape.
Pick your preferred one-line installer (ships both wt-radar and wt-radar-hub):
macOS / Linux (Homebrew)
brew install rxxusp/tap/wt-radar
macOS / Linux (Shell installer via cargo-dist)
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/rxxusp/wt-radar/releases/latest/download/wt-radar-cli-installer.sh | sh
Cargo (Rust 1.96+)
cargo install wt-radar-cli wt-radar-hub
Windows (PowerShell / Winget)
winget install wt-radar.wt-radar
or: irm https://github.com/rxxusp/wt-radar/releases/latest/download/wt-radar-cli-installer.ps1 | iex
Container Images (multi-arch linux/amd64 & linux/arm64, distroless nonroot)
docker pull ghcr.io/rxxusp/wt-radar-hub:1.0.0 docker pull ghcr.io/rxxusp/wt-radar:1.0.0
Initialize Policy-as-Code and inspect your repository in seconds:
wt-radar init # creates .wtradar.toml wt-radar status # 4-tier collision scan across all linked worktrees wt-radar watch # start background daemon + local IPC socket wt-radar tui # open live interactive dashboard
Verified Performance & Resource Ceilings
wt-radar enforces hard local resource budgets (< 30 MB RSS, < 1% CPU, < 50 ms incremental check) using pure-Rust gix (no git CLI subprocesses), native OS filesystem watchers (notify) with adaptive burst shedding, and embedded Tree-sitter parsers.
cargo run --release -p wt-radar-bench -- --files 100000 --assert-budgets
60-Second Self-Hosted Demo (Team Box)
Spin up a zero-code wt-radar-hub coordination server with live Prometheus metrics and a pre-provisioned Grafana dashboard in under a minute—no external database required:
docker compose -f deploy/docker-compose.yml up -d
Services exposed locally:
Point any local daemon at the hub with your shared team salt:
export WT_RADAR_SALT="replace-with-team-256bit-secret" wt-radar watch --hub http://localhost:50051
Stop and clean up with docker compose -f deploy/docker-compose.yml down -v.
Every edit across local linked worktrees—or synced remote worktrees—is evaluated through four progressively deeper tiers:
wt-radar-hub never receives, inspects, or stores your source code, file paths, branch names, or symbol names.
See docs/privacy-and-security.md for the full threat model and wire audit.
wt-radar ships a native Model Context Protocol server built on the official Rust rmcp SDK, supporting both stdio and Streamable HTTP (--transport stdio|http --bind 127.0.0.1:3849).
{ "mcpServers": { "wt-radar": { "command": "wt-radar", "args": ["mcp", "--transport", "stdio"] } } }
Or run Streamable HTTP for shared container/remote agent sandboxes:
wt-radar mcp --transport http --bind 127.0.0.1:3849
Full agent setup guides and system-prompt guardrails live in docs/mcp-integration.md.
Profile Scale Storage & Pub/Sub Auth & Network Deployment Artifact
Solo / Local 1 dev, N agents Local in-memory + Unix socket / Named pipe Local OS permissions (0600) docs/systemd/wt-radar.service, docs/launchd/dev.wtradar.daemon.plist
Team Box 1–50 devs Embedded SQLite (WAL) or in-memory Optional mTLS / OIDC deploy/docker-compose.yml
Enterprise Fleet 50–5,000+ devs PostgreSQL + Valkey/Redis or NATS mTLS + OIDC/JWKS + Multi-AZ HPA deploy/helm/wt-radar-hub/ & deploy/docker-compose.fleet.yml
Air-Gapped / Regulated Any Private registry + internal Postgres/Valkey Mandatory internal PKI mTLS + deny-all egress NetworkPolicy deploy/helm/wt-radar-hub/values-airgapped.yaml
See docs/deployment.md for production runbooks, webhooks (Slack, Discord, Mattermost), and OpenTelemetry/Prometheus observability.
Commit .wtradar.toml to your repository root to standardize severity thresholds, protected globs, watcher burst protection, AST languages, and Hub sync settings across humans, CI, and MCP agents:
version = 1
[severity] tier1_path = "info" tier2_hunk = "warn" tier3_ast_semantic = "warn" tier4_critical_asset = "block" hunk_proximity_lines = 5
[critical_assets] enable_builtins = true
[[critical_assets.protected_globs]] id = "billing-migrations" pattern = "db/migrations/**/*.sql" severity = "block" reason = "Database migrations must be sequenced by one worktree at a time."
[resources] max_rss_mb = 30 max_cpu_percent = 1.0
[hub] enabled = false
endpoint = "https://wt-radar-hub.internal:50051"
lease_ttl_secs = 60 heartbeat_interval_secs = 20 salt_env_var = "WT_RADAR_SALT"
Complete schema documentation: docs/policy-reference.md.
Starship (~/.config/starship.toml)
[custom.wt_radar] command = "wt-radar prompt --format starship --quiet-clean" when = "git rev-parse --is-inside-work-tree >/dev/null 2>&1" format = "$output " style = "bold yellow"
tmux (~/.tmux.conf)
set -g status-right '#(wt-radar prompt --format tmux) | %H:%M '
Displays wt:3 ⚡1 when collisions are active (or wt:3 ✓ when clean).
Both extensions connect directly to the local wt-radar watch daemon over NDJSON Unix domain sockets ($XDG_RUNTIME_DIR/wt-radar.sock / $TMPDIR/wt-radar-<user>.sock) or Windows named pipes (\.\pipe\wt-radar) with zero heavy gRPC dependencies:
Gate pull requests and upload SARIF 2.1.0 collision alerts directly to GitHub Code Scanning using the bundled composite action (action.yml):
- name: Check active worktree collision risk uses: rxxusp/wt-radar@v1 with: fail-on-severity: block upload-sarif: true
Documentation
Architecture & Data Flow
Privacy, Cryptography & Security Model
Native MCP Integration Guide
Self-Hosted Deployment Guide
.wtradar.toml Policy Reference
Contributing · Security Policy · Changelog
License
Dual-licensed under either of:
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。
