Skip to content

[ef-37] fix: build + ship dist/index.js to fix custom policy loading + bump to 0.0.1-beta.11#37

Merged
NiveditJain merged 3 commits into
mainfrom
ef-37
Apr 7, 2026
Merged

[ef-37] fix: build + ship dist/index.js to fix custom policy loading + bump to 0.0.1-beta.11#37
NiveditJain merged 3 commits into
mainfrom
ef-37

Conversation

@NiveditJain

@NiveditJain NiveditJain commented Apr 7, 2026

Copy link
Copy Markdown
Member

Summary

  • Root cause: dist/index.js was never built or included in the published npm package. findDistIndex() always returned null for global installs, so the ESM shim was never created and from 'failproofai' imports in user custom policy files were left unrewritten → Cannot find package 'failproofai'
  • Fix: Prepend bun build --target=node --format=cjs --outfile=dist/index.js src/index.ts to the build script, and add dist/ to the files array in package.json
  • Version: 0.0.1-beta.100.0.1-beta.11

Test plan

  • Built dist/index.js locally — valid CJS output confirmed
  • FAILPROOFAI_DIST_PATH=./dist failproofai p -i -c ~/failproofai/examples/policies-notification.js — "Validated 1 custom hook(s): slack-on-idle-notification" ✅
  • npm pack --dry-run --ignore-scriptsdist/index.js (2.1kB) appears in tarball ✅
  • Docker clean-install (oven/bun image, install from local .tgz, failproofai p -i -c /tmp/test-policy.mjs) — exits 0, "Validated 1 custom hook(s): test-policy" ✅
  • 723 unit tests pass

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Bumped package version to 0.0.1-beta.11.
    • Updated build process and included compiled output in releases for improved packaging and standalone builds.
  • Documentation

    • Added repository guidance docs outlining agent workflows, CI/testing requirements, and environment/tooling expectations.

…ailproofai' + bump to 0.0.1-beta.11

`findDistIndex()` always returned null for global installs because
`dist/index.js` was never built or included in the published package.
This caused the ESM shim to be skipped, leaving `from 'failproofai'`
unrewritten in user custom policy temp files → "Cannot find package
'failproofai'" at runtime.

Fixes: prepend a `bun build` CJS step to the build script so
`dist/index.js` is produced before publish, and add `dist/` to
the `files` array so it ships in the npm tarball.

Verified: Docker clean-install (oven/bun image) confirms dist/index.js
present and `failproofai p -i -c` succeeds end-to-end.

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

coderabbitai Bot commented Apr 7, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@NiveditJain has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 21 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 0 minutes and 21 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: 3b6a4a9f-ea73-4905-9521-b81ff2026286

📥 Commits

Reviewing files that changed from the base of the PR and between b86dd35 and c90824c.

📒 Files selected for processing (2)
  • AGENTS.md
  • CLAUDE.md
📝 Walkthrough

Walkthrough

Version bumped to 0.0.1-beta.11; package.json build script updated to run a Bun build (Node target, CommonJS output to dist/index.js), then next build and copy .next/static into the standalone output; dist/ added to published files. Two new repo guidance docs added: AGENTS.md and CLAUDE.md.

Changes

Cohort / File(s) Summary
Package manifest & build
package.json
Version bump to 0.0.1-beta.11; dist/ added to files; build script now runs a Bun build targeting Node (emits CommonJS to dist/index.js), then next build, and copies .next/static into the standalone output.
Repository agent guidance
AGENTS.md
New documentation added: repo-specific agent/PR rules, CI polling guidance, testing constraints, Docker smoke test steps, regression checklist, and file-role reference.
Repository agent guidance
CLAUDE.md
New documentation added: tooling/environment assumptions, PR/CI workflow rules, required CI commands, testing discipline, Docker verification steps, regression scenarios, and project cheatsheet.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I hopped through package.json with glee,

Built with Bun and set the code free,
Docs arrived to guide the crew,
Small bumps, neat scripts, a bright new view,
— a rabbit's clap for changes, two!


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

NiveditJain and others added 2 commits April 7, 2026 19:36
…w rules

Documents the full agent workflow: Docker clean-install test recipe,
regression checklist, one-PR-per-branch rule, CI-must-be-green rule,
and unit-test requirements for new behaviour.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e pushing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@NiveditJain NiveditJain merged commit 96784f6 into main Apr 7, 2026
8 checks passed
@NiveditJain NiveditJain deleted the ef-37 branch April 21, 2026 01:31
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