Public report of openclaw/Peekaboo, published 14 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 14 November 2026, 21:54 UTC · Survey ID cd_76c220e4a8764b56b1cbeb5f2ef1e64e
openclaw/Peekaboo
Measured 14 November 2026, 21:53 UTC, at code version d079c7e
Code coverage is not measured: JavaScript/TypeScript and Swift suite (CouldNotMeasureTestRunFailed, CouldNotMeasureEnvironment).
CAI scoreWeak
CriticalWeakAdequateStrongExemplary
Down 2 since the last survey
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A large codebase: 278,184 lines of product code in 22 projects, tests not counted · Estimated rebuild effort: about 3.6 person-years · Weakest lens: Code Health, 33
Findings by how serious they are
31 critical2766 serious91 minor
15 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
14 November 2026, 21:53 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
55of 55 dimensions measured by tools.
2870of 2888 findings point to an exact file and line, so you can open each one in the code. The other 18 concern the repository as a whole, such as missing documentation.
55dimensions across 6 lenses, read from 278,184 lines of product code in 22 projects.
openclaw/Peekaboo falls short of our standard for production, held back most by its Code Health lens, the quality of the code itself. It scores 46 out of 100 and is rated Weak, and all 31 of its critical findings are security problems.
Code Health, at 33, is the weakest lens and counts most in the score. The best first step is adding type checking, worth about 6 points. Simplifying the most tangled functions comes next, worth about 5 points. Raising Code Health to 70 would lift the score to about 57.
Twenty-five pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Two places in the code run text as code, which an attacker could use, and two weaknesses in the code could be used by an attacker. Pinning each tool to an exact version, replacing text run as code with direct calls and fixing the weaknesses the scanner points to would close these risks. Setting a waiting period for automatic updates would fix the automatic dependency update that takes a new release at once, and the password or key in the code's history needs replacing, with the old one switched off.
The product code is 278,184 lines, about €530,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Code Health rose from 33 to 70, the lowest score rated Strong, the score would rise from 46 to about 57.
Code composition: what the lines of code are
Product code 47%Tests 53%
New since the last survey: 666 findings
These 666 critical or serious findings weren't in the previous survey, on 28 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
Code Duplication · Edited copy of a member (20 corresponding lines) Apps/Mac/Peekaboo/Core/Settings.swift
Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift
Code Duplication · Edited copy of a member (167 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift
Code Duplication · Edited copy of a member (78 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift
Code Duplication · Edited copy of a member (53 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift
Code Duplication · Edited copy of a member (72 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift
Code Duplication · Edited copy of a member (31 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift
Code Duplication · Edited copy of a member (64 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift
Code Duplication · Edited copy of a member (53 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift
Code Duplication · Edited copy of a member (35 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift
Code Duplication · Edited copy of a member (62 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceUtilities.swift
Code Duplication · Edited copy of a member (40 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Testing.swift
Code Duplication · Edited copy of a member (30 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool+Formatting.swift
Code Duplication · Edited copy of a member (54 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift
Code Duplication · Edited copy of a member (39 corresponding lines) Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/CoordinateTransformer.swift
Code Duplication · Edited copy of a member (77 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift
Code Duplication · Edited copy of a member (28 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Responses.swift
Code Duplication · Edited copy of a member (39 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift
Code Duplication · Edited copy of a member (29 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift
Code Duplication · Edited copy of a member (53 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuBarElementCollector.swift
Code Duplication · Edited copy of a member (31 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift
Code Duplication · Edited copy of a member (45 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift
Code Duplication · Edited copy of a member (41 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift
Code Duplication · Edited copy of a member (53 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/FileService.swift
Code Duplication · Edited copy of a member (26 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift
Code Duplication · Edited copy of a member (28 corresponding lines) Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift
Code Duplication · Edited copy of a member (39 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift
Code Duplication · Edited copies of one member (3 members, 44+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Helpers/ProcessWait.swift
Code Duplication · Edited copy of a member (44 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraState.swift
Code Duplication · Edited copy of a member (28 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift
Code Duplication · Edited copy of a member (37 corresponding lines) Apps/Mac/Peekaboo/Features/Settings/AddCustomProviderView.swift
Code Duplication · Edited copy of a member (37 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift
Code Duplication · Edited copy of a member (31 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolResultExtractor.swift
Code Duplication · Edited copy of a member (37 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBootstrap.swift
Code Duplication · Edited copy of a member (46 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand.swift
Code Duplication · Edited copy of a member (35 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift
Code Duplication · Edited copy of a member (22 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureApplicationResolver.swift
Code Duplication · Edited copy of a member (28 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift
Code Duplication · Edited copy of a member (28 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/BridgeCommand+Receipt.swift
Code Duplication · Edited copy of a member (24 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Lifecycle.swift
Code Duplication · Edited copy of a member (26 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift
Code Duplication · Edited copy of a member (26 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift
Code Duplication · Edited copy of a member (39 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/Snapshot.swift
Code Duplication · Edited copy of a member (22 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Screenshots.swift
Code Duplication · Edited copy of a member (31 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift
Code Duplication · Edited copy of a member (14 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/HeldPointerPlan.swift
Code Duplication · Edited copies of one member (3 members, 37+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementDetectionModels.swift
Code Duplication · Edited copy of a member (35 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopMutationWatermarkStore.swift
Code Duplication · Edited copy of a member (19 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Resolution.swift
Code Duplication · Edited copy of a member (31 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Focus.swift
Code Duplication · Edited copy of a member (30 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift
Code Duplication · Edited copy of a member (26 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool.swift
Code Duplication · Edited copy of a member (24 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeResponse+CaptureDiagnostics.swift
Code Duplication · Edited copies of one member (3 members, 30+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift
Code Duplication · Edited copy of a member (26 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift
Code Duplication · Edited copy of a member (18 corresponding lines) Apps/Mac/Peekaboo/Features/Settings/SettingsWindow.swift
Code Duplication · Edited copies of one member (3 members, 26+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOwnerLease.swift
Code Duplication · Edited copy of a member (18 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentOutputDelegate.swift
Code Duplication · Edited copies of one member (3 members, 25+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift
Code Duplication · Edited copy of a member (19 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelOutput.swift
Code Duplication · Edited copy of a member (23 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequestResponse.swift
Code Duplication · Edited copy of a member (28 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Captures.swift
Code Duplication · Edited copy of a member (33 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift
Code Duplication · Edited copy of a member (19 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift
Code Duplication · Edited copy of a member (33 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift
Code Duplication · Edited copy of a member (20 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift
Code Duplication · Edited copy of a member (25 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext+BrowserSession.swift
Code Duplication · Edited copy of a member (18 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+PointerKeyboardOperations.swift
Code Duplication · Edited copy of a member (28 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraState.swift
Code Duplication · Edited copy of a member (21 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClipboardTool.swift
Code Duplication · Edited copy of a member (33 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementDetectionTimeoutRunner.swift
Code Duplication · Edited copy of a member (29 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+TypingOperations.swift
Code Duplication · Edited copy of a member (20 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/HeldPointerRunner.swift
Code Duplication · Edited copy of a member (29 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift
Code Duplication · Edited copy of a member (20 corresponding lines) Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift
Code Duplication · Edited copy of a member (11 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift
Code Duplication · Edited copy of a member (21 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift
Code Duplication · Edited copies of one member (3 members, 19+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationContext.swift
Code Duplication · Edited copy of a member (23 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift
Code Duplication · Edited copy of a member (22 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/SystemIdentityResolver.swift
Code Duplication · Edited copy of a member (12 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentCompatibilityTypes.swift
Code Duplication · Edited copy of a member (29 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift
Code Duplication · Edited copy of a member (29 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureSessionOptions.swift
Code Duplication · Edited copy of a member (19 corresponding lines) Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift
Code Duplication · Edited copy of a member (16 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift
Code Duplication · Edited copy of a member (22 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogHierarchyReader.swift
Code Duplication · Edited copy of a member (19 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationAttestationModels.swift
Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift
Code Duplication · Edited copy of a member (18 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/PeekabooMCPServer.swift
Code Duplication · Edited copy of a member (11 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift
Code Duplication · Edited copy of a member (29 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolSnapshotMutation.swift
Code Duplication · Edited copies of one member (3 members, 8+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatUI.swift
Code Duplication · Edited copy of a member (19 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift
Code Duplication · Edited copy of a member (22 corresponding lines) Apps/Mac/Peekaboo/Features/Settings/SettingsWindow.swift
We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 718 findings
These 718 critical or serious findings were in the previous survey, on 28 October 2026, and are gone from this one. The first 100 are listed here.
€180,000 to €880,000, for 2,927 to 9,285 hours of work, about 3.6 person-years for 2 to 7 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.7 at a score of 46. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Large: 278,184 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
Raises the score by about 6 points · Medium effort · Type Safety
2
Resolve the 40 finding(s) in Cyclomatic Complexity.
Adopt a checker and raise it file by file: with Sorbet, `srb init` (or `bundle exec tapioca init`) commits `sorbet/config`, then move each file's sigil from `# typed: false` to `# typed: true` and on to `strict` as its methods get `sig`s — `spoom bump` does the moving; with Steep, write RBS signatures and `check` the product directories in the `Steepfile` under `D::Ruby.default` or `strict`, not `lenient`.
Then pay down the assertions rather than adding to them: each `T.must` is a nil the checker could not rule out — narrow it (`return unless x`, `x&.`, `if (y = x)`), make the attribute non-nilable and set it in `initialize`, or change the method so the nil cannot arrive.
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €530,000 to build again, about 3.6 person-years of work. Its weakest lens is Code Health, at 33 (Weak). Code Health is about how easy the code is to read and change safely, and code that is hard to read is slow and risky to change, so every future change costs more than it should. Because the weakest lens counts most in the score, work on Code Health also moves the score most.
Based on: the rebuild estimate · the Code Health grade · how much each lens counts
What to do: Start with the Code Health actions in Top priorities.
If you do one thing first · First action
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up. Of all the actions in this report, it raises the score most for the work it takes: about 6 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 6.0 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 12% on every change. The history of the code shows how much it changes: about 378,566 lines over the last 90 days, which is about 1,535,295 lines a year. At that pace, the extra work comes to an estimated 196.3 to 1177.8 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
27 modules, with 59 dependencies between them. One loop runs through 10 of the modules, marked above the diagonal.
Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
Core~PeekabooFoundation~PeekabooFoundation uses Core~PeekabooCore~PeekabooBridge, so a change to Core~PeekabooCore~PeekabooBridge can break Core~PeekabooFoundation~PeekabooFoundation, while a change to Core~PeekabooFoundation~PeekabooFoundation can't break Core~PeekabooCore~PeekabooBridge.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
14→24 Core~PeekabooFoundation~PeekabooFoundation uses Core~PeekabooAutomationKit~PeekabooAutomationKitpart of a loop✕
Connections
7 pairs of types, where a type in Core~PeekabooFoundation~PeekabooFoundation uses a type in Core~PeekabooAutomationKit~PeekabooAutomationKit.
Core~PeekabooFoundation~PeekabooFoundation uses Core~PeekabooAutomationKit~PeekabooAutomationKit, so a change to Core~PeekabooAutomationKit~PeekabooAutomationKit can break Core~PeekabooFoundation~PeekabooFoundation, while a change to Core~PeekabooFoundation~PeekabooFoundation can't break Core~PeekabooAutomationKit~PeekabooAutomationKit.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
50 pairs of types, where a type in Core~PeekabooCore~PeekabooCore uses a type in Core~PeekabooFoundation~PeekabooFoundation. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Core~PeekabooCore~PeekabooCore uses Core~PeekabooFoundation~PeekabooFoundation, so a change to Core~PeekabooFoundation~PeekabooFoundation can break Core~PeekabooCore~PeekabooCore, while a change to Core~PeekabooCore~PeekabooCore can't break Core~PeekabooFoundation~PeekabooFoundation.
Position
Below the diagonal: Core~PeekabooCore~PeekabooCore uses a module listed above it, which is the healthy direction.
15→21 Core~PeekabooCore~PeekabooCore uses Core~PeekabooCore~PeekabooBridgepart of a loop✕
Connections
47 pairs of types, where a type in Core~PeekabooCore~PeekabooCore uses a type in Core~PeekabooCore~PeekabooBridge. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Core~PeekabooCore~PeekabooCore uses Core~PeekabooCore~PeekabooBridge, so a change to Core~PeekabooCore~PeekabooBridge can break Core~PeekabooCore~PeekabooCore, while a change to Core~PeekabooCore~PeekabooCore can't break Core~PeekabooCore~PeekabooBridge.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
15→22 Core~PeekabooCore~PeekabooCore uses Core~PeekabooCore~PeekabooAutomationpart of a loop✕
Connections
4 pairs of types, where a type in Core~PeekabooCore~PeekabooCore uses a type in Core~PeekabooCore~PeekabooAutomation.
Core~PeekabooCore~PeekabooCore uses Core~PeekabooCore~PeekabooAutomation, so a change to Core~PeekabooCore~PeekabooAutomation can break Core~PeekabooCore~PeekabooCore, while a change to Core~PeekabooCore~PeekabooCore can't break Core~PeekabooCore~PeekabooAutomation.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
15→23 Core~PeekabooCore~PeekabooCore uses Core~PeekabooCore~PeekabooAgentRuntimepart of a loop✕
Connections
38 pairs of types, where a type in Core~PeekabooCore~PeekabooCore uses a type in Core~PeekabooCore~PeekabooAgentRuntime. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Core~PeekabooCore~PeekabooCore uses Core~PeekabooCore~PeekabooAgentRuntime, so a change to Core~PeekabooCore~PeekabooAgentRuntime can break Core~PeekabooCore~PeekabooCore, while a change to Core~PeekabooCore~PeekabooCore can't break Core~PeekabooCore~PeekabooAgentRuntime.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
15→24 Core~PeekabooCore~PeekabooCore uses Core~PeekabooAutomationKit~PeekabooAutomationKitpart of a loop✕
Connections
160 pairs of types, where a type in Core~PeekabooCore~PeekabooCore uses a type in Core~PeekabooAutomationKit~PeekabooAutomationKit. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Core~PeekabooCore~PeekabooCore uses Core~PeekabooAutomationKit~PeekabooAutomationKit, so a change to Core~PeekabooAutomationKit~PeekabooAutomationKit can break Core~PeekabooCore~PeekabooCore, while a change to Core~PeekabooCore~PeekabooCore can't break Core~PeekabooAutomationKit~PeekabooAutomationKit.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
15→25 Core~PeekabooCore~PeekabooCore uses Apps~CLI~PeekabooCLIpart of a loop✕
Connections
1 pair of types, where a type in Core~PeekabooCore~PeekabooCore uses a type in Apps~CLI~PeekabooCLI.
Core~PeekabooCore~PeekabooCore uses Apps~CLI~PeekabooCLI, so a change to Apps~CLI~PeekabooCLI can break Core~PeekabooCore~PeekabooCore, while a change to Core~PeekabooCore~PeekabooCore can't break Apps~CLI~PeekabooCLI.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
1 pair of types, where a type in Core~PeekabooExternalDependencies~PeekabooExternalDependencies uses a type in Core~PeekabooFoundation~PeekabooFoundation.
Core~PeekabooExternalDependencies~PeekabooExternalDependencies uses Core~PeekabooFoundation~PeekabooFoundation, so a change to Core~PeekabooFoundation~PeekabooFoundation can break Core~PeekabooExternalDependencies~PeekabooExternalDependencies, while a change to Core~PeekabooExternalDependencies~PeekabooExternalDependencies can't break Core~PeekabooFoundation~PeekabooFoundation.
Position
Below the diagonal: Core~PeekabooExternalDependencies~PeekabooExternalDependencies uses a module listed above it, which is the healthy direction.
42 pairs of types, where a type in Core~PeekabooVisualizer~PeekabooVisualizer uses a type in Core~PeekabooFoundation~PeekabooFoundation. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Core~PeekabooVisualizer~PeekabooVisualizer uses Core~PeekabooFoundation~PeekabooFoundation, so a change to Core~PeekabooFoundation~PeekabooFoundation can break Core~PeekabooVisualizer~PeekabooVisualizer, while a change to Core~PeekabooVisualizer~PeekabooVisualizer can't break Core~PeekabooFoundation~PeekabooFoundation.
Position
Below the diagonal: Core~PeekabooVisualizer~PeekabooVisualizer uses a module listed above it, which is the healthy direction.
17→20 Core~PeekabooVisualizer~PeekabooVisualizer uses repositorypart of a loop✕
Connections
13 pairs of types, where a type in Core~PeekabooVisualizer~PeekabooVisualizer uses a type in repository.
Core~PeekabooVisualizer~PeekabooVisualizer uses repository, so a change to repository can break Core~PeekabooVisualizer~PeekabooVisualizer, while a change to Core~PeekabooVisualizer~PeekabooVisualizer can't break repository.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
17→21 Core~PeekabooVisualizer~PeekabooVisualizer uses Core~PeekabooCore~PeekabooBridgepart of a loop✕
Connections
2 pairs of types, where a type in Core~PeekabooVisualizer~PeekabooVisualizer uses a type in Core~PeekabooCore~PeekabooBridge.
Core~PeekabooVisualizer~PeekabooVisualizer uses Core~PeekabooCore~PeekabooBridge, so a change to Core~PeekabooCore~PeekabooBridge can break Core~PeekabooVisualizer~PeekabooVisualizer, while a change to Core~PeekabooVisualizer~PeekabooVisualizer can't break Core~PeekabooCore~PeekabooBridge.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
17→24 Core~PeekabooVisualizer~PeekabooVisualizer uses Core~PeekabooAutomationKit~PeekabooAutomationKitpart of a loop✕
Connections
26 pairs of types, where a type in Core~PeekabooVisualizer~PeekabooVisualizer uses a type in Core~PeekabooAutomationKit~PeekabooAutomationKit. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Core~PeekabooVisualizer~PeekabooVisualizer uses Core~PeekabooAutomationKit~PeekabooAutomationKit, so a change to Core~PeekabooAutomationKit~PeekabooAutomationKit can break Core~PeekabooVisualizer~PeekabooVisualizer, while a change to Core~PeekabooVisualizer~PeekabooVisualizer can't break Core~PeekabooAutomationKit~PeekabooAutomationKit.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
17→25 Core~PeekabooVisualizer~PeekabooVisualizer uses Apps~CLI~PeekabooCLIpart of a loop✕
Connections
6 pairs of types, where a type in Core~PeekabooVisualizer~PeekabooVisualizer uses a type in Apps~CLI~PeekabooCLI.
Core~PeekabooVisualizer~PeekabooVisualizer uses Apps~CLI~PeekabooCLI, so a change to Apps~CLI~PeekabooCLI can break Core~PeekabooVisualizer~PeekabooVisualizer, while a change to Core~PeekabooVisualizer~PeekabooVisualizer can't break Apps~CLI~PeekabooCLI.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
experiments~cgs-menu-probe~cgs-menu-probe uses Core~PeekabooFoundation~PeekabooFoundation, so a change to Core~PeekabooFoundation~PeekabooFoundation can break experiments~cgs-menu-probe~cgs-menu-probe, while a change to experiments~cgs-menu-probe~cgs-menu-probe can't break Core~PeekabooFoundation~PeekabooFoundation.
Position
Below the diagonal: experiments~cgs-menu-probe~cgs-menu-probe uses a module listed above it, which is the healthy direction.
Core~PeekabooUICore~PeekabooUICore uses Core~PeekabooFoundation~PeekabooFoundation, so a change to Core~PeekabooFoundation~PeekabooFoundation can break Core~PeekabooUICore~PeekabooUICore, while a change to Core~PeekabooUICore~PeekabooUICore can't break Core~PeekabooFoundation~PeekabooFoundation.
Position
Below the diagonal: Core~PeekabooUICore~PeekabooUICore uses a module listed above it, which is the healthy direction.
Core~PeekabooUICore~PeekabooUICore uses Core~PeekabooVisualizer~PeekabooVisualizer, so a change to Core~PeekabooVisualizer~PeekabooVisualizer can break Core~PeekabooUICore~PeekabooUICore, while a change to Core~PeekabooUICore~PeekabooUICore can't break Core~PeekabooVisualizer~PeekabooVisualizer.
Position
Below the diagonal: Core~PeekabooUICore~PeekabooUICore uses a module listed above it, which is the healthy direction.
19→20 Core~PeekabooUICore~PeekabooUICore uses repositorypart of a loop✕
Connections
16 pairs of types, where a type in Core~PeekabooUICore~PeekabooUICore uses a type in repository.
Core~PeekabooUICore~PeekabooUICore uses repository, so a change to repository can break Core~PeekabooUICore~PeekabooUICore, while a change to Core~PeekabooUICore~PeekabooUICore can't break repository.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
19→24 Core~PeekabooUICore~PeekabooUICore uses Core~PeekabooAutomationKit~PeekabooAutomationKitpart of a loop✕
Connections
14 pairs of types, where a type in Core~PeekabooUICore~PeekabooUICore uses a type in Core~PeekabooAutomationKit~PeekabooAutomationKit.
Core~PeekabooUICore~PeekabooUICore uses Core~PeekabooAutomationKit~PeekabooAutomationKit, so a change to Core~PeekabooAutomationKit~PeekabooAutomationKit can break Core~PeekabooUICore~PeekabooUICore, while a change to Core~PeekabooUICore~PeekabooUICore can't break Core~PeekabooAutomationKit~PeekabooAutomationKit.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
19→25 Core~PeekabooUICore~PeekabooUICore uses Apps~CLI~PeekabooCLIpart of a loop✕
Connections
1 pair of types, where a type in Core~PeekabooUICore~PeekabooUICore uses a type in Apps~CLI~PeekabooCLI.
Core~PeekabooUICore~PeekabooUICore uses Apps~CLI~PeekabooCLI, so a change to Apps~CLI~PeekabooCLI can break Core~PeekabooUICore~PeekabooUICore, while a change to Core~PeekabooUICore~PeekabooUICore can't break Apps~CLI~PeekabooCLI.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
163 pairs of types, where a type in repository uses a type in Core~PeekabooFoundation~PeekabooFoundation. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
repository uses Core~PeekabooFoundation~PeekabooFoundation, so a change to Core~PeekabooFoundation~PeekabooFoundation can break repository, while a change to repository can't break Core~PeekabooFoundation~PeekabooFoundation.
Position
Below the diagonal: repository uses a module listed above it, which is the healthy direction.
repository uses Core~PeekabooCore~PeekabooCore, so a change to Core~PeekabooCore~PeekabooCore can break repository, while a change to repository can't break Core~PeekabooCore~PeekabooCore.
Position
Below the diagonal: repository uses a module listed above it, which is the healthy direction.
repository uses Core~PeekabooVisualizer~PeekabooVisualizer, so a change to Core~PeekabooVisualizer~PeekabooVisualizer can break repository, while a change to repository can't break Core~PeekabooVisualizer~PeekabooVisualizer.
Position
Below the diagonal: repository uses a module listed above it, which is the healthy direction.
repository uses Core~PeekabooUICore~PeekabooUICore, so a change to Core~PeekabooUICore~PeekabooUICore can break repository, while a change to repository can't break Core~PeekabooUICore~PeekabooUICore.
Position
Below the diagonal: repository uses a module listed above it, which is the healthy direction.
20→21 repository uses Core~PeekabooCore~PeekabooBridgepart of a loop✕
Connections
11 pairs of types, where a type in repository uses a type in Core~PeekabooCore~PeekabooBridge.
repository uses Core~PeekabooCore~PeekabooBridge, so a change to Core~PeekabooCore~PeekabooBridge can break repository, while a change to repository can't break Core~PeekabooCore~PeekabooBridge.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
20→22 repository uses Core~PeekabooCore~PeekabooAutomationpart of a loop✕
Connections
11 pairs of types, where a type in repository uses a type in Core~PeekabooCore~PeekabooAutomation.
repository uses Core~PeekabooCore~PeekabooAutomation, so a change to Core~PeekabooCore~PeekabooAutomation can break repository, while a change to repository can't break Core~PeekabooCore~PeekabooAutomation.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
20→23 repository uses Core~PeekabooCore~PeekabooAgentRuntimepart of a loop✕
Connections
8 pairs of types, where a type in repository uses a type in Core~PeekabooCore~PeekabooAgentRuntime.
repository uses Core~PeekabooCore~PeekabooAgentRuntime, so a change to Core~PeekabooCore~PeekabooAgentRuntime can break repository, while a change to repository can't break Core~PeekabooCore~PeekabooAgentRuntime.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
20→24 repository uses Core~PeekabooAutomationKit~PeekabooAutomationKitpart of a loop✕
Connections
34 pairs of types, where a type in repository uses a type in Core~PeekabooAutomationKit~PeekabooAutomationKit. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
repository uses Core~PeekabooAutomationKit~PeekabooAutomationKit, so a change to Core~PeekabooAutomationKit~PeekabooAutomationKit can break repository, while a change to repository can't break Core~PeekabooAutomationKit~PeekabooAutomationKit.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
20→25 repository uses Apps~CLI~PeekabooCLIpart of a loop✕
Connections
9 pairs of types, where a type in repository uses a type in Apps~CLI~PeekabooCLI.
repository uses Apps~CLI~PeekabooCLI, so a change to Apps~CLI~PeekabooCLI can break repository, while a change to repository can't break Apps~CLI~PeekabooCLI.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
244 pairs of types, where a type in Core~PeekabooCore~PeekabooBridge uses a type in Core~PeekabooFoundation~PeekabooFoundation. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Core~PeekabooCore~PeekabooBridge uses Core~PeekabooFoundation~PeekabooFoundation, so a change to Core~PeekabooFoundation~PeekabooFoundation can break Core~PeekabooCore~PeekabooBridge, while a change to Core~PeekabooCore~PeekabooBridge can't break Core~PeekabooFoundation~PeekabooFoundation.
Position
Below the diagonal: Core~PeekabooCore~PeekabooBridge uses a module listed above it, which is the healthy direction.
Core~PeekabooCore~PeekabooBridge uses repository, so a change to repository can break Core~PeekabooCore~PeekabooBridge, while a change to Core~PeekabooCore~PeekabooBridge can't break repository.
Position
Below the diagonal: Core~PeekabooCore~PeekabooBridge uses a module listed above it, which is the healthy direction.
21→24 Core~PeekabooCore~PeekabooBridge uses Core~PeekabooAutomationKit~PeekabooAutomationKitpart of a loop✕
Connections
298 pairs of types, where a type in Core~PeekabooCore~PeekabooBridge uses a type in Core~PeekabooAutomationKit~PeekabooAutomationKit. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Core~PeekabooCore~PeekabooBridge uses Core~PeekabooAutomationKit~PeekabooAutomationKit, so a change to Core~PeekabooAutomationKit~PeekabooAutomationKit can break Core~PeekabooCore~PeekabooBridge, while a change to Core~PeekabooCore~PeekabooBridge can't break Core~PeekabooAutomationKit~PeekabooAutomationKit.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
21→25 Core~PeekabooCore~PeekabooBridge uses Apps~CLI~PeekabooCLIpart of a loop✕
Connections
4 pairs of types, where a type in Core~PeekabooCore~PeekabooBridge uses a type in Apps~CLI~PeekabooCLI.
Core~PeekabooCore~PeekabooBridge uses Apps~CLI~PeekabooCLI, so a change to Apps~CLI~PeekabooCLI can break Core~PeekabooCore~PeekabooBridge, while a change to Core~PeekabooCore~PeekabooBridge can't break Apps~CLI~PeekabooCLI.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
38 pairs of types, where a type in Core~PeekabooCore~PeekabooAutomation uses a type in Core~PeekabooFoundation~PeekabooFoundation. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Core~PeekabooCore~PeekabooAutomation uses Core~PeekabooFoundation~PeekabooFoundation, so a change to Core~PeekabooFoundation~PeekabooFoundation can break Core~PeekabooCore~PeekabooAutomation, while a change to Core~PeekabooCore~PeekabooAutomation can't break Core~PeekabooFoundation~PeekabooFoundation.
Position
Below the diagonal: Core~PeekabooCore~PeekabooAutomation uses a module listed above it, which is the healthy direction.
Core~PeekabooCore~PeekabooAutomation uses Core~PeekabooVisualizer~PeekabooVisualizer, so a change to Core~PeekabooVisualizer~PeekabooVisualizer can break Core~PeekabooCore~PeekabooAutomation, while a change to Core~PeekabooCore~PeekabooAutomation can't break Core~PeekabooVisualizer~PeekabooVisualizer.
Position
Below the diagonal: Core~PeekabooCore~PeekabooAutomation uses a module listed above it, which is the healthy direction.
Core~PeekabooCore~PeekabooAutomation uses Core~PeekabooCore~PeekabooBridge, so a change to Core~PeekabooCore~PeekabooBridge can break Core~PeekabooCore~PeekabooAutomation, while a change to Core~PeekabooCore~PeekabooAutomation can't break Core~PeekabooCore~PeekabooBridge.
Position
Below the diagonal: Core~PeekabooCore~PeekabooAutomation uses a module listed above it, which is the healthy direction.
22→24 Core~PeekabooCore~PeekabooAutomation uses Core~PeekabooAutomationKit~PeekabooAutomationKitpart of a loop✕
Connections
9 pairs of types, where a type in Core~PeekabooCore~PeekabooAutomation uses a type in Core~PeekabooAutomationKit~PeekabooAutomationKit.
Core~PeekabooCore~PeekabooAutomation uses Core~PeekabooAutomationKit~PeekabooAutomationKit, so a change to Core~PeekabooAutomationKit~PeekabooAutomationKit can break Core~PeekabooCore~PeekabooAutomation, while a change to Core~PeekabooCore~PeekabooAutomation can't break Core~PeekabooAutomationKit~PeekabooAutomationKit.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
22→25 Core~PeekabooCore~PeekabooAutomation uses Apps~CLI~PeekabooCLIpart of a loop✕
Connections
1 pair of types, where a type in Core~PeekabooCore~PeekabooAutomation uses a type in Apps~CLI~PeekabooCLI.
Core~PeekabooCore~PeekabooAutomation uses Apps~CLI~PeekabooCLI, so a change to Apps~CLI~PeekabooCLI can break Core~PeekabooCore~PeekabooAutomation, while a change to Core~PeekabooCore~PeekabooAutomation can't break Apps~CLI~PeekabooCLI.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
399 pairs of types, where a type in Core~PeekabooCore~PeekabooAgentRuntime uses a type in Core~PeekabooFoundation~PeekabooFoundation. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Core~PeekabooCore~PeekabooAgentRuntime uses Core~PeekabooFoundation~PeekabooFoundation, so a change to Core~PeekabooFoundation~PeekabooFoundation can break Core~PeekabooCore~PeekabooAgentRuntime, while a change to Core~PeekabooCore~PeekabooAgentRuntime can't break Core~PeekabooFoundation~PeekabooFoundation.
Position
Below the diagonal: Core~PeekabooCore~PeekabooAgentRuntime uses a module listed above it, which is the healthy direction.
Core~PeekabooCore~PeekabooAgentRuntime uses repository, so a change to repository can break Core~PeekabooCore~PeekabooAgentRuntime, while a change to Core~PeekabooCore~PeekabooAgentRuntime can't break repository.
Position
Below the diagonal: Core~PeekabooCore~PeekabooAgentRuntime uses a module listed above it, which is the healthy direction.
Core~PeekabooCore~PeekabooAgentRuntime uses Core~PeekabooCore~PeekabooAutomation, so a change to Core~PeekabooCore~PeekabooAutomation can break Core~PeekabooCore~PeekabooAgentRuntime, while a change to Core~PeekabooCore~PeekabooAgentRuntime can't break Core~PeekabooCore~PeekabooAutomation.
Position
Below the diagonal: Core~PeekabooCore~PeekabooAgentRuntime uses a module listed above it, which is the healthy direction.
23→24 Core~PeekabooCore~PeekabooAgentRuntime uses Core~PeekabooAutomationKit~PeekabooAutomationKitpart of a loop✕
Connections
314 pairs of types, where a type in Core~PeekabooCore~PeekabooAgentRuntime uses a type in Core~PeekabooAutomationKit~PeekabooAutomationKit. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Core~PeekabooCore~PeekabooAgentRuntime uses Core~PeekabooAutomationKit~PeekabooAutomationKit, so a change to Core~PeekabooAutomationKit~PeekabooAutomationKit can break Core~PeekabooCore~PeekabooAgentRuntime, while a change to Core~PeekabooCore~PeekabooAgentRuntime can't break Core~PeekabooAutomationKit~PeekabooAutomationKit.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
23→25 Core~PeekabooCore~PeekabooAgentRuntime uses Apps~CLI~PeekabooCLIpart of a loop✕
Connections
26 pairs of types, where a type in Core~PeekabooCore~PeekabooAgentRuntime uses a type in Apps~CLI~PeekabooCLI. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Core~PeekabooCore~PeekabooAgentRuntime uses Apps~CLI~PeekabooCLI, so a change to Apps~CLI~PeekabooCLI can break Core~PeekabooCore~PeekabooAgentRuntime, while a change to Core~PeekabooCore~PeekabooAgentRuntime can't break Apps~CLI~PeekabooCLI.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
820 pairs of types, where a type in Core~PeekabooAutomationKit~PeekabooAutomationKit uses a type in Core~PeekabooFoundation~PeekabooFoundation. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Core~PeekabooAutomationKit~PeekabooAutomationKit uses Core~PeekabooFoundation~PeekabooFoundation, so a change to Core~PeekabooFoundation~PeekabooFoundation can break Core~PeekabooAutomationKit~PeekabooAutomationKit, while a change to Core~PeekabooAutomationKit~PeekabooAutomationKit can't break Core~PeekabooFoundation~PeekabooFoundation.
Position
Below the diagonal: Core~PeekabooAutomationKit~PeekabooAutomationKit uses a module listed above it, which is the healthy direction.
Core~PeekabooAutomationKit~PeekabooAutomationKit uses repository, so a change to repository can break Core~PeekabooAutomationKit~PeekabooAutomationKit, while a change to Core~PeekabooAutomationKit~PeekabooAutomationKit can't break repository.
Position
Below the diagonal: Core~PeekabooAutomationKit~PeekabooAutomationKit uses a module listed above it, which is the healthy direction.
Core~PeekabooAutomationKit~PeekabooAutomationKit uses Core~PeekabooCore~PeekabooBridge, so a change to Core~PeekabooCore~PeekabooBridge can break Core~PeekabooAutomationKit~PeekabooAutomationKit, while a change to Core~PeekabooAutomationKit~PeekabooAutomationKit can't break Core~PeekabooCore~PeekabooBridge.
Position
Below the diagonal: Core~PeekabooAutomationKit~PeekabooAutomationKit uses a module listed above it, which is the healthy direction.
Core~PeekabooAutomationKit~PeekabooAutomationKit uses Core~PeekabooCore~PeekabooAgentRuntime, so a change to Core~PeekabooCore~PeekabooAgentRuntime can break Core~PeekabooAutomationKit~PeekabooAutomationKit, while a change to Core~PeekabooAutomationKit~PeekabooAutomationKit can't break Core~PeekabooCore~PeekabooAgentRuntime.
Position
Below the diagonal: Core~PeekabooAutomationKit~PeekabooAutomationKit uses a module listed above it, which is the healthy direction.
24→25 Core~PeekabooAutomationKit~PeekabooAutomationKit uses Apps~CLI~PeekabooCLIpart of a loop✕
Connections
35 pairs of types, where a type in Core~PeekabooAutomationKit~PeekabooAutomationKit uses a type in Apps~CLI~PeekabooCLI. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Core~PeekabooAutomationKit~PeekabooAutomationKit uses Apps~CLI~PeekabooCLI, so a change to Apps~CLI~PeekabooCLI can break Core~PeekabooAutomationKit~PeekabooAutomationKit, while a change to Core~PeekabooAutomationKit~PeekabooAutomationKit can't break Apps~CLI~PeekabooCLI.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
496 pairs of types, where a type in Apps~CLI~PeekabooCLI uses a type in Core~PeekabooFoundation~PeekabooFoundation. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Apps~CLI~PeekabooCLI uses Core~PeekabooFoundation~PeekabooFoundation, so a change to Core~PeekabooFoundation~PeekabooFoundation can break Apps~CLI~PeekabooCLI, while a change to Apps~CLI~PeekabooCLI can't break Core~PeekabooFoundation~PeekabooFoundation.
Position
Below the diagonal: Apps~CLI~PeekabooCLI uses a module listed above it, which is the healthy direction.
Apps~CLI~PeekabooCLI uses Core~PeekabooCore~PeekabooCore, so a change to Core~PeekabooCore~PeekabooCore can break Apps~CLI~PeekabooCLI, while a change to Apps~CLI~PeekabooCLI can't break Core~PeekabooCore~PeekabooCore.
Position
Below the diagonal: Apps~CLI~PeekabooCLI uses a module listed above it, which is the healthy direction.
42 pairs of types, where a type in Apps~CLI~PeekabooCLI uses a type in Core~PeekabooCore~PeekabooBridge. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Apps~CLI~PeekabooCLI uses Core~PeekabooCore~PeekabooBridge, so a change to Core~PeekabooCore~PeekabooBridge can break Apps~CLI~PeekabooCLI, while a change to Apps~CLI~PeekabooCLI can't break Core~PeekabooCore~PeekabooBridge.
Position
Below the diagonal: Apps~CLI~PeekabooCLI uses a module listed above it, which is the healthy direction.
Apps~CLI~PeekabooCLI uses Core~PeekabooCore~PeekabooAutomation, so a change to Core~PeekabooCore~PeekabooAutomation can break Apps~CLI~PeekabooCLI, while a change to Apps~CLI~PeekabooCLI can't break Core~PeekabooCore~PeekabooAutomation.
Position
Below the diagonal: Apps~CLI~PeekabooCLI uses a module listed above it, which is the healthy direction.
57 pairs of types, where a type in Apps~CLI~PeekabooCLI uses a type in Core~PeekabooCore~PeekabooAgentRuntime. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Apps~CLI~PeekabooCLI uses Core~PeekabooCore~PeekabooAgentRuntime, so a change to Core~PeekabooCore~PeekabooAgentRuntime can break Apps~CLI~PeekabooCLI, while a change to Apps~CLI~PeekabooCLI can't break Core~PeekabooCore~PeekabooAgentRuntime.
Position
Below the diagonal: Apps~CLI~PeekabooCLI uses a module listed above it, which is the healthy direction.
377 pairs of types, where a type in Apps~CLI~PeekabooCLI uses a type in Core~PeekabooAutomationKit~PeekabooAutomationKit. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Apps~CLI~PeekabooCLI uses Core~PeekabooAutomationKit~PeekabooAutomationKit, so a change to Core~PeekabooAutomationKit~PeekabooAutomationKit can break Apps~CLI~PeekabooCLI, while a change to Apps~CLI~PeekabooCLI can't break Core~PeekabooAutomationKit~PeekabooAutomationKit.
Position
Below the diagonal: Apps~CLI~PeekabooCLI uses a module listed above it, which is the healthy direction.
67 pairs of types, where a type in Apps~CLI~PeekabooCertificationController uses a type in Core~PeekabooFoundation~PeekabooFoundation. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Apps~CLI~PeekabooCertificationController uses Core~PeekabooFoundation~PeekabooFoundation, so a change to Core~PeekabooFoundation~PeekabooFoundation can break Apps~CLI~PeekabooCertificationController, while a change to Apps~CLI~PeekabooCertificationController can't break Core~PeekabooFoundation~PeekabooFoundation.
Position
Below the diagonal: Apps~CLI~PeekabooCertificationController uses a module listed above it, which is the healthy direction.
Apps~CLI~PeekabooCertificationController uses Core~PeekabooCore~PeekabooBridge, so a change to Core~PeekabooCore~PeekabooBridge can break Apps~CLI~PeekabooCertificationController, while a change to Apps~CLI~PeekabooCertificationController can't break Core~PeekabooCore~PeekabooBridge.
Position
Below the diagonal: Apps~CLI~PeekabooCertificationController uses a module listed above it, which is the healthy direction.
31 pairs of types, where a type in Apps~CLI~PeekabooCertificationController uses a type in Core~PeekabooAutomationKit~PeekabooAutomationKit. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
Apps~CLI~PeekabooCertificationController uses Core~PeekabooAutomationKit~PeekabooAutomationKit, so a change to Core~PeekabooAutomationKit~PeekabooAutomationKit can break Apps~CLI~PeekabooCertificationController, while a change to Apps~CLI~PeekabooCertificationController can't break Core~PeekabooAutomationKit~PeekabooAutomationKit.
Position
Below the diagonal: Apps~CLI~PeekabooCertificationController uses a module listed above it, which is the healthy direction.
Core~PeekabooProtocols~PeekabooProtocols uses Core~PeekabooFoundation~PeekabooFoundation, so a change to Core~PeekabooFoundation~PeekabooFoundation can break Core~PeekabooProtocols~PeekabooProtocols, while a change to Core~PeekabooProtocols~PeekabooProtocols can't break Core~PeekabooFoundation~PeekabooFoundation.
Position
Below the diagonal: Core~PeekabooProtocols~PeekabooProtocols uses a module listed above it, which is the healthy direction.
Core~PeekabooProtocols~PeekabooProtocols uses Core~PeekabooAutomationKit~PeekabooAutomationKit, so a change to Core~PeekabooAutomationKit~PeekabooAutomationKit can break Core~PeekabooProtocols~PeekabooProtocols, while a change to Core~PeekabooProtocols~PeekabooProtocols can't break Core~PeekabooAutomationKit~PeekabooAutomationKit.
Position
Below the diagonal: Core~PeekabooProtocols~PeekabooProtocols uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 33% · Weak · gated by D2, R1, R2, X5 ·
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2025 — Injection
30
High / Critical
A03:2025 — Software Supply Chain Failures
4
Medium
A07:2025 — Authentication Failures
2
High / Critical
Roadmap
Top priorities: Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up; Resolve the 40 finding(s) in Cyclomatic Complexity; Adopt a checker and raise it file by file: with Sorbet, `srb init` (or `bundle exec tapioca init`) commits `sorbet/config`, then move each file's sigil from `# typed: false` to `# typed: true` and on to `strict` as its methods get `sig`s — `spoom bump` does the moving; with Steep, write RBS signatures and `check` the product directories in the `Steepfile` under `D::Ruby.default` or `strict`, not `lenient`. Then pay down the assertions rather than adding to them: each `T.must` is a nil the checker could not rule out — narrow it (`return unless x`, `x&.`, `if (y = x)`), make the attribute non-nilable and set it in `initialize`, or change the method so the nil cannot arrive.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
Adopt a checker and raise it file by file: with Sorbet, `srb init` (or `bundle exec tapioca init`) commits `sorbet/config`, then move each file's sigil from `# typed: false` to `# typed: true` and on to `strict` as its methods get `sig`s — `spoom bump` does the moving; with Steep, write RBS signatures and `check` the product directories in the `Steepfile` under `D::Ruby.default` or `strict`, not `lenient`. Then pay down the assertions rather than adding to them: each `T.must` is a nil the checker could not rule out — narrow it (`return unless x`, `x&.`, `if (y = x)`), make the attribute non-nilable and set it in `initialize`, or change the method so the nil cannot arrive.
Every finding carries one of four grades. Three say how serious it is. The fourth says this
survey could not settle it — and it is a grade, not a gap.
Critical — 31
A definite problem that already costs you something and drags the score down: a
missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here
tends to cause failures elsewhere.
Serious — 2766
Likely wrong, but not failing yet. It degrades
the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to
carry for two years either.
Minor — 91
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 15
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 55 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.
Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.
What we checked — 55 dimensions across the health lenses
Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.
How to trust any code-health report — three questions
Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 2870 of 2888 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 1,286 test(s) behind this row are the ones the code-model census could read, and this repository also carries at least 47 test source file(s) (.mjs, .rb) that it cannot: it reads the test types the .swift frontend declared, so a suite in any other language is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability NOT MEASURED: the JavaScript/TypeScript suite could not be re-run in the analyzer sandbox — the node:test run in the repository root produced no per-test report (throw new Error(). This is OUR limitation, not a defect in the repo — it is excluded from the score.
D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability for the node:test suite in the repository root was NOT MEASURED: the node:test run in the repository root produced no per-test report (throw new Error(). This is OUR limitation, not a defect in the repository, and the suite is excluded from the measurement rather than counted against it.
D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 2 of this repository's SwiftPM dependencies could not be fetched at a pinned revision and are repositories api.deps.dev has not indexed, so their licences were not read and the verdict does not cover them: axorcist, spinner.
D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares package.json, but the licence verdict published here was taken over its SwiftPM package dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-maintainer repository — bus factor is not applicable (47 contributor(s) across 3908 commit(s) sampled, automation and bot accounts excluded). One of them holds 94% of the history; the other 46 hold 0.1% each on average, below the 5% at which there is somebody to hand the work to. That is a single maintainer with drive-by contributors, not a team whose knowledge has concentrated — so the bus factor is not applicable and there is nothing here for the owner to act on.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `Apps/CLI/Sources/PeekabooCLI/CLI/CommanderMigrationAdvisor.swift`, `Apps/CLI/Sources/PeekabooCLI/CLI/CommanderRuntimeExecutor.swift`, `Apps/CLI/Sources/PeekabooCLI/CLI/CommanderRuntimeRouter+Help.swift`, `Apps/CLI/Sources/PeekabooCLI/CLI/CommanderRuntimeRouter.swift`, `Apps/CLI/Sources/PeekabooCLI/CLI/Output/CLILogger.swift`, … (+305 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
D44 Platform End-of-Life — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This dimension reads a project's own statement about the platform it runs on: a TargetFramework in a .NET project file, a .nvmrc or .python-version, a capped requires-python, a Rust toolchain file or Cargo.toml rust-version, a .go-version, .java-version, .ruby-version, .tool-versions or .sdkmanrc, a go.mod go directive, a Maven or Gradle Java level or toolchain, a Gemfile's ruby directive, a mix.exs elixir requirement, a rebar.config minimum_otp_vsn, a pubspec.yaml SDK constraint, a build.sbt scalaVersion, or a framework major pinned by a dependency constraint. This repository carries none of them, so nothing about its platform was established. That is a gap in this analyzer's coverage, NOT a finding that the platform is supported — a language whose runtime is declared elsewhere (Package.swift, a Dockerfile) is simply not read here yet.
AX1 Captive dependencies — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPPageRoutingContract.swift, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
AXB1 Runtime evidence locked — no reproducible boot — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Subject: a native UI project (Apps/Playground/Playground.xcodeproj/project.pbxproj). The Runtime Evidence tier boots an app only via docker-compose, an Aspire AppHost, a Dockerfile, an npm dev script, a web service's own toolchain entry point (cargo, go, dotnet, Python, Spring Boot), or an Android app's own Gradle wrapper (run on an emulator); an Apple or Flutter app needs a host it lacks. None applied, so no live runtime a11y/egress/header evidence was collected. You can widen what we reach: add a docker-compose.yml (or an Aspire AppHost) that brings the app up with its dependencies. We then boot it in an isolated sandbox and gathers real runtime evidence — you change nothing in your pipeline (no CI step, no SDK).
C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
C2 Access Controls — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
C3 Audit Trail — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Swift is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Swift is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and none applies: this repository publishes a library and deploys nothing (no container, IaC or deployment manifest), so it holds no runtime state of its own. Any data-access dependency it declares is the store it is a CLIENT for, not one it operates. The DR control belongs to whoever runs that data.
PF3 Async & latency hygiene — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 35 further occurrence(s) are not listed individually; the score already reflects all 75.
R10 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 44 further occurrence(s) are not listed individually; the score already reflects all 84.
R2 Cyclomatic Complexity — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 101 further occurrence(s) are not listed individually; the score already reflects all 141.
S1 Web-Security Posture — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
X10 Duplicated predicate — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 35 further occurrence(s) are not listed individually; the score already reflects all 75.
X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X13 Undrained process stream — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X2 Cancellation propagation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Go, PHP, Dart, Kotlin, Ruby, Scala, Java, Python and Rust source only, and no C# was loaded, and no named async function in this repository's JavaScript/TypeScript, nor any Go, PHP or Dart function or Kotlin suspend function, makes a request that can be cancelled (fetch, axios, ky, ofetch, got, undici, node:http; net/http, net.Dial; amphp; Dio; Ktor, OkHttp), so there is nothing to judge, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 35 further occurrence(s) are not listed individually; the score already reflects all 75.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
388 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was PeekabooBridgeServer.handleHandshake at 134. A further 36 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being PeekabooBridgeRequest.operation at 124 — they are counted neither in the figure above nor in this dimension's score. 15 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequestResponse.swift (PeekabooBridgeRequest.operation at 124), Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationDescriptor.swift (PeekabooBridgeOperationResultSemantics.operationDescriptor at 99), Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolType.swift (ToolType.displayName at 54), Core/PeekabooFoundation/Sources/PeekabooFoundation/PeekabooError.swift (PeekabooError.errorDescription at 41), Apps/Mac/Peekaboo/Features/Main/AnimatedToolIcon.swift (AnimatedToolIcon.symbolName at 25), and 10 more not listed here. They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.
+ 382 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 3 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with PeekabooBridgeServer.handleHandshake (cyclomatic 134), PeekabooBridgeAgentExecutionTraceResponse.validate (cyclomatic 107), PeekabooBridgeOperationResultSemantics.deliveryRules (cyclomatic 81). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 3 together lifts Cyclomatic Complexity from 5.0 to about 6.1/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 538 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 5 bodies over 60 down to 60 or less in Cognitive Complexity — start with PeekabooBridgeServer.handleHandshake (cognitive 139), PeekabooBridgeAgentExecutionTraceResponse.validate (cognitive 106), TypeService.performTypeActions (cognitive 71). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 5 together lifts Cognitive Complexity from 3.7 to about 5.3/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes7.3 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
Resolve the 97 FileTooLong finding(s) in God Classes — start with BrowserMCPSessionManager.swift, PeekabooBridgeOperationResultSemantics.swift, PeekabooBridgeClient.swift. — One of this dimension's main actionable groups (97 warning-level).
Resolve the 88 MethodTooLong finding(s) in God Classes — start with PeekabooBridgeOperationResultSemantics.swift (3), PeekabooBridgeServer+Handlers.swift (3), PasteTool.swift (3). — One of this dimension's main actionable groups (88 warning-level).
Resolve the 51 TooManyMethods finding(s) in God Classes — start with PeekabooBridgeClient.swift, PeekabooBridgeServer.swift, PeekabooAgentService.swift. — One of this dimension's main actionable groups (51 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
509 duplicated block group(s) detected. 9.9 % of the production lines (27,482 of 278,184) are in a reported copy. A further 575 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 67 of the 1084 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.
+ 223 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 37 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with PeekabooBridgeAgentExecutionSupport.swift (2), MenuBarPopoverDetector.swift (2), CaptureActionProcessRunner.swift. — One of this dimension's main actionable groups (37 warning-level).
Resolve the 34 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with AgentChatEventDelegate.swift (2), PeekabooBridgeCertificationProducerAttestationModels.swift (2), background-computer-use-probe.swift (2). — One of this dimension's main actionable groups (34 warning-level).
Resolve the 33 Duplicated block (12 lines × 2) finding(s) in Code Duplication — start with UIAutomationService+TypingOperations.swift (3), UIAutomationService+Operations.swift (2), background-computer-use-probe.swift (2). — One of this dimension's main actionable groups (33 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling8.8 / 10Strong✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
22 production modules (npm+SwiftPM), 0 dependency cycle(s), 1 unstable depended-on module(s). Read from the build's own module declarations; 2 module(s) off the main sequence, with abstractness counted on 17 of the 22 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).
Off the main sequence: PeekabooFoundation (Core/PeekabooFoundation) · ×2
Unstable project PeekabooAgentRuntime
What to do
Resolve the 2 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (2 warning-level).
Resolve the 1 Unstable project PeekabooAgentRuntime finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 18 Low cohesion finding(s) in Cohesion (LCOM4) — start with RemoteWindowManagementService.swift, CoordinateTransformer.swift, WindowManagementService.swift. — One of this dimension's main actionable groups (18 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D10 · Test Quality8.6 / 10Strong✓ Tool-verified
What it measures: Whether the tests truly assert behaviour rather than just running the code.
Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.
15 skipped (8 with a documented reason), 108 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 1286 tests. Measured on the .swift suite only — at least 47 test source file(s) (.mjs, .rb) went unread, so its test quality is unmeasured and is not in these counts.
No assertions: · ×108Apps/CLI/Tests/CLIAutomationTests/ConfigGuidanceSnapshotTests.swift:6
Resolve the 108 No assertions finding(s) in Test Quality — start with ClickServiceTests.swift (4), DesktopObservationServiceTests.swift (3), ClipboardSlotFidelityTests.swift (2). — One of this dimension's main actionable groups (108 warning-level).
Resolve the 7 Skipped test finding(s) in Test Quality — start with AXTreeCollectorBudgetTests.swift (6), ClipboardTemporaryWriteTests.swift. — One of this dimension's main actionable groups (7 warning-level).
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.
2 outdated direct SwiftPM dependencies, 1 pinning defect(s). 4 of 16 direct dependencies had their releases listed (0 naming no readable repository, 12 pinned to a branch or a revision rather than a version). SwiftPM has no package registry: a dependency is a repository URL and its releases are that repository's semver tags, so currency is answered by listing tags rather than by querying an index. Only a newer tag on the SAME MAJOR is reported — a `from:` requirement admits everything below the next major and nothing above it, so a major crossing needs a Package.swift edit rather than an update, and naming the update as its remedy would be wrong. Whether any dependency is DEPRECATED or ABANDONED is not graded and cannot be: a repository publishes no such marker, and there is no registry that could carry one. Known CVEs in this dependency graph are D30's question.
No Package.resolved committed (Apps/CLI/Package.swift)
Outdated: sparkle · ×2
What to do
Resolve the 1 No Package.resolved committed (Apps/CLI/Package.swift) finding(s) in Dependency Hygiene. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
REDACTED scan ran and found no leaked secrets. 1 detection(s) were excluded as holding no minted credential in material that runs: a name, reference or comparison rather than a value, a readable phrase or pattern, a value that declares itself fake, or development, test, example, mock or demo material.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 17 SwiftPM package(s) use a banned license. SwiftPM has no package registry, so each package's licence is the one its repository declares: 14 of them read from the licence file the repository carries at the revision Package.resolved pins, and 3 — unpinned, or whose licence file could not be read or named — from api.deps.dev, which reports the licence the repository declares today. Graded: every package a committed Package.resolved pins, direct and transitive, and every declared dependency none pins. 11 of them are declared by a manifest that commits no Package.resolved (a library, whose resolution is its consumer's), so their own dependencies are resolved by whoever builds it and are not in this verdict. 2 of them declare no licence that matches a known SPDX licence; that is missing data, not a violation, and none of them is charged. ★ 2 package(s) could not be read at a pinned revision and are not known to the index, and were NOT graded — this verdict does not cover them: `axorcist`, `spinner`. ★ COVERAGE OF THIS VERDICT: it grades this repository's SwiftPM package dependencies and nothing else. The repository also declares package.json, and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Top hotspots: Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handshake.swift (22×134=2948); Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift (29×81=2349); scripts/finalize-multi-target-certification.mjs (10×155=1550) Repeated repair below the complexity floor: Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationSessionClaim.swift (11 of 16 changes were fixes); Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandRuntime.swift (10 of 16 changes were fixes); Core/PeekabooCore/Sources/PeekabooCore/Support/RemotePeekabooServices.swift (9 of 16 changes were fixes)
Resolve the 75 Hotspot finding(s) in Churn × Complexity Hotspots — start with PeekabooBridgeServer+Handshake.swift, PeekabooBridgeOperationResultSemantics.swift, finalize-multi-target-certification.mjs. — One of this dimension's main actionable groups (75 warning-level).
Resolve the 54 Repeated repair finding(s) in Churn × Complexity Hotspots — start with PeekabooBridgeOperationSessionClaim.swift, CommandRuntime.swift, RemotePeekabooServices.swift. — One of this dimension's main actionable groups (54 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
0 deducted task-comment markers across 278184 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.
1 of 1 documentation facets pass in full. 124 document(s) read across 1 unit(s).
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with package.json. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Seven vocabulary-free rules (N1-N7) mine each naming convention from the repository and flag a name that breaks a convention its structural peers in the same unit follow; production C# and TypeScript, each its own population. Deterministic, no model, no sample. Advisory.
7 naming inconsistencies among 214 declarations measured against a convention their peers follow.
`durationMS` spells `MS` where 36 names in the project spell it `Ms` · ×2Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationResultModels.swift:7
`ollamaBaseUrl` spells `Url` where 74 names in the project spell it `URL` · ×2Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/Configuration.swift:49
`browserUrl` spells `Url` where 67 names in the project spell it `URL`Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserCommand.swift:41
`highlightJson` spells `Json` where 18 names in the project spell it `JSON`scripts/build-docs-site.mjs:885
`caseId` spells `Id` where 19 names in the project spell it `ID`scripts/validate-background-computer-use-report.mjs:9
What to do
Resolve the 2 `durationMS` spells `MS` where 36 names in the project spell it `Ms` finding(s) in Naming Consistency — start with DesktopObservationResultModels.swift (2). — One of this dimension's main actionable groups (2 recommendation-level).
Resolve the 2 `ollamaBaseUrl` spells `Url` where 74 names in the project spell it… finding(s) in Naming Consistency — start with Configuration.swift (2). — One of this dimension's main actionable groups (2 recommendation-level).
Resolve the 1 `browserUrl` spells `Url` where 67 names in the project spell it `URL` finding(s) in Naming Consistency — start with BrowserCommand.swift. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d21_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).
Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.
5 of 114 judged comments only repeat the code they sit on (4.4 %). 2 comment(s) in another language or script were not judged.
redundant commentREDACTED:238
What to do
Resolve the 1 redundant comment finding(s) in Comment Value — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d24_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D26 · Project Cohesion4.0 / 10Weak✓ Tool-verified
What it measures: Whether each project is a focused, coherent unit rather than an oversized grab-bag.
4 of 13 build units (SwiftPM, npm) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.
Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.
Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.
8 % of calls cross a namespace and 1 % go through an interface, but 100 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
1 finding(s): 0 critical, 1 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
What to do
Resolve the 1 REDACTED finding(s) in Secrets (history) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
30 finding(s): 0 critical, 30 high, 0 medium, 0 low. 25 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 16 file(s) — `Apps/CLI/Tests/CoreCLITests/AgentCommandAutomationEventTests.swift` (line 12, line 56, line 62, …), `Apps/Mac/Peekaboo/Core/PeekabooAppLaunchPolicy.swift` (lines 66–68), `Apps/Mac/Peekaboo/Core/Settings.swift` (line 674, line 675, line 685, …), `Apps/Mac/PeekabooTests/Services/SettingsServiceTests.swift` (lines 8–12, line 16, line 17, …), `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift` (lines 8–106, line 189, line 212, …), … (+11 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 1 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
No action in Static Analysis (SAST) — all 24 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (24 issue-level, 0 of them charged here).
No action in Static Analysis (SAST) — all 1 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (1 issue-level, 0 of them charged here).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
6 of 866 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is Apps/CLI/Sources/PeekabooCLI/CLI/Completions/CompletionModel.swift. Counted over 866 of the 1106 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 13 Change coupling finding(s) in Change Coupling — start with ClickCommand.swift (2), CommanderBinder.swift, SpaceCommand.swift. — One of this dimension's main actionable groups (13 warning-level).
Resolve the 1 Change-coupling hub finding(s) in Change Coupling — start with DockCommand.swift. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Do you agree with this assessment?
AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified
Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.
Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.
Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.
Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.
Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.
Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
Do you agree with this assessment?
P2 · Observability5.8 / 10Adequate✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Only 7/12 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `.`, `Apps/CLI/TestFixtures/BackgroundHotkeyProbe`, `Apps/CLI/TestHost`, `Apps/PeekabooInspector`.
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
`package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — package.json:95
What to do
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
`sleep` is async and calls sleep — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs. (×5) — Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:851, Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:858, Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:18, …
`rightClickDockItemImpl` is async and calls usleep — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs. — Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService+Actions.swift:162
`postHotkey` is async and calls usleep — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs. — Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/HotkeyService.swift:456
`resolveSessionCreation` is async and calls .wait() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs. — Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceipts.swift:691
`automate` is async and calls .wait() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs. — Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+Automation.swift:14
`performAutomationAction` is async and calls .wait() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs. — Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+Automation.swift:107
`fs.existsSync` in `waitForInspectorReceipt` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:4235
`fs.realpathSync` in `inspectCodeIdentity` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — scripts/finalize-multi-target-certification.mjs:4280, scripts/finalize-multi-target-certification.mjs:4349
`fs.mkdtempSync` in `inspectCodeIdentity` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:4281
`fs.chmodSync` in `inspectCodeIdentity` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:4283
`fs.readdirSync` in `inspectCodeIdentity` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:4371
`fs.rmSync` in `inspectCodeIdentity` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:4403
`fs.realpathSync` in `stageCodeIdentityInspector` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — scripts/finalize-multi-target-certification.mjs:4414, scripts/finalize-multi-target-certification.mjs:4416
`fs.mkdtempSync` in `stageCodeIdentityInspector` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:4417
`fs.chmodSync` in `stageCodeIdentityInspector` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×3) — scripts/finalize-multi-target-certification.mjs:4419, scripts/finalize-multi-target-certification.mjs:4436, scripts/finalize-multi-target-certification.mjs:4508
`fs.writeFileSync` in `stageCodeIdentityInspector` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — scripts/finalize-multi-target-certification.mjs:4422, scripts/finalize-multi-target-certification.mjs:4429
`fs.readdirSync` in `stageCodeIdentityInspector` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:4424
`fs.lstatSync` in `stageCodeIdentityInspector` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:4437
`fs.rmSync` in `stageCodeIdentityInspector` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:4509
`fs.realpathSync` in `verifyLiveMonitorRuntime` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:4751
`fs.lstatSync` in `verifyLiveMonitorRuntime` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:4798
`fs.readdirSync` in `verifyLiveMonitorRuntime` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:4814
`fs.realpathSync` in `verifyLiveControllerRuntime` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:4840
`fs.realpathSync` in `verifyLiveForegroundObserverRuntime` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:4894
`fs.realpathSync` in `runStagedPIDAttestationCommand` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:5036
`fs.mkdtempSync` in `runLivePIDAttestation` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:5117
`fs.chmodSync` in `runLivePIDAttestation` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:5118
`fs.rmSync` in `runLivePIDAttestation` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:5186
`spawnSync` in `anonymous function` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:5257
`fs.readFileSync` in `runCLI` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/finalize-multi-target-certification.mjs:5367
`fs.existsSync` in `anonymous function` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/run-live-multi-target-certification.mjs:966
What to do
Swift: await instead of blocking — `try await Task.sleep(for:)` for Thread.sleep/sleep, a checked continuation instead of a DispatchSemaphore or DispatchGroup wait, the async Process and URLSession APIs; never park a thread waiting on a Task — the cooperative pool cannot guarantee it progress.
TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
Do you agree with this assessment?
R1 · Type Safety0.0 / 10Critical✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
0 typed · 77 plain JS — the untyped files are peekaboo-mcp.js, scripts/build-docs-site.mjs, scripts/controller-source-manifest.mjs, scripts/docs-lint.mjs, scripts/docs-list.mjs, scripts/docs-site-assets.mjs (+71 more).
What to do
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.
scripts/finalize-multi-target-certification.mjs:4083 · scripts/run-live-multi-target-certification.mjs:181 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — scripts/finalize-multi-target-certification.mjs:4083
scripts/final-qualification/qualification-manifest.mjs:2935 · scripts/final-qualification/qualification-manifest.mjs:3557 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/final-qualification/qualification-manifest.mjs:2935
scripts/controller-source-manifest.mjs:9 · scripts/validate-terminal-artifact-manifest.mjs:11 — the two spans are one implementation copied and then locally edited — 333 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — scripts/controller-source-manifest.mjs:9
scripts/final-qualification/qualification-manifest.mjs:1946 · scripts/final-qualification/validate-concurrent-run.mjs:191 — the two spans are one implementation copied and then locally edited — 163 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — scripts/final-qualification/qualification-manifest.mjs:1946
scripts/finalize-multi-target-certification.mjs:108 · scripts/run-live-multi-target-certification.mjs:84 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/finalize-multi-target-certification.mjs:108
scripts/finalize-multi-target-certification.mjs:4376 · scripts/finalize-multi-target-certification.mjs:5051 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/finalize-multi-target-certification.mjs:4376
scripts/finalize-multi-target-certification.mjs:4314 · scripts/finalize-multi-target-certification.mjs:4992 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — scripts/finalize-multi-target-certification.mjs:4314
scripts/final-qualification/qualification-manifest.mjs:2348 · scripts/final-qualification/qualification-manifest.mjs:2393 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/final-qualification/qualification-manifest.mjs:2348
scripts/final-qualification/qualification-manifest.mjs:3141 · scripts/final-qualification/qualification-manifest.mjs:3709 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/final-qualification/qualification-manifest.mjs:3141
scripts/finalize-multi-target-certification.mjs:2124 · scripts/run-live-multi-target-certification.mjs:918 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/finalize-multi-target-certification.mjs:2124
scripts/final-qualification/executable-policy-scanner.mjs:357 · scripts/final-qualification/executable-policy-scanner.mjs:384 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/final-qualification/executable-policy-scanner.mjs:357
scripts/final-qualification/project-live-bindings.mjs:254 · scripts/final-qualification/publish-coordinator-marker.mjs:113 · scripts/final-qualification/validate-concurrent-run.mjs:1133 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/final-qualification/project-live-bindings.mjs:254
scripts/final-qualification/qualification-manifest.mjs:2628 · scripts/final-qualification/qualification-manifest.mjs:2650 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/final-qualification/qualification-manifest.mjs:2628
scripts/build-docs-site.mjs:856 · scripts/build-docs-site.mjs:920 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — scripts/build-docs-site.mjs:856
scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:63 · scripts/final-qualification/validate-concurrent-run.mjs:47 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:63
scripts/finalize-multi-target-certification.mjs:2894 · scripts/finalize-multi-target-certification.mjs:2925 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/finalize-multi-target-certification.mjs:2894
scripts/finalize-multi-target-certification.mjs:3418 · scripts/finalize-multi-target-certification.mjs:3456 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — scripts/finalize-multi-target-certification.mjs:3418
scripts/final-qualification/executable-policy-scanner.mjs:409 · scripts/final-qualification/executable-policy-scanner.mjs:432 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — scripts/final-qualification/executable-policy-scanner.mjs:409
scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:85 · scripts/final-qualification/qualification-manifest.mjs:619 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:85
scripts/final-qualification/executable-policy-scanner.mjs:1394 · scripts/final-qualification/qualification-manifest.mjs:3845 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/final-qualification/executable-policy-scanner.mjs:1394
scripts/final-qualification/lib.mjs:763 · scripts/final-qualification/qualification-manifest.mjs:1964 — the two spans are one implementation copied and then locally edited — 71 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — scripts/final-qualification/lib.mjs:763
scripts/test-chrome-devtools-mcp-contract.mjs:264 · scripts/test-chrome-devtools-mcp-contract.mjs:278 · scripts/test-chrome-devtools-mcp-contract.mjs:290 · scripts/test-chrome-devtools-mcp-contract.mjs:302 — all 4 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/test-chrome-devtools-mcp-contract.mjs:264
scripts/final-qualification/executable-policy-scanner.mjs:956 · scripts/final-qualification/executable-policy-scanner.mjs:974 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/final-qualification/executable-policy-scanner.mjs:956
scripts/finalize-multi-target-certification.mjs:3359 · scripts/finalize-multi-target-certification.mjs:4010 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/finalize-multi-target-certification.mjs:3359
scripts/finalize-multi-target-certification.mjs:4429 · scripts/finalize-multi-target-certification.mjs:4591 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/finalize-multi-target-certification.mjs:4429
scripts/finalize-multi-target-certification.mjs:4632 · scripts/finalize-multi-target-certification.mjs:4695 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — scripts/finalize-multi-target-certification.mjs:4632
scripts/final-qualification/process-tree-collector.mjs:133 · scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:58 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/final-qualification/process-tree-collector.mjs:133
scripts/final-qualification/qualification-manifest.mjs:3864 · scripts/final-qualification/qualification-manifest.mjs:3884 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/final-qualification/qualification-manifest.mjs:3864
scripts/finalize-multi-target-certification.mjs:346 · scripts/run-live-multi-target-certification.mjs:292 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/finalize-multi-target-certification.mjs:346
scripts/finalize-multi-target-certification.mjs:451 · scripts/finalize-multi-target-certification.mjs:4174 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/finalize-multi-target-certification.mjs:451
scripts/test-terminal-archive-policy.mjs:248 · scripts/test-terminal-archive-policy.mjs:264 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/test-terminal-archive-policy.mjs:248
scripts/final-qualification/crash-inventory.mjs:146 · scripts/final-qualification/executable-policy-scanner.mjs:1393 · scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:549 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/final-qualification/crash-inventory.mjs:146
scripts/final-qualification/lib.mjs:822 · scripts/run-live-multi-target-certification.mjs:403 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — scripts/final-qualification/lib.mjs:822
scripts/final-qualification/lib.mjs:845 · scripts/final-qualification/managed-launcher.mjs:144 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/final-qualification/lib.mjs:845
scripts/finalize-multi-target-certification.mjs:728 · scripts/finalize-multi-target-certification.mjs:737 · scripts/finalize-multi-target-certification.mjs:746 · scripts/finalize-multi-target-certification.mjs:755 — all 4 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/finalize-multi-target-certification.mjs:728
scripts/finalize-multi-target-certification.mjs:4418 · scripts/finalize-multi-target-certification.mjs:4570 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/finalize-multi-target-certification.mjs:4418
REDACTED:795 · REDACTED:821 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:795
scripts/release-preflight-contract.mjs:56 · scripts/validate-background-computer-use-report.mjs:17 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — scripts/release-preflight-contract.mjs:56
scripts/run-live-multi-target-certification.mjs:519 · scripts/run-live-multi-target-certification.mjs:1222 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/run-live-multi-target-certification.mjs:519
scripts/test-terminal-archive-policy.mjs:327 · scripts/test-terminal-archive-policy.mjs:337 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — scripts/test-terminal-archive-policy.mjs:327
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
React / JS · Architecture — Conformance to the detected frontend architecture layout (feature-sliced / layered src) plus cross-package deep-import rules (D-386).
Method: Conformance to the detected frontend layout (feature-sliced / layered src) plus cross-package deep-import rules, over the module graph. Deterministic.
scripts/test-browser-provider-connection.mjs:8 imports tests/fixtures/devtools-websocket.mjs, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on. — scripts/test-browser-provider-connection.mjs:8
scripts/test-browser-provider-connection.mjs:12 reaches into another package with a relative path (../node_modules/.bin) — import the package by name instead. — scripts/test-browser-provider-connection.mjs:12
scripts/test-browser-provider-connection.mjs:14 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/index.js) — import the package by name instead. — scripts/test-browser-provider-connection.mjs:14
scripts/test-browser-provider-connection.mjs:15 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/BrowserManager.js) — import the package by name instead. — scripts/test-browser-provider-connection.mjs:15
scripts/test-browser-provider-connection.mjs:16 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/config/mcp-options.js) — import the package by name instead. — scripts/test-browser-provider-connection.mjs:16
scripts/test-browser-provider-connection.mjs:132 imports tests/browser-provider-lifecycle.test.mjs, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on. — scripts/test-browser-provider-connection.mjs:132
scripts/test-chrome-devtools-mcp-contract.mjs:9 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/package.json) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:9
scripts/test-chrome-devtools-mcp-contract.mjs:81 reaches into another package with a relative path (../node_modules/.bin) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:81
scripts/test-chrome-devtools-mcp-contract.mjs:84 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/ToolHandler.js) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:84
scripts/test-chrome-devtools-mcp-contract.mjs:88 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/tools/tools.js) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:88
scripts/test-chrome-devtools-mcp-contract.mjs:91 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/config/mcp-options.js) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:91
scripts/test-chrome-devtools-mcp-contract.mjs:188 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/telemetry/ClearcutLogger.js) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:188
scripts/test-chrome-devtools-mcp-contract.mjs:210 reaches into another package with a relative path (../node_modules/.bin) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:210
scripts/test-chrome-devtools-mcp-contract.mjs:269 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/McpPage.js) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:269
scripts/test-chrome-devtools-mcp-contract.mjs:273 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/TextSnapshot.js) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:273
scripts/test-chrome-devtools-mcp-contract.mjs:277 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/McpResponse.js) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:277
scripts/test-chrome-devtools-mcp-contract.mjs:281 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/tools/input.js) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:281
scripts/test-chrome-devtools-mcp-contract.mjs:285 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/formatters/SnapshotFormatter.js) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:285
scripts/test-chrome-devtools-mcp-contract.mjs:289 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/tools/screenshot.js) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:289
scripts/test-chrome-devtools-mcp-contract.mjs:293 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/formatters/IssueFormatter.js) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:293
scripts/test-chrome-devtools-mcp-contract.mjs:297 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/utils/WaitForHelper.js) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:297
scripts/test-chrome-devtools-mcp-contract.mjs:301 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/tools/script.js) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:301
scripts/test-chrome-devtools-mcp-contract.mjs:305 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/tools/pages.js) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:305
scripts/test-chrome-devtools-mcp-contract.mjs:309 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/tools/network.js) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:309
scripts/test-chrome-devtools-mcp-contract.mjs:313 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/TextSnapshot.js) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:313
scripts/test-chrome-devtools-mcp-contract.mjs:317 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/third_party/index.js) — import the package by name instead. — scripts/test-chrome-devtools-mcp-contract.mjs:317
What to do
Fix the listed violations: import through the target package's declared public entry rather than a deep path into its internals or a relative path into its directory (24 rows); move the shared test helper into a source directory production code may depend on (2 rows).
React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.
Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.
thinMachOSlice has cyclomatic complexity 144 and cognitive complexity 235; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/executable-policy-scanner.mjs:806
validateSuccessfulCertificationSummary has cyclomatic complexity 137 and cognitive complexity 85; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/finalize-multi-target-certification.mjs:2870
semanticProcessTree has cyclomatic complexity 104 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/qualification-manifest.mjs:632
parseCodeDirectory has cyclomatic complexity 101 and cognitive complexity 72; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/executable-policy-scanner.mjs:187
runCoordinator has cyclomatic complexity 96 and cognitive complexity 95; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/run-live-multi-target-certification.mjs:1260
semanticConcurrentValidation has cyclomatic complexity 93 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/qualification-manifest.mjs:1513
validateCatalog has cyclomatic complexity 90 and cognitive complexity 62; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/finalize-multi-target-certification.mjs:627
validateContract has cyclomatic complexity 85 and cognitive complexity 69; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/finalize-multi-target-certification.mjs:821
validateLiveMonitorEvidence has cyclomatic complexity 82 and cognitive complexity 74; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/finalize-multi-target-certification.mjs:2301
validateObservationSemantics has cyclomatic complexity 73 and cognitive complexity 49; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/finalize-multi-target-certification.mjs:1412
validateCertification has cyclomatic complexity 70 and cognitive complexity 111; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/validate-background-computer-use-report.mjs:474
extractAndCompare has cyclomatic complexity 67 and cognitive complexity 78; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/validate-terminal-artifact-manifest.mjs:183
validatePlan has cyclomatic complexity 64 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/run-live-multi-target-certification.mjs:660
validateCatalog has cyclomatic complexity 63 and cognitive complexity 76; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/validate-background-computer-use-report.mjs:48
validateCollectorReadiness has cyclomatic complexity 59 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:265
validatePlaygroundAlertLifecycle has cyclomatic complexity 57 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/playground-alert-lifecycle.mjs:270
validateAgentExecutionResponse has cyclomatic complexity 57 and cognitive complexity 31; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/lib.mjs:590
bindStreamPolicyImports has cyclomatic complexity 54 and cognitive complexity 97; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/executable-policy-scanner.mjs:446
verifyDigestClaims has cyclomatic complexity 52 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/finalize-multi-target-certification.mjs:3085
validateCoordinationReceipt has cyclomatic complexity 52 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:150
semanticHeldControllerResult has cyclomatic complexity 51 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/qualification-manifest.mjs:2425
markdownToHtml has cyclomatic complexity 49 and cognitive complexity 82; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/build-docs-site.mjs:267
adjunct has cyclomatic complexity 49 and cognitive complexity 37; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/qualification-manifest.mjs:2607
chainedStartsSegmentCount has cyclomatic complexity 48 and cognitive complexity 84; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/executable-policy-scanner.mjs:661
(anonymous) has cyclomatic complexity 48 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/finalize-multi-target-certification.mjs:977
validateForegroundPostcondition has cyclomatic complexity 47 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/finalize-multi-target-certification.mjs:2508
validateArchiveEntries has cyclomatic complexity 44 and cognitive complexity 54; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/terminal-archive-policy.mjs:93
collectProcessTree has cyclomatic complexity 44 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/process-tree-collector.mjs:385
chainedFixupPolicyImports has cyclomatic complexity 43 and cognitive complexity 45; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/executable-policy-scanner.mjs:744
makeLiveCertificationContract has cyclomatic complexity 41 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/finalize-multi-target-certification.mjs:3613
machOEvidence has cyclomatic complexity 37 and cognitive complexity 39; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/executable-policy-scanner.mjs:1084
validateOperationSemantics has cyclomatic complexity 36 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/finalize-multi-target-certification.mjs:1513
(anonymous) has cyclomatic complexity 36 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/finalize-multi-target-certification.mjs:2979
(anonymous) has cyclomatic complexity 35 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/run-live-multi-target-certification.mjs:965
decodeBundle has cyclomatic complexity 35 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/finalize-multi-target-certification.mjs:1677
validateZipLocalEntries has cyclomatic complexity 34 and cognitive complexity 53; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/terminal-archive-policy.mjs:447
codeDirectoryIdentifiers has cyclomatic complexity 34 and cognitive complexity 36; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/executable-policy-scanner.mjs:185
semanticPeekabooArtifactManifest has cyclomatic complexity 34 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/qualification-manifest.mjs:261
validateNotary has cyclomatic complexity 34 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/validate-terminal-artifact-manifest.mjs:372
semanticValidatorPair has cyclomatic complexity 34 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — scripts/final-qualification/qualification-manifest.mjs:1937
Do you agree with this assessment?
R3 · Large Files10.0 / 10Exemplary✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
Do you agree with this assessment?
R4 · Test Coverage10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.
Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.
tests/codeql-build-graph.test.mjs:228 imports '../Apps/CLI/Sources/PeekabooExec/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — tests/codeql-build-graph.test.mjs:228
Do you agree with this assessment?
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.
Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.
This repository declares test tooling, and the ✓ above records that declaration — but tests/codeql-build-graph.test.mjs cannot be loaded at all: it imports a module that names no file in this repository, so the runner throws while collecting it and none of its cases execute. The wiring is present and the suite it points at does not run as written, which is why the tooling tick must not be read as a statement that the tests pass. Fix the unloadable file(s) — each one is reported with its failing import under Test Coverage — then the declared script exercises what it claims to. — tests/codeql-build-graph.test.mjs:228
Do you agree with this assessment?
R7 · Dead Code9.8 / 10Exemplary✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
Nothing imports this binding — it is safe to review for removal. — scripts/release-preflight-contract.mjs:4
This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it. (×2) — scripts/build-docs-site.mjs:18, scripts/terminal-archive-policy.mjs:225
What to do
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.
Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.
React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.
Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
`catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×40) — Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteBrowserMCPClient.swift:501, Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteBrowserMCPClient.swift:650, Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteScreenCaptureService.swift:190, …
Other · Code Health — Whether Ruby's type checker checks nil and is not undermined by assertions — a file Sorbet reads at `# typed: true` or above, or a Steep target `check`s under its default or strict diagnostics, is one where a method call on a `T.nilable(String)` / `String?` is an error, and each `T.must`, `#: as !nil` or `# steep:ignore NoMethod` is the author telling the checker a value cannot be nil.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
This repository commits no Sorbet configuration (`sorbet/config`) and no `Steepfile`, so nothing type-checks its 1 Ruby product file(s): a nilable value reaches a method call silently and raises `NoMethodError: undefined method … for nil` the first time it is nil. A `# typed:` sigil does nothing without a `sorbet/config` beside the code; a Steep run configured only on a command line is not something this check can read.
What to do
Adopt a checker and raise it file by file: with Sorbet, `srb init` (or `bundle exec tapioca init`) commits `sorbet/config`, then move each file's sigil from `# typed: false` to `# typed: true` and on to `strict` as its methods get `sig`s — `spoom bump` does the moving; with Steep, write RBS signatures and `check` the product directories in the `Steepfile` under `D::Ruby.default` or `strict`, not `lenient`. Then pay down the assertions rather than adding to them: each `T.must` is a nil the checker could not rule out — narrow it (`return unless x`, `x&.`, `if (y = x)`), make the attribute non-nilable and set it in `initialize`, or change the method so the nil cannot arrive.
Do you agree with this assessment?
Reference — by lens
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 3 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 12 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X9 Subsumed condition operand — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 2 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 68 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. No class in this Ruby code is a Rails controller, a Sinatra, Grape or Roda app, a Hanami action or a Rack app (an instance `call(env)`), so no request handler shares state between request threads. No Swift request handler (a Vapor, Hummingbird, Kitura, Swifter or Perfect route handler, as a method or a registered closure) is declared, so no state is shared between request threads. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX6 Interface segregation — no class or module declares an abstract method
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AXB1 Runtime evidence locked — no reproducible boot — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C4 Data Retention — No personal data detected in a persisted data model — no PII-named property (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a SwiftData @Model, a Core Data, Realm, GRDB or Fluent type, a GRDB or SQLite.swift column, or in a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (CoreData, SwiftData, GRDB, RealmSwift, SQLite, Firebase, …) imported either, so this repository keeps no personal data whose lifetime a retention limit would bound.
C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named property (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a SwiftData @Model, a Core Data, Realm, GRDB or Fluent type, a GRDB or SQLite.swift column, or in a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (CoreData, SwiftData, GRDB, RealmSwift, SQLite, Firebase, …) imported either, so this repository keeps no personal data for a data subject to erase, export or consent over.
D11 Test Reliability — Test reliability not measured — JavaScript/TypeScript suite did not run
D16 Bus Factor — single-maintainer repository — bus factor is not applicable
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D22 Internal API Consistency — API consistency is measured on C# only; the exposed JavaScript, Swift surface was not measured.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D25 ADR Conformance — no ADRs to check
D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
D32 Data Compliance (PII/GDPR) — 310 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D44 Platform End-of-Life — Platform end-of-life not assessed — this repository declares no platform this pass reads
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
D8 Code Coverage — Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — the node:test suite in the repository root ran and not one test passed (throw new Error(), so the coverage would describe the failed run, not the code; the Swift half could not be measured — the Swift suite in . produced no coverage export. This repository's production source spans both ecosystems, and no partial figure is published as if it were the whole: coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan.
DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (2 value object(s))
ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and this analysis resolves a call's owner only where the receiver's type is written down in the source. Reported as guidance rather than measured
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JavaScript/TypeScript, Ruby, Swift source, so there is no service whose uptime a failing dependency could take down
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for `Benchmark("…")` in a file importing package-benchmark, or package-benchmark in Package.swift, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
R5 Dependency Freshness — uses a pnpm lockfile — dependency freshness not measured here; JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X1 Async correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X12 Unreachable branch — X12 reached only 9% of this repository's production lines — swift (276,045 lines), c (770 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X13 Undrained process stream — X13 reached only 9% of this repository's production lines — swift (276,045 lines), c (770 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X16 Unfloored truncation loop — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X18 Disposal-pattern correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X2 Cancellation propagation — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X21 Side-effecting pattern guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X25 Inert configuration knob — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X27 Collection changed while being enumerated — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X29 Per-element action decided by a fixed element — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X30 Support guard that admits what it rejects — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X4 Structured logging — This check asks whether log calls keep a message's values apart from its text, which needs a logger that can carry them as fields. This repository's Ruby was read, and it logs through none: the standard library's Logger, which Rails.logger is, takes one finished message and no template arguments or fields (as log4net does in C#), so an interpolated message there loses nothing the API could have kept. The console gem (`Console.info`), SemanticLogger, Ougai and dry-logger would be judged.
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
No assertions: Apps/CLI/Tests/CLIAutomationTests/ConfigGuidanceSnapshotTests.swift:6— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Apps/CLI/Tests/CLIRuntimeTests/BridgeReceiptCLITests.swift:6— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Apps/CLI/Tests/CLIRuntimeTests/CaptureEngineRoutingCLITests.swift:5— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Apps/CLI/Tests/CLIRuntimeTests/DaemonStartupGateTests.swift:20— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Apps/CLI/Tests/CLIRuntimeTests/StaticCommandStartupTests.swift:6— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Apps/CLI/Tests/CertificationControllerTests/CodeIdentityRunnerTests.swift:13— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Apps/CLI/Tests/CertificationControllerTests/OutcomePolicyTests.swift:12— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Apps/CLI/Tests/CoreCLITests/CaptureReadinessRuntimeTests.swift:14— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Apps/CLI/Tests/CoreCLITests/CommandHelpRendererTests.swift:8— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Apps/CLI/Tests/CoreCLITests/ConfigurationMutationReadTests.swift:23— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Apps/CLI/Tests/CoreCLITests/ExactDialogInputRuntimeCapabilityTests.swift:10— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Apps/CLI/Tests/CoreCLITests/ExactWindowROIRuntimeCapabilityTests.swift:18— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Apps/CLI/Tests/CoreCLITests/ExplicitAutoClassicOwnerRuntimeTests.swift:12— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Apps/CLI/Tests/CoreCLITests/InteractionTargetSelectorValidationTests.swift:16— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Apps/CLI/Tests/CoreCLITests/PreRuntimeInvalidInputOrderingTests.swift:9— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Apps/CLI/Tests/CoreCLITests/StatelessClickRuntimeTests.swift:10— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Apps/CLI/Tests/CoreCLITests/WindowTargetCreationTests.swift:8— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Core/PeekabooAutomationKit/Tests/PeekabooAutomationKitTests/AXMutationObservationReaderTests.swift:14— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Core/PeekabooAutomationKit/Tests/PeekabooAutomationKitTests/ApplicationInventoryTimeoutTests.swift:10— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Core/PeekabooAutomationKit/Tests/PeekabooAutomationKitTests/AsyncAXMutationTests.swift:25— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Core/PeekabooAutomationKit/Tests/PeekabooAutomationKitTests/BackgroundInputDriverPositionalTargetTests.swift:12— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Core/PeekabooAutomationKit/Tests/PeekabooAutomationKitTests/BackgroundTextInputDeliveryTests.swift:25— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Core/PeekabooAutomationKit/Tests/PeekabooAutomationKitTests/BackgroundTextInputReceiverTests.swift:12— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: Core/PeekabooAutomationKit/Tests/PeekabooAutomationKitTests/CaptureWindowMainStateTests.swift:9— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: testPlainTextOnlyRestoreKeepsTheExistingStringCompanion Core/PeekabooAutomationKit/Tests/PeekabooAutomationKitTests/ClipboardSlotFidelityTests.swift:114— This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
FileTooLong: Browser/BrowserMCPSessionManager.swift Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift— FileTooLong — 1399 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: BrowserMCPSessionManager (48-1766). The bar is 500 significant lines; this is 899 over it, 2.80× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift— FileTooLong — 1363 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 863 over it, 2.73× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: PeekabooBridge/PeekabooBridgeClient.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift— FileTooLong — 1262 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 762 over it, 2.52× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: Agent/PeekabooAgentService+Streaming.swift Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift— FileTooLong — 1244 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 744 over it, 2.49× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: PeekabooBridge/PeekabooBridgeOperationReceipts.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceipts.swift— FileTooLong — 1239 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 739 over it, 2.48× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: PeekabooBridge/PeekabooBridgeServer+Handlers.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift— FileTooLong — 1237 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 737 over it, 2.47× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: UI/TypeService.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift— FileTooLong — 1235 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 735 over it, 2.47× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: UI/BackgroundInputDriver.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift— FileTooLong — 1230 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 730 over it, 2.46× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: PeekabooBridge/PeekabooBridgeServer.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift— FileTooLong — 1220 significant lines (blank, comment-only and punctuation-only lines excluded), about 82% of them inside a single declaration: PeekabooBridgeServer (71-1325). The bar is 500 significant lines; this is 720 over it, 2.44× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: Browser/BrowserMCPService.swift Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift— FileTooLong — 1209 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 709 over it, 2.42× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: UI/WindowManagementService+StateOperations.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift— FileTooLong — 1189 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 689 over it, 2.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: UI/ActionInputDriver.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift— FileTooLong — 1179 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 679 over it, 2.36× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: PeekabooBridge/PeekabooBridgeHost.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift— FileTooLong — 1176 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 676 over it, 2.35× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift— FileTooLong — 1167 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 667 over it, 2.33× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: Tools/BrowserTool.swift Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift— FileTooLong — 1137 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 637 over it, 2.27× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: Tools/PasteTool.swift Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift— FileTooLong — 1135 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: PasteTool (12-1305). The bar is 500 significant lines; this is 635 over it, 2.27× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: UI/ClickService.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift— FileTooLong — 1134 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 634 over it, 2.27× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: MCP/MCPToolContext.swift Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift— FileTooLong — 1102 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 602 over it, 2.20× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift— FileTooLong — 1095 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 595 over it, 2.19× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: PeekabooBridge/PeekabooBridgeClient+Transport.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift— FileTooLong — 1094 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 594 over it, 2.19× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: PeekabooBridge/PeekabooBridgeBrowserSessionHandoff.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserSessionHandoff.swift— FileTooLong — 1085 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 585 over it, 2.17× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: Core/CaptureCommand+Action.swift Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift— FileTooLong — 1075 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 575 over it, 2.15× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: Utilities/FocusUtilities.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/FocusUtilities.swift— FileTooLong — 1047 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 547 over it, 2.09× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: Tools/ClickTool.swift Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift— FileTooLong — 1044 significant lines (blank, comment-only and punctuation-only lines excluded), about 63% of them inside a single declaration: ClickTool (10-801). The bar is 500 significant lines; this is 544 over it, 2.09× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: System/ApplicationService+Lifecycle.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift— FileTooLong — 1014 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 514 over it, 2.03× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
MethodTooLong: PeekabooBridgeOperationResultSemantics.operationDescriptor Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationDescriptor.swift:22— MethodTooLong — operationDescriptor runs 731 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 631 over it, 7.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PeekabooBridgeServer.handleHandshake Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handshake.swift:31— MethodTooLong — handleHandshake runs 346 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 246 over it, 3.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PeekabooBridgeOperationResultSemantics.deliveryRules Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:727— MethodTooLong — deliveryRules runs 275 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 175 over it, 2.75× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PeekabooBridgeLiveAgentExecutionRunner.runDetached Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionRunner.swift:39— MethodTooLong — runDetached runs 239 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 139 over it, 2.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DialogTool.perform Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DialogTool.swift:226— MethodTooLong — perform runs 156 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 56 over it, 1.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DialogService.executeBackgroundDialogInput Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:137— MethodTooLong — executeBackgroundDialogInput runs 154 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 54 over it, 1.54× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PeekabooBridgeServer.performAttestedOperation Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+OperationReceipts.swift:59— MethodTooLong — performAttestedOperation runs 149 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 49 over it, 1.49× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PeekabooBridgeOperationResultSemantics.typedResponseRule Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:422— MethodTooLong — typedResponseRule runs 146 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 46 over it, 1.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PasteCommand.performClipboardPasteTransaction Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:222— MethodTooLong — performClipboardPasteTransaction runs 143 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 43 over it, 1.43× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: TypeService.executePixelFocusType Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:1254— MethodTooLong — executePixelFocusType runs 141 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 41 over it, 1.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PeekabooBridgeServer.handleAutomationRequest Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:188— MethodTooLong — handleAutomationRequest runs 140 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PasteTool.performClipboardPasteTransaction Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:597— MethodTooLong — performClipboardPasteTransaction runs 139 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 39 over it, 1.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: CommanderCLIBinder.makeRuntimeOptions Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:43— MethodTooLong — makeRuntimeOptions runs 138 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 38 over it, 1.38× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ForegroundModifierClickExecutor.executeOwned Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ForegroundModifierClickExecutor.swift:207— MethodTooLong — executeOwned runs 138 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 38 over it, 1.38× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: HotkeyService.hotkey Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/HotkeyService.swift:193— MethodTooLong — hotkey runs 138 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 38 over it, 1.38× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PeekabooAgentService.handleToolCalls Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:810— MethodTooLong — handleToolCalls runs 138 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 38 over it, 1.38× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DialogService.executeDialogInput Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:472— MethodTooLong — executeDialogInput runs 135 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 35 over it, 1.35× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PeekabooBridgeAgentExecutionTraceResponse.validate Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionTraceModels.swift:339— MethodTooLong — validate runs 134 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 34 over it, 1.34× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PeekabooBridgeClient.exchange Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:414— MethodTooLong — exchange runs 134 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 34 over it, 1.34× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DetachedAXObservationWorker.inspect Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:239— MethodTooLong — inspect runs 132 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 32 over it, 1.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DialogService.executeFileDialog Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogs.swift:43— MethodTooLong — executeFileDialog runs 132 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 32 over it, 1.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MCPToolContext.execute Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:336— MethodTooLong — execute runs 132 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 32 over it, 1.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PeekabooBridgeOperationResultSemantics.contract Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:16— MethodTooLong — contract runs 131 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 31 over it, 1.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: WatchCaptureSession.captureFrames Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchCaptureSession+Loop.swift:127— MethodTooLong — captureFrames runs 130 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 30 over it, 1.30× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DragTool.execute Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool.swift:67— MethodTooLong — execute runs 129 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 29 over it, 1.29× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Hotspot: Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handshake.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handshake.swift:31— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handshake.swift changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 134 in PeekabooBridgeServer.handleHandshake at line 31. 12 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handshake.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:727— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 81 in PeekabooBridgeOperationResultSemantics.deliveryRules at line 727. 13 of those changes were fix/bug commits, and the other 16 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: scripts/finalize-multi-target-certification.mjs scripts/finalize-multi-target-certification.mjs:2870— scripts/finalize-multi-target-certification.mjs changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 155 in finalize-multi-target-certification.validateSuccessfulCertificationSummary at line 2870. 5 of those changes were fix/bug commits, and the other 5 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- scripts/finalize-multi-target-certification.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:1084— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift changed 31 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in PeekabooBridgeServer.validateOperationAccess at line 1084. 14 of those changes were fix/bug commits, and the other 17 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:877— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift changed 37 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in PeekabooBridgeClient.handshakeCandidate at line 877. 20 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:198— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift changed 31 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 34 in PeekabooBridgeClient.requireNegotiatedInputCapabilities at line 198. 15 of those changes were fix/bug commits, and the other 16 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: scripts/build-docs-site.mjs scripts/build-docs-site.mjs:267— scripts/build-docs-site.mjs changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 74 in build-docs-site.markdownToHtml at line 267. 10 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- scripts/build-docs-site.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver.swift Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver.swift:327— Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver.swift changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in RuntimeHostResolver.resolveRemoteRouting at line 327. 19 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeModels.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeModels.swift:171— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeModels.swift changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in PeekabooBridgeOperation.compatible at line 171. 18 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeModels.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:240— Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 42 in BridgeCapabilityPolicy.supportsInteractionRequirements at line 240. 12 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:43— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 49 in CommanderCLIBinder.makeRuntimeOptions at line 43. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:9— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in PeekabooBridgeServer.handleAuthorized at line 9. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:641— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in PeekabooBridgeOperationReceiptSemantics.validateSuccessfulTargetAttribution at line 641. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:860— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in MCPToolContext.backgroundTargetAuthorization at line 860. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: scripts/run-live-multi-target-certification.mjs scripts/run-live-multi-target-certification.mjs:1260— scripts/run-live-multi-target-certification.mjs changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 121 in run-live-multi-target-certification.runCoordinator at line 1260. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- scripts/run-live-multi-target-certification.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:921— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in BrowserMCPSessionManager.prepareExecutionReceipt at line 921. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequest+DesktopMutation.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequest+DesktopMutation.swift:42— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequest+DesktopMutation.swift changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in PeekabooBridgeRequest.minimumNegotiatedProtocolVersion at line 42. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequest+DesktopMutation.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+ScreenCaptureKitOwner.swift Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+ScreenCaptureKitOwner.swift:417— Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+ScreenCaptureKitOwner.swift changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in RuntimeHostResolver.resolveExplicitAutomaticClassicCapture at line 417. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+ScreenCaptureKitOwner.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:597— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in PasteTool.performClipboardPasteTransaction at line 597. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:308— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in DetachedExactWindowFocusReader.read at line 308. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/HotkeyService.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/HotkeyService.swift:193— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/HotkeyService.swift changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 34 in HotkeyService.hotkey at line 193. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/HotkeyService.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+OperationReceipts.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+OperationReceipts.swift:59— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+OperationReceipts.swift changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in PeekabooBridgeServer.performAttestedOperation at line 59. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+OperationReceipts.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:976— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 34 in ClickRequest.init at line 976. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:222— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in PasteCommand.performClipboardPasteTransaction at line 222. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: scripts/terminal-archive-policy.mjs scripts/terminal-archive-policy.mjs:93— scripts/terminal-archive-policy.mjs changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in terminal-archive-policy.validateArchiveEntries at line 93. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- scripts/terminal-archive-policy.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationSessionClaim.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationSessionClaim.swift:24— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationSessionClaim.swift changed 16 times in last 90 days and 11 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 2 (its worst body is PeekabooBridgeNegotiatedSessionCapabilities.offersSetValueVerification at line 24), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(menubar): prepare clicks within an explicit app owner (#977)”; “fix(dialog): retain exact file-panel ownership”; “fix(paste): fence exact-window clipboard delivery (#894)”; “fix(bridge): verify typed native value readbacks (#815)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationSessionClaim.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandRuntime.swift Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandRuntime.swift:264— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandRuntime.swift changed 16 times in last 90 days and 10 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is CommandRuntime.init at line 264), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(runtime): declare route-specific permission needs for input commands (#1088)”; “fix(cli): honor classic verify screenshots on bridge hosts (#849)”; “fix(cli): avoid capture admission for screenshot-free verify (#844)”; “fix(see): preserve read-only observation snapshots (#809)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandRuntime.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Core/PeekabooCore/Sources/PeekabooCore/Support/RemotePeekabooServices.swift Core/PeekabooCore/Sources/PeekabooCore/Support/RemotePeekabooServices.swift:34— Core/PeekabooCore/Sources/PeekabooCore/Support/RemotePeekabooServices.swift changed 16 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is RemotePeekabooServices.init at line 34), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(dialog): retain exact file-panel ownership”; “fix(paste): fence exact-window clipboard delivery (#894)”; “fix(agent): keep automatic captures on a proven classic host (#778)”; “fix: background input, bridge error surfacing, exact-app targeting, and system permission dialogs (#743)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooCore/Support/RemotePeekabooServices.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:48— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift changed 12 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is AutomationServiceBridge.click at line 48), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(menubar): prepare clicks within an explicit app owner (#977)”; “fix(paste): fence exact-window clipboard delivery (#894)”; “fix(hotkey): preserve exact background select-all receipts (#796)”; “fix(bridge): bind element mutations to process generation (#640)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService.swift:173— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService.swift changed 11 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is UIAutomationService.init at line 173), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(paste): fence exact-window clipboard delivery (#894)”; “fix(automation): settle background AX writes before dependent input (#823)”; “fix: background input, bridge error surfacing, exact-app targeting, and system permission dialogs (#743)”; “fix(type): report truthful background delivery (#638)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:107— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift changed 10 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is ScrollRequest.validatePointSelector at line 107), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(automation): distinguish unreadable focus window evidence (#912)”; “fix: preserve no-input refusals during background paste preparation (#902)”; “fix(bridge): verify typed native value readbacks (#815)”; “fix(scroll): reject overflowing amounts before dispatch (#769)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Apps/CLI/Sources/PeekabooCLI/Commands/Core/LearnCommand.swift Apps/CLI/Sources/PeekabooCLI/Commands/Core/LearnCommand.swift:231— Apps/CLI/Sources/PeekabooCLI/Commands/Core/LearnCommand.swift changed 8 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is LearnCommand.renderGuide at line 231), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: preserve background typing caret state and clarify key names (#915)”; “fix(clipboard): keep unattended native reads silent (#841)”; “fix(cli): keep learn on injected runtime (#653)”; “fix(cli): hide foreground-only tools from background catalogs (#595)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Apps/CLI/Sources/PeekabooCLI/Commands/Core/LearnCommand.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Apps/CLI/Sources/PeekabooCLI/CLI/PeekabooEntryPoint.swift Apps/CLI/Sources/PeekabooCLI/CLI/PeekabooEntryPoint.swift:18— Apps/CLI/Sources/PeekabooCLI/CLI/PeekabooEntryPoint.swift changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is PeekabooEntryPoint.swift.executePeekabooCLI at line 18), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): accept renamed or symlinked executables (#1011)”; “fix(cli): defer configuration loading until runtime (#828)”; “fix(paste): bound exclusive paste lock waits at 15s (#793)”; “fix(capture): preserve GUI readiness and classic recovery (#684)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Apps/CLI/Sources/PeekabooCLI/CLI/PeekabooEntryPoint.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: scripts/test-terminal-archive-policy.mjs scripts/test-terminal-archive-policy.mjs:24— scripts/test-terminal-archive-policy.mjs changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is test-terminal-archive-policy.zipFixture at line 24), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: drain ZIP entry readers before closing archive handles (#986)”; “fix(release): reject non-ASCII tar metadata before decoding (#966)”; “fix(release): reject archive children beneath regular files”; “fix(release): resolve composed artifact symlinks before containment checks (#954)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- scripts/test-terminal-archive-policy.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/SnapshotMutationRecordingManager.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/SnapshotMutationRecordingManager.swift:101— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/SnapshotMutationRecordingManager.swift changed 6 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is SnapshotMutationRecordingManager.ownsSnapshot at line 101), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): enforce pixel-only observation deadlines (#870)”; “fix(cli): report only persisted snapshot map paths (#819)”; “fix: enforce snapshot mutation leases across CLI and MCP (#789)”; “fix(mcp): wait for queries with pinned Accessibility (#785)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/SnapshotMutationRecordingManager.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+Execution.swift Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+Execution.swift:140— Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+Execution.swift changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is AgentCommand.makeAgentJSONResponse at line 140), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(agent): restore streaming callbacks and elide unused events (#863)”; “fix(agent): distinguish narrative from recorded outcomes (#818)”; “fix(agent): preserve progress on step-limit failure (#814)”; “fix(cli): keep agent task content out of public logs (#652)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+Execution.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:108— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is WindowManagementService.windowById at line 108), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(windows): keep same-name apps apart in focused-window lookups (#1165)”; “fix(see): resolve exact windows exposed only through AXFocusedWindow or AXMainWindow (#1156)”; “fix(windows): describe an empty window index range (#1150)”; “fix(automation): recover the PID of apps that re-exec themselves (#1121)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/UIAutomationTarget.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/UIAutomationTarget.swift:244— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/UIAutomationTarget.swift changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is UIAutomationTarget.pinningCurrentFocusedElement at line 244), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(paste): fence exact-window clipboard delivery (#894)”; “fix(bridge): preserve background Select All receipts (#837)”; “fix(hotkey): preserve exact background select-all receipts (#796)”; “fix(type): report truthful background delivery (#638)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/UIAutomationTarget.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementActions.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementActions.swift:295— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementActions.swift changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is UIAutomationService.resolveActionTarget at line 295), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(automation): resolve custom accessibility action titles”; “fix(automation): settle background AX writes before dependent input (#823)”; “fix(bridge): verify typed native value readbacks (#815)”; “fix(bridge): bind element mutations to process generation (#640)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementActions.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Apps/Mac/Peekaboo/Core/PeekabooAgent.swift Apps/Mac/Peekaboo/Core/PeekabooAgent.swift:214— Apps/Mac/Peekaboo/Core/PeekabooAgent.swift changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is PeekabooAgent.runQueuedTasks at line 214), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mac): keep a streaming reply ahead of a queued follow-up (#1126)”; “fix(mac): mark a failed tool row as failed (#1134)”; “fix(mac): open the recent session that was clicked (#1108)”; “fix(mac): record chat prompts and replies once (#1117)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Apps/Mac/Peekaboo/Core/PeekabooAgent.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Core/PeekabooFoundation/Sources/PeekabooFoundation/StandardizedErrors.swift Core/PeekabooFoundation/Sources/PeekabooFoundation/StandardizedErrors.swift:142— Core/PeekabooFoundation/Sources/PeekabooFoundation/StandardizedErrors.swift changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is StandardizedError.recoverySuggestion at line 142), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(permissions): show macOS 27 Settings row names (#1078)”; “fix(foundation): classify cooperative and URL cancellation (#1042)”; “fix(bridge): bind element mutations to process generation (#640)”; “fix(browser): preserve target lock guidance (#630)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooFoundation/Sources/PeekabooFoundation/StandardizedErrors.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Apps/CLI/Sources/PeekabooCLI/CLI/CommanderRuntimeExecutor.swift Apps/CLI/Sources/PeekabooCLI/CLI/CommanderRuntimeExecutor.swift:207— Apps/CLI/Sources/PeekabooCLI/CLI/CommanderRuntimeExecutor.swift changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is CommanderRuntimeExecutor.invalidateSnapshotsAfterCommandIfNeeded at line 207), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): accept renamed or symlinked executables (#1011)”; “fix(cli): render Agent dry runs before runtime admission (#776)”; “fix(cli): bound mutation lock waits and preserve reservation ownership (#758)”; “fix(browser): isolate caller capability sessions (#646)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Apps/CLI/Sources/PeekabooCLI/CLI/CommanderRuntimeExecutor.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolExecutionPolicy.swift Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolExecutionPolicy.swift:173— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolExecutionPolicy.swift changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is BackgroundOnlyToolPolicy.violation at line 173), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(clipboard): keep unattended native reads silent (#841)”; “fix(browser): isolate caller capability sessions (#646)”; “fix(cli): hide foreground-only tools from background catalogs (#595)”; “fix(agent): align background capability guidance (#525)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolExecutionPolicy.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/WindowIdentityUtilities.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/WindowIdentityUtilities.swift:267— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/WindowIdentityUtilities.swift changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is WindowIdentityService.isTopmostRenderableWindow at line 267), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(see): resolve exact windows exposed only through AXFocusedWindow or AXMainWindow (#1156)”; “fix(automation): recover the PID of apps that re-exec themselves (#1121)”; “fix: preserve exact window catalog evidence (#508)”; “fix(automation): resolve exact windows the on-screen list omits (#505)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/WindowIdentityUtilities.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Window.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Window.swift:7— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Window.swift changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is LegacyScreenCaptureOperator.captureWindow at line 7), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(automation): recover the PID of apps that re-exec themselves (#1121)”; “fix(capture): stop inventing main-window state (#919)”; “fix(automation): report hidden windows as off screen (#779)”; “fix(capture): preserve exact popup and sheet extents (#689)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Window.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService.swift:207— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService.swift changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 2 (its worst body is ApplicationService.init at line 207), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(automation): recover the PID of apps that re-exec themselves (#1121)”; “fix(automation): preserve mutations with inaccessible background services (#678)”; “fix(app): bound retained native metadata work (#674)”; “fix(app): make background hide outcome truthful (#619)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Apps/Mac/Peekaboo/PeekabooApp.swift Apps/Mac/Peekaboo/PeekabooApp.swift:267— Apps/Mac/Peekaboo/PeekabooApp.swift changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is AppDelegate.connectToState at line 267), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(certification): admit the GUI controller and preserve receipt scopes (#891)”; “fix(app): refuse CLI-style bundle invocation”; “fix(mac): preserve menu-bar-only activation during presentation (#679)”; “fix(mac): use prompt-free shared credential storage (#651)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Apps/Mac/Peekaboo/PeekabooApp.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:254— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is CommandUtilities.swift.validatedMutationSelector at line 254), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): bound mutation lock waits and preserve reservation ownership (#758)”; “fix(cli): validate system selectors before runtime (#614)”; “fix(cli): keep command timeouts bounded under load (#532)”; “fix: refuse fuzzy application mutation targets (#521)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:44— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is ActionTool.execute at line 44), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(automation): resolve custom accessibility action titles”; “fix: enforce snapshot mutation leases across CLI and MCP (#789)”; “fix(bridge): bind element mutations to process generation (#640)”; “fix(agent): align background capability guidance (#525)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService.swift:24— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService.swift changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is DialogError.errorDescription at line 24), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(dialog): select files in Open panels through Go to Folder (#1167)”; “fix(dialog): reject search fields during filename entry (#1159)”; “fix(dialog): retain exact file-panel ownership”; “fix: background input, bridge error surfacing, exact-app targeting, and system permission dialogs (#743)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 01:26:10 -08:00' --until='2026-11-14 01:26:10 -08:00' --full-history --no-merges -- Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
TooManyMethods: PeekabooBridgeClient Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:46— TooManyMethods — 353 methods, declared across 16 files: PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift (67), PeekabooBridge/PeekabooBridgeClient.swift (65), PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift (47), PeekabooBridge/PeekabooBridgeClient+Transport.swift (35), +12 more file(s). The bar is 30 methods; this is 323 over it, 11.77× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: PeekabooBridgeServer Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:69— TooManyMethods — 220 methods, declared across 18 files: PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift (39), PeekabooBridge/PeekabooBridgeServer.swift (38), PeekabooBridge/PeekabooBridgeServer+Handlers.swift (31), PeekabooBridge/PeekabooBridgeServer+Handshake.swift (20), +14 more file(s). The bar is 30 methods; this is 190 over it, 7.33× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: PeekabooAgentService Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService.swift:148— TooManyMethods — 216 methods, declared across 14 files: Agent/PeekabooAgentService+Tools.swift (48), Agent/PeekabooAgentService+Streaming.swift (34), Agent/PeekabooAgentService+SessionLifecycle.swift (27), Agent/PeekabooAgentService+Execution.swift (18), +10 more file(s). The bar is 30 methods; this is 186 over it, 7.20× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DialogService Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService.swift:59— TooManyMethods — 206 methods, declared across 23 files: UI/DialogService+ForegroundOutcomes.swift (45), UI/DialogService+PreparedActions.swift (34), UI/DialogService+FileDialogVerification.swift (22), UI/DialogService+Elements.swift (16), +19 more file(s). The bar is 30 methods; this is 176 over it, 6.87× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SeeCommand Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand.swift:10— TooManyMethods — 141 methods, declared across 18 files: AI/SeeCommand.swift (23), AI/SeeCommand+Output.swift (16), AI/SeeCommand+PixelCapturePipeline.swift (14), AI/SeeCommand+MenuBarCandidates.swift (11), +14 more file(s). The bar is 30 methods; this is 111 over it, 4.70× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ApplicationService Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService.swift:44— TooManyMethods — 113 methods, declared across 5 files: System/ApplicationService+Lifecycle.swift (54), System/ApplicationService+Discovery.swift (23), System/ApplicationService+ActionOutcomes.swift (22), System/ApplicationService+WindowListing.swift (12), +1 more file(s). The bar is 30 methods; this is 83 over it, 3.77× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: UIAutomationService Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService.swift:52— TooManyMethods — 113 methods, declared across 10 files: UI/UIAutomationService+PointerKeyboardOperations.swift (23), UI/UIAutomationService+ElementActions.swift (19), UI/UIAutomationService+Operations.swift (19), UI/UIAutomationService+TypingOperations.swift (16), +6 more file(s). The bar is 30 methods; this is 83 over it, 3.77× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: MenuService Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService.swift:14— TooManyMethods — 99 methods, declared across 11 files: UI/MenuService+Extras.swift (26), UI/MenuService+Actions.swift (12), UI/MenuService+MenuExtraWindows.swift (12), UI/MenuService+List.swift (9), +7 more file(s). The bar is 30 methods; this is 69 over it, 3.30× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: AgentCommand Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand.swift:41— TooManyMethods — 85 methods, declared across 7 files: AI/AgentCommand+Execution.swift (21), AI/AgentCommand+ModelParsing.swift (15), AI/AgentCommand+Chat.swift (14), AI/AgentCommand+Sessions.swift (14), +3 more file(s). The bar is 30 methods; this is 55 over it, 2.83× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ConfigurationManager Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager.swift:18— TooManyMethods — 84 methods, declared across 6 files: Configuration/ConfigurationManager+Accessors.swift (35), Configuration/ConfigurationManager+CustomProviders.swift (15), Configuration/ConfigurationManager+Credentials.swift (10), Configuration/ConfigurationManager+Parsing.swift (10), +2 more file(s). The bar is 30 methods; this is 54 over it, 2.80× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: RemoteUIAutomationService Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:8— TooManyMethods — 80 methods, declared across 2 files: Support/RemoteUIAutomationService.swift (48), Support/RemoteUIAutomationService+ActionOutcomes.swift (32). The bar is 30 methods; this is 50 over it, 2.67× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WindowManagementService Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService.swift:39— TooManyMethods — 77 methods, declared across 8 files: UI/WindowManagementService+StateOperations.swift (28), UI/WindowManagementService+Resolution.swift (13), UI/WindowManagementService+GeometryOperations.swift (12), UI/WindowManagementService+Search.swift (7), +4 more file(s). The bar is 30 methods; this is 47 over it, 2.57× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SnapshotManager Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager.swift:8— TooManyMethods — 73 methods, declared across 5 files: Support/SnapshotManager+Helpers.swift (45), Support/SnapshotManager.swift (20), Support/SnapshotManager+Elements.swift (3), Support/SnapshotManager+Screenshots.swift (3), +1 more file(s). The bar is 30 methods; this is 43 over it, 2.43× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ActionInputDriver Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:133— TooManyMethods — 61 methods. The bar is 30 methods; this is 31 over it, 2.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: MCPToolContext Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:25— TooManyMethods — 60 methods, declared across 4 files: MCP/MCPToolContext.swift (42), MCP/MCPToolContext+BackgroundApplicationTarget.swift (13), MCP/MCPToolContext+BrowserSession.swift (3), MCP/AuthorizedDesktopTargetPlan.swift (2). The bar is 30 methods; this is 30 over it, 2.00× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DockService Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService.swift:37— TooManyMethods — 59 methods, declared across 6 files: UI/DockService+Actions.swift (17), UI/DockService.swift (14), UI/DockService+Support.swift (12), UI/DockService+Visibility.swift (10), +2 more file(s). The bar is 30 methods; this is 29 over it, 1.97× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BrowserMCPSessionManager Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:46— TooManyMethods — 58 methods. The bar is 30 methods; this is 28 over it, 1.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BrowserMCPService Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:400— TooManyMethods — 56 methods. The bar is 30 methods; this is 26 over it, 1.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: PeekabooBridgeHost Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift:261— TooManyMethods — 56 methods, declared across 3 files: PeekabooBridge/PeekabooBridgeHost.swift (38), PeekabooBridge/PeekabooBridgeHost+Clients.swift (15), PeekabooBridge/PeekabooBridgeHost+BrowserHandoffMaintenance.swift (3). The bar is 30 methods; this is 26 over it, 1.87× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: PeekabooServices Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices.swift:16— TooManyMethods — 53 methods, declared across 6 files: Support/PeekabooServices+Agent.swift (15), Support/PeekabooServices+BrowserBridge.swift (15), Support/PeekabooServices+BrowserSessions.swift (12), Support/PeekabooServices+Automation.swift (5), +2 more file(s). The bar is 30 methods; this is 23 over it, 1.77× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DesktopObservationService Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift:381— TooManyMethods — 51 methods, declared across 6 files: Observation/DesktopObservationService.swift (23), Observation/DesktopObservationService+Detection.swift (9), Observation/DesktopObservationService+OperationLane.swift (8), Observation/DesktopObservationService+Capture.swift (6), +2 more file(s). The bar is 30 methods; this is 21 over it, 1.70× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DesktopMutationWatermarkStore Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopMutationWatermarkStore.swift:10— TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: InMemorySnapshotManager Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager.swift:28— TooManyMethods — 48 methods, declared across 6 files: Support/InMemorySnapshotManager+Lifecycle.swift (18), Support/InMemorySnapshotManager+DetectionMapping.swift (9), Support/InMemorySnapshotManager+Pruning.swift (7), Support/InMemorySnapshotManager+Screenshots.swift (7), +2 more file(s). The bar is 30 methods; this is 18 over it, 1.60× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: PeekabooSettings Apps/Mac/Peekaboo/Core/Settings.swift:50— TooManyMethods — 46 methods. The bar is 30 methods; this is 16 over it, 1.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: PeekabooBridgeBrowserHandoffGrantRegistry Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserSessionHandoff.swift:224— TooManyMethods — 46 methods. The bar is 30 methods; this is 16 over it, 1.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: BrowserMCPSessionManager Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:46— ClassTooLong — 1367 significant lines (blank, comment-only and punctuation-only lines excluded), 58 methods. The bar is 400 significant lines; this is 967 over it, 3.42× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PasteTool Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:12— ClassTooLong — 1055 significant lines (blank, comment-only and punctuation-only lines excluded), 33 methods. The bar is 400 significant lines; this is 655 over it, 2.64× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PeekabooBridgeServer Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:69— ClassTooLong — 1004 significant lines (blank, comment-only and punctuation-only lines excluded), 220 methods. The bar is 400 significant lines; this is 604 over it, 2.51× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WindowRoutedPointerDriver Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowRoutedPointerDriver.swift:18— ClassTooLong — 689 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods. The bar is 400 significant lines; this is 289 over it, 1.72× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DesktopMutationWatermarkStore Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopMutationWatermarkStore.swift:10— ClassTooLong — 666 significant lines (blank, comment-only and punctuation-only lines excluded), 49 methods. The bar is 400 significant lines; this is 266 over it, 1.67× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PasteCommand Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:8— ClassTooLong — 665 significant lines (blank, comment-only and punctuation-only lines excluded), 26 methods. The bar is 400 significant lines; this is 265 over it, 1.66× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ClickTool Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:10— ClassTooLong — 656 significant lines (blank, comment-only and punctuation-only lines excluded), 23 methods. The bar is 400 significant lines; this is 256 over it, 1.64× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PeekabooBridgeDesktopObservationBinding Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:10— ClassTooLong — 645 significant lines (blank, comment-only and punctuation-only lines excluded), 38 methods. The bar is 400 significant lines; this is 245 over it, 1.61× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: BrowserMCPService Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:400— ClassTooLong — 643 significant lines (blank, comment-only and punctuation-only lines excluded), 56 methods. The bar is 400 significant lines; this is 243 over it, 1.61× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: RemoteBrowserMCPClient Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteBrowserMCPClient.swift:8— ClassTooLong — 643 significant lines (blank, comment-only and punctuation-only lines excluded), 46 methods. The bar is 400 significant lines; this is 243 over it, 1.61× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: TypeService Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:71— ClassTooLong — 641 significant lines (blank, comment-only and punctuation-only lines excluded), 42 methods. The bar is 400 significant lines; this is 241 over it, 1.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ClickService Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:104— ClassTooLong — 640 significant lines (blank, comment-only and punctuation-only lines excluded), 41 methods. The bar is 400 significant lines; this is 240 over it, 1.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: BackgroundInputDriver Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:20— ClassTooLong — 628 significant lines (blank, comment-only and punctuation-only lines excluded), 71 methods. The bar is 400 significant lines; this is 228 over it, 1.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DialogTool Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DialogTool.swift:9— ClassTooLong — 619 significant lines (blank, comment-only and punctuation-only lines excluded), 16 methods. The bar is 400 significant lines; this is 219 over it, 1.55× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ActionInputDriver Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:133— ClassTooLong — 616 significant lines (blank, comment-only and punctuation-only lines excluded), 61 methods. The bar is 400 significant lines; this is 216 over it, 1.54× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PeekabooBridgeBrowserHandoffGrantRegistry Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserSessionHandoff.swift:224— ClassTooLong — 616 significant lines (blank, comment-only and punctuation-only lines excluded), 46 methods. The bar is 400 significant lines; this is 216 over it, 1.54× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: FocusManagementService Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/FocusUtilities.swift:611— ClassTooLong — 614 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods. The bar is 400 significant lines; this is 214 over it, 1.54× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ClickCommand Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:24— ClassTooLong — 597 significant lines (blank, comment-only and punctuation-only lines excluded), 44 methods. The bar is 400 significant lines; this is 197 over it, 1.49× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PeekabooBridgeOperationResultSemantics Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultContracts.swift:11— ClassTooLong — 590 significant lines (blank, comment-only and punctuation-only lines excluded), 47 methods. The bar is 400 significant lines; this is 190 over it, 1.48× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: BrowserTool Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:11— ClassTooLong — 587 significant lines (blank, comment-only and punctuation-only lines excluded), 25 methods. The bar is 400 significant lines; this is 187 over it, 1.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ScreenCaptureKitOwnerLease Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOwnerLease.swift:10— ClassTooLong — 571 significant lines (blank, comment-only and punctuation-only lines excluded), 33 methods. The bar is 400 significant lines; this is 171 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: RemoteUIAutomationService Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:8— ClassTooLong — 552 significant lines (blank, comment-only and punctuation-only lines excluded), 80 methods. The bar is 400 significant lines; this is 152 over it, 1.38× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DesktopObservationService Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift:381— ClassTooLong — 549 significant lines (blank, comment-only and punctuation-only lines excluded), 51 methods. The bar is 400 significant lines; this is 149 over it, 1.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ElementDetectionService Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementDetectionService.swift:57— ClassTooLong — 530 significant lines (blank, comment-only and punctuation-only lines excluded), 20 methods. The bar is 400 significant lines; this is 130 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DesktopActionOutcome Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:8— ClassTooLong — 526 significant lines (blank, comment-only and punctuation-only lines excluded), 20 methods. The bar is 400 significant lines; this is 126 over it, 1.32× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Sync-over-async blocking Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:851— `sleep` is async and calls sleep — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
Sync-over-async blocking Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:858— `sleep` is async and calls sleep — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
Sync-over-async blocking Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:18— `sleep` is async and calls sleep — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
Sync-over-async blocking Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchCaptureMonotonicClock.swift:16— `sleep` is async and calls sleep — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
Sync-over-async blocking Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchCaptureSession+Loop.swift:611— `sleep` is async and calls sleep — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
Sync-over-async blocking Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService+Actions.swift:162— `rightClickDockItemImpl` is async and calls usleep — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
Sync-over-async blocking Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/HotkeyService.swift:456— `postHotkey` is async and calls usleep — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
Sync-over-async blocking Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceipts.swift:691— `resolveSessionCreation` is async and calls .wait() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
Sync-over-async blocking Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+Automation.swift:14— `automate` is async and calls .wait() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
Sync-over-async blocking Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+Automation.swift:107— `performAutomationAction` is async and calls .wait() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
Sync-over-async blocking scripts/finalize-multi-target-certification.mjs:4235— `fs.existsSync` in `waitForInspectorReceipt` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/finalize-multi-target-certification.mjs:4280— `fs.realpathSync` in `inspectCodeIdentity` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/finalize-multi-target-certification.mjs:4281— `fs.mkdtempSync` in `inspectCodeIdentity` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/finalize-multi-target-certification.mjs:4283— `fs.chmodSync` in `inspectCodeIdentity` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/finalize-multi-target-certification.mjs:4349— `fs.realpathSync` in `inspectCodeIdentity` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/finalize-multi-target-certification.mjs:4371— `fs.readdirSync` in `inspectCodeIdentity` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/finalize-multi-target-certification.mjs:4403— `fs.rmSync` in `inspectCodeIdentity` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/finalize-multi-target-certification.mjs:4414— `fs.realpathSync` in `stageCodeIdentityInspector` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/finalize-multi-target-certification.mjs:4416— `fs.realpathSync` in `stageCodeIdentityInspector` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/finalize-multi-target-certification.mjs:4417— `fs.mkdtempSync` in `stageCodeIdentityInspector` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/finalize-multi-target-certification.mjs:4419— `fs.chmodSync` in `stageCodeIdentityInspector` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/finalize-multi-target-certification.mjs:4422— `fs.writeFileSync` in `stageCodeIdentityInspector` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/finalize-multi-target-certification.mjs:4424— `fs.readdirSync` in `stageCodeIdentityInspector` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/finalize-multi-target-certification.mjs:4429— `fs.writeFileSync` in `stageCodeIdentityInspector` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Sync-over-async blocking scripts/finalize-multi-target-certification.mjs:4436— `fs.chmodSync` in `stageCodeIdentityInspector` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteBrowserMCPClient.swift:501— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteBrowserMCPClient.swift:650— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteScreenCaptureService.swift:190— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:614— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooCore/Daemon/PeekabooDaemon.swift:364— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserSessionHandoff.swift:658— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserSessionHandoff.swift:1059— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeConnectedRequest.swift:421— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:467— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:606— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost+BrowserHandoffMaintenance.swift:14— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost+Clients.swift:168— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceipts.swift:441— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:420— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+Parsing.swift:89— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:787— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:801— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:1142— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:1194— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolSnapshotMutation.swift:388— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ShellTool.swift:372— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/EOFDrainingTransport.swift:124— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPAuthenticatedSessionPool.swift:386— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPAuthenticatedSessionPool.swift:473— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:229— `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Duplicated block (5 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionProcessRunner.swift:590— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionProcessRunner.swift:590-594 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ShellTool.swift:229-233 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (5 lines × 2) Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverSelector.swift:59— Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverSelector.swift:59-63 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverResolver.swift:153-157 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/CGS/MenuBarCGSBridge.swift:87— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/CGS/MenuBarCGSBridge.swift:87-91 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/CGS/MenuBarCGSBridge.swift:134-138 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogFilename.swift:79— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogFilename.swift:79-83 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogNavigation.swift:255-259 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogFilename.swift:79` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementDetectionWindowResolver.swift:375— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementDetectionWindowResolver.swift:375-379 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementDetectionWindowResolver.swift:383-387 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementDetectionWindowResolver.swift:383` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:872— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:872-876 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:1066-1070 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPHandoff.swift:41— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPHandoff.swift:41-45 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:1204-1208 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (5 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:530— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:530-534 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MoveTool+Execution.swift:143-147 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:530` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ElementToolFormatter.swift:95— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ElementToolFormatter.swift:95-99 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ElementToolFormatter.swift:309-313 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ElementToolFormatter.swift:315` calls `focusedAppName` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ElementToolFormatter.swift:100` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter.swift:37— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter.swift:37-41 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter.swift:27-31 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+SpaceResults.swift:8— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+SpaceResults.swift:8-12 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+WindowResults.swift:137-141 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+SpaceResults.swift:8` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:762— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:762-768 | scripts/final-qualification/integrated-cu-emitter-calibrator.swift:285-289 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHostIdentity.swift:88— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHostIdentity.swift:88-96 | scripts/support/background-computer-use-probe.swift:2311-2315 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHostIdentity.swift:88` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PressCommand.swift:406— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PressCommand.swift:406-410 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PressTool.swift:529-533 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/CodeIdentityRunner.swift:117— Apps/CLI/Sources/PeekabooCertificationController/CodeIdentityRunner.swift:117-121 | Apps/CLI/Sources/PeekabooCertificationController/ObserverPlan.swift:235-239 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:356— Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:356-360 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:573-577 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverOCRSelector.swift:147— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverOCRSelector.swift:147-151 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverResolver.swift:200-204 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ChromeProcessCodeSignatureValidator.swift:149— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ChromeProcessCodeSignatureValidator.swift:149-153 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:398-402 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:537— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:537-541 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:1568-1572 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SeeTool.swift:339— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SeeTool.swift:339-343 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDesktopObservationService.swift:461-465 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:800— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:800-804 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceipts.swift:69-73 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCaptureBinding.swift:213— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCaptureBinding.swift:213-217 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:928-932 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverDetector.swift:106— Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverDetector.swift:106-110 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverResolver.swift:165-173 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `screen` to `ScreenBounds` in one and `ScreenInfo` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (5 lines × 2) Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverDetector.swift:124— Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverDetector.swift:124-128 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverResolver.swift:194-198 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:190— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:190-194 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeProcessGenerationObservationModels.swift:70-74 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) Apps/CLI/Sources/PeekabooCLI/AgentExecutionReleaseGate.swift:55— Apps/CLI/Sources/PeekabooCLI/AgentExecutionReleaseGate.swift:55-60 | Apps/CLI/Sources/PeekabooCLI/AgentExecutionReleaseGate.swift:109-115 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:157— Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:157-162 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentOutputDelegate+Formatting.swift:192-198 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:157` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:165— Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:165-170 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentOutputDelegate+Formatting.swift:201-206 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (6 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandHelpRenderer.swift:108— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandHelpRenderer.swift:108-113 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandHelpRenderer.swift:157-162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandHelpRenderer.swift:108` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Core/ConfigCommand+Status.swift:38— Apps/CLI/Sources/PeekabooCLI/Commands/Core/ConfigCommand+Status.swift:38-43 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/ConfigCommand+Status.swift:45-50 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (6 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand.swift:422— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand.swift:422-427 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand+CommanderMetadata.swift:49-54 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand+CommanderMetadata.swift:47` calls `makeInteractionTargetOptions`, `flag` and `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand.swift:421` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/TypeCommand.swift:454— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/TypeCommand.swift:454-459 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationROI.swift:14-19 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOwnerLease.swift:293— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOwnerLease.swift:293-298 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitProcessCapabilityRegistry.swift:286-291 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationROI.swift:149— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationROI.swift:149-154 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationROI.swift:310-315 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationROI.swift:149` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService.swift:70— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService.swift:70-75 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService.swift:109-114 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService.swift:70` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Extras.swift:351— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Extras.swift:351-356 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+ScopedMenuExtraPreparation.swift:140-145 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Extras.swift:351` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:206— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:206-211 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:226-231 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Resolution.swift:63— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Resolution.swift:63-68 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MoveTool+Parsing.swift:7-12 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Response.swift:77— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Response.swift:77-82 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MoveTool+Execution.swift:184-191 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Response.swift:77` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SpaceTool+Handlers.swift:233— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SpaceTool+Handlers.swift:233-238 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SpaceTool+Handlers.swift:334-339 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SpaceTool+Handlers.swift:233` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:251— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:251-256 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:296-301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:251` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:302` calls `Coordinates`, `Double` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:257` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:376— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:376-381 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+ActionResults.swift:320-325 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Actions.swift:66— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Actions.swift:66-71 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Actions.swift:121-126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Actions.swift:66` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolArgumentValidation.swift:134— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolArgumentValidation.swift:134-139 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolArgumentValidation.swift:176-181 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:298— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:298-303 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:318-323 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:298` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:57— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:57-62 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationAttestationModels.swift:46-51 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:68— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:68-73 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SetValueCommand.swift:66-71 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SetValueCommand.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 89 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionCoordinateResolver.swift:465— Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionCoordinateResolver.swift:465-470 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Types.swift:395-400 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService.swift:164— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService.swift:164-169 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteScreenCaptureService.swift:32-37 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverResolver.swift:238— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverResolver.swift:238-243 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarWindowCatalog.swift:235-240 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelOutput.swift:207— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelOutput.swift:207-218 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelOutput.swift:231-242 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelOutput.swift:207` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1307— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1307-1318 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveScope.swift:163-174 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveScope.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1307` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/LiveCertificationBridge.swift:295— Apps/CLI/Sources/PeekabooCertificationController/LiveCertificationBridge.swift:295-306 | Apps/CLI/Sources/PeekabooCertificationController/LiveCertificationBridge.swift:322-333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCertificationController/LiveCertificationBridge.swift:295` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Apps/Mac/Peekaboo/Features/Main/SessionChatView.swift:36— Apps/Mac/Peekaboo/Features/Main/SessionChatView.swift:36-47 | Apps/Mac/Peekaboo/Features/Main/SessionSidebar.swift:57-68 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/Mac/Peekaboo/Features/Main/SessionChatView.swift:36` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Apps/Mac/Peekaboo/Features/Settings/SettingsWindow.swift:399— Apps/Mac/Peekaboo/Features/Settings/SettingsWindow.swift:399-410 | Apps/Mac/Peekaboo/Features/Settings/SettingsWindow.swift:421-432 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/Mac/Peekaboo/Features/Settings/SettingsWindow.swift:399` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) Apps/Mac/Peekaboo/Features/StatusBar/UnifiedActivityFeed.swift:375— Apps/Mac/Peekaboo/Features/StatusBar/UnifiedActivityFeed.swift:375-386 | Apps/Mac/Peekaboo/Features/StatusBar/UnifiedActivityFeed.swift:392-403 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/Mac/Peekaboo/Features/StatusBar/UnifiedActivityFeed.swift:375` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Apps/Mac/Peekaboo/Features/StatusBar/UnifiedActivityFeed.swift:404` calls `lineLimit` and `Apps/Mac/Peekaboo/Features/StatusBar/UnifiedActivityFeed.swift:387` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:180— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:180-191 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:265-276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:180` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOwnerLease.swift:654— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOwnerLease.swift:654-665 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOwnerLease.swift:675-686 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOwnerLease.swift:654` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/FileService.swift:32— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/FileService.swift:32-43 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/FileService.swift:92-103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/FileService.swift:32` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/FileService.swift:90` calls `Date`, `addingTimeInterval`, `Double` and `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/FileService.swift:30` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Elements.swift:294— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Elements.swift:294-305 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService+Actions.swift:287-298 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Elements.swift:294` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Tools.swift:463— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Tools.swift:463-474 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Tools.swift:490-501 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Tools.swift:463` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:110— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:110-121 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserModels.swift:81-92 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:110` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:90— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:90-101 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SetValueTool.swift:101-112 — before extracting anything, compare `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SetValueTool.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 77 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:90` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:160— Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:160-171 | Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:194-205 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:160` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:110— Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:110-121 | Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+BrowserBridge.swift:307-318 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:110` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:37— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:37-48 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:79-90 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:37` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Routing.swift:108— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Routing.swift:108-119 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Routing.swift:133-144 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Routing.swift:108` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:271— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:271-282 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:330-341 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:271` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Core/PeekabooUICore/Sources/PeekabooUICore/Components/AllElementsView.swift:255— Core/PeekabooUICore/Sources/PeekabooUICore/Components/AllElementsView.swift:255-266 | Core/PeekabooUICore/Sources/PeekabooUICore/Components/ElementDetailsView.swift:67-78 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooUICore/Sources/PeekabooUICore/Components/AllElementsView.swift:255` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:104— Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:104-115 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/InspectorPreset.swift:47-58 — before extracting anything, compare `Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift` and `Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/InspectorPreset.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:104` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Testing.swift:289— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Testing.swift:289-300 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Testing.swift:330-341 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Testing.swift:289` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:733— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:733-744 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:769-780 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:733` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/CGS/MenuBarCGSBridge.swift:18— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/CGS/MenuBarCGSBridge.swift:18-30 | Helpers/MenuBarHelper/main.swift:20-31 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (12 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:148— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:148-159 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Interaction.swift:173-184 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (12 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:188— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:188-199 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Interaction.swift:186-197 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:185` calls `UIAutomationActionResult` and `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Interaction.swift:183` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
+ 8 more in this group — see findings.md.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×31
Edited copy of a member (13 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:774— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:774-786 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:794-807 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:355— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:355-367 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+WindowResults.swift:266-280 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:48— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:48-60 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:106-126 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:176— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:176-188 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:197-209 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Extras.swift:31— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Extras.swift:31-43 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Extras.swift:346-362 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Apps/CLI/Sources/PeekabooCLI/CLI/CommanderBridge.swift:147— Apps/CLI/Sources/PeekabooCLI/CLI/CommanderBridge.swift:147-160 | Apps/CLI/Sources/PeekabooCLI/CLI/CommanderBridge.swift:164-176 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/PermissionsService.swift:184— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/PermissionsService.swift:184-197 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/PermissionsService.swift:227-239 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverOCRSelector.swift:60— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverOCRSelector.swift:60-72 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverOCRSelector.swift:74-88 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeProcessGenerationObservationModels.swift:215— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeProcessGenerationObservationModels.swift:215-228 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeProcessGenerationObservationModels.swift:230-242 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ClipboardService.swift:132— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ClipboardService.swift:132-144 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ClipboardService.swift:157-169 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/System/MenuCommand+Output.swift:57— Apps/CLI/Sources/PeekabooCLI/Commands/System/MenuCommand+Output.swift:57-69 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MenuTool.swift:566-581 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ExactWindowHeldPointerLifecycle.swift:863— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ExactWindowHeldPointerLifecycle.swift:863-875 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ExactWindowHeldPointerLifecycle.swift:877-889 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:138— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:138-157 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:343-355 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooEmbeddedBridgeRuntime.swift:285— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooEmbeddedBridgeRuntime.swift:285-297 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooEmbeddedBridgeRuntime.swift:310-323 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:866— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:866-879 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:728-740 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/UISnapshotStore.swift:440— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/UISnapshotStore.swift:440-452 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/UISnapshotStore.swift:454-466 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/AXTreeCollector.swift:356— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/AXTreeCollector.swift:356-372 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuBarElementCollector.swift:161-173 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:995— Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:995-1007 | Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:1028-1040 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementActionOutcome.swift:54— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementActionOutcome.swift:54-66 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementActionOutcome.swift:68-81 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDialogService.swift:337— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDialogService.swift:337-349 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDialogService.swift:351-366 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/ConfigCommand+Shared.swift:153— Apps/CLI/Sources/PeekabooCLI/Commands/Core/ConfigCommand+Shared.swift:153-165 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/ConfigCommand+Shared.swift:167-179 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:372— Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:372-385 | Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:387-399 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationIdentifierMatcher.swift:23— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationIdentifierMatcher.swift:23-38 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationSelectorResolutionProof.swift:71-83 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/MCPToolCatalog.swift:33— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/MCPToolCatalog.swift:33-45 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/MCPToolCatalog.swift:47-60 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Types.swift:127— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Types.swift:127-143 | Core/PeekabooFoundation/Sources/PeekabooFoundation/InteractionTargetSelector.swift:50-62 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (7 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:95— Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:95-101 | Apps/Mac/Peekaboo/Core/ToolFormatterBridge.swift:75-82 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/ControllerBuildIdentity.swift:172— Apps/CLI/Sources/PeekabooCertificationController/ControllerBuildIdentity.swift:172-178 | scripts/final-qualification/integrated-cu-emitter-calibrator.swift:184-190 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (7 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:383— Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:383-389 | Apps/CLI/Sources/PeekabooCertificationController/ObserverPlan.swift:223-229 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (7 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:133— Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:133-139 | Apps/CLI/Sources/PeekabooCertificationController/ObserveOnlyRunner.swift:202-208 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:145— Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:145-151 | Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:181-189 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:145` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:115— Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:115-121 | Apps/CLI/Sources/PeekabooCertificationController/MonitorAttestationRunner.swift:136-142 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:115` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureApplicationResolver.swift:28— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureApplicationResolver.swift:28-34 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Discovery.swift:504-510 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureApplicationResolver.swift:28` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOperator+Window.swift:191— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOperator+Window.swift:191-197 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOperator+Window.swift:405-412 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOperator+Window.swift:191` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOwnerLease.swift:578— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOwnerLease.swift:578-587 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ClipboardPasteTransactionGate.swift:196-202 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOwnerLease.swift:578` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:555— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:555-561 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeJSONValue.swift:17-23 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:555` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:144— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:144-150 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:201-207 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:407— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:407-413 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:432-440 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:432` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:691— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:691-697 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+BrowserConnect.swift:84-90 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:691` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool+Types.swift:35— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool+Types.swift:35-41 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SeeTool+Types.swift:58-64 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+PointerResults.swift:89— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+PointerResults.swift:89-95 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+PointerResults.swift:115-121 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+PointerResults.swift:89` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:39— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:39-45 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:262-268 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:39` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:269` calls `decode` and `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:46` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequestResponse.swift:346— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequestResponse.swift:346-352 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequestResponse.swift:406-412 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequestResponse.swift:346` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:354— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:354-361 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:374-380 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:354` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/WindowSelectorResolutionProof.swift:40— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/WindowSelectorResolutionProof.swift:40-46 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationIdentifierMatcher.swift:133-139 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Responses.swift:19— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Responses.swift:19-25 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Responses.swift:51-57 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Responses.swift:19` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:1323— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:1323-1329 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:1339-1345 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:1323` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:795— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:795-801 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ClipboardService.swift:728-734 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:912— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:912-918 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/HotkeyService.swift:679-686 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementActions.swift:91— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementActions.swift:91-100 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Interaction.swift:106-112 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+TypingOperations.swift:135— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+TypingOperations.swift:135-144 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Interaction.swift:27-33 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:556— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:556-565 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MCPGlobalPointerActionResult.swift:29-38 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:198— Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:198-209 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationObserverSemanticPayload.swift:260-269 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:198` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:431— Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:431-440 | scripts/support/background-computer-use-probe.swift:2845-2854 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) Apps/Mac/Peekaboo/Features/StatusBar/UnifiedActivityFeed.swift:307— Apps/Mac/Peekaboo/Features/StatusBar/UnifiedActivityFeed.swift:307-316 | Apps/Mac/Peekaboo/Features/StatusBar/UnifiedActivityFeed.swift:489-498 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/Mac/Peekaboo/Features/StatusBar/UnifiedActivityFeed.swift:307` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:343— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:343-352 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/WindowManagementServiceProtocol.swift:317-326 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:343` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `expectedIdentity` to `ApplicationProcessIdentity` in one and `WindowMutationIdentity` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (10 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationDiagnosticsBuilder.swift:80— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationDiagnosticsBuilder.swift:80-96 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:953-962 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (10 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Lifecycle.swift:85— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Lifecycle.swift:85-94 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Lifecycle.swift:110-119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Lifecycle.swift:85` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/DetachedApplicationInventoryWorker.swift:17— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/DetachedApplicationInventoryWorker.swift:17-26 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementDetectionTimeoutRunner.swift:52-64 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/DetachedApplicationInventoryWorker.swift:17` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1359— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1359-1368 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1372-1381 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1359` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraWindows.swift:301— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraWindows.swift:301-310 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraWindows.swift:324-333 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraWindows.swift:301` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:493— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:493-502 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementActions.swift:384-393 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:519— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:519-528 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:865-874 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TargetedTypeInputDriver.swift:62— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TargetedTypeInputDriver.swift:62-72 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TargetedTypeInputDriver.swift:80-89 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TargetedTypeInputDriver.swift:62` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:226— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:226-235 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Search.swift:29-38 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+SessionLifecycle.swift:193— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+SessionLifecycle.swift:193-202 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+SessionLifecycle.swift:219-228 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+SessionLifecycle.swift:193` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool.swift:41— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool.swift:41-50 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MoveTool.swift:43-52 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool.swift:41` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool+Types.swift:19— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool+Types.swift:19-28 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SeeTool+Types.swift:29-38 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Browser.swift:127— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Browser.swift:127-136 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Browser.swift:154-163 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeResponse+CaptureDiagnostics.swift:13— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeResponse+CaptureDiagnostics.swift:13-22 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeResponse+CaptureDiagnostics.swift:41-50 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeResponse+CaptureDiagnostics.swift:13` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:652— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:652-661 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:908-917 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:652` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:446— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:446-455 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:466-475 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:446` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:44— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:44-53 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeProcessGenerationObservationModels.swift:19-28 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:54` calls `decode` and `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeProcessGenerationObservationModels.swift:29` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:722— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:722-731 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:758-767 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:722` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:152— Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:152-161 | Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:227-236 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:152` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `apiKey` to `String) async throws -> (success: Bool` in one and `String) async throws -> (models: [String]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (10 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+PointerKeyboardOperations.swift:141— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+PointerKeyboardOperations.swift:141-150 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Interaction.swift:138-147 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+PointerKeyboardOperations.swift:137` calls `visualizeHotkey`, `UIAutomationActionResult` and `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Interaction.swift:135` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
+ 2 more in this group — see findings.md.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×26
Edited copy of a member (9 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogFileOperationModels.swift:40— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogFileOperationModels.swift:40-49 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogOperationModels.swift:357-365 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogOperationModels.swift:301— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogOperationModels.swift:301-310 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogOperationModels.swift:357-365 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:154— Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:154-162 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentOutputDelegate+Formatting.swift:189-198 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserToolCapabilitySession.swift:678— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserToolCapabilitySession.swift:678-688 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:1161-1169 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder+InteractionPermissions.swift:97— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder+InteractionPermissions.swift:97-106 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:364-372 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:115— Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:115-123 | Apps/CLI/Sources/PeekabooCertificationController/MonitorAttestationRunner.swift:136-144 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:486— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:486-494 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:496-504 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DockServiceProtocol.swift:107— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DockServiceProtocol.swift:107-115 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DockServiceProtocol.swift:117-125 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeSocketIO.swift:130— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeSocketIO.swift:130-140 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeSocketIO.swift:142-150 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+DesktopReadLane.swift:30— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+DesktopReadLane.swift:30-41 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+DesktopReadLane.swift:43-51 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:779— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:779-793 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:1349-1357 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Snapshots.swift:175— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Snapshots.swift:175-185 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Snapshots.swift:187-195 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:26— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:26-34 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:68-76 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/WindowMutationPostcondition.swift:21— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/WindowMutationPostcondition.swift:21-29 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/WindowMutationPostcondition.swift:31-39 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:1362— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:1362-1371 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolEventSummary.swift:194-202 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:476— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:476-484 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:1063-1071 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/DetachedApplicationMetadataWorker.swift:72— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/DetachedApplicationMetadataWorker.swift:72-81 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/DetachedAXWindowEnumerationWorker.swift:214-222 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarWindowCatalog.swift:215— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarWindowCatalog.swift:215-226 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverResolver.swift:228-236 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarWindowCatalog.swift:202— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarWindowCatalog.swift:202-213 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverResolver.swift:218-226 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:445— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:445-457 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:136-144 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService.swift:82— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService.swift:82-91 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService.swift:54-62 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+MutationProof.swift:7— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+MutationProof.swift:7-17 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:926-934 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationResultModels.swift:32— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationResultModels.swift:32-40 | Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/Configuration.swift:78-88 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:113— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:113-121 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgePayloads.swift:477-485 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogServiceProtocol.swift:521— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogServiceProtocol.swift:521-529 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/TextSelectionRequest.swift:17-27 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (14 lines × 2) Apps/CLI/Sources/PeekabooCLI/CLI/Output/JSONOutput.swift:581— Apps/CLI/Sources/PeekabooCLI/CLI/Output/JSONOutput.swift:581-594 | Apps/CLI/Sources/PeekabooCLI/CLI/Output/JSONOutput.swift:618-631 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:46— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:46-59 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:161-174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:46` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:158` calls `invalidInput` and `Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:45` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementDetectionModels.swift:277— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementDetectionModels.swift:277-290 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementDetectionModels.swift:315-328 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementDetectionModels.swift:277` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementDetectionModels.swift:333— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementDetectionModels.swift:333-346 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:187-200 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementDetectionModels.swift:333` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+ActionOutcomes.swift:193— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+ActionOutcomes.swift:193-206 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+ActionOutcomes.swift:242-255 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+ActionOutcomes.swift:193` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraAccessibility.swift:25— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraAccessibility.swift:25-38 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraAccessibility.swift:250-263 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `limit` to `Int = 6` in one and `Int = 4` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (14 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:73— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:73-86 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:213-226 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (14 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/SyntheticInputDriver.swift:323— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/SyntheticInputDriver.swift:323-336 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/SyntheticInputDriver.swift:468-481 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementActions.swift:307— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementActions.swift:307-320 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementActions.swift:405-418 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+TypingOperations.swift:204— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+TypingOperations.swift:204-217 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Interaction.swift:48-61 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (14 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowCGInfoLookup.swift:138— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowCGInfoLookup.swift:138-151 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/WindowIdentityUtilities.swift:392-405 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (14 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:630— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:630-643 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:308-321 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:630` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (14 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext+BrowserSession.swift:46— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext+BrowserSession.swift:46-59 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:824-837 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext+BrowserSession.swift:46` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:21— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:21-34 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:121-134 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:21` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:21` is reached only past a guard at line 12 that tests `request.newInstance` and leaves the function early, and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:121` reads `request.newInstance` with no such check. What separates these copies is not which lines they run but which PRECONDITION they enforce, so one of them is operating on state the other one refuses. Decide which is intended BEFORE unifying them — extract the shared part and whichever copy is missing the check keeps running unchecked, and if the guard is the correct behaviour then that hole is already live.
Duplicated block (14 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Focus.swift:27— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Focus.swift:27-40 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MoveTool+Execution.swift:76-89 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Focus.swift:27` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+AgentExecutionTrace.swift:51— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+AgentExecutionTrace.swift:51-64 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ProcessGenerationObservation.swift:47-60 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+AgentExecutionTrace.swift:51` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:683— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:683-696 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:730-743 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:683` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (14 lines × 2) Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+BrowserBridge.swift:191— Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+BrowserBridge.swift:191-204 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteBrowserMCPClient.swift:774-787 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (14 lines × 2) Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:30— Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:30-43 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/ElementStyleProvider.swift:111-124 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (14 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AnalyzeTool.swift:215— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AnalyzeTool.swift:215-228 | Core/PeekabooCore/Sources/PeekabooAutomation/Utils/AIProviderParser.swift:38-51 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Core/PeekabooCore/Sources/PeekabooAutomation/Utils/AIProviderParser.swift:37` calls `lowercased` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AnalyzeTool.swift:214` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:480— Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:480-493 | Apps/CLI/Sources/PeekabooCertificationController/HeldPointerPlan.swift:218-231 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift` and `Apps/CLI/Sources/PeekabooCertificationController/HeldPointerPlan.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:201— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:201-214 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Interaction.swift:199-212 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (14 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:264— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:264-277 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Interaction.swift:214-227 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (14 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:279— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:279-292 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Interaction.swift:229-242 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (14 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+TypingOperations.swift:90— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+TypingOperations.swift:90-103 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Interaction.swift:12-25 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Boundary violation [package:test-suite-dependency] scripts/test-browser-provider-connection.mjs:8— scripts/test-browser-provider-connection.mjs:8 imports tests/fixtures/devtools-websocket.mjs, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on.
Boundary violation [package:relative-cross-package] scripts/test-browser-provider-connection.mjs:12— scripts/test-browser-provider-connection.mjs:12 reaches into another package with a relative path (../node_modules/.bin) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-browser-provider-connection.mjs:14— scripts/test-browser-provider-connection.mjs:14 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/index.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-browser-provider-connection.mjs:15— scripts/test-browser-provider-connection.mjs:15 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/BrowserManager.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-browser-provider-connection.mjs:16— scripts/test-browser-provider-connection.mjs:16 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/config/mcp-options.js) — import the package by name instead.
Boundary violation [package:test-suite-dependency] scripts/test-browser-provider-connection.mjs:132— scripts/test-browser-provider-connection.mjs:132 imports tests/browser-provider-lifecycle.test.mjs, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:9— scripts/test-chrome-devtools-mcp-contract.mjs:9 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/package.json) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:81— scripts/test-chrome-devtools-mcp-contract.mjs:81 reaches into another package with a relative path (../node_modules/.bin) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:84— scripts/test-chrome-devtools-mcp-contract.mjs:84 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/ToolHandler.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:88— scripts/test-chrome-devtools-mcp-contract.mjs:88 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/tools/tools.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:91— scripts/test-chrome-devtools-mcp-contract.mjs:91 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/config/mcp-options.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:188— scripts/test-chrome-devtools-mcp-contract.mjs:188 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/telemetry/ClearcutLogger.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:210— scripts/test-chrome-devtools-mcp-contract.mjs:210 reaches into another package with a relative path (../node_modules/.bin) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:269— scripts/test-chrome-devtools-mcp-contract.mjs:269 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/McpPage.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:273— scripts/test-chrome-devtools-mcp-contract.mjs:273 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/TextSnapshot.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:277— scripts/test-chrome-devtools-mcp-contract.mjs:277 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/McpResponse.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:281— scripts/test-chrome-devtools-mcp-contract.mjs:281 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/tools/input.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:285— scripts/test-chrome-devtools-mcp-contract.mjs:285 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/formatters/SnapshotFormatter.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:289— scripts/test-chrome-devtools-mcp-contract.mjs:289 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/tools/screenshot.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:293— scripts/test-chrome-devtools-mcp-contract.mjs:293 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/formatters/IssueFormatter.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:297— scripts/test-chrome-devtools-mcp-contract.mjs:297 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/utils/WaitForHelper.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:301— scripts/test-chrome-devtools-mcp-contract.mjs:301 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/tools/script.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:305— scripts/test-chrome-devtools-mcp-contract.mjs:305 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/tools/pages.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:309— scripts/test-chrome-devtools-mcp-contract.mjs:309 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/tools/network.js) — import the package by name instead.
Boundary violation [package:relative-cross-package] scripts/test-chrome-devtools-mcp-contract.mjs:313— scripts/test-chrome-devtools-mcp-contract.mjs:313 reaches into another package with a relative path (../node_modules/chrome-devtools-mcp/build/src/TextSnapshot.js) — import the package by name instead.
Duplicated block (11 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:683— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:683-693 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:729-739 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:683` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:775— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:775-785 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:795-805 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:408— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:408-418 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Live.swift:107-117 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:408` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:306— Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:306-316 | Apps/CLI/Sources/PeekabooCertificationController/ObserverPlan.swift:138-148 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11 lines × 2) Apps/Playground/Playground/ContentView.swift:321— Apps/Playground/Playground/ContentView.swift:321-331 | Apps/Playground/Playground/Views/DialogFixtureView.swift:110-120 — before extracting anything, compare `Apps/Playground/Playground/ContentView.swift` and `Apps/Playground/Playground/Views/DialogFixtureView.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 140 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/Playground/Playground/ContentView.swift:321` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Apps/Playground/Playground/ContentView.swift:319` calls `Divider` and `Apps/Playground/Playground/Views/DialogFixtureView.swift:108` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Window.swift:23— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Window.swift:23-33 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOperator+Window.swift:155-165 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (11 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:219— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:219-229 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:272-282 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:219` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationTargetResolver.swift:282— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationTargetResolver.swift:282-292 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+WindowListing.swift:41-51 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationTargetResolver.swift:282` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:48— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:48-58 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift:634-644 — before extracting anything, compare `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift` and `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (11 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift:1228— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift:1228-1238 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService+Items.swift:124-134 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift:1228` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/FileService.swift:20— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/FileService.swift:20-30 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/FileService.swift:78-88 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/FileService.swift:90` calls `Date`, `addingTimeInterval`, `Double` and `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/FileService.swift:32` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogVerification.swift:371— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogVerification.swift:371-381 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+PreparedActions.swift:102-112 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogVerification.swift:371` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/UIAutomationActionResultSemantics.swift:125— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/UIAutomationActionResultSemantics.swift:125-135 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/UIAutomationActionResultSemantics.swift:186-196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/UIAutomationActionResultSemantics.swift:125` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService.swift:418— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService.swift:418-428 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService.swift:445-455 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService.swift:418` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPExecutionEvidence.swift:76— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPExecutionEvidence.swift:76-86 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:798-808 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPExecutionEvidence.swift:76` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:809` calls `object` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPExecutionEvidence.swift:87` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/PeekabooMCPServer.swift:77— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/PeekabooMCPServer.swift:77-87 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/PeekabooMCPServer.swift:96-106 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/PeekabooMCPServer.swift:77` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/PeekabooMCPServer.swift:75` calls `makeDefaultIfConfigured` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/PeekabooMCPServer.swift:95` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:168— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:168-178 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:212-222 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:168` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:198— Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:198-208 | Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValueConversions.swift:19-29 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:198` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBootstrap.swift:25— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBootstrap.swift:25-35 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBootstrap.swift:65-75 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:497— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:497-507 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:682-692 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:497` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:935— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:935-945 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:951-961 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:935` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationSessionClaim.swift:63— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationSessionClaim.swift:63-73 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDialogService.swift:23-33 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationSessionClaim.swift:63` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+BrowserBridge.swift:45— Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+BrowserBridge.swift:45-55 | Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+BrowserSessions.swift:61-71 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+BrowserBridge.swift:45` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) Apps/CLI/TestFixtures/MCPStubServer.swift:221— Apps/CLI/TestFixtures/MCPStubServer.swift:221-231 | Apps/CLI/TestFixtures/MCPStubServer.swift:244-254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (9 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand+BackgroundTextResult.swift:32— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand+BackgroundTextResult.swift:32-40 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:980-988 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/HeldPointerRunner.swift:435— Apps/CLI/Sources/PeekabooCertificationController/HeldPointerRunner.swift:435-443 | Apps/CLI/Sources/PeekabooCertificationController/HeldPointerRunner.swift:444-452 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) Apps/Mac/Peekaboo/Features/Settings/AddCustomProviderView.swift:566— Apps/Mac/Peekaboo/Features/Settings/AddCustomProviderView.swift:566-574 | Apps/Mac/Peekaboo/Features/Settings/AddCustomProviderView.swift:710-718 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Support.swift:85— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Support.swift:85-93 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationWindowEnumerationContext.swift:200-208 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraAccessibility.swift:56— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraAccessibility.swift:56-64 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraAccessibility.swift:121-129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraAccessibility.swift:56` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:543— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:543-551 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:577-585 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:543` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:522— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:522-530 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:625-633 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Focus.swift:28— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Focus.swift:28-36 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Focus.swift:40-48 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Focus.swift:28` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:246— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:246-254 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:818-826 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:180— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:180-188 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:241-249 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:180` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:273— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:273-281 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:305-313 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:273` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ImageTool+Capture.swift:171— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ImageTool+Capture.swift:171-179 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ImageTool+Capture.swift:204-212 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ImageTool+Capture.swift:171` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:197— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:197-205 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:241-249 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:197` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:46— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:46-54 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:270-278 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:268` calls `decode` and `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:44` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:841— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:841-849 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:851-859 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (9 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:42— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:42-50 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:92-100 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:42` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+ObservationRequest.swift:196— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+ObservationRequest.swift:196-204 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelObservationRequest.swift:86-94 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionTargetOptions.swift:35— Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionTargetOptions.swift:35-43 | Apps/CLI/Sources/PeekabooCLI/Commands/System/WindowCommand+Support.swift:46-54 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:184— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:184-192 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SetValueTool.swift:237-245 — before extracting anything, compare `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SetValueTool.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 77 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/ScriptedInventoryServices.swift:316— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/ScriptedInventoryServices.swift:316-324 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/ScriptedInventoryServices.swift:339-347 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/ScriptedInventoryServices.swift:316` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 2) scripts/support/background-computer-use-probe.swift:4799— scripts/support/background-computer-use-probe.swift:4799-4807 | scripts/support/background-computer-use-probe.swift:4974-4982 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) scripts/support/background-computer-use-probe.swift:5250— scripts/support/background-computer-use-probe.swift:5250-5258 | scripts/support/background-computer-use-probe.swift:5332-5340 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) scripts/support/background-computer-use-probe.swift:6071— scripts/support/background-computer-use-probe.swift:6071-6079 | scripts/support/background-computer-use-probe.swift:6227-6235 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `scripts/support/background-computer-use-probe.swift:6080` calls `currentMonitorProcessReceipt` and `scripts/support/background-computer-use-probe.swift:6236` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 2) scripts/support/background-computer-use-probe.swift:4036— scripts/support/background-computer-use-probe.swift:4036-4044 | scripts/support/background-computer-use-probe.swift:4861-4869 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/support/background-computer-use-probe.swift:4036` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `scripts/support/background-computer-use-probe.swift:4045` calls `publish`, `testEvidence`, `closeForHeartbeat` and `scripts/support/background-computer-use-probe.swift:4870` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×21
Edited copy of a member (11 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:137— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:137-147 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:489-501 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:592— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:592-602 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+ActionResults.swift:187-197 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandHelpRenderer.swift:107— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandHelpRenderer.swift:107-118 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandHelpRenderer.swift:156-166 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/DaemonLaunchPolicy.swift:238— Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/DaemonLaunchPolicy.swift:238-248 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/DaemonLaunchPolicy.swift:250-260 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentExecutionTrace.swift:832— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentExecutionTrace.swift:832-844 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolCallArgumentPreview.swift:58-68 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:842— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:842-852 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/VideoWriter.swift:352-362 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraState.swift:93— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraState.swift:93-103 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraState.swift:154-169 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/TextSelectionRange.swift:17— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/TextSelectionRange.swift:17-28 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ClipboardTemporaryWrite.swift:53-63 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Apps/Playground/Playground/Views/WindowTestingView.swift:278— Apps/Playground/Playground/Views/WindowTestingView.swift:278-288 | Apps/Playground/Playground/Views/WindowTestingView.swift:290-302 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/ControllerEvidence.swift:355— Apps/CLI/Sources/PeekabooCertificationController/ControllerEvidence.swift:355-365 | Apps/CLI/Sources/PeekabooCertificationController/ControllerEvidence.swift:367-380 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/ControllerBuildIdentity.swift:130— Apps/CLI/Sources/PeekabooCertificationController/ControllerBuildIdentity.swift:130-142 | Apps/CLI/Sources/PeekabooCertificationController/ControllerBuildIdentity.swift:144-154 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOperator+Support.swift:59— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOperator+Support.swift:59-69 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOperator+Support.swift:76-91 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:706— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:706-718 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:720-730 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolExecutionPolicy.swift:304— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolExecutionPolicy.swift:304-318 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolExecutionPolicy.swift:320-330 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:1017— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:1017-1028 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:1030-1040 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/FocusCommandUtilities.swift:66— Apps/CLI/Sources/PeekabooCLI/Commands/Shared/FocusCommandUtilities.swift:66-76 | Apps/CLI/Sources/PeekabooCLI/Commands/Shared/FocusCommandUtilities.swift:78-88 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:444— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:444-454 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/WindowManagementServiceProtocol.swift:389-402 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/BridgeCommand+Receipt.swift:404— Apps/CLI/Sources/PeekabooCLI/Commands/Core/BridgeCommand+Receipt.swift:404-418 | Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:284-294 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Core/PeekabooUICore/Sources/PeekabooUICore/Overlay/AllAppsOverlayView.swift:18— Core/PeekabooUICore/Sources/PeekabooUICore/Overlay/AllAppsOverlayView.swift:18-28 | Core/PeekabooUICore/Sources/PeekabooUICore/Overlay/AppOverlayView.swift:17-27 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift:288— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift:288-298 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeModels.swift:308-318 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) scripts/final-qualification/integrated-cu-emitter-calibrator.swift:170— scripts/final-qualification/integrated-cu-emitter-calibrator.swift:170-181 | scripts/support/background-computer-use-probe.swift:1383-1393 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (5 corresponding lines) · ×21
Edited copy of a member (5 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand+Validation.swift:91— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand+Validation.swift:91-95 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand.swift:279-283 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+Output.swift:89— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+Output.swift:89-93 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelOutput.swift:248-256 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/System/WindowCommand+Bindings.swift:249— Apps/CLI/Sources/PeekabooCLI/Commands/System/WindowCommand+Bindings.swift:249-253 | Apps/CLI/Sources/PeekabooCLI/Commands/System/WindowCommand+Bindings.swift:258-262 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/AXDescriptorReader.swift:371— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/AXDescriptorReader.swift:371-378 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:933-937 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/AXDescriptorReader.swift:380— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/AXDescriptorReader.swift:380-387 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:939-943 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeActionProjectionModels.swift:91— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeActionProjectionModels.swift:91-95 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequestResponse.swift:447-451 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/MonitorAttestationRunner.swift:146— Apps/CLI/Sources/PeekabooCertificationController/MonitorAttestationRunner.swift:146-150 | scripts/support/background-computer-use-probe.swift:20-24 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogMetadataReader.swift:23— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogMetadataReader.swift:23-27 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuExtraAXReader.swift:308-312 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService.swift:89— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService.swift:89-93 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/FocusUtilities.swift:703-707 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionProcessRunner.swift:814— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionProcessRunner.swift:814-818 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ShellTool.swift:412-416 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Operations.swift:39— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Operations.swift:39-49 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDialogService.swift:93-97 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/WindowMutationPostcondition.swift:104— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/WindowMutationPostcondition.swift:104-108 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:1165-1169 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:362— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:362-366 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/HotkeyService.swift:669-677 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/QueueMode.swift:211— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/QueueMode.swift:211-215 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Support/ToolFiltering.swift:209-214 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:647— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:647-651 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:1450-1455 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+Screens.swift:116— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+Screens.swift:116-120 | Apps/CLI/Sources/PeekabooCLI/Commands/System/CleanCommand.swift:162-166 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1669— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1669-1676 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowRoutedPointerDriver.swift:952-956 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserSessionHandoff.swift:182— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserSessionHandoff.swift:182-188 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServiceProviding.swift:78-82 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/SnapshotManagerProtocol.swift:268— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/SnapshotManagerProtocol.swift:268-273 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager.swift:171-175 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) Core/PeekabooUICore/Sources/PeekabooUICore/Inspector/OverlayHitTesting.swift:41— Core/PeekabooUICore/Sources/PeekabooUICore/Inspector/OverlayHitTesting.swift:41-45 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/VisualizerScreenGeometry.swift:11-18 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) scripts/final-qualification/integrated-cu-emitter-calibrator.swift:156— scripts/final-qualification/integrated-cu-emitter-calibrator.swift:156-160 | scripts/support/background-computer-use-probe.swift:968-972 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (13 lines × 2) Apps/CLI/Sources/PeekabooCLI/AgentExecutionReleaseGate.swift:235— Apps/CLI/Sources/PeekabooCLI/AgentExecutionReleaseGate.swift:235-247 | Apps/CLI/Sources/PeekabooCLI/AgentExecutionReleaseGate.swift:249-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+ModelParsing.swift:173— Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+ModelParsing.swift:173-185 | Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+Agent.swift:164-176 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+ModelParsing.swift:173` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) Apps/Mac/Peekaboo/Features/Settings/AddCustomProviderView.swift:315— Apps/Mac/Peekaboo/Features/Settings/AddCustomProviderView.swift:315-327 | Apps/Mac/Peekaboo/Features/Settings/CustomProviderView.swift:373-385 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (13 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureSessionOptions.swift:82— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureSessionOptions.swift:82-94 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureSessionResult.swift:36-48 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note what the matched lines are: every one of them assigns one field to another, so the block is a hand-written mapper between two data shapes rather than behaviour with a helper inside it. Extracting one shared function only works if both sites map the SAME pair of types in the same direction — check that first, because inverse or differently-typed mappers have no single function they can both call. Where they do not, the moves that exist are a generated or reflective mapper, a common embedded/base type the fields live on once, or accepting the run and covering it with a test that fails when a field is added to one side only.
Duplicated block (13 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitCaptureGate.swift:468— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitCaptureGate.swift:468-480 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationOCRService.swift:505-517 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (13 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementDetectionModels.swift:517— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementDetectionModels.swift:517-529 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationResultModels.swift:195-207 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementDetectionModels.swift:530` calls `decodeIfPresent` and `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationResultModels.swift:208` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Traversal.swift:51— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Traversal.swift:51-63 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Traversal.swift:90-102 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Traversal.swift:51` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:42— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:42-54 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:123-135 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:40` calls `MainActor` and `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:121` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceWindowMutationDispatcher.swift:90— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceWindowMutationDispatcher.swift:90-102 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceWindowMutationDispatcher.swift:127-139 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceWindowMutationDispatcher.swift:123` calls `removeWindows` and `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceWindowMutationDispatcher.swift:88` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:15— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:15-27 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:135-147 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:15` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:614— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:614-626 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:1175-1187 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:614` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:579— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:579-591 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:625-637 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:579` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost+Clients.swift:176— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost+Clients.swift:176-188 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost+Clients.swift:191-203 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost+Clients.swift:176` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:613— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:613-625 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:643-655 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:613` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:57— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:57-69 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:95-107 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:57` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/AnnotationPreset.swift:62— Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/AnnotationPreset.swift:62-74 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/InspectorPreset.swift:82-94 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/AnnotationPreset.swift:62` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:289— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:289-301 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:358-370 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:289` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/WindowTrackerService.swift:14— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/WindowTrackerService.swift:14-26 | Core/PeekabooCore/Sources/PeekabooBridge/DaemonModels.swift:85-97 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (13 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:172— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:172-184 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:203-215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:172` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:210— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:210-222 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:241-253 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:210` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:56— Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:56-68 | Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ScriptedBridgePeer.swift:74-86 — before extracting anything, compare `Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift` and `Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ScriptedBridgePeer.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:56` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×20
Edited copy of a member (17 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handshake.swift:465— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handshake.swift:465-481 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handshake.swift:483-502 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/WindowIdentityUtilities.swift:319— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/WindowIdentityUtilities.swift:319-342 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/WindowIdentityUtilities.swift:348-364 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:78— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:78-98 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:187-203 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+TurnBoundary.swift:138— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+TurnBoundary.swift:138-154 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+TurnBoundary.swift:170-186 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/ForegroundSemanticObserver.swift:18— Apps/CLI/Sources/PeekabooCertificationController/ForegroundSemanticObserver.swift:18-34 | Apps/CLI/Sources/PeekabooCertificationController/LiveCertificationBridge.swift:62-79 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MCPInteractionTarget.swift:100— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MCPInteractionTarget.swift:100-116 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MCPInteractionTarget.swift:120-138 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationAttestationModels.swift:158— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationAttestationModels.swift:158-174 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationAttestationModels.swift:295-315 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Core/PeekabooUICore/Sources/PeekabooUICore/Presets/AnnotationPreset.swift:83— Core/PeekabooUICore/Sources/PeekabooUICore/Presets/AnnotationPreset.swift:83-99 | Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:50-66 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+BrowserBridge.swift:35— Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+BrowserBridge.swift:35-55 | Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+BrowserSessions.swift:55-71 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:207— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:207-223 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:460-477 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementDetectionModels.swift:176— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementDetectionModels.swift:176-194 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/ElementVisualization.swift:38-54 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+SessionLifecycle.swift:342— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+SessionLifecycle.swift:342-358 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+SessionLifecycle.swift:360-379 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDialogService.swift:238— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDialogService.swift:238-256 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDialogService.swift:258-274 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationTargetModels.swift:65— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationTargetModels.swift:65-83 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationIdentifierMatcher.swift:57-73 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:48— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:48-64 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserModels.swift:48-64 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Apps/CLI/Sources/PeekabooCLI/CLI/Output/JSONOutput.swift:498— Apps/CLI/Sources/PeekabooCLI/CLI/Output/JSONOutput.swift:498-514 | Apps/CLI/Sources/PeekabooCLI/CLI/Output/JSONOutput.swift:516-532 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+CapturePipeline.swift:57— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+CapturePipeline.swift:57-73 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+CapturePipeline.swift:75-94 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationServiceProtocol.swift:436— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationServiceProtocol.swift:436-452 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationServiceProtocol.swift:862-878 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureFrameModels.swift:253— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureFrameModels.swift:253-269 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationCrashInventoryPayload.swift:59-75 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementDetectionModels.swift:556— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementDetectionModels.swift:556-572 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDesktopObservationService.swift:57-73 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×20
Edited copy of a member (15 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PressTool.swift:406— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PressTool.swift:406-422 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PressTool.swift:424-438 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationOCRService.swift:557— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationOCRService.swift:557-571 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateDeadlineRunner.swift:72-86 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationOutputWriter.swift:198— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationOutputWriter.swift:198-212 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationOutputWriter.swift:214-228 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:594— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:594-608 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:610-624 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TargetedTypeInputDriver.swift:60— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TargetedTypeInputDriver.swift:60-76 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TargetedTypeInputDriver.swift:78-92 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:103— Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:103-117 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/InspectorPreset.swift:46-60 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+AgentExecutionTrace.swift:22— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+AgentExecutionTrace.swift:22-36 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ProcessGenerationObservation.swift:16-32 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+Parsing.swift:231— Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+Parsing.swift:231-245 | Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+Parsing.swift:247-262 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift:719— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift:719-737 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/FileService.swift:182-196 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Extras.swift:388— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Extras.swift:388-402 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:287-305 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:219— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:219-233 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:272-286 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:741— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:741-759 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:761-775 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/Configuration.swift:51— Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/Configuration.swift:51-65 | Core/PeekabooFoundation/Sources/PeekabooFoundation/ScreenCaptureKitOwnershipDiagnostic.swift:31-45 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteApplicationService.swift:176— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteApplicationService.swift:176-191 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteApplicationService.swift:250-264 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+DaemonRouting.swift:10— Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+DaemonRouting.swift:10-24 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+DaemonRouting.swift:26-40 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:896— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:896-910 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowCGInfoLookup.swift:118-135 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:80— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:80-94 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserModels.swift:15-30 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowRoutedPointerDriver.swift:613— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowRoutedPointerDriver.swift:613-627 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowRoutedPointerDriver.swift:723-740 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:361— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:361-375 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:409-423 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitProcessCapabilityRegistry.swift:59— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitProcessCapabilityRegistry.swift:59-74 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementTypeAdjuster.swift:11-25 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (6 corresponding lines) · ×20
Edited copy of a member (6 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationTraceRecorder.swift:40— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationTraceRecorder.swift:40-45 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationOutputWriter.swift:230-239 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationWindowEnumerationContext.swift:574— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationWindowEnumerationContext.swift:574-579 | Core/PeekabooUICore/Sources/PeekabooUICore/Inspector/OverlayHitTesting.swift:147-155 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:281— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:281-286 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:301-311 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+PointerResults.swift:260— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+PointerResults.swift:260-267 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+WindowResults.swift:408-413 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogOperationModels.swift:396— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogOperationModels.swift:396-401 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogOperationModels.swift:451-457 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CursorMovementResolver.swift:54— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CursorMovementResolver.swift:54-59 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MovementProfileSupport.swift:21-26 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/ControllerBuildIdentity.swift:195— Apps/CLI/Sources/PeekabooCertificationController/ControllerBuildIdentity.swift:195-200 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:371-378 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:362— Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:362-370 | Apps/CLI/Sources/PeekabooCertificationController/CodeIdentityRunner.swift:123-128 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/System/DaemonCommand+Start.swift:248— Apps/CLI/Sources/PeekabooCLI/Commands/System/DaemonCommand+Start.swift:248-254 | Apps/CLI/Sources/PeekabooCLI/Commands/System/DaemonCommand+Stop.swift:73-78 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/System/MenuCommand+Click.swift:236— Apps/CLI/Sources/PeekabooCLI/Commands/System/MenuCommand+Click.swift:236-242 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter.swift:89-94 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ScreenCaptureServiceProtocol.swift:529— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ScreenCaptureServiceProtocol.swift:529-534 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationTargetModels.swift:138-143 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/MCPDesktopTargetMetadataProjector.swift:13— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/MCPDesktopTargetMetadataProjector.swift:13-19 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:1071-1076 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/CaptureTool+Arguments.swift:91— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/CaptureTool+Arguments.swift:91-96 | Core/PeekabooFoundation/Sources/PeekabooFoundation/InteractionTargetSelector.swift:202-207 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Apps/Mac/Peekaboo/Features/Main/MessageComponents/MessageContentView.swift:136— Apps/Mac/Peekaboo/Features/Main/MessageComponents/MessageContentView.swift:136-141 | Apps/Mac/Peekaboo/Features/Main/SessionHelpers.swift:44-49 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/Application.swift:66— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/Application.swift:66-71 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/GameBridge/GameBridgeDetectionService.swift:85-90 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+WindowResults.swift:376— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+WindowResults.swift:376-381 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolFormatter.swift:95-100 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:653— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:653-658 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService+TargetResolution.swift:29-34 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ClipboardPasteTransactionGate.swift:106— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ClipboardPasteTransactionGate.swift:106-111 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ClipboardPasteTransactionGating.swift:11-16 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+PreparedActions.swift:824— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+PreparedActions.swift:824-829 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/DesktopOperationSnapshotReceiptValidator.swift:115-121 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:153— Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:153-159 | Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ScriptedBridgePeer.swift:171-176 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (4 corresponding lines) · ×20
Edited copy of a member (4 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/DesktopTargetPlanning+Candidates.swift:151— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/DesktopTargetPlanning+Candidates.swift:151-154 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/DesktopTargetPlanning+Candidates.swift:156-159 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:404— Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:404-407 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationObserverSemanticPayload.swift:326-333 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:57— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:57-63 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:129-132 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarWindowCatalog.swift:141— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarWindowCatalog.swift:141-148 | scripts/support/background-computer-use-probe.swift:1213-1216 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:890— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:890-893 | Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:222-225 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Support.swift:63— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Support.swift:63-66 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOperator+Support.swift:32-35 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:93— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:93-96 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:262-265 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:154— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:154-157 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:289-292 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:266— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:266-269 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:315-318 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelOutput.swift:62— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelOutput.swift:62-67 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ScreenCaptureServiceProtocol.swift:478-481 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogOperationDeadline.swift:40— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogOperationDeadline.swift:40-43 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:1141-1144 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:1033— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:1033-1036 | Apps/CLI/Sources/PeekabooCLI/Version.swift:69-74 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:1418— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:1418-1421 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService+SpecialKeys.swift:79-82 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:571— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:571-574 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:542-545 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CursorMovementResolver.swift:61— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CursorMovementResolver.swift:61-64 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MovementProfileSupport.swift:28-31 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogOperationModels.swift:41— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogOperationModels.swift:41-44 | Core/PeekabooFoundation/Sources/PeekabooFoundation/InteractionTargetSelector.swift:76-79 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+Parsing.swift:128— Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+Parsing.swift:128-133 | Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+Agent.swift:482-485 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:704— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:704-707 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteBrowserMCPClient.swift:179-182 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Renderer/VisualizerEventReceiver.swift:12— Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Renderer/VisualizerEventReceiver.swift:12-15 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualizer/VisualizerEventStore.swift:11-14 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) scripts/final-qualification/integrated-cu-emitter-calibrator.swift:448— scripts/final-qualification/integrated-cu-emitter-calibrator.swift:448-453 | scripts/support/background-computer-use-probe.swift:3259-3262 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×19
Edited copy of a member (14 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/HeldPointerPlan.swift:138— Apps/CLI/Sources/PeekabooCertificationController/HeldPointerPlan.swift:138-151 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceipts.swift:101-119 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:41— Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:41-54 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:69-86 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Renderer/VisualizerCoordinator+AnimationAPI.swift:57— Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Renderer/VisualizerCoordinator+AnimationAPI.swift:57-71 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Renderer/VisualizerCoordinator+AnimationAPI.swift:92-105 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/ScriptedInventoryServices.swift:423— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/ScriptedInventoryServices.swift:423-439 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteApplicationService.swift:111-124 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverResolver.swift:173— Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverResolver.swift:173-186 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarWindowCatalog.swift:150-164 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:162— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:162-176 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SetValueTool.swift:201-214 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Capture.swift:83— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Capture.swift:83-101 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Capture.swift:112-125 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationInvalidator.swift:78— Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationInvalidator.swift:78-91 | Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationInvalidator.swift:93-109 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Apps/Playground/Playground/Views/ClickTestingView.swift:200— Apps/Playground/Playground/Views/ClickTestingView.swift:200-216 | Apps/Playground/Playground/Views/ScrollTestingView.swift:414-427 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:243— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:243-257 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:259-272 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteApplicationService.swift:224— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteApplicationService.swift:224-237 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteApplicationService.swift:284-297 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:938— Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:938-955 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handshake.swift:761-774 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:618— Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:618-631 | scripts/support/background-computer-use-probe.swift:2873-2886 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ScrollTool.swift:406— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ScrollTool.swift:406-421 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/TypeTool.swift:977-990 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:343— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:343-357 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:359-372 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift:112— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift:112-125 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift:249-262 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/UIAutomationTarget.swift:375— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/UIAutomationTarget.swift:375-388 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/UIAutomationTarget.swift:390-404 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Renderer/VisualizerCoordinator+AnimationAPI.swift:153— Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Renderer/VisualizerCoordinator+AnimationAPI.swift:153-166 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualizer/VisualizationClient.swift:203-216 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand.swift:48— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand.swift:48-61 | Apps/CLI/Sources/PeekabooCLI/Commands/System/ClipboardCommand+Commander.swift:10-26 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×19
Edited copy of a member (10 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/HeldPointerRunner.swift:26— Apps/CLI/Sources/PeekabooCertificationController/HeldPointerRunner.swift:26-35 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:57-66 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:60— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:60-69 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationRequestModels.swift:409-421 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ScrollCommand.swift:376— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ScrollCommand.swift:376-385 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Enhancements.swift:245-256 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/EOFDrainingTransport.swift:168— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/EOFDrainingTransport.swift:168-177 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/EOFDrainingTransport.swift:179-188 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/WindowListMapper.swift:109— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/WindowListMapper.swift:109-118 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/WindowListMapper.swift:120-132 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/ExactWindowSelectorResolver.swift:166— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/ExactWindowSelectorResolver.swift:166-177 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/ExactWindowSelectorResolver.swift:179-188 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Utilities/PathResolver.swift:98— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Utilities/PathResolver.swift:98-114 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolMCPBridge.swift:602-611 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+MenuBarOCR.swift:7— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+MenuBarOCR.swift:7-21 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+MenuBarOCR.swift:23-32 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Apps/Mac/Peekaboo/Features/Settings/AddCustomProviderView.swift:164— Apps/Mac/Peekaboo/Features/Settings/AddCustomProviderView.swift:164-173 | Apps/Mac/Peekaboo/Features/Settings/AddCustomProviderView.swift:175-184 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:136— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:136-146 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:1377-1386 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:577— Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:577-586 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:1142-1151 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementValueVerification.swift:27— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementValueVerification.swift:27-36 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:526-537 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:502— Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:502-511 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerTransport.swift:237-246 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:654— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:654-663 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService+TargetResolution.swift:101-110 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Window.swift:281— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Window.swift:281-290 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOperator+Window.swift:802-811 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationOCRService.swift:527— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationOCRService.swift:527-538 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/DetachedApplicationMetadataPool.swift:171-180 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionProcessRunner.swift:833— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionProcessRunner.swift:833-842 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ShellTool.swift:432-441 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOperator+Support.swift:37— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOperator+Support.swift:37-46 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/SingleShotFrameSource.swift:77-86 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:22— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:22-31 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:223-232 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×18
Edited copy of a member (7 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationCrashInventoryPayload.swift:341— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationCrashInventoryPayload.swift:341-347 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationMonitorSealValidation.swift:563-569 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:164— Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:164-170 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentOutputDelegate+Formatting.swift:200-206 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeModels.swift:510— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeModels.swift:510-516 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeModels.swift:518-524 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/ConfigCommand+Bindings.swift:42— Apps/CLI/Sources/PeekabooCLI/Commands/Core/ConfigCommand+Bindings.swift:42-48 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/ConfigCommand+Bindings.swift:80-86 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopMutationWatermarkStore.swift:473— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopMutationWatermarkStore.swift:473-481 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopMutationWatermarkStore.swift:625-631 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:369— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:369-375 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/VisionToolFormatter.swift:393-400 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeActionProjectionModels.swift:81— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeActionProjectionModels.swift:81-89 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequestResponse.swift:439-445 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) Apps/CLI/Sources/PeekabooCLI/CLI/Output/CLILogger.swift:202— Apps/CLI/Sources/PeekabooCLI/CLI/Output/CLILogger.swift:202-208 | Apps/CLI/Sources/PeekabooCLI/CLI/Output/CLILogger.swift:211-218 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:103— Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:103-109 | Apps/CLI/Sources/PeekabooCLI/Helpers/JSONFormatting.swift:31-37 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/MonitorAttestationRunner.swift:128— Apps/CLI/Sources/PeekabooCertificationController/MonitorAttestationRunner.swift:128-134 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerTransport.swift:248-254 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:7— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:7-13 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:87-93 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolSnapshotMutation.swift:49— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolSnapshotMutation.swift:49-55 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ButtonActions.swift:13-19 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:107— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:107-113 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:168-174 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:14— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:14-20 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:215-221 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/VideoFrameSource.swift:256— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/VideoFrameSource.swift:256-262 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXActionRunner.swift:94-100 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:126— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:126-136 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SetValueCommand.swift:102-108 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ExactWindowHeldPointerLifecycle.swift:855— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ExactWindowHeldPointerLifecycle.swift:855-861 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:798-804 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:959— Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:959-970 | Apps/Mac/Peekaboo/Features/Permissions/PermissionChecklistView.swift:17-23 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (3 corresponding lines) · ×18
Edited copy of a member (3 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ChromeProcessCodeSignatureValidator.swift:159— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ChromeProcessCodeSignatureValidator.swift:159-161 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:410-412 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:990— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:990-992 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogElementClassification.swift:125-127 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:110— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:110-115 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Interaction.swift:8-10 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopMutationWatermarkStore.swift:603— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopMutationWatermarkStore.swift:603-605 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopOperationLaneCoordinator.swift:324-326 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCaptureBinding.swift:219— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCaptureBinding.swift:219-221 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:934-936 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:537— Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:537-539 | Core/PeekabooCore/Sources/PeekabooAutomation/Services/AI/AnalyzeImageFile.swift:79-81 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopObservationTargetChangeDiagnostic.swift:12— Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopObservationTargetChangeDiagnostic.swift:12-14 | Core/PeekabooFoundation/Sources/PeekabooFoundation/ScreenCaptureKitOwnershipDiagnostic.swift:10-12 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopObservationTargetChangeDiagnostic.swift:24— Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopObservationTargetChangeDiagnostic.swift:24-26 | Core/PeekabooFoundation/Sources/PeekabooFoundation/ScreenCaptureKitOwnershipDiagnostic.swift:18-20 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopObservationTargetChangeDiagnostic.swift:36— Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopObservationTargetChangeDiagnostic.swift:36-38 | Core/PeekabooFoundation/Sources/PeekabooFoundation/ScreenCaptureKitOwnershipDiagnostic.swift:137-139 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Apps/CLI/Sources/PeekabooCLI/CLI/Configuration/CLIConfiguration.swift:171— Apps/CLI/Sources/PeekabooCLI/CLI/Configuration/CLIConfiguration.swift:171-174 | Apps/Mac/Peekaboo/Core/Settings.swift:973-975 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+PointerKeyboardOperations.swift:92— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+PointerKeyboardOperations.swift:92-94 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Interaction.swift:127-129 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Apps/CLI/Sources/PeekabooCLI/CLI/Configuration/CLIConfiguration.swift:165— Apps/CLI/Sources/PeekabooCLI/CLI/Configuration/CLIConfiguration.swift:165-168 | Apps/Mac/Peekaboo/Core/Settings.swift:969-971 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/ControllerBuildIdentity.swift:223— Apps/CLI/Sources/PeekabooCertificationController/ControllerBuildIdentity.swift:223-225 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:414-416 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopMutationWatermarkStore.swift:594— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopMutationWatermarkStore.swift:594-596 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopOperationLaneCoordinator.swift:320-322 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:1281— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:1281-1283 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Types.swift:159-161 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:37— Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:37-39 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/GameBridge/GameBridgeDetectionService.swift:92-94 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureFrameSource.swift:81— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureFrameSource.swift:81-84 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/SingleShotFrameSource.swift:23-25 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) scripts/test-release-archive-publication.py:14— scripts/test-release-archive-publication.py:14-16 | scripts/test-standalone-cli-install.py:16-18 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Low cohesion: RemoteWindowManagementService (LCOM4 14) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:9— RemoteWindowManagementService's methods fall into 14 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 14 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: CoordinateTransformer (LCOM4 11) Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/CoordinateTransformer.swift:15— CoordinateTransformer's methods fall into 11 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 11 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WindowManagementService (LCOM4 10) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService.swift:39— WindowManagementService's methods fall into 10 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 10 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: ApplicationService (LCOM4 9) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService.swift:44— ApplicationService's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WindowIdentityService (LCOM4 7) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/WindowIdentityUtilities.swift:83— WindowIdentityService's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: RemoteApplicationService (LCOM4 7) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteApplicationService.swift:9— RemoteApplicationService's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: ModelMessage (LCOM4 6) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolMCPBridge.swift:745— ModelMessage's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: StatusBarController (LCOM4 6) Apps/Mac/Peekaboo/Features/StatusBar/StatusBarController.swift:46— StatusBarController's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: UnknownToolFormatter (LCOM4 5) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentOutputDelegate+Formatting.swift:368— UnknownToolFormatter's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: RemoteSnapshotManager (LCOM4 5) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteSnapshotManager.swift:8— RemoteSnapshotManager's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: FocusDispatchGuard (LCOM4 4) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/FocusUtilities.swift:130— FocusDispatchGuard's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: SnapshotStorageActor (LCOM4 4) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotStorageActor.swift:5— SnapshotStorageActor's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: PermissionsService (LCOM4 4) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/PermissionsService.swift:8— PermissionsService's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: PeekabooAgentService (LCOM4 4) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService.swift:148— PeekabooAgentService's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: BaseToolFormatter (LCOM4 4) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolFormatter.swift:36— BaseToolFormatter's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: PeekabooServices (LCOM4 4) Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices.swift:16— PeekabooServices's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: ProbeView (LCOM4 4) Apps/Playground/Playground/Views/MouseMoveProbeView.swift:17— ProbeView's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: ProxyAXView (LCOM4 4) Apps/Playground/Playground/Views/ScrollTestingView.swift:494— ProxyAXView's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×17
Edited copy of a member (12 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentCompatibilityTypes.swift:191— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentCompatibilityTypes.swift:191-202 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentExecutionTrace.swift:62-80 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:9— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:9-22 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:342-353 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundWindowChromeReader.swift:407— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundWindowChromeReader.swift:407-418 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowRoutedPointerDriver.swift:880-894 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:418— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:418-429 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:431-442 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:554— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:554-565 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:567-579 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/PermissionsService.swift:148— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/PermissionsService.swift:148-159 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/PermissionsService.swift:211-225 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) Core/PeekabooCore/Sources/PeekabooAutomation/Services/AI/PeekabooAIService.swift:143— Core/PeekabooCore/Sources/PeekabooAutomation/Services/AI/PeekabooAIService.swift:143-154 | Core/PeekabooCore/Sources/PeekabooAutomation/Services/AI/PeekabooAIService.swift:156-170 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) Core/PeekabooCore/Sources/PeekabooAutomation/VisualizerAutomationFeedbackClient.swift:67— Core/PeekabooCore/Sources/PeekabooAutomation/VisualizerAutomationFeedbackClient.swift:67-78 | Core/PeekabooCore/Sources/PeekabooAutomation/VisualizerAutomationFeedbackClient.swift:80-91 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:129— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:129-140 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:144-161 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchCaptureSession+Loop.swift:647— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchCaptureSession+Loop.swift:647-659 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptArchiveMaintenance.swift:251-262 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/SmartCaptureImageProcessor.swift:5— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/SmartCaptureImageProcessor.swift:5-16 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Enhancements.swift:207-218 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogServiceProtocol.swift:144— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogServiceProtocol.swift:144-155 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDialogService.swift:99-116 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:9— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:9-21 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:23-34 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureOutput.swift:148— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureOutput.swift:148-163 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationROI.swift:488-499 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Capture.swift:70— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Capture.swift:70-81 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:143-154 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOperator.swift:51— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOperator.swift:51-62 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService.swift:182-193 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:122— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:122-133 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:287-305 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (8 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:215— Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:215-222 | Apps/CLI/Sources/PeekabooCertificationController/ObserveOnlyRunner.swift:164-171 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:215` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/ForegroundSemanticObserver.swift:115— Apps/CLI/Sources/PeekabooCertificationController/ForegroundSemanticObserver.swift:115-122 | Apps/CLI/Sources/PeekabooCertificationController/LiveCertificationBridge.swift:200-207 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCertificationController/ForegroundSemanticObserver.swift:115` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) Apps/Mac/Peekaboo/Features/Main/AnimatedToolIcon.swift:21— Apps/Mac/Peekaboo/Features/Main/AnimatedToolIcon.swift:21-28 | Apps/Mac/Peekaboo/Features/Main/AnimatedToolIcon.swift:57-64 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchCaptureSession+Loop.swift:202— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchCaptureSession+Loop.swift:202-209 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchCaptureSession+Loop.swift:220-227 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchCaptureSession+Loop.swift:202` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:572— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:572-579 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeJSONValue.swift:36-43 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:572` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeJSONValue.swift:35` calls `encodeNil` and `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:571` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/GestureService.swift:32— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/GestureService.swift:32-39 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/GestureService.swift:96-103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/GestureService.swift:32` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Actions.swift:44— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Actions.swift:44-51 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Actions.swift:87-94 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Actions.swift:44` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ModifierClick.swift:197— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ModifierClick.swift:197-204 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ModifierClick.swift:230-237 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ModifierClick.swift:197` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:365— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:365-372 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SpaceTool+Handlers.swift:76-83 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:365` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/VisionToolFormatter.swift:190— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/VisionToolFormatter.swift:190-197 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+WindowResults.swift:109-116 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/VisionToolFormatter.swift:190` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:50— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:50-57 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:112-121 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:112` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+BrowserConnect.swift:48— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+BrowserConnect.swift:48-55 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+BrowserHandlers.swift:30-37 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (8 lines × 2) Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+BrowserBridge.swift:140— Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+BrowserBridge.swift:140-147 | Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+BrowserSessions.swift:118-125 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+BrowserBridge.swift:140` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1320— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1320-1327 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveScope.swift:176-183 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveScope.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PressCommand.swift:395— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PressCommand.swift:395-402 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/TypeCommand.swift:608-615 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementActions.swift:210— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementActions.swift:210-219 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Interaction.swift:114-121 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:152— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:152-159 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:180-190 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×14
Edited copy of a member (19 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Resolution.swift:62— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Resolution.swift:62-82 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MoveTool+Parsing.swift:6-24 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelOutput.swift:202— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelOutput.swift:202-220 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelOutput.swift:222-246 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:282— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:282-305 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:307-325 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:194— Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:194-213 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeJSONValue.swift:31-49 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationAttestationModels.swift:26— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationAttestationModels.swift:26-44 | Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:726-746 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:757— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:757-777 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:1329-1347 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService.swift:69— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService.swift:69-87 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService.swift:105-124 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) Apps/CLI/Sources/PeekabooCLI/CLI/CommanderRuntimeRouter+Help.swift:214— Apps/CLI/Sources/PeekabooCLI/CLI/CommanderRuntimeRouter+Help.swift:214-232 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandHelpRenderer.swift:135-154 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:169— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:169-187 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:1479-1497 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverDetector.swift:130— Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverDetector.swift:130-148 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ScreenService.swift:78-110 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/UIInputPolicy.swift:78— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/UIInputPolicy.swift:78-98 | Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/Configuration.swift:218-236 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserModels.swift:291— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserModels.swift:291-310 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserModels.swift:312-330 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:44— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:44-68 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:209-227 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:231— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:231-249 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHostIdentity.swift:17-35 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Change coupling: CommanderBinder.swift ↔ BridgeCapabilityPolicy.swift Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:1— `Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in different directories, but in this ecosystem the namespace is declared in the FILE, not by the folder — so the two may well share one namespace and reference each other with no import for this pass to see. Read the pair before acting: if one derives from or overrides the other, the dependency is explicit in the type declaration and the co-change is definitional; if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE and the thing to add is a comment saying so; if they simply belong together, co-locate them; if none of these holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `ed9c8f7e` fix(runtime): declare route-specific permission needs for input comma…; `33c27f4d` fix(bridge): gate capture engine routing (#398); `e665dfb6` fix(cli): preserve capture engine host routing (#395) — run `git show` on any of them.
Change coupling: SpaceCommand.swift ↔ WindowCommand.swift Apps/CLI/Sources/PeekabooCLI/Commands/System/SpaceCommand.swift:1— `Apps/CLI/Sources/PeekabooCLI/Commands/System/SpaceCommand.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/System/WindowCommand.swift` change together 62% of the time (13 of the 21 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `3c5576b2` fix(cli): stabilize JSON output + automation tests; `5b6dcbec` feat(cli): show help for bare commands; `7eee2c99` refactor(cli): migrate all CLI commands to use injected services — run `git show` on any of them.
Change coupling: ScreenCaptureService+Support.swift ↔ ScreenCaptureService.swift Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Support.swift:1— `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Support.swift` and `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService.swift` change together 60% of the time (15 of the 25 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 15 shared commits counted here, the most recent 3 are `7fcffdb4` refactor(capture): route legacy area through operator; `f185e4b7` refactor(capture): extract permission gate; `a4a92a77` refactor(capture): centralize screen scale planning — run `git show` on any of them.
Change coupling: ActionTool.swift ↔ TypeTool.swift Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:1— `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/TypeTool.swift` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `194cd90d` fix: enforce snapshot mutation leases across CLI and MCP (#789); `37a62edd` refactor: centralize desktop action composition (#453); `24deee95` fix(mcp): consume canonical action outcomes (#447) — run `git show` on any of them.
Change coupling: ErrorHandling.swift ↔ AgentCommand.swift Apps/CLI/Sources/PeekabooCLI/CLI/Utilities/ErrorHandling.swift:1— `Apps/CLI/Sources/PeekabooCLI/CLI/Utilities/ErrorHandling.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand.swift` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in different directories, but in this ecosystem the namespace is declared in the FILE, not by the folder — so the two may well share one namespace and reference each other with no import for this pass to see. Read the pair before acting: if one derives from or overrides the other, the dependency is explicit in the type declaration and the co-change is definitional; if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE and the thing to add is a comment saying so; if they simply belong together, co-locate them; if none of these holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `0399222f` Clarify complex agent and CLI paths; `b464ec91` fix: Complete Phase 2 modularization and remove unused AsyncHTTPClien… (at that commit the files were still `Apps/CLI/Sources/peekaboo/CLI/Utilities/ErrorHandling.swift` and `Apps/CLI/Sources/peekaboo/Commands/AI/AgentCommand.swift`); `a2081a72` fix: Migrate error types from ApplicationError/CLIError to PeekabooError (at that commit the files were still `Apps/CLI/Sources/peekaboo/CLI/Utilities/ErrorHandling.swift` and `Apps/CLI/Sources/peekaboo/Commands/AI/AgentCommand.swift`) — run `git show` on any of them.
Change coupling: ClickCommand.swift ↔ ScrollCommand.swift Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:1— `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ScrollCommand.swift` change together 54% of the time (19 of the 35 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 19 shared commits counted here, the most recent 3 are `822d755c` feat(cli): consume canonical action outcomes (#445); `6448025f` fix: centralize pre-dispatch refusal outcomes (#444); `9498938b` feat(interaction): report target point diagnostics — run `git show` on any of them.
Change coupling: DragTool.swift ↔ MoveTool.swift Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool.swift:1— `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool.swift` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MoveTool.swift` change together 54% of the time (7 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `ab31e91e` fix(mcp): reject unsafe numeric arguments (#409); `36661365` fix(agent): align observation guidance with inspect_ui; `5b2c5b8a` build: update MCP runtime for swift-sdk 0.12 — run `git show` on any of them.
Change coupling: DragCommand.swift ↔ MoveCommand.swift Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand.swift:1— `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand.swift` change together 53% of the time (19 of the 36 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 19 shared commits counted here, the most recent 3 are `b9e8e22c` fix(cli): validate coordinates before runtime selection (#469); `6448025f` fix: centralize pre-dispatch refusal outcomes (#444); `555132f3` refactor(cli): split drag destination resolution — run `git show` on any of them.
Change coupling: ScrollTool.swift ↔ TypeTool.swift Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ScrollTool.swift:1— `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ScrollTool.swift` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/TypeTool.swift` change together 53% of the time (10 of the 19 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `194cd90d` fix: enforce snapshot mutation leases across CLI and MCP (#789); `37a62edd` refactor: centralize desktop action composition (#453); `24deee95` fix(mcp): consume canonical action outcomes (#447) — run `git show` on any of them.
Change coupling: ClickCommand.swift ↔ MoveCommand.swift Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:1— `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand.swift` change together 50% of the time (18 of the 36 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 18 shared commits counted here, the most recent 3 are `6448025f` fix: centralize pre-dispatch refusal outcomes (#444); `9498938b` feat(interaction): report target point diagnostics; `e77d1854` fix(interaction): refresh stale query snapshots — run `git show` on any of them.
Change coupling: CleanCommand.swift ↔ DialogCommand.swift Apps/CLI/Sources/PeekabooCLI/Commands/System/CleanCommand.swift:1— `Apps/CLI/Sources/PeekabooCLI/Commands/System/CleanCommand.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/System/DialogCommand.swift` change together 50% of the time (8 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `91c6e874` fix(cli): harden e2e automation flows; `5b6dcbec` feat(cli): show help for bare commands; `7eee2c99` refactor(cli): migrate all CLI commands to use injected services — run `git show` on any of them.
Change coupling: AgentCommand+ModelParsing.swift ↔ PeekabooAgentService+Execution.swift Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+ModelParsing.swift:1— `Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+ModelParsing.swift` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift` change together 50% of the time (7 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in different directories, but in this ecosystem the namespace is declared in the FILE, not by the folder — so the two may well share one namespace and reference each other with no import for this pass to see. Read the pair before acting: if one derives from or overrides the other, the dependency is explicit in the type declaration and the co-change is definitional; if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE and the thing to add is a comment saying so; if they simply belong together, co-locate them; if none of these holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `33c55947` feat(agent): add GPT-6.1 Sol selection (#873); `01523a55` feat(agent): add GPT-6 model selection (#833); `807bb841` feat(agent): support GPT-5.6 and Claude Sonnet 5 models (#247) — run `git show` on any of them.
Change coupling: PeekabooBridgeClient+Transport.swift ↔ PeekabooBridgeServer.swift Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:1— `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift` and `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift` change together 50% of the time (6 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `c693cd61` refactor(bridge): centralize request planning (#568); `2976dea7` feat(bridge): attest certification producers (#564); `680d9797` fix(bridge): refuse unverifiable set-value hosts (#559) — run `git show` on any of them.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×13
Edited copy of a member (18 corresponding lines) Apps/Mac/Peekaboo/Features/Settings/SettingsWindow.swift:393— Apps/Mac/Peekaboo/Features/Settings/SettingsWindow.swift:393-410 | Apps/Mac/Peekaboo/Features/Settings/SettingsWindow.swift:412-432 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentOutputDelegate.swift:277— Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentOutputDelegate.swift:277-302 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentOutputDelegate.swift:306-323 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+PointerKeyboardOperations.swift:326— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+PointerKeyboardOperations.swift:326-343 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+PointerKeyboardOperations.swift:358-383 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/PeekabooMCPServer.swift:68— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/PeekabooMCPServer.swift:68-87 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Server/PeekabooMCPServer.swift:89-106 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:36— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:36-53 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:78-95 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:103— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:103-120 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SetValueTool.swift:114-132 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:347— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:347-364 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:366-384 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Extras.swift:89— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Extras.swift:89-108 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Extras.swift:110-127 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:108— Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:108-126 | Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+BrowserBridge.swift:306-323 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:1293— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:1293-1311 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:1349-1366 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/CommandActionSequenceAccumulator.swift:48— Apps/CLI/Sources/PeekabooCLI/Commands/Shared/CommandActionSequenceAccumulator.swift:48-65 | Apps/CLI/Sources/PeekabooCLI/Commands/Shared/CommandActionSequenceAccumulator.swift:124-141 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationServiceProtocol.swift:454— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationServiceProtocol.swift:454-471 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationServiceProtocol.swift:807-824 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementLabelResolver.swift:13— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementLabelResolver.swift:13-31 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeModels.swift:364-381 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×13
Edited copy of a member (8 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationRequestModels.swift:136— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationRequestModels.swift:136-145 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationOCRService.swift:57-64 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/CaptureCoordinateContextMetadata.swift:58— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/CaptureCoordinateContextMetadata.swift:58-65 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ObservationDiagnosticsMetadata.swift:97-104 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/ControllerBuildIdentity.swift:211— Apps/CLI/Sources/PeekabooCertificationController/ControllerBuildIdentity.swift:211-221 | scripts/final-qualification/integrated-cu-emitter-calibrator.swift:214-221 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogOperationModels.swift:68— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogOperationModels.swift:68-75 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserModels.swift:244-252 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopMutationWatermarkStore.swift:585— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopMutationWatermarkStore.swift:585-592 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift:42-49 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:912— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:912-919 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:675-682 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:8— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:8-15 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:17-24 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:565— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:565-576 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:891-898 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ForegroundModifierClickExecutor.swift:628— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ForegroundModifierClickExecutor.swift:628-635 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ForegroundModifierClickExecutor.swift:1017-1024 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:191— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:191-198 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:252-259 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationServiceProtocol.swift:266— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationServiceProtocol.swift:266-276 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ClipboardService.swift:121-128 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/DetachedAXWindowEnumerationWorker.swift:53— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/DetachedAXWindowEnumerationWorker.swift:53-61 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:49-56 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteScreenCaptureService.swift:186— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteScreenCaptureService.swift:186-193 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:610-617 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (15 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Screenshots.swift:132— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Screenshots.swift:132-146 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Elements.swift:28-42 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Screenshots.swift:132` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:341— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:341-355 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:363-377 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (15 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ForegroundModifierClickExecutor.swift:648— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ForegroundModifierClickExecutor.swift:648-662 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ForegroundModifierClickExecutor.swift:725-739 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraAccessibility.swift:72— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraAccessibility.swift:72-86 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraAccessibility.swift:306-320 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraAccessibility.swift:72` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:241— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:241-255 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:321-335 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:241` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:854— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:854-868 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:907-921 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:854` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) Core/PeekabooUICore/Sources/PeekabooUICore/Presets/AnnotationPreset.swift:105— Core/PeekabooUICore/Sources/PeekabooUICore/Presets/AnnotationPreset.swift:105-119 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/AnnotationPreset.swift:42-56 — before extracting anything, compare `Core/PeekabooUICore/Sources/PeekabooUICore/Presets/AnnotationPreset.swift` and `Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/AnnotationPreset.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) Core/PeekabooUICore/Sources/PeekabooUICore/Presets/AnnotationPreset.swift:141— Core/PeekabooUICore/Sources/PeekabooUICore/Presets/AnnotationPreset.swift:141-155 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/AnnotationPreset.swift:78-92 — before extracting anything, compare `Core/PeekabooUICore/Sources/PeekabooUICore/Presets/AnnotationPreset.swift` and `Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/AnnotationPreset.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:744— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:744-758 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService+TargetResolution.swift:36-50 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:744` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:49— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:49-63 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:147-161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:49` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:49` is reached only past a guard at line 12 that tests `request.newInstance` and leaves the function early, and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:147` reads `request.newInstance` with no such check. What separates these copies is not which lines they run but which PRECONDITION they enforce, so one of them is operating on state the other one refuses. Decide which is intended BEFORE unifying them — extract the shared part and whichever copy is missing the check keeps running unchecked, and if the guard is the correct behaviour then that hole is already live.
Duplicated block (15 lines × 2) scripts/support/background-computer-use-probe.swift:4432— scripts/support/background-computer-use-probe.swift:4432-4446 | scripts/support/background-computer-use-probe.swift:4447-4461 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/support/background-computer-use-probe.swift:4430` calls `ProcessGenerationIdentity` and `scripts/support/background-computer-use-probe.swift:4446` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 2) scripts/support/background-computer-use-probe.swift:5911— scripts/support/background-computer-use-probe.swift:5911-5925 | scripts/support/background-computer-use-probe.swift:5967-5981 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:194— Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:194-208 | Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ScriptedBridgePeer.swift:188-202 — before extracting anything, compare `Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift` and `Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ScriptedBridgePeer.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication· Edited copy of a member (21 corresponding lines) · ×12
Edited copy of a member (21 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:242— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:242-262 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:295-315 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClipboardTool.swift:170— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClipboardTool.swift:170-195 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClipboardTool.swift:219-239 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift:712— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift:712-732 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift:734-755 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift:357— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift:357-378 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ImageTool+Capture.swift:569-589 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:108— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:108-128 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserModels.swift:79-100 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/SnapshotTargetReceiptPlanner.swift:94— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/SnapshotTargetReceiptPlanner.swift:94-114 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/SnapshotTargetReceiptPlanner.swift:117-137 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService+Actions.swift:274— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService+Actions.swift:274-298 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService+Actions.swift:300-320 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+PointerResults.swift:9— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+PointerResults.swift:9-30 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+WindowResults.swift:27-47 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:730— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:730-754 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementClassifier.swift:16-36 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionTargetOptions.swift:65— Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionTargetOptions.swift:65-85 | Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionTargetOptions.swift:87-108 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PressTool.swift:16— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PressTool.swift:16-36 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/TypeTool.swift:16-38 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand.swift:384— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand.swift:384-409 | Apps/CLI/Sources/PeekabooCLI/Commands/System/WindowCommand+Bindings.swift:175-195 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×11
Edited copy of a member (20 corresponding lines) Apps/Mac/Peekaboo/Core/Settings.swift:645— Apps/Mac/Peekaboo/Core/Settings.swift:645-710 | Apps/Mac/Peekaboo/Core/Settings.swift:864-891 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1140— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1140-1159 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1161-1183 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/HeldPointerRunner.swift:129— Apps/CLI/Sources/PeekabooCertificationController/HeldPointerRunner.swift:129-148 | Apps/CLI/Sources/PeekabooCertificationController/HeldPointerRunner.swift:165-191 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:38— Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:38-57 | Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:59-79 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/SmartCaptureImageProcessor.swift:42— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/SmartCaptureImageProcessor.swift:42-61 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchCaptureArtifactWriter.swift:95-115 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+OperationReceipts.swift:551— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+OperationReceipts.swift:551-577 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+OperationReceipts.swift:622-641 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift:771— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift:771-790 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift:792-813 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:1023— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:1023-1042 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:1044-1063 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:19— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:19-39 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:379-398 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:147— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:147-166 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:168-190 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/HotkeyService.swift:638— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/HotkeyService.swift:638-657 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:1032-1051 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (28 corresponding lines) · ×10
Edited copy of a member (28 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Responses.swift:9— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Responses.swift:9-41 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Responses.swift:43-70 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:162— Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:162-192 | Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValueConversions.swift:79-106 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:588— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:588-615 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveOptions.swift:6-33 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:1132— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:1132-1168 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:1170-1197 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/BridgeCommand+Receipt.swift:420— Apps/CLI/Sources/PeekabooCLI/Commands/Core/BridgeCommand+Receipt.swift:420-456 | Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:313-340 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Captures.swift:7— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Captures.swift:7-37 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Captures.swift:126-153 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraState.swift:188— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraState.swift:188-215 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraState.swift:217-249 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+TypingOperations.swift:105— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+TypingOperations.swift:105-133 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+TypingOperations.swift:146-173 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureFrameModels.swift:99— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureFrameModels.swift:99-131 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureFrameModels.swift:134-161 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:19— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:19-46 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClipboardTool.swift:17-45 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (17 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+MenuBarCandidates.swift:61— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+MenuBarCandidates.swift:61-77 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+MenuBarCandidates.swift:97-113 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+MenuBarCandidates.swift:61` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1250— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1250-1266 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveScope.swift:105-121 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveScope.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionTargetOptions+CommanderMetadata.swift:18— Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionTargetOptions+CommanderMetadata.swift:18-34 | Apps/CLI/Sources/PeekabooCLI/Commands/System/WindowIdentificationOptions+CommanderMetadata.swift:18-34 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionTargetOptions+CommanderMetadata.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/System/WindowIdentificationOptions+CommanderMetadata.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 47 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionTargetOptions+CommanderMetadata.swift:18` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+ScreenArea.swift:57— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+ScreenArea.swift:57-73 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Window.swift:97-113 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+ScreenArea.swift:57` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:134— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:134-150 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:215-231 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:134` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:246— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:246-262 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:299-315 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:246` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/UIInputPolicy.swift:13— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/UIInputPolicy.swift:13-29 | Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/Configuration.swift:249-265 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (17 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:1152— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:1152-1168 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:1181-1197 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:1152` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 2) Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:135— Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:135-151 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/ElementStyleProvider.swift:159-175 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:135` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:228— Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:228-244 | Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ScriptedBridgePeer.swift:241-257 — before extracting anything, compare `Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift` and `Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ScriptedBridgePeer.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:228` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×9
Edited copy of a member (16 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AnalyzeTool.swift:214— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AnalyzeTool.swift:214-239 | Core/PeekabooCore/Sources/PeekabooAutomation/Utils/AIProviderParser.swift:36-54 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:552— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:552-567 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeJSONValue.swift:12-29 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:1213— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:1213-1228 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:1240-1255 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+ScreenCaptureKitOwner.swift:703— Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+ScreenCaptureKitOwner.swift:703-718 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+ScreenCaptureKitOwner.swift:720-735 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:86— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:86-102 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:8-23 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ElementToolFormatter.swift:37— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ElementToolFormatter.swift:37-54 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/SystemToolFormatter.swift:114-129 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+AgentExecutionTrace.swift:75— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+AgentExecutionTrace.swift:75-90 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ProcessGenerationObservation.swift:71-87 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:255— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:255-270 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:150-165 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/BridgeTestFixtures.swift:223— Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/BridgeTestFixtures.swift:223-240 | Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/BridgeTestFixtures.swift:242-257 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 7+ corresponding lines) · ×9
Edited copies of one member (3 members, 7+ corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/ControllerBuildIdentity.swift:163— Apps/CLI/Sources/PeekabooCertificationController/ControllerBuildIdentity.swift:163-169 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitProcessCapabilityRegistry.swift:532-538 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/RunningApplicationProcessIdentity.swift:88-95 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:862— Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:862-876 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:1123-1129 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:1234-1249 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/CLI/Completions/FishCompletionRenderer.swift:184— Apps/CLI/Sources/PeekabooCLI/CLI/Completions/FishCompletionRenderer.swift:184-190 | Apps/CLI/Sources/PeekabooCLI/CLI/Completions/ZshCompletionRenderer.swift:190-196 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService+Actions.swift:95-102 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:141— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:141-148 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SelectTextCommand.swift:116-124 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SetValueCommand.swift:113-119 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand.swift:469— Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand.swift:469-475 | Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand.swift:483-490 | Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand.swift:543-551 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:307— Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:307-313 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:814-821 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerTransport.swift:291-297 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/System/DialogCommand.swift:540— Apps/CLI/Sources/PeekabooCLI/Commands/System/DialogCommand.swift:540-546 | Apps/CLI/Sources/PeekabooCLI/Commands/System/MenuCommand+Output.swift:98-114 | Apps/CLI/Sources/PeekabooCLI/Commands/System/MenuCommand+Output.swift:116-131 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) Apps/Mac/Peekaboo/Core/ConversationSession.swift:99— Apps/Mac/Peekaboo/Core/ConversationSession.swift:99-105 | Apps/Mac/Peekaboo/Core/ConversationSession.swift:107-113 | Apps/Mac/Peekaboo/Core/ConversationSession.swift:115-121 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Helpers/JSONFormatting.swift:22— Apps/CLI/Sources/PeekabooCLI/Helpers/JSONFormatting.swift:22-28 | Apps/Mac/Peekaboo/Features/Main/ToolFormatter.swift:51-58 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:1397-1405 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (18 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Window.swift:66— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Window.swift:66-83 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Window.swift:166-183 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/SnapshotTargetReceiptPlanner.swift:95— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/SnapshotTargetReceiptPlanner.swift:95-112 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/SnapshotTargetReceiptPlanner.swift:118-135 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/SnapshotTargetReceiptPlanner.swift:95` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (18 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:525— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:525-542 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:171-188 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:525` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (18 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:146— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:146-163 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:201-218 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MenuTool.swift:122— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MenuTool.swift:122-139 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MenuTool.swift:213-230 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MenuTool.swift:122` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionTraceModels.swift:95— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionTraceModels.swift:95-112 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionTraceModels.swift:266-283 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionTraceModels.swift:121— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionTraceModels.swift:121-138 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionTraceModels.swift:303-320 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note what the matched lines are: every one of them assigns one field to another, so the block is a hand-written mapper between two data shapes rather than behaviour with a helper inside it. Extracting one shared function only works if both sites map the SAME pair of types in the same direction — check that first, because inverse or differently-typed mappers have no single function they can both call. Where they do not, the moves that exist are a generated or reflective mapper, a common embedded/base type the fields live on once, or accepting the run and covering it with a test that fails when a field is added to one side only.
Duplicated block (18 lines × 2) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:463— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:463-480 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:493-510 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:463` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverResolver.swift:175— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverResolver.swift:175-192 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarWindowCatalog.swift:166-183 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 3) Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:146— Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:146-151 | Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:163-168 | Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:182-189 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:146` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 3) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:152— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:152-157 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PressTool.swift:121-126 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/TypeTool.swift:148-153 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (6 lines × 3) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool.swift:136— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool.swift:136-141 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool.swift:150-155 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool.swift:157-162 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool.swift:136` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Routing.swift:109— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Routing.swift:109-114 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Routing.swift:134-139 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Routing.swift:147-152 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Routing.swift:109` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:102— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:102-107 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:271-276 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:102-107 — before extracting anything, compare `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift` and `Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:163— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:163-168 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:298-303 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:127-132 — before extracting anything, compare `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift` and `Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:275— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:275-280 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:324-329 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:152-157 — before extracting anything, compare `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift` and `Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand+Validation.swift:134— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand+Validation.swift:134-139 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:1111-1116 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/TypeTool.swift:227-232 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (6 lines × 3) Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:194— Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:194-199 | Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ScriptedBridgePeer.swift:188-193 | Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ScriptedBridgePeer.swift:215-220 — before extracting anything, compare `Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift` and `Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ScriptedBridgePeer.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×7
Edited copy of a member (22 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureApplicationResolver.swift:22— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureApplicationResolver.swift:22-43 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Discovery.swift:496-520 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Screenshots.swift:125— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Screenshots.swift:125-146 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Elements.swift:17-42 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/SystemIdentityResolver.swift:351— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/SystemIdentityResolver.swift:351-372 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/SystemIdentityResolver.swift:376-406 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogHierarchyReader.swift:156— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogHierarchyReader.swift:156-177 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuExtraAXReader.swift:284-306 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) Apps/Mac/Peekaboo/Features/Settings/SettingsWindow.swift:206— Apps/Mac/Peekaboo/Features/Settings/SettingsWindow.swift:206-232 | Apps/Mac/Peekaboo/Features/Settings/SettingsWindow.swift:267-288 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/CoordinateTransformer.swift:257— Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/CoordinateTransformer.swift:257-278 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/ElementLayoutEngine.swift:144-165 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogFileOperationModels.swift:13— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogFileOperationModels.swift:13-34 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogOperationModels.swift:324-347 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (24 corresponding lines) · ×7
Edited copy of a member (24 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Lifecycle.swift:84— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Lifecycle.swift:84-107 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Lifecycle.swift:109-135 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeResponse+CaptureDiagnostics.swift:5— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeResponse+CaptureDiagnostics.swift:5-28 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeResponse+CaptureDiagnostics.swift:33-56 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) Apps/Playground/Playground/Views/KeyboardView.swift:243— Apps/Playground/Playground/Views/KeyboardView.swift:243-270 | Apps/Playground/Playground/Views/KeyboardView.swift:272-295 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceWindowMutationDispatcher.swift:269— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceWindowMutationDispatcher.swift:269-300 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SpaceTool+Handlers.swift:423-446 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionProcessWait.swift:173— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionProcessWait.swift:173-197 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionProcessWait.swift:199-222 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter.swift:29— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter.swift:29-52 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter.swift:75-98 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+List.swift:50— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+List.swift:50-73 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+List.swift:111-137 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×7
Edited copy of a member (25 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext+BrowserSession.swift:45— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext+BrowserSession.swift:45-69 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:823-848 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:456— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:456-480 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:482-510 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeModels.swift:701— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeModels.swift:701-726 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeModels.swift:728-752 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationContext.swift:295— Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationContext.swift:295-319 | Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationContext.swift:342-366 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:1285— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:1285-1309 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:1311-1335 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) scripts/support/background-computer-use-probe.swift:4185— scripts/support/background-computer-use-probe.swift:4185-4215 | scripts/support/background-computer-use-probe.swift:5595-5619 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:227— Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:227-251 | Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ScriptedBridgePeer.swift:240-264 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 8+ corresponding lines) · ×7
Edited copies of one member (3 members, 8+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatUI.swift:166— Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatUI.swift:166-173 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatUI.swift:175-184 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatUI.swift:186-193 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundWindowChromeReader.swift:333— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundWindowChromeReader.swift:333-342 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundWindowChromeReader.swift:344-351 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundWindowChromeReader.swift:353-360 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:382— Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:382-389 | Apps/CLI/Sources/PeekabooCertificationController/ObserverPlan.swift:222-229 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationCrashInventoryPayload.swift:354-361 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:428— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:428-435 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Status.swift:18-28 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:426-439 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:167— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:167-174 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:210-217 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:253-260 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandRuntime.swift:414— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandRuntime.swift:414-422 | Apps/CLI/Sources/PeekabooCLI/Commands/System/SpaceCommand.swift:77-84 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:109-116 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 8+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/SnapshotManagerProtocol.swift:297— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/SnapshotManagerProtocol.swift:297-304 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager.swift:254-265 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/SnapshotMutationRecordingManager.swift:141-150 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 3+ corresponding lines) · ×7
Edited copies of one member (3 members, 3+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+PointerKeyboardOperations.swift:345— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+PointerKeyboardOperations.swift:345-356 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Interaction.swift:271-282 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:635-637 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 3+ corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:709— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:709-715 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:322-324 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteBrowserMCPClient.swift:184-187 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 3+ corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:391— Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:391-393 | Apps/CLI/Sources/PeekabooCertificationController/ObserverPlan.swift:231-233 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationCrashInventoryPayload.swift:363-365 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 3+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:98— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:98-100 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:267-269 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:98-100 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 3+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:159— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:159-161 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:294-296 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:123-125 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 3+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:271— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:271-273 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:320-322 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:148-150 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 3+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Lifecycle.swift:137— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Lifecycle.swift:137-139 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager.swift:240-242 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteSnapshotManager.swift:93-95 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (16 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:600— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:600-615 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveOptions.swift:18-33 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:600` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Captures.swift:158— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Captures.swift:158-173 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Captures.swift:192-207 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Captures.swift:158` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (16 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:172— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:172-187 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:1482-1497 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:172` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (16 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:76— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:76-91 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:105-120 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:76` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPExecutionEvidence.swift:59— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPExecutionEvidence.swift:59-74 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:784-799 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (16 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:105— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:105-120 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SelectTextCommand.swift:97-112 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (16 lines × 2) scripts/support/background-computer-use-probe.swift:5526— scripts/support/background-computer-use-probe.swift:5526-5541 | scripts/support/background-computer-use-probe.swift:5547-5562 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/support/background-computer-use-probe.swift:5526` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 3) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelCapturePipeline.swift:337— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelCapturePipeline.swift:337-346 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1302-1311 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveScope.swift:158-167 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveScope.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelCapturePipeline.swift:337` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:15— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:15-24 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:95-104 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:176-185 — before extracting anything, compare `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift` and `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:26— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:26-35 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:106-115 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:187-196 — before extracting anything, compare `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift` and `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:65— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:65-74 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:134-143 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:219-228 — before extracting anything, compare `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift` and `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:76— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:76-85 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:145-154 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:230-239 — before extracting anything, compare `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift` and `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:115— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:115-124 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:176-185 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:262-271 — before extracting anything, compare `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift` and `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:126— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:126-135 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:187-196 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:273-282 — before extracting anything, compare `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift` and `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 3) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/DaemonStartupGate.swift:15— Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/DaemonStartupGate.swift:15-19 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOwnerLease.swift:145-149 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopOperationLaneCoordinator.swift:41-45 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/DaemonStartupGate.swift:15` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:686— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:686-690 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:548-555 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:1547-1554 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:686` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:694— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:694-698 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:562-569 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:1559-1566 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:694` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:110— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:110-114 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:171-175 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:283-287 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:110` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (5 lines × 3) Apps/CLI/Sources/PeekabooCertificationController/CodeIdentityRunner.swift:111— Apps/CLI/Sources/PeekabooCertificationController/CodeIdentityRunner.swift:111-115 | Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:109-113 | Apps/CLI/Sources/PeekabooCertificationController/ObserverPlan.swift:202-206 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (5 lines × 3) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:1238— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:1238-1242 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:1249-1253 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:1270-1274 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/LinkedDesktopTargetFixture.swift:30— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/LinkedDesktopTargetFixture.swift:30-34 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/LinkedSnapshotTargetFixture.swift:34-38 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/ScriptedInventoryServices.swift:250-254 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (9 lines × 2 locations) scripts/final-qualification/lib.mjs:822— scripts/final-qualification/lib.mjs:822 · scripts/run-live-multi-target-certification.mjs:403 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
Duplicated block (9 lines × 2 locations) scripts/final-qualification/lib.mjs:845— scripts/final-qualification/lib.mjs:845 · scripts/final-qualification/managed-launcher.mjs:144 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 2 locations) scripts/finalize-multi-target-certification.mjs:4418— scripts/finalize-multi-target-certification.mjs:4418 · scripts/finalize-multi-target-certification.mjs:4570 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 2 locations) REDACTED:795— REDACTED:795 · REDACTED:821 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 2 locations) scripts/release-preflight-contract.mjs:56— scripts/release-preflight-contract.mjs:56 · scripts/validate-background-computer-use-report.mjs:17 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (9 lines × 2 locations) scripts/run-live-multi-target-certification.mjs:519— scripts/run-live-multi-target-certification.mjs:519 · scripts/run-live-multi-target-certification.mjs:1222 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 2 locations) scripts/test-terminal-archive-policy.mjs:327— scripts/test-terminal-archive-policy.mjs:327 · scripts/test-terminal-archive-policy.mjs:337 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×6
Members sharing a duplicated core (4 members, 50+ identical tokens) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:268— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:268-307 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:309-341 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:44-101 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SetValueTool.swift:48-112 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:329— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:329-368 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService+Capture.swift:90-152 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationTargetResolver.swift:281-305 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+WindowListing.swift:35-65 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:372— Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:372-380 | Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:125-132 | Apps/CLI/Sources/PeekabooCertificationController/ObserverPlan.swift:213-220 | scripts/support/background-computer-use-probe.swift:26-33 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:444— Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:444-478 | Apps/CLI/Sources/PeekabooCertificationController/HeldPointerPlan.swift:180-216 | Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:60-86 | Apps/CLI/Sources/PeekabooCertificationController/ObserverPlan.swift:276-295 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:81— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:81-151 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager.swift:159-230 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:533-651 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementClassifier.swift:122-152 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) scripts/support/background-computer-use-probe.swift:3865— scripts/support/background-computer-use-probe.swift:3865-3926 | scripts/support/background-computer-use-probe.swift:3928-3957 | scripts/support/background-computer-use-probe.swift:4010-4033 | scripts/support/background-computer-use-probe.swift:4066-4090 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×6
Edited copy of a member (29 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:357— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:357-385 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+ActionResults.swift:296-333 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+TypingOperations.swift:219— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+TypingOperations.swift:219-247 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+TypingOperations.swift:359-390 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:610— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:610-638 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:640-668 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:730— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:730-758 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:465-494 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureSessionOptions.swift:67— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureSessionOptions.swift:67-95 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureSessionResult.swift:20-50 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolSnapshotMutation.swift:148— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolSnapshotMutation.swift:148-176 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolSnapshotMutation.swift:183-216 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (26 corresponding lines) · ×6
Edited copy of a member (26 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:129— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:129-154 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SetValueTool.swift:141-180 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:185— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:185-210 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:241-270 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:75— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:75-100 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:102-134 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool.swift:382— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool.swift:382-407 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SeeTool.swift:224-251 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:255— Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:255-282 | Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:482-507 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) scripts/support/background-computer-use-probe.swift:135— scripts/support/background-computer-use-probe.swift:135-160 | scripts/support/background-computer-use-probe.swift:162-187 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 11+ corresponding lines) · ×6
Edited copies of one member (3 members, 11+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverResolver.swift:206— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverResolver.swift:206-216 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarWindowCatalog.swift:190-200 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowCGInfoLookup.swift:105-116 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand+Validation.swift:122— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand+Validation.swift:122-132 | Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionTargetPointResolver.swift:115-129 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:583-594 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:461— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:461-478 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:674-692 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:694-704 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:247— Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:247-258 | Apps/CLI/Sources/PeekabooCertificationController/HeldPointerPlan.swift:49-61 | Apps/CLI/Sources/PeekabooCertificationController/ObserverPlan.swift:102-112 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:400— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:400-410 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:412-424 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:441-452 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:117— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:117-127 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:156-166 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:198-209 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 14+ corresponding lines) · ×6
Edited copies of one member (3 members, 14+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/BridgeCommand+Diagnostics.swift:371— Apps/CLI/Sources/PeekabooCLI/Commands/Core/BridgeCommand+Diagnostics.swift:371-387 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHostIdentity.swift:81-102 | scripts/support/background-computer-use-probe.swift:2306-2319 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 14+ corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:475— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:475-489 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:491-504 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:521-535 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 14+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/FocusUtilities.swift:397— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/FocusUtilities.swift:397-410 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/FocusUtilities.swift:412-427 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/FocusUtilities.swift:429-444 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 14+ corresponding lines) Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:408— Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:408-421 | Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:434-447 | Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:465-478 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 14+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelCapturePipeline.swift:299— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelCapturePipeline.swift:299-312 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelCapturePipeline.swift:314-328 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelCapturePipeline.swift:357-370 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 14+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:613— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:613-626 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/TypeCommand.swift:415-428 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/TypeTool.swift:508-522 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 10+ corresponding lines) · ×6
Edited copies of one member (3 members, 10+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+ActionOutcomes.swift:128— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+ActionOutcomes.swift:128-137 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Actions.swift:43-56 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Actions.swift:86-99 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) Apps/Mac/Peekaboo/Core/ToolFormatterBridge.swift:84— Apps/Mac/Peekaboo/Core/ToolFormatterBridge.swift:84-93 | Apps/Mac/Peekaboo/Features/Main/SessionHelpers.swift:85-96 | Apps/Mac/Peekaboo/Features/StatusBar/UnifiedActivityFeed.swift:428-437 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MouseMovementProfile.swift:32— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MouseMovementProfile.swift:32-41 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:339-349 | Core/PeekabooFoundation/Sources/PeekabooFoundation/BasicTypes.swift:271-281 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationAttestationModels.swift:571— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationAttestationModels.swift:571-580 | Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:112-121 | Core/PeekabooFoundation/Sources/PeekabooFoundation/SnapshotReference.swift:46-55 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:484— Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:484-494 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:518-527 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:529-538 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationTargetModels.swift:85— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationTargetModels.swift:85-95 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationIdentifierMatcher.swift:75-84 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationIdentifierMatcher.swift:86-95 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 5+ corresponding lines) · ×6
Edited copies of one member (3 members, 5+ corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/ActionVerifier.swift:251— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/ActionVerifier.swift:251-255 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPHandoff.swift:40-45 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:1203-1208 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 5+ corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:258— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:258-262 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:725-732 | scripts/final-qualification/integrated-cu-emitter-calibrator.swift:183-192 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 5+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionProcessRunner.swift:826— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionProcessRunner.swift:826-831 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ShellTool.swift:424-430 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:1036-1040 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 5+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:657— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:657-661 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TextInputRoute.swift:168-172 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:531-535 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 5+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+Execution.swift:381— Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+Execution.swift:381-385 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementLabelResolver.swift:102-106 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAXHelpers.swift:13-17 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 5+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOwnerLease.swift:91— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOwnerLease.swift:91-99 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:23-31 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationAttestationModels.swift:14-18 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (19 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1276— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1276-1294 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveScope.swift:132-150 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveScope.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1276` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:156— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:156-174 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:239-257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:156` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBootstrap.swift:38— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBootstrap.swift:38-56 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBootstrap.swift:78-96 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) Core/PeekabooCore/Sources/PeekabooCore/Support/RemotePeekabooServices.swift:55— Core/PeekabooCore/Sources/PeekabooCore/Support/RemotePeekabooServices.swift:55-73 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:71-89 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (19 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:61— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:61-79 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift:647-665 — before extracting anything, compare `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift` and `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (19 lines × 2) scripts/support/background-computer-use-probe.swift:2433— scripts/support/background-computer-use-probe.swift:2433-2451 | scripts/support/background-computer-use-probe.swift:2986-3004 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/support/background-computer-use-probe.swift:2433` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (12–13 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:401— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:401-412 | Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationContext.swift:477-489 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:401` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12–13 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand.swift:171— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand.swift:171-183 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand.swift:152-163 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand.swift:171` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12–13 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService+Actions.swift:412— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService+Actions.swift:412-424 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService+Support.swift:104-115 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService+Actions.swift:412` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12–13 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:294— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:294-305 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:122-134 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:294` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–13 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool.swift:396— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool.swift:396-407 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SeeTool.swift:239-251 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool.swift:396` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `snapshotId` to `String?) async throws -> (snapshot: UISnapshot` in one and `String?) async throws -> ( snapshot: UISnapshot` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (12–13 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift:1304— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift:1304-1316 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift:1320-1331 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift:1304` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:806— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:806-815 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/VideoWriter.swift:405-413 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:806` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Screenshots.swift:28— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Screenshots.swift:28-36 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Screenshots.swift:79-88 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9–10 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:572— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:572-581 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:639-647 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:572` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–10 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MCPAgentTool.swift:111— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MCPAgentTool.swift:111-119 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MCPAgentTool.swift:409-418 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MCPAgentTool.swift:409` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–10 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:594— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:594-602 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:605-614 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9–10 lines × 2) scripts/support/background-computer-use-probe.swift:5020— scripts/support/background-computer-use-probe.swift:5020-5029 | scripts/support/background-computer-use-probe.swift:5042-5050 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication· Edited copy of a member (31 corresponding lines) · ×5
Edited copy of a member (31 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1374— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1374-1411 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveBindings.swift:20-50 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:251— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:251-281 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:283-313 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolResultExtractor.swift:70— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolResultExtractor.swift:70-114 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolResultExtractor.swift:119-149 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:542— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:542-574 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:576-606 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Focus.swift:5— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Focus.swift:5-40 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MoveTool+Execution.swift:59-89 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 16+ corresponding lines) · ×5
Edited copies of one member (3 members, 16+ corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:143— Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:143-159 | Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:161-176 | Apps/CLI/Sources/PeekabooCertificationController/ControllerRunner.swift:178-202 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 16+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:37— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:37-55 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:87-105 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+GeometryOperations.swift:137-152 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 16+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:161— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:161-186 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+PointerKeyboardOperations.swift:124-139 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+TypingOperations.swift:320-344 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 16+ corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDialogService.swift:133— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDialogService.swift:133-148 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDialogService.swift:150-169 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDialogService.swift:217-232 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 16+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+ActionOutcomes.swift:349— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+ActionOutcomes.swift:349-366 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+ActionOutcomes.swift:368-384 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+ActionOutcomes.swift:386-401 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (11–12 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:173— Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:173-183 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentOutputDelegate+Formatting.swift:208-219 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:173` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11–12 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:95— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:95-106 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:138-148 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:95` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–12 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift:778— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift:778-788 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift:800-811 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift:778` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11–12 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:318— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:318-329 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:1022-1032 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:318` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–12 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PressTool.swift:412— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PressTool.swift:412-422 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PressTool.swift:427-438 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PressTool.swift:412` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PressTool.swift:409` calls `PressToolValidationError` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PressTool.swift:426` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2 locations) scripts/final-qualification/process-tree-collector.mjs:133— scripts/final-qualification/process-tree-collector.mjs:133 · scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:58 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (10 lines × 2 locations) scripts/final-qualification/qualification-manifest.mjs:3864— scripts/final-qualification/qualification-manifest.mjs:3864 · scripts/final-qualification/qualification-manifest.mjs:3884 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (10 lines × 2 locations) scripts/finalize-multi-target-certification.mjs:346— scripts/finalize-multi-target-certification.mjs:346 · scripts/run-live-multi-target-certification.mjs:292 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (10 lines × 2 locations) scripts/finalize-multi-target-certification.mjs:451— scripts/finalize-multi-target-certification.mjs:451 · scripts/finalize-multi-target-certification.mjs:4174 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (10 lines × 2 locations) scripts/test-terminal-archive-policy.mjs:248— scripts/test-terminal-archive-policy.mjs:248 · scripts/test-terminal-archive-policy.mjs:264 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×4
Members sharing a duplicated core (6 members, 50+ identical tokens) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelCapturePipeline.swift:330— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelCapturePipeline.swift:330-355 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1296-1318 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveScope.swift:152-174 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/TypeCommand.swift:453-464 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationROI.swift:13-26 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/TypeTool.swift:437-506 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:48— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:48-82 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:84-129 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:178-220 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:222-264 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:266-314 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:316-355 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) Core/PeekabooUICore/Sources/PeekabooUICore/Presets/AnnotationPreset.swift:121— Core/PeekabooUICore/Sources/PeekabooUICore/Presets/AnnotationPreset.swift:121-139 | Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:135-153 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/ElementStyleProvider.swift:139-157 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/ElementStyleProvider.swift:159-177 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/AnnotationPreset.swift:58-76 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/InspectorPreset.swift:78-96 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) scripts/support/background-computer-use-probe.swift:5692— scripts/support/background-computer-use-probe.swift:5692-5734 | scripts/support/background-computer-use-probe.swift:5791-6067 | scripts/support/background-computer-use-probe.swift:6069-6133 | scripts/support/background-computer-use-probe.swift:6183-6223 | scripts/support/background-computer-use-probe.swift:6225-6280 | scripts/support/background-computer-use-probe.swift:6282-6502 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Edited copy of a member (53 corresponding lines) · ×4
Edited copy of a member (53 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:10— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:10-65 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:111-163 — These two members are one piece of code written twice and then edited apart: 53 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (53 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:136— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:136-188 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DockTool.swift:190-249 — These two members are one piece of code written twice and then edited apart: 53 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (53 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuBarElementCollector.swift:8— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuBarElementCollector.swift:8-60 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuBarElementCollector.swift:62-117 — These two members are one piece of code written twice and then edited apart: 53 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (53 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/FileService.swift:19— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/FileService.swift:19-71 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/FileService.swift:73-131 — These two members are one piece of code written twice and then edited apart: 53 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (39 corresponding lines) · ×4
Edited copy of a member (39 corresponding lines) Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/CoordinateTransformer.swift:54— Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/CoordinateTransformer.swift:54-93 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/CoordinateTransformer.swift:96-134 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (39 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:733— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:733-775 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/VideoWriter.swift:364-402 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (39 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:28— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:28-66 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SetValueCommand.swift:26-64 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (39 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/Snapshot.swift:107— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/Snapshot.swift:107-147 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Support/UIElementSummary.swift:29-67 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×4
Edited copy of a member (23 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequestResponse.swift:344— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequestResponse.swift:344-366 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequestResponse.swift:404-426 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift:393— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift:393-422 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService.swift:424-446 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+Chat.swift:338— Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+Chat.swift:338-364 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+Sessions.swift:45-67 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteApplicationService.swift:58— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteApplicationService.swift:58-80 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDialogService.swift:21-45 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 17+ corresponding lines) · ×4
Edited copies of one member (3 members, 17+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/CLI/Completions/BashCompletionRenderer.swift:94— Apps/CLI/Sources/PeekabooCLI/CLI/Completions/BashCompletionRenderer.swift:94-110 | Apps/CLI/Sources/PeekabooCLI/CLI/Completions/FishCompletionRenderer.swift:104-120 | Apps/CLI/Sources/PeekabooCLI/CLI/Completions/ZshCompletionRenderer.swift:97-115 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 17+ corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:1138— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:1138-1154 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:1189-1209 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:1211-1228 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 17+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureSessionOptions.swift:25— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureSessionOptions.swift:25-43 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Types.swift:127-143 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MoveTool+Types.swift:29-45 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 17+ corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:648— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:648-667 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:669-685 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:687-704 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (22 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+Types.swift:42— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+Types.swift:42-63 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+Types.swift:67-88 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+Types.swift:42` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (22 lines × 2) Apps/Playground/Playground/ContentView.swift:417— Apps/Playground/Playground/ContentView.swift:417-438 | Apps/Playground/Playground/Views/DialogFixtureView.swift:205-226 — before extracting anything, compare `Apps/Playground/Playground/ContentView.swift` and `Apps/Playground/Playground/Views/DialogFixtureView.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 140 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (22 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionRunner.swift:150— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionRunner.swift:150-171 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionRunner.swift:269-290 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:572— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:572-593 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:779-800 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:572` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:77— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:77-87 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:106-116 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:694-704 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:911— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:911-921 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:947-957 | Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+BrowserBridge.swift:119-129 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:911` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:56— Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:56-66 | Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:107-117 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/InspectorPreset.swift:50-60 — before extracting anything, compare `Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift` and `Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/InspectorPreset.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:56` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:335— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:335-346 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:364-375 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:409-419 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:335` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 3) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:481— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:481-489 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:496-504 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:527-535 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:481` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Lifecycle.swift:141— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Lifecycle.swift:141-149 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager.swift:244-252 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteSnapshotManager.swift:97-105 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (9 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:33— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:33-41 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift:234-242 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift:64-72 — before extracting anything, compare `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+WindowsApplications.swift` and `Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteWindowManagementService.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 3) scripts/support/background-computer-use-probe.swift:2437— scripts/support/background-computer-use-probe.swift:2437-2445 | scripts/support/background-computer-use-probe.swift:2804-2812 | scripts/support/background-computer-use-probe.swift:2990-2998 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/support/background-computer-use-probe.swift:2437` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6–7 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder+InteractionPermissions.swift:98— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder+InteractionPermissions.swift:98-103 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:365-371 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6–7 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1380— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1380-1385 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveBindings.swift:26-32 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6–7 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Discovery.swift:228— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Discovery.swift:228-233 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Elements.swift:161-167 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Elements.swift:161` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6–7 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveOptions.swift:12— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveOptions.swift:12-18 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Video.swift:192-197 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveOptions.swift:12` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (6 lines × 4) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelCapturePipeline.swift:337— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelCapturePipeline.swift:337-342 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1302-1307 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveScope.swift:158-163 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/TypeTool.swift:450-455 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveScope.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 4) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:212— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:212-217 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:221-226 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:230-235 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+WindowResults.swift:114-119 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:212` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 4) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:375— Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:375-380 | Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:127-132 | Apps/CLI/Sources/PeekabooCertificationController/ObserverPlan.swift:215-220 | scripts/support/background-computer-use-probe.swift:28-33 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:375` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 4) scripts/support/background-computer-use-probe.swift:4709— scripts/support/background-computer-use-probe.swift:4709-4714 | scripts/support/background-computer-use-probe.swift:4759-4764 | scripts/support/background-computer-use-probe.swift:5012-5017 | scripts/support/background-computer-use-probe.swift:5084-5089 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (14 lines × 2 locations) scripts/build-docs-site.mjs:856— scripts/build-docs-site.mjs:856 · scripts/build-docs-site.mjs:920 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2 locations) scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:63— scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:63 · scripts/final-qualification/validate-concurrent-run.mjs:47 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (14 lines × 2 locations) scripts/finalize-multi-target-certification.mjs:2894— scripts/finalize-multi-target-certification.mjs:2894 · scripts/finalize-multi-target-certification.mjs:2925 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (14 lines × 2 locations) scripts/finalize-multi-target-certification.mjs:3418— scripts/finalize-multi-target-certification.mjs:3418 · scripts/finalize-multi-target-certification.mjs:3456 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2 locations) scripts/final-qualification/executable-policy-scanner.mjs:956— scripts/final-qualification/executable-policy-scanner.mjs:956 · scripts/final-qualification/executable-policy-scanner.mjs:974 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (11 lines × 2 locations) scripts/finalize-multi-target-certification.mjs:3359— scripts/finalize-multi-target-certification.mjs:3359 · scripts/finalize-multi-target-certification.mjs:4010 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (11 lines × 2 locations) scripts/finalize-multi-target-certification.mjs:4429— scripts/finalize-multi-target-certification.mjs:4429 · scripts/finalize-multi-target-certification.mjs:4591 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (11 lines × 2 locations) scripts/finalize-multi-target-certification.mjs:4632— scripts/finalize-multi-target-certification.mjs:4632 · scripts/finalize-multi-target-certification.mjs:4695 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
FunctionTooLong: PeekabooBridgeCodeSignatureIdentity.swift.peekaboo_csops Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:6— FunctionTooLong — peekaboo_csops runs 296 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 196 over it, 2.96× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: PeekabooBridgeCodeSignatureIdentity.swift.peekaboo_csops_audittoken Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:13— FunctionTooLong — peekaboo_csops_audittoken runs 290 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 190 over it, 2.90× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: FocusCommandUtilities.swift.ensureFocused Apps/CLI/Sources/PeekabooCLI/Commands/Shared/FocusCommandUtilities.swift:236— FunctionTooLong — ensureFocused runs 115 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 15 over it, 1.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×3
Members sharing a duplicated core (5 members, 50+ identical tokens) Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverDetector.swift:112— Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverDetector.swift:112-122 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Support.swift:79-114 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Window.swift:365-375 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationWindowEnumerationContext.swift:193-263 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraWindows.swift:250-333 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:1088— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:1088-1115 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationWindowEnumerationContext.swift:630-654 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationWindowEnumerationContext.swift:656-683 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationWindowEnumerationContext.swift:686-710 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:320-351 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:255— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:255-285 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:323-353 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ElementToolFormatter.swift:376-400 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter+Menu.swift:110-147 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+WindowResults.swift:242-264 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Edited copy of a member (35 corresponding lines) · ×3
Edited copy of a member (35 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:694— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:694-744 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:746-780 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (35 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:42— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:42-76 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:152-191 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (35 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopMutationWatermarkStore.swift:712— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopMutationWatermarkStore.swift:712-751 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopMutationWatermarkStore.swift:753-787 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (30 corresponding lines) · ×3
Edited copy of a member (30 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool+Formatting.swift:32— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool+Formatting.swift:32-61 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SeeTool+Formatting.swift:20-54 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:521— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:521-550 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:165-198 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/System/DockCommand.swift:9— Apps/CLI/Sources/PeekabooCLI/Commands/System/DockCommand.swift:9-40 | Apps/CLI/Sources/PeekabooCLI/Commands/System/MenuCommand.swift:36-65 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (37 corresponding lines) · ×3
Edited copy of a member (37 corresponding lines) Apps/Mac/Peekaboo/Features/Settings/AddCustomProviderView.swift:313— Apps/Mac/Peekaboo/Features/Settings/AddCustomProviderView.swift:313-353 | Apps/Mac/Peekaboo/Features/Settings/CustomProviderView.swift:371-407 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (37 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:10— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:10-46 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:131-176 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (37 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBootstrap.swift:23— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBootstrap.swift:23-61 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBootstrap.swift:63-99 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (33 corresponding lines) · ×3
Edited copy of a member (33 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:230— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:230-262 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:309-342 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (33 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:454— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:454-487 | Apps/CLI/Sources/PeekabooCLI/Commands/System/ClipboardCommand+Commander.swift:409-441 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (33 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementDetectionTimeoutRunner.swift:5— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementDetectionTimeoutRunner.swift:5-40 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateDeadlineRunner.swift:8-40 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 12+ corresponding lines) · ×3
Edited copies of one member (3 members, 12+ corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:462— Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:462-477 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerTransport.swift:224-235 | scripts/support/background-computer-use-probe.swift:2741-2754 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 12+ corresponding lines) Core/PeekabooUICore/Sources/PeekabooUICore/Presets/AnnotationPreset.swift:28— Core/PeekabooUICore/Sources/PeekabooUICore/Presets/AnnotationPreset.swift:28-39 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/AnnotationPreset.swift:29-40 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/InspectorPreset.swift:31-44 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 12+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:307— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:307-318 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:540-555 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:557-575 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 20+ corresponding lines) · ×3
Edited copies of one member (3 members, 20+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:777— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:777-802 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:804-828 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/VideoWriter.swift:404-423 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 20+ corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:100— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:100-120 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:153-175 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:177-196 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 20+ corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:239— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:239-258 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:381-400 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:402-423 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 13+ corresponding lines) · ×3
Edited copies of one member (3 members, 13+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:38— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:38-52 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:637-650 | Core/PeekabooFoundation/Sources/PeekabooFoundation/BasicTypes.swift:210-222 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 13+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogServiceProtocol.swift:225— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogServiceProtocol.swift:225-237 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogs.swift:15-30 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDialogService.swift:197-211 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 13+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogServiceProtocol.swift:165— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DialogServiceProtocol.swift:165-177 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:41-55 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDialogService.swift:118-131 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 9+ corresponding lines) · ×3
Edited copies of one member (3 members, 9+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:720— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:720-732 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:734-742 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:751-764 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 9+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:359— Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:359-370 | Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:561-569 | Apps/CLI/Sources/PeekabooCertificationController/ControllerBuildIdentity.swift:255-263 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 9+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:464— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:464-472 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:474-484 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/WindowManagementServiceProtocol.swift:379-387 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 10+ corresponding lines) · ×3
Edited copies of one member (4 members, 10+ corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteScreenCaptureService.swift:39— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteScreenCaptureService.swift:39-52 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteScreenCaptureService.swift:54-72 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteScreenCaptureService.swift:74-85 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteScreenCaptureService.swift:97-106 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 10+ corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:288— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:288-300 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:302-318 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:320-334 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:336-345 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 10+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1142— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1142-1151 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService.swift:41-50 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:1636-1645 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:85-96 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 4+ corresponding lines) · ×3
Edited copies of one member (3 members, 4+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/CGS/MenuBarCGSBridge.swift:32— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/CGS/MenuBarCGSBridge.swift:32-37 | Helpers/MenuBarHelper/main.swift:15-18 | experiments/cgs-menu-probe/Sources/cgs-menu-probe/cgs_menu_probe.swift:18-21 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 4+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+MenuBarGeometry.swift:23— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+MenuBarGeometry.swift:23-26 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverOCRSelector.swift:142-145 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarWindowCatalog.swift:185-188 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 4+ corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationAttestationModels.swift:582— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationAttestationModels.swift:582-585 | Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:123-126 | Core/PeekabooFoundation/Sources/PeekabooFoundation/SnapshotReference.swift:57-60 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (23 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Tools.swift:106— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Tools.swift:106-128 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Tools.swift:195-217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Tools.swift:105` calls `checkCancellation` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Tools.swift:194` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (23 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:56— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:56-78 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SetValueTool.swift:66-88 — before extracting anything, compare `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SetValueTool.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 77 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:56` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MenuTool.swift:241— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MenuTool.swift:241-263 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MenuTool.swift:272-294 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MenuTool.swift:241` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (20 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureArtifactIntegrityValidator.swift:150— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureArtifactIntegrityValidator.swift:150-169 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureArtifactIntegrityValidator.swift:267-286 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureArtifactIntegrityValidator.swift:150` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:355— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:355-374 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:462-481 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:355` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (20 lines × 2) Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:254— Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:254-273 | Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ScriptedBridgePeer.swift:268-287 — before extracting anything, compare `Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift` and `Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ScriptedBridgePeer.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ScriptedBridgePeer.swift:268` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–18 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:173— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:173-189 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift:577-594 — before extracting anything, compare `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift` and `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17–18 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+SessionLifecycle.swift:315— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+SessionLifecycle.swift:315-332 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService.swift:496-512 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+SessionLifecycle.swift:315` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–18 lines × 2) Core/PeekabooCore/Sources/PeekabooCore/Support/RemotePeekabooServices.swift:37— Core/PeekabooCore/Sources/PeekabooCore/Support/RemotePeekabooServices.swift:37-53 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:57-74 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (16–17 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ScreenCaptureServiceProtocol.swift:337— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ScreenCaptureServiceProtocol.swift:337-353 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ScreenCaptureServiceProtocol.swift:363-378 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ScreenCaptureServiceProtocol.swift:337` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16–17 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ChromeProcessCodeSignatureValidator.swift:132— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ChromeProcessCodeSignatureValidator.swift:132-147 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:380-396 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ChromeProcessCodeSignatureValidator.swift:132` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (16–17 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:906— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:906-921 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:942-958 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:942` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 3) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:978— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:978-990 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureArtifactIntegrityValidator.swift:164-176 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureArtifactIntegrityValidator.swift:281-293 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (13 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:28— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:28-40 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager.swift:130-142 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DetectedElementSnapshotConverter.swift:10-22 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (13 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:102— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:102-114 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager.swift:179-191 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementClassifier.swift:125-137 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (12 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceUtilities.swift:131— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceUtilities.swift:131-142 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceUtilities.swift:186-197 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceUtilities.swift:250-261 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (12 lines × 3) Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:86— Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:86-97 | Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:158-169 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/InspectorPreset.swift:101-112 — before extracting anything, compare `Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift` and `Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/InspectorPreset.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:86` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 3) Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:122— Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:122-133 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/ElementStyleProvider.swift:182-193 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/InspectorPreset.swift:65-76 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:122` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 5) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:1096— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:1096-1106 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationWindowEnumerationContext.swift:636-646 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationWindowEnumerationContext.swift:664-674 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationWindowEnumerationContext.swift:692-702 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:326-336 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (11 lines × 5) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:1322— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:1322-1332 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:574-584 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:586-596 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:598-608 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:670-680 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (11 lines × 5) scripts/support/background-computer-use-probe.swift:5306— scripts/support/background-computer-use-probe.swift:5306-5316 | scripts/support/background-computer-use-probe.swift:5341-5351 | scripts/support/background-computer-use-probe.swift:5372-5382 | scripts/support/background-computer-use-probe.swift:5406-5416 | scripts/support/background-computer-use-probe.swift:5442-5452 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/support/background-computer-use-probe.swift:5306` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/support/background-computer-use-probe.swift:5403` calls `admitForTesting`, `focus`, `FocusEventEvidence` and `scripts/support/background-computer-use-probe.swift:5305` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–11 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/ControllerEvidence.swift:356— Apps/CLI/Sources/PeekabooCertificationController/ControllerEvidence.swift:356-365 | Apps/CLI/Sources/PeekabooCertificationController/ControllerEvidence.swift:370-380 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCertificationController/ControllerEvidence.swift:370` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:194— Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:194-204 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeJSONValue.swift:31-40 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:194` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) scripts/support/background-computer-use-probe.swift:5164— scripts/support/background-computer-use-probe.swift:5164-5173 | scripts/support/background-computer-use-probe.swift:5175-5185 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/TypeCommand.swift:454— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/TypeCommand.swift:454-461 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/TypeTool.swift:450-458 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/TypeTool.swift:450` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8–9 lines × 2) Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:162— Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:162-170 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeJSONValue.swift:12-19 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAutomation/Utils/TypedValue.swift:162` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–9 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooEmbeddedBridgeRuntime.swift:162— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooEmbeddedBridgeRuntime.swift:162-169 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooEmbeddedBridgeRuntime.swift:190-198 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooEmbeddedBridgeRuntime.swift:190` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–8 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:136— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:136-141 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager.swift:213-220 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:136` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6–8 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:872— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:872-877 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:949-956 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6–8 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Responses.swift:65— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Responses.swift:65-70 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SpaceTool+Handlers.swift:127-134 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Responses.swift:65` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 4) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelCapturePipeline.swift:337— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelCapturePipeline.swift:337-343 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1302-1308 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveScope.swift:158-164 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationROI.swift:14-20 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveScope.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 4) Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverDetector.swift:114— Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverDetector.swift:114-120 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Support.swift:85-91 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationWindowEnumerationContext.swift:200-206 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraWindows.swift:272-278 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 4) Apps/Mac/Peekaboo/Features/Main/MessageComponents/DetailedMessageRow.swift:208— Apps/Mac/Peekaboo/Features/Main/MessageComponents/DetailedMessageRow.swift:208-214 | Apps/Mac/Peekaboo/Features/Main/MessageComponents/DetailedMessageRow.swift:227-233 | Apps/Mac/Peekaboo/Features/StatusBar/UnifiedActivityFeed.swift:514-520 | Apps/Mac/Peekaboo/Features/StatusBar/UnifiedActivityFeed.swift:538-544 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (8 lines × 3) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:357— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:357-364 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:443-450 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+ActionResults.swift:296-303 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:357` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+ActionResults.swift:304` calls `decode` and `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:365` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1361— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1361-1368 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1374-1381 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1384-1391 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1371` calls `deletionRangeAfterSelection` and `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1383` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 3) Apps/CLI/Sources/PeekabooCLI/CLI/CommanderBridge.swift:196— Apps/CLI/Sources/PeekabooCLI/CLI/CommanderBridge.swift:196-203 | Apps/CLI/Sources/PeekabooCLI/CLI/Completions/CompletionModel.swift:279-286 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandSignature+PeekabooRuntime.swift:46-53 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (7 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:494— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:494-500 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementActions.swift:385-391 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:1114-1121 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:494` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 3) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter+Dialog.swift:35— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter+Dialog.swift:35-41 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter+Dialog.swift:73-79 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+KeyboardResults.swift:36-42 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (7 lines × 3) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter+Dialog.swift:63— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter+Dialog.swift:63-69 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter+Menu.swift:28-34 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+KeyboardResults.swift:80-86 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter+Dialog.swift:63` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2 locations) scripts/final-qualification/qualification-manifest.mjs:2348— scripts/final-qualification/qualification-manifest.mjs:2348 · scripts/final-qualification/qualification-manifest.mjs:2393 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (17 lines × 2 locations) scripts/final-qualification/qualification-manifest.mjs:3141— scripts/final-qualification/qualification-manifest.mjs:3141 · scripts/final-qualification/qualification-manifest.mjs:3709 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (17 lines × 2 locations) scripts/finalize-multi-target-certification.mjs:2124— scripts/finalize-multi-target-certification.mjs:2124 · scripts/run-live-multi-target-certification.mjs:918 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (7 members, 50+ identical tokens) Apps/CLI/Sources/PeekabooCLI/Commands/Core/BridgeCommand+Receipt.swift:354— Apps/CLI/Sources/PeekabooCLI/Commands/Core/BridgeCommand+Receipt.swift:354-402 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:911-1002 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureArtifactIntegrityValidator.swift:108-187 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureArtifactIntegrityValidator.swift:235-301 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:734-777 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:1224-1276 | scripts/final-qualification/integrated-cu-emitter-calibrator.swift:223-306 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
Members sharing a duplicated core (7 members, 50+ identical tokens) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationCrashInventoryPayload.swift:36— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationCrashInventoryPayload.swift:36-48 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationMonitorSealPayload.swift:25-34 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationObserverSemanticPayload.swift:105-131 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:117-135 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:203-218 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:401-417 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:469-487 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication· Edited copy of a member (46 corresponding lines) · ×2
Edited copy of a member (46 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand.swift:69— Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand.swift:69-124 | Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand.swift:148-193 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (46 corresponding lines) scripts/support/background-computer-use-probe.swift:5195— scripts/support/background-computer-use-probe.swift:5195-5240 | scripts/support/background-computer-use-probe.swift:5242-5291 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 26+ corresponding lines) · ×2
Edited copies of one member (3 members, 26+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOwnerLease.swift:578— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitOwnerLease.swift:578-605 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopOperationLaneCoordinator.swift:255-288 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ClipboardPasteTransactionGate.swift:195-220 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 26+ corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+AgentExecutionTrace.swift:39— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+AgentExecutionTrace.swift:39-64 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+CertificationProducerAttestation.swift:43-74 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ProcessGenerationObservation.swift:35-60 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 19+ corresponding lines) · ×2
Edited copies of one member (3 members, 19+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationContext.swift:468— Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationContext.swift:468-490 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:486-504 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementActions.swift:374-395 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 19+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:308— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:308-326 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:328-346 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1303-1321 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 15+ corresponding lines) · ×2
Edited copies of one member (4 members, 15+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MouseMovementProfile.swift:14— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MouseMovementProfile.swift:14-30 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/UIAutomationOperationModels.swift:621-635 | Core/PeekabooFoundation/Sources/PeekabooFoundation/BasicTypes.swift:190-208 | Core/PeekabooFoundation/Sources/PeekabooFoundation/BasicTypes.swift:253-269 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 15+ corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:180— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:180-194 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:196-213 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:215-232 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:234-249 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 21+ corresponding lines) · ×2
Edited copies of one member (3 members, 21+ corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolResultExtractor.swift:13— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolResultExtractor.swift:13-41 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolResultExtractor.swift:192-213 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolResultExtractor.swift:218-238 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 21+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:682— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:682-704 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:706-726 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:728-751 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 18+ corresponding lines) · ×2
Edited copies of one member (3 members, 18+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:29— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:29-46 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:460-491 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:548-567 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 18+ corresponding lines) Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:193— Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ConcurrentGatedBridgePeer.swift:193-214 | Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ScriptedBridgePeer.swift:183-208 | Core/PeekabooCore/Sources/PeekabooBridgeTestSupport/ScriptedBridgePeer.swift:210-227 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 6+ corresponding lines) · ×2
Edited copies of one member (3 members, 6+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/AgentExecutionReleaseGate.swift:158— Apps/CLI/Sources/PeekabooCLI/AgentExecutionReleaseGate.swift:158-164 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:39-44 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:480-485 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 6+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Traversal.swift:224— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+Traversal.swift:224-229 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+ForegroundClose.swift:211-218 | Core/PeekabooFoundation/Sources/PeekabooFoundationTestSupport/DesktopActionOutcomeFixtures.swift:195-200 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 20+ corresponding lines) · ×2
Edited copies of one member (4 members, 20+ corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:788— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:788-808 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:810-832 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:834-855 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:993-1012 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 20+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationContext.swift:205— Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationContext.swift:205-224 | Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationContext.swift:252-272 | Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationContext.swift:274-293 | Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationContext.swift:321-340 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 14+ corresponding lines) · ×2
Edited copies of one member (5 members, 14+ corresponding lines) Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:829— Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:829-842 | Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:844-862 | Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:864-877 | Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:894-908 | Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:926-944 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
Edited copies of one member (5 members, 14+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:294— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+Operations.swift:294-307 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:70-83 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:85-98 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:122-136 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:138-151 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
Duplicated block (28 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:102— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:102-129 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:149-176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:102` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (28 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:256— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:256-283 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:324-351 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (24 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:384— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:384-407 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:490-513 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:384` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (24 lines × 2) scripts/support/background-computer-use-probe.swift:5214— scripts/support/background-computer-use-probe.swift:5214-5237 | scripts/support/background-computer-use-probe.swift:5262-5285 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/support/background-computer-use-probe.swift:5214` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (22–23 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:131— Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentChatEventDelegate.swift:131-152 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentOutputDelegate+Formatting.swift:165-187 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (22–23 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:252— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:252-273 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift:690-712 — before extracting anything, compare `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift` and `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (21–22 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:229— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:229-249 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift:667-688 — before extracting anything, compare `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift` and `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (21–22 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool.swift:169— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool.swift:169-189 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SeeTool.swift:193-214 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool.swift:169` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 4) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:356— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:356-365 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService+Capture.swift:116-125 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationTargetResolver.swift:294-303 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+WindowListing.swift:53-62 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
Duplicated block (10 lines × 4) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:272— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:272-281 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:340-349 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter+Menu.swift:132-141 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+WindowResults.swift:250-259 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (7 lines × 7) Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:343— Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:343-349 | Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:521-527 | Apps/CLI/Sources/PeekabooCertificationController/PrivateArtifacts.swift:255-261 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgePrivateReceiptArchive.swift:87-93 | scripts/support/background-computer-use-probe.swift:2436-2442 | scripts/support/background-computer-use-probe.swift:2803-2809 | scripts/support/background-computer-use-probe.swift:2989-2995 — there are 7 copies across 5 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 7 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:343` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/support/background-computer-use-probe.swift:2433` calls `open`, `POSIXError`, `POSIXErrorCode` and `scripts/support/background-computer-use-probe.swift:2802` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 7) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationCrashInventoryPayload.swift:36— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationCrashInventoryPayload.swift:36-42 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationMonitorSealPayload.swift:25-31 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationObserverSemanticPayload.swift:105-111 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:117-123 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:203-209 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:401-407 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:469-475 — there are 7 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 7 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationCrashInventoryPayload.swift:36` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:124` calls `decode` and `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationCrashInventoryPayload.swift:43` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 11) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+CommanderMetadata.swift:4— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+CommanderMetadata.swift:4-18 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/VerifyCommand+CommanderMetadata.swift:4-8 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+CommanderMetadata.swift:10-16 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand+CommanderMetadata.swift:4-18 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ScrollCommand+CommanderMetadata.swift:4-18 | Apps/CLI/Sources/PeekabooCLI/Commands/MCP/MCPCommand+CommanderMetadata.swift:4-18 | Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionTargetOptions+CommanderMetadata.swift:4-18 | Apps/CLI/Sources/PeekabooCLI/Commands/System/DialogCommand+CommanderMetadata.swift:26-30 | Apps/CLI/Sources/PeekabooCLI/Commands/System/DialogCommand+CommanderMetadata.swift:51-57 | Apps/CLI/Sources/PeekabooCLI/Commands/System/SpaceCommand+CommanderMetadata.swift:39-53 | Apps/CLI/Sources/PeekabooCLI/Commands/System/WindowIdentificationOptions+CommanderMetadata.swift:4-18 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ScrollCommand+CommanderMetadata.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/MCP/MCPCommand+CommanderMetadata.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+CommanderMetadata.swift:4` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Apps/CLI/Sources/PeekabooCLI/Commands/AI/VerifyCommand+CommanderMetadata.swift:8` calls `commandOption` and `Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+CommanderMetadata.swift:18` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 11) scripts/support/background-computer-use-probe.swift:4657— scripts/support/background-computer-use-probe.swift:4657-4661 | scripts/support/background-computer-use-probe.swift:4757-4761 | scripts/support/background-computer-use-probe.swift:5010-5014 | scripts/support/background-computer-use-probe.swift:5082-5086 | scripts/support/background-computer-use-probe.swift:5201-5205 | scripts/support/background-computer-use-probe.swift:5248-5252 | scripts/support/background-computer-use-probe.swift:5299-5303 | scripts/support/background-computer-use-probe.swift:5330-5334 | scripts/support/background-computer-use-probe.swift:5365-5369 | scripts/support/background-computer-use-probe.swift:5396-5400 | scripts/support/background-computer-use-probe.swift:5430-5434 — all 11 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/support/background-computer-use-probe.swift:4657` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 9) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+CommanderMetadata.swift:85— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+CommanderMetadata.swift:85-89 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:156-162 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand+CommanderMetadata.swift:12-16 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PressCommand+CommanderMetadata.swift:13-28 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SetValueCommand.swift:127-133 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/TypeCommand+CommanderMetadata.swift:11-26 | Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserCommand.swift:383-391 | Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift:62-76 | Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift:221-236 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+CommanderMetadata.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+CommanderMetadata.swift:85` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 9) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:172— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:172-178 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter+Dialog.swift:26-31 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter+Dialog.swift:60-65 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter+Menu.swift:35-40 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/SystemToolFormatter.swift:341-347 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+KeyboardResults.swift:77-82 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+KeyboardResults.swift:87-92 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+KeyboardResults.swift:119-124 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+PointerResults.swift:207-211 — there are 9 copies across 6 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 9 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:172` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+PointerResults.swift:216` calls `pointerDetailEntries` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter+Dialog.swift:67` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 5) Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverDetector.swift:114— Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverDetector.swift:114-118 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Support.swift:85-89 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+Window.swift:367-371 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationWindowEnumerationContext.swift:200-204 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraWindows.swift:272-276 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverDetector.swift:114` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 5) scripts/support/background-computer-use-probe.swift:4659— scripts/support/background-computer-use-probe.swift:4659-4663 | scripts/support/background-computer-use-probe.swift:4709-4713 | scripts/support/background-computer-use-probe.swift:4759-4763 | scripts/support/background-computer-use-probe.swift:5012-5016 | scripts/support/background-computer-use-probe.swift:5084-5088 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 5) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:211— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:211-216 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:220-225 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:229-234 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/VisionToolFormatter.swift:194-199 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+WindowResults.swift:113-118 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:211` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:220` calls `dictionary` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/VisionToolFormatter.swift:200` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 5) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementActionOutcome.swift:163— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementActionOutcome.swift:163-168 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceWindowMutationDispatcher.swift:307-312 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPBatchMutationProjection.swift:152-157 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:1139-1144 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:1388-1393 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times.
Duplicated block (3–5 lines × 3) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/CaptureCoordinateContextMetadata.swift:61— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/CaptureCoordinateContextMetadata.swift:61-65 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ObservationDiagnosticsMetadata.swift:100-104 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:307-309 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/CaptureCoordinateContextMetadata.swift:61` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/CaptureCoordinateContextMetadata.swift:67` calls `sizeValue`, `object` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:309` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (3–5 lines × 3) scripts/support/background-computer-use-probe.swift:5353— scripts/support/background-computer-use-probe.swift:5353-5357 | scripts/support/background-computer-use-probe.swift:5384-5386 | scripts/support/background-computer-use-probe.swift:5418-5422 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/support/background-computer-use-probe.swift:5353` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Off the main sequence: PeekabooFoundation (Core/PeekabooFoundation) — PeekabooFoundation (Core/PeekabooFoundation): abstractness 0.16, instability 0.00, distance 0.84 — zone of pain — concrete and depended on by 9 project(s), so it's rigid to change.
Off the main sequence: PeekabooProtocols (Core/PeekabooProtocols) — PeekabooProtocols (Core/PeekabooProtocols): abstractness 0.00, instability 0.17, distance 0.83 — zone of pain — concrete and depended on by 5 project(s), so it's rigid to change.
Duplicated block (15 lines × 2 locations) scripts/final-qualification/executable-policy-scanner.mjs:357— scripts/final-qualification/executable-policy-scanner.mjs:357 · scripts/final-qualification/executable-policy-scanner.mjs:384 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (15 lines × 2 locations) scripts/final-qualification/qualification-manifest.mjs:2628— scripts/final-qualification/qualification-manifest.mjs:2628 · scripts/final-qualification/qualification-manifest.mjs:2650 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (13 lines × 2 locations) scripts/final-qualification/executable-policy-scanner.mjs:409— scripts/final-qualification/executable-policy-scanner.mjs:409 · scripts/final-qualification/executable-policy-scanner.mjs:432 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2 locations) scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:85— scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:85 · scripts/final-qualification/qualification-manifest.mjs:619 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
PeekabooBridgeServer.handleHandshake (cyclomatic 134) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handshake.swift:31— PeekabooBridgeServer.handleHandshake has cyclomatic complexity 134 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeAgentExecutionTraceResponse.validate (cyclomatic 107) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionTraceModels.swift:339— PeekabooBridgeAgentExecutionTraceResponse.validate has cyclomatic complexity 107 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperationResultSemantics.deliveryRules (cyclomatic 81) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:727— PeekabooBridgeOperationResultSemantics.deliveryRules has cyclomatic complexity 81 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
CommanderCLIBinder.makeRuntimeOptions (cyclomatic 49) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:43— CommanderCLIBinder.makeRuntimeOptions has cyclomatic complexity 49 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CertificationObserveOnlyPlan.validate (cyclomatic 48) Apps/CLI/Sources/PeekabooCertificationController/ObserverPlan.swift:114— CertificationObserveOnlyPlan.validate has cyclomatic complexity 48 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DetachedAXMutationReader.readSynchronously (cyclomatic 47) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/AXMutationObservation.swift:140— DetachedAXMutationReader.readSynchronously has cyclomatic complexity 47 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeCertificationObserverSemanticPayload.validate (cyclomatic 46) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationObserverSemanticPayload.swift:133— PeekabooBridgeCertificationObserverSemanticPayload.validate has cyclomatic complexity 46 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
UISnapshot.setScreenshot (cyclomatic 45) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/UISnapshotStore.swift:36— UISnapshot.setScreenshot has cyclomatic complexity 45 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperationResultSemantics.contract (cyclomatic 44) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:16— PeekabooBridgeOperationResultSemantics.contract has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CommanderCLIBinder.requiresImplicitSnapshotInvalidation (cyclomatic 43) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:444— CommanderCLIBinder.requiresImplicitSnapshotInvalidation has cyclomatic complexity 43 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DialogTool.execute (cyclomatic 43) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DialogTool.swift:110— DialogTool.execute has cyclomatic complexity 43 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
BridgeCapabilityPolicy.supportsInteractionRequirements (cyclomatic 42) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:240— BridgeCapabilityPolicy.supportsInteractionRequirements has cyclomatic complexity 42 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DesktopActionOutcome.validateDecoded (cyclomatic 42) Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:648— DesktopActionOutcome.validateDecoded has cyclomatic complexity 42 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SeeCommand.validatePresentationOptions (cyclomatic 41) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand.swift:398— SeeCommand.validatePresentationOptions has cyclomatic complexity 41 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BrowserMCPSessionManager.prepareExecutionReceipt (cyclomatic 41) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:921— BrowserMCPSessionManager.prepareExecutionReceipt has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeServer.validateOperationAccess (cyclomatic 41) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:1084— PeekabooBridgeServer.validateOperationAccess has cyclomatic complexity 41 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DesktopTargetIdentityCoalescer.resolve (cyclomatic 40) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/DesktopTargetPlanning.swift:310— DesktopTargetIdentityCoalescer.resolve has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CertificationControllerPlan.validate (cyclomatic 39) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:260— CertificationControllerPlan.validate has cyclomatic complexity 39 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CommanderCLIBinder.applyRoutePermissionOptions (cyclomatic 38) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder+InteractionPermissions.swift:8— CommanderCLIBinder.applyRoutePermissionOptions has cyclomatic complexity 38 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BrowserMCPSessionManager.validate (cyclomatic 38) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:1431— BrowserMCPSessionManager.validate has cyclomatic complexity 38 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BrowserToolCapabilitySession.project (cyclomatic 38) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserToolCapabilitySession.swift:133— BrowserToolCapabilitySession.project has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CaptureActionManifest.semanticFailure (cyclomatic 37) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:148— CaptureActionManifest.semanticFailure has cyclomatic complexity 37 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ScrollTool.parseRequest (cyclomatic 37) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ScrollTool.swift:102— ScrollTool.parseRequest has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeCertificationMonitorSealPayload.validateHeartbeat (cyclomatic 37) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationMonitorSealValidation.swift:212— PeekabooBridgeCertificationMonitorSealPayload.validateHeartbeat has cyclomatic complexity 37 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeServer.handleAuthorized (cyclomatic 37) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:9— PeekabooBridgeServer.handleAuthorized has cyclomatic complexity 37 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
WindowEnumerationContext.mergeWindowInventory (cyclomatic 36) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationWindowEnumerationContext.swift:439— WindowEnumerationContext.mergeWindowInventory has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LiveCertificationBridge.validateCanonicalRequest (cyclomatic 35) Apps/CLI/Sources/PeekabooCertificationController/LiveCertificationBridge.swift:436— LiveCertificationBridge.validateCanonicalRequest has cyclomatic complexity 35 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BrowserMCPSessionManager.connectionReceipt (cyclomatic 35) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:1559— BrowserMCPSessionManager.connectionReceipt has cyclomatic complexity 35 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CaptureError.errorDescription (cyclomatic 35) Core/PeekabooFoundation/Sources/PeekabooFoundation/ErrorTypes.swift:38— CaptureError.errorDescription has cyclomatic complexity 35 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
core-sigpipe-diagnostic.capture (cyclomatic 35) .github/scripts/core-sigpipe-diagnostic.py:60— core-sigpipe-diagnostic.capture has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LegacyPNGValidator.hasValidStructureAndCRC (cyclomatic 34) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyPNGValidator.swift:18— LegacyPNGValidator.hasValidStructureAndCRC has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HotkeyService.hotkey (cyclomatic 34) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/HotkeyService.swift:193— HotkeyService.hotkey has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ClickRequest.init (cyclomatic 34) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:976— ClickRequest.init has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UISnapshot.setTargetMetadata (cyclomatic 34) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/UISnapshotStore.swift:165— UISnapshot.setTargetMetadata has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PeekabooBridgeClient.requireNegotiatedInputCapabilities (cyclomatic 34) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:198— PeekabooBridgeClient.requireNegotiatedInputCapabilities has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CaptureActionManifestWriter.retainedFile (cyclomatic 33) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:911— CaptureActionManifestWriter.retainedFile has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CaptureArtifactIntegrityValidator.videoCustody (cyclomatic 33) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureArtifactIntegrityValidator.swift:108— CaptureArtifactIntegrityValidator.videoCustody has cyclomatic complexity 33 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Reader.read (cyclomatic 33) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundWindowChromeReader.swift:91— Reader.read has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DesktopActionSequenceAccumulator.completedBatch (cyclomatic 33) Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionSequenceAccumulator.swift:116— DesktopActionSequenceAccumulator.completedBatch has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BridgeCapabilityPolicy.firstUnmetRemoteRequirement (cyclomatic 32) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:27— BridgeCapabilityPolicy.firstUnmetRemoteRequirement has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MenuExtraAXReader.readSynchronously (cyclomatic 32) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuExtraAXReader.swift:75— MenuExtraAXReader.readSynchronously has cyclomatic complexity 32 (threshold 15). Of this number, 29 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentToolResultSemantics.turnBoundaryProjection (cyclomatic 32) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolResultSemantics.swift:265— AgentToolResultSemantics.turnBoundaryProjection has cyclomatic complexity 32 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MCPToolContext.backgroundTargetAuthorization (cyclomatic 32) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:860— MCPToolContext.backgroundTargetAuthorization has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RuntimeHostResolver.resolveRemoteRouting (cyclomatic 31) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver.swift:327— RuntimeHostResolver.resolveRemoteRouting has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RuntimeHostResolver.resolveRemoteServices (cyclomatic 31) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver.swift:835— RuntimeHostResolver.resolveRemoteServices has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeAgentExecutionPaths.validateAndPrepare (cyclomatic 31) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:57— PeekabooBridgeAgentExecutionPaths.validateAndPrepare has cyclomatic complexity 31 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeClient.handshakeCandidate (cyclomatic 31) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:877— PeekabooBridgeClient.handshakeCandidate has cyclomatic complexity 31 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeDesktopObservationBinding.validateOutputOptions (cyclomatic 31) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:392— PeekabooBridgeDesktopObservationBinding.validateOutputOptions has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeOperationReceiptBundle.validateIntegrity (cyclomatic 31) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:202— PeekabooBridgeOperationReceiptBundle.validateIntegrity has cyclomatic complexity 31 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperationReceiptSemantics.validatePostMutationWindow (cyclomatic 31) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:1226— PeekabooBridgeOperationReceiptSemantics.validatePostMutationWindow has cyclomatic complexity 31 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperationResultSemantics.browserResponseProgressMismatch (cyclomatic 31) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics+Browser.swift:15— PeekabooBridgeOperationResultSemantics.browserResponseProgressMismatch has cyclomatic complexity 31 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeServer.allowedOperationsToAdvertise (cyclomatic 31) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handshake.swift:591— PeekabooBridgeServer.allowedOperationsToAdvertise has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SeeCommand.requireBoundTreeOnlyEvidence (cyclomatic 30) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+DetectionPipeline.swift:206— SeeCommand.requireBoundTreeOnlyEvidence has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CertificationControllerBuildIdentityResolver.current (cyclomatic 30) Apps/CLI/Sources/PeekabooCertificationController/ControllerBuildIdentity.swift:38— CertificationControllerBuildIdentityResolver.current has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
HeldPointerCertificationPlan.validate (cyclomatic 30) Apps/CLI/Sources/PeekabooCertificationController/HeldPointerPlan.swift:63— HeldPointerCertificationPlan.validate has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ActionInputDriver.selectText (cyclomatic 30) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:300— ActionInputDriver.selectText has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PeekabooBridgeCertificationMonitorSealPayload.validate (cyclomatic 30) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationMonitorSealValidation.swift:4— PeekabooBridgeCertificationMonitorSealPayload.validate has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperation.compatible (cyclomatic 30) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeModels.swift:171— PeekabooBridgeOperation.compatible has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PeekabooBridgeOperationReceiptSemantics.validateSuccessfulTargetAttribution (cyclomatic 30) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:641— PeekabooBridgeOperationReceiptSemantics.validateSuccessfulTargetAttribution has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeServer.handleBrowserExecute (cyclomatic 30) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+BrowserHandlers.swift:78— PeekabooBridgeServer.handleBrowserExecute has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ForegroundModifierClickExecutor.executeOwned (cyclomatic 29) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ForegroundModifierClickExecutor.swift:207— ForegroundModifierClickExecutor.executeOwned has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeCertificationObserverSemanticPayload.readback (cyclomatic 29) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationObserverSemanticPayload.swift:227— PeekabooBridgeCertificationObserverSemanticPayload.readback has cyclomatic complexity 29 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeClient.sendCarryingActionOutcome (cyclomatic 29) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:24— PeekabooBridgeClient.sendCarryingActionOutcome has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DetachedExactWindowFocusReader.read (cyclomatic 28) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:308— DetachedExactWindowFocusReader.read has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeDesktopObservationBinding.validateWindowEvidence (cyclomatic 28) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:612— PeekabooBridgeDesktopObservationBinding.validateWindowEvidence has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TypeActionResultRule.accepts (cyclomatic 28) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultContracts.swift:271— TypeActionResultRule.accepts has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeRequestPlan.validateBoundTypedResponse (cyclomatic 28) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultContracts.swift:695— PeekabooBridgeRequestPlan.validateBoundTypedResponse has cyclomatic complexity 28 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
PeekabooSettings.hasValidAPIKey (cyclomatic 28) Apps/Mac/Peekaboo/Core/Settings.swift:351— PeekabooSettings.hasValidAPIKey has cyclomatic complexity 28 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ClickCommand.validate (cyclomatic 27) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand+Validation.swift:12— ClickCommand.validate has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RuntimeHostResolver.resolveSnapshotAffinityOwner (cyclomatic 27) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+SnapshotAffinity.swift:110— RuntimeHostResolver.resolveSnapshotAffinityOwner has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LiveForegroundSemanticObserver.connect (cyclomatic 27) Apps/CLI/Sources/PeekabooCertificationController/ForegroundSemanticObserver.swift:36— LiveForegroundSemanticObserver.connect has cyclomatic complexity 27 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
LiveCertificationBridge.connect (cyclomatic 27) Apps/CLI/Sources/PeekabooCertificationController/LiveCertificationBridge.swift:81— LiveCertificationBridge.connect has cyclomatic complexity 27 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeHost.legacySocketOwnerState (cyclomatic 27) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift:1342— PeekabooBridgeHost.legacySocketOwnerState has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeServer.init (cyclomatic 27) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:156— PeekabooBridgeServer.init has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ClipboardPayloadBuilder.readFile (cyclomatic 26) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ClipboardPayloadBuilder.swift:126— ClipboardPayloadBuilder.readFile has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AutomationElementResolver.resolveScrollTarget (cyclomatic 26) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/AutomationElementResolver.swift:220— AutomationElementResolver.resolveScrollTarget has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DetachedAXObservationWorker.inspect (cyclomatic 26) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:239— DetachedAXObservationWorker.inspect has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DetachedAXObservationWorker.process (cyclomatic 26) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:533— DetachedAXObservationWorker.process has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DialogService.discoverDialogCandidates (cyclomatic 26) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Discovery.swift:35— DialogService.discoverDialogCandidates has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ScrollService.scrollWithLanePreparation (cyclomatic 26) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:102— ScrollService.scrollWithLanePreparation has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PressTool.execute (cyclomatic 26) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PressTool.swift:111— PressTool.execute has cyclomatic complexity 26 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
PeekabooBridgeCertificationCrashInventoryPairPayload.validate (cyclomatic 26) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationCrashInventoryPayload.swift:255— PeekabooBridgeCertificationCrashInventoryPairPayload.validate has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeClient.sendBlocking (cyclomatic 26) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:895— PeekabooBridgeClient.sendBlocking has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeClient.verifyAttestedResponse (cyclomatic 26) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:1035— PeekabooBridgeClient.verifyAttestedResponse has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeOperationReceiptAuthority.prepareSessionCreationLocked (cyclomatic 26) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceipts.swift:506— PeekabooBridgeOperationReceiptAuthority.prepareSessionCreationLocked has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PeekabooBridgeRequest.operationTargetEvidence (cyclomatic 29) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
PeekabooBridgeOperationResultSemantics.allowedSuccessStates (cyclomatic 26) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:587— PeekabooBridgeOperationResultSemantics.allowedSuccessStates has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
PeekabooBridgeServer.validateBrowserSessionRequest (cyclomatic 26) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserSessionHandoff.swift:1378— PeekabooBridgeServer.validateBrowserSessionRequest has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SeeCommand.validateTarget (cyclomatic 25) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand.swift:475— SeeCommand.validateTarget has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
DaemonLaunchPolicy.startOnDemandDaemonWithStartupLockHeld (cyclomatic 25) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/DaemonLaunchPolicy.swift:423— DaemonLaunchPolicy.startOnDemandDaemonWithStartupLockHeld has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HeldPointerCertificationRunner.validateHandshake (cyclomatic 25) Apps/CLI/Sources/PeekabooCertificationController/HeldPointerRunner.swift:577— HeldPointerCertificationRunner.validateHandshake has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CaptureArtifactIntegrityValidator.retainedRegularFile (cyclomatic 25) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureArtifactIntegrityValidator.swift:235— CaptureArtifactIntegrityValidator.retainedRegularFile has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DesktopObservationROIProcessor.apply (cyclomatic 25) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationROI.swift:115— DesktopObservationROIProcessor.apply has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DesktopObservationROIProcessor.validateApplied (cyclomatic 25) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationROI.swift:219— DesktopObservationROIProcessor.validateApplied has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DialogService.verifySavedFile (cyclomatic 25) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogVerification.swift:182— DialogService.verifySavedFile has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BrowserMCPService.executeSequenceWithOutcome (cyclomatic 25) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:857— BrowserMCPService.executeSequenceWithOutcome has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
SystemToolFormatter.formatShellResult (cyclomatic 25) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/SystemToolFormatter.swift:133— SystemToolFormatter.formatShellResult has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeAgentExecutionExecutable.stableExecutableSHA256 (cyclomatic 25) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:734— PeekabooBridgeAgentExecutionExecutable.stableExecutableSHA256 has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeAgentExecutionAcknowledgementReader.stableRead (cyclomatic 25) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:1224— PeekabooBridgeAgentExecutionAcknowledgementReader.stableRead has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeClient.validateReceiptlessProjectedTarget (cyclomatic 25) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:781— PeekabooBridgeClient.validateReceiptlessProjectedTarget has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
PeekabooBridgeDesktopObservationBinding.validateApplicationEvidence (cyclomatic 25) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:507— PeekabooBridgeDesktopObservationBinding.validateApplicationEvidence has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeDesktopObservationBinding.validateScreenSemanticOwner (cyclomatic 25) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:572— PeekabooBridgeDesktopObservationBinding.validateScreenSemanticOwner has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperationResultSemantics.finalizeSuccessful (cyclomatic 25) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:1263— PeekabooBridgeOperationResultSemantics.finalizeSuccessful has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooServices.determineDefaultModelWithConflict (cyclomatic 25) Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+Agent.swift:211— PeekabooServices.determineDefaultModelWithConflict has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RemoteDesktopObservationService.observeActionResult (cyclomatic 25) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDesktopObservationService.swift:97— RemoteDesktopObservationService.observeActionResult has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentCommand.runInternal (cyclomatic 24) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand.swift:238— AgentCommand.runInternal has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CommanderCLIBinder.requiresSilentCapture (cyclomatic 24) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:394— CommanderCLIBinder.requiresSilentCapture has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ClickCommand.run (cyclomatic 24) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:91— ClickCommand.run has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RuntimeMCPToolSnapshotMutationCoordinator.completeMutation (cyclomatic 24) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationInvalidator.swift:745— RuntimeMCPToolSnapshotMutationCoordinator.completeMutation has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DaemonStatusPrinter.render (cyclomatic 24) Apps/CLI/Sources/PeekabooCLI/Commands/System/DaemonCommand.swift:645— DaemonStatusPrinter.render has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LiveForegroundSemanticObserver.readSemanticValue (cyclomatic 24) Apps/CLI/Sources/PeekabooCertificationController/ForegroundSemanticObserver.swift:85— LiveForegroundSemanticObserver.readSemanticValue has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SelectorResolutionProof.applicationMismatch (cyclomatic 24) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationSelectorResolutionProof.swift:86— SelectorResolutionProof.applicationMismatch has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MenuService.makeMenuExtraDisplayName (cyclomatic 24) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraSupport.swift:36— MenuService.makeMenuExtraDisplayName has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TypeService.clearCurrentField (cyclomatic 24) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:905— TypeService.clearCurrentField has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
AgentToolArgumentValidator.validate (cyclomatic 24) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolArgumentValidation.swift:103— AgentToolArgumentValidator.validate has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentToolMCPBridge.observationProviderValue (cyclomatic 24) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolMCPBridge+ProviderContext.swift:62— AgentToolMCPBridge.observationProviderValue has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooAgentService.runStreamingLoopBody (cyclomatic 24) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:201— PeekabooAgentService.runStreamingLoopBody has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ToolEventSummary.toMetaValue (cyclomatic 24) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolEventSummary.swift:81— ToolEventSummary.toMetaValue has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DialogTool.validatedDialogResultTarget (cyclomatic 24) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DialogTool.swift:568— DialogTool.validatedDialogResultTarget has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CredentialFile.updateCredentials (cyclomatic 24) Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/CredentialFile.swift:88— CredentialFile.updateCredentials has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeBrowserHandoffGrantRegistry.bootstrap (cyclomatic 24) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserSessionHandoff.swift:457— PeekabooBridgeBrowserHandoffGrantRegistry.bootstrap has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeOperationReceiptSemantics.validateSelectedLeafEvidence (cyclomatic 24) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:435— PeekabooBridgeOperationReceiptSemantics.validateSelectedLeafEvidence has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeRequestPreflight.validate (cyclomatic 24) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequestPreflight.swift:41— PeekabooBridgeRequestPreflight.validate has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeServer.bridgeErrorEnvelope (cyclomatic 24) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:559— PeekabooBridgeServer.bridgeErrorEnvelope has cyclomatic complexity 24 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
DesktopActionSequenceAccumulator.interruptedBatch (cyclomatic 24) Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionSequenceAccumulator.swift:229— DesktopActionSequenceAccumulator.interruptedBatch has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DesktopActionSequenceAccumulator.successResolution (cyclomatic 24) Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionSequenceAccumulator.swift:332— DesktopActionSequenceAccumulator.successResolution has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SessionTitleGenerator.selectModel (cyclomatic 24) Apps/Mac/Peekaboo/Services/SessionTitleGenerator.swift:98— SessionTitleGenerator.selectModel has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CommanderCLIBinder.validateDialogBeforeRuntimeResolution (cyclomatic 23) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder+Dialogs.swift:25— CommanderCLIBinder.validateDialogBeforeRuntimeResolution has cyclomatic complexity 23 (threshold 15). Of this number, 18 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CertificationPrivateArtifacts.readOwnerPrivateFile (cyclomatic 23) Apps/CLI/Sources/PeekabooCertificationController/PrivateArtifacts.swift:12— CertificationPrivateArtifacts.readOwnerPrivateFile has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DesktopObservationService.validateCaptureReceipt (cyclomatic 23) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService+Capture.swift:154— DesktopObservationService.validateCaptureReceipt has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ApplicationService.performApplicationVisibilityMutation (cyclomatic 23) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+ActionOutcomes.swift:444— ApplicationService.performApplicationVisibilityMutation has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DetachedAXWindowEnumerationWorker.enumerate (cyclomatic 23) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/DetachedAXWindowEnumerationWorker.swift:103— DetachedAXWindowEnumerationWorker.enumerate has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ActionInputDriver.setValue (cyclomatic 23) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:612— ActionInputDriver.setValue has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DetachedAXObservationWorker.attachingFocusedTextSelection (cyclomatic 23) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker+TextSelection.swift:34— DetachedAXObservationWorker.attachingFocusedTextSelection has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DialogService.targetedDialogCandidates (cyclomatic 23) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+PreparedActions.swift:279— DialogService.targetedDialogCandidates has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ElementDetectionResultBuilder.makeResult (cyclomatic 23) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementDetectionResultBuilder.swift:6— ElementDetectionResultBuilder.makeResult has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ForegroundModifierClickExecutor.restoreFocusIfOwned (cyclomatic 23) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ForegroundModifierClickExecutor.swift:896— ForegroundModifierClickExecutor.restoreFocusIfOwned has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MenuService.makeMenuExtra (cyclomatic 23) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraWindows.swift:250— MenuService.makeMenuExtra has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TypeService.performTypeActions (cyclomatic 23) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:629— TypeService.performTypeActions has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ElementValueMutationSemantics.exactDecimalInteger (cyclomatic 23) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementValueVerification.swift:266— ElementValueMutationSemantics.exactDecimalInteger has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BrowserMCPSessionManager.connectUnlockedWithOutcome (cyclomatic 23) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:389— BrowserMCPSessionManager.connectUnlockedWithOutcome has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AnalyzeTool.languageModel (cyclomatic 23) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AnalyzeTool.swift:162— AnalyzeTool.languageModel has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DragRequest.init (cyclomatic 23) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Types.swift:19— DragRequest.init has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeLiveAgentExecutionRunner.runDetached (cyclomatic 23) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionRunner.swift:39— PeekabooBridgeLiveAgentExecutionRunner.runDetached has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeClient.exchange (cyclomatic 23) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:414— PeekabooBridgeClient.exchange has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeOperationSessionRefusal.validate (cyclomatic 23) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationAttestationModels.swift:622— PeekabooBridgeOperationSessionRefusal.validate has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperationReceiptSemantics.validateReceiptCarriage (cyclomatic 23) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:330— PeekabooBridgeOperationReceiptSemantics.validateReceiptCarriage has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeOperationReceiptSemantics.validateTypedResponseSemantics (cyclomatic 23) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:865— PeekabooBridgeOperationReceiptSemantics.validateTypedResponseSemantics has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
PeekabooServices.refreshAgentService (cyclomatic 23) Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+Agent.swift:10— PeekabooServices.refreshAgentService has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PasteCommand.performClipboardPasteTransaction (cyclomatic 22) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:222— PasteCommand.performClipboardPasteTransaction has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BrowserCommand.arguments (cyclomatic 22) Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserCommand.swift:243— BrowserCommand.arguments has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DialogCommand.execute (cyclomatic 22) Apps/CLI/Sources/PeekabooCLI/Commands/System/DialogCommand.swift:248— DialogCommand.execute has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BridgeCapabilityPolicy.firstUnmetObservationRequirement (cyclomatic 22) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:158— BridgeCapabilityPolicy.firstUnmetObservationRequirement has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CertificationCodeIdentityPlan.validate (cyclomatic 22) Apps/CLI/Sources/PeekabooCertificationController/CodeIdentityRunner.swift:71— CertificationCodeIdentityPlan.validate has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
UIAutomationActionResultSequenceAccumulator.recordTargetMetadata (cyclomatic 22) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/UIAutomationActionResultSequenceAccumulator.swift:283— UIAutomationActionResultSequenceAccumulator.recordTargetMetadata has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
StableRegularFileReader.readStableRegularFile (cyclomatic 22) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/StableRegularFileReader.swift:51— StableRegularFileReader.readStableRegularFile has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ClickService.validateSnapshotTarget (cyclomatic 22) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:447— ClickService.validateSnapshotTarget has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DialogService.findDialogElement (cyclomatic 22) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Resolution.swift:145— DialogService.findDialogElement has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ExactWindowDragRequest.validate (cyclomatic 22) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ExactWindowDrag.swift:42— ExactWindowDragRequest.validate has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BoundedBackgroundWindowAX.setGeometryValue (cyclomatic 22) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:1341— BoundedBackgroundWindowAX.setGeometryValue has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BrowserToolCapabilitySession.resolvingElementReferences (cyclomatic 22) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserToolCapabilitySession.swift:391— BrowserToolCapabilitySession.resolvingElementReferences has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MCPToolContext.execute (cyclomatic 22) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:336— MCPToolContext.execute has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BrowserTool.execute (cyclomatic 22) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:191— BrowserTool.execute has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
VerifyStateTool.resolveWindow (cyclomatic 22) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:263— VerifyStateTool.resolveWindow has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WindowToolFormatter.formatCompactSummary (cyclomatic 22) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter.swift:11— WindowToolFormatter.formatCompactSummary has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeAgentExecutionPaths.provisionOperationReceiptDirectoryBeforeRelease (cyclomatic 22) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:135— PeekabooBridgeAgentExecutionPaths.provisionOperationReceiptDirectoryBeforeRelease has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeCodeSignatureIdentity.authenticatedCurrentProcessSigningInformation (cyclomatic 22) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:64— PeekabooBridgeCodeSignatureIdentity.authenticatedCurrentProcessSigningInformation has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MenuBarPopoverDetector.candidates (cyclomatic 21) Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverDetector.swift:30— MenuBarPopoverDetector.candidates has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentCommand.supportedParsedModel (cyclomatic 21) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+ModelParsing.swift:58— AgentCommand.supportedParsedModel has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BridgeReceiptVerifier.readPrivateBundle (cyclomatic 21) Apps/CLI/Sources/PeekabooCLI/Commands/Core/BridgeCommand+Receipt.swift:354— BridgeReceiptVerifier.readPrivateBundle has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DragCommand.validateInputs (cyclomatic 21) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand.swift:264— DragCommand.validateInputs has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LiveCertificationBridge.execute (cyclomatic 21) Apps/CLI/Sources/PeekabooCertificationController/LiveCertificationBridge.swift:179— LiveCertificationBridge.execute has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WatchCaptureSession.captureFrames (cyclomatic 21) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchCaptureSession+Loop.swift:127— WatchCaptureSession.captureFrames has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DesktopObservationROIProcessor.exactReceiptMatches (cyclomatic 21) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationROI.swift:270— DesktopObservationROIProcessor.exactReceiptMatches has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SelectorResolutionProof.windowMismatch (cyclomatic 21) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/WindowSelectorResolutionProof.swift:142— SelectorResolutionProof.windowMismatch has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ActionInputDriver.observeMutation (cyclomatic 21) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:816— ActionInputDriver.observeMutation has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DialogService.navigateToDirectory (cyclomatic 21) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogNavigation.swift:178— DialogService.navigateToDirectory has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DialogService.executeBackgroundDialogInput (cyclomatic 21) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:137— DialogService.executeBackgroundDialogInput has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TypeService.executePixelFocusType (cyclomatic 21) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:1254— TypeService.executePixelFocusType has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentToolMCPBridge.convert (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolMCPBridge.swift:65— AgentToolMCPBridge.convert has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentToolMCPBridge.providerContextMessages (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolMCPBridge+ProviderContext.swift:7— AgentToolMCPBridge.providerContextMessages has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooAgentService.collectStreamOutput (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+StreamProcessing.swift:33— PeekabooAgentService.collectStreamOutput has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MCPToolSnapshotMutationPolicy.explicitEffect (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolSnapshotMutation.swift:400— MCPToolSnapshotMutationPolicy.explicitEffect has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ClickTool.performClick (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:345— ClickTool.performClick has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DragTool.execute (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool.swift:67— DragTool.execute has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PasteTool.performClipboardPasteTransaction (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:597— PasteTool.performClipboardPasteTransaction has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AIProviderParser.determineDefaultModel (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooAutomation/Utils/AIProviderParser.swift:83— AIProviderParser.determineDefaultModel has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooAIService.resolveAvailableModels (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooAutomation/Services/AI/PeekabooAIService.swift:511— PeekabooAIService.resolveAvailableModels has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PeekabooBridgeCertificationCrashInventoryPairPayload.validate (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationCrashInventoryPayload.swift:291— PeekabooBridgeCertificationCrashInventoryPairPayload.validate has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeClient.handshakeAuthentication (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:1017— PeekabooBridgeClient.handshakeAuthentication has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperationReceiptSemantics.validateInvalidRequestCarriageRefusal (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:405— PeekabooBridgeOperationReceiptSemantics.validateInvalidRequestCarriageRefusal has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperationReceiptAuthority.commitSessionCreation (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceipts.swift:736— PeekabooBridgeOperationReceiptAuthority.commitSessionCreation has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: PeekabooBridgeRequest.operationTargetEvidence (cyclomatic 29) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
PeekabooBridgeServer.handleHeldPointerRequest (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+HeldPointer.swift:30— PeekabooBridgeServer.handleHeldPointerRequest has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeServer.handleApplicationRequest (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:8— PeekabooBridgeServer.handleApplicationRequest has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
PeekabooBridgeServer.handleDialogRequest (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:786— PeekabooBridgeServer.handleDialogRequest has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeWindowContextBinding.applicationScopedFallbackRefines (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeWindowContextBinding.swift:58— PeekabooBridgeWindowContextBinding.applicationScopedFallbackRefines has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooServices.firstAvailableModel (cyclomatic 21) Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+Agent.swift:289— PeekabooServices.firstAvailableModel has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TypeCommand.validate (cyclomatic 20) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/TypeCommand.swift:267— TypeCommand.validate has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MenuBarActionCommand.resolveClickTarget (cyclomatic 20) Apps/CLI/Sources/PeekabooCLI/Commands/System/MenuBarCommand.swift:276— MenuBarActionCommand.resolveClickTarget has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
RuntimeHostResolver.resolveExplicitAutomaticClassicCapture (cyclomatic 20) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+ScreenCaptureKitOwner.swift:417— RuntimeHostResolver.resolveExplicitAutomaticClassicCapture has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
FocusCommandUtilities.swift.ensureFocused (cyclomatic 20) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/FocusCommandUtilities.swift:236— FocusCommandUtilities.swift.ensureFocused has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
CaptureArtifactIntegrityValidator.validatePNG (cyclomatic 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureArtifactIntegrityValidator.swift:189— CaptureArtifactIntegrityValidator.validatePNG has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DetectionTruncationInfo.remediationMessage (cyclomatic 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationRequestModels.swift:185— DetectionTruncationInfo.remediationMessage has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
InMemorySnapshotManager.invalidateImplicitLatestSnapshot (cyclomatic 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Lifecycle.swift:151— InMemorySnapshotManager.invalidateImplicitLatestSnapshot has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BackgroundInputDriver.click (cyclomatic 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1569— BackgroundInputDriver.click has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BackgroundWindowActivationDriver.prepare (cyclomatic 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundWindowActivationDriver.swift:18— BackgroundWindowActivationDriver.prepare has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DialogService.resolveButton (cyclomatic 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ButtonActions.swift:68— DialogService.resolveButton has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DialogService.findDialogViaApplicationService (cyclomatic 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Visibility.swift:49— DialogService.findDialogViaApplicationService has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ExactWindowHeldPointerLifecycle.runHold (cyclomatic 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ExactWindowHeldPointerLifecycle.swift:556— ExactWindowHeldPointerLifecycle.runHold has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TextInputRoute.resolve (cyclomatic 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TextInputRoute.swift:57— TextInputRoute.resolve has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
UIAutomationService.requireExactWindowKeyboardFocus (cyclomatic 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementLookup.swift:75— UIAutomationService.requireExactWindowKeyboardFocus has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
WindowRoutedPointerDriver.scrollTrackingDispatch (cyclomatic 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowRoutedPointerDriver.swift:462— WindowRoutedPointerDriver.scrollTrackingDispatch has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentToolArgumentValidator.validate (cyclomatic 20) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolArgumentValidation.swift:152— AgentToolArgumentValidator.validate has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AppToolActions.handleQuitAll (cyclomatic 20) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:327— AppToolActions.handleQuitAll has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VerifyStateRequest.init (cyclomatic 20) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Types.swift:73— VerifyStateRequest.init has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
VerifyStateTool.sample (cyclomatic 20) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:148— VerifyStateTool.sample has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooAIService.parseHostedProviderEntry (cyclomatic 20) Core/PeekabooCore/Sources/PeekabooAutomation/Services/AI/PeekabooAIService.swift:423— PeekabooAIService.parseHostedProviderEntry has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeBrowserHandoffGrantRegistry.endSession (cyclomatic 20) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserSessionHandoff.swift:823— PeekabooBridgeBrowserHandoffGrantRegistry.endSession has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeOperationReceiptSemantics.validateFailureResponseSemantics (cyclomatic 20) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:801— PeekabooBridgeOperationReceiptSemantics.validateFailureResponseSemantics has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperationReceiptSemantics.validateDialogResult (cyclomatic 20) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:1296— PeekabooBridgeOperationReceiptSemantics.validateDialogResult has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
PeekabooBridgeOperationReceiptAuthority.retireDeadClientSessions (cyclomatic 20) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceipts.swift:985— PeekabooBridgeOperationReceiptAuthority.retireDeadClientSessions has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: PeekabooBridgeRequest.operationTargetEvidence (cyclomatic 29) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
PeekabooBridgeSelectorResolutionBinding.observationMismatch (cyclomatic 20) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeSelectorResolutionBinding.swift:94— PeekabooBridgeSelectorResolutionBinding.observationMismatch has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeServer.performAttestedOperation (cyclomatic 20) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+OperationReceipts.swift:59— PeekabooBridgeServer.performAttestedOperation has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeServer.handleMenuRequest (cyclomatic 20) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:375— PeekabooBridgeServer.handleMenuRequest has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeServer.handleSnapshotRequest (cyclomatic 20) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:961— PeekabooBridgeServer.handleSnapshotRequest has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
SeeCommand.outputTextResults (cyclomatic 19) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+Output.swift:164— SeeCommand.outputTextResults has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CommanderCLIBinder.applyRuntimeTransportOptions (cyclomatic 19) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:212— CommanderCLIBinder.applyRuntimeTransportOptions has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CommanderCLIBinder.prefersLocalRuntime (cyclomatic 19) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:625— CommanderCLIBinder.prefersLocalRuntime has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PasteCommand.run (cyclomatic 19) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:68— PasteCommand.run has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InteractionCoordinateResolver.resolveBackgroundSnapshotCoordinates (cyclomatic 19) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionCoordinateResolver.swift:16— InteractionCoordinateResolver.resolveBackgroundSnapshotCoordinates has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RuntimeHostResolver.evaluateRemoteCandidate (cyclomatic 19) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+Resolution.swift:233— RuntimeHostResolver.evaluateRemoteCandidate has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CommandErrorHandling.swift.errorCode (cyclomatic 19) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandErrorHandling.swift:487— CommandErrorHandling.swift.errorCode has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
WindowCommand+GeometryVerification.swift.evaluateWindowGeometryOutcome (cyclomatic 19) Apps/CLI/Sources/PeekabooCLI/Commands/System/WindowCommand+GeometryVerification.swift:52— WindowCommand+GeometryVerification.swift.evaluateWindowGeometryOutcome has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ScreenCaptureKitProcessCapabilityRegistry.removeStaleMarkers (cyclomatic 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitProcessCapabilityRegistry.swift:395— ScreenCaptureKitProcessCapabilityRegistry.removeStaleMarkers has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WatchFrameDiffer.extractBoundingBoxes (cyclomatic 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchFrameDiffer.swift:182— WatchFrameDiffer.extractBoundingBoxes has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ApplicationService.prepareApplicationLaunch (cyclomatic 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift:30— ApplicationService.prepareApplicationLaunch has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ApplicationService.performApplicationRelaunchWithOutcomeOwnedLane (cyclomatic 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift:482— ApplicationService.performApplicationRelaunchWithOutcomeOwnedLane has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DarwinProcessLoopbackListenerInspector.inspect (cyclomatic 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/DarwinProcessLoopbackListenerInspector.swift:104— DarwinProcessLoopbackListenerInspector.inspect has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ClickService.performActionClick (cyclomatic 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:172— ClickService.performActionClick has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ClickService.resolveTargetElement (cyclomatic 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:744— ClickService.resolveTargetElement has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ElementDetectionService.inspectReadOnlyElements (cyclomatic 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementDetectionService.swift:330— ElementDetectionService.inspectReadOnlyElements has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BrowserMCPPageRoutingContract.capabilityContract (cyclomatic 19) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPPageRoutingContract.swift:211— BrowserMCPPageRoutingContract.capabilityContract has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
BrowserMCPService.transferConnection (cyclomatic 19) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:567— BrowserMCPService.transferConnection has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: BrowserMCPConnectionError.errorDescription (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
MCPToolContext.completeMutation (cyclomatic 19) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:1118— MCPToolContext.completeMutation has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VerifyStateTool.resolveExactWindowFromCompleteInventory (cyclomatic 19) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:343— VerifyStateTool.resolveExactWindowFromCompleteInventory has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VisionToolFormatter.extractElementSummary (cyclomatic 19) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/VisionToolFormatter.swift:276— VisionToolFormatter.extractElementSummary has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeCertificationProducerTransport.authenticateProducer (cyclomatic 19) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerTransport.swift:126— PeekabooBridgeCertificationProducerTransport.authenticateProducer has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeClient.installHandshakeCandidate (cyclomatic 19) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:1251— PeekabooBridgeClient.installHandshakeCandidate has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeClient.receiptBoundBrowserRequest (cyclomatic 19) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Browser.swift:369— PeekabooBridgeClient.receiptBoundBrowserRequest has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperationReceiptSemantics.validateResponseOutcomeConsistency (cyclomatic 19) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:1411— PeekabooBridgeOperationReceiptSemantics.validateResponseOutcomeConsistency has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PressCommand.run (cyclomatic 18) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PressCommand.swift:76— PressCommand.run has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
MenuBarActionCommand.clickMenuBarItem (cyclomatic 18) Apps/CLI/Sources/PeekabooCLI/Commands/System/MenuBarCommand.swift:155— MenuBarActionCommand.clickMenuBarItem has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ListSubcommand.run (cyclomatic 18) Apps/CLI/Sources/PeekabooCLI/Commands/System/SpaceCommand+List.swift:13— ListSubcommand.run has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DaemonLaunchPolicy.machOUUID (cyclomatic 18) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/DaemonLaunchPolicy.swift:192— DaemonLaunchPolicy.machOUUID has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CertificationCodeIdentityRunner.validateImmutableCopy (cyclomatic 18) Apps/CLI/Sources/PeekabooCertificationController/CodeIdentityRunner.swift:431— CertificationCodeIdentityRunner.validateImmutableCopy has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SpaceWindowMutationDispatcher.moveWindow (cyclomatic 18) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceWindowMutationDispatcher.swift:30— SpaceWindowMutationDispatcher.moveWindow has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ScreenCaptureWindowPlanExecutor.execute (cyclomatic 18) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitWindowPlanCache.swift:258— ScreenCaptureWindowPlanExecutor.execute has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CaptureCoordinateMapper.globalPoint (cyclomatic 18) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/CaptureCoordinateMapper.swift:38— CaptureCoordinateMapper.globalPoint has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ApplicationService.readMutationInventory (cyclomatic 18) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Discovery.swift:49— ApplicationService.readMutationInventory has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ApplicationService.requestVerifiedActivation (cyclomatic 18) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift:859— ApplicationService.requestVerifiedActivation has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ElementDetectionWindowResolver.stableExactWindowOwner (cyclomatic 18) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementDetectionWindowResolver.swift:187— ElementDetectionWindowResolver.stableExactWindowOwner has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WindowRoutedPointerDriver.click (cyclomatic 18) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowRoutedPointerDriver.swift:149— WindowRoutedPointerDriver.click has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
AgentExecutionTraceBuilder.mutationDispatchState (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentExecutionTrace.swift:249— AgentExecutionTraceBuilder.mutationDispatchState has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentExecutionTraceSanitizer.sanitizeArgument (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentExecutionTrace.swift:689— AgentExecutionTraceSanitizer.sanitizeArgument has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ReasoningReplayTarget.init (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:1487— ReasoningReplayTarget.init has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BrowserMCPChannelEndpointResolver.parseActivePort (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPChannelEndpointResolver.swift:229— BrowserMCPChannelEndpointResolver.parseActivePort has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BrowserMCPSessionManager.executeSequenceUnlocked (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:796— BrowserMCPSessionManager.executeSequenceUnlocked has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BrowserMCPUploadStager.stageSynchronously (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPUploadStager.swift:156— BrowserMCPUploadStager.stageSynchronously has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ToolEventSummary.shortDescription (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolEventSummary.swift:204— ToolEventSummary.shortDescription has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BrowserTool.formatStatus (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:711— BrowserTool.formatStatus has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TypeTool.resolvePixelFocusTarget (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/TypeTool.swift:437— TypeTool.resolvePixelFocusTarget has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
VerifyStateTool.finalScreenshot (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Response.swift:106— VerifyStateTool.finalScreenshot has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SystemToolFormatter.formatCompactSummary (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/SystemToolFormatter.swift:11— SystemToolFormatter.formatCompactSummary has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SystemToolFormatter.formatError (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/SystemToolFormatter.swift:403— SystemToolFormatter.formatError has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UIAutomationToolFormatter.formatScrollResult (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+PointerResults.swift:32— UIAutomationToolFormatter.formatScrollResult has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WindowToolFormatter.formatListScreensResult (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+WindowResults.swift:136— WindowToolFormatter.formatListScreensResult has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CredentialFile.readCredentialSnapshot (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/CredentialFile.swift:40— CredentialFile.readCredentialSnapshot has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeDesktopObservationBinding.validateDisplayEvidence (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:672— PeekabooBridgeDesktopObservationBinding.validateDisplayEvidence has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeHost.peerInfoIfAllowed (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost+Clients.swift:238— PeekabooBridgeHost.peerInfoIfAllowed has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeOperationReceiptSemantics.validateDesktopObservationSetupResult (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:1131— PeekabooBridgeOperationReceiptSemantics.validateDesktopObservationSetupResult has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperationResultSemantics.failureOutcomeMatchesContract (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:1184— PeekabooBridgeOperationResultSemantics.failureOutcomeMatchesContract has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: PeekabooBridgeOperationResultSemantics.desktopOperationScope (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
PeekabooBridgeOperationResultSemantics.validateSuccessfulTargetDisposition (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:1487— PeekabooBridgeOperationResultSemantics.validateSuccessfulTargetDisposition has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PeekabooBridgeOperationResultSemantics.desktopOperationScope (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
PeekabooBridgeRequest.minimumNegotiatedProtocolVersion (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequest+DesktopMutation.swift:42— PeekabooBridgeRequest.minimumNegotiatedProtocolVersion has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PeekabooBridgeServer.handleDesktopObservationRequest (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+CaptureHandlers.swift:60— PeekabooBridgeServer.handleDesktopObservationRequest has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeServer.updateSnapshotAndElementCapabilities (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:1432— PeekabooBridgeServer.updateSnapshotAndElementCapabilities has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooServices.isConfiguredDefaultAvailable (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+Agent.swift:424— PeekabooServices.isConfiguredDefaultAvailable has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
RemoteDesktopObservationService.prepareObservationResult (cyclomatic 18) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDesktopObservationService.swift:284— RemoteDesktopObservationService.prepareObservationResult has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DesktopSelectedLeafEvidence.validate (cyclomatic 18) Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopSelectedLeafEvidence.swift:181— DesktopSelectedLeafEvidence.validate has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
AllElementsView.filteredElements (cyclomatic 18) Core/PeekabooUICore/Sources/PeekabooUICore/Components/AllElementsView.swift:154— AllElementsView.filteredElements has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
KeyboardView.body (cyclomatic 18) Apps/Playground/Playground/Views/KeyboardView.swift:13— KeyboardView.body has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AgentExecutionReleaseGate.waitIfConfigured (cyclomatic 17) Apps/CLI/Sources/PeekabooCLI/AgentExecutionReleaseGate.swift:17— AgentExecutionReleaseGate.waitIfConfigured has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MenuBarPopoverResolver.resolve (cyclomatic 17) Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverResolver.swift:71— MenuBarPopoverResolver.resolve has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentCommand.runTauTUIChatLoop (cyclomatic 17) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+Chat.swift:179— AgentCommand.runTauTUIChatLoop has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentCommand.unavailableImplicitCustomModelToolCapabilityError (cyclomatic 17) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+ModelParsing.swift:156— AgentCommand.unavailableImplicitCustomModelToolCapabilityError has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SeeCommand.run (cyclomatic 17) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand.swift:158— SeeCommand.run has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SeeCommand.observationTargetForCaptureWithDetectionIfPossible (cyclomatic 17) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+ObservationRequest.swift:26— SeeCommand.observationTargetForCaptureWithDetectionIfPossible has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProviderStatusReporter.envSource (cyclomatic 17) Apps/CLI/Sources/PeekabooCLI/Commands/Core/ConfigCommand+Status.swift:111— ProviderStatusReporter.envSource has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PasteCommand.withInteractionMutationInvalidation (cyclomatic 17) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:912— PasteCommand.withInteractionMutationInvalidation has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WindowCommand+State.swift.validatedRestoredWindowOutputInfo (cyclomatic 17) Apps/CLI/Sources/PeekabooCLI/Commands/System/WindowCommand+State.swift:479— WindowCommand+State.swift.validatedRestoredWindowOutputInfo has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
HeldPointerReceiptTracker.record (cyclomatic 17) Apps/CLI/Sources/PeekabooCertificationController/HeldPointerRunner.swift:242— HeldPointerReceiptTracker.record has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ObservationTargetResolver.resolveApplication (cyclomatic 17) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationTargetResolver.swift:139— ObservationTargetResolver.resolveApplication has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ApplicationService.listApplications (cyclomatic 17) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Discovery.swift:155— ApplicationService.listApplications has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ClipboardService.set (cyclomatic 17) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ClipboardService.swift:461— ClipboardService.set has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ClickService.focusExactElementWithOutcome (cyclomatic 17) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:1010— ClickService.focusExactElementWithOutcome has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ClickService.executeClick (cyclomatic 17) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:1368— ClickService.executeClick has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DialogService.exactFileDialogTarget (cyclomatic 17) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Resolution.swift:93— DialogService.exactFileDialogTarget has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MenuService.getMenuBarItemsFromAppsAX (cyclomatic 17) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraAccessibility.swift:239— MenuService.getMenuBarItemsFromAppsAX has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TypeService.resolveTargetElement (cyclomatic 17) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService+TargetResolution.swift:36— TypeService.resolveTargetElement has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WindowManagementService.closeWindowWithForegroundFallbackResult (cyclomatic 17) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+ForegroundClose.swift:9— WindowManagementService.closeWindowWithForegroundFallbackResult has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentExecutionTraceSanitizer.resultSummary (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentExecutionTrace.swift:495— AgentExecutionTraceSanitizer.resultSummary has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentToolMCPBridge.makeModelImage (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolMCPBridge.swift:319— AgentToolMCPBridge.makeModelImage has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooAgentService.runGenerationLoopBody (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:552— PeekabooAgentService.runGenerationLoopBody has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooAgentService.balancedJSONFragments (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:444— PeekabooAgentService.balancedJSONFragments has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooAgentService.removingJSONComments (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:490— PeekabooAgentService.removingJSONComments has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooAgentService.reasoningMetadata (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:689— PeekabooAgentService.reasoningMetadata has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AgentSystemPrompt.interactionSection (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/Tools/AgentSystemPrompt.swift:263— AgentSystemPrompt.interactionSection has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MenuTool.handleClickAction (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MenuTool.swift:194— MenuTool.handleClickAction has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SeeElementTextFormatter.describe (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SeeTool+Formatting.swift:20— SeeElementTextFormatter.describe has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SelectTextTool.execute (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SelectTextTool.swift:35— SelectTextTool.execute has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TypeTool.focusIfNeeded (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/TypeTool.swift:698— TypeTool.focusIfNeeded has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MenuSystemToolFormatter.formatCompactSummary (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter.swift:11— MenuSystemToolFormatter.formatCompactSummary has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MenuSystemToolFormatter.formatListMenuItemsResult (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter+Menu.swift:58— MenuSystemToolFormatter.formatListMenuItemsResult has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UIAutomationToolFormatter.formatTypeResult (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+KeyboardResults.swift:9— UIAutomationToolFormatter.formatTypeResult has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PeekabooBridgeAgentExecutionOutputExtractor.convert (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:1384— PeekabooBridgeAgentExecutionOutputExtractor.convert has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeCertificationMonitorSealPayload.validateForegroundPlan (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationMonitorSealValidation.swift:104— PeekabooBridgeCertificationMonitorSealPayload.validateForegroundPlan has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeHost.handleClient (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost+Clients.swift:9— PeekabooBridgeHost.handleClient has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeHost.acquireLease (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift:676— PeekabooBridgeHost.acquireLease has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PeekabooBridgeHost.readLeaseMarker (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift:1167— PeekabooBridgeHost.readLeaseMarker has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeOperationReceiptSemantics.selectedLeaf (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:589— PeekabooBridgeOperationReceiptSemantics.selectedLeaf has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperationReceiptSemantics.validateSelectorResponseSemantics (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:959— PeekabooBridgeOperationReceiptSemantics.validateSelectorResponseSemantics has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeOperationReceiptPayload.validateTargetState (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptPayload.swift:94— PeekabooBridgeOperationReceiptPayload.validateTargetState has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeServer.handleExactWindowTargetedHotkey (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:691— PeekabooBridgeServer.handleExactWindowTargetedHotkey has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: PeekabooBridgeServer.handleAutomationRequest (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
PeekabooBridgeServer.windowMutationResponse (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+MutationProof.swift:83— PeekabooBridgeServer.windowMutationResponse has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeServer.updateInputAndLifecycleCapabilities (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:1489— PeekabooBridgeServer.updateInputAndLifecycleCapabilities has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeWindowContextBinding.matches (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeWindowContextBinding.swift:7— PeekabooBridgeWindowContextBinding.matches has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeServer.swift.protocolHostCapabilities (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:1327— PeekabooBridgeServer.swift.protocolHostCapabilities has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PeekabooServices.configuredCustomDefaultModel (cyclomatic 17) Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+Agent.swift:138— PeekabooServices.configuredCustomDefaultModel has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WindowTestingView.body (cyclomatic 17) Apps/Playground/Playground/Views/WindowTestingView.swift:12— WindowTestingView.body has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AgentExecutionReleaseGate.wait (cyclomatic 16) Apps/CLI/Sources/PeekabooCLI/AgentExecutionReleaseGate.swift:108— AgentExecutionReleaseGate.wait has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentCommand.runLineChatLoop (cyclomatic 16) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+Chat.swift:91— AgentCommand.runLineChatLoop has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SeeCommand.validateSpecialCaptureTargets (cyclomatic 16) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand.swift:455— SeeCommand.validateSpecialCaptureTargets has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CaptureActionProcessBox.release (cyclomatic 16) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionProcessRunner.swift:244— CaptureActionProcessBox.release has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ClickCommand.resolveAndDispatchModifierClick (cyclomatic 16) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:534— ClickCommand.resolveAndDispatchModifierClick has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ClickCommand.resolveBackgroundClickTarget (cyclomatic 16) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:1133— ClickCommand.resolveBackgroundClickTarget has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ClickCommand.validateBackgroundCoordinateResolution (cyclomatic 16) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:1239— ClickCommand.validateBackgroundCoordinateResolution has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MoveCommand.validate (cyclomatic 16) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand.swift:41— MoveCommand.validate has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ScrollCommand.run (cyclomatic 16) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ScrollCommand.swift:43— ScrollCommand.run has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RuntimeHostResolver.shouldSkipOnDemandDaemon (cyclomatic 16) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+Resolution.swift:175— RuntimeHostResolver.shouldSkipOnDemandDaemon has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
FocusedElementReceiptResolver.validate (cyclomatic 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/FocusedElementReceiptResolver.swift:70— FocusedElementReceiptResolver.validate has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
VideoWriter.abortAndRemovePartialOutput (cyclomatic 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/VideoWriter.swift:255— VideoWriter.abortAndRemovePartialOutput has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DesktopObservationService.validateResolvedTarget (cyclomatic 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService+OperationLane.swift:92— DesktopObservationService.validateResolvedTarget has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ObservationTargetResolver.backgroundMenuBarClick (cyclomatic 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationTargetResolver+MenuBar.swift:177— ObservationTargetResolver.backgroundMenuBarClick has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ApplicationService.requestApplicationVisibility (cyclomatic 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift:1134— ApplicationService.requestApplicationVisibility has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BoundedArtifactFile.read (cyclomatic 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/BoundedArtifactFile.swift:60— BoundedArtifactFile.read has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AutomationElementResolver.application (cyclomatic 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/AutomationElementResolver.swift:386— AutomationElementResolver.application has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: AutomationElementResolver.elementType (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
DialogService.executeFileDialog (cyclomatic 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogs.swift:43— DialogService.executeFileDialog has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ForegroundModifierClickExecutor.makeTargetFocusGuard (cyclomatic 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ForegroundModifierClickExecutor.swift:639— ForegroundModifierClickExecutor.makeTargetFocusGuard has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TypeService.typeActionsByFocusingPixel (cyclomatic 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:1145— TypeService.typeActionsByFocusingPixel has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
PinnedWindowGeometrySequence.swift.completePinnedWindowGeometry (cyclomatic 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/PinnedWindowGeometrySequence.swift:97— PinnedWindowGeometrySequence.swift.completePinnedWindowGeometry has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentToolMCPBridge.agentValue (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolMCPBridge.swift:500— AgentToolMCPBridge.agentValue has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooAgentService.maxOutputTokens (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:145— PeekabooAgentService.maxOutputTokens has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
PeekabooAgentService.executeToolCall (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:1056— PeekabooAgentService.executeToolCall has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AgentTurnBoundary.recordSuccessfulCompletion (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/QueueMode.swift:144— AgentTurnBoundary.recordSuccessfulCompletion has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BrowserMCPAuthenticatedSessionPool.commitRootHandoff (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPAuthenticatedSessionPool.swift:365— BrowserMCPAuthenticatedSessionPool.commitRootHandoff has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BrowserMCPSessionManager.inspectStatusUnlocked (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:234— BrowserMCPSessionManager.inspectStatusUnlocked has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BrowserMCPSessionManager.resolveTarget (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:1280— BrowserMCPSessionManager.resolveTarget has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AnalyzeTool.isUnsupportedLegacyModel (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AnalyzeTool.swift:214— AnalyzeTool.isUnsupportedLegacyModel has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BrowserTool.executeCapabilityBound (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:366— BrowserTool.executeCapabilityBound has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PasteTool.execute (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:145— PasteTool.execute has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PasteTool.dispatchPasteHotkey (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:512— PasteTool.dispatchPasteHotkey has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VerifyStateTargetIdentityTracker.resolve (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:603— VerifyStateTargetIdentityTracker.resolve has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
VerifyStateTool.resolveApplication (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:418— VerifyStateTool.resolveApplication has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VisionToolFormatter.formatWindowCaptureResult (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/VisionToolFormatter.swift:166— VisionToolFormatter.formatWindowCaptureResult has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WindowToolFormatter.formatStarting (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter.swift:100— WindowToolFormatter.formatStarting has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeCertificationMonitorSealPayload.validateTarget (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationMonitorSealValidation.swift:84— PeekabooBridgeCertificationMonitorSealPayload.validateTarget has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeClient.reserveOperationSession (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:359— PeekabooBridgeClient.reserveOperationSession has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeClient.exactDialogForceDismiss (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:601— PeekabooBridgeClient.exactDialogForceDismiss has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeClient.unwrapResponse (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:653— PeekabooBridgeClient.unwrapResponse has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeCodeSignatureIdentity.validatedSigningInformation (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:217— PeekabooBridgeCodeSignatureIdentity.validatedSigningInformation has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PeekabooBridgeHost.makeListeningSocket (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift:759— PeekabooBridgeHost.makeListeningSocket has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeOperationResultSemantics.successResponseMatchesPolicy (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:1144— PeekabooBridgeOperationResultSemantics.successResponseMatchesPolicy has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: PeekabooBridgeOperationResultSemantics.desktopOperationScope (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
TypedResponseRule.isConsistent (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultContracts.swift:406— TypedResponseRule.isConsistent has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeServer.handleBrowserConnect (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+BrowserConnect.swift:27— PeekabooBridgeServer.handleBrowserConnect has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeekabooBridgeWindowContextBinding.refines (cyclomatic 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeWindowContextBinding.swift:27— PeekabooBridgeWindowContextBinding.refines has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SuccessPolicy.accepts (cyclomatic 16) Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:324— SuccessPolicy.accepts has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
SessionChatHeader.body (cyclomatic 16) Apps/Mac/Peekaboo/Features/Main/SessionChatView.swift:210— SessionChatHeader.body has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DetailedMessageRow.body (cyclomatic 16) Apps/Mac/Peekaboo/Features/Main/MessageComponents/DetailedMessageRow.swift:17— DetailedMessageRow.body has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PeekabooMCPWrapper.start (cyclomatic 16) peekaboo-mcp.js:42— PeekabooMCPWrapper.start has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 66, 79). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D12 · Dependency Hygiene· No Package.resolved committed (Apps/CLI/Package.swift) · ×1
No Package.resolved committed (Apps/CLI/Package.swift) — Apps/CLI/Package.swift declares 3 dependencies and no `.library` product, so it is an APPLICATION — but no `Package.resolved` is committed beside it. Nothing records the versions a working build resolved to, so `swift build` re-resolves against whatever each dependency's git host serves today and two builds of this commit are not guaranteed to be the same build. Build once and commit the resulting `Package.resolved`. (A published LIBRARY correctly omits its resolution — SwiftPM ignores a library's `Package.resolved` when the package is consumed — which is why this is asked only of a package that ships no `.library` product.)
PeekabooBridgeServer.handleHandshake (cognitive 139) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handshake.swift:31— PeekabooBridgeServer.handleHandshake has cognitive complexity 139 (threshold 15). Drivers by points: boolean chains 88, if/else 43 (45 pts), match/switch 1 (3 pts), error handling 1 (2 pts), ternaries 1 (nesting depth added 5). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeAgentExecutionTraceResponse.validate (cognitive 106) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionTraceModels.swift:339— PeekabooBridgeAgentExecutionTraceResponse.validate has cognitive complexity 106 (threshold 15). Drivers by points: boolean chains 102, if/else 3, error handling 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
TypeService.performTypeActions (cognitive 71) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:629— TypeService.performTypeActions has cognitive complexity 71 (threshold 15). Drivers by points: error handling 8 (29 pts), ternaries 5 (24 pts), if/else 3 (8 pts), loops 2 (6 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
core-sigpipe-diagnostic.capture (cognitive 71) .github/scripts/core-sigpipe-diagnostic.py:60— core-sigpipe-diagnostic.capture has cognitive complexity 71 (threshold 15). Drivers by points: if/else 20 (38 pts), ternaries 3 (14 pts), loops 6 (13 pts), boolean chains 4, error handling 2 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClickCommand.run (cognitive 70) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:91— ClickCommand.run has cognitive complexity 70 (threshold 15). Drivers by points: if/else 19 (53 pts), ternaries 2 (10 pts), boolean chains 6, error handling 1 (nesting depth added 42). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BrowserMCPSessionManager.prepareExecutionReceipt (cognitive 58) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:921— BrowserMCPSessionManager.prepareExecutionReceipt has cognitive complexity 58 (threshold 15). Drivers by points: if/else 23 (39 pts), boolean chains 12, error handling 5 (7 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RuntimeHostResolver.resolveRemoteServices (cognitive 56) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver.swift:835— RuntimeHostResolver.resolveRemoteServices has cognitive complexity 56 (threshold 15). Drivers by points: if/else 10 (32 pts), boolean chains 15, error handling 4 (8 pts), loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeClient.sendCarryingActionOutcome (cognitive 56) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:24— PeekabooBridgeClient.sendCarryingActionOutcome has cognitive complexity 56 (threshold 15). Drivers by points: if/else 12 (34 pts), boolean chains 10, error handling 2 (7 pts), match/switch 1 (2 pts), ternaries 2, loops 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DaemonLaunchPolicy.startOnDemandDaemonWithStartupLockHeld (cognitive 54) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/DaemonLaunchPolicy.swift:423— DaemonLaunchPolicy.startOnDemandDaemonWithStartupLockHeld has cognitive complexity 54 (threshold 15). Drivers by points: if/else 10 (29 pts), error handling 7 (18 pts), boolean chains 3, ternaries 1 (3 pts), match/switch 1 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DialogTool.execute (cognitive 54) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DialogTool.swift:110— DialogTool.execute has cognitive complexity 54 (threshold 15). Drivers by points: boolean chains 24, if/else 13 (24 pts), error handling 4, match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UISnapshot.setScreenshot (cognitive 54) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/UISnapshotStore.swift:36— UISnapshot.setScreenshot has cognitive complexity 54 (threshold 15). Drivers by points: boolean chains 28, if/else 23, ternaries 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperationResultSemantics.deliveryRules (cognitive 54) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:727— PeekabooBridgeOperationResultSemantics.deliveryRules has cognitive complexity 54 (threshold 15). Drivers by points: if/else 14 (28 pts), ternaries 8 (17 pts), boolean chains 6, match/switch 2 (3 pts) (nesting depth added 24). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PressCommand.run (cognitive 52) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PressCommand.swift:76— PressCommand.run has cognitive complexity 52 (threshold 15). Drivers by points: error handling 8 (25 pts), if/else 6 (20 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LegacyPNGValidator.hasValidStructureAndCRC (cognitive 50) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyPNGValidator.swift:18— LegacyPNGValidator.hasValidStructureAndCRC has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (32 pts), boolean chains 15, match/switch 1 (2 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ScrollService.scrollWithLanePreparation (cognitive 50) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:102— ScrollService.scrollWithLanePreparation has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (34 pts), boolean chains 7, error handling 3 (5 pts), ternaries 2 (4 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
CommanderCLIBinder.makeRuntimeOptions (cognitive 49) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:43— CommanderCLIBinder.makeRuntimeOptions has cognitive complexity 49 (threshold 15). Drivers by points: boolean chains 36, if/else 11 (12 pts), ternaries 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DialogCommand.execute (cognitive 49) Apps/CLI/Sources/PeekabooCLI/Commands/System/DialogCommand.swift:248— DialogCommand.execute has cognitive complexity 49 (threshold 15). Drivers by points: if/else 12 (32 pts), error handling 6 (7 pts), ternaries 1 (5 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WindowEnumerationContext.mergeWindowInventory (cognitive 49) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationWindowEnumerationContext.swift:439— WindowEnumerationContext.mergeWindowInventory has cognitive complexity 49 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 14, loops 5, ternaries 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DialogService.navigateToDirectory (cognitive 49) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogNavigation.swift:178— DialogService.navigateToDirectory has cognitive complexity 49 (threshold 15). Drivers by points: if/else 15 (37 pts), ternaries 3 (8 pts), boolean chains 3, error handling 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DesktopTargetIdentityCoalescer.resolve (cognitive 48) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/DesktopTargetPlanning.swift:310— DesktopTargetIdentityCoalescer.resolve has cognitive complexity 48 (threshold 15). Drivers by points: if/else 19 (28 pts), boolean chains 19, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DetachedAXMutationReader.readSynchronously (cognitive 48) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/AXMutationObservation.swift:140— DetachedAXMutationReader.readSynchronously has cognitive complexity 48 (threshold 15). Drivers by points: boolean chains 25, if/else 12 (19 pts), ternaries 3, match/switch 1 (nesting depth added 7). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Reader.read (cognitive 48) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundWindowChromeReader.swift:91— Reader.read has cognitive complexity 48 (threshold 15). Drivers by points: if/else 18 (33 pts), boolean chains 12, loops 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserMCPService.executeSequenceWithOutcome (cognitive 48) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:857— BrowserMCPService.executeSequenceWithOutcome has cognitive complexity 48 (threshold 15). Drivers by points: error handling 7 (21 pts), if/else 11 (15 pts), ternaries 4 (6 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CertificationObserveOnlyPlan.validate (cognitive 47) Apps/CLI/Sources/PeekabooCertificationController/ObserverPlan.swift:114— CertificationObserveOnlyPlan.validate has cognitive complexity 47 (threshold 15). Drivers by points: boolean chains 42, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooAgentService.runStreamingLoopBody (cognitive 47) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:201— PeekabooAgentService.runStreamingLoopBody has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (30 pts), error handling 2 (4 pts), loops 2 (4 pts), boolean chains 3, match/switch 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ScrollTool.parseRequest (cognitive 47) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ScrollTool.swift:102— ScrollTool.parseRequest has cognitive complexity 47 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 18, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MenuExtraAXReader.readSynchronously (cognitive 45) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuExtraAXReader.swift:75— MenuExtraAXReader.readSynchronously has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 12, error handling 2 (3 pts), ternaries 2 (3 pts), loops 1 (nesting depth added 14). Of this number, 41 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClickRequest.init (cognitive 45) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:976— ClickRequest.init has cognitive complexity 45 (threshold 15). Drivers by points: if/else 23 (32 pts), boolean chains 13 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeCertificationObserverSemanticPayload.validate (cognitive 45) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationObserverSemanticPayload.swift:133— PeekabooBridgeCertificationObserverSemanticPayload.validate has cognitive complexity 45 (threshold 15). Drivers by points: boolean chains 40, if/else 4, error handling 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeHost.legacySocketOwnerState (cognitive 45) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift:1342— PeekabooBridgeHost.legacySocketOwnerState has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (31 pts), boolean chains 7, loops 2 (3 pts), match/switch 1 (3 pts), ternaries 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeRequestPreflight.validate (cognitive 45) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeRequestPreflight.swift:41— PeekabooBridgeRequestPreflight.validate has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 3 (7 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeServer.validateOperationAccess (cognitive 45) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:1084— PeekabooBridgeServer.validateOperationAccess has cognitive complexity 45 (threshold 15). Drivers by points: boolean chains 26, if/else 14 (19 pts) (nesting depth added 5). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
HotkeyService.hotkey (cognitive 44) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/HotkeyService.swift:193— HotkeyService.hotkey has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 14, error handling 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MCPToolContext.execute (cognitive 44) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:336— MCPToolContext.execute has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (35 pts), ternaries 2 (4 pts), error handling 3, boolean chains 2 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
UISnapshot.setTargetMetadata (cognitive 44) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/UISnapshotStore.swift:165— UISnapshot.setTargetMetadata has cognitive complexity 44 (threshold 15). Drivers by points: if/else 23, boolean chains 19, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PeekabooBridgeClient.sendBlocking (cognitive 44) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:895— PeekabooBridgeClient.sendBlocking has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (24 pts), error handling 5 (11 pts), boolean chains 9 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationResultSemantics.contract (cognitive 44) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:16— PeekabooBridgeOperationResultSemantics.contract has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 12 (25 pts), if/else 6 (11 pts), match/switch 3 (5 pts), boolean chains 3 (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ListSubcommand.run (cognitive 43) Apps/CLI/Sources/PeekabooCLI/Commands/System/SpaceCommand+List.swift:13— ListSubcommand.run has cognitive complexity 43 (threshold 15). Drivers by points: loops 5 (16 pts), ternaries 4 (13 pts), if/else 6 (9 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DialogService.discoverDialogCandidates (cognitive 43) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Discovery.swift:35— DialogService.discoverDialogCandidates has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 10, loops 3 (6 pts), ternaries 1 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserMCPSessionManager.validate (cognitive 43) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:1431— BrowserMCPSessionManager.validate has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 28, if/else 9 (15 pts) (nesting depth added 6). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CommanderCLIBinder.requiresImplicitSnapshotInvalidation (cognitive 42) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:444— CommanderCLIBinder.requiresImplicitSnapshotInvalidation has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 36, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CommanderCLIBinder.applyRoutePermissionOptions (cognitive 42) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder+InteractionPermissions.swift:8— CommanderCLIBinder.applyRoutePermissionOptions has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 26, if/else 6 (7 pts), ternaries 3 (7 pts), match/switch 1 (2 pts) (nesting depth added 6). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BrowserToolCapabilitySession.project (cognitive 42) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserToolCapabilitySession.swift:133— BrowserToolCapabilitySession.project has cognitive complexity 42 (threshold 15). Drivers by points: if/else 21 (24 pts), boolean chains 12, ternaries 5 (6 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PeekabooBridgeOperationReceiptSemantics.validateSuccessfulTargetAttribution (cognitive 42) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:641— PeekabooBridgeOperationReceiptSemantics.validateSuccessfulTargetAttribution has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 8, error handling 2, ternaries 1 (2 pts), match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BridgeCapabilityPolicy.supportsInteractionRequirements (cognitive 41) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:240— BridgeCapabilityPolicy.supportsInteractionRequirements has cognitive complexity 41 (threshold 15). Drivers by points: boolean chains 21, if/else 20. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
TypeService.clearCurrentField (cognitive 41) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:905— TypeService.clearCurrentField has cognitive complexity 41 (threshold 15). Drivers by points: error handling 11 (19 pts), ternaries 6 (14 pts), if/else 4, match/switch 1 (3 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClickTool.performClick (cognitive 41) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:345— ClickTool.performClick has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (35 pts), boolean chains 6 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SeeCommand.validatePresentationOptions (cognitive 40) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand.swift:398— SeeCommand.validatePresentationOptions has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 27, if/else 13. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
RemoteDesktopObservationService.observeActionResult (cognitive 40) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDesktopObservationService.swift:97— RemoteDesktopObservationService.observeActionResult has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 7, error handling 4 (6 pts), loops 1 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CaptureActionManifestWriter.retainedFile (cognitive 39) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:911— CaptureActionManifestWriter.retainedFile has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 18, loops 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WatchCaptureSession.captureFrames (cognitive 39) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchCaptureSession+Loop.swift:127— WatchCaptureSession.captureFrames has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (30 pts), boolean chains 4, error handling 1 (2 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ActionInputDriver.setValue (cognitive 39) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:612— ActionInputDriver.setValue has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 8, error handling 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ForegroundModifierClickExecutor.executeOwned (cognitive 39) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ForegroundModifierClickExecutor.swift:207— ForegroundModifierClickExecutor.executeOwned has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 9, error handling 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentToolMCPBridge.convert (cognitive 39) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolMCPBridge.swift:65— AgentToolMCPBridge.convert has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (26 pts), ternaries 2 (5 pts), loops 2 (3 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooAgentService.collectStreamOutput (cognitive 39) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+StreamProcessing.swift:33— PeekabooAgentService.collectStreamOutput has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (27 pts), ternaries 2 (7 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserToolCapabilitySession.resolvingElementReferences (cognitive 39) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserToolCapabilitySession.swift:391— BrowserToolCapabilitySession.resolvingElementReferences has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 3 (7 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeCertificationMonitorSealPayload.validateHeartbeat (cognitive 39) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationMonitorSealValidation.swift:212— PeekabooBridgeCertificationMonitorSealPayload.validateHeartbeat has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 30, if/else 5 (7 pts), ternaries 2 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeServer.handleBrowserExecute (cognitive 39) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+BrowserHandlers.swift:78— PeekabooBridgeServer.handleBrowserExecute has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 12, ternaries 1 (2 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DesktopActionSequenceAccumulator.completedBatch (cognitive 39) Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionSequenceAccumulator.swift:116— DesktopActionSequenceAccumulator.completedBatch has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 17, if/else 15 (17 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DaemonStatusPrinter.render (cognitive 38) Apps/CLI/Sources/PeekabooCLI/Commands/System/DaemonCommand.swift:645— DaemonStatusPrinter.render has cognitive complexity 38 (threshold 15). Drivers by points: if/else 20 (29 pts), ternaries 4 (9 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MenuBarActionCommand.clickMenuBarItem (cognitive 38) Apps/CLI/Sources/PeekabooCLI/Commands/System/MenuBarCommand.swift:155— MenuBarActionCommand.clickMenuBarItem has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (28 pts), ternaries 4 (9 pts), error handling 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CertificationControllerPlan.validate (cognitive 38) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:260— CertificationControllerPlan.validate has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 24, if/else 14. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WatchFrameDiffer.extractBoundingBoxes (cognitive 38) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchFrameDiffer.swift:182— WatchFrameDiffer.extractBoundingBoxes has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 5 (11 pts), boolean chains 5 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DialogService.verifySavedFile (cognitive 38) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogVerification.swift:182— DialogService.verifySavedFile has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 12, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WindowManagementService.closeWindowWithForegroundFallbackResult (cognitive 38) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+ForegroundClose.swift:9— WindowManagementService.closeWindowWithForegroundFallbackResult has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (24 pts), error handling 6 (11 pts), ternaries 1 (3 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentToolResultSemantics.turnBoundaryProjection (cognitive 38) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolResultSemantics.swift:265— AgentToolResultSemantics.turnBoundaryProjection has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 20, if/else 13 (17 pts), loops 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeDesktopObservationBinding.validateOutputOptions (cognitive 38) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:392— PeekabooBridgeDesktopObservationBinding.validateOutputOptions has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 12, error handling 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RuntimeHostResolver.resolveRemoteRouting (cognitive 37) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver.swift:327— RuntimeHostResolver.resolveRemoteRouting has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 15, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LiveCertificationBridge.validateCanonicalRequest (cognitive 37) Apps/CLI/Sources/PeekabooCertificationController/LiveCertificationBridge.swift:436— LiveCertificationBridge.validateCanonicalRequest has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 26, if/else 7 (10 pts), match/switch 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CaptureArtifactIntegrityValidator.videoCustody (cognitive 37) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureArtifactIntegrityValidator.swift:108— CaptureArtifactIntegrityValidator.videoCustody has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 23, if/else 8 (13 pts), loops 1 (nesting depth added 5). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BrowserMCPSessionManager.connectionReceipt (cognitive 37) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:1559— BrowserMCPSessionManager.connectionReceipt has cognitive complexity 37 (threshold 15). Drivers by points: boolean chains 25, if/else 11 (12 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SystemToolFormatter.formatShellResult (cognitive 37) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/SystemToolFormatter.swift:133— SystemToolFormatter.formatShellResult has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (21 pts), ternaries 4 (10 pts), boolean chains 6 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TypeActionResultRule.accepts (cognitive 37) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultContracts.swift:271— TypeActionResultRule.accepts has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 11, loops 1, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CaptureActionManifest.semanticFailure (cognitive 36) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:148— CaptureActionManifest.semanticFailure has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 27, if/else 6 (7 pts), match/switch 1, ternaries 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ActionInputDriver.selectText (cognitive 36) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:300— ActionInputDriver.selectText has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 9, error handling 6 (9 pts), ternaries 2 (3 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ForegroundModifierClickExecutor.restoreFocusIfOwned (cognitive 36) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ForegroundModifierClickExecutor.swift:896— ForegroundModifierClickExecutor.restoreFocusIfOwned has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (25 pts), error handling 6 (9 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DragTool.execute (cognitive 36) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool.swift:67— DragTool.execute has cognitive complexity 36 (threshold 15). Drivers by points: if/else 8 (18 pts), error handling 7 (8 pts), boolean chains 6, ternaries 1 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VerifyStateTool.resolveWindow (cognitive 36) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:263— VerifyStateTool.resolveWindow has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (27 pts), match/switch 1 (3 pts), ternaries 1 (3 pts), error handling 2, boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeClient.exchange (cognitive 36) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:414— PeekabooBridgeClient.exchange has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (24 pts), error handling 6, boolean chains 4, match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MenuBarPopoverDetector.candidates (cognitive 35) Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverDetector.swift:30— MenuBarPopoverDetector.candidates has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 6, ternaries 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PasteCommand.run (cognitive 35) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:68— PasteCommand.run has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (24 pts), ternaries 4 (8 pts), error handling 2, boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ApplicationService.requestVerifiedActivation (cognitive 35) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift:859— ApplicationService.requestVerifiedActivation has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (27 pts), boolean chains 4, loops 1 (2 pts), error handling 1, ternaries 1 (nesting depth added 18). Of this number, 32 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooAgentService.removingJSONComments (cognitive 35) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:490— PeekabooAgentService.removingJSONComments has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 3 (9 pts), boolean chains 4 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserMCPSessionManager.executeSequenceUnlocked (cognitive 35) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:796— BrowserMCPSessionManager.executeSequenceUnlocked has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (22 pts), error handling 3 (6 pts), boolean chains 3, match/switch 1 (3 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PressTool.execute (cognitive 35) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PressTool.swift:111— PressTool.execute has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 9 (10 pts), boolean chains 5, match/switch 2 (4 pts), ternaries 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationReceiptAuthority.prepareSessionCreationLocked (cognitive 35) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceipts.swift:506— PeekabooBridgeOperationReceiptAuthority.prepareSessionCreationLocked has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 11, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeServer.handleDesktopObservationRequest (cognitive 35) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+CaptureHandlers.swift:60— PeekabooBridgeServer.handleDesktopObservationRequest has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (22 pts), ternaries 3 (7 pts), boolean chains 5, match/switch 1 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
DesktopActionOutcome.validateDecoded (cognitive 35) Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionOutcome.swift:648— DesktopActionOutcome.validateDecoded has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 33, if/else 1, match/switch 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SeeCommand.run (cognitive 34) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand.swift:158— SeeCommand.run has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (25 pts), error handling 3 (4 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ApplicationService.performApplicationVisibilityMutation (cognitive 34) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+ActionOutcomes.swift:444— ApplicationService.performApplicationVisibilityMutation has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (23 pts), error handling 3 (4 pts), ternaries 3 (4 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClipboardPayloadBuilder.readFile (cognitive 34) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ClipboardPayloadBuilder.swift:126— ClipboardPayloadBuilder.readFile has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 8, ternaries 2 (5 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ActionInputDriver.observeMutation (cognitive 34) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:816— ActionInputDriver.observeMutation has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 9, error handling 2 (5 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DetachedExactWindowFocusReader.read (cognitive 34) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:308— DetachedExactWindowFocusReader.read has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 6, ternaries 2 (3 pts), loops 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DialogService.executeFileDialog (cognitive 34) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogs.swift:43— DialogService.executeFileDialog has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (29 pts), ternaries 1 (3 pts), boolean chains 1, error handling 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DialogService.targetedDialogCandidates (cognitive 34) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+PreparedActions.swift:279— DialogService.targetedDialogCandidates has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 6, loops 3 (6 pts), ternaries 3 (6 pts), match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DialogService.findDialogElement (cognitive 34) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Resolution.swift:145— DialogService.findDialogElement has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 4 (9 pts), boolean chains 5 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExactWindowHeldPointerLifecycle.runHold (cognitive 34) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ExactWindowHeldPointerLifecycle.swift:556— ExactWindowHeldPointerLifecycle.runHold has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (30 pts), boolean chains 3, error handling 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeDesktopObservationBinding.validateWindowEvidence (cognitive 34) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:612— PeekabooBridgeDesktopObservationBinding.validateWindowEvidence has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 15, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationReceiptSemantics.validateReceiptCarriage (cognitive 34) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:330— PeekabooBridgeOperationReceiptSemantics.validateReceiptCarriage has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 9, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeServer.init (cognitive 34) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:156— PeekabooBridgeServer.init has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (19 pts), boolean chains 14, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PeekabooBridgeServer.validateBrowserSessionRequest (cognitive 34) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserSessionHandoff.swift:1378— PeekabooBridgeServer.validateBrowserSessionRequest has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 11, match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ClickCommand.validate (cognitive 33) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand+Validation.swift:12— ClickCommand.validate has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 9 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClickService.resolveTargetElement (cognitive 33) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:744— ClickService.resolveTargetElement has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (31 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DetachedAXObservationWorker.inspect (cognitive 33) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:239— DetachedAXObservationWorker.inspect has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 13, if/else 9 (13 pts), ternaries 5 (6 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MCPToolContext.backgroundTargetAuthorization (cognitive 33) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:860— MCPToolContext.backgroundTargetAuthorization has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 11, error handling 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
AppToolActions.handleQuitAll (cognitive 33) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool+Lifecycle.swift:327— AppToolActions.handleQuitAll has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (21 pts), error handling 3 (6 pts), boolean chains 5, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MenuTool.handleClickAction (cognitive 33) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MenuTool.swift:194— MenuTool.handleClickAction has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 6 (18 pts), error handling 6 (10 pts), if/else 5 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeAgentExecutionPipeReader.read (cognitive 33) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:1106— PeekabooBridgeAgentExecutionPipeReader.read has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeClient.requireNegotiatedInputCapabilities (cognitive 33) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:198— PeekabooBridgeClient.requireNegotiatedInputCapabilities has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17, boolean chains 16. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PeekabooBridgeClient.verifyAttestedResponse (cognitive 33) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:1035— PeekabooBridgeClient.verifyAttestedResponse has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 14, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeHost.handleClient (cognitive 33) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost+Clients.swift:9— PeekabooBridgeHost.handleClient has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (24 pts), ternaries 2 (5 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationResultSemantics.browserResponseProgressMismatch (cognitive 33) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics+Browser.swift:15— PeekabooBridgeOperationResultSemantics.browserResponseProgressMismatch has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 19, if/else 11 (14 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
AutomationElementResolver.resolveScrollTarget (cognitive 32) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/AutomationElementResolver.swift:220— AutomationElementResolver.resolveScrollTarget has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 11, ternaries 2 (4 pts), loops 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WindowRoutedPointerDriver.scrollTrackingDispatch (cognitive 32) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowRoutedPointerDriver.swift:462— WindowRoutedPointerDriver.scrollTrackingDispatch has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 4, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooAgentService.runGenerationLoopBody (cognitive 32) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:552— PeekabooAgentService.runGenerationLoopBody has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (23 pts), match/switch 1 (3 pts), error handling 1 (2 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserMCPSessionManager.connectUnlockedWithOutcome (cognitive 32) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:389— BrowserMCPSessionManager.connectUnlockedWithOutcome has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 5, error handling 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnalyzeTool.languageModel (cognitive 32) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AnalyzeTool.swift:162— AnalyzeTool.languageModel has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 5, match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationReceiptBundle.validateIntegrity (cognitive 32) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:202— PeekabooBridgeOperationReceiptBundle.validateIntegrity has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 25, if/else 5 (6 pts), error handling 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
AgentCommand.runTauTUIChatLoop (cognitive 31) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+Chat.swift:179— AgentCommand.runTauTUIChatLoop has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (23 pts), error handling 4 (6 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PasteCommand.performClipboardPasteTransaction (cognitive 31) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:222— PasteCommand.performClipboardPasteTransaction has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (20 pts), error handling 8 (9 pts), boolean chains 2 (nesting depth added 7). Of this number, 30 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ScrollCommand.run (cognitive 31) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ScrollCommand.swift:43— ScrollCommand.run has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (20 pts), ternaries 2 (4 pts), boolean chains 3, match/switch 1 (3 pts), error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BridgeCapabilityPolicy.firstUnmetRemoteRequirement (cognitive 31) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:27— BridgeCapabilityPolicy.firstUnmetRemoteRequirement has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16, boolean chains 13, ternaries 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RuntimeHostResolver.resolveSnapshotAffinityOwner (cognitive 31) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+SnapshotAffinity.swift:110— RuntimeHostResolver.resolveSnapshotAffinityOwner has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (18 pts), loops 4, ternaries 3 (4 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ScreenCaptureWindowPlanExecutor.execute (cognitive 31) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitWindowPlanCache.swift:258— ScreenCaptureWindowPlanExecutor.execute has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (20 pts), error handling 3 (6 pts), match/switch 2 (4 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ApplicationService.performApplicationRelaunchWithOutcomeOwnedLane (cognitive 31) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift:482— ApplicationService.performApplicationRelaunchWithOutcomeOwnedLane has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (22 pts), error handling 3 (5 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ForegroundModifierClickExecutor.attemptClick (cognitive 31) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ForegroundModifierClickExecutor.swift:382— ForegroundModifierClickExecutor.attemptClick has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (17 pts), error handling 4 (12 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeLiveAgentExecutionRunner.runDetached (cognitive 31) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionRunner.swift:39— PeekabooBridgeLiveAgentExecutionRunner.runDetached has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 8, error handling 5 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeDesktopObservationBinding.validateApplicationEvidence (cognitive 31) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:507— PeekabooBridgeDesktopObservationBinding.validateApplicationEvidence has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 12, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeServer.allowedOperationsToAdvertise (cognitive 31) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handshake.swift:591— PeekabooBridgeServer.allowedOperationsToAdvertise has cognitive complexity 31 (threshold 15). Drivers by points: if/else 21 (22 pts), boolean chains 9 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DesktopActionSequenceAccumulator.successResolution (cognitive 31) Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionSequenceAccumulator.swift:332— DesktopActionSequenceAccumulator.successResolution has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 12, if/else 9 (12 pts), ternaries 2 (6 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentCommand.runLineChatLoop (cognitive 30) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+Chat.swift:91— AgentCommand.runLineChatLoop has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (19 pts), error handling 6 (10 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SeeCommand.requireBoundTreeOnlyEvidence (cognitive 30) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+DetectionPipeline.swift:206— SeeCommand.requireBoundTreeOnlyEvidence has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 24, if/else 5 (6 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CommanderCLIBinder.validateDialogBeforeRuntimeResolution (cognitive 30) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder+Dialogs.swift:25— CommanderCLIBinder.validateDialogBeforeRuntimeResolution has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 8, error handling 1 (nesting depth added 7). Of this number, 25 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FocusCommandUtilities.swift.ensureFocused (cognitive 30) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/FocusCommandUtilities.swift:236— FocusCommandUtilities.swift.ensureFocused has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (15 pts), match/switch 3 (6 pts), error handling 2 (5 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ApplicationService.readMutationInventory (cognitive 30) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Discovery.swift:49— ApplicationService.readMutationInventory has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 6, loops 1, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentToolArgumentValidator.validate (cognitive 30) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolArgumentValidation.swift:103— AgentToolArgumentValidator.validate has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 4, loops 1 (3 pts), match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
DialogTool.validatedDialogResultTarget (cognitive 30) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DialogTool.swift:568— DialogTool.validatedDialogResultTarget has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 10, error handling 3 (5 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AIProviderParser.determineDefaultModel (cognitive 30) Core/PeekabooCore/Sources/PeekabooAutomation/Utils/AIProviderParser.swift:83— AIProviderParser.determineDefaultModel has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (26 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeAgentExecutionPaths.validateAndPrepare (cognitive 30) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:57— PeekabooBridgeAgentExecutionPaths.validateAndPrepare has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 25, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeBrowserHandoffGrantRegistry.bootstrap (cognitive 30) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserSessionHandoff.swift:457— PeekabooBridgeBrowserHandoffGrantRegistry.bootstrap has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 6, error handling 1, match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeClient.handshakeCandidate (cognitive 30) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:877— PeekabooBridgeClient.handshakeCandidate has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 30. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperationResultSemantics.finalizeSuccessful (cognitive 30) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:1263— PeekabooBridgeOperationResultSemantics.finalizeSuccessful has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 5, ternaries 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentCommand.unavailableImplicitCustomModelToolCapabilityError (cognitive 29) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+ModelParsing.swift:156— AgentCommand.unavailableImplicitCustomModelToolCapabilityError has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 6, loops 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GitStalenessProbe.swift.runGitStalenessProbe (cognitive 29) Apps/CLI/Sources/PeekabooCLI/CLI/Utilities/GitStalenessProbe.swift:5— GitStalenessProbe.swift.runGitStalenessProbe has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (19 pts), ternaries 1 (4 pts), boolean chains 3, loops 1 (2 pts), error handling 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CertificationControllerBuildIdentityResolver.current (cognitive 29) Apps/CLI/Sources/PeekabooCertificationController/ControllerBuildIdentity.swift:38— CertificationControllerBuildIdentityResolver.current has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 24, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
HeldPointerCertificationPlan.validate (cognitive 29) Apps/CLI/Sources/PeekabooCertificationController/HeldPointerPlan.swift:63— HeldPointerCertificationPlan.validate has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 20, if/else 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CaptureArtifactIntegrityValidator.retainedRegularFile (cognitive 29) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureArtifactIntegrityValidator.swift:235— CaptureArtifactIntegrityValidator.retainedRegularFile has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 16, if/else 7 (12 pts), loops 1 (nesting depth added 5). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ScreenCaptureKitProcessCapabilityRegistry.removeStaleMarkers (cognitive 29) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureKitProcessCapabilityRegistry.swift:395— ScreenCaptureKitProcessCapabilityRegistry.removeStaleMarkers has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 7, error handling 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StableRegularFileReader.readStableRegularFile (cognitive 29) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/StableRegularFileReader.swift:51— StableRegularFileReader.readStableRegularFile has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 4, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClickService.performActionClick (cognitive 29) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:172— ClickService.performActionClick has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (21 pts), error handling 2 (5 pts), boolean chains 2, match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TypeService.resolveTargetElement (cognitive 29) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService+TargetResolution.swift:36— TypeService.resolveTargetElement has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TypeService.executePixelFocusType (cognitive 29) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:1254— TypeService.executePixelFocusType has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (18 pts), error handling 7, boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DragRequest.init (cognitive 29) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DragTool+Types.swift:19— DragRequest.init has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 7 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PasteTool.performClipboardPasteTransaction (cognitive 29) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:597— PasteTool.performClipboardPasteTransaction has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (19 pts), error handling 8 (9 pts), boolean chains 1 (nesting depth added 6). Of this number, 28 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TypeTool.focusIfNeeded (cognitive 29) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/TypeTool.swift:698— TypeTool.focusIfNeeded has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 5 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VerifyStateTool.sample (cognitive 29) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:148— VerifyStateTool.sample has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 4 (8 pts), error handling 1 (2 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
VerifyStateTool.resolveApplication (cognitive 29) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:418— VerifyStateTool.resolveApplication has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (17 pts), boolean chains 4, error handling 2 (4 pts), match/switch 2 (4 pts) (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
CredentialFile.updateCredentials (cognitive 29) Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/CredentialFile.swift:88— CredentialFile.updateCredentials has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 11, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeCertificationMonitorSealPayload.validate (cognitive 29) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationMonitorSealValidation.swift:4— PeekabooBridgeCertificationMonitorSealPayload.validate has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 23, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperation.compatible (cognitive 29) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeModels.swift:171— PeekabooBridgeOperation.compatible has cognitive complexity 29 (threshold 15). Drivers by points: if/else 29. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PeekabooBridgeSelectorResolutionBinding.observationMismatch (cognitive 29) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeSelectorResolutionBinding.swift:94— PeekabooBridgeSelectorResolutionBinding.observationMismatch has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 4, match/switch 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DesktopActionSequenceAccumulator.interruptedBatch (cognitive 29) Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopActionSequenceAccumulator.swift:229— DesktopActionSequenceAccumulator.interruptedBatch has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 7, ternaries 2 (5 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentCommand.runInternal (cognitive 28) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand.swift:238— AgentCommand.runInternal has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 5, error handling 2, match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DarwinProcessLoopbackListenerInspector.inspect (cognitive 28) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/DarwinProcessLoopbackListenerInspector.swift:104— DarwinProcessLoopbackListenerInspector.inspect has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DetachedAXWindowEnumerationWorker.enumerate (cognitive 28) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/DetachedAXWindowEnumerationWorker.swift:103— DetachedAXWindowEnumerationWorker.enumerate has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 11, loops 2, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DialogService.findDialogViaApplicationService (cognitive 28) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Visibility.swift:49— DialogService.findDialogViaApplicationService has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 8, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MenuService.getMenuBarItemsFromAppsAX (cognitive 28) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraAccessibility.swift:239— MenuService.getMenuBarItemsFromAppsAX has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 6, loops 3 (5 pts) (nesting depth added 12). Of this number, 24 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MenuService.makeMenuExtra (cognitive 28) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraWindows.swift:250— MenuService.makeMenuExtra has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 9, ternaries 4 (8 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WindowToolFormatter.formatListScreensResult (cognitive 28) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+WindowResults.swift:136— WindowToolFormatter.formatListScreensResult has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 5, ternaries 3 (5 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConfigurationManager.expandEnvironmentVariables (cognitive 28) Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+Parsing.swift:47— ConfigurationManager.expandEnvironmentVariables has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (22 pts), boolean chains 3, loops 1 (2 pts), error handling 1 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PeekabooBridgeCertificationObserverSemanticPayload.readback (cognitive 28) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationObserverSemanticPayload.swift:227— PeekabooBridgeCertificationObserverSemanticPayload.readback has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 24, error handling 2, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeClient.handshakeAuthentication (cognitive 28) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:1017— PeekabooBridgeClient.handshakeAuthentication has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 13, if/else 7 (11 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeClient.installHandshakeCandidate (cognitive 28) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:1251— PeekabooBridgeClient.installHandshakeCandidate has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 7 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeDesktopObservationBinding.validateScreenSemanticOwner (cognitive 28) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:572— PeekabooBridgeDesktopObservationBinding.validateScreenSemanticOwner has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 14, if/else 9 (13 pts), error handling 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeServer.handleHeldPointerRequest (cognitive 28) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+HeldPointer.swift:30— PeekabooBridgeServer.handleHeldPointerRequest has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 6, error handling 2 (4 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooServices.refreshAgentService (cognitive 28) Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+Agent.swift:10— PeekabooServices.refreshAgentService has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 15, if/else 8 (11 pts), error handling 1 (2 pts) (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
TypeCommand.validate (cognitive 27) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/TypeCommand.swift:267— TypeCommand.validate has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 6 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MoveWindowSubcommand.run (cognitive 27) Apps/CLI/Sources/PeekabooCLI/Commands/System/SpaceCommand+MoveWindow.swift:69— MoveWindowSubcommand.run has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (20 pts), error handling 2 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DaemonLaunchPolicy.launchDaemon (cognitive 27) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/DaemonLaunchPolicy+Launch.swift:101— DaemonLaunchPolicy.launchDaemon has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (21 pts), error handling 3 (5 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClickService.executeClick (cognitive 27) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:1368— ClickService.executeClick has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (17 pts), error handling 4 (6 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooAgentService.balancedJSONFragments (cognitive 27) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:444— PeekabooAgentService.balancedJSONFragments has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 4, ternaries 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooAgentService.handleToolCalls (cognitive 27) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:810— PeekabooAgentService.handleToolCalls has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 3 (7 pts), loops 2 (4 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserMCPService.transferConnection (cognitive 27) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPService.swift:567— BrowserMCPService.transferConnection has cognitive complexity 27 (threshold 15). Drivers by points: error handling 6 (12 pts), if/else 5 (10 pts), boolean chains 4, match/switch 1 (nesting depth added 11). Of this number, 25 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PasteTool.execute (cognitive 27) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:145— PasteTool.execute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 7 (10 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VerifyStateTool.finalScreenshot (cognitive 27) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Response.swift:106— VerifyStateTool.finalScreenshot has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 3, error handling 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MenuSystemToolFormatter.formatListMenuItemsResult (cognitive 27) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter+Menu.swift:58— MenuSystemToolFormatter.formatListMenuItemsResult has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 4 (9 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SystemToolFormatter.formatCompactSummary (cognitive 27) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/SystemToolFormatter.swift:11— SystemToolFormatter.formatCompactSummary has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (19 pts), ternaries 2 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WindowToolFormatter.formatCompactSummary (cognitive 27) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter.swift:11— WindowToolFormatter.formatCompactSummary has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 2, ternaries 1 (2 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PeekabooBridgeOperationReceiptSemantics.validateSelectedLeafEvidence (cognitive 27) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:435— PeekabooBridgeOperationReceiptSemantics.validateSelectedLeafEvidence has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 5, loops 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeServer.windowMutationResponse (cognitive 27) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+MutationProof.swift:83— PeekabooBridgeServer.windowMutationResponse has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 8, error handling 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooSettings.updateConfigFile (cognitive 27) Apps/Mac/Peekaboo/Core/Settings.swift:796— PeekabooSettings.updateConfigFile has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 1 (3 pts), boolean chains 2, error handling 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SeeCommand.validateTarget (cognitive 26) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand.swift:475— SeeCommand.validateTarget has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 13, if/else 6 (12 pts), match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
BridgeDiagnostics.report (cognitive 26) Apps/CLI/Sources/PeekabooCLI/Commands/Core/BridgeCommand+Diagnostics.swift:70— BridgeDiagnostics.report has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (17 pts), ternaries 1 (3 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LiveForegroundSemanticObserver.connect (cognitive 26) Apps/CLI/Sources/PeekabooCertificationController/ForegroundSemanticObserver.swift:36— LiveForegroundSemanticObserver.connect has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 24, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
LiveCertificationBridge.connect (cognitive 26) Apps/CLI/Sources/PeekabooCertificationController/LiveCertificationBridge.swift:81— LiveCertificationBridge.connect has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 19, if/else 7. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ElementValueMutationSemantics.exactDecimalInteger (cognitive 26) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementValueVerification.swift:266— ElementValueMutationSemantics.exactDecimalInteger has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 5, ternaries 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PinnedWindowGeometrySequence.swift.completePinnedWindowGeometry (cognitive 26) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/PinnedWindowGeometrySequence.swift:97— PinnedWindowGeometrySequence.swift.completePinnedWindowGeometry has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 3, match/switch 1 (3 pts), loops 1 (2 pts), error handling 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentToolMCPBridge.providerContextMessages (cognitive 26) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolMCPBridge+ProviderContext.swift:7— AgentToolMCPBridge.providerContextMessages has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 14, if/else 3 (6 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 6). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ToolEventSummary.toMetaValue (cognitive 26) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolEventSummary.swift:81— ToolEventSummary.toMetaValue has cognitive complexity 26 (threshold 15). Drivers by points: if/else 23 (26 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
CredentialFile.readCredentialSnapshot (cognitive 26) Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/CredentialFile.swift:40— CredentialFile.readCredentialSnapshot has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 4, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeAgentExecutionExecutable.stableExecutableSHA256 (cognitive 26) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:734— PeekabooBridgeAgentExecutionExecutable.stableExecutableSHA256 has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 17, if/else 7 (8 pts), loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeAgentExecutionAcknowledgementReader.stableRead (cognitive 26) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:1224— PeekabooBridgeAgentExecutionAcknowledgementReader.stableRead has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 17, if/else 7 (8 pts), loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeServer.handleExactWindowTargetedHotkey (cognitive 26) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:691— PeekabooBridgeServer.handleExactWindowTargetedHotkey has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 5 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooServices.determineDefaultModelWithConflict (cognitive 26) Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+Agent.swift:211— PeekabooServices.determineDefaultModelWithConflict has cognitive complexity 26 (threshold 15). Drivers by points: if/else 19, boolean chains 6, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MenuBarClickVerifier.waitForPopoverResolution (cognitive 25) Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarClickVerifier.swift:280— MenuBarClickVerifier.waitForPopoverResolution has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 4 (8 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserCommand.arguments (cognitive 25) Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserCommand.swift:243— BrowserCommand.arguments has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
RuntimeMCPToolSnapshotMutationCoordinator.completeMutation (cognitive 25) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationInvalidator.swift:745— RuntimeMCPToolSnapshotMutationCoordinator.completeMutation has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 15, if/else 5 (6 pts), ternaries 3 (4 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DaemonControlClient.stopAndWait (cognitive 25) Apps/CLI/Sources/PeekabooCLI/Commands/System/DaemonCommand.swift:120— DaemonControlClient.stopAndWait has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 3 (5 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AXTreeCollector.textualDescendants (cognitive 25) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/AXTreeCollector.swift:251— AXTreeCollector.textualDescendants has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 5, loops 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ClickService.validateSnapshotTarget (cognitive 25) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:447— ClickService.validateSnapshotTarget has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 7, error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
DialogService.discoveryTree (cognitive 25) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Discovery.swift:136— DialogService.discoveryTree has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 4, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DialogService.executeBackgroundDialogInput (cognitive 25) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:137— DialogService.executeBackgroundDialogInput has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 5, error handling 3 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MenuService.getMenuBarItemsFromControlCenterAX (cognitive 25) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraAccessibility.swift:13— MenuService.getMenuBarItemsFromControlCenterAX has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 11). Of this number, 21 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TextInputRoute.resolve (cognitive 25) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TextInputRoute.swift:57— TextInputRoute.resolve has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 12, if/else 6 (12 pts), loops 1 (nesting depth added 6). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
UIAutomationService.requireExactWindowKeyboardFocus (cognitive 25) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementLookup.swift:75— UIAutomationService.requireExactWindowKeyboardFocus has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (6 pts), ternaries 2 (5 pts), match/switch 1 (3 pts), error handling 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentExecutionTraceSanitizer.sanitizeArgument (cognitive 25) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentExecutionTrace.swift:689— AgentExecutionTraceSanitizer.sanitizeArgument has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17 (25 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentToolArgumentValidator.validate (cognitive 25) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolArgumentValidation.swift:152— AgentToolArgumentValidator.validate has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 1 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
AgentToolMCPBridge.observationProviderValue (cognitive 25) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolMCPBridge+ProviderContext.swift:62— AgentToolMCPBridge.observationProviderValue has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 15, if/else 7 (9 pts), match/switch 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BrowserTool.executeCapabilityBound (cognitive 25) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:366— BrowserTool.executeCapabilityBound has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (15 pts), error handling 4 (6 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DialogTool.perform (cognitive 25) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DialogTool.swift:226— DialogTool.perform has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (22 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
SelectTextTool.execute (cognitive 25) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SelectTextTool.swift:35— SelectTextTool.execute has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 6, error handling 2, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VisionToolFormatter.extractElementSummary (cognitive 25) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/VisionToolFormatter.swift:276— VisionToolFormatter.extractElementSummary has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, loops 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeBrowserHandoffGrantRegistry.endSession (cognitive 25) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserSessionHandoff.swift:823— PeekabooBridgeBrowserHandoffGrantRegistry.endSession has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 5, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeCertificationCrashInventoryPairPayload.validate (cognitive 25) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationCrashInventoryPayload.swift:255— PeekabooBridgeCertificationCrashInventoryPairPayload.validate has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 22, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeClient.validateReceiptlessProjectedTarget (cognitive 25) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:781— PeekabooBridgeClient.validateReceiptlessProjectedTarget has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 10, match/switch 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationReceiptSemantics.validatePostMutationWindow (cognitive 25) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:1226— PeekabooBridgeOperationReceiptSemantics.validatePostMutationWindow has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 15, if/else 8 (9 pts), match/switch 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SeeCommand.observationTargetForCaptureWithDetectionIfPossible (cognitive 24) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+ObservationRequest.swift:26— SeeCommand.observationTargetForCaptureWithDetectionIfPossible has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DragCommand.validateInputs (cognitive 24) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand.swift:264— DragCommand.validateInputs has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 9 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MenuBarActionCommand.resolveClickTarget (cognitive 24) Apps/CLI/Sources/PeekabooCLI/Commands/System/MenuBarCommand.swift:276— MenuBarActionCommand.resolveClickTarget has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 11, if/else 7 (10 pts), error handling 2 (3 pts) (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BuildStalenessChecker.swift.parseGitStatusOutput (cognitive 24) Apps/CLI/Sources/PeekabooCLI/CLI/Utilities/BuildStalenessChecker.swift:181— BuildStalenessChecker.swift.parseGitStatusOutput has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 5, ternaries 1 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WindowCommand+GeometryVerification.swift.evaluateWindowGeometryOutcome (cognitive 24) Apps/CLI/Sources/PeekabooCLI/Commands/System/WindowCommand+GeometryVerification.swift:52— WindowCommand+GeometryVerification.swift.evaluateWindowGeometryOutcome has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 7 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HeldPointerCertificationRunner.validateHandshake (cognitive 24) Apps/CLI/Sources/PeekabooCertificationController/HeldPointerRunner.swift:577— HeldPointerCertificationRunner.validateHandshake has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 23, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CertificationPrivateArtifacts.readOwnerPrivateFile (cognitive 24) Apps/CLI/Sources/PeekabooCertificationController/PrivateArtifacts.swift:12— CertificationPrivateArtifacts.readOwnerPrivateFile has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 14, if/else 8 (9 pts), loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SpaceWindowMutationDispatcher.moveWindow (cognitive 24) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceWindowMutationDispatcher.swift:30— SpaceWindowMutationDispatcher.moveWindow has cognitive complexity 24 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DesktopObservationROIProcessor.apply (cognitive 24) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationROI.swift:115— DesktopObservationROIProcessor.apply has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 15, if/else 7, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DesktopObservationROIProcessor.validateApplied (cognitive 24) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationROI.swift:219— DesktopObservationROIProcessor.validateApplied has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 22, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ActionInputDriver.performPageScrollActions (cognitive 24) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:996— ActionInputDriver.performPageScrollActions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (18 pts), error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ElementDetectionResultBuilder.makeResult (cognitive 24) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementDetectionResultBuilder.swift:6— ElementDetectionResultBuilder.makeResult has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, if/else 9, ternaries 2 (3 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MenuService.makeMenuExtraDisplayName (cognitive 24) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraSupport.swift:36— MenuService.makeMenuExtraDisplayName has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 7, match/switch 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserMCPSessionManager.inspectStatusUnlocked (cognitive 24) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:234— BrowserMCPSessionManager.inspectStatusUnlocked has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 3 (4 pts), error handling 3, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserToolCapabilityProjection.balancedJSONEnd (cognitive 24) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserToolCapabilityProjection.swift:508— BrowserToolCapabilityProjection.balancedJSONEnd has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MCPToolContext.completeMutation (cognitive 24) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:1118— MCPToolContext.completeMutation has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 5 (8 pts), boolean chains 7, if/else 6 (7 pts), error handling 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserTool.execute (cognitive 24) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:191— BrowserTool.execute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (11 pts), error handling 9, boolean chains 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
InspectUITool.execute (cognitive 24) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool.swift:79— InspectUITool.execute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 3, error handling 2, ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TypeTool.performOrdinaryType (cognitive 24) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/TypeTool.swift:304— TypeTool.performOrdinaryType has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (19 pts), error handling 5 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WindowToolFormatter.formatListSpacesResult (cognitive 24) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+SpaceResults.swift:7— WindowToolFormatter.formatListSpacesResult has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (19 pts), ternaries 3 (5 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeAgentExecutionPaths.provisionOperationReceiptDirectoryBeforeRelease (cognitive 24) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:135— PeekabooBridgeAgentExecutionPaths.provisionOperationReceiptDirectoryBeforeRelease has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 14, if/else 6 (9 pts), error handling 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeAgentExecutionOutputExtractor.convert (cognitive 24) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:1384— PeekabooBridgeAgentExecutionOutputExtractor.convert has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeHost.makeListeningSocket (cognitive 24) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift:759— PeekabooBridgeHost.makeListeningSocket has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 5, loops 1 (3 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationReceiptSemantics.validateResponseOutcomeConsistency (cognitive 24) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:1411— PeekabooBridgeOperationReceiptSemantics.validateResponseOutcomeConsistency has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 7 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationReceiptAuthority.commitSessionCreation (cognitive 24) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceipts.swift:736— PeekabooBridgeOperationReceiptAuthority.commitSessionCreation has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 13, if/else 8 (11 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeServer.handleAuthorized (cognitive 24) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:9— PeekabooBridgeServer.handleAuthorized has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 3, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
SessionTitleGenerator.selectModel (cognitive 24) Apps/Mac/Peekaboo/Services/SessionTitleGenerator.swift:98— SessionTitleGenerator.selectModel has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 13, if/else 9, match/switch 1 (2 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
AgentCommand.supportedParsedModel (cognitive 23) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+ModelParsing.swift:58— AgentCommand.supportedParsedModel has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 3 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
SeeCommand.outputTextResults (cognitive 23) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+Output.swift:164— SeeCommand.outputTextResults has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (14 pts), ternaries 3 (5 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
VerifyCommand.run (cognitive 23) Apps/CLI/Sources/PeekabooCLI/Commands/AI/VerifyCommand.swift:40— VerifyCommand.run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 1 (3 pts), error handling 2, match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CommanderCLIBinder.requiresSilentCapture (cognitive 23) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:394— CommanderCLIBinder.requiresSilentCapture has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 15, if/else 8. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
LiveForegroundSemanticObserver.readSemanticValue (cognitive 23) Apps/CLI/Sources/PeekabooCertificationController/ForegroundSemanticObserver.swift:85— LiveForegroundSemanticObserver.readSemanticValue has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 18, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SelectorResolutionProof.applicationMismatch (cognitive 23) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationSelectorResolutionProof.swift:86— SelectorResolutionProof.applicationMismatch has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 13, if/else 9, match/switch 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BoundedArtifactFile.read (cognitive 23) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/BoundedArtifactFile.swift:60— BoundedArtifactFile.read has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4, ternaries 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DetachedAXObservationWorker.process (cognitive 23) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:533— DetachedAXObservationWorker.process has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17, boolean chains 4, match/switch 1, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PeekabooAgentService.resolveRemoteBrowserOpeningForEnd (cognitive 23) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Tools.swift:452— PeekabooAgentService.resolveRemoteBrowserOpeningForEnd has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (19 pts), error handling 2 (3 pts), match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserMCPUploadStager.copy (cognitive 23) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPUploadStager.swift:295— BrowserMCPUploadStager.copy has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserToolCapabilityProjection.containsUnmappedIssueResourceUID (cognitive 23) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserToolCapabilityProjection.swift:243— BrowserToolCapabilityProjection.containsUnmappedIssueResourceUID has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (6 pts), boolean chains 4, match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MCPToolArgumentValidator.validateClosedProperties (cognitive 23) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolArgumentValidation.swift:113— MCPToolArgumentValidator.validateClosedProperties has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4 (7 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PressTool.dispatchSequence (cognitive 23) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PressTool.swift:256— PressTool.dispatchSequence has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (5 pts), boolean chains 3, error handling 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VerifyStateTool.resolveExactWindowFromCompleteInventory (cognitive 23) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:343— VerifyStateTool.resolveExactWindowFromCompleteInventory has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 3 (6 pts), ternaries 1 (3 pts), error handling 2, boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MenuSystemToolFormatter.formatCompactSummary (cognitive 23) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter.swift:11— MenuSystemToolFormatter.formatCompactSummary has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PeekabooAIService.resolveAvailableModels (cognitive 23) Core/PeekabooCore/Sources/PeekabooAutomation/Services/AI/PeekabooAIService.swift:511— PeekabooAIService.resolveAvailableModels has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PeekabooBridgeClient.unwrapResponse (cognitive 23) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Transport.swift:653— PeekabooBridgeClient.unwrapResponse has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeHost.peerInfoIfAllowed (cognitive 23) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost+Clients.swift:238— PeekabooBridgeHost.peerInfoIfAllowed has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 7 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationReceiptSemantics.validateFailureResponseSemantics (cognitive 23) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:801— PeekabooBridgeOperationReceiptSemantics.validateFailureResponseSemantics has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 13, if/else 7 (10 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperationReceiptAuthority.retireDeadClientSessions (cognitive 23) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceipts.swift:985— PeekabooBridgeOperationReceiptAuthority.retireDeadClientSessions has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 13, if/else 5 (9 pts), loops 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeServer.performAttestedOperation (cognitive 23) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+OperationReceipts.swift:59— PeekabooBridgeServer.performAttestedOperation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, error handling 3, match/switch 2 (3 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
KeyboardView.body (cognitive 23) Apps/Playground/Playground/Views/KeyboardView.swift:13— KeyboardView.body has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (18 pts), ternaries 4 (5 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
MenuBarPopoverResolver.resolve (cognitive 22) Apps/CLI/Sources/PeekabooCLI/Helpers/MenuBarPopoverResolver.swift:71— MenuBarPopoverResolver.resolve has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InteractionObservationInvalidator.invalidateLatestSnapshotsAcrossKnownHosts (cognitive 22) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationInvalidator.swift:325— InteractionObservationInvalidator.invalidateLatestSnapshotsAcrossKnownHosts has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, error handling 1 (2 pts), loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CleanCommand.run (cognitive 22) Apps/CLI/Sources/PeekabooCLI/Commands/System/CleanCommand.swift:59— CleanCommand.run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (19 pts), error handling 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CertificationCodeIdentityPlan.validate (cognitive 22) Apps/CLI/Sources/PeekabooCertificationController/CodeIdentityRunner.swift:71— CertificationCodeIdentityPlan.validate has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 16, if/else 3 (5 pts), match/switch 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DetectionTruncationInfo.remediationMessage (cognitive 22) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationRequestModels.swift:185— DetectionTruncationInfo.remediationMessage has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (9 pts), match/switch 4 (8 pts), ternaries 3 (5 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
DesktopObservationService.validateCaptureReceipt (cognitive 22) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService+Capture.swift:154— DesktopObservationService.validateCaptureReceipt has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 19, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BackgroundInputDriver.click (cognitive 22) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1569— BackgroundInputDriver.click has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 8 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
DetachedAXObservationWorker.attachingFocusedTextSelection (cognitive 22) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker+TextSelection.swift:34— DetachedAXObservationWorker.attachingFocusedTextSelection has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 16, if/else 4, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DialogService.updateFilename (cognitive 22) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogFilename.swift:52— DialogService.updateFilename has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExactWindowHeldPointerLifecycle.drag (cognitive 22) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ExactWindowHeldPointerLifecycle.swift:427— ExactWindowHeldPointerLifecycle.drag has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 1 (4 pts), error handling 2 (3 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooAgentService.executeToolCall (cognitive 22) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:1056— PeekabooAgentService.executeToolCall has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 1 (2 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooAgentService.remoteBrowserClient (cognitive 22) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Tools.swift:97— PeekabooAgentService.remoteBrowserClient has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ToolEventSummary.shortDescription (cognitive 22) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolEventSummary.swift:204— ToolEventSummary.shortDescription has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserTool.statusMetaFields (cognitive 22) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:770— BrowserTool.statusMetaFields has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (18 pts), ternaries 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VisionToolFormatter.formatCompactSummary (cognitive 22) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/VisionToolFormatter.swift:26— VisionToolFormatter.formatCompactSummary has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 3, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ConfigurationManager.validate (cognitive 22) Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:107— ConfigurationManager.validate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeDesktopObservationBinding.validateDisplayEvidence (cognitive 22) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:672— PeekabooBridgeDesktopObservationBinding.validateDisplayEvidence has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 1, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PeekabooBridgeHost.readLeaseMarker (cognitive 22) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift:1167— PeekabooBridgeHost.readLeaseMarker has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 2, loops 2, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationSessionRefusal.validate (cognitive 22) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationAttestationModels.swift:622— PeekabooBridgeOperationSessionRefusal.validate has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 18, if/else 3, error handling 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
TypeActionResultRule.init (cognitive 22) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultContracts.swift:204— TypeActionResultRule.init has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TypedResponseRule.isConsistent (cognitive 22) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultContracts.swift:406— TypedResponseRule.isConsistent has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (21 pts), match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PeekabooBridgeServer.handleBrowserConnect (cognitive 22) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+BrowserConnect.swift:27— PeekabooBridgeServer.handleBrowserConnect has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooSettings.hasValidAPIKey (cognitive 22) Apps/Mac/Peekaboo/Core/Settings.swift:351— PeekabooSettings.hasValidAPIKey has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 17, if/else 3 (4 pts), match/switch 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SeeCommand.prepareResult (cognitive 21) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand.swift:549— SeeCommand.prepareResult has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 5, ternaries 1 (2 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BridgeReceiptVerifier.readPrivateBundle (cognitive 21) Apps/CLI/Sources/PeekabooCLI/Commands/Core/BridgeCommand+Receipt.swift:354— BridgeReceiptVerifier.readPrivateBundle has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 14, if/else 5, match/switch 1 (2 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CaptureActionManifestWriter.write (cognitive 21) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:668— CaptureActionManifestWriter.write has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 5, error handling 2, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BridgeCapabilityPolicy.firstUnmetObservationRequirement (cognitive 21) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:158— BridgeCapabilityPolicy.firstUnmetObservationRequirement has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, if/else 9, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
UIAutomationActionResultSequenceAccumulator.recordTargetMetadata (cognitive 21) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/UIAutomationActionResultSequenceAccumulator.swift:283— UIAutomationActionResultSequenceAccumulator.recordTargetMetadata has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (9 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ApplicationService.listApplications (cognitive 21) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Discovery.swift:155— ApplicationService.listApplications has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 5 (6 pts), boolean chains 3, loops 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ApplicationService.requestApplicationVisibility (cognitive 21) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift:1134— ApplicationService.requestApplicationVisibility has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, error handling 3, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ActionInputDriver.performScrollbarActions (cognitive 21) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ActionInputDriver.swift:1064— ActionInputDriver.performScrollbarActions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (15 pts), error handling 1 (3 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DialogService.visitFileDialogTree (cognitive 21) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogTraversal.swift:13— DialogService.visitFileDialogTree has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExactWindowDragRequest.validate (cognitive 21) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ExactWindowDrag.swift:42— ExactWindowDragRequest.validate has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 20, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MCPToolArgumentValidator.discriminatorMatches (cognitive 21) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolArgumentValidation.swift:183— MCPToolArgumentValidator.discriminatorMatches has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ToolFiltering.apply (cognitive 21) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Support/ToolFiltering.swift:114— ToolFiltering.apply has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 1 (4 pts), ternaries 1 (4 pts) (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ToolResultExtractor.extractCoordinate (cognitive 21) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolResultExtractor.swift:265— ToolResultExtractor.extractCoordinate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserTool.formatStatus (cognitive 21) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:711— BrowserTool.formatStatus has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, ternaries 2 (3 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
SystemToolFormatter.formatError (cognitive 21) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/SystemToolFormatter.swift:403— SystemToolFormatter.formatError has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, ternaries 1 (3 pts), match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
VisionToolFormatter.formatWindowCaptureResult (cognitive 21) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/VisionToolFormatter.swift:166— VisionToolFormatter.formatWindowCaptureResult has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, ternaries 1 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeCodeSignatureIdentity.authenticatedCurrentProcessSigningInformation (cognitive 21) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCodeSignatureIdentity.swift:64— PeekabooBridgeCodeSignatureIdentity.authenticatedCurrentProcessSigningInformation has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 18, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeDesktopObservationBinding.validateDetectionOptions (cognitive 21) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:355— PeekabooBridgeDesktopObservationBinding.validateDetectionOptions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 5, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PeekabooBridgeHost.publishSocket (cognitive 21) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift:924— PeekabooBridgeHost.publishSocket has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationReceiptSemantics.validateDesktopObservationSetupResult (cognitive 21) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:1131— PeekabooBridgeOperationReceiptSemantics.validateDesktopObservationSetupResult has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 12, if/else 5 (7 pts), ternaries 1 (2 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeRequestPlan.validateBoundTypedResponse (cognitive 21) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultContracts.swift:695— PeekabooBridgeRequestPlan.validateBoundTypedResponse has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 8, match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
AgentExecutionReleaseGate.wait (cognitive 20) Apps/CLI/Sources/PeekabooCLI/AgentExecutionReleaseGate.swift:108— AgentExecutionReleaseGate.wait has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ErrorHandlingCommand.handleError (cognitive 20) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandErrorHandling.swift:36— ErrorHandlingCommand.handleError has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 3 (6 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CaptureActionCommand.createPublicationProbeDirectory (cognitive 20) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:733— CaptureActionCommand.createPublicationProbeDirectory has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LearnCommand.appendCommanderSummary (cognitive 20) Apps/CLI/Sources/PeekabooCLI/Commands/Core/LearnCommand.swift:196— LearnCommand.appendCommanderSummary has cognitive complexity 20 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 3 (6 pts), ternaries 1 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClickCommand.performClick (cognitive 20) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:638— ClickCommand.performClick has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ScrollCommand.validateDeliveryMode (cognitive 20) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ScrollCommand.swift:334— ScrollCommand.validateDeliveryMode has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InteractionCoordinateResolver.resolveBackgroundSnapshotCoordinates (cognitive 20) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionCoordinateResolver.swift:16— InteractionCoordinateResolver.resolveBackgroundSnapshotCoordinates has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 8, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
RuntimeHostResolver.resolveServices (cognitive 20) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver.swift:22— RuntimeHostResolver.resolveServices has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
RuntimeHostResolver.evaluateRemoteCandidate (cognitive 20) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+Resolution.swift:233— RuntimeHostResolver.evaluateRemoteCandidate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 9 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RuntimeHostResolver.firstScreenCaptureKitOwnerUnawareHost (cognitive 20) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+ScreenCaptureKitOwner.swift:615— RuntimeHostResolver.firstScreenCaptureKitOwnerUnawareHost has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LiveCertificationBridge.execute (cognitive 20) Apps/CLI/Sources/PeekabooCertificationController/LiveCertificationBridge.swift:179— LiveCertificationBridge.execute has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 13, if/else 7. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
VideoWriter.createStagingDirectory (cognitive 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/VideoWriter.swift:364— VideoWriter.createStagingDirectory has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DesktopObservationROIProcessor.exactReceiptMatches (cognitive 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationROI.swift:270— DesktopObservationROIProcessor.exactReceiptMatches has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 19, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ObservationMenuBarWindowCatalog.bandCandidates (cognitive 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarWindowCatalog.swift:70— ObservationMenuBarWindowCatalog.bandCandidates has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ObservationTargetResolver.resolveApplication (cognitive 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationTargetResolver.swift:139— ObservationTargetResolver.resolveApplication has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InMemorySnapshotManager.invalidateImplicitLatestSnapshot (cognitive 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+Lifecycle.swift:151— InMemorySnapshotManager.invalidateImplicitLatestSnapshot has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 15, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SelectorResolutionProof.windowMismatch (cognitive 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/WindowSelectorResolutionProof.swift:142— SelectorResolutionProof.windowMismatch has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 13, if/else 7. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ApplicationService.prepareApplicationLaunch (cognitive 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift:30— ApplicationService.prepareApplicationLaunch has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 9, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ClipboardService.set (cognitive 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ClipboardService.swift:461— ClipboardService.set has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DialogService.resolveButton (cognitive 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ButtonActions.swift:68— DialogService.resolveButton has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 8 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UIAutomationService.findElement (cognitive 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementLookup.swift:238— UIAutomationService.findElement has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BoundedBackgroundWindowAX.setGeometryValue (cognitive 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:1341— BoundedBackgroundWindowAX.setGeometryValue has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 16, if/else 3, match/switch 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WindowRoutedPointerDriver.click (cognitive 20) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowRoutedPointerDriver.swift:149— WindowRoutedPointerDriver.click has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 7, if/else 6 (7 pts), error handling 3 (5 pts), loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooAgentService.reasoningMetadata (cognitive 20) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:689— PeekabooAgentService.reasoningMetadata has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
MCPToolContext.backgroundApplicationTargetAuthorization (cognitive 20) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:1013— MCPToolContext.backgroundApplicationTargetAuthorization has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, error handling 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentSystemPrompt.interactionSection (cognitive 20) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/Tools/AgentSystemPrompt.swift:263— AgentSystemPrompt.interactionSection has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, ternaries 4 (8 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PasteTool.dispatchPasteHotkey (cognitive 20) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:512— PasteTool.dispatchPasteHotkey has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VerifyStateRequest.init (cognitive 20) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Types.swift:73— VerifyStateRequest.init has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 2, match/switch 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WindowTool.execute (cognitive 20) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool.swift:110— WindowTool.execute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 6 (8 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooAIService.parseHostedProviderEntry (cognitive 20) Core/PeekabooCore/Sources/PeekabooAutomation/Services/AI/PeekabooAIService.swift:423— PeekabooAIService.parseHostedProviderEntry has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (19 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PeekabooBridgeCertificationCrashInventoryPairPayload.validate (cognitive 20) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationCrashInventoryPayload.swift:291— PeekabooBridgeCertificationCrashInventoryPairPayload.validate has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 18, if/else 1, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeClient.receiptBoundBrowserRequest (cognitive 20) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Browser.swift:369— PeekabooBridgeClient.receiptBoundBrowserRequest has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (9 pts), ternaries 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeConnectedHostTrust.validate (cognitive 20) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeConnectedHostTrust.swift:4— PeekabooBridgeConnectedHostTrust.validate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationReceiptSemantics.validateInvalidRequestCarriageRefusal (cognitive 20) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:405— PeekabooBridgeOperationReceiptSemantics.validateInvalidRequestCarriageRefusal has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 19, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgePrivateReceiptArchive.writeAtomically (cognitive 20) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgePrivateReceiptArchive.swift:65— PeekabooBridgePrivateReceiptArchive.writeAtomically has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), error handling 2, loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeServer.updateSnapshotAndElementCapabilities (cognitive 20) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:1432— PeekabooBridgeServer.updateSnapshotAndElementCapabilities has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 12, if/else 8. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeWindowContextBinding.applicationScopedFallbackRefines (cognitive 20) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeWindowContextBinding.swift:58— PeekabooBridgeWindowContextBinding.applicationScopedFallbackRefines has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 19, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CommanderMigrationAdvisor.optionError (cognitive 19) Apps/CLI/Sources/PeekabooCLI/CLI/CommanderMigrationAdvisor.swift:122— CommanderMigrationAdvisor.optionError has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentCommand.performChatTurn (cognitive 19) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+Chat.swift:381— AgentCommand.performChatTurn has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), error handling 3 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SeeCommand.performScreenCapture (cognitive 19) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+Screens.swift:7— SeeCommand.performScreenCapture has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, ternaries 2 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CommanderCLIBinder.applyRuntimeTransportOptions (cognitive 19) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:212— CommanderCLIBinder.applyRuntimeTransportOptions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 7 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ProviderStatusReporter.envSource (cognitive 19) Apps/CLI/Sources/PeekabooCLI/Commands/Core/ConfigCommand+Status.swift:111— ProviderStatusReporter.envSource has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 5, loops 1 (2 pts), match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PasteCommand.withInteractionMutationInvalidation (cognitive 19) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:912— PasteCommand.withInteractionMutationInvalidation has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 13, if/else 2 (5 pts), error handling 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
RuntimeHostResolver.resolveExplicitAutomaticClassicCapture (cognitive 19) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+ScreenCaptureKitOwner.swift:417— RuntimeHostResolver.resolveExplicitAutomaticClassicCapture has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 17, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ClipboardCommand+Commander.swift.verifyClipboardWriteIfNeeded (cognitive 19) Apps/CLI/Sources/PeekabooCLI/Commands/System/ClipboardCommand+Commander.swift:465— ClipboardCommand+Commander.swift.verifyClipboardWriteIfNeeded has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CaptureArtifactIntegrityValidator.validatePNG (cognitive 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureArtifactIntegrityValidator.swift:189— CaptureArtifactIntegrityValidator.validatePNG has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 15, if/else 4. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
VideoWriter.abortAndRemovePartialOutput (cognitive 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/VideoWriter.swift:255— VideoWriter.abortAndRemovePartialOutput has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, error handling 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SmartLabelPlacer.findBestLabelPosition (cognitive 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationLabelPlacer.swift:52— SmartLabelPlacer.findBestLabelPosition has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (19 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InMemorySnapshotManager.detectionResult (cognitive 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:81— InMemorySnapshotManager.detectionResult has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PendingSnapshotCleanupPolicy.shouldPreserveReservation (cognitive 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/PendingSnapshotCleanupPolicy.swift:18— PendingSnapshotCleanupPolicy.shouldPreserveReservation has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 3 (6 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SnapshotManager.getDetectionResult (cognitive 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager.swift:159— SnapshotManager.getDetectionResult has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ApplicationService.performApplicationLaunchWithOutcomeOwnedLane (cognitive 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift:81— ApplicationService.performApplicationLaunchWithOutcomeOwnedLane has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 pts), error handling 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AutomationElementResolver.application (cognitive 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/AutomationElementResolver.swift:386— AutomationElementResolver.application has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 8, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BackgroundWindowActivationDriver.prepare (cognitive 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundWindowActivationDriver.swift:18— BackgroundWindowActivationDriver.prepare has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 15, if/else 4. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ElementDetectionService.inspectReadOnlyElements (cognitive 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementDetectionService.swift:330— ElementDetectionService.inspectReadOnlyElements has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 7, boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MenuExtraAXReader.attributeValue (cognitive 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuExtraAXReader.swift:284— MenuExtraAXReader.attributeValue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
TypeService.confirmExactLiteralTypingEffect (cognitive 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:1459— TypeService.confirmExactLiteralTypingEffect has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 7, error handling 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UIAutomationService.makeModifierClickEvents (cognitive 19) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ModifierClick.swift:428— UIAutomationService.makeModifierClickEvents has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentExecutionTrace.init (cognitive 19) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentExecutionTrace.swift:140— AgentExecutionTrace.init has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 5 (7 pts), boolean chains 2, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooAgentService.finishRemoteBrowserQueuedOpening (cognitive 19) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Tools.swift:182— PeekabooAgentService.finishRemoteBrowserQueuedOpening has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 1 (3 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserMCPSessionManager.connectWithOutcome (cognitive 19) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:340— BrowserMCPSessionManager.connectWithOutcome has cognitive complexity 19 (threshold 15). Drivers by points: error handling 9 (14 pts), if/else 2 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserTool.executeAction (cognitive 19) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:272— BrowserTool.executeAction has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ClickTool.execute (cognitive 19) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:112— ClickTool.execute has cognitive complexity 19 (threshold 15). Drivers by points: error handling 8 (10 pts), if/else 4 (7 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClickTool.backgroundProcessIdentity (cognitive 19) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:457— ClickTool.backgroundProcessIdentity has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PasteTool.performBackgroundTextPaste (cognitive 19) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:819— PasteTool.performBackgroundTextPaste has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 2 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeBrowserHandoffGrantRegistry.beginMaintenance (cognitive 19) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserSessionHandoff.swift:1251— PeekabooBridgeBrowserHandoffGrantRegistry.beginMaintenance has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeClient.desktopObservationWithOutcome (cognitive 19) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Observation.swift:11— PeekabooBridgeClient.desktopObservationWithOutcome has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationReceiptArchiveMaintenance.perform (cognitive 19) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptArchiveMaintenance.swift:159— PeekabooBridgeOperationReceiptArchiveMaintenance.perform has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationReceiptSemantics.validateTypedResponseSemantics (cognitive 19) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:865— PeekabooBridgeOperationReceiptSemantics.validateTypedResponseSemantics has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationReceiptSemantics.validateDialogResult (cognitive 19) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:1296— PeekabooBridgeOperationReceiptSemantics.validateDialogResult has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, error handling 2 (4 pts), match/switch 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationReceiptPayload.validateTargetState (cognitive 19) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptPayload.swift:94— PeekabooBridgeOperationReceiptPayload.validateTargetState has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationResultSemantics.failureOutcomeMatchesContract (cognitive 19) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:1184— PeekabooBridgeOperationResultSemantics.failureOutcomeMatchesContract has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 8 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PeekabooBridgeServer.bridgeErrorEnvelope (cognitive 19) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:559— PeekabooBridgeServer.bridgeErrorEnvelope has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), match/switch 3 (6 pts), boolean chains 2, ternaries 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PeekabooBridgeServer.handleAutomationAction (cognitive 19) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:400— PeekabooBridgeServer.handleAutomationAction has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 4 (8 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeServer.updateInputAndLifecycleCapabilities (cognitive 19) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:1489— PeekabooBridgeServer.updateInputAndLifecycleCapabilities has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
RemoteDesktopObservationService.prepareObservationResult (cognitive 19) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteDesktopObservationService.swift:284— RemoteDesktopObservationService.prepareObservationResult has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 6, boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
APIKeyField.body (cognitive 19) Apps/Mac/Peekaboo/Features/Settings/APIKeyField.swift:105— APIKeyField.body has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 3 (6 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DetailedMessageRow.retryLastTask (cognitive 19) Apps/Mac/Peekaboo/Features/Main/MessageComponents/DetailedMessageRow.swift:290— DetailedMessageRow.retryLastTask has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CommanderRuntimeExecutor.invalidateSnapshotsAfterCommandIfNeeded (cognitive 18) Apps/CLI/Sources/PeekabooCLI/CLI/CommanderRuntimeExecutor.swift:207— CommanderRuntimeExecutor.invalidateSnapshotsAfterCommandIfNeeded has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (5 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FileDescriptorOutputCapture.replay (cognitive 18) Apps/CLI/Sources/PeekabooCLI/CLI/Output/DeferredCommandOutput.swift:187— FileDescriptorOutputCapture.replay has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SeeCommand.validateSpecialCaptureTargets (cognitive 18) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand.swift:455— SeeCommand.validateSpecialCaptureTargets has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (6 pts), ternaries 1 (2 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
VerifyCommand.predicates (cognitive 18) Apps/CLI/Sources/PeekabooCLI/Commands/AI/VerifyCommand.swift:162— VerifyCommand.predicates has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AutomationServiceBridge.click (cognitive 18) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:48— AutomationServiceBridge.click has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CommanderCLIBinder.prefersLocalRuntime (cognitive 18) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommanderBinder.swift:625— CommanderCLIBinder.prefersLocalRuntime has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 18. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ProviderStatusReporter.credentialSource (cognitive 18) Apps/CLI/Sources/PeekabooCLI/Commands/Core/ConfigCommand+Status.swift:140— ProviderStatusReporter.credentialSource has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
DragCommand.run (cognitive 18) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand.swift:43— DragCommand.run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 1, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DaemonLaunchPolicy.machOUUID (cognitive 18) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/DaemonLaunchPolicy.swift:192— DaemonLaunchPolicy.machOUUID has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, loops 1, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CertificationUnixSocket.readJSONLine (cognitive 18) Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:368— CertificationUnixSocket.readJSONLine has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CaptureCoordinateMapper.globalPoint (cognitive 18) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/CaptureCoordinateMapper.swift:38— CaptureCoordinateMapper.globalPoint has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 8, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClickService.resolveAutomationElement (cognitive 18) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:321— ClickService.resolveAutomationElement has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ClickService.focusExactElementWithOutcome (cognitive 18) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:1010— ClickService.focusExactElementWithOutcome has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
DetachedExactWindowFocusReader.readValue (cognitive 18) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:246— DetachedExactWindowFocusReader.readValue has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 2 (4 pts), error handling 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ElementDetectionWindowResolver.stableExactWindowOwner (cognitive 18) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementDetectionWindowResolver.swift:187— ElementDetectionWindowResolver.stableExactWindowOwner has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 14, if/else 3 (4 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
TypeService.performSyntheticType (cognitive 18) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:394— TypeService.performSyntheticType has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentExecutionTraceBuilder.mutationDispatchState (cognitive 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentExecutionTrace.swift:249— AgentExecutionTraceBuilder.mutationDispatchState has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (7 pts), match/switch 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentExecutionTraceSanitizer.resultSummary (cognitive 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentExecutionTrace.swift:495— AgentExecutionTraceSanitizer.resultSummary has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentTurnBoundary.recordSuccessfulCompletion (cognitive 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/QueueMode.swift:144— AgentTurnBoundary.recordSuccessfulCompletion has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 2 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserMCPSessionManager.bootstrapAuthorizedHandoff (cognitive 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:621— BrowserMCPSessionManager.bootstrapAuthorizedHandoff has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), boolean chains 5, error handling 3 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserMCPUploadStager.stageSynchronously (cognitive 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPUploadStager.swift:156— BrowserMCPUploadStager.stageSynchronously has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BrowserToolCapabilitySession.resolve (cognitive 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserToolCapabilitySession.swift:79— BrowserToolCapabilitySession.resolve has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 3 (6 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
MCPToolContext.validatedBackgroundMutationResponse (cognitive 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:1262— MCPToolContext.validatedBackgroundMutationResponse has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, ternaries 1 (3 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DialogTool.handleFileAction (cognitive 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DialogTool.swift:407— DialogTool.handleFileAction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, ternaries 3 (5 pts), boolean chains 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PasteTool.validatePayloadShape (cognitive 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:1186— PasteTool.validatePayloadShape has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SeeTool.execute (cognitive 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SeeTool.swift:113— SeeTool.execute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VerifyStateTool.verifyWithinDeadline (cognitive 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:53— VerifyStateTool.verifyWithinDeadline has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UIAutomationToolFormatter.formatTypeResult (cognitive 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+KeyboardResults.swift:9— UIAutomationToolFormatter.formatTypeResult has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
AgentToolArguments.stringDictionary (cognitive 18) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Enhancements.swift:391— AgentToolArguments.stringDictionary has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 1 (4 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeBrowserHandoffGrantRegistry.authorizeSession (cognitive 18) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeBrowserSessionHandoff.swift:764— PeekabooBridgeBrowserHandoffGrantRegistry.authorizeSession has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeCertificationProducerTransport.authenticateProducer (cognitive 18) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerTransport.swift:126— PeekabooBridgeCertificationProducerTransport.authenticateProducer has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 17, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeClient.exactDialogForceDismiss (cognitive 18) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:601— PeekabooBridgeClient.exactDialogForceDismiss has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (8 pts), match/switch 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeServer.handleMenuRequest (cognitive 18) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:375— PeekabooBridgeServer.handleMenuRequest has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PeekabooServices.configuredCustomDefaultModel (cognitive 18) Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+Agent.swift:138— PeekabooServices.configuredCustomDefaultModel has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (8 pts), loops 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
RemoteBrowserMCPClient.openBrowserMCPScopedSession (cognitive 18) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteBrowserMCPClient.swift:82— RemoteBrowserMCPClient.openBrowserMCPScopedSession has cognitive complexity 18 (threshold 15). Drivers by points: error handling 3 (6 pts), if/else 3 (5 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WindowTestingView.body (cognitive 18) Apps/Playground/Playground/Views/WindowTestingView.swift:12— WindowTestingView.body has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SessionChatHeader.body (cognitive 18) Apps/Mac/Peekaboo/Features/Main/SessionChatView.swift:210— SessionChatHeader.body has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, ternaries 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
BoundedPipeOutput.finish (cognitive 17) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionProcessRunner.swift:69— BoundedPipeOutput.finish has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (4 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CaptureActionProcessBox.release (cognitive 17) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionProcessRunner.swift:244— CaptureActionProcessBox.release has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 7 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ClickCommand.resolveAndDispatchModifierClick (cognitive 17) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:534— ClickCommand.resolveAndDispatchModifierClick has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, error handling 1, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClickCommand.resolveBackgroundClickTarget (cognitive 17) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:1133— ClickCommand.resolveBackgroundClickTarget has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 5 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PasteCommand.pasteCurrentClipboard (cognitive 17) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:489— PasteCommand.pasteCurrentClipboard has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 2 (3 pts), boolean chains 2, error handling 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
TypeCommand.run (cognitive 17) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/TypeCommand.swift:82— TypeCommand.run has cognitive complexity 17 (threshold 15). Drivers by points: error handling 7 (13 pts), if/else 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SwitchSubcommand.run (cognitive 17) Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand.swift:220— SwitchSubcommand.run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (6 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CleanCommand.printResults (cognitive 17) Apps/CLI/Sources/PeekabooCLI/Commands/System/CleanCommand.swift:129— CleanCommand.printResults has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (6 pts), loops 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CertificationCodeIdentityRunner.validateImmutableCopy (cognitive 17) Apps/CLI/Sources/PeekabooCertificationController/CodeIdentityRunner.swift:431— CertificationCodeIdentityRunner.validateImmutableCopy has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 16, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ScreenRecordingPermissionChecker.evaluatePermission (cognitive 17) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCapturePermissionGate.swift:65— ScreenRecordingPermissionChecker.evaluatePermission has cognitive complexity 17 (threshold 15). Drivers by points: error handling 5 (11 pts), if/else 4 (6 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DesktopObservationService.validateResolvedTarget (cognitive 17) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService+OperationLane.swift:92— DesktopObservationService.validateResolvedTarget has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (7 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ApplicationService.bindSelectorResolution (cognitive 17) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationService+Lifecycle.swift:191— ApplicationService.bindSelectorResolution has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AutomationElementResolver.bestElement (cognitive 17) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/AutomationElementResolver.swift:424— AutomationElementResolver.bestElement has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 5, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ControlCenterIdentifierLookup.loadMapping (cognitive 17) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraSupport.swift:187— ControlCenterIdentifierLookup.loadMapping has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MenuService.getMenuBarItemsViaWindows (cognitive 17) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraWindows.swift:25— MenuService.getMenuBarItemsViaWindows has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TypeService.typeActionsByFocusingPixel (cognitive 17) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService.swift:1145— TypeService.typeActionsByFocusingPixel has cognitive complexity 17 (threshold 15). Drivers by points: error handling 9, if/else 4 (5 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentExecutionTraceSanitizer.baseResultSummary (cognitive 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentExecutionTrace.swift:544— AgentExecutionTraceSanitizer.baseResultSummary has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ReasoningReplayTarget.init (cognitive 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:1487— ReasoningReplayTarget.init has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PeekabooAgentService.isAgentCancellation (cognitive 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+LoopLifecycle.swift:178— PeekabooAgentService.isAgentCancellation has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BrowserMCPChannelEndpointResolver.parseActivePort (cognitive 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPChannelEndpointResolver.swift:229— BrowserMCPChannelEndpointResolver.parseActivePort has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 12, if/else 4, loops 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
BrowserMCPProviderConnection.version (cognitive 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPProviderConnection.swift:21— BrowserMCPProviderConnection.version has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 8 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ToolResultExtractor.int (cognitive 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolResultExtractor.swift:70— ToolResultExtractor.int has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ToolResultExtractor.double) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ToolResultExtractor.double (cognitive 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolResultExtractor.swift:119— ToolResultExtractor.double has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ToolResultExtractor.int) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SeeElementTextFormatter.describe (cognitive 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SeeTool+Formatting.swift:20— SeeElementTextFormatter.describe has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 6, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SpaceTool.handleList (cognitive 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SpaceTool+Handlers.swift:25— SpaceTool.handleList has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SpaceTool.moveWindowToSpecificSpace (cognitive 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SpaceTool+Handlers.swift:240— SpaceTool.moveWindowToSpecificSpace has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 1 (2 pts), boolean chains 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TypeTool.resolvePixelFocusTarget (cognitive 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/TypeTool.swift:437— TypeTool.resolvePixelFocusTarget has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 4, error handling 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
MenuSystemToolFormatter.menuItemDetails (cognitive 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter+Menu.swift:110— MenuSystemToolFormatter.menuItemDetails has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SystemToolFormatter.formatWaitResult (cognitive 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/SystemToolFormatter.swift:209— SystemToolFormatter.formatWaitResult has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UIAutomationToolFormatter.formatScrollResult (cognitive 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+PointerResults.swift:32— UIAutomationToolFormatter.formatScrollResult has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, boolean chains 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ModelMessage.sanitizedForProviderContext (cognitive 17) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:1380— ModelMessage.sanitizedForProviderContext has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 5, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeCaptureBinding.validateWindow (cognitive 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCaptureBinding.swift:95— PeekabooBridgeCaptureBinding.validateWindow has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeClient.exactDialogEnterText (cognitive 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:523— PeekabooBridgeClient.exactDialogEnterText has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeHost.acquireLease (cognitive 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift:676— PeekabooBridgeHost.acquireLease has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, error handling 1, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PeekabooBridgeOperationReceiptSemantics.validateFailedTargetAttribution (cognitive 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:740— PeekabooBridgeOperationReceiptSemantics.validateFailedTargetAttribution has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 3 (5 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeOperationResultSemantics.exactReadTarget (cognitive 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:357— PeekabooBridgeOperationResultSemantics.exactReadTarget has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PeekabooBridgeOperationResultSemantics.validateSuccessfulTargetDisposition (cognitive 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:1487— PeekabooBridgeOperationResultSemantics.validateSuccessfulTargetDisposition has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgePrivateReceiptArchive.prepareDirectory (cognitive 17) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgePrivateReceiptArchive.swift:5— PeekabooBridgePrivateReceiptArchive.prepareDirectory has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
DesktopSelectedLeafEvidence.validate (cognitive 17) Core/PeekabooFoundation/Sources/PeekabooFoundation/DesktopSelectedLeafEvidence.swift:181— DesktopSelectedLeafEvidence.validate has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 16, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DetailedMessageRow.body (cognitive 17) Apps/Mac/Peekaboo/Features/Main/MessageComponents/DetailedMessageRow.swift:17— DetailedMessageRow.body has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, ternaries 3 (4 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AgentExecutionReleaseGate.waitIfConfigured (cognitive 16) Apps/CLI/Sources/PeekabooCLI/AgentExecutionReleaseGate.swift:17— AgentExecutionReleaseGate.waitIfConfigured has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 14, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
CommanderRuntimeRouter.containsOnlyRecognizedRuntimeOptions (cognitive 16) Apps/CLI/Sources/PeekabooCLI/CLI/CommanderRuntimeRouter.swift:190— CommanderRuntimeRouter.containsOnlyRecognizedRuntimeOptions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentCommand.makeAgentJSONResponse (cognitive 16) Apps/CLI/Sources/PeekabooCLI/Commands/AI/AgentCommand+Execution.swift:140— AgentCommand.makeAgentJSONResponse has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 1 (4 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MoveCommand.validate (cognitive 16) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand.swift:41— MoveCommand.validate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, ternaries 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BrowserCommand.run (cognitive 16) Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserCommand.swift:126— BrowserCommand.run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 3 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RuntimeHostResolver.shouldSkipOnDemandDaemon (cognitive 16) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/RuntimeHostResolver+Resolution.swift:175— RuntimeHostResolver.shouldSkipOnDemandDaemon has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 3 (4 pts), error handling 2 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WindowCommand+State.swift.validatedRestoredWindowOutputInfo (cognitive 16) Apps/CLI/Sources/PeekabooCLI/Commands/System/WindowCommand+State.swift:479— WindowCommand+State.swift.validatedRestoredWindowOutputInfo has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 13, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
HeldPointerReceiptTracker.record (cognitive 16) Apps/CLI/Sources/PeekabooCertificationController/HeldPointerRunner.swift:242— HeldPointerReceiptTracker.record has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 12, if/else 4. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
LiveCertificationBridge.validateCanonicalResponse (cognitive 16) Apps/CLI/Sources/PeekabooCertificationController/LiveCertificationBridge.swift:505— LiveCertificationBridge.validateCanonicalResponse has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 6, match/switch 1 (nesting depth added 4). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
CertificationObserverAttestationServer.serve (cognitive 16) Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:585— CertificationObserverAttestationServer.serve has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FocusRaiseSettlement.attempt (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/FocusUtilities.swift:314— FocusRaiseSettlement.attempt has cognitive complexity 16 (threshold 15). Drivers by points: error handling 5 (7 pts), if/else 4 (6 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FocusManagementService.focusWindowWithOwnedLane (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/FocusUtilities.swift:987— FocusManagementService.focusWindowWithOwnedLane has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), error handling 2 (4 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RunningApplicationProcessIdentity.resolve (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/RunningApplicationProcessIdentity.swift:45— RunningApplicationProcessIdentity.resolve has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SpaceManagementService.getAllSpaces (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceUtilities.swift:93— SpaceManagementService.getAllSpaces has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SpaceManagementService.getSpacesForWindow) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SpaceManagementService.getSpacesForWindow (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceUtilities.swift:210— SpaceManagementService.getSpacesForWindow has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SpaceManagementService.getAllSpaces) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ScreenCaptureFallbackRunner.run (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:126— ScreenCaptureFallbackRunner.run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), error handling 2 (6 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ScreenCaptureFallbackRunner.runCapture) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ScreenCaptureFallbackRunner.runCapture (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:205— ScreenCaptureFallbackRunner.runCapture has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), error handling 2 (6 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ScreenCaptureFallbackRunner.run) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ScreenCapturePlanner.matchDisplay (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCapturePlanner.swift:123— ScreenCapturePlanner.matchDisplay has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WatchCaptureSessionStore.performAutoclean (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchCaptureSessionStore.swift:32— WatchCaptureSessionStore.performAutoclean has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ObservationMenuBarPopoverResolver.candidate (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationMenuBarPopoverResolver.swift:64— ObservationMenuBarPopoverResolver.candidate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ObservationTargetResolver.backgroundMenuBarClick (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationTargetResolver+MenuBar.swift:177— ObservationTargetResolver.backgroundMenuBarClick has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 4, match/switch 1 (2 pts), error handling 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DesktopMutationWatermarkStore.hasPendingMutationUnlocked (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/DesktopMutationWatermarkStore.swift:712— DesktopMutationWatermarkStore.hasPendingMutationUnlocked has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DetachedAXObservationWorker.resolveWindow (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:471— DetachedAXObservationWorker.resolveWindow has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DialogHierarchyReader.attributeValue (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogHierarchyReader.swift:156— DialogHierarchyReader.attributeValue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
DialogService.findDialogUsingCGWindowList (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+CGWindowResolution.swift:7— DialogService.findDialogUsingCGWindowList has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DialogService.navigateViaGoToFolder (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+FileDialogNavigation.swift:325— DialogService.navigateViaGoToFolder has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 1, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DialogService.executeDialogInput (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:472— DialogService.executeDialogInput has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (7 pts), boolean chains 3, error handling 3, if/else 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DialogService.dispatchDialogInput (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+ForegroundOutcomes.swift:992— DialogService.dispatchDialogInput has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 2 (5 pts), loops 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DialogService.performPreparedDialogAction (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+PreparedActions.swift:54— DialogService.performPreparedDialogAction has cognitive complexity 16 (threshold 15). Drivers by points: error handling 7 (8 pts), if/else 4 (5 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DialogService.exactFileDialogTarget (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DialogService+Resolution.swift:93— DialogService.exactFileDialogTarget has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ExactWindowHeldPointerLifecycle.begin (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ExactWindowHeldPointerLifecycle.swift:282— ExactWindowHeldPointerLifecycle.begin has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 2 (4 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
UIAutomationService.resolveActionTarget (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementActions.swift:295— UIAutomationService.resolveActionTarget has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 2, error handling 2, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UIAutomationService.searchElementRecursively (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/UIAutomationService+ElementLookup.swift:377— UIAutomationService.searchElementRecursively has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WindowManagementService.restoreWindowActionResult (cognitive 16) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:170— WindowManagementService.restoreWindowActionResult has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 4 (6 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AgentToolMCPBridge.convertNonImageContent (cognitive 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolMCPBridge.swift:207— AgentToolMCPBridge.convertNonImageContent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 1, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
AgentToolMCPBridge.makeModelImage (cognitive 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentToolMCPBridge.swift:319— AgentToolMCPBridge.makeModelImage has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 7. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooAgentService.clearAllSessions (cognitive 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+SessionLifecycle.swift:493— PeekabooAgentService.clearAllSessions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (6 pts), error handling 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooAgentService.restoredTurnBoundary (cognitive 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+TurnBoundary.swift:28— PeekabooAgentService.restoredTurnBoundary has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserMCPSessionManager.resolveTarget (cognitive 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPSessionManager.swift:1280— BrowserMCPSessionManager.resolveTarget has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 6. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MCPToolArgumentValidator.rejection (cognitive 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolArgumentValidation.swift:66— MCPToolArgumentValidator.rejection has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), error handling 3, match/switch 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MCPToolContext.recoverPendingInvalidations (cognitive 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:617— MCPToolContext.recoverPendingInvalidations has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 1 (2 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BrowserTool.executeSequence (cognitive 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/BrowserTool.swift:489— BrowserTool.executeSequence has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 2 (3 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MenuTool.handleListAction (cognitive 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MenuTool.swift:108— MenuTool.handleListAction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 3, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PasteTool.resolveDeliveryDestination (cognitive 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:1078— PasteTool.resolveDeliveryDestination has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 1, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ScrollTool.dispatchScroll (cognitive 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ScrollTool.swift:265— ScrollTool.dispatchScroll has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 1 (3 pts), error handling 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VerifyStateTargetIdentityTracker.resolve (cognitive 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Execution.swift:603— VerifyStateTargetIdentityTracker.resolve has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
VerifyStateTool.evaluate (cognitive 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Evaluation.swift:84— VerifyStateTool.evaluate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 3 (6 pts), boolean chains 1, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
VerifyStateTool.response (cognitive 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/VerifyStateTool+Response.swift:8— VerifyStateTool.response has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SystemToolFormatter.formatStarting (cognitive 16) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/SystemToolFormatter.swift:366— SystemToolFormatter.formatStarting has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (6 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PeekabooBridgeAgentExecutionProcessWait.retainExactReap (cognitive 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionProcessWait.swift:330— PeekabooBridgeAgentExecutionProcessWait.retainExactReap has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeAgentExecutionReleaseGate.waitForLockdown (cognitive 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:494— PeekabooBridgeAgentExecutionReleaseGate.waitForLockdown has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeCertificationMonitorSealPayload.validateForegroundPlan (cognitive 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationMonitorSealValidation.swift:104— PeekabooBridgeCertificationMonitorSealPayload.validateForegroundPlan has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 15, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeCertificationProducerTransport.perform (cognitive 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerTransport.swift:19— PeekabooBridgeCertificationProducerTransport.perform has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, error handling 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeClient.reserveOperationSession (cognitive 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:359— PeekabooBridgeClient.reserveOperationSession has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeClient.renewOperationSession (cognitive 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:564— PeekabooBridgeClient.renewOperationSession has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 3 (4 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeHost.removeOwnedSocket (cognitive 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost.swift:1017— PeekabooBridgeHost.removeOwnedSocket has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeekabooBridgeErrorEnvelope.init (cognitive 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeModels.swift:754— PeekabooBridgeErrorEnvelope.init has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (8 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperationReceiptSemantics.selectedLeaf (cognitive 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptModels.swift:589— PeekabooBridgeOperationReceiptSemantics.selectedLeaf has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 13, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeOperationResultSemantics.successResponseMatchesPolicy (cognitive 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationResultSemantics.swift:1144— PeekabooBridgeOperationResultSemantics.successResponseMatchesPolicy has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 7, match/switch 1 (nesting depth added 4). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PeekabooBridgeServer.handleTargetedClick (cognitive 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:806— PeekabooBridgeServer.handleTargetedClick has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PeekabooBridgeServer.validatePeerAuthorization (cognitive 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Routing.swift:7— PeekabooBridgeServer.validatePeerAuthorization has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PeekabooBridgeServer.handleDialogRequest (cognitive 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+ServiceHandlers.swift:786— PeekabooBridgeServer.handleDialogRequest has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PeekabooBridgeWindowContextBinding.matches (cognitive 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeWindowContextBinding.swift:7— PeekabooBridgeWindowContextBinding.matches has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 14, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PeekabooBridgeServer.swift.protocolHostCapabilities (cognitive 16) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:1327— PeekabooBridgeServer.swift.protocolHostCapabilities has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, boolean chains 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PeekabooServices.firstAvailableModel (cognitive 16) Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices+Agent.swift:289— PeekabooServices.firstAvailableModel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 1 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CaptureError.errorDescription (cognitive 16) Core/PeekabooFoundation/Sources/PeekabooFoundation/ErrorTypes.swift:38— CaptureError.errorDescription has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PeekabooApp.body (cognitive 16) Apps/Mac/Peekaboo/PeekabooApp.swift:45— PeekabooApp.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 2, boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AppDelegate.startBridgeHost (cognitive 16) Apps/Mac/Peekaboo/PeekabooApp.swift:609— AppDelegate.startBridgeHost has cognitive complexity 16 (threshold 15). Drivers by points: error handling 3 (7 pts), if/else 2 (4 pts), ternaries 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DetailedMessageRow.determineToolStatus (cognitive 16) Apps/Mac/Peekaboo/Features/Main/MessageComponents/DetailedMessageRow.swift:250— DetailedMessageRow.determineToolStatus has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (16 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Change-coupling hub: DockCommand.swift → CleanCommand.swift, DialogCommand.swift, MenuCommand.swift, WindowCommand.swift Apps/CLI/Sources/PeekabooCLI/Commands/System/DockCommand.swift— `Apps/CLI/Sources/PeekabooCLI/Commands/System/DockCommand.swift` changes together with 4 other files — `Apps/CLI/Sources/PeekabooCLI/Commands/System/CleanCommand.swift`, `Apps/CLI/Sources/PeekabooCLI/Commands/System/DialogCommand.swift`, `Apps/CLI/Sources/PeekabooCLI/Commands/System/MenuCommand.swift`, `Apps/CLI/Sources/PeekabooCLI/Commands/System/WindowCommand.swift` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
Near-duplicate member pair (77 shared lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:305— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:305-413 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:416-519 — These two members are variants of one another: 77 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (36 corresponding lines) · ×1
Edited copy of a member (36 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:191— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:191-226 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift:596-631 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (32 corresponding lines) · ×1
Edited copy of a member (32 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Captures.swift:155— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Captures.swift:155-188 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Captures.swift:190-222 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (8 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (8 members, 50+ identical tokens) Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:342— Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:342-357 | Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:520-535 | Apps/CLI/Sources/PeekabooCertificationController/PrivateArtifacts.swift:229-286 | Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/CredentialFile.swift:88-144 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgePrivateReceiptArchive.swift:65-123 | scripts/support/background-computer-use-probe.swift:2423-2451 | scripts/support/background-computer-use-probe.swift:2798-2817 | scripts/support/background-computer-use-probe.swift:2984-3004 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication· Edited copy of a member (167 corresponding lines) · ×1
Edited copy of a member (167 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:222— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:222-398 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/PasteTool.swift:597-763 — These two members are one piece of code written twice and then edited apart: 167 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (78 corresponding lines) · ×1
Edited copy of a member (78 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:126— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:126-203 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:205-289 — These two members are one piece of code written twice and then edited apart: 78 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (72 corresponding lines) · ×1
Edited copy of a member (72 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:523— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:523-598 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:601-672 — These two members are one piece of code written twice and then edited apart: 72 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (64 corresponding lines) · ×1
Edited copy of a member (64 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:744— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:744-814 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService+TargetResolution.swift:36-99 — These two members are one piece of code written twice and then edited apart: 64 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (62 corresponding lines) · ×1
Edited copy of a member (62 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceUtilities.swift:93— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceUtilities.swift:93-154 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceUtilities.swift:210-273 — These two members are one piece of code written twice and then edited apart: 62 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (40 corresponding lines) · ×1
Edited copy of a member (40 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Testing.swift:266— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Testing.swift:266-317 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureService+Testing.swift:319-358 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (54 corresponding lines) · ×1
Edited copy of a member (54 corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:903— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:903-965 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer+Handlers.swift:967-1020 — These two members are one piece of code written twice and then edited apart: 54 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (77 corresponding lines) · ×1
Edited copy of a member (77 corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:28— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:28-106 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SeeTool.swift:31-107 — These two members are one piece of code written twice and then edited apart: 77 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (45 corresponding lines) · ×1
Edited copy of a member (45 corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1228— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1228-1272 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveScope.swift:75-127 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (41 corresponding lines) · ×1
Edited copy of a member (41 corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:368— Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:368-416 | scripts/support/background-computer-use-probe.swift:2756-2796 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 44+ corresponding lines) · ×1
Edited copies of one member (3 members, 44+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Helpers/ProcessWait.swift:11— Apps/CLI/Sources/PeekabooCLI/Helpers/ProcessWait.swift:11-66 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/LegacyScreenCaptureOperator+SystemScreencapture.swift:173-216 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService+Process.swift:9-61 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 44 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (44 corresponding lines) · ×1
Edited copy of a member (44 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraState.swift:13— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraState.swift:13-56 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/MenuService+MenuExtraState.swift:105-152 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 37+ corresponding lines) · ×1
Edited copies of one member (3 members, 37+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementDetectionModels.swift:277— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ElementDetectionModels.swift:277-313 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ClickTool.swift:1177-1213 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/ToolEventSummary.swift:36-78 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 37 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 30+ corresponding lines) · ×1
Edited copies of one member (3 members, 30+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:773— Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:773-802 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:804-843 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/BridgeCapabilityPolicy.swift:878-907 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 25+ corresponding lines) · ×1
Edited copies of one member (3 members, 25+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:846— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:846-870 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ScrollService.swift:665-692 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService+TargetResolution.swift:112-137 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 16+ corresponding lines) · ×1
Edited copies of one member (5 members, 16+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/CLI/Completions/BashCompletionRenderer.swift:135— Apps/CLI/Sources/PeekabooCLI/CLI/Completions/BashCompletionRenderer.swift:135-152 | Apps/CLI/Sources/PeekabooCLI/CLI/Completions/BashCompletionRenderer.swift:154-173 | Apps/CLI/Sources/PeekabooCLI/CLI/Completions/FishCompletionRenderer.swift:144-159 | Apps/CLI/Sources/PeekabooCLI/CLI/Completions/ZshCompletionRenderer.swift:142-159 | Apps/CLI/Sources/PeekabooCLI/CLI/Completions/ZshCompletionRenderer.swift:161-180 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 23+ corresponding lines) · ×1
Edited copies of one member (6 members, 23+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:805— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:805-827 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:829-851 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:853-875 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:877-901 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:903-927 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:929-953 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 24+ corresponding lines) · ×1
Edited copies of one member (3 members, 24+ corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+SessionLifecycle.swift:193— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+SessionLifecycle.swift:193-217 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+SessionLifecycle.swift:219-242 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService.swift:418-443 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×1
Edited copy of a member (27 corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceUtilities.swift:333— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceUtilities.swift:333-359 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceUtilities.swift:410-437 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (7 members, 18+ corresponding lines) · ×1
Edited copies of one member (7 members, 18+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/WindowManagementServiceProtocol.swift:404— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/WindowManagementServiceProtocol.swift:404-428 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/WindowManagementServiceProtocol.swift:430-447 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/WindowManagementServiceProtocol.swift:449-466 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/WindowManagementServiceProtocol.swift:468-485 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/WindowManagementServiceProtocol.swift:487-507 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/WindowManagementServiceProtocol.swift:509-529 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/WindowManagementServiceProtocol.swift:531-551 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 12+ corresponding lines) · ×1
Edited copies of one member (4 members, 12+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DockServiceProtocol.swift:78— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/DockServiceProtocol.swift:78-90 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:377-388 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:390-403 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/MenuServiceProtocol.swift:405-416 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 23+ corresponding lines) · ×1
Edited copies of one member (4 members, 23+ corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:214— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:214-237 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:260-282 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:284-312 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:314-341 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 15+ corresponding lines) · ×1
Edited copies of one member (6 members, 15+ corresponding lines) Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:83— Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:83-97 | Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:119-133 | Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:155-169 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/ElementStyleProvider.swift:179-193 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/InspectorPreset.swift:62-76 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/InspectorPreset.swift:98-112 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 7+ corresponding lines) · ×1
Edited copies of one member (6 members, 7+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:684— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:684-690 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedExactWindowFocusReader.swift:692-698 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:543-555 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+Resolution.swift:557-569 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:1544-1554 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:1556-1566 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 11+ corresponding lines) · ×1
Edited copies of one member (4 members, 11+ corresponding lines) Apps/Playground/Playground/Views/ScrollTestingView.swift:326— Apps/Playground/Playground/Views/ScrollTestingView.swift:326-337 | Apps/Playground/Playground/Views/ScrollTestingView.swift:339-349 | Apps/Playground/Playground/Views/ScrollTestingView.swift:351-361 | Apps/Playground/Playground/Views/ScrollTestingView.swift:363-373 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 15+ corresponding lines) · ×1
Edited copies of one member (5 members, 15+ corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:49— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:49-69 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:71-85 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:87-107 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:109-126 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService+ActionOutcomes.swift:128-148 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 14+ corresponding lines) · ×1
Edited copies of one member (4 members, 14+ corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:6— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:6-19 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:399-413 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+ActionOutcomes.swift:442-456 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+HeldPointer.swift:41-56 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 17+ corresponding lines) · ×1
Edited copies of one member (4 members, 17+ corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:86— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:86-104 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:175-191 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:370-388 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:432-454 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 7+ corresponding lines) · ×1
Edited copies of one member (5 members, 7+ corresponding lines) Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:206— Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:206-212 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:619-629 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:742-752 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:758-766 | Core/PeekabooCore/Sources/PeekabooCore/Support/RemoteUIAutomationService.swift:768-779 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 8+ corresponding lines) · ×1
Edited copies of one member (5 members, 8+ corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Capture.swift:7— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Capture.swift:7-18 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Capture.swift:20-34 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Capture.swift:36-49 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Capture.swift:51-58 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+Capture.swift:60-68 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 13+ corresponding lines) · ×1
Edited copies of one member (6 members, 13+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/LoggingServiceProtocol.swift:60— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/LoggingServiceProtocol.swift:60-72 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/LoggingServiceProtocol.swift:74-86 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/LoggingServiceProtocol.swift:88-100 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/LoggingServiceProtocol.swift:102-114 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/LoggingServiceProtocol.swift:116-128 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/LoggingServiceProtocol.swift:130-142 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 10+ corresponding lines) · ×1
Edited copies of one member (5 members, 10+ corresponding lines) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:55— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:55-66 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:97-108 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:136-145 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:369-378 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:390-404 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 12+ corresponding lines) · ×1
Edited copies of one member (6 members, 12+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchCaptureSession+Loop.swift:661— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchCaptureSession+Loop.swift:661-672 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService.swift:28-39 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService.swift:82-95 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient.swift:1647-1658 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceiptArchiveMaintenance.swift:264-275 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeServer.swift:98-109 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 4+ corresponding lines) · ×1
Edited copies of one member (5 members, 4+ corresponding lines) Apps/CLI/Sources/PeekabooCertificationController/CodeIdentityRunner.swift:106— Apps/CLI/Sources/PeekabooCertificationController/CodeIdentityRunner.swift:106-109 | Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:399-402 | Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:134-137 | Apps/CLI/Sources/PeekabooCertificationController/ObserverPlan.swift:241-244 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:585-588 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 31+ corresponding lines) · ×1
Edited copies of one member (5 members, 31+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand+CommanderMetadata.swift:7— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand+CommanderMetadata.swift:7-37 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand.swift:1014-1049 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PressCommand.swift:432-472 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ScrollCommand.swift:468-500 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/TypeCommand.swift:671-722 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 31 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 34+ corresponding lines) · ×1
Edited copies of one member (4 members, 34+ corresponding lines) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool.swift:15— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/AppTool.swift:15-50 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/DialogTool.swift:23-63 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/MenuTool.swift:27-60 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SpaceTool.swift:42-78 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 34 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (7 members, 3+ corresponding lines) · ×1
Edited copies of one member (7 members, 3+ corresponding lines) Apps/CLI/Sources/PeekabooCLI/Commands/Core/BridgeCommand+Receipt.swift:458— Apps/CLI/Sources/PeekabooCLI/Commands/Core/BridgeCommand+Receipt.swift:458-460 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:1015-1017 | Apps/CLI/Sources/PeekabooCertificationController/PrivateArtifacts.swift:221-223 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/WatchCaptureArtifactWriter.swift:162-164 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationResultModels.swift:74-76 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:810-812 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeOperationReceipts.swift:79-81 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
Duplicated block (69 lines × 2) Apps/Playground/Playground/ContentView.swift:347— Apps/Playground/Playground/ContentView.swift:347-415 | Apps/Playground/Playground/Views/DialogFixtureView.swift:135-203 — before extracting anything, compare `Apps/Playground/Playground/ContentView.swift` and `Apps/Playground/Playground/Views/DialogFixtureView.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 140 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (53 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceUtilities.swift:102— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceUtilities.swift:102-154 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceUtilities.swift:221-273 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Utilities/SpaceUtilities.swift:102` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (39 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:95— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:95-133 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager.swift:172-210 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:95` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (38 lines × 2) Apps/Playground/Playground/ContentView.swift:440— Apps/Playground/Playground/ContentView.swift:440-477 | Apps/Playground/Playground/Views/DialogFixtureView.swift:228-265 — before extracting anything, compare `Apps/Playground/Playground/ContentView.swift` and `Apps/Playground/Playground/Views/DialogFixtureView.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 140 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (37 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:537— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:537-573 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:620-656 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:537` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:618` calls `init` and `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:536` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (35–36 lines × 2) Apps/CLI/Sources/PeekabooCLI/Helpers/ProcessWait.swift:14— Apps/CLI/Sources/PeekabooCLI/Helpers/ProcessWait.swift:14-49 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DockService+Process.swift:13-47 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Helpers/ProcessWait.swift:14` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Note first that the copies are not typed on the same thing: the declarations holding them bind `timeoutSeconds` to `TimeInterval` in one and `TimeInterval = 15` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (33 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:312— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:312-344 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:421-453 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:312` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (32 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:195— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:195-226 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift:600-631 — before extracting anything, compare `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift` and `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:195` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (29–30 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:650— Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:650-678 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:326-355 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Execution.swift:650` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23–26 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/HeldPointerRunner.swift:615— Apps/CLI/Sources/PeekabooCertificationController/HeldPointerRunner.swift:615-640 | Apps/CLI/Sources/PeekabooCertificationController/LiveCertificationBridge.swift:155-177 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCertificationController/HeldPointerRunner.swift:615` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (26 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool.swift:48— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool.swift:48-73 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SeeTool.swift:82-107 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/InspectUITool.swift:48` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–25 lines × 3) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:434— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:434-454 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:768-792 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/TypeService+TargetResolution.swift:56-80 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ClickService.swift:794` calls `lowercased` and `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:455` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (25 lines × 3) Core/PeekabooUICore/Sources/PeekabooUICore/Inspector/OverlayManager.swift:124— Core/PeekabooUICore/Sources/PeekabooUICore/Inspector/OverlayManager.swift:124-148 | Core/PeekabooUICore/Sources/PeekabooUICore/Inspector/OverlayManager.swift:478-502 | Core/PeekabooUICore/Sources/PeekabooUICore/Overlay/OverlayView.swift:136-160 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (4–25 lines × 3) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:146— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:146-169 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/SystemToolFormatter.swift:315-318 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/VisionToolFormatter.swift:167-191 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (25 lines × 2) Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+Accessors.swift:75— Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+Accessors.swift:75-99 | Core/PeekabooCore/Sources/PeekabooAutomation/Services/AI/PeekabooAIService.swift:603-627 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (23–24 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:736— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:736-759 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/VideoWriter.swift:366-388 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:736` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (21–24 lines × 2) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:129— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:129-152 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:225-245 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/WindowManagementService+StateOperations.swift:129` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (21 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:162— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:162-182 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:213-233 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:162` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–20 lines × 2) Apps/Mac/Peekaboo/Core/Settings.swift:652— Apps/Mac/Peekaboo/Core/Settings.swift:652-671 | Apps/Mac/Peekaboo/Core/Settings.swift:799-814 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/Mac/Peekaboo/Core/Settings.swift:652` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19–20 lines × 2) Apps/Mac/Peekaboo/Core/Settings.swift:675— Apps/Mac/Peekaboo/Core/Settings.swift:675-693 | Apps/Mac/Peekaboo/Core/Settings.swift:865-884 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/Mac/Peekaboo/Core/Settings.swift:675` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–19 lines × 4) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand+CommanderMetadata.swift:94— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand+CommanderMetadata.swift:94-107 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ScrollCommand+CommanderMetadata.swift:34-51 | Apps/CLI/Sources/PeekabooCLI/Commands/System/DialogCommand+CommanderMetadata.swift:32-43 | Apps/CLI/Sources/PeekabooCLI/Commands/System/DialogCommand+CommanderMetadata.swift:63-81 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand+CommanderMetadata.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ScrollCommand+CommanderMetadata.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand+CommanderMetadata.swift:94` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13–19 lines × 3) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:159— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:159-171 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand+CommanderMetadata.swift:40-58 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SetValueCommand.swift:130-142 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand+CommanderMetadata.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:159` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–19 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:278— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:278-296 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SetValueTool.swift:59-73 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:278` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–19 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift:133— Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift:133-151 | Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift:266-273 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift:133` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7–18 lines × 5) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+CommanderMetadata.swift:65— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+CommanderMetadata.swift:65-74 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+CommanderMetadata.swift:99-105 | Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift:140-157 | Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift:269-279 | Apps/CLI/Sources/PeekabooCLI/Commands/System/WindowCommand+CommanderMetadata.swift:105-115 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+CommanderMetadata.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+CommanderMetadata.swift:65` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+CommanderMetadata.swift:63` calls `commandOption` and `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+CommanderMetadata.swift:99` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (18 lines × 4) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:1094— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Core/Protocols/ApplicationServiceProtocol.swift:1094-1111 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationWindowEnumerationContext.swift:634-651 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationWindowEnumerationContext.swift:662-679 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/System/ApplicationWindowEnumerationContext.swift:690-707 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (17–18 lines × 3) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:348— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand.swift:348-364 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationService+Capture.swift:107-124 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/ObservationTargetResolver.swift:286-302 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (15–18 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:444— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:444-458 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:474-491 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:444` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–18 lines × 2) Apps/Playground/Playground/LogViewerWindow.swift:60— Apps/Playground/Playground/LogViewerWindow.swift:60-75 | Core/PeekabooUICore/Sources/PeekabooUICore/Components/AllElementsView.swift:82-99 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7–17 lines × 11) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:152— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:152-158 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand+CommanderMetadata.swift:5-15 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SetValueCommand.swift:123-129 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/TypeCommand+CommanderMetadata.swift:4-20 | Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserCommand.swift:376-388 | Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift:4-20 | Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift:58-70 | Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift:102-118 | Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift:128-144 | Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift:214-230 | Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift:262-268 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SetValueCommand.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 89 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:152` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PasteCommand+CommanderMetadata.swift:17` calls `commandOption` and `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:160` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:154— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:154-170 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift:559-575 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Strategy/FocusedElementReceiptResolver.swift:152-168 — before extracting anything, compare `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift` and `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 142 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (15–17 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:859— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:859-875 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/VideoWriter.swift:263-277 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:859` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–16 lines × 4) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:285— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:285-300 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:319-334 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:55-66 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SetValueTool.swift:65-76 — before extracting anything, compare `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SetValueTool.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 77 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandServiceBridges.swift:285` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–16 lines × 4) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:159— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:159-166 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand+CommanderMetadata.swift:38-53 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SelectTextCommand.swift:135-145 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SetValueCommand.swift:130-137 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand+CommanderMetadata.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:159` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SelectTextCommand.swift:135` calls `commandOption` and `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:159` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16 lines × 3) Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:61— Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:61-76 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:176-191 | Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:235-250 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Base/CommandUtilities.swift:61` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (12–16 lines × 3) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:444— Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:444-455 | Apps/CLI/Sources/PeekabooCertificationController/HeldPointerPlan.swift:180-195 | Apps/CLI/Sources/PeekabooCertificationController/ObserverPlan.swift:276-287 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift` and `Apps/CLI/Sources/PeekabooCertificationController/HeldPointerPlan.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:444` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–15 lines × 4) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:445— Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:445-455 | Apps/CLI/Sources/PeekabooCertificationController/HeldPointerPlan.swift:181-195 | Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:61-71 | Apps/CLI/Sources/PeekabooCertificationController/ObserverPlan.swift:277-287 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift` and `Apps/CLI/Sources/PeekabooCertificationController/HeldPointerPlan.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 3) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:550— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:550-564 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:633-647 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:757-771 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:550` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9–15 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/CodeIdentityRunner.swift:260— Apps/CLI/Sources/PeekabooCertificationController/CodeIdentityRunner.swift:260-268 | Apps/CLI/Sources/PeekabooCertificationController/ControllerBuildIdentity.swift:49-63 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (4–15 lines × 4) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/SystemToolFormatter.swift:147— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/SystemToolFormatter.swift:147-150 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/SystemToolFormatter.swift:413-416 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+WindowResults.swift:66-80 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/WindowToolFormatter+WindowResults.swift:96-110 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (14–15 lines × 2) Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices.swift:303— Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices.swift:303-316 | Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices.swift:354-368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices.swift:302` calls `ScreenService` and `Core/PeekabooCore/Sources/PeekabooCore/Support/PeekabooServices.swift:353` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13–14 lines × 3) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:49— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:49-61 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:85-97 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:317-330 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:49` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (14 lines × 3) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:566— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:566-579 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:649-662 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:773-786 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeClient+MenusDockDialogs.swift:566` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–14 lines × 2) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost+Clients.swift:403— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHost+Clients.swift:403-416 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeHostIdentity.swift:82-94 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (13 lines × 5) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:52— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:52-64 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:88-100 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:183-195 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:227-239 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:271-283 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/WindowTool+Handlers.swift:52` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11–13 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationInvalidator.swift:771— Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionObservationInvalidator.swift:771-781 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/MCPToolContext.swift:1146-1158 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11–12 lines × 4) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:144— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:144-155 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:168-179 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:225-235 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:251-261 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:141` calls `debug` and `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/ScreenCaptureEngineSupport.swift:167` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 4) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:103— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/InMemorySnapshotManager+DetectionMapping.swift:103-114 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager.swift:180-191 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/DetachedAXObservationWorker.swift:602-613 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/ElementClassifier.swift:126-137 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
Duplicated block (9–11 lines × 3) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1143— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1143-1151 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1164-1172 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1326-1336 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/UI/BackgroundInputDriver.swift:1143` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8–11 lines × 2) Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:147— Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:147-154 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SetValueTool.swift:170-180 — before extracting anything, compare `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift` and `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SetValueTool.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 77 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/ActionTool.swift:147` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 6) Core/PeekabooUICore/Sources/PeekabooUICore/Presets/AnnotationPreset.swift:130— Core/PeekabooUICore/Sources/PeekabooUICore/Presets/AnnotationPreset.swift:130-139 | Core/PeekabooUICore/Sources/PeekabooUICore/Presets/InspectorPreset.swift:144-153 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/ElementStyleProvider.swift:148-157 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/ElementStyleProvider.swift:168-177 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/AnnotationPreset.swift:67-76 | Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/InspectorPreset.swift:87-96 — before extracting anything, compare `Core/PeekabooUICore/Sources/PeekabooUICore/Presets/AnnotationPreset.swift` and `Core/PeekabooVisualizer/Sources/PeekabooVisualizer/Visualization/Presets/AnnotationPreset.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 40 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooUICore/Sources/PeekabooUICore/Presets/AnnotationPreset.swift:130` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 5) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:176— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:176-185 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/MenuSystemToolFormatter+Dialog.swift:43-52 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+KeyboardResults.swift:94-103 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+KeyboardResults.swift:134-143 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/UIAutomationToolFormatter+PointerResults.swift:74-83 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:176` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8–10 lines × 2) Apps/Mac/Peekaboo/Core/Settings.swift:1148— Apps/Mac/Peekaboo/Core/Settings.swift:1148-1155 | Apps/Mac/Peekaboo/Core/Settings.swift:1163-1172 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 5) Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:344— Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:344-352 | Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:522-530 | Apps/CLI/Sources/PeekabooCertificationController/PrivateArtifacts.swift:256-264 | Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/CredentialFile.swift:126-134 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgePrivateReceiptArchive.swift:88-96 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:344` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (3–9 lines × 5) Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:118— Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:118-126 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:204-212 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:402-410 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:470-476 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeCertificationProducerAttestationModels.swift:477-479 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8–9 lines × 3) Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:277— Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:277-285 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:345-353 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ElementToolFormatter.swift:393-400 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAgentRuntime/ToolFormatting/Formatters/ApplicationToolFormatter.swift:277` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6–9 lines × 2) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SelectTextCommand.swift:46— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SelectTextCommand.swift:46-54 | Core/PeekabooCore/Sources/PeekabooAgentRuntime/MCP/Tools/SelectTextTool.swift:85-90 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SelectTextCommand.swift:46` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5–9 lines × 2) Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:470— Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift:470-474 | Apps/CLI/Sources/PeekabooCertificationController/HeldPointerPlan.swift:200-208 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCertificationController/ControllerPlan.swift` and `Apps/CLI/Sources/PeekabooCertificationController/HeldPointerPlan.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCertificationController/HeldPointerPlan.swift:200` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 6) Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand+CommanderMetadata.swift:94— Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand+CommanderMetadata.swift:94-104 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ScrollCommand+CommanderMetadata.swift:34-48 | Apps/CLI/Sources/PeekabooCLI/Commands/MCP/MCPCommand+CommanderMetadata.swift:19-34 | Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift:81-96 | Apps/CLI/Sources/PeekabooCLI/Commands/System/DialogCommand+CommanderMetadata.swift:32-39 | Apps/CLI/Sources/PeekabooCLI/Commands/System/DialogCommand+CommanderMetadata.swift:63-77 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand+CommanderMetadata.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ScrollCommand+CommanderMetadata.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand+CommanderMetadata.swift:94` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (3–8 lines × 3) Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1398— Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1398-1405 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+LiveBindings.swift:42-49 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Video.swift:268-270 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1398` calls `singleOption` and `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Video.swift:268` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 21) Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+CommanderMetadata.swift:7— Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+CommanderMetadata.swift:7-21 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+CommanderMetadata.swift:33-47 | Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+CommanderMetadata.swift:71-85 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1337-1343 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+CommanderMetadata.swift:13-19 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+CommanderMetadata.swift:35-49 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ActionCommand.swift:158-164 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/DragCommand+CommanderMetadata.swift:7-21 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/MoveCommand+CommanderMetadata.swift:72-86 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/PressCommand+CommanderMetadata.swift:16-30 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ScrollCommand+CommanderMetadata.swift:7-21 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/SetValueCommand.swift:129-135 | Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/TypeCommand+CommanderMetadata.swift:14-28 | Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserCommand.swift:386-392 | Apps/CLI/Sources/PeekabooCLI/Commands/MCP/MCPCommand+CommanderMetadata.swift:7-21 | Apps/CLI/Sources/PeekabooCLI/Commands/Shared/InteractionTargetOptions+CommanderMetadata.swift:7-21 | Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift:64-78 | Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift:224-238 | Apps/CLI/Sources/PeekabooCLI/Commands/System/DialogCommand+CommanderMetadata.swift:54-60 | Apps/CLI/Sources/PeekabooCLI/Commands/System/SpaceCommand+CommanderMetadata.swift:42-56 | Apps/CLI/Sources/PeekabooCLI/Commands/System/WindowIdentificationOptions+CommanderMetadata.swift:7-21 — before extracting anything, compare `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+CommanderMetadata.swift` and `Apps/CLI/Sources/PeekabooCLI/Commands/System/AppCommand+CommanderMetadata.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+CommanderMetadata.swift:7` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserCommand.swift:393` calls `commandOption` and `Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureCommand+Action.swift:1344` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 6) Apps/CLI/Sources/PeekabooCLI/Commands/Core/BridgeCommand+Receipt.swift:390— Apps/CLI/Sources/PeekabooCLI/Commands/Core/BridgeCommand+Receipt.swift:390-396 | Apps/CLI/Sources/PeekabooCLI/Commands/Core/CaptureActionManifest.swift:982-988 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureArtifactIntegrityValidator.swift:168-174 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Capture/CaptureArtifactIntegrityValidator.swift:285-291 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:766-772 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:1263-1269 — there are 6 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:765` calls `lstat` and `Apps/CLI/Sources/PeekabooCLI/Commands/Core/BridgeCommand+Receipt.swift:389` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 8) Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:344— Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:344-349 | Apps/CLI/Sources/PeekabooCertificationController/LocalPIDAttestation.swift:522-527 | Apps/CLI/Sources/PeekabooCertificationController/PrivateArtifacts.swift:256-261 | Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/CredentialFile.swift:126-131 | Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgePrivateReceiptArchive.swift:88-93 | scripts/support/background-computer-use-probe.swift:2437-2442 | scripts/support/background-computer-use-probe.swift:2804-2809 | scripts/support/background-computer-use-probe.swift:2990-2995 — there are 8 copies across 6 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 8 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserHandoffReceiptStore.swift:344` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (3–6 lines × 3) Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:148— Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:148-153 | Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:174-179 | Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:226-228 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:148` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:182` calls `setValue` and `Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/ConfigurationManager+CustomProviders.swift:156` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication· Near-duplicate member family (5 members, 21 shared lines) · ×1
Near-duplicate member family (5 members, 21 shared lines) scripts/support/background-computer-use-probe.swift:5293— scripts/support/background-computer-use-probe.swift:5293-5322 | scripts/support/background-computer-use-probe.swift:5324-5357 | scripts/support/background-computer-use-probe.swift:5359-5388 | scripts/support/background-computer-use-probe.swift:5390-5422 | scripts/support/background-computer-use-probe.swift:5424-5458 — These 5 members are variants of one another: a block of 21 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Near-duplicate member family (5 members, 14 shared lines) · ×1
Near-duplicate member family (5 members, 14 shared lines) scripts/support/background-computer-use-probe.swift:4906— scripts/support/background-computer-use-probe.swift:4906-4946 | scripts/support/background-computer-use-probe.swift:5324-5357 | scripts/support/background-computer-use-probe.swift:5359-5388 | scripts/support/background-computer-use-probe.swift:5390-5422 | scripts/support/background-computer-use-probe.swift:5424-5458 — These 5 members are variants of one another: a block of 14 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Edited copies of one member (7 members, 25+ corresponding lines) · ×1
Edited copies of one member (7 members, 25+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:135— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:135-161 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:163-190 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:192-222 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:224-253 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:255-285 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:442-466 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:468-493 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 19+ corresponding lines) · ×1
Edited copies of one member (4 members, 19+ corresponding lines) Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:320— Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:320-346 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:348-375 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:377-399 | Core/PeekabooAutomationKit/Sources/PeekabooAutomationKitTestSupport/UIAutomationOutcomeScript.swift:401-419 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Duplicated block (7–9 lines × 2) scripts/final-qualification/integrated-cu-emitter-calibrator.swift:170— scripts/final-qualification/integrated-cu-emitter-calibrator.swift:170-176 | scripts/support/background-computer-use-probe.swift:1383-1391 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/final-qualification/integrated-cu-emitter-calibrator.swift:170` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–8 lines × 2) scripts/support/background-computer-use-probe.swift:6099— scripts/support/background-computer-use-probe.swift:6099-6105 | scripts/support/background-computer-use-probe.swift:6247-6254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/support/background-computer-use-probe.swift:6247` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 11) scripts/support/background-computer-use-probe.swift:4752— scripts/support/background-computer-use-probe.swift:4752-4758 | scripts/support/background-computer-use-probe.swift:4907-4913 | scripts/support/background-computer-use-probe.swift:4949-4955 | scripts/support/background-computer-use-probe.swift:5077-5083 | scripts/support/background-computer-use-probe.swift:5196-5202 | scripts/support/background-computer-use-probe.swift:5243-5249 | scripts/support/background-computer-use-probe.swift:5294-5300 | scripts/support/background-computer-use-probe.swift:5325-5331 | scripts/support/background-computer-use-probe.swift:5360-5366 | scripts/support/background-computer-use-probe.swift:5391-5397 | scripts/support/background-computer-use-probe.swift:5425-5431 — all 11 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/support/background-computer-use-probe.swift:4752` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `scripts/support/background-computer-use-probe.swift:4914` calls `testAuthorization`, `testProducerSet` and `scripts/support/background-computer-use-probe.swift:4759` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6–7 lines × 5) scripts/support/background-computer-use-probe.swift:4657— scripts/support/background-computer-use-probe.swift:4657-4662 | scripts/support/background-computer-use-probe.swift:4757-4762 | scripts/support/background-computer-use-probe.swift:5010-5015 | scripts/support/background-computer-use-probe.swift:5082-5087 | scripts/support/background-computer-use-probe.swift:5430-5436 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/support/background-computer-use-probe.swift:5430` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 5) scripts/support/background-computer-use-probe.swift:4932— scripts/support/background-computer-use-probe.swift:4932-4938 | scripts/support/background-computer-use-probe.swift:5346-5352 | scripts/support/background-computer-use-probe.swift:5377-5383 | scripts/support/background-computer-use-probe.swift:5411-5417 | scripts/support/background-computer-use-probe.swift:5447-5453 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/support/background-computer-use-probe.swift:4932` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (4–7 lines × 4) scripts/support/background-computer-use-probe.swift:3866— scripts/support/background-computer-use-probe.swift:3866-3869 | scripts/support/background-computer-use-probe.swift:3931-3937 | scripts/support/background-computer-use-probe.swift:4013-4019 | scripts/support/background-computer-use-probe.swift:4070-4076 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5–7 lines × 2) scripts/support/background-computer-use-probe.swift:5017— scripts/support/background-computer-use-probe.swift:5017-5023 | scripts/support/background-computer-use-probe.swift:5066-5070 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/support/background-computer-use-probe.swift:5017` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/support/background-computer-use-probe.swift:5016` calls `testAuthorization`, `testProducerSet` and `scripts/support/background-computer-use-probe.swift:5065` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 6) scripts/support/background-computer-use-probe.swift:5693— scripts/support/background-computer-use-probe.swift:5693-5698 | scripts/support/background-computer-use-probe.swift:5792-5797 | scripts/support/background-computer-use-probe.swift:6070-6075 | scripts/support/background-computer-use-probe.swift:6184-6189 | scripts/support/background-computer-use-probe.swift:6226-6231 | scripts/support/background-computer-use-probe.swift:6285-6290 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Coverage not measured — JavaScript/TypeScript and Swift suite — Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — the node:test suite in the repository root ran and not one test passed (throw new Error(), so the coverage would describe the failed run, not the code; the Swift half could not be measured — the Swift suite in . produced no coverage export. This repository's production source spans both ecosystems, and no partial figure is published as if it were the whole: coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan.
Duplicated block (34 lines × 2 locations) scripts/finalize-multi-target-certification.mjs:4083— scripts/finalize-multi-target-certification.mjs:4083 · scripts/run-live-multi-target-certification.mjs:181 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (30 lines × 2 locations) scripts/final-qualification/qualification-manifest.mjs:2935— scripts/final-qualification/qualification-manifest.mjs:2935 · scripts/final-qualification/qualification-manifest.mjs:3557 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (29 matched lines × 2 locations) · ×1
Duplicated block with local edits (29 matched lines × 2 locations) scripts/controller-source-manifest.mjs:9— scripts/controller-source-manifest.mjs:9 · scripts/validate-terminal-artifact-manifest.mjs:11 — the two spans are one implementation copied and then locally edited — 333 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (25 matched lines × 2 locations) · ×1
Duplicated block with local edits (25 matched lines × 2 locations) scripts/final-qualification/qualification-manifest.mjs:1946— scripts/final-qualification/qualification-manifest.mjs:1946 · scripts/final-qualification/validate-concurrent-run.mjs:191 — the two spans are one implementation copied and then locally edited — 163 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (24 lines × 2 locations) scripts/finalize-multi-target-certification.mjs:108— scripts/finalize-multi-target-certification.mjs:108 · scripts/run-live-multi-target-certification.mjs:84 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (21 lines × 2 locations) scripts/finalize-multi-target-certification.mjs:4376— scripts/finalize-multi-target-certification.mjs:4376 · scripts/finalize-multi-target-certification.mjs:5051 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (18 lines × 2 locations) scripts/finalize-multi-target-certification.mjs:4314— scripts/finalize-multi-target-certification.mjs:4314 · scripts/finalize-multi-target-certification.mjs:4992 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 3 locations) scripts/final-qualification/project-live-bindings.mjs:254— scripts/final-qualification/project-live-bindings.mjs:254 · scripts/final-qualification/publish-coordinator-marker.mjs:113 · scripts/final-qualification/validate-concurrent-run.mjs:1133 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (12 lines × 2 locations) scripts/final-qualification/executable-policy-scanner.mjs:1394— scripts/final-qualification/executable-policy-scanner.mjs:1394 · scripts/final-qualification/qualification-manifest.mjs:3845 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (12 matched lines × 2 locations) · ×1
Duplicated block with local edits (12 matched lines × 2 locations) scripts/final-qualification/lib.mjs:763— scripts/final-qualification/lib.mjs:763 · scripts/final-qualification/qualification-manifest.mjs:1964 — the two spans are one implementation copied and then locally edited — 71 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (12 lines × 4 locations) scripts/test-chrome-devtools-mcp-contract.mjs:264— scripts/test-chrome-devtools-mcp-contract.mjs:264 · scripts/test-chrome-devtools-mcp-contract.mjs:278 · scripts/test-chrome-devtools-mcp-contract.mjs:290 · scripts/test-chrome-devtools-mcp-contract.mjs:302 — all 4 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 3 locations) scripts/final-qualification/crash-inventory.mjs:146— scripts/final-qualification/crash-inventory.mjs:146 · scripts/final-qualification/executable-policy-scanner.mjs:1393 · scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:549 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 4 locations) scripts/finalize-multi-target-certification.mjs:728— scripts/finalize-multi-target-certification.mjs:728 · scripts/finalize-multi-target-certification.mjs:737 · scripts/finalize-multi-target-certification.mjs:746 · scripts/finalize-multi-target-certification.mjs:755 — all 4 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Complex function thinMachOSlice (cyclomatic 144, cognitive 235) scripts/final-qualification/executable-policy-scanner.mjs:806— thinMachOSlice has cyclomatic complexity 144 and cognitive complexity 235; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validateSuccessfulCertificationSummary (cyclomatic 137, cognitive 85) scripts/finalize-multi-target-certification.mjs:2870— validateSuccessfulCertificationSummary has cyclomatic complexity 137 and cognitive complexity 85; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function semanticProcessTree (cyclomatic 104, cognitive 32) scripts/final-qualification/qualification-manifest.mjs:632— semanticProcessTree has cyclomatic complexity 104 and cognitive complexity 32; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function parseCodeDirectory (cyclomatic 101, cognitive 72) scripts/final-qualification/executable-policy-scanner.mjs:187— parseCodeDirectory has cyclomatic complexity 101 and cognitive complexity 72; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function runCoordinator (cyclomatic 96, cognitive 95) scripts/run-live-multi-target-certification.mjs:1260— runCoordinator has cyclomatic complexity 96 and cognitive complexity 95; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function semanticConcurrentValidation (cyclomatic 93, cognitive 34) scripts/final-qualification/qualification-manifest.mjs:1513— semanticConcurrentValidation has cyclomatic complexity 93 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validateCatalog (cyclomatic 90, cognitive 62) scripts/finalize-multi-target-certification.mjs:627— validateCatalog has cyclomatic complexity 90 and cognitive complexity 62; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validateContract (cyclomatic 85, cognitive 69) scripts/finalize-multi-target-certification.mjs:821— validateContract has cyclomatic complexity 85 and cognitive complexity 69; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validateLiveMonitorEvidence (cyclomatic 82, cognitive 74) scripts/finalize-multi-target-certification.mjs:2301— validateLiveMonitorEvidence has cyclomatic complexity 82 and cognitive complexity 74; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validateObservationSemantics (cyclomatic 73, cognitive 49) scripts/finalize-multi-target-certification.mjs:1412— validateObservationSemantics has cyclomatic complexity 73 and cognitive complexity 49; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validateCertification (cyclomatic 70, cognitive 111) scripts/validate-background-computer-use-report.mjs:474— validateCertification has cyclomatic complexity 70 and cognitive complexity 111; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function extractAndCompare (cyclomatic 67, cognitive 78) scripts/validate-terminal-artifact-manifest.mjs:183— extractAndCompare has cyclomatic complexity 67 and cognitive complexity 78; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validatePlan (cyclomatic 64, cognitive 41) scripts/run-live-multi-target-certification.mjs:660— validatePlan has cyclomatic complexity 64 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validateCatalog (cyclomatic 63, cognitive 76) scripts/validate-background-computer-use-report.mjs:48— validateCatalog has cyclomatic complexity 63 and cognitive complexity 76; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validateCollectorReadiness (cyclomatic 59, cognitive 28) scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:265— validateCollectorReadiness has cyclomatic complexity 59 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validatePlaygroundAlertLifecycle (cyclomatic 57, cognitive 34) scripts/final-qualification/playground-alert-lifecycle.mjs:270— validatePlaygroundAlertLifecycle has cyclomatic complexity 57 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validateAgentExecutionResponse (cyclomatic 57, cognitive 31) scripts/final-qualification/lib.mjs:590— validateAgentExecutionResponse has cyclomatic complexity 57 and cognitive complexity 31; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function bindStreamPolicyImports (cyclomatic 54, cognitive 97) scripts/final-qualification/executable-policy-scanner.mjs:446— bindStreamPolicyImports has cyclomatic complexity 54 and cognitive complexity 97; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function verifyDigestClaims (cyclomatic 52, cognitive 40) scripts/finalize-multi-target-certification.mjs:3085— verifyDigestClaims has cyclomatic complexity 52 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validateCoordinationReceipt (cyclomatic 52, cognitive 17) scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:150— validateCoordinationReceipt has cyclomatic complexity 52 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function semanticHeldControllerResult (cyclomatic 51, cognitive 18) scripts/final-qualification/qualification-manifest.mjs:2425— semanticHeldControllerResult has cyclomatic complexity 51 and cognitive complexity 18; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function markdownToHtml (cyclomatic 49, cognitive 82) scripts/build-docs-site.mjs:267— markdownToHtml has cyclomatic complexity 49 and cognitive complexity 82; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function adjunct (cyclomatic 49, cognitive 37) scripts/final-qualification/qualification-manifest.mjs:2607— adjunct has cyclomatic complexity 49 and cognitive complexity 37; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function chainedStartsSegmentCount (cyclomatic 48, cognitive 84) scripts/final-qualification/executable-policy-scanner.mjs:661— chainedStartsSegmentCount has cyclomatic complexity 48 and cognitive complexity 84; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 48, cognitive 30) scripts/finalize-multi-target-certification.mjs:977— (anonymous) has cyclomatic complexity 48 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validateForegroundPostcondition (cyclomatic 47, cognitive 28) scripts/finalize-multi-target-certification.mjs:2508— validateForegroundPostcondition has cyclomatic complexity 47 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validateArchiveEntries (cyclomatic 44, cognitive 54) scripts/terminal-archive-policy.mjs:93— validateArchiveEntries has cyclomatic complexity 44 and cognitive complexity 54; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function collectProcessTree (cyclomatic 44, cognitive 34) scripts/final-qualification/process-tree-collector.mjs:385— collectProcessTree has cyclomatic complexity 44 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function chainedFixupPolicyImports (cyclomatic 43, cognitive 45) scripts/final-qualification/executable-policy-scanner.mjs:744— chainedFixupPolicyImports has cyclomatic complexity 43 and cognitive complexity 45; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function makeLiveCertificationContract (cyclomatic 41, cognitive 22) scripts/finalize-multi-target-certification.mjs:3613— makeLiveCertificationContract has cyclomatic complexity 41 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function machOEvidence (cyclomatic 37, cognitive 39) scripts/final-qualification/executable-policy-scanner.mjs:1084— machOEvidence has cyclomatic complexity 37 and cognitive complexity 39; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validateOperationSemantics (cyclomatic 36, cognitive 28) scripts/finalize-multi-target-certification.mjs:1513— validateOperationSemantics has cyclomatic complexity 36 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 36, cognitive 22) scripts/finalize-multi-target-certification.mjs:2979— (anonymous) has cyclomatic complexity 36 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 35, cognitive 34) scripts/run-live-multi-target-certification.mjs:965— (anonymous) has cyclomatic complexity 35 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function decodeBundle (cyclomatic 35, cognitive 25) scripts/finalize-multi-target-certification.mjs:1677— decodeBundle has cyclomatic complexity 35 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validateZipLocalEntries (cyclomatic 34, cognitive 53) scripts/terminal-archive-policy.mjs:447— validateZipLocalEntries has cyclomatic complexity 34 and cognitive complexity 53; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function codeDirectoryIdentifiers (cyclomatic 34, cognitive 36) scripts/final-qualification/executable-policy-scanner.mjs:185— codeDirectoryIdentifiers has cyclomatic complexity 34 and cognitive complexity 36; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function semanticPeekabooArtifactManifest (cyclomatic 34, cognitive 25) scripts/final-qualification/qualification-manifest.mjs:261— semanticPeekabooArtifactManifest has cyclomatic complexity 34 and cognitive complexity 25; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function validateNotary (cyclomatic 34, cognitive 17) scripts/validate-terminal-artifact-manifest.mjs:372— validateNotary has cyclomatic complexity 34 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function semanticValidatorPair (cyclomatic 34, cognitive 16) scripts/final-qualification/qualification-manifest.mjs:1937— semanticValidatorPair has cyclomatic complexity 34 and cognitive complexity 16; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R4 · Test Coverage· This test file cannot be loaded · ×1
This test file cannot be loaded tests/codeql-build-graph.test.mjs:228— tests/codeql-build-graph.test.mjs:228 imports '../Apps/CLI/Sources/PeekabooExec/', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
R6 · Tooling· The declared test suite includes a file that cannot be loaded · ×1
The declared test suite includes a file that cannot be loaded tests/codeql-build-graph.test.mjs:228— This repository declares test tooling, and the ✓ above records that declaration — but tests/codeql-build-graph.test.mjs cannot be loaded at all: it imports a module that names no file in this repository, so the runner throws while collecting it and none of its cases execute. The wiring is present and the suite it points at does not run as written, which is why the tooling tick must not be read as a statement that the tests pass. Fix the unloadable file(s) — each one is reported with its failing import under Test Coverage — then the declared script exercises what it claims to.
Duplicated predicate scripts/controller-source-manifest.mjs:12— `!Number.isFinite(value) || Object.is(value, -0) || (Number.isInteger(value) && !Number.isSafeInteger(value))` appears character-identically in 4 files — scripts/controller-source-manifest.mjs, scripts/finalize-multi-target-certification.mjs, scripts/run-live-multi-target-certification.mjs, scripts/validate-terminal-artifact-manifest.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:75— `!display.error && display.status === 0 && matches.length === 1` appears character-identically in 3 files — scripts/final-qualification/publish-agent-execution-acknowledgement.mjs, scripts/final-qualification/qualification-manifest.mjs, scripts/final-qualification/validate-concurrent-run.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/controller-source-manifest.mjs:17— `!value || typeof value !== 'object' || Array.isArray(value)` appears character-identically in 5 files — scripts/controller-source-manifest.mjs, scripts/final-qualification/lib.mjs, scripts/finalize-multi-target-certification.mjs, scripts/run-live-multi-target-certification.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/final-qualification/process-tree-collector.mjs:140— `!verification.error && verification.status === 0` appears character-identically in 2 files — scripts/final-qualification/process-tree-collector.mjs, scripts/finalize-multi-target-certification.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/final-qualification/construct-live-plan.mjs:20— `Number.isSafeInteger(value) && value > 0` appears character-identically in 4 files — scripts/final-qualification/construct-live-plan.mjs, scripts/final-qualification/lib.mjs, scripts/final-qualification/playground-alert-lifecycle.mjs, scripts/finalize-multi-target-certification.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/run-live-multi-target-certification.mjs:510— `child.exitCode === null && child.signalCode === null` appears character-identically in 2 files — scripts/run-live-multi-target-certification.mjs, scripts/test-browser-provider-connection.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/final-qualification/executable-policy-scanner.mjs:1184— `component === '' || component === '.' || component === '..'` appears character-identically in 2 files — scripts/final-qualification/executable-policy-scanner.mjs, scripts/final-qualification/qualification-manifest.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/final-qualification/playground-alert-lifecycle.mjs:86— `entry.isFile() && entry.name.endsWith('.json')` appears character-identically in 2 files — scripts/final-qualification/playground-alert-lifecycle.mjs, scripts/final-qualification/validate-concurrent-run.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/finalize-multi-target-certification.mjs:2416— `heartbeat.attributedForegroundEventCount !== 0 || heartbeat.attributedForegroundSourcePIDs.length !== 0 || heartbeat.foregroundActivityObser…` appears character-identically in 2 files — scripts/finalize-multi-target-certification.mjs, scripts/run-live-multi-target-certification.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/final-qualification/qualification-manifest.mjs:2265— `index === 0 || actionIntervals[index - 1].completed_at_milliseconds` appears character-identically in 2 files — scripts/final-qualification/qualification-manifest.mjs, scripts/final-qualification/validate-concurrent-run.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/final-qualification/process-tree-collector.mjs:301— `index === 0 || roots[index - 1].root_id < root.root_id` appears character-identically in 2 files — scripts/final-qualification/process-tree-collector.mjs, scripts/final-qualification/publish-agent-execution-acknowledgement.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/final-qualification/publish-agent-execution-acknowledgement.mjs:297— `index === 0 || value.lifecycle_watched_pids[index - 1] < pid` appears character-identically in 2 files — scripts/final-qualification/publish-agent-execution-acknowledgement.mjs, scripts/final-qualification/qualification-manifest.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/finalize-multi-target-certification.mjs:491— `inner.x >= outer.x && inner.y >= outer.y && inner.x + inner.width <= outer.x + outer.width && inner.y + inner.height <= outer.y + outer.heig…` appears character-identically in 2 files — scripts/finalize-multi-target-certification.mjs, scripts/run-live-multi-target-certification.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/final-qualification/lib.mjs:956— `names.includes(name) && result[name] === undefined` appears character-identically in 2 files — scripts/final-qualification/lib.mjs, scripts/final-qualification/playground-alert-lifecycle.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/final-qualification/lib.mjs:1089— `positiveInteger(value.pid) && positiveDecimal(value.start_identity)` appears character-identically in 2 files — scripts/final-qualification/lib.mjs, scripts/final-qualification/validate-concurrent-run.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/final-qualification/lib.mjs:23— `prototype === Object.prototype || prototype === null` appears character-identically in 3 files — scripts/final-qualification/lib.mjs, scripts/finalize-multi-target-certification.mjs, scripts/run-live-multi-target-certification.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/final-qualification/managed-launcher.mjs:83— `typeof entry === 'string' && !entry.includes('\0')` appears character-identically in 2 files — scripts/final-qualification/managed-launcher.mjs, scripts/final-qualification/publish-agent-execution-acknowledgement.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/finalize-multi-target-certification.mjs:3328— `typeof process.geteuid === 'function' && info.uid !== process.geteuid()` appears character-identically in 2 files — scripts/finalize-multi-target-certification.mjs, scripts/run-live-multi-target-certification.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/final-qualification/lib.mjs:235— `typeof value !== 'string' || !POSITIVE_DECIMAL.test(value)` appears character-identically in 2 files — scripts/final-qualification/lib.mjs, scripts/run-live-multi-target-certification.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/finalize-multi-target-certification.mjs:350— `typeof value === 'number' && Number.isFinite(value) && !Object.is(value, -0) && (!Number.isInteger(value) || Number.isSafeInteger(value))` appears character-identically in 2 files — scripts/finalize-multi-target-certification.mjs, scripts/run-live-multi-target-certification.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/final-qualification/construct-live-plan.mjs:24— `typeof value === 'string' && /^[1-9][0-9]*$/.test(value)` appears character-identically in 2 files — scripts/final-qualification/construct-live-plan.mjs, scripts/final-qualification/playground-alert-lifecycle.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/final-qualification/qualification-manifest.mjs:468— `value && typeof value === 'object' && !Array.isArray(value)` appears character-identically in 2 files — scripts/final-qualification/qualification-manifest.mjs, scripts/validate-terminal-artifact-manifest.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/final-qualification/construct-live-plan.mjs:118— `value === null || ( typeof value === 'string' && value.length > 0 && !value.includes('\0') && Buffer.byteLength(value) <= 1024 )` appears character-identically in 2 files — scripts/final-qualification/construct-live-plan.mjs, scripts/final-qualification/project-live-bindings.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/controller-source-manifest.mjs:10— `value === null || typeof value === 'boolean' || typeof value === 'string'` appears character-identically in 3 files — scripts/controller-source-manifest.mjs, scripts/finalize-multi-target-certification.mjs, scripts/validate-terminal-artifact-manifest.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate scripts/final-qualification/lib.mjs:37— `value === null || typeof value === 'string' || typeof value === 'boolean'` appears character-identically in 2 files — scripts/final-qualification/lib.mjs, scripts/run-live-multi-target-certification.mjs. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Silent fallback default in catch Apps/CLI/Sources/PeekabooCLI/Commands/System/DaemonCommand.swift:564— `discoveredHistoricalBuildScopedSocketPaths` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/DaemonLaunchPolicy.swift:141— `executableUUIDs` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Support/SnapshotManager+Helpers.swift:220— `snapshotDirectoryURLsUnlocked` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentCompatibilityTypes.swift:394— `listSessions` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:1358— `toolCompletionTextPayload` turns every thrown error into `"{}"` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeAgentExecutionSupport.swift:797— `argumentsSHA256` turns every thrown error into `""` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Core/PeekabooCore/Sources/PeekabooBridge/PeekabooBridgeDesktopObservationBinding.swift:467— `validateOutputOptions` turns every thrown error into `"inline capture content digest"` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch Apps/Mac/Peekaboo/Features/Settings/SettingsWindow.swift:739— `probeOllamaModels` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch scripts/support/background-computer-use-probe.swift:4830— `decodeJSONLines` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
Silent fallback default in catch scripts/final-qualification/lib.mjs:55— `sameJSON` swallows every exception into `return false` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch scripts/finalize-multi-target-certification.mjs:448— `sameJSON` swallows every exception into `return false` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch scripts/run-live-multi-target-certification.mjs:120— `sameJSON` swallows every exception into `return false` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Orphaned file Apps/CLI/Sources/PeekabooCLI/CLI/Completions/CompletionModel.swift:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file Apps/CLI/Sources/PeekabooCLI/CLI/Completions/BashCompletionRenderer.swift:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file Apps/CLI/Sources/PeekabooCLI/CLI/Completions/ZshCompletionRenderer.swift:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file Apps/CLI/Sources/PeekabooCLI/CLI/Completions/FishCompletionRenderer.swift:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file Apps/CLI/Sources/PeekabooCLI/Commands/Core/CompletionsCommand.swift:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file Apps/CLI/TestFixtures/BackgroundHotkeyProbe/Sources/BackgroundHotkeyProbe/main.swift:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
D21 · Naming Consistency· `durationMS` spells `MS` where 36 names in the project spell it `Ms` · ×2
`durationMS` spells `MS` where 36 names in the project spell it `Ms` Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationResultModels.swift:7— 36 of 38 names in project Core~PeekabooAutomationKit~PeekabooAutomationKit spell the token `Ms` (36 of 38; unit: names in project Core~PeekabooAutomationKit~PeekabooAutomationKit containing `Ms`). Peers: CaptureFrameInfo.timestampMs (Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureFrameModels.swift:15); CaptureFrameInfo.init(timestampMs) (Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureFrameModels.swift:25); CaptureStats.totalDurationMs (Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureFrameModels.swift:50); CaptureStats.samplingDurationMs (Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureFrameModels.swift:52); CaptureStats.durationMs (Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureFrameModels.swift:75). Rename to `durationMs`. [rule N6]
`durationMS` spells `MS` where 36 names in the project spell it `Ms` Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Services/Observation/DesktopObservationResultModels.swift:10— 36 of 38 names in project Core~PeekabooAutomationKit~PeekabooAutomationKit spell the token `Ms` (36 of 38; unit: names in project Core~PeekabooAutomationKit~PeekabooAutomationKit containing `Ms`). Peers: CaptureFrameInfo.timestampMs (Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureFrameModels.swift:15); CaptureFrameInfo.init(timestampMs) (Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureFrameModels.swift:25); CaptureStats.totalDurationMs (Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureFrameModels.swift:50); CaptureStats.samplingDurationMs (Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureFrameModels.swift:52); CaptureStats.durationMs (Core/PeekabooAutomationKit/Sources/PeekabooAutomationKit/Core/Models/CaptureFrameModels.swift:75). Rename to `durationMs`. [rule N6]
D21 · Naming Consistency· `ollamaBaseUrl` spells `Url` where 74 names in the project spell it `URL` · ×2
`ollamaBaseUrl` spells `Url` where 74 names in the project spell it `URL` Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/Configuration.swift:49— 74 of 76 names in project Core~PeekabooCore~PeekabooAgentRuntime spell the token `URL` (74 of 76; unit: names in project Core~PeekabooCore~PeekabooAgentRuntime containing `URL`). Peers: AgentSessionManager.sessionFileURL (Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentCompatibilityTypes.swift:456); AgentExecutionTraceSanitizer.looksLikeURL (Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentExecutionTrace.swift:879); AgentProcessLimitProbeProvider.baseURL (Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+ProcessLimitProbe.swift:7); ReasoningReplayTarget.baseURL (Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:1482); BrowserMCPChannelEndpointReservation.browserURL (Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPChannelEndpointResolver.swift:13). Rename to `ollamaBaseURL`. [rule N6]
`ollamaBaseUrl` spells `Url` where 74 names in the project spell it `URL` Core/PeekabooCore/Sources/PeekabooAutomation/Configuration/Configuration.swift:51— 74 of 76 names in project Core~PeekabooCore~PeekabooAgentRuntime spell the token `URL` (74 of 76; unit: names in project Core~PeekabooCore~PeekabooAgentRuntime containing `URL`). Peers: AgentSessionManager.sessionFileURL (Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentCompatibilityTypes.swift:456); AgentExecutionTraceSanitizer.looksLikeURL (Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/AgentExecutionTrace.swift:879); AgentProcessLimitProbeProvider.baseURL (Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+ProcessLimitProbe.swift:7); ReasoningReplayTarget.baseURL (Core/PeekabooCore/Sources/PeekabooAgentRuntime/Agent/PeekabooAgentService+Streaming.swift:1482); BrowserMCPChannelEndpointReservation.browserURL (Core/PeekabooCore/Sources/PeekabooAgentRuntime/Browser/BrowserMCPChannelEndpointResolver.swift:13). Rename to `ollamaBaseURL`. [rule N6]
No ADRs found package.json:8— No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `package.json` makes this repository a deployable product (line 8).
D21 · Naming Consistency· `browserUrl` spells `Url` where 67 names in the project spell it `URL` · ×1
`browserUrl` spells `Url` where 67 names in the project spell it `URL` Apps/CLI/Sources/PeekabooCLI/Commands/MCP/BrowserCommand.swift:41— 67 of 68 names in project Apps~CLI~PeekabooCLI spell the token `URL` (67 of 68; unit: names in project Apps~CLI~PeekabooCLI containing `URL`). Peers: ConfigurationManager.getOllamaBaseURL (Apps/CLI/Sources/PeekabooCLI/CLI/Configuration/CLIConfiguration.swift:87); SeeCommand.makeOutputURL (Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelCaptureFiles.swift:37); SeeCommand.makePixelObservationRequest(outputURL) (Apps/CLI/Sources/PeekabooCLI/Commands/AI/SeeCommand+PixelObservationRequest.swift:56); DaemonLaunchPolicy.launchDaemon(executableURL) (Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/DaemonLaunchPolicy+Launch.swift:101); DaemonLaunchPolicy.runtimeBuildIdentity(executableURL) (Apps/CLI/Sources/PeekabooCLI/Commands/Base/Runtime/DaemonLaunchPolicy.swift:71). Rename to `browserURL`. [rule N6]
D21 · Naming Consistency· `highlightJson` spells `Json` where 18 names in the project spell it `JSON` · ×1
`highlightJson` spells `Json` where 18 names in the project spell it `JSON` scripts/build-docs-site.mjs:885— 18 of 19 names in project @steipete/peekaboo spell the token `JSON` (18 of 19; unit: names in project @steipete/peekaboo containing `JSON`). Peers: lib.sameJSON (scripts/final-qualification/lib.mjs:52); lib.decodeCanonicalBase64JSON (scripts/final-qualification/lib.mjs:205); lib.readStableJSON (scripts/final-qualification/lib.mjs:353); lib.readStableJSONLines (scripts/final-qualification/lib.mjs:365); playground-alert-lifecycle.readJSONReference (scripts/final-qualification/playground-alert-lifecycle.mjs:61). Rename to `highlightJSON`. [rule N6]
D21 · Naming Consistency· `caseId` spells `Id` where 19 names in the project spell it `ID` · ×1
`caseId` spells `Id` where 19 names in the project spell it `ID` scripts/validate-background-computer-use-report.mjs:9— 19 of 20 names in project @steipete/peekaboo spell the token `ID` (19 of 20; unit: names in project @steipete/peekaboo containing `ID`). Peers: qualification-manifest.derivedHeldPointerClientID (scripts/final-qualification/qualification-manifest.mjs:2412); validate-concurrent-run.operationInterval(monitorID) (scripts/final-qualification/validate-concurrent-run.mjs:119); validate-concurrent-run.agentBundleCorpus(expectedListenerInstanceID) (scripts/final-qualification/validate-concurrent-run.mjs:460); finalize-multi-target-certification.failure(slotID) (scripts/finalize-multi-target-certification.mjs:106); finalize-multi-target-certification.deterministicRequestID (scripts/finalize-multi-target-certification.mjs:375). Rename to `caseID`. [rule N6]
redundant comment REDACTED:238— 5 comments in this file only repeat the code they sit on (lines 238, 299, 306, 693, 697), for example "Check if node_modules exists". Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 4 of 13 project(s) overshoot their size bounds, lowering Project Cohesion to 4.0/10. The most over is `Core/PeekabooCore` (96707 LoC, 735 module-visible types across 23 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history)· Rotate the exposed credentials · ×1
REDACTED
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 6 of 866 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 866 of the 1106 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: Apps/CLI/Sources/PeekabooCLI/CLI/Completions/CompletionModel.swift, Apps/CLI/Sources/PeekabooCLI/CLI/Completions/BashCompletionRenderer.swift, Apps/CLI/Sources/PeekabooCLI/CLI/Completions/ZshCompletionRenderer.swift, Apps/CLI/Sources/PeekabooCLI/CLI/Completions/FishCompletionRenderer.swift, Apps/CLI/Sources/PeekabooCLI/Commands/Core/CompletionsCommand.swift, Apps/CLI/TestFixtures/BackgroundHotkeyProbe/Sources/BackgroundHotkeyProbe/main.swift. Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
Logging is not universal — Only 7/12 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `.`, `Apps/CLI/TestFixtures/BackgroundHotkeyProbe`, `Apps/CLI/TestHost`, `Apps/PeekabooInspector`.
No dependency-update automation package.json:95— `package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
R7 · Dead Code· Unused export 'EXPECTED_ROOT_COMMAND_COUNT' · ×1
Unused export 'EXPECTED_ROOT_COMMAND_COUNT' scripts/release-preflight-contract.mjs:4— Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code· Unused module-local declaration 'productTagline' · ×1
Unused module-local declaration 'productTagline' scripts/build-docs-site.mjs:18— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code· Unused module-local declaration 'crc32' · ×1
Unused module-local declaration 'crc32' scripts/terminal-archive-policy.mjs:225— This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
X5 · Nullable reference types· Ruby's type checker does not check nil everywhere · ×1
Ruby's type checker does not check nil everywhere — This repository commits no Sorbet configuration (`sorbet/config`) and no `Steepfile`, so nothing type-checks its 1 Ruby product file(s): a nilable value reaches a method call silently and raises `NoMethodError: undefined method … for nil` the first time it is nil. A `# typed:` sigil does nothing without a `sorbet/config` beside the code; a Steep run configured only on a command line is not something this check can read.
Subsumed condition operand Apps/CLI/Sources/PeekabooCLI/Commands/Interaction/ClickCommand+Validation.swift:147— `query.hasPrefix("//")` can never decide this `||` — every value satisfying `query.hasPrefix("//")` also satisfies `query.hasPrefix("/")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Skipped (documented): Apps/Mac/PeekabooTests/TachikomaCredentialInteropTests.swift:13— Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
Skipped (documented): Apps/CLI/Tests/CLIAutomationTests/AgentIntegrationTests.swift:16— Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
Skipped (documented): Apps/CLI/Tests/CLIAutomationTests/AgentMenuTests.swift:23— Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
Skipped (documented): Apps/CLI/Tests/CLIAutomationTests/AnnotationIntegrationTests.swift:17— Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
Skipped (documented): Apps/CLI/Tests/CLIAutomationTests/EnhancedErrorIntegrationTests.swift:16— Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
Skipped (documented): Apps/CLI/Tests/CLIAutomationTests/PIDTargetingTests.swift:9— Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
Skipped (documented): Apps/Mac/PeekabooTests/Integration/EndToEndTests.swift:25— Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
Skipped (documented): Core/PeekabooCore/Tests/PeekabooTests/MessageContentAudioTests.swift:132— Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
Outdated: sparkle — `sparkle` is resolved at 2.10.0, but 2.10.1 is the newest release tagged on https://github.com/sparkle-project/Sparkle within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update sparkle` reaches this one with no change to Package.swift.
Outdated: swift-configuration — `swift-configuration` is resolved at 1.4.0, but 1.5.0 is the newest release tagged on https://github.com/apple/swift-configuration within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-configuration` reaches this one with no change to Package.swift.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 310 file(s) — `Apps/CLI/Sources/PeekabooCLI/CLI/CommanderMigrationAdvisor.swift`, `Apps/CLI/Sources/PeekabooCLI/CLI/CommanderRuntimeExecutor.swift`, `Apps/CLI/Sources/PeekabooCLI/CLI/CommanderRuntimeRouter+Help.swift`, `Apps/CLI/Sources/PeekabooCLI/CLI/CommanderRuntimeRouter.swift`, `Apps/CLI/Sources/PeekabooCLI/CLI/Output/CLILogger.swift`, … (+305 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a1dc0c-f710-77f3-85a8-e9352b83d011 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 31 · Warnings: 2766 · Recommendations: 81 · Info: 10 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 14-11-2026 @ 21:53 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.