feat(cli): add stall command for one-shot stall detection#277
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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-alertshows 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 howtempexposes 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
packages/cli/src/commands/stall.tsmaps history readings to the SDKTemperatureReadingshape (string timestamps toDate), sorts oldest first, and callsdetectStall.src/index.ts(import,stallswitch case, help text).--thresholdand--durationtune the plateau band and minimum duration; defaults match the SDK (2 degrees, 30 minutes).Tests
packages/cli/tests/stall.test.tscovers 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), andpnpm lintare green.Docs
packages/cli/README.mdanddocs/cli-reference.md.Closes #272