From 38f4265a1cba076d5dc09e1f2960756a1ef886a3 Mon Sep 17 00:00:00 2001 From: Affaan Mustafa Date: Thu, 30 Apr 2026 08:55:40 -0400 Subject: [PATCH] feat: add loop-status watch mode --- commands/loop-status.md | 7 ++- scripts/loop-status.js | 72 +++++++++++++++++++++++++------ tests/scripts/loop-status.test.js | 54 ++++++++++++++++++++++- 3 files changed, 119 insertions(+), 14 deletions(-) diff --git a/commands/loop-status.md b/commands/loop-status.md index 81dc9427..1149fc4b 100644 --- a/commands/loop-status.md +++ b/commands/loop-status.md @@ -40,10 +40,15 @@ tool calls that have no matching `tool_result`. directly. - `ecc loop-status --bash-timeout-seconds 1800` adjusts the stale Bash threshold. +- `ecc loop-status --watch` refreshes status until interrupted. +- `ecc loop-status --watch --watch-count 3` emits a bounded watch stream for + scripts and handoffs. ## Watch Mode -When `--watch` is present, refresh status periodically and surface state changes. +When `--watch` is present, refresh status periodically. With `--json`, each +refresh is emitted as one JSON object per line so another terminal or script can +consume the stream. ## Arguments diff --git a/scripts/loop-status.js b/scripts/loop-status.js index 98844590..b0bee3f2 100644 --- a/scripts/loop-status.js +++ b/scripts/loop-status.js @@ -8,12 +8,13 @@ const path = require('path'); const DEFAULT_BASH_TIMEOUT_SECONDS = 30 * 60; const DEFAULT_LIMIT = 10; const DEFAULT_WAKE_GRACE_MULTIPLIER = 2; +const DEFAULT_WATCH_INTERVAL_SECONDS = 5; function usage() { console.log([ 'Usage:', - ' node scripts/loop-status.js [--json] [--home ] [--limit ]', - ' node scripts/loop-status.js --transcript [--json]', + ' node scripts/loop-status.js [--json] [--home ] [--limit ] [--watch]', + ' node scripts/loop-status.js --transcript [--json] [--watch]', '', 'Options:', ' --json Emit machine-readable status JSON', @@ -23,6 +24,9 @@ function usage() { ' --bash-timeout-seconds Age before a pending Bash call is stale (default: 1800)', ' --wake-grace-multiplier ScheduleWakeup grace multiplier (default: 2)', ' --now