How watanabe3tipapa/var-watcher works
var-watcher monitors macOS /var activity through several watcher engines and presents a shared event stream in a terminal UI and a Web UI. Its main workflow loads configuration, starts watchers, and distributes events to live views and optional analysis or persistence services. The Web UI also exposes search, export, alerts, statistics, trees, diffs, presets, and performance data. Edges reflect the sampled entry point and server/UI excerpts or README statements; several subsystem internals were not sampled, so their precise wiring is not expanded.
Main entry points: main.go Process Entry · server.go Web API Server · engine.go Watcher Engine · bus.go Event Bus
Components 21
Runtime and Watchers
- Process Entry
cmd/varwatch/main.go - Watcher Engine
internal/engine/engine.go - Watch Sources
internal/engine/watcher.go - Event Bus
internal/engine/bus.go
Event Analysis
- Alert Rules
internal/alert/alert.go - File Diffs
internal/diff/diff.go - Performance Monitor
internal/perf/perf.go
Persistence and Search
- SQLite Log Store
internal/store/store.go - Statistics
internal/store/stats.go - Directory Tree
internal/store/tree.go
User Interfaces
- Terminal UI
internal/tui/tui.go - Web API Server
internal/web/server.go - Web Dashboard
frontend/src/App.vue - Language Catalogs
frontend/src/i18n/en.ts - Japanese Catalog
frontend/src/i18n/ja.ts
Configuration and Integrations
- Configuration
internal/config/config.go - Shell Plugins
internal/plugin/plugin.go - macOS Notifications
internal/notify/notify.go
Other components
- Operator
- macOS /var
- Watcher Commands
Connections 34
- Operator → Process Entry: starts
README.md - Process Entry → Configuration: loads
cmd/varwatch/main.go - Process Entry → Watcher Engine: initializes
cmd/varwatch/main.go - Process Entry → SQLite Log Store: opens
cmd/varwatch/main.go - Process Entry → Shell Plugins: discovers
cmd/varwatch/main.go - Process Entry → Alert Rules: starts
cmd/varwatch/main.go - Process Entry → File Diffs: starts capture
cmd/varwatch/main.go - Process Entry → Performance Monitor: starts
cmd/varwatch/main.go - Process Entry → Web API Server: starts
cmd/varwatch/main.go - Process Entry → Terminal UI: starts
cmd/varwatch/main.go - Watcher Engine → Watch Sources: builds
internal/engine/engine.go - Watch Sources → macOS /var: monitors
README.md - Watch Sources → Watcher Commands: runs
README.md - Shell Plugins → Watcher Engine: registers
- Watcher Engine → Event Bus: publishes events
- Alert Rules → Event Bus: subscribes
internal/alert/alert.go - Process Entry → Event Bus: persists events
cmd/varwatch/main.go - Event Bus → SQLite Log Store: appends logs
- Process Entry → Event Bus: captures diffs
cmd/varwatch/main.go - Process Entry → Event Bus: counts events
cmd/varwatch/main.go - Process Entry → macOS Notifications: sends alerts
cmd/varwatch/main.go - Terminal UI → Watcher Engine: controls watchers
internal/tui/tui.go - Terminal UI → SQLite Log Store: exports logs
internal/tui/tui.go - Web API Server → Watcher Engine: controls watchers
internal/web/server.go - Web API Server → SQLite Log Store: queries logs
internal/web/server.go - Web API Server → Statistics: requests aggregates
internal/web/server.go - Web API Server → Directory Tree: requests hierarchy
internal/web/server.go - Web API Server → File Diffs: reads history
internal/web/server.go - Web API Server → Alert Rules: reads history
README.md - Web API Server → Performance Monitor: serves samples
README.md - Web Dashboard → Web API Server: requests API
frontend/src/App.vue - Web Dashboard → Language Catalogs: uses translations
frontend/src/App.vue - Language Catalogs → Japanese Catalog: loads catalog
frontend/src/i18n/index.ts - Web Dashboard → Operator: shows dashboard
README.md