Closed general

issue create/comment/edit: repeatable --file flag (any-type attachments)

Colby Knox · 2mo ago ·closed by Colby Knox

CLI half of wiki.adom.inc/adom/wiki/issues/107 (the wiki server + web UI halves are live: any-type attachments on issues, chips in rendered bodies).

Add --file <path> to issue create / issue comment / issue edit

Generalize the repeatable --image flag:

  • Upload via the same endpoint images use: POST /api/pages/<owner>/<slug>/attachments, multipart field file.
  • Embed in flag order like images do, but as a plain link: [<filename>](<url>). The web renders links to /attachments/ as file chips. (Images keep the ![]() inline form; the response's content_type tells you which you got, images come back as image/*, files as application/octet-stream.)

Server contract

  • Allowed file extensions (beyond the image set): log, txt, md, json, yaml, yml, toml, ini, csv, tsv, xml, patch, diff, zip, gz, tgz, tar, kicad_sym, kicad_mod, kicad_sch, kicad_pcb, kicad_pro, lbr, glb, gltf, step, stp, stl, obj, pdf, hex, uf2, map.
  • Caps: images 10MB, files 25MB (413 over).
  • Rejections carry code: BAD_ATTACHMENT_TYPE with data.allowed listing every accepted extension, so key on the data, not the prose.
  • Files are stored and served as application/octet-stream with an attachment disposition; do not expect type-specific content types back.

2 Replies

Colby Knox · 2mo ago

Shipped in 1.0.80, live as latest.

--file is repeatable on issue create, issue comment, issue edit, and (for parity, since the endpoint is page-scoped and the helper is shared) pr comment. Files upload through the same attachments endpoint, multipart field file, and embed as plain [<filename>](<url>) links in flag order, after any --image embeds; images keep the inline ![]() form. issue edit --file alone appends to the current body, same as --image alone.

Local pre-validation mirrors the server contract for instant failure: the full extension list (including the kicad_* set, lbr, step/stp, glb/gltf, stl/obj, pdf, hex/uf2, map), 10MB images, 25MB files; a bad extension fails before any wire time with both lists in the error. The server stays authoritative: the BAD_ATTACHMENT_TYPE arm keys on data.allowed as specified (and its wording no longer says "image"), so a server-side list change renders correctly with no CLI release. application/octet-stream responses are expected and undisturbed; embedded URLs remain wiki paths, verbatim, per the standing attachment contract.

Verified live on staging: a .log uploaded and embedded as [gate-test.log](/attachments/kcknox/...), and a .exe instant-failed locally with the full allowed list.

Colby Knox · 2mo ago

Shipped in adom-wiki-cli 1.0.80: repeatable --file on issue create/comment/edit plus pr comment, embeds in flag order after images, edit-with---file-alone appends, pre-validation mirrors the server's extension list and caps, and the error arm keys on data.allowed so future list changes need no CLI release. A .log round-tripped on staging as a chip link. Closing.

Log in to reply.