feat: initialize AI agent harness
This commit is contained in:
33
scripts/build.mjs
Normal file
33
scripts/build.mjs
Normal file
@@ -0,0 +1,33 @@
|
||||
import { chmod, rm } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { build } from "esbuild";
|
||||
|
||||
const harnessRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
await rm(path.join(harnessRoot, "dist"), { recursive: true, force: true });
|
||||
|
||||
const common = {
|
||||
absWorkingDir: harnessRoot,
|
||||
bundle: true,
|
||||
platform: "node",
|
||||
target: "node20",
|
||||
format: "cjs",
|
||||
legalComments: "eof",
|
||||
sourcemap: false,
|
||||
};
|
||||
|
||||
await Promise.all([
|
||||
build({
|
||||
...common,
|
||||
entryPoints: [path.join(harnessRoot, "src", "cli.ts")],
|
||||
outfile: path.join(harnessRoot, "dist", "cli.cjs"),
|
||||
banner: { js: "#!/usr/bin/env node" },
|
||||
}),
|
||||
build({
|
||||
...common,
|
||||
entryPoints: [path.join(harnessRoot, "src", "index.ts")],
|
||||
outfile: path.join(harnessRoot, "dist", "index.cjs"),
|
||||
}),
|
||||
]);
|
||||
|
||||
await chmod(path.join(harnessRoot, "dist", "cli.cjs"), 0o755);
|
||||
Reference in New Issue
Block a user