Autocomplete consistency for app/job/secret/valkey/opensearch commands#668
Autocomplete consistency for app/job/secret/valkey/opensearch commands#668rbjornstad merged 28 commits intomainfrom
Conversation
📝 Changelog previewBelow is a preview of the Changelog that will be added to the next release. Only commit messages that follow the Conventional Commits specification will be included in the Changelog. v5.14.0 - 2026-03-16Full Changelog: v5.13.1...v5.14.0 🚀 Features
🐛 Bug Fixes
⚙️ Miscellaneous Changes
|
There was a problem hiding this comment.
Pull request overview
This PR refactors and standardizes CLI auto-completion for several resource commands (Valkey, OpenSearch, Secrets, Apps, Jobs), and adds more explicit handling of environment flag usage—particularly for secrets where the environment can be inferred at runtime.
Changes:
- Extracted shared auto-completion helpers for Valkey and OpenSearch instance names (dedupe + sort + optional environment filtering).
- Reworked secret name auto-completion to support environment filtering, and added secret environment resolution logic for
secrets get. - Added CLI-arg parsing helpers to infer
--environmentvalues for auto-completion in some commands, plus added “missing team” feedback in list commands.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/valkey/command/update.go | Uses shared Valkey name auto-completion helper. |
| internal/valkey/command/get.go | Uses shared Valkey name auto-completion helper. |
| internal/valkey/command/delete.go | Uses shared Valkey name auto-completion helper. |
| internal/valkey/command/command.go | Adds autoCompleteValkeyNames (dedupe/sort/filter). |
| internal/opensearch/command/update.go | Uses shared OpenSearch name auto-completion helper. |
| internal/opensearch/command/get.go | Uses shared OpenSearch name auto-completion helper. |
| internal/opensearch/command/delete.go | Uses shared OpenSearch name auto-completion helper. |
| internal/opensearch/command/command.go | Adds autoCompleteOpenSearchNames + CLI arg environment parsing helper. |
| internal/secret/command/command.go | Refactors secret name auto-completion with environment filtering and sorting. |
| internal/secret/command/environment.go | Adds secret environment resolution + environment flag counting/parsing helpers. |
| internal/secret/command/get.go | Updates validation flow and runtime environment resolution for secrets get; refactors run logic into helper. |
| internal/secret/command/set.go | Adds single-environment-flag usage validation; updates secret-name auto-completion call. |
| internal/secret/command/unset.go | Adds single-environment-flag usage validation; updates secret-name auto-completion call. |
| internal/secret/command/delete.go | Adds single-environment-flag usage validation; updates secret-name auto-completion call. |
| internal/secret/command/activity.go | Uses parsed CLI environments for secret-name auto-completion when flags aren’t populated. |
| internal/app/command/list.go | Adds AutoCompleteFunc to surface missing-team guidance. |
| internal/app/command/activity.go | Adds CLI parsing fallback to require environment(s) for activity name completion. |
| internal/job/command/list.go | Adds AutoCompleteFunc to surface missing-team guidance. |
| internal/job/command/activity.go | Adds CLI parsing fallback to require environment(s) for activity name completion. |
Comments suppressed due to low confidence (1)
internal/secret/command/get.go:45
secrets getno longer validates the value of--environment. If the user provides an invalid environment string,resolveSecretEnvironmentreturns it as-is and the command proceeds to call the API, which can lead to confusing downstream errors. Consider reintroducingvalidation.CheckEnvironment(string(f.Environment))when the flag is set, or validatingprovidedinsideresolveSecretEnvironmentbefore returning it.
ValidateFunc: func(_ context.Context, args *naistrix.Arguments) error {
if err := validateSingleEnvironmentFlagUsage(); err != nil {
return err
}
if err := validateArgs(args); err != nil {
return err
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
This reverts commit b8a6bbe.
There was a problem hiding this comment.
Pull request overview
This PR refactors several CLI commands to centralize and improve shell auto-completion behavior (especially around filtering by environment), and enhances secret handling by resolving the secret environment when not explicitly provided.
Changes:
- Centralize name auto-completion for Valkey and OpenSearch instances (dedupe + sort + optional environment filtering).
- Improve secret commands by adding environment resolution logic and stricter detection of multiple
--environment/-eflag usages. - Introduce a small
internal/cliflagshelper for extracting/counting flag values directly from raw CLI args (used primarily in completion paths).
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/valkey/command/update.go | Switch Valkey name completion to shared helper. |
| internal/valkey/command/get.go | Switch Valkey name completion to shared helper. |
| internal/valkey/command/delete.go | Switch Valkey name completion to shared helper. |
| internal/valkey/command/command.go | Add autoCompleteValkeyNames helper (dedupe/sort/filter by environment). |
| internal/secret/command/unset.go | Enforce single environment flag usage; update completion call signature. |
| internal/secret/command/set.go | Enforce single environment flag usage; update completion call signature. |
| internal/secret/command/get.go | Resolve environment dynamically; refactor run logic into runGetCommand. |
| internal/secret/command/environment.go | New helpers for resolving secret environment and inspecting raw --environment/-e usage. |
| internal/secret/command/delete.go | Enforce single environment flag usage; update completion call signature. |
| internal/secret/command/command.go | Refactor/extend secret name completion with environment filtering + sorting. |
| internal/secret/command/activity.go | Allow completion across multiple environments (including from raw CLI args). |
| internal/opensearch/command/update.go | Switch OpenSearch name completion to shared helper. |
| internal/opensearch/command/get.go | Switch OpenSearch name completion to shared helper. |
| internal/opensearch/command/delete.go | Switch OpenSearch name completion to shared helper. |
| internal/opensearch/command/command.go | Add autoCompleteOpenSearchNames helper + raw env parsing fallback. |
| internal/job/command/list.go | Add completion-time hint when team is missing. |
| internal/job/command/activity.go | Completion now derives envs from raw args when needed. |
| internal/cliflags/flags.go | New utilities for parsing unique flag values / counting occurrences from args. |
| internal/app/command/list.go | Add completion-time hint when team is missing. |
| internal/app/command/activity.go | Completion now derives envs from raw args when needed. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
This PR improves CLI auto-completion and environment handling across multiple commands by centralizing “name” completion logic, adding CLI flag parsing helpers, and making secrets get capable of resolving the environment when omitted.
Changes:
- Refactors Valkey/OpenSearch name auto-completion into shared helper functions with environment filtering and sorted/deduped results.
- Enhances secrets commands with multi-environment handling utilities (including environment resolution for
secrets get) and stronger--environment/-eusage validation. - Introduces
internal/cliflagshelpers (with tests) to parse repeated flag values from raw CLI args, used by activity auto-completion.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/valkey/command/update.go | Switches instance-name autocomplete to new Valkey helper. |
| internal/valkey/command/get.go | Switches instance-name autocomplete to new Valkey helper. |
| internal/valkey/command/delete.go | Switches instance-name autocomplete to new Valkey helper. |
| internal/valkey/command/command.go | Adds autoCompleteValkeyNames helper (dedupe + env filter + sort). |
| internal/secret/command/unset.go | Adds single-environment flag usage validation; updates autocomplete call signature. |
| internal/secret/command/set.go | Adds single-environment flag usage validation; updates autocomplete call signature. |
| internal/secret/command/get.go | Adds environment auto-resolution and refactors run logic into runGetCommand; updates autocomplete call signature. |
| internal/secret/command/environment.go | Adds environment resolution/selection logic and CLI env-flag occurrence utilities. |
| internal/secret/command/environment_test.go | Adds unit tests for selectSecretEnvironment. |
| internal/secret/command/delete.go | Adds single-environment flag usage validation; updates autocomplete call signature. |
| internal/secret/command/command.go | Refactors secret-name autocomplete with env filtering, dedupe, and sorting. |
| internal/secret/command/activity.go | Uses CLI env-flag parsing fallback for autocomplete environment filtering. |
| internal/opensearch/command/update.go | Switches instance-name autocomplete to new OpenSearch helper. |
| internal/opensearch/command/get.go | Switches instance-name autocomplete to new OpenSearch helper. |
| internal/opensearch/command/delete.go | Switches instance-name autocomplete to new OpenSearch helper. |
| internal/opensearch/command/command.go | Adds autoCompleteOpenSearchNames helper and CLI env parsing helper. |
| internal/job/command/list.go | Adds an autocomplete hook that prompts for missing team (no suggestions returned). |
| internal/job/command/activity.go | Uses CLI env-flag parsing fallback to pass environments into GetJobNames. |
| internal/cliflags/flags.go | Adds UniqueFlagValues / CountFlagOccurrences for raw CLI arg inspection. |
| internal/cliflags/flags_test.go | Adds unit tests for UniqueFlagValues and CountFlagOccurrences. |
| internal/app/command/list.go | Adds an autocomplete hook that prompts for missing team (no suggestions returned). |
| internal/app/command/activity.go | Uses CLI env-flag parsing fallback to pass environments into GetApplicationNames. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
This PR refactors CLI command registration and auto-completion to better handle environment/team context, and promotes some commands from the alpha command group to the main CLI.
Changes:
- Promote
valkeyandopensearchcommands to top-level (remove fromalpha) and refactor their flags to useflags.GlobalFlags. - Centralize instance-name autocompletion for Valkey/OpenSearch with environment filtering and sorted/deduped results.
- Improve secret environment handling (auto-resolve environment for
secrets get, enforce single--environment/-eusage for single-env secret commands), and add a smallcliflagsutility for reading repeated-e/--environmentvalues fromos.Args.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/valkey/command/command.go | Adds shared Valkey name auto-complete helper and switches command to GlobalFlags. |
| internal/valkey/command/flag/flag.go | Replaces embedded alpha flags with *flags.GlobalFlags. |
| internal/valkey/command/get.go | Uses centralized Valkey name auto-completion. |
| internal/valkey/command/delete.go | Uses centralized Valkey name auto-completion. |
| internal/valkey/command/update.go | Uses centralized Valkey name auto-completion. |
| internal/opensearch/command/command.go | Adds shared OpenSearch name auto-complete helper (incl. CLI env flag inspection) and switches command to GlobalFlags. |
| internal/opensearch/command/flag/flag.go | Replaces embedded alpha flags with *flags.GlobalFlags. |
| internal/opensearch/command/get.go | Uses centralized OpenSearch name auto-completion. |
| internal/opensearch/command/delete.go | Uses centralized OpenSearch name auto-completion. |
| internal/opensearch/command/update.go | Uses centralized OpenSearch name auto-completion. |
| internal/secret/command/command.go | Refactors secret name autocompletion to support environment filtering and better messages. |
| internal/secret/command/environment.go | Adds environment resolution logic for secrets get and validation for single -e/--environment usage. |
| internal/secret/command/environment_test.go | Adds unit tests for secret environment selection behavior. |
| internal/secret/command/get.go | Allows secrets get to resolve environment automatically; refactors logic into runGetCommand. |
| internal/secret/command/set.go | Enforces single -e/--environment usage; updates autocompletion call signature. |
| internal/secret/command/unset.go | Enforces single -e/--environment usage; updates autocompletion call signature. |
| internal/secret/command/delete.go | Enforces single -e/--environment usage; updates autocompletion call signature. |
| internal/secret/command/activity.go | Uses CLI-provided environment values when repeated -e flags are used. |
| internal/cliflags/flags.go | Introduces helpers to extract/count flag values directly from argv. |
| internal/cliflags/flags_test.go | Adds unit tests for the new argv flag helpers. |
| internal/app/command/activity.go | Reads repeated environment flags from argv when needed for activity auto-complete. |
| internal/app/command/list.go | Adds an autocomplete handler to provide an active-help message when team is missing. |
| internal/job/command/activity.go | Reads repeated environment flags from argv when needed for activity auto-complete. |
| internal/job/command/list.go | Adds an autocomplete handler to provide an active-help message when team is missing. |
| internal/application/application.go | Registers valkey and opensearch as top-level commands. |
| internal/alpha/command/alpha.go | Removes valkey and opensearch from the alpha command group. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
This PR refactors CLI auto-completion and environment handling across several commands, introduces shared CLI-arg flag parsing helpers, and promotes the valkey and opensearch command groups from the alpha command tree into the main application command set.
Changes:
- Centralize and enhance auto-completion for Valkey/OpenSearch/Secrets with team/environment-aware filtering and clearer user guidance.
- Add
internal/cliflagshelpers for parsing repeated short/long flags from raw CLI args, plus unit tests. - Improve
secrets getby resolving environment automatically when omitted (and add tests), and wire new commands into the main app while removing them fromalpha.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/valkey/command/update.go | Switch Valkey name autocomplete to shared helper. |
| internal/valkey/command/get.go | Switch Valkey name autocomplete to shared helper. |
| internal/valkey/command/delete.go | Switch Valkey name autocomplete to shared helper. |
| internal/valkey/command/command.go | Add Valkey autocomplete helper and CLI env-flag parsing. |
| internal/valkey/command/flag/flag.go | Migrate Valkey flags to embed GlobalFlags instead of alpha flags. |
| internal/opensearch/command/update.go | Switch OpenSearch name autocomplete to shared helper. |
| internal/opensearch/command/get.go | Switch OpenSearch name autocomplete to shared helper. |
| internal/opensearch/command/delete.go | Switch OpenSearch name autocomplete to shared helper. |
| internal/opensearch/command/command.go | Add OpenSearch autocomplete helper and CLI env-flag parsing. |
| internal/opensearch/command/flag/flag.go | Migrate OpenSearch flags to embed GlobalFlags instead of alpha flags. |
| internal/secret/command/unset.go | Enforce single environment flag usage + updated secret-name autocomplete call. |
| internal/secret/command/set.go | Enforce single environment flag usage + updated secret-name autocomplete call. |
| internal/secret/command/get.go | Resolve secret environment when omitted; refactor execution into helper function. |
| internal/secret/command/environment.go | Add environment resolution + environment-flag usage validation utilities. |
| internal/secret/command/environment_test.go | Unit tests for environment selection logic. |
| internal/secret/command/delete.go | Enforce single environment flag usage + updated secret-name autocomplete call. |
| internal/secret/command/command.go | Add environment-aware secret-name autocomplete + improved messaging. |
| internal/secret/command/activity.go | Support environment filtering in secret-name autocomplete for activity. |
| internal/job/command/list.go | Add autocomplete-time guidance when team is missing. |
| internal/job/command/activity.go | Pull environment values from raw CLI args when flags aren’t populated (autocomplete). |
| internal/app/command/list.go | Add autocomplete-time guidance when team is missing. |
| internal/app/command/activity.go | Pull environment values from raw CLI args when flags aren’t populated (autocomplete). |
| internal/cliflags/flags.go | New utilities to parse unique flag values and count occurrences from os.Args. |
| internal/cliflags/flags_test.go | Unit tests for new CLI-flag parsing helpers. |
| internal/application/application.go | Register Valkey and OpenSearch commands at the top-level app. |
| internal/alpha/command/alpha.go | Remove Valkey/OpenSearch from alpha subcommands. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
This PR improves CLI auto-completion and environment handling across several commands, and promotes valkey and opensearch from the alpha command group to top-level commands.
Changes:
- Add
internal/cliflagshelpers to parse/count repeated CLI flags (notably--environment/-e) fromos.Args. - Refactor secret/valkey/opensearch auto-completion to support environment filtering and clearer guidance when team/environment is missing or ambiguous.
- Allow
secret getto omit--environmentby resolving the environment when the secret exists in exactly one environment; movevalkey/opensearchto the root command set.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/valkey/command/update.go | Switch instance-name completion to shared autoCompleteValkeyNames. |
| internal/valkey/command/get.go | Switch instance-name completion to shared autoCompleteValkeyNames. |
| internal/valkey/command/delete.go | Switch instance-name completion to shared autoCompleteValkeyNames. |
| internal/valkey/command/command.go | Add Valkey name auto-completion helper with env filtering + CLI flag parsing helpers. |
| internal/valkey/command/flag/flag.go | Embed *flags.GlobalFlags instead of alpha flags. |
| internal/opensearch/command/update.go | Switch instance-name completion to shared autoCompleteOpenSearchNames. |
| internal/opensearch/command/get.go | Switch instance-name completion to shared autoCompleteOpenSearchNames. |
| internal/opensearch/command/delete.go | Switch instance-name completion to shared autoCompleteOpenSearchNames. |
| internal/opensearch/command/command.go | Add OpenSearch name auto-completion helper with env filtering + CLI flag parsing helpers. |
| internal/opensearch/command/flag/flag.go | Embed *flags.GlobalFlags instead of alpha flags. |
| internal/secret/command/unset.go | Enforce single --environment/-e usage; update secret name auto-completion signature. |
| internal/secret/command/set.go | Enforce single --environment/-e usage; update secret name auto-completion signature. |
| internal/secret/command/delete.go | Enforce single --environment/-e usage; update secret name auto-completion signature. |
| internal/secret/command/get.go | Allow omitted environment via resolution; refactor run logic into runGetCommand; update auto-completion. |
| internal/secret/command/activity.go | Auto-complete secret names filtered by selected/enumerated environments. |
| internal/secret/command/command.go | Refactor secret-name auto-completion to support env filtering and improved messaging. |
| internal/secret/command/environment.go | Add environment resolution + single-environment flag validation utilities. |
| internal/secret/command/environment_test.go | Add tests for secret environment selection logic. |
| internal/job/command/list.go | Add AutoCompleteFunc to provide a helpful “missing team” message. |
| internal/job/command/activity.go | Use cliflags.UniqueFlagValues to infer environments from CLI args when none are set in flags. |
| internal/app/command/list.go | Add AutoCompleteFunc to provide a helpful “missing team” message. |
| internal/app/command/activity.go | Use cliflags.UniqueFlagValues to infer environments from CLI args when none are set in flags. |
| internal/cliflags/flags.go | New helpers to parse unique flag values and count occurrences from raw CLI args. |
| internal/cliflags/flags_test.go | Unit tests for cliflags parsing/counting behavior. |
| internal/application/application.go | Register valkey and opensearch as top-level commands. |
| internal/alpha/command/alpha.go | Remove valkey/opensearch from alpha subcommands. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
This PR promotes the Valkey and OpenSearch commands from the alpha command group into the main CLI, and improves --environment/-e handling and auto-completion across several commands by parsing environment flags directly from CLI args.
Changes:
- Add a new
internal/cliflagshelper package to parse/count CLI flag occurrences and values. - Improve environment validation/selection and environment-aware auto-completion for secrets, Valkey, OpenSearch, apps, and jobs.
- Move
valkeyandopensearchcommands out ofalphaand into the main application command set.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/valkey/command/command.go | Switch to GlobalFlags, add env-aware Valkey name auto-completion and single-env flag validation helpers. |
| internal/valkey/command/create.go | Enforce single --environment/-e usage during validation. |
| internal/valkey/command/delete.go | Use shared Valkey name auto-completion and enforce single environment flag usage. |
| internal/valkey/command/get.go | Use shared Valkey name auto-completion and enforce single environment flag usage. |
| internal/valkey/command/update.go | Use shared Valkey name auto-completion and enforce single environment flag usage. |
| internal/valkey/command/flag/flag.go | Migrate Valkey flags to embed GlobalFlags instead of alpha flags. |
| internal/opensearch/command/command.go | Switch to GlobalFlags, add env-aware OpenSearch name auto-completion and single-env flag validation helpers. |
| internal/opensearch/command/create.go | Enforce single --environment/-e usage during validation. |
| internal/opensearch/command/delete.go | Use shared OpenSearch name auto-completion and enforce single environment flag usage. |
| internal/opensearch/command/get.go | Use shared OpenSearch name auto-completion and enforce single environment flag usage. |
| internal/opensearch/command/update.go | Use shared OpenSearch name auto-completion and enforce single environment flag usage. |
| internal/opensearch/command/flag/flag.go | Migrate OpenSearch flags to embed GlobalFlags instead of alpha flags. |
| internal/secret/command/command.go | Refactor secret auto-completion to support environment filtering and better empty-result messaging. |
| internal/secret/command/environment.go | Add logic to resolve/select environment for secrets and validate single env flag usage. |
| internal/secret/command/environment_test.go | Add test coverage for secret environment selection logic. |
| internal/secret/command/get.go | Allow secret get without explicit environment by resolving it when unambiguous; refactor run logic into helper. |
| internal/secret/command/set.go | Enforce single --environment/-e usage; update auto-completion to new signature. |
| internal/secret/command/unset.go | Enforce single --environment/-e usage; update auto-completion to new signature. |
| internal/secret/command/delete.go | Enforce single --environment/-e usage; update auto-completion to new signature. |
| internal/secret/command/activity.go | Auto-complete secret names with optional environment filtering sourced from CLI args. |
| internal/cliflags/flags.go | Add utilities to parse unique flag values and count occurrences from os.Args. |
| internal/cliflags/flags_test.go | Add tests for flag parsing/counting helpers. |
| internal/app/command/activity.go | Use CLI-derived env values for name auto-completion when env flag list is empty. |
| internal/app/command/list.go | Add an AutoCompleteFunc guard for missing team (currently introduces an unused param compile error). |
| internal/job/command/activity.go | Use CLI-derived env values for name auto-completion when env flag list is empty. |
| internal/job/command/list.go | Add an AutoCompleteFunc guard for missing team (currently introduces an unused param compile error). |
| internal/application/application.go | Register valkey and opensearch commands in the main application command list. |
| internal/alpha/command/alpha.go | Remove valkey and opensearch from the alpha command group. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
This PR improves CLI environment-flag handling and auto-completion behavior across multiple commands, while also promoting valkey and opensearch commands from the alpha command group into the main application command set.
Changes:
- Add a shared
cliflagshelper for extracting/counting--environment/-evalues from raw CLI args (supporting completion scenarios). - Update Valkey/OpenSearch/Secret commands to enforce single
--environment/-eusage and to improve name auto-completion (including env filtering). - Enhance
secret getto resolve environment automatically when not provided, with tests; movevalkey/opensearchinto the main app commands.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/valkey/command/update.go | Enforce single env-flag usage; delegate name completion to shared helper. |
| internal/valkey/command/get.go | Enforce single env-flag usage; delegate name completion to shared helper. |
| internal/valkey/command/delete.go | Enforce single env-flag usage; delegate name completion to shared helper. |
| internal/valkey/command/create.go | Enforce single env-flag usage during validation. |
| internal/valkey/command/command.go | Switch to GlobalFlags; add env-aware Valkey name completion + env-flag parsing helpers. |
| internal/valkey/command/flag/flag.go | Replace alpha flags embedding with GlobalFlags. |
| internal/opensearch/command/update.go | Enforce single env-flag usage; delegate name completion to shared helper. |
| internal/opensearch/command/get.go | Enforce single env-flag usage; delegate name completion to shared helper. |
| internal/opensearch/command/delete.go | Enforce single env-flag usage; delegate name completion to shared helper. |
| internal/opensearch/command/create.go | Enforce single env-flag usage during validation. |
| internal/opensearch/command/command.go | Switch to GlobalFlags; add env-aware OpenSearch name completion + env-flag parsing helpers. |
| internal/opensearch/command/flag/flag.go | Replace alpha flags embedding with GlobalFlags. |
| internal/secret/command/get.go | Allow env omission by resolving secret environment; refactor into runGetCommand; update completion + validation. |
| internal/secret/command/set.go | Enforce single env-flag usage; update secret-name completion signature. |
| internal/secret/command/unset.go | Enforce single env-flag usage; update secret-name completion signature. |
| internal/secret/command/delete.go | Enforce single env-flag usage; update secret-name completion signature. |
| internal/secret/command/command.go | Add env-aware secret name completion with optional env filtering and better “no results” messages. |
| internal/secret/command/activity.go | Update completion to support env filtering from flags/CLI args. |
| internal/secret/command/environment.go | Add env resolution + single env-flag validation + CLI env extraction helpers. |
| internal/secret/command/environment_test.go | Add unit tests for secret environment selection logic. |
| internal/app/command/activity.go | Update completion to allow env values from CLI args when none are set in flags. |
| internal/app/command/list.go | Add autocomplete messaging when team is missing. |
| internal/job/command/activity.go | Update completion to allow env values from CLI args when none are set in flags. |
| internal/job/command/list.go | Add autocomplete messaging when team is missing. |
| internal/cliflags/flags.go | New helper: parse unique flag values and count occurrences from raw args. |
| internal/cliflags/flags_test.go | Unit tests for CLI flag parsing/counting helpers. |
| internal/application/application.go | Register valkey and opensearch as top-level commands. |
| internal/alpha/command/alpha.go | Remove valkey/opensearch from alpha command group. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
This PR promotes the valkey and opensearch command groups from alpha into the main CLI, and improves environment-related UX by (a) enforcing single --environment/-e usage where commands only accept one environment, and (b) making auto-completion environment-aware across several commands. It also updates app/job activity auto-completion to support multiple environment filters.
Changes:
- Move
valkeyandopensearchcommands out ofalphaand register them in the main application command set. - Add shared CLI-args flag parsing helpers (
internal/cliflags) and use them to support environment-aware auto-completion and to reject repeated--environment/-ewhere ambiguous. - Improve
secret getbehavior by resolving environment when omitted and adding tests for environment selection logic.
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/valkey/command/update.go | Adds single-environment flag validation and switches name auto-completion to a shared helper. |
| internal/valkey/command/get.go | Adds single-environment flag validation and switches name auto-completion to a shared helper. |
| internal/valkey/command/delete.go | Adds single-environment flag validation and switches name auto-completion to a shared helper. |
| internal/valkey/command/create.go | Adds single-environment flag validation. |
| internal/valkey/command/command.go | Moves to GlobalFlags parent, adds environment-aware instance name auto-completion + CLI-args parsing helpers. |
| internal/valkey/command/flag/flag.go | Switches embedded flags from alpha.Alpha to flags.GlobalFlags. |
| internal/opensearch/command/update.go | Adds single-environment flag validation and switches name auto-completion to a shared helper. |
| internal/opensearch/command/get.go | Adds single-environment flag validation and switches name auto-completion to a shared helper. |
| internal/opensearch/command/delete.go | Adds single-environment flag validation and switches name auto-completion to a shared helper. |
| internal/opensearch/command/create.go | Adds single-environment flag validation. |
| internal/opensearch/command/command.go | Moves to GlobalFlags parent, adds environment-aware instance name auto-completion + CLI-args parsing helpers. |
| internal/opensearch/command/flag/flag.go | Switches embedded flags from alpha.Alpha to flags.GlobalFlags. |
| internal/secret/command/unset.go | Adds single-environment flag validation and updates secret-name auto-completion signature. |
| internal/secret/command/set.go | Adds single-environment flag validation and updates secret-name auto-completion signature. |
| internal/secret/command/delete.go | Adds single-environment flag validation and updates secret-name auto-completion signature. |
| internal/secret/command/get.go | Allows environment omission by resolving it at runtime; refactors execution into runGetCommand. |
| internal/secret/command/command.go | Implements environment-aware secret-name auto-completion (including multi-env variant) and improved messaging. |
| internal/secret/command/activity.go | Updates auto-completion to optionally filter by one or more environments. |
| internal/secret/command/environment.go | Adds environment resolution/selection logic and CLI env-flag counting helpers. |
| internal/secret/command/environment_test.go | Adds unit tests for environment selection logic. |
| internal/job/command/list.go | Adds a minimal autocomplete handler to surface missing-team guidance. |
| internal/job/command/activity.go | Updates job-name auto-completion to accept multiple environments from flags or CLI args. |
| internal/app/command/list.go | Adds a minimal autocomplete handler to surface missing-team guidance. |
| internal/app/command/activity.go | Updates application-name auto-completion to accept multiple environments from flags or CLI args. |
| internal/cliflags/flags.go | New helpers to parse repeated flag occurrences/values directly from raw CLI args. |
| internal/cliflags/flags_test.go | Unit tests for cliflags parsing behavior. |
| internal/application/application.go | Registers valkey and opensearch at the top-level command set. |
| internal/alpha/command/alpha.go | Removes valkey and opensearch from the alpha command group. |
Comments suppressed due to low confidence (1)
internal/secret/command/get.go:52
secret getno longer validates--environment/-ewhen it is provided (the previousvalidation.CheckEnvironmentcall was removed). This means a typoed/invalid environment will only fail later (or give a misleading “secret does not exist in environment …” message). Suggest: ifstring(f.Environment) != "", runvalidation.CheckEnvironment(...)inValidateFunc(keeping environment optional overall).
ValidateFunc: func(_ context.Context, args *naistrix.Arguments) error {
if err := validateSingleEnvironmentFlagUsage(); err != nil {
return err
}
if err := validateArgs(args); err != nil {
return err
}
if f.Reason != "" && !f.WithValues {
return fmt.Errorf("--reason can only be used together with --with-values")
}
if f.WithValues && f.Reason != "" && len(f.Reason) < 10 {
return fmt.Errorf("reason must be at least 10 characters")
}
return nil
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Summary
This PR improves autocomplete consistency and environment handling across app, job, secret, valkey, and opensearch commands.
Main goals:
Changes
Secrets
secrets getsecrets deletesecrets setsecrets unsetsecrets activitywhen multiple-eare providedApp / Job
app activityandjob activityautocomplete to better respect environment in completion context.job list.app listautocomplete UX:Valkey
valkey getvalkey deletevalkey updateOpenSearch
opensearch getopensearch deleteopensearch updateWhy
Autocomplete behavior was inconsistent across command groups and could:
-e/--environmentin completion contextThis PR makes behavior consistent and safer for environment-scoped commands.
Validation
go test ./internal/secret/command ./internal/app/command ./internal/job/command ./internal/opensearch/commandgo build ./...go build -o nais . && source <(./nais completion zsh)Manual smoke checks:
app list,app activityjob list,job activitysecrets get,secrets activityvalkey getopensearch getNotes
valkeyandopensearchare now top-level commands (moved out ofalpha).