Skip to content

Initial implementation of WingetPackageEditor and skills update - #5

Open
KlausLoeffelmann wants to merge 7 commits into
mainfrom
WingetPackageEditor
Open

Initial implementation of WingetPackageEditor and skills update#5
KlausLoeffelmann wants to merge 7 commits into
mainfrom
WingetPackageEditor

Conversation

@KlausLoeffelmann

Copy link
Copy Markdown
Owner

This pull request introduces two new Copilot skills for the WARP-Toolkit: a high-level API decision guide and a comprehensive guide for app services and DI setup. These skills are designed to help developers quickly identify the correct WARP NuGet packages and patterns for common WinForms development tasks, and to provide canonical examples for bootstrapping and service registration.

New Copilot skills for WARP-Toolkit:

1. API decision guidance and package mapping

  • Added .github/skills/WARP-ApiDecisionGuide/SKILL.md, which provides a decision table mapping WinForms development tasks to the appropriate WARP-Toolkit NuGet packages and entry-point types. It also lists anti-patterns to avoid and hand-off points to more specialized skills.

2. Application services, DI, and hosting

  • Added .github/skills/WARP-AppServices/SKILL.md, a detailed skill for setting up application-level infrastructure with WARP-Toolkit, covering both WarpToolkit.Desktop.AppServices (contracts) and WarpToolkit.WinForms.AppServices (implementations and builder).
  • Includes a canonical Program.cs example for bootstrapping a WARP-based WinForms app with DI, configuration, and service registration, as well as guidance for VB projects.
  • Provides best practices and anti-patterns for using services like IDialogService, IUserSettingsService, and EnvironmentVariableKeyService in view-models and forms, with code samples and explanations.
  • Documents the correct approach for exception handling, user settings persistence, and API key retrieval for AI providers.

These additions will help streamline onboarding and ensure consistent, modern practices across WARP-based WinForms projects.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Introduces a new .NET 10 WinForms “WinGet Package Editor” solution (core MVVM library, WinForms UI, and xUnit tests) and expands the repo’s Copilot skills library with WARP/WinForms guidance documents.

Changes:

  • Added WingetPackageEditor.Core (models, services, and MVVM view-models) plus a WinForms UI project wired through WARP AppServices/DI.
  • Added WingetPackageEditor.Tests with unit tests covering basic view-model behaviors and JSON polymorphic round-tripping.
  • Added/updated multiple .github/skills/*/SKILL.md documents (WARP skills + WinForms guides) and a project “implementation prompt” document.

Reviewed changes

Copilot reviewed 39 out of 41 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/WinForms/NET10/Winget-Package-Editor/WingetPackageEditor.Tests/WingetPackageEditor.Tests.csproj New xUnit test project definition (package refs need version syntax fixes).
src/WinForms/NET10/Winget-Package-Editor/WingetPackageEditor.Tests/MainViewModelTests.cs Unit tests for core view-model behaviors + JSON polymorphism round-trip.
src/WinForms/NET10/Winget-Package-Editor/WingetPackageEditor.Core/WingetPackageEditor.Core.csproj New core library project definition (package ref version syntax needs fix).
src/WinForms/NET10/Winget-Package-Editor/WingetPackageEditor.Core/ViewModels/PackageViewModel.cs Package view-model for package metadata + app list management.
src/WinForms/NET10/Winget-Package-Editor/WingetPackageEditor.Core/ViewModels/NavigationNodeViewModel.cs Navigation tree node VM + enum kinds.
src/WinForms/NET10/Winget-Package-Editor/WingetPackageEditor.Core/ViewModels/MainViewModel.cs Main VM with commands, selection logic, navigation rebuild, and status text.
src/WinForms/NET10/Winget-Package-Editor/WingetPackageEditor.Core/ViewModels/AppEntryViewModel.cs App entry VM projecting polymorphic model fields to bindable properties.
src/WinForms/NET10/Winget-Package-Editor/WingetPackageEditor.Core/Services/PackageJsonSerializer.cs JSON serializer wrapper using System.Text.Json polymorphism attributes.
src/WinForms/NET10/Winget-Package-Editor/WingetPackageEditor.Core/Services/IConsoleService.cs Console message service contract for UI logging surface.
src/WinForms/NET10/Winget-Package-Editor/WingetPackageEditor.Core/Services/ICatalogService.cs Catalog service contract for demo/default app entries.
src/WinForms/NET10/Winget-Package-Editor/WingetPackageEditor.Core/Services/HardcodedCatalogService.cs Hardcoded demo catalog and demo package creation.
src/WinForms/NET10/Winget-Package-Editor/WingetPackageEditor.Core/Services/ConsoleService.cs In-memory ObservableCollection-backed console message service.
src/WinForms/NET10/Winget-Package-Editor/WingetPackageEditor.Core/Services/ConsoleMessage.cs Console message record + message kind enum.
src/WinForms/NET10/Winget-Package-Editor/WingetPackageEditor.Core/Models/WingetPackage.cs Package + polymorphic app-entry model types with JsonDerivedType metadata.
src/WinForms/NET10/Winget-Package-Editor/Winget-Package-Editor/Winget-Package-Editor.csproj New WinForms app project (WARP packages version property needs fix).
src/WinForms/NET10/Winget-Package-Editor/Winget-Package-Editor/TreeViewBinder.cs TreeView adapter to bind NavigationRoots and selection.
src/WinForms/NET10/Winget-Package-Editor/Winget-Package-Editor/Properties/DataSources/MainViewModel.datasource Designer data-source registration for MainViewModel.
src/WinForms/NET10/Winget-Package-Editor/Winget-Package-Editor/Program.cs WARP WinFormsApplicationBuilder bootstrap + DI registrations.
src/WinForms/NET10/Winget-Package-Editor/Winget-Package-Editor/ObservableBindingList.cs Adapter from ObservableCollection to BindingList for DataGridView binding.
src/WinForms/NET10/Winget-Package-Editor/Winget-Package-Editor/MainForm.resx Form resource file.
src/WinForms/NET10/Winget-Package-Editor/Winget-Package-Editor/MainForm.Designer.cs MainForm designer + IServiceProvider/DI facade plumbing.
src/WinForms/NET10/Winget-Package-Editor/Winget-Package-Editor/MainForm.cs MainForm runtime logic: MVVM wiring, grid/tree/console adapters.
src/WinForms/NET10/Winget-Package-Editor/Winget-Package-Editor/GridSelectionBinder.cs DataGridView selection sync with MainViewModel.SelectedApp.
src/WinForms/NET10/Winget-Package-Editor/Winget-Package-Editor/Feature-Prompts/ApplicationPrompt.md Large “implementation prompt” spec document for the project.
src/WinForms/NET10/Winget-Package-Editor/Winget-Package-Editor/appsettings.json WinForms startup configuration defaults.
src/WinForms/NET10/Winget-Package-Editor/Winget-Package-Editor.slnx Solution definition including app/core/tests.
.github/skills/winforms-rendering/SKILL.md New WinForms custom rendering guide skill.
.github/skills/winforms-development/SKILL.md New WinForms development guide skill.
.github/skills/winforms-databinding/SKILL.md New WinForms data binding guide skill.
.github/skills/winforms-custom-and-usercontrols/SKILL.md New custom controls/UserControls guide skill.
.github/skills/winforms-async-apis/SKILL.md New WinForms async APIs guide skill.
.github/skills/WARP-WinFormsControls/SKILL.md WARP WinForms controls/components/helpers skill.
.github/skills/WARP-WinFormsApplicationBuilder/SKILL.md WARP WinFormsApplicationBuilder + DI/Designer interop skill.
.github/skills/WARP-WinFormsAI/SKILL.md WARP WinForms AI stack skill.
.github/skills/WARP-ToolStripIcons/SKILL.md New WARP ToolStrip icon wiring skill.
.github/skills/WARP-FluentTabControl/SKILL.md WARP FluentTabControl usage/sizing conventions skill.
.github/skills/WARP-AppServices/SKILL.md New WARP AppServices/DI/hosting skill.
.github/skills/WARP-ApiDecisionGuide/SKILL.md New WARP API/package decision guide skill.
Files not reviewed (1)
  • src/WinForms/NET10/Winget-Package-Editor/Winget-Package-Editor/MainForm.Designer.cs: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +34 to +36
/// <exception cref="NullReferenceException">
/// Thrown when the required <see cref="IUserSettingsService"/> is not registered in the service provider.
/// </exception>
Comment on lines +60 to +67
_userSettingsService = serviceProvider.GetRequiredService<IUserSettingsService>();
_viewModel = serviceProvider.GetRequiredService<MainViewModel>();

if (_userSettingsService is null)
{
throw new NullReferenceException($"The service '{nameof(IUserSettingsService)}' is not registered.");
}
}
Comment on lines +61 to +66
public bool RemoveApp(AppEntryViewModel app)
{
ArgumentNullException.ThrowIfNull(app);
bool removedFromModel = Model.Apps.Remove(app.Model);
bool removedFromView = Apps.Remove(app);
return removedFromModel || removedFromView;
Comment on lines +171 to +190
private async Task AppendConsoleMessageAsync(ConsoleMessage message)
{
Color color = message.Kind switch
{
ConsoleMessageKind.Error => Color.IndianRed,
ConsoleMessageKind.Warning => Color.Goldenrod,
ConsoleMessageKind.Command => Color.LightSkyBlue,
ConsoleMessageKind.Debug => Color.Gray,
_ => Color.Empty
};

string line = $"[{message.Timestamp:HH:mm:ss}] [{message.Kind}] {message.Text}";
if (IsHandleCreated && InvokeRequired)
{
BeginInvoke(new Action(() => _ = AppendConsoleMessageAsync(message)));
return;
}

await _consoleControl.WriteLineAsync(line, color == Color.Empty ? null : color);
}
Comment on lines +30 to +39
// One we setup this service, compatible component can use the
// service to either get the AI-Provider key via this default local
// key, or can pass a different EnvironmentVariable key once they got
// the service, to get the actual key from the environment variable.
builder.Services.AddLocalKeyRetrievalService();

// We want to use the BlazorWebView service, so we can
// so we can use the ChatView control, which is based
// on the BlazorWebView control.
// builder.Services.AddWindowsFormsBlazorWebView();
KlausLoeffelmann and others added 4 commits June 1, 2026 14:57
Nest the Visual Studio node under each package with a Version -> SKU-combo
(Channel-Edition) -> instance hierarchy. SKUs are detected by running
vswhere.exe -all -prerelease (streamed to the Console control) and parsed via
VisualStudioDiscoveryParser; experimental hives are correlated from
%LocalAppData%\Microsoft\VisualStudio. Adds PathShortener for shortened path
display and the flat row view models that drive the DataGridView.

Also fixes UserSettings serialization so window bounds are restored after the
fonts are applied, alongside TreeView expansion, column widths and splitter
distances. Introduces the Options dialog and UiFontSettings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Persist each package as its own JSON file under
%AppData%\Winget-Package-Editor\Packages, auto-saving on change and loading on
startup (IPackageStore / JsonPackageStore; WingetPackage gains a stable Id).
Removing a package writes a WPE{yyMMddHHmmss}.bak backup before deletion.

Reworks the menu commands: New-from-existing (deep clone via NewFromExistingDialog),
Remove package (confirm + backup), Update-current-package (scan installed apps via
WingetListScanner and add only missing well-known apps), and Edit > Add App...
(AddAppDialog). Obsolete Save/Open/Save-As are dropped. Adds the well-known app
catalog, the dialog service, and store/scanner unit tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…Model

Integrates both features in the shared host files. MainViewModel builds the
per-package Visual Studio navigation branch and exposes the reworked
persistence/menu commands with auto-save wiring. MainForm restores window bounds
after fonts (and layout state on shown), configures the node-driven VS instance
grid with shortened paths and a Path-to-Data button column, tints experimental
hive rows, and adds the per-row context menu (open/copy paths, enable unsigned
.NET runtimes via VsRegEdit.exe). Tests updated for the new hierarchy and
persistence behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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