How chrisb0-2/storage-sage works
Storage-Sage is a safety-first disk-cleanup service with both one-shot CLI and scheduled daemon operation, plus a browser dashboard. Its main workflow scans configured roots, evaluates cleanup policy and filesystem safety, then previews or executes actions; execution can move files to recoverable trash, with decisions retained in an audit trail. The graph preserves the documented safety gates and the dashboard’s monitoring and management capabilities. Some workflow links rely on README documentation because the relevant implementation excerpts are incomplete.
Main entry points: main.go CLI entry point · simple.go Fail-closed executor · daemon.go Daemon scheduler · pages Dashboard pages
Components 21
Cleanup workflow
- CLI entry point
cmd/storage-sage/main.go - Configuration
internal/config/config.go - Filesystem scanner
internal/scanner/walkdir.go - Cleanup policies
internal/policy - Safety validation
internal/safety/safety.go - Ancestor checks
internal/safety/ancestor_symlink.go - Action planner
internal/planner/planner.go - Fail-closed executor
internal/executor/simple.go
Service and API
- Daemon scheduler
internal/daemon/daemon.go - API authentication
internal/auth - Embedded web app
internal/web/embed.go
Web dashboard
- HTTP API client
web/src/api/client.ts - Dashboard pages
web/src/pages - Data hooks
web/src/hooks - Dashboard components
web/src/components
State and observability
- Soft-delete store
internal/trash/trash.go - Audit trail
internal/auditor - Prometheus metrics
internal/metrics/prometheus.go - Webhook notifications
internal/notifier/webhook.go - Application logging
internal/logger
Other components
- Administrator
Connections 26
- Administrator → CLI entry point: configures cleanup
README.md - Administrator → Daemon scheduler: operates service
README.md - CLI entry point → Configuration: loads settings
cmd/storage-sage/main.go - CLI entry point → Filesystem scanner: starts scan
README.md - Filesystem scanner → Cleanup policies: candidates evaluated
README.md - Cleanup policies → Safety validation: passes candidates
README.md - Safety validation → Ancestor checks: checks ancestry
README.md - Ancestor checks → Action planner: cleared for planning
README.md - Action planner → Fail-closed executor: supplies plan
README.md - CLI entry point → Fail-closed executor: executes plan
cmd/storage-sage/main.go - Fail-closed executor → Safety validation: revalidates before mutation
internal/executor/simple.go - Fail-closed executor → Soft-delete store: moves to trash
internal/executor/simple.go - Fail-closed executor → Audit trail: records result
- Daemon scheduler → CLI entry point: runs cleanup callback
internal/daemon/daemon.go - Administrator → Dashboard pages: views and manages
README.md - Dashboard pages → Data hooks: uses data hooks
web/src/pages/Dashboard.tsx - Dashboard pages → Dashboard components: renders controls
web/src/pages/Dashboard.tsx - Data hooks → HTTP API client: requests data
web/src/hooks/useAuditHistory.ts - HTTP API client → Daemon scheduler: calls HTTP endpoints
web/src/api/client.ts - Daemon scheduler → Audit trail: queries audit records
internal/daemon/daemon.go - Daemon scheduler → Soft-delete store: manages trash items
internal/daemon/daemon.go - Daemon scheduler → API authentication: protects API
internal/daemon/daemon.go - CLI entry point → Prometheus metrics: starts metrics service
cmd/storage-sage/main.go - Fail-closed executor → Prometheus metrics: records action metrics
internal/executor/simple.go - CLI entry point → Webhook notifications: configures notifications
- CLI entry point → Application logging: configures logging
cmd/storage-sage/main.go