Repository navigation
Refactor: unify architecture, MVVM, and plugin system - #1
Conversation
- Replace custom ICommand/INotifyPropertyChanged with CommunityToolkit.Mvvm in all UI projects - Add Application-layer DI extension; centralize service registration - Introduce IPluginManager abstraction for plugin lifecycle - Add async load/save to ISettingsService; update usages - Replace Result with ValidationResult for worklog validation - Refactor worklog submission to use Application.DTOs - Add cross-platform IHotkeyService; standardize hotkey to Ctrl+Shift+W - Add AppBootstrapper for shared startup logic (db, plugins, state) - Improve MainViewModel/MainWindow timer handling (pause/resume) - Enhance TrayIconService, NotificationService, dialogs, and settings - Move plugin references to Infrastructure only - Remove redundant custom command classes - Update tests and namespaces for new APIs and DTOs These changes modernize the codebase, improve maintainability, and enhance user experience across Avalonia and WPF.
There was a problem hiding this comment.
Pull request overview
This PR modernizes the WorkTracker solution by centralizing DI/service registration, standardizing MVVM across UI hosts using CommunityToolkit.Mvvm, and formalizing the plugin lifecycle behind an IPluginManager abstraction to decouple UI layers from plugin implementations.
Changes:
- Introduces Application-layer DI (
AddApplication) and shared UI bootstrapping (AppBootstrapper) to unify startup (db/plugins/state) across WPF/Avalonia/CLI. - Replaces custom command/INPC implementations with CommunityToolkit.Mvvm and refactors viewmodels (including timer pause/resume behavior).
- Updates settings/worklog validation and plugin submission flows (async settings APIs,
ValidationResult, Application DTOs,IPluginManager), with corresponding test updates.
Reviewed changes
Copilot reviewed 79 out of 79 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/WorkTracker.Infrastructure.Tests/DependencyInjectionTests.cs | Updates DI resolvability assertions for IPluginManager and interface moves. |
| tests/WorkTracker.Application.Tests/Services/WorklogValidatorTests.cs | Migrates assertions from Result to ValidationResult and Application DTOs. |
| tests/WorkTracker.Application.Tests/Services/WorkEntryServiceTests.cs | Updates repository/service interface namespace usage. |
| tests/WorkTracker.Application.Tests/Plugins/WorklogMapperTests.cs | Aligns mapper tests to Application DTOs. |
| src/WorkTracker.WPF/WorkTracker.WPF.csproj | Removes direct plugin project reference from WPF host. |
| src/WorkTracker.WPF/Views/SettingsWindow.xaml | Updates displayed hotkey to Ctrl+Shift+W. |
| src/WorkTracker.WPF/ViewModels/WorkEntryEditViewModel.cs | Switches command plumbing to CommunityToolkit Mvvm command interfaces. |
| src/WorkTracker.WPF/ViewModels/ViewModelBase.cs | Replaces custom INPC base with ObservableObject. |
| src/WorkTracker.WPF/ViewModels/SubmitWorklogViewModel.cs | Uses toolkit commands + Application DTOs for submission payloads. |
| src/WorkTracker.WPF/ViewModels/SettingsViewModel.cs | Depends on IPluginManager and uses async settings save + toolkit command APIs. |
| src/WorkTracker.WPF/ViewModels/MainViewModel.cs | Adds IDisposable to stop timer/unsubscribe from state events; updates command notifications. |
| src/WorkTracker.WPF/Services/HotkeyService.cs | Changes registered hotkey to Ctrl+Shift+W. |
| src/WorkTracker.WPF/Commands/RelayCommand.cs | Removes custom command implementation (replaced by toolkit). |
| src/WorkTracker.WPF/Commands/AsyncRelayCommand.cs | Removes custom async command implementation (replaced by toolkit). |
| src/WorkTracker.WPF/App.xaml.cs | Centralizes startup in AppBootstrapper; disposes main VM; uses IPluginManager. |
| src/WorkTracker.UI.Shared/Services/WorklogStateService.cs | Makes external “work entries modified” notification async and refreshes state before raising event. |
| src/WorkTracker.UI.Shared/Services/SettingsService.cs | Adds async load/save APIs and shared JSON write options. |
| src/WorkTracker.UI.Shared/Services/LocalizationService.cs | Normalizes file header/encoding (BOM). |
| src/WorkTracker.UI.Shared/Services/IWorklogStateService.cs | Updates contract to NotifyWorkEntriesModifiedAsync() with refreshed-state semantics. |
| src/WorkTracker.UI.Shared/Services/ITrayIconService.cs | Normalizes file header/encoding (BOM). |
| src/WorkTracker.UI.Shared/Services/ISettingsService.cs | Adds async load/save method contracts. |
| src/WorkTracker.UI.Shared/Services/INotificationService.cs | Normalizes file header/encoding (BOM). |
| src/WorkTracker.UI.Shared/Services/IHotkeyService.cs | Normalizes file header/encoding (BOM). |
| src/WorkTracker.UI.Shared/Services/IDialogService.cs | Normalizes file header/encoding (BOM). |
| src/WorkTracker.UI.Shared/Services/AppBootstrapper.cs | Adds shared host bootstrapping (db/plugins/state) for UI hosts. |
| src/WorkTracker.UI.Shared/Models/FavoriteWorkItem.cs | Normalizes file header/encoding (BOM). |
| src/WorkTracker.UI.Shared/Models/CloseWindowBehavior.cs | Normalizes file header/encoding (BOM). |
| src/WorkTracker.UI.Shared/Models/ApplicationSettings.cs | Normalizes file header/encoding (BOM). |
| src/WorkTracker.Plugin.Abstractions/WorkTracker.Plugin.Abstractions.csproj | Simplifies csproj (relies on repo-wide props for TF/nullable/minver). |
| src/WorkTracker.Plugin.Abstractions/WorklogUploadPluginBase.cs | Normalizes file header/encoding (BOM). |
| src/WorkTracker.Plugin.Abstractions/IWorklogUploadPlugin.cs | Normalizes file header/encoding (BOM). |
| src/WorkTracker.Plugin.Abstractions/IPlugin.cs | Normalizes file header/encoding (BOM). |
| src/WorkTracker.Infrastructure/WorkTrackerPaths.cs | Introduces centralized default filesystem paths (e.g., DB path). |
| src/WorkTracker.Infrastructure/WorkTracker.Infrastructure.csproj | Moves Tempo plugin project reference into Infrastructure. |
| src/WorkTracker.Infrastructure/Repositories/WorkEntryRepository.cs | Updates repository interface namespace to Domain layer. |
| src/WorkTracker.Infrastructure/DependencyInjection.cs | Centralizes service registration via AddApplication; loads embedded plugin; adds IPluginManager binding. |
| src/WorkTracker.Infrastructure/Data/WorkTrackerDbContextFactory.cs | Uses WorkTrackerPaths.DefaultDatabasePath for design-time context. |
| src/WorkTracker.Domain/Interfaces/IWorkEntryRepository.cs | Corrects interface namespace to WorkTracker.Domain.Interfaces. |
| src/WorkTracker.CLI/WorkTracker.CLI.csproj | Removes direct plugin project reference from CLI host. |
| src/WorkTracker.CLI/Program.cs | Defers embedded plugin loading to Infrastructure initialization. |
| src/WorkTracker.Avalonia/WorkTracker.Avalonia.csproj | Removes direct plugin project reference from Avalonia host. |
| src/WorkTracker.Avalonia/Views/WorkEntryEditDialog.axaml.cs | Formatting/indentation normalization. |
| src/WorkTracker.Avalonia/Views/SubmitWorklogDialog.axaml.cs | Formatting/indentation normalization. |
| src/WorkTracker.Avalonia/Views/SettingsWindow.axaml.cs | Formatting/indentation normalization. |
| src/WorkTracker.Avalonia/Views/MessageBoxWindow.axaml.cs | Formatting/indentation normalization. |
| src/WorkTracker.Avalonia/Views/MainWindow.axaml.cs | Adds timer pause/resume wiring on visibility/close behavior; disposes VM on exit. |
| src/WorkTracker.Avalonia/ViewModels/WorkEntryEditViewModel.cs | Switches to toolkit commands and updates CanExecute notification calls. |
| src/WorkTracker.Avalonia/ViewModels/ViewModelBase.cs | Replaces custom INPC base with ObservableObject. |
| src/WorkTracker.Avalonia/ViewModels/SubmitWorklogViewModel.cs | Switches to toolkit commands; uses Application DTOs for submission payloads. |
| src/WorkTracker.Avalonia/ViewModels/SettingsViewModel.cs | Depends on IPluginManager; uses async settings save; toolkit command APIs. |
| src/WorkTracker.Avalonia/ViewModels/MainViewModel.cs | Adds cancellation/disposal; timer pause/resume; toolkit command notifications; async init hardening. |
| src/WorkTracker.Avalonia/Services/TrayIconService.cs | Adds logging for previously swallowed tray-context errors. |
| src/WorkTracker.Avalonia/Services/NotificationService.cs | Uses theme-aware brushes for notification colors. |
| src/WorkTracker.Avalonia/Services/HotkeyService.cs | Adds cross-platform hotkey service (Win32 implemented; others no-op w/ logging). |
| src/WorkTracker.Avalonia/Services/DialogService.cs | Formatting/encoding normalization. |
| src/WorkTracker.Avalonia/Services/AutostartManager.cs | Formatting/encoding normalization. |
| src/WorkTracker.Avalonia/Program.cs | Formatting/indentation normalization. |
| src/WorkTracker.Avalonia/Markup/LocalizeExtension.cs | Encoding normalization (BOM). |
| src/WorkTracker.Avalonia/Converters/TimeSpanToStringConverter.cs | Formatting/indentation normalization. |
| src/WorkTracker.Avalonia/Converters/NullToBoolConverter.cs | Formatting/indentation normalization. |
| src/WorkTracker.Avalonia/Converters/DateTimeToStringConverter.cs | Formatting/indentation normalization. |
| src/WorkTracker.Avalonia/Commands/RelayCommand.cs | Removes custom command implementation (replaced by toolkit). |
| src/WorkTracker.Avalonia/Commands/AsyncRelayCommand.cs | Removes custom async command implementation (replaced by toolkit). |
| src/WorkTracker.Avalonia/App.axaml.cs | Uses AppBootstrapper; wires global hotkey; uses IPluginManager for shutdown disposal. |
| src/WorkTracker.Application/WorkTracker.Application.csproj | Adds DI abstractions package for Application-layer DI extension. |
| src/WorkTracker.Application/Services/WorklogValidator.cs | Migrates to ValidationResult, introduces duration constants, updates multi-validation aggregation. |
| src/WorkTracker.Application/Services/WorkEntryService.cs | Updates repository interface namespace usage. |
| src/WorkTracker.Application/Services/PluginBasedWorklogSubmissionService.cs | Switches to IPluginManager; centralizes WorkEntry→WorklogDto mapping; optimizes weekly operations via date-range query. |
| src/WorkTracker.Application/Services/IWorklogValidator.cs | Updates signatures to ValidationResult and Application DTOs. |
| src/WorkTracker.Application/Services/IWorklogSubmissionService.cs | Updates custom submit signature to Application WorklogDto. |
| src/WorkTracker.Application/Plugins/WorklogMapper.cs | Uses Application DTOs. |
| src/WorkTracker.Application/Plugins/PluginManager.cs | Implements IPluginManager interface. |
| src/WorkTracker.Application/Plugins/IPluginManager.cs | Introduces plugin lifecycle abstraction. |
| src/WorkTracker.Application/DTOs/WorklogSubmissionDto.cs | Removes dependency on Domain DTOs (now uses Application DTOs). |
| src/WorkTracker.Application/DTOs/WorklogDto.cs | Moves DTO namespace to Application layer. |
| src/WorkTracker.Application/DependencyInjection.cs | Adds AddApplication() to centralize application service registrations. |
| src/WorkTracker.Application/Common/JiraPatterns.cs | Encoding normalization (BOM). |
| src/WorkTracker.Application/AppInfo.cs | Formatting/indentation normalization. |
| plugins/WorkTracker.Plugin.Tempo/TempoWorklogPlugin.cs | Adds HTTP timeouts, retry logic, and TTL issue-id caching; hardens response parsing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…posal - LoadSettingsAsync now updates internal _settings field for consistency - NotifyWorkEntriesModifiedAsync raises event only after successful refresh - Update InitializePluginsAsync XML doc to match actual behavior - Dispose HttpResponseMessage in Tempo retry loop to prevent socket exhaustion - Capture window instance safely in Avalonia HotkeyService registration - Skip ResumeTimer in OnOpened when window starts minimized Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 80 out of 80 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
src/WorkTracker.Application/Services/IWorklogValidator.cs:24
- The interface uses non-nullable parameters (
WorkEntry entry,WorklogDto worklog), but the implementation/tests explicitly pass/check null (e.g.,ValidateForSubmission(null!)andif (entry == null)). Consider updating the interface signatures to accept nullable inputs (WorkEntry?,WorklogDto?) so the API matches actual usage and you don't need null-forgiving at call sites.
/// Validates a work entry for submission
/// </summary>
ValidationResult ValidateForSubmission(WorkEntry entry);
/// <summary>
/// Validates multiple work entries
/// </summary>
ValidationResult ValidateMultiple(IEnumerable<WorkEntry> entries);
/// <summary>
/// Validates a worklog DTO
/// </summary>
ValidationResult Validate(WorklogDto worklog);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- ToWorklogDto uses Math.Ceiling + Math.Max(1, ...) to avoid 0-minute duration for sub-minute entries that would fail validation - LoadSettings() now updates _settings field consistently with async version Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 80 out of 80 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use imported WorklogDto/ProviderInfo directly in IWorklogSubmissionService - Remove null check from ValidateForSubmission (non-nullable parameter) - Restructure Tempo retry loop to eliminate unreachable code path - Fix Dispatcher.InvokeAsync to return Task instead of async void lambda Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 80 out of 80 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 80 out of 80 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Change MainViewModel from Transient to Singleton (matches WPF) - Explicitly dispose MainViewModel in OnShutdownRequested to prevent resource leaks when exiting from tray without window closing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 80 out of 80 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 80 out of 80 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Use async lambda to ensure ShowEditWorkEntryDialogAsync is awaited on the UI thread, preventing unobserved Task<bool> from InvokeAsync. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 80 out of 80 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 80 out of 80 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 80 out of 80 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "Bash(if exist README.md move README.md readme.md)", | ||
| "Bash(if [ -f \"E:\\Claude-shared\\WorkTracker\\src\\WorkTracker.MAUI\\Resources\\Images\\README.md\" ])", | ||
| "Bash(then mv \"E:\\Claude-shared\\WorkTracker\\src\\WorkTracker.MAUI\\Resources\\Images\\README.md\" \"E:\\Claude-shared\\WorkTracker\\src\\WorkTracker.MAUI\\Resources\\Images\\readme.md\")", | ||
| "Bash(fi)" | ||
| "Bash(fi)", | ||
| "Bash(gh api:*)" | ||
| ], |
There was a problem hiding this comment.
This repository is committing .claude/settings.local.json, which contains machine-specific absolute paths and a permissive command allowlist; adding Bash(gh api:*) further broadens what the tool can execute. Consider removing this local settings file from source control (or replacing it with a sanitized, non-local template) and adding it to .gitignore to avoid leaking local environment details and unintentionally widening execution permissions for other contributors/CI.
These changes modernize the codebase, improve maintainability, and enhance user experience across Avalonia and WPF.