fix(cli): reject unknown options and extra positionals in render - #105
NgoQuocViet2001 wants to merge 3 commits into
Conversation
render destructured its positionals with no validation, so a mistyped
flag was taken as the output path:
archify render architecture spec.json --json out.html
wrote a 650KB html file literally named `--json`, never wrote
out.html, and exited 0. An extra positional was silently dropped the
same way.
render takes no options of its own once --quality and --repo-root are
stripped, so anything left starting with -- is a typo. Every sibling
artifact-producing subcommand already guards this -- compare, deliver,
preview, visual-check, guide and brands all do; render was the gap.
archify.zip rebuilt: bin/archify.mjs ships in the skill runtime.
|
Merged current Since the archive is a gate, I rebuilt it rather than hand-resolved it, and validated the toolchain first: rebuilding On the merged head:
Diff is unchanged in scope at 3 files: |
Carries forward the original contribution from @NgoQuocViet2001 in #105 onto the current main branch and rebuilds the canonical archive. Co-authored-by: NgoQuocViet2001 <ngoquocviet2001@gmail.com>
|
Thank you, @NgoQuocViet2001, for identifying this failure mode and providing the focused fix and regression coverage. Because this PR comes from a fork with maintainer edits disabled, we could not resolve the archify.zip conflict directly on this branch. We carried the source and tests forward onto the current main branch in #303, rebuilt the canonical archive with Node 22, and preserved your contribution through explicit co-author credit. The replacement passed the full local suite (1002 passed, 27 skipped, 0 failed), deterministic ZIP verification, packaged-skill smoke testing, and all current GitHub CI checks. It has now been merged as 5769ace. Closing this PR as superseded by #303. Thanks again for the clear reproduction and the contribution. |
The bug
renderdestructured its positionals with no validation, so a mistyped flag became the output path:out.htmlis never written, nothing warns, and the exit code is 0. An extra positional goes the same way:--jsonis a plausible typo here precisely because it is a real option on the neighbouringcompareanddelivercommands.The fix
Once
--qualityand--repo-rootare stripped,rendertakes no options of its own, so anything left starting with--is a typo. This mirrors the guarddeliveralready has, twelve lines away:renderwas the only artifact-producing subcommand without it —compare,deliver,preview,visual-check,guideandbrandsall validate already.After
Tests
Two cases in
archify/test/cli.test.mjs, both asserting the directory afterwards contains onlyspec.json— so they fail if the stray file comes back, not just if the message changes.The one failure is the same in both:
cli: preview runs from an installed skill without node_modules and exits cleanly, which spawns a browser and fails on this Windows box on unmodifiedmaintoo. Not touched by this change.archify.zip
Rebuilt, since
bin/archify.mjsships in the skill runtime. Verified with the same comparisonzip-freshnessruns — against the previously committed archive the only file that differs isbin/archify.mjs, so nothing unrelated drifted in.(Building on Windows silently produces a CRLF archive that fails that job; I built from an LF export under Linux, as with #91.)