Skip to content

feat(cli): add stall command for one-shot stall detection#277

Merged
jongio merged 1 commit into
mainfrom
idea/cli-stall
Jul 13, 2026
Merged

feat(cli): add stall command for one-shot stall detection#277
jongio merged 1 commit into
mainfrom
idea/cli-stall

Conversation

@jongio

@jongio jongio commented Jul 12, 2026

Copy link
Copy Markdown
Owner

What

Adds a thermoworks stall <SERIAL> command: a one-shot check for whether a cook has stalled, meant for scripts and cron jobs.

It pulls the device temperature history, runs the existing stall detection over it, and reports:

  • whether the temperature has plateaued
  • when the stall started
  • how long it has lasted
  • the average plateau temperature

When a stall is active it prints a short wrap suggestion (foil or butcher paper, or hold and wait).

Why

The SDK already ships tested stall detection, and watch --stall-alert shows it live. There was no scriptable, non-streaming way to ask "is this cook stalled right now?" and branch on the answer. This exposes the same detection as a one-shot command, mirroring how temp exposes a single reading for automation.

thermoworks stall M100009168
thermoworks stall M100009168 --threshold 3 --duration 45
thermoworks stall M100009168 --json   # { serial, isStalling, stallStart, stallDuration, avgTemp }

How

  • New packages/cli/src/commands/stall.ts maps history readings to the SDK TemperatureReading shape (string timestamps to Date), sorts oldest first, and calls detectStall.
  • Wired into src/index.ts (import, stall switch case, help text).
  • --threshold and --duration tune the plateau band and minimum duration; defaults match the SDK (2 degrees, 30 minutes).
  • Exits non-zero when there is not enough history to assess a stall.

Tests

  • packages/cli/tests/stall.test.ts covers arg parsing, active-stall output, the JSON shape, no-stall output, unordered-reading sorting, and the not-enough-history, missing-serial, and not-logged-in exits.
  • pnpm --dir packages/cli typecheck, pnpm --dir packages/cli test (887 pass), and pnpm lint are green.

Docs

  • Added command sections to packages/cli/README.md and docs/cli-reference.md.

Closes #272

Add a `thermoworks stall <SERIAL>` command that reports whether a cook
has plateaued, in one shot, for scripts and cron jobs. It pulls the
device temperature history, runs the existing stall detection over it,
and prints the stall state, start time, duration, and average plateau
temperature, with a short wrap suggestion when a stall is active.

The same detection already powers `watch --stall-alert`; this exposes it
as a scriptable, non-streaming check (mirroring the `temp` command).
Supports `--threshold`, `--duration`, and `--json`.

Closes #272

Co-authored-by: Copilot App <[email protected]>
@jongio jongio added cli CLI package enhancement New feature or request idea Feature idea from the idea pipeline labels Jul 12, 2026
@jongio jongio self-assigned this Jul 12, 2026
@jongio jongio merged commit 6e423fb into main Jul 13, 2026
2 checks passed
@jongio jongio deleted the idea/cli-stall branch July 13, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI package enhancement New feature or request idea Feature idea from the idea pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI: Add stall command for a one-shot stall check

1 participant