Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed
MCP
code on this site's /mcp
CLI
none: the JSON below is the answer
JSON
/christopher/abso-core/files/server/test/push.test.ts?version=160&format=json
68 linesspeed 100%Last change speed in version 150, 1 version changed it

You're reading version 160. The newest is 318, and 3 versions since then changed this file. Go to the newestCompare with 318

1import assert from "node:assert/strict";
2import { describe, it } from "node:test";
3import git from "isomorphic-git";
4import { absoVersion } from "../src/ingest.ts";
5import { MemoryFS } from "../src/memory-fs.ts";
6import { commitShared, projectOfRepo, readTreeFiles, repoName } from "../src/push.ts";
7
8describe("repo names", () => {
9 it("names a project's Artifacts repo abso-<project>, and back", () => {
10 assert.equal(repoName("game"), "abso-game");
11 assert.equal(repoName("my.site_2"), "abso-my.site_2");
12 assert.equal(projectOfRepo("abso-game"), "game");
13 assert.equal(projectOfRepo("avcs-game"), null);
14 assert.equal(projectOfRepo("abso-"), null);
15 });
17 it("reads the version a pushed commit carries, under either name", () => {
18 assert.equal(absoVersion("Fix it\n\nabso-version: 12\n"), 12);
19 assert.equal(absoVersion("Fix it\n\navcs-version: 7\n"), 7);
20 assert.equal(absoVersion("a person's own commit"), undefined);
21 });
22});
24describe("commitShared", () => {
25 it("writes shared as a commit with its modes, then only what changed", async () => {
26 const fs = new MemoryFS();
27 const dir = "/repo";
28 await git.init({ fs, dir, defaultBranch: "main" });
29 const noBlobs = () => null;
30 const first = await commitShared(
31 fs,
32 dir,
33 null,
34 {
35 version: 0,
36 files: { "a.txt": "one\n", "run.sh": "echo hi\n", link: "" },
37 modes: { "run.sh": { exec: true }, link: { link: "a.txt" } },
38 },
39 noBlobs,
40 );
41 assert.equal(first.changed, 3);
42 const commit = (await git.readCommit({ fs, dir, oid: first.commit })).commit;
43 assert.match(commit.message, /^Start the project\n\nabso-version: 0\n$/);
44 const { files } = await readTreeFiles(fs, dir, commit.tree);
45 assert.deepEqual(Object.fromEntries([...files].map(([p, f]) => [p, f.mode])), {
46 "a.txt": "100644",
47 link: "120000",
48 "run.sh": "100755",
49 });
50 const second = await commitShared(
51 fs,
52 dir,
53 first.commit,
54 {
55 version: 1,
56 files: { "a.txt": "one\ntwo\n", "run.sh": "echo hi\n", link: "" },
57 modes: { "run.sh": { exec: true }, link: { link: "a.txt" } },
58 last: { agent: "alice", message: "Add two" },
59 },
60 noBlobs,
61 );
62 assert.equal(second.changed, 1);
63 const next = (await git.readCommit({ fs, dir, oid: second.commit })).commit;
64 assert.equal(next.author.name, "alice");
65 assert.deepEqual(next.parent, [first.commit]);
66 assert.equal(absoVersion(next.message), 1);
67 });
68});