- MCP
- show on this site's /mcp
- CLI
- abso show 5 --json
- JSON
- /christopher/abso-core/versions/5?format=json
abso issue new and abso issue N --comment take --attach <file,file> (abso issue 171). Each file goes up to the Issues Worker first (POST /p/:project/a/:agent/attachments, the bytes as the body and the name URI-encoded in X-Avcs-Name), and the write carries the ids the uploads answered. Nothing is sent if a file is missing or over 10 MB. --attach anywhere else is refused. The issue's page lists each attachment under the issue or comment carrying it: id, name, size and its link. The wire types gain Attachment and attachments?. MCP's issue tool takes attach too, since its parameters come from the flags. The server side is abso 621 (off until Cloud binds the bucket). Tests: client/test/attach.test.ts, against a stand-in Issues server. Checked: biome ci, npm run check (698 pass).
of shared·pinch··Not checked
Version 4 · Files at version 5
5 files, 292 lines added, 19 removed.
--- a/client/src/api.ts
+++ b/client/src/api.ts
@@ -50,7 +50,7 @@
53−import type { Ask, Draft, DraftBody, News as IssueNews, IssuePage, IssueRow } from "./issues-wire.ts";
53+import type { Ask, Attachment, Draft, DraftBody, News as IssueNews, IssuePage, IssueRow } from "./issues-wire.ts";
5555
@@ -65,7 +65,7 @@
68−export type { Ask, Draft, DraftBody, IssueNews, IssuePage, IssueRow };
6969
@@ -400,10 +400,39 @@
402402
403− issueOpen(body: DraftBody & { title: string }): Promise<{ id: number; news?: IssueNews }> {
403+ issueOpen(body: DraftBody & { title: string; attachments?: string[] }): Promise<{ id: number; news?: IssueNews }> {
406406
407+ /** Uploads an image to the Issues Worker (abso issue 171): it checks the type by the bytes, strips metadata and answers its id. */
410+ throw new ApiError(`${this.config.server} has no Issues Worker beside it; AVCS_ISSUES_SERVER names one`);
416+ headers: { ...this.headers("application/octet-stream"), "x-avcs-name": encodeURIComponent(name) },
423+ `could not reach ${this.issuesServer}: ${(e.cause as Error | undefined)?.message ?? e.message}`,
427+ if (!res.ok) throw new ApiError(`uploading ${name} answered ${res.status}: ${errorSentence(text)}`, res.status);
430+
435+
407436 /** An edit (abso issue 3): it tells the issue's watchers, and `also`, unless `notify` is false. null clears a parent or Agent. */
@@ -422,8 +451,17 @@
424453
425− issueComment(id: number, text: string, objection = false): Promise<{ id: number; news?: IssueNews }> {
426− return this.#issues("POST", this.agentPath(`issue/${id}/comment`), { text, ...(objection ? { objection } : {}) });
428466
--- a/client/src/issues-wire.ts
+++ b/client/src/issues-wire.ts
@@ -45,8 +45,19 @@
4951
52+/** An image on an issue or comment (abso issue 171): GET /p/:project/attachments/<id> serves it. */
60+
@@ -74,7 +85,7 @@
7586
77− issue: IssueRow & { description: string; lines: Lines | null; watchers: string[] };
88+ issue: IssueRow & { description: string; lines: Lines | null; watchers: string[]; attachments?: Attachment[] };
--- a/client/src/issues.ts
+++ b/client/src/issues.ts
@@ -5,7 +5,9 @@
77
8−import type { Api, Ask, Draft, DraftBody, IssuePage, IssueRow } from "./api.ts";
@@ -107,8 +109,48 @@
109111
112+/** The most one attachment may be: the Issues Worker's cap, checked here before sending (abso issue 171). */
114+
115+/** Uploads each file --attach names (comma-separated), in order, and answers their ids. Nothing is sent if a file is missing or too big. */
116+async function uploadAttachments(api: Api, cwd: string, value: string | undefined): Promise<string[]> {
119+ if (paths.length === 0) throw new UsageError("--attach names files, comma-separated: --attach shot.png,after.png");
129+ throw new UsageError(`--attach ${p} is ${sizeText(size)}; one attachment is at most ${sizeText(ATTACH_MAX)}`);
133+ for (const f of files) ids.push((await api.attachmentUpload(readFileSync(f.full), f.name)).id);
136+
138+ return n < 1024 ? `${n} B` : n < 1024 * 1024 ? `${Math.round(n / 1024)} KB` : `${(n / (1024 * 1024)).toFixed(1)} MB`;
140+
148+ (a) => `${indent}attached ${a.id}: ${q(a.name)}, ${sizeText(a.size)}${api ? `, ${api.attachmentUrl(a.id)}` : ""}`,
151+
111−export function issuePage(p: IssuePage): string[] {
@@ -128,14 +170,16 @@
129171 ...(i.lines ? [`From ${i.lines.file} lines ${i.lines.from}-${i.lines.to} at version ${i.lines.version}.`] : []),
136− ...p.comments.map(
137− (c) => ` ${c.by}${c.kind === "objection" ? " objects" : ""}, ${shortWhen(c.at)}: ${q(c.text)}`,
138− ),
@@ -286,8 +330,13 @@
287331 'avcs issue new "<title>" [--description "..."] [--parent <N>] [--lines <file>:<from>-<to>@<version>] [--agent <agent>] [--blocked-by <N,N>] [--notify <who,who>] [--label <l,l>]',
289− const r = await api.issueOpen({ ...openFields(args, rest.join(" ")), title: rest.join(" ") });
290− return { text: `Opened issue ${r.id}. avcs start "..." --issue ${r.id} starts on it.`, json: { id: r.id } };
335+ const r = await api.issueOpen({ ...fields, ...(attachments.length > 0 ? { attachments } : {}) });
337+ text: `Opened issue ${r.id}${attachments.length > 0 ? ` with ${plural(attachments.length, "attachment")} (${attachments.join(", ")})` : ""}. avcs start "..." --issue ${r.id} starts on it.`,
@@ -340,11 +389,14 @@
341390 "--quiet and --notify go with an edit (--title, --description, --parent, --agent, --blocked-by, --label or --unlabel)",
344− const r = await api.issueComment(id, (comment ?? object)!, object !== undefined);
346− text: `${object !== undefined ? "Objected" : "Commented"} on issue ${id}. Its agents hear it.`,
347− json: { id: r.id, issue: id },
398+ text: `${object !== undefined ? "Objected" : "Commented"} on issue ${id}${attachments.length > 0 ? ` with ${plural(attachments.length, "attachment")} (${attachments.join(", ")})` : ""}. Its agents hear it.`,
@@ -373,7 +425,7 @@
376− return { text: issuePage(page).join("\n"), json: { ...page } };
378430
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -365,11 +365,12 @@
370− 'avcs issue <N> [--comment "..." | --object "..." | --drop | --reopen | --done [--done-by <version>]] | avcs issue <N> [--title "..."] [--description "..."] [--parent <N|none>] [--agent <agent|none>] [--blocked-by <N,N|none>] [--label <l,l>] [--unlabel <l,l>] [--notify <who,who> | --quiet] | avcs issue new "<title>" [--description "..."] [--parent <N>] [--lines <file>:<from>-<to>@<version>] [--agent <agent>] [--blocked-by <N,N>] [--notify <who,who>] [--label <l,l>]',
371+ 'avcs issue <N> [--comment "..." [--attach <file,file>] | --object "..." | --drop | --reopen | --done [--done-by <version>]] | avcs issue <N> [--title "..."] [--description "..."] [--parent <N|none>] [--agent <agent|none>] [--blocked-by <N,N|none>] [--label <l,l>] [--unlabel <l,l>] [--notify <who,who> | --quiet] | avcs issue new "<title>" [--description "..."] [--parent <N>] [--lines <file>:<from>-<to>@<version>] [--agent <agent>] [--blocked-by <N,N>] [--notify <who,who>] [--label <l,l>] [--attach <file,file>]',
372− "One issue: its description, Agent, Blocked by, labels, asks, comments, edits, sub-issues and watchers. --comment comments on it and --object objects; its agents hear either. --drop drops it. --reopen opens a dropped issue again. --done marks it done by hand, and --done-by <version> names the published version that did it. publish --done still marks it done too. --title, --description, --parent, --agent and --blocked-by edit it, and the edit tells its watchers (who opened it, its Agent and agents, its Reviewer, whoever was named in Notify, and whoever commented); --notify tells more people, --quiet tells nobody. --label adds labels and --unlabel takes them off (friction, area:client: lower-case letters, digits and - _ . :); a label-only edit tells nobody unless --notify names people. An issue is Blocked until each issue it's blocked by is Done. avcs issue new opens one; --lines ties it to lines at a version of shared, --agent says who it's for, --notify tells people now, and --label labels it. avcs issue draft \"<title>\" [the same fields] saves a draft instead: yours alone, with no number and no news; avcs issue draft <D> [fields] changes it, --open opens it as an issue, --delete deletes it.",
373+ "One issue: its description, Agent, Blocked by, labels, asks, comments, edits, sub-issues and watchers. --comment comments on it and --object objects; its agents hear either. --drop drops it. --reopen opens a dropped issue again. --done marks it done by hand, and --done-by <version> names the published version that did it. publish --done still marks it done too. --title, --description, --parent, --agent and --blocked-by edit it, and the edit tells its watchers (who opened it, its Agent and agents, its Reviewer, whoever was named in Notify, and whoever commented); --notify tells more people, --quiet tells nobody. --label adds labels and --unlabel takes them off (friction, area:client: lower-case letters, digits and - _ . :); a label-only edit tells nobody unless --notify names people. An issue is Blocked until each issue it's blocked by is Done. avcs issue new opens one; --lines ties it to lines at a version of shared, --agent says who it's for, --notify tells people now, and --label labels it. --attach shot.png,after.png puts images on a new issue or a comment (png, jpeg, gif or webp, 10 MB each; the server checks the type by the bytes and takes out metadata such as where a photo was taken), and prints each one's id for the text to point at; the issue's page lists them with a link. avcs issue draft \"<title>\" [the same fields] saves a draft instead: yours alone, with no number and no news; avcs issue draft <D> [fields] changes it, --open opens it as an issue, --delete deletes it.",
--- /dev/null
+++ b/client/test/attach.test.ts
@@ -0,0 +1,171 @@
4+
16+
21+const seen: { method: string; url: string; headers: Record<string, string | string[] | undefined>; body: Buffer }[] =
24+
33+ const json = (o: unknown) => res.writeHead(200, { "content-type": "application/json" }).end(JSON.stringify(o));
54+
61+
62+async function avcs(cwd: string, argv: string[]): Promise<{ exit: number; out: string; json?: unknown }> {
70+
75+ const r = await avcs(dir, ["init", "--server", fake.url, "--project", `attach${++n}`, "--agent", "ann"]);
81+
86+ const r = await avcs(dir, ["issue", "new", "The page after the fix", "--attach", "shot.png,after.png"]);
96+ const opened = JSON.parse(calls[2]!.body.toString()) as { title: string; attachments: string[] };
101+
107+ const comment = JSON.parse(seen.at(-1)!.body.toString()) as { text: string; attachments: string[] };
115+
124+
154+ attachments: [{ id: "a00000000000f", name: "mine.png", type: "image/png", size: 3 * 1024 * 1024 }],
167+ /attached a0123456789ab: "shot.png", 2 KB, https:\/\/issues.example\/p\/x\/attachments\/a0123456789ab/,