fix!: remove the unused --yes flag from coder autoupdate (#30149)

`coder autoupdate` has registered `-y/--yes` since #10438 but never
prompts, so the flag did nothing.
This PR removes it.

**Breaking change:** `coder autoupdate` no longer accepts `-y/--yes`.
Scripts that pass it now fail with `unknown shorthand flag: 'y'`.
To fix them, drop the flag; it never had an effect.

<details>
<summary>Decisions</summary>

- The first version kept `-y` as a hidden no-op so existing scripts
wouldn't break.
- Reviewers preferred removing it outright as a breaking change, since a
deprecation period would end in the same removal and the hidden flag is
cruft.
- The title uses `fix!:` and the PR carries `release/breaking`, so the
release tooling lists it under breaking changes.
- `cliui.HiddenSkipPromptOption()` landed on `main` through the
organizations create PR and stays there for that command; this PR no
longer touches it.
- The test now pins the new behavior: passing `-y` returns an unknown
flag error.

</details>

Closes [CLI-33](https://linear.app/codercom/issue/CLI-33)

_This PR was generated by Coder Agents on behalf of @nickvigilante._
This commit is contained in:
Nick Vigilante
2026-10-08 11:55:29 -04:00
committed by GitHub
parent 54ee377364
commit 98bcc3afb7
4 changed files with 10 additions and 18 deletions
-2
View File
@@ -6,7 +6,6 @@ import (
"golang.org/x/xerrors"
"github.com/coder/coder/v2/cli/cliui"
"github.com/coder/coder/v2/codersdk"
"github.com/coder/serpent"
)
@@ -47,7 +46,6 @@ func (r *RootCmd) autoupdate() *serpent.Command {
},
}
cmd.Options = append(cmd.Options, cliui.SkipPromptOption())
return cmd
}
+8
View File
@@ -41,6 +41,14 @@ func TestAutoUpdate(t *testing.T) {
require.Equal(t, expectedPolicy, workspace.AutomaticUpdates)
})
t.Run("YesFlagRejected", func(t *testing.T) {
t.Parallel()
inv, _ := clitest.New(t, "autoupdate", "my-workspace", string(codersdk.AutomaticUpdatesAlways), "-y")
err := inv.Run()
require.ErrorContains(t, err, "unknown shorthand flag: 'y'")
})
t.Run("InvalidArgs", func(t *testing.T) {
type testcase struct {
Name string
+1 -5
View File
@@ -1,13 +1,9 @@
coder v0.0.0-devel
USAGE:
coder autoupdate [flags] <workspace> <always|never>
coder autoupdate <workspace> <always|never>
Toggle auto-update policy for a workspace
OPTIONS:
-y, --yes bool
Bypass confirmation prompts.
———
Run `coder --help` for a list of global options.
+1 -11
View File
@@ -11,15 +11,5 @@ Toggle auto-update policy for a workspace
## Usage
```console
coder autoupdate [flags] <workspace> <always|never>
coder autoupdate <workspace> <always|never>
```
## Options
### -y, --yes
| | |
|------|-------------------|
| Type | <code>bool</code> |
Bypass confirmation prompts.