This index coordinates the architecture refactors implied by the repository AGENTS.md files. Each linked plan should be worked as a focused pass with characterization tests before broad code movement.
The shared target is pragmatic SwiftUI MVVM:
Models/mirrors OpenCode domain/server types and reducer semantics.API/owns transport, bootstrap fetching, SSE framing, and the event-stream boundary.Stores/own focused observable feature state.Coordinators/own async workflow glue and request/response sequencing.Views/render state and send intent upward.AppViewModelshrinks into temporary compatibility glue and is then deleted.
-
APPVIEWMODEL_REMOVAL_PLAN.mdExisting plan for shrinking and deleting the legacy root facade. -
SYNC_PARITY_REFACTOR_PLAN.mdAlign bootstrap, SSE, typed events, reducers, and fallback refresh behavior with upstream OpenCode web UI. -
STORE_OWNERSHIP_REFACTOR_PLAN.mdMove canonical state ownership out ofAppViewModeland into focused stores. -
FEATURE_FACADES_REFACTOR_PLAN.mdDefine feature facades that views can consume instead ofAppViewModel. -
VIEWS_FACADE_MIGRATION_PLAN.mdMigrate SwiftUI views fromAppViewModelto focused facades/stores. -
MODELS_CLEANUP_REFACTOR_PLAN.mdKeepModels/focused on OpenCode domain/server/reducer semantics and move app-only types elsewhere. -
PERSISTENCE_AND_SECRETS_REFACTOR_PLAN.mdCentralize persistence, app-group snapshots, and Keychain usage while protecting secrets. -
COMMERCE_REFACTOR_PLAN.mdMove paywall, entitlement, and usage-metering rules into a focused commerce layer. -
WIDGETS_LIVE_ACTIVITY_REFACTOR_PLAN.mdMake widgets and Live Activities side-effect consumers of app state, not parallel sync owners. -
TEST_CHARACTERIZATION_REFACTOR_PLAN.mdAdd and migrate tests needed to safely execute the architecture refactors.
- Sync parity before ownership cleanup.
- Store ownership before view migration.
- Facade definitions before deleting
AppViewModelcall sites. - Persistence and commerce cleanup before final AppViewModel deletion.
- Widgets/Live Activities after store/facade ownership is clear.
- Tests before every behavior-preserving extraction.
- Prefer upstream OpenCode web behavior over local assumptions for server-backed data flow.
- Do not add new canonical state to
AppViewModel. - Do not move networking into stores or views.
- Do not duplicate reducer event mutation in views, stores, or coordinators.
- Keep compatibility adapters only as temporary migration aids.
- Preserve on-device behavior and compact/split-view navigation throughout.
The full refactor family is complete when:
- Views no longer require
AppViewModelfor normal operation. - Canonical feature state lives in focused stores.
- Feature workflows are expressed through facades/coordinators.
- OpenCode sync behavior is reducer-driven and aligned with upstream web UI.
- App-only models and persistence are owned by their features.
- Widgets and Live Activities consume published snapshots/ActivityKit state.
- Unit, UI, screenshot, and on-device smoke tests pass.