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 34 to 35

Compare

+46 −13 in 10 places
Lines 69–75 at 35 (were 69–75 at 34)
6969 return ` ${String(i.id).padStart(3)} ${i.status.padEnd(11)} ${q(i.title)}${detail.length > 0 ? ` (${detail.join("; ")})` : ""}`;
7070}
7171
72−function askLine(a: Ask & { title?: string | null }): string {
72+function askLine(a: Ask & { title?: string | null }, api?: Pick<Api, "attachmentUrl">): string {
7373 const what = a.review ? "a review" : a.kind === "task" ? "a task" : "a question";
7474 const where = a.issue === null ? "" : ` on issue ${a.issue}${a.title ? ` (${q(a.title)})` : ""}`;
7575 const extra = [
Lines 82–94 at 35 (were 82–93 at 34)
8282 a.blocks.length > 0 ? `blocks ${a.blocks.join(", ")}` : "",
8383 ].filter((x) => x !== "");
8484 const head = ` ask ${a.id}: ${a.by}, ${shortWhen(a.at)}, asks ${a.of} ${what}${where}${extra.length > 0 ? ` (${extra.join("; ")})` : ""}: ${q(a.question)}`;
85− const lines = [head];
85+ const lines = [head, ...attachmentLines(api, a.attachments, " ")];
8686 if (a.options.length > 0) lines.push(` options: ${a.options.map((o, i) => `${i + 1}. ${q(o)}`).join(", ")}`);
8787 if (a.recommendation) lines.push(` ${a.recommendation.by} recommends: ${q(a.recommendation.text)}`);
8888 if (a.answer && a.outcome === "withdrawn") {
8989 if (a.answer.words !== "") lines.push(` why: ${q(a.answer.words)}`);
90− } else if (a.answer) lines.push(` answer: ${q(a.answer.words)}`);
90+ } else if (a.answer)
91+ lines.push(` answer: ${q(a.answer.words)}`, ...attachmentLines(api, a.answer.attachments, " "));
9192 return lines.join("\n");
9293}
9394
Lines 129–148 at 35 (were 128–133 at 34)
128129 .filter((v) => v !== "");
129130}
130131
132+/** " with 2 attachments (a…, a…)" after a write that carried some; nothing otherwise. */
133+function withFiles(ids: readonly string[]): string {
134+ return ids.length > 0 ? ` with ${plural(ids.length, "attachment")} (${ids.join(", ")})` : "";
135+}
137+/**
138+ * What to say when a write sent files the server didn't keep: an Issues server from before asks carried
139+ * attachments takes the words and leaves the files out. Nothing to say when it kept them, or none were sent.
140+ */
141+function notKept(sent: readonly string[], kept: readonly string[] | undefined, what: string): string | undefined {
142+ if (sent.length === 0 || (kept !== undefined && sent.every((id) => kept.includes(id)))) return undefined;
143+ return `The Issues server didn't keep the ${sent.length === 1 ? "file" : "files"} on ${what}: it is older than this client. The words went; the ${sent.length === 1 ? "file goes" : "files go"} on a comment instead (abso issue <N> --comment "..." --attach ...).`;
144+}
131146/** The most one attachment may be: the Issues Worker's cap, checked here before sending (abso issue 171). */
132147const ATTACH_MAX = 10 * 1024 * 1024;
133148
Lines 199–206 at 35 (were 184–191 at 34)
184199}
185200
186201/**
187− * abso issue N --save-attachments <folder>: every attachment on the issue and
188− * its comments, written to that folder as <id>-<name>; an svg's own file
202+ * abso issue N --save-attachments <folder>: every attachment on the issue, its
203+ * comments and its asks and answers, written to that folder as <id>-<name>; an svg's own file
189204 * beside the png drawn from it. Not into the abso folder unless abso leaves
190205 * that place out, or the images would be recorded as edits.
191206 */
Lines 212–222 at 35 (were 197–205 at 34)
197212 `${dir} is inside this abso folder, so abso would record the images as your edits. Save them outside the folder, or into a folder .absoignore leaves out`,
198213 );
199214 const seen = new Set<string>();
200− const all = [...(page.issue.attachments ?? []), ...page.comments.flatMap((c) => c.attachments ?? [])].filter(
201− (a) => !seen.has(a.id) && seen.add(a.id),
202− );
215+ const all = [
216+ ...(page.issue.attachments ?? []),
217+ ...page.comments.flatMap((c) => c.attachments ?? []),
218+ ...page.asks.flatMap((a) => [...(a.attachments ?? []), ...(a.answer?.attachments ?? [])]),
219+ ].filter((a) => !seen.has(a.id) && seen.add(a.id));
203220 if (all.length === 0)
204221 return {
205222 text: `Issue ${page.issue.id} has no attachments.`,
Lines 264–270 at 35 (were 247–253 at 34)
247264 ...(i.lines ? [`From ${i.lines.file} lines ${i.lines.from}-${i.lines.to} at version ${i.lines.version}.`] : []),
248265 ...(i.description !== "" ? ["", ...i.description.split("\n").map((l) => ` ${l}`)] : []),
249266 ...attachmentLines(api, i.attachments, " "),
250− ...(p.asks.length > 0 ? ["", "Asks:", ...p.asks.map(askLine)] : []),
267+ ...(p.asks.length > 0 ? ["", "Asks:", ...p.asks.map((a) => askLine(a, api))] : []),
251268 ...(p.comments.length > 0
252269 ? [
253270 "",
Lines 619–625 at 35 (were 602–607 at 34)
602619 const issue = str(args, "issue");
603620 const blocks = str(args, "blocks");
604621 const options = str(args, "options");
622+ const attachments = await uploadAttachments(api, env.cwd, str(args, "attach"));
605623 const r = await api.ask({
606624 of,
607625 question: words.join(" "),
Lines 636–653 at 35 (were 618–630 at 34)
618636 .filter((o) => o !== ""),
619637 }
620638 : {}),
639+ ...(attachments.length > 0 ? { attachments } : {}),
621640 });
622− return { text: `Asked ${of} (ask ${r.id}). They hear it; abso waiting shows what's open.`, json: { id: r.id } };
641+ const lost = notKept(attachments, r.attachments, `ask ${r.id}`);
642+ return {
643+ text: `Asked ${of} (ask ${r.id})${withFiles(attachments)}. They hear it; abso waiting shows what's open.${lost ? ` ${lost}` : ""}`,
644+ json: { id: r.id, ...(attachments.length > 0 ? { attachments } : {}), ...(lost ? { notKept: lost } : {}) },
645+ };
623646}
624647
625648/** abso ask --withdraw <ask> [--note "why"]: the asker takes an ask back. It closes like an answer, and the one asked hears it. */
626649async function withdrawAsk(args: Parsed, env: Env, word: string): Promise<Output> {
627− const others = ["issue", "due", "blocks", "options"].filter((f) => str(args, f) !== undefined);
650+ const others = ["issue", "due", "blocks", "options", "attach"].filter((f) => str(args, f) !== undefined);
628651 if (args.positionals.length > 0 || others.length > 0 || bool(args, "review") || bool(args, "task"))
629652 throw new UsageError('abso ask --withdraw <ask> [--note "why"] takes nothing else: it takes back an ask you made');
630653 const id = issueNumber(word, "the ask number");
Lines 705–711 at 35 (were 682–688 at 34)
682705 ? `Nothing is waiting${of ? ` on ${of}` : ""}.`
683706 : [
684707 `${plural(asks.length, "open ask")}${of ? ` of ${of}` : ""}, soonest due first:`,
685− ...asks.map(askLine),
708+ ...asks.map((a) => askLine(a, api)),
686709 'abso answer <ask> "..." answers one asked of you.',
687710 ].join("\n"),
688711 json: { asks },
Lines 721–741 at 35 (were 698–708 at 34)
698721 throw new UsageError('abso answer <ask> "<words>" | --option <N> [--note "..."] | --done [--note "..."]');
699722 const { api } = openIssues(env);
700723 const note = str(args, "note");
724+ const attachments = await uploadAttachments(api, env.cwd, str(args, "attach"));
701725 const r = await api.answer(id, {
702726 ...(words.length > 0 ? { words: words.join(" ") } : {}),
703727 ...(option !== undefined ? { option: /^\d+$/.test(option) ? Number(option) - 1 : option } : {}),
704728 ...(done ? { done: true } : {}),
705729 ...(note !== undefined ? { note } : {}),
730+ ...(attachments.length > 0 ? { attachments } : {}),
706731 });
707− return { text: `Answered ask ${id}. ${r.ask.by} hears it.`, json: { ask: r.ask } };
732+ const lost = notKept(
733+ attachments,
734+ r.ask.answer?.attachments?.map((a) => a.id),
735+ `your answer to ask ${id}`,
736+ );
737+ return {
738+ text: `Answered ask ${id}${withFiles(attachments)}. ${r.ask.by} hears it.${lost ? ` ${lost}` : ""}`,
739+ json: { ask: r.ask, ...(lost ? { notKept: lost } : {}) },
740+ };
708741}
MCP
compare on this site's /mcp
CLI
abso diff 34 35 client/src/issues.ts --json
JSON
/christopher/abso-core/compare/34..35?file=client%2Fsrc%2Fissues.ts&format=json