feat(cli): add --agents-allowed to template commands (#27517)

Relates to CODAGT-713

Depends on #27515

This adds `--agents-allowed` to `coder templates create` and `coder templates edit`. Template creation defaults the option to true, matching the per-template API and database default, while template editing only changes the value when the flag is explicitly supplied so unrelated edits preserve the existing setting.

The generated CLI help and reference documentation include the new option. #27518 updates the Coder Agents platform controls documentation to describe the completed per-template model.
This commit is contained in:
Ethan
2026-08-06 14:45:38 +10:00
committed by GitHub
parent 6c8a8647f6
commit 78b5a0f5a2
8 changed files with 165 additions and 0 deletions
+12
View File
@@ -33,6 +33,7 @@ func (r *RootCmd) templateEdit() *serpent.Command {
allowUserCancelWorkspaceJobs bool
allowUserAutostart bool
allowUserAutostop bool
agentsAllowed bool
requireActiveVersion bool
deprecationMessage string
disableEveryone bool
@@ -142,6 +143,10 @@ func (r *RootCmd) templateEdit() *serpent.Command {
dormancyAutoDeletion = time.Duration(template.TimeTilDormantAutoDeleteMillis) * time.Millisecond
}
if !userSetOption(inv, "agents-allowed") {
agentsAllowed = template.AgentsAllowed
}
if !userSetOption(inv, "require-active-version") {
requireActiveVersion = template.RequireActiveVersion
}
@@ -199,6 +204,7 @@ func (r *RootCmd) templateEdit() *serpent.Command {
AllowUserCancelWorkspaceJobs: &allowUserCancelWorkspaceJobs,
AllowUserAutostart: &allowUserAutostart,
AllowUserAutostop: &allowUserAutostop,
AgentsAllowed: &agentsAllowed,
RequireActiveVersion: &requireActiveVersion,
DeprecationMessage: deprecated,
DisableEveryoneGroupAccess: &disableEveryoneGroup,
@@ -292,6 +298,12 @@ func (r *RootCmd) templateEdit() *serpent.Command {
Default: "0h",
Value: serpent.DurationOf(&dormancyAutoDeletion),
},
{
Flag: "agents-allowed",
Description: "Allow Coder Agents to create workspaces using this template.",
Default: "true",
Value: serpent.BoolOf(&agentsAllowed),
},
{
Flag: "allow-user-cancel-workspace-jobs",
Description: "Allow users to cancel in-progress workspace jobs.",