Skip to content

feat(cli/templatepush): read display_name, description, and icon from README.md frontmatter#23743

Draft
bpmct wants to merge 1 commit intomainfrom
bpmct/template-push-frontmatter
Draft

feat(cli/templatepush): read display_name, description, and icon from README.md frontmatter#23743
bpmct wants to merge 1 commit intomainfrom
bpmct/template-push-frontmatter

Conversation

@bpmct
Copy link
Copy Markdown
Member

@bpmct bpmct commented Mar 28, 2026

`coder templates push` now reads YAML frontmatter from the template directory's `README.md` and uses `display_name`, `description`, and `icon` when creating or updating a template. This uses the same Hugo `pageparser` already used by `scripts/examplegen` for starter templates.

  • Create path: populates `DisplayName`, `Description`, and `Icon` in `CreateTemplateRequest`.
  • Update path: calls `UpdateTemplateMeta` with frontmatter values.
  • CLI flags override: new `--display-name`, `--description`, and `--icon` flags take precedence over frontmatter.
  • Stdin/missing README: gracefully skipped.

Closes #23735

Implementation notes
  • Reuses `github.com/gohugoio/hugo/parser/pageparser` (already in go.mod) for frontmatter parsing, same approach as `scripts/examplegen/main.go`.
  • `readTemplateFrontmatter()` returns zero values without error when README.md is missing or has no frontmatter.
  • On the update path, only calls `UpdateTemplateMeta` when at least one of display_name/description/icon is non-empty, preserving existing values for unset fields.
  • `userSetOption()` (from `cli/util.go`) determines whether a CLI flag was explicitly set, so frontmatter is only used as a fallback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: templates push should read display_name, icon, and description from README.md frontmatter

1 participant