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

Compare

+29 −8 in 7 places
Lines 7–13 at 318 (were 7–13 at 17)
77// edit, and `sync` only overwrites files that still match it.
88//
99// Skipped everywhere: .git, .avcs, .claude and node_modules, plus what git's
10−// ignore rules leave out: every .gitignore and .avcsignore in the folder,
10+// ignore rules leave out: every .gitignore and .absoignore in the folder,
1111// .git/info/exclude and git's global excludes file (core.ts has the rules).
1212
1313import { execFileSync } from "node:child_process";
Lines 26–34 at 318 (were 26–33 at 17)
2626import { homedir } from "node:os";
2727import { dirname, join, relative, sep } from "node:path";
2828import { blobOf, keptWholeAs, readKnownBlobs } from "./blobs.ts";
29+import type { CleanFiles } from "./clean-files.ts";
2930import { type GitHome, gitIgnoreSetup, type Ignore, isLocalOnly, makeIgnore, normalize, readAllSync } from "./core.ts";
30−import { type Mode, modeChange, onDisk, PLAIN, readKnownModes } from "./modes.ts";
31+import { FILE_MODE, type Mode, modeChange, onDisk, PLAIN, readKnownModes } from "./modes.ts";
3132import { stateDir } from "./state-dir.ts";
3233
3334export { type Ignore, isLocalOnly, normalize, withEndingsOf } from "./core.ts";
Lines 280–292 at 318 (were 279–290 at 17)
279280
280281// --- the known copy ---
281282
282−function knownPath(root: string, rel: string): string {
283− return join(stateDir(root), KNOWN, ...insideParts(rel));
283+/** `state` is the folder's stateDir, for a caller that looks up many files: finding it checks the disk each time. */
284+export function knownPath(root: string, rel: string, state: string = stateDir(root)): string {
285+ return join(state, KNOWN, ...insideParts(rel));
284286}
285287
286−export function readKnown(root: string, rel: string): string | undefined {
287− return readText(knownPath(root, rel));
288+export function readKnown(root: string, rel: string, state?: string): string | undefined {
289+ return readText(knownPath(root, rel, state));
288290}
289291
290292export function writeKnown(root: string, rel: string, text: string): void {
Lines 323–337 at 318 (were 321–331 at 17)
321323 * server's form), known files that are gone (null), and the modes that differ
322324 * from the known modes. An empty file is a file like any other (""); a link's
323325 * text is "".
326+ *
327+ * `clean` lets status skip reading the files it found unchanged last time
328+ * (clean-files.ts). record never passes it, so it always reads every file.
324329 */
325330export function unrecorded(
326331 root: string,
327332 all = false,
328333 meantBinary: ReadonlySet<string> = new Set(),
334+ clean?: CleanFiles,
329335): {
330336 files: Map<string, string | null>;
331337 blobs: Map<string, BlobToSend>;
Lines 348–370 at 318 (were 342–351 at 17)
342348 const turnedBinary: TurnedBinary[] = [];
343349 // Exact names: on a case-insensitive disk, known/a.ts would also answer for A.ts, hiding a rename that changes only case.
344350 const knownPaths = new Set(listKnown(root));
351+ const state = stateDir(root);
345352 const knownBlobs = readKnownBlobs(root);
346353 const knownModes = readKnownModes(root);
354+ const trusted = all ? undefined : clean;
347355 for (const rel of walk(root, ignore)) {
348356 const was = knownModes.get(rel) ?? PLAIN;
357+ // Taken before the file is read, so an edit during the read changes the key.
358+ const key =
359+ trusted && knownPaths.has(rel) && was.link === null
360+ ? trusted.key(absolute(root, rel), knownPath(root, rel, state))
361+ : undefined;
362+ if (key && trusted!.check(rel, key)) {
363+ present.add(rel);
364+ const change = modeChange(was, { exec: FILE_MODE ? (key.mode & 0o111) !== 0 : was.exec, link: null });
365+ if (change) modes[rel] = change;
366+ continue;
367+ }
349368 const d = onDisk(absolute(root, rel), was);
350369 if (d === undefined) continue;
351370 if (d.text === undefined) {
Lines 386–398 at 318 (were 367–377 at 17)
367386 if (all || knownBlobs.get(rel) !== b.sha) blobs.set(rel, { sha: b.sha, bytes: b.bytes });
368387 } else {
369388 const text = normalize(d.text);
370− const known = knownPaths.has(rel) ? readKnown(root, rel) : undefined;
389+ const known = knownPaths.has(rel) ? readKnown(root, rel, state) : undefined;
371390 present.add(rel);
372391 // A file the server keeps whole has no known copy, only its hash (#46).
373392 if (all || (known !== text && !(known === undefined && keptWholeAs(text, knownBlobs.get(rel)))))
374393 out.set(rel, text);
394+ if (key && d.link === null && known === text) trusted!.mark(rel, key, d.text.includes("\r"));
395+ else trusted?.drop(rel);
375396 }
376397 // --all sends every file's whole mode, as it sends every file's text.
377398 const change = all ? { exec: d.exec, link: d.link } : modeChange(was, d);
Lines 455–461 at 318 (were 434–440 at 17)
434455 }
435456 const autocrlf = config.get("core.autocrlf");
436457 const coreEol = config.get("core.eol") ?? "native";
437− 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`);
438459 if (attrs === undefined) return out;
439460 const f = attrs.split("\0");
440461 const seen = new Map<string, { text?: string; eol?: string }>();
MCP
compare on this site's /mcp
CLI
abso diff 17 318 client/src/folder.ts --json
JSON
/christopher/abso-core/compare/17..318?file=client%2Fsrc%2Ffolder.ts&format=json