Skip to content

fix: resolve context.js path + include it in npm package#19

Merged
bhvbhushan merged 1 commit into
mainfrom
bhvbhushan/context-optimization
Apr 8, 2026
Merged

fix: resolve context.js path + include it in npm package#19
bhvbhushan merged 1 commit into
mainfrom
bhvbhushan/context-optimization

Conversation

@bhvbhushan

@bhvbhushan bhvbhushan commented Apr 8, 2026

Copy link
Copy Markdown
Owner

Summary

Two bugs that made vibecop init --context completely broken in 0.4.1 and 0.4.2:

  1. dist/context.js was never included in the npm package. The prepublishOnly script ran bun run build but not bun run build:context. The tarball shipped without it.

  2. Path resolution fell back to user's CWD. When dist/context.js didn't exist in the package (because of bug feat: aiqt v0.1 — AI code quality linter with 7 detectors and 5 output formats #1), resolveContextScript() fell through to resolve("dist/context.js") which resolved against the user's project directory.

Result: hooks pointed to /Users/you/your-project/dist/context.js which doesn't exist.

Fix

  1. Added build:context to prepublishOnly script
  2. resolveContextScript() now tries ./context.js (sibling in dist/) first

Verified

$ npm pack && tar tzf vibecop-*.tgz | grep dist/
package/dist/cli.js
package/dist/context.js     ← now included

$ npm install ./vibecop-0.4.3.tgz && npx vibecop init --context
Hook path: node_modules/vibecop/dist/context.js  ← correct
File exists: YES

610 tests pass, type check clean, lint clean, both builds succeed.

🤖 Generated with Claude Code

resolveContextScript() now tries ./context.js (sibling in dist/) first,
which is the correct path when running from the bundled dist/cli.js.
Previously, locally-installed vibecop generated hook commands pointing
to a non-existent dist/context.js in the user's project root.

Bumps version to 0.4.2.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bhvbhushan bhvbhushan merged commit 04de187 into main Apr 8, 2026
1 check passed
@bhvbhushan bhvbhushan changed the title fix: resolve context.js path from vibecop package, not user's cwd fix: resolve context.js path + include it in npm package Apr 8, 2026
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