-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Problem
coder templates push currently ignores the README.md frontmatter when creating a template. The CreateTemplateRequest supports display_name, description, and icon, but the CLI never populates them — users must follow up with coder templates edit to set these fields.
Meanwhile, templates in coder/registry and our own examples/templates/ already use a well-defined YAML frontmatter format:
---
display_name: Docker Containers
description: Provision Docker containers as Coder workspaces
icon: ../../../site/static/icon/docker.png
maintainer_github: coder
verified: true
tags: [docker, container]
---We even parse this exact format in scripts/examplegen/main.go (using github.com/gohugoio/hugo/parser/pageparser, already a go.mod dependency) to generate starter template metadata.
Proposal
When coder templates push runs from a directory (not stdin), read README.md from the template directory and parse its frontmatter. Use display_name, description, and icon to populate the template on both create and update paths.
- Create path: populate
DisplayName,Description, andIconinCreateTemplateRequest. - Update path: call
UpdateTemplateMetawith values from frontmatter. - CLI flag override: add
--display-nameand--iconflags so explicit values take precedence over frontmatter. - Stdin: skip frontmatter detection when reading from stdin (
-d -).
Why this matters
-
User-contributed templates in the registry — community authors already write frontmatter for registry publishing. When they push these same templates to their Coder deployment, the display name and icon should just work without a separate
templates editstep. This removes a paper cut that makes the registry-to-deployment workflow feel disjointed. -
Template creation AI skill — we are building a template creation skill that will generate complete template directories including README.md with frontmatter. If
templates pushrespects frontmatter, the skill can produce a fully-configured template in one shot, no post-push fixup required.
Prior art
scripts/examplegen/main.go— parses the same frontmatter schema to buildcodersdk.TemplateExamplefor starter templates.codersdk.CreateTemplateRequestalready hasDisplayName,Description, andIconfields.coder templates editalready supports--display-name,--icon, and--descriptionflags viaUpdateTemplateMeta.