Skip to content

🔧 Refactor repository checks in interactive workflows#14246

Merged
dsyme merged 3 commits intomainfrom
rc
Feb 7, 2026
Merged

🔧 Refactor repository checks in interactive workflows#14246
dsyme merged 3 commits intomainfrom
rc

Conversation

@dsyme
Copy link
Contributor

@dsyme dsyme commented Feb 7, 2026

Summary

  • Extracted shared repository check methods for better code reusability
  • Added an alias add-wizard to the add command
  • Simplified interactive workflow checks with shared functions
  • Improved error handling and logging in repository status checks

Details

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.

Copilot AI review requested due to automatic review settings February 7, 2026 00:55
Copy link
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 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 init interactive git-repo checking with a shared CheckInteractivePreconditions(...) call.
  • Replaced several add interactive auth/repo checks with shared helper function calls.
  • Added add-wizard as an alias for the add command.

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

  • checkGHAuthStatusShared is 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

  • checkRepoVisibilityShared is 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 prior checkRepoVisibility method.
	// 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.

@dsyme dsyme merged commit f8b2094 into main Feb 7, 2026
51 checks passed
@dsyme dsyme deleted the rc branch February 7, 2026 01:28
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.

1 participant