refactor: split main.ts into domain runtimes

This commit is contained in:
2026-03-31 23:48:14 -07:00
parent 3502cdc607
commit 983f3b38ee
84 changed files with 15591 additions and 4251 deletions

View File

@@ -0,0 +1,36 @@
---
id: TASK-238.8
title: Refactor src/main.ts composition root into domain runtimes
status: To Do
assignee: []
created_date: '2026-03-31 06:28'
labels:
- tech-debt
- runtime
- maintainability
- composition-root
dependencies: []
references:
- src/main.ts
- src/main/boot/services
- src/main/runtime/composers
- docs/architecture/README.md
parent_task_id: TASK-238
priority: high
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
Refactor `src/main.ts` so it becomes a thin composition root and the domain-specific runtime wiring moves into short wrapper modules under `src/main/`. Preserve all current behavior, IPC contracts, and config/schema semantics while reducing the entrypoint to boot services, grouped runtime instantiation, startup execution, and process-level quit handling.
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [ ] #1 `src/main.ts` is bootstrap/composition only: platform preflight, boot services, runtime creation, startup execution, and top-level quit/signal handling.
- [ ] #2 `src/main.ts` no longer imports `src/main/runtime/*-main-deps.ts` directly.
- [ ] #3 `src/main.ts` has no local names like `build*MainDepsHandler`, `*MainDeps`, or trivial `*Handler` pass-through wrappers.
- [ ] #4 New wrapper files stay under ~500 LOC each; if one exceeds that, split before merge.
- [ ] #5 Cross-domain coordination stays in `main.ts`; wrapper modules stay acyclic and communicate via injected callbacks.
- [ ] #6 No user-facing behavior, config fields, or IPC channel names change.
<!-- AC:END -->

View File

@@ -0,0 +1,27 @@
---
id: TASK-262
title: Create overlay UI bootstrap input helper
status: To Do
assignee: []
created_date: '2026-03-31 17:04'
labels:
- refactor
- main
- overlay-ui
dependencies: []
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
Add a coarse input-builder/helper module to reduce the large createOverlayUiRuntime(...) callsite in src/main.ts without changing runtime behavior. Do not edit src/main.ts in this task.
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [ ] #1 New helper module(s) live under src/main/
- [ ] #2 Helper accepts grouped overlay UI/domain inputs instead of giant inline literals
- [ ] #3 Helper keeps files under 500 LOC
- [ ] #4 Optional focused tests added if useful
- [ ] #5 No runtime behavior changes
<!-- AC:END -->

View File

@@ -0,0 +1,28 @@
---
id: TASK-263
title: Create coarse startup bootstrap wrapper
status: To Do
assignee: []
created_date: '2026-03-31 17:21'
labels:
- refactor
- main
- startup
dependencies: []
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
Move the large createMainStartupRuntime construction and its self-reference handling out of src/main.ts into a coarse startup bootstrap wrapper. Keep behavior identical and shrink the startup section materially.
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [ ] #1 New wrapper module(s) live under src/main/
- [ ] #2 Wrapper owns createMainStartupRuntime construction and self-reference handling
- [ ] #3 src/main.ts startup section becomes materially smaller
- [ ] #4 Files stay under 500 LOC
- [ ] #5 Focused tests cover the wrapper if useful
- [ ] #6 No runtime behavior changes
<!-- AC:END -->