From 4a60bffe3b8156491ffc658a879d7d316ee2e6e3 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 2 Dec 2025 08:55:25 +0000 Subject: [PATCH] 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. --- packages/coding-agent/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/coding-agent/package.json b/packages/coding-agent/package.json index 134e8c94..73a6d78d 100644 --- a/packages/coding-agent/package.json +++ b/packages/coding-agent/package.json @@ -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",