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

Compare

+47 −15 in 12 places
Lines 8–20 at 318 (were 8–18 at 41)
88import { bool, type Parsed, UsageError } from "./args.ts";
99import { readKnownBlobs, writeKnownBlobs } from "./blobs.ts";
1010import { ciText } from "./ci.ts";
11−import { newerCommitNote } from "./client-version.ts";
11+import { CleanFiles } from "./clean-files.ts";
12+import { newerClientNote } from "./client-version.ts";
1213import { type Env, heard, type Output, open, plural } from "./command-env.ts";
1314import {
1415 LISTED,
1516 leftOutText,
17+ pullUnfinishedText,
1618 READER_REFUSES,
1719 readUnwritten,
1820 recordedFirst,
Lines 28–34 at 318 (were 26–31 at 41)
2628 absolute,
2729 forgetKnown,
2830 isLocalOnly,
31+ knownPath,
2932 listKnown,
3033 newFileEndings,
3134 normalize,
Lines 40–46 at 318 (were 37–42 at 41)
3740} from "./folder.ts";
3841import { fileArg } from "./history.ts";
3942import { modsBehindText } from "./install.ts";
43+import { isLocal } from "./local-store.ts";
4044import { withFolderLock } from "./lock.ts";
4145import { readKnownModes, writeKnownModes } from "./modes.ts";
4246import { queueText } from "./queue.ts";
Lines 72–95 at 318 (were 68–80 at 41)
6872 * line endings (#37: Python's text mode on Windows writes CRLF).
6973 * abso records them, and abso run sends them, with LF; a tool run here sees
7074 * CRLF. Files git would check out with CRLF are left out of the list.
75+ * With `clean` (status), a file found unchanged before is answered without reading it.
7176 */
72−export function crlfOnly(root: string): string[] {
77+export function crlfOnly(root: string, clean?: CleanFiles): string[] {
7378 const out: string[] = [];
79+ const state = stateDir(root);
7480 for (const rel of listKnown(root)) {
81+ const key = clean?.key(absolute(root, rel), knownPath(root, rel, state));
82+ const was = key && clean!.check(rel, key);
83+ if (was) {
84+ if (was.cr) out.push(rel);
85+ continue;
86+ }
7587 const disk = readText(absolute(root, rel));
7688 if (disk === undefined || !disk.includes("\r")) continue;
77− if (normalize(disk) === readKnown(root, rel)) out.push(rel);
89+ if (normalize(disk) === readKnown(root, rel, state)) {
90+ out.push(rel);
91+ if (key) clean!.mark(rel, key, true);
92+ }
7893 }
7994 const git = newFileEndings(root, out);
8095 return out.filter((rel) => git.get(rel) !== "crlf").sort();
Lines 150–157 at 318 (were 135–142 at 41)
135150 writeConfig(root, raw as unknown as Settings);
136151 return {
137152 text: on
138− ? "This folder is a reader now: status, sync, log, show, files and export work, and nothing it does is recorded or published. abso reader off undoes it."
139− : "This folder records and publishes again.",
153+ ? "This folder is a reader now: status, pull, log, show, files and export work, and nothing it does is recorded or pushed. abso reader off undoes it."
154+ : "This folder records and pushes again.",
140155 json: { reader: on },
141156 };
142157}
Lines 160–166 at 318 (were 145–151 at 41)
145160export function openCollisionsText(open: readonly OpenCollision[]): string[] {
146161 if (open.length === 0) return [];
147162 return [
148− `${plural(open.length, "collision")} to settle before you publish (keep yours, theirs or a mix and delete the marker lines, or abso settle <file> --yours|--theirs|--both):`,
163+ `${plural(open.length, "collision")} to settle before you push (keep yours, theirs or a mix and delete the marker lines, or abso settle <file> --yours|--theirs|--both):`,
149164 ...open.map(
150165 (c) =>
151166 ` ${c.file} lines ${c.lines[0]}-${c.lines[1]}, with ${c.theirs.agent}'s version ${c.theirs.version} ("${c.theirs.message}")`,
Lines 218–224 at 318 (were 203–209 at 41)
203218 });
204219 return {
205220 text: [
206− `Moved ${from} to ${to} in your draft; its lines keep their history. It reaches shared with your next publish.`,
221+ `Moved ${from} to ${to} in your draft; its lines keep their history. It reaches shared with your next push.`,
207222 ...(isComposed(to) ? [] : [uncomposedText(to)]),
208223 ].join("\n"),
209224 json: { from: answer.from, to: answer.to },
Lines 262–268 at 318 (were 247–253 at 41)
247262 return {
248263 text: [
249264 ...recordedFirst(recorded).filter((l) => !l.startsWith("Recorded first")),
250− `Settled ${counts.map(([rel, n]) => `${plural(n, "block")} in ${rel}`).join(", ")}, keeping ${which}.${keep === "both" ? " Both sides stay in the file; when you publish, the other author hears that you kept both." : ""}`,
265+ `Settled ${counts.map(([rel, n]) => `${plural(n, "block")} in ${rel}`).join(", ")}, keeping ${which}.${keep === "both" ? " Both sides stay in the file; when you push, the other author hears that you kept both." : ""}`,
251266 ].join("\n"),
252267 json: { keep, files: counts.map(([file, blocks]) => ({ file, blocks })), recorded: recorded.sent },
253268 };
Lines 276–316 at 318 (were 261–287 at 41)
261276 ? missing.join(", ")
262277 : `${missing.slice(0, LISTED).join(", ")}, and ${missing.length - LISTED} more`;
263278 return [
264− `Missing from this folder though your view has ${missing.length === 1 ? "it" : "them"} (abso sync --full writes ${missing.length === 1 ? "it" : "them"}; abso files lists them all): ${some}`,
279+ `Missing from this folder though your view has ${missing.length === 1 ? "it" : "them"} (abso pull --full writes ${missing.length === 1 ? "it" : "them"}; abso files lists them all): ${some}`,
265280 ];
266281}
267282
268283export async function runStatus(args: Parsed, env: Env): Promise<Output> {
269284 const { root, config, api } = open(env);
285+ if (config.visitor) {
286+ // A folder that reads signed out: shared's version and whether it's green. It holds no files to compare.
287+ const status = await api.status();
288+ return {
289+ text: [
290+ `Project ${config.project}: shared is at version ${status.version}. This folder reads it signed out, sending no sign-in: status, log, show, files, blame, why, where, issues, issue and search work here. To work on it: abso login, then abso join ${config.project} in a new folder.`,
291+ ...ciText(status.ci ?? undefined, status.version),
292+ ].join("\n"),
293+ json: { project: config.project, version: status.version, visitor: true, ci: status.ci ?? null },
294+ };
295+ }
270296 const short = bool(args, "short");
271297 const { files: view, ...status } = short ? { ...(await api.status()), files: undefined } : await api.statusAndFiles();
272− const pending = unrecorded(root);
298+ const clean = CleanFiles.load(root);
299+ const pending = unrecorded(root, false, new Set(), clean);
273300 const local = new Set([...pending.files.keys(), ...pending.blobs.keys(), ...Object.keys(pending.modes)]);
274301 if (short) {
302+ clean.save();
275303 // One word to stamp a build with (#37): 214, coast@3, 214+unpublished.
276304 const me = status.agents.find((a) => a.agent === config.agent);
277305 const unpublished = local.size > 0 || (me?.draftChanges ?? 0) > 0;
278306 // +queued: published into the merge queue, not landed yet (#39).
279− const word = `${me?.draft ? `${me.draft}@` : ""}${me?.base ?? "none"}${unpublished ? "+unpublished" : ""}${(me?.queued?.length ?? 0) > 0 ? "+queued" : ""}`;
307+ const word = `${me?.draft ? `${me.draft}@` : ""}${me?.base ?? "none"}${unpublished ? "+unpushed" : ""}${(me?.queued?.length ?? 0) > 0 ? "+queued" : ""}`;
280308 return { text: word, json: { version: me?.base ?? null, draft: me?.draft ?? null, unpublished, word } };
281309 }
282310 const missing = view === undefined ? [] : missingHere(root, view.files, local);
283311 const unwritten = readUnwritten(root);
284− const crlf = crlfOnly(root);
312+ const crlf = crlfOnly(root, clean);
313+ clean.save();
285314 // Files an earlier record added to the draft and that are gone again (#37: scratch files a run
286315 // recorded, deleted after): nothing reached shared, and the next record takes them out of the draft.
287316 const deleted = [...pending.files].filter(([, text]) => text === null).map(([rel]) => rel);
Lines 326–336 at 318 (were 297–305 at 41)
297326 const space = (draft: string | null | undefined): string => (draft ? `draft ${draft}` : "shared");
298327 const parked = (me?.parked ?? []).filter((p) => p.draftChanges > 0);
299328 const credential = credentialLabel(root, config.server, env.env);
300− const behind = await newerCommitNote(config.server);
329+ // A local project reaches for nothing on the network, npm included.
330+ const localProject = isLocal(config.server);
331+ const behind = localProject ? undefined : await newerClientNote(config.server);
301332 const lines = [
302− `Project ${config.project}: shared is at version ${status.version}. This folder is ${config.agent}${config.reader || me?.reader ? ", a reader (it records and publishes nothing)" : ""}, working in ${space(me?.draft)}.${config.follow ? ` It follows label ${config.follow}: syncs take it to the newest version with that label.` : ""} Signed in with ${credential.kind}${credential.id ? ` ${credential.id}` : ""}.`,
333+ `Project ${config.project}: shared is at version ${status.version}. This folder is ${config.agent}${config.reader || me?.reader ? ", a reader (it records and pushes nothing)" : ""}, working in ${space(me?.draft)}.${config.follow ? ` It follows label ${config.follow}: pulls take it to the newest version with that label.` : ""}${localProject ? ` It's a local project, in ${join(config.localStore ?? "", config.project)}.` : ` Signed in with ${credential.kind}${credential.id ? ` ${credential.id}` : ""}.`}`,
303334 ...(behind ? [behind] : []),
304335 // Is shared green (#39)? Right under the first line, since it decides what to do next.
305336 ...ciText(status.ci, status.version),
Lines 345–351 at 318 (were 314–320 at 41)
314345 : `Not yet recorded (abso record sends them): ${[...local.keys()].join(", ")}`,
315346 ...(neverShared.length > 0
316347 ? [
317− `Added 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: ${neverShared.join(", ")}`,
348+ `Added 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: ${neverShared.join(", ")}`,
318349 ]
319350 : []),
320351 ...openCollisionsText(me?.collisions ?? []),
Lines 353–359 at 318 (were 322–327 at 41)
322353 ...modsBehindText(env.env),
323354 ...missingText(missing),
324355 ...unwrittenText(unwritten),
356+ ...pullUnfinishedText(root),
325357 ...(crlf.length > 0
326358 ? [
327359 `${plural(crlf.length, "file")} differ${crlf.length === 1 ? "s" : ""} from what abso recorded only in line endings (CRLF here; abso records and abso run sends LF). Harmless; abso fix-eol rewrites ${crlf.length === 1 ? "it" : "them"} with LF.`,
MCP
compare on this site's /mcp
CLI
abso diff 41 318 client/src/status-commands.ts --json
JSON
/christopher/abso-core/compare/41..318?file=client%2Fsrc%2Fstatus-commands.ts&format=json