Uh oh!
There was an error while loading. Please reload this page.
🌟[Major]: Implement Module Contexts and User Contexts - #107
🌟[Major]: Implement Module Contexts and User Contexts#107Marius Storhaug (MariusStorhaug) with Copilot wants to merge 8 commits into
Conversation
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
…feature Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Marius Storhaug (MariusStorhaug)
commented
Sep 20, 2025
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 <17722253+MariusStorhaug@users.noreply.github.com>
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.
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Marius Storhaug (MariusStorhaug)
commented
Sep 20, 2025
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 <17722253+MariusStorhaug@users.noreply.github.com>
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. |
Marius Storhaug (MariusStorhaug)
left a comment
There was a problem hiding this comment.
Copilot fix comments
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…ocks and separate Get-ActiveModuleContextName Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Marius Storhaug (MariusStorhaug)
commented
Sep 20, 2025
Copilot |
…parameter documentation Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
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.