Skip to content

✨ Convert to binary module - #114

Merged
JustinGrote merged 79 commits into
mainfrom
copilot/refactor-project-to-csharp-modules
Jul 16, 2026
Merged

✨ Convert to binary module#114
JustinGrote merged 79 commits into
mainfrom
copilot/refactor-project-to-csharp-modules

Conversation

CopilotAI commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Install progress was a static 50% during the entire install phase, with no indication of how many modules were being installed or how far along the process was.

Changes

  • ModuleFastInstaller.InstallModulesAsync: Added Action<ModuleFastInfo>? onModuleInstalled callback parameter, invoked synchronously on the completing thread after each successful install. Uses Action<T> (not IProgress<T>) to avoid SynchronizationContext marshalling.
  • InstallModuleFastCommand: Progress now updates per-module using Interlocked.Increment — shows Installing X/N Modules (P%) in real time as parallel installs complete. Percentage uses (int)(done * 100.0 / total) to avoid integer truncation.

Progress now looks like:

Installing 3/10 Modules (30%)
Installing 7/10 Modules (70%)
Installing 10/10 Modules (100%)

⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

CopilotAIand others added 3 commits March 20, 2026 18:51
- Add C# project (src/ModuleFast/ModuleFast.csproj) targeting net8.0
- Implement ModuleFastSpec in C# with full NuGet version range support
- Implement ModuleFastInfo in C# with IComparable and implicit ModuleSpecification conversion
- Add ModuleFastClient HTTP client factory helper
- Add stub binary cmdlets: GetModuleFastPlanCommand, ClearModuleFastCacheCommand
- Remove PowerShell class definitions from ModuleFast.psm1
- Register type accelerators for ModuleFastSpec and ModuleFastInfo in psm1
- Update ModuleFast.psd1 to export binary cmdlets
- Update ModuleFast.build.ps1 with BuildCSharp task
- Update .gitignore to exclude build artifacts
- Add ModuleFast.slnx solution file
All 7 non-E2E Pester tests pass.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…pdate-TypeData
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
CopilotAI changed the title [WIP] Refactor project to use C# binary modules instead of PowerShell scriptRefactor ModuleFast toward C# binary module; update Pester tests to matchMar 20, 2026
CopilotAI requested a review from JustinGroteMarch 20, 2026 19:04
@JustinGrote

Copy link
Copy Markdown
Owner

@copilot Convert the following powershell functions and any dependent functions into C# Cmdlets:
Install-ModuleFast
Get-ModuleFastPlan
Clear-ModuleFastCache
Install-ModuleFastHelper
Import-ModuleManifest
ConvertFrom-PSResourceGet
Get-ModuleInfoAsync
Add-DestinationToPSModulePath
Find-LocalModule
ConvertFrom-RequiredSpec
Select-RequiredSpecFileType
Read-RequiredSpecFile
ConvertFrom-ModuleManifest
Approve-Action
Get-PSDefaultModulePath

- Add InstallModuleFastCommand, GetModuleFastPlanCommand, ClearModuleFastCacheCommand, ImportModuleManifestCommand cmdlets
- Add ModuleFastPlanner (async HTTP planning with Task.WhenAll)
- Add ModuleFastInstaller (parallel download+extract, no runspaces)
- Add ModuleManifestReader (handles dynamic .psd1 manifests)
- Add LocalModuleFinder (searches PSModulePaths for installed modules)
- Add SpecFileReader (ModuleFast/PSResourceGet/PSDepend spec file formats)
- Add PathHelper (PSModulePath management, profile updates)
- Add ModuleFastCache (singleton ConcurrentDictionary request cache)
- Add NuGetModels (JSON models for NuGet v3 Registration API)
- Update ModuleFastInfo: make ModuleVersion, Location, Guid settable; IsLocal computed
- Update ModuleFastClient: add PSCredential support, ToAuthHeader, HTTP/3
- Update ModuleFast.psm1: simplified to DLL load + type accelerators only
- Update ModuleFast.psd1: FunctionsToExport=@(), CmdletsToExport with all 4 cmdlets
- Update ModuleFast.tests.ps1: remove InModuleScope wrapper (Import-ModuleManifest is now a public cmdlet)
- Add SpecFileType and InstallScope enums in C#
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

CopilotAI commented Mar 20, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot Convert the following powershell functions and any dependent functions into C# Cmdlets:
Install-ModuleFast
Get-ModuleFastPlan...

Done in commit 4e1f6bf. All 15 functions (plus their helpers) are now C# binary cmdlets/classes:

PowerShell functionC# equivalent
Install-ModuleFastInstallModuleFastCommand — all 3 param sets
Get-ModuleFastPlanGetModuleFastPlanCommand
Clear-ModuleFastCacheClearModuleFastCacheCommand
Import-ModuleManifestImportModuleManifestCommand + ModuleManifestReader
Install-ModuleFastHelperModuleFastInstaller — uses Task.WhenAll, no runspaces/ThreadJob
Get-ModuleInfoAsyncModuleFastPlanner.GetModuleInfoAsync + GetCachedStringAsync
Find-LocalModuleLocalModuleFinder.FindLocalModule
ConvertFrom-RequiredSpecSpecFileReader.ConvertFromRequiredSpec
Select-RequiredSpecFileTypeSpecFileReader.SelectRequiredSpecFileType
Read-RequiredSpecFileSpecFileReader.ReadRequiredSpecFile
ConvertFrom-PSResourceGetSpecFileReader.ConvertFromPSResourceGet
Add-DestinationToPSModulePathPathHelper.AddDestinationToPSModulePath
Get-PSDefaultModulePathPathHelper.GetPSDefaultModulePath
Approve-ActionPathHelper.ApproveAction
ConvertFrom-PSDependSpecFileReader.ConvertFromPSDepend

ModuleFast.psm1 is now just DLL loading + type accelerator registration. The planning loop uses Task.WhenAny and installation uses Task.WhenAll for parallel downloads and extraction.

CopilotAI changed the title Refactor ModuleFast toward C# binary module; update Pester tests to matchRefactor ModuleFast to C# binary module — full cmdlet conversionMar 20, 2026
@JustinGrote

Copy link
Copy Markdown
Owner

@copilot Reconfigure to use Artifacts Output Layout and Central Package Management

…ge Management (Directory.Packages.props)
Co-authored-by: JustinGrote <15258962+JustinGrote@users.noreply.github.com>
Agent-Logs-Url: https://github.com/JustinGrote/ModuleFast/sessions/74b5c2fa-04b4-44e8-830a-7e868b2d0871

CopilotAI commented Mar 20, 2026

Copy link
Copy Markdown
ContributorAuthor

@copilot Reconfigure to use Artifacts Output Layout and Central Package Management

Done in commit 4da8061.

Artifacts Output Layout (Directory.Build.props):

  • UseArtifactsOutput=true — all build outputs now land in artifacts/bin/ModuleFast/{debug,release}/ instead of src/ModuleFast/bin/
  • ModuleFast.psm1 probes artifacts/bin/ModuleFast/debug/, then release/, then falls back to the classic deployed bin/ModuleFast/ path
  • ModuleFast.build.ps1: BuildCSharp drops the -o flag; CopyFiles reads from artifacts/bin/ModuleFast/release/ when staging the module

Central Package Management (Directory.Packages.props):

  • ManagePackageVersionsCentrally=true with Microsoft.PowerShell.SDK 7.4.6 and NuGet.Versioning 6.8.0
  • ModuleFast.csprojPackageReference entries no longer carry Version attributes

CopilotAI changed the title Refactor ModuleFast to C# binary module — full cmdlet conversionRefactor ModuleFast to C# binary module — full cmdlet conversion with Artifacts Output Layout and Central Package ManagementMar 20, 2026
@JustinGrote

Copy link
Copy Markdown
Owner

@copilot Recommend ways to improve the performance, and optimize for async concurrency, especially around download, decompression, and installation of modules

@JustinGrote
JustinGrote marked this pull request as ready for review July 16, 2026 03:21
@JustinGrote
JustinGrote merged commit b96fd92 into mainJul 16, 2026
4 checks passed
@JustinGrote
JustinGrote deleted the copilot/refactor-project-to-csharp-modules branch July 16, 2026 03:22
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@JustinGrote