Skip to content

Commit c5be390

Browse files
committed
refactor(screenshot): extract macOS crop-target decision to keep classifier under the complexity budget
classifyAppleCropTarget inlined the macOS surface decision, pushing its cyclomatic complexity to the fallow threshold. Move it back out to a small helper so the target classifier stays within budget.
1 parent 7edcd2a commit c5be390

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/daemon/screenshot-crop-target.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function classifyAppleCropTarget(
8888
case 'tvos':
8989
return 'tvos';
9090
case 'macos':
91-
return surface === 'app' || surface === 'frontmost-app' ? 'macos-app-window' : 'macos-helper';
91+
return classifyMacOsCropTarget(surface);
9292
case 'watchos':
9393
case 'visionos':
9494
// Stored records carry the reserved OSes although discovery never populates them; a
@@ -98,6 +98,10 @@ function classifyAppleCropTarget(
9898
}
9999
}
100100

101+
function classifyMacOsCropTarget(surface: SessionSurface | undefined): CropTarget {
102+
return surface === 'app' || surface === 'frontmost-app' ? 'macos-app-window' : 'macos-helper';
103+
}
104+
101105
function cropRefusal(target: string, rejectionReason?: ScreenshotCropReason): AppError {
102106
return new AppError(
103107
'UNSUPPORTED_OPERATION',

0 commit comments

Comments
 (0)