Skip to content

feat(attachments): work item attachments and inline description images - #12

Open
Liewzheng wants to merge 4 commits into
cpatrickalves:mainfrom
Liewzheng:feat/work-item-attachments
Open

feat(attachments): work item attachments and inline description images#12
Liewzheng wants to merge 4 commits into
cpatrickalves:mainfrom
Liewzheng:feat/work-item-attachments

Conversation

@Liewzheng

Copy link
Copy Markdown

What

Adds work item attachment support and inline description images:

  • attachment sub-app (registered in app.py)
    • attachment attach -p <project> <issue> -f <file> — uploads a file via the API's three-step flow: register an asset (presigned S3 URL) → PUT the binary → PATCH is_uploaded=true, then re-read the asset to verify the write (per ADR-0007, a 200 is not always a write). If an asset with the same name already exists on the issue, the user must confirm (or pass --force); non-interactive runs are rejected.
    • attachment ls -p <project> <issue> — lists assets on the issue.
  • wi create / wi update: repeatable -i/--image flag uploads an image and appends it to the description. wi create creates the issue first, uploads, then patches the description.

Conventions followed

  • Resolution/caching/formatter layers untouched; new code calls cached_list_* reads and invalidate_resource("attachment", ...) after mutations, matching ADR-0004.
  • SDK mismatches use raw HTTP escape hatches with NOTE: comments, per ADR-0003.
  • The img tag's src stores only the asset UUID — the web editor resolves it at render time; a full path renders as "Error loading image".
  • The v2 app upload endpoint is preferred, falling back to v1 when the server rejects API-token auth (asset UUIDs are interchangeable).

Tests

make check — 196 passed (16 new in tests/test_commands/test_attachments.py), lint clean.

Closes #11

Add an `attachment` sub-app with `attach`/`ls` commands, backed by a
three-step upload flow (register for a presigned S3 URL, PUT the binary,
PATCH is_uploaded and verify the write — see ADRs 0003 and 0007).
Duplicate asset names are rejected unless the user confirms.

`wi create`/`wi update` gain repeatable `-i/--image` flags that upload an
image and append it to the description. The img src stores only the
asset UUID — the web editor resolves it via getAssetSrc, so storing a
full path breaks image rendering ("Error loading image").

The v2 app upload endpoint (ISSUE_DESCRIPTION) is preferred and
automatically falls back to v1 when the server rejects API-token auth;
asset UUIDs stay interchangeable across both paths.
comment create/update wrapped the whole body in a single p tag; the
editor collapses whitespace inside a paragraph, so multi-line comments
(numbered items, link lists) rendered as one long line. Blank lines now
split into separate paragraphs, single newlines become br tags.
The API stores comment HTML verbatim and does not auto-link URLs — only
the web editor does — so links posted via the CLI rendered as plain text.
Bare http(s) URLs now become anchors; trailing sentence punctuation stays
outside the link, and URLs already inside an anchor are left alone.
The editor stores HTML and does not parse markdown, so `branch` and
fenced blocks posted via the CLI showed literal backticks. Inline code
becomes an escaped code tag (never linkified); fenced blocks become
pre-wrapped code and keep their own paragraph.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: work item attachments and inline description images

1 participant