Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 168 to 169

Compare

+64 −0 in 1 place
new file, 64 lines
1+// Builds client/bin/abso.mjs: the whole client, client/abso.ts and everything it imports (yaml included),
2+// as one plain-JS file for Node 20 or later. Node 20 can't run the .ts files themselves (it has no type
3+// stripping), so this file is how a checkout runs on it:
4+//
5+// node client/bin/abso.mjs help
6+//
7+// npm run build:client rebuilds it; run it after changing the client and push the result.
8+// npm run check:client-bundle fails when the file isn't what a build of this folder gives (the check runs it).
9+//
10+// The file is committed, so a fresh clone runs it with no install and no build. It sits one folder under
11+// client/, so the client's own folder (client-version.ts) is still client/. The build is deterministic:
12+// paths in it are relative to the repo, so it comes out the same on every machine.
13+//
14+// Plain JS on purpose: it runs before anything is built.
15+import { readFileSync, writeFileSync } from "node:fs";
16+import { createRequire } from "node:module";
17+import { dirname, join, resolve } from "node:path";
18+import { fileURLToPath } from "node:url";
20+const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
21+const OUT = "client/bin/abso.mjs";
23+/** The bundle's text, built in memory. */
24+export function buildClient() {
25+ const esbuild = createRequire(import.meta.url)("esbuild");
26+ const result = esbuild.buildSync({
27+ absWorkingDir: root,
28+ entryPoints: ["client/abso.ts"],
29+ bundle: true,
30+ platform: "node",
31+ format: "esm",
32+ target: "node20",
33+ write: false,
34+ outfile: OUT,
35+ logLevel: "warning",
36+ // A bundled CommonJS package (yaml) calls require("process") lazily, which an ES module bundle
37+ // can't do without a real require.
38+ banner: {
39+ js: [
40+ "// Built from client/abso.ts by scripts/build-client.mjs (npm run build:client). Don't edit it by hand.",
41+ 'import { createRequire as __absoCreateRequire } from "node:module";',
42+ "const require = __absoCreateRequire(import.meta.url);",
43+ ].join("\n"),
44+ },
45+ });
46+ return result.outputFiles[0].text;
47+}
49+if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
50+ const path = join(root, OUT);
51+ const text = buildClient();
52+ if (process.argv.includes("--check")) {
53+ let have = "";
54+ try {
55+ have = readFileSync(path, "utf8").replace(/\r\n/g, "\n");
56+ } catch {}
57+ if (have !== text) {
58+ process.stderr.write(
59+ `${OUT} is not a build of this folder's client: run npm run build:client and push the file it writes.\n`,
60+ );
61+ process.exit(1);
62+ }
63+ } else writeFileSync(path, text);
64+}
MCP
compare on this site's /mcp
CLI
abso diff 168 169 scripts/build-client.mjs --json
JSON
/christopher/abso-core/compare/168..169?file=scripts%2Fbuild-client.mjs&format=json