attachLast updated on
Last updated on
Attach files to artifacts as layers or content references
Attaches a file to an artifact as a layer or content reference.
Usage
ofm attach <artifact> <file> [options]Arguments
| Argument | Description |
|---|---|
artifact | Artifact file (JSON/YAML) to attach file to |
file | File to attach (PDF, image, Markdown, etc.) |
Options
| Option | Description |
|---|---|
-y, --yes | Skip interactive prompts |
-n, --name <name> | Layer name (key in layers object) |
-t, --title <title> | Human-readable title |
-d, --description <desc> | Description text |
-m, --mime-type <type> | Override auto-detected MIME type |
--dry-run | Show what would be changed without modifying the file |
--as <target> | Attach as: layer (default), instructions, or agent-instructions |
Description
The attach command adds a file reference to an artifact. It computes the relative path from the artifact directory and a SHA-256 checksum, then writes the result back to the artifact file.
By default, the file is attached as a layer. Use --as instructions or --as agent-instructions to attach the file as a content reference instead.
In interactive mode (without -y), the command prompts for a layer name, title, and description. The layer name defaults to a sanitized version of the filename. In non-interactive mode, a name is derived automatically or can be set with --name.
If the target content reference already exists, you will be prompted to confirm the overwrite (unless -y is set).
MIME type is auto-detected from the file extension. Use --mime-type to override.
Examples
Attach a PDF as a layer (interactive):
ofm attach my-form.yaml ./lease-template.pdfAttach a layer with explicit options:
ofm attach my-form.yaml ./lease-template.pdf --name pdf --title "Lease Template" -yAttach a file as instructions:
ofm attach my-form.yaml ./instructions.md --as instructionsAttach a file as agent instructions:
ofm attach my-form.yaml ./agent-guide.md --as agent-instructionsPreview changes without writing:
ofm attach my-form.yaml ./lease-template.pdf --dry-runOutput
When attaching as a layer:
Attach File to Artifact
File: ./lease-template.pdf
MIME type: application/pdf
Checksum: sha256:abc123...
Layer to add:
layers.pdf:
kind: file
path: ./lease-template.pdf
mimeType: application/pdf
checksum: sha256:abc123...
Attached "pdf" layer to: my-form.yamlWhen attaching as a content reference:
Content reference to set:
instructions:
kind: file
path: ./instructions.md
mimeType: text/markdown
checksum: sha256:def456...
Set "instructions" on: my-form.yamlSupported file types
| Type | MIME Type |
|---|---|
application/pdf | |
| PNG | image/png |
| JPEG | image/jpeg |
| GIF | image/gif |
| SVG | image/svg+xml |
| HTML | text/html |
| Markdown | text/markdown |