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 63 to 64

Compare

+46 −20 in 5 places
Lines 23–29 at 64 (were 23–29 at 63)
2323import { createServer as createHttpServer } from "node:http";
2424import { type AddressInfo, createServer as createTcpServer } from "node:net";
2525import { tmpdir } from "node:os";
26−import { dirname, join, relative, sep } from "node:path";
26+import { dirname, join, relative, resolve, sep } from "node:path";
2727import { after, before, describe, it } from "node:test";
2828import { fileURLToPath } from "node:url";
2929import { Api, LOG_PAGE, PUBLISH_TIMEOUT_MS, timeoutFor } from "../src/api.ts";
Lines 33–39 at 64 (were 33–38 at 63)
3333import { restoreLines, sinceTest } from "../src/changes.ts";
3434import { ciText } from "../src/ci.ts";
3535import { collisionText, parallelScript, runCommand, sameVersionHint, undoGitBashPaths } from "../src/commands.ts";
36+import { installKey } from "../src/config.ts";
3637import {
3738 isLocalOnly,
3839 isSkippedPart,
Lines 49–55 at 64 (were 48–53 at 63)
4849import { unifiedDiff } from "../src/diff.ts";
4950import { absolute, knownPath, unrecorded, writeFileAtomic } from "../src/folder.ts";
5051import { runHook } from "../src/hook.ts";
52+import { joinFolder } from "../src/join-commands.ts";
5153import { tryFolderLock } from "../src/lock.ts";
5254import { boxServer, commandTable, main } from "../src/main.ts";
5355import { argvFor, confineCall, mcpTools } from "../src/mcp.ts";
Lines 527–533 at 64 (were 525–531 at 63)
525527 git("init", "-q");
526528 git("config", "core.autocrlf", "false");
527529 write(bob, { ".gitattributes": "*.txt eol=crlf\n*.bin -text\n" });
528− assert.equal((await avcs(bob, "join", name, "--agent", "bob", "--server", fake.url, "--dir", ".")).exit, 0);
530+ assert.equal((await avcs(bob, "join", name, "--agent", "bob", "--server", fake.url)).exit, 0);
529531 write(folders.alice!, { "a.txt": "one\ntwo\n", "b.md": "one\ntwo\n", "c.bin": "x\ny\n" });
530532 assert.equal((await avcs(folders.alice!, "publish", "-m", "three files")).exit, 0);
531533 assert.equal((await avcs(bob, "sync")).exit, 0);
Lines 2544–2596 at 64 (were 2542–2570 at 63)
25422544 assert.doesNotMatch(without.stdout, /Nothing is installed/);
25432545 });
25442546
2545− it("join writes here when this folder is empty, else into ./<project>, never over someone's files (abso issue 351)", async () => {
2546− const { name } = await project({ "a.ts": "one\n" }, "alice");
2547− const run = (cwd: string, agent: string) =>
2548− main(["join", name, "--agent", agent, "--server", fake.url], { cwd, env: ENV, write: () => {} });
2547+ it("join with no --agent writes here when this folder is empty, else into ./<project>, never over someone's files", () => {
2548+ const args = (...words: string[]) => parseArgs("join", ["p", ...words], { agent: "string", dir: "string" });
25492549 const empty = temp();
2550− const here = await run(empty, "bob");
2551− assert.equal(here.exit, 0, here.stderr);
2552− assert.equal(read(empty, "a.ts"), "one\n", "an empty folder: here");
2553− assert.doesNotMatch(here.stdout, /^cd /m);
2550+ assert.equal(joinFolder(args(), { cwd: empty }, "p"), resolve(empty));
2551+ const prepared = temp();
2552+ mkdirSync(join(prepared, ".abso"));
2553+ assert.equal(joinFolder(args(), { cwd: prepared }, "p"), resolve(prepared), "only abso's own folder: still empty");
25542554 const busy = temp();
25552555 write(busy, { "notes.md": "mine\n" });
2556− const sub = await run(busy, "carol");
2557− assert.equal(sub.exit, 0, sub.stderr);
2558− assert.equal(read(join(busy, name), "a.ts"), "one\n", "a folder with files in it: ./<project>");
2559− assert.equal(read(busy, "notes.md"), "mine\n");
2560− assert.match(sub.stdout, new RegExp(`^cd ${name}$`, "m"));
2561− const taken = temp();
2562− write(taken, { "notes.md": "mine\n", [`${name}/other.md`]: "theirs\n" });
2563− const refused = await run(taken, "dave");
2564− assert.notEqual(refused.exit, 0);
2565− assert.match(refused.stderr, /already has files in it: say where to join with --dir <folder>/);
2556+ assert.equal(joinFolder(args(), { cwd: busy }, "p"), resolve(busy, "p"), "files here: ./<project>");
2557+ assert.equal(joinFolder(args("--agent", "bob"), { cwd: busy }, "p"), resolve(busy), "--agent: here, as before");
2558+ assert.equal(joinFolder(args("--dir", "x"), { cwd: busy }, "p"), resolve(busy, "x"));
2559+ write(busy, { "p/other.md": "theirs\n" });
2560+ assert.throws(
2561+ () => joinFolder(args(), { cwd: busy }, "p"),
2562+ /already has files in it: say where to join with --dir <folder>/,
2563+ );
25662564 });
25672565
2566+ it("join --agent joins a folder prepared with abso key install --server where it is, and sends that key", async () => {
2567+ const KEY = "abso_sk_prepared-before-join-0123456789";
2568+ const keyed = await startFake(0, KEY);
2569+ try {
2570+ const seed = temp();
2571+ write(seed, { "a.ts": "one\n" });
2572+ const env = { ...ENV, AVCS_TOKEN: KEY };
2573+ const init = await main(["init", "--server", keyed.url, "--project", "prep", "--agent", "alice"], {
2574+ cwd: seed,
2575+ env,
2576+ write: () => {},
2577+ });
2578+ assert.equal(init.exit, 0, init.stderr);
2579+ const dir = temp();
2580+ installKey(dir, JSON.stringify({ key: KEY, id: "k_0123abcd" }), keyed.url);
2581+ const joined = await main(["join", "prep", "--agent", "bob", "--server", keyed.url], {
2582+ cwd: dir,
2583+ env: { ...ENV, AVCS_TOKEN: "not-the-key" },
2584+ write: () => {},
2585+ });
2586+ assert.equal(joined.exit, 0, joined.stderr);
2587+ assert.equal(read(dir, "a.ts"), "one\n", "joined here, not in ./prep");
2588+ assert.doesNotMatch(joined.stdout, /^cd /m);
2589+ } finally {
2590+ await keyed.close();
2591+ }
2592+ });
25682594 it("gives a call more time by what it sends: 1 s per 100 KB over the base (abso issue 34)", () => {
25692595 assert.equal(timeoutFor(30_000, undefined), 30_000);
25702596 assert.equal(timeoutFor(30_000, "{}"), 30_000);
MCP
compare on this site's /mcp
CLI
abso diff 63 64 client/test/client.test.ts --json
JSON
/christopher/abso-core/compare/63..64?file=client%2Ftest%2Fclient.test.ts&format=json