Skip to content

feat: real-time per-module install progress with count and percentage#114

Draft
Copilot wants to merge 37 commits into
mainfrom
copilot/refactor-project-to-csharp-modules
Draft

feat: real-time per-module install progress with count and percentage#114
Copilot wants to merge 37 commits into
mainfrom
copilot/refactor-project-to-csharp-modules

Conversation

Copilot AI commented Mar 20, 2026

Copy link
Copy Markdown

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.

Copilot AI and 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>
Copilot AI changed the title [WIP] Refactor project to use C# binary modules instead of PowerShell script Refactor ModuleFast toward C# binary module; update Pester tests to match Mar 20, 2026
Copilot AI requested a review from JustinGrote March 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>

Copilot AI commented Mar 20, 2026

Copy link
Copy Markdown
Author

@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 function C# equivalent
Install-ModuleFast InstallModuleFastCommand — all 3 param sets
Get-ModuleFastPlan GetModuleFastPlanCommand
Clear-ModuleFastCache ClearModuleFastCacheCommand
Import-ModuleManifest ImportModuleManifestCommand + ModuleManifestReader
Install-ModuleFastHelper ModuleFastInstaller — uses Task.WhenAll, no runspaces/ThreadJob
Get-ModuleInfoAsync ModuleFastPlanner.GetModuleInfoAsync + GetCachedStringAsync
Find-LocalModule LocalModuleFinder.FindLocalModule
ConvertFrom-RequiredSpec SpecFileReader.ConvertFromRequiredSpec
Select-RequiredSpecFileType SpecFileReader.SelectRequiredSpecFileType
Read-RequiredSpecFile SpecFileReader.ReadRequiredSpecFile
ConvertFrom-PSResourceGet SpecFileReader.ConvertFromPSResourceGet
Add-DestinationToPSModulePath PathHelper.AddDestinationToPSModulePath
Get-PSDefaultModulePath PathHelper.GetPSDefaultModulePath
Approve-Action PathHelper.ApproveAction
ConvertFrom-PSDepend SpecFileReader.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.

Copilot AI changed the title Refactor ModuleFast toward C# binary module; update Pester tests to match Refactor ModuleFast to C# binary module — full cmdlet conversion Mar 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

Copilot AI commented Mar 20, 2026

Copy link
Copy Markdown
Author

@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.csproj PackageReference entries no longer carry Version attributes

Copilot AI changed the title Refactor ModuleFast to C# binary module — full cmdlet conversion Refactor ModuleFast to C# binary module — full cmdlet conversion with Artifacts Output Layout and Central Package Management Mar 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

Copy link
Copy Markdown
Owner

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Jun 27, 2026

Copy link
Copy Markdown
Author

@copilot resolve the merge conflicts in this pull request

Merge conflicts resolved in commit e2c2b5c. The .gitignore conflict was resolved by keeping our version (superset of main's entries). The ModuleFast.psm1 conflict was resolved by keeping our binary-module stub. The two bug fixes from main that are relevant to the C# implementation were ported in the same commit:

  • Linux case-insensitive manifest searchFindManifestPath helper in ModuleFastInstaller.cs uses EnumerationOptions { MatchCasing = CaseInsensitive } to locate .psd1 files after extraction (mirrors the f802cb1 fix)
  • VSCode Host profile path + non-standard destination → NoProfileUpdate — ported to PathHelper.AddDestinationToPSModulePath and InstallModuleFastCommand.BeginProcessing (mirrors the 4e1c2f8 fix)

@copilot Look for areas where file io can be improved using the newer file and filestream apis
[File IO improvements in .NET 6 - .NET Blog](https://devblogs.microsoft.com/dotnet/file-io-improvements-i...

Applied across commits. Here's a summary of the .NET 6+ file I/O improvements:

Location Improvement
ModuleManifestReader.TryReadModuleVersionFast StreamReader now backed by FileStreamOptions { Options = FileOptions.SequentialScan } — hints to the OS that the file is read front-to-back once, enabling OS read-ahead
ModuleFastInstaller.incomplete sentinel FileStream with FileOptions.WriteThrough | FileOptions.Asynchronous — write-through ensures the marker reaches the OS before the zip extraction starts, guarding against partial installs on crash
ModuleFastInstaller.originalModuleVersion Same WriteThrough | Asynchronous options; WriteLineAsync ensures a trailing newline for tool compatibility
ModuleFastInstaller — NuGet cleanup loop Directory.EnumerateFileSystemEntries instead of GetFileSystemEntries — lazy enumeration avoids allocating the full entry array
PathHelper.AddDestinationToPSModulePath — profile read FileStream with FileOptions.SequentialScan — same read-ahead benefit
PathHelper.AddDestinationToPSModulePath — profile create/append FileStream with FileOptions.WriteThrough — profile changes durably committed even if the process is killed before the OS flushes its page cache

Copilot AI changed the title Refactor ModuleFast to C# binary module — full cmdlet conversion with Artifacts Output Layout, Central Package Management, .NET 10 migration, and async performance optimisations Refactor ModuleFast to C# binary module — full cmdlet conversion with Artifacts Output Layout, Central Package Management, .NET 10 migration, async performance optimisations, and .NET 6+ file I/O improvements Jun 27, 2026
Copilot AI changed the title Refactor ModuleFast to C# binary module — full cmdlet conversion with Artifacts Output Layout, Central Package Management, .NET 10 migration, async performance optimisations, and .NET 6+ file I/O improvements feat: real-time per-module install progress with count and percentage Jun 27, 2026
Sign up for free to 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