Skip to content

fix: cross-platform external check commands#17

Merged
PatrickDinh merged 5 commits into
mainfrom
feat/spawn-external-improvements
Jul 21, 2026
Merged

fix: cross-platform external check commands#17
PatrickDinh merged 5 commits into
mainfrom
feat/spawn-external-improvements

Conversation

@PatrickDinh

@PatrickDinh PatrickDinh commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

What

  • External check commands run as argv arrays with no shell; args after -- reach the tool as literal entries — never re-split or glob-expanded.
  • The installed-tool probe understands Windows .CMD/.EXE bin shims (PATHEXT).
  • verifyx eject writes scripts quoted for both POSIX and Windows npm scripts, and fails at eject time on args it can't quote portably.
  • verify:circular-deps scaffolds as plain verifyx circular-deps (skott scans the project by default); failure hints print the exact argv.

Why

verifyx duplicate-code -- --ignore '**/generated/**' ignored nothing. Passthrough args were joined unquoted into a single shell string, so /bin/sh glob-expanded the pattern and jscpd received --ignore src/generated/a.ts src/generated/b.ts — a single-file ignore plus a stray scan path. The same joining word-split any arg with a space.

Windows failed the opposite way: cmd.exe never expands globs, so the scaffolded verifyx circular-deps -- src/*.ts handed skott a literal src/*.ts and failed on every Windows machine. With shell strings, each argument's fate depends on which shell re-parses it — so no shell gets to see the arguments at all.

How

checkCommand/fixCommand are now readonly string[], spawned with shell: false via cross-spawn (new runtime dependency — plain shell-less spawn can't run node_modules/.bin .cmd shims on Windows). Consumer-owned verify:* script overrides are user-authored strings and still run through the platform shell, unchanged.

Verified manually with before/after tarballs on real Windows + Linux:

Scenario Before After
Linux: duplicate-code -- --ignore '**/generated/**' exit 1 — ignore glob destroyed exit 0
Windows: scaffolded verify:circular-deps, clean project exit 1 — literal src/*.ts not found exit 0
Windows: circular-deps -- "my src/index.ts" exit 1 — arg word-split exit 0
Both: duplicate-code with real duplicates exit 1 exit 1

@PatrickDinh
PatrickDinh marked this pull request as ready for review July 20, 2026 23:36

@staff0rd staff0rd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my agents had nothing to say about this :0

@PatrickDinh
PatrickDinh merged commit f432b9c into main Jul 21, 2026
1 check passed
@PatrickDinh
PatrickDinh deleted the feat/spawn-external-improvements branch July 21, 2026 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants