Skip to content

🌟[Major]: Introducing ContextVaults - Multi-Vault Support#90

Merged
Marius Storhaug (MariusStorhaug) merged 57 commits into
mainfrom
copilot/fix-77-2
Jun 7, 2025
Merged

🌟[Major]: Introducing ContextVaults - Multi-Vault Support#90
Marius Storhaug (MariusStorhaug) merged 57 commits into
mainfrom
copilot/fix-77-2

Conversation

Copilot AI commented Jun 3, 2025

Copy link
Copy Markdown
Contributor

This pull request introduces significant enhancements to data organization, encryption, and usability. Key changes include the addition of ContextVaults for grouping contexts, new helper functions for context and vault management, and updates to documentation and code formatting. These changes aim to make the module more user-friendly and scalable for managing secure, persistent data.

Enhancements to Context Management

  • Introduced the concept of ContextVaults to group related contexts into logical containers. Vaults are automatically created during context storage, and contexts in different vaults are isolated.
  • Moved argument completion to function and attribute based, using Complete-ContextID and Complete-ContextVaultName for tab completion of context IDs and vault names.

Encryption and Security

  • Implemented the Get-ContextVaultKeyPair function to retrieve public and private keys for encrypting and decrypting contexts securely.
  • Updated the directory structure and metadata format to support vault-based storage, ensuring better organization and security.

Documentation and Developer Guidance

  • Expanded the README.md with a detailed implementation guide for module developers, including best practices for integrating contexts and vaults into modules.
  • Added a complete example demonstrating how to use the Context module in a hypothetical GitHub module, showcasing practical usage patterns.

Codebase Improvements

  • Introduced a new ContextVault class to represent vaults with properties like Name and Path, and added formatting definitions for better display in PowerShell.

Copilot AI and others added 2 commits June 3, 2025 22:41
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Copilot AI changed the title [WIP] 🚀[Feature]: ContextVaults - Multi-Vault Support for Context PowerShell Module 🚀[Feature]: ContextVaults - Multi-Vault Support for Context PowerShell Module Jun 3, 2025
@MariusStorhaug

Copy link
Copy Markdown
Member

Lets add one more function. Set-ContextVault. This should be a declarative function that will forcefully configure the vault with the given input. If the vault exists, it updates its configuration, if it does not exist it is created. Update the readme with this additional info. Also remove references to "time" on the documentation. Phrases like "now supports" has no place in "timeless" documentation. Documenation must be written in a way where its predefined to the version that is being read. Describe the functions and features without adding any concept of time for when it was added.

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

Copilot AI commented Jun 3, 2025

Copy link
Copy Markdown
Contributor Author

Lets add one more function. Set-ContextVault. This should be a declarative function that will forcefully configure the vault with the given input. If the vault exists, it updates its configuration, ...

Added Set-ContextVault function that provides declarative vault configuration - creates vaults if they don't exist, updates configuration if they do. Updated README to remove temporal references and added documentation for the new function. All tests passing (13/13). Commit: ce4fa41

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • aka.ms
    • Triggering command: pwsh (dns block)
  • http://168.63.129.16:80/machine/
    • Triggering command: /usr/bin/python3 -u bin/WALinuxAgent-2.13.1.1-py3.9.egg -collect-logs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@MariusStorhaug

Copy link
Copy Markdown
Member

Lets remove the loading logic that exists in main.ps1. The main.ps1 script is run when the module is loaded, if it exists. As there is no vault or settings to load anylonger during module import, we can safely remove the main.ps1 file and the private Set-ContextVault function.

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

Copilot AI commented Jun 3, 2025

Copy link
Copy Markdown
Contributor Author

Lets remove the loading logic that exists in main.ps1. The main.ps1 script is run when the module is loaded, if it exists. As there is no vault or settings to load anylonger during module import, we c...

Removed main.ps1 file and private Set-ContextVault function as requested. Also removed the initialization logic from all context functions (Get-Context, Set-Context, etc.) since vault initialization is no longer needed during module import. All ContextVaults tests continue to pass (13/13). Commit: 90ea688

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • http://168.63.129.16:80/machine/
    • Triggering command: /usr/bin/python3 -u bin/WALinuxAgent-2.13.1.1-py3.9.egg -collect-logs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@MariusStorhaug Marius Storhaug (MariusStorhaug) added Major Breaking changes that are are not backwards compatible Prerelease Make a prerelease of the package/module/repo. labels Jun 4, 2025
@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title 🚀[Feature]: ContextVaults - Multi-Vault Support for Context PowerShell Module 🌟[Major]: Introducing ContextVaults - Multi-Vault Support Jun 4, 2025
…structure

- Updated `Remove-Context.ps1` to change the search path for vaults.
- Deleted obsolete functions: `Remove-ContextVault.ps1`, `Rename-ContextVault.ps1`, `Reset-ContextVault.ps1`, and `Set-ContextVault.ps1`.
- Introduced new functions for vault management: `Get-ContextVault.ps1`, `Remove-ContextVault.ps1`, `Reset-ContextVault.ps1`, and `Set-ContextVault.ps1` with improved functionality.
- Enhanced `Set-Context.ps1` to align with new vault structure.
- Updated configuration variables in `Config.ps1` to reflect new paths and naming conventions.
- Refactored tests in `ContextVaults.Tests.ps1` to accommodate changes in vault management functions and ensure proper cleanup of test vaults.
… functions; streamline object creation in Set-ContextVault function
- Update Remove-ContextVault and Reset-ContextVault to support pipeline input and wildcards.
- Refactor logic for removing and resetting vaults based on parameter sets.
- Introduce ContextVault class for better structure and handling.
- Remove unnecessary validation in Set-ContextVault function.
…g quotes and improve debug output formatting for clarity
…add Get-ContextVaultKeyPair, Convert-ContextHashtableToObjectRecursive, ConvertFrom-ContextJson, Convert-ContextObjectToHashtableRecursive, ConvertTo-ContextJson, and Get-PSCallStackPath functions for enhanced context management and data handling.
…r all vaults, specific vaults, and wildcard matching
…r all vaults, specific vaults, and wildcard matching; remove redundant Get-ContextInfo tests from ContextVaults.Tests
…lt removal before and after tests, and update vault creation test for clarity.
…put display and streamline Get-ContextInfo tests by removing unnecessary vault setup.
@github-actions

github-actions Bot commented Jun 7, 2025

Copy link
Copy Markdown

Module Context - 8.0.0-copilotfix772001 published to the PowerShell Gallery.

@github-actions

github-actions Bot commented Jun 7, 2025

Copy link
Copy Markdown

GitHub release for Context v8.0.0-copilotfix772001 has been created.

…e clarity on context storage and management, and improve organization of examples.
…istency in Context.Tests.ps1 and ContextVaults.Tests.ps1
@github-actions

github-actions Bot commented Jun 7, 2025

Copy link
Copy Markdown

Module Context - 8.0.0-copilotfix772002 published to the PowerShell Gallery.

@github-actions

github-actions Bot commented Jun 7, 2025

Copy link
Copy Markdown

GitHub release for Context v8.0.0-copilotfix772002 has been created.

@github-actions

github-actions Bot commented Jun 7, 2025

Copy link
Copy Markdown

Module Context - 8.0.0-copilotfix772003 published to the PowerShell Gallery.

@github-actions

github-actions Bot commented Jun 7, 2025

Copy link
Copy Markdown

GitHub release for Context v8.0.0-copilotfix772003 has been created.

@MariusStorhaug Marius Storhaug (MariusStorhaug) marked this pull request as ready for review June 7, 2025 19:12
Copilot AI review requested due to automatic review settings June 7, 2025 19:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces multi-vault support by adding the new ContextVault concept along with helper functions for vault and context management, enhanced encryption key handling, and updated documentation.

  • Introduces contextual segregation of contexts into vaults with the new ContextVault class
  • Adds and updates public functions (Set-Context, Get-Context, Remove-Context, Rename-Context) to support vault parameters
  • Revises documentation and examples to reflect the new vault-based storage structure

Reviewed Changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/functions/public/Vault/Remove-ContextVault.ps1 Implements removal of vaults with iterative matching
src/functions/public/Vault/Get-ContextVault.ps1 Retrieves vaults and constructs ContextVault objects
src/functions/public/Set-Context.ps1 Updates context setting to include vault support and encryption
src/functions/public/Rename-Context.ps1 Updates renaming with vault parameter and enhanced error messages
src/functions/public/Remove-Context.ps1 Updates context removal to filter by vault
src/functions/public/Get-ContextInfo.ps1 Supports vault filtering when retrieving context info
src/functions/public/Get-Context.ps1 Gets contexts using vault parameter and updated decryption logic
src/functions/private/Get-PSCallStackPath.ps1 Minor comment update
src/functions/private/Set-ContextVault.ps1 Removed entirely
src/functions/private/ObjectToJson/ConvertTo-ContextJson.ps1 Documentation comment update for JSON conversion
src/functions/private/ObjectToJson/Convert-ContextObjectToHashtableRecursive.ps1 Documentation adjustment
src/functions/private/JsonToObject/ConvertFrom-ContextJson.ps1 Comment update for decryption output type
src/functions/private/JsonToObject/Convert-ContextHashtableToObjectRecursive.ps1 Comment update for output type
src/functions/private/Get-ContextVaultKeyPair.ps1 Retrieves encryption key pair but calls a removed function
src/functions/private/Completers/Complete-ContextVaultName.ps1 Provides vault name tab completion
src/functions/private/Completers/Complete-ContextID.ps1 Provides context ID tab completion
src/formats/ContextVault.Format.ps1xml Adds custom formatting for ContextVault objects
src/completers.ps1 Removed obsolete completer registration
src/classes/public/ContextVault.ps1 Defines the new ContextVault class
README.md Updates documentation to demonstrate new multi-vault usage
Comments suppressed due to low confidence (2)

src/functions/public/Set-Context.ps1:79

  • The call to 'Set-ContextVault' is now broken as the function has been removed from the codebase. Update this reference to use the new vault initialization logic or reintroduce the missing function.
$vaultObject = Set-ContextVault -Name $Vault

src/functions/private/Get-ContextVaultKeyPair.ps1:35

  • The reference to 'Set-ContextVault' is now broken due to its removal. Update the vault key retrieval to initialize the vault using the new mechanism or restore the missing function.
$vaultObject = Set-ContextVault -Name $Vault

@MariusStorhaug Marius Storhaug (MariusStorhaug) merged commit d11b8a2 into main Jun 7, 2025
37 checks passed
@MariusStorhaug Marius Storhaug (MariusStorhaug) deleted the copilot/fix-77-2 branch June 7, 2025 19:20
@github-actions

github-actions Bot commented Jun 7, 2025

Copy link
Copy Markdown

Module Context - 8.0.0 published to the PowerShell Gallery.

@github-actions

github-actions Bot commented Jun 7, 2025

Copy link
Copy Markdown

GitHub release for Context v8.0.0 has been created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Major Breaking changes that are are not backwards compatible Prerelease Make a prerelease of the package/module/repo.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚀[Feature]: ContextVaults - Multi-Vault Support for Context PowerShell Module

3 participants