Skip to content

abso-core

Public

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

Check passed
MCP
show on this site's /mcp
CLI
abso show 78 --json
JSON
/christopher/abso-core/versions/78?format=json

Biome is silent: about 90 hints cleared. String joins as templates, dotted keys, unused imports, variables and a private method removed, optional chains (one kept boolean with === true), the preset field instead of the deprecated recommended. Two rules off where they don't fit: noExplicitAny in the hook modules, whose engine types come from the host, and noTemplateCurlyInString in tests, which hold source text as data.

of shared·pinch··Not checked

Version 77 · Files at version 78

44 files, 84 lines added, 102 removed.

--- a/biome.json
+++ b/biome.json
@@ -28,7 +28,7 @@
2828 "linter": {
2929 "enabled": true,
3030 "rules": {
31− "recommended": true,
31+ "preset": "recommended",
3232 "style": {
3333 "noNonNullAssertion": "off"
3434 },
@@ -56,6 +56,17 @@
5656 "linter": {
5757 "rules": {
5858 "suspicious": {
59+ "noExplicitAny": "off",
60+ "noTemplateCurlyInString": "off"
61+ }
62+ }
63+ }
64+ },
65+ {
66+ "includes": ["client/hooks/**", "client/view/hooks/**"],
67+ "linter": {
68+ "rules": {
69+ "suspicious": {
5970 "noExplicitAny": "off"
6071 }
6172 }
--- a/client/hooks/register.ts
+++ b/client/hooks/register.ts
@@ -144,7 +144,7 @@
144144 ),
145145 ),
146146 snapshot: text === undefined || looksBinary(text) ? undefined : normalize(text),
147− ...(text !== undefined && text.includes("\u0000")
147+ ...(text?.includes("\u0000")
148148 ? { nul: { at: text.indexOf("\u0000"), line: text.slice(0, text.indexOf("\u0000")).split("\n").length } }
149149 : {}),
150150 agentId: typeof input.agentId === "string" ? input.agentId : undefined,
--- a/client/src/box-commands.ts
+++ b/client/src/box-commands.ts
@@ -106,8 +106,7 @@
106106 : [[box, local] as const];
107107 for (const [path, from] of files) {
108108 const text = readText(from);
109− const data =
110− text !== undefined && text.includes("\r") ? Buffer.from(text.replace(/\r\n?/g, "\n")) : readFileSync(from);
109+ const data = text?.includes("\r") ? Buffer.from(text.replace(/\r\n?/g, "\n")) : readFileSync(from);
111110 const exec = (statSync(from).mode & 0o111) !== 0 || (data[0] === 0x23 && data[1] === 0x21);
112111 out.push({ path, data, ...(exec ? { mode: 0o755 } : {}) });
113112 }
@@ -364,7 +363,7 @@
364363 continue;
365364 }
366365 // Text goes as abso records it, with LF line endings: a CRLF script fails in the box's sh (#37).
367− const lf = d.text !== undefined && d.text.includes("\r") ? Buffer.from(d.text.replace(/\r\n?/g, "\n")) : undefined;
366+ const lf = d.text?.includes("\r") ? Buffer.from(d.text.replace(/\r\n?/g, "\n")) : undefined;
368367 if (lf !== undefined) toLf.push(rel);
369368 const data = lf ?? readFileSync(path);
370369 // The bit from the disk, or (on Windows) from the server; a script with "#!" runs either way.
--- a/client/src/commands.ts
+++ b/client/src/commands.ts
@@ -28,7 +28,6 @@
2828 isPaused,
2929 type LeftOut,
3030 listKnown,
31− MAX_TEXT_BYTES,
3231 newFileEndings,
3332 normalize,
3433 pausedPath,
--- a/client/src/drafts.ts
+++ b/client/src/drafts.ts
@@ -16,7 +16,6 @@
1616 type Env,
1717 EXIT,
1818 mergedLinesText,
19− newsText,
2019 type Output,
2120 open,
2221 plural,
--- a/client/src/folder.ts
+++ b/client/src/folder.ts
@@ -455,7 +455,7 @@
455455 }
456456 const autocrlf = config.get("core.autocrlf");
457457 const coreEol = config.get("core.eol") ?? "native";
458− const attrs = git(["check-attr", "--stdin", "-z", "text", "eol"], rels.join("\0") + "\0");
458+ const attrs = git(["check-attr", "--stdin", "-z", "text", "eol"], `${rels.join("\0")}\0`);
459459 if (attrs === undefined) return out;
460460 const f = attrs.split("\0");
461461 const seen = new Map<string, { text?: string; eol?: string }>();
--- a/client/src/key-admin.ts
+++ b/client/src/key-admin.ts
@@ -3,7 +3,6 @@
33
44import { readFileSync } from "node:fs";
55import { homedir } from "node:os";
6−import { join } from "node:path";
76import { UsageError } from "./args.ts";
87import type { Config } from "./config.ts";
98import { fromEnv } from "./env-names.ts";
--- a/client/src/queue.ts
+++ b/client/src/queue.ts
@@ -6,7 +6,7 @@
66
77import { type Api, newsLines, type QueueItem, type QueueState } from "./api.ts";
88import { type Parsed, UsageError } from "./args.ts";
9−import { type Env, type Output, open, plural } from "./commands.ts";
9+import { type Env, type Output, open } from "./commands.ts";
1010import { logNews } from "./folder.ts";
1111
1212/** How long publish waits by default: under the 2 minutes a Claude Code shell command gets (#39). */
--- a/client/test/client.test.ts
+++ b/client/test/client.test.ts
@@ -1328,7 +1328,7 @@
13281328 ];
13291329
13301330 it("refuses each one, writes nothing for it, and says which and why", async () => {
1331− const { name, folders } = await project({ "ok.txt": "ok\n" }, "alice", "bob", "carol");
1331+ const { folders } = await project({ "ok.txt": "ok\n" }, "alice", "bob", "carol");
13321332 const bob = folders.bob!;
13331333 const files = Object.fromEntries([...HOSTILE.map((p) => [p, "pwned\n"] as const), ["fine/new.txt", "fine\n"]]);
13341334 const parent = dirname(bob);
@@ -1474,7 +1474,7 @@
14741474 });
14751475
14761476 it("refuses a link out of the folder, and a write through a folder that is a link", async () => {
1477− const { name, folders } = await project({ "ok.txt": "ok\n" }, "alice", "bob");
1477+ const { folders } = await project({ "ok.txt": "ok\n" }, "alice", "bob");
14781478 const bob = folders.bob!;
14791479 fake.injectSync = {
14801480 files: { up: "", "in-folder": "" },
@@ -1783,7 +1783,7 @@
17831783 );
17841784 // Settle: a file with no markers is refused, and settles nothing.
17851785 assert.match(
1786− (await main(["settle", "b.txt", "--theirs"], { cwd: alice, env: ENV, write: () => {} })).stdout + "",
1786+ `${(await main(["settle", "b.txt", "--theirs"], { cwd: alice, env: ENV, write: () => {} })).stdout}`,
17871787 /^$/,
17881788 );
17891789 const none = await main(["settle", "a.txt", "b.txt", "--theirs"], { cwd: alice, env: ENV, write: () => {} });
@@ -4249,8 +4249,8 @@
42494249 const { name, folders } = await project({ "a.txt": "a\n" }, "alice");
42504250 symlinkSync("a.txt", join(folders.alice!, "link"));
42514251 assert.equal((await avcs(folders.alice!, "publish", "-m", "add a link")).exit, 0);
4252− assert.equal(shared(name)["link"], "");
4253− assert.deepEqual(fake.projects.get(name)!.project.modes()["link"], { link: "a.txt" });
4252+ assert.equal(shared(name).link, "");
4253+ assert.deepEqual(fake.projects.get(name)!.project.modes().link, { link: "a.txt" });
42544254 });
42554255
42564256 it("shows mode changes in diffs and attribute collisions in words", () => {
--- a/client/test/ignore.test.ts
+++ b/client/test/ignore.test.ts
@@ -59,7 +59,7 @@
5959 {
6060 cwd: root,
6161 env,
62− input: paths.join("\0") + "\0",
62+ input: `${paths.join("\0")}\0`,
6363 encoding: "utf8",
6464 },
6565 );
--- a/src/engine/build.ts
+++ b/src/engine/build.ts
@@ -487,7 +487,7 @@
487487 if (replacement !== "" && !replacement.endsWith("\n")) {
488488 if (endLine + 1 < visible.length) {
489489 endLine++;
490− replacement += visible[endLine]!.text + "\n";
490+ replacement += `${visible[endLine]!.text}\n`;
491491 } else {
492492 replacement += "\n";
493493 }
--- a/src/engine/test/build.test.ts
+++ b/src/engine/test/build.test.ts
@@ -127,7 +127,7 @@
127127 const atom = repo.edit({ edits: [{ file: "f.txt", old: "five\n", new: "five\nsix\n" }] });
128128 assert.deepEqual(atom.writes, [gapKey("a0.4")]);
129129 assert.deepEqual(atom.reads, [lineKey("a0.4")]);
130− assert.equal(repo.text("f.txt"), FIVE + "six\n");
130+ assert.equal(repo.text("f.txt"), `${FIVE}six\n`);
131131 });
132132});
133133
--- a/src/engine/test/concurrent.test.ts
+++ b/src/engine/test/concurrent.test.ts
@@ -24,13 +24,13 @@
2424 View,
2525} from "../index.ts";
2626
27−const textOf = (lines: readonly string[]): string => (lines.length === 0 ? "" : lines.join("\n") + "\n");
27+const textOf = (lines: readonly string[]): string => (lines.length === 0 ? "" : `${lines.join("\n")}\n`);
2828
2929import { EditGen, type Files, filesFromView, filesToRecord, sameFiles } from "./gen.ts";
3030import { Repo, Rng } from "./helpers.ts";
3131
32−const BASE_SEED = Number(process.env["PROP_SEED"] ?? 20260621);
33−const CASES = Number(process.env["PROP_CASES"] ?? 250);
32+const BASE_SEED = Number(process.env.PROP_SEED ?? 20260621);
33+const CASES = Number(process.env.PROP_CASES ?? 250);
3434
3535/** A hunk in terms of the old view's visible lines. start === end is a pure insertion at gap start. */
3636interface PlainHunk {
@@ -98,7 +98,7 @@
9898 usedFiles.add(path);
9999 const lines = fresh(rng.range(1, 3));
100100 hunks.push({ file: path, start: 0, end: 0, lines });
101− edits.push({ file: path, old: "", new: lines.join("\n") + "\n" });
101+ edits.push({ file: path, old: "", new: `${lines.join("\n")}\n` });
102102 parts.push(`create ${path} ${JSON.stringify(lines)}`);
103103 return;
104104 }
@@ -429,7 +429,7 @@
429429 const a = Math.max(0, i - rng.range(0, 2));
430430 const b = Math.min(n, j + rng.range(0, 2));
431431 const edit = gen.textEdit(file, all, i, j, add, "both") as { old: string; new: string };
432− const text = (ls: readonly string[]) => (ls.length ? ls.join("\n") + "\n" : "");
432+ const text = (ls: readonly string[]) => (ls.length ? `${ls.join("\n")}\n` : "");
433433 const whole = text(all);
434434 const wider = { file, old: text(all.slice(a, b)), new: text([...all.slice(a, i), ...add, ...all.slice(j, b)]) };
435435 const unique = wider.old !== "" && whole.indexOf(wider.old) === whole.lastIndexOf(wider.old);
--- a/src/engine/test/gen.ts
+++ b/src/engine/test/gen.ts
@@ -21,13 +21,13 @@
2121 const out: Record<string, string> = {};
2222 for (const path of [...files.keys()].sort()) {
2323 const lines = files.get(path)!;
24− if (lines.length > 0) out[path] = lines.join("\n") + "\n";
24+ if (lines.length > 0) out[path] = `${lines.join("\n")}\n`;
2525 }
2626 return out;
2727}
2828
2929function textOf(lines: readonly string[]): string {
30− return lines.length === 0 ? "" : lines.join("\n") + "\n";
30+ return lines.length === 0 ? "" : `${lines.join("\n")}\n`;
3131}
3232
3333function occurrences(text: string, needle: string): number {
@@ -247,7 +247,7 @@
247247 let old = t.slice(c1, this.rng.range(c1 + 1, t.length));
248248 if (this.rng.chance(0.3) && i + 1 < lines.length) {
249249 const next = lines[i + 1]!;
250− old = t.slice(c1) + "\n" + next.slice(0, this.rng.int(next.length + 1));
250+ old = `${t.slice(c1)}\n${next.slice(0, this.rng.int(next.length + 1))}`;
251251 }
252252 const replacement = this.rng.pick(["", "Z", "q\nr", "\n", "w\n", "yy", "Z\nZ", this.fresh()]);
253253 const text = textOf(lines);
--- a/src/engine/test/helpers.ts
+++ b/src/engine/test/helpers.ts
@@ -133,5 +133,5 @@
133133
134134/** Lines of text with a trailing newline. */
135135export function lines(...items: string[]): string {
136− return items.map((s) => s + "\n").join("");
136+ return items.map((s) => `${s}\n`).join("");
137137}
--- a/src/engine/test/moves.test.ts
+++ b/src/engine/test/moves.test.ts
@@ -8,8 +8,8 @@
88import { type Atom, type AtomId, conflicts } from "../index.ts";
99import { lines, Repo, Rng } from "./helpers.ts";
1010
11−const BASE_SEED = Number(process.env["PROP_SEED"] ?? 20261004);
12−const CASES = Number(process.env["PROP_CASES"] ?? 200);
11+const BASE_SEED = Number(process.env.PROP_SEED ?? 20261004);
12+const CASES = Number(process.env.PROP_CASES ?? 200);
1313
1414const FN = ["function area(r) {", " const pi = 3.14;", " return pi * r * r;", "}"];
1515const START = {
@@ -133,7 +133,7 @@
133133 const repo = Repo.init(START);
134134 concurrently(
135135 repo,
136− (base) => repo.draft({ edits: [{ file: "shapes.js", old: FN.join("\n") + "\n", new: "" }] }, base),
136+ (base) => repo.draft({ edits: [{ file: "shapes.js", old: `${FN.join("\n")}\n`, new: "" }] }, base),
137137 (base) => moveArea(repo, base),
138138 );
139139 assert.deepEqual(conflicts(repo.graph, repo.shared), []);
--- a/src/engine/test/properties.test.ts
+++ b/src/engine/test/properties.test.ts
@@ -21,8 +21,8 @@
2121import { EditGen, type Files, filesFromView, filesToRecord, sameFiles } from "./gen.ts";
2222import { Repo, Rng } from "./helpers.ts";
2323
24−const BASE_SEED = Number(process.env["PROP_SEED"] ?? 20260621);
25−const CASES = Number(process.env["PROP_CASES"] ?? 250);
24+const BASE_SEED = Number(process.env.PROP_SEED ?? 20260621);
25+const CASES = Number(process.env.PROP_CASES ?? 250);
2626
2727/** Run `body` once per seed; on failure report the seed and the steps taken. */
2828export function forCases(name: string, body: (rng: Rng, log: string[]) => void): void {
--- a/src/engine/test/scenarios.test.ts
+++ b/src/engine/test/scenarios.test.ts
@@ -166,8 +166,8 @@
166166 }
167167 const insertAfter = (anchor: string, line: string, mode: "both" | "after" = "both") => ({
168168 file: "Sidebar.tsx",
169− old: anchor + "\n",
170− new: anchor + "\n" + line + "\n",
169+ old: `${anchor}\n`,
170+ new: `${anchor}\n${line}\n`,
171171 mode,
172172 });
173173 const railAfter = (anchor: string, mode: "both" | "after" = "both"): Spec => ({
@@ -240,7 +240,7 @@
240240 author: "reviewer",
241241 message: "keep both imports, Rail before Footer",
242242 resolves: [a.id, b.id],
243− edits: [{ file: "Sidebar.tsx", old: FOOTER + "\n" + RAIL + "\n", new: RAIL + "\n" + FOOTER + "\n" }],
243+ edits: [{ file: "Sidebar.tsx", old: `${FOOTER}\n${RAIL}\n`, new: `${RAIL}\n${FOOTER}\n` }],
244244 });
245245 assert.deepEqual(
246246 resolver.deps.filter((d) => d === a.id || d === b.id),
--- a/src/engine/test/text.test.ts
+++ b/src/engine/test/text.test.ts
@@ -115,9 +115,9 @@
115115 assert.deepEqual(
116116 diffLines(
117117 a,
118− a.map((s) => s + "!"),
118+ a.map((s) => `${s}!`),
119119 ),
120− [{ start: 0, end: 2100, lines: a.map((s) => s + "!") }],
120+ [{ start: 0, end: 2100, lines: a.map((s) => `${s}!`) }],
121121 );
122122 });
123123
@@ -192,8 +192,8 @@
192192 const base = Array.from({ length: 6 + rnd(10) }, (_, k) => `l${k}`);
193193 // ours edits the first half, theirs the second, with a gap between.
194194 const cut = Math.floor(base.length / 2);
195− const ours = base.map((l, k) => (k < cut - 1 && rnd(3) === 0 ? l + "o" : l));
196− const theirs = base.map((l, k) => (k > cut && rnd(3) === 0 ? l + "t" : l));
195+ const ours = base.map((l, k) => (k < cut - 1 && rnd(3) === 0 ? `${l}o` : l));
196+ const theirs = base.map((l, k) => (k > cut && rnd(3) === 0 ? `${l}t` : l));
197197 const expected = base.map((l, k) => (ours[k] !== l ? ours[k] : theirs[k]));
198198 const got = mergeLines(base, ours, theirs);
199199 if (got.conflicts === 0) assert.deepEqual(got.lines, expected, `seed ${seed}`);
--- a/src/engine/test/view.test.ts
+++ b/src/engine/test/view.test.ts
@@ -78,7 +78,7 @@
7878 it("projects a long file (a deep chain) without recursion limits", () => {
7979 const big = Array.from({ length: 30_000 }, (_, i) => `line ${i}`);
8080 const graph = new Graph();
81− graph.add(buildBase({ "big.txt": big.join("\n") + "\n" }, { author: "import", message: "big" }));
81+ graph.add(buildBase({ "big.txt": `${big.join("\n")}\n` }, { author: "import", message: "big" }));
8282 const files = project(graph, ["a0"]);
8383 assert.equal(files["big.txt"]!.split("\n").length, 30_001);
8484 });
--- a/src/engine/text.ts
+++ b/src/engine/text.ts
@@ -15,7 +15,7 @@
1515
1616/** Join lines into file text. A non-empty file always ends with "\n". */
1717export function joinLines(lines: readonly string[]): string {
18− return lines.length === 0 ? "" : lines.join("\n") + "\n";
18+ return lines.length === 0 ? "" : `${lines.join("\n")}\n`;
1919}
2020
2121/** Normalize, then make a non-empty text end with "\n" (how files are projected). */
--- a/src/gitview/test/ingest.test.ts
+++ b/src/gitview/test/ingest.test.ts
@@ -241,7 +241,7 @@
241241 edits: [{ file: "notes.md", old: "two\n", new: "two\nthree\n" }],
242242 });
243243 person.setLine("app.txt", 9, "app line nine");
244− person.write("app.txt", person.read("app.txt") + "app line 13\n");
244+ person.write("app.txt", `${person.read("app.txt")}app line 13\n`);
245245 person.commit("Pat edits the bottom");
246246
247247 const result = await ingest(repo.graph, repo.shared, person.dir);
--- a/src/gitview/test/random.test.ts
+++ b/src/gitview/test/random.test.ts
@@ -16,8 +16,8 @@
1616
1717after(cleanup);
1818
19−const BASE_SEED = Number(process.env["PROP_SEED"] ?? 20261003);
20−const CASES = Number(process.env["PROP_CASES"] ?? 30);
19+const BASE_SEED = Number(process.env.PROP_SEED ?? 20261003);
20+const CASES = Number(process.env.PROP_CASES ?? 30);
2121
2222// A small vocabulary, so files repeat lines and diffs have choices to make.
2323const WORDS = ["{", "}", "x", "y", "return x;", "", "let a = 1;", "let b = 2;"];
@@ -28,7 +28,7 @@
2828 return Array.from({ length: rng.range(min, max) }, (_, i) => (rng.chance(0.5) ? rng.pick(WORDS) : `${tag} ${i}`));
2929}
3030
31−const text = (lines: readonly string[]): string => lines.map((l) => l + "\n").join("");
31+const text = (lines: readonly string[]): string => lines.map((l) => `${l}\n`).join("");
3232
3333/** One person's commit: a few random line edits, sometimes a new or deleted file. */
3434function randomCommit(rng: Rng, files: Files, n: number): Files {
--- a/src/gitview/trailers.ts
+++ b/src/gitview/trailers.ts
@@ -34,7 +34,7 @@
3434 */
3535export function withTrailers(message: string, trailers: readonly Trailer[], fallback: string): string {
3636 const body = cleanMessage(message) || fallback;
37− if (trailers.length === 0) return body + "\n";
37+ if (trailers.length === 0) return `${body}\n`;
3838 const block = trailers.map((t) => `${t.key}: ${oneLine(t.value)}`).join("\n");
3939 return `${body}\n\n${block}\n`;
4040}
--- a/src/gitview/tree.ts
+++ b/src/gitview/tree.ts
@@ -61,7 +61,7 @@
6161 for (const entry of tree) {
6262 const path = prefix + entry.path;
6363 if (entry.mode === MODE_TREE) {
64− await visit(entry.oid, path + "/");
64+ await visit(entry.oid, `${path}/`);
6565 } else if (entry.mode === MODE_SUBMODULE) {
6666 skipped.push({ path, reason: "submodule", oid: entry.oid });
6767 } else if (entry.mode === MODE_LINK) {
--- a/worker/project/collisions.ts
+++ b/worker/project/collisions.ts
@@ -240,8 +240,8 @@
240240 kind: "duplicate",
241241 name,
242242 file,
243− yours: { lines: [yours.start + 1, yours.end], text: yours.text + "\n" },
244− theirs: { lines: [theirs.start + 1, theirs.end], text: theirs.text + "\n", ...originOf(host, by, space.name) },
243+ yours: { lines: [yours.start + 1, yours.end], text: `${yours.text}\n` },
244+ theirs: { lines: [theirs.start + 1, theirs.end], text: `${theirs.text}\n`, ...originOf(host, by, space.name) },
245245 });
246246 }
247247 }
--- a/worker/project/definition-rule.ts
+++ b/worker/project/definition-rule.ts
@@ -168,7 +168,7 @@
168168 const visible = view.lines(file);
169169 const def = after[0];
170170 const theirs = def
171− ? { file: def.file, lines: [def.start + 1, def.end] as [number, number], text: def.text + "\n" }
171+ ? { file: def.file, lines: [def.start + 1, def.end] as [number, number], text: `${def.text}\n` }
172172 : { file: before[0]!.file, lines: [before[0]!.start + 1, before[0]!.start] as [number, number], text: "" };
173173 const collision: Collision = {
174174 kind: "definition",
--- a/worker/project/draft-collisions.ts
+++ b/worker/project/draft-collisions.ts
@@ -114,8 +114,8 @@
114114 kind: "duplicate",
115115 name,
116116 file,
117− first: { agent: a.name, file, lines: [dA.start + 1, dA.end], text: dA.text + "\n" },
118− second: { agent: b.name, file, lines: [dB.start + 1, dB.end], text: dB.text + "\n" },
117+ first: { agent: a.name, file, lines: [dA.start + 1, dA.end], text: `${dA.text}\n` },
118+ second: { agent: b.name, file, lines: [dB.start + 1, dB.end], text: `${dB.text}\n` },
119119 });
120120 }
121121 }
--- a/worker/project/express-moves.ts
+++ b/worker/project/express-moves.ts
@@ -127,7 +127,7 @@
127127 }
128128 if (len > 0 && (!best || len > best.len)) best = { block, q, len };
129129 }
130− if (best && best.block.texts.slice(best.q, best.q + best.len).some((t) => !PLAIN_LINE.test(t))) {
130+ if (best?.block.texts.slice(best.q, best.q + best.len).some((t) => !PLAIN_LINE.test(t))) {
131131 const ids = best.block.ids.slice(best.q, best.q + best.len);
132132 for (const id of ids) used.add(id);
133133 matches.push({ from: best.block.file, ids, to: run.file, at: run.start + p });
--- a/worker/project/history.ts
+++ b/worker/project/history.ts
@@ -2,7 +2,7 @@
22// (pathLife), and where lines went (follow). They read through HistoryHost, the one seam the derived tables
33// (abso issues 48 and 79) plug into: today the host is the project in memory.
44
5−import type { AtomId, Graph, LineId, View } from "../../src/engine/index.ts";
5+import type { Graph, LineId, View } from "../../src/engine/index.ts";
66import { pathKey } from "./pathkey.ts";
77import { checkReadPath, differs, type LastChange, ProjectError, utf8Bytes } from "./project.ts";
88import { last, SHARED, type Space } from "./spaces.ts";
--- a/worker/project/news.ts
+++ b/worker/project/news.ts
@@ -86,7 +86,7 @@
8686 const about = note.change !== undefined ? ` (change "${clip(note.change)}")` : "";
8787 const verb = note.reply ? "replies on" : note.kind === "objection" ? "objects on" : "comments on";
8888 const ask =
89− note.kind === "objection" ? " Fix it, or answer: abso note --reply " + id : " Answer: abso note --reply " + id;
89+ note.kind === "objection" ? ` Fix it, or answer: abso note --reply ${id}` : ` Answer: abso note --reply ${id}`;
9090 return note.person
9191 ? `${note.person.person.name} (a person, signed in on the website, id ${note.person.person.id}) ${verb} ${file} ${span}${about}: ${JSON.stringify(clip(note.text))}.${ask}`
9292 : `${note.writer} ${verb} ${file} ${span}${about}: "${clip(note.text)}".${ask}`;
--- a/worker/project/project.ts
+++ b/worker/project/project.ts
@@ -12,18 +12,7 @@
1212// agents publish into under the same rules, and that lands in shared as one
1313// unit. Every agent works in one space at a time.
1414
15−import {
16− type Atom,
17− type AtomId,
18− type ConflictKey,
19− conflictKeys,
20− type EditInput,
21− EngineError,
22− Graph,
23− type LineId,
24− type MoveInput,
25− type View,
26−} from "../../src/engine/index.ts";
15+import { type Atom, type AtomId, EngineError, Graph, type LineId, type View } from "../../src/engine/index.ts";
2716import { type AddDraftHost, addDraft as hostedAddDraft } from "./add-draft.ts";
2817import { type AmendHost, amend as hostedAmend } from "./amend.ts";
2918import { type AnnounceHost, announce as hostedAnnounce, announcePerson as hostedAnnouncePerson } from "./announce.ts";
@@ -98,7 +87,6 @@
9887 closeNote as hostedCloseNote,
9988 noteAnswer as hostedNoteAnswer,
10089 notes as hostedNotes,
101− noteView as hostedNoteView,
10290 startingNotes as hostedStartingNotes,
10391 writeNote as hostedWriteNote,
10492 type NoteHost,
@@ -140,8 +128,6 @@
140128 Entry,
141129 LandAnswer,
142130 MergedLine,
143− Meta,
144− Mode,
145131 Modes,
146132 NoteAnswer,
147133 NoteBody,
@@ -155,7 +141,6 @@
155141 Refusal,
156142 Settled,
157143 Starting,
158− SwitchAnswer,
159144 Tail,
160145 TellRecord,
161146} from "./project-types.ts";
@@ -178,7 +163,7 @@
178163import { recordFile as hostedRecordFile, type RecordFileHost } from "./record-file.ts";
179164import { refusals as hostedRefusals, refuse as hostedRefuse, type RefuseHost } from "./refuse.ts";
180165import { restore as hostedRestore, type RestoreHost } from "./restore.ts";
181−import { addVersion, last, Membership, newSpace, type Published, SHARED, type Space, sharedBaseOf } from "./spaces.ts";
166+import { last, Membership, SHARED, type Space, sharedBaseOf } from "./spaces.ts";
182167import { starting as hostedStarting, type StartingHost } from "./start.ts";
183168import { switchTo as hostedSwitchTo, type SwitchHost } from "./switch-to.ts";
184169import { sync as hostedSync, type SyncHost } from "./sync.ts";
@@ -740,16 +725,6 @@
740725 return author ? this.#currentChange(author, this.#now?.() ?? this.#lastTime) : undefined;
741726 }
742727
743− /**
744− * The view a note's lines live in (#44):
745− * shared once any were published there; else the named draft they were
746− * published into; else their author's draft, where it works now or where it
747− * parked it. Undefined when no space holds them any more (a discarded draft).
748− */
749− #noteView(n: NoteRecord): View | undefined {
750− return hostedNoteView(this.#notesHost, n);
751− }
752−
753728 #noteAnswer(n: NoteRecord): NoteAnswer {
754729 return hostedNoteAnswer(this.#notesHost, n);
755730 }
--- a/worker/project/queue.ts
+++ b/worker/project/queue.ts
@@ -137,10 +137,10 @@
137137 kind: "duplicate",
138138 name,
139139 file,
140− yours: { lines: [yours.start + 1, yours.end], text: yours.text + "\n" },
140+ yours: { lines: [yours.start + 1, yours.end], text: `${yours.text}\n` },
141141 theirs: {
142142 lines: [theirs.start + 1, theirs.end],
143− text: theirs.text + "\n",
143+ text: `${theirs.text}\n`,
144144 agent: q.agent,
145145 message: q.message,
146146 version: last(space),
--- a/worker/project/test/bench.ts
+++ b/worker/project/test/bench.ts
@@ -15,7 +15,7 @@
1515
1616const files: Record<string, string> = {};
1717for (let f = 0; f < fileCount; f++) {
18− files[`src/f${f}.ts`] = Array.from({ length: linesPer }, (_, i) => lineOf(f, i)).join("\n") + "\n";
18+ files[`src/f${f}.ts`] = `${Array.from({ length: linesPer }, (_, i) => lineOf(f, i)).join("\n")}\n`;
1919}
2020
2121const store = new MemoryStore();
--- a/worker/project/test/merge.test.ts
+++ b/worker/project/test/merge.test.ts
@@ -54,7 +54,7 @@
5454 project.record("prefix", { "engine/classset.ts": CALLS + HELPER }, 1);
5555 assert.equal(project.publish("prefix", "isHex instead of regex literals", 2).ok, true);
5656 // fuzzer, unpublished: the same calls, and its own helper at the top.
57− const mine = CALLS.replace("// classset\n", "// classset\n" + HELPER.replace("no RegExp", "hex only"));
57+ const mine = CALLS.replace("// classset\n", `// classset\n${HELPER.replace("no RegExp", "hex only")}`);
5858 project.record("fuzzer", { "engine/classset.ts": mine }, 3);
5959 const s = project.sync("fuzzer");
6060 const text = project.draftOf("fuzzer")!.view.text("engine/classset.ts");
--- a/worker/project/test/moves.test.ts
+++ b/worker/project/test/moves.test.ts
@@ -192,10 +192,10 @@
192192test("past the move limit only the longest blocks move: a rewrite of many single lines still publishes, and a block moved whole keeps someone's edit (abso issue 137)", () => {
193193 const keys = Array.from({ length: 200 }, (_, i) => ` "k${i}": ${i},`);
194194 const block = [" // block", ' "b1": "one",', ' "b2": "two",', ' "b3": "three",', " // end block"];
195− const before = ["{", ...block, ...keys, "}"].join("\n") + "\n";
195+ const before = `${["{", ...block, ...keys, "}"].join("\n")}\n`;
196196 // The draft reverses the keys with a new line between each, so every one is its own one-line match.
197197 const rewritten = keys.toReversed().flatMap((k, i) => [k, ` "n${i}": 0,`]);
198− const after = ["{", ...rewritten, ...block, "}"].join("\n") + "\n";
198+ const after = `${["{", ...rewritten, ...block, "}"].join("\n")}\n`;
199199 const store = new MemoryStore();
200200 const project = new Project(store);
201201 project.init({ "f.json": before }, 0);
--- a/worker/project/test/order.test.ts
+++ b/worker/project/test/order.test.ts
@@ -45,18 +45,18 @@
4545
4646 const expected = [...base];
4747 for (const p of [...plans].reverse()) expected.splice(p.start, p.end - p.start, ...p.lines);
48− const expectedText = expected.length > 0 ? expected.join("\n") + "\n" : undefined;
48+ const expectedText = expected.length > 0 ? `${expected.join("\n")}\n` : undefined;
4949
5050 const orders = [plans.map((_, i) => i), plans.map((_, i) => plans.length - 1 - i)];
5151 for (let k = 0; k < 3; k++) orders.push([...orders[0]!].sort(() => rand() - 0.5));
5252 for (const order of orders) {
5353 const project = new Project(new MemoryStore());
54− project.init({ "f.txt": base.join("\n") + "\n" }, 0);
54+ project.init({ "f.txt": `${base.join("\n")}\n` }, 0);
5555 for (const p of plans) {
5656 project.sync(p.agent);
5757 const lines = [...base];
5858 lines.splice(p.start, p.end - p.start, ...p.lines);
59− project.record(p.agent, { "f.txt": lines.join("\n") + "\n" }, 1);
59+ project.record(p.agent, { "f.txt": `${lines.join("\n")}\n` }, 1);
6060 }
6161 for (const i of order) {
6262 const answer = project.publish(plans[i]!.agent, "m", 2);
--- a/worker/project/test/project-file.test.ts
+++ b/worker/project/test/project-file.test.ts
@@ -6,7 +6,7 @@
66import { test } from "node:test";
77import { MemoryStore, Project } from "../project.ts";
88
9−const review = (reviewer: string) => JSON.stringify({ review: [{ paths: ["src/**"], reviewer }] }) + "\n";
9+const review = (reviewer: string) => `${JSON.stringify({ review: [{ paths: ["src/**"], reviewer }] })}\n`;
1010
1111function touchSrc(project: Project, time: number): void {
1212 project.sync("builder");
--- a/worker/project/test/queue.test.ts
+++ b/worker/project/test/queue.test.ts
@@ -20,7 +20,7 @@
2020 project.checkerReady = true;
2121 project.init(
2222 {
23− "avcs.json": JSON.stringify({ queue }) + "\n",
23+ "avcs.json": `${JSON.stringify({ queue })}\n`,
2424 "a.ts": "export const a = 1;\n",
2525 "b.ts": "export const b = 1;\n",
2626 "c.ts": "export const c = 1;\n",
--- a/worker/project/test/queued-moves.test.ts
+++ b/worker/project/test/queued-moves.test.ts
@@ -20,7 +20,7 @@
2020 project.checkerReady = true;
2121 project.init(
2222 {
23− "avcs.json": JSON.stringify({ queue: true }) + "\n",
23+ "avcs.json": `${JSON.stringify({ queue: true })}\n`,
2424 "a.ts": "export const a = 1;\nexport function kept() {\n\treturn 'x';\n}\n",
2525 "c.ts": "export const c = 1;\n",
2626 },
@@ -66,7 +66,7 @@
6666 const project = new Project(store);
6767 project.checkerReady = true;
6868 project.init(
69− { "avcs.json": JSON.stringify({ queue: true }) + "\n", "a.ts": "export const a = 1;\nexport const b = 1;\n" },
69+ { "avcs.json": `${JSON.stringify({ queue: true })}\n`, "a.ts": "export const a = 1;\nexport const b = 1;\n" },
7070 0,
7171 );
7272 project.sync("one");
--- a/worker/project/test/reviewers.test.ts
+++ b/worker/project/test/reviewers.test.ts
@@ -23,7 +23,7 @@
2323 const project = new Project(new MemoryStore(), { now: () => 100 });
2424 project.init(
2525 {
26− "avcs.json": JSON.stringify(RULES) + "\n",
26+ "avcs.json": `${JSON.stringify(RULES)}\n`,
2727 "src/auth/login.ts": "export const login = 1;\n",
2828 "src/game.ts": "export const game = 1;\n",
2929 "README.md": "# readme\n",
--- a/worker/project/test/tells.test.ts
+++ b/worker/project/test/tells.test.ts
@@ -58,7 +58,7 @@
5858 for (let i = 0; i < TELLS_KEPT + 3; i++) project.announce("lead", `Tell ${i}.`, ["b2"], 3 + i);
5959 const kept = project.status().tells;
6060 assert.equal(kept.length, TELLS_KEPT);
61− assert.match(kept[0]!.text, new RegExp(`Tell ${TELLS_KEPT + 2}\.$`));
61+ assert.match(kept[0]!.text, new RegExp(`Tell ${TELLS_KEPT + 2}\\.$`));
6262});
6363
6464test("a person's tell is kept like an agent's", () => {
--- a/worker/project/test/whole.test.ts
+++ b/worker/project/test/whole.test.ts
@@ -21,13 +21,13 @@
2121 };
2222 const log = new MemoryStore();
2323 const project = new Project(log, { hasBlob: (sha) => store.has(sha), whole });
24− project.init({ "avcs.json": JSON.stringify(config) + "\n", "src/a.ts": "export const a = 1;\n" }, 0);
24+ project.init({ "avcs.json": `${JSON.stringify(config)}\n`, "src/a.ts": "export const a = 1;\n" }, 0);
2525 for (const a of ["ann", "bob"]) project.sync(a);
2626 return { project, store, log, whole };
2727}
2828
2929const recording = (n: number) =>
30− JSON.stringify({ frames: Array.from({ length: 50 }, (_, i) => i * n) }, null, 2) + "\n";
30+ `${JSON.stringify({ frames: Array.from({ length: 50 }, (_, i) => i * n) }, null, 2)}\n`;
3131
3232test("a path the project marks whole is stored as a blob, and publishes and syncs like one", () => {
3333 const { project, store } = setup();
@@ -44,7 +44,7 @@
4444
4545test("text over 1 MB is kept whole whatever its path; smaller text is tracked by line", () => {
4646 const { project } = setup({});
47− const big = "x".repeat(80) + "\n";
47+ const big = `${"x".repeat(80)}\n`;
4848 project.record("ann", { "gen/big.txt": big.repeat(13_000), "src/small.txt": "small\n" }, 1);
4949 project.publish("ann", "two files", 2);
5050 assert.ok(project.blobs()["gen/big.txt"], "the big one is a blob");
@@ -54,7 +54,7 @@
5454
5555test("once whole, a file stays whole even when it shrinks; an Edit of it is out of step so the client sends the file", () => {
5656 const { project, store } = setup({});
57− project.record("ann", { "gen/big.txt": ("y".repeat(80) + "\n").repeat(13_000) }, 1);
57+ project.record("ann", { "gen/big.txt": `${"y".repeat(80)}\n`.repeat(13_000) }, 1);
5858 project.publish("ann", "big", 2);
5959 project.sync("bob");
6060 project.record("bob", { "gen/big.txt": "tiny now\n" }, 3);
--- a/worker/project/whole-files.ts
+++ b/worker/project/whole-files.ts
@@ -52,7 +52,7 @@
5252 return (
5353 rules.some((p) => matchesPattern(p, path)) ||
5454 length > WHOLE_LIMIT ||
55− (view !== undefined && view.hasFile(path) && view.attrs(path).blob !== null)
55+ (view?.hasFile(path) === true && view.attrs(path).blob !== null)
5656 );
5757}
5858