gstack/design
Jayesh Betala 68f646d1e5 fix(design/variants): guard --count against NaN/zero/negative input
`design variants --count <bad value>` silently produced zero variants
because the generation loop only clamped the upper bound. `--count` arrives
via `parseInt`, which yields NaN for non-numeric input ("abc") and passes
zero/negative values straight through. `Math.min(NaN, 7)` is NaN, so the
`for (i = 0; i < NaN; i++)` loop never ran and the JSON result emitted
`"count": null` — a confusing success-with-nothing for any caller parsing it.

Add an exported `normalizeVariantCount` helper that clamps to the supported
[1, 7] range and falls back to the default of 3 for non-finite input, then
use it where the bare upper-bound cap was. Pure and unit-tested so the
behavior is pinned without an API key.

Fixes #2032

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 12:32:19 +05:30
..
src fix(design/variants): guard --count against NaN/zero/negative input 2026-06-17 12:32:19 +05:30
test fix(design/variants): guard --count against NaN/zero/negative input 2026-06-17 12:32:19 +05:30
prototype.ts v1.30.0.0 fix wave: 21 community PRs + Windows CI extension + codex flag-semantics smoke (#1391) 2026-05-09 08:06:47 -07:00