Repository navigation
fix: refuse Node.js older than 18 before the CLI starts - #28
Open
arunim2405 wants to merge 2 commits into
Open
arunim2405 wants to merge 2 commits into
arunim2405 wants to merge 2 commits into
Conversation
npm only warns about `engines`, so `npx @stackguardian/mcp-wizard` ran on Node 16. The browser sign-in, the default flow, then failed with "fetch is not defined" after the user had approved access, because Node 16 has no global fetch. The npm bin is now src/cli.ts, which checks the version and exits with a clear message before loading index.ts and its dependencies. Node 18 and 20 are unchanged. --token installs on older versions, which happened to work, now stop too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The error now prints the curl and irm one-liners from the README, so a user on old Node can switch to the standalone executable without leaving the terminal. A test keeps the commands in step with the README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
🤖 AI review (GPT-6.1)Verdict: looks good stackguardian-mcp#28 — fix: refuse Node.js older than 18 before the CLI startsNo findings on head The npm entry point checks the runtime before dynamically importing the CLI. The packed build preserves that ordering and prints both standalone installation commands. Rejecting API-key installs and informational commands on older Node versions matches the declared Tests
Automated review generated from the StackGuardian PR-review automation. Comments only; it does not approve or block. Reply here if a finding is wrong. |
larisoncarvalho
approved these changes
Nov 2, 2026
This branch has not been deployed
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.
Problem
npx @stackguardian/mcp-wizardon Node 16 prints a fewEBADENGINEwarnings and starts normally. The browser sign-in, which is the default flow, then ends withfetch is not defined, after the user has already approved access in the browser.Root cause
engines: { node: ">=18" }has been inpackage.jsonsince the initial commit, but npm only warns about it (unlessengine-strictis set), so nothing stops the CLI from running.exchangeCodeinsrc/sg/oauth.tsdefaultsfetchImplto the globalfetch, which Node 16 does not have without a flag. That default is only evaluated when the token exchange runs, which is after the browser step.Fix
src/cli.ts: checksprocess.versions.nodeand exits 1 with a clear message below Node 18, then dynamically importssrc/index.ts.index.tswould still run aftercommander,chalkand the others load.src/index.tsand the upstream files are unchanged. The standalone executable still builds fromsrc/index.ts.CHANGELOG.mdentry and version bump to 1.3.1, perAGENTS.md.Message on Node 16:
The install commands are the same one-liners as the README's Install section; a test fails if the two drift apart.
Behaviour change to check
--tokeninstalls happen to work on Node 16 today, because that path never callsfetch. This PR stops them too, along withstatusandlist-agents. That matchesenginesand the bug thread, but it is a deliberate choice.Tests
tests/sg-node-version.test.ts(new)bun run typecheckbun run buildbun run test:unitbun run test(unit + e2e)sg-login-tty"login in a terminal goes on to pick agents and install" times out locally. It times out the same way on untouchedmain(66070a0), so it is not caused by this change.bun run fallow -- --summarynpm packtarball run throughnpxon real Node binaries, with a throwawayHOME. Sign-in used a local stub broker, so no real token endpoint was involved:--version/status--tokeninstallNot tested: Node 12/14 (no arm64 builds and no Rosetta on the test machine), Node 18.0–18.19, Node 24 and 26, and Linux/Windows.
Links
🤖 Generated with Claude Code