Summary
Several CLI options (--count, --delay, --max-pages, etc.) are cast with Number(...) but never validated. If the user passes a non-numeric value, the code forwards NaN to the API query or loops, which leads to confusing behavior.
Steps to Reproduce
- Run
node lg.mjs fetch --enrollment fake --count nope.
- The CLI still runs and logs the URL, which now contains
count=NaN.
Expected Result
The CLI should reject non-numeric inputs with a clear message.
Actual Result
Invalid numeric strings become NaN; the code continues and produces broken requests or loops.
Additional Context
Number(...) conversions happen in lg.mjs (see lines ~322, ~184, and inside fetchNotesRange). Adding a Number.isFinite guard (and defaulting to the safe fallback) would make the UX clearer and avoid confusing API calls.
Summary
Several CLI options (
--count,--delay,--max-pages, etc.) are cast withNumber(...)but never validated. If the user passes a non-numeric value, the code forwardsNaNto the API query or loops, which leads to confusing behavior.Steps to Reproduce
node lg.mjs fetch --enrollment fake --count nope.count=NaN.Expected Result
The CLI should reject non-numeric inputs with a clear message.
Actual Result
Invalid numeric strings become
NaN; the code continues and produces broken requests or loops.Additional Context
Number(...)conversions happen inlg.mjs(see lines ~322, ~184, and insidefetchNotesRange). Adding aNumber.isFiniteguard (and defaulting to the safe fallback) would make the UX clearer and avoid confusing API calls.