Skip to content

feat(cli): make templates push support every templates create flag so create can be removed #31998

Open

Description

@coder

coder templates create was deprecated in #11390 in favor of coder templates push plus coder templates edit. push still can't replace create, though: create sets these template settings when it creates the template, and push has no flags for them.

I compared the option lists of `templatecreate.go` and `templatepush.go`. These flags are in create and missing from push:

Issue Flag Scope License needed
#31999 --private S No (do first: Everyone group can use pushed templates until edited)
#32000 --default-ttl S, needs a decision on the default No
#32001 --failure-ttl S Advanced Template Scheduling
#32002 --dormancy-threshold S Advanced Template Scheduling
#32003 --dormancy-auto-deletion S Advanced Template Scheduling
#32004 --require-active-version S Access Control
#32005 --agents-allowed XS No

All other create flags are also in push. The API already supports every one of these settings: CreateTemplateRequest and UpdateTemplateMeta (which treats nil as "leave unchanged") both have the fields. So this is CLI-only work, with no API or database changes.

Work shared by all of them

  • Flag definitions. create and edit each define these options separately, with different descriptions. A shared templateSettingsFlags struct, like the existing templateUploadFlags, would make each flag a small change and keep the three commands consistent.
  • Updating an existing template. push also updates existing templates, so it should only send flags the user actually set (`userSetOption`). Otherwise it would reset settings that someone changed in the UI. Today push only patches template metadata inside `case activate:`. We need to decide whether settings flags still apply with --activate=false.
  • License checks. The AGPL schedule store keeps the old values without an error for licensed settings, so the CLI has to check entitlements first. create (L50) and edit (L63) each do this check in their own code. A shared helper would avoid a third copy.
  • Generated files. Regenerate cli/testdata/coder_templates_push_--help.golden and docs/reference/cli/templates_push.md (make gen).
  • After everything lands, remove coder templates create.

Estimated scope

In total, this is about 150 to 300 lines including tests, all in cli/. If the shared flag struct is done first, each flag is mostly one field in the create request, one optional field in the update request, and a test.

Created on behalf of @angrycub

Activity

  1. linear-code commented on Nov 10, 2026

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions