--max, --max-tool and --price all go straight through Number(...) with no check:
const price = Number(flag("--price", 3));
maxTokens: flag("--max", null) ? Number(flag("--max", null)) : null,
tokencut payload.json --compact --max abc gives maxTokens: NaN. The trim loop condition is total > NaN, which is always false, so the command reports "saved 0 tokens" and exits 0. It looks like the payload was already under budget.
--price abc is worse: every cost in the output becomes $NaN.
Acceptance
- A non-numeric or negative value for any of the three flags exits non-zero with a message naming the flag and what it got
--max 0 is still accepted (a legitimate, if extreme, budget)
- Tests cover a bad value for each flag
Good first issue: one small helper and three call sites.
--max,--max-tooland--priceall go straight throughNumber(...)with no check:tokencut payload.json --compact --max abcgivesmaxTokens: NaN. The trim loop condition istotal > NaN, which is always false, so the command reports "saved 0 tokens" and exits 0. It looks like the payload was already under budget.--price abcis worse: every cost in the output becomes$NaN.Acceptance
--max 0is still accepted (a legitimate, if extreme, budget)Good first issue: one small helper and three call sites.