mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-27 18:22:41 -08:00
refactor(launcher): split CLI flow into command modules
Isolate process-side effects behind adapter seams and keep wrapper behavior stable while improving command-level testability.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
---
|
||||
id: TASK-81
|
||||
title: Refactor launcher into command modules and process adapters
|
||||
status: To Do
|
||||
assignee: []
|
||||
status: Done
|
||||
assignee:
|
||||
- opencode-task81-launcher-modules
|
||||
created_date: '2026-02-18 11:43'
|
||||
updated_date: '2026-02-18 11:43'
|
||||
updated_date: '2026-02-22 01:09'
|
||||
labels:
|
||||
- launcher
|
||||
- cli
|
||||
@@ -43,15 +44,44 @@ Launcher code is still large and process-control heavy (`launcher/main.ts`, `lau
|
||||
|
||||
## Acceptance Criteria
|
||||
<!-- AC:BEGIN -->
|
||||
- [ ] #1 Launcher commands are implemented as focused modules
|
||||
- [ ] #2 Process side effects are isolated behind adapter interfaces
|
||||
- [ ] #3 Existing CLI behavior and exit codes remain compatible
|
||||
- [ ] #4 Launcher testability improves via mocked adapter tests
|
||||
- [x] #1 Launcher commands are implemented as focused modules
|
||||
- [x] #2 Process side effects are isolated behind adapter interfaces
|
||||
- [x] #3 Existing CLI behavior and exit codes remain compatible
|
||||
- [x] #4 Launcher testability improves via mocked adapter tests
|
||||
<!-- AC:END -->
|
||||
|
||||
## Implementation Plan
|
||||
|
||||
<!-- SECTION:PLAN:BEGIN -->
|
||||
1) Add `launcher/process-adapter.ts` and `launcher/commands/context.ts` so command handlers receive a shared context and explicit process/stdout/signal/exit seam instead of hardcoding `process.*` calls.
|
||||
2) Extract early-return command branches from `launcher/main.ts` into focused modules under `launcher/commands/` (`config`, `doctor`, `mpv`, `app`, `texthooker`) while preserving existing outputs and exit-code behavior.
|
||||
3) Extract `jellyfin` and default playback orchestration into dedicated command modules so `launcher/main.ts` becomes thin command dispatch + lifecycle wiring.
|
||||
4) Add adapter-mocked command tests (`launcher/commands/command-modules.test.ts`) and keep integration regressions in `launcher/main.test.ts` to prove behavior parity.
|
||||
5) Wire new command test file into launcher/core source test scripts, run required gates (`bun run test:launcher`, `bun run test:core:src`), then finalize TASK-81 notes/AC/DoD without commit.
|
||||
<!-- SECTION:PLAN:END -->
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
<!-- SECTION:NOTES:BEGIN -->
|
||||
Planning complete. Detailed execution plan saved at docs/plans/2026-02-22-task-81-launcher-command-modules-process-adapters.md. Proceeding directly per user request to execute via writing-plans + executing-plans flow without commit.
|
||||
|
||||
Implemented launcher refactor by extracting command handlers into `launcher/commands/*` (`config`, `doctor`, `mpv`, `app`, `jellyfin`, `playback`) and converting `launcher/main.ts` into thin context+dispatch orchestration.
|
||||
|
||||
Added explicit process side-effect seam in `launcher/process-adapter.ts` and routed command output/exit/signal behavior through adapter-aware command modules.
|
||||
|
||||
Added mocked-adapter regression tests in `launcher/commands/command-modules.test.ts` and wired that file into `test:launcher:src` + `test:core:src` scripts.
|
||||
|
||||
Verification: `bun test launcher/commands/command-modules.test.ts launcher/main.test.ts launcher/parse-args.test.ts` and `bun run test:launcher && bun run test:core:src` all passing.
|
||||
<!-- SECTION:NOTES:END -->
|
||||
|
||||
## Final Summary
|
||||
|
||||
<!-- SECTION:FINAL_SUMMARY:BEGIN -->
|
||||
Refactored launcher command branching into focused command modules and introduced a dedicated process adapter interface to isolate output/exit/signal side effects from orchestration code. Preserved existing CLI behavior by keeping helper flows intact, added adapter-mocked command tests, and validated compatibility with full launcher and core source test gates.
|
||||
<!-- SECTION:FINAL_SUMMARY:END -->
|
||||
|
||||
## Definition of Done
|
||||
<!-- DOD:BEGIN -->
|
||||
- [ ] #1 Launcher tests and core test gate pass
|
||||
- [ ] #2 No regression in wrapper command behavior
|
||||
- [x] #1 Launcher tests and core test gate pass
|
||||
- [x] #2 No regression in wrapper command behavior
|
||||
<!-- DOD:END -->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user