Skip to content

Conversation

@jdalton
Copy link
Contributor

@jdalton jdalton commented Jan 10, 2026

Summary

Applies the remaining fixes from the closed PR #1025 that were not related to the @socketsecurity/lib update:

  • Add prebuild hook and generate-packages.mjs script to ensure template packages are generated before CLI build runs
  • Always copy cli.js to dist directory (required for dist/index.js to work)
  • Add Node.js CLI flags whitelist to prevent --help, --version, etc from being forwarded to Python CLI
  • Remove unused --prod flag from build script
  • Simplify cli.js copy to use copyFileSync directly instead of spawning node

Related

Test plan

  • Build succeeds locally
  • All tests pass
  • CI passes

Note

Focuses on reliable builds and correct flag handling.

  • Adds prebuild hook running scripts/generate-packages.mjs to generate template packages before build
  • Always copies build/cli.js to dist/cli.js via copyFileSync; removes unused --prod path and simplifies build script
  • Updates CLI flag forwarding: ignores built-in flags (e.g., --help, --version, --config, etc.) and supports --flag=value parsing when deciding Python forwarding
  • CI workflow: removes cache lookup-only gating and unconditionalizes CLI build across unit/integration/e2e jobs
  • Test updates for stability (hoisted mocks, debug mocking) and coverage of new behaviors

Written by Cursor Bugbot for commit 9521bcf. Configure here.

- Add prebuild hook and generate-packages.mjs script to ensure template
  packages are generated before CLI build runs
- Always copy cli.js to dist directory (required for dist/index.js to work)
- Add Node.js CLI flags whitelist to prevent --help, --version, etc from
  being forwarded to Python CLI
- Remove unused --prod flag from build script
- Simplify cli.js copy to use copyFileSync directly instead of spawning node
- Add isDebug mock to npm-base.test.mts and install.test.mts to ensure
  --loglevel args are consistently added (isDebug() was returning true in CI
  due to environment variables)
- Use hoisted mocks for whichRealSync in path-resolve.test.mts to ensure
  reliable mock behavior in CI (dynamic import pattern was failing)
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Comment @cursor review or bugbot run to trigger another review on this PR

- Handle --flag=value syntax in nodeCliFlags whitelist by extracting base flag name
- Use nullish coalescing for process.exit in generate-packages.mjs to handle
  signal-killed processes (code is null, which coerces to 0)
The test was mocking `resolveBinPathSync` but the actual function is
`resolveRealBinSync`. This caused tests to use the real implementation
in CI, which resolved to the actual npm path on the runner.
The CI workflow was using `lookup-only: true` for cache restore, which
only checks if the cache exists but doesn't actually restore files.
This caused test jobs to skip the build step when cache existed, but
the build artifacts weren't actually present on disk.

Remove `lookup-only` and always run the build step. The build script
already has its own caching logic and will skip unnecessary work.
@jdalton
Copy link
Contributor Author

jdalton commented Jan 10, 2026

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no bugs!


Comment @cursor review or bugbot run to trigger another review on this PR

@jdalton jdalton merged commit c4b1339 into main Jan 10, 2026
16 checks passed
@jdalton jdalton deleted the fix/remaining-pr-1025-fixes branch January 10, 2026 23:41
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