feat(HAI-090): remove package.json dependency from compiled binary

- Inline version/name resolution in bin.ts so the binary works without package.json
- Simplify build.ts by removing package.json bundling steps
- Remove unused dynamic package.json lookups in engine merger, triage, and executor
- Expand build-exe tests to verify binary runs independently of package.json
- Clean up obsolete engine unit tests tied to removed package.json logic
This commit is contained in:
Dustin Byrne
2026-03-26 01:18:18 -04:00
parent a8a7fd711b
commit eac1eda49a
3 changed files with 87 additions and 33 deletions

View File

@@ -16,7 +16,7 @@
*/
import { join, dirname } from "node:path";
import { cpSync, mkdirSync, existsSync, rmSync, writeFileSync } from "node:fs";
import { cpSync, mkdirSync, existsSync, rmSync } from "node:fs";
const cliRoot = dirname(new URL(import.meta.url).pathname);
const workspaceRoot = join(cliRoot, "..", "..");
@@ -102,14 +102,6 @@ function copyClientAssets() {
console.log(`${dashboardClientDest}`);
}
// ── Write a minimal package.json next to the binary ───────────────────
function writeDistPackageJson() {
writeFileSync(
join(outDir, "package.json"),
JSON.stringify({ name: "hai", version: "0.1.0", type: "module" }, null, 2) + "\n",
);
}
// ── Compile a single binary ───────────────────────────────────────────
function compileBinary(outFile: string, target: string): boolean {
console.log(`Compiling ${outFile} (target: ${target})...`);
@@ -157,7 +149,6 @@ if (targets === null) {
// Default: build for current platform → dist/hai
const outBinary = join(outDir, defaultBinaryName());
const ok = compileBinary(outBinary, "bun");
writeDistPackageJson();
if (!ok) process.exit(1);
console.log(`\n✓ Built: ${outBinary}`);
console.log(` Assets: ${dashboardClientDest}`);
@@ -178,8 +169,6 @@ if (targets === null) {
}
}
writeDistPackageJson();
console.log(`\n${failed ? "⚠" : "✓"} Cross-compilation complete.`);
if (built.length > 0) {
console.log(` Built ${built.length} binaries:`);