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 28 to 29

Compare

+38 −1 in 3 places
Lines 3–9 at 29 (were 3–9 at 28)
33// here is a stand-in that keeps what it was sent.
44
55import assert from "node:assert/strict";
6−import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
6+import { mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
77import { createServer, type Server } from "node:http";
88import type { AddressInfo } from "node:net";
99import { tmpdir } from "node:os";
Lines 43–62 at 29 (were 43–48 at 28)
4343 });
4444 if (req.url!.endsWith("/issue")) return json({ id: 7 });
4545 if (/\/issue\/\d+\/comment$/.test(req.url!)) return json({ id: 3 });
46+ // Issue 8 carries an svg-drawn image on itself and again on a comment, plus one more on the comment.
47+ const logo = { id: "a00000000000b", name: "../shot one.png", type: "image/png", size: 13 };
48+ if (req.method === "GET" && /\/issue\/8$/.test(req.url!))
49+ return json({
50+ issue: { id: 8, attachments: [{ ...logo, source: { name: "logo.svg", size: 20 } }] },
51+ comments: [{ attachments: [logo, { id: "a00000000000c", name: "after.png", type: "image/png", size: 13 }] }],
52+ edits: [],
53+ asks: [],
54+ claims: [],
55+ children: [],
56+ });
57+ const served = /\/attachments\/(a[0-9a-f]{12})(\/source)?$/.exec(req.url!);
58+ if (req.method === "GET" && served)
59+ return res.writeHead(200, { "content-type": "image/png" }).end(`${served[1]}${served[2] ?? ""}`);
4660 res.writeHead(404).end("{}");
4761 });
4862 });
Lines 156–184 at 29 (were 142–147 at 28)
142156 assert.equal(seen.length, from);
143157 });
144158
159+ it("--save-attachments saves each attachment once, an svg's own file too, outside the folder", async () => {
160+ const dir = await folder();
161+ const out = mkdtempSync(join(tmpdir(), "abso-saved-"));
162+ dirs.push(out);
163+ const r = await avcs(dir, ["issue", "8", "--save-attachments", join(out, "images")]);
164+ assert.equal(r.exit, 0, r.out);
165+ const names = readdirSync(join(out, "images")).sort();
166+ assert.deepEqual(names, ["a00000000000b-logo.svg", "a00000000000b-shot_one.png", "a00000000000c-after.png"]);
167+ assert.equal(readFileSync(join(out, "images", "a00000000000b-logo.svg"), "utf8"), "a00000000000b/source");
168+ assert.equal(readFileSync(join(out, "images", "a00000000000c-after.png"), "utf8"), "a00000000000c");
169+ assert.equal((r.json as { files: unknown[] }).files.length, 3);
170+ // Into the folder only where abso leaves files out, or they'd be recorded as edits.
171+ const inside = await avcs(dir, ["issue", "8", "--save-attachments", "images"]);
172+ assert.equal(inside.exit, 1);
173+ assert.match(inside.out, /inside this abso folder/);
174+ assert.equal((await avcs(dir, ["issue", "8", "--save-attachments", "."])).exit, 1);
175+ writeFileSync(join(dir, ".absoignore"), "saved/\n");
176+ assert.equal((await avcs(dir, ["issue", "8", "--save-attachments", "saved"])).exit, 0);
177+ const mixed = await avcs(dir, ["issue", "8", "--save-attachments", out, "--comment", "x"]);
178+ assert.equal(mixed.exit, 1);
179+ assert.match(mixed.out, /--save-attachments goes alone/);
180+ });
145182 it("an issue's page lists its attachments and each comment's, with links", () => {
146183 const page = {
147184 issue: {
MCP
compare on this site's /mcp
CLI
abso diff 28 29 client/test/attach.test.ts --json
JSON
/christopher/abso-core/compare/28..29?file=client%2Ftest%2Fattach.test.ts&format=json