feat(cli): add Bun single executable binary support

Enables building hapi as standalone Bun-compiled executables for macOS,
Linux, and Windows (x64/arm64). Adds build script, bootstrap entry point,
runtime asset management, and automatic deployment of bundled tools
(ripgrep, difftastic). Includes MCP stdio bridge support and proper
environment handling for compiled binaries. Updates documentation with
build and installation instructions for single executable distribution.
This commit is contained in:
weishu
2025-12-20 21:41:11 +08:00
parent bf18224d05
commit 17eeba10d6
28 changed files with 605 additions and 238 deletions
+4 -3
View File
@@ -16,6 +16,7 @@ import os from 'node:os';
import { MessageQueue2 } from '@/utils/MessageQueue2';
import { hashObject } from '@/utils/deterministicJson';
import { runtimePath } from '@/projectPath';
import { getHappyCliCommand } from '@/utils/spawnHappyCLI';
import { resolve, join } from 'node:path';
import fs from 'node:fs';
import { startHappyServer } from '@/claude/utils/startHappyServer';
@@ -521,11 +522,11 @@ export async function runCodex(opts: {
// Start Happy MCP server (HTTP) and prepare STDIO bridge config for Codex
const happyServer = await startHappyServer(session);
const bridgeCommand = join(runtimePath(), 'bin', 'happy-mcp.mjs');
const bridgeCommand = getHappyCliCommand(['mcp', '--url', happyServer.url]);
const mcpServers = {
happy: {
command: bridgeCommand,
args: ['--url', happyServer.url]
command: bridgeCommand.command,
args: bridgeCommand.args
}
} as const;
let first = true;