Skip to content

Add attachment

Copy an image into the folder named like the element file, next to it, and return the Markdown that embeds it relatively; once the text embeds it, the image counts to the version (SR-097, D-057). Never replaces a file.

Command element.addAttachment. Writes files in the working tree, never to Git. It is refused while the workspace is read-only. Adds a file to an element, and no change can be checked against a missing or faulty metamodel.

Field Type Required Description
ref elementRef yes UUID, short ID or identifier (e.g. SR-036), any case; several matches give ref.ambiguous.
sourcePath localPath yes The image to copy: a file ending in .avif, .bmp, .gif, .jpeg, .jpg, .png, .svg or .webp (any case).
Field Type Required Description
file string yes The image file relative to the workspace root, / as separator, e.g. requirements/SR-825b7146fb54/layout.png. Its name is the source name with only ASCII letters, digits, _ and -, and -2, -3, … when the folder has that name already; a file there with the same bytes is reused.
markdown string yes The image as Markdown with a link relative to the element file, e.g. ![layout](SR-825b7146fb54/layout.png), to insert into the text and save with element.update.

In the command prompt (Ctrl+Shift+P, macOS ⌘⇧P): the action Insert image.

reqseq element add-attachment, with --json for the output as JSON. Its help:

Usage: reqseq element add-attachment <ref> <source-path> [options]
Copy an image into the folder named like the element file, next to it, and
return the Markdown that embeds it relatively; once the text embeds it, the
image counts to the version (SR-097, D-057). Never replaces a file.
Arguments:
ref
source-path The image to copy: a file ending in .avif, .bmp, .gif,
.jpeg, .jpg, .png, .svg or .webp (any case).
Options:
--ref <value> instead of the argument <ref>
--source-path <value> instead of the argument <source-path>
--input <json|@file|-> command input as JSON: inline, from a file, or from
standard input
--workspace <path> workspace root (default: nearest folder upwards with
reqseq-workspace.yaml)
--json print exactly the command output as JSON
--yaml print the whole command output as YAML, problems one
per line
-h, --help show help

POST /v1/commands/element.addAttachment on the local API (reqseq serve api), with the input as the JSON body; the answer is the output.

Tool element_addAttachment of the MCP server (reqseq mcp), with the input as its arguments.