server-watcher
server-watcher (binary sw) is ssh-config-driven server infrastructure
management for a single operator. It reads the user's ~/.ssh/config, keeps a
host catalog in SQLite, probes and collects metrics through the system ssh
binary, and exposes the fleet three ways: a local web dashboard with an
in-browser terminal (sw serve / sw ui), a REST API, and a stdio MCP server
for LLM agents (sw mcp).
What is documented here
-
Architecture — the design document: workspace layout (eight crates), run modes, the system-ssh reuse decision, the localhost trust model, storage, the write-path overview, and the frontend/desktop shell.
-
Design Intent Review — a conformance review of the implementation against every intent claim in the architecture document, with evidence, performed after Phase 6 completion.
-
Write Path and Audit Contracts — the round-2 mutation surface: bidirectional ssh-config editing (stanza splicing, diff preview, optimistic concurrency, atomic writes), SSH key management (scan/generate/delete/deploy), the audit log rules, the stale-host purge policy, and the MCP tool surface.
-
Alerting Contracts — the transition rule (fire once, not every cycle), what raises and clears each condition, the macOS and webhook channels, and the threshold configuration surface.
-
Assistant Contracts (BYOK) — the operator's own LLM key: two wire protocols with vendors as presets, what context each assistant may see, why a suggested command waits for a keystroke, and how a fleet plan becomes an approved fan-out.
Key properties
| Property | Choice |
|---|---|
| Source of truth | ~/.ssh/config — imported by sync; user-owned fields (tags, notes, groups) survive re-sync; the app edits it back through the stanza-splicing write path |
| SSH transport | the system ssh binary (no embedded SSH library, no second credential store) |
| Trust model | loopback-only bind + bearer token on every non-asset request |
| Storage | one SQLite file, WAL mode, compile-time-embedded migrations, runtime-checked queries |
| Auditability | append-only audit log for every config/key/purge mutation, tagged api/mcp |
| Assistant | BYOK: the model proposes a command, the operator runs it; fleet plans fan out only after an explicit approval |
| Alerting | host-down and cpu/mem/disk thresholds, notified once per transition via macOS notification and/or webhook |
| Stack | Rust 2024 edition, tokio, axum 0.8, sqlx 0.8, clap 4.5, Leptos CSR UI, Tauri v2 shell |
| Toolchain | pinned Rust (1.93.1) and trunk (0.21.14); committed UI dist so CI never runs trunk |