Skip to content

refactor(config): migrate commands to NewCommandSetup and remove lega…#640

Open
frjcomp wants to merge 1 commit into
mainfrom
copilot/config-migration-new-command-setup
Open

refactor(config): migrate commands to NewCommandSetup and remove lega…#640
frjcomp wants to merge 1 commit into
mainfrom
copilot/config-migration-new-command-setup

Conversation

@frjcomp
Copy link
Copy Markdown
Collaborator

@frjcomp frjcomp commented May 21, 2026

…cy bind APIs

Copilot AI review requested due to automatic review settings May 21, 2026 14:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR completes a config-binding refactor by migrating command implementations and tests to the config.NewCommandSetup pattern and removing legacy flag-binding helpers from pkg/config, reducing duplicated boilerplate across CLI commands.

Changes:

  • Removed legacy config binder functions (BindCommandFlags, AutoBindFlags) from pkg/config and routed binding through CommandSetup.
  • Migrated multiple platform commands (GitLab/GitHub/Gitea/Jenkins/Bitbucket/Azure DevOps) to NewCommandSetup(...).WithFlagBindings(...).RequireKeys(...).MustBind().
  • Updated unit/e2e tests and contributor instructions to match the new binding/validation approach.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/e2e/gitea/vuln/vuln_test.go Updates test commentary to reflect command setup based validation.
pkg/config/loader.go Removes deprecated/legacy binder APIs from the config loader package.
pkg/config/loader_priority_test.go Updates priority tests to bind flags via NewCommandSetup().WithFlagBindings(...).Bind().
pkg/config/loader_priority_chain_test.go Migrates chained precedence tests to NewCommandSetup binding.
pkg/config/loader_integration_test.go Updates integration tests to use NewCommandSetup flag binding.
pkg/config/loader_inheritance_test.go Updates inheritance tests to use NewCommandSetup binding.
pkg/config/loader_bind_test.go Renames and rewrites binder tests to validate CommandSetup behavior.
pkg/config/config_coverage_test.go Updates binding coverage tests and documentation text to reference NewCommandSetup.
pkg/config/command_setup.go Moves flag-binding implementation behind CommandSetup (internal bindFlags).
internal/cmd/jenkins/scan/scan.go Migrates Jenkins scan command to NewCommandSetup + explicit flagBindings.
internal/cmd/gitlab/tf/tf_test.go Updates GitLab TF command tests to use NewCommandSetup binding.
internal/cmd/gitlab/scanpublic/scan_public.go Migrates GitLab public scan command to NewCommandSetup + explicit flagBindings.
internal/cmd/gitlab/scan/scan.go Migrates GitLab scan command to NewCommandSetup + required key validation.
internal/cmd/gitlab/scan/scan_test.go Updates GitLab scan tests to bind via NewCommandSetup.
internal/cmd/gitlab/renovate/privesc/privesc.go Migrates Renovate privesc command to NewCommandSetup + required key validation.
internal/cmd/gitlab/renovate/enum/enum.go Migrates Renovate enum command to NewCommandSetup and removes legacy logging/binding flow.
internal/cmd/gitlab/renovate/bots/bots.go Migrates Renovate bots command to NewCommandSetup + required key validation.
internal/cmd/gitlab/renovate/autodiscovery/autodiscovery.go Migrates Renovate autodiscovery command to NewCommandSetup + required key validation.
internal/cmd/gitlab/container/artipacked/artipacked.go Migrates artipacked audit command to NewCommandSetup + required key validation.
internal/cmd/github/scan/scan.go Migrates GitHub scan command to NewCommandSetup + required key validation.
internal/cmd/github/scan/scan_flag_test.go Updates GitHub scan tests to bind via NewCommandSetup.
internal/cmd/gitea/scan/scan.go Migrates Gitea scan command to NewCommandSetup + required key validation.
internal/cmd/gitea/scan/scan_test.go Updates Gitea scan tests to bind via NewCommandSetup.
internal/cmd/devops/scan/scan.go Migrates Azure DevOps scan command to NewCommandSetup + required key validation.
internal/cmd/devops/scan/scan_test.go Updates Azure DevOps scan tests to bind via NewCommandSetup.
internal/cmd/circle/scan/scan_test.go Updates CircleCI scan tests to bind via NewCommandSetup.
internal/cmd/bitbucket/scan/scan.go Migrates Bitbucket scan command to NewCommandSetup (binding consolidation via flagBindings).
.github/copilot-instructions.md Updates contributor guidance to reflect removal of legacy binder APIs and NewCommandSetup usage.

Comment on lines 117 to 119
// MustBind is like Bind but logs fatal on error. Use this for commands where failure
// should immediately exit the program.
func (cs *CommandSetup) MustBind() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants