Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 11, 2025

This pull request introduces a new configurable completion mode for argument completers, allowing users to choose between 'StartsWith' and 'Contains' matching for tab completion throughout the module. It also improves the config initialization logic to better synchronize stored configuration objects with the current class definition, ensuring obsolete properties are removed and new ones are added automatically.

Configurable Completion Mode:

  • Added a new CompletionMode property to the GitHubConfig class, allowing users to select between 'StartsWith' and 'Contains' matching for argument completion. This property is now included in the config display format.
  • Updated all argument completer scripts to use the CompletionMode from config, switching between prefix and substring matching as specified. This affects completers for contexts, organizations, environments, gitignore, licenses, permissions, and repository permissions.
  • Added a value completer for the CompletionMode property itself, suggesting 'StartsWith' and 'Contains' when setting the config.

Configuration Management Improvements:

  • Enhanced the Initialize-GitHubConfig function to automatically add new properties and remove obsolete ones from stored configs, ensuring the config object stays in sync with the class definition.

Minor Usability Improvement:

  • Made the Context parameter in Get-GitHubContext positional for easier use.

Copilot AI and others added 2 commits September 11, 2025 20:32
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
…mpletion

Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] 🩹 [Patch]: Add a config for how to match argument completers 🩹 [Patch]: Add a config for how to match argument completers Sep 11, 2025
@Copilot Copilot AI requested a review from MariusStorhaug September 11, 2025 20:36
Copilot finished work on behalf of MariusStorhaug September 11, 2025 20:36
@MariusStorhaug
Copy link
Member

@copilot
When I have upgraded my module locally to the version that has a new config value, I want the new value to be created on my local config. Make changes so that the local config is updated with new values from the module. Also make sure that values that are in the local config is removed if no longer supported by the module (via the GitHubConfig class.)

…rties

Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Sep 11, 2025

@copilot
When I have upgraded my module locally to the version that has a new config value, I want the new value to be created on my local config. Make changes so that the local config is updated wi...

I've enhanced the Initialize-GitHubConfig function to automatically synchronize the local config with the module's current GitHubConfig class definition. The implementation now:

Adds new properties - Any new config values (like CompletionMode) are automatically added to local config with default values
Removes obsolete properties - Properties no longer supported by the GitHubConfig class are automatically removed from local config
Uses class reflection - Compares against actual [GitHubConfig].GetProperties().Name for accuracy

When users upgrade to this version, their local config will automatically get the new CompletionMode property and stay synchronized with future module updates.

Implemented in commit d058ea4.

@Copilot Copilot AI changed the title 🩹 [Patch]: Add a config for how to match argument completers 🩹 [Patch]: Add a config for how to match argument completers with automatic config synchronization Sep 11, 2025
Copilot finished work on behalf of MariusStorhaug September 11, 2025 23:32
@MariusStorhaug MariusStorhaug marked this pull request as ready for review September 11, 2025 23:39
@MariusStorhaug MariusStorhaug requested a review from a team as a code owner September 11, 2025 23:39
@Copilot Copilot AI review requested due to automatic review settings September 11, 2025 23:39
Copy link
Contributor

@Copilot 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 patch adds a new CompletionMode configuration option to control argument completion behavior (StartsWith vs Contains matching) and enhances the configuration system to automatically synchronize local configs when the module is upgraded.

  • Added CompletionMode property to GitHubConfig class with StartsWith (default) and Contains options
  • Created Get-GitHubCompletionPattern helper function and updated all 30 argument completer instances to use it
  • Enhanced configuration synchronization to automatically add new properties and remove obsolete ones during module upgrades

Reviewed Changes

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

Show a summary per file
File Description
src/classes/public/Config/GitHubConfig.ps1 Added CompletionMode property to the GitHubConfig class
src/variables/private/GitHub.ps1 Added default CompletionMode value to module configuration
src/functions/private/Config/Get-GitHubCompletionPattern.ps1 New helper function to generate completion patterns based on configuration
src/functions/private/Config/Initialize-GitHubConfig.ps1 Enhanced config synchronization logic for automatic property management
src/functions/public/Config/completers.ps1 Updated to use new pattern helper and added completion for CompletionMode values
Multiple completer files (13 files) Updated all argument completers to use the new pattern generation helper

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@MariusStorhaug MariusStorhaug changed the title 🩹 [Patch]: Add a config for how to match argument completers with automatic config synchronization 🩹 [Patch]: Add a config for how to match argument completers Sep 12, 2025
@MariusStorhaug MariusStorhaug changed the title 🩹 [Patch]: Add a config for how to match argument completers 🚀[Feature]: Add a config for how to match argument completers Sep 12, 2025
@MariusStorhaug MariusStorhaug merged commit 0d0b600 into main Sep 12, 2025
11 of 13 checks passed
@MariusStorhaug MariusStorhaug deleted the copilot/fix-509 branch September 12, 2025 11:52
Copy link
Contributor

Module GitHub - 0.37.0 published to the PowerShell Gallery.

Copy link
Contributor

GitHub release for GitHub v0.37.0 has been created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

🩹 [Patch]: Add a config for how to match argument completers
2 participants