Skip to content

Commit 43aee31

Browse files
kwschulzclaude
andcommitted
refactor(capture): extract workflow logic with proper separation of concerns
- Add workflow.py with phase-specific result types: - BrowserCheckResult: browser installation check - ConnectivityResult: connectivity check - AuthResult: authentication detection - CaptureResult: capture operation result - CaptureWorkflowResult composes phase results with convenience properties - cli/capture.py now thin CLI layer using workflow functions - Add comprehensive tests for all workflow types and functions (35 tests) This design makes each type testable in isolation and clarifies which fields are valid in which phase. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 3add8fd commit 43aee31

4 files changed

Lines changed: 1230 additions & 56 deletions

File tree

src/har_capture/capture/__init__.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
- CaptureOptions: Options for filtering (fonts, images, media)
1010
- check_playwright: Check if Playwright is available
1111
- install_playwright: Install Playwright and browser
12+
- CaptureWorkflowResult: Result dataclass from workflow
13+
- run_capture_workflow: Run the complete capture workflow
1214
"""
1315

1416
from __future__ import annotations
@@ -30,6 +32,18 @@
3032
install_browser_deps,
3133
install_playwright,
3234
)
35+
from har_capture.capture.workflow import (
36+
AuthResult,
37+
BrowserCheckResult,
38+
CaptureWorkflowResult,
39+
ConnectivityResult,
40+
check_auth_phase,
41+
check_browser_phase,
42+
check_connectivity_phase,
43+
run_capture_phase,
44+
run_capture_workflow,
45+
)
46+
from har_capture.capture.workflow import CaptureResult as WorkflowCaptureResult
3347

3448
__all__ = [
3549
# Core capture
@@ -46,4 +60,15 @@
4660
"install_playwright",
4761
"install_browser",
4862
"install_browser_deps",
63+
# Workflow orchestration
64+
"CaptureWorkflowResult",
65+
"BrowserCheckResult",
66+
"ConnectivityResult",
67+
"AuthResult",
68+
"WorkflowCaptureResult",
69+
"check_browser_phase",
70+
"check_connectivity_phase",
71+
"check_auth_phase",
72+
"run_capture_phase",
73+
"run_capture_workflow",
4974
]

0 commit comments

Comments
 (0)