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

Compare

+46 −0 in 3 places
Lines 28–34 at 318 (were 28–33 at 150)
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 426–474 at 318 (were 425–430 at 150)
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 150)
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));
MCP
compare on this site's /mcp
CLI
abso diff 150 318 client/src/changes.ts --json
JSON
/christopher/abso-core/compare/150..318?file=client%2Fsrc%2Fchanges.ts&format=json