feat(HAI-071): add Bun single-binary compile support for CLI

- Create build script (packages/cli/build.ts) using Bun.build compile target
- Update asset resolution in dashboard server for bundled context
- Add npm scripts to wire up the build process
- Add build-exe tests to verify compiled binary output
- Fix pre-existing build errors in engine and core packages
- Document build and compile workflow in README
This commit is contained in:
Dustin Byrne
2026-03-26 00:32:57 -04:00
parent 96bacb5d65
commit fbecff7255
7 changed files with 230 additions and 6 deletions

View File

@@ -140,6 +140,37 @@ pnpm dev dashboard -- --engine # Board + AI engine
pnpm dev task list # CLI commands
```
## Building a standalone executable
You can build a single self-contained `hai` binary using [Bun](https://bun.sh/):
```bash
pnpm build:exe
```
This compiles all TypeScript, builds the dashboard client, and produces:
- `packages/cli/dist/hai` — the standalone binary
- `packages/cli/dist/client/` — co-located dashboard assets
Run the binary directly — no Node.js, pnpm, or workspace setup needed:
```bash
./packages/cli/dist/hai --help
./packages/cli/dist/hai task list
./packages/cli/dist/hai dashboard
```
To distribute, copy both the `hai` binary and the `client/` directory together.
You can override the dashboard asset path via the `HAI_CLIENT_DIR` environment variable:
```bash
HAI_CLIENT_DIR=/path/to/client ./hai dashboard
```
**Prerequisites:** Bun ≥ 1.0 (`bun --version`)
## License
ISC