Draft
Conversation
The PascalCase rename missed the .agr (agent grammar) files, causing agc compilation failures in CI. Updated all actionName values in 5 .agr files to match their PascalCase counterparts in the TypeScript schemas. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Phase 2 unit test project with three test classes: - CommandDispatcherTests: quit detection, routing, error isolation, empty/unknown commands - AudioCommandHandlerTests: volume set/restore, mute on/off, invalid input handling - HandlerRegistrationTests: all 77 commands registered, no duplicates, PascalCase enforced Uses xUnit + Moq for mocking IAudioService and other internal interfaces. Added InternalsVisibleTo for test project and DynamicProxyGenAssembly2. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Runs dotnet test for autoShell.Tests after the MSBuild build step, in both Debug and Release configurations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
fba483e to
b450c9d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the autoShell Windows desktop agent to a handler/service-based architecture with a centralized command dispatcher, while aligning the TS action schemas/connector to PascalCase command names and adding a comprehensive .NET test suite + CI test execution.
Changes:
- Updated desktop TS
.agrgrammars + action schema types andconnector.tsrouting to use PascalCaseactionNames (matching the refactored .NET command keys). - Introduced a new .NET command pipeline (
CommandDispatcher+ domain command handlers) and OS-abstraction service interfaces with Windows implementations. - Added
autoShell.Tests(xUnit + Moq) including integration/E2E protocol tests, and wireddotnet testinto CI.
Reviewed changes
Copilot reviewed 84 out of 84 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| ts/packages/agents/desktop/src/windows/systemSchema.agr | Renames network/gaming/system action names to PascalCase in the grammar mappings. |
| ts/packages/agents/desktop/src/windows/systemActionsSchema.ts | Updates actionName string literal types for system actions to PascalCase. |
| ts/packages/agents/desktop/src/windows/powerSchema.agr | Updates power-mode command mappings to PascalCase action names. |
| ts/packages/agents/desktop/src/windows/powerActionsSchema.ts | Updates SetPowerModePluggedIn action type to PascalCase actionName. |
| ts/packages/agents/desktop/src/windows/inputSchema.agr | Updates mouse-related action names and extends cursor-trail utterances. |
| ts/packages/agents/desktop/src/windows/inputActionsSchema.ts | Updates actionName string literals (e.g., SetPrimaryMouseButton, MousePointerCustomization). |
| ts/packages/agents/desktop/src/windows/displaySchema.agr | Updates Night Light color temperature action name to PascalCase. |
| ts/packages/agents/desktop/src/windows/displayActionsSchema.ts | Updates AdjustColorTemperature action type to PascalCase actionName. |
| ts/packages/agents/desktop/src/desktopSchema.agr | Updates core desktop command mappings (launch/close/window mgmt, volume, wifi, desktops, etc.) to PascalCase action names. |
| ts/packages/agents/desktop/src/connector.ts | Updates action routing switch cases + protocol keys (e.g., ListAppNames) to PascalCase command keys. |
| ts/packages/agents/desktop/src/actionsSchema.ts | Updates the top-level Desktop action schema types to PascalCase actionName literals and examples. |
| dotnet/autoShell/WindowsAppRegistry.cs | Adds IAppRegistry implementation for friendly-name → path/AppUserModelId metadata + AppsFolder enumeration. |
| dotnet/autoShell/Services/WindowsWindowService.cs | Adds Win32/PInvoke-backed IWindowService implementation (maximize/minimize/raise/tile/find). |
| dotnet/autoShell/Services/WindowsSystemParametersService.cs | Adds ISystemParametersService implementation wrapping SystemParametersInfo + mouse button swap. |
| dotnet/autoShell/Services/WindowsRegistryService.cs | Adds IRegistryService implementation for HKCU/HKLM value set/get and WM_SETTINGCHANGE broadcast. |
| dotnet/autoShell/Services/WindowsProcessService.cs | Adds IProcessService implementation for process start and lookup. |
| dotnet/autoShell/Services/WindowsDisplayService.cs | Adds IDisplayService implementation (resolution list/set; text-size via UIAutomation). |
| dotnet/autoShell/Services/WindowsDebuggerService.cs | Adds IDebuggerService implementation using Debugger.Launch(). |
| dotnet/autoShell/Services/WindowsBrightnessService.cs | Adds IBrightnessService implementation using registry + WMI. |
| dotnet/autoShell/Services/WindowsAudioService.cs | Adds IAudioService implementation using CoreAudio COM interop. |
| dotnet/autoShell/Services/IWindowService.cs | Introduces window-management abstraction interface. |
| dotnet/autoShell/Services/IVirtualDesktopService.cs | Introduces virtual desktop abstraction interface. |
| dotnet/autoShell/Services/ISystemParametersService.cs | Introduces system-parameters abstraction interface. |
| dotnet/autoShell/Services/IRegistryService.cs | Introduces registry abstraction interface. |
| dotnet/autoShell/Services/IProcessService.cs | Introduces process abstraction interface. |
| dotnet/autoShell/Services/Interop/UIAutomation.cs | Moves UIAutomation interop under Services/Interop and routes logging through ILogger. |
| dotnet/autoShell/Services/Interop/CoreAudioInterop.cs | Adds CoreAudio COM interop definitions under Services/Interop. |
| dotnet/autoShell/Services/INetworkService.cs | Introduces network abstraction interface (wifi, airplane mode, bluetooth). |
| dotnet/autoShell/Services/IDisplayService.cs | Introduces display abstraction interface. |
| dotnet/autoShell/Services/IDebuggerService.cs | Introduces debugger abstraction interface. |
| dotnet/autoShell/Services/IBrightnessService.cs | Introduces brightness abstraction interface. |
| dotnet/autoShell/Services/IAudioService.cs | Introduces audio abstraction interface. |
| dotnet/autoShell/packages.config | Removes legacy NuGet packages.config usage. |
| dotnet/autoShell/Logging/ILogger.cs | Adds logging abstraction used across services/handlers. |
| dotnet/autoShell/Logging/ConsoleLogger.cs | Adds console-backed logger implementation. |
| dotnet/autoShell/IAppRegistry.cs | Introduces shared application registry abstraction. |
| dotnet/autoShell/Handlers/WindowCommandHandler.cs | Adds handler for Maximize/Minimize/SwitchTo/Tile. |
| dotnet/autoShell/Handlers/VirtualDesktopCommandHandler.cs | Adds handler for desktop creation/move/pin/switch commands. |
| dotnet/autoShell/Handlers/ThemeCommandHandler.cs | Adds handler for theme apply/list/mode/wallpaper logic. |
| dotnet/autoShell/Handlers/SystemCommandHandler.cs | Adds handler for debug + notification center commands. |
| dotnet/autoShell/Handlers/Settings/TaskbarSettingsHandler.cs | Adds taskbar settings handler backed by registry edits + settings change notify. |
| dotnet/autoShell/Handlers/Settings/SystemSettingsHandler.cs | Adds system settings handler (DST, game mode, quiet hours, display-related settings URIs). |
| dotnet/autoShell/Handlers/Settings/PrivacySettingsHandler.cs | Adds privacy settings handler (camera/location/microphone consent store). |
| dotnet/autoShell/Handlers/Settings/PowerSettingsHandler.cs | Adds power settings handler (battery threshold + settings URIs). |
| dotnet/autoShell/Handlers/Settings/PersonalizationSettingsHandler.cs | Adds personalization settings handler (title bar color, transparency, theme mode). |
| dotnet/autoShell/Handlers/Settings/MouseSettingsHandler.cs | Adds mouse/touchpad settings handler (cursor speed, trails, wheel lines, swap buttons, etc.). |
| dotnet/autoShell/Handlers/Settings/FileExplorerSettingsHandler.cs | Adds File Explorer settings handler (extensions, hidden/system files). |
| dotnet/autoShell/Handlers/Settings/DisplaySettingsHandler.cs | Adds display settings handler (brightness, night light, scaling, blue light registry, rotation lock). |
| dotnet/autoShell/Handlers/Settings/AccessibilitySettingsHandler.cs | Adds accessibility settings handler (filter keys, sticky keys, narrator/magnifier, mono audio). |
| dotnet/autoShell/Handlers/NetworkCommandHandler.cs | Adds network command handler for wifi/airplane/bluetooth/metered connections. |
| dotnet/autoShell/Handlers/ICommandHandler.cs | Defines common handler contract and supported command list. |
| dotnet/autoShell/Handlers/DisplayCommandHandler.cs | Adds handler for listing resolutions and setting resolution/text size. |
| dotnet/autoShell/Handlers/AudioCommandHandler.cs | Adds handler for mute/volume/restore behavior. |
| dotnet/autoShell/Handlers/AppCommandHandler.cs | Adds handler for launch/close/list-app-names and app registry resolution. |
| dotnet/autoShell/CoreAudioInterop.cs | Removes old CoreAudio interop file (moved under Services/Interop). |
| dotnet/autoShell/CommandDispatcher.cs | Adds central dispatcher that registers handlers and routes JSON keys via dictionary lookup with error isolation. |
| dotnet/autoShell/autoShell.sln | Adds test project and expands solution configurations. |
| dotnet/autoShell/autoShell.csproj | Updates project metadata for net8 WindowsDesktop build, warning suppressions, and InternalsVisibleTo for tests/mocking. |
| dotnet/autoShell/AutoShell_Themes.cs | Removes legacy theme logic file (migrated into ThemeCommandHandler). |
| dotnet/autoShell/App.config | Removes legacy App.config for old .NET Framework runtime config. |
| dotnet/autoShell.Tests/WindowsAppRegistryTests.cs | Adds unit tests for WindowsAppRegistry behaviors and contracts. |
| dotnet/autoShell.Tests/WindowCommandHandlerTests.cs | Adds tests validating window command routing and service calls. |
| dotnet/autoShell.Tests/VirtualDesktopCommandHandlerTests.cs | Adds tests validating virtual desktop command behavior and edge cases. |
| dotnet/autoShell.Tests/ThemeCommandHandlerTests.cs | Adds tests validating theme mode/wallpaper behaviors and safe handling. |
| dotnet/autoShell.Tests/SystemCommandHandlerTests.cs | Adds tests for Debug and Action Center behavior. |
| dotnet/autoShell.Tests/NetworkCommandHandlerTests.cs | Adds tests for wifi/bluetooth/airplane/metered routing. |
| dotnet/autoShell.Tests/HandlerRegistrationTests.cs | Adds reflection-based enforcement that commands are uniquely owned and have test coverage. |
| dotnet/autoShell.Tests/EndToEndTests.cs | Adds stdin/stdout protocol E2E tests for query commands, quit, malformed input, and command-line mode. |
| dotnet/autoShell.Tests/DisplayCommandHandlerTests.cs | Adds tests for resolution parsing and display command routing. |
| dotnet/autoShell.Tests/CommandDispatcherTests.cs | Adds tests for dispatcher routing, quit semantics, and exception isolation. |
| dotnet/autoShell.Tests/CommandDispatcherIntegrationTests.cs | Adds integration tests for full Create() wiring with mock services. |
| dotnet/autoShell.Tests/AutoShellProcess.cs | Adds helper to run autoShell.exe as a child process for E2E tests. |
| dotnet/autoShell.Tests/autoShell.Tests.csproj | Introduces the xUnit test project targeting net8.0-windows with Moq + test SDK deps. |
| dotnet/autoShell.Tests/AudioCommandHandlerTests.cs | Adds tests for volume/mute/restore behavior. |
| dotnet/autoShell.Tests/AppCommandHandlerTests.cs | Adds tests for launch/close/list and various launch fallbacks. |
| dotnet/.editorconfig | Updates qualification/naming/analyzer severities to fit refactoring conventions. |
| .github/workflows/build-dotnet.yml | Adds dotnet test step for the new autoShell.Tests project in CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…soft/TypeAgent into talzacc/autoshell_refactor
…soft/TypeAgent into talzacc/autoshell_refactor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Structural refactoring of
autoShellto make the codebase testable, maintainable, and extensible. All 78 commands continue to work identically — verified by a command-by-command audit againstorigin/main.Phase 1: Core Architecture
IAudioService,IRegistryService,ISystemParametersService,IProcessService,IWindowService,INetworkService,IBrightnessService,IDisplayService,IVirtualDesktopService,IDebuggerService)AudioCommandHandler,WindowCommandHandler,NetworkCommandHandler, 9 settings sub-handlers, etc.)execLineswitch withCommandDispatcher+ dictionary lookupIAppRegistryservice (replaces static fields)AutoShell.csinto handlers (~1604 → ~80 lines)Services/Interop/(CoreAudioInterop.cs,UIAutomation.cs)IAppRegistry+WindowsAppRegistryto project rootAutoShell_Win32.cs,AutoShell_Settings.cs,AutoShell_Themes.cs— all logic now in handlers/servicespackages.configandApp.configquitdirectly in dispatcher (not in handlers)Phase 2: Code Quality
<inheritdoc/>on implementations.editorconfigrules)dotnet formatfor code style consistencyHashtable→Dictionary<string,string>withOrdinalIgnoreCase,SortedList→DictionaryDictionaryindexer regression (TryGetValue for null-return contract)ILoggerabstraction withError,Warning,Info,DebuglevelsConsole.WriteLine/Debug.WriteLinewith proper logger callsPhase 3: Testing
autoShell.TestsxUnit project with MoqCommandDispatchertests — verify correct handler routing for each actionHandlerRegistrationreflection tests — enforce every command has at least one unit testWindowsAppRegistrytests — real class, null returns, case insensitivity (9 tests)CommandDispatcherIntegrationtests — full wiring with mock services (11 tests)dotnet testto CI