feat(cli): add portions command to plan how much meat to buy#299
Closed
jongio wants to merge 1 commit into
Closed
Conversation
Turn a guest count into a raw-weight shopping number. Cuts lose weight to trim and rendering, so this divides the cooked weight you want to serve by the cut's yield and rounds up to the next quarter pound. SDK: new portions module with calculatePortions, listAppetites, and listPortionYields. Pure and offline, reusing the shared meat registry for cut lookup (aliases included). Per-cut yields cover the ten built-in profiles; appetite presets are light/standard/hearty at 4/6/8 cooked oz. CLI: new `thermoworks portions <meat> --guests N` command with --appetite, --per-person, --list, and --json. Unknown cuts and bad counts exit non-zero. Tests cover yield math, rounding, aliases, validation, and the CLI parse/format/handler paths. README and cli-reference updated. Closes #295 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ecabbd71-7dd2-42f1-a014-ab6df3686eee
Owner
Author
|
Closing. Keeping the thermoworks CLI focused on device and temperature features: probes, alarms, device health, and live and archived readings. A portions calculator doesn't read device data, so it's out of scope here. |
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
Add a
portionscommand that turns a guest count into how much raw meat to buy.Cuts lose weight to trim and rendering, so buying by cooked serving size under-buys. This divides the cooked weight you want to serve by the cut's yield, then rounds up to the next quarter pound so you land on a number the counter can actually weigh out.
npx thermoworks portions brisket --guests 12 npx thermoworks portions "pork butt" --guests 20 --appetite hearty npx thermoworks portions salmon --guests 8 --per-person 5 --json npx thermoworks portions --listHow
packages/sdk/src/portions.ts: purecalculatePortions(meat, guests, options)pluslistAppetitesandlistPortionYields. It reuses the shared meat registry (resolveMeatProfile) so aliases likepork buttandbabybackresolve, and keeps its own per-cut cook yields for the ten built-in profiles. Appetite presets are light, standard, and hearty at 4, 6, and 8 cooked ounces. No network, no clock, no files.packages/cli/src/commands/portions.ts:portions <meat> --guests N [--appetite ...] [--per-person OZ] [--list] [--json]. Unknown cuts, bad guest counts, and conflicting flags exit non-zero.Testing
--list, and the error paths.pnpm lintclean, typecheck clean.Yields are working averages meant to keep you from under-buying, not to hit an exact plate weight.
Closes #295