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 169 to 318

Compare

+21 −24 in 3 places
Lines 2–16 at 318 (were 2–18 at 169)
22// as one plain-JS file for Node 20 or later. Node 20 can't run the .ts files themselves (it has no type
33// stripping), so this file is how a checkout runs on it:
44//
5+// npm ci && npm run build
56// node client/bin/abso.mjs help
67//
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).
8+// The file isn't committed (.gitignore leaves client/bin/ out); build it again after pulling. It sits one
9+// folder under client/, so the client's own folder (client-version.ts) is still client/. scripts/pack-npm.mjs
10+// puts the same build in the npm package.
911//
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−//
1412// Plain JS on purpose: it runs before anything is built.
15−import { readFileSync, writeFileSync } from "node:fs";
13+import { mkdirSync, writeFileSync } from "node:fs";
1614import { createRequire } from "node:module";
1715import { dirname, join, resolve } from "node:path";
1816import { fileURLToPath } from "node:url";
Lines 18–25 at 318 (were 20–27 at 169)
2018const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
2119const OUT = "client/bin/abso.mjs";
2220
23−/** The bundle's text, built in memory. */
24−export function buildClient() {
21+/** The bundle's text, built in memory. `banner` adds lines at its top (the npm package stamps its version). */
22+export function buildClient(banner = []) {
2523 const esbuild = createRequire(import.meta.url)("esbuild");
2624 const result = esbuild.buildSync({
2725 absWorkingDir: root,
Lines 31–61 at 318 (were 33–64 at 169)
3331 write: false,
3432 outfile: OUT,
3533 logLevel: "warning",
34+ // Local projects run the open server's code in the client (client/src/local-store.ts); its Durable Object
35+ // base class comes from the Workers runtime, so the bundle gets the client's stand-in.
36+ alias: { "cloudflare:workers": "./client/src/durable-object-stand-in.ts" },
3637 // A bundled CommonJS package (yaml) calls require("process") lazily, which an ES module bundle
3738 // can't do without a real require.
3839 banner: {
3940 js: [
40− "// Built from client/abso.ts by scripts/build-client.mjs (npm run build:client). Don't edit it by hand.",
41+ "// Built from client/abso.ts by scripts/build-client.mjs (npm run build). Don't edit it by hand.",
4142 'import { createRequire as __absoCreateRequire } from "node:module";',
4243 "const require = __absoCreateRequire(import.meta.url);",
44+ ...banner,
4345 ].join("\n"),
4446 },
4547 });
46− return result.outputFiles[0].text;
48+ // esbuild leaves control characters in string literals as they are (yaml's lexer has \x02, \x18 and \x1f).
49+ // Escaped, the file is plain text that every tool shows and stores as it is.
50+ return result.outputFiles[0].text.replace(
51+ /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,
52+ (c) => `\\x${c.charCodeAt(0).toString(16).padStart(2, "0")}`,
53+ );
4754}
4855
4956if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
5057 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);
58+ mkdirSync(dirname(path), { recursive: true });
59+ writeFileSync(path, buildClient());
60+ process.stdout.write(`Built ${OUT}: node ${OUT} help\n`);
6461}
MCP
compare on this site's /mcp
CLI
abso diff 169 318 scripts/build-client.mjs --json
JSON
/christopher/abso-core/compare/169..318?file=scripts%2Fbuild-client.mjs&format=json