Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to refactor and de-duplicate repository “precondition” checks used by interactive CLI workflows (init/add), and adds an alias for the add command.
Changes:
- Replaced
initinteractive git-repo checking with a sharedCheckInteractivePreconditions(...)call. - Replaced several
addinteractive auth/repo checks with shared helper function calls. - Added
add-wizardas an alias for theaddcommand.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/cli/init.go | Switches interactive init to rely on a shared precondition-check function and logs the returned repo info. |
| pkg/cli/add_interactive_auth.go | Refactors interactive add auth/actions/permissions/visibility checks to shared helpers. |
| pkg/cli/add_command.go | Adds add-wizard as a Cobra alias for the add command. |
Comments suppressed due to low confidence (2)
pkg/cli/add_interactive_auth.go:15
checkGHAuthStatusSharedis called here but no such function is defined anywhere in the repo, so this change introduces a build break. Either add the new shared helper (likely alongside other interactive precondition checks) or revert to the previous inlined implementation.
// checkGHAuthStatus verifies the user is logged in to GitHub CLI
func (c *AddInteractiveConfig) checkGHAuthStatus() error {
return checkGHAuthStatusShared(c.Verbose)
}
pkg/cli/add_interactive_auth.go:74
checkRepoVisibilitySharedis referenced but not implemented anywhere in the repository, which will fail compilation. Add the extracted shared visibility check helper (keeping existing behavior like defaulting to public on failure) or restore the priorcheckRepoVisibilitymethod.
// Check if repository is public or private
c.isPublicRepo = checkRepoVisibilityShared(c.RepoOverride)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
add-wizardto the add commandDetails
The changes focus on modularizing the repository checking logic in the interactive workflows, making the code more maintainable and reducing duplication. Key modifications include extracting common authentication and repository validation methods to shared functions.