refactor(FN-1563): decouple CLI commands from UI dependencies

- Extract task lifecycle helpers (checkForExistingSession, resolveProjectPath) to shared modules
- Extract port selection logic to dedicated port-prompt module
- Remove direct imports from @fusion/dashboard in serve.ts
- Add architectural boundary comments for future maintainability
- Update tests to reflect new module structure
- Add memory note documenting the architectural decision
This commit is contained in:
gsxdsm
2026-04-10 12:47:46 -07:00
parent e54867d746
commit e685745aa3
7 changed files with 391 additions and 189 deletions

View File

@@ -377,8 +377,11 @@ vi.mock("@mariozechner/pi-coding-agent", () => ({
createExtensionRuntime: vi.fn(),
}));
vi.mock("../dashboard.js", () => ({
vi.mock("../port-prompt.js", () => ({
promptForPort: vi.fn(async (port: number) => port),
}));
vi.mock("../task-lifecycle.js", () => ({
getMergeStrategy: vi.fn((settings: { mergeStrategy?: "direct" | "pull-request" }) => settings.mergeStrategy ?? "direct"),
processPullRequestMergeTask: vi.fn().mockResolvedValue("waiting"),
}));