{"version":5,"agent":"pinch","message":"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).","time":1791510167765,"timeIso":"2026-10-09T01:42:47.765Z","changes":5,"change":48,"files":["client/src/api.ts","client/src/issues-wire.ts","client/src/issues.ts","client/src/main.ts","client/test/attach.test.ts"],"draft":null,"diff":[{"path":"client/src/api.ts","added":43,"removed":5,"diff":"--- a/client/src/api.ts\n+++ b/client/src/api.ts\n@@ -50,7 +50,7 @@\n \tWhereAnswer,\n \tWhyAnswer,\n } from \"./history-answers.ts\";\n-import type { Ask, Draft, DraftBody, News as IssueNews, IssuePage, IssueRow } from \"./issues-wire.ts\";\n+import type { Ask, Attachment, Draft, DraftBody, News as IssueNews, IssuePage, IssueRow } from \"./issues-wire.ts\";\n import type { Modes } from \"./modes.ts\";\n \n export * from \"./api-answers.ts\";\n@@ -65,7 +65,7 @@\n } from \"./box-run.ts\";\n export * from \"./ci-answers.ts\";\n export * from \"./history-answers.ts\";\n-export type { Ask, Draft, DraftBody, IssueNews, IssuePage, IssueRow };\n+export type { Ask, Attachment, Draft, DraftBody, IssueNews, IssuePage, IssueRow };\n \n /**\n  * How long a call may take: the base, plus 1 s for each 100 KB it sends\n@@ -400,10 +400,39 @@\n \t\t}\n \t}\n \n-\tissueOpen(body: DraftBody & { title: string }): Promise<{ id: number; news?: IssueNews }> {\n+\tissueOpen(body: DraftBody & { title: string; attachments?: string[] }): Promise<{ id: number; news?: IssueNews }> {\n \t\treturn this.#issues(\"POST\", this.agentPath(\"issue\"), body);\n \t}\n \n+\t/** Uploads an image to the Issues Worker (abso issue 171): it checks the type by the bytes, strips metadata and answers its id. */\n+\tasync attachmentUpload(bytes: Uint8Array, name: string): Promise<Attachment> {\n+\t\tif (this.issuesServer === undefined)\n+\t\t\tthrow new ApiError(`${this.config.server} has no Issues Worker beside it; AVCS_ISSUES_SERVER names one`);\n+\t\tconst path = this.agentPath(\"attachments\");\n+\t\tlet res: Response;\n+\t\ttry {\n+\t\t\tres = await fetch(this.url(path, this.issuesServer), {\n+\t\t\t\tmethod: \"POST\",\n+\t\t\t\theaders: { ...this.headers(\"application/octet-stream\"), \"x-avcs-name\": encodeURIComponent(name) },\n+\t\t\t\tbody: bytes as Uint8Array<ArrayBuffer>,\n+\t\t\t\tsignal: AbortSignal.timeout(Math.max(this.timeoutMs, 120_000)),\n+\t\t\t});\n+\t\t} catch (err) {\n+\t\t\tconst e = err as Error;\n+\t\t\tthrow new ApiError(\n+\t\t\t\t`could not reach ${this.issuesServer}: ${(e.cause as Error | undefined)?.message ?? e.message}`,\n+\t\t\t);\n+\t\t}\n+\t\tconst text = await res.text();\n+\t\tif (!res.ok) throw new ApiError(`uploading ${name} answered ${res.status}: ${errorSentence(text)}`, res.status);\n+\t\treturn JSON.parse(text) as Attachment;\n+\t}\n+\n+\t/** Where an attachment is served. */\n+\tattachmentUrl(id: string): string {\n+\t\treturn this.url(`/attachments/${id}`, this.issuesServer);\n+\t}\n+\n \t/** An edit (abso issue 3): it tells the issue's watchers, and `also`, unless `notify` is false. null clears a parent or Agent. */\n \tissueEdit(\n \t\tid: number,\n@@ -422,8 +451,17 @@\n \t\treturn this.#issues(\"POST\", this.agentPath(`issue/${id}/edit`), body);\n \t}\n \n-\tissueComment(id: number, text: string, objection = false): Promise<{ id: number; news?: IssueNews }> {\n-\t\treturn this.#issues(\"POST\", this.agentPath(`issue/${id}/comment`), { text, ...(objection ? { objection } : {}) });\n+\tissueComment(\n+\t\tid: number,\n+\t\ttext: string,\n+\t\tobjection = false,\n+\t\tattachments: readonly string[] = [],\n+\t): Promise<{ id: number; news?: IssueNews }> {\n+\t\treturn this.#issues(\"POST\", this.agentPath(`issue/${id}/comment`), {\n+\t\t\ttext,\n+\t\t\t...(objection ? { objection } : {}),\n+\t\t\t...(attachments.length > 0 ? { attachments } : {}),\n+\t\t});\n \t}\n \n \tissueDrop(id: number): Promise<{ news?: IssueNews }> {"},{"path":"client/src/issues-wire.ts","added":12,"removed":1,"diff":"--- a/client/src/issues-wire.ts\n+++ b/client/src/issues-wire.ts\n@@ -45,8 +45,19 @@\n \tkind: \"comment\" | \"objection\";\n \ttext: string;\n \tat: number;\n+\t/** Images it carries (abso issue 171); left out when none. */\n+\tattachments?: Attachment[];\n }\n \n+/** An image on an issue or comment (abso issue 171): GET /p/:project/attachments/<id> serves it. */\n+export interface Attachment {\n+\t/** \"a\" and the first 12 hex of its sha256: what a text points at. */\n+\tid: string;\n+\tname: string;\n+\ttype: string;\n+\tsize: number;\n+}\n+\n export interface Ask {\n \tid: number;\n \t/** The issue it's on; none for a decision that belongs to no issue. */\n@@ -74,7 +85,7 @@\n }\n \n export interface IssuePage {\n-\tissue: IssueRow & { description: string; lines: Lines | null; watchers: string[] };\n+\tissue: IssueRow & { description: string; lines: Lines | null; watchers: string[]; attachments?: Attachment[] };\n \tcomments: Comment[];\n \tedits: Edit[];\n \tasks: Ask[];"},{"path":"client/src/issues.ts","added":63,"removed":11,"diff":"--- a/client/src/issues.ts\n+++ b/client/src/issues.ts\n@@ -5,7 +5,9 @@\n // In review, and publish --done closes it. Other agents' and people's words\n // are quoted as JSON, so none can print as another line (#30).\n \n-import type { Api, Ask, Draft, DraftBody, IssuePage, IssueRow } from \"./api.ts\";\n+import { readFileSync, statSync } from \"node:fs\";\n+import { basename, resolve } from \"node:path\";\n+import type { Api, Ask, Attachment, Draft, DraftBody, IssuePage, IssueRow } from \"./api.ts\";\n import { bool, type Parsed, str, UsageError } from \"./args.ts\";\n import { type Env, type Output, open, plural } from \"./commands.ts\";\n import { type Config, readMachineServers, trustedServers } from \"./config.ts\";\n@@ -107,8 +109,48 @@\n \t\t\t\t.filter((v) => v !== \"\");\n }\n \n+/** The most one attachment may be: the Issues Worker's cap, checked here before sending (abso issue 171). */\n+const ATTACH_MAX = 10 * 1024 * 1024;\n+\n+/** Uploads each file --attach names (comma-separated), in order, and answers their ids. Nothing is sent if a file is missing or too big. */\n+async function uploadAttachments(api: Api, cwd: string, value: string | undefined): Promise<string[]> {\n+\tif (value === undefined) return [];\n+\tconst paths = listOf(value);\n+\tif (paths.length === 0) throw new UsageError(\"--attach names files, comma-separated: --attach shot.png,after.png\");\n+\tconst files = paths.map((p) => {\n+\t\tconst full = resolve(cwd, p);\n+\t\tlet size: number;\n+\t\ttry {\n+\t\t\tsize = statSync(full).size;\n+\t\t} catch {\n+\t\t\tthrow new UsageError(`--attach ${p}: no such file`);\n+\t\t}\n+\t\tif (size > ATTACH_MAX)\n+\t\t\tthrow new UsageError(`--attach ${p} is ${sizeText(size)}; one attachment is at most ${sizeText(ATTACH_MAX)}`);\n+\t\treturn { full, name: basename(full) };\n+\t});\n+\tconst ids: string[] = [];\n+\tfor (const f of files) ids.push((await api.attachmentUpload(readFileSync(f.full), f.name)).id);\n+\treturn ids;\n+}\n+\n+function sizeText(n: number): string {\n+\treturn n < 1024 ? `${n} B` : n < 1024 * 1024 ? `${Math.round(n / 1024)} KB` : `${(n / (1024 * 1024)).toFixed(1)} MB`;\n+}\n+\n+/** Attachments as lines under what carries them: name, size and where it's served. */\n+function attachmentLines(\n+\tapi: Pick<Api, \"attachmentUrl\"> | undefined,\n+\tfiles: readonly Attachment[] | undefined,\n+\tindent: string,\n+): string[] {\n+\treturn (files ?? []).map(\n+\t\t(a) => `${indent}attached ${a.id}: ${q(a.name)}, ${sizeText(a.size)}${api ? `, ${api.attachmentUrl(a.id)}` : \"\"}`,\n+\t);\n+}\n+\n /** An issue's page, as text. */\n-export function issuePage(p: IssuePage): string[] {\n+export function issuePage(p: IssuePage, api?: Pick<Api, \"attachmentUrl\">): string[] {\n \tconst i = p.issue;\n \tconst facts = [\n \t\ti.parent !== null ? `Under issue ${i.parent}.` : \"\",\n@@ -128,14 +170,16 @@\n \t\tfacts.join(\" \"),\n \t\t...(i.lines ? [`From ${i.lines.file} lines ${i.lines.from}-${i.lines.to} at version ${i.lines.version}.`] : []),\n \t\t...(i.description !== \"\" ? [\"\", ...i.description.split(\"\\n\").map((l) => `  ${l}`)] : []),\n+\t\t...attachmentLines(api, i.attachments, \"  \"),\n \t\t...(p.asks.length > 0 ? [\"\", \"Asks:\", ...p.asks.map(askLine)] : []),\n \t\t...(p.comments.length > 0\n \t\t\t? [\n \t\t\t\t\t\"\",\n \t\t\t\t\t\"Comments:\",\n-\t\t\t\t\t...p.comments.map(\n-\t\t\t\t\t\t(c) => `  ${c.by}${c.kind === \"objection\" ? \" objects\" : \"\"}, ${shortWhen(c.at)}: ${q(c.text)}`,\n-\t\t\t\t\t),\n+\t\t\t\t\t...p.comments.flatMap((c) => [\n+\t\t\t\t\t\t`  ${c.by}${c.kind === \"objection\" ? \" objects\" : \"\"}, ${shortWhen(c.at)}: ${q(c.text)}`,\n+\t\t\t\t\t\t...attachmentLines(api, c.attachments, \"    \"),\n+\t\t\t\t\t]),\n \t\t\t\t]\n \t\t\t: []),\n \t\t...((p.edits ?? []).length > 0 ? [\"\", \"Edits:\", ...p.edits.map(editLine)] : []),\n@@ -286,8 +330,13 @@\n \t\t\tthrow new UsageError(\n \t\t\t\t'avcs issue new \"<title>\" [--description \"...\"] [--parent <N>] [--lines <file>:<from>-<to>@<version>] [--agent <agent>] [--blocked-by <N,N>] [--notify <who,who>] [--label <l,l>]',\n \t\t\t);\n-\t\tconst r = await api.issueOpen({ ...openFields(args, rest.join(\" \")), title: rest.join(\" \") });\n-\t\treturn { text: `Opened issue ${r.id}. avcs start \"...\" --issue ${r.id} starts on it.`, json: { id: r.id } };\n+\t\tconst fields = { ...openFields(args, rest.join(\" \")), title: rest.join(\" \") };\n+\t\tconst attachments = await uploadAttachments(api, env.cwd, str(args, \"attach\"));\n+\t\tconst r = await api.issueOpen({ ...fields, ...(attachments.length > 0 ? { attachments } : {}) });\n+\t\treturn {\n+\t\t\ttext: `Opened issue ${r.id}${attachments.length > 0 ? ` with ${plural(attachments.length, \"attachment\")} (${attachments.join(\", \")})` : \"\"}. avcs start \"...\" --issue ${r.id} starts on it.`,\n+\t\t\tjson: { id: r.id, ...(attachments.length > 0 ? { attachments } : {}) },\n+\t\t};\n \t}\n \tif (first === undefined || rest.length > 0)\n \t\tthrow new UsageError(\n@@ -340,11 +389,14 @@\n \t\tthrow new UsageError(\n \t\t\t\"--quiet and --notify go with an edit (--title, --description, --parent, --agent, --blocked-by, --label or --unlabel)\",\n \t\t);\n+\tif (str(args, \"attach\") !== undefined && comment === undefined && object === undefined)\n+\t\tthrow new UsageError(\"--attach goes with avcs issue new or --comment (or --object)\");\n \tif (comment !== undefined || object !== undefined) {\n-\t\tconst r = await api.issueComment(id, (comment ?? object)!, object !== undefined);\n+\t\tconst attachments = await uploadAttachments(api, env.cwd, str(args, \"attach\"));\n+\t\tconst r = await api.issueComment(id, (comment ?? object)!, object !== undefined, attachments);\n \t\treturn {\n-\t\t\ttext: `${object !== undefined ? \"Objected\" : \"Commented\"} on issue ${id}. Its agents hear it.`,\n-\t\t\tjson: { id: r.id, issue: id },\n+\t\t\ttext: `${object !== undefined ? \"Objected\" : \"Commented\"} on issue ${id}${attachments.length > 0 ? ` with ${plural(attachments.length, \"attachment\")} (${attachments.join(\", \")})` : \"\"}. Its agents hear it.`,\n+\t\t\tjson: { id: r.id, issue: id, ...(attachments.length > 0 ? { attachments } : {}) },\n \t\t};\n \t}\n \tif (bool(args, \"drop\")) {\n@@ -373,7 +425,7 @@\n \t\t};\n \t}\n \tconst page = await api.issue(id);\n-\treturn { text: issuePage(page).join(\"\\n\"), json: { ...page } };\n+\treturn { text: issuePage(page, api).join(\"\\n\"), json: { ...page } };\n }\n \n export async function runAsk(args: Parsed, env: Env): Promise<Output> {"},{"path":"client/src/main.ts","added":3,"removed":2,"diff":"--- a/client/src/main.ts\n+++ b/client/src/main.ts\n@@ -365,11 +365,12 @@\n \t\t\tunlabel: \"string\",\n \t\t\topen: \"boolean\",\n \t\t\tdelete: \"boolean\",\n+\t\t\tattach: \"string\",\n \t\t},\n \t\tusage:\n-\t\t\t'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>]',\n+\t\t\t'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>]',\n \t\tabout:\n-\t\t\t\"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.\",\n+\t\t\t\"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.\",\n \t\trun: runIssue,\n \t},\n \task: {"},{"path":"client/test/attach.test.ts","added":171,"removed":0,"diff":"--- /dev/null\n+++ b/client/test/attach.test.ts\n@@ -0,0 +1,171 @@\n+// --attach (abso issue 171): images go up to the Issues Worker before the\n+// write that carries them, and the issue's page lists them. The Issues server\n+// here is a stand-in that keeps what it was sent.\n+\n+import assert from \"node:assert/strict\";\n+import { mkdtempSync, rmSync, writeFileSync } from \"node:fs\";\n+import { createServer, type Server } from \"node:http\";\n+import type { AddressInfo } from \"node:net\";\n+import { tmpdir } from \"node:os\";\n+import { join } from \"node:path\";\n+import { after, before, describe, it } from \"node:test\";\n+import { issuePage } from \"../src/issues.ts\";\n+import type { IssuePage } from \"../src/issues-wire.ts\";\n+import { main } from \"../src/main.ts\";\n+import { type Fake, startFake } from \"./fake-server.ts\";\n+\n+const TOKEN = \"test-token-not-secret\";\n+let fake: Fake;\n+let issues: Server;\n+let issuesUrl: string;\n+const seen: { method: string; url: string; headers: Record<string, string | string[] | undefined>; body: Buffer }[] =\n+\t[];\n+const dirs: string[] = [];\n+\n+before(async () => {\n+\tfake = await startFake(0, TOKEN);\n+\tissues = createServer((req, res) => {\n+\t\tconst parts: Buffer[] = [];\n+\t\treq.on(\"data\", (c: Buffer) => parts.push(c));\n+\t\treq.on(\"end\", () => {\n+\t\t\tconst body = Buffer.concat(parts);\n+\t\t\tseen.push({ method: req.method!, url: req.url!, headers: req.headers, body });\n+\t\t\tconst json = (o: unknown) => res.writeHead(200, { \"content-type\": \"application/json\" }).end(JSON.stringify(o));\n+\t\t\tif (req.url!.endsWith(\"/attachments\"))\n+\t\t\t\treturn json({\n+\t\t\t\t\tid: `a${String(seen.length).padStart(12, \"0\")}`,\n+\t\t\t\t\tname: \"x\",\n+\t\t\t\t\ttype: \"image/png\",\n+\t\t\t\t\tsize: body.length,\n+\t\t\t\t});\n+\t\t\tif (req.url!.endsWith(\"/issue\")) return json({ id: 7 });\n+\t\t\tif (/\\/issue\\/\\d+\\/comment$/.test(req.url!)) return json({ id: 3 });\n+\t\t\tres.writeHead(404).end(\"{}\");\n+\t\t});\n+\t});\n+\tawait new Promise<void>((ok) => issues.listen(0, \"127.0.0.1\", ok));\n+\tissuesUrl = `http://127.0.0.1:${(issues.address() as AddressInfo).port}`;\n+});\n+after(async () => {\n+\tawait fake.close();\n+\tawait new Promise((ok) => issues.close(ok));\n+\tfor (const d of dirs) rmSync(d, { recursive: true, force: true, maxRetries: 5 });\n+});\n+\n+const ENV = (): Record<string, string> => ({\n+\tAVCS_TOKEN: TOKEN,\n+\tAVCS_HOOK_FORCE: \"1\",\n+\tAVCS_ISSUES_SERVER: issuesUrl,\n+\tAVCS_SERVERS_FILE: \"no-servers.json\",\n+});\n+\n+async function avcs(cwd: string, argv: string[]): Promise<{ exit: number; out: string; json?: unknown }> {\n+\tconst r = await main([...argv, \"--json\"], { cwd, env: ENV(), write: () => {} });\n+\tlet json: unknown;\n+\ttry {\n+\t\tjson = JSON.parse(r.stdout);\n+\t} catch {}\n+\treturn { exit: r.exit, out: r.stdout + r.stderr, json };\n+}\n+\n+let n = 0;\n+async function folder(): Promise<string> {\n+\tconst dir = mkdtempSync(join(tmpdir(), \"abso-attach-\"));\n+\tdirs.push(dir);\n+\tconst r = await avcs(dir, [\"init\", \"--server\", fake.url, \"--project\", `attach${++n}`, \"--agent\", \"ann\"]);\n+\tassert.equal(r.exit, 0, r.out);\n+\twriteFileSync(join(dir, \"shot.png\"), Buffer.from([0x89, 0x50, 0x4e, 0x47, 1, 2, 3]));\n+\twriteFileSync(join(dir, \"after.png\"), Buffer.from([0x89, 0x50, 0x4e, 0x47, 4, 5]));\n+\treturn dir;\n+}\n+\n+describe(\"--attach (abso issue 171)\", () => {\n+\tit(\"uploads each file, then opens the issue carrying their ids\", async () => {\n+\t\tconst dir = await folder();\n+\t\tconst from = seen.length;\n+\t\tconst r = await avcs(dir, [\"issue\", \"new\", \"The page after the fix\", \"--attach\", \"shot.png,after.png\"]);\n+\t\tassert.equal(r.exit, 0, r.out);\n+\t\tconst calls = seen.slice(from);\n+\t\tassert.deepEqual(\n+\t\t\tcalls.map((c) => `${c.method} ${c.url.replace(/^\\/p\\/[^/]+/, \"\")}`),\n+\t\t\t[\"POST /a/ann/attachments\", \"POST /a/ann/attachments\", \"POST /a/ann/issue\"],\n+\t\t);\n+\t\tassert.equal(calls[0]!.headers[\"x-avcs-name\"], \"shot.png\");\n+\t\tassert.equal(calls[0]!.headers[\"content-type\"], \"application/octet-stream\");\n+\t\tassert.deepEqual([...calls[0]!.body], [0x89, 0x50, 0x4e, 0x47, 1, 2, 3]);\n+\t\tconst opened = JSON.parse(calls[2]!.body.toString()) as { title: string; attachments: string[] };\n+\t\tassert.equal(opened.title, \"The page after the fix\");\n+\t\tassert.equal(opened.attachments.length, 2);\n+\t\tassert.deepEqual((r.json as { attachments: string[] }).attachments, opened.attachments);\n+\t});\n+\n+\tit(\"goes on a comment too, and nowhere else\", async () => {\n+\t\tconst dir = await folder();\n+\t\tconst from = seen.length;\n+\t\tconst r = await avcs(dir, [\"issue\", \"7\", \"--comment\", \"after\", \"--attach\", \"shot.png\"]);\n+\t\tassert.equal(r.exit, 0, r.out);\n+\t\tconst comment = JSON.parse(seen.at(-1)!.body.toString()) as { text: string; attachments: string[] };\n+\t\tassert.equal(comment.text, \"after\");\n+\t\tassert.equal(comment.attachments.length, 1);\n+\t\tassert.equal(seen.length - from, 2);\n+\t\tconst alone = await avcs(dir, [\"issue\", \"7\", \"--attach\", \"shot.png\"]);\n+\t\tassert.equal(alone.exit, 1);\n+\t\tassert.match(alone.out, /--attach goes with avcs issue new or --comment/);\n+\t});\n+\n+\tit(\"sends nothing when a file is missing\", async () => {\n+\t\tconst dir = await folder();\n+\t\tconst from = seen.length;\n+\t\tconst r = await avcs(dir, [\"issue\", \"new\", \"T\", \"--attach\", \"shot.png,nope.png\"]);\n+\t\tassert.equal(r.exit, 1);\n+\t\tassert.match(r.out, /--attach nope.png: no such file/);\n+\t\tassert.equal(seen.length, from);\n+\t});\n+\n+\tit(\"an issue's page lists its attachments and each comment's, with links\", () => {\n+\t\tconst page = {\n+\t\t\tissue: {\n+\t\t\t\tid: 7,\n+\t\t\t\ttitle: \"T\",\n+\t\t\t\tstatus: \"open\",\n+\t\t\t\topened: { by: \"ann\", at: 0 },\n+\t\t\t\tagent: null,\n+\t\t\t\tagents: [],\n+\t\t\t\tblockedBy: [],\n+\t\t\t\tlabels: [],\n+\t\t\t\tversions: [],\n+\t\t\t\twaitingOn: [],\n+\t\t\t\tparent: null,\n+\t\t\t\tchildren: 0,\n+\t\t\t\tupdated: 0,\n+\t\t\t\tclosed: null,\n+\t\t\t\tdescription: \"\",\n+\t\t\t\tlines: null,\n+\t\t\t\twatchers: [],\n+\t\t\t\tattachments: [{ id: \"a0123456789ab\", name: \"shot.png\", type: \"image/png\", size: 2048 }],\n+\t\t\t},\n+\t\t\tcomments: [\n+\t\t\t\t{\n+\t\t\t\t\tid: 1,\n+\t\t\t\t\tby: \"bob\",\n+\t\t\t\t\tkind: \"comment\",\n+\t\t\t\t\ttext: \"same here\",\n+\t\t\t\t\tat: 0,\n+\t\t\t\t\tattachments: [{ id: \"a00000000000f\", name: \"mine.png\", type: \"image/png\", size: 3 * 1024 * 1024 }],\n+\t\t\t\t},\n+\t\t\t],\n+\t\t\tedits: [],\n+\t\t\tasks: [],\n+\t\t\tclaims: [],\n+\t\t\tchildren: [],\n+\t\t} as unknown as IssuePage;\n+\t\tconst text = issuePage(page, {\n+\t\t\tattachmentUrl: (id: string) => `https://issues.example/p/x/attachments/${id}`,\n+\t\t}).join(\"\\n\");\n+\t\tassert.match(\n+\t\t\ttext,\n+\t\t\t/attached a0123456789ab: \"shot.png\", 2 KB, https:\\/\\/issues.example\\/p\\/x\\/attachments\\/a0123456789ab/,\n+\t\t);\n+\t\tassert.match(text, /\\n {4}attached a00000000000f: \"mine.png\", 3.0 MB/);\n+\t});\n+});"}],"ci":null}