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

Compare

+19 −11 in 7 places
Lines 1–24 at 318 (were 1–23 at 2)
11// Review (#44): review is reading what
22// landed. abso review lists the changes since you last looked, or shows one;
33// abso note leaves a note on lines, which follows them as the file changes;
4−// abso notes lists them. The server holds changes and notes (Engine, 15a3035).
4+// abso notes lists them. The server holds changes and notes.
55
66import { readFileSync } from "node:fs";
77import { join } from "node:path";
88import type { ChangeAnswer, NoteAnswer } from "./api.ts";
99import { bool, type Parsed, str, UsageError } from "./args.ts";
1010import { type Env, type Output, open, plural, recordFolder } from "./commands.ts";
11−import { AVCS_DIR } from "./config.ts";
11+import { fromEnv } from "./env-names.ts";
1212import { writeFileAtomic } from "./folder.ts";
1313import { fileArg, when } from "./history.ts";
14+import { stateDir } from "./state-dir.ts";
1415
1516/** Where this folder last looked: a log position, kept in .avcs/review.json. */
1617const MARK = "review.json";
1718
1819function readMark(root: string): number | undefined {
1920 try {
20− const n = (JSON.parse(readFileSync(join(root, AVCS_DIR, MARK), "utf8")) as { since?: unknown }).since;
21+ const n = (JSON.parse(readFileSync(join(stateDir(root), MARK), "utf8")) as { since?: unknown }).since;
2122 return typeof n === "number" && Number.isInteger(n) && n >= 0 ? n : undefined;
2223 } catch {
2324 return undefined;
Lines 26–32 at 318 (were 25–31 at 2)
2526}
2627
2728function writeMark(root: string, since: number): void {
28− writeFileAtomic(join(root, AVCS_DIR, MARK), `${JSON.stringify({ since })}\n`);
29+ writeFileAtomic(join(stateDir(root), MARK), `${JSON.stringify({ since })}\n`);
2930}
3031
3132const SAID = { comment: "says", objection: "objects", read: "read it" } as const;
Lines 62–68 at 318 (were 61–67 at 2)
6162
6263/** One change in a list. */
6364/**
64− * A change's title as a list shows it (#43, Git Lessons): the first line, cut
65+ * A change's title as a list shows it (#43): the first line, cut
6566 * to 100 characters, as git log --oneline does, with an imported commit's
6667 * trailer (`git <sha12>, <author>, <time>`) as a short hash beside it. The
6768 * change page keeps the whole message.
Lines 83–95 at 318 (were 82–87 at 2)
8283 return ` ${c.id} ${c.agent}, ${titleLine(c.title)}${c.open ? " (still going)" : ""}: ${versionsText(c)}${files}${open > 0 ? `; ${plural(open, "open objection")}` : ""}`;
8384}
8485
86+/** What a settle kept, read from outside: whose lines, not "yours" or "theirs". */
87+function keptText(s: ChangeAnswer["settled"][number], settler: string): string {
88+ if (s.kept === "yours") return `kept ${settler}'s`;
89+ if (s.kept === "theirs") return `kept ${s.theirs.agent}'s`;
90+ return s.kept === "both" ? "kept both" : "rewrote both sides";
91+}
8593/** The change page, as text. */
8694export function changePage(c: ChangeAnswer): string[] {
8795 const out = [
Lines 106–117 at 318 (were 98–109 at 2)
98106 ),
99107 ...(c.settled.length > 0
100108 ? [
101− `Settled: ${c.settled.map((s) => `${s.file} (kept ${s.kept}, against ${s.theirs.agent}'s version ${s.theirs.version})`).join("; ")}.`,
109+ `Settled: ${c.settled.map((s) => `${s.file} (${keptText(s, c.agent)}, against ${s.theirs.agent}'s version ${s.theirs.version})`).join("; ")}.`,
102110 ]
103111 : []),
104112 ...(c.refusals.length > 0
105113 ? [
106− `Refused ${plural(c.refusals.length, "time")} on the way: ${c.refusals.map((r) => `${r.kinds.join(", ")} (${r.files.join(", ")})`).join("; ")}.`,
114+ `Refused ${plural(c.refusals.length, "time")} on the way: ${c.refusals.map((r) => `${r.kinds.join(", ")} (${r.files.join(", ")})${r.message ? `: ${JSON.stringify(r.message)}` : ""}`).join("; ")}.`,
107115 ]
108116 : []),
109117 ...((c.reviewers ?? []).length > 0
Lines 129–135 at 318 (were 121–127 at 2)
121129async function findChange(api: ReturnType<typeof open>["api"], word: string): Promise<ChangeAnswer> {
122130 if (/^\d+$/.test(word)) return api.change(Number(word));
123131 const v = /^v(\d+)$/i.exec(word);
124− // show names a version's change (Engine, 6a2911b); older servers don't, and the recent changes are searched.
132+ // show names a version's change; older servers don't, and the recent changes are searched.
125133 if (v) {
126134 const shown = await api.show(Number(v[1]), { draft: null }).catch(() => undefined);
127135 if (shown?.change !== undefined) return api.change(shown.change);
Lines 176–185 at 318 (were 168–177 at 2)
168176 const cutoff = back === undefined ? 0 : Date.now() - back;
169177 const lastActive = (c: ChangeAnswer): number => Math.max(c.time, ...c.versions.map((v) => v.time));
170178 // A first look shows the newest 20. Otherwise every change since the mark (or the span) is listed, page by
171− // page, before the mark moves past them (AVCS - Git Lessons' review): one page would drop the older ones.
179+ // page, before the mark moves past them: one page would drop the older ones.
172180 const firstLook = mark === undefined && raw === undefined;
173− // AVCS_REVIEW_PAGE shortens the page in tests.
174− const pageSize = Number(process.env.AVCS_REVIEW_PAGE) || 200;
181+ // ABSO_REVIEW_PAGE shortens the page in tests.
182+ const pageSize = Number(fromEnv(process.env, "REVIEW_PAGE")) || 200;
175183 const answer = await api.changes(since, firstLook ? 20 : pageSize);
176184 const all = [...answer.changes];
177185 for (
MCP
compare on this site's /mcp
CLI
abso diff 2 318 client/src/review.ts --json
JSON
/christopher/abso-core/compare/2..318?file=client%2Fsrc%2Freview.ts&format=json