Repository navigation
fix: make fix and the unused-dependency fallback work on Windows - #12
Open
AjayBThorat-20 wants to merge 1 commit into
Open
AjayBThorat-20 wants to merge 1 commit into
AjayBThorat-20 wants to merge 1 commit into
Conversation
- fix ran execFileSync('npm', ...), which can't start npm.cmd on Windows
(Node won't spawn a .cmd without a shell), so it could not install or
remove anything there. npm calls now go through cross-spawn (runNpm),
which resolves npm/npm.cmd and passes arguments without a shell; npm
audit uses the same helper.
- The unused fallback shelled out to grep, which Windows lacks, so every
dependency looked used. It is a JavaScript scan now: imports in code,
whole-name references in config files and stylesheets (.babelrc,
postcss.config.js, @import), and no longer a bare substring match.
- Run DevCompass's own bundled knip instead of `npx knip`, which resolved
knip against the scanned project and could download another version.
cross-spawn was already installed transitively; the lockfile is unchanged.
This was referenced Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
fixcouldn't install or remove anything on Windows. It ranexecFileSync('npm', …), and Node can't startnpm.cmdwithout a shell. npm calls now go throughcross-spawn, which resolvesnpm/npm.cmdeverywhere and still passes arguments without a shell;npm audituses the same helper.grep. It's a JavaScript scan now, covering imports in code and whole-name references in config files and stylesheets (.babelrc,postcss.config.js,@import), and it no longer counts a substring (msinsideitems) as a use.knipruns from DevCompass's own bundled copy instead ofnpx knip, which resolved it against the scanned project and could download a different version.cross-spawnwas already installed transitively; the lockfile is unchanged. This should let the Windows CI job (#7) dropcontinue-on-error.Stacked on #11.
Merging the stack: use Create a merge commit, not squash (squashing makes every later PR show these commits again). After merging the PR below this one, click Delete branch on it; GitHub then retargets this PR to
mainand CI runs.How I tested it
npm run test:coverageon Node 24.21.0, cleannpm ci, network disabled: 127/127 pass, 36.33% linesnpm audit --audit-level=highcurrently fails on GHSA-mrwp-f3q8-3g9p (follow-redirects, published after this branch was made); the lockfile fix is in feat: rank vulnerabilities by exploit risk (CISA KEV + FIRST EPSS) #14runNpm(no shell,npm.cmdresolution) and the JavaScript unused scan (config files, stylesheets, no substring matches)🤖 Generated with Claude Code