Skip to content

render ignores the first H1: untitled sources all publish to the slug 'artifact' and silently overwrite each other #2

Description

@bitgorust

Summary

opencode-artifacts render <file.md> sets the title to the literal string Artifact
when the source has no frontmatter title:. It ignores the first # heading. The slug
becomes artifact, so every untitled source publishes to the same page.

Two different documents therefore collapse into one artifact, and the first one is lost
without a warning.

Reproduction

printf -- '# Alpha Report\n\nFirst doc.\n' > a.md
printf -- '# Beta Report\n\nSecond doc.\n' > b.md
npx opencode-artifacts@0.14.4 render a.md
npx opencode-artifacts@0.14.4 render b.md

ls .opencode/artifacts          # artifact.html, index.html, manifest.json
grep -o 'First doc\.' .opencode/artifacts/artifact.html   # no match
grep -o 'Second doc\.' .opencode/artifacts/artifact.html  # match

manifest.json holds a single entry: {"slug": "artifact", "title": "Artifact"}.

Expected

Fall back to the first # heading before falling back to Artifact. For the example
above that gives slug alpha-report and title Alpha Report, and the two documents stay
separate.

Why it matters

  • The naming rule in skills/artifact-pages/SKILL.md says to name the page like a product.
    A CLI user who follows normal Markdown practice, one # heading per document, cannot
    reach that outcome.
  • The overwrite is silent. publish() keys on slug, so the second render replaces the
    stable page of the first.
  • The heading is already parsed; the information needed for a better default is present.

Source

dist/cli.js, renderCommand:

const finalTitle = title ?? rendered.meta.title ?? "Artifact";

Environment

opencode-artifacts 0.14.4, Node v24.19.0, OpenCode 1.18.9, macOS 25.5.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions