Open
Description
Describe the change
Summary
Add support to automatically configure the GitHub CLI (gh
) and Git for the relevant account/context when running Connect-GitHubAccount
, Disconnect-GitHubAccount
, and Connect-GitHubApp
.
This should streamline authentication and configuration for users, ensuring their CLI tools are in sync with PowerShell authentication actions.
Motivation
Currently, users who authenticate via PowerShell functions must manually ensure that their gh
and Git environments are configured to match. This manual process is error-prone and inconvenient, especially in multi-account or automation scenarios.
Proposal
New Behavior
- On connect:
When a user runsConnect-GitHubAccount
orConnect-GitHubApp
, the module should configure the GitHub CLI (gh
) and Git to use the authenticated account (unless skipped). - On disconnect:
When a user runsDisconnect-GitHubAccount
, the module should clear (or restore) the relatedgh
and Git context (unless skipped).
New Parameters
-SkipGit
Skip Git configuration.-SkipCli
Skip GitHub CLI (gh
) configuration.
Supported Functions
Connect-GitHubAccount
Connect-GitHubApp
Disconnect-GitHubAccount
Example Usage
Connect-GitHubAccount -SkipGit # Configures only gh, not Git
Connect-GitHubAccount -SkipCli # Configures only Git, not gh
Connect-GitHubAccount -SkipGit -SkipCli # Skips all configuration (current behavior)
Disconnect-GitHubAccount # Resets gh and Git context
Considerations
- For Git, update
user.name
anduser.email
based on the authenticated GitHub user, scoped appropriately (global/local). - For
gh
, log in/out or switch user/context based on the account used in the session. - Should not override user settings unless the authentication context is explicitly changed via the cmdlet.
Acceptance Criteria
- Cmdlets update Git and
gh
configuration according to the authenticated account. -
-SkipGit
and-SkipCli
work as described. - Documentation/examples are updated to cover the new options.
- Does not break existing behavior when both switches are omitted.
Additional Notes
- Should gracefully handle environments where either
git
orgh
are not installed. - Consider modularizing config logic for easier testing/maintenance.
Metadata
Metadata
Assignees
Type
Projects
Status
Todo