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
MCP
blame on this site's /mcp
CLI
abso blame client/src/without.ts --json
JSON
/christopher/abso-core/blame/client/src/without.ts?format=json
53 linescandidates 100%Last change candidates in version 186,

53 lines from 1 change in 1 version.

candidates186Read a version of shared without some earlier versions: abso show <N> --without A,B shows what differs and abso export <dir> --version N --without A,B writes the files. The server's GET without?version=&versions= checks the set left exactly as asked: when a version it keeps builds on one left out, it refuses with that chain, the files and the wider set that works, and never widens it. Atoms keep their ids and authors; shared and its log don't change; the same ask gives the same tree hash.Compare1// --without <version,...> on abso show and abso export: a version of shared with some earlier versions left out.
2// The server reads it; shared doesn't change. When a version kept builds on one left out, it is refused with
3// that chain and the wider set that works, which is never taken without being asked.
4
5import type { VersionRef, WithoutAnswer } from "./api.ts";
6import { type Parsed, str, UsageError } from "./args.ts";
7
8/** The versions --without names, sorted, or undefined without it. */
9export function withoutArg(args: Parsed): number[] | undefined {
10 const raw = str(args, "without");
11 if (raw === undefined) return undefined;
12 const words = raw
13 .split(",")
14 .map((w) => w.trim())
15 .filter((w) => w !== "");
16 if (words.length === 0 || words.some((w) => !/^\d+$/.test(w)))
17 throw new UsageError(`--without takes version numbers, like --without 37,38 (got ${JSON.stringify(raw)})`);
18 return [...new Set(words.map(Number))].toSorted((a, b) => a - b);
21/** "version 37", "versions 37 and 38", "versions 37, 38 and 40". */
22export function versionsText(versions: readonly number[]): string {
23 if (versions.length === 1) return `version ${versions[0]}`;
24 return `versions ${versions.slice(0, -1).join(", ")} and ${versions[versions.length - 1]}`;
27function ref(v: VersionRef): string {
28 return ` version ${v.version} by ${v.agent}: ${v.message}`;
31/** The heading of an answer: the version and what it leaves out, one line each. */
32export function withoutHeading(answer: WithoutAnswer): string[] {
33 return [
34 `Version ${answer.version} of shared without ${versionsText(answer.without.map((w) => w.version))}:`,
35 ...answer.without.map(ref),
36 ];
39/** A refusal: which kept versions build on what is left out, and the ask that would work (`retry` writes it). */
40export function refusalText(
41 answer: Extract<WithoutAnswer, { ok: false }>,
42 retry: (versions: readonly number[]) => string,
43): string {
44 const asked = answer.without.map((w) => w.version);
45 return [
46 `Version ${answer.version} of shared can't leave out ${versionsText(asked)}: versions it keeps build on ${asked.length === 1 ? "it" : "them"}.`,
47 ...answer.dependents.flatMap((d) => [
48 ref(d),
49 ` builds on ${d.needs.map((n) => `version ${n.version} (${n.files.join(", ") || "no file of its own"})`).join(", ")}`,
50 ]),
51 `Leaving those out too works: ${retry(answer.suggestion)}`,
52 ].join("\n");