Skip to content

[ef-46] fix: bundle CLI for Node.js — support npm install -g without bun#46

Merged
NiveditJain merged 1 commit into
mainfrom
ef-46
Apr 8, 2026
Merged

[ef-46] fix: bundle CLI for Node.js — support npm install -g without bun#46
NiveditJain merged 1 commit into
mainfrom
ef-46

Conversation

@NiveditJain

@NiveditJain NiveditJain commented Apr 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Root cause: CLI entry point (bin/failproofai.mjs) used #!/usr/bin/env bun shebang and imported TypeScript files directly, making npm install -g failproofai fail on systems without bun (/usr/bin/env: 'bun': No such file or directory)
  • Fix: Bundle the CLI into dist/cli.mjs using bun's bundler with #!/usr/bin/env node shebang, so it runs natively on Node.js without requiring bun
  • Bump version to 0.0.2-beta.1
  • Error message: "server binary" -> "server.js"
  • Postinstall now validates server.js exists and fails early if missing
  • Docs updated to show both npm install -g and bun add -g install commands

Test plan

  • bun run test:run — 723 unit tests pass
  • bun run test:e2e — 124 E2E tests pass
  • bun run lint + tsc --noEmit — clean
  • Docker node:20 (no bun): npm install -gfailproofai --version → dashboard launches
  • Docker oven/bun:latest + npm: npm install -gfailproofai --version → dashboard launches
  • Local node dist/cli.mjs --version, dashboard launch, hook handling, policies list — all work

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation

    • Marked Bun as optional for development/building from source.
    • Added Bun as an alternative installation method alongside npm across multiple documentation sections.
  • Chores

    • Bumped version to 0.0.2-beta.1.
    • Updated CLI build process and installation verification.

…l -g

The CLI entry point used #!/usr/bin/env bun shebang and imported TypeScript
files directly, making it incompatible with npm install -g on systems without
bun. Bundle the CLI into dist/cli.mjs via bun build with #!/usr/bin/env node
shebang so it works with both node and bun runtimes.

- Add build:cli script that bundles bin/failproofai.mjs into dist/cli.mjs
- Change bin entry from bin/failproofai.mjs to dist/cli.mjs
- Bump version to 0.0.2-beta.1
- Fix error message: "server binary" -> "server.js"
- Add postinstall validation: fail install if server.js is missing
- Update docs to show both npm and bun install commands
- Mark Bun as optional (only needed for development)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 8, 2026

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Documentation updated to mark Bun as optional for development, alternative Bun-based installation commands added across multiple docs. Package version bumped to 0.0.2-beta.1, CLI entrypoint changed to built dist file, build process restructured with new CLI building step, and postinstall script enhanced with server.js validation check.

Changes

Cohort / File(s) Summary
Documentation updates
README.md, docs/getting-started.md, docs/introduction.md, docs/package-aliases.md
Marked Bun as optional development tool; added alternative bun add -g failproofai commands alongside npm installation instructions; updated section headings for clarity.
Build and package configuration
package.json
Version bumped to 0.0.2-beta.1; CLI entrypoint changed from ./bin/failproofai.mjs to ./dist/cli.mjs; refactored build scripts with new build:cli step for ESM bundling with shebang rewrite; added CJS library build to main build script; updated predev and prestart hooks to run build:cli before linking.
Script utilities
scripts/postinstall.mjs, scripts/launch.ts
Added preflight check in postinstall to verify .next/standalone/server.js exists before proceeding; updated error message in launch script from "Cannot find server binary at" to "Cannot find server.js at".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


🐰 Bun hops away, optional now,
npm takes the stage with a bow,
Build scripts dance in their new array,
CLI bundles in dist today,
Zero-point-two-beta leads the way! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: bundling the CLI for Node.js to support npm install without requiring bun.
Description check ✅ Passed The description covers the root cause, fix, version bump, and documentation updates, and includes a comprehensive test plan showing all required checks passed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ef-46

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant