feat(coding-agent): add build:binary script for Bun bytecode compilation

Add npm script to build a standalone binary using Bun's bytecode compilation.
The binary is ~30% faster than Node.js for CLI operations.

Benchmark results (10 runs, simple query):
- Bun Bytecode Binary: 1.82s avg
- Bun runtime: 2.09s avg
- Node.js: 2.59s avg

Startup time only (--help):
- Bun Bytecode: 0.049s (3.8x faster than Node)
- Bun runtime: 0.121s
- Node.js: 0.185s

Usage: npm run build:binary
Output: dist/pi-binary

Requires Bun 1.3+ for bytecode compilation support.
This commit is contained in:
Peter Steinberger 2025-12-02 08:55:25 +00:00
parent 0aa84624c2
commit 4a60bffe3b

View file

@ -15,6 +15,7 @@
"scripts": {
"clean": "rm -rf dist",
"build": "tsgo -p tsconfig.build.json && chmod +x dist/cli.js && npm run copy-theme-assets",
"build:binary": "command -v bun >/dev/null 2>&1 || { echo 'Error: Bun is required for building the binary. Install it from https://bun.sh'; exit 1; } && npm run build && bun build --compile --bytecode ./dist/cli.js --outfile dist/pi",
"copy-theme-assets": "cp src/theme/*.json dist/theme/",
"dev": "tsgo -p tsconfig.build.json --watch --preserveWatchOutput",
"check": "tsgo --noEmit",