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

Compare

+57 −11 in 9 places
Lines 28–34 at 318 (were 28–33 at 86)
2828import { byWhom } from "./history-answers.ts";
2929import { applyMode, PLAIN, readKnownModes, writeKnownModes } from "./modes.ts";
3030import { refusedText, screenAnswer } from "./safety.ts";
31+import { refusalText, withoutArg, withoutHeading } from "./without.ts";
3132
3233/** The space to read: --draft (where "shared" means shared), else the one this agent is in (shared, in a folder with no agent). */
3334function space(args: Parsed, agent: string): Where {
Lines 88–94 at 318 (were 87–93 at 86)
8788 return {
8889 text: [
8990 mine
90− ? `Your view holds ${what}: ${spaceName(answer.draft)} at version ${answer.version}, with your unpublished changes.${missing.size > 0 ? ` ${missing.size} of them ${missing.size === 1 ? "is" : "are"} missing from this folder (abso sync --full writes them).` : ""}`
91+ ? `Your view holds ${what}: ${spaceName(answer.draft)} at version ${answer.version}, with your unpushed changes.${missing.size > 0 ? ` ${missing.size} of them ${missing.size === 1 ? "is" : "are"} missing from this folder (abso pull --full writes them).` : ""}`
9192 : `${spaceName(answer.draft)} at version ${answer.version} holds ${what}.`,
9293 ...files.map((f) => (missing.has(f) ? `${f} (missing from this folder)` : f)),
9394 ].join("\n"),
Lines 146–160 at 318 (were 145–159 at 86)
145146 const other = str(args, "agent");
146147 if (other !== undefined) {
147148 if (between || str(args, "draft") !== undefined)
148− throw new UsageError("--agent shows that agent's unpublished changes: abso diff [file...] --agent <name>");
149+ throw new UsageError("--agent shows that agent's unpushed changes: abso diff [file...] --agent <name>");
149150 const answer = await api.diffOf(other);
150151 const files = pick(answer.files);
151152 const d = diffs(files);
152153 const where = `${spaceName(answer.draft)}${answer.base === null ? "" : ` (on version ${answer.base})`}`;
153154 const head =
154155 files.length === 0
155− ? `${other} has no recorded, unpublished changes${inPaths(only, "to")} in ${where}.`
156− : `${other}'s recorded, unpublished changes${inPaths(only, "to")} in ${where}: ${totals(files)}.`;
156+ ? `${other} has no recorded, unpushed changes${inPaths(only, "to")} in ${where}.`
157+ : `${other}'s recorded, unpushed changes${inPaths(only, "to")} in ${where}: ${totals(files)}.`;
157158 return {
158159 text: [head, ...d.text].join("\n"),
159160 json: { agent: other, draft: answer.draft, base: answer.base, files: d.json, unmatched: unmatched(files) },
Lines 180–186 at 318 (were 179–185 at 86)
179180
180181 if (str(args, "draft") !== undefined)
181182 throw new UsageError(
182− "--draft goes with two versions (abso diff <from> <to>); abso diff alone shows your own unpublished changes",
183+ "--draft goes with two versions (abso diff <from> <to>); abso diff alone shows your own unpushed changes",
183184 );
184185 // Folder-only edits count as unpublished changes too.
185186 const recorded = await recordFolder(root, api);
Lines 190–197 at 318 (were 189–196 at 86)
189190 const where = `${spaceName(answer.draft)}${answer.base === null ? "" : ` (on version ${answer.base})`}`;
190191 const head =
191192 files.length === 0
192− ? `No unpublished changes${inPaths(only, "to")} in ${where}.`
193− : `Your unpublished changes${inPaths(only, "to")} in ${where}: ${totals(files)}.`;
193+ ? `No unpushed changes${inPaths(only, "to")} in ${where}.`
194+ : `Your unpushed changes${inPaths(only, "to")} in ${where}: ${totals(files)}.`;
194195 const pre = recordedFirst(recorded);
195196 return {
196197 text: [...pre, head, ...notes(files), ...d.text].join("\n"),
Lines 288–294 at 318 (were 287–293 at 86)
287288 if (v.drops && v.drops.length > 0)
288289 out.push(` drops ${v.drops.length === 1 ? "version" : "versions"} ${v.drops.join(", ")}`);
289290 if (v.droppedIn !== undefined) out.push(` dropped in version ${v.droppedIn}: shared no longer has these changes`);
290− if (v.originalMessage !== undefined) out.push(` amended; first published as: ${v.originalMessage}`);
291+ if (v.originalMessage !== undefined) out.push(` amended; first pushed as: ${v.originalMessage}`);
291292 return out;
292293}
293294
Lines 426–474 at 318 (were 425–430 at 86)
425426 return { text: lines.join("\n"), json: { ...answer } };
426427}
427428
429+/** abso show <version>[:<file>] --without <versions>: what differs with them left out, or that file then. */
430+async function showWithout(
431+ api: Api,
432+ root: string,
433+ cwd: string,
434+ word: string,
435+ where: Where,
436+ leave: readonly number[],
437+): Promise<Output> {
438+ if ("draft" in where && where.draft !== null) throw new UsageError("--without reads shared, not a named draft");
439+ const colon = word.indexOf(":");
440+ const v = version(colon >= 0 ? word.slice(0, colon) : word);
441+ const path = colon >= 0 ? fileArg(root, cwd, word.slice(colon + 1)) : undefined;
442+ const answer = await api.without(v, leave);
443+ if (!answer.ok)
444+ return {
445+ exit: EXIT.refused,
446+ text: refusalText(answer, (vs) => `abso show ${word} --without ${vs.join(",")}`),
447+ json: { ...answer },
448+ };
449+ if (path !== undefined) {
450+ const file = answer.files.find((f) => f.path === path);
451+ if (file === undefined) {
452+ const same = await api.fileAt(path, v, { draft: null });
453+ if (same.text !== null) return { text: same.text, json: { ...same, without: answer.without } };
454+ } else if (file.after !== null) return { text: file.after, json: { ...file, without: answer.without } };
455+ return {
456+ exit: EXIT.error,
457+ text: `${path} isn't in version ${v} of shared without them.`,
458+ json: { path, version: v, without: answer.without },
459+ };
460+ }
461+ const changed = pairRenames(answer.files);
462+ const d = diffs(changed);
463+ const lines = [
464+ ...withoutHeading(answer),
465+ changed.length === 0 ? `No file differs from version ${v}.` : `Compared with version ${v}: ${totals(changed)}.`,
466+ `The files hash to ${answer.tree}; the same ask gives the same hash. Shared doesn't change.`,
467+ ...d.text,
468+ ];
469+ return { text: lines.join("\n"), json: { ...answer, files: d.json } };
470+}
428472export async function runShow(args: Parsed, env: Env): Promise<Output> {
429473 if (args.positionals.length !== 1)
430474 throw new UsageError("show takes one version: abso show <version> or abso show <version>:<file>");
Lines 476–483 at 318 (were 432–437 at 86)
432476 const word = args.positionals[0]!;
433477 const colon = word.indexOf(":");
434478 const where = space(args, config.agent);
479+ const leave = withoutArg(args);
480+ if (leave !== undefined) return showWithout(api, root, env.cwd, word, where, leave);
435481
436482 if (colon >= 0) {
437483 const v = version(word.slice(0, colon));
Lines 644–655 at 318 (were 598–609 at 86)
598644 );
599645 const lines = [
600646 restored.length + deleted.length === 0
601− ? "Nothing to restore: no unpublished changes there."
602− : `Discarded your unpublished changes to ${plural(restored.length + deleted.length, "file")}:`,
647+ ? "Nothing to restore: no unpushed changes there."
648+ : `Discarded your unpushed changes to ${plural(restored.length + deleted.length, "file")}:`,
603649 ...restored.map((f) => ` restored ${f}`),
604650 ...deleted.map((f) => ` deleted ${f} (it is new in your draft)`),
605651 ...(untouched.length > 0 && restored.length + deleted.length > 0
606− ? [`No unpublished changes to: ${untouched.join(", ")}`]
652+ ? [`No unpushed changes to: ${untouched.join(", ")}`]
607653 : []),
608654 ...refusedText(refused),
609655 ];
MCP
compare on this site's /mcp
CLI
abso diff 86 318 client/src/changes.ts --json
JSON
/christopher/abso-core/compare/86..318?file=client%2Fsrc%2Fchanges.ts&format=json