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

Compare

+9 −8 in 2 places
Lines 25–51 at 318 (were 25–50 at 86)
2525 readonly modes: Map<string, FullMode>;
2626}
2727
28−/** Each file as it is on one side of a change (`before`), applied to the snapshot. */
29−function applyBefore(s: Snapshot, changes: readonly FileChange[]): void {
28+/** Each file as it is on one side of a change (`before` unless said), applied to the snapshot. */
29+export function applySide(s: Snapshot, changes: readonly FileChange[], side: "before" | "after" = "before"): void {
3030 for (const f of changes) {
3131 if (isLocalOnly(f.path)) continue;
32− const blob = f.blob?.before ?? null;
32+ const blob = f.blob?.[side] ?? null;
33+ const text = f[side];
3334 if (blob !== null) s.files.set(f.path, { blob });
34− else if (f.before !== null) s.files.set(f.path, { text: f.before });
35+ else if (text !== null) s.files.set(f.path, { text });
3536 else {
3637 s.files.delete(f.path);
3738 s.modes.delete(f.path);
3839 continue;
3940 }
40− if (f.mode) s.modes.set(f.path, { exec: f.mode.before.exec === true, link: f.mode.before.link ?? null });
41+ if (f.mode) s.modes.set(f.path, { exec: f.mode[side].exec === true, link: f.mode[side].link ?? null });
4142 }
4243}
4344
4445/** The folder's space as it was at `version`: every file, and its mode. */
4546export async function snapshotAt(root: string, api: Api, version: number): Promise<Snapshot> {
4647 const diff = await api.diff();
47− if (diff.base === null) throw new UsageError("this folder has no version yet: run abso sync first");
48+ if (diff.base === null) throw new UsageError("this folder has no version yet: run abso pull first");
4849 const where: Where = { draft: diff.draft };
4950 // This agent's view, from its known copies.
5051 const s: Snapshot = { version, files: new Map(), modes: new Map() };
Lines 57–65 at 318 (were 56–64 at 86)
5657 for (const [rel, sha] of readKnownBlobs(root)) s.files.set(rel, { blob: sha });
5758 for (const [rel, mode] of readKnownModes(root)) if (s.files.has(rel)) s.modes.set(rel, mode);
5859 // Its base: the draft's changes taken back out.
59− applyBefore(s, diff.files);
60+ applySide(s, diff.files);
6061 // Version N: what differs from the base, as it was at N.
61− if (version !== diff.base) applyBefore(s, (await api.compare(version, diff.base, where)).files);
62+ if (version !== diff.base) applySide(s, (await api.compare(version, diff.base, where)).files);
6263 return s;
6364}
6465
MCP
compare on this site's /mcp
CLI
abso diff 86 318 client/src/at.ts --json
JSON
/christopher/abso-core/compare/86..318?file=client%2Fsrc%2Fat.ts&format=json