Skip to content

Commit 70bc034

Browse files
committed
feat: ship phone todo/session UX and Android persistence
1 parent b0d8fa4 commit 70bc034

56 files changed

Lines changed: 3849 additions & 537 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/pull_request_template.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## Summary
2+
3+
- What changed:
4+
- Why this change is needed:
5+
6+
## Compliance Boundary Checklist (MVP-APP-006)
7+
8+
Confirm each item before requesting review.
9+
10+
- [ ] No new ViewModel app logic was added (no filesystem/process/network/watcher/timer/composition logic in ViewModels).
11+
- [ ] Commands/queries do not carry `ViewModel` references.
12+
- [ ] CQRS handlers do not call `ViewModel.*Internal(...)` or access ViewModel private services/mediator state.
13+
- [ ] Code-behind changes are UI-only (event wiring, control sync, layout/splitter persistence) or a documented exception is linked below.
14+
- [ ] If a documented exception was used, I linked the rationale and removal plan: `docs/EXCEPTION-EVALUATION.md` or equivalent.
15+
- [ ] Legacy project (`src/McpServerManager`) scope impact is stated (unchanged / intentionally touched with justification).
16+
17+
## Validation
18+
19+
- [ ] Desktop build tested (command + result)
20+
- [ ] Android build tested (command + result)
21+
- [ ] Manual smoke checks listed for impacted tabs/features
22+
23+
## Notes for Reviewers
24+
25+
- Compliance/audit docs updated (if applicable):
26+
- Remaining known risks:
27+

.github/workflows/build-android.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ jobs:
3030
with:
3131
fetch-depth: 0
3232

33+
- name: Architecture compliance guardrails (Phase 0)
34+
shell: pwsh
35+
run: ./tools/compliance/Invoke-ArchitectureChecks.ps1
36+
3337
- uses: actions/setup-dotnet@v4
3438
with:
3539
dotnet-version: '9.0.x'

HANDOFF.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,3 +590,83 @@ This provides a concrete, correct pattern to apply next to `MainWindowViewModel`
590590
## Connected Devices
591591
- `emulator-5554` — Android tablet emulator (x86_64, 1600x2560)
592592
- `ZD222QH58Q` — Physical Android device (not used this session)
593+
594+
## MVP-APP-006 Phase 0 Compliance Tranche (Audit + Guardrails)
595+
596+
Status: completed baseline governance/inventory phase (refactor not started in this tranche)
597+
598+
### Artifacts added
599+
600+
- Compliance spec + freeze rule:
601+
- `docs/architecture/compliance/COMPLIANCE-SPEC.md`
602+
- Compliance matrix (violation families, target design, replacement owner):
603+
- `docs/architecture/compliance/COMPLIANCE-MATRIX.md`
604+
- Core ViewModel app-logic inventory:
605+
- `docs/architecture/compliance/INVENTORY-CORE-VIEWMODEL-APP-LOGIC.md`
606+
- Core handler/ViewModel coupling inventory:
607+
- `docs/architecture/compliance/INVENTORY-CORE-HANDLER-VM-COUPLING.md`
608+
- Desktop/Android code-behind classification inventory:
609+
- `docs/architecture/compliance/INVENTORY-CODE-BEHIND.md`
610+
- Legacy project scope decision + inventory:
611+
- `docs/architecture/compliance/LEGACY-COMPLIANCE-SCOPE.md`
612+
- PR compliance checklist:
613+
- `.github/pull_request_template.md`
614+
- CI guardrail scripts:
615+
- `tools/compliance/Check-CqrsBoundaries.ps1`
616+
- `tools/compliance/Check-ViewModelBoundaries.ps1`
617+
- `tools/compliance/Invoke-ArchitectureChecks.ps1`
618+
619+
### CI enforcement change
620+
621+
- Added Phase 0 architecture guardrail step to:
622+
- `.github/workflows/build-android.yml`
623+
- The guardrails intentionally fail while known violations remain. This is expected and aligns with the no-wrapper/no-masking directive.
624+
625+
### Scope decision (legacy)
626+
627+
- Active compliance scope for `MVP-APP-006` is `Core`, `Desktop`, and `Android`.
628+
- `src/McpServerManager` remains visible in audit documentation but is excluded from Phase 0 guardrail execution pending explicit deprecation/refactor work.
629+
630+
### Relationship to existing audit/blame sections
631+
632+
- The detailed findings and blame attribution earlier in this file remain the line-level source of truth for current non-compliance.
633+
- The new docs above convert those findings into a tracked matrix and executable guardrails.
634+
635+
## MVP-APP-006 Chat Refactor Tranche (Post-Phase 0)
636+
637+
Status: Chat compliance tranche completed for tasks 9, 12, 13, 14, 15, 16, 17, 18, and 33 (MainWindow/Todo/Workspace epic work remains)
638+
639+
### Completed in this tranche
640+
641+
- Added chat application service interfaces and default implementations for:
642+
- prompt template loading
643+
- chat-related local file open/config file operations
644+
- model discovery
645+
- send orchestration contract (wrapper introduced for later migration)
646+
- Replaced `Core/Commands/ChatCommands.cs` wrapper handlers with DTO/result-based handlers:
647+
- no `ChatWindowViewModel` command payload properties remain
648+
- no handlers call `ViewModel.*Internal(...)`
649+
- Converted chat model discovery to a CQRS **query** handler/service path
650+
- Refactored `Core/ViewModels/ChatWindowViewModel.cs` so these flows dispatch/apply results instead of owning file-open/prompt-load/model-discovery logic
651+
- Moved chat send backend orchestration to CQRS command handler + app service (`ChatSendMessageHandler`)
652+
- Added compliant `ChatWindowViewModelFactory` to own chat mediator/handler registration and config IO integration
653+
- Refactored Desktop `MainWindow` code-behind to use the chat factory (removed direct chat service/config/VM construction)
654+
655+
### Remaining Chat-specific non-compliance in active scope
656+
657+
- None identified in the active Chat subsystem path after this tranche.
658+
- `CancelSend()` remains in `ChatWindowViewModel` as UI cancellation-token ownership (allowed by current compliance spec).
659+
- Legacy chat window path in `src/McpServerManager` remains out of active scope (see legacy scope decision doc).
660+
661+
### Files changed in this tranche
662+
663+
- `src/McpServerManager.Core/Services/ChatApplicationServices.cs`
664+
- `src/McpServerManager.Core/Services/ChatWindowViewModelFactory.cs`
665+
- `src/McpServerManager.Core/Commands/ChatCommands.cs`
666+
- `src/McpServerManager.Core/ViewModels/ChatWindowViewModel.cs`
667+
- `src/McpServerManager.Desktop/Views/MainWindow.axaml.cs`
668+
669+
### Validation
670+
671+
- `dotnet build src/McpServerManager.Core/McpServerManager.Core.csproj -c Debug --no-restore` ⚠️ one run failed due transient file lock (`CS2012`, Defender lock on `obj` DLL); subsequent Desktop build succeeded and compiled Core
672+
- `dotnet build src/McpServerManager.Desktop/McpServerManager.Desktop.csproj -c Debug --no-restore`

docs/Project/TODO.yaml

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,55 @@ mvp-app:
33
- id: MVP-APP-006
44
title: Bring codebase into full CQRS/code-behind compliance (refactor-first, no wrapper masking)
55
estimate: ~40-80 hours (multi-session architecture refactor + regression validation)
6+
note: 'Phase 0 + Chat refactor complete: Chat prompt/config/model/send flows, CQRS handlers, VM factory, and Desktop chat code-behind extraction are compliant. Remaining work is MainWindow/Todo/Workspace and cross-cutting validation.'
67
done: false
78
description:
89
- 'Refactor the codebase to full CQRS and code-behind compliance: ViewModels own UI state/projection only; all app logic moves to handlers/services.'
910
- Enforce correctness, completeness, and adherence; do not preserve non-compliant behavior behind wrapper handlers or proxy internal methods.
1011
- Use the current HANDOFF audit and blame map as the baseline and update it continuously until final pass criteria are met for the declared scope.
12+
remaining: 24 tasks remain (MainWindow/Todo/Workspace compliance refactors, central composition, checks, and validation).
1113
technical-details:
1214
- 'Target rule: no commands/queries carrying ViewModel references and no handlers invoking ViewModel internal methods.'
1315
- 'Target rule: no network/file/process/watcher/composition logic inside ViewModels except documented, approved exceptions.'
1416
- 'Target rule: code-behind is UI-only (event wiring, control sync, layout persistence) except explicitly documented exceptions.'
1517
- Migration must preserve behavior via phased refactors with build validation and manual smoke testing after each subsystem.
1618
implementation-tasks:
1719
- task: Publish a formal compliance spec defining allowed ViewModel responsibilities, allowed code-behind responsibilities, CQRS handler rules, and forbidden patterns.
18-
done: false
20+
done: true
1921
- task: Convert the current audit into a tracked compliance matrix with status, target design, and replacement owner for each violation.
20-
done: false
22+
done: true
2123
- task: 'Freeze architecture drift by documenting a temporary rule: no new ViewModel app logic and no commands/queries carrying ViewModel references.'
22-
done: false
24+
done: true
2325
- task: 'Inventory every Core ViewModel app-logic method and classify by domain: network, filesystem, process, parsing, watcher, orchestration, composition.'
24-
done: false
26+
done: true
2527
- task: Inventory every Core handler that calls ViewModel internals or accesses ViewModel fields/services and map a replacement design.
26-
done: false
28+
done: true
2729
- task: Inventory all Desktop and Android code-behind paths and classify as UI-only, documented exception, or extraction required.
28-
done: false
30+
done: true
2931
- task: Inventory all legacy project violations and decide per area whether to refactor or deprecate from compliance scope.
30-
done: false
32+
done: true
3133
- task: Document and approve the final compliance-scope decision for the legacy project so success criteria are unambiguous.
32-
done: false
34+
done: true
3335
- task: Define chat application service interfaces for prompt/config file operations, model discovery, and send orchestration.
34-
done: false
36+
done: true
3537
- task: Define MainWindow application service interfaces for session loading, aggregation, JSON parsing/tree building, file previews, archive, shell launch, and AGENTS watcher.
3638
done: false
3739
- task: Define workspace catalog and health orchestration service interfaces currently owned by MainWindowViewModel.
3840
done: false
3941
- task: Define a compliant composition factory for ChatWindowViewModel creation outside Desktop MainWindow code-behind.
40-
done: false
42+
done: true
4143
- task: Refactor ChatCommands payloads to primitives/DTOs only and remove ChatWindowViewModel references from commands.
42-
done: false
44+
done: true
4345
- task: Replace ChatCommands handlers with service-backed handlers that return structured results rather than mutating ViewModel internals.
44-
done: false
46+
done: true
4547
- task: Move chat prompt/config file IO and shell-open logic out of ChatWindowViewModel into dedicated services with explicit success/failure results.
46-
done: false
48+
done: true
4749
- task: Move chat model discovery out of ChatWindowViewModel into a query handler and service adapter.
48-
done: false
50+
done: true
4951
- task: Move chat send pipeline orchestration out of ChatWindowViewModel into a command handler/app service while preserving streaming and cancellation.
50-
done: false
52+
done: true
5153
- task: Refactor ChatWindowViewModel to command/query dispatch plus UI state projection only and delete obsolete internal app-logic methods.
52-
done: false
54+
done: true
5355
- task: Refactor MainWindow AllCommands so commands do not carry MainWindowViewModel and handlers do not call ViewModel internals.
5456
done: false
5557
- task: Refactor MainWindow AsyncCommands so handlers no longer access vm._mediator, vm services, or vm internal builder methods.
@@ -79,17 +81,17 @@ mvp-app:
7981
- task: Introduce a central composition layer for Core ViewModels and handler/service registration that supports endpoint changes compliantly.
8082
done: false
8183
- task: Refactor Desktop MainWindow code-behind to remove chat service creation, config IO reads, and ChatWindowViewModel construction.
82-
done: false
84+
done: true
8385
- task: Re-audit Desktop and Android code-behind and document any remaining explicit exceptions with rationale and approval.
8486
done: false
8587
- task: If legacy remains in scope, refactor legacy ViewModels and code-behind using the same patterns; otherwise mark legacy deprecated and excluded in docs/CI.
86-
done: false
88+
done: true
8789
- task: Add architecture checks that fail CI when commands contain ViewModel properties or handlers invoke ViewModel internal methods.
88-
done: false
90+
done: true
8991
- task: Add architecture checks that flag filesystem/process/network APIs in ViewModels except approved exceptions.
90-
done: false
92+
done: true
9193
- task: Add a PR review checklist requiring confirmation of ViewModel, CQRS handler, and code-behind boundary compliance.
92-
done: false
94+
done: true
9395
- task: Update HANDOFF audit and blame sections after each refactor phase to keep the remaining violation map current.
9496
done: false
9597
- task: Validate Desktop build and run manual smoke tests for Request Tracker, Todos, Workspaces, Logs, Chat, and AGENTS after each subsystem migration.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Compliance Matrix (MVP-APP-006 Baseline)
2+
3+
Status: Phase 0 baseline matrix (tracked, actionable)
4+
Source audit: `HANDOFF.md` (CQRS + code-behind findings, blame map, provenance notes)
5+
6+
## Matrix
7+
8+
| ID | Violation Family | Current State | Target Design | Replacement Owner | Status | Evidence |
9+
|---|---|---|---|---|---|---|
10+
| CM-001 | CQRS wrapper handlers in `Core/Commands` | Commands carry `MainWindowViewModel` / `ChatWindowViewModel`; handlers call `*Internal` methods | DTO-only commands/queries + service-backed handlers returning results | `Core/Commands` + new app services | Open | `src/McpServerManager.Core/Commands/AllCommands.cs`, `src/McpServerManager.Core/Commands/AsyncCommands.cs`, `src/McpServerManager.Core/Commands/ChatCommands.cs` |
11+
| CM-002 | `MainWindowViewModel` owns app logic | Network/file/process/parsing/watcher/timer/orchestration/composition logic in VM | VM reduced to UI state + dispatch; handlers/services own behavior | `MainWindowViewModel` + extracted services | Open | `src/McpServerManager.Core/ViewModels/MainWindowViewModel.cs` |
12+
| CM-003 | `ChatWindowViewModel` owns app logic | Prompt/config file IO, shell-open, model discovery, send orchestration in VM | Chat app service interfaces + command/query handlers + VM projection only | `ChatWindowViewModel` + chat services | Open | `src/McpServerManager.Core/ViewModels/ChatWindowViewModel.cs` |
13+
| CM-004 | VM-local composition roots | VMs construct MCP services and register handlers directly | Central composition layer/factory injects services/handlers | `TodoListViewModel`, `WorkspaceViewModel`, `MainWindowViewModel`, `ChatWindowViewModel` | Open | `src/McpServerManager.Core/ViewModels/TodoListViewModel.cs`, `src/McpServerManager.Core/ViewModels/WorkspaceViewModel.cs` |
14+
| CM-005 | Desktop MainWindow code-behind owns app composition | Code-behind constructs chat VM and reads/writes config model path | Code-behind requests view model/factory result; no feature composition | Desktop host/app composition layer | Open | `src/McpServerManager.Desktop/Views/MainWindow.axaml.cs:248` |
15+
| CM-006 | Code-behind exceptions not fully cataloged | Mixed UI-only and exceptions, no complete desktop/android inventory | Full inventory with classification and extraction backlog | Desktop + Android view inventory docs | Completed (Phase 0) | `docs/architecture/compliance/INVENTORY-CODE-BEHIND.md` |
16+
| CM-007 | Legacy project compliance scope ambiguous | Legacy project still exists and is non-compliant; success criteria unclear | Explicit scope decision: exclude legacy from active compliance and CI checks until dedicated deprecation/refactor phase | Maintainers + epic owner | Completed (Phase 0 decision) | `docs/architecture/compliance/LEGACY-COMPLIANCE-SCOPE.md` |
17+
| CM-008 | Architecture drift risk during refactor | New non-compliant patterns can be introduced while epic is open | Freeze rule + CI checks + PR checklist | Repo policy + CI | Completed (Phase 0) | `docs/architecture/compliance/COMPLIANCE-SPEC.md`, `.github/pull_request_template.md`, `tools/compliance/*` |
18+
19+
## Status Legend
20+
21+
- `Open`: Violation exists and refactor is not complete.
22+
- `Completed (Phase 0)`: Baseline governance/inventory/scoping work completed.
23+
- `In Progress`: Refactor underway with partial migration (none marked yet in this matrix).
24+
25+
## Mapping to `MVP-APP-006` Task Families
26+
27+
Phase 0 matrix-driven tasks:
28+
29+
- Governance/spec/freeze: tasks 1, 3
30+
- Baseline matrix: task 2
31+
- Inventories: tasks 4, 5, 6, 7
32+
- Legacy scope decision: tasks 8 and (scope path of) 35
33+
- Guardrails/checklist: tasks 36, 37, 38
34+
35+
## Notes
36+
37+
- This matrix tracks violation families and replacement owners. It is not a substitute for the line-level blame map in `HANDOFF.md`.
38+
- Refactor-phase updates should append progress and remaining violations to `HANDOFF.md` and keep this matrix current.
39+

0 commit comments

Comments
 (0)