Attachments
Upload and attach one local file to an issue:
linear-cli attachment upload --issue ENG-123 --file ./screenshot.png
linear-cli attachment upload --issue ENG-123 --file ./report.pdf --title "Bug report"
The flags are:
| Flag | Required | Behavior |
|---|---|---|
--issue <identifier> | Yes | Issue identifier such as ENG-123; it is resolved to a Linear issue ID. |
--file <path> | Yes | Local file path. The entire file is read before upload. |
--title <text> | No | Attachment title; defaults to the base filename. |
The implementation performs these steps:
- Detect the filename, byte size, and MIME type. A known extension wins; otherwise
http.DetectContentTypeinspects the bytes. - Call Linear's
fileUploadmutation to receiveuploadUrlandassetUrl. - Send the bytes with HTTP
PUTto the presigned URL, settingContent-TypeandContent-Length. This request has a 60-second timeout. - Call
attachmentCreatewith the issue ID, title, and asset URL.
The success envelope's data object contains attachment, assetUrl, fileName, fileSize, contentType, and issueIdentifier. Missing flags and local file read failures return usage errors with exit code 2; upload connection failures return NETWORK_ERROR / 6.