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

Compare

+662 −388 in 149 places
Lines 23–29 at 318 (were 23–29 at 32)
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 318 (were 33–38 at 32)
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 47–55 at 318 (were 46–53 at 32)
4647 uncomposedText,
4748} from "../src/core.ts";
4849import { unifiedDiff } from "../src/diff.ts";
49−import { absolute, writeFileAtomic } from "../src/folder.ts";
50+import { 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 256–285 at 318 (were 254–283 at 32)
254256 writeFileSync(join(dir, "b.txt"), new Uint8Array([0, 1]));
255257 const diff = await main(["diff", "pic.bin"], { cwd: dir, env: ENV, write: () => {} });
256258 assert.match(diff.stdout, /Binary file pic\.bin changed: [0-9a-f]{12} -> [0-9a-f]{12}/);
257− const refused = await main(["publish", "-m", "new picture"], { cwd: dir, env: ENV, write: () => {} });
259+ const refused = await main(["push", "-m", "new picture"], { cwd: dir, env: ENV, write: () => {} });
258260 assert.equal(refused.exit, 2);
259261 assert.match(
260262 refused.stdout,
261− /NOT SENT: b\.txt was text and now has a NUL byte at line 1 \(byte 0\)\..*pass --binary b\.txt\.\nNot published\./,
263+ /NOT SENT: b\.txt was text and now has a NUL byte at line 1 \(byte 0\)\..*pass --binary b\.txt\.\nNot pushed\./,
262264 );
263265 // The publish goes through, and still says the huge file was left out, with a non-zero exit.
264− const published = await avcs(dir, "publish", "-m", "new picture, b is binary now", "--binary", "b.txt");
266+ const published = await avcs(dir, "push", "-m", "new picture, b is binary now", "--binary", "b.txt");
265267 assert.equal(published.exit, 1, published.out);
266− assert.ok(published.json.version !== undefined, "the rest was published");
268+ assert.ok(published.json.version !== undefined, "the rest was pushed");
267269 assert.deepEqual(published.json.leftOut, [{ path: "huge.bin", reason: "too big" }]);
268270 rmSync(join(dir, "huge.bin")); // the rest of the test is about the files that do go
269271 assert.equal("b.txt" in shared("blobs"), false);
270272 assert.ok("b.txt" in hosted.project.blobs());
271− assert.equal((await avcs(bob, "sync")).exit, 0);
273+ assert.equal((await avcs(bob, "pull")).exit, 0);
272274 assert.deepEqual(new Uint8Array(readFileSync(join(bob, "pic.bin"))), new Uint8Array([9, 0, 9]));
273275 assert.deepEqual(new Uint8Array(readFileSync(join(bob, "b.txt"))), new Uint8Array([0, 1]));
274276
275277 // Unrecorded binary work is never overwritten by a sync.
276278 writeFileSync(join(bob, "pic.bin"), new Uint8Array([7, 0, 7]));
277279 writeFileSync(join(dir, "pic.bin"), new Uint8Array([8, 0, 8]));
278− assert.equal((await avcs(dir, "publish", "-m", "another picture")).exit, 0);
280+ assert.equal((await avcs(dir, "push", "-m", "another picture")).exit, 0);
279281 // sync records first, so bob's picture goes into his draft and collides with alice's rather than being lost.
280− const synced = JSON.parse((await main(["sync", "--json"], { cwd: bob, env: ENV, write: () => {} })).stdout);
282+ const synced = JSON.parse((await main(["pull", "--json"], { cwd: bob, env: ENV, write: () => {} })).stdout);
281283 assert.equal(synced.ok, true);
282284 assert.deepEqual(new Uint8Array(readFileSync(join(bob, "pic.bin"))), new Uint8Array([7, 0, 7]), "bob's bytes stay");
283285
Lines 414–428 at 318 (were 412–426 at 32)
412414 assert.match(read(root, ".avcs/hook.log"), /\tEdit\ta\.txt\terror: could not reach/);
413415 writeFileSync(join(root, ".avcs", "config.json"), JSON.stringify(config));
414416 assert.equal((await avcs(root, "record")).json.sent, 1);
415− assert.equal((await avcs(root, "publish", "-m", "caps")).exit, 0);
417+ assert.equal((await avcs(root, "push", "-m", "caps")).exit, 0);
416418 assert.equal(shared(name)["a.txt"], "ONE\n");
417419 });
418420
419− it("hands news back as additionalContext when someone publishes lines in the draft", async () => {
421+ it("hands news back as additionalContext when someone pushes lines in the draft", async () => {
420422 const { folders } = await project({ "a.txt": "one\ntwo\n", "b.txt": "b\n" }, "alice", "bob");
421423 await edit(folders.bob!, "a.txt", "one\n", "uno\n");
422424 await edit(folders.alice!, "a.txt", "one\n", "ONE\n");
423− assert.equal((await avcs(folders.alice!, "publish", "-m", "shout one")).exit, 0);
425+ assert.equal((await avcs(folders.alice!, "push", "-m", "shout one")).exit, 0);
424426 const r = await edit(folders.bob!, "b.txt", "b\n", "bee\n");
425427 const out = JSON.parse(r.stdout);
426428 assert.equal(out.hookSpecificOutput.hookEventName, "PostToolUse");
Lines 449–455 at 318 (were 447–453 at 32)
447449 });
448450});
449451
450−describe("record, publish and sync", () => {
452+describe("record, push and pull", () => {
451453 it("records changes and deletions made outside the hook", async () => {
452454 const { name, folders } = await project({ "a.txt": "a\n", "gone.txt": "g\n" }, "alice");
453455 write(folders.alice!, { "a.txt": "A\n", "new.txt": "n\n" });
Lines 462–483 at 318 (were 460–481 at 32)
460462 assert.equal((await avcs(folders.alice!, "record")).json.sent, 0);
461463 });
462464
463− it("publishes, syncs into another folder, refuses a collision, and settles it", async () => {
465+ it("pushes, pulls into another folder, refuses a collision, and settles it", async () => {
464466 const { folders } = await project({ "a.txt": "one\n", "b.txt": "b\n" }, "alice", "bob");
465467 await edit(folders.alice!, "a.txt", "one\n", "alice one\n");
466− const pub = await avcs(folders.alice!, "publish", "-m", "alice was here");
468+ const pub = await avcs(folders.alice!, "push", "-m", "alice was here");
467469 assert.equal(pub.exit, 0, pub.out);
468470 assert.equal(pub.json.version, 1);
469471
470472 await edit(folders.bob!, "a.txt", "one\n", "bob one\n");
471473 write(folders.bob!, { "c.txt": "c\n" }); // not through the hook: publish records it first
472− const refused = await avcs(folders.bob!, "publish", "-m", "bob too");
474+ const refused = await avcs(folders.bob!, "push", "-m", "bob too");
473475 assert.equal(refused.exit, 2, refused.out);
474476 assert.equal(refused.json.collisions[0].file, "a.txt");
475477 assert.equal(refused.json.collisions[0].theirs.agent, "alice");
476478 assert.equal(refused.json.recorded, 1);
477479
478− const sync = await avcs(folders.bob!, "sync");
480+ const sync = await avcs(folders.bob!, "pull");
479481 assert.equal(sync.json.version, 1);
480482 assert.deepEqual(
481483 sync.json.collisions.map((c: any) => c.file),
Lines 488–498 at 318 (were 486–496 at 32)
486488 assert.match(both, /bob one/);
487489
488490 await put(folders.bob!, "a.txt", "alice one\nbob one\n");
489− const ok = await avcs(folders.bob!, "publish", "-m", "keep both");
491+ const ok = await avcs(folders.bob!, "push", "-m", "keep both");
490492 assert.equal(ok.exit, 0, ok.out);
491493 assert.equal(ok.json.version, 2);
492494
493− const back = await avcs(folders.alice!, "sync");
495+ const back = await avcs(folders.alice!, "pull");
494496 assert.deepEqual([...back.json.written].sort(), ["a.txt", "c.txt"]);
495497 assert.equal(read(folders.alice!, "a.txt"), "alice one\nbob one\n");
496498 assert.equal(read(folders.alice!, "c.txt"), "c\n");
Lines 502–520 at 318 (were 500–518 at 32)
500502 const { folders } = await project({ "a.txt": "a\n", "b.txt": "b\n" }, "alice", "bob");
501503 unlinkSync(join(folders.alice!, "b.txt"));
502504 write(folders.alice!, { "a.txt": "A\n" });
503− assert.equal((await avcs(folders.alice!, "publish", "-m", "drop b")).exit, 0);
504− const s = await avcs(folders.bob!, "sync");
505+ assert.equal((await avcs(folders.alice!, "push", "-m", "drop b")).exit, 0);
506+ const s = await avcs(folders.bob!, "pull");
505507 assert.deepEqual(s.json.deleted, ["b.txt"]);
506508 assert.ok(!existsSync(join(folders.bob!, "b.txt")));
507509 assert.equal(read(folders.bob!, "a.txt"), "A\n");
508510 });
509511
510− it("keeps CRLF line endings when sync rewrites a CRLF file", async () => {
512+ it("keeps CRLF line endings when pull rewrites a CRLF file", async () => {
511513 const { folders } = await project({ "w.txt": "one\r\ntwo\r\n" }, "alice", "bob");
512514 assert.equal(read(folders.bob!, "w.txt"), "one\ntwo\n", "a new file comes in the server form");
513515 await edit(folders.bob!, "w.txt", "two\n", "TWO\n");
514− assert.equal((await avcs(folders.bob!, "publish", "-m", "caps")).exit, 0);
515− const s = await avcs(folders.alice!, "sync");
516+ assert.equal((await avcs(folders.bob!, "push", "-m", "caps")).exit, 0);
517+ const s = await avcs(folders.alice!, "pull");
516518 assert.deepEqual(s.json.written, ["w.txt"]);
517519 assert.equal(read(folders.alice!, "w.txt"), "one\r\nTWO\r\n");
518520 });
Lines 529–536 at 318 (were 527–534 at 32)
527529 write(bob, { ".gitattributes": "*.txt eol=crlf\n*.bin -text\n" });
528530 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" });
530− assert.equal((await avcs(folders.alice!, "publish", "-m", "three files")).exit, 0);
531− assert.equal((await avcs(bob, "sync")).exit, 0);
532+ assert.equal((await avcs(folders.alice!, "push", "-m", "three files")).exit, 0);
533+ assert.equal((await avcs(bob, "pull")).exit, 0);
532534 assert.equal(readFileSync(join(bob, "a.txt"), "utf8"), "one\r\ntwo\r\n", "eol=crlf");
533535 assert.equal(
534536 readFileSync(join(bob, "b.md"), "utf8"),
Lines 540–583 at 318 (were 538–581 at 32)
538540 assert.equal(readFileSync(join(bob, "c.bin"), "utf8"), "x\ny\n", "-text: left alone");
539541 git("config", "core.autocrlf", "true");
540542 write(folders.alice!, { "d.md": "x\n" });
541− assert.equal((await avcs(folders.alice!, "publish", "-m", "d")).exit, 0);
542− assert.equal((await avcs(bob, "sync")).exit, 0);
543+ assert.equal((await avcs(folders.alice!, "push", "-m", "d")).exit, 0);
544+ assert.equal((await avcs(bob, "pull")).exit, 0);
543545 assert.equal(readFileSync(join(bob, "d.md"), "utf8"), "x\r\n", "core.autocrlf true");
544546 assert.equal((await avcs(bob, "record")).json.sent, 0, "CRLF on disk is the same text to the server");
545547 });
546548
547− it("keeps each line's own ending in a mixed-ending file when sync rewrites it (lone CR too)", async () => {
549+ it("keeps each line's own ending in a mixed-ending file when pull rewrites it (lone CR too)", async () => {
548550 const { folders } = await project({ "m.txt": "a\r\nb\nc\rd\r\ne\r\n" }, "alice", "bob");
549551 await edit(folders.bob!, "m.txt", "b\n", "B\nnew\n");
550− assert.equal((await avcs(folders.bob!, "publish", "-m", "change b, add a line")).exit, 0);
551− assert.equal((await avcs(folders.alice!, "sync")).exit, 0);
552+ assert.equal((await avcs(folders.bob!, "push", "-m", "change b, add a line")).exit, 0);
553+ assert.equal((await avcs(folders.alice!, "pull")).exit, 0);
552554 // a, c, d and e keep their endings; the changed and the new line take the most common one (CRLF).
553555 assert.equal(read(folders.alice!, "m.txt"), "a\r\nB\r\nnew\r\nc\rd\r\ne\r\n");
554556 assert.equal((await avcs(folders.alice!, "record")).json.sent, 0);
555557 });
556558
557− it("keeps a missing final newline (LF or CRLF) when sync rewrites the file, with nothing left to record", async () => {
559+ it("keeps a missing final newline (LF or CRLF) when pull rewrites the file, with nothing left to record", async () => {
558560 const { folders } = await project({ "n.txt": "one\ntwo", "c.txt": "x\r\ny" }, "alice", "bob");
559561 await edit(folders.bob!, "n.txt", "two\n", "TWO\n");
560562 await edit(folders.bob!, "c.txt", "y\n", "Y\n");
561− assert.equal((await avcs(folders.bob!, "publish", "-m", "caps")).exit, 0);
562− const s = await avcs(folders.alice!, "sync");
563+ assert.equal((await avcs(folders.bob!, "push", "-m", "caps")).exit, 0);
564+ const s = await avcs(folders.alice!, "pull");
563565 assert.deepEqual(s.json.written.sort(), ["c.txt", "n.txt"]);
564566 assert.equal(read(folders.alice!, "n.txt"), "one\nTWO");
565567 assert.equal(read(folders.alice!, "c.txt"), "x\r\nY");
566568 assert.equal((await avcs(folders.alice!, "record")).json.sent, 0);
567569 });
568570
569− it("says so when there is nothing to publish", async () => {
571+ it("says so when there is nothing to push", async () => {
570572 const { folders } = await project({ "a.txt": "a\n" }, "alice");
571− const r = await main(["publish", "-m", "nothing"], { cwd: folders.alice!, env: ENV, write: () => {} });
573+ const r = await main(["push", "-m", "nothing"], { cwd: folders.alice!, env: ENV, write: () => {} });
572574 assert.equal(r.exit, 0);
573− assert.match(r.stdout, /Nothing to publish: your draft is empty\. Shared is at version 0\./);
575+ assert.match(r.stdout, /Nothing to push: your draft is empty\. Shared is at version 0\./);
574576 });
575577
576− it("refuses publish without a message", async () => {
578+ it("refuses push without a message", async () => {
577579 const { folders } = await project({ "a.txt": "a\n" }, "alice");
578− const r = await avcs(folders.alice!, "publish");
580+ const r = await avcs(folders.alice!, "push");
579581 assert.equal(r.exit, 1);
580582 assert.equal(r.json.error.code, "usage");
581583 });
Lines 611–627 at 318 (were 609–625 at 32)
609611 assert.ok(LOCK in shared(name));
610612
611613 await edit(folders.lazy!, "a.txt", "one\n", "one lazy\n");
612− const refused = await main(["publish", "-m", "lazy work"], { cwd: folders.lazy!, env: ENV, write: () => {} });
614+ const refused = await main(["push", "-m", "lazy work"], { cwd: folders.lazy!, env: ENV, write: () => {} });
613615 assert.equal(refused.exit, 2);
614616 assert.match(refused.stdout, /\.claude\/scheduled_tasks\.lock: local files that should never have been shared/);
615− assert.match(refused.stdout, /Run abso sync, then publish again\./);
617+ assert.match(refused.stdout, /Run abso pull, then push again\./);
616618
617619 for (const agent of ["lazy", "pike", "prefix"]) {
618− const s = await avcs(folders[agent]!, "sync");
620+ const s = await avcs(folders[agent]!, "pull");
619621 assert.deepEqual(s.json.collisions, [], `${agent} sees no collision`);
620622 assert.equal(read(folders[agent]!, LOCK), `lock ${agent}\n`, `${agent}'s lock file is untouched`);
621623 if (agent === "pike") await edit(folders.pike!, "b.txt", "two\n", "two pike\n");
622− const pub = await avcs(folders[agent]!, "publish", "-m", `${agent} work`);
624+ const pub = await avcs(folders[agent]!, "push", "-m", `${agent} work`);
623625 assert.equal(pub.exit, 0, `${agent}: ${pub.out}`);
624626 }
625627 assert.ok(!(LOCK in shared(name)), "shared no longer has it");
Lines 630–651 at 318 (were 628–649 at 32)
628630 });
629631});
630632
631−describe("named drafts: switch, land and draft-sync", () => {
633+describe("named drafts: switch, land and draft-pull", () => {
632634 it("carries work into a new draft, parks and restores it, lands it, and moves it onto shared", async () => {
633635 const { name, folders } = await project({ "a.txt": "a\n", "b.txt": "b\n", "c.txt": "c\n" }, "alice", "bob");
634636 const alice = folders.alice!;
635637
636− // Unpublished work carried into a new draft stays in the folder.
638+ // Unpushed work carried into a new draft stays in the folder.
637639 await edit(alice, "a.txt", "a\n", "a in exp\n");
638640 const started = await avcs(alice, "switch", "-c", "exp");
639641 assert.equal(started.exit, 0, started.out);
640642 assert.equal(started.json.draft, "exp");
641643 assert.equal(read(alice, "a.txt"), "a in exp\n");
642− assert.equal((await avcs(alice, "publish", "-m", "exp: change a")).exit, 0);
643− assert.equal(shared(name)["a.txt"], "a\n", "publishing into the draft leaves shared alone");
644+ assert.equal((await avcs(alice, "push", "-m", "exp: change a")).exit, 0);
645+ assert.equal(shared(name)["a.txt"], "a\n", "pushing into the draft leaves shared alone");
644646
645647 // A folder-only edit (no hook) is recorded before switching, so it is parked, not lost.
646− write(alice, { "b.txt": "b unpublished in exp\n" });
648+ write(alice, { "b.txt": "b unpushed in exp\n" });
647649 const back = await avcs(alice, "switch", "shared");
648650 assert.equal(back.exit, 0, back.out);
649651 assert.equal(back.json.draft, null);
Lines 659–680 at 318 (were 657–678 at 32)
657659 const again = await avcs(alice, "switch", "exp");
658660 assert.equal(again.exit, 0, again.out);
659661 assert.equal(read(alice, "a.txt"), "a in exp\n");
660− assert.equal(read(alice, "b.txt"), "b unpublished in exp\n", "the parked work came back");
662+ assert.equal(read(alice, "b.txt"), "b unpushed in exp\n", "the parked work came back");
661663
662664 // Shared moves on; draft-sync brings it into the draft and this folder.
663665 await edit(folders.bob!, "c.txt", "c\n", "c from bob\n");
664− assert.equal((await avcs(folders.bob!, "publish", "-m", "bob: change c")).exit, 0);
665− const moved = await avcs(alice, "draft-sync");
666+ assert.equal((await avcs(folders.bob!, "push", "-m", "bob: change c")).exit, 0);
667+ const moved = await avcs(alice, "draft-pull");
666668 assert.equal(moved.exit, 0, moved.out);
667669 assert.equal(moved.json.sharedBase, 1);
668670 assert.equal(read(alice, "c.txt"), "c from bob\n");
669671
670672 // Land the draft: its published work goes into shared as one unit.
671− assert.equal((await avcs(alice, "publish", "-m", "exp: change b")).exit, 0);
673+ assert.equal((await avcs(alice, "push", "-m", "exp: change b")).exit, 0);
672674 const landed = await avcs(alice, "land", "-m", "land exp");
673675 assert.equal(landed.exit, 0, landed.out);
674676 assert.equal(shared(name)["a.txt"], "a in exp\n");
675− assert.equal(shared(name)["b.txt"], "b unpublished in exp\n");
677+ assert.equal(shared(name)["b.txt"], "b unpushed in exp\n");
676678 assert.equal(shared(name)["c.txt"], "c from bob\n");
677679
678680 // Switching back syncs: the folder shows shared as it is now, landed work included.
Lines 693–699 at 318 (were 691–697 at 32)
691693 assert.equal((await avcs(alice, "switch", "exp")).exit, 0);
692694 assert.equal(read(alice, "a.txt"), "one\ntwo\nthree\n", "the shared edit is parked");
693695 await edit(folders.bob!, "a.txt", "two\n", "two bob\n");
694− assert.equal((await avcs(folders.bob!, "publish", "-m", "bob: line two")).exit, 0);
696+ assert.equal((await avcs(folders.bob!, "push", "-m", "bob: line two")).exit, 0);
695697
696698 const back = await avcs(alice, "switch", "shared");
697699 assert.equal(back.exit, 0, back.out);
Lines 712–732 at 318 (were 710–730 at 32)
710712describe("announcements", () => {
711713 it("reach every other agent once, as news on their next edit or abso news", async () => {
712714 const { folders } = await project({ "a.txt": "a\n" }, "lead", "bob", "carol");
713− const sent = await avcs(folders.lead!, "announce", "Stop", "publishing", "until", "v12", "lands");
715+ const sent = await avcs(folders.lead!, "announce", "Stop", "pushing", "until", "v12", "lands");
714716 assert.equal(sent.exit, 0, sent.out);
715717 assert.deepEqual([...sent.json.to].sort(), ["bob", "carol"]);
716718
717719 const bob = await avcs(folders.bob!, "news");
718− assert.deepEqual(bob.json.news, ["Announcement from lead (as claimed): Stop publishing until v12 lands"]);
720+ assert.deepEqual(bob.json.news, ["Announcement from lead (as claimed): Stop pushing until v12 lands"]);
719721 assert.match(
720722 read(folders.bob!, ".avcs/news.log"),
721− /\tAnnouncement from lead \(as claimed\): Stop publishing until v12 lands\n$/,
723+ /\tAnnouncement from lead \(as claimed\): Stop pushing until v12 lands\n$/,
722724 );
723725 assert.deepEqual((await avcs(folders.bob!, "news")).json.news, [], "each item comes once");
724726
725727 // carol gets it on her next edit instead.
726728 const hooked = await edit(folders.carol!, "a.txt", "a\n", "a from carol\n");
727− assert.match(hooked.stdout, /Announcement from lead \(as claimed\): Stop publishing until v12 lands/);
729+ assert.match(hooked.stdout, /lead \(as claimed\) told you:\\n {2}Stop pushing until v12 lands/);
728730 });
729731
730732 it("go only to the agents named with --to, and refuse unknown ones", async () => {
Lines 748–754 at 318 (were 746–752 at 32)
746748 const started = await text(folders.builder6!, "start", "Storm cloud art", "storm.ts");
747749 assert.equal(started.exit, 0, started.stderr);
748750 assert.match(started.stdout, /Starting on "Storm cloud art", naming storm\.ts\./);
749− assert.match(started.stdout, /storm\.ts: builder3 \(1 unpublished change\)/);
751+ assert.match(started.stdout, /storm\.ts: builder3 \(1 unpushed change\)/);
750752 const where = await text(folders.builder3!, "where");
751753 assert.match(where.stdout, /Starting on:\n {2}builder6: "Storm cloud art" \(storm\.ts\), since /);
752754 assert.match(
Lines 768–784 at 318 (were 766–782 at 32)
766768 writeFileSync(join(alice, "fuzz.ts"), "one\ntwo\nth\u0000ree\n");
767769 const status = await main(["status"], { cwd: alice, env: ENV, write: () => {} });
768770 assert.match(status.stdout, /NOT SENT: fuzz\.ts was text and now has a NUL byte at line 3 \(byte 10\)/);
769− const refused = await avcs(alice, "publish", "-m", "oops");
771+ const refused = await avcs(alice, "push", "-m", "oops");
770772 assert.equal(refused.exit, 2);
771773 assert.deepEqual(refused.json.turnedBinary, [{ path: "fuzz.ts", why: "a NUL byte", offset: 10, line: 3 }]);
772774 assert.equal(shared(name)["fuzz.ts"], "one\ntwo\nthree\n", "the server keeps the text");
773775
774776 writeFileSync(join(alice, "fuzz.ts"), "one\ntwo\nthree, fixed\n");
775− assert.equal((await avcs(alice, "publish", "-m", "fixed")).exit, 0);
777+ assert.equal((await avcs(alice, "push", "-m", "fixed")).exit, 0);
776778 assert.equal(shared(name)["fuzz.ts"], "one\ntwo\nthree, fixed\n");
777779
778780 writeFileSync(join(alice, "fuzz.ts"), Buffer.concat([Buffer.from("ok\n"), Buffer.from([0xc3, 0x28])]));
779− assert.deepEqual((await avcs(alice, "publish", "-m", "bad utf-8")).json.turnedBinary, [
781+ assert.deepEqual((await avcs(alice, "push", "-m", "bad utf-8")).json.turnedBinary, [
780782 { path: "fuzz.ts", why: "bytes that are not UTF-8", offset: 3, line: 2 },
781783 ]);
782784 });
Lines 787–809 at 318 (were 785–807 at 32)
785787describe("drop, pluck, amend, labels and follow (#10, #27)", () => {
786788 const text = async (cwd: string, ...argv: string[]) => main(argv, { cwd, env: ENV, write: () => {} });
787789
788− it("drops a published version, refuses one others build on, and says so in the log", async () => {
790+ it("drops a pushed version, refuses one others build on, and says so in the log", async () => {
789791 const { name, folders } = await project({ "a.txt": "a\n", "b.txt": "b\n" }, "alice", "bob");
790792 const [alice, bob] = [folders.alice!, folders.bob!];
791793 write(alice, { "a.txt": "a, changed\n" });
792− assert.equal((await avcs(alice, "publish", "-m", "change a")).exit, 0);
794+ assert.equal((await avcs(alice, "push", "-m", "change a")).exit, 0);
793795 write(alice, { "a.txt": "a, changed again\n" });
794− assert.equal((await avcs(alice, "publish", "-m", "change a again")).exit, 0);
796+ assert.equal((await avcs(alice, "push", "-m", "change a again")).exit, 0);
795797 write(alice, { "b.txt": "b, changed\n" });
796− assert.equal((await avcs(alice, "publish", "-m", "change b")).exit, 0);
797− assert.equal((await avcs(bob, "sync")).exit, 0);
798+ assert.equal((await avcs(alice, "push", "-m", "change b")).exit, 0);
799+ assert.equal((await avcs(bob, "pull")).exit, 0);
798800
799801 // Version 2 builds on version 1: refused, then dropped together.
800802 const refused = await text(alice, "drop", "1", "-m", "a was wrong");
801803 assert.equal(refused.exit, 2);
802804 assert.match(
803805 refused.stdout,
804− /Not dropped\.\nLater published versions build on it:\n {2}version 2 by alice: change a again\nPass --with-dependents/,
806+ /Not dropped\.\nLater pushed versions build on it:\n {2}version 2 by alice: change a again\nPass --with-dependents/,
805807 );
806808 assert.equal((await text(alice, "drop", "1")).exit, 1, "a drop needs a message");
807809 const dropped = await avcs(alice, "drop", "1", "-m", "a was wrong", "--with-dependents");
Lines 814–820 at 318 (were 812–818 at 32)
812814 assert.equal(shared(name)["b.txt"], "b, changed\n", "version 3 stays");
813815
814816 // The other agent's sync takes it out of their folder; the log says what happened.
815− assert.equal((await avcs(bob, "sync")).exit, 0);
817+ assert.equal((await avcs(bob, "pull")).exit, 0);
816818 assert.equal(read(bob, "a.txt"), "a\n");
817819 const log = await text(bob, "log");
818820 assert.match(log.stdout, /version 4 by alice, .*: a was wrong\n {2}1 file: a\.txt\n {2}drops versions 1, 2/);
Lines 824–875 at 318 (were 822–833 at 32)
822824 );
823825 });
824826
825− it("refuses a publish that builds on lines a drop took out, plainly, with exit 2", async () => {
827+ it("shows and exports a version without earlier ones, refuses one a kept version builds on, and leaves shared alone", async () => {
828+ const { name, folders } = await project({ "a.txt": "a\n", "b.txt": "b\n" }, "alice", "bob");
829+ const [alice, bob] = [folders.alice!, folders.bob!];
830+ write(alice, { "a.txt": "a, changed\n" });
831+ assert.equal((await avcs(alice, "push", "-m", "change a")).exit, 0);
832+ write(alice, { "b.txt": "b, changed\n" });
833+ assert.equal((await avcs(alice, "push", "-m", "change b")).exit, 0);
834+ write(alice, { "a.txt": "a, changed again\n" });
835+ assert.equal((await avcs(alice, "push", "-m", "change a again")).exit, 0);
836+ const before = shared(name);
838+ const shown = await text(bob, "show", "2", "--without", "1");
839+ assert.equal(shown.exit, 0, shown.stderr);
840+ assert.match(
841+ shown.stdout,
842+ /^Version 2 of shared without version 1:\n {2}version 1 by alice: change a\nCompared with version 2: 1 file, 1 line added, 1 removed\.\nThe files hash to [0-9a-f]{64}; the same ask gives the same hash\. Shared doesn't change\./,
843+ );
844+ assert.match(shown.stdout, /-a, changed\n\+a\n/);
845+ assert.equal((await text(bob, "show", "2:a.txt", "--without", "1")).stdout, "a\n");
846+ assert.equal((await text(bob, "show", "2:b.txt", "--without", "1")).stdout, "b, changed\n");
848+ const refused = await text(bob, "show", "3", "--without", "1");
849+ assert.equal(refused.exit, 2);
850+ assert.equal(
851+ refused.stdout,
852+ "Version 3 of shared can't leave out version 1: versions it keeps build on it.\n version 3 by alice: change a again\n builds on version 1 (a.txt)\nLeaving those out too works: abso show 3 --without 1,3\n",
853+ );
854+ const out = join(temp(), "without");
855+ const blocked = await avcs(bob, "export", out, "--version", "3", "--without", "1");
856+ assert.equal(blocked.exit, 2);
857+ assert.deepEqual(blocked.json.suggestion, [1, 3]);
858+ const exported = await avcs(bob, "export", out, "--version", "3", "--without", "1,3");
859+ assert.equal(exported.exit, 0, exported.out);
860+ assert.deepEqual(exported.json.without, [1, 3]);
861+ assert.equal(readFileSync(join(out, "a.txt"), "utf8"), "a\n");
862+ assert.equal(readFileSync(join(out, "b.txt"), "utf8"), "b, changed\n");
863+ assert.deepEqual(shared(name), before, "shared doesn't change");
864+ assert.equal((await text(bob, "show", "3", "--without", "x")).exit, 1);
865+ });
867+ it("refuses a push that builds on lines a drop took out, plainly, with exit 2", async () => {
826868 const { folders } = await project({ "a.txt": "one\ntwo\n" }, "alice", "bob");
827869 const [alice, bob] = [folders.alice!, folders.bob!];
828870 write(alice, { "a.txt": "one\nTWO\n" });
829− assert.equal((await avcs(alice, "publish", "-m", "shout two")).exit, 0);
830− assert.equal((await avcs(bob, "sync")).exit, 0);
871+ assert.equal((await avcs(alice, "push", "-m", "shout two")).exit, 0);
872+ assert.equal((await avcs(bob, "pull")).exit, 0);
831873 // A drop never touches unpublished work.
832874 write(bob, { "a.txt": "one\nTWO?\n" });
833875 assert.equal((await avcs(bob, "record")).exit, 0);
Lines 877–920 at 318 (were 835–878 at 32)
835877 assert.equal(blocked.exit, 2);
836878 assert.match(
837879 blocked.stdout,
838− /Unpublished work builds on it, and a drop never touches unpublished work:\n {2}agent bob: a\.txt/,
880+ /Unpushed work builds on it, and a drop never touches unpushed work:\n {2}agent bob: a\.txt/,
839881 );
840882 assert.equal((await avcs(bob, "restore", "a.txt")).exit, 0);
841883 // The drop lands before bob syncs; bob's edit still builds on the dropped line.
842884 assert.equal((await avcs(alice, "drop", "1", "-m", "no shouting")).exit, 0);
843885 write(bob, { "a.txt": "one\nTWO!\n" });
844− const publish = await text(bob, "publish", "-m", "more shouting");
886+ const publish = await text(bob, "push", "-m", "more shouting");
845887 assert.equal(publish.exit, 2);
846888 assert.match(
847889 publish.stderr,
848− /^abso publish: refused: your unpublished changes to a\.txt build on lines a drop took out of shared; restore those files \(abso restore a\.txt\)/,
890+ /^abso push: refused: your unpushed changes to a\.txt build on lines a drop took out of shared; restore those files \(abso restore a\.txt\)/,
849891 );
850892 });
851893
852− it("amends the newest publish, and the log keeps the first message", async () => {
894+ it("amends the newest push, and the log keeps the first message", async () => {
853895 const { folders } = await project({ "a.txt": "a\n" }, "alice");
854896 const alice = folders.alice!;
855897 write(alice, { "a.txt": "a2\n" });
856− assert.equal((await avcs(alice, "publish", "-m", "chnage a")).exit, 0);
898+ assert.equal((await avcs(alice, "push", "-m", "chnage a")).exit, 0);
857899 const amended = await text(alice, "amend", "-m", "change a");
858900 assert.equal(amended.exit, 0, amended.stderr);
859901 assert.match(amended.stdout, /^Version 1 of shared now says: change a\n\(It said: chnage a\.\)/);
860902 assert.match(
861903 (await text(alice, "log")).stdout,
862− /version 1 by alice, .*: change a\n {2}1 file: a\.txt\n {2}amended; first published as: chnage a/,
904+ /version 1 by alice, .*: change a\n {2}1 file: a\.txt\n {2}amended; first pushed as: chnage a/,
863905 );
864− assert.match((await text(alice, "show", "1")).stdout, /: change a\n {2}amended; first published as: chnage a/);
906+ assert.match((await text(alice, "show", "1")).stdout, /: change a\n {2}amended; first pushed as: chnage a/);
865907 });
866908
867− it("labels versions, and a folder that follows a label syncs to it", async () => {
909+ it("labels versions, and a folder that follows a label pulls to it", async () => {
868910 const { folders } = await project({ "a.txt": "a\n" }, "alice", "bob");
869911 const [alice, bob] = [folders.alice!, folders.bob!];
870912 write(alice, { "a.txt": "a1\n" });
871− assert.equal((await avcs(alice, "publish", "-m", "one")).exit, 0);
913+ assert.equal((await avcs(alice, "push", "-m", "one")).exit, 0);
872914 const labeled = await text(alice, "label", "stable");
873915 assert.equal(labeled.stdout, "Put label stable on version 1. It marks 1 version: 1.\n");
874916 write(alice, { "a.txt": "a2\n" });
875− assert.equal((await avcs(alice, "publish", "-m", "two")).exit, 0);
917+ assert.equal((await avcs(alice, "push", "-m", "two")).exit, 0);
876918 assert.equal((await text(alice, "label", "bad name!")).exit, 1);
877919 assert.deepEqual((await avcs(alice, "labels")).json.labels, { stable: [1] });
878920 assert.match(
Lines 932–938 at 318 (were 890–896 at 32)
890932
891933 // Moving the label moves the folder on its next sync.
892934 assert.equal((await avcs(alice, "label", "stable", "--version", "2")).exit, 0);
893− assert.equal((await avcs(bob, "sync")).exit, 0);
935+ assert.equal((await avcs(bob, "pull")).exit, 0);
894936 assert.equal(read(bob, "a.txt"), "a2\n");
895937
896938 assert.equal((await avcs(alice, "label", "stable", "--version", "2", "--remove")).json.versions.join(), "1");
Lines 948–956 at 318 (were 906–914 at 32)
906948 const alice = folders.alice!;
907949 assert.equal((await avcs(alice, "switch", "-c", "exp")).exit, 0);
908950 write(alice, { "a.txt": "a in exp\n" });
909− assert.equal((await avcs(alice, "publish", "-m", "exp: a")).exit, 0);
951+ assert.equal((await avcs(alice, "push", "-m", "exp: a")).exit, 0);
910952 write(alice, { "b.txt": "b in exp\n" });
911− assert.equal((await avcs(alice, "publish", "-m", "exp: b")).exit, 0);
953+ assert.equal((await avcs(alice, "push", "-m", "exp: b")).exit, 0);
912954 const plucked = await text(folders.bob!, "pluck", "exp", "2", "-m", "just b");
913955 assert.equal(plucked.exit, 0, plucked.stderr);
914956 assert.match(plucked.stdout, /^Plucked 1 version of draft exp into shared as version 1/);
Lines 959–965 at 318 (were 917–923 at 32)
917959 assert.equal((await text(folders.bob!, "pluck", "exp", "-m", "nothing")).exit, 1);
918960 });
919961
920− it("blames a named draft, and marks your own unpublished lines with --mine", async () => {
962+ it("blames a named draft, and marks your own unpushed lines with --mine", async () => {
921963 const { folders } = await project({ "a.txt": "one\ntwo\n" }, "alice");
922964 const alice = folders.alice!;
923965 write(alice, { "a.txt": "one\ntwo\nthree\n" });
Lines 968–974 at 318 (were 926–932 at 32)
926968 assert.equal(mine.exit, 0, mine.stderr);
927969 assert.match(mine.stdout, /^a\.txt as your view has it now \(lines 1-3 of 3\):/);
928970 assert.match(mine.stdout, /\n {2}3 {2}\* {4}alice {2}three\n/);
929− assert.match(mine.stdout, /\* not published yet/);
971+ assert.match(mine.stdout, /\* not pushed yet/);
930972 assert.match((await text(alice, "blame", "a.txt")).stdout, /lines 1-2 of 2/, "shared does not have it");
931973 assert.equal((await text(alice, "blame", "a.txt", "--mine", "--draft", "x")).exit, 1);
932974 const why = await avcs(alice, "why", "a.txt:3", "--mine");
Lines 976–982 at 318 (were 934–940 at 32)
934976 assert.equal(why.json.text, "three");
935977
936978 assert.equal((await avcs(alice, "switch", "-c", "exp")).exit, 0);
937− assert.equal((await avcs(alice, "publish", "-m", "exp: three")).exit, 0);
979+ assert.equal((await avcs(alice, "push", "-m", "exp: three")).exit, 0);
938980 assert.match(
939981 (await text(alice, "blame", "a.txt", "--draft", "exp")).stdout,
940982 /^a\.txt as draft exp has it at version 1 \(lines 1-3 of 3\):/,
Lines 988–998 at 318 (were 946–956 at 32)
946988 const text = async (cwd: string, ...argv: string[]) => main(argv, { cwd, env: ENV, write: () => {} });
947989 const SRC = "export function f() {\n return 1;\n}\n\nexport const x = 2;\n";
948990
949− it("shows a rename as one change in diff, show and sync, and log follows it back", async () => {
991+ it("shows a rename as one change in diff, show and pull, and log follows it back", async () => {
950992 const { name, folders } = await project({ "lib/old.ts": SRC, "keep.ts": "k\n" }, "alice", "bob");
951993 const [alice, bob] = [folders.alice!, folders.bob!];
952994 write(alice, { "lib/old.ts": SRC.replace("return 1", "return 2") });
953− assert.equal((await avcs(alice, "publish", "-m", "f returns 2")).exit, 0);
995+ assert.equal((await avcs(alice, "push", "-m", "f returns 2")).exit, 0);
954996
955997 // Renamed with one line changed: one file, 1 line added and 1 removed.
956998 renameSync(join(alice, "lib", "old.ts"), join(alice, "lib", "new.ts"));
Lines 1007–1013 at 318 (were 965–971 at 32)
9651007 /rename from lib\/old\.ts/,
9661008 "the old path picks the rename too",
9671009 );
968− assert.equal((await avcs(alice, "publish", "-m", "rename old to new")).exit, 0);
1010+ assert.equal((await avcs(alice, "push", "-m", "rename old to new")).exit, 0);
9691011 assert.equal(shared(name)["lib/new.ts"], SRC.replace("return 1", "return 2").replace("x = 2", "x = 3"));
9701012
9711013 const show = await text(alice, "show", "2");
Lines 1016–1022 at 318 (were 974–980 at 32)
9741016 /1 file \(1 renamed\), 1 line added, 1 removed\.\nsimilarity index 80%\nrename from lib\/old\.ts\nrename to lib\/new\.ts/,
9751017 );
9761018
977− const sync = await avcs(bob, "sync");
1019+ const sync = await avcs(bob, "pull");
9781020 assert.deepEqual(sync.json.renamed, [{ from: "lib/old.ts", to: "lib/new.ts" }]);
9791021 write(bob, { "keep.ts": "k\n" });
9801022
Lines 1033–1043 at 318 (were 991–1001 at 32)
9911033 (await text(alice, "diff")).stdout,
9921034 /: 1 file \(1 renamed\), 0 lines added, 0 removed\.\nsimilarity index 100%\nrename from keep\.ts\nrename to kept\.ts\n$/,
9931035 );
994− assert.equal((await avcs(alice, "publish", "-m", "rename keep")).exit, 0);
995− const synced = await text(bob, "sync");
1036+ assert.equal((await avcs(alice, "push", "-m", "rename keep")).exit, 0);
1037+ const synced = await text(bob, "pull");
9961038 assert.match(
9971039 synced.stdout,
998− /Synced to version 3: 0 files updated, 0 deleted, 1 renamed\.\n {2}renamed: keep\.ts -> kept\.ts/,
1040+ /Pulled to version 3: 0 files updated, 0 deleted, 1 renamed\.\n {2}renamed: keep\.ts -> kept\.ts/,
9991041 );
10001042 });
10011043
Lines 1086–1092 at 318 (were 1044–1050 at 32)
10441086 });
10451087});
10461088
1047−describe("a quieter sync (trial request)", () => {
1089+describe("a quieter pull (trial request)", () => {
10481090 it("names up to 8 files per line, and --verbose lists every one", async () => {
10491091 const files: Record<string, string> = {};
10501092 for (let i = 0; i < 11; i++) files[`f${String(i).padStart(2, "0")}.txt`] = `${i}\n`;
Lines 1095–1109 at 318 (were 1053–1067 at 32)
10531095 const changed: Record<string, string> = {};
10541096 for (const f of Object.keys(files)) changed[f] = `${files[f]}changed\n`;
10551097 write(alice, changed);
1056− assert.equal((await avcs(alice, "publish", "-m", "change all")).exit, 0);
1057− const quiet = await main(["sync"], { cwd: bob, env: ENV, write: () => {} });
1098+ assert.equal((await avcs(alice, "push", "-m", "change all")).exit, 0);
1099+ const quiet = await main(["pull"], { cwd: bob, env: ENV, write: () => {} });
10581100 assert.equal(
10591101 quiet.stdout,
1060− "Synced to version 1: 11 files updated, 0 deleted.\n updated: f00.txt, f01.txt, f02.txt, f03.txt, f04.txt, f05.txt, f06.txt, f07.txt, and 3 more\n (abso sync --verbose lists every file)\n",
1102+ "Pulled to version 1: 11 files updated, 0 deleted.\n updated: f00.txt, f01.txt, f02.txt, f03.txt, f04.txt, f05.txt, f06.txt, f07.txt, and 3 more\n (abso pull --verbose lists every file)\n",
10611103 );
10621104 write(alice, files);
1063− assert.equal((await avcs(alice, "publish", "-m", "change back")).exit, 0);
1064− const loud = await main(["sync", "--verbose"], { cwd: bob, env: ENV, write: () => {} });
1105+ assert.equal((await avcs(alice, "push", "-m", "change back")).exit, 0);
1106+ const loud = await main(["pull", "--verbose"], { cwd: bob, env: ENV, write: () => {} });
10651107 assert.equal(loud.stdout.split("\n").filter((l) => l.startsWith(" updated f")).length, 11);
10661108 });
10671109});
Lines 1138–1147 at 318 (were 1096–1102 at 32)
10961138 fake.dropRunStarts = 4;
10971139 const r = await main(["run", "node", "hi.js"], { cwd: folders.alice!, env: FAST, write: () => {} });
10981140 assert.equal(r.exit, 1);
1099− assert.match(r.stderr, /^abso run: could not reach .*\(tried 4 times\)\n$/);
1141+ assert.match(
1142+ r.stderr,
1143+ /^abso run: Can't reach .*\(tried 4 times\)\. Check your connection; abso doctor checks the rest\.\n$/,
1144+ );
11001145 assert.equal(fake.runStarts.slice(before).filter((t) => t.started).length, 0);
11011146 fake.dropRunStarts = 0;
11021147 });
Lines 1261–1267 at 318 (were 1216–1222 at 32)
12161261 });
12171262});
12181263
1219−describe("a name defined twice (#25, Engine e94f772)", () => {
1264+describe("a name defined twice (#25)", () => {
12201265 it("says which definition is whose, and that one has to go", () => {
12211266 const text = collisionText({
12221267 kind: "duplicate",
Lines 1279–1285 at 318 (were 1234–1240 at 32)
12341279 assert.equal(
12351280 text,
12361281 [
1237− ` src/re.ts: parse is defined twice, yours (lines 10-12) and bob's from version 7 ("add parse") (lines 3-4). Keep one, then publish.`,
1282+ ` src/re.ts: parse is defined twice, yours (lines 10-12) and bob's from version 7 ("add parse") (lines 3-4). Keep one, then push.`,
12381283 " yours:",
12391284 " export function parse(s) {",
12401285 " return s;",
Lines 1291–1320 at 318 (were 1246–1275 at 32)
12461291 );
12471292 });
12481293
1249− it("refuses a publish that defines a name another agent defined in the same file", async () => {
1294+ it("refuses a push that defines a name another agent defined in the same file", async () => {
12501295 const { folders } = await project({ "a.ts": "export const x = 1;\n" }, "alice", "bob");
12511296 const [alice, bob] = [folders.alice!, folders.bob!];
12521297 write(alice, { "a.ts": "export const x = 1;\nexport function parseClassSet() {\n return 1;\n}\n" });
1253− assert.equal((await avcs(alice, "publish", "-m", "add parse")).exit, 0);
1298+ assert.equal((await avcs(alice, "push", "-m", "add parse")).exit, 0);
12541299 write(bob, { "a.ts": "export function parseClassSet() {\n return 2;\n}\nexport const x = 1;\n" });
12551300 // Sync brings alice's parse into bob's view, where it is defined twice: sync lists it, publish refuses.
1256− const synced = await main(["sync"], { cwd: bob, env: ENV, write: () => {} });
1301+ const synced = await main(["pull"], { cwd: bob, env: ENV, write: () => {} });
12571302 assert.match(
12581303 synced.stdout,
1259− /1 collision: a name defined twice needs one definition kept before you publish\.\n/,
1304+ /1 collision: a name defined twice needs one definition kept before you push\.\n/,
12601305 "no talk of both sides' lines: none changed",
12611306 );
12621307 // Where each definition is: the declaration line, or (engine after e94f772) the whole definition.
12631308 assert.match(
12641309 synced.stdout,
1265− /a\.ts: parseClassSet is defined twice, yours \((line 1|lines 1-3)\) and alice's from version 1 \("add parse"\) \((line 5|lines 5-7)\)\. Keep one, then publish\./,
1310+ /a\.ts: parseClassSet is defined twice, yours \((line 1|lines 1-3)\) and alice's from version 1 \("add parse"\) \((line 5|lines 5-7)\)\. Keep one, then push\./,
12661311 );
1267− const refused = await main(["publish", "-m", "my parse"], { cwd: bob, env: ENV, write: () => {} });
1312+ const refused = await main(["push", "-m", "my parse"], { cwd: bob, env: ENV, write: () => {} });
12681313 assert.equal(refused.exit, 2, refused.stdout + refused.stderr);
1269− assert.match(refused.stdout, /^Not published: 1 collision\.\n {2}a\.ts: parseClassSet is defined twice/);
1314+ assert.match(refused.stdout, /^Not pushed: 1 collision\.\n {2}a\.ts: parseClassSet is defined twice/);
12701315 assert.match(
12711316 refused.stdout,
1272− /\nKeep one definition of each name defined twice \(delete yours, or theirs\), then publish again\.\n$/,
1317+ /\nKeep one definition of each name defined twice \(delete yours, or theirs\), then push again\.\n$/,
12731318 );
12741319 });
12751320});
Lines 1347–1353 at 318 (were 1302–1308 at 32)
13021347 });
13031348});
13041349
1305−describe("paths from the server never leave the folder (Security)", () => {
1350+describe("paths from the server never leave the folder", () => {
13061351 // In a sync answer, as a server that let anything through would send them (the engine refuses them at record since 03a44da).
13071352 const HOSTILE = [
13081353 "../escape.txt",
Lines 1368–1379 at 318 (were 1323–1334 at 32)
13231368 ];
13241369
13251370 it("refuses each one, writes nothing for it, and says which and why", async () => {
1326− const { name, folders } = await project({ "ok.txt": "ok\n" }, "alice", "bob", "carol");
1371+ const { folders } = await project({ "ok.txt": "ok\n" }, "alice", "bob", "carol");
13271372 const bob = folders.bob!;
13281373 const files = Object.fromEntries([...HOSTILE.map((p) => [p, "pwned\n"] as const), ["fine/new.txt", "fine\n"]]);
13291374 const parent = dirname(bob);
13301375 fake.injectSync = { files };
1331− const sync = await main(["sync", "--json"], { cwd: bob, env: ENV, write: () => {} });
1376+ const sync = await main(["pull", "--json"], { cwd: bob, env: ENV, write: () => {} });
13321377 const json = JSON.parse(sync.stdout);
13331378 assert.equal(json.ok, true, sync.stdout);
13341379 assert.deepEqual(json.refused.map((r: { path: string }) => r.path).sort(), [...HOSTILE].sort());
Lines 1385–1391 at 318 (were 1340–1346 at 32)
13401385 assert.equal(existsSync(join(bob, ".claude")), false);
13411386 assert.equal(existsSync(join(bob, "abs.txt")), false);
13421387 fake.injectSync = { files };
1343− const text = await main(["sync"], { cwd: folders.carol!, env: ENV, write: () => {} });
1388+ const text = await main(["pull"], { cwd: folders.carol!, env: ENV, write: () => {} });
13441389 assert.match(text.stdout, /REFUSED 15 paths from the server, and wrote nothing there/);
13451390 assert.match(text.stdout, /\n {2}"\.\.\/escape\.txt": it has a "\.\." part\n/);
13461391 assert.match(
Lines 1395–1401 at 318 (were 1350–1356 at 32)
13501395 assert.match(text.stdout, /\n {2}"CON\.txt": "CON\.txt" is a Windows device name\n/);
13511396 });
13521397
1353− it("refuses every spelling a disk may take for .git, .abso, .claude or node_modules (AVCS - Security)", () => {
1398+ it("refuses every spelling a disk may take for .git, .abso, .claude or node_modules", () => {
13541399 // Folded by pathKey: a long s, a dotless i and other case; then characters HFS+ leaves out when it compares names.
13551400 const twins = [
13561401 ".avc\u017F/config.json",
Lines 1424–1430 at 318 (were 1379–1385 at 32)
13791424 assert.equal(isSkippedPart(".git"), true);
13801425 });
13811426
1382− it("refuses Windows short names and characters Windows can't hold (AVCS - Git Lessons, git's CVE-2019-1353)", async () => {
1427+ it("refuses Windows short names and characters Windows can't hold (git's CVE-2019-1353)", async () => {
13831428 for (const p of [
13841429 "CLAUDE~1/settings.json",
13851430 "GIT~1/hooks/pre-commit",
Lines 1454–1460 at 318 (were 1409–1415 at 32)
14091454 fake.injectSync = {
14101455 files: { "CLAUDE~1/settings.json": '{"hooks":"pwned"}\n', "GIT~1/config": "pwned\n", "fine.txt": "fine\n" },
14111456 };
1412− const json = JSON.parse((await main(["sync", "--json"], { cwd: bob, env: ENV, write: () => {} })).stdout);
1457+ const json = JSON.parse((await main(["pull", "--json"], { cwd: bob, env: ENV, write: () => {} })).stdout);
14131458 assert.deepEqual(json.refused.map((r: { path: string }) => r.path).sort(), [
14141459 "CLAUDE~1/settings.json",
14151460 "GIT~1/config",
Lines 1486–1526 at 318 (were 1441–1481 at 32)
14411486 assert.deepEqual(readdirSync(dir), ["a.txt"], "the temporary file is gone");
14421487 });
14431488
1444− it("a write the disk refuses is named, and the rest of the sync still lands", async () => {
1489+ it("a write the disk refuses is named, and the rest of the pull still lands", async () => {
14451490 const { folders } = await project({ "ok.txt": "ok\n" }, "alice", "bob");
14461491 const bob = folders.bob!;
14471492 // "block" is a file here, so block/x.txt can't be written; z.txt after it still is.
14481493 write(bob, { block: "a file, not a folder\n" });
14491494 fake.injectSync = { files: { "block/x.txt": "x\n", "z.txt": "z\n" } };
1450− const sync = await main(["sync", "--json"], { cwd: bob, env: ENV, write: () => {} });
1495+ const sync = await main(["pull", "--json"], { cwd: bob, env: ENV, write: () => {} });
14511496 const json = JSON.parse(sync.stdout);
14521497 assert.equal(json.ok, true, sync.stdout + sync.stderr);
14531498 assert.equal(json.refused.length, 1);
14541499 assert.equal(json.refused[0].path, "block/x.txt");
14551500 assert.match(json.refused[0].why, /^writing it here failed \(/);
1456− assert.equal(read(bob, "z.txt"), "z\n", "the rest of the sync still lands");
1501+ assert.equal(read(bob, "z.txt"), "z\n", "the rest of the pull still lands");
14571502
14581503 // Remembered (#51): no later sync sends it again, so status and every sync name it until a write works.
14591504 const stale =
1460− /Stale here: a sync couldn't write this file, and no later sync sends it again\. Close whatever holds it, then abso sync --full: block\/x\.txt \(version \d+: [A-Z]+\)/;
1505+ /Stale here: a pull couldn't write this file, and no later pull sends it again\. Close whatever holds it, then abso pull --full: block\/x\.txt \(version \d+: [A-Z]+\)/;
14611506 assert.match((await main(["status"], { cwd: bob, env: ENV, write: () => {} })).stdout, stale);
1462− const again = await main(["sync"], { cwd: bob, env: ENV, write: () => {} });
1507+ const again = await main(["pull"], { cwd: bob, env: ENV, write: () => {} });
14631508 assert.match(again.stdout, stale);
14641509 rmSync(join(bob, "block"));
14651510 fake.injectSync = { files: { "block/x.txt": "x\n" } };
1466− assert.equal((await main(["sync"], { cwd: bob, env: ENV, write: () => {} })).exit, 0);
1511+ assert.equal((await main(["pull"], { cwd: bob, env: ENV, write: () => {} })).exit, 0);
14671512 assert.equal(read(bob, "block/x.txt"), "x\n");
14681513 assert.doesNotMatch((await main(["status"], { cwd: bob, env: ENV, write: () => {} })).stdout, /Stale here/);
14691514 });
14701515
14711516 it("refuses a link out of the folder, and a write through a folder that is a link", async () => {
1472− const { name, folders } = await project({ "ok.txt": "ok\n" }, "alice", "bob");
1517+ const { folders } = await project({ "ok.txt": "ok\n" }, "alice", "bob");
14731518 const bob = folders.bob!;
14741519 fake.injectSync = {
14751520 files: { up: "", "in-folder": "" },
14761521 modes: { up: { link: "../../.ssh" }, "in-folder": { link: "ok.txt" } },
14771522 };
1478− const json = JSON.parse((await main(["sync", "--json"], { cwd: bob, env: ENV, write: () => {} })).stdout);
1523+ const json = JSON.parse((await main(["pull", "--json"], { cwd: bob, env: ENV, write: () => {} })).stdout);
14791524 assert.deepEqual(json.refused, [{ path: "up", why: "it links to ../../.ssh, outside this folder" }]);
14801525 assert.equal(existsSync(join(bob, "up")), false);
14811526
Lines 1544–1550 at 318 (were 1499–1505 at 32)
14991544 });
15001545});
15011546
1502−describe("the token goes only to abso servers (Security, #30)", () => {
1547+describe("the token goes only to abso servers (#30)", () => {
15031548 it("knows the servers it may go to", () => {
15041549 for (const ok of [
15051550 "https://api.abso.dev",
Lines 1596–1602 at 318 (were 1551–1557 at 32)
15511596 assert.equal(tokenGoesTo("https://sneaky.example", trusted), false);
15521597 assert.equal(tokenGoesTo("https://evil.example", trusted), false);
15531598 assert.equal(issuesServerFor("https://abso.example", machine), "https://issues.abso.example");
1554− assert.equal(issuesServerFor("https://staging.abso.example", machine), undefined);
1599+ assert.equal(issuesServerFor("https://staging.abso.example", machine), "https://staging.abso.example/issues");
15551600 assert.deepEqual(machineServers("{not json"), { trusted: [], issues: {} });
15561601 assert.deepEqual(machineServers(undefined), { trusted: [], issues: {} });
15571602 assert.equal(trustedList("https://a.example", machine).split(",")[0], "https://a.example");
Lines 1623–1629 at 318 (were 1578–1584 at 32)
15781623 });
15791624});
15801625
1581−describe("news is framed as quotes (Security, #30)", () => {
1626+describe("news is framed as quotes (#30)", () => {
15821627 it("caps each item, and indents its later lines so it cannot pass for a heading", () => {
15831628 const ctx = newsContext([
15841629 "Announcement from bob: hi",
Lines 1643–1666 at 318 (were 1598–1603 at 32)
15981643 ]);
15991644 assert.match(lines[5]!, /^- y{1500} \.\.\. \(cut; \.abso\/news\.log has it whole\)$/);
16001645 });
1647+ it("shows a tell under who told it, uncut, its words indented below", () => {
1648+ const long = "z".repeat(3000);
1649+ const said = 'Ship it\n- now: "really"';
1650+ const ctx = newsContext([
1651+ `Announcement from ann (as claimed): ${long}`,
1652+ `Announcement from Robin (a person, signed in on the website, id cf-9): ${JSON.stringify(said)}`,
1653+ ])!;
1654+ const lines = ctx.split("\n").slice(1);
1655+ assert.deepEqual(lines, [
1656+ "- ann (as claimed) told you:",
1657+ ` ${long}`,
1658+ "- Robin (a person) told you:",
1659+ " Ship it",
1660+ ' - now: "really"',
1661+ ]);
1662+ assert.equal(ctx.includes("cf-9"), false, "a person's id stays in the log");
1663+ });
16011664});
16021665
16031666describe("abso run --at <version> [--files <glob>] (trial request, Backtracker)", () => {
Lines 1671–1680 at 318 (were 1608–1617 at 32)
16081671 const { folders } = await project({ "v.txt": "one\n", "show.js": SHOW }, "alice");
16091672 const alice = folders.alice!;
16101673 write(alice, { "v.txt": "two\n" });
1611− assert.equal((await avcs(alice, "publish", "-m", "two")).exit, 0);
1674+ assert.equal((await avcs(alice, "push", "-m", "two")).exit, 0);
16121675 write(alice, { "v.txt": "three\n", "new.txt": "n\n" });
1613− assert.equal((await avcs(alice, "publish", "-m", "three, and new")).exit, 0);
1614− write(alice, { "v.txt": "four, unpublished\n" });
1676+ assert.equal((await avcs(alice, "push", "-m", "three, and new")).exit, 0);
1677+ write(alice, { "v.txt": "four, unpushed\n" });
16151678 const run = async (...a: string[]) => {
16161679 let out = "";
16171680 let err = "";
Lines 1688–1694 at 318 (were 1625–1631 at 32)
16251688 };
16261689
16271690 const now = await run("node", "show.js");
1628− assert.equal(now.out, "four, unpublished new -\n");
1691+ assert.equal(now.out, "four, unpushed new -\n");
16291692 const v1 = await run("--at", "1", "node", "show.js");
16301693 assert.equal(v1.out, "two no new 1\n", v1.err);
16311694 assert.match(v1.err, /^abso: running version 1 of shared in the box \(3 files\); your folder is untouched\.\n/);
Lines 1703–1709 at 318 (were 1640–1646 at 32)
16401703 assert.equal(gone.out, "two no new 1 files new.txt,v.txt\n", gone.err);
16411704 assert.match(gone.err, /left out, not there at version 1: new\.txt/);
16421705
1643− assert.equal(read(alice, "v.txt"), "four, unpublished\n", "the folder is untouched");
1706+ assert.equal(read(alice, "v.txt"), "four, unpushed\n", "the folder is untouched");
16441707 assert.equal((await avcs(alice, "record")).json.sent, 0, "nothing old was recorded");
16451708 assert.equal((await run("--files", "v.txt", "node", "show.js")).exit, 1);
16461709 assert.equal((await run("--at", "two", "node", "show.js")).exit, 1);
Lines 1738–1753 at 318 (were 1675–1690 at 32)
16751738 assert.equal(hooked.outcome, "skipped: recording is paused (abso resume)");
16761739 const record = await avcs(alice, "record");
16771740 assert.equal(record.exit, 2);
1678− const publish = await main(["publish", "-m", "nothing"], { cwd: alice, env: ENV, write: () => {} });
1741+ const publish = await main(["push", "-m", "nothing"], { cwd: alice, env: ENV, write: () => {} });
16791742 assert.match(
16801743 publish.stdout,
1681− /^Recording is paused \(abso resume\): your folder's changes were not sent first\.\nNothing to publish/,
1744+ /^Recording is paused \(abso resume\): your folder's changes were not sent first\.\nNothing to push/,
16821745 );
16831746 assert.equal(shared(name)["a.txt"], "one\n");
16841747 assert.match((await main(["resume"], { cwd: alice, env: ENV, write: () => {} })).stdout, /^Recording again\./);
16851748 write(alice, { "b.txt": "b2\n" });
1686− const sent = await main(["publish", "-m", "now"], { cwd: alice, env: ENV, write: () => {} });
1687− assert.match(sent.stdout, /^Recorded first: 2 changed \(a\.txt, b\.txt\)\.\nPublished version 1\./);
1749+ const sent = await main(["push", "-m", "now"], { cwd: alice, env: ENV, write: () => {} });
1750+ assert.match(sent.stdout, /^Recorded first: 2 changed \(a\.txt, b\.txt\)\.\nPushed version 1\./);
16881751 assert.equal(shared(name)["a.txt"], "old copy\n");
16891752 });
16901753
Lines 1765–1800 at 318 (were 1702–1737 at 32)
17021765 });
17031766});
17041767
1705−describe("publish and sync say what happened to others' work (#37, the game trial)", () => {
1706− it("a publish on top of versions the folder lacks says nothing was overwritten", async () => {
1768+describe("push and pull say what happened to others' work (#37, the game trial)", () => {
1769+ it("a push on top of versions the folder lacks says nothing was overwritten", async () => {
17071770 const { folders } = await project({ "a.txt": "a\n", "b.txt": "b\n" }, "alice", "bob");
17081771 write(folders.bob!, { "a.txt": "a by bob\n" });
1709− assert.equal((await avcs(folders.bob!, "publish", "-m", "Pitch five")).exit, 0);
1772+ assert.equal((await avcs(folders.bob!, "push", "-m", "Pitch five")).exit, 0);
17101773 write(folders.alice!, { "b.txt": "b by alice\n" });
1711− const r = await main(["publish", "-m", "mine"], { cwd: folders.alice!, env: ENV, write: () => {} });
1774+ const r = await main(["push", "-m", "mine"], { cwd: folders.alice!, env: ENV, write: () => {} });
17121775 assert.match(
17131776 r.stdout,
1714− /Published version 2\. It went on top of version 1 \(bob: "Pitch five"\), which your folder doesn't have yet\. Nothing of theirs was overwritten; run abso sync to see both\.\n/,
1777+ /Pushed version 2\. It went on top of version 1 \(bob: "Pitch five"\), which your folder doesn't have yet\. Nothing of theirs was overwritten; run abso pull to see both\.\n/,
17151778 );
17161779 });
17171780
1718− it("lines changed on both sides: sync writes a marker block, publish refuses it, --as-is keeps both (#11)", async () => {
1781+ it("lines changed on both sides: pull writes a marker block, push refuses it, --as-is keeps both (#11)", async () => {
17191782 const { folders } = await project({ "a.txt": "one\ntwo\nthree\n" }, "alice", "bob");
17201783 write(folders.bob!, { "a.txt": "one\nTWO by bob\nthree\n" });
1721− assert.equal((await avcs(folders.bob!, "publish", "-m", "bob")).exit, 0);
1784+ assert.equal((await avcs(folders.bob!, "push", "-m", "bob")).exit, 0);
17221785 write(folders.alice!, { "a.txt": "one\ntwo by alice\nthree\n" });
1723− const synced = await main(["sync"], { cwd: folders.alice!, env: ENV, write: () => {} });
1786+ const synced = await main(["pull"], { cwd: folders.alice!, env: ENV, write: () => {} });
17241787 assert.match(synced.stdout, /1 collision: where lines changed on both sides, the file now holds a marker block/);
17251788 assert.equal(
17261789 read(folders.alice!, "a.txt"),
17271790 'one\n<<<<<<< yours (unpublished)\ntwo by alice\n||||||| before (version 0)\ntwo\n=======\nTWO by bob\n>>>>>>> theirs: bob, version 1 "bob"\nthree\n',
17281791 );
1729− const refused = await main(["publish", "-m", "both kept"], { cwd: folders.alice!, env: ENV, write: () => {} });
1792+ const refused = await main(["push", "-m", "both kept"], { cwd: folders.alice!, env: ENV, write: () => {} });
17301793 assert.equal(refused.exit, 2);
17311794 assert.equal(
1732− (await avcs(folders.alice!, "publish", "-m", "both kept", "--as-is")).exit,
1795+ (await avcs(folders.alice!, "push", "-m", "both kept", "--as-is")).exit,
17331796 0,
1734− "--as-is publishes both and settles it",
1797+ "--as-is pushes both and settles it",
17351798 );
17361799 assert.equal(read(folders.alice!, "a.txt"), "one\ntwo by alice\nTWO by bob\nthree\n");
17371800 });
Lines 1803–1811 at 318 (were 1740–1748 at 32)
17401803 const { folders } = await project({ "a.txt": "one\ntwo\nthree\n", "b.txt": "b\n" }, "alice", "bob");
17411804 const [alice, bob] = [folders.alice!, folders.bob!];
17421805 write(bob, { "a.txt": "one\nTWO by bob\nthree\n" });
1743− assert.equal((await avcs(bob, "publish", "-m", "Bob says TWO")).exit, 0);
1806+ assert.equal((await avcs(bob, "push", "-m", "Bob says TWO")).exit, 0);
17441807 write(alice, { "a.txt": "one\ntwo by alice\nthree\n" });
1745− const synced = await main(["sync"], { cwd: alice, env: ENV, write: () => {} });
1808+ const synced = await main(["pull"], { cwd: alice, env: ENV, write: () => {} });
17461809 assert.match(
17471810 synced.stdout,
17481811 /Box runs fail while markers are in the folder\.\n {2}a\.txt lines 2-8: yours against bob's version 1 \("Bob says TWO"\)\.\n/,
Lines 1813–1829 at 318 (were 1750–1766 at 32)
17501813 const status = await main(["status"], { cwd: alice, env: ENV, write: () => {} });
17511814 assert.match(
17521815 status.stdout,
1753− /\n1 collision to settle before you publish \(keep yours, theirs or a mix and delete the marker lines, or abso settle <file> --yours\|--theirs\|--both\):\n {2}a\.txt lines 2-8, with bob's version 1 \("Bob says TWO"\)\n/,
1816+ /\n1 collision to settle before you push \(keep yours, theirs or a mix and delete the marker lines, or abso settle <file> --yours\|--theirs\|--both\):\n {2}a\.txt lines 2-8, with bob's version 1 \("Bob says TWO"\)\n/,
17541817 );
1755− const refused = await main(["publish", "-m", "mine"], { cwd: alice, env: ENV, write: () => {} });
1818+ const refused = await main(["push", "-m", "mine"], { cwd: alice, env: ENV, write: () => {} });
17561819 assert.equal(refused.exit, 2);
17571820 assert.match(
17581821 refused.stdout,
1759− /Not published: a\.txt still has collision markers \(1 block\)\.\n {2}a\.txt lines 2-8: yours against bob's version 1 \("Bob says TWO"\)\.\nSettle each: keep yours, theirs or a mix and delete the marker lines, or abso settle <file> --yours\|--theirs\|--both\./,
1822+ /Not pushed: a\.txt still has collision markers \(1 block\)\.\n {2}a\.txt lines 2-8: yours against bob's version 1 \("Bob says TWO"\)\.\nSettle each: keep yours, theirs or a mix and delete the marker lines, or abso settle <file> --yours\|--theirs\|--both\./,
17601823 );
17611824 // Settle: a file with no markers is refused, and settles nothing.
17621825 assert.match(
1763− (await main(["settle", "b.txt", "--theirs"], { cwd: alice, env: ENV, write: () => {} })).stdout + "",
1826+ `${(await main(["settle", "b.txt", "--theirs"], { cwd: alice, env: ENV, write: () => {} })).stdout}`,
17641827 /^$/,
17651828 );
17661829 const none = await main(["settle", "a.txt", "b.txt", "--theirs"], { cwd: alice, env: ENV, write: () => {} });
Lines 1843–1849 at 318 (were 1780–1786 at 32)
17801843 [],
17811844 );
17821845 write(alice, { "b.txt": "b by alice\n" });
1783− const published = await main(["publish", "-m", "Alice"], { cwd: alice, env: ENV, write: () => {} });
1846+ const published = await main(["push", "-m", "Alice"], { cwd: alice, env: ENV, write: () => {} });
17841847 assert.equal(published.exit, 0, published.stdout + published.stderr);
17851848 assert.match(
17861849 published.stdout,
Lines 1852–1870 at 318 (were 1789–1807 at 32)
17891852 const heard = await avcs(bob, "news");
17901853 assert.match(
17911854 JSON.stringify(heard.json),
1792− /alice settled its collision with your version 1 in a\.txt, publishing version 2: it kept your lines\. abso show 2:a\.txt shows the file\./,
1855+ /alice settled its collision with your version 1 in a\.txt, pushing version 2: it kept your lines\. abso show 2:a\.txt shows the file\./,
17931856 );
17941857 });
17951858
1796− it("a settle that loses lines both sides had says which, under the Settled line (#37, Playtester 1)", async () => {
1859+ it("a settle that loses lines both sides had says which, under the Settled line (#37)", async () => {
17971860 const { folders } = await project({ "a.txt": "one\nx\nthree\n" }, "alice", "bob");
17981861 write(folders.bob!, { "a.txt": "one\nB1\nshared line\nthree\n" });
1799− assert.equal((await avcs(folders.bob!, "publish", "-m", "bob")).exit, 0);
1862+ assert.equal((await avcs(folders.bob!, "push", "-m", "bob")).exit, 0);
18001863 write(folders.alice!, { "a.txt": "one\nA1\nshared line\nthree\n" });
1801− assert.equal((await avcs(folders.alice!, "sync")).exit, 0);
1864+ assert.equal((await avcs(folders.alice!, "pull")).exit, 0);
18021865 // Settled by hand, keeping only A1: "shared line", which both had, is gone.
18031866 write(folders.alice!, { "a.txt": "one\nA1\nthree\n" });
1804− const r = await main(["publish", "-m", "mine"], { cwd: folders.alice!, env: ENV, write: () => {} });
1867+ const r = await main(["push", "-m", "mine"], { cwd: folders.alice!, env: ENV, write: () => {} });
18051868 assert.equal(r.exit, 0, r.stdout + r.stderr);
18061869 assert.match(r.stdout, /\n {2}a\.txt: lost 1 line you both had: "shared line"; check abso show 2:a\.txt\n/);
18071870 });
Lines 1872–1889 at 318 (were 1809–1826 at 32)
18091872 it("a marker line left behind after settling is named on its own line, to delete (#11)", async () => {
18101873 const { folders } = await project({ "a.txt": "one\ntwo\nthree\n" }, "alice", "bob");
18111874 write(folders.bob!, { "a.txt": "one\nTWO by bob\nthree\n" });
1812− assert.equal((await avcs(folders.bob!, "publish", "-m", "bob")).exit, 0);
1875+ assert.equal((await avcs(folders.bob!, "push", "-m", "bob")).exit, 0);
18131876 write(folders.alice!, { "a.txt": "one\ntwo by alice\nthree\n" });
1814− assert.equal((await avcs(folders.alice!, "sync")).exit, 0);
1877+ assert.equal((await avcs(folders.alice!, "pull")).exit, 0);
18151878 // Settled by hand, but one marker line stays.
18161879 write(folders.alice!, { "a.txt": 'one\ntwo by alice\n=======\n>>>>>>> theirs: bob, version 1 "bob"\nthree\n' });
1817− const refused = await main(["publish", "-m", "mine"], { cwd: folders.alice!, env: ENV, write: () => {} });
1880+ const refused = await main(["push", "-m", "mine"], { cwd: folders.alice!, env: ENV, write: () => {} });
18181881 assert.equal(refused.exit, 2);
18191882 assert.match(refused.stdout, /\n {2}a\.txt line 4: a marker line left from a collision; delete it\.\n/);
18201883 });
18211884});
18221885
1823−describe("abso fetch and run --fetch (#37, Builder 4)", () => {
1886+describe("abso fetch and run --fetch (#37)", () => {
18241887 const MAKE = [
18251888 "const fs = require('fs');",
18261889 "fs.mkdirSync('out', { recursive: true });",
Lines 1927–1933 at 318 (were 1864–1870 at 32)
18641927 );
18651928 });
18661929
1867− it("screens the box's paths as a sync's: nothing outside the folder, in .git, or a link", async () => {
1930+ it("screens the box's paths as a pull's: nothing outside the folder, in .git, or a link", async () => {
18681931 const { folders } = await project({ "make.js": `${MAKE}\n` }, "alice");
18691932 const alice = folders.alice!;
18701933 writeFileSync(join(alice, ".absoignore"), `${read(alice, ".absoignore")}out/\n`);
Lines 1950–1963 at 318 (were 1887–1900 at 32)
18871950 });
18881951});
18891952
1890−describe("recording first says what was deleted (#37, Builder 2)", () => {
1953+describe("recording first says what was deleted (#37)", () => {
18911954 it("names deletions as deletions", async () => {
18921955 const { folders } = await project({ "a.txt": "a\n", "gone1.ts": "x\n", "gone2.ts": "y\n" }, "alice", "bob");
18931956 const alice = folders.alice!;
18941957 rmSync(join(alice, "gone1.ts"));
18951958 rmSync(join(alice, "gone2.ts"));
18961959 write(alice, { "a.txt": "a2\n" });
1897− const synced = await main(["sync"], { cwd: alice, env: ENV, write: () => {} });
1960+ const synced = await main(["pull"], { cwd: alice, env: ENV, write: () => {} });
18981961 assert.match(synced.stdout, /^Recorded first: 1 changed \(a\.txt\), 2 deleted \(gone1\.ts, gone2\.ts\)\.\n/);
18991962 write(alice, { "a.txt": "a3\n" });
19001963 assert.match(
Lines 1967–1973 at 318 (were 1904–1910 at 32)
19041967 });
19051968});
19061969
1907−describe("abso export and status --short (#37, Playtester 1)", () => {
1970+describe("abso export and status --short (#37)", () => {
19081971 const FILES = { "index.html": "<p>v0</p>\n", "src/game.ts": "game v0\n", "src/old.ts": "old\n" };
19091972 const listAll = (dir: string): string[] =>
19101973 readdirSync(dir, { recursive: true, withFileTypes: true })
Lines 1975–1996 at 318 (were 1912–1933 at 32)
19121975 .map((e) => relative(dir, join(e.parentPath, e.name)).split(sep).join("/"))
19131976 .sort();
19141977
1915− it("writes one published version to its own folder, stamped, and leaves the folder and the agent alone", async () => {
1978+ it("writes one pushed version to its own folder, stamped, and leaves the folder and the agent alone", async () => {
19161979 const { folders } = await project(FILES, "alice", "tester");
19171980 write(folders.alice!, { "src/game.ts": "game v1\n", "src/new.ts": "new\n" });
19181981 rmSync(join(folders.alice!, "src", "old.ts"));
1919− assert.equal((await avcs(folders.alice!, "publish", "-m", "v1")).exit, 0);
1982+ assert.equal((await avcs(folders.alice!, "push", "-m", "v1")).exit, 0);
19201983 write(folders.alice!, { "src/game.ts": "game v2\n" });
1921− assert.equal((await avcs(folders.alice!, "publish", "-m", "v2")).exit, 0);
1984+ assert.equal((await avcs(folders.alice!, "push", "-m", "v2")).exit, 0);
19221985 const tester = folders.tester!;
1923− write(tester, { "index.html": "<p>mine, unpublished</p>\n" });
1986+ write(tester, { "index.html": "<p>mine, unpushed</p>\n" });
19241987 const out = join(temp(), "build");
19251988 const one = await avcs(tester, "export", out, "--version", "1");
19261989 assert.equal(one.exit, 0, one.out);
19271990 assert.equal(one.json.version, 1);
19281991 assert.deepEqual(listAll(out), [".abso-export", ".absoignore", "index.html", "src/game.ts", "src/new.ts"]);
19291992 assert.equal(read(out, "src/game.ts"), "game v1\n");
1930− assert.equal(read(out, "index.html"), "<p>v0</p>\n", "published files, not the unpublished edit");
1993+ assert.equal(read(out, "index.html"), "<p>v0</p>\n", "pushed files, not the unpushed edit");
19311994 // One line, no extension: the exported project's own formatter has nothing to say about it.
19321995 const stamp = read(out, ".abso-export");
19331996 assert.equal(stamp.split("\n").length, 2, stamp);
Lines 2019–2028 at 318 (were 1956–1965 at 32)
19562019 assert.equal(existsSync(join(out, "stray.txt")), false);
19572020 assert.equal(read(out, "src/game.ts"), "game v2\n");
19582021 // The folder is untouched, and so is the agent: still on version 0 with its unpublished edit.
1959− assert.equal(read(tester, "index.html"), "<p>mine, unpublished</p>\n");
2022+ assert.equal(read(tester, "index.html"), "<p>mine, unpushed</p>\n");
19602023 assert.equal(read(tester, "src/game.ts"), "game v0\n");
19612024 const short = await main(["status", "--short"], { cwd: tester, env: ENV, write: () => {} });
1962− assert.equal(short.stdout, "0+unpublished\n");
2025+ assert.equal(short.stdout, "0+unpushed\n");
19632026 });
19642027
19652028 it("refuses a folder with other files in it, and one inside the abso folder that abso would record", async () => {
Lines 2042–2057 at 318 (were 1979–1994 at 32)
19792042 assert.equal(read(folders.alice!, "build/src/game.ts"), "game v0\n");
19802043 });
19812044
1982− it("status --short is the version alone when the folder holds nothing unpublished", async () => {
2045+ it("status --short is the version alone when the folder holds nothing unpushed", async () => {
19832046 const { folders } = await project(FILES, "alice", "bob");
19842047 write(folders.alice!, { "src/game.ts": "game v1\n" });
1985− assert.equal((await avcs(folders.alice!, "publish", "-m", "v1")).exit, 0);
2048+ assert.equal((await avcs(folders.alice!, "push", "-m", "v1")).exit, 0);
19862049 assert.equal((await main(["status", "--short"], { cwd: folders.alice!, env: ENV, write: () => {} })).stdout, "1\n");
19872050 assert.equal((await main(["status", "--short"], { cwd: folders.bob!, env: ENV, write: () => {} })).stdout, "0\n");
19882051 });
19892052});
19902053
1991−describe("a folder missing files its view has (#37, Artist 1)", () => {
2054+describe("a folder missing files its view has (#37)", () => {
19922055 const FILES = {
19932056 "src/main.ts": "main\n",
19942057 "src/state.ts": "state\n",
Lines 2062–2068 at 318 (were 1999–2005 at 32)
19992062 it("a join under an agent name the server already knows writes every file, not only what changed since", async () => {
20002063 const { name, folders } = await project(FILES, "alice", "bob");
20012064 write(folders.alice!, { "src/main.ts": "main v1\n" });
2002− assert.equal((await avcs(folders.alice!, "publish", "-m", "v1")).exit, 0);
2065+ assert.equal((await avcs(folders.alice!, "push", "-m", "v1")).exit, 0);
20032066 const again = temp();
20042067 const joined = await avcs(again, "join", name, "--agent", "bob", "--server", fake.url);
20052068 assert.equal(joined.exit, 0, joined.out);
Lines 2072–2078 at 318 (were 2009–2015 at 32)
20092072 assert.deepEqual((await avcs(again, "status")).json.missing, []);
20102073 });
20112074
2012− it("status names files the folder lacks, files marks them, and sync --full writes them", async () => {
2075+ it("status names files the folder lacks, files marks them, and pull --full writes them", async () => {
20132076 const { folders } = await project(FILES, "alice", "bob");
20142077 const bob = folders.bob!;
20152078 // What a partial join leaves: neither the file nor avcs's copy of it.
Lines 2083–2095 at 318 (were 2020–2032 at 32)
20202083 const status = await main(["status"], { cwd: bob, env: ENV, write: () => {} });
20212084 assert.match(
20222085 status.stdout,
2023− /Everything in this folder is recorded\.\nMissing from this folder though your view has them \(abso sync --full writes them; abso files lists them all\): src\/state\.ts, vite\.config\.ts\n/,
2086+ /Everything in this folder is recorded\.\nMissing from this folder though your view has them \(abso pull --full writes them; abso files lists them all\): src\/state\.ts, vite\.config\.ts\n/,
20242087 );
20252088 const listed = await main(["files"], { cwd: bob, env: ENV, write: () => {} });
20262089 assert.equal(
20272090 listed.stdout,
20282091 [
2029− "Your view holds 5 files: shared at version 0, with your unpublished changes. 2 of them are missing from this folder (abso sync --full writes them).",
2092+ "Your view holds 5 files: shared at version 0, with your unpushed changes. 2 of them are missing from this folder (abso pull --full writes them).",
20302093 ".absoignore",
20312094 "src/main.ts",
20322095 "src/state.ts (missing from this folder)",
Lines 2100–2107 at 318 (were 2037–2044 at 32)
20372100 );
20382101 assert.deepEqual((await avcs(bob, "files", "src/**")).json.files, ["src/main.ts", "src/state.ts"]);
20392102 // A plain sync has nothing new to send; --full writes them.
2040− assert.equal((await avcs(bob, "sync")).json.written.length, 0);
2041− const full = await avcs(bob, "sync", "--full");
2103+ assert.equal((await avcs(bob, "pull")).json.written.length, 0);
2104+ const full = await avcs(bob, "pull", "--full");
20422105 assert.deepEqual(full.json.written.sort(), ["src/state.ts", "vite.config.ts"]);
20432106 assert.equal(read(bob, "vite.config.ts"), "vite\n");
20442107 const after = await avcs(bob, "status");
Lines 2109–2128 at 318 (were 2046–2065 at 32)
20462109 assert.deepEqual(after.json.unrecorded, []);
20472110 });
20482111
2049− it("a file deleted and not yet recorded is not called missing, and sync --full leaves the deletion alone", async () => {
2112+ it("a file deleted and not yet recorded is not called missing, and pull --full leaves the deletion alone", async () => {
20502113 const { folders } = await project(FILES, "alice", "bob");
20512114 rmSync(join(folders.bob!, "tools", "play.mjs"));
20522115 const status = await avcs(folders.bob!, "status");
20532116 assert.deepEqual(status.json.missing, []);
20542117 assert.deepEqual(status.json.unrecorded, ["tools/play.mjs"]);
2055− await avcs(folders.bob!, "sync", "--full");
2056− assert.equal(existsSync(join(folders.bob!, "tools", "play.mjs")), false, "sync records the deletion first");
2118+ await avcs(folders.bob!, "pull", "--full");
2119+ assert.equal(existsSync(join(folders.bob!, "tools", "play.mjs")), false, "pull records the deletion first");
20572120 });
20582121
20592122 it("files --draft shared --version N lists shared's files at that version", async () => {
20602123 const { folders } = await project(FILES, "alice", "bob");
20612124 write(folders.alice!, { "src/new.ts": "new\n" });
2062− assert.equal((await avcs(folders.alice!, "publish", "-m", "new")).exit, 0);
2125+ assert.equal((await avcs(folders.alice!, "push", "-m", "new")).exit, 0);
20632126 assert.equal((await avcs(folders.bob!, "files", "--version", "0")).json.files.length, 5, "4 files and .absoignore");
20642127 const now = await main(["files", "--draft", "shared"], { cwd: folders.bob!, env: ENV, write: () => {} });
20652128 assert.match(now.stdout, /^shared at version 1 holds 6 files\.\n/);
Lines 2130–2154 at 318 (were 2067–2095 at 32)
20672130 });
20682131});
20692132
2070−describe("lines merged item by item at sync (#37, Engine c164c1a)", () => {
2071− it("names the merged line, so the agent reads it before publishing", async () => {
2133+describe("lines merged item by item at pull (#37)", () => {
2134+ it("names the merged line, so the agent reads it before pushing", async () => {
20722135 const { folders } = await project({ "src/main.ts": "const SYSTEMS = [input, physics, render];\n" }, "alice", "bob");
20732136 write(folders.bob!, { "src/main.ts": "const SYSTEMS = [input, physics, audio, render];\n" });
2074− assert.equal((await avcs(folders.bob!, "publish", "-m", "Audio system")).exit, 0);
2137+ assert.equal((await avcs(folders.bob!, "push", "-m", "Audio system")).exit, 0);
20752138 write(folders.alice!, { "src/main.ts": "const SYSTEMS = [input, physics, render, hud];\n" });
2076− const synced = await main(["sync"], { cwd: folders.alice!, env: ENV, write: () => {} });
2139+ const synced = await main(["pull"], { cwd: folders.alice!, env: ENV, write: () => {} });
20772140 assert.match(
20782141 synced.stdout,
2079− /\nMerged 1 line that both you and bob changed, item by item\. Check it reads right, then publish:\n {2}src\/main\.ts line 1, with bob's version 1 \("Audio system"\): const SYSTEMS = \[[^\]]*\];\n/,
2142+ /\nMerged 1 line that both you and bob changed, item by item\. Check it reads right, then push:\n {2}src\/main\.ts line 1, with bob's version 1 \("Audio system"\): const SYSTEMS = \[[^\]]*\];\n/,
20802143 );
20812144 const text = read(folders.alice!, "src/main.ts");
20822145 assert.match(text, /audio/);
20832146 assert.match(text, /hud/);
2084− assert.equal(
2085− (await avcs(folders.alice!, "publish", "-m", "hud")).exit,
2086− 0,
2087− "a merged line does not hold up a publish",
2088− );
2147+ assert.equal((await avcs(folders.alice!, "push", "-m", "hud")).exit, 0, "a merged line does not hold up a push");
20892148 });
20902149});
20912150
2092−describe("a failing publish --check says whose it is (#36, Builder 6)", () => {
2151+describe("a failing push --check says whose it is (#36)", () => {
20932152 const CHECK =
20942153 "const fs = require('fs'); const t = fs.readFileSync('state.txt', 'utf8') + fs.readFileSync('mine.txt', 'utf8'); process.exit(t.includes('bad') ? 1 : 0);\n";
20952154
Lines 2159–2167 at 318 (were 2100–2108 at 32)
21002159 "bob",
21012160 );
21022161 write(folders.bob!, { "state.txt": "bad, by bob\n" });
2103− assert.equal((await avcs(folders.bob!, "publish", "-m", "Bob breaks the test")).exit, 0);
2162+ assert.equal((await avcs(folders.bob!, "push", "-m", "Bob breaks the test")).exit, 0);
21042163 write(folders.alice!, { "a.txt": "a by alice\n" });
2105− const theirs = await main(["publish", "-m", "mine", "--check", "node check.cjs"], {
2164+ const theirs = await main(["push", "-m", "mine", "--check", "node check.cjs"], {
21062165 cwd: folders.alice!,
21072166 env: ENV,
21082167 write: () => {},
Lines 2174–2182 at 318 (were 2115–2123 at 32)
21152174 );
21162175 // bob fixes it; now alice's own draft is what breaks it.
21172176 write(folders.bob!, { "state.txt": "ok again\n" });
2118− assert.equal((await avcs(folders.bob!, "publish", "-m", "Bob fixes it")).exit, 0);
2177+ assert.equal((await avcs(folders.bob!, "push", "-m", "Bob fixes it")).exit, 0);
21192178 write(folders.alice!, { "mine.txt": "bad, by alice\n" });
2120− const mine = await main(["publish", "-m", "mine", "--check", "node check.cjs"], {
2179+ const mine = await main(["push", "-m", "mine", "--check", "node check.cjs"], {
21212180 cwd: folders.alice!,
21222181 env: ENV,
21232182 write: () => {},
Lines 2198–2268 at 318 (were 2139–2175 at 32)
21392198 };
21402199 const publish = async (cwd: string, ...more: string[]) => {
21412200 let err = "";
2142− const r = await main(["publish", ...more], { cwd, env: QENV, write: () => {}, writeErr: (t) => (err += t) });
2201+ const r = await main(["push", ...more], { cwd, env: QENV, write: () => {}, writeErr: (t) => (err += t) });
21432202 return { ...r, err };
21442203 };
21452204
2146− it("publish waits for its publish to land, or to be pulled with the check's output", async () => {
2205+ it("push waits for its push to land, or to be turned back with the check's output", async () => {
21472206 const { folders } = await project(files, "alice", "bob");
21482207 write(folders.alice!, { "state.txt": "ok, by alice\n" });
21492208 const landed = await publish(folders.alice!, "-m", "fine");
21502209 assert.equal(landed.exit, 0, landed.stdout + landed.stderr);
21512210 assert.equal(
21522211 landed.stdout,
2153− "Recorded first: 1 changed (state.txt).\nPublished version 1: it passed the project's check in the merge queue.\n",
2212+ "Recorded first: 1 changed (state.txt).\nPushed version 1: it passed the project's check in the merge queue.\n",
21542213 );
21552214 assert.match(
21562215 landed.err,
2157− /^abso: Queued as publish 1: it lands once the project's check passes on it in the merge queue\. Waiting up to 100 s for it \(--no-wait returns at once\)\.\n/,
2216+ /^abso: Queued as push 1: it lands once the project's check passes on it in the merge queue\. Waiting up to 100 s for it \(--no-wait returns at once\)\.\n/,
21582217 );
21592218 assert.doesNotMatch(landed.stdout, /landed as version/, "the outcome is said once, not again as news");
21602219
2161− await avcs(folders.bob!, "sync");
2220+ await avcs(folders.bob!, "pull");
21622221 write(folders.bob!, { "state.txt": "bad, by bob\n" });
21632222 const pulled = await publish(folders.bob!, "-m", "breaks it");
21642223 assert.equal(pulled.exit, 2, pulled.stdout + pulled.stderr);
21652224 assert.equal(
21662225 pulled.stdout,
2167− `Recorded first: 1 changed (state.txt).\nNot published: your queued publish "breaks it" was pulled: the project's check failed on it on top of version 1. Its changes are still in your draft; fix them, then publish again.\n`,
2226+ `Recorded first: 1 changed (state.txt).\nNot pushed: your queued push "breaks it" was turned back: the project's check failed on it on top of version 1. Its changes are still in your draft; fix them, then push again.\n`,
21682227 );
21692228 assert.equal((await avcs(folders.bob!, "status")).json.version, 1, "shared stayed at version 1");
21702229 });
21712230
2172− it("--no-wait and --wait, status shows the queue, unqueue takes it back, and a collision names the queued publish", async () => {
2231+ it("--done takes the start note back only once the queued push lands", async () => {
2232+ const { folders } = await project(files, "alice");
2233+ const noted = async () =>
2234+ /Starting on:/.test((await main(["where"], { cwd: folders.alice!, env: QENV, write: () => {} })).stdout);
2235+ assert.equal((await avcs(folders.alice!, "start", "Two", "other.txt")).exit, 0);
2236+ fake.queueHold = true;
2237+ try {
2238+ write(folders.alice!, { "other.txt": "two\n" });
2239+ const queued = await publish(folders.alice!, "-m", "two", "--no-wait", "--done");
2240+ assert.equal(queued.exit, 0, queued.stdout + queued.stderr);
2241+ assert.match(
2242+ queued.stdout,
2243+ /\nYour start note stays \(--done\): push 1 hasn't landed yet\. Once it has, abso start --done takes the note back and abso issue <N> --done closes the issue it names\.\n$/,
2244+ );
2245+ assert.equal(await noted(), true, "a queued push may yet be turned back");
2246+ assert.equal((await main(["unqueue"], { cwd: folders.alice!, env: QENV, write: () => {} })).exit, 0);
2247+ } finally {
2248+ fake.queueHold = false;
2249+ }
2250+ write(folders.alice!, { "state.txt": "bad\n" });
2251+ const pulled = await publish(folders.alice!, "-m", "breaks it", "--done");
2252+ assert.equal(pulled.exit, 2, pulled.stdout + pulled.stderr);
2253+ assert.doesNotMatch(pulled.stdout, /start note/);
2254+ assert.equal(await noted(), true, "a pulled push leaves the note");
2255+ write(folders.alice!, { "state.txt": "ok, fixed\n" });
2256+ const landed = await publish(folders.alice!, "-m", "fixed", "--done");
2257+ assert.equal(landed.exit, 0, landed.stdout + landed.stderr);
2258+ assert.match(
2259+ landed.stdout,
2260+ /\nPushed version 1: it passed the project's check in the merge queue\.\nYour start note is taken back \(--done\): this work is finished\.\n$/,
2261+ );
2262+ assert.equal(await noted(), false);
2263+ });
2265+ it("--no-wait and --wait, status shows the queue, unqueue takes it back, and a collision names the queued push", async () => {
21732266 const { folders } = await project(files, "alice", "bob");
21742267 fake.queueHold = true;
21752268 try {
Lines 2271–2310 at 318 (were 2178–2197 at 32)
21782271 assert.equal(queued.exit, 0, queued.stdout + queued.stderr);
21792272 assert.match(
21802273 queued.stdout,
2181− /^Recorded first: 1 changed \(other\.txt\)\.\nQueued as publish 1: it lands once the project's check passes on it in the merge queue\.\nNot waiting \(--no-wait\)\. The outcome comes as news on your next edit; abso status shows the queue, and abso unqueue takes it back\.\n$/,
2274+ /^Recorded first: 1 changed \(other\.txt\)\.\nQueued as push 1: it lands once the project's check passes on it in the merge queue\.\nNot waiting \(--no-wait\)\. The outcome comes as news on your next edit; abso status shows the queue, and abso unqueue takes it back\.\n$/,
21822275 );
21832276 const status = await main(["status"], { cwd: folders.alice!, env: QENV, write: () => {} });
21842277 assert.match(status.stdout, /\nMerge queue: waiting: yours \(1\)\.\n/);
21852278 assert.equal(
21862279 (await main(["status", "--short"], { cwd: folders.alice!, env: QENV, write: () => {} })).stdout,
2187− "0+unpublished+queued\n",
2280+ "0+unpushed+queued\n",
21882281 );
2282+ // waiting --mine lists it beside the asks (an Issues stand-in with none open).
2283+ const stub = createHttpServer((_req, res) =>
2284+ res.writeHead(200, { "content-type": "application/json" }).end('{"asks":[]}'),
2285+ );
2286+ await new Promise<void>((ok) => stub.listen(0, "127.0.0.1", ok));
2287+ try {
2288+ const issuesUrl = `http://127.0.0.1:${(stub.address() as AddressInfo).port}`;
2289+ const waiting = await main(["waiting", "--mine"], {
2290+ cwd: folders.alice!,
2291+ env: { ...QENV, AVCS_ISSUES_SERVER: issuesUrl },
2292+ write: () => {},
2293+ });
2294+ assert.equal(waiting.exit, 0, waiting.stdout + waiting.stderr);
2295+ assert.match(
2296+ waiting.stdout,
2297+ /^Your push 1 \("two"\) is in the merge queue: [^\n]+\.\nIt lands or is turned back once the project's check runs on it; the outcome comes as news, and abso unqueue takes it back\.\nNo open asks of alice\.\n$/,
2298+ );
2299+ } finally {
2300+ await new Promise((ok) => stub.close(ok));
2301+ }
21892302
21902303 // bob changes the same line: refused at once, naming the queued publish, not a version.
21912304 write(folders.bob!, { "other.txt": "two, by bob\n" });
21922305 const refused = await publish(folders.bob!, "-m", "mine");
21932306 assert.equal(refused.exit, 2);
2194− assert.match(refused.stdout, /theirs, by alice in queued publish 1 \(not landed yet\) \("two"\)/);
2307+ assert.match(refused.stdout, /theirs, by alice in queued push 1 \(not landed yet\) \("two"\)/);
21952308 assert.match(refused.stdout, /\nSome of theirs are still in the merge queue, not in shared: once they land/);
21962309
21972310 write(folders.alice!, { "state.txt": "ok again\n" });
Lines 2312–2327 at 318 (were 2199–2217 at 32)
21992312 assert.equal(still.exit, 3, still.stdout + still.stderr);
22002313 assert.match(
22012314 still.stdout,
2202− /^Recorded first: 1 changed \(state\.txt\)\.\nStill queued after 1 s: publish 2 is waiting, 1 publish ahead of it\. The outcome comes as news/,
2315+ /^Recorded first: 1 changed \(state\.txt\)\.\nStill queued after 1 s: push 2 is waiting, 1 push ahead of it\. The outcome comes as news/,
22032316 );
22042317 assert.match(
22052318 still.err,
2206− /^abso: Queued as publish 2, 1 publish ahead of it: [^\n]*\nabso: your publish is waiting, 1 publish ahead of it\.\n/,
2319+ /^abso: Queued as push 2, 1 push ahead of it: [^\n]*\nabso: your push is waiting, 1 push ahead of it\.\n/,
22072320 );
22082321
22092322 const back = await main(["unqueue"], { cwd: folders.alice!, env: QENV, write: () => {} });
22102323 assert.equal(back.exit, 0, back.stdout + back.stderr);
2211− assert.equal(
2212− back.stdout,
2213− "Took back queued publishes 1, 2: their changes are still in your draft, unpublished.\n",
2214− );
2324+ assert.equal(back.stdout, "Took back queued pushes 1, 2: their changes are still in your draft, unpushed.\n");
22152325 const none = await main(["unqueue"], { cwd: folders.alice!, env: QENV, write: () => {} });
22162326 assert.equal(none.exit, 1);
22172327 assert.match(none.stderr, /alice has nothing queued/);
Lines 2331–2357 at 318 (were 2221–2247 at 32)
22212331 });
22222332
22232333 it("a pull puts the check's output first and the verdict last", () => {
2224− const news = `Your queued publish "breaks it" was pulled: the project's check failed on it on top of version 1:\n== check\n== check exited 1\n. Its changes are still in your draft.`;
2334+ const news = `Your queued push "breaks it" was turned back: the project's check failed on it on top of version 1:\n== check\n== check exited 1\n. Its changes are still in your draft.`;
22252335 assert.equal(
22262336 pulledText(news),
2227− `The check's output ends:\n== check\n== check exited 1\nNot published: your queued publish "breaks it" was pulled: the project's check failed on it on top of version 1. Its changes are still in your draft; fix them, then publish again.`,
2337+ `The check's output ends:\n== check\n== check exited 1\nNot pushed: your queued push "breaks it" was turned back: the project's check failed on it on top of version 1. Its changes are still in your draft; fix them, then push again.`,
22282338 );
22292339 assert.equal(
22302340 pulledText(
2231− 'Your queued publish "x" was pulled: it builds on queued publish 3, which was pulled. Its changes are still in your draft.',
2341+ 'Your queued push "x" was turned back: it builds on queued push 3, which was turned back. Its changes are still in your draft.',
22322342 ),
2233− 'Not published: your queued publish "x" was pulled: it builds on queued publish 3, which was pulled. Its changes are still in your draft; fix them, then publish again.',
2343+ 'Not pushed: your queued push "x" was turned back: it builds on queued push 3, which was turned back. Its changes are still in your draft; fix them, then push again.',
22342344 );
22352345 });
22362346
2237− it("--check alone skipped for a queue that is only in the draft says the publish landed directly, unchecked", async () => {
2347+ it("--check alone skipped for a queue that is only in the draft says the push landed directly, unchecked", async () => {
22382348 const { folders } = await project({ "avcs.json": '{"check": "node -e 0"}\n', "a.txt": "a\n" }, "alice");
22392349 write(folders.alice!, { "avcs.json": '{"check": "node -e 0", "queue": true}\n' });
22402350 const r = await publish(folders.alice!, "-m", "turn the queue on", "--check");
22412351 assert.equal(r.exit, 0, r.stdout + r.stderr);
22422352 assert.match(
22432353 r.stdout,
2244− /\nPublished version 1\.\nIt landed directly, with no check: your avcs\.json says "queue": true, but shared's doesn't yet, so the merge queue isn't on and --check alone was skipped\./,
2354+ /\nPushed version 1\.\nIt landed directly, with no check: your avcs\.json says "queue": true, but shared's doesn't yet, so the merge queue isn't on and --check alone was skipped\./,
22452355 );
22462356 });
22472357
Lines 2364–2370 at 318 (were 2254–2260 at 32)
22542364 assert.equal(fake.runStarts.length, startsBefore, "no box run");
22552365 assert.match(
22562366 r.stdout,
2257− /^Recorded first: 1 changed \(other\.txt\)\.\nThe merge queue runs the project's check on what lands, so --check alone was skipped\.\nPublished version 1: /,
2367+ /^Recorded first: 1 changed \(other\.txt\)\.\nThe merge queue runs the project's check on what lands, so --check alone was skipped\.\nPushed version 1: /,
22582368 );
22592369 });
22602370});
Lines 2377–2384 at 318 (were 2267–2274 at 32)
22672377 // Another process holding the lock, as a long sync would.
22682378 const holder = spawn(process.execPath, ["-e", "setTimeout(() => {}, 20000)"]);
22692379 try {
2270− // Renewed a minute ago, and its process runs: held (AVCS - Security).
2271− writeFileSync(lock, JSON.stringify({ pid: holder.pid, time: Date.now() - 60_000, what: "sync" }));
2380+ // Renewed a minute ago, and its process runs: held.
2381+ writeFileSync(lock, JSON.stringify({ pid: holder.pid, time: Date.now() - 60_000, what: "pull" }));
22722382 write(root, { "a.txt": "two\n" });
22732383 process.env.AVCS_LOCK_WAIT_MS = "200";
22742384 const blocked = await main(["record"], { cwd: root, env: ENV, write: () => {} });
Lines 2386–2392 at 318 (were 2276–2282 at 32)
22762386 assert.match(
22772387 blocked.stderr,
22782388 new RegExp(
2279− `another abso command \\(sync, process ${holder.pid}, since [0-9:]+ UTC\\) is changing this folder's records; run this again when it has finished\\. If none is running, delete \\.avcs/lock\\.`,
2389+ `another abso command \\(pull, process ${holder.pid}, since [0-9:]+ UTC\\) is changing this folder's records; run this again when it has finished\\. If none is running, delete \\.avcs/lock\\.`,
22802390 ),
22812391 );
22822392 const hooked = await hook(root, "Write", { file_path: join(root, "a.txt"), content: "two\n" });
Lines 2410–2419 at 318 (were 2300–2309 at 32)
23002410
23012411 it("the mod's check: a lock renewed in the last 2 minutes is held, and so is one it can't read", () => {
23022412 const now = Date.parse("2026-10-07T04:00:00Z");
2303− assert.equal(lockHeld(JSON.stringify({ pid: 1, time: now - 5_000, what: "sync" }), now), true);
2304− assert.equal(lockHeld(JSON.stringify({ pid: 1, time: now - 100_000, what: "sync" }), now), true);
2413+ assert.equal(lockHeld(JSON.stringify({ pid: 1, time: now - 5_000, what: "pull" }), now), true);
2414+ assert.equal(lockHeld(JSON.stringify({ pid: 1, time: now - 100_000, what: "pull" }), now), true);
23052415 assert.equal(
2306− lockHeld(JSON.stringify({ pid: 1, time: now - 3 * 60_000, what: "sync" }), now),
2416+ lockHeld(JSON.stringify({ pid: 1, time: now - 3 * 60_000, what: "pull" }), now),
23072417 false,
23082418 "not renewed: left behind",
23092419 );
Lines 2422–2428 at 318 (were 2312–2318 at 32)
23122422 assert.equal(lockHeld(undefined, now), false);
23132423 });
23142424
2315− it("two takers never both hold it: an unreadable lock is held until old, and one not renewed is taken over whatever its pid (AVCS - Git Lessons)", async () => {
2425+ it("two takers never both hold it: an unreadable lock is held until old, and one not renewed is taken over whatever its pid", async () => {
23162426 const { folders } = await project({ "a.txt": "one\n" }, "alice");
23172427 const root = folders.alice!;
23182428 const lock = join(root, ".avcs", "lock");
Lines 2438–2444 at 318 (were 2328–2334 at 32)
23282438 letGo();
23292439 assert.equal(existsSync(lock), false);
23302440 // A running process's id (this one's), but not renewed for 3 minutes: left behind, as when a pid is reused.
2331− writeFileSync(lock, JSON.stringify({ pid: process.pid, time: Date.now() - 3 * 60_000, what: "sync" }));
2441+ writeFileSync(lock, JSON.stringify({ pid: process.pid, time: Date.now() - 3 * 60_000, what: "pull" }));
23322442 const again = tryFolderLock(root, "hook");
23332443 assert.ok(again);
23342444 again();
Lines 2451–2457 at 318 (were 2341–2347 at 32)
23412451});
23422452
23432453describe("files the server keeps whole (#46, found in the #56 import rehearsal)", () => {
2344− it("are recorded after init, and a sync brings another agent's change to one", async () => {
2454+ it("are recorded after init, and a pull brings another agent's change to one", async () => {
23452455 const files = {
23462456 "avcs.json": '{"whole": ["package-lock.json", "logs/**"]}\n',
23472457 "package-lock.json": '{\n "v": 1\n}\n',
Lines 2467–2475 at 318 (were 2357–2365 at 32)
23572467
23582468 write(folders.bob!, { "package-lock.json": '{\n "v": 2\n}\n' });
23592469 assert.deepEqual((await avcs(folders.bob!, "status")).json.unrecorded, ["package-lock.json"]);
2360− const published = await main(["publish", "-m", "lock two"], { cwd: folders.bob!, env: ENV, write: () => {} });
2470+ const published = await main(["push", "-m", "lock two"], { cwd: folders.bob!, env: ENV, write: () => {} });
23612471 assert.equal(published.exit, 0, published.stdout + published.stderr);
2362− const synced = await main(["sync"], { cwd: folders.alice!, env: ENV, write: () => {} });
2472+ const synced = await main(["pull"], { cwd: folders.alice!, env: ENV, write: () => {} });
23632473 assert.equal(synced.exit, 0, synced.stderr);
23642474 assert.equal(
23652475 readFileSync(join(folders.alice!, "package-lock.json"), "utf8"),
Lines 2493–2501 at 318 (were 2383–2391 at 32)
23832493 const { folders } = await project({ "a.ts": "one\ntwo\nthree\n" }, "alice", "bob");
23842494 assert.equal((await run(folders.alice!, "start", "Sign-in", "a.ts")).exit, 0);
23852495 write(folders.alice!, { "a.ts": "one\ntwo, checked\nthree\n" });
2386− assert.equal((await run(folders.alice!, "publish", "-m", "check two")).exit, 0);
2496+ assert.equal((await run(folders.alice!, "push", "-m", "check two")).exit, 0);
23872497 write(folders.alice!, { "a.ts": "one\ntwo, checked\nthree, too\n" });
2388− assert.equal((await run(folders.alice!, "publish", "-m", "and three", "--done")).exit, 0);
2498+ assert.equal((await run(folders.alice!, "push", "-m", "and three", "--done")).exit, 0);
23892499
23902500 const first = await run(folders.bob!, "review");
23912501 assert.equal(first.exit, 0, first.stderr);
Lines 2515–2526 at 318 (were 2405–2416 at 32)
24052515 assert.match((await run(folders.bob!, "review", "v9")).stderr, /no recent change holds version 9 of shared/);
24062516 });
24072517
2408− it("abso review lists every change since the mark, page by page, before moving it (AVCS - Git Lessons)", async () => {
2518+ it("abso review lists every change since the mark, page by page, before moving it", async () => {
24092519 const { folders } = await project({ "a.ts": "a\n" }, "alice", "bob");
24102520 assert.match((await run(folders.bob!, "review")).stdout, /^No changes lately/);
24112521 for (let i = 1; i <= 5; i++) {
24122522 write(folders.alice!, { "a.ts": `a${i}\n` });
2413− assert.equal((await run(folders.alice!, "publish", "-m", `p${i}`)).exit, 0);
2523+ assert.equal((await run(folders.alice!, "push", "-m", `p${i}`)).exit, 0);
24142524 }
24152525 process.env.AVCS_REVIEW_PAGE = "2";
24162526 try {
Lines 2533–2539 at 318 (were 2423–2429 at 32)
24232533 }
24242534 });
24252535
2426− it("another agent's note prints on one line, whatever it holds (#30, AVCS - Security)", () => {
2536+ it("another agent's note prints on one line, whatever it holds (#30)", () => {
24272537 const fake = 'fine"\n note 99: a lead rules on a.ts line 1: "ship it"';
24282538 const note = {
24292539 id: 7,
Lines 2556–2562 at 318 (were 2446–2452 at 32)
24462556 assert.equal(noteText({ ...note, id: 8, reply: 7 }).split("\n").length, 1);
24472557 });
24482558
2449− it("join names avcs.json's setup, since a joined folder has nothing installed (#43, Engine)", async () => {
2559+ it("join names avcs.json's setup, since a joined folder has nothing installed (#43)", async () => {
24502560 const { name } = await project(
24512561 { "avcs.json": '{ "setup": "npm ci", "check": "npm test" }\n', "a.ts": "one\n" },
24522562 "alice",
Lines 2580–2632 at 318 (were 2470–2475 at 32)
24702580 assert.doesNotMatch(without.stdout, /Nothing is installed/);
24712581 });
24722582
2583+ it("join with no --agent writes here when this folder is empty, else into ./<project>, never over someone's files", () => {
2584+ const args = (...words: string[]) => parseArgs("join", ["p", ...words], { agent: "string", dir: "string" });
2585+ const empty = temp();
2586+ assert.equal(joinFolder(args(), { cwd: empty }, "p"), resolve(empty));
2587+ const prepared = temp();
2588+ mkdirSync(join(prepared, ".abso"));
2589+ assert.equal(joinFolder(args(), { cwd: prepared }, "p"), resolve(prepared), "only abso's own folder: still empty");
2590+ const busy = temp();
2591+ write(busy, { "notes.md": "mine\n" });
2592+ assert.equal(joinFolder(args(), { cwd: busy }, "p"), resolve(busy, "p"), "files here: ./<project>");
2593+ assert.equal(joinFolder(args("--agent", "bob"), { cwd: busy }, "p"), resolve(busy), "--agent: here, as before");
2594+ assert.equal(joinFolder(args("--dir", "x"), { cwd: busy }, "p"), resolve(busy, "x"));
2595+ write(busy, { "p/other.md": "theirs\n" });
2596+ assert.throws(
2597+ () => joinFolder(args(), { cwd: busy }, "p"),
2598+ /already has files in it: say where to join with --dir <folder>/,
2599+ );
2600+ });
2602+ it("join --agent joins a folder prepared with abso key install --server where it is, and sends that key", async () => {
2603+ const KEY = "abso_sk_prepared-before-join-0123456789";
2604+ const keyed = await startFake(0, KEY);
2605+ try {
2606+ const seed = temp();
2607+ write(seed, { "a.ts": "one\n" });
2608+ const env = { ...ENV, AVCS_TOKEN: KEY };
2609+ const init = await main(["init", "--server", keyed.url, "--project", "prep", "--agent", "alice"], {
2610+ cwd: seed,
2611+ env,
2612+ write: () => {},
2613+ });
2614+ assert.equal(init.exit, 0, init.stderr);
2615+ const dir = temp();
2616+ installKey(dir, JSON.stringify({ key: KEY, id: "k_0123abcd" }), keyed.url);
2617+ const joined = await main(["join", "prep", "--agent", "bob", "--server", keyed.url], {
2618+ cwd: dir,
2619+ env: { ...ENV, AVCS_TOKEN: "not-the-key" },
2620+ write: () => {},
2621+ });
2622+ assert.equal(joined.exit, 0, joined.stderr);
2623+ assert.equal(read(dir, "a.ts"), "one\n", "joined here, not in ./prep");
2624+ assert.doesNotMatch(joined.stdout, /^cd /m);
2625+ } finally {
2626+ await keyed.close();
2627+ }
2628+ });
24732630 it("gives a call more time by what it sends: 1 s per 100 KB over the base (abso issue 34)", () => {
24742631 assert.equal(timeoutFor(30_000, undefined), 30_000);
24752632 assert.equal(timeoutFor(30_000, "{}"), 30_000);
Lines 2666–2672 at 318 (were 2509–2515 at 32)
25092666 }
25102667 });
25112668
2512− it("waits for a publish and a land as long as the server may work on them, past the base timeout", async () => {
2669+ it("waits for a push and a land as long as the server may work on them, past the base timeout", async () => {
25132670 assert.ok(PUBLISH_TIMEOUT_MS > 120_000, "longer than the server's 2 minutes for one request");
25142671 // Every answer comes after 300 ms; the client's base timeout here is 100 ms.
25152672 const slow = createHttpServer((_req, res) => {
Lines 2688–2694 at 318 (were 2531–2537 at 32)
25312688 }
25322689 });
25332690
2534− it("lists a change by its message's first line, and an import's commit as a short hash (#43, Git Lessons)", () => {
2691+ it("lists a change by its message's first line, and an import's commit as a short hash (#43)", () => {
25352692 const imported =
25362693 "Issues' own Worker: the skeleton\n\nA long body\nover lines.\n\ngit ad107af03b56, Alex Rivera, 2026-10-07T14:00:00-05:00";
25372694 assert.equal(titleLine(imported), `"Issues' own Worker: the skeleton" (git ad107af)`);
Lines 2702–2709 at 318 (were 2545–2552 at 32)
25452702 it("abso note leaves a note on the lines as your folder shows them, and replies and closing work", async () => {
25462703 const { folders } = await project({ "a.ts": "one\ntwo\nthree\n" }, "alice", "bob");
25472704 write(folders.alice!, { "a.ts": "one\ntwo, by alice\nthree\n" });
2548− assert.equal((await run(folders.alice!, "publish", "-m", "two")).exit, 0);
2549− await run(folders.bob!, "sync");
2705+ assert.equal((await run(folders.alice!, "push", "-m", "two")).exit, 0);
2706+ await run(folders.bob!, "pull");
25502707 // bob's own unpublished edit puts two lines on top: his line 4 is shared's line 2.
25512708 write(folders.bob!, { "a.ts": "zero\nzero again\none\ntwo, by alice\nthree\n" });
25522709 const noted = await run(folders.bob!, "note", "a.ts:4", "the state isn't checked", "--object");
Lines 2792–2802 at 318 (were 2635–2645 at 32)
26352792 inputSchema: { properties: Record<string, unknown> };
26362793 }[];
26372794 const names = tools.map((t) => t.name);
2638− for (const name of ["status", "log", "diff", "why", "publish", "check_ignore", "unqueue"])
2795+ for (const name of ["status", "log", "diff", "why", "push", "check_ignore", "unqueue"])
26392796 assert.ok(names.includes(name), name);
26402797 for (const name of ["run", "shot", "init", "hook", "drop"])
26412798 assert.ok(!names.includes(name), `${name} stays in the shell`);
2642− assert.ok("message" in tools.find((t) => t.name === "publish")!.inputSchema.properties);
2799+ assert.ok("message" in tools.find((t) => t.name === "push")!.inputSchema.properties);
26432800
26442801 write(folders.alice!, { "a.txt": "two\n" });
26452802 const status = await server.call("tools/call", { name: "status", arguments: {} });
Lines 2808–2817 at 318 (were 2651–2660 at 32)
26512808 assert.equal(JSON.parse(asJson.result.content[0].text).command, "status");
26522809
26532810 const published = await server.call("tools/call", {
2654− name: "publish",
2811+ name: "push",
26552812 arguments: { message: "two, through MCP" },
26562813 });
2657− assert.match(published.result.content[0].text, /Published version 1\./);
2814+ assert.match(published.result.content[0].text, /Pushed version 1\./);
26582815 const shown = await server.call("tools/call", { name: "show", arguments: { args: ["1"] } });
26592816 assert.match(shown.result.content[0].text, /^version 1 of shared by alice, [0-9 :-]+ UTC: two, through MCP\n/);
26602817 const bad = await server.call("tools/call", { name: "show", arguments: { args: ["nope"] } });
Lines 2824–2840 at 318 (were 2667–2683 at 32)
26672824 });
26682825
26692826 it("turns a tool call into the command line, flags first and the words after --", () => {
2670− assert.deepEqual(argvFor("publish", { message: "why", "as-is": true, check: "", args: [] }), [
2671− "publish",
2827+ assert.deepEqual(argvFor("push", { message: "why", "as-is": true, check: "", args: [] }), [
2828+ "push",
26722829 "--message=why",
26732830 "--as-is",
26742831 "--check=",
26752832 ]);
26762833 assert.deepEqual(argvFor("log", { args: ["-weird.txt"], limit: "3" }), ["log", "--limit=3", "--", "-weird.txt"]);
2677− // An input can't add a flag of its own: a value stays one entry, and a free word comes after -- (AVCS - Security).
2678− const argv = argvFor("publish", { message: "--server=x", args: ["--server=x"] });
2679− assert.deepEqual(argv, ["publish", "--message=--server=x", "--", "--server=x"]);
2680− const parsed = parseArgs("publish", argv.slice(1), commandTable().publish!.flags);
2834+ // An input can't add a flag of its own: a value stays one entry, and a free word comes after --.
2835+ const argv = argvFor("push", { message: "--server=x", args: ["--server=x"] });
2836+ assert.deepEqual(argv, ["push", "--message=--server=x", "--", "--server=x"]);
2837+ const parsed = parseArgs("push", argv.slice(1), commandTable().push!.flags);
26812838 assert.equal(parsed.flags.get("message"), "--server=x");
26822839 assert.deepEqual(parsed.positionals, ["--server=x"]);
26832840 });
Lines 2886–2911 at 318 (were 2729–2751 at 32)
27292886 it("abso login, box and logout outside a folder act on https://api.abso.dev", () => {
27302887 const outside = mkdtempSync(join(tmpdir(), "abso-login-"));
27312888 try {
2732− assert.equal(boxServer(parseArgs("login", [], { server: "string" }), { cwd: outside }), "https://api.abso.dev");
2889+ assert.equal(
2890+ boxServer(parseArgs("login", [], { server: "string" }), { cwd: outside, env: {} }),
2891+ "https://api.abso.dev",
2892+ );
27332893 const given = parseArgs("login", ["--server", "https://example.test"], { server: "string" });
2734− assert.equal(boxServer(given, { cwd: outside }), "https://example.test");
2894+ assert.equal(boxServer(given, { cwd: outside, env: {} }), "https://example.test");
27352895 } finally {
27362896 rmSync(outside, { recursive: true, force: true });
27372897 }
27382898 });
27392899
2740− it("publish --done takes the start note back once it is published", async () => {
2900+ it("push --done takes the start note back once it is pushed", async () => {
27412901 const { folders } = await project({ "a.txt": "one\n" }, "alice");
27422902 assert.equal((await avcs(folders.alice!, "start", "Two", "a.txt")).exit, 0);
27432903 write(folders.alice!, { "a.txt": "two\n" });
2744− const r = await main(["publish", "-m", "two", "--done"], { cwd: folders.alice!, env: ENV, write: () => {} });
2904+ const r = await main(["push", "-m", "two", "--done"], { cwd: folders.alice!, env: ENV, write: () => {} });
27452905 assert.equal(r.exit, 0, r.stdout + r.stderr);
27462906 assert.match(
27472907 r.stdout,
2748− /\nPublished version 1\.\nYour start note is taken back \(--done\): this work is finished\.\n$/,
2908+ /\nPushed version 1\.\nYour start note is taken back \(--done\): this work is finished\.\n$/,
27492909 );
27502910 assert.doesNotMatch(
27512911 (await main(["where"], { cwd: folders.alice!, env: ENV, write: () => {} })).stdout,
Lines 2914–2947 at 318 (were 2754–2787 at 32)
27542914 });
27552915});
27562916
2757−describe("a publish whose answer is lost (Cloud: a storage reset after the publish landed)", () => {
2758− it("looks at shared before saying it failed, and never publishes again by itself", async () => {
2917+describe("a push whose answer is lost (a storage reset after the push landed)", () => {
2918+ it("looks at shared before saying it failed, and never pushes again by itself", async () => {
27592919 const { folders } = await project({ "a.txt": "a\n" }, "alice");
27602920 write(folders.alice!, { "a.txt": "b\n" });
27612921 fake.failPublish = "after";
2762− const landed = await main(["publish", "-m", "lands anyway"], { cwd: folders.alice!, env: ENV, write: () => {} });
2922+ const landed = await main(["push", "-m", "lands anyway"], { cwd: folders.alice!, env: ENV, write: () => {} });
27632923 assert.equal(landed.exit, 0, landed.stdout + landed.stderr);
27642924 assert.match(
27652925 landed.stdout,
2766− /\nPublished version 1\. The server's answer was lost \(POST \/a\/alice\/publish answered 500: Internal error in Durable Object storage caused object to be reset\.?\), but shared's log shows your publish landed\.\n$/,
2926+ /\nPushed version 1\. The server's answer was lost \(POST \/a\/alice\/publish answered 500: Internal error in Durable Object storage caused object to be reset\.?\), but shared's log shows your push landed\.\n$/,
27672927 );
27682928
27692929 write(folders.alice!, { "a.txt": "c\n" });
27702930 fake.failPublish = "before";
2771− const lost = await main(["publish", "-m", "never landed"], { cwd: folders.alice!, env: ENV, write: () => {} });
2931+ const lost = await main(["push", "-m", "never landed"], { cwd: folders.alice!, env: ENV, write: () => {} });
27722932 assert.equal(lost.exit, 1);
27732933 assert.match(
27742934 lost.stdout,
2775− /\nNot published: POST \/a\/alice\/publish answered 500: [^\n]*\. Shared's newest versions and the merge queue don't have it, so it's safe to publish again\.\n$/,
2935+ /\nNot pushed: POST \/a\/alice\/publish answered 500: [^\n]*\. Shared's newest versions and the merge queue don't have it, so it's safe to push again\.\n$/,
27762936 );
2777− assert.equal((await avcs(folders.alice!, "status")).json.version, 1, "nothing was published again by itself");
2937+ assert.equal((await avcs(folders.alice!, "status")).json.version, 1, "nothing was pushed again by itself");
27782938 // The same message as an earlier publish doesn't count when it's an older version: only this attempt's.
2779− assert.equal((await avcs(folders.alice!, "publish", "-m", "never landed")).exit, 0);
2939+ assert.equal((await avcs(folders.alice!, "push", "-m", "never landed")).exit, 0);
27802940 });
27812941});
27822942
27832943describe("a server that can't be reached (#37, GAME - UI/UX)", () => {
2784− it("tries a connection that never opened once more, and says nothing reached the server and how far publish got", async () => {
2944+ it("tries a connection that never opened once more, and says nothing reached the server and how far push got", async () => {
27852945 const { folders } = await project({ "a.txt": "a\n" }, "alice");
27862946 write(folders.alice!, { "a.txt": "b\n" });
27872947 // A port nothing listens on: the connection is refused before any request goes out.
Lines 2956–2966 at 318 (were 2796–2806 at 32)
27962956 assert.equal(status.exit, 1);
27972957 assert.match(
27982958 status.stderr,
2799− /could not reach http:\/\/127\.0\.0\.1:\d+: .*Tried twice, the second time IPv4 first; the connection never opened, so nothing reached the server\n$/,
2959+ /Can't reach http:\/\/127\.0\.0\.1:\d+: .*Tried twice, the second time IPv4 first; the connection never opened, so nothing reached the server\. Check your connection; abso doctor checks the rest\.\n$/,
28002960 );
2801− const plain = await main(["publish", "-m", "x"], { cwd: folders.alice!, env: ENV, write: () => {} });
2802− assert.match(plain.stderr, /nothing reached the server\. Nothing was published\. Run the same command again\.\n$/);
2803− const checked = await main(["publish", "-m", "x", "--check", "node -e 0"], {
2961+ const plain = await main(["push", "-m", "x"], { cwd: folders.alice!, env: ENV, write: () => {} });
2962+ assert.match(plain.stderr, /nothing reached the server\. Nothing was pushed\. Run the same command again\.\n$/);
2963+ const checked = await main(["push", "-m", "x", "--check", "node -e 0"], {
28042964 cwd: folders.alice!,
28052965 env: ENV,
28062966 write: () => {},
Lines 2968–2974 at 318 (were 2808–2814 at 32)
28082968 });
28092969 assert.match(
28102970 checked.stderr,
2811− /nothing reached the server\. Nothing was published, and the check didn't run\. Run the same command again\.\n$/,
2971+ /nothing reached the server\. Nothing was pushed, and the check didn't run\. Run the same command again\.\n$/,
28122972 );
28132973 });
28142974});
Lines 3010–3016 at 318 (were 2850–2856 at 32)
28503010 init.stdout,
28513011 /\nWrote abso.json: CI will run on every new version of shared \(setup "npm install", build "npm run build"\)\. Fill in check, out when the project has them\./,
28523012 );
2853− // Nothing to check or build: no abso.json, so CI has nothing to run and starts no boxes (#39, Agent VCS).
3013+ // Nothing to check or build: no abso.json, so CI has nothing to run and starts no boxes (#39).
28543014 const bare = temp();
28553015 write(bare, { "a.txt": "a\n", "package.json": JSON.stringify({ scripts: { start: "node a.js" } }) });
28563016 const off = await main(["init", "--server", fake.url, "--project", "guess-none", "--agent", "alice"], {
Lines 3022–3028 at 318 (were 2862–2868 at 32)
28623022 assert.equal(existsSync(join(bare, "abso.json")), false);
28633023 assert.match(
28643024 off.stdout,
2865− /\nNo abso.json written: package\.json gives no check or build to guess, so CI has nothing to run on each new version\. To give it a check, publish an abso.json like \{"check": "npm test"\}/,
3025+ /\nNo abso.json written: package\.json gives no check or build to guess, so CI has nothing to run on each new version\. To give it a check, push an abso.json like \{"check": "npm test"\}/,
28663026 );
28673027 // --as-is (an import, #58): the folder goes up exactly as it is, with nothing of avcs's own added.
28683028 const asIs = temp();
Lines 3038–3044 at 318 (were 2878–2884 at 32)
28783038 assert.doesNotMatch(imported.stdout, /Wrote|No avcs\.json written/);
28793039 });
28803040
2881− it("publish --check alone runs the check in the draft's avcs.json, wherever --check sits", async () => {
3041+ it("push --check alone runs the check in the draft's avcs.json, wherever --check sits", async () => {
28823042 const CHECK = "process.exit(require('fs').readFileSync('state.txt', 'utf8').includes('bad') ? 1 : 0);\n";
28833043 const { folders } = await project(
28843044 { "avcs.json": '{"check": "node check.cjs"}\n', "check.cjs": CHECK, "state.txt": "ok\n" },
Lines 3047–3053 at 318 (were 2887–2893 at 32)
28873047 write(folders.alice!, { "state.txt": "bad\n" });
28883048 let err = "";
28893049 const startsBefore = fake.runStarts.length;
2890− const bad = await main(["publish", "--check", "-m", "breaks it"], {
3050+ const bad = await main(["push", "--check", "-m", "breaks it"], {
28913051 cwd: folders.alice!,
28923052 env: ENV,
28933053 write: () => {},
Lines 3055–3061 at 318 (were 2895–2901 at 32)
28953055 });
28963056 assert.equal(bad.exit, 2, bad.stdout);
28973057 assert.match(err, /checking your draft on newest shared in the box: node check\.cjs\n/);
2898− // Each box run says what it is for, for the server's box-run records (#39, DevOps).
3058+ // Each box run says what it is for, for the server's box-run records (#39).
28993059 assert.deepEqual([...new Set(fake.runStarts.slice(startsBefore).map((r) => r.kind))], ["publish-check"]);
29003060 assert.equal(
29013061 (await main(["run", "node", "--version"], { cwd: folders.alice!, env: ENV, write: () => {}, writeErr: () => {} }))
Lines 3065–3071 at 318 (were 2905–2911 at 32)
29053065 assert.equal(fake.runStarts.at(-1)!.kind, "run");
29063066 // The draft's copy of avcs.json is the one that runs.
29073067 write(folders.alice!, { "avcs.json": '{"check": "node -e 0"}\n' });
2908− const ok = await main(["publish", "-m", "a new check", "--check"], {
3068+ const ok = await main(["push", "-m", "a new check", "--check"], {
29093069 cwd: folders.alice!,
29103070 env: ENV,
29113071 write: () => {},
Lines 3079–3085 at 318 (were 2919–2925 at 32)
29193079 "avcs.json": '{"build": "node build.cjs", "check": "node check.cjs"}\n',
29203080 });
29213081 err = "";
2922− const broken = await main(["publish", "-m", "breaks the build", "--check"], {
3082+ const broken = await main(["push", "-m", "breaks the build", "--check"], {
29233083 cwd: folders.alice!,
29243084 env: ENV,
29253085 write: () => {},
Lines 3089–3099 at 318 (were 2929–2939 at 32)
29293089 assert.match(err, /in the box: node build\.cjs && node check\.cjs\n/);
29303090 });
29313091
2932− it("publish --check alone refuses when there is no check to run", async () => {
3092+ it("push --check alone refuses when there is no check to run", async () => {
29333093 const { folders } = await project({ "a.txt": "a\n" }, "alice");
29343094 assert.equal(existsSync(join(folders.alice!, "avcs.json")), false, "nothing to guess: no avcs.json");
29353095 write(folders.alice!, { "a.txt": "b\n" });
2936− const missing = await main(["publish", "-m", "x", "--check"], {
3096+ const missing = await main(["push", "-m", "x", "--check"], {
29373097 cwd: folders.alice!,
29383098 env: ENV,
29393099 write: () => {},
Lines 3105–3111 at 318 (were 2945–2951 at 32)
29453105 /--check alone runs the project's check, but there is no abso.json\. Set "check" in abso.json/,
29463106 );
29473107 write(folders.alice!, { "avcs.json": '{"build": "", "check": ""}\n' });
2948− const none = await main(["publish", "-m", "x", "--check"], {
3108+ const none = await main(["push", "-m", "x", "--check"], {
29493109 cwd: folders.alice!,
29503110 env: ENV,
29513111 write: () => {},
Lines 3117–3137 at 318 (were 2957–2977 at 32)
29573117 /--check alone runs the project's check, but avcs\.json has no "check"\. Set "check" in avcs\.json/,
29583118 );
29593119 write(folders.alice!, { "avcs.json": '{"check": ' });
2960− const broken = await main(["publish", "-m", "x", "--check"], {
3120+ const broken = await main(["push", "-m", "x", "--check"], {
29613121 cwd: folders.alice!,
29623122 env: ENV,
29633123 write: () => {},
29643124 writeErr: () => {},
29653125 });
29663126 assert.match(broken.stdout + broken.stderr, /but avcs\.json isn't valid JSON/);
2967− assert.equal((await avcs(folders.alice!, "status")).json.version, 0, "nothing was published");
3127+ assert.equal((await avcs(folders.alice!, "status")).json.version, 0, "nothing was pushed");
29683128 });
29693129
29703130 it("status says whether shared is green or red, log marks shared versions, and abso ci shows a job (#39)", async () => {
29713131 const { name, folders } = await project({ "a.txt": "a\n" }, "alice", "bob");
29723132 for (const n of [1, 2, 3]) {
29733133 write(folders.bob!, { "a.txt": `a ${n}\n` });
2974− assert.equal((await avcs(folders.bob!, "publish", "-m", `step ${n}`)).exit, 0);
3134+ assert.equal((await avcs(folders.bob!, "push", "-m", `step ${n}`)).exit, 0);
29753135 }
29763136 const plain = await main(["status"], { cwd: folders.alice!, env: ENV, write: () => {} });
29773137 assert.doesNotMatch(plain.stdout, /Shared is|checked|Preview/, "a server without CI adds nothing");
Lines 3236–3242 at 318 (were 3076–3082 at 32)
30763236 "Not checked yet. Version 4 is being checked (35 s so far).",
30773237 ]);
30783238 assert.deepEqual(ciText({ ...base, checked: { version: 2, result: "none" }, running: null }, 3, now), [
3079− "CI couldn't check version 2 (the box failed twice, or abso.json has nothing to run). Versions after 2 aren't checked yet.",
3239+ "CI couldn't check version 2 (the box failed twice, or the pipeline file has nothing to run). Versions after 2 aren't checked yet.",
30803240 ]);
30813241 assert.deepEqual(
30823242 ciText({ ...base, running: null, red: { version: 1, agent: null, message: null, lastGood: null } }, 1, now),
Lines 3273–3285 at 318 (were 3113–3125 at 32)
31133273
31143274 it("an optional flag takes the next word unless it is another option or missing", () => {
31153275 const spec = { check: "optional", message: "string" } as const;
3116− assert.equal(parseArgs("publish", ["--check", "npm test", "-m", "x"], spec).flags.get("check"), "npm test");
3117− assert.equal(parseArgs("publish", ["--check", "-m", "x"], spec).flags.get("check"), "");
3118− assert.equal(parseArgs("publish", ["-m", "x", "--check"], spec).flags.get("check"), "");
3276+ assert.equal(parseArgs("push", ["--check", "npm test", "-m", "x"], spec).flags.get("check"), "npm test");
3277+ assert.equal(parseArgs("push", ["--check", "-m", "x"], spec).flags.get("check"), "");
3278+ assert.equal(parseArgs("push", ["-m", "x", "--check"], spec).flags.get("check"), "");
31193279 });
31203280});
31213281
3122−describe("run --fetch with a second glob given the wrong way (#37, Builder 5)", () => {
3282+describe("run --fetch with a second glob given the wrong way (#37)", () => {
31233283 it("refuses, naming the comma form, instead of running the glob as the command", async () => {
31243284 const { folders } = await project({ "a.txt": "a\n" }, "alice");
31253285 const runs = fake.runStarts.length;
Lines 3296–3302 at 318 (were 3136–3142 at 32)
31363296 });
31373297});
31383298
3139−describe("abso start names whose note it meets (#37, Builder 5)", () => {
3299+describe("abso start names whose note it meets (#37)", () => {
31403300 it("the closing line names the agent and their note, not only the list above it", async () => {
31413301 const { folders } = await project({ "src/ui/hud.ts": "hud\n", "src/ui/menu.ts": "menu\n" }, "builder2", "builder5");
31423302 assert.equal((await avcs(folders.builder2!, "start", "HUD polish", "src/ui/hud.ts")).exit, 0);
Lines 3314–3331 at 318 (were 3154–3171 at 32)
31543314 });
31553315});
31563316
3157−describe("Recorded first names new files on their own, in full (#37, Builder 7)", () => {
3158− it("a file a script made, which no hook saw, is listed as new at publish", async () => {
3317+describe("Recorded first names new files on their own, in full (#37)", () => {
3318+ it("a file a script made, which no hook saw, is listed as new at push", async () => {
31593319 const { folders } = await project({ "a.txt": "a\n" }, "alice");
31603320 write(folders.alice!, { "a.txt": "a, edited\n", "tests/made-by-a-script.test.ts": "test\n" });
3161− const r = await main(["publish", "-m", "x"], { cwd: folders.alice!, env: ENV, write: () => {} });
3321+ const r = await main(["push", "-m", "x"], { cwd: folders.alice!, env: ENV, write: () => {} });
31623322 assert.equal(r.exit, 0);
31633323 assert.match(r.stdout, /^Recorded first: 1 new \(tests\/made-by-a-script\.test\.ts\), 1 changed \(a\.txt\)\.\n/);
31643324 });
31653325});
31663326
31673327describe("CEO's roundup: --check without a prep, run --quiet, restore some lines (#37)", () => {
3168− it("restore <file>:<lines> puts back only the hunks that touch those lines (Builder 2)", async () => {
3328+ it("restore <file>:<lines> puts back only the hunks that touch those lines", async () => {
31693329 const base = "a\nb\nc\nd\ne\nf\ng\nh\n";
31703330 assert.deepEqual(restoreLines(base, "a\nB\nc\nd\ne\nf\nG\nh\n", 2, 2), {
31713331 text: "a\nb\nc\nd\ne\nf\nG\nh\n",
Lines 3375–3381 at 318 (were 3215–3221 at 32)
32153375 assert.equal(quiet.err, "err\n");
32163376 });
32173377
3218− it("news a run takes goes to stderr, not into the command output (Builder 3)", async () => {
3378+ it("news a run takes goes to stderr, not into the command output", async () => {
32193379 const { folders } = await project({ "a.txt": "a\n", "say.cjs": "console.log('out');\n" }, "alice", "bob");
32203380 assert.equal((await avcs(folders.bob!, "announce", "heads up")).exit, 0);
32213381 write(folders.alice!, { "a.txt": "a by alice\n" });
Lines 3388–3403 at 318 (were 3228–3243 at 32)
32283388 });
32293389 assert.equal(out, "out\n");
32303390 assert.equal(r.stdout, "");
3231− assert.match(r.stderr, /^News:\n {2}Announcement from bob \(as claimed\): heads up\n$/);
3391+ assert.match(r.stderr, /^News:\n {2}bob \(as claimed\) told you:\n {4}heads up\n$/);
32323392 });
32333393
3234− it("publish --check refuses when the box has no prep and the project has a package-lock (Builder 1)", async () => {
3394+ it("push --check refuses when the box has no prep and the project has a package-lock", async () => {
32353395 const { folders } = await project(
32363396 { "a.txt": "a\n", "package-lock.json": "{}\n", "ok.cjs": "process.exit(0);\n" },
32373397 "alice",
32383398 );
32393399 write(folders.alice!, { "a.txt": "a by alice\n" });
3240− const r = await main(["publish", "-m", "x", "--check", "node ok.cjs"], {
3400+ const r = await main(["push", "-m", "x", "--check", "node ok.cjs"], {
32413401 cwd: folders.alice!,
32423402 env: ENV,
32433403 write: () => {},
Lines 3406–3416 at 318 (were 3246–3256 at 32)
32463406 assert.equal(r.exit, 2);
32473407 assert.match(
32483408 r.stdout,
3249− /Not published: your box has no prep, so the check ran without node_modules and its result can't be trusted\. Run abso prep 'npm ci --ignore-scripts' once/,
3409+ /Not pushed: your box has no prep, so the check ran without node_modules and its result can't be trusted\. Run abso prep 'npm ci --ignore-scripts' once/,
32503410 );
3251− // Now the folder knows: the next --check refuses before running anything (#37, Artist 1).
3411+ // Now the folder knows: the next --check refuses before running anything (#37).
32523412 const runs = fake.runStarts.length;
3253− const again = await main(["publish", "-m", "x", "--check", "node ok.cjs"], {
3413+ const again = await main(["push", "-m", "x", "--check", "node ok.cjs"], {
32543414 cwd: folders.alice!,
32553415 env: ENV,
32563416 write: () => {},
Lines 3419–3429 at 318 (were 3259–3269 at 32)
32593419 assert.equal(again.exit, 2);
32603420 assert.match(
32613421 again.stdout,
3262− /Not published: your box has no prep, so a check would run without node_modules .*\(Nothing was run: this folder's last run in that box said it had no prep\.\)/,
3422+ /Not pushed: your box has no prep, so a check would run without node_modules .*\(Nothing was run: this folder's last run in that box said it had no prep\.\)/,
32633423 );
32643424 assert.equal(fake.runStarts.length, runs, "no run started");
32653425 // Another box, never heard of: it runs, as the first time.
3266− const other = await main(["publish", "-m", "x", "--check", "node ok.cjs", "--box", "b2"], {
3426+ const other = await main(["push", "-m", "x", "--check", "node ok.cjs", "--box", "b2"], {
32673427 cwd: folders.alice!,
32683428 env: ENV,
32693429 write: () => {},
Lines 3433–3447 at 318 (were 3273–3287 at 32)
32733433 });
32743434});
32753435
3276−describe("abso bisect and publish --check (Cloud d49759d, #37)", () => {
3436+describe("abso bisect and push --check (#37)", () => {
32773437 const CHECK = "const t = require('fs').readFileSync('state.txt', 'utf8'); process.exit(t.includes('bad') ? 1 : 0);\n";
32783438
32793439 it("bisect names the first failing version, its author and message", async () => {
32803440 const { folders } = await project({ "state.txt": "ok 0\n", "check.cjs": CHECK }, "alice", "bob");
32813441 const pub = async (who: string, text: string) => {
3282− await avcs(folders[who]!, "sync");
3442+ await avcs(folders[who]!, "pull");
32833443 write(folders[who]!, { "state.txt": text });
3284− assert.equal((await avcs(folders[who]!, "publish", "-m", text.trim())).exit, 0);
3444+ assert.equal((await avcs(folders[who]!, "push", "-m", text.trim())).exit, 0);
32853445 };
32863446 await pub("alice", "ok 1\n");
32873447 await pub("alice", "ok 2\n");
Lines 3469–3475 at 318 (were 3309–3315 at 32)
33093469 const { folders } = await project({ "state.txt": "ok 0\n", "check.cjs": SKIPPING }, "alice");
33103470 for (const s of states) {
33113471 write(folders.alice!, { "state.txt": `${s}\n` });
3312− assert.equal((await avcs(folders.alice!, "publish", "-m", s)).exit, 0);
3472+ assert.equal((await avcs(folders.alice!, "push", "-m", s)).exit, 0);
33133473 }
33143474 let err = "";
33153475 const r = await main(["bisect", "--", "node", "check.cjs"], {
Lines 3493–3505 at 318 (were 3333–3345 at 32)
33333493 );
33343494 });
33353495
3336− it("publish --check says when shared moved during the check, and paths the sync didn't write don't block it", async () => {
3496+ it("push --check says when shared moved during the check, and paths the pull didn't write don't block it", async () => {
33373497 const WAIT = "setTimeout(() => process.exit(0), 1500);\n";
33383498 const { folders } = await project({ "a.txt": "a\n", "b.txt": "b\n", "wait.cjs": WAIT }, "alice", "bob");
33393499 write(folders.alice!, { "a.txt": "a by alice\n" });
33403500 fake.injectSync = { files: { "../outside.txt": "x\n" } };
33413501 let err = "";
3342− const publishing = main(["publish", "-m", "alice", "--check", "node wait.cjs"], {
3502+ const publishing = main(["push", "-m", "alice", "--check", "node wait.cjs"], {
33433503 cwd: folders.alice!,
33443504 env: ENV,
33453505 write: () => {},
Lines 3509–3556 at 318 (were 3349–3396 at 32)
33493509 const started = fake.runStarts.length;
33503510 for (let i = 0; i < 200 && fake.runStarts.length === started; i++) await new Promise((r) => setTimeout(r, 10));
33513511 write(folders.bob!, { "b.txt": "b by bob\n" });
3352− assert.equal((await avcs(folders.bob!, "publish", "-m", "bob meanwhile")).exit, 0);
3512+ assert.equal((await avcs(folders.bob!, "push", "-m", "bob meanwhile")).exit, 0);
33533513 const r = await publishing;
33543514 assert.equal(r.exit, 0, r.stdout + err);
3355− assert.match(err, /abso: the sync didn't write these: \.\.\/outside\.txt; the check runs without them\./);
3515+ assert.match(err, /abso: the pull didn't write these: \.\.\/outside\.txt; the check runs without them\./);
33563516 assert.match(r.stdout, /\nShared moved during the check: version 1 merged in without being checked\.\n/);
33573517 });
33583518
3359− it("publish --check publishes only when the check passes on the draft with newest shared", async () => {
3519+ it("push --check pushes only when the check passes on the draft with newest shared", async () => {
33603520 const { folders } = await project({ "state.txt": "ok\n", "check.cjs": CHECK }, "alice");
33613521 write(folders.alice!, { "state.txt": "bad\n" });
3362− const refused = await main(["publish", "-m", "breaks it", "--check", "node check.cjs"], {
3522+ const refused = await main(["push", "-m", "breaks it", "--check", "node check.cjs"], {
33633523 cwd: folders.alice!,
33643524 env: ENV,
33653525 write: () => {},
33663526 writeErr: () => {},
33673527 });
33683528 assert.equal(refused.exit, 2);
3369− assert.match(refused.stdout, /Not published: the check failed \(exit 1\)/);
3529+ assert.match(refused.stdout, /Not pushed: the check failed \(exit 1\)/);
33703530 assert.equal((await avcs(folders.alice!, "log")).json.version, 0, "shared did not move");
33713531 write(folders.alice!, { "state.txt": "ok, better\n" });
3372− const ok = await main(["publish", "-m", "fine", "--check", "node check.cjs"], {
3532+ const ok = await main(["push", "-m", "fine", "--check", "node check.cjs"], {
33733533 cwd: folders.alice!,
33743534 env: ENV,
33753535 write: () => {},
33763536 writeErr: () => {},
33773537 });
33783538 assert.equal(ok.exit, 0, ok.stdout);
3379− assert.match(ok.stdout, /Published version 1\./);
3539+ assert.match(ok.stdout, /Pushed version 1\./);
33803540 });
33813541});
33823542
33833543describe("every command that takes news prints it (#37, News Report)", () => {
3384− it("sync and diff print the news their record took, --json carries it, a command that records nothing leaves it waiting, and it prints once", async () => {
3544+ it("pull and diff print the news their record took, --json carries it, a command that records nothing leaves it waiting, and it prints once", async () => {
33853545 const { folders } = await project({ "a.txt": "a\n", "b.txt": "b\n" }, "alice", "bob");
33863546 const [alice, bob] = [folders.alice!, folders.bob!];
33873547 const say = async (text: string) => assert.equal((await avcs(alice, "announce", text)).exit, 0);
33883548 await say("Ruling: playtest builds come from v40 only.");
33893549 write(bob, { "a.txt": "a by bob\n" });
3390− const synced = await main(["sync"], { cwd: bob, env: ENV, write: () => {} });
3550+ const synced = await main(["pull"], { cwd: bob, env: ENV, write: () => {} });
33913551 assert.match(
33923552 synced.stdout,
3393− /\nNews:\n {2}Announcement from alice \(as claimed\): Ruling: playtest builds come from v40 only\.\n$/,
3553+ /\nNews:\n {2}alice \(as claimed\) told you:\n {4}Ruling: playtest builds come from v40 only\.\n$/,
33943554 );
33953555 await say("Second ruling.");
33963556 write(bob, { "b.txt": "b by bob\n" });
Lines 3564–3607 at 318 (were 3404–3447 at 32)
34043564 assert.doesNotMatch(failed.stdout, /News/);
34053565 const recorded = await main(["record"], { cwd: bob, env: ENV, write: () => {} });
34063566 assert.equal(
3407− recorded.stdout.match(/Announcement from alice \(as claimed\): Third\./g)?.length,
3567+ recorded.stdout.match(/alice \(as claimed\) told you:\n {4}Third\./g)?.length,
34083568 1,
34093569 "printed once, not twice",
34103570 );
34113571 });
34123572});
34133573
3414−describe("wishlist: publish clarity, who, fix-eol, one-version hint (#37)", () => {
3415− it("an empty publish says shared already has the file and who changed it, not that work vanished (Artist 1)", async () => {
3574+describe("wishlist: push clarity, who, fix-eol, one-version hint (#37)", () => {
3575+ it("an empty push says shared already has the file and who changed it, not that work vanished", async () => {
34163576 const { folders } = await project({ "tools/look.mjs": "look\n" }, "artist", "builder2");
34173577 write(folders.builder2!, { "tools/look.mjs": "look --mute-audio\n" });
3418− assert.equal((await avcs(folders.builder2!, "publish", "-m", "Mute audio in look")).exit, 0);
3578+ assert.equal((await avcs(folders.builder2!, "push", "-m", "Mute audio in look")).exit, 0);
34193579 // The same change, made here before syncing: sync merges it away, and the draft is empty.
34203580 await edit(folders.artist!, "tools/look.mjs", "look\n", "look --mute-audio\n");
3421− assert.equal((await avcs(folders.artist!, "sync")).exit, 0);
3422− const r = await main(["publish", "-m", "mute"], { cwd: folders.artist!, env: ENV, write: () => {} });
3581+ assert.equal((await avcs(folders.artist!, "pull")).exit, 0);
3582+ const r = await main(["push", "-m", "mute"], { cwd: folders.artist!, env: ENV, write: () => {} });
34233583 assert.equal(r.exit, 0, r.stdout + r.stderr);
34243584 assert.match(
34253585 r.stdout,
3426− /Nothing published: shared already has the file you changed as you have it, so nothing of yours is lost\. Last changed in tools\/look\.mjs \(version 1, builder2: "Mute audio in look"\)\./,
3586+ /Nothing pushed: shared already has the file you changed as you have it, so nothing of yours is lost\. Last changed in tools\/look\.mjs \(version 1, builder2: "Mute audio in look"\)\./,
34273587 );
34283588 });
34293589
3430− it("who names the last change, the drafts, and the starting notes for a file (Artist 1)", async () => {
3590+ it("who names the last change, the drafts, and the starting notes for a file", async () => {
34313591 const { folders } = await project({ "a.txt": "a\n", "b.txt": "b\n" }, "alice", "bob");
34323592 write(folders.alice!, { "a.txt": "a1\n" });
3433− assert.equal((await avcs(folders.alice!, "publish", "-m", "alice a1")).exit, 0);
3593+ assert.equal((await avcs(folders.alice!, "push", "-m", "alice a1")).exit, 0);
34343594 write(folders.bob!, { "a.txt": "a by bob\n" });
34353595 assert.equal((await avcs(folders.bob!, "record")).exit, 0);
34363596 assert.equal((await avcs(folders.bob!, "start", "tidy the texts", "*.txt")).exit, 0);
34373597 const r = await main(["who", "a.txt", "b.txt"], { cwd: folders.alice!, env: ENV, write: () => {} });
34383598 assert.match(
34393599 r.stdout,
3440− /^a\.txt:\n {2}last changed in version 1 by alice, .*: alice a1\n {2}bob has unpublished changes at lines 1, last at .*\n {2}bob started "tidy the texts", .*\nb\.txt:\n {2}last changed in version 0 by .*\n {2}nobody has unpublished changes in it\n {2}bob started "tidy the texts"/,
3600+ /^a\.txt:\n {2}last changed in version 1 by alice, .*: alice a1\n {2}bob has unpushed changes at lines 1, last at .*\n {2}bob started "tidy the texts", .*\nb\.txt:\n {2}last changed in version 0 by .*\n {2}nobody has unpushed changes in it\n {2}bob started "tidy the texts"/,
34413601 );
34423602 });
34433603
3444− it("status says line-ending-only files in one line; fix-eol rewrites them and records nothing (Writer 1)", async () => {
3604+ it("status says line-ending-only files in one line; fix-eol rewrites them and records nothing", async () => {
34453605 const { folders } = await project({ "a.txt": "one\ntwo\n", "b.txt": "b\n" }, "alice");
34463606 writeFileSync(join(folders.alice!, "a.txt"), "one\r\ntwo\r\n");
34473607 writeFileSync(join(folders.alice!, "b.txt"), "b\r\n");
Lines 3617–3691 at 318 (were 3457–3463 at 32)
34573617 assert.deepEqual(after.json.unrecorded, []);
34583618 });
34593619
3460− it("several files marked against one version get one settle --theirs hint (Builder 6)", () => {
3620+ it("status skips reading files it found unchanged before, never trusts one changed too recently, and record still reads every file", async () => {
3621+ const { folders } = await project({ "a.txt": "a\n", "b.txt": "b\n", "c.txt": "c\r\n" }, "alice", "bob");
3622+ const root = folders.alice!;
3623+ const record = join(stateDir(root), "clean.json");
3624+ const old = new Date(Date.now() - 60_000);
3625+ // The file and its known copy a minute old, as after a quiet spell.
3626+ const age = (...rels: string[]) => {
3627+ for (const rel of rels) {
3628+ utimesSync(join(root, rel), old, old);
3629+ utimesSync(knownPath(root, rel), old, old);
3630+ }
3631+ };
3632+ // Changes a file without changing its size or time: only reading it can tell.
3633+ const swap = (rel: string, text: string) => {
3634+ const was = statSync(join(root, rel));
3635+ writeFileSync(join(root, rel), text);
3636+ utimesSync(join(root, rel), was.atime, was.mtime);
3637+ };
3638+ writeFileSync(join(root, "c.txt"), "c\r\n");
3640+ // Files too new to trust are read, and not kept: a swap is still caught. A time a minute ahead stays
3641+ // too new however long the run takes.
3642+ const soon = new Date(Date.now() + 60_000);
3643+ for (const rel of ["a.txt", "b.txt", "c.txt"]) utimesSync(join(root, rel), soon, soon);
3644+ assert.deepEqual((await avcs(root, "status")).json.unrecorded, []);
3645+ swap("a.txt", "A\n");
3646+ assert.deepEqual((await avcs(root, "status")).json.unrecorded, ["a.txt"]);
3647+ swap("a.txt", "a\n");
3649+ // Old files are kept after one status, and the next answers from the record without reading them.
3650+ age("a.txt", "b.txt", "c.txt");
3651+ const first = await avcs(root, "status");
3652+ assert.deepEqual(first.json.unrecorded, []);
3653+ assert.deepEqual(first.json.crlf, ["c.txt"]);
3654+ // .absoignore, written at init and never aged here, is kept too once the run so far took longer than RACY_MS.
3655+ const keptNames = Object.keys(JSON.parse(readFileSync(record, "utf8")).files).filter((k) => k !== ".absoignore");
3656+ assert.deepEqual(keptNames.sort(), ["a.txt", "b.txt", "c.txt"]);
3657+ swap("b.txt", "B\n");
3658+ const second = await avcs(root, "status");
3659+ assert.deepEqual(second.json.unrecorded, [], "b.txt was answered from the record");
3660+ assert.deepEqual(second.json.crlf, ["c.txt"]);
3661+ // What record sends is read from every file, whatever the record says.
3662+ assert.deepEqual([...unrecorded(root).files.keys()], ["b.txt"]);
3664+ // A record of an unknown format, or one that doesn't parse, is not used.
3665+ const kept = JSON.parse(readFileSync(record, "utf8"));
3666+ writeFileSync(record, JSON.stringify({ ...kept, format: 2 }));
3667+ assert.deepEqual((await avcs(root, "status")).json.unrecorded, ["b.txt"]);
3668+ writeFileSync(record, "not json");
3669+ assert.deepEqual((await avcs(root, "status")).json.unrecorded, ["b.txt"]);
3671+ // An edit that changes the size or time is read at once.
3672+ swap("b.txt", "b\n");
3673+ age("b.txt");
3674+ assert.deepEqual((await avcs(root, "status")).json.unrecorded, []);
3675+ writeFileSync(join(root, "b.txt"), "bb\n");
3676+ assert.deepEqual((await avcs(root, "status")).json.unrecorded, ["b.txt"]);
3678+ // A sync writes the file and its known copy, so what was kept for them no longer holds.
3679+ writeFileSync(join(root, "b.txt"), "b\n");
3680+ write(folders.bob!, { "a.txt": "a2\n" });
3681+ assert.equal((await avcs(folders.bob!, "push", "-m", "a2")).exit, 0);
3682+ assert.equal((await avcs(root, "pull")).exit, 0);
3683+ assert.equal(readFileSync(join(root, "a.txt"), "utf8"), "a2\n");
3684+ swap("a.txt", "a3\n");
3685+ assert.deepEqual((await avcs(root, "status")).json.unrecorded, ["a.txt"]);
3686+ });
3688+ it("several files marked against one version get one settle --theirs hint", () => {
34613689 const c = (file: string, version: number) => ({
34623690 kind: "lines" as const,
34633691 marked: true as const,
Lines 3712–3718 at 318 (were 3484–3490 at 32)
34843712 assert.equal(joined.exit, 0, joined.stdout + joined.stderr);
34853713 assert.match(
34863714 joined.stdout,
3487− /It is a reader: status, sync, log, show, files and export work, and nothing it does is recorded or published\./,
3715+ /It is a reader: status, pull, log, show, files and export work, and nothing it does is recorded or pushed\./,
34883716 );
34893717 assert.equal(read(dir, "a.txt"), "a\n");
34903718 // Edits: the command hook stands down, record and publish refuse here, sync skips its record step.
Lines 3720–3737 at 318 (were 3492–3509 at 32)
34923720 write(dir, { "notes.md": "mine\n" });
34933721 const recorded = await main(["record"], { cwd: dir, env: ENV, write: () => {} });
34943722 assert.equal(recorded.exit, 1);
3495− assert.match(recorded.stdout + recorded.stderr, /this folder is a reader: it records and publishes nothing/);
3496− assert.equal((await main(["publish", "-m", "x"], { cwd: dir, env: ENV, write: () => {} })).exit, 1);
3723+ assert.match(recorded.stdout + recorded.stderr, /this folder is a reader: it records and pushes nothing/);
3724+ assert.equal((await main(["push", "-m", "x"], { cwd: dir, env: ENV, write: () => {} })).exit, 1);
34973725 write(folders.alice!, { "a.txt": "a by alice\n" });
3498− assert.equal((await avcs(folders.alice!, "publish", "-m", "alice")).exit, 0);
3499− assert.equal((await avcs(dir, "sync")).exit, 0);
3726+ assert.equal((await avcs(folders.alice!, "push", "-m", "alice")).exit, 0);
3727+ assert.equal((await avcs(dir, "pull")).exit, 0);
35003728 const status = await avcs(dir, "status");
35013729 const rep = status.json.agents.find((a: { agent: string }) => a.agent === "rep");
35023730 assert.equal(rep.reader, true);
35033731 assert.equal(rep.draftChanges, 0, "nothing reached a draft");
35043732 assert.match(
35053733 (await main(["status"], { cwd: dir, env: ENV, write: () => {} })).stdout,
3506− /This folder is rep, a reader \(it records and publishes nothing\)/,
3734+ /This folder is rep, a reader \(it records and pushes nothing\)/,
35073735 );
35083736 assert.match(read(dir, ".avcs/hook.log"), /\tskipped: this folder is a reader\t/);
35093737 // The server refuses too, whatever the folder says.
Lines 3745–3779 at 318 (were 3517–3528 at 32)
35173745 assert.equal((await avcs(dir, "reader", "off")).exit, 0);
35183746 assert.equal(JSON.parse(read(dir, ".avcs/config.json")).reader, undefined);
35193747 write(dir, { "notes.md": "now recorded\n" });
3520− assert.equal((await avcs(dir, "publish", "-m", "rep writes")).exit, 0);
3748+ assert.equal((await avcs(dir, "push", "-m", "rep writes")).exit, 0);
35213749 });
35223750
3523− it("reader on is refused while the agent has unpublished work, and changes nothing here", async () => {
3751+ it("a reader talks: it announces, notes lines and closes notes, but still can't start or push (abso 682)", async () => {
3752+ const { name, folders } = await project({ "a.txt": "a\n" }, "alice");
3753+ const dir = temp();
3754+ const joined = await main(["join", name, "--agent", "rep", "--server", fake.url, "--reader"], {
3755+ cwd: dir,
3756+ env: ENV,
3757+ write: () => {},
3758+ });
3759+ assert.equal(joined.exit, 0, joined.stdout + joined.stderr);
3760+ // Talking: news to the other agents, and notes on lines, made and closed.
3761+ const said = await avcs(dir, "announce", "reader here");
3762+ assert.equal(said.exit, 0, said.out);
3763+ assert.deepEqual(said.json.to, ["alice"]);
3764+ const noted = await avcs(dir, "note", "a.txt:1", "why this line?");
3765+ assert.equal(noted.exit, 0, noted.out);
3766+ assert.equal((await avcs(dir, "note", "--close", String(noted.json.id), "--withdrawn")).exit, 0);
3767+ // Code: still refused.
3768+ const started = await main(["start", "reader work"], { cwd: dir, env: ENV, write: () => {} });
3769+ assert.match(started.stdout + started.stderr, /agent rep is a reader: it records nothing/);
3770+ assert.equal((await main(["push", "-m", "x"], { cwd: dir, env: ENV, write: () => {} })).exit, 1);
3771+ assert.equal((await avcs(folders.alice!, "news")).json.news.length > 0, true, "alice heard the reader");
3772+ });
3774+ it("reader on is refused while the agent has unpushed work, and changes nothing here", async () => {
35243775 const { folders } = await project({ "a.txt": "a\n" }, "alice");
3525− write(folders.alice!, { "a.txt": "a, unpublished\n" });
3776+ write(folders.alice!, { "a.txt": "a, unpushed\n" });
35263777 assert.equal((await avcs(folders.alice!, "record")).exit, 0);
35273778 const on = await main(["reader", "on"], { cwd: folders.alice!, env: ENV, write: () => {} });
35283779 assert.equal(on.exit, 2);
Lines 3837–3848 at 318 (were 3586–3597 at 32)
35863837 const { folders } = await project({ "a.txt": "a\n", "b.txt": "b\n" }, "alice", "bob");
35873838 const pub = async (who: string, file: string, text: string) => {
35883839 write(folders[who]!, { [file]: text });
3589− assert.equal((await avcs(folders[who]!, "publish", "-m", `${who} ${text.trim()}`)).exit, 0);
3590− await avcs(folders[who]!, "sync");
3840+ assert.equal((await avcs(folders[who]!, "push", "-m", `${who} ${text.trim()}`)).exit, 0);
3841+ await avcs(folders[who]!, "pull");
35913842 };
35923843 await pub("alice", "a.txt", "a1\n");
35933844 await pub("bob", "b.txt", "b1\n");
3594− await avcs(folders.alice!, "sync");
3845+ await avcs(folders.alice!, "pull");
35953846 await pub("alice", "a.txt", "a2\n");
35963847 await pub("alice", "b.txt", "b2\n");
35973848 const since = await avcs(folders.alice!, "log", "--since", "1");
Lines 3872–3878 at 318 (were 3621–3627 at 32)
36213872 });
36223873});
36233874
3624−describe("scratch files for a run (#37, Builder 6)", () => {
3875+describe("scratch files for a run (#37)", () => {
36253876 it("status says plainly that files recorded and then deleted never reach shared, not that they wait to be recorded", async () => {
36263877 const { folders } = await project({ "a.txt": "a\n" }, "alice");
36273878 const alice = folders.alice!;
Lines 3886–3892 at 318 (were 3635–3641 at 32)
36353886 const said = await main(["status"], { cwd: alice, env: ENV, write: () => {} });
36363887 assert.match(
36373888 said.stdout,
3638− /\nEverything in this folder is recorded\.\nAdded to your draft by an earlier record and deleted since, so they never reach shared; the next record \(sync, publish, run\) takes them out of your draft: _ab\/x\.ts, tools\/_perf\.sh\n/,
3889+ /\nEverything in this folder is recorded\.\nAdded to your draft by an earlier record and deleted since, so they never reach shared; the next record \(pull, push, run\) takes them out of your draft: _ab\/x\.ts, tools\/_perf\.sh\n/,
36393890 );
36403891 assert.equal((await avcs(alice, "record")).exit, 0);
36413892 assert.deepEqual((await avcs(alice, "diff")).json.files, [], "the next record clears the draft");
Lines 3996–4002 at 318 (were 3745–3751 at 32)
37453996 });
37463997});
37473998
3748−describe("files that differ from the record only in line endings (#37, Builder 2)", () => {
3999+describe("files that differ from the record only in line endings (#37)", () => {
37494000 it("run sends them with LF, as abso records them, and says so; status names them", async () => {
37504001 const probe = "process.stdout.write(JSON.stringify(require('fs').readFileSync('tools/prep.sh', 'utf8')));\n";
37514002 const { folders } = await project(
Lines 4037–4050 at 318 (were 3786–3799 at 32)
37864037});
37874038
37884039describe("ignored files an old edit mod put in the draft (#37, Reporter)", () => {
3789− it("sync and publish drop new ones from the draft and keep them on disk; a file shared has stays", async () => {
4040+ it("pull and push drop new ones from the draft and keep them on disk; a file shared has stays", async () => {
37904041 const { folders } = await project({ "a.txt": "a\n", "out/keep.txt": "keep\n" }, "alice");
37914042 const alice = folders.alice!;
37924043 // What a mod without nested ignore files does: the files reach the draft, then out/.avcsignore says "*".
37934044 write(alice, { "out/cards.mjs": "cards\n", "out/keep.txt": "keep, edited\n" });
37944045 assert.equal((await avcs(alice, "record")).exit, 0);
37954046 write(alice, { "out/.avcsignore": "# scratch\n*\n" });
3796− const synced = await main(["sync"], { cwd: alice, env: ENV, write: () => {} });
4047+ const synced = await main(["pull"], { cwd: alice, env: ENV, write: () => {} });
37974048 assert.match(
37984049 synced.stdout,
37994050 /Dropped from your draft, kept on disk \(your ignore rules leave it out; abso check-ignore says which line\): out\/cards\.mjs\n/,
Lines 4061–4067 at 318 (were 3810–3816 at 32)
38104061 rmSync(join(alice, "out", ".avcsignore"));
38114062 assert.equal((await avcs(alice, "record")).exit, 0);
38124063 write(alice, { "out/.avcsignore": "*\n" });
3813− const published = await avcs(alice, "publish", "-m", "keep");
4064+ const published = await avcs(alice, "push", "-m", "keep");
38144065 assert.equal(published.exit, 0, published.out);
38154066 const shown = await avcs(alice, "show", "1");
38164067 assert.deepEqual(shown.json.files, ["out/keep.txt"]);
Lines 4069–4075 at 318 (were 3818–3824 at 32)
38184069 });
38194070});
38204071
3821−describe("abso run undoes Git Bash's path rewriting (#37, Agent VCS)", () => {
4072+describe("abso run undoes Git Bash's path rewriting (#37)", () => {
38224073 // What cygpath -u answers on this machine's Git Bash, for the paths Git Bash made.
38234074 const MOUNTS: Record<string, string> = {
38244075 "W:/out": "/w/out",
Lines 4215–4236 at 318 (were 3964–3985 at 32)
39644215});
39654216
39664217describe("empty files", () => {
3967− it('are files: a Write of "" empties a file without deleting it, and sync brings empty files', async () => {
4218+ it('are files: a Write of "" empties a file without deleting it, and pull brings empty files', async () => {
39684219 const { name, folders } = await project({ "a.txt": "a\n" }, "alice", "bob");
39694220 const alice = folders.alice!;
39704221 assert.match((await put(alice, "new.txt", "")).outcome, /^sent/);
39714222 assert.match((await put(alice, "a.txt", "")).outcome, /^sent/);
39724223 assert.equal((await avcs(alice, "record")).json.sent, 0, "the hook kept the known copies in step");
3973− assert.equal((await avcs(alice, "publish", "-m", "empty two files")).exit, 0);
4224+ assert.equal((await avcs(alice, "push", "-m", "empty two files")).exit, 0);
39744225 assert.equal(shared(name)["a.txt"], "");
39754226 assert.equal(shared(name)["new.txt"], "");
39764227
39774228 const bob = folders.bob!;
3978− assert.equal((await avcs(bob, "sync")).exit, 0);
4229+ assert.equal((await avcs(bob, "pull")).exit, 0);
39794230 assert.equal(read(bob, "a.txt"), "");
39804231 assert.equal(read(bob, "new.txt"), "");
39814232 unlinkSync(join(bob, "new.txt"));
3982− assert.equal((await avcs(bob, "publish", "-m", "remove the empty file")).exit, 0);
4233+ assert.equal((await avcs(bob, "push", "-m", "remove the empty file")).exit, 0);
39834234 assert.equal("new.txt" in shared(name), false, "deleting an empty file removes it");
39844235 });
39854236});
Lines 4261–4267 at 318 (were 4010–4016 at 32)
40104261 assert.deepEqual(hosted.project.modes()["run.sh"], { exec: true });
40114262
40124263 const alice = folders.alice!;
4013− const synced = await avcs(alice, "sync");
4264+ const synced = await avcs(alice, "pull");
40144265 assert.equal(synced.exit, 0, synced.out);
40154266 assert.deepEqual(JSON.parse(read(alice, ".avcs/modes.json")), { "run.sh": { exec: true } });
40164267 if (process.platform !== "win32")
Lines 4277–4283 at 318 (were 4026–4032 at 32)
40264277 hosted.project.publish("bob", "link to a", Date.now());
40274278
40284279 const alice = folders.alice!;
4029− assert.equal((await avcs(alice, "sync")).exit, 0);
4280+ assert.equal((await avcs(alice, "pull")).exit, 0);
40304281 assert.equal(linkOnDisk(alice, "to-a"), "a.txt");
40314282 assert.equal((await avcs(alice, "record")).json.sent, 0, "the link (or its stand-in) matches what the server has");
40324283 const path = join(alice, "to-a");
Lines 4299–4305 at 318 (were 4048–4054 at 32)
40484299 writeFileSync(path, "b.txt");
40494300 }
40504301 writeFileSync(join(alice, "a.txt"), "a\n");
4051− assert.equal((await avcs(alice, "publish", "-m", "point the link at b")).exit, 0);
4302+ assert.equal((await avcs(alice, "push", "-m", "point the link at b")).exit, 0);
40524303 assert.deepEqual(hosted.project.modes()["to-a"], { link: "b.txt" });
40534304 assert.equal(shared(name)["a.txt"], "a\n");
40544305 });
Lines 4309–4317 at 318 (were 4058–4066 at 32)
40584309 }, async () => {
40594310 const { name, folders } = await project({ "a.txt": "a\n" }, "alice");
40604311 symlinkSync("a.txt", join(folders.alice!, "link"));
4061− assert.equal((await avcs(folders.alice!, "publish", "-m", "add a link")).exit, 0);
4062− assert.equal(shared(name)["link"], "");
4063− assert.deepEqual(fake.projects.get(name)!.project.modes()["link"], { link: "a.txt" });
4312+ assert.equal((await avcs(folders.alice!, "push", "-m", "add a link")).exit, 0);
4313+ assert.equal(shared(name).link, "");
4314+ assert.deepEqual(fake.projects.get(name)!.project.modes().link, { link: "a.txt" });
40644315 });
40654316
40664317 it("shows mode changes in diffs and attribute collisions in words", () => {
Lines 4338–4344 at 318 (were 4087–4093 at 32)
40874338});
40884339
40894340describe("diff, log, show and restore", () => {
4090− it("shows unpublished changes line by line, the versions, one version, and a file at a version", async () => {
4341+ it("shows unpushed changes line by line, the versions, one version, and a file at a version", async () => {
40914342 const { folders } = await project({ "a.txt": "one\ntwo\nthree\n", "b.txt": "b\n" }, "alice", "bob");
40924343 const alice = folders.alice!;
40934344 await edit(alice, "a.txt", "two\n", "TWO\n");
Lines 4358–4392 at 318 (were 4107–4118 at 32)
41074358 const text = await main(["diff", "a.txt"], { cwd: alice, env: ENV, write: () => {} });
41084359 assert.match(
41094360 text.stdout,
4110− /^Your unpublished changes to a\.txt in shared \(on version 0\): 1 file, 1 line added, 1 removed\.\n--- a\/a\.txt/,
4361+ /^Your unpushed changes to a\.txt in shared \(on version 0\): 1 file, 1 line added, 1 removed\.\n--- a\/a\.txt/,
41114362 );
41124363
4113− assert.equal((await avcs(alice, "publish", "-m", "alice: shout two, add c")).exit, 0);
4364+ // bob reviews alice's draft: what she recorded, read only.
4365+ const theirs = await main(["diff", "a.txt", "--agent", "alice"], { cwd: folders.bob!, env: ENV, write: () => {} });
4366+ assert.equal(theirs.exit, 0, theirs.stderr);
4367+ assert.match(
4368+ theirs.stdout,
4369+ /^alice's recorded, unpushed 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/,
4370+ );
4371+ assert.deepEqual((await avcs(folders.bob!, "diff", "--agent", "alice")).json.files.map((f: any) => f.path).sort(), [
4372+ "a.txt",
4373+ "c.txt",
4374+ ]);
4375+ assert.match(
4376+ (await main(["diff", "--agent", "bob"], { cwd: folders.bob!, env: ENV, write: () => {} })).stdout,
4377+ /^bob has no recorded, unpushed changes in shared/,
4378+ );
4379+ const nobody = await main(["diff", "--agent", "carol"], { cwd: folders.bob!, env: ENV, write: () => {} });
4380+ assert.notEqual(nobody.exit, 0);
4381+ assert.match(nobody.stderr, /there is no agent "carol"/);
4382+ assert.equal(
4383+ (await main(["diff", "0", "1", "--agent", "alice"], { cwd: folders.bob!, env: ENV, write: () => {} })).exit,
4384+ 1,
4385+ );
4387+ assert.equal((await avcs(alice, "push", "-m", "alice: shout two, add c")).exit, 0);
41144388 await edit(folders.bob!, "b.txt", "b\n", "b from bob\n");
4115− assert.equal((await avcs(folders.bob!, "publish", "-m", "bob: change b")).exit, 0);
4389+ assert.equal((await avcs(folders.bob!, "push", "-m", "bob: change b")).exit, 0);
41164390
41174391 const log = await avcs(alice, "log");
41184392 assert.equal(log.exit, 0, log.out);
Lines 4437–4443 at 318 (were 4163–4169 at 32)
41634437 );
41644438 const alice = folders.alice!;
41654439 write(alice, { "src/a.ts": "a2\n", "src/deep/b.ts": "b2\n", "top.txt": "y\n" });
4166− assert.equal((await avcs(alice, "publish", "-m", "change src and top")).exit, 0);
4440+ assert.equal((await avcs(alice, "push", "-m", "change src and top")).exit, 0);
41674441
41684442 const between = await avcs(alice, "diff", "0", "1", "src/", "test/", "nope/");
41694443 assert.deepEqual(between.json.files.map((f: any) => f.path).sort(), ["src/a.ts", "src/deep/b.ts"]);
Lines 4477–4483 at 318 (were 4203–4209 at 32)
42034477 const alice = folders.alice!;
42044478 await edit(alice, "a.txt", "a\n", "a in exp\n");
42054479 assert.equal((await avcs(alice, "switch", "-c", "exp")).exit, 0);
4206− assert.equal((await avcs(alice, "publish", "-m", "exp: a")).exit, 0);
4480+ assert.equal((await avcs(alice, "push", "-m", "exp: a")).exit, 0);
42074481 const inDraft = await avcs(alice, "log");
42084482 assert.equal(inDraft.json.draft, "exp");
42094483 assert.equal(inDraft.json.versions[0].message, "exp: a");
Lines 4523–4532 at 318 (were 4249–4258 at 32)
42494523}
42504524
42514525describe("renames that change only case", { skip: !caseInsensitiveDisk() && "this disk is case-sensitive" }, () => {
4252− it("records the rename, and a sync brings it in without deleting the file", async () => {
4526+ it("records the rename, and a pull brings it in without deleting the file", async () => {
42534527 const { name, folders } = await project({ "a.ts": "one\n", "b.ts": "b\n" }, "alice", "bob");
42544528 renameSync(join(folders.alice!, "a.ts"), join(folders.alice!, "A.ts"));
4255− assert.equal((await avcs(folders.alice!, "publish", "-m", "rename a.ts to A.ts")).exit, 0);
4529+ assert.equal((await avcs(folders.alice!, "push", "-m", "rename a.ts to A.ts")).exit, 0);
42564530 assert.deepEqual(Object.keys(shared(name)).sort(), [".absoignore", "A.ts", "b.ts"]);
42574531 assert.equal(
42584532 (await avcs(folders.alice!, "status")).json.unrecorded?.length ?? 0,
Lines 4534–4559 at 318 (were 4260–4285 at 32)
42604534 "nothing left to record after the rename",
42614535 );
42624536
4263− const synced = await avcs(folders.bob!, "sync");
4537+ const synced = await avcs(folders.bob!, "pull");
42644538 assert.equal(synced.exit, 0, synced.out);
42654539 assert.ok(
42664540 readdirSync(folders.bob!).includes("A.ts"),
42674541 `bob's folder has A.ts: ${readdirSync(folders.bob!).join(", ")}`,
42684542 );
42694543 assert.equal(read(folders.bob!, "A.ts"), "one\n");
4270− assert.equal((await avcs(folders.bob!, "record")).json.sent, 0, "the known copy matches after the sync");
4544+ assert.equal((await avcs(folders.bob!, "record")).json.sent, 0, "the known copy matches after the pull");
42714545 });
42724546});
42734547
42744548describe("one file whatever its spelling, and abso mv (#49)", () => {
4275− it("abso mv changes a file's case and moves a file, keeping its history, and others sync it in", async () => {
4549+ it("abso mv changes a file's case and moves a file, keeping its history, and others pull it in", async () => {
42764550 const { name, folders } = await project({ "readme.md": "one\ntwo\n", "src/a.ts": "a\n" }, "alice", "bob");
42774551 const run = (cwd: string, ...argv: string[]) => main(argv, { cwd, env: ENV, write: () => {} });
42784552 const cased = await run(folders.alice!, "mv", "readme.md", "README.md");
42794553 assert.equal(cased.exit, 0, cased.stderr);
42804554 assert.equal(
42814555 cased.stdout,
4282− "Moved readme.md to README.md in your draft; its lines keep their history. It reaches shared with your next publish.\n",
4556+ "Moved readme.md to README.md in your draft; its lines keep their history. It reaches shared with your next push.\n",
42834557 );
42844558 assert.ok(readdirSync(folders.alice!).includes("README.md"), readdirSync(folders.alice!).join(", "));
42854559 assert.equal((await run(folders.alice!, "mv", "src/a.ts", "lib/a.ts")).exit, 0);
Lines 4564–4574 at 318 (were 4290–4300 at 32)
42904564 0,
42914565 "nothing left to record: the moves are in the draft",
42924566 );
4293− assert.equal((await avcs(folders.alice!, "publish", "-m", "renames")).exit, 0);
4567+ assert.equal((await avcs(folders.alice!, "push", "-m", "renames")).exit, 0);
42944568 assert.deepEqual(Object.keys(shared(name)).sort(), [".absoignore", "README.md", "lib/a.ts"]);
42954569 // The lines kept their history: blame still names the init version.
42964570 assert.match((await run(folders.alice!, "blame", "README.md")).stdout, /\binit\b/);
4297− assert.equal((await avcs(folders.bob!, "sync")).exit, 0);
4571+ assert.equal((await avcs(folders.bob!, "pull")).exit, 0);
42984572 assert.ok(readdirSync(folders.bob!).includes("README.md"), readdirSync(folders.bob!).join(", "));
42994573 assert.equal(read(folders.bob!, "lib/a.ts"), "a\n");
43004574
Lines 4656–4667 at 318 (were 4382–4393 at 32)
43824656 await edit(folders.alice!, "src/a.txt", "two\n", "alice two\n");
43834657 const where = await main(["where"], { cwd: folders.bob!, env: ENV, write: () => {} });
43844658 assert.match(where.stdout, /src\/a\.txt\n {4}alice: lines 2, at shared lines 2; 1 change/);
4385− assert.equal((await avcs(folders.alice!, "publish", "-m", "alice changes two")).exit, 0);
4659+ assert.equal((await avcs(folders.alice!, "push", "-m", "alice changes two")).exit, 0);
43864660 await edit(folders.bob!, "src/a.txt", "two\n", "bob two\n");
4387− assert.equal((await avcs(folders.bob!, "publish", "-m", "bob changes two")).exit, 2);
4388− await avcs(folders.bob!, "sync");
4661+ assert.equal((await avcs(folders.bob!, "push", "-m", "bob changes two")).exit, 2);
4662+ await avcs(folders.bob!, "pull");
43894663 await put(folders.bob!, "src/a.txt", "one\nsettled two\nthree\n");
4390− assert.equal((await avcs(folders.bob!, "publish", "-m", "settle two")).exit, 0);
4664+ assert.equal((await avcs(folders.bob!, "push", "-m", "settle two")).exit, 0);
43914665
43924666 // From inside src/, the path is relative to where the command runs.
43934667 const inSrc = join(folders.alice!, "src");
Lines 4684–4690 at 318 (were 4410–4416 at 32)
44104684 assert.match(bad.stderr, /has 3 lines; ask for one in 1-3/);
44114685 assert.match(
44124686 (await main(["where"], { cwd: inSrc, env: ENV, write: () => {} })).stdout,
4413− /^Nobody has unpublished changes\. Shared is at version 2\./,
4687+ /^Nobody has unpushed changes\. Shared is at version 2\./,
44144688 );
44154689 });
44164690});
Lines 4733–4739 at 318 (were 4459–4465 at 32)
44594733 assert.equal(gitMarkerLine(mine), undefined, "abso's own blocks are settled with abso settle");
44604734 });
44614735
4462− it("record and publish say so, once, and still send the file", async () => {
4736+ it("record and push say so, once, and still send the file", async () => {
44634737 const { folders } = await project({ "a.txt": "a\n" }, "alice");
44644738 const dir = folders.alice!;
44654739 writeFileSync(join(dir, "a.txt"), "a\n<<<<<<< HEAD\nmine\n=======\ntheirs\n>>>>>>> feature\n");
Lines 4799–4805 at 318 (were 4525–4531 at 32)
45254799 credential: "abso_bx_secret",
45264800 id: "b_1",
45274801 expiresAt: Date.now() + 1e6,
4528− grant: { projects: [{ project: "p", role: "writer" }], max_agents: 1 },
4802+ grant: { projects: [{ project: "p", role: "writer" }] },
45294803 };
45304804 mkdirSync(join(home, ".avcs", "boxes"), { recursive: true });
45314805 writeBox(record as never, home);
MCP
compare on this site's /mcp
CLI
abso diff 32 318 client/test/client.test.ts --json
JSON
/christopher/abso-core/compare/32..318?file=client%2Ftest%2Fclient.test.ts&format=json