{"draft":null,"from":175,"to":318,"files":[{"path":"client/src/without.ts","added":53,"removed":0,"diff":"--- /dev/null\n+++ b/client/src/without.ts\n@@ -0,0 +1,53 @@\n+// --without <version,...> on abso show and abso export: a version of shared with some earlier versions left out.\n+// The server reads it; shared doesn't change. When a version kept builds on one left out, it is refused with\n+// that chain and the wider set that works, which is never taken without being asked.\n+\n+import type { VersionRef, WithoutAnswer } from \"./api.ts\";\n+import { type Parsed, str, UsageError } from \"./args.ts\";\n+\n+/** The versions --without names, sorted, or undefined without it. */\n+export function withoutArg(args: Parsed): number[] | undefined {\n+\tconst raw = str(args, \"without\");\n+\tif (raw === undefined) return undefined;\n+\tconst words = raw\n+\t\t.split(\",\")\n+\t\t.map((w) => w.trim())\n+\t\t.filter((w) => w !== \"\");\n+\tif (words.length === 0 || words.some((w) => !/^\\d+$/.test(w)))\n+\t\tthrow new UsageError(`--without takes version numbers, like --without 37,38 (got ${JSON.stringify(raw)})`);\n+\treturn [...new Set(words.map(Number))].toSorted((a, b) => a - b);\n+}\n+\n+/** \"version 37\", \"versions 37 and 38\", \"versions 37, 38 and 40\". */\n+export function versionsText(versions: readonly number[]): string {\n+\tif (versions.length === 1) return `version ${versions[0]}`;\n+\treturn `versions ${versions.slice(0, -1).join(\", \")} and ${versions[versions.length - 1]}`;\n+}\n+\n+function ref(v: VersionRef): string {\n+\treturn `  version ${v.version} by ${v.agent}: ${v.message}`;\n+}\n+\n+/** The heading of an answer: the version and what it leaves out, one line each. */\n+export function withoutHeading(answer: WithoutAnswer): string[] {\n+\treturn [\n+\t\t`Version ${answer.version} of shared without ${versionsText(answer.without.map((w) => w.version))}:`,\n+\t\t...answer.without.map(ref),\n+\t];\n+}\n+\n+/** A refusal: which kept versions build on what is left out, and the ask that would work (`retry` writes it). */\n+export function refusalText(\n+\tanswer: Extract<WithoutAnswer, { ok: false }>,\n+\tretry: (versions: readonly number[]) => string,\n+): string {\n+\tconst asked = answer.without.map((w) => w.version);\n+\treturn [\n+\t\t`Version ${answer.version} of shared can't leave out ${versionsText(asked)}: versions it keeps build on ${asked.length === 1 ? \"it\" : \"them\"}.`,\n+\t\t...answer.dependents.flatMap((d) => [\n+\t\t\tref(d),\n+\t\t\t`    builds on ${d.needs.map((n) => `version ${n.version} (${n.files.join(\", \") || \"no file of its own\"})`).join(\", \")}`,\n+\t\t]),\n+\t\t`Leaving those out too works: ${retry(answer.suggestion)}`,\n+\t].join(\"\\n\");\n+}"}],"unmatched":[]}