Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,26 @@ night-watch run

---

## Agent / Machine-Readable CLI

External agents and automation should use the JSON-first manageability commands instead of scraping human output:

```bash
night-watch agent status --json
night-watch health --json
night-watch config list --json
night-watch config get reviewerEnabled --json
night-watch config set reviewerEnabled false --json
night-watch job pause reviewer --json
night-watch job resume reviewer --json
```

JSON modes write one JSON document to stdout on success and reserve stderr for errors. `night-watch status --json` keeps its legacy shape for backward compatibility; `night-watch agent status --json` adds a stable wrapper with `schemaVersion`, `status`, `paused`, `queue`, `board`, `health`, and `lastRuns`.

Paused jobs are stored in `night-watch.config.json` under `pausedJobs`. Cron scripts and queue claim/dispatch paths read this state before starting work, so `night-watch job pause <job> --json` prevents new cron/queue-dispatched runs for that job until resumed.

---

## Who It's For

Night Watch is strongest when:
Expand Down
24 changes: 24 additions & 0 deletions SELF_REVIEW.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Self Review: Agent Manageability CLI

## Implementation

- Added `night-watch agent status --json` with `schemaVersion`, legacy status data, pause state, queue state, board summary, health checks, and recent run timestamps.
- Added `night-watch config list/get/set --json` with dot-path access, simple value parsing, config reload validation, and rollback on invalid persisted values.
- Added `night-watch health --json` with lightweight automation readiness checks and JSON-only stdout.
- Added `night-watch job pause/resume <job> --json`, persisted pause state under `pausedJobs`, and wired cron/queue entry points to skip paused jobs before starting new work.
- Documented the machine-readable CLI contract in `README.md` and `docs/reference/commands.md`; committed the PRD at `docs/prds/agent-manageability-cli.md`.

## Tests Run

- `yarn workspace @jonit-dev/night-watch-cli test src/__tests__/commands/agent.test.ts`
- `yarn workspace @jonit-dev/night-watch-cli test src/__tests__/commands/agent.test.ts src/__tests__/commands/status.test.ts src/__tests__/commands/queue.test.ts`
- `bash -n scripts/night-watch-cron.sh scripts/night-watch-pr-reviewer-cron.sh scripts/night-watch-qa-cron.sh scripts/night-watch-audit-cron.sh scripts/night-watch-slicer-cron.sh scripts/night-watch-plan-cron.sh scripts/night-watch-merger-cron.sh scripts/night-watch-pr-resolver-cron.sh scripts/night-watch-helpers.sh`
- `yarn lint` (passes with existing warnings)
- `yarn verify`
- `yarn workspace @jonit-dev/night-watch-cli build`

## Known Limitations

- `job pause` prevents new cron/queue-dispatched starts; it does not terminate a job that is already running.
- `agent status` includes board details only when a board is already configured. Provider/API errors are captured in `board.error` instead of failing the whole status snapshot.
- `lastRuns` is based on available job-run telemetry from the last 30 days; projects without telemetry return null timestamps.
Loading
Loading