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
MCP
show on this site's /mcp
CLI
abso show 52 --json
JSON
/christopher/abso-core/versions/52?format=json

abso diff --agent <name>: review another agent's unpublished changes

of shared·pinch··Not checked

Reviewing a teammate's work before it's published had no command: abso diff showed only your own draft, and abso status names files but not lines. Reviewers read the other agent's folder on disk, which only works on a shared machine and shows their disk, not what they recorded.

abso diff --agent alice now prints alice's recorded, unpublished changes line by line, the way abso diff prints yours: "alice's recorded, unpublished changes in shared (on version 12): 2 files, 5 lines added, 1 removed." Paths narrow it as usual. It reads what the server holds, the same route the website's drafts use, so it records nothing and changes nothing. An agent with no changes says so; a name the project doesn't know is refused by the server. --agent doesn't go with two versions or --draft.

The test server answers GET /p/:project/diff?agent= as the Worker does. Tested in client.test.ts.

Version 51 · Files at version 52

5 files, 62 lines added, 4 removed.

--- a/client/src/api.ts
+++ b/client/src/api.ts
@@ -846,6 +846,11 @@
846846 return this.json("POST", this.agentPath("diff"), {});
847847 }
848848
849+ /** Another agent's recorded, unpublished changes, file by file: read only, as the website's drafts show them. */
850+ diffOf(agent: string): Promise<DiffAnswer> {
851+ return this.json("GET", `/diff?${query({ agent })}`);
852+ }
849854 /** Discard this agent's unpublished changes to `files` (null: all of them). */
850855 restore(files: readonly string[] | null): Promise<RestoreAnswer> {
851856 return this.json("POST", this.agentPath("restore"), files === null ? { all: true } : { files });
--- a/client/src/changes.ts
+++ b/client/src/changes.ts
@@ -141,6 +141,25 @@
141141 .filter((p) => only.length > 1 || !existsHere(root, p))
142142 .map((p) => nothingAt(root, p));
143143
144+ // --agent: someone else's draft, to review it. What they've recorded, not their folder; nothing here is recorded.
145+ const other = str(args, "agent");
146+ if (other !== undefined) {
147+ if (between || str(args, "draft") !== undefined)
148+ throw new UsageError("--agent shows that agent's unpublished changes: abso diff [file...] --agent <name>");
149+ const answer = await api.diffOf(other);
150+ const files = pick(answer.files);
151+ const d = diffs(files);
152+ const where = `${spaceName(answer.draft)}${answer.base === null ? "" : ` (on version ${answer.base})`}`;
153+ const head =
154+ files.length === 0
155+ ? `${other} has no recorded, unpublished changes${inPaths(only, "to")} in ${where}.`
156+ : `${other}'s recorded, unpublished changes${inPaths(only, "to")} in ${where}: ${totals(files)}.`;
157+ return {
158+ text: [head, ...d.text].join("\n"),
159+ json: { agent: other, draft: answer.draft, base: answer.base, files: d.json, unmatched: unmatched(files) },
160+ };
161+ }
144163 if (between) {
145164 const from = version(words[0]!);
146165 const to = version(words[1]!);
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -577,10 +577,10 @@
577577 run: runDraftSync,
578578 },
579579 diff: {
580− flags: { draft: "string" },
581− usage: "abso diff [file...] | abso diff <from> <to> [file...] [--draft <name>]",
580+ flags: { draft: "string", agent: "string" },
581+ usage: "abso diff [file...] [--agent <name>] | abso diff <from> <to> [file...] [--draft <name>]",
582582 about:
583− "Your unpublished changes, line by line, as git prints them (records first). With two versions: what changed between them in this space.",
583+ "Your unpublished changes, line by line, as git prints them (records first). --agent <name>: that agent's recorded, unpublished changes instead, to review them; it changes nothing. With two versions: what changed between them in this space.",
584584 run: runDiff,
585585 },
586586 restore: {
--- a/client/test/client.test.ts
+++ b/client/test/client.test.ts
@@ -4248,6 +4248,29 @@
42484248 /^Your unpublished changes to a\.txt in shared \(on version 0\): 1 file, 1 line added, 1 removed\.\n--- a\/a\.txt/,
42494249 );
42504250
4251+ // bob reviews alice's draft: what she recorded, read only.
4252+ const theirs = await main(["diff", "a.txt", "--agent", "alice"], { cwd: folders.bob!, env: ENV, write: () => {} });
4253+ assert.equal(theirs.exit, 0, theirs.stderr);
4254+ assert.match(
4255+ theirs.stdout,
4256+ /^alice's recorded, unpublished changes to a\.txt in shared \(on version 0\): 1 file, 1 line added, 1 removed\.\n--- a\/a\.txt\n\+\+\+ b\/a\.txt\n@@ -1,3 \+1,3 @@\n one\n-two\n\+TWO\n three/,
4257+ );
4258+ assert.deepEqual((await avcs(folders.bob!, "diff", "--agent", "alice")).json.files.map((f: any) => f.path).sort(), [
4259+ "a.txt",
4260+ "c.txt",
4261+ ]);
4262+ assert.match(
4263+ (await main(["diff", "--agent", "bob"], { cwd: folders.bob!, env: ENV, write: () => {} })).stdout,
4264+ /^bob has no recorded, unpublished changes in shared/,
4265+ );
4266+ const nobody = await main(["diff", "--agent", "carol"], { cwd: folders.bob!, env: ENV, write: () => {} });
4267+ assert.notEqual(nobody.exit, 0);
4268+ assert.match(nobody.stderr, /there is no agent "carol"/);
4269+ assert.equal(
4270+ (await main(["diff", "0", "1", "--agent", "alice"], { cwd: folders.bob!, env: ENV, write: () => {} })).exit,
4271+ 1,
4272+ );
42514274 assert.equal((await avcs(alice, "publish", "-m", "alice: shout two, add c")).exit, 0);
42524275 await edit(folders.bob!, "b.txt", "b\n", "b from bob\n");
42534276 assert.equal((await avcs(folders.bob!, "publish", "-m", "bob: change b")).exit, 0);
--- a/client/test/fake-server.ts
+++ b/client/test/fake-server.ts
@@ -271,7 +271,7 @@
271271 return;
272272 }
273273 const m =
274− /^\/p\/([^/]+)\/(init|status|queue|change\/\d+|changes|notes|ci\/revoke|ci|blame|why|where|labels|files|log|show|file|compare|a\/([^/]+)\/(edit|record|publish|sync|run|draft|land|draft-sync|diff|restore|announce|news|starting|reader|drop|pluck|amend|label|files|unqueue|note|note-close|move))$/.exec(
274+ /^\/p\/([^/]+)\/(init|status|queue|change\/\d+|changes|notes|ci\/revoke|ci|blame|why|where|labels|files|diff|log|show|file|compare|a\/([^/]+)\/(edit|record|publish|sync|run|draft|land|draft-sync|diff|restore|announce|news|starting|reader|drop|pluck|amend|label|files|unqueue|note|note-close|move))$/.exec(
275275 url.pathname,
276276 );
277277 if (!m) return send(res, 404, { error: "no such route; see docs/v2-slice1.md" });
@@ -405,6 +405,17 @@
405405 }
406406 if (op === "where") return send(res, 200, where(hosted.project));
407407 if (op === "labels") return send(res, 200, hosted.project.labels());
408+ if (op === "diff" && agent === undefined) {
409+ // Another agent's draft, read only (abso diff --agent), as the Worker answers GET /p/:project/diff?agent=.
410+ const of = url.searchParams.get("agent");
411+ if (!of) return send(res, 400, { error: "diff needs ?agent=<name>" });
412+ try {
413+ return send(res, 200, hosted.project.diffOf(of));
414+ } catch (e) {
415+ const code = (e as { code?: string }).code;
416+ return send(res, code === "not-found" ? 404 : 500, { error: e instanceof Error ? e.message : String(e) });
417+ }
418+ }
408419 if (op === "files" && agent === undefined) {
409420 const q = Object.fromEntries(url.searchParams) as Record<string, string | undefined>;
410421 try {