refactor: migrate CLI from Node.js to Bun

Closes #69 (closed)

Summary

  • Migrate CLI runtime from Node.js to Bun
  • Replace Node.js APIs with Bun equivalents (Bun.serve(), Bun.spawn(), native fetch())
  • Add build step for npm compatibility (works with both bunx and npx)
  • Convert test suite from Node test runner to Bun test runner

Performance Improvements

Metric Before (Node.js) After (Bun) Improvement
CLI startup 151ms 118ms 28% faster (n=200)
Build 3,700ms 82ms 45x faster (n=20)
Package install 4.5s 1.2s 3.8x faster
Dev iteration ~3.9s (build + run) 296ms (direct TS) 13x faster

Dual Runtime Support

  • Development: bun ./bin/postgres-ai.ts (native TypeScript, no build)
  • Production: Works with both bunx pgai and npx pgai
  • Users without Bun can still use the CLI via npm/npx

Test Plan

  • All 25 tests pass with bun test
  • bun ./bin/postgres-ai.ts --help works
  • node ./dist/bin/postgres-ai.js --help works
  • Build produces single 871KB bundle

Merge request reports

Loading