-
Notifications
You must be signed in to change notification settings - Fork 3
🌟[Major]: Implement Module Contexts and User Contexts #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: MariusStorhaug <[email protected]>
…feature Co-authored-by: MariusStorhaug <[email protected]>
|
@copilot Remove the migration part of the code. We will make this as a breaking change, so it should assume that integrators will need to start with a new vault and new settings. |
Co-authored-by: MariusStorhaug <[email protected]>
Removed migration logic as requested. The module contexts feature is now implemented as a breaking change. Commit 3a1a3b1 removes the automatic migration of existing context files and related tests - existing vaults will have module/ and user/ directories created but old contexts remain in the root directory. Integrators will need to manually migrate their data to the new structure. |
There was a problem hiding this 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 implements a comprehensive context architecture that separates module-level configuration from user-level data with clean directory structure, active context tracking, and seamless migration from legacy vaults.
- Introduces module contexts and user contexts with distinct storage directories (
module/anduser/) - Adds active module context tracking with plaintext storage for performance and persistence
- Implements automatic migration from legacy vault structures to new directory-based organization
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
tests/ModuleContexts.Tests.ps1 |
Comprehensive test suite for new module context functionality and vault migration |
tests/Context.Tests.ps1 |
Integration tests for Type parameter across all context functions |
src/functions/public/Vault/Set-ContextVault.ps1 |
Vault creation with new directory structure and legacy vault migration |
src/functions/public/Switch-ModuleContext.ps1 |
New functions for switching and retrieving active module contexts |
src/functions/public/Set-Context.ps1 |
Enhanced with Type parameter and active context management for modules |
src/functions/public/Rename-Context.ps1 |
Updated to support Type parameter and active context tracking |
src/functions/public/Remove-Context.ps1 |
Enhanced with Type parameter and module context protection logic |
src/functions/public/Get-ContextInfo.ps1 |
Updated to support Type parameter and new directory structure |
src/functions/public/Get-Context.ps1 |
Enhanced with Type parameter and active module context resolution |
src/functions/private/Get-ContextDirectory.ps1 |
New helper function for Type-based directory path resolution |
src/functions/private/Get-ActiveModuleContext.ps1 |
New functions for reading/writing active module context metadata |
README.md |
Comprehensive documentation updates with examples and patterns |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
|
@copilot For the files we are getting content from, make suret hey use the private Get-ContentNonLocking function. |
…ocking file access Co-authored-by: MariusStorhaug <[email protected]>
Updated Get-ActiveModuleContext to use Get-ContentNonLocking instead of Get-Content for reading the active-context file. Commit ec5fcad ensures all file content reading operations in the codebase now use the private Get-ContentNonLocking function for non-locking concurrent access. The other functions (Get-ContextVaultKeyPair and Get-ContextInfo) were already using Get-ContentNonLocking correctly. |
MariusStorhaug
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot fix comments
…ocks and separate Get-ActiveModuleContextName Co-authored-by: MariusStorhaug <[email protected]>
|
@copilot |
…parameter documentation Co-authored-by: MariusStorhaug <[email protected]>
Separated all functions into individual files and fixed parameter documentation format. Commit e2aebff creates Set-ActiveModuleContext.ps1 as a separate file and removes remaining .PARAMETER blocks, replacing them with inline parameter descriptions in param() blocks. Each function now has its own dedicated file. |
Add migration logic for existing vaultsREMOVED - Breaking ChangeBreaking Change Implementation
Removed automatic migration logic per feedback. The module contexts feature is now implemented as a breaking change with complete function separation and consistent documentation:
Function Organization:
Get-ActiveModuleContext.ps1to its own fileSet-ActiveModuleContext.ps1Files Structure:
Get-ActiveModuleContext.ps1: Only contains Get-ActiveModuleContext functionSet-ActiveModuleContext.ps1: New separate file for Set-ActiveModuleContext functionGet-ContextDirectory.ps1: Parameter descriptions in param() blockSwitch-ModuleContext.ps1: Parameter descriptions in param() block, simplified .OUTPUTSGet-ActiveModuleContextName.ps1: Separate file with parameter descriptions in param() blockDocumentation Standards:
This ensures maximum maintainability and follows PowerShell best practices for module organization.
Fixes #104.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.