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

Compare

+39 −10 in 10 places
Lines 2–16 at 318 (were 2–8 at 30)
22// first used for #56, abso hosts abso). Each commit on the first-parent line
33// of --ref becomes a version of shared, oldest first: the first by `avcs
44// init`, each later one by a publish of that commit's tree, with the commit's
5−// message and a last line naming the commit, its author and its time.
5+// message and a last line naming the commit, its author and its time. When
6+// the repository's issues are on the web (origin on GitHub or GitLab, or
7+// --issues <url>), a line after it says where, so "#39" in the message, or
8+// in the lines it wrote, names that tracker's issue, not the project's:
9+//
10+// git 4e1a7c2b9f03, Ada Lovelace, 2026-10-06T20:36:43-05:00
11+// Issues: https://github.com/owner/repo/issues
12+//
13+// abso why and abso blame read these lines (client/src/git-origin.ts).
614// --last-only imports the last commit alone.
715//
816// Before anything is created, the last commit is checked: abso stores text
Lines 22–30 at 318 (were 14–20 at 30)
1422// What a first cut leaves for later (#58): every version's agent is the
1523// importing agent and its time is the import's (the commit's author and time
1624// are in the message); merges come in as their first parent's line; a run
17−// that stops partway goes on with --after <sha> in the same --dir.
25+// that stops partway goes on with --after <sha> in the same --dir. Version 0
26+// is made by init, which says "Start the project", so the first commit's own
27+// message and hash aren't on it: they're printed when the import starts.
1828//
1929// CI counts each imported version as seen as soon as it lands, so it never
2030// checks or bisects the history; it checks what is published after the
Lines 32–38 at 318 (were 22–28 at 30)
2232//
2333// node client/scripts/import-git.ts --project <name> [--ref origin/main]
2434// [--server <url>] [--agent import] [--dir <empty folder>]
25−// [--last-only] [--check-only] [--after <sha>]
35+// [--last-only] [--check-only] [--after <sha>] [--issues <url>]
2636
2737import { spawnSync } from "node:child_process";
2838import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync } from "node:fs";
Lines 41–47 at 318 (were 31–36 at 30)
3141import { parseArgs } from "node:util";
3242import { open } from "../src/commands.ts";
3343import { loadIgnore } from "../src/folder.ts";
44+import { issuesOf } from "../src/git-origin.ts";
3445import { main } from "../src/main.ts";
3546
3647const { values } = parseArgs({
Lines 54–60 at 318 (were 43–48 at 30)
4354 "last-only": { type: "boolean", default: false },
4455 "check-only": { type: "boolean", default: false },
4556 after: { type: "string" },
57+ issues: { type: "string" },
4658 },
4759});
4860const checkOnly = values["check-only"] === true;
Lines 72–82 at 318 (were 60–66 at 30)
6072const dir = values.dir ? resolve(values.dir) : mkdtempSync(join(tmpdir(), "avcs-import-"));
6173mkdirSync(dir, { recursive: true });
6274if (after === undefined && readdirSync(dir).length > 0) fail(`${dir} isn't empty`);
63−if (after !== undefined && !existsSync(join(dir, ".avcs", "config.json")))
75+if (
76+ after !== undefined &&
77+ !existsSync(join(dir, ".abso", "config.json")) &&
78+ !existsSync(join(dir, ".avcs", "config.json"))
79+)
6480 fail(`${dir} isn't an abso folder; --after goes on in an earlier run's folder`);
6581
6682// The last commit first: nothing is created unless it passes.
Lines 106–129 at 318 (were 90–107 at 30)
90106 process.exit(0);
91107}
92108
109+// Where "#N" in the history points: --issues, else origin's issues on GitHub or GitLab.
110+if (values.issues !== undefined && !/^https?:\/\/\S+$/.test(values.issues))
111+ fail(`--issues is a web address, like https://github.com/owner/repo/issues (got ${JSON.stringify(values.issues)})`);
112+const tracker = values.issues ?? issuesOf(origin());
93114const env = { cwd: dir, env: process.env, write: () => {} };
94115let skipped = 0;
95116for (let i = start; i < line.length; i++) {
96117 const sha = line[i]!;
97118 extract(sha, dir);
98− const message = `${git(["log", "-1", "--format=%B", sha]).trim()}\n\ngit ${sha.slice(0, 12)}, ${git(["log", "-1", "--format=%an, %aI", sha]).trim()}`;
119+ const message = `${git(["log", "-1", "--format=%B", sha]).trim()}\n\ngit ${sha.slice(0, 12)}, ${git(["log", "-1", "--format=%an, %aI", sha]).trim()}${tracker ? `\nIssues: ${tracker}` : ""}`;
120+ if (i === 0) console.log(`Version 0 is commit ${sha.slice(0, 12)}: ${message.split("\n")[0]}`);
99121 const subject = message.split("\n")[0]!.slice(0, 72);
100122 // The first commit makes the project; --as-is adds no starting .absoignore or avcs.json git never had.
101123 const argv =
102124 i === 0
103125 ? ["init", dir, "--server", values.server!, "--project", values.project!, "--agent", values.agent!, "--as-is"]
104− : ["publish", "-m", message];
126+ : ["push", "-m", message];
105127 let r = await main(argv, env);
106128 // A lost connection: try again. If the lost publish did land, the next try finds nothing to publish.
107129 for (
Lines 138–144 at 318 (were 116–122 at 30)
116138 fail(
117139 `[${i + 1}/${line.length}] ${sha.slice(0, 12)} ${subject}: ${argv[0]} failed (exit ${r.exit}).\n${r.stdout}${r.stderr}\nGo on from the commit before it with --after ${i === 0 ? "(none: start again in an empty folder)" : line[i - 1]!.slice(0, 12)} --dir ${dir}`,
118140 );
119− const empty = /^Nothing (to publish|published)/m.test(r.stdout);
141+ const empty = /^Nothing (to push|pushed)/m.test(r.stdout);
120142 if (empty) skipped++;
121143 const version = /(?:version|at version) (\d+)/.exec(r.stdout)?.[1];
122144 if (version !== undefined) await skipCi(Number(version));
Lines 162–177 at 318 (were 140–154 at 30)
140162 }
141163}
142164
143−/** The commit's tree in `dir`, replacing everything but .avcs; its files, folder-relative. */
165+/** The commit's tree in `dir`, replacing everything but .avcs and .abso; its files, folder-relative. */
144166function extract(sha: string, into: string): string[] {
145− for (const e of readdirSync(into)) if (e !== ".avcs") rmSync(join(into, e), { recursive: true, force: true });
167+ for (const e of readdirSync(into))
168+ if (e !== ".avcs" && e !== ".abso") rmSync(join(into, e), { recursive: true, force: true });
146169 // Piped, with tar in the folder: no path for tar to misread (GNU tar takes "C:" for a remote host).
147170 const archive = spawnSync("git", ["archive", "--format=tar", sha], { maxBuffer: 1 << 30 });
148171 if (archive.status !== 0) fail(`git archive: ${archive.stderr.toString().trim()}`);
149172 const untar = spawnSync("tar", ["-xf", "-"], { cwd: into, input: archive.stdout, encoding: "utf8" });
150173 if (untar.status !== 0) fail(`tar couldn't unpack ${sha}: ${untar.stderr}`);
151− return walk(into).filter((rel) => !rel.startsWith(".avcs/"));
174+ return walk(into).filter((rel) => !rel.startsWith(".avcs/") && !rel.startsWith(".abso/"));
152175}
153176
154177/** Why abso would store these bytes differently from git, or undefined. Binary files (NUL, or not UTF-8) go up byte for byte. */
Lines 197–208 at 318 (were 174–179 at 30)
174197 return r.stdout;
175198}
176199
200+/** origin's address, or "" when there's no origin. */
201+function origin(): string {
202+ const r = spawnSync("git", ["remote", "get-url", "origin"], { encoding: "utf8" });
203+ return r.status === 0 ? r.stdout.trim() : "";
204+}
177206function fail(message: string): never {
178207 console.error(message);
179208 process.exit(1);
MCP
compare on this site's /mcp
CLI
abso diff 30 318 client/scripts/import-git.ts --json
JSON
/christopher/abso-core/compare/30..318?file=client%2Fscripts%2Fimport-git.ts&format=json