Mirror runtime status to ~/.antidrift_status
A window-manager status bar can now read a single-line status file: a glyph plus minutes-remaining (● 24m / ⚠ DRIFT 24m / ● 24m ·? / ◔ planning / ✓ review), empty when idle. Rewritten on a one-minute tick, only when the line changes, and removed on shutdown. Degrades to no file if $HOME is unresolvable. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"antidrift/internal/ai"
|
||||
"antidrift/internal/evidence"
|
||||
"antidrift/internal/session"
|
||||
"antidrift/internal/statusfile"
|
||||
"antidrift/internal/store"
|
||||
"antidrift/internal/web"
|
||||
)
|
||||
@@ -45,6 +46,15 @@ func main() {
|
||||
log.Printf("ai: %s backend (coach + drift judge + nudge)", backend.Name())
|
||||
}
|
||||
|
||||
// Mirror runtime status to ~/.antidrift_status for a window-manager bar.
|
||||
// A misconfigured home dir degrades to no status file, not a failed start.
|
||||
if statusPath, err := statusfile.DefaultPath(); err != nil {
|
||||
log.Printf("status file disabled: %v", err)
|
||||
} else {
|
||||
go statusfile.NewWriter(statusPath, ctrl.State).Run(context.Background())
|
||||
log.Printf("status: writing %s", statusPath)
|
||||
}
|
||||
|
||||
src := evidence.NewSource()
|
||||
go src.Watch(context.Background(), ctrl.RecordWindow)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user