-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix: improve CLI flag descriptions and help text for create api command #5628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -28,8 +28,8 @@ func (c CLI) newCreateCmd() *cobra.Command { | |||||||||
| return &cobra.Command{ | ||||||||||
| Use: "create", | ||||||||||
| SuggestFor: []string{"new"}, | ||||||||||
| Short: "Scaffold a Kubernetes API or webhook", | ||||||||||
| Long: fmt.Sprintf(`Scaffold a Kubernetes API or webhook. | ||||||||||
| Short: "Create a Kubernetes API or webhook", | ||||||||||
| Long: fmt.Sprintf(`Create a Kubernetes API or webhook. | ||||||||||
|
Comment on lines
+31
to
+32
|
||||||||||
| Short: "Create a Kubernetes API or webhook", | |
| Long: fmt.Sprintf(`Create a Kubernetes API or webhook. | |
| Short: "Scaffold a Kubernetes API or webhook", | |
| Long: fmt.Sprintf(`Scaffold a Kubernetes API or webhook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Scaffold was a good suggestion.
I think we changed that see that acrros the project, we have a skill as well now: https://github.com/kubernetes-sigs/kubebuilder/tree/master/.agents/skills/cli-descriptions
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -59,19 +59,29 @@ type createAPISubcommand struct { | |||||||||||
| } | ||||||||||||
|
|
||||||||||||
| func (p *createAPISubcommand) UpdateMetadata(cliMeta plugin.CLIMetadata, subcmdMeta *plugin.SubcommandMetadata) { | ||||||||||||
| subcmdMeta.Description = `Scaffold a Kubernetes API by writing a Resource definition and/or a Controller. | ||||||||||||
| subcmdMeta.Description = `Create a Kubernetes API by writing a Resource definition and/or a Controller. | ||||||||||||
|
|
||||||||||||
| If information about whether the resource and controller should be scaffolded | ||||||||||||
| If information about whether the resource and controller should be created | ||||||||||||
| was not explicitly provided, it will prompt the user if they should be. | ||||||||||||
|
|
||||||||||||
| After the scaffold is written, the dependencies will be updated and | ||||||||||||
| After the files are created, the dependencies will be updated and | ||||||||||||
| make generate will be run. | ||||||||||||
|
Comment on lines
+67
to
68
|
||||||||||||
| After the files are created, the dependencies will be updated and | |
| make generate will be run. | |
| After the files are created, the dependencies will be updated. | |
| If --make is not set to false and the resource has an API, | |
| make generate will also be run. |
Copilot
AI
Apr 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in example text: "a frigates API" should be singular ("a frigate API").
| subcmdMeta.Examples = fmt.Sprintf(` # Create a frigates API with Group: ship, Version: v1beta1 and Kind: Frigate | |
| subcmdMeta.Examples = fmt.Sprintf(` # Create a frigate API with Group: ship, Version: v1beta1 and Kind: Frigate |
Copilot
AI
Apr 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "add a controller" example omits --controller=true, so it will prompt interactively by default (since the code prompts when the flag isn't explicitly set). Consider making the example non-interactive by including an explicit --controller=true (and similarly any other prompting flags).
| --resource=false --controller-name frigate-status | |
| --resource=false --controller=true --controller-name frigate-status |
Copilot
AI
Apr 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--make help text is written as "If set... Default: true" but this flag is default-true (opt-out) and the repo's CLI description standards recommend phrasing like "Run ... (enabled by default; use --make=false to disable)". Also note that make generate only runs when p.resource.HasAPI(); the current wording implies it always runs after creating files.
Copilot
AI
Apr 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--resource help text says it will create the resource "without prompting" and that the default is true, but the implementation prompts when the flag isn't explicitly set (if !p.resourceFlag.Changed { ... util.YesNo(...) }). The wording should reflect the prompting behavior (see .agents/skills/cli-descriptions/SKILL.md:83-94 for the recommended pattern).
| "If set, create the resource without prompting. Default: true. "+ | |
| "Use --resource=false to skip resource creation (e.g., when adding a controller for an existing or external API)") | |
| "If set, create the resource. "+ | |
| "Use --resource=false to skip resource creation (e.g., when adding a controller for an existing or external API). "+ | |
| "If not specified, you may be prompted to confirm whether to create the resource") |
Copilot
AI
Apr 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--namespaced help text uses the "If set... Default: true" pattern, but this is a default-true (opt-out) flag. The repo's CLI description standards recommend phrasing like "Resource is namespaced by default; use --namespaced=false to create a cluster-scoped resource" (.agents/skills/cli-descriptions/SKILL.md:48-68).
| "If set, create a namespaced resource. Default: true. "+ | |
| "Use --namespaced=false to create a cluster-scoped resource") | |
| "Resource is namespaced by default; use --namespaced=false to create a cluster-scoped resource") |
Copilot
AI
Apr 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--controller help text says "Default: true" and suggests --controller=false to skip creation, but the command prompts when the flag isn't explicitly set (if !p.controllerFlag.Changed { ... }). Please use the prompting-flag wording (e.g., "Prompt whether to generate the controller by default; use --controller=true or --controller=false to skip the prompt") per .agents/skills/cli-descriptions/SKILL.md:83-94.
| "If set, create the controller. Default: true. "+ | |
| "Use --controller=false to skip controller creation") | |
| "Prompt whether to generate the controller by default; "+ | |
| "use --controller=true or --controller=false to skip the prompt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create apiShort/Long help now uses "Create", whilecreate webhookstill uses "Scaffold" (pkg/cli/webhook.go:33-35). Consider aligning the terminology acrosscreatesubcommands for a consistent help UX.