Skip to content

Bug: pi: not found when installed via bun — transitive dep binary not linked #8

Description

@minzique

Bug

When installing ypi globally via bun, the pi binary from @mariozechner/pi-coding-agent (a transitive dependency) is not symlinked to the global bin directory. Running ypi fails immediately:

$ ypi ./
/Users/minzi/.bun/bin/ypi: line 119: exec: pi: not found

What happens next is worse

The natural reaction is to run bun install -g pi, which installs the wrong packagepi@2.0.5, a math pi-number calculator that squats the pi name on npm. That package then crashes with:

Error: Cannot find module './pi'

...because bun blocks its postinstall script.

Root Cause

Both ypi (line 124) and rlm_query (lines 345, 414, 433) invoke bare pi via exec pi / $TIMEOUT_CMD pi, relying on PATH resolution. But:

  1. bun (and pnpm) only link direct package binaries globally, not transitive dependency binaries
  2. ypi declares @mariozechner/pi-coding-agent as a dependency but doesn't re-export its pi binary
  3. The pi binary ends up at node_modules/@mariozechner/pi-coding-agent/dist/cli.js — present but not on PATH

Suggested Fix

Resolve pi from the package's own node_modules relative to SCRIPT_DIR instead of relying on bare PATH lookup. Search order:

  1. $SCRIPT_DIR/node_modules/.bin/pi (nested)
  2. $SCRIPT_DIR/../.bin/pi (hoisted .bin)
  3. $SCRIPT_DIR/node_modules/@mariozechner/pi-coding-agent/dist/cli.js (nested direct)
  4. $SCRIPT_DIR/../@mariozechner/pi-coding-agent/dist/cli.js (hoisted direct)
  5. Fall back to command -v pi (PATH — for standalone installs)

I've submitted a PR with this fix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions