Public report of herdrdev/herdr, 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, 15:01 UTC · Survey ID cd_bf5ace7a1c794a948f0b6bf47dfada94
herdrdev/herdr
Measured 14 November 2026, 15:01 UTC, at code version ee5bfb5
CAI scoreAdequate
CriticalWeakAdequateStrongExemplary
Down 8 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: 251,757 lines of product code in 2 projects, tests not counted · Estimated rebuild effort: about 2.6 person-years · Weakest lens: Code Health, 52
Findings by how serious they are
2 critical1004 serious51 minor
14 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, 15:01 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 ▸
43of 43 dimensions measured by tools.
1041of 1057 findings point to an exact file and line, so you can open each one in the code. The other 16 concern the repository as a whole, such as missing documentation.
43dimensions across 8 lenses, read from 251,757 lines of product code in 2 projects.
herdrdev/herdr falls short of our standard for a preview release, held back most by its Code Health lens, the quality of the code itself. It scores 59 out of 100 and is rated Adequate, and both of its critical findings are security problems in its automatic dependency updates and in its code.
Code Health, at 52, is the weakest lens and counts most in the score. The best first step for the work it takes is recording design decisions, worth about 3 points. Turning on missing-value checks would lift Code Health itself, worth about 6 points. Raising Code Health to 67 would lift the score to about 64.
One automatic update takes new releases before a bad one can be spotted. One weakness in the code could be used by an attacker. Setting a waiting period for automatic updates and fixing the weaknesses the scanner points to would close both risks.
The product code is 251,757 lines, about €380,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 52 to 67, the lowest score rated Strong, the score would rise from 59 to about 64.
Code composition: what the lines of code are
Business logic 1%Supporting code 0%Tests 99%
New since the last survey: 199 findings
These 199 critical or serious findings weren't in the previous survey, on 27 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
Code Duplication · Near-duplicate member pair (183 shared lines) src/pane.rs
Code Duplication · Near-duplicate member pair (84 shared lines) src/client/shell/overlays.rs
Code Duplication · Members sharing a duplicated core (17 members, 50+ identical tokens) src/app/state.rs
Code Duplication · Edited copy of a member (86 corresponding lines) src/pane/osc.rs
Code Duplication · Edited copy of a member (40 corresponding lines) src/app/api/panes.rs
Code Duplication · Edited copy of a member (43 corresponding lines) src/ui/sidebar/tokens.rs
Code Duplication · Edited copy of a member (44 corresponding lines) src/client/shell_runtime.rs
Code Duplication · Edited copy of a member (37 corresponding lines) src/api/subscriptions.rs
Code Duplication · Edited copy of a member (24 corresponding lines) src/platform/linux.rs
Code Duplication · Edited copy of a member (32 corresponding lines) src/protocol/render_ansi.rs
Code Duplication · Edited copy of a member (43 corresponding lines) src/update.rs
Code Duplication · Edited copy of a member (30 corresponding lines) src/pty/actor.rs
Code Duplication · Edited copy of a member (24 corresponding lines) src/client/endpoint/activation.rs
Code Duplication · Edited copy of a member (19 corresponding lines) src/app/api/panes.rs
Code Duplication · Edited copy of a member (33 corresponding lines) src/integration/claude_settings.rs
Code Duplication · Edited copy of a member (28 corresponding lines) crates/ghostty-vt/src/pane_graphics_files.rs
Code Duplication · Edited copy of a member (25 corresponding lines) src/detect/manifest.rs
Code Duplication · Edited copy of a member (25 corresponding lines) src/workspace.rs
Code Duplication · Edited copy of a member (28 corresponding lines) src/detect/mod.rs
Code Duplication · Edited copies of one member (3 members, 34+ corresponding lines) src/integration/targets.rs
Code Duplication · Edited copy of a member (26 corresponding lines) src/pty/actor.rs
Code Duplication · Edited copy of a member (18 corresponding lines) src/app/actions.rs
Code Duplication · Edited copy of a member (18 corresponding lines) src/app/api/plugins/mod.rs
Code Duplication · Edited copy of a member (15 corresponding lines) src/config/io.rs
Code Duplication · Edited copies of one member (3 members, 29+ corresponding lines) src/config/keybinds.rs
Code Duplication · Edited copy of a member (20 corresponding lines) src/persist/io.rs
Code Duplication · Edited copy of a member (15 corresponding lines) src/persist/writer.rs
Code Duplication · Edited copy of a member (17 corresponding lines) src/integration/config_edit.rs
Code Duplication · Edited copy of a member (14 corresponding lines) src/product_announcements.rs
Code Duplication · Edited copies of one member (3 members, 17+ corresponding lines) src/integration/config_edit.rs
Code Duplication · Edited copy of a member (18 corresponding lines) src/pane/terminal.rs
Code Duplication · Edited copies of one member (3 members, 7+ corresponding lines) src/api/schema/common.rs
Code Duplication · Edited copy of a member (20 corresponding lines) src/app/creation.rs
Code Duplication · Edited copy of a member (18 corresponding lines) src/cli/plugin.rs
Code Duplication · Edited copy of a member (23 corresponding lines) src/platform/linux.rs
Code Duplication · Edited copy of a member (25 corresponding lines) src/app/popup.rs
Code Duplication · Edited copy of a member (18 corresponding lines) src/pty/fd.rs
Code Duplication · Edited copy of a member (23 corresponding lines) crates/ghostty-vt/src/lib.rs
Code Duplication · Edited copy of a member (16 corresponding lines) src/app/api/panes.rs
Code Duplication · Edited copy of a member (13 corresponding lines) src/pty/actor/unix.rs
Code Duplication · Edited copy of a member (12 corresponding lines) src/client/endpoint/activation.rs
Code Duplication · Edited copy of a member (12 corresponding lines) src/integration/env.rs
Code Duplication · Edited copies of one member (3 members, 24+ corresponding lines) src/integration/targets.rs
Code Duplication · Edited copy of a member (20 corresponding lines) src/cli/integration.rs
Code Duplication · Edited copy of a member (15 corresponding lines) src/platform/linux/power.rs
Code Duplication · Edited copy of a member (15 corresponding lines) src/detect/manifest.rs
Code Duplication · Edited copies of one member (4 members, 18+ corresponding lines) crates/ghostty-vt/src/lib.rs
Code Duplication · Edited copies of one member (4 members, 14+ corresponding lines) src/platform/fallback.rs
Code Duplication · Edited copy of a member (18 corresponding lines) src/app/runtime.rs
Code Duplication · Edited copies of one member (4 members, 19+ corresponding lines) src/cli.rs
Code Duplication · Edited copy of a member (16 corresponding lines) src/platform/macos.rs
Code Duplication · Edited copy of a member (13 corresponding lines) src/pane/terminal.rs
Code Duplication · Edited copy of a member (15 corresponding lines) crates/ghostty-vt/src/pane_graphics_files.rs
Code Duplication · Edited copy of a member (14 corresponding lines) src/platform/linux.rs
Code Duplication · Edited copies of one member (3 members, 15+ corresponding lines) crates/ghostty-vt/src/lib.rs
Code Duplication · Edited copy of a member (13 corresponding lines) src/client/shell/overlays.rs
Code Duplication · Edited copy of a member (21 corresponding lines) src/pane/terminal.rs
Code Duplication · Edited copy of a member (18 corresponding lines) src/app/api/plugins/context.rs
Code Duplication · Edited copy of a member (19 corresponding lines) src/platform/linux.rs
Code Duplication · Edited copy of a member (20 corresponding lines) REDACTED
Code Duplication · Edited copy of a member (11 corresponding lines) src/cli/plugin.rs
Code Duplication · Edited copy of a member (17 corresponding lines) src/cli/plugin.rs
Code Duplication · Edited copy of a member (16 corresponding lines) src/integration/config_edit.rs
Code Duplication · Edited copy of a member (10 corresponding lines) src/pty/fd.rs
Code Duplication · Edited copy of a member (21 corresponding lines) REDACTED
Code Duplication · Edited copy of a member (12 corresponding lines) src/cli/plugin.rs
Code Duplication · Edited copy of a member (15 corresponding lines) src/update.rs
Code Duplication · Edited copy of a member (15 corresponding lines) src/app/api/workspaces.rs
Code Duplication · Edited copy of a member (14 corresponding lines) src/cli/plugin.rs
Code Duplication · Edited copy of a member (6 corresponding lines) src/platform/linux.rs
Code Duplication · Edited copy of a member (17 corresponding lines) src/app/state.rs
Code Duplication · Edited copy of a member (13 corresponding lines) src/cli/plugin.rs
Code Duplication · Edited copy of a member (22 corresponding lines) src/update.rs
Code Duplication · Edited copies of one member (4 members, 19+ corresponding lines) src/pane/terminal.rs
Code Duplication · Edited copy of a member (12 corresponding lines) src/app/agent_resume.rs
Code Duplication · Edited copy of a member (14 corresponding lines) src/terminal/state.rs
Code Duplication · Edited copy of a member (21 corresponding lines) src/pane.rs
Code Duplication · Edited copy of a member (14 corresponding lines) crates/ghostty-vt/src/pane_graphics_files.rs
Code Duplication · Edited copy of a member (8 corresponding lines) src/ui/panes.rs
Code Duplication · Edited copy of a member (19 corresponding lines) src/app/api/plugins/context.rs
Code Duplication · Edited copy of a member (10 corresponding lines) src/platform/windows.rs
Code Duplication · Edited copies of one member (3 members, 16+ corresponding lines) src/server/headless/client_views.rs
Code Duplication · Edited copy of a member (13 corresponding lines) src/client/state.rs
Code Duplication · Edited copy of a member (8 corresponding lines) src/detect/manifest_update.rs
Code Duplication · Edited copy of a member (7 corresponding lines) src/integration/claude_settings.rs
Code Duplication · Edited copy of a member (19 corresponding lines) src/layout.rs
Code Duplication · Edited copy of a member (10 corresponding lines) src/logging.rs
Code Duplication · Edited copy of a member (13 corresponding lines) crates/ghostty-vt/src/lib.rs
Code Duplication · Edited copy of a member (13 corresponding lines) src/pane.rs
Code Duplication · Edited copy of a member (9 corresponding lines) src/app/api/tabs.rs
Code Duplication · Edited copy of a member (9 corresponding lines) src/integration/config_edit.rs
Code Duplication · Edited copy of a member (10 corresponding lines) src/pane/terminal.rs
Code Duplication · Edited copy of a member (16 corresponding lines) src/platform/linux.rs
Code Duplication · Edited copy of a member (8 corresponding lines) src/terminal_theme.rs
Code Duplication · Edited copy of a member (13 corresponding lines) src/worktree.rs
Code Duplication · Edited copies of one member (3 members, 9+ corresponding lines) src/app/agent_view.rs
Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) src/app/api/plugins/manifest.rs
Code Duplication · Edited copy of a member (10 corresponding lines) src/platform/mod.rs
Code Duplication · Edited copy of a member (14 corresponding lines) src/cli.rs
Code Duplication · Edited copy of a member (13 corresponding lines) src/pane/terminal.rs
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: 74 findings
These 74 critical or serious findings were in the previous survey, on 27 October 2026, and are gone from this one.
€130,000 to €640,000, for 2,127 to 6,750 hours of work, about 2.6 person-years for 1 to 6 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.8 at a score of 59. 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: 251,757 lines of product code
Comment lines
The estimate prices 251,751 lines. Comment lines count towards the size of 251,757 lines but aren't priced as work.
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.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with main.rs.
Raises the score by about 3 points · Low effort · ADR Quality
2
Put every file in a nullable-enabled context — `#nullable enable` at its top, or commit a project file with <Nullable>enable</Nullable> — and resolve warnings rather than suppressing with `!`.
Bring the 2 bodies over 240 down to 240 or less in Cognitive Complexity — start with herdr::client::run_client_loop (cognitive 724), ClientShellState::handle_mouse (cognitive 515).
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 €380,000 to build again, about 2.6 person-years of work. Its weakest lens is Code Health, at 52 (Adequate). 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
Resolve the 1 No ADRs found finding(s) in ADR Quality. Of all the actions in this report, it raises the score most for the work it takes: about 3 points for low effort, because it clears the 1 ADR Quality findings. 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.4 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 4% to 9% on every change. The history of the code shows how much it changes: about 397,937 lines over the last 90 days, which is about 1,613,856 lines a year. At that pace, the extra work comes to an estimated 162.7 to 976.3 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.
358 modules, with 870 dependencies between them. 9 loops run through 34 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 318 more are left out to keep it readable.
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.
herdr.api.schema.agents uses herdr.api.schema.common, so a change to herdr.api.schema.common can break herdr.api.schema.agents, while a change to herdr.api.schema.agents can't break herdr.api.schema.common.
Position
Below the diagonal: herdr.api.schema.agents uses a module listed above it, which is the healthy direction.
9→19 herdr.config.model uses herdr.config.keybindspart of a loop✕
Connections
8 pairs of types, where a type in herdr.config.model uses a type in herdr.config.keybinds.
herdr.config.model uses herdr.config.keybinds, so a change to herdr.config.keybinds can break herdr.config.model, while a change to herdr.config.model can't break herdr.config.keybinds.
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.
herdr.terminal_theme uses herdr.protocol.wire, so a change to herdr.protocol.wire can break herdr.terminal_theme, while a change to herdr.terminal_theme can't break herdr.protocol.wire.
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.
portable_pty uses portable_pty.cmdbuilder, so a change to portable_pty.cmdbuilder can break portable_pty, while a change to portable_pty can't break portable_pty.cmdbuilder.
Position
Below the diagonal: portable_pty uses a module listed above it, which is the healthy direction.
herdr.api.schema.panes uses herdr.api.schema.common, so a change to herdr.api.schema.common can break herdr.api.schema.panes, while a change to herdr.api.schema.panes can't break herdr.api.schema.common.
Position
Below the diagonal: herdr.api.schema.panes uses a module listed above it, which is the healthy direction.
herdr.api.schema.panes uses herdr.api.schema.agents, so a change to herdr.api.schema.agents can break herdr.api.schema.panes, while a change to herdr.api.schema.panes can't break herdr.api.schema.agents.
Position
Below the diagonal: herdr.api.schema.panes uses a module listed above it, which is the healthy direction.
herdr.platform uses portable_pty.cmdbuilder, so a change to portable_pty.cmdbuilder can break herdr.platform, while a change to herdr.platform can't break portable_pty.cmdbuilder.
Position
Below the diagonal: herdr.platform uses a module listed above it, which is the healthy direction.
herdr.protocol.wire uses ghostty_vt, so a change to ghostty_vt can break herdr.protocol.wire, while a change to herdr.protocol.wire can't break ghostty_vt.
Position
Below the diagonal: herdr.protocol.wire uses a module listed above it, which is the healthy direction.
herdr.protocol.wire uses herdr.api.schema.common, so a change to herdr.api.schema.common can break herdr.protocol.wire, while a change to herdr.protocol.wire can't break herdr.api.schema.common.
Position
Below the diagonal: herdr.protocol.wire uses a module listed above it, which is the healthy direction.
herdr.protocol.wire uses herdr.config.model, so a change to herdr.config.model can break herdr.protocol.wire, while a change to herdr.protocol.wire can't break herdr.config.model.
Position
Below the diagonal: herdr.protocol.wire uses a module listed above it, which is the healthy direction.
herdr.protocol.wire uses herdr.input.model, so a change to herdr.input.model can break herdr.protocol.wire, while a change to herdr.protocol.wire can't break herdr.input.model.
Position
Below the diagonal: herdr.protocol.wire uses a module listed above it, which is the healthy direction.
herdr.protocol.wire uses herdr.terminal_theme, so a change to herdr.terminal_theme can break herdr.protocol.wire, while a change to herdr.protocol.wire can't break herdr.terminal_theme.
Position
Below the diagonal: herdr.protocol.wire uses a module listed above it, which is the healthy direction.
15→19 herdr.protocol.wire uses herdr.config.keybindspart of a loop✕
Connections
1 pair of types, where a type in herdr.protocol.wire uses a type in herdr.config.keybinds.
herdr.protocol.wire uses herdr.config.keybinds, so a change to herdr.config.keybinds can break herdr.protocol.wire, while a change to herdr.protocol.wire can't break herdr.config.keybinds.
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.
herdr.api.schema.plugins uses herdr.api.schema.common, so a change to herdr.api.schema.common can break herdr.api.schema.plugins, while a change to herdr.api.schema.plugins can't break herdr.api.schema.common.
Position
Below the diagonal: herdr.api.schema.plugins uses a module listed above it, which is the healthy direction.
herdr.api.schema.plugins uses herdr.api.schema.panes, so a change to herdr.api.schema.panes can break herdr.api.schema.plugins, while a change to herdr.api.schema.plugins can't break herdr.api.schema.panes.
Position
Below the diagonal: herdr.api.schema.plugins uses a module listed above it, which is the healthy direction.
herdr.api.schema.session uses herdr.api.schema.agents, so a change to herdr.api.schema.agents can break herdr.api.schema.session, while a change to herdr.api.schema.session can't break herdr.api.schema.agents.
Position
Below the diagonal: herdr.api.schema.session uses a module listed above it, which is the healthy direction.
herdr.api.schema.session uses herdr.api.schema.panes, so a change to herdr.api.schema.panes can break herdr.api.schema.session, while a change to herdr.api.schema.session can't break herdr.api.schema.panes.
Position
Below the diagonal: herdr.api.schema.session uses a module listed above it, which is the healthy direction.
herdr.client.endpoint.registry uses ghostty_vt, so a change to ghostty_vt can break herdr.client.endpoint.registry, while a change to herdr.client.endpoint.registry can't break ghostty_vt.
Position
Below the diagonal: herdr.client.endpoint.registry uses a module listed above it, which is the healthy direction.
herdr.client.endpoint.registry uses herdr.client.endpoint, so a change to herdr.client.endpoint can break herdr.client.endpoint.registry, while a change to herdr.client.endpoint.registry can't break herdr.client.endpoint.
Position
Below the diagonal: herdr.client.endpoint.registry uses a module listed above it, which is the healthy direction.
herdr.client.endpoint.registry uses herdr.protocol.wire, so a change to herdr.protocol.wire can break herdr.client.endpoint.registry, while a change to herdr.client.endpoint.registry can't break herdr.protocol.wire.
Position
Below the diagonal: herdr.client.endpoint.registry uses a module listed above it, which is the healthy direction.
herdr.config.keybinds uses herdr.config.model, so a change to herdr.config.model can break herdr.config.keybinds, while a change to herdr.config.keybinds can't break herdr.config.model.
Position
Below the diagonal: herdr.config.keybinds uses a module listed above it, which is the healthy direction.
herdr.config.keybinds uses herdr.input.model, so a change to herdr.input.model can break herdr.config.keybinds, while a change to herdr.config.keybinds can't break herdr.input.model.
Position
Below the diagonal: herdr.config.keybinds uses a module listed above it, which is the healthy direction.
herdr.config.keybinds uses herdr.protocol.wire, so a change to herdr.protocol.wire can break herdr.config.keybinds, while a change to herdr.config.keybinds can't break herdr.protocol.wire.
Position
Below the diagonal: herdr.config.keybinds uses a module listed above it, which is the healthy direction.
herdr.layout uses herdr.api.schema.panes, so a change to herdr.api.schema.panes can break herdr.layout, while a change to herdr.layout can't break herdr.api.schema.panes.
Position
Below the diagonal: herdr.layout uses a module listed above it, which is the healthy direction.
herdr.client.state uses herdr.client.endpoint, so a change to herdr.client.endpoint can break herdr.client.state, while a change to herdr.client.state can't break herdr.client.endpoint.
Position
Below the diagonal: herdr.client.state uses a module listed above it, which is the healthy direction.
herdr.client.state uses portable_pty, so a change to portable_pty can break herdr.client.state, while a change to herdr.client.state can't break portable_pty.
Position
Below the diagonal: herdr.client.state uses a module listed above it, which is the healthy direction.
herdr.client.state uses herdr.protocol.wire, so a change to herdr.protocol.wire can break herdr.client.state, while a change to herdr.client.state can't break herdr.protocol.wire.
Position
Below the diagonal: herdr.client.state uses a module listed above it, which is the healthy direction.
herdr.client.state uses herdr.client.endpoint.registry, so a change to herdr.client.endpoint.registry can break herdr.client.state, while a change to herdr.client.state can't break herdr.client.endpoint.registry.
Position
Below the diagonal: herdr.client.state uses a module listed above it, which is the healthy direction.
22→37 herdr.client.state uses herdr.client.shell.statepart of a loop✕
Connections
1 pair of types, where a type in herdr.client.state uses a type in herdr.client.shell.state.
herdr.client.state uses herdr.client.shell.state, so a change to herdr.client.shell.state can break herdr.client.state, while a change to herdr.client.state can't break herdr.client.shell.state.
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→39 herdr.client.state uses herdr.client.endpoint.activation.modelpart of a loop✕
Connections
1 pair of types, where a type in herdr.client.state uses a type in herdr.client.endpoint.activation.model.
herdr.client.state uses herdr.client.endpoint.activation.model, so a change to herdr.client.endpoint.activation.model can break herdr.client.state, while a change to herdr.client.state can't break herdr.client.endpoint.activation.model.
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.
herdr.pane.terminal uses ghostty_vt, so a change to ghostty_vt can break herdr.pane.terminal, while a change to herdr.pane.terminal can't break ghostty_vt.
Position
Below the diagonal: herdr.pane.terminal uses a module listed above it, which is the healthy direction.
herdr.pane.terminal uses herdr.input.model, so a change to herdr.input.model can break herdr.pane.terminal, while a change to herdr.pane.terminal can't break herdr.input.model.
Position
Below the diagonal: herdr.pane.terminal uses a module listed above it, which is the healthy direction.
herdr.pane.terminal uses herdr.terminal_theme, so a change to herdr.terminal_theme can break herdr.pane.terminal, while a change to herdr.pane.terminal can't break herdr.terminal_theme.
Position
Below the diagonal: herdr.pane.terminal uses a module listed above it, which is the healthy direction.
herdr.pane.terminal uses herdr.api.schema.panes, so a change to herdr.api.schema.panes can break herdr.pane.terminal, while a change to herdr.pane.terminal can't break herdr.api.schema.panes.
Position
Below the diagonal: herdr.pane.terminal uses a module listed above it, which is the healthy direction.
herdr.pane.terminal uses herdr.protocol.wire, so a change to herdr.protocol.wire can break herdr.pane.terminal, while a change to herdr.pane.terminal can't break herdr.protocol.wire.
Position
Below the diagonal: herdr.pane.terminal uses a module listed above it, which is the healthy direction.
herdr.pane.terminal uses herdr.layout, so a change to herdr.layout can break herdr.pane.terminal, while a change to herdr.pane.terminal can't break herdr.layout.
Position
Below the diagonal: herdr.pane.terminal uses a module listed above it, which is the healthy direction.
23→25 herdr.pane.terminal uses herdr.panepart of a loop✕
Connections
2 pairs of types, where a type in herdr.pane.terminal uses a type in herdr.pane.
herdr.pane.terminal uses herdr.pane, so a change to herdr.pane can break herdr.pane.terminal, while a change to herdr.pane.terminal can't break herdr.pane.
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.
herdr.terminal.state uses herdr.terminal.id, so a change to herdr.terminal.id can break herdr.terminal.state, while a change to herdr.terminal.state can't break herdr.terminal.id.
Position
Below the diagonal: herdr.terminal.state uses a module listed above it, which is the healthy direction.
herdr.terminal.state uses herdr.detect, so a change to herdr.detect can break herdr.terminal.state, while a change to herdr.terminal.state can't break herdr.detect.
Position
Below the diagonal: herdr.terminal.state uses a module listed above it, which is the healthy direction.
herdr.pane uses portable_pty.cmdbuilder, so a change to portable_pty.cmdbuilder can break herdr.pane, while a change to herdr.pane can't break portable_pty.cmdbuilder.
Position
Below the diagonal: herdr.pane uses a module listed above it, which is the healthy direction.
herdr.pane uses herdr.config.model, so a change to herdr.config.model can break herdr.pane, while a change to herdr.pane can't break herdr.config.model.
Position
Below the diagonal: herdr.pane uses a module listed above it, which is the healthy direction.
herdr.pane uses herdr.terminal_theme, so a change to herdr.terminal_theme can break herdr.pane, while a change to herdr.pane can't break herdr.terminal_theme.
Position
Below the diagonal: herdr.pane uses a module listed above it, which is the healthy direction.
herdr.pane uses herdr.api.schema.panes, so a change to herdr.api.schema.panes can break herdr.pane, while a change to herdr.pane can't break herdr.api.schema.panes.
Position
Below the diagonal: herdr.pane uses a module listed above it, which is the healthy direction.
herdr.pane uses herdr.pane.terminal, so a change to herdr.pane.terminal can break herdr.pane, while a change to herdr.pane can't break herdr.pane.terminal.
Position
Below the diagonal: herdr.pane uses a module listed above it, which is the healthy direction.
herdr.terminal.runtime uses ghostty_vt, so a change to ghostty_vt can break herdr.terminal.runtime, while a change to herdr.terminal.runtime can't break ghostty_vt.
Position
Below the diagonal: herdr.terminal.runtime uses a module listed above it, which is the healthy direction.
herdr.terminal.runtime uses herdr.input.model, so a change to herdr.input.model can break herdr.terminal.runtime, while a change to herdr.terminal.runtime can't break herdr.input.model.
Position
Below the diagonal: herdr.terminal.runtime uses a module listed above it, which is the healthy direction.
herdr.terminal.runtime uses herdr.terminal_theme, so a change to herdr.terminal_theme can break herdr.terminal.runtime, while a change to herdr.terminal.runtime can't break herdr.terminal_theme.
Position
Below the diagonal: herdr.terminal.runtime uses a module listed above it, which is the healthy direction.
herdr.terminal.runtime uses herdr.api.schema.panes, so a change to herdr.api.schema.panes can break herdr.terminal.runtime, while a change to herdr.terminal.runtime can't break herdr.api.schema.panes.
Position
Below the diagonal: herdr.terminal.runtime uses a module listed above it, which is the healthy direction.
herdr.terminal.runtime uses herdr.detect, so a change to herdr.detect can break herdr.terminal.runtime, while a change to herdr.terminal.runtime can't break herdr.detect.
Position
Below the diagonal: herdr.terminal.runtime uses a module listed above it, which is the healthy direction.
herdr.terminal.runtime uses herdr.layout, so a change to herdr.layout can break herdr.terminal.runtime, while a change to herdr.terminal.runtime can't break herdr.layout.
Position
Below the diagonal: herdr.terminal.runtime uses a module listed above it, which is the healthy direction.
herdr.terminal.runtime uses herdr.pane.terminal, so a change to herdr.pane.terminal can break herdr.terminal.runtime, while a change to herdr.terminal.runtime can't break herdr.pane.terminal.
Position
Below the diagonal: herdr.terminal.runtime uses a module listed above it, which is the healthy direction.
herdr.terminal.runtime uses herdr.pane, so a change to herdr.pane can break herdr.terminal.runtime, while a change to herdr.terminal.runtime can't break herdr.pane.
Position
Below the diagonal: herdr.terminal.runtime uses a module listed above it, which is the healthy direction.
herdr.terminal.runtime_registry uses herdr.terminal.id, so a change to herdr.terminal.id can break herdr.terminal.runtime_registry, while a change to herdr.terminal.runtime_registry can't break herdr.terminal.id.
Position
Below the diagonal: herdr.terminal.runtime_registry uses a module listed above it, which is the healthy direction.
herdr.terminal.runtime_registry uses herdr.terminal.runtime, so a change to herdr.terminal.runtime can break herdr.terminal.runtime_registry, while a change to herdr.terminal.runtime_registry can't break herdr.terminal.runtime.
Position
Below the diagonal: herdr.terminal.runtime_registry uses a module listed above it, which is the healthy direction.
herdr.ui.tab_surface uses herdr.api.schema.panes, so a change to herdr.api.schema.panes can break herdr.ui.tab_surface, while a change to herdr.ui.tab_surface can't break herdr.api.schema.panes.
Position
Below the diagonal: herdr.ui.tab_surface uses a module listed above it, which is the healthy direction.
herdr.ui.tab_surface uses herdr.protocol.wire, so a change to herdr.protocol.wire can break herdr.ui.tab_surface, while a change to herdr.ui.tab_surface can't break herdr.protocol.wire.
Position
Below the diagonal: herdr.ui.tab_surface uses a module listed above it, which is the healthy direction.
herdr.ui.tab_surface uses herdr.layout, so a change to herdr.layout can break herdr.ui.tab_surface, while a change to herdr.ui.tab_surface can't break herdr.layout.
Position
Below the diagonal: herdr.ui.tab_surface uses a module listed above it, which is the healthy direction.
herdr.ui.tab_surface uses herdr.terminal.runtime_registry, so a change to herdr.terminal.runtime_registry can break herdr.ui.tab_surface, while a change to herdr.ui.tab_surface can't break herdr.terminal.runtime_registry.
Position
Below the diagonal: herdr.ui.tab_surface uses a module listed above it, which is the healthy direction.
28→30 herdr.ui.tab_surface uses herdr.kitty_graphicspart of a loop✕
Connections
1 pair of types, where a type in herdr.ui.tab_surface uses a type in herdr.kitty_graphics.
herdr.ui.tab_surface uses herdr.kitty_graphics, so a change to herdr.kitty_graphics can break herdr.ui.tab_surface, while a change to herdr.ui.tab_surface can't break herdr.kitty_graphics.
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.
28→33 herdr.ui.tab_surface uses herdr.app.statepart of a loop✕
Connections
1 pair of types, where a type in herdr.ui.tab_surface uses a type in herdr.app.state.
herdr.ui.tab_surface uses herdr.app.state, so a change to herdr.app.state can break herdr.ui.tab_surface, while a change to herdr.ui.tab_surface can't break herdr.app.state.
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.
herdr.workspace.tab uses herdr.terminal.id, so a change to herdr.terminal.id can break herdr.workspace.tab, while a change to herdr.workspace.tab can't break herdr.terminal.id.
Position
Below the diagonal: herdr.workspace.tab uses a module listed above it, which is the healthy direction.
herdr.workspace.tab uses herdr.terminal_theme, so a change to herdr.terminal_theme can break herdr.workspace.tab, while a change to herdr.workspace.tab can't break herdr.terminal_theme.
Position
Below the diagonal: herdr.workspace.tab uses a module listed above it, which is the healthy direction.
herdr.workspace.tab uses herdr.layout, so a change to herdr.layout can break herdr.workspace.tab, while a change to herdr.workspace.tab can't break herdr.layout.
Position
Below the diagonal: herdr.workspace.tab uses a module listed above it, which is the healthy direction.
herdr.workspace.tab uses herdr.terminal.state, so a change to herdr.terminal.state can break herdr.workspace.tab, while a change to herdr.workspace.tab can't break herdr.terminal.state.
Position
Below the diagonal: herdr.workspace.tab uses a module listed above it, which is the healthy direction.
herdr.workspace.tab uses herdr.pane, so a change to herdr.pane can break herdr.workspace.tab, while a change to herdr.workspace.tab can't break herdr.pane.
Position
Below the diagonal: herdr.workspace.tab uses a module listed above it, which is the healthy direction.
herdr.workspace.tab uses herdr.terminal.runtime, so a change to herdr.terminal.runtime can break herdr.workspace.tab, while a change to herdr.workspace.tab can't break herdr.terminal.runtime.
Position
Below the diagonal: herdr.workspace.tab uses a module listed above it, which is the healthy direction.
herdr.workspace.tab uses herdr.terminal.runtime_registry, so a change to herdr.terminal.runtime_registry can break herdr.workspace.tab, while a change to herdr.workspace.tab can't break herdr.terminal.runtime_registry.
Position
Below the diagonal: herdr.workspace.tab uses a module listed above it, which is the healthy direction.
herdr.kitty_graphics uses ghostty_vt, so a change to ghostty_vt can break herdr.kitty_graphics, while a change to herdr.kitty_graphics can't break ghostty_vt.
Position
Below the diagonal: herdr.kitty_graphics uses a module listed above it, which is the healthy direction.
herdr.kitty_graphics uses herdr.layout, so a change to herdr.layout can break herdr.kitty_graphics, while a change to herdr.kitty_graphics can't break herdr.layout.
Position
Below the diagonal: herdr.kitty_graphics uses a module listed above it, which is the healthy direction.
herdr.kitty_graphics uses herdr.terminal.runtime_registry, so a change to herdr.terminal.runtime_registry can break herdr.kitty_graphics, while a change to herdr.kitty_graphics can't break herdr.terminal.runtime_registry.
Position
Below the diagonal: herdr.kitty_graphics uses a module listed above it, which is the healthy direction.
herdr.kitty_graphics uses herdr.ui.tab_surface, so a change to herdr.ui.tab_surface can break herdr.kitty_graphics, while a change to herdr.kitty_graphics can't break herdr.ui.tab_surface.
Position
Below the diagonal: herdr.kitty_graphics uses a module listed above it, which is the healthy direction.
30→33 herdr.kitty_graphics uses herdr.app.statepart of a loop✕
Connections
1 pair of types, where a type in herdr.kitty_graphics uses a type in herdr.app.state.
herdr.kitty_graphics uses herdr.app.state, so a change to herdr.app.state can break herdr.kitty_graphics, while a change to herdr.kitty_graphics can't break herdr.app.state.
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.
herdr.workspace uses herdr.terminal.id, so a change to herdr.terminal.id can break herdr.workspace, while a change to herdr.workspace can't break herdr.terminal.id.
Position
Below the diagonal: herdr.workspace uses a module listed above it, which is the healthy direction.
herdr.workspace uses herdr.terminal_theme, so a change to herdr.terminal_theme can break herdr.workspace, while a change to herdr.workspace can't break herdr.terminal_theme.
Position
Below the diagonal: herdr.workspace uses a module listed above it, which is the healthy direction.
herdr.workspace uses herdr.terminal.runtime_registry, so a change to herdr.terminal.runtime_registry can break herdr.workspace, while a change to herdr.workspace can't break herdr.terminal.runtime_registry.
Position
Below the diagonal: herdr.workspace uses a module listed above it, which is the healthy direction.
herdr.workspace uses herdr.workspace.tab, so a change to herdr.workspace.tab can break herdr.workspace, while a change to herdr.workspace can't break herdr.workspace.tab.
Position
Below the diagonal: herdr.workspace uses a module listed above it, which is the healthy direction.
herdr.ui.panes uses herdr.config.model, so a change to herdr.config.model can break herdr.ui.panes, while a change to herdr.ui.panes can't break herdr.config.model.
Position
Below the diagonal: herdr.ui.panes uses a module listed above it, which is the healthy direction.
herdr.ui.panes uses herdr.terminal_theme, so a change to herdr.terminal_theme can break herdr.ui.panes, while a change to herdr.ui.panes can't break herdr.terminal_theme.
Position
Below the diagonal: herdr.ui.panes uses a module listed above it, which is the healthy direction.
herdr.ui.panes uses herdr.api.schema.panes, so a change to herdr.api.schema.panes can break herdr.ui.panes, while a change to herdr.ui.panes can't break herdr.api.schema.panes.
Position
Below the diagonal: herdr.ui.panes uses a module listed above it, which is the healthy direction.
herdr.ui.panes uses herdr.pane.terminal, so a change to herdr.pane.terminal can break herdr.ui.panes, while a change to herdr.ui.panes can't break herdr.pane.terminal.
Position
Below the diagonal: herdr.ui.panes uses a module listed above it, which is the healthy direction.
herdr.ui.panes uses herdr.terminal.runtime, so a change to herdr.terminal.runtime can break herdr.ui.panes, while a change to herdr.ui.panes can't break herdr.terminal.runtime.
Position
Below the diagonal: herdr.ui.panes uses a module listed above it, which is the healthy direction.
herdr.ui.panes uses herdr.terminal.runtime_registry, so a change to herdr.terminal.runtime_registry can break herdr.ui.panes, while a change to herdr.ui.panes can't break herdr.terminal.runtime_registry.
Position
Below the diagonal: herdr.ui.panes uses a module listed above it, which is the healthy direction.
herdr.ui.panes uses herdr.ui.tab_surface, so a change to herdr.ui.tab_surface can break herdr.ui.panes, while a change to herdr.ui.panes can't break herdr.ui.tab_surface.
Position
Below the diagonal: herdr.ui.panes uses a module listed above it, which is the healthy direction.
herdr.ui.panes uses herdr.workspace.tab, so a change to herdr.workspace.tab can break herdr.ui.panes, while a change to herdr.ui.panes can't break herdr.workspace.tab.
Position
Below the diagonal: herdr.ui.panes uses a module listed above it, which is the healthy direction.
herdr.ui.panes uses herdr.kitty_graphics, so a change to herdr.kitty_graphics can break herdr.ui.panes, while a change to herdr.ui.panes can't break herdr.kitty_graphics.
Position
Below the diagonal: herdr.ui.panes uses a module listed above it, which is the healthy direction.
herdr.ui.panes uses herdr.workspace, so a change to herdr.workspace can break herdr.ui.panes, while a change to herdr.ui.panes can't break herdr.workspace.
Position
Below the diagonal: herdr.ui.panes uses a module listed above it, which is the healthy direction.
32→33 herdr.ui.panes uses herdr.app.statepart of a loop✕
Connections
2 pairs of types, where a type in herdr.ui.panes uses a type in herdr.app.state.
herdr.ui.panes uses herdr.app.state, so a change to herdr.app.state can break herdr.ui.panes, while a change to herdr.ui.panes can't break herdr.app.state.
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.
herdr.app.state uses herdr.terminal.id, so a change to herdr.terminal.id can break herdr.app.state, while a change to herdr.app.state can't break herdr.terminal.id.
Position
Below the diagonal: herdr.app.state uses a module listed above it, which is the healthy direction.
herdr.app.state uses herdr.api.schema.agents, so a change to herdr.api.schema.agents can break herdr.app.state, while a change to herdr.app.state can't break herdr.api.schema.agents.
Position
Below the diagonal: herdr.app.state uses a module listed above it, which is the healthy direction.
herdr.app.state uses herdr.config.model, so a change to herdr.config.model can break herdr.app.state, while a change to herdr.app.state can't break herdr.config.model.
Position
Below the diagonal: herdr.app.state uses a module listed above it, which is the healthy direction.
herdr.app.state uses herdr.terminal_theme, so a change to herdr.terminal_theme can break herdr.app.state, while a change to herdr.app.state can't break herdr.terminal_theme.
Position
Below the diagonal: herdr.app.state uses a module listed above it, which is the healthy direction.
herdr.app.state uses herdr.api.schema.panes, so a change to herdr.api.schema.panes can break herdr.app.state, while a change to herdr.app.state can't break herdr.api.schema.panes.
Position
Below the diagonal: herdr.app.state uses a module listed above it, which is the healthy direction.
herdr.app.state uses herdr.api.schema.plugins, so a change to herdr.api.schema.plugins can break herdr.app.state, while a change to herdr.app.state can't break herdr.api.schema.plugins.
Position
Below the diagonal: herdr.app.state uses a module listed above it, which is the healthy direction.
herdr.app.state uses herdr.config.keybinds, so a change to herdr.config.keybinds can break herdr.app.state, while a change to herdr.app.state can't break herdr.config.keybinds.
Position
Below the diagonal: herdr.app.state uses a module listed above it, which is the healthy direction.
herdr.app.state uses herdr.terminal.state, so a change to herdr.terminal.state can break herdr.app.state, while a change to herdr.app.state can't break herdr.terminal.state.
Position
Below the diagonal: herdr.app.state uses a module listed above it, which is the healthy direction.
herdr.app.state uses herdr.terminal.runtime, so a change to herdr.terminal.runtime can break herdr.app.state, while a change to herdr.app.state can't break herdr.terminal.runtime.
Position
Below the diagonal: herdr.app.state uses a module listed above it, which is the healthy direction.
herdr.app.state uses herdr.terminal.runtime_registry, so a change to herdr.terminal.runtime_registry can break herdr.app.state, while a change to herdr.app.state can't break herdr.terminal.runtime_registry.
Position
Below the diagonal: herdr.app.state uses a module listed above it, which is the healthy direction.
herdr.app.state uses herdr.kitty_graphics, so a change to herdr.kitty_graphics can break herdr.app.state, while a change to herdr.app.state can't break herdr.kitty_graphics.
Position
Below the diagonal: herdr.app.state uses a module listed above it, which is the healthy direction.
herdr.app.state uses herdr.workspace, so a change to herdr.workspace can break herdr.app.state, while a change to herdr.app.state can't break herdr.workspace.
Position
Below the diagonal: herdr.app.state uses a module listed above it, which is the healthy direction.
herdr.app.state uses herdr.ui.panes, so a change to herdr.ui.panes can break herdr.app.state, while a change to herdr.app.state can't break herdr.ui.panes.
Position
Below the diagonal: herdr.app.state uses a module listed above it, which is the healthy direction.
33→34 herdr.app.state uses herdr.app.actionspart of a loop✕
Connections
3 pairs of types, where a type in herdr.app.state uses a type in herdr.app.actions.
herdr.app.state uses herdr.app.actions, so a change to herdr.app.actions can break herdr.app.state, while a change to herdr.app.state can't break herdr.app.actions.
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.
herdr.app.actions uses herdr.api.schema.common, so a change to herdr.api.schema.common can break herdr.app.actions, while a change to herdr.app.actions can't break herdr.api.schema.common.
Position
Below the diagonal: herdr.app.actions uses a module listed above it, which is the healthy direction.
herdr.app.actions uses herdr.detect, so a change to herdr.detect can break herdr.app.actions, while a change to herdr.app.actions can't break herdr.detect.
Position
Below the diagonal: herdr.app.actions uses a module listed above it, which is the healthy direction.
herdr.app.actions uses herdr.layout, so a change to herdr.layout can break herdr.app.actions, while a change to herdr.app.actions can't break herdr.layout.
Position
Below the diagonal: herdr.app.actions uses a module listed above it, which is the healthy direction.
herdr.app.actions uses herdr.terminal.state, so a change to herdr.terminal.state can break herdr.app.actions, while a change to herdr.app.actions can't break herdr.terminal.state.
Position
Below the diagonal: herdr.app.actions uses a module listed above it, which is the healthy direction.
herdr.app.actions uses herdr.workspace, so a change to herdr.workspace can break herdr.app.actions, while a change to herdr.app.actions can't break herdr.workspace.
Position
Below the diagonal: herdr.app.actions uses a module listed above it, which is the healthy direction.
herdr.app.actions uses herdr.app.state, so a change to herdr.app.state can break herdr.app.actions, while a change to herdr.app.actions can't break herdr.app.state.
Position
Below the diagonal: herdr.app.actions uses a module listed above it, which is the healthy direction.
herdr.app uses herdr.api.schema.common, so a change to herdr.api.schema.common can break herdr.app, while a change to herdr.app can't break herdr.api.schema.common.
Position
Below the diagonal: herdr.app uses a module listed above it, which is the healthy direction.
herdr.app uses herdr.api.schema.response, so a change to herdr.api.schema.response can break herdr.app, while a change to herdr.app can't break herdr.api.schema.response.
Position
Below the diagonal: herdr.app uses a module listed above it, which is the healthy direction.
herdr.app uses herdr.api.schema.agents, so a change to herdr.api.schema.agents can break herdr.app, while a change to herdr.app can't break herdr.api.schema.agents.
Position
Below the diagonal: herdr.app uses a module listed above it, which is the healthy direction.
herdr.app uses herdr.terminal_theme, so a change to herdr.terminal_theme can break herdr.app, while a change to herdr.app can't break herdr.terminal_theme.
Position
Below the diagonal: herdr.app uses a module listed above it, which is the healthy direction.
37 pairs of types, where a type in herdr.app uses a type in herdr.api.schema.panes. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
herdr.app uses herdr.api.schema.panes, so a change to herdr.api.schema.panes can break herdr.app, while a change to herdr.app can't break herdr.api.schema.panes.
Position
Below the diagonal: herdr.app uses a module listed above it, which is the healthy direction.
herdr.app uses herdr.protocol.wire, so a change to herdr.protocol.wire can break herdr.app, while a change to herdr.app can't break herdr.protocol.wire.
Position
Below the diagonal: herdr.app uses a module listed above it, which is the healthy direction.
herdr.app uses herdr.api.schema.plugins, so a change to herdr.api.schema.plugins can break herdr.app, while a change to herdr.app can't break herdr.api.schema.plugins.
Position
Below the diagonal: herdr.app uses a module listed above it, which is the healthy direction.
herdr.app uses herdr.api.schema.session, so a change to herdr.api.schema.session can break herdr.app, while a change to herdr.app can't break herdr.api.schema.session.
Position
Below the diagonal: herdr.app uses a module listed above it, which is the healthy direction.
herdr.app uses herdr.config.keybinds, so a change to herdr.config.keybinds can break herdr.app, while a change to herdr.app can't break herdr.config.keybinds.
Position
Below the diagonal: herdr.app uses a module listed above it, which is the healthy direction.
herdr.app uses herdr.terminal.state, so a change to herdr.terminal.state can break herdr.app, while a change to herdr.app can't break herdr.terminal.state.
Position
Below the diagonal: herdr.app uses a module listed above it, which is the healthy direction.
herdr.app uses herdr.terminal.runtime, so a change to herdr.terminal.runtime can break herdr.app, while a change to herdr.app can't break herdr.terminal.runtime.
Position
Below the diagonal: herdr.app uses a module listed above it, which is the healthy direction.
herdr.app uses herdr.terminal.runtime_registry, so a change to herdr.terminal.runtime_registry can break herdr.app, while a change to herdr.app can't break herdr.terminal.runtime_registry.
Position
Below the diagonal: herdr.app uses a module listed above it, which is the healthy direction.
3 pairs of types, where a type in herdr.app uses a type in herdr.workspace.tab.
The types involved
herdr.app.App → herdr.workspace.tab.MovedPane
herdr.app.App → herdr.workspace.tab.NewPane
herdr.app.App → herdr.workspace.tab.Tab
Direction
herdr.app uses herdr.workspace.tab, so a change to herdr.workspace.tab can break herdr.app, while a change to herdr.app can't break herdr.workspace.tab.
Position
Below the diagonal: herdr.app uses a module listed above it, which is the healthy direction.
herdr.kitty_graphics.surface uses ghostty_vt, so a change to ghostty_vt can break herdr.kitty_graphics.surface, while a change to herdr.kitty_graphics.surface can't break ghostty_vt.
Position
Below the diagonal: herdr.kitty_graphics.surface uses a module listed above it, which is the healthy direction.
herdr.kitty_graphics.surface uses herdr.protocol.wire, so a change to herdr.protocol.wire can break herdr.kitty_graphics.surface, while a change to herdr.kitty_graphics.surface can't break herdr.protocol.wire.
Position
Below the diagonal: herdr.kitty_graphics.surface uses a module listed above it, which is the healthy direction.
herdr.kitty_graphics.surface uses herdr.ui.tab_surface, so a change to herdr.ui.tab_surface can break herdr.kitty_graphics.surface, while a change to herdr.kitty_graphics.surface can't break herdr.ui.tab_surface.
Position
Below the diagonal: herdr.kitty_graphics.surface uses a module listed above it, which is the healthy direction.
herdr.kitty_graphics.surface uses herdr.kitty_graphics, so a change to herdr.kitty_graphics can break herdr.kitty_graphics.surface, while a change to herdr.kitty_graphics.surface can't break herdr.kitty_graphics.
Position
Below the diagonal: herdr.kitty_graphics.surface uses a module listed above it, which is the healthy direction.
herdr.kitty_graphics.surface uses herdr.app, so a change to herdr.app can break herdr.kitty_graphics.surface, while a change to herdr.kitty_graphics.surface can't break herdr.app.
Position
Below the diagonal: herdr.kitty_graphics.surface uses a module listed above it, which is the healthy direction.
herdr.client.shell.state uses ghostty_vt, so a change to ghostty_vt can break herdr.client.shell.state, while a change to herdr.client.shell.state can't break ghostty_vt.
Position
Below the diagonal: herdr.client.shell.state uses a module listed above it, which is the healthy direction.
herdr.client.shell.state uses herdr.api.schema.common, so a change to herdr.api.schema.common can break herdr.client.shell.state, while a change to herdr.client.shell.state can't break herdr.api.schema.common.
Position
Below the diagonal: herdr.client.shell.state uses a module listed above it, which is the healthy direction.
herdr.client.shell.state uses herdr.client.endpoint, so a change to herdr.client.endpoint can break herdr.client.shell.state, while a change to herdr.client.shell.state can't break herdr.client.endpoint.
Position
Below the diagonal: herdr.client.shell.state uses a module listed above it, which is the healthy direction.
herdr.client.shell.state uses herdr.config.model, so a change to herdr.config.model can break herdr.client.shell.state, while a change to herdr.client.shell.state can't break herdr.config.model.
Position
Below the diagonal: herdr.client.shell.state uses a module listed above it, which is the healthy direction.
herdr.client.shell.state uses herdr.input.model, so a change to herdr.input.model can break herdr.client.shell.state, while a change to herdr.client.shell.state can't break herdr.input.model.
Position
Below the diagonal: herdr.client.shell.state uses a module listed above it, which is the healthy direction.
herdr.client.shell.state uses herdr.terminal_theme, so a change to herdr.terminal_theme can break herdr.client.shell.state, while a change to herdr.client.shell.state can't break herdr.terminal_theme.
Position
Below the diagonal: herdr.client.shell.state uses a module listed above it, which is the healthy direction.
herdr.client.shell.state uses herdr.api.schema.panes, so a change to herdr.api.schema.panes can break herdr.client.shell.state, while a change to herdr.client.shell.state can't break herdr.api.schema.panes.
Position
Below the diagonal: herdr.client.shell.state uses a module listed above it, which is the healthy direction.
herdr.client.shell.state uses herdr.protocol.wire, so a change to herdr.protocol.wire can break herdr.client.shell.state, while a change to herdr.client.shell.state can't break herdr.protocol.wire.
Position
Below the diagonal: herdr.client.shell.state uses a module listed above it, which is the healthy direction.
herdr.client.shell.state uses herdr.config.keybinds, so a change to herdr.config.keybinds can break herdr.client.shell.state, while a change to herdr.client.shell.state can't break herdr.config.keybinds.
Position
Below the diagonal: herdr.client.shell.state uses a module listed above it, which is the healthy direction.
herdr.client.shell.state uses herdr.client.state, so a change to herdr.client.state can break herdr.client.shell.state, while a change to herdr.client.shell.state can't break herdr.client.state.
Position
Below the diagonal: herdr.client.shell.state uses a module listed above it, which is the healthy direction.
herdr.client.shell.state uses herdr.pane.terminal, so a change to herdr.pane.terminal can break herdr.client.shell.state, while a change to herdr.client.shell.state can't break herdr.pane.terminal.
Position
Below the diagonal: herdr.client.shell.state uses a module listed above it, which is the healthy direction.
herdr.client.shell.state uses herdr.kitty_graphics, so a change to herdr.kitty_graphics can break herdr.client.shell.state, while a change to herdr.client.shell.state can't break herdr.kitty_graphics.
Position
Below the diagonal: herdr.client.shell.state uses a module listed above it, which is the healthy direction.
herdr.client.shell.state uses herdr.app.state, so a change to herdr.app.state can break herdr.client.shell.state, while a change to herdr.client.shell.state can't break herdr.app.state.
Position
Below the diagonal: herdr.client.shell.state uses a module listed above it, which is the healthy direction.
herdr.client.shell.state uses herdr.kitty_graphics.surface, so a change to herdr.kitty_graphics.surface can break herdr.client.shell.state, while a change to herdr.client.shell.state can't break herdr.kitty_graphics.surface.
Position
Below the diagonal: herdr.client.shell.state uses a module listed above it, which is the healthy direction.
herdr.server.headless uses ghostty_vt, so a change to ghostty_vt can break herdr.server.headless, while a change to herdr.server.headless can't break ghostty_vt.
Position
Below the diagonal: herdr.server.headless uses a module listed above it, which is the healthy direction.
herdr.server.headless uses herdr.api.schema, so a change to herdr.api.schema can break herdr.server.headless, while a change to herdr.server.headless can't break herdr.api.schema.
Position
Below the diagonal: herdr.server.headless uses a module listed above it, which is the healthy direction.
herdr.server.headless uses herdr.api.schema.common, so a change to herdr.api.schema.common can break herdr.server.headless, while a change to herdr.server.headless can't break herdr.api.schema.common.
Position
Below the diagonal: herdr.server.headless uses a module listed above it, which is the healthy direction.
herdr.server.headless uses herdr.api.schema.response, so a change to herdr.api.schema.response can break herdr.server.headless, while a change to herdr.server.headless can't break herdr.api.schema.response.
Position
Below the diagonal: herdr.server.headless uses a module listed above it, which is the healthy direction.
herdr.server.headless uses herdr.terminal.id, so a change to herdr.terminal.id can break herdr.server.headless, while a change to herdr.server.headless can't break herdr.terminal.id.
Position
Below the diagonal: herdr.server.headless uses a module listed above it, which is the healthy direction.
herdr.server.headless uses herdr.config.model, so a change to herdr.config.model can break herdr.server.headless, while a change to herdr.server.headless can't break herdr.config.model.
Position
Below the diagonal: herdr.server.headless uses a module listed above it, which is the healthy direction.
herdr.server.headless uses herdr.platform, so a change to herdr.platform can break herdr.server.headless, while a change to herdr.server.headless can't break herdr.platform.
Position
Below the diagonal: herdr.server.headless uses a module listed above it, which is the healthy direction.
herdr.server.headless uses herdr.protocol.wire, so a change to herdr.protocol.wire can break herdr.server.headless, while a change to herdr.server.headless can't break herdr.protocol.wire.
Position
Below the diagonal: herdr.server.headless uses a module listed above it, which is the healthy direction.
herdr.server.headless uses herdr.config.keybinds, so a change to herdr.config.keybinds can break herdr.server.headless, while a change to herdr.server.headless can't break herdr.config.keybinds.
Position
Below the diagonal: herdr.server.headless uses a module listed above it, which is the healthy direction.
herdr.server.headless uses herdr.detect, so a change to herdr.detect can break herdr.server.headless, while a change to herdr.server.headless can't break herdr.detect.
Position
Below the diagonal: herdr.server.headless uses a module listed above it, which is the healthy direction.
herdr.server.headless uses herdr.layout, so a change to herdr.layout can break herdr.server.headless, while a change to herdr.server.headless can't break herdr.layout.
Position
Below the diagonal: herdr.server.headless uses a module listed above it, which is the healthy direction.
herdr.server.headless uses herdr.terminal.runtime, so a change to herdr.terminal.runtime can break herdr.server.headless, while a change to herdr.server.headless can't break herdr.terminal.runtime.
Position
Below the diagonal: herdr.server.headless uses a module listed above it, which is the healthy direction.
herdr.server.headless uses herdr.ui.tab_surface, so a change to herdr.ui.tab_surface can break herdr.server.headless, while a change to herdr.server.headless can't break herdr.ui.tab_surface.
Position
Below the diagonal: herdr.server.headless uses a module listed above it, which is the healthy direction.
herdr.server.headless uses herdr.app.state, so a change to herdr.app.state can break herdr.server.headless, while a change to herdr.server.headless can't break herdr.app.state.
Position
Below the diagonal: herdr.server.headless uses a module listed above it, which is the healthy direction.
herdr.server.headless uses herdr.app.actions, so a change to herdr.app.actions can break herdr.server.headless, while a change to herdr.server.headless can't break herdr.app.actions.
Position
Below the diagonal: herdr.server.headless uses a module listed above it, which is the healthy direction.
herdr.server.headless uses herdr.app, so a change to herdr.app can break herdr.server.headless, while a change to herdr.server.headless can't break herdr.app.
Position
Below the diagonal: herdr.server.headless uses a module listed above it, which is the healthy direction.
herdr.server.headless uses herdr.kitty_graphics.surface, so a change to herdr.kitty_graphics.surface can break herdr.server.headless, while a change to herdr.server.headless can't break herdr.kitty_graphics.surface.
Position
Below the diagonal: herdr.server.headless uses a module listed above it, which is the healthy direction.
herdr.client.endpoint.activation.model uses herdr.client.endpoint, so a change to herdr.client.endpoint can break herdr.client.endpoint.activation.model, while a change to herdr.client.endpoint.activation.model can't break herdr.client.endpoint.
Position
Below the diagonal: herdr.client.endpoint.activation.model uses a module listed above it, which is the healthy direction.
herdr.client.endpoint.activation.model uses herdr.protocol.wire, so a change to herdr.protocol.wire can break herdr.client.endpoint.activation.model, while a change to herdr.client.endpoint.activation.model can't break herdr.protocol.wire.
Position
Below the diagonal: herdr.client.endpoint.activation.model uses a module listed above it, which is the healthy direction.
herdr.client.endpoint.activation.model uses herdr.client.endpoint.registry, so a change to herdr.client.endpoint.registry can break herdr.client.endpoint.activation.model, while a change to herdr.client.endpoint.activation.model can't break herdr.client.endpoint.registry.
Position
Below the diagonal: herdr.client.endpoint.activation.model uses a module listed above it, which is the healthy direction.
herdr.client.endpoint.activation.model uses herdr.client.shell.state, so a change to herdr.client.shell.state can break herdr.client.endpoint.activation.model, while a change to herdr.client.endpoint.activation.model can't break herdr.client.shell.state.
Position
Below the diagonal: herdr.client.endpoint.activation.model uses a module listed above it, which is the healthy direction.
herdr.client.shell_runtime uses herdr.client.endpoint, so a change to herdr.client.endpoint can break herdr.client.shell_runtime, while a change to herdr.client.shell_runtime can't break herdr.client.endpoint.
Position
Below the diagonal: herdr.client.shell_runtime uses a module listed above it, which is the healthy direction.
herdr.client.shell_runtime uses portable_pty, so a change to portable_pty can break herdr.client.shell_runtime, while a change to herdr.client.shell_runtime can't break portable_pty.
Position
Below the diagonal: herdr.client.shell_runtime uses a module listed above it, which is the healthy direction.
herdr.client.shell_runtime uses herdr.protocol.wire, so a change to herdr.protocol.wire can break herdr.client.shell_runtime, while a change to herdr.client.shell_runtime can't break herdr.protocol.wire.
Position
Below the diagonal: herdr.client.shell_runtime uses a module listed above it, which is the healthy direction.
herdr.client.shell_runtime uses herdr.client.endpoint.registry, so a change to herdr.client.endpoint.registry can break herdr.client.shell_runtime, while a change to herdr.client.shell_runtime can't break herdr.client.endpoint.registry.
Position
Below the diagonal: herdr.client.shell_runtime uses a module listed above it, which is the healthy direction.
herdr.client.shell_runtime uses herdr.client.state, so a change to herdr.client.state can break herdr.client.shell_runtime, while a change to herdr.client.shell_runtime can't break herdr.client.state.
Position
Below the diagonal: herdr.client.shell_runtime uses a module listed above it, which is the healthy direction.
herdr.client.shell_runtime uses herdr.client.shell.state, so a change to herdr.client.shell.state can break herdr.client.shell_runtime, while a change to herdr.client.shell_runtime can't break herdr.client.shell.state.
Position
Below the diagonal: herdr.client.shell_runtime uses a module listed above it, which is the healthy direction.
herdr.client.shell_runtime uses herdr.client.endpoint.activation.model, so a change to herdr.client.endpoint.activation.model can break herdr.client.shell_runtime, while a change to herdr.client.shell_runtime can't break herdr.client.endpoint.activation.model.
Position
Below the diagonal: herdr.client.shell_runtime uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 52% · Adequate · gated by D2, 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
A03:2025 — Software Supply Chain Failures
11
Medium
A05:2025 — Injection
6
High / Critical
Roadmap
Top priorities: Put every file in a nullable-enabled context — `#nullable enable` at its top, or commit a project file with <Nullable>enable</Nullable> — and resolve warnings rather than suppressing with `!`; Resolve the 1 No ADRs found finding(s) in ADR Quality — start with main.rs; 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.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with main.rs.
Put every file in a nullable-enabled context — `#nullable enable` at its top, or commit a project file with <Nullable>enable</Nullable> — and resolve warnings rather than suppressing with `!`.
Bring the 2 bodies over 240 down to 240 or less in Cognitive Complexity — start with herdr::client::run_client_loop (cognitive 724), ClientShellState::handle_mouse (cognitive 515).
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.
A `static` field is one slot for the whole process, however its type is created: back it with a thread-safe type (ConcurrentDictionary, Interlocked), take a lock around every write, or move it into a registered singleton that does.
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 — 2
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 — 1004
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 — 51
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 14
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 43 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 — 43 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, 1041 of 1057 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.
D8 Code Coverage — 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. Coverage NOT MEASURED: the Rust half could not be measured — the Cargo suite in repository root did not build, so it was never run. Coverage is excluded from the score rather than counted as a near-zero. This is OUR limitation, not a defect in the repo.
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 63 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 94 test source file(s) (.rs, .py) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite 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 source is present (.rs, .py, .ts) and this repository declares a Cargo test suite (repository root, 302 test files), but it was not re-run: no test result was produced. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
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. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
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 — 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. 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.
D27 Navigability — 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. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
AXR1 Runtime accessibility — 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. Render strategy: boot via Dockerfile (vendor/libghostty-vt/src/build/docker/lib-c-docs/Dockerfile). docker build failed (exit 1) — 35 | >>> COPY src/build/docker/lib-c-docs/entrypoint.sh /entrypoint.sh 36 | RUN chmod +x /entrypoint.sh 37 | -------------------- ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 872a113c-f749-4b13-9fed-58e0138a12e4::12p8hwmzhfyvxxk2ve9av6qvb: "/src/build/docker/lib-c-docs/entrypoint.sh": not found; runtime evidence skipped.
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'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.
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 no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
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.
X16 Unfloored truncation loop — 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.
X18 Disposal-pattern correctness — 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.
X27 Collection changed while being enumerated — 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 repository's C# was parsed (it ships no .sln or .csproj, so it was read as syntax-only projects), but this check proves its findings from resolved symbols and a reference-free parse resolves none. It abstained rather than report a clean bill it could not earn. That is a gap in this analyzer's reach into build-less repositories — not a finding that the repository is free of what this check looks for.
X28 Index access outside its own emptiness guard — 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.
X3 Exception handling — 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.
Repo exclusion declarations: 29 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.
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 Secret Scanning: Secret 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.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
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.
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.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
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.
137 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was ClientShellState::handle_mouse at 269. A further 31 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 herdr::input::parse::kitty_codepoint_to_keycode at 68 — they are counted neither in the figure above nor in this dimension's score. 16 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: src/input/parse.rs (herdr::input::parse::kitty_codepoint_to_keycode at 68), src/app/tab_bar_status.rs (herdr::app::tab_bar_status::strip_terminal_control_sequences at 31), src/api/subscriptions.rs (ActiveSubscription::new at 29), src/api/schema/events.rs (EventKind::dot_name at 26), src/detect/mod.rs (herdr::detect::lookup_agent at 26), and 11 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.
+ 28 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 5 bodies over 120 down to 120 or less in Cyclomatic Complexity — start with ClientShellState::handle_mouse (cyclomatic 269), herdr::client::run_client_loop (cyclomatic 262), KeysConfig::local_profile (cyclomatic 177). — 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 Cyclomatic Complexity from 5.0 to about 5.8/10, projected with the scoring formula itself and assuming each lands exactly at 120; 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.
+ 39 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 2 bodies over 240 down to 240 or less in Cognitive Complexity — start with herdr::client::run_client_loop (cognitive 724), ClientShellState::handle_mouse (cognitive 515). — 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 2 together lifts Cognitive Complexity from 2.0 to about 3.6/10, projected with the scoring formula itself and assuming each lands exactly at 240; 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 Classes8.1 / 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.
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 64 FileTooLong finding(s) in God Classes — start with mod.rs (4), state.rs (3), panes.rs (3). — One of this dimension's main actionable groups (64 warning-level).
Resolve the 42 MethodTooLong finding(s) in God Classes — start with state.rs (6), actions.rs (4), panes.rs (3). — One of this dimension's main actionable groups (42 warning-level).
Resolve the 36 FunctionTooLong finding(s) in God Classes — start with mobile.rs (3), sidebar.rs (3), mod.rs (2). — One of this dimension's main actionable groups (36 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.
174 duplicated block group(s) detected. 3.6 % of the production lines (8,908 of 250,385) are in a reported copy. A further 150 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 22 of the 324 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.
+ 119 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 15 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with product_announcements.rs (2), actions.rs, custom_commands.rs. — One of this dimension's main actionable groups (15 warning-level).
Resolve the 11 Edited copy of a member (13 corresponding lines) finding(s) in Code Duplication — start with terminal.rs (2), unix.rs, overlays.rs. — One of this dimension's main actionable groups (11 warning-level).
Resolve the 11 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with terminal.rs (2), activation.rs, composition.rs. — One of this dimension's main actionable groups (11 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling6.0 / 10Adequate✓ 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.
2 production modules (Cargo), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 1 module(s) off the main sequence.
Off the main sequence: ghostty-vt
What to do
Resolve the 1 Off the main sequence 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.
D10 · Test Quality10.0 / 10Stronggated by 1 serious finding✓ 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.
1 skipped (1 with a documented reason), 0 zero-assertion, 1 synchronised by a fixed sleep, no mocking-framework packages referenced (hand-written doubles or no mocking) across 63 tests. Measured on the JavaScript/TypeScript suite only — at least 94 test source file(s) (.rs, .py) went unread, so its test quality is unmeasured and is not in these counts.
Fixed-sleep synchronisation: V2 resends the latest state after a failed deliverysrc/integration/assets/opencode/herdr-tui-session.test.ts:684
Resolve the 1 Fixed-sleep synchronisation finding(s) in Test Quality — start with herdr-tui-session.test.ts. — One of this dimension's main actionable groups (1 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.
7 outdated, 0 yanked direct Cargo dependencies. 33 of 34 direct crates were graded against crates.io (0 not published there, 1 not resolved by a committed REDACTED). Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from REDACTED there.
Outdated: interprocess · ×7
✓ On the Gold path — maintain.
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.
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 294 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's REDACTED closed over its manifests' `[dependencies]` and `[build-dependencies]`. Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. This repository publishes itself under Apache-2.0, which is its own choice and is not judged here.
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: src/client/mod.rs (46×262=12052); src/server/headless.rs (44×133=5852); src/client/shell/mouse.rs (17×269=4573) Repeated repair below the complexity floor: src/platform/windows.rs (41 of 48 changes were fixes); src/platform/mod.rs (30 of 36 changes were fixes); src/platform/linux.rs (20 of 25 changes were fixes)
Resolve the 61 Hotspot finding(s) in Churn × Complexity Hotspots — start with mod.rs (3), state.rs (3), actions.rs (3). — One of this dimension's main actionable groups (61 warning-level).
Resolve the 59 Repeated repair finding(s) in Churn × Complexity Hotspots — start with mod.rs (2), runtime.rs (2), agents.rs (2). — One of this dimension's main actionable groups (59 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor8.0 / 10Strong✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
68 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is src/kitty_graphics/surface.rs. Counted over 333 of the 383 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Off-boarding risk: anonymized user #1 · ×2
Further sole-owners (lower concentration)
What to do
Resolve the 2 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (2 recommendation-level).
Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d16_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 250385 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. 1067 document(s) read across 2 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.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: Secret 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.
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).
8 finding(s): 0 critical, 2 high, 6 medium, 0 low. semgrep hit a parse error in 6 file(s) — `crates/ghostty-vt/src/bindings.rs` (line 309, line 400, line 404, …), `scripts/release_perf_case.sh` (line 28), `src/client/notifications.rs` (line 74), `src/platform/macos.rs` (line 77, lines 144–145), `src/platform/macos/bootstrap.rs` (line 17), … (+1 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 5 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
What to do
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4). — One of this dimension's main actionable groups (4 warning-level).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
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.
Resolve the 5 Medium advisory (unsound) finding(s) in Dependency Vulnerabilities — start with REDACTED (5). — One of this dimension's main actionable groups (5 warning-level).
Resolve the 4 Medium advisory (unmaintained) finding(s) in Dependency Vulnerabilities — start with REDACTED (4). — One of this dimension's main actionable groups (4 warning-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Every significant source file has living knowledge — recently and meaningfully worked. Counted over 333 of the 383 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 6 Change coupling finding(s) in Change Coupling — start with agent_resume.rs, creation.rs, changelog.py. — One of this dimension's main actionable groups (6 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.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
1 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 0 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
Resolve the 1 End-of-life runtime finding(s) in Platform End-of-Life — start with rust-toolchain.toml. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d44_recommendation.md · top locations in Appendix A, every location in findings.md.
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 singleton services avoid mutable shared instance state that concurrent callers would race on.
Method: Roslyn scan: singleton field mutations unguarded by lock or Interlocked, per type; syntax-based guard detection. Deterministic, traceable per field.
`Desktop` keeps mutable `static` state — one slot for the whole process, shared by every thread that reaches the type however its instances are created — and mutates it outside any lock (stopThread, stopThreadId, stopHook, stopError; e.g. `stopThread` at line 46). Concurrent callers lose updates, and a collection that is not built for concurrent writers can corrupt. — scripts/windows_input/Native.cs:22
What to do
A `static` field is one slot for the whole process, however its type is created: back it with a thread-safe type (ConcurrentDictionary, Interlocked), take a lock around every write, or move it into a registered singleton that does.
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.
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.
Other · Event-Driven — Whether persisted/published domain events are named in the past tense (facts that happened) rather than imperatively.
Method: Roslyn scan (event-driven gated): domain and integration events checked for past-tense naming (-ed/-en suffix or irregular set). Naming nudge, low-weight advisory.
`UpdateReady` is an imperative name inside a domain-event set whose siblings are past-tense facts — it reads as an intent, not something that happened. Name new events for the fact that occurred (e.g. `ItemAdded`). Do not rename this one if it is already stored or published: its type name is written with every event recorded under it, so a rename can break replay of the stored stream and every subscriber that reads it, and a clearer name does not pay for that. If it has never been written or sent, renaming it now is safe. — src/events.rs:78
What to do
Name new events in the past tense: they record facts that already happened. Do not rename an event that is already stored or published: its type name is written with every event recorded under it, so a rename can break replay of the stored stream and every subscriber that reads it.
Other · Event Sourcing — Whether the recovery-replay fold is deterministic — state derived purely from each event's own fields, no clock/random/IO on the replay path.
Method: Roslyn syntax scan (event-sourcing gated): Apply/When folds checked for forbidden tokens (DateTime.Now, Guid.NewGuid, Random, IO), stripped of comments/strings. Deterministic, hard fact per fold.
Other · Event Sourcing — Whether domain events stay immutable (private fields, set once) rather than carrying mutable state.
Method: Roslyn scan (event-sourcing gated): persisted events checked for public setters; immutability verified per property/field. Deterministic, hard fact.
Other · Code Health — Unreviewed-generation residue: shipped members still throwing NotImplementedException, and placeholder string literals left in non-test, non-generated code. Scored as a quality signature, never as a claim about authorship.
Method: Roslyn syntax scan: NotImplementedException throws and placeholder string literals in non-test, non-generated shipped code. Deterministic, code-shape signature.
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.
No C4/Structurizr/PlantUML/Mermaid/Graphviz/D2 diagram, no drawn diagram named for the architecture, no file named `architecture` or `design` in any markup this check reads, and nothing in the README, docs or contributor guides that announces the shape — no `## Architecture` heading, no "architecture overview"/"high-level design" phrasing, no "the architecture is …" introduction, no guided code tour. A shape laid out in prose that never names itself as the architecture is not visible to this check, and neither is one kept outside the repository, so this row reports the absence of a re-findable shape document — not evidence that nobody wrote the shape down.
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.
Add a C4 context/container diagram (Structurizr, PlantUML or Mermaid) or an architecture.md overview.
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 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.
`REDACTED` schedules updates, but no `package-ecosystem` entry covers `npm`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list. — REDACTED:2
What to do
Dependabot is configured but does not watch `npm` — add that `package-ecosystem` entry to REDACTED so those dependencies get the same automatic update and advisory pressure as the ones it already covers.
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.
`complete_shutdown` is async and calls thread::sleep — a blocking call inside async code stalls the executor thread, and every task scheduled on it for as long as it runs. — src/server/headless/lifecycle.rs:336
What to do
Rust: `.await` the future instead of `block_on` (on a Tokio runtime thread it panics outright) and use `tokio::time::sleep(..).await` instead of `std::thread::sleep`; where synchronous code must run, move it to `tokio::task::spawn_blocking` or `block_in_place`.
Other · Code Health — Whether nullable reference types are enabled and not undermined by heavy `!` suppression.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
0/1 C# file(s) are in a nullable-enabled context. This repository commits no project file, so nothing sets <Nullable>enable</Nullable> for it: a file is enabled only by its own `#nullable enable`, by a Unity `csc.rsp` with `-nullable:enable` for its assembly, or as a file-based app (`#:` directives) whose `#:property Nullable` does not turn it off. NRTs catch a whole class of null-deref bugs at compile time.
What to do
Put every file in a nullable-enabled context — `#nullable enable` at its top, or commit a project file with <Nullable>enable</Nullable> — and resolve warnings rather than suppressing with `!`.
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.
SC1 Supply-chain hygiene — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X10 Duplicated predicate — 16 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 16 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 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.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 72 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 — no DI registrations detected
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 public interfaces
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — docker build failed (exit 1) — 35 | >>> COPY src/build/docker/lib-c-docs/entrypoint.sh /entrypoint.sh 36 | RUN chmod +x /entrypoint.sh 37 | -------------------- ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 872a113c-f749-4b13-9fed-58e0138a12e4::12p8hwmzhfyvxxk2ve9av6qvb: "build/docker/lib-c-docs/entrypoint.sh": not found; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
C1 Data Protection — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
C2 Access Controls — No access-control surface detected in the analyzed source — no web/app surface to authorize (no HTTP API or web-UI project) and no authorization code at all (no [Authorize]/policies, no imperative guard methods). Access control is therefore N/A here — this is a library/CLI, which is authorized by its CALLER, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
C3 Audit Trail — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
C4 Data Retention — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
C5 Data-Subject Rights — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
D11 Test Reliability — Test reliability not included — the .rs suite was found but not re-run
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.
D21 Naming Consistency — N/A — too few peers to establish a naming convention (21629 declarations, no unit with a dominant convention).
D22 Internal API Consistency — API consistency is measured on C# only; the exposed Rust 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"]`.
D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only; comments in this repository's .py, .rs source were not judged.
D25 ADR Conformance — no ADRs to check
D26 Project Cohesion — Project cohesion is assessed over the .NET project set; this target exposed no projects, so project size and spread could not be assessed. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.rs), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
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) — 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.
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.
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 — Rust suite
DM1 Domain Modelling — applicable but not scored (2 of 3 signals for this style — below the bar we score at): 127 value object(s); 8 domain event(s); its domain events are published by services or handlers — no domain entity raises one
ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable (this repository commits no MSBuild project, so its C# was read as syntax-only projects — a handler marked ONLY by an interface from a package is not visible without a build)
IC1 Incompleteness & stubs — IC1 reached only 0% of this repository's production lines — rust (245,160 lines), python (4,081 lines), javascript (1,348 lines), typescript (642 lines), perl (24 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
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, Python, Rust 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 — Performance is assessed only for perf-relevant repos — a packaged library, one that ships benchmarks, or one already using allocation-aware APIs. This repo isn't one, so the Performance lens is not applicable and is excluded from the score.
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.
S1 Web-Security Posture — No web surface detected in the analyzed source — no HTTP API or web-UI project (no controllers/minimal-API endpoints, no Razor/Blazor views) and no web middleware (HTTPS redirection, HSTS, security headers, cookies). Transport security, security headers, secure cookies, CSRF/input-validation and middleware-order controls are therefore N/A here — this is a library/CLI/worker, not a web app. Crypto hygiene was still checked and found nothing to flag. If this codebase becomes web-facing, the dimension reactivates automatically.
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 0% of this repository's production lines — rust (245,160 lines), python (4,081 lines), javascript (1,348 lines), typescript (642 lines), perl (24 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 — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
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 — X16 reached only 0% of this repository's production lines — rust (245,160 lines), python (4,081 lines), javascript (1,348 lines), typescript (642 lines), perl (24 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
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 — X18 reached only 0% of this repository's production lines — rust (245,160 lines), python (4,081 lines), javascript (1,348 lines), typescript (642 lines), perl (24 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
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 — no async method does work a token could cancel
X20 Mistyped argument guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
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 — This check needs a compiled C# program and this repository commits no project file to compile, so only its syntax could be read. That is a limit of the analyzer, not a finding about your code.
X28 Index access outside its own emptiness guard — X28 reached only 0% of this repository's production lines — rust (245,160 lines), python (4,081 lines), javascript (1,348 lines), typescript (642 lines), perl (24 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
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
X3 Exception handling — X3 reached only 0% of this repository's production lines — rust (245,160 lines), python (4,081 lines), javascript (1,348 lines), typescript (642 lines), perl (24 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
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 — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X4 Structured logging — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X9 Subsumed condition operand — 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.
herdr::client::run_client_loop (cognitive 724) src/client/mod.rs:437— herdr::client::run_client_loop has cognitive complexity 724 (threshold 15). Drivers by points: if/else 175 (619 pts), match/switch 15 (54 pts), boolean chains 33, loops 6 (18 pts) (nesting depth added 495). 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.
herdr::client::shell::mobile::mobile_items (cognitive 107) src/client/shell/mobile.rs:575— herdr::client::shell::mobile::mobile_items has cognitive complexity 107 (threshold 15). Drivers by points: if/else 44 (91 pts), loops 6 (10 pts), boolean chains 6 (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.
herdr::client::shell::overlays::render_navigator_overlay (cognitive 99) src/client/shell/overlays.rs:704— herdr::client::shell::overlays::render_navigator_overlay has cognitive complexity 99 (threshold 15). Drivers by points: if/else 55 (90 pts), boolean chains 6, match/switch 1 (2 pts), loops 1 (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.
herdr::integration::actions::uninstall_target (cognitive 96) src/integration/actions.rs:326— herdr::integration::actions::uninstall_target has cognitive complexity 96 (threshold 15). Drivers by points: if/else 62 (93 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 32). 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.
herdr::client::input::unix_stdin_reader_loop (cognitive 89) src/client/input.rs:80— herdr::client::input::unix_stdin_reader_loop has cognitive complexity 89 (threshold 15). Drivers by points: if/else 24 (70 pts), boolean chains 9, loops 3 (8 pts), match/switch 1 (2 pts) (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
herdr::pane::terminal::ghostty_collect_dirty_patch (cognitive 88) src/pane/terminal.rs:2617— herdr::pane::terminal::ghostty_collect_dirty_patch has cognitive complexity 88 (threshold 15). Drivers by points: if/else 27 (59 pts), match/switch 17 (23 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
herdr::client::shell::endpoint_sidebar::render_collapsed (cognitive 79) src/client/shell/endpoint_sidebar.rs:15— herdr::client::shell::endpoint_sidebar::render_collapsed has cognitive complexity 79 (threshold 15). Drivers by points: if/else 35 (71 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
herdr::client::shell::aggregate_navigation::navigator_rows (cognitive 70) src/client/shell/aggregate_navigation.rs:278— herdr::client::shell::aggregate_navigation::navigator_rows has cognitive complexity 70 (threshold 15). Drivers by points: if/else 8 (25 pts), loops 6 (19 pts), match/switch 3 (15 pts), boolean chains 11 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
herdr::pane::spawn_basic_detection_task (cognitive 63) src/pane.rs:929— herdr::pane::spawn_basic_detection_task has cognitive complexity 63 (threshold 15). Drivers by points: if/else 21 (49 pts), boolean chains 7, match/switch 3 (6 pts), loops 1 (nesting depth added 31). 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.
herdr::persist::restore::restore_tab (cognitive 61) src/persist/restore.rs:491— herdr::persist::restore::restore_tab has cognitive complexity 61 (threshold 15). Drivers by points: if/else 25 (51 pts), match/switch 3 (8 pts), boolean chains 1, loops 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
herdr::server::client_transport::client_read_loop_with_endpoint_controls (cognitive 59) src/server/client_transport.rs:1002— herdr::server::client_transport::client_read_loop_with_endpoint_controls has cognitive complexity 59 (threshold 15). Drivers by points: if/else 15 (39 pts), match/switch 7 (17 pts), boolean chains 2, loops 1 (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.
herdr::client::shell::endpoint_sidebar::render_expanded (cognitive 58) src/client/shell/endpoint_sidebar.rs:237— herdr::client::shell::endpoint_sidebar::render_expanded has cognitive complexity 58 (threshold 15). Drivers by points: if/else 23 (43 pts), boolean chains 7, match/switch 4 (6 pts), loops 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
herdr::client::shell::render::render_mode_bar (cognitive 52) src/client/shell/render.rs:31— herdr::client::shell::render::render_mode_bar has cognitive complexity 52 (threshold 15). Drivers by points: if/else 18 (39 pts), match/switch 3 (7 pts), boolean chains 4, loops 2 (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.
herdr::api::wait::wait_for_resolved_agent (cognitive 50) src/api/wait.rs:364— herdr::api::wait::wait_for_resolved_agent has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (38 pts), match/switch 3 (7 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
herdr::client::shell::tabs::render_tab_bar (cognitive 50) src/client/shell/tabs.rs:7— herdr::client::shell::tabs::render_tab_bar has cognitive complexity 50 (threshold 15). Drivers by points: if/else 32 (43 pts), boolean chains 6, 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.
herdr::platform::macos::input::longest_canonical_line (cognitive 47) src/platform/macos/input.rs:62— herdr::platform::macos::input::longest_canonical_line has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (32 pts), boolean chains 14, 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.
herdr::client::shell_runtime::finish_client_shell_input (cognitive 46) src/client/shell_runtime.rs:743— herdr::client::shell_runtime::finish_client_shell_input has cognitive complexity 46 (threshold 15). Drivers by points: if/else 22 (44 pts), boolean chains 1, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
herdr::server::pane_input::apply_client_terminal_input_events (cognitive 45) src/server/pane_input.rs:229— herdr::server::pane_input::apply_client_terminal_input_events has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (31 pts), match/switch 4 (12 pts), boolean chains 1, 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.
herdr::kitty_graphics::surface::collect_scene (cognitive 44) src/kitty_graphics/surface.rs:575— herdr::kitty_graphics::surface::collect_scene has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16 (31 pts), loops 5 (8 pts), match/switch 2 (4 pts), boolean chains 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.
herdr::server::client_shell::render_pane_surface (cognitive 43) src/server/client_shell.rs:286— herdr::server::client_shell::render_pane_surface has cognitive complexity 43 (threshold 15). Drivers by points: if/else 18 (37 pts), loops 2 (4 pts), boolean chains 1, match/switch 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.
herdr::client::terminal_setup::consume_host_keyboard_probe_responses (cognitive 42) src/client/terminal_setup.rs:261— herdr::client::terminal_setup::consume_host_keyboard_probe_responses has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (32 pts), boolean chains 5, loops 2 (3 pts), 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.
herdr::ui::sidebar::resolved_token_spans (cognitive 42) src/ui/sidebar.rs:106— herdr::ui::sidebar::resolved_token_spans has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 5 (8 pts), boolean chains 4, match/switch 3 (4 pts) (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.
herdr::main (cognitive 39) src/main.rs:511— herdr::main has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (24 pts), match/switch 5 (7 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 8). 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.
herdr::client::shell_runtime::begin_endpoint_activation (cognitive 39) src/client/shell_runtime.rs:224— herdr::client::shell_runtime::begin_endpoint_activation has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (35 pts), boolean chains 3, match/switch 1 (nesting depth added 18). 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.
herdr::pane::run_terminal_compression_task (cognitive 39) src/pane.rs:1391— herdr::pane::run_terminal_compression_task has cognitive complexity 39 (threshold 15). Drivers by points: if/else 4 (14 pts), match/switch 5 (14 pts), loops 5 (10 pts), boolean chains 1 (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.
FileTooLong: src/pane.rs src/pane.rs— FileTooLong — 2757 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 51 free functions. The bar is 500 significant lines; this is 2257 over it, 5.51× 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: src/lib.rs crates/ghostty-vt/src/lib.rs— FileTooLong — 2625 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 44 free functions. The bar is 500 significant lines; this is 2125 over it, 5.25× 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: pane/terminal.rs src/pane/terminal.rs— FileTooLong — 2511 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 64 free functions. The bar is 500 significant lines; this is 2011 over it, 5.02× 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: server/headless.rs src/server/headless.rs— FileTooLong — 2379 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1879 over it, 4.76× 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: platform/windows.rs src/platform/windows.rs— FileTooLong — 2188 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 138 free functions. The bar is 500 significant lines; this is 1688 over it, 4.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: REDACTED REDACTED— FileTooLong — 2048 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 103 free functions. The bar is 500 significant lines; this is 1548 over it, 4.10× 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: shell/mouse.rs src/client/shell/mouse.rs— FileTooLong — 1833 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 100% of them inside a single declaration: ClientShellState (7-2402). The bar is 500 significant lines; this is 1333 over it, 3.67× 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: client/mod.rs src/client/mod.rs— FileTooLong — 1798 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1298 over it, 3.60× 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: src/update.rs src/update.rs— FileTooLong — 1774 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 87 free functions. The bar is 500 significant lines; this is 1274 over it, 3.55× 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: terminal/state.rs src/terminal/state.rs— FileTooLong — 1762 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 95% of them inside a single declaration: TerminalState (2 blocks, 129-2446). The bar is 500 significant lines; this is 1262 over it, 3.52× 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: api/panes.rs src/app/api/panes.rs— FileTooLong — 1742 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 93% of them inside a single declaration: App (2 blocks, 33-2210). The bar is 500 significant lines; this is 1242 over it, 3.48× 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: shell/state.rs src/client/shell/state.rs— FileTooLong — 1496 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 996 over it, 2.99× 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: app/actions.rs src/app/actions.rs— FileTooLong — 1415 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 76% of them inside a single declaration: AppState (4 blocks, 190-2122), declaring 34 free functions. The bar is 500 significant lines; this is 915 over it, 2.83× 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: integration/targets.rs src/integration/targets.rs— FileTooLong — 1255 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 50 free functions. The bar is 500 significant lines; this is 755 over it, 2.51× 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: detect/manifest.rs src/detect/manifest.rs— FileTooLong — 1142 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 67 free functions. The bar is 500 significant lines; this is 642 over it, 2.28× 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: config/keybinds.rs src/config/keybinds.rs— FileTooLong — 1113 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 613 over it, 2.23× 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: shell/overlays.rs src/client/shell/overlays.rs— FileTooLong — 1094 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). 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: protocol/wire.rs src/protocol/wire.rs— FileTooLong — 1087 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 587 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: src/raw_input.rs src/raw_input.rs— FileTooLong — 1055 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 38 free functions. The bar is 500 significant lines; this is 555 over it, 2.11× 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: cli/plugin.rs src/cli/plugin.rs— FileTooLong — 1002 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), declaring 55 free functions. The bar is 500 significant lines; this is 502 over it, 2.00× 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: app/api.rs src/app/api.rs— FileTooLong — 988 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 94% of them inside a single declaration: App (29-1332). The bar is 500 significant lines; this is 488 over it, 1.98× 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: server/client_transport.rs src/server/client_transport.rs— FileTooLong — 949 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 449 over it, 1.90× 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: config/model.rs src/config/model.rs— FileTooLong — 929 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 429 over it, 1.86× 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: shell/mobile.rs src/client/shell/mobile.rs— FileTooLong — 899 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 399 over it, 1.80× 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: shell/overlay_input.rs src/client/shell/overlay_input.rs— FileTooLong — 893 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), about 100% of them inside a single declaration: ClientShellState (3-1227). The bar is 500 significant lines; this is 393 over it, 1.79× 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.
Hotspot: src/client/mod.rs src/client/mod.rs:437— src/client/mod.rs changed 46 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 262 in herdr::client::run_client_loop at line 437. 35 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/client/mod.rs`: 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: src/server/headless.rs src/server/headless.rs:1849— src/server/headless.rs changed 44 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 133 in HeadlessServer::handle_server_event at line 1849. 33 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/server/headless.rs`: 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: src/client/shell/mouse.rs src/client/shell/mouse.rs:683— src/client/shell/mouse.rs changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 269 in ClientShellState::handle_mouse at line 683. 11 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/client/shell/mouse.rs`: 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: src/config/model.rs src/config/model.rs:718— src/config/model.rs changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 177 in KeysConfig::local_profile at line 718. 3 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/config/model.rs`: 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: src/pane.rs src/pane.rs:2687— src/pane.rs changed 56 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 61 in PaneRuntime::spawn_command_builder at line 2687. 39 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/pane.rs`: 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: src/pane/terminal.rs src/pane/terminal.rs:2617— src/pane/terminal.rs changed 48 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 65 in herdr::pane::terminal::ghostty_collect_dirty_patch at line 2617. 30 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/pane/terminal.rs`: 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: src/app/api.rs src/app/api.rs:935— src/app/api.rs changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 101 in App::handle_api_request_after_internal_events_drained at line 935. 16 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/app/api.rs`: 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: src/client/shell/state.rs src/client/shell/state.rs:1299— src/client/shell/state.rs changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 60 in ClientShellState::apply_active_snapshot at line 1299. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/client/shell/state.rs`: 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: src/app/mod.rs src/app/mod.rs:861— src/app/mod.rs changed 45 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in App::apply_live_config at line 861. 26 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/app/mod.rs`: 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: src/client/shell/actions.rs src/client/shell/actions.rs:499— src/client/shell/actions.rs changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 63 in ClientShellState::handle_endpoint_result at line 499. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/client/shell/actions.rs`: 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: src/main.rs src/main.rs:511— src/main.rs changed 38 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in herdr::main at line 511. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/main.rs`: 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: src/client/shell/overlay_input.rs src/client/shell/overlay_input.rs:479— src/client/shell/overlay_input.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 127 in ClientShellState::route_overlay_key at line 479. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/client/shell/overlay_input.rs`: 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: src/raw_input.rs src/raw_input.rs:476— src/raw_input.rs changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 49 in RawInputByteFramer::flush_timeout at line 476. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/raw_input.rs`: 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: src/client/shell/composition.rs src/client/shell/composition.rs:150— src/client/shell/composition.rs changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 64 in ClientShellState::compose at line 150. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/client/shell/composition.rs`: 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: src/server/headless/render.rs src/server/headless/render.rs:454— src/server/headless/render.rs changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 84 in HeadlessServer::render_and_stream_with_graphics_limit at line 454. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/server/headless/render.rs`: 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: src/app/api/panes.rs src/app/api/panes.rs:947— src/app/api/panes.rs changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 55 in App::handle_pane_move at line 947. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/app/api/panes.rs`: 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: src/app/actions.rs src/app/actions.rs:1392— src/app/actions.rs changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in AppState::handle_app_event at line 1392. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/app/actions.rs`: 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: src/terminal/state.rs src/terminal/state.rs:359— src/terminal/state.rs changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in TerminalState::set_detected_state_with_screen_signals_at at line 359. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/terminal/state.rs`: 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: src/server/client_transport.rs src/server/client_transport.rs:1002— src/server/client_transport.rs changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in herdr::server::client_transport::client_read_loop_with_endpoint_controls at line 1002. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/server/client_transport.rs`: 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: src/config/keybinds.rs src/config/keybinds.rs:499— src/config/keybinds.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 77 in Config::validated_keybinds at line 499. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/config/keybinds.rs`: 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: src/client/shell/input.rs src/client/shell/input.rs:223— src/client/shell/input.rs changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in ClientShellState::handle_raw_events at line 223. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/client/shell/input.rs`: 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: src/client/input.rs src/client/input.rs:80— src/client/input.rs changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in herdr::client::input::unix_stdin_reader_loop at line 80. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/client/input.rs`: 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: src/server/headless/retained_surface.rs src/server/headless/retained_surface.rs:227— src/server/headless/retained_surface.rs changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 59 in HeadlessServer::render_retained_pane_surface_and_stream at line 227. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/server/headless/retained_surface.rs`: 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: src/server/headless/notifications.rs src/server/headless/notifications.rs:301— src/server/headless/notifications.rs changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 52 in HeadlessServer::handle_internal_event_with_forwarding at line 301. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/server/headless/notifications.rs`: 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: REDACTED REDACTED:3287— REDACTED changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in herdr::remote::attach::bridge_child at line 3287. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- REDACTED`: 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: src/platform/windows.rs src/platform/windows.rs:2807— src/platform/windows.rs changed 48 times in last 90 days and 41 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 herdr::platform::windows::write_clipboard at line 2807), 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: prevent windows ssh output from delaying typing (#5463)”; “fix: recover endpoint connections promptly after wake (#5249)”; “fix: cancel and clean up endpoint connection attempts (#5247)”; “fix: enforce handshake response deadlines (#5242)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/platform/windows.rs`: 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: src/platform/mod.rs src/platform/mod.rs:491— src/platform/mod.rs changed 36 times in last 90 days and 30 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 herdr::platform::read_limited_reader at line 491), 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: keep the saved layout when panes die during host shutdown (#5510)”; “fix: keep polling when a resize samples a zero-sized grid (#5310)”; “fix: keep the macos server running when its terminal quits (#5236)”; “fix: recover endpoint connections promptly after wake (#5249)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/platform/mod.rs`: 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: src/platform/linux.rs src/platform/linux.rs:489— src/platform/linux.rs changed 25 times in last 90 days and 20 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 herdr::platform::linux::process_tree_pids at line 489), 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: bound clipboard helpers so a hung wl-copy or wl-paste can't freeze herdr (#5583)”; “fix: recover blocked shared ssh connections (#5252)”; “fix: recover endpoint connections promptly after wake (#5249)”; “fix: keep agent sessions while the agent is suspended or backgrounded (#4964)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/platform/linux.rs`: 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: src/platform/unix_common.rs src/platform/unix_common.rs:439— src/platform/unix_common.rs changed 20 times in last 90 days and 17 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 herdr::platform::unix_common::create_remote_ssh_config_dir at line 439), 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: keep the saved layout when panes die during host shutdown (#5510)”; “fix: recover blocked shared ssh connections (#5252)”; “fix: cancel and clean up endpoint connection attempts (#5247)”; “fix: enforce handshake response deadlines (#5242)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/platform/unix_common.rs`: 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: src/platform/macos.rs src/platform/macos.rs:561— src/platform/macos.rs changed 19 times in last 90 days and 16 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 herdr::platform::macos::process_argv0_name at line 561), 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: keep the macos server running when its terminal quits (#5236)”; “fix: recover blocked shared ssh connections (#5252)”; “fix: recover endpoint connections promptly after wake (#5249)”; “fix: reject oversized canonical input on macos (#4988)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/platform/macos.rs`: 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: src/detect/mod.rs src/detect/mod.rs:705— src/detect/mod.rs changed 21 times in last 90 days and 14 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 herdr::detect::agent_name_from_known_package_path at line 705), 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: detect hermes started by the newer installer launcher (#5518)”; “fix: keep agent sessions while the agent is suspended or backgrounded (#4964)”; “fix: recognize Hermes launched through its Python wrapper (#4911)”; “fix(windows): read agent command lines without PROCESS_VM_READ (#4708)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/detect/mod.rs`: 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: src/terminal/runtime.rs src/terminal/runtime.rs:518— src/terminal/runtime.rs changed 24 times in last 90 days and 13 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is TerminalRuntime::screen_text_snapshot_with_seq at line 518), 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: send pane appearance changes only after the matching background (#5517)”; “fix: reject oversized canonical input on macos (#4988)”; “fix: keep offscreen kitty images loaded instead of resending them on scroll (#4686)”; “fix: keep synchronized pane frames atomic (#4508)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/terminal/runtime.rs`: 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: src/platform/fallback.rs src/platform/fallback.rs:60— src/platform/fallback.rs changed 13 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 4 (its worst body is herdr::platform::fallback::create_remote_ssh_config_dir at line 60), 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: keep agent sessions while the agent is suspended or backgrounded (#4964)”; “fix: keep the server running on hangup and log why it stops (#4965)”; “fix(windows): avoid redundant clipboard history entries (#4709)”; “fix: clean up idle ssh bridges and back off flapping connections (#4083)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/platform/fallback.rs`: 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: src/input/parse.rs src/input/parse.rs:13— src/input/parse.rs changed 11 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 12 (its worst body is herdr::input::parse::parse_kitty_key_sequence at line 13), 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: map non-latin layout ctrl chords to their base keys (#4961)”; “fix(input): accept parameterized CSI-tilde F1-F4 keys (#4067)”; “fix: recognize kitty CSI-u codepoints for F1 through F12 (#2378)”; “fix(input): accept WezTerm control key reports (#3592)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/input/parse.rs`: 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: src/protocol/wire.rs src/protocol/wire.rs:284— src/protocol/wire.rs changed 14 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 8 (its worst body is ClientMouseKind::from_crossterm at line 284), 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: capture Windows host default colors at startup (#4710)”; “fix: keep remote surface updates incremental (#4209)”; “fix: avoid resending terminal cells for metadata updates (#4137)”; “fix: suppress Windows dead-key fallback characters in remote panes (#3972)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/protocol/wire.rs`: 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: src/integration/targets.rs src/integration/targets.rs:372— src/integration/targets.rs 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 11 (its worst body is herdr::integration::targets::install_droid at line 372), 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: drop codex turn status hooks (#5278)”; “fix: report codex turn completion through hooks (#4756)”; “fix: respect opencode tui.json registrations (#4250)”; “fix: protect integration configs from failed writes (#3973)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/integration/targets.rs`: 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: src/client/endpoint/supervisor.rs src/client/endpoint/supervisor.rs:319— src/client/endpoint/supervisor.rs changed 9 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 EndpointSupervisors::host_power_event at line 319), 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: prevent windows ssh output from delaying typing (#5463)”; “fix: recover endpoint connections promptly after wake (#5249)”; “fix: cancel and clean up endpoint connection attempts (#5247)”; “fix: allow busy servers time to become ready (#5241)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/client/endpoint/supervisor.rs`: 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: src/server/headless/client_views.rs src/server/headless/client_views.rs:810— src/server/headless/client_views.rs 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 15 (its worst body is HeadlessServer::handle_api_request_with_shutdown_check at line 810), 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: move worktree lookups async (#4492)”; “fix: stagger restored agent startups (#4487)”; “fix: keep remote surface updates incremental (#4209)”; “fix: reconcile client locations after no-focus pane moves (#4171)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/server/headless/client_views.rs`: 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: src/app/runtime.rs src/app/runtime.rs:58— src/app/runtime.rs 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 4 (its worst body is App::expire_metadata_at at line 58), 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: send pane appearance changes only after the matching background (#5517)”; “fix: keep the server alive when thread spawns fail (#4958)”; “fix: isolate hidden pane render cadence (#2892)”; “fix: reap ctrl-click url openers (#2906)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/app/runtime.rs`: 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: src/app/api/agents.rs src/app/api/agents.rs:140— src/app/api/agents.rs changed 8 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 11 (its worst body is App::validate_agent_prompt 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: keep the server alive when thread spawns fail (#4958)”; “fix: keep an agent name through a process-exit observation (#3574)”; “fix: flush Windows Codex paste burst before prompt submit (#3961)”; “fix: make Windows Codex prompt delay size-aware (#3552)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/app/api/agents.rs`: 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: src/terminal_modes.rs src/terminal_modes.rs:74— src/terminal_modes.rs changed 8 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 7 (its worst body is herdr::terminal_modes::set_direct_host_keyboard_protocol at line 74), 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): preserve mouse capture during refresh (#4319)”; “fix(windows): preserve sgr mouse encoding after native capture (#4195)”; “fix(windows): restore mouse reporting when reattaching (#4080)”; “fix(windows): disable host mouse reporting on terminal restore (#4055)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/terminal_modes.rs`: 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: src/client/handshake.rs src/client/handshake.rs:172— src/client/handshake.rs changed 10 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 14 (its worst body is herdr::client::handshake::do_handshake at line 172), 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: prevent windows ssh output from delaying typing (#5463)”; “fix: cancel and clean up endpoint connection attempts (#5247)”; “fix: enforce handshake response deadlines (#5242)”; “fix: keep sgr pixel mouse units consistent (#4971)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/client/handshake.rs`: 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: src/input/model.rs src/input/model.rs:248— src/input/model.rs changed 9 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 7 (its worst body is TerminalKey::with_text_commit at line 248), 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: map non-latin layout ctrl chords to their base keys (#4961)”; “fix: suppress Windows dead-key fallback characters in remote panes (#3972)”; “fix(windows): preserve dead-key composition in kitty panes (#3548)”; “fix(windows): preserve native pane key identity (#3503)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/input/model.rs`: 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: src/cli/pane.rs src/cli/pane.rs:13— src/cli/pane.rs 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 12 (its worst body is herdr::cli::pane::run_pane_command at line 13), 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: default pane splits to the calling pane (#4123)”; “fix(cli): accept reordered agent report arguments (#2928)”; “fix(cli): accept --flag=value and reordered options in pane read/wait-output (#2183)”; “fix(cli): resolve pane query --current from caller (#2298)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/cli/pane.rs`: 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: src/server/clients.rs src/server/clients.rs:377— src/server/clients.rs 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 9 (its worst body is ClientConnection::update_host_theme at line 377), 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: distinguish agent completion from startup and session changes (#4457)”; “fix: keep remote surface updates incremental (#4209)”; “fix: scope agent views to the selected machine (#3784)”; “fix(windows): preserve native pane key identity (#3503)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/server/clients.rs`: 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: src/ipc.rs src/ipc.rs:128— src/ipc.rs 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 7 (its worst body is herdr::ipc::prepare_socket_path at line 128), 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: keep a slow server's socket instead of treating a connect timeout as stale (#5511)”; “fix: prevent windows ssh output from delaying typing (#5463)”; “fix: cancel and clean up endpoint connection attempts (#5247)”; “fix: allow same-user Windows clients to attach across elevation (#4777)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/ipc.rs`: 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: src/server/headless/bootstrap.rs src/server/headless/bootstrap.rs:4— src/server/headless/bootstrap.rs 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 10 (its worst body is herdr::server::headless::bootstrap::run_server at line 4), 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: keep the macos server running when its terminal quits (#5236)”; “fix: save sessions before agents die during macos restart (#5092)”; “fix: keep the server running on hangup and log why it stops (#4965)”; “fix: require opt-in for cross-elevation Windows access (#4779)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/server/headless/bootstrap.rs`: 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: src/app/api/worktrees/deferred.rs src/app/api/worktrees/deferred.rs:520— src/app/api/worktrees/deferred.rs 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 14 (its worst body is App::handle_api_worktree_remove_finished at line 520), 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: keep the server alive when thread spawns fail (#4958)”; “fix: keep session restore responsive during git discovery (#4945)”; “fix: move worktree lookups async (#4492)”; “fix(windows): remove worktrees with active agent panes (#3532)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/app/api/worktrees/deferred.rs`: 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: src/pty/actor.rs src/pty/actor.rs:205— src/pty/actor.rs 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 10 (its worst body is PtyIoActor::spawn at line 205), 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: keep the server alive when thread spawns fail (#4958)”; “fix(windows): bound queued Enter waits during pane shutdown (#4872)”; “fix: make Windows Codex prompt delay size-aware (#3552)”; “fix: reliably submit delayed agent prompts (#3506)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/pty/actor.rs`: 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: src/app/api/plugins/panes.rs src/app/api/plugins/panes.rs:82— src/app/api/plugins/panes.rs 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 14 (its worst body is App::open_plugin_split_pane at line 82), 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: send pane appearance changes only after the matching background (#5517)”; “fix: hidden pane memory and new pane spawn size (#4873)”; “fix: keep plugins working after client-only updates (#4077)”; “fix: synchronize plugin pane pwd (#2985)”. 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-07-31..2026-10-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-31 15:56:49 +03:00' --until='2026-10-29 15:56:49 +03:00' --full-history --no-merges -- src/app/api/plugins/panes.rs`: 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.
herdr::client::run_client_loop (cyclomatic 262) src/client/mod.rs:437— herdr::client::run_client_loop has cyclomatic complexity 262 (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.
herdr::pane::terminal::ghostty_collect_dirty_patch (cyclomatic 65) src/pane/terminal.rs:2617— herdr::pane::terminal::ghostty_collect_dirty_patch has cyclomatic complexity 65 (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.
herdr::integration::actions::uninstall_target (cyclomatic 49) src/integration/actions.rs:326— herdr::integration::actions::uninstall_target has cyclomatic complexity 49 (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.
herdr::server::client_transport::client_read_loop_with_endpoint_controls (cyclomatic 48) src/server/client_transport.rs:1002— herdr::server::client_transport::client_read_loop_with_endpoint_controls has cyclomatic complexity 48 (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.
herdr::client::shell::overlays::render_navigator_overlay (cyclomatic 44) src/client/shell/overlays.rs:704— herdr::client::shell::overlays::render_navigator_overlay 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.
herdr::client::direct_graphics::valid_control (cyclomatic 42) src/client/direct_graphics.rs:215— herdr::client::direct_graphics::valid_control has cyclomatic complexity 42 (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.
herdr::client::shell::mobile::mobile_items (cyclomatic 39) src/client/shell/mobile.rs:575— herdr::client::shell::mobile::mobile_items has cyclomatic complexity 39 (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.
herdr::client::input::unix_stdin_reader_loop (cyclomatic 38) src/client/input.rs:80— herdr::client::input::unix_stdin_reader_loop has cyclomatic complexity 38 (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.
herdr::client::shell::endpoint_sidebar::render_collapsed (cyclomatic 34) src/client/shell/endpoint_sidebar.rs:15— herdr::client::shell::endpoint_sidebar::render_collapsed 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.
herdr::config::keybinds::parse_key_combo (cyclomatic 33) src/config/keybinds.rs:1281— herdr::config::keybinds::parse_key_combo has cyclomatic complexity 33 (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.
herdr::persist::restore::restore_tab (cyclomatic 33) src/persist/restore.rs:491— herdr::persist::restore::restore_tab 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.
herdr::main (cyclomatic 32) src/main.rs:511— herdr::main 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.
herdr::client::shell::aggregate_navigation::navigator_rows (cyclomatic 32) src/client/shell/aggregate_navigation.rs:278— herdr::client::shell::aggregate_navigation::navigator_rows has cyclomatic complexity 32 (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.
herdr::client::shell::endpoint_sidebar::render_expanded (cyclomatic 31) src/client/shell/endpoint_sidebar.rs:237— herdr::client::shell::endpoint_sidebar::render_expanded 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.
herdr::client::shell::tabs::render_tab_bar (cyclomatic 30) src/client/shell/tabs.rs:7— herdr::client::shell::tabs::render_tab_bar 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.
herdr::pane::spawn_basic_detection_task (cyclomatic 29) src/pane.rs:929— herdr::pane::spawn_basic_detection_task 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.
herdr::ui::sidebar::resolved_token_spans (cyclomatic 29) src/ui/sidebar.rs:106— herdr::ui::sidebar::resolved_token_spans 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.
herdr::platform::macos::input::longest_canonical_line (cyclomatic 28) src/platform/macos/input.rs:62— herdr::platform::macos::input::longest_canonical_line 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.
herdr::config::theme::parse_color (cyclomatic 26) src/config/theme.rs:155— herdr::config::theme::parse_color 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.
herdr::kitty_graphics::surface::collect_scene (cyclomatic 26) src/kitty_graphics/surface.rs:575— herdr::kitty_graphics::surface::collect_scene 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.
herdr::client::shell::render::render_mode_bar (cyclomatic 25) src/client/shell/render.rs:31— herdr::client::shell::render::render_mode_bar 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.
herdr::api::wait::wait_for_resolved_agent (cyclomatic 24) src/api/wait.rs:364— herdr::api::wait::wait_for_resolved_agent 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.
herdr::integration::actions::install_target_inner (cyclomatic 23) src/integration/actions.rs:78— herdr::integration::actions::install_target_inner has cyclomatic complexity 23 (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.
herdr::platform::linux::clipboard::run (cyclomatic 23) src/platform/linux/clipboard.rs:36— herdr::platform::linux::clipboard::run 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.
herdr::client::shell_runtime::begin_endpoint_activation (cyclomatic 22) src/client/shell_runtime.rs:224— herdr::client::shell_runtime::begin_endpoint_activation 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.
MethodTooLong: ClientShellState.handle_mouse src/client/shell/mouse.rs:683— MethodTooLong — handle_mouse runs 1267 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1167 over it, 12.67× 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: ClientShellState.compose src/client/shell/composition.rs:150— MethodTooLong — compose runs 484 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 384 over it, 4.84× 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: HeadlessServer.render_and_stream_with_graphics_limit src/server/headless/render.rs:454— MethodTooLong — render_and_stream_with_graphics_limit runs 419 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 319 over it, 4.19× 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: App.handle_pane_move src/app/api/panes.rs:947— MethodTooLong — handle_pane_move runs 331 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 231 over it, 3.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: ClientShellState.route_overlay_key src/client/shell/overlay_input.rs:479— MethodTooLong — route_overlay_key runs 330 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 230 over it, 3.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: HeadlessServer.render_retained_pane_surface_and_stream src/server/headless/retained_surface.rs:227— MethodTooLong — render_retained_pane_surface_and_stream runs 293 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 193 over it, 2.93× 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: HeadlessServer.handle_internal_event_with_forwarding src/server/headless/notifications.rs:301— MethodTooLong — handle_internal_event_with_forwarding runs 286 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 186 over it, 2.86× 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: ClientShellState.handle_endpoint_result src/client/shell/actions.rs:499— MethodTooLong — handle_endpoint_result runs 274 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 174 over it, 2.74× 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: App.handle_api_request_after_internal_events_drained src/app/api.rs:935— MethodTooLong — handle_api_request_after_internal_events_drained runs 251 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 151 over it, 2.51× 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: App.handle_internal_event_with_pane_updates src/app/api.rs:89— MethodTooLong — handle_internal_event_with_pane_updates runs 241 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 141 over it, 2.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: AppState.handle_app_event src/app/actions.rs:1392— MethodTooLong — handle_app_event runs 237 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 137 over it, 2.37× 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: ClientShellState.apply_active_snapshot src/client/shell/state.rs:1299— MethodTooLong — apply_active_snapshot runs 237 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 137 over it, 2.37× 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: Config.validated_keybinds src/config/keybinds.rs:499— MethodTooLong — validated_keybinds runs 230 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 130 over it, 2.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: TerminalState.set_detected_state_with_screen_signals_at src/terminal/state.rs:359— MethodTooLong — set_detected_state_with_screen_signals_at runs 226 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 126 over it, 2.26× 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: ClientShellState.endpoint_method_for_action src/client/shell/actions.rs:860— MethodTooLong — endpoint_method_for_action runs 207 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 107 over it, 2.07× 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: ClientShellState.record_binding src/client/shell/actions.rs:4— MethodTooLong — record_binding runs 203 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 103 over it, 2.03× 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: TerminalState.set_agent_session_ref_for_session_start src/terminal/state.rs:1461— MethodTooLong — set_agent_session_ref_for_session_start runs 190 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 90 over it, 1.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.
MethodTooLong: RawInputByteFramer.flush_timeout src/raw_input.rs:476— MethodTooLong — flush_timeout runs 178 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 78 over it, 1.78× 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: PendingAltScreenRead.poll src/server/alt_screen_read.rs:136— MethodTooLong — poll runs 164 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 64 over it, 1.64× 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: HeadlessServer.perform_live_handoff src/server/headless/lifecycle.rs:25— MethodTooLong — perform_live_handoff runs 146 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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: App.handle_layout_apply src/app/api/layouts.rs:34— MethodTooLong — handle_layout_apply runs 144 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 44 over it, 1.44× 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: ClientShellState.handle_worktree_endpoint_result src/client/shell/worktrees.rs:368— MethodTooLong — handle_worktree_endpoint_result runs 141 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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: App.handle_pane_swap src/app/api/panes.rs:774— MethodTooLong — handle_pane_swap runs 132 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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: ClientShellState.install_pane_surface src/client/shell/state.rs:1642— MethodTooLong — install_pane_surface runs 132 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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: App.handle_pane_report_metadata src/app/api/panes.rs:1701— MethodTooLong — handle_pane_report_metadata runs 129 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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.
FunctionTooLong: herdr::client::run_client_loop src/client/mod.rs:437— FunctionTooLong — herdr::client::run_client_loop runs 1504 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 1404 over it, 15.04× 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: herdr::integration::actions::uninstall_target src/integration/actions.rs:326— FunctionTooLong — herdr::integration::actions::uninstall_target runs 330 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 230 over it, 3.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.
FunctionTooLong: herdr::client::shell::overlays::render_navigator_overlay src/client/shell/overlays.rs:704— FunctionTooLong — herdr::client::shell::overlays::render_navigator_overlay runs 293 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 193 over it, 2.93× 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: herdr::client::shell::mobile::mobile_items src/client/shell/mobile.rs:575— FunctionTooLong — herdr::client::shell::mobile::mobile_items runs 288 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 188 over it, 2.88× 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: herdr::client::shell::endpoint_sidebar::render_expanded src/client/shell/endpoint_sidebar.rs:237— FunctionTooLong — herdr::client::shell::endpoint_sidebar::render_expanded runs 280 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 180 over it, 2.80× 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: herdr::persist::restore::restore_tab src/persist/restore.rs:491— FunctionTooLong — herdr::persist::restore::restore_tab runs 269 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 169 over it, 2.69× 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: herdr::server::client_shell::snapshot_with_completions src/server/client_shell.rs:17— FunctionTooLong — herdr::server::client_shell::snapshot_with_completions runs 222 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 122 over it, 2.22× 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: herdr::client::shell::sidebar::render_sidebar src/client/shell/sidebar.rs:199— FunctionTooLong — herdr::client::shell::sidebar::render_sidebar runs 214 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 114 over it, 2.14× 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: herdr::main src/main.rs:511— FunctionTooLong — herdr::main runs 212 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 112 over it, 2.12× 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: herdr::client::shell::settings_overlay::render_settings_overlay src/client/shell/settings_overlay.rs:36— FunctionTooLong — herdr::client::shell::settings_overlay::render_settings_overlay runs 183 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 83 over it, 1.83× 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: herdr::client::shell::tabs::render_tab_bar src/client/shell/tabs.rs:7— FunctionTooLong — herdr::client::shell::tabs::render_tab_bar runs 181 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 81 over it, 1.81× 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: herdr::client::shell::endpoint_sidebar::render_collapsed src/client/shell/endpoint_sidebar.rs:15— FunctionTooLong — herdr::client::shell::endpoint_sidebar::render_collapsed runs 178 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 78 over it, 1.78× 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: herdr::client::run_client_with_mode src/client/mod.rs:175— FunctionTooLong — herdr::client::run_client_with_mode runs 172 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 72 over it, 1.72× 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: herdr::integration::actions::install_target_inner src/integration/actions.rs:78— FunctionTooLong — herdr::integration::actions::install_target_inner runs 171 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 71 over it, 1.71× 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: herdr::client::shell::worktree_overlays::render_worktree_open_overlay src/client/shell/worktree_overlays.rs:109— FunctionTooLong — herdr::client::shell::worktree_overlays::render_worktree_open_overlay runs 170 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 70 over it, 1.70× 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: herdr::server::client_shell::render_pane_surface src/server/client_shell.rs:286— FunctionTooLong — herdr::server::client_shell::render_pane_surface runs 168 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 68 over it, 1.68× 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: herdr::kitty_graphics::surface::collect_scene src/kitty_graphics/surface.rs:575— FunctionTooLong — herdr::kitty_graphics::surface::collect_scene runs 164 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 64 over it, 1.64× 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: herdr::client::shell::render::render_mode_bar src/client/shell/render.rs:31— FunctionTooLong — herdr::client::shell::render::render_mode_bar runs 163 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 63 over it, 1.63× 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: herdr::client::shell::aggregate_navigation::navigator_rows src/client/shell/aggregate_navigation.rs:278— FunctionTooLong — herdr::client::shell::aggregate_navigation::navigator_rows runs 152 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 52 over it, 1.52× 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: herdr::client::input::unix_stdin_reader_loop src/client/input.rs:80— FunctionTooLong — herdr::client::input::unix_stdin_reader_loop runs 151 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 51 over it, 1.51× 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: herdr::api::server::handle_connection_with_stop src/api/server.rs:328— FunctionTooLong — herdr::api::server::handle_connection_with_stop runs 149 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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.
FunctionTooLong: herdr::ui::sidebar::resolved_token_spans src/ui/sidebar.rs:106— FunctionTooLong — herdr::ui::sidebar::resolved_token_spans runs 136 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 36 over it, 1.36× 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: herdr::client::shell::mobile::render_mobile_switcher src/client/shell/mobile.rs:363— FunctionTooLong — herdr::client::shell::mobile::render_mobile_switcher runs 134 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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.
FunctionTooLong: herdr::client::shell::sidebar::render_collapsed_sidebar src/client/shell/sidebar.rs:47— FunctionTooLong — herdr::client::shell::sidebar::render_collapsed_sidebar runs 124 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 24 over it, 1.24× 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: herdr::remote::attach::bridge_child REDACTED:3287— FunctionTooLong — herdr::remote::attach::bridge_child runs 121 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 21 over it, 1.21× 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.
ClientShellState::handle_mouse (cognitive 515) src/client/shell/mouse.rs:683— ClientShellState::handle_mouse has cognitive complexity 515 (threshold 15). Drivers by points: if/else 186 (447 pts), match/switch 18 (43 pts), boolean chains 25 (nesting depth added 286). 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.
ClientShellState::route_overlay_key (cognitive 193) src/client/shell/overlay_input.rs:479— ClientShellState::route_overlay_key has cognitive complexity 193 (threshold 15). Drivers by points: if/else 63 (144 pts), match/switch 12 (31 pts), boolean chains 18 (nesting depth added 100). 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.
ClientShellState::compose (cognitive 108) src/client/shell/composition.rs:150— ClientShellState::compose has cognitive complexity 108 (threshold 15). Drivers by points: if/else 48 (76 pts), boolean chains 17, match/switch 4 (8 pts), loops 2 (7 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClientShellState::record_binding (cognitive 77) src/client/shell/actions.rs:4— ClientShellState::record_binding has cognitive complexity 77 (threshold 15). Drivers by points: if/else 34 (72 pts), boolean chains 4, match/switch 1 (nesting depth added 38). 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.
ClientShellState::apply_active_snapshot (cognitive 76) src/client/shell/state.rs:1299— ClientShellState::apply_active_snapshot has cognitive complexity 76 (threshold 15). Drivers by points: if/else 30 (47 pts), boolean chains 22, match/switch 5 (7 pts) (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.
ClientShellState::handle_endpoint_result (cognitive 63) src/client/shell/actions.rs:499— ClientShellState::handle_endpoint_result has cognitive complexity 63 (threshold 15). Drivers by points: if/else 15 (33 pts), match/switch 11 (21 pts), boolean chains 9 (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.
ClientShellState::handle_raw_events (cognitive 62) src/client/shell/input.rs:223— ClientShellState::handle_raw_events has cognitive complexity 62 (threshold 15). Drivers by points: if/else 20 (51 pts), match/switch 3 (7 pts), boolean chains 3, loops 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClientShellState::install_pane_surface (cognitive 53) src/client/shell/state.rs:1642— ClientShellState::install_pane_surface has cognitive complexity 53 (threshold 15). Drivers by points: if/else 22 (40 pts), boolean chains 11, loops 1, match/switch 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.
ClientShellState::route_worktree_overlay_key (cognitive 51) src/client/shell/worktrees.rs:46— ClientShellState::route_worktree_overlay_key has cognitive complexity 51 (threshold 15). Drivers by points: if/else 12 (41 pts), match/switch 4 (7 pts), boolean chains 3 (nesting depth added 32). 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.
ClientShellState::endpoint_method_for_action (cognitive 37) src/client/shell/actions.rs:860— ClientShellState::endpoint_method_for_action has cognitive complexity 37 (threshold 15). Drivers by points: if/else 19 (32 pts), match/switch 3 (4 pts), boolean chains 1 (nesting depth added 14). 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.
ClientShellState::apply_pane_surface_patch (cognitive 34) src/client/shell/surface_patch.rs:109— ClientShellState::apply_pane_surface_patch has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 5, loops 3 (4 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.
ClientShellState::route_key_press (cognitive 30) src/client/shell/input.rs:610— ClientShellState::route_key_press has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (26 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.
ClientShellState::handle_endpoint_navigation (cognitive 25) src/client/shell/endpoint_navigation.rs:106— ClientShellState::handle_endpoint_navigation has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 3 (7 pts), boolean chains 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.
ClientShellState::handle_mobile_mouse (cognitive 24) src/client/shell/mobile.rs:944— ClientShellState::handle_mobile_mouse has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 3, match/switch 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.
ClientShellState::tick_notifications (cognitive 23) src/client/shell/notification_policy.rs:147— ClientShellState::tick_notifications has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 3 (9 pts), boolean chains 2, 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.
ClientShellState::move_navigate_workspace (cognitive 22) src/client/shell/workspace_navigation.rs:99— ClientShellState::move_navigate_workspace has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5, loops 2 (3 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.
ClientShellState::cache_endpoint_snapshot_with_surface (cognitive 20) src/client/shell/endpoints.rs:543— ClientShellState::cache_endpoint_snapshot_with_surface has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 7, loops 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, 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.
ClientShellState::handle_worktree_endpoint_result (cognitive 20) src/client/shell/worktrees.rs:368— ClientShellState::handle_worktree_endpoint_result has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 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.
ClientShellState::route_navigate_key (cognitive 18) src/client/shell/input.rs:751— ClientShellState::route_navigate_key has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2, match/switch 1 (2 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.
ClientShellState::explicit_link_regions (cognitive 18) src/client/shell/link_hover.rs:231— ClientShellState::explicit_link_regions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, loops 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.
ClientShellState::update_selection_drag (cognitive 17) src/client/shell/mouse.rs:206— ClientShellState::update_selection_drag has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, match/switch 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.
ClientShellState::route_copy_mode_key (cognitive 16) src/client/shell/copy_mode.rs:104— ClientShellState::route_copy_mode_key has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 3, 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.
ClientShellState::handle_key (cognitive 16) src/client/shell/input.rs:378— ClientShellState::handle_key has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, 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.
ClientShellState::handle_mouse (cyclomatic 269) src/client/shell/mouse.rs:683— ClientShellState::handle_mouse has cyclomatic complexity 269 (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.
ClientShellState::route_overlay_key (cyclomatic 127) src/client/shell/overlay_input.rs:479— ClientShellState::route_overlay_key has cyclomatic complexity 127 (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.
ClientShellState::compose (cyclomatic 64) src/client/shell/composition.rs:150— ClientShellState::compose has cyclomatic complexity 64 (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.
ClientShellState::handle_endpoint_result (cyclomatic 63) src/client/shell/actions.rs:499— ClientShellState::handle_endpoint_result has cyclomatic complexity 63 (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.
ClientShellState::apply_active_snapshot (cyclomatic 60) src/client/shell/state.rs:1299— ClientShellState::apply_active_snapshot has cyclomatic complexity 60 (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.
ClientShellState::route_copy_mode_key (cyclomatic 47) src/client/shell/copy_mode.rs:104— ClientShellState::route_copy_mode_key has cyclomatic complexity 47 (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.
ClientShellState::record_binding (cyclomatic 40) src/client/shell/actions.rs:4— ClientShellState::record_binding 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.
ClientShellState::endpoint_method_for_action (cyclomatic 40) src/client/shell/actions.rs:860— ClientShellState::endpoint_method_for_action 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.
ClientShellState::install_pane_surface (cyclomatic 36) src/client/shell/state.rs:1642— ClientShellState::install_pane_surface 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.
ClientShellState::handle_raw_events (cyclomatic 35) src/client/shell/input.rs:223— ClientShellState::handle_raw_events 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.
ClientShellState::route_worktree_overlay_key (cyclomatic 28) src/client/shell/worktrees.rs:46— ClientShellState::route_worktree_overlay_key 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.
ClientShellState::handle_mobile_mouse (cyclomatic 25) src/client/shell/mobile.rs:944— ClientShellState::handle_mobile_mouse 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.
ClientShellState::route_key_press (cyclomatic 24) src/client/shell/input.rs:610— ClientShellState::route_key_press 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.
ClientShellState::handle_worktree_endpoint_result (cyclomatic 22) src/client/shell/worktrees.rs:368— ClientShellState::handle_worktree_endpoint_result 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.
ClientShellState::apply_pane_surface_patch (cyclomatic 21) src/client/shell/surface_patch.rs:109— ClientShellState::apply_pane_surface_patch 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.
ClientShellState::handle_endpoint_navigation (cyclomatic 20) src/client/shell/endpoint_navigation.rs:106— ClientShellState::handle_endpoint_navigation 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.
ClientShellState::route_navigate_key (cyclomatic 19) src/client/shell/input.rs:751— ClientShellState::route_navigate_key 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.
ClientShellState::tick_notifications (cyclomatic 18) src/client/shell/notification_policy.rs:147— ClientShellState::tick_notifications 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.
ClientShellState::cache_endpoint_snapshot_with_surface (cyclomatic 17) src/client/shell/endpoints.rs:543— ClientShellState::cache_endpoint_snapshot_with_surface 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.
ClientShellState::move_navigate_workspace (cyclomatic 17) src/client/shell/workspace_navigation.rs:99— ClientShellState::move_navigate_workspace 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.
App::handle_pane_move (cognitive 91) src/app/api/panes.rs:947— App::handle_pane_move has cognitive complexity 91 (threshold 15). Drivers by points: if/else 45 (79 pts), match/switch 6 (8 pts), boolean chains 4 (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.
App::handle_internal_event_with_pane_updates (cognitive 87) src/app/api.rs:89— App::handle_internal_event_with_pane_updates has cognitive complexity 87 (threshold 15). Drivers by points: if/else 48 (80 pts), boolean chains 5, loops 1, match/switch 1 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App::apply_live_config (cognitive 44) src/app/mod.rs:861— App::apply_live_config has cognitive complexity 44 (threshold 15). Drivers by points: if/else 26 (33 pts), boolean chains 6, match/switch 2 (5 pts) (nesting depth added 10). 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.
App::handle_layout_apply (cognitive 35) src/app/api/layouts.rs:34— App::handle_layout_apply has cognitive complexity 35 (threshold 15). Drivers by points: if/else 21 (25 pts), match/switch 5 (6 pts), boolean chains 3, loops 1 (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.
App::handle_pane_swap (cognitive 33) src/app/api/panes.rs:774— App::handle_pane_swap has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (25 pts), match/switch 4 (6 pts), boolean chains 2 (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.
App::handle_pane_report_metadata (cognitive 33) src/app/api/panes.rs:1701— App::handle_pane_report_metadata has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (15 pts), match/switch 9 (12 pts), boolean chains 6 (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.
App::pending_agent_resume_candidates (cognitive 24) src/app/agent_resume.rs:99— App::pending_agent_resume_candidates has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 3 (6 pts), boolean chains 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.
App::restore_shutdown_worktree_panes (cognitive 24) src/app/api/worktrees/deferred.rs:641— App::restore_shutdown_worktree_panes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (23 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.
App::handle_plugin_pane_open (cognitive 23) src/app/api/plugins/mod.rs:436— App::handle_plugin_pane_open has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 5, match/switch 2 (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.
App::custom_command_env (cognitive 23) src/app/custom_commands.rs:244— App::custom_command_env has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (23 pts) (nesting depth added 15). 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.
App::finish_worktree_open (cognitive 21) src/app/api/worktrees.rs:69— App::finish_worktree_open has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 3, match/switch 2 (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.
App::find_plugin_link_handler (cognitive 19) src/app/api/plugins/mod.rs:665— App::find_plugin_link_handler has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2 (3 pts), 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.
App::handle_api_worktree_remove_finished (cognitive 18) src/app/api/worktrees/deferred.rs:520— App::handle_api_worktree_remove_finished has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 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.
App::handle_pane_copy_motion (cognitive 16) src/app/api/panes.rs:292— App::handle_pane_copy_motion has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 3 (5 pts), boolean chains 2 (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.
App::handle_workspace_move_block (cognitive 16) src/app/api/workspaces.rs:171— App::handle_workspace_move_block has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1, 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.
Duplicated block (8 lines × 2) src/app/actions.rs:700— src/app/actions.rs:700-707 | src/app/actions.rs:2109-2116 — 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 `self` to `crate) fn close_workspaces(&mut` in one and `&mut` 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 (8 lines × 2) src/app/custom_commands.rs:312— src/app/custom_commands.rs:312-319 | src/app/custom_commands.rs:456-463 — 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 `self` to `crate) fn open_focused_scrollback_in_editor(&mut` in one and `&mut` 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 (8 lines × 2) src/client/shell/endpoint_sidebar.rs:393— src/client/shell/endpoint_sidebar.rs:393-400 | src/client/shell/sidebar.rs:294-301 — before extracting anything, compare `src/client/shell/endpoint_sidebar.rs` and `src/client/shell/sidebar.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 69 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) src/client/shell/state.rs:1621— src/client/shell/state.rs:1621-1628 | src/client/shell/state.rs:1650-1658 — 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 `src/client/shell/state.rs:1621` 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 `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 `self` to `crate) fn set_pane_surface(&mut` in one and `&mut` 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 (8 lines × 2) src/integration/targets.rs:1501— src/integration/targets.rs:1501-1508 | src/integration/targets.rs:1605-1612 — 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 `src/integration/targets.rs:1501` 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) src/pane.rs:1007— src/pane.rs:1007-1014 | src/pane.rs:2942-2949 — 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) src/platform/windows.rs:185— src/platform/windows.rs:185-192 | src/platform/windows.rs:227-234 — 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 `src/platform/windows.rs:185` 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) src/platform/windows/clipboard_image.rs:190— src/platform/windows/clipboard_image.rs:190-197 | src/platform/windows/clipboard_image.rs:199-206 — 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 (8 lines × 2) src/server/headless.rs:1316— src/server/headless.rs:1316-1323 | src/server/headless.rs:1818-1825 — 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 `src/server/headless.rs:1316` 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) src/server/headless/lifecycle.rs:183— src/server/headless/lifecycle.rs:183-190 | src/server/headless/lifecycle.rs:200-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 `src/server/headless/lifecycle.rs:183` 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) src/app/api/agents.rs:276— src/app/api/agents.rs:276-283 | src/app/api/agents.rs:313-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 first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) fn handle_agent_read( &mut` in one and `super) fn handle_agent_explain(&mut` 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 (8 lines × 2) src/product_announcements.rs:211— src/product_announcements.rs:211-218 | src/release_notes.rs:59-66 — 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 `src/product_announcements.rs:211` 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 (8 lines × 2) src/product_announcements.rs:220— src/product_announcements.rs:220-227 | src/release_notes.rs: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.
Duplicated block (8 lines × 2) src/api/subscriptions.rs:596— src/api/subscriptions.rs:596-603 | src/api/subscriptions.rs:636-643 — 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 `src/api/subscriptions.rs:596` 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) src/config/io.rs:47— src/config/io.rs:47-54 | src/config/io.rs:73-80 — 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 `src/config/io.rs:47` 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.
HeadlessServer::handle_server_event (cognitive 213) src/server/headless.rs:1849— HeadlessServer::handle_server_event has cognitive complexity 213 (threshold 15). Drivers by points: if/else 81 (175 pts), boolean chains 26, match/switch 6 (12 pts) (nesting depth added 100). 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.
HeadlessServer::render_and_stream_with_graphics_limit (cognitive 205) src/server/headless/render.rs:454— HeadlessServer::render_and_stream_with_graphics_limit has cognitive complexity 205 (threshold 15). Drivers by points: if/else 61 (147 pts), match/switch 10 (34 pts), boolean chains 13, loops 5 (11 pts) (nesting depth added 116). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HeadlessServer::render_retained_pane_surface_and_stream (cognitive 112) src/server/headless/retained_surface.rs:227— HeadlessServer::render_retained_pane_surface_and_stream has cognitive complexity 112 (threshold 15). Drivers by points: if/else 45 (91 pts), loops 7 (9 pts), boolean chains 6, match/switch 3 (6 pts) (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.
HeadlessServer::run (cognitive 102) src/server/headless.rs:412— HeadlessServer::run has cognitive complexity 102 (threshold 15). Drivers by points: if/else 32 (74 pts), match/switch 6 (16 pts), boolean chains 11, loops 1 (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HeadlessServer::handle_internal_event_with_forwarding (cognitive 81) src/server/headless/notifications.rs:301— HeadlessServer::handle_internal_event_with_forwarding has cognitive complexity 81 (threshold 15). Drivers by points: if/else 28 (56 pts), boolean chains 11, loops 5 (10 pts), match/switch 3 (4 pts) (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.
HeadlessServer::handle_api_request_with_shutdown_check_inner (cognitive 73) src/server/headless.rs:2909— HeadlessServer::handle_api_request_with_shutdown_check_inner has cognitive complexity 73 (threshold 15). Drivers by points: if/else 31 (54 pts), boolean chains 9, match/switch 4 (9 pts), 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.
HeadlessServer::perform_live_handoff (cognitive 40) src/server/headless/lifecycle.rs:25— HeadlessServer::perform_live_handoff has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 10 (15 pts), match/switch 5 (6 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.
HeadlessServer::sync_immediate_pty_sources (cognitive 35) src/server/headless/render.rs:294— HeadlessServer::sync_immediate_pty_sources has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 3 (7 pts), boolean chains 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.
HeadlessServer::paste_client_clipboard_image_path (cognitive 33) src/server/headless.rs:1168— HeadlessServer::paste_client_clipboard_image_path has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (27 pts), boolean chains 5, match/switch 1 (nesting depth added 14). 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.
HeadlessServer::stream_direct_terminal_keyboard_mode (cognitive 28) src/server/headless/render.rs:182— HeadlessServer::stream_direct_terminal_keyboard_mode has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 3 (5 pts), boolean chains 3, loops 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.
HeadlessServer::set_client_shell_surface_active (cognitive 20) src/server/headless/surface_interest.rs:9— HeadlessServer::set_client_shell_surface_active has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 4 (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.
HeadlessServer::stream_host_mouse_capture_mode (cognitive 19) src/server/headless/render.rs:105— HeadlessServer::stream_host_mouse_capture_mode has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 6, match/switch 2 (3 pts), 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.
HeadlessServer::handle_scheduled_tasks_headless (cognitive 17) src/server/headless.rs:3275— HeadlessServer::handle_scheduled_tasks_headless has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (14 pts), loops 1 (3 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.
TooManyMethods: App src/app/mod.rs:105— TooManyMethods — 349 methods, declared across 32 files: api/panes.rs (45), app/api.rs (31), plugins/mod.rs (22), app/creation.rs (22), +28 more file(s). The bar is 30 methods; this is 319 over it, 11.63× 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: ClientShellState src/client/shell/state.rs:859— TooManyMethods — 281 methods, declared across 24 files: shell/endpoints.rs (32), shell/input.rs (30), shell/overlay_input.rs (30), shell/copy_mode.rs (25), +20 more file(s). The bar is 30 methods; this is 251 over it, 9.37× 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: HeadlessServer src/server/headless.rs:192— TooManyMethods — 153 methods, declared across 9 files: server/headless.rs (67), headless/client_views.rs (38), headless/render.rs (16), headless/notifications.rs (12), +5 more file(s). The bar is 30 methods; this is 123 over it, 5.10× 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: TerminalState src/terminal/state.rs:129— TooManyMethods — 108 methods, declared across 2 files: terminal/state.rs (84), terminal/metadata.rs (24). The bar is 30 methods; this is 78 over it, 3.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: PaneRuntime src/pane.rs:1500— TooManyMethods — 86 methods. The bar is 30 methods; this is 56 over it, 2.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: TerminalRuntime src/terminal/runtime.rs:17— TooManyMethods — 81 methods. The bar is 30 methods; this is 51 over it, 2.70× 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: Desktop scripts/windows_input/Native.cs— TooManyMethods — 307 significant lines (blank, comment-only and punctuation-only lines excluded), 71 methods. The bar is 30 methods; this is 41 over it, 2.37× the bar. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
TooManyMethods: Terminal crates/ghostty-vt/src/lib.rs:848— TooManyMethods — 69 methods. The bar is 30 methods; this is 39 over it, 2.30× 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: GhosttyPaneTerminal src/pane/terminal.rs:188— TooManyMethods — 66 methods. The bar is 30 methods; this is 36 over it, 2.20× 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: PaneTerminal src/pane/terminal.rs:223— TooManyMethods — 60 methods. The bar is 30 methods; this is 30 over it, 2.00× 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: AppState src/app/state.rs:789— TooManyMethods — 52 methods, declared across 2 files: app/actions.rs (41), app/state.rs (11). The bar is 30 methods; this is 22 over it, 1.73× 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: Workspace src/workspace.rs:176— TooManyMethods — 48 methods, declared across 2 files: src/workspace.rs (46), workspace/aggregate.rs (2). 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: PendingEndpointActivation src/client/endpoint/activation/model.rs:159— TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× 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.
TooManyFields: ClientShellState src/client/shell/state.rs:859— TooManyFields — 94 stored fields beside 281 methods. The bar is 30 stored fields; this is 64 over it, 3.13× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: AppState src/app/state.rs:789— TooManyFields — 68 stored fields beside 52 methods. The bar is 30 stored fields; this is 38 over it, 2.27× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: KeysConfig src/config/model.rs:336— TooManyFields — 63 stored fields beside 2 methods. The bar is 30 stored fields; this is 33 over it, 2.10× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: KeysConfigOverlay src/config/model.rs:469— TooManyFields — 63 stored fields beside 1 method. The bar is 30 stored fields; this is 33 over it, 2.10× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: App src/app/mod.rs:105— TooManyFields — 62 stored fields beside 349 methods. The bar is 30 stored fields; this is 32 over it, 2.07× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: ShellHitMap src/client/shell/state.rs:85— TooManyFields — 55 stored fields. The bar is 30 stored fields; this is 25 over it, 1.83× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: Keybinds src/config/keybinds.rs:352— TooManyFields — 54 stored fields. The bar is 30 stored fields; this is 24 over it, 1.80× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: ClientShellConfig src/client/shell/state.rs:15— TooManyFields — 38 stored fields beside 14 methods. The bar is 30 stored fields; this is 8 over it, 1.27× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: HeadlessServer src/server/headless.rs:192— TooManyFields — 36 stored fields beside 153 methods. The bar is 30 stored fields; this is 6 over it, 1.20× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: TerminalState src/terminal/state.rs:129— TooManyFields — 35 stored fields beside 108 methods. The bar is 30 stored fields; this is 5 over it, 1.17× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: ClientState src/client/state.rs:33— TooManyFields — 33 stored fields beside 23 methods. The bar is 30 stored fields; this is 3 over it, 1.10× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: ClientConnection src/server/clients.rs:133— TooManyFields — 32 stored fields beside 13 methods. The bar is 30 stored fields; this is 2 over it, 1.07× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
HeadlessServer::handle_server_event (cyclomatic 133) src/server/headless.rs:1849— HeadlessServer::handle_server_event has cyclomatic complexity 133 (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.
HeadlessServer::render_and_stream_with_graphics_limit (cyclomatic 84) src/server/headless/render.rs:454— HeadlessServer::render_and_stream_with_graphics_limit has cyclomatic complexity 84 (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.
HeadlessServer::render_retained_pane_surface_and_stream (cyclomatic 59) src/server/headless/retained_surface.rs:227— HeadlessServer::render_retained_pane_surface_and_stream has cyclomatic complexity 59 (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.
HeadlessServer::run (cyclomatic 57) src/server/headless.rs:412— HeadlessServer::run has cyclomatic complexity 57 (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.
HeadlessServer::handle_internal_event_with_forwarding (cyclomatic 52) src/server/headless/notifications.rs:301— HeadlessServer::handle_internal_event_with_forwarding has cyclomatic complexity 52 (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.
HeadlessServer::handle_api_request_with_shutdown_check_inner (cyclomatic 46) src/server/headless.rs:2909— HeadlessServer::handle_api_request_with_shutdown_check_inner has cyclomatic complexity 46 (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.
HeadlessServer::perform_live_handoff (cyclomatic 27) src/server/headless/lifecycle.rs:25— HeadlessServer::perform_live_handoff has cyclomatic complexity 27 (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.
HeadlessServer::paste_client_clipboard_image_path (cyclomatic 21) src/server/headless.rs:1168— HeadlessServer::paste_client_clipboard_image_path 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.
HeadlessServer::stream_direct_terminal_keyboard_mode (cyclomatic 19) src/server/headless/render.rs:182— HeadlessServer::stream_direct_terminal_keyboard_mode 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.
HeadlessServer::stream_host_mouse_capture_mode (cyclomatic 16) src/server/headless/render.rs:105— HeadlessServer::stream_host_mouse_capture_mode 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.
HeadlessServer::set_client_shell_surface_active (cyclomatic 16) src/server/headless/surface_interest.rs:9— HeadlessServer::set_client_shell_surface_active 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.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×11
Edited copy of a member (13 corresponding lines) src/pty/actor/unix.rs:293— src/pty/actor/unix.rs:293-305 | src/pty/actor/unix.rs:338-357 — 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) src/pane/terminal.rs:1578— src/pane/terminal.rs:1578-1592 | src/pane/terminal.rs:1667-1679 — 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) src/client/shell/overlays.rs:268— src/client/shell/overlays.rs:268-280 | src/ui/widgets.rs:15-28 — 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) src/cli/plugin.rs:657— src/cli/plugin.rs:657-671 | src/cli/plugin.rs:673-685 — 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) src/client/state.rs:470— src/client/state.rs:470-482 | src/client/state.rs:490-502 — 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) crates/ghostty-vt/src/lib.rs:2378— crates/ghostty-vt/src/lib.rs:2378-2394 | crates/ghostty-vt/src/lib.rs:3561-3573 — 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) src/pane.rs:1703— src/pane.rs:1703-1718 | src/pane.rs:2234-2246 — 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) src/worktree.rs:245— src/worktree.rs:245-259 | src/worktree.rs:266-278 — 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) src/pane/terminal.rs:3523— src/pane/terminal.rs:3523-3535 | src/pane/terminal.rs:3541-3553 — 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) src/server/headless.rs:1065— src/server/headless.rs:1065-1077 | src/server/headless.rs:2871-2883 — 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) scripts/changelog.py:511— scripts/changelog.py:511-523 | scripts/changelog.py:567-579 — 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 (11 lines × 2) src/client/endpoint/activation.rs:663— src/client/endpoint/activation.rs:663-673 | src/client/endpoint/activation.rs:695-705 — 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 `src/client/endpoint/activation.rs:663` 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 `self` to `crate) fn update_host_focus( &mut` in one and `crate) fn update_host_theme( &mut` 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 (11 lines × 2) src/client/shell/composition.rs:38— src/client/shell/composition.rs:38-48 | src/client/shell/composition.rs:162-172 — 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 `self` to `&mut` in one and `crate) fn compose( &mut` 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 (11 lines × 2) src/client/shell_runtime.rs:417— src/client/shell_runtime.rs:417-427 | src/client/shell_runtime.rs:463-473 — 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) src/pane.rs:976— src/pane.rs:976-986 | src/pane.rs:2911-2921 — 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 `src/pane.rs:976` 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) src/pane/osc.rs:66— src/pane/osc.rs:66-76 | src/pane/osc.rs:171-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/pane/osc.rs: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.
Duplicated block (11 lines × 2) src/pane/terminal.rs:3188— src/pane/terminal.rs:3188-3198 | src/protocol/render_ansi.rs:758-768 — 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 (11 lines × 2) src/platform/fallback.rs:63— src/platform/fallback.rs:63-73 | src/platform/windows.rs:861-871 — 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 `src/platform/fallback.rs:63` 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) src/ui/sidebar/tokens.rs:112— src/ui/sidebar/tokens.rs:112-122 | src/ui/sidebar/tokens.rs:168-178 — 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 `src/ui/sidebar/tokens.rs: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.
Duplicated block (11 lines × 2) src/pane/terminal.rs:2380— src/pane/terminal.rs:2380-2390 | src/pane/terminal.rs:2670-2680 — 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) src/client/shell/worktree_overlays.rs:10— src/client/shell/worktree_overlays.rs:10-20 | src/client/shell/worktree_overlays.rs:117-127 — 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, `src/client/shell/worktree_overlays.rs:129` calls `filtered_indices` and `src/client/shell/worktree_overlays.rs:21` 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) src/cli/plugin.rs:463— src/cli/plugin.rs:463-473 | src/cli/worktree.rs:18-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/cli/plugin.rs: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.
App::handle_api_request_after_internal_events_drained (cyclomatic 101) src/app/api.rs:935— App::handle_api_request_after_internal_events_drained has cyclomatic complexity 101 (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.
App::handle_pane_move (cyclomatic 55) src/app/api/panes.rs:947— App::handle_pane_move has cyclomatic complexity 55 (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.
App::handle_internal_event_with_pane_updates (cyclomatic 48) src/app/api.rs:89— App::handle_internal_event_with_pane_updates has cyclomatic complexity 48 (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.
App::apply_live_config (cyclomatic 31) src/app/mod.rs:861— App::apply_live_config 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.
App::handle_pane_report_metadata (cyclomatic 30) src/app/api/panes.rs:1701— App::handle_pane_report_metadata has cyclomatic complexity 30 (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.
App::handle_layout_apply (cyclomatic 29) src/app/api/layouts.rs:34— App::handle_layout_apply has cyclomatic complexity 29 (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.
App::handle_plugin_pane_open (cyclomatic 24) src/app/api/plugins/mod.rs:436— App::handle_plugin_pane_open 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.
App::handle_pane_swap (cyclomatic 22) src/app/api/panes.rs:774— App::handle_pane_swap 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.
App::handle_pane_copy_motion (cyclomatic 19) src/app/api/panes.rs:292— App::handle_pane_copy_motion 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.
App::finish_worktree_open (cyclomatic 16) src/app/api/worktrees.rs:69— App::finish_worktree_open 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.
Duplicated block (9 lines × 2) crates/ghostty-vt/src/lib.rs:3652— crates/ghostty-vt/src/lib.rs:3652-3660 | crates/ghostty-vt/src/lib.rs:3668-3676 — 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 `crates/ghostty-vt/src/lib.rs:3652` 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 lines × 2) src/pane.rs:2536— src/pane.rs:2536-2544 | src/pane.rs:2706-2714 — 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 `src/pane.rs:2536` 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, `src/pane.rs:2533` calls `map_err`, `other`, `to_string` and `src/pane.rs:2705` 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 (9 lines × 2) src/platform/linux.rs:150— src/platform/linux.rs:150-158 | src/platform/macos.rs:152-160 — before extracting anything, compare `src/platform/linux.rs` and `src/platform/macos.rs` as WHOLE FILES: this scan already matched 5 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. 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 `src/platform/linux.rs:150` 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 `temporary` to `&std::path::Path` in one and `&Path` 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 (9 lines × 2) src/pty/fd.rs:68— src/pty/fd.rs:68-76 | src/pty/fd.rs:118-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 `src/pty/fd.rs:68` 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 lines × 2) src/server/headless.rs:805— src/server/headless.rs:805-813 | src/server/headless.rs:816-824 — 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 `src/server/headless.rs:816` 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 (9 lines × 2) src/app/api/plugins/manifest.rs:517— src/app/api/plugins/manifest.rs:517-525 | src/cli/plugin.rs:1287-1295 — 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) src/app/mod.rs:1036— src/app/mod.rs:1036-1044 | src/app/mod.rs:1048-1057 — 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 `src/app/mod.rs:1048` 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) src/server/headless.rs:2449— src/server/headless.rs:2449-2457 | src/server/headless.rs:2538-2546 — 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 `src/server/headless.rs:2449` 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 lines × 2) src/pty/actor/unix.rs:297— src/pty/actor/unix.rs:297-305 | src/pty/actor/unix.rs:349-357 — 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 `src/pty/actor/unix.rs:297` 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) scripts/changelog.py:511— scripts/changelog.py:511-519 | scripts/changelog.py:567-575 — 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) src/app/api.rs:837— src/app/api.rs:837-843 | src/app/api.rs:883-889 — 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 `src/app/api.rs:837` 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 `self` to `crate) fn accept_current_focus_with_api_events(&mut` in one and `&mut` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/app/api.rs:890` calls `Some`, `send_pane_focus_event` and `src/app/api.rs:844` 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 × 2) src/app/api/plugins/manifest.rs:399— src/app/api/plugins/manifest.rs:399-405 | src/app/api/plugins/manifest.rs:425-431 — 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 `src/app/api/plugins/manifest.rs:399` 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) src/app/api/plugins/mod.rs:91— src/app/api/plugins/mod.rs:91-97 | src/app/api/plugins/mod.rs:159-165 — 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 `params` to `PluginListParams` in one and `PluginActionListParams` 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 (7 lines × 2) src/app/custom_commands.rs:368— src/app/custom_commands.rs:368-374 | src/app/custom_commands.rs:448-454 — 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, `src/app/custom_commands.rs:375` calls `custom_command_env`, `pane_host_terminal_appearance` and `src/app/custom_commands.rs:456` 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 (7 lines × 2) src/client/shell/overlays.rs:769— src/client/shell/overlays.rs:769-777 | src/client/shell/overlays.rs:1166-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/client/shell/overlays.rs:769` 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) src/terminal/state.rs:1645— src/terminal/state.rs:1645-1652 | src/terminal/state.rs:1892-1898 — 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 `src/terminal/state.rs:1645` 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) src/cli/pane/bindings.rs:45— src/cli/pane/bindings.rs:45-51 | src/cli/plugin/bindings.rs:43-49 — 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) src/platform/linux.rs:319— src/platform/linux.rs:319-325 | src/platform/macos.rs:214-220 — before extracting anything, compare `src/platform/linux.rs` and `src/platform/macos.rs` as WHOLE FILES: this scan already matched 5 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. 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 × 2) src/server/headless.rs:2421— src/server/headless.rs:2421-2427 | src/server/headless.rs:2512-2518 — 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 `src/server/headless.rs:2421` 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) scripts/windows_input/Native.cs:346— scripts/windows_input/Native.cs:346-352 | scripts/windows_input/Native.cs:357-363 — 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) src/app/api/panes.rs:1585— src/app/api/panes.rs:1585-1597 | src/app/api/panes.rs:1631-1643 — 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 `src/app/api/panes.rs:1585` 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 first that the copies are not typed on the same thing: the declarations holding them bind `params` to `PaneReportAgentParams` in one and `PaneReportAgentSessionParams` 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 (13 lines × 2) src/client/shell/mobile.rs:157— src/client/shell/mobile.rs:157-169 | src/client/shell/mobile.rs:531-543 — 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) src/kitty_graphics/surface.rs:900— src/kitty_graphics/surface.rs:900-912 | src/kitty_graphics/surface.rs:918-930 — 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 (13 lines × 2) src/pane.rs:2567— src/pane.rs:2567-2579 | src/pane.rs:2771-2783 — 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 `src/pane.rs:2567` 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, `src/pane.rs:2580` calls `clone` and `src/pane.rs:2784` 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 (13 lines × 2) src/pane.rs:2581— src/pane.rs:2581-2593 | src/pane.rs:2784-2796 — 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 `src/pane.rs:2581` 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, `src/pane.rs:2580` calls `clone` and `src/pane.rs:2783` 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 (13 lines × 2) src/platform/linux.rs:1015— src/platform/linux.rs:1015-1027 | src/platform/macos.rs:887-899 — before extracting anything, compare `src/platform/linux.rs` and `src/platform/macos.rs` as WHOLE FILES: this scan already matched 5 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. 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 (13 lines × 2) src/terminal/state.rs:2227— src/terminal/state.rs:2227-2239 | src/terminal/state.rs:2260-2272 — 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 (13 lines × 2) src/app/api/panes.rs:1826— src/app/api/panes.rs:1826-1838 | src/app/api/workspaces.rs:287-301 — 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 `src/app/api/workspaces.rs:287` 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, `src/app/api/panes.rs:1839` calls `is_some_and` and `src/app/api/workspaces.rs:301` 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 (13 lines × 2) src/client/shell/overlays.rs:1128— src/client/shell/overlays.rs:1128-1140 | src/client/shell/settings_overlay.rs:53-66 — 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 `src/client/shell/overlays.rs:1128` 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.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×8
Edited copy of a member (9 corresponding lines) src/app/api/tabs.rs:36— src/app/api/tabs.rs:36-45 | src/app/api/tabs.rs:132-140 — 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) src/integration/config_edit.rs:618— src/integration/config_edit.rs:618-628 | src/integration/config_edit.rs:630-638 — 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) src/platform/fallback.rs:50— src/platform/fallback.rs:50-58 | src/platform/unix_common.rs:429-437 — 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) src/platform/linux.rs:879— src/platform/linux.rs:879-887 | src/platform/macos.rs:693-701 — 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) src/pane/terminal/windows_recent_fallback.rs:223— src/pane/terminal/windows_recent_fallback.rs:223-234 | src/pane/terminal.rs:3624-3632 — 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) src/layout.rs:557— src/layout.rs:557-565 | src/persist/restore.rs:1003-1011 — 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) scripts/capture_agent_screen.py:324— scripts/capture_agent_screen.py:324-332 | scripts/capture_agent_screen.py:336-345 — 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) scripts/capture_key_matrix.py:151— scripts/capture_key_matrix.py:151-159 | scripts/verify_suspicious_keys.py:112-120 — 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 (12 lines × 2) src/app/agent_resume.rs:273— src/app/agent_resume.rs:273-284 | src/app/api.rs:617-628 — 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 `src/app/agent_resume.rs:273` 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) src/detect/mod.rs:140— src/detect/mod.rs:140-151 | src/detect/mod.rs:175-186 — 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 `src/detect/mod.rs: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.
Duplicated block (12 lines × 2) src/platform/macos.rs:526— src/platform/macos.rs:526-537 | src/platform/macos.rs:974-985 — 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 (12 lines × 2) src/platform/macos/power.rs:40— src/platform/macos/power.rs:40-51 | src/platform/windows/power.rs:27-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. 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 (12 lines × 2) src/platform/unix_common.rs:250— src/platform/unix_common.rs:250-261 | src/platform/windows.rs:382-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. 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 (12 lines × 2) src/platform/windows.rs:2344— src/platform/windows.rs:2344-2355 | src/platform/windows.rs:2465-2476 — 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 `src/platform/windows.rs:2344` 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) src/update.rs:2098— src/update.rs:2098-2109 | src/update.rs:2132-2143 — 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 (12 lines × 2) scripts/capture_agent_screen.py:244— scripts/capture_agent_screen.py:244-255 | scripts/capture_agent_screen.py:261-272 — 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 (10 lines × 2) src/app/api/panes.rs:752— src/app/api/panes.rs:752-761 | src/app/api/panes.rs:924-933 — 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 `src/app/api/panes.rs:752` 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) src/client/shell/overlays.rs:1308— src/client/shell/overlays.rs:1308-1317 | src/client/shell/worktree_overlays.rs:409-418 — before extracting anything, compare `src/client/shell/overlays.rs` and `src/client/shell/worktree_overlays.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 64 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 `src/client/shell/overlays.rs:1308` 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 × 2) src/client/shell_runtime.rs:606— src/client/shell_runtime.rs:606-615 | src/client/shell_runtime.rs:665-674 — 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 `src/client/shell_runtime.rs:606` 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 × 2) src/integration/config_edit.rs:251— src/integration/config_edit.rs:251-260 | src/integration/config_edit.rs:276-285 — 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 `src/integration/config_edit.rs:251` 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 (10 lines × 2) src/persist/restore.rs:596— src/persist/restore.rs:596-605 | src/persist/restore.rs:696-705 — 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 `src/persist/restore.rs:596` 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) src/protocol/render_ansi.rs:662— src/protocol/render_ansi.rs:662-671 | src/protocol/render_ansi.rs:719-737 — 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 `src/protocol/render_ansi.rs:662` 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 × 2) src/workspace/git/config.rs:203— src/workspace/git/config.rs:203-212 | src/workspace/git/config.rs:271-280 — 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) src/workspace/git/config.rs:282— src/workspace/git/config.rs:282-291 | src/workspace/git/config.rs:500-509 — 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 `src/workspace/git/config.rs: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.
TerminalState::set_detected_state_with_screen_signals_at (cognitive 81) src/terminal/state.rs:359— TerminalState::set_detected_state_with_screen_signals_at has cognitive complexity 81 (threshold 15). Drivers by points: if/else 26 (45 pts), boolean chains 24, loops 5 (12 pts) (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.
TerminalState::set_agent_session_ref_for_session_start (cognitive 44) src/terminal/state.rs:1461— TerminalState::set_agent_session_ref_for_session_start has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (25 pts), boolean chains 19 (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.
TerminalState::set_agent_metadata (cognitive 31) src/terminal/metadata.rs:144— TerminalState::set_agent_metadata has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 4, 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.
TerminalState::reconcile_managed_agent_at (cognitive 31) src/terminal/state.rs:2206— TerminalState::reconcile_managed_agent_at has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 10, 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.
TerminalState::set_hook_authority_at (cognitive 23) src/terminal/state.rs:701— TerminalState::set_hook_authority_at has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 5, match/switch 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.
TerminalState::route_full_lifecycle_hook_report (cognitive 23) src/terminal/state.rs:931— TerminalState::route_full_lifecycle_hook_report has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 6 (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.
TerminalState::clear_full_lifecycle_hook_suppression_for_detected_agent (cognitive 16) src/terminal/state.rs:1149— TerminalState::clear_full_lifecycle_hook_suppression_for_detected_agent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, 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.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×7
Edited copy of a member (18 corresponding lines) src/app/actions.rs:387— src/app/actions.rs:387-404 | src/app/actions.rs:406-435 — 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) src/app/api/plugins/mod.rs:90— src/app/api/plugins/mod.rs:90-111 | src/app/api/plugins/mod.rs:158-175 — 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) src/pane/terminal.rs:2813— src/pane/terminal.rs:2813-2830 | src/pane/terminal/windows_recent_fallback.rs:162-186 — 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) src/cli/plugin.rs:456— src/cli/plugin.rs:456-473 | src/cli/worktree.rs:10-28 — 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) src/pty/fd.rs:59— src/pty/fd.rs:59-76 | src/pty/fd.rs:107-126 — 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) src/app/runtime.rs:97— src/app/runtime.rs:97-122 | src/app/runtime.rs: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) src/app/api/plugins/context.rs:302— src/app/api/plugins/context.rs:302-321 | src/app/api/plugins/context.rs:328-345 — 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 (15 corresponding lines) · ×7
Edited copy of a member (15 corresponding lines) src/config/io.rs:45— src/config/io.rs:45-59 | src/config/io.rs:71-85 — 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) src/persist/writer.rs:42— src/persist/writer.rs:42-59 | src/persist/writer.rs:61-75 — 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) src/platform/linux/power.rs:10— src/platform/linux/power.rs:10-24 | src/platform/linux/shutdown.rs:12-26 — 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) src/detect/manifest.rs:1346— src/detect/manifest.rs:1346-1360 | src/detect/manifest.rs:1362-1376 — 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) crates/ghostty-vt/src/pane_graphics_files.rs:534— crates/ghostty-vt/src/pane_graphics_files.rs:534-554 | crates/ghostty-vt/src/pane_graphics_files.rs:568-582 — 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) src/update.rs:2097— src/update.rs:2097-2111 | src/update.rs:2131-2149 — 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) src/app/api/workspaces.rs:23— src/app/api/workspaces.rs:23-37 | src/app/api/workspaces.rs:87-102 — 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 (14 corresponding lines) · ×7
Edited copy of a member (14 corresponding lines) src/product_announcements.rs:205— src/product_announcements.rs:205-218 | src/release_notes.rs:53-66 — 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) src/platform/linux.rs:714— src/platform/linux.rs:714-727 | src/platform/macos.rs:953-966 — 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) src/cli/plugin.rs:1323— src/cli/plugin.rs:1323-1336 | src/persist/plugin_registry.rs:21-34 — 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) src/terminal/state.rs:1068— src/terminal/state.rs:1068-1081 | src/terminal/state.rs:1088-1104 — 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) crates/ghostty-vt/src/pane_graphics_files.rs:502— crates/ghostty-vt/src/pane_graphics_files.rs:502-517 | crates/ghostty-vt/src/pane_graphics_files.rs:519-532 — 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) src/cli.rs:582— src/cli.rs:582-600 | src/cli.rs:602-615 — 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) scripts/capture_agent_screen.py:244— scripts/capture_agent_screen.py:244-257 | scripts/capture_agent_screen.py:261-279 — 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) · ×7
Edited copy of a member (10 corresponding lines) src/pty/fd.rs:18— src/pty/fd.rs:18-27 | src/pty/fd.rs:30-39 — 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) src/platform/windows.rs:152— src/platform/windows.rs:152-165 | src/platform/windows.rs:170-179 — 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) src/logging.rs:61— src/logging.rs:61-87 | src/logging.rs:94-103 — 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) src/pane/terminal.rs:3012— src/pane/terminal.rs:3012-3021 | src/pane/terminal.rs:3027-3037 — 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) src/platform/mod.rs:444— src/platform/mod.rs:444-454 | src/platform/unix_common.rs:311-320 — 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) src/platform/macos/shutdown.rs:77— src/platform/macos/shutdown.rs:77-89 | src/platform/unix_common.rs:324-333 — 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) src/app/creation.rs:37— src/app/creation.rs:37-46 | src/workspace/tab.rs:537-547 — 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.
Duplicated block (5 lines × 2) src/app/api/plugins/panes.rs:53— src/app/api/plugins/panes.rs:53-57 | src/app/api/plugins/panes.rs:204-208 — 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) src/integration/config_edit.rs:119— src/integration/config_edit.rs:119-123 | src/integration/config_edit.rs:303-310 — 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 (5 lines × 2) src/app/api/plugins/context.rs:260— src/app/api/plugins/context.rs:260-264 | src/app/api/plugins/context.rs:285-289 — 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 `src/app/api/plugins/context.rs:260` 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) src/client/shell/endpoint_sidebar.rs:456— src/client/shell/endpoint_sidebar.rs:456-460 | src/client/shell/sidebar.rs:308-312 — before extracting anything, compare `src/client/shell/endpoint_sidebar.rs` and `src/client/shell/sidebar.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 69 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 (5 lines × 2) src/kitty_graphics/surface.rs:338— src/kitty_graphics/surface.rs:338-342 | src/kitty_graphics/surface.rs:495-499 — 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 `self` to `crate) fn take_pending_cleanup(&mut` in one and `&mut` 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) scripts/capture_key_matrix.py:134— scripts/capture_key_matrix.py:134-138 | scripts/verify_suspicious_keys.py:97-101 — before extracting anything, compare `scripts/capture_key_matrix.py` and `scripts/verify_suspicious_keys.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 103 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 (5 lines × 2) scripts/package_windows_conpty.py:47— scripts/package_windows_conpty.py:47-51 | scripts/package_windows_conpty.py:117-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.
TerminalState::set_detected_state_with_screen_signals_at (cyclomatic 54) src/terminal/state.rs:359— TerminalState::set_detected_state_with_screen_signals_at has cyclomatic complexity 54 (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.
TerminalState::set_agent_session_ref_for_session_start (cyclomatic 39) src/terminal/state.rs:1461— TerminalState::set_agent_session_ref_for_session_start has cyclomatic complexity 39 (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.
TerminalState::reconcile_managed_agent_at (cyclomatic 23) src/terminal/state.rs:2206— TerminalState::reconcile_managed_agent_at 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.
TerminalState::set_agent_metadata (cyclomatic 21) src/terminal/metadata.rs:144— TerminalState::set_agent_metadata 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.
TerminalState::set_hook_authority_at (cyclomatic 20) src/terminal/state.rs:701— TerminalState::set_hook_authority_at 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.
TerminalState::route_full_lifecycle_hook_report (cyclomatic 19) src/terminal/state.rs:931— TerminalState::route_full_lifecycle_hook_report 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.
Change coupling: agent_resume.rs ↔ mod.rs src/agent_resume.rs:1— `src/agent_resume.rs` and `src/integration/mod.rs` change together 67% of the time (14 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) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 14 shared commits counted here, the most recent 3 are `4b4705db` fix: report codex turn completion through hooks (#4756); `e608a751` fix: make known-agent exit process-owned; `74fa90ce` fix: scope opencode hook to main agent and adopt new sessions — run `git show` on any of them.
Change coupling: creation.rs ↔ tab.rs src/app/creation.rs:1— `src/app/creation.rs` and `src/workspace/tab.rs` change together 60% of the time (9 of the 15 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) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `10eb0bc7` fix: propagate host color scheme to pane apps (#2214); `a02c3a69` refactor: centralize new terminal cwd selection; `4f7fcc48` fix: follow foreground cwd for new terminals — run `git show` on any of them.
Change coupling: changelog.py ↔ update.rs scripts/changelog.py:1— `scripts/changelog.py` and `src/update.rs` 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) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `322ab6a5` fix: verify stable release checksums; `eac2314e` fix: handle package-manager remote updates; `3769dcbb` fix: version latest manifest metadata — run `git show` on any of them.
Change coupling: api.rs ↔ tab.rs src/app/api.rs:1— `src/app/api.rs` and `src/workspace/tab.rs` change together 53% of the time (8 of the 15 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) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; 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 `10eb0bc7` fix: propagate host color scheme to pane apps (#2214); `e27a4ea4` perf: skip rendering hidden pty updates; `d35c642e` feat: add pane move api and cli — run `git show` on any of them.
Change coupling: mod.rs ↔ client_transport.rs src/client/mod.rs:1— `src/client/mod.rs` and `src/server/client_transport.rs` change together 50% of the time (12 of the 24 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) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 12 shared commits counted here, the most recent 3 are `ee731a22` fix: allow busy servers time to become ready (#5241); `80c0c072` perf: send scrolling pane output as row shifts and skip blank cells (…; `d8b36691` fix: avoid resending terminal cells for metadata updates (#4137) — run `git show` on any of them.
Change coupling: autodetect.rs ↔ update.rs src/server/autodetect.rs:1— `src/server/autodetect.rs` and `src/update.rs` 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) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; 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 `26db26e4` fix: keep remote sessions alive across disconnects; `77819797` fix: clarify update restart guidance; `1daf54ec` feat: show named session command hints — run `git show` on any of them.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×6
Edited copy of a member (12 corresponding lines) src/client/endpoint/activation.rs:1017— src/client/endpoint/activation.rs:1017-1033 | src/client/endpoint/activation.rs:1059-1070 — 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) src/integration/env.rs:43— src/integration/env.rs:43-57 | src/integration/env.rs:75-86 — 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) src/cli/plugin.rs:759— src/cli/plugin.rs:759-772 | src/cli/plugin.rs:785-796 — 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) src/app/agent_resume.rs:367— src/app/agent_resume.rs:367-381 | src/platform/mod.rs:651-662 — 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) src/api/server.rs:1034— src/api/server.rs:1034-1046 | src/server/client_commands.rs:27-38 — 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) src/app/agent_resume.rs:343— src/app/agent_resume.rs:343-354 | src/ui/panes.rs:40-51 — 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.
D4 · Code Duplication· Edited copy of a member (6 corresponding lines) · ×6
Edited copy of a member (6 corresponding lines) src/platform/linux.rs:654— src/platform/linux.rs:654-663 | src/platform/linux.rs:1164-1169 — 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) src/input/parse.rs:371— src/input/parse.rs:371-376 | src/terminal_notify.rs:58-63 — 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) src/cli/agent/bindings.rs:86— src/cli/agent/bindings.rs:86-91 | src/cli/pane/bindings.rs:212-217 — 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) src/app/api/plugins/runtime.rs:330— src/app/api/plugins/runtime.rs:330-335 | src/platform/macos.rs:744-749 — 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) src/cli/pane.rs:108— src/cli/pane.rs:108-114 | src/cli/workspace_bindings.rs:47-52 — 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) src/detect/manifest.rs:1480— src/detect/manifest.rs:1480-1486 | src/pane/terminal.rs:2910-2915 — 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 (8 corresponding lines) · ×6
Edited copy of a member (8 corresponding lines) src/ui/panes.rs:167— src/ui/panes.rs:167-179 | src/ui/panes.rs:181-188 — 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) src/detect/manifest_update.rs:403— src/detect/manifest_update.rs:403-411 | src/detect/manifest_update.rs:430-437 — 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) src/terminal_theme.rs:94— src/terminal_theme.rs:94-106 | src/terminal_theme.rs:108-115 — 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) src/client/shell/state.rs:966— src/client/shell/state.rs:966-975 | src/product_announcements.rs:63-70 — 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) src/platform/linux.rs:136— src/platform/linux.rs:136-143 | src/platform/unix_common.rs:486-494 — 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) scripts/windows_input/Native.cs:345— scripts/windows_input/Native.cs:345-355 | scripts/windows_input/Native.cs:356-377 — 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.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×6
Edited copy of a member (7 corresponding lines) src/integration/claude_settings.rs:472— src/integration/claude_settings.rs:472-478 | src/integration/claude_settings.rs:480-486 — 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) src/config/io.rs:122— src/config/io.rs:122-128 | src/persist/io.rs:79-85 — 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) src/detect/manifest.rs:1378— src/detect/manifest.rs:1378-1384 | src/detect/manifest.rs:1417-1424 — 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) src/cli/pane/bindings.rs:200— src/cli/pane/bindings.rs:200-210 | src/cli/agent/bindings.rs:63-69 — 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) src/app/tab_bar_status.rs:233— src/app/tab_bar_status.rs:233-239 | src/protocol/render_ansi.rs:910-916 — 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) src/cli/plugin/bindings.rs:17— src/cli/plugin/bindings.rs:17-23 | src/cli/workspace_bindings.rs:39-45 — 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.
Duplicated block (18 lines × 2) src/api/wait.rs:458— src/api/wait.rs:458-475 | src/api/wait.rs:487-504 — 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) src/app/agents.rs:278— src/app/agents.rs:278-295 | src/app/agents.rs:351-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/app/agents.rs: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 (18 lines × 2) src/app/api/panes.rs:1559— src/app/api/panes.rs:1559-1576 | src/app/api/panes.rs:1604-1621 — 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 `params` to `PaneReportAgentParams` in one and `PaneReportAgentSessionParams` 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 (18 lines × 2) src/client/shell/input.rs:250— src/client/shell/input.rs:250-267 | src/client/shell/input.rs:283-300 — 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 `src/client/shell/input.rs:250` 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 (18 lines × 2) src/server/headless.rs:771— src/server/headless.rs:771-788 | src/server/headless/client_views.rs:522-539 — 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 `src/server/headless.rs:771` 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) src/pane.rs:2435— src/pane.rs:2435-2452 | src/pane.rs:2482-2499 — 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 `src/pane.rs:2435` 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.
ClassTooLong: TerminalState src/terminal/state.rs:129— ClassTooLong — 1674 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 108 methods, 2 blocks, lines 129-2446. The bar is 400 significant lines; this is 1274 over it, 4.19× 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: Terminal crates/ghostty-vt/src/lib.rs:848— ClassTooLong — 1051 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 69 methods, 3 blocks, lines 848-2315. The bar is 400 significant lines; this is 651 over it, 2.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.
ClassTooLong: ClientShellState src/client/shell/state.rs:859— ClassTooLong — 800 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 281 methods, 2 blocks, lines 859-1897. The bar is 400 significant lines; this is 400 over it, 2.00× 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: Palette src/app/state.rs:35— ClassTooLong — 502 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 21 methods, 2 blocks, lines 35-676. The bar is 400 significant lines; this is 102 over it, 1.26× 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: RawInputByteFramer src/raw_input.rs:200— ClassTooLong — 439 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 19 methods, 2 blocks, lines 200-903. The bar is 400 significant lines; this is 39 over it, 1.10× 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.
TooManyFunctions: herdr::platform src/platform/mod.rs:56— TooManyFunctions — 50 free functions. The bar is 30 free functions; this is 20 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.
TooManyFunctions: herdr::platform::fallback src/platform/fallback.rs:10— TooManyFunctions — 44 free functions. The bar is 30 free functions; this is 14 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.
TooManyFunctions: herdr::platform::unix_common src/platform/unix_common.rs:54— TooManyFunctions — 39 free functions. The bar is 30 free functions; this is 9 over it, 1.30× 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.
TooManyFunctions: herdr::session src/session.rs:31— TooManyFunctions — 35 free functions. The bar is 30 free functions; this is 5 over it, 1.17× 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.
TooManyFunctions: herdr::logging src/logging.rs:12— TooManyFunctions — 31 free functions. The bar is 30 free functions; this is 1 over it, 1.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.
D30 · Dependency Vulnerabilities· Medium advisory (unsound) · ×5
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×5
Edited copy of a member (17 corresponding lines) src/integration/config_edit.rs:118— src/integration/config_edit.rs:118-139 | src/integration/config_edit.rs:302-318 — 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) src/cli/plugin.rs:603— src/cli/plugin.rs:603-619 | src/session.rs:461-482 — 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) src/app/state.rs:977— src/app/state.rs:977-993 | src/server/headless/client_views.rs:498-519 — 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) src/workspace.rs:706— src/workspace.rs:706-722 | src/workspace/tab.rs: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) src/pane.rs:2354— src/pane.rs:2354-2370 | src/terminal/runtime.rs:133-150 — 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 (16 corresponding lines) · ×5
Edited copy of a member (16 corresponding lines) src/app/api/panes.rs:491— src/app/api/panes.rs:491-507 | src/app/api/panes.rs:509-524 — 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) src/platform/macos.rs:525— src/platform/macos.rs:525-550 | src/platform/macos.rs:973-988 — 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) src/integration/config_edit.rs:18— src/integration/config_edit.rs:18-33 | src/integration/config_edit.rs:40-58 — 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) src/platform/linux.rs:826— src/platform/linux.rs:826-841 | src/platform/macos.rs:1180-1195 — 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) scripts/changelog.py:194— scripts/changelog.py:194-209 | scripts/changelog.py:217-234 — 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.
Duplicated block (15 lines × 2) src/client/endpoint/activation.rs:463— src/client/endpoint/activation.rs:463-477 | src/client/endpoint/activation.rs:479-493 — 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 `src/client/endpoint/activation.rs:463` 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 (15 lines × 2) src/client/shell/overlays.rs:119— src/client/shell/overlays.rs:119-133 | src/client/shell/overlays.rs:196-210 — 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) src/update.rs:1205— src/update.rs:1205-1219 | src/update.rs:1474-1488 — 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 `src/update.rs:1205` 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) src/platform/unix_common.rs:622— src/platform/unix_common.rs:622-636 | src/platform/windows.rs:1125-1139 — 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 `src/platform/windows.rs:1125` 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) src/api/wait.rs:116— src/api/wait.rs:116-130 | src/api/wait.rs:743-757 — 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 `src/api/wait.rs:116` 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, `src/api/wait.rs:115` calls `api_wait_timed_out` and `src/api/wait.rs:742` 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) crates/ghostty-vt/src/lib.rs:1916— crates/ghostty-vt/src/lib.rs:1916-1929 | crates/ghostty-vt/src/lib.rs:2459-2472 — 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) src/client/mod.rs:1551— src/client/mod.rs:1551-1564 | src/client/mod.rs:2100-2114 — 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 `src/client/mod.rs:1551` 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 (14 lines × 2) src/persist/restore.rs:609— src/persist/restore.rs:609-622 | src/persist/restore.rs:711-724 — 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 `src/persist/restore.rs:609` 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, `src/persist/restore.rs:709` calls `Some`, `set_agent_name` and `src/persist/restore.rs:608` 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) src/pty/actor.rs:126— src/pty/actor.rs:126-139 | src/pty/actor/unix.rs:156-169 — 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 `src/pty/actor.rs:126` 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 (14 lines × 2) src/client/shell/settings_overlay.rs:304— src/client/shell/settings_overlay.rs:304-317 | src/client/shell/worktree_overlays.rs:10-23 — 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 `src/client/shell/settings_overlay.rs:304` 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.
AppState::handle_pane_died (cognitive 33) src/app/actions.rs:2059— AppState::handle_pane_died has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (33 pts) (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.
AppState::handle_app_event (cognitive 27) src/app/actions.rs:1392— AppState::handle_app_event has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 3, 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.
AppState::apply_workspace_git_statuses (cognitive 19) src/app/actions.rs:1342— AppState::apply_workspace_git_statuses has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, 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.
AppState::update_terminal_state_with_completion_policy (cognitive 19) src/app/actions.rs:1682— AppState::update_terminal_state_with_completion_policy has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 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.
GhosttyPaneTerminal::write_pty_bytes_with_ordered_responses (cognitive 28) src/pane/terminal.rs:1491— GhosttyPaneTerminal::write_pty_bytes_with_ordered_responses has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 2, match/switch 1 (2 pts), loops 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.
GhosttyPaneTerminal::render (cognitive 28) src/pane/terminal.rs:2357— GhosttyPaneTerminal::render has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 5 (8 pts), match/switch 5 (8 pts), boolean chains 3 (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.
GhosttyPaneTerminal::resize (cognitive 23) src/pane/terminal.rs:1681— GhosttyPaneTerminal::resize has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 1 (3 pts), boolean chains 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.
GhosttyPaneTerminal::process_pty_bytes (cognitive 17) src/pane/terminal.rs:1353— GhosttyPaneTerminal::process_pty_bytes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 3, 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.
D30 · Dependency Vulnerabilities· Medium advisory (unmaintained) · ×4
REDACTED
REDACTED
REDACTED
REDACTED
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×4
Members sharing a duplicated core (4 members, 50+ identical tokens) src/app/api/panes.rs:177— src/app/api/panes.rs:177-191 | src/app/api/panes.rs:193-210 | src/app/api/panes.rs:296-405 | src/app/api/panes.rs:411-489 — 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) src/app/api/plugins/panes.rs:17— src/app/api/plugins/panes.rs:17-42 | src/app/api/plugins/panes.rs:50-80 | src/app/api/plugins/panes.rs:89-183 | src/app/api/plugins/panes.rs:191-246 — 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) src/client/shell/overlays.rs:1260— src/client/shell/overlays.rs:1260-1317 | src/client/shell/worktree_overlays.rs:7-107 | src/client/shell/worktree_overlays.rs:113-306 | src/client/shell/worktree_overlays.rs:312-418 — 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) src/terminal/state.rs:1468— src/terminal/state.rs:1468-1696 | src/terminal/state.rs:1766-1809 | src/terminal/state.rs:1816-1875 | src/terminal/state.rs:1890-1919 — 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 (19 corresponding lines) · ×4
Edited copy of a member (19 corresponding lines) src/app/api/panes.rs:1934— src/app/api/panes.rs:1934-1957 | src/app/api/panes.rs:2039-2057 — 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) src/platform/linux.rs:633— src/platform/linux.rs:633-652 | src/platform/macos.rs:474-492 — 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) src/app/api/plugins/context.rs:392— src/app/api/plugins/context.rs:392-410 | src/cli/plugin/bindings.rs:136-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) src/layout.rs:659— src/layout.rs:659-678 | src/layout.rs:680-698 — 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.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×4
Edited copy of a member (20 corresponding lines) src/persist/io.rs:22— src/persist/io.rs:22-43 | src/persist/plugin_registry.rs:39-58 — 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) src/app/creation.rs:418— src/app/creation.rs:418-439 | src/terminal/state.rs:1309-1328 — 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) src/cli/integration.rs:88— src/cli/integration.rs:88-107 | src/cli/integration.rs:109-128 — 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) REDACTED:1421— REDACTED:1421-1441 | REDACTED:1443-1462 — 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 (21 corresponding lines) · ×4
Edited copy of a member (21 corresponding lines) src/pane/terminal.rs:963— src/pane/terminal.rs:963-983 | src/pane/terminal.rs:1026-1049 — 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) REDACTED:324— REDACTED:324-344 | src/update.rs:2556-2576 — 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) src/pane.rs:2388— src/pane.rs:2388-2414 | src/pane.rs:2432-2452 — 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) src/app/actions.rs:1286— src/app/actions.rs:1286-1306 | src/raw_input.rs:926-946 — 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 (4 corresponding lines) · ×4
Edited copy of a member (4 corresponding lines) src/app/api/plugins/panes.rs:351— src/app/api/plugins/panes.rs:351-355 | src/app/creation.rs:72-75 — 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/capture_key_matrix.py:142— scripts/capture_key_matrix.py:142-147 | scripts/verify_suspicious_keys.py:105-108 — 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/capture_key_matrix.py:86— scripts/capture_key_matrix.py:86-89 | scripts/verify_suspicious_keys.py:62-65 — 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/capture_key_matrix.py:111— scripts/capture_key_matrix.py:111-114 | scripts/verify_suspicious_keys.py:87-90 — 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.
Duplicated block (16 lines × 2) src/client/shell/endpoint_sidebar.rs:217— src/client/shell/endpoint_sidebar.rs:217-232 | src/client/shell/sidebar.rs:173-188 — before extracting anything, compare `src/client/shell/endpoint_sidebar.rs` and `src/client/shell/sidebar.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 69 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 `src/client/shell/endpoint_sidebar.rs:217` 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) src/client/shell/overlays.rs:1290— src/client/shell/overlays.rs:1290-1305 | src/client/shell/worktree_overlays.rs:391-406 — before extracting anything, compare `src/client/shell/overlays.rs` and `src/client/shell/worktree_overlays.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 64 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 `src/client/shell/overlays.rs:1290` 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) src/persist/restore.rs:650— src/persist/restore.rs:650-665 | src/persist/restore.rs:669-684 — 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 `src/persist/restore.rs: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 (16 lines × 2) src/workspace.rs:872— src/workspace.rs:872-887 | src/workspace.rs:1115-1130 — 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 `src/workspace.rs:872` 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 (6 lines × 2) src/app/actions.rs:500— src/app/actions.rs:500-505 | src/app/actions.rs:566-571 — 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 `src/app/actions.rs:500` 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 (6 lines × 2) src/cli/pane/bindings.rs:304— src/cli/pane/bindings.rs:304-309 | src/cli/workspace_bindings.rs:62-67 — 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) src/client/shell/overlays.rs:661— src/client/shell/overlays.rs:661-666 | src/client/shell/worktree_overlays.rs:28-33 — before extracting anything, compare `src/client/shell/overlays.rs` and `src/client/shell/worktree_overlays.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 64 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 `src/client/shell/overlays.rs:661` 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) scripts/capture_key_matrix.py:163— scripts/capture_key_matrix.py:163-168 | scripts/verify_suspicious_keys.py:124-129 — before extracting anything, compare `scripts/capture_key_matrix.py` and `scripts/verify_suspicious_keys.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 103 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.
herdr-tui-session.tui::apply (cognitive 21) src/integration/assets/opencode/herdr-tui-session.js:234— herdr-tui-session.tui::apply has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 2, ternaries 1 (2 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. This shape REPEATS in the file: 2 other methods here (herdr-tui-session.tui::resolveRoot, herdr-tui-session.tui::syncSelection) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
herdr-tui-session.tui::syncSelection (cognitive 18) src/integration/assets/opencode/herdr-tui-session.js:343— herdr-tui-session.tui::syncSelection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, ternaries 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. This shape REPEATS in the file: 2 other methods here (herdr-tui-session.tui::resolveRoot, herdr-tui-session.tui::apply) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
herdr-tui-session.tui::resolveRoot (cognitive 17) src/integration/assets/opencode/herdr-tui-session.js:113— herdr-tui-session.tui::resolveRoot has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 1, 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. This shape REPEATS in the file: 2 other methods here (herdr-tui-session.tui::apply, herdr-tui-session.tui::syncSelection) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 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.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×3
Edited copy of a member (25 corresponding lines) src/detect/manifest.rs:982— src/detect/manifest.rs:982-1009 | src/detect/manifest.rs:1015-1039 — 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) src/workspace.rs:869— src/workspace.rs:869-893 | src/workspace.rs:1111-1136 — 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) src/app/popup.rs:41— src/app/popup.rs:41-65 | src/app/popup.rs:73-97 — 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.
Duplicated block (17 lines × 2) src/config/keybinds.rs:1058— src/config/keybinds.rs:1058-1074 | src/config/keybinds.rs:1092-1108 — 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 `src/config/keybinds.rs:1058` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/config/keybinds.rs:1055` calls `normalize_key_combo`, `combo` and `src/config/keybinds.rs:1089` 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 × 2) REDACTED:325— REDACTED:325-341 | src/update.rs:2557-2573 — 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) scripts/capture_key_matrix.py:172— scripts/capture_key_matrix.py:172-189 | scripts/verify_suspicious_keys.py:133-149 — before extracting anything, compare `scripts/capture_key_matrix.py` and `scripts/verify_suspicious_keys.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 103 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 × 3) src/app/api/panes.rs:1917— src/app/api/panes.rs:1917-1922 | src/app/api/panes.rs:1935-1940 | src/app/api/panes.rs:2040-2045 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `params` to `PaneSendTextParams` in one and `PaneSendInputParams` 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 (6 lines × 3) src/app/api/plugins/panes.rs:19— src/app/api/plugins/panes.rs:19-24 | src/app/api/plugins/panes.rs:52-57 | src/app/api/plugins/panes.rs:105-110 — 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 (6 lines × 3) src/platform/fallback.rs:168— src/platform/fallback.rs:168-173 | src/platform/linux.rs:306-311 | src/platform/macos.rs:201-206 — before extracting anything, compare `src/platform/linux.rs` and `src/platform/macos.rs` as WHOLE FILES: this scan already matched 5 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. 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.
KeysConfig::local_profile (cyclomatic 177) src/config/model.rs:718— KeysConfig::local_profile has cyclomatic complexity 177 (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.
KeysConfig::deserialize (cyclomatic 68) src/config/model.rs:612— KeysConfig::deserialize has cyclomatic complexity 68 (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.
RawInputByteFramer::flush_timeout (cyclomatic 49) src/raw_input.rs:476— RawInputByteFramer::flush_timeout has cyclomatic complexity 49 (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.
RawInputByteFramer::drain_available_chunks (cyclomatic 36) src/raw_input.rs:753— RawInputByteFramer::drain_available_chunks 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.
AppState::handle_app_event (cyclomatic 37) src/app/actions.rs:1392— AppState::handle_app_event 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.
AppState::update_terminal_state_with_completion_policy (cyclomatic 17) src/app/actions.rs:1682— AppState::update_terminal_state_with_completion_policy 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.
herdr-tui-session.tui::apply (cyclomatic 25) src/integration/assets/opencode/herdr-tui-session.js:234— herdr-tui-session.tui::apply 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. This shape REPEATS in the file: one other method here (herdr-tui-session.tui::hydrate) 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.
herdr-tui-session.tui::hydrate (cyclomatic 17) src/integration/assets/opencode/herdr-tui-session.js:287— herdr-tui-session.tui::hydrate 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. This shape REPEATS in the file: one other method here (herdr-tui-session.tui::apply) 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.
PendingEndpointActivation::receive_response_for_boot (cyclomatic 22) src/client/endpoint/activation.rs:350— PendingEndpointActivation::receive_response_for_boot 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.
PendingEndpointActivation::endpoint_disconnected (cyclomatic 18) src/client/endpoint/activation.rs:741— PendingEndpointActivation::endpoint_disconnected 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.
Palette::with_overrides (cyclomatic 20) src/app/state.rs:553— Palette::with_overrides 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. This shape REPEATS in the file: one other method here (Palette::with_mode_overrides) 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.
Palette::with_mode_overrides (cyclomatic 20) src/app/state.rs:615— Palette::with_mode_overrides 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. This shape REPEATS in the file: one other method here (Palette::with_overrides) 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.
GhosttyPaneTerminal::render (cyclomatic 20) src/pane/terminal.rs:2357— GhosttyPaneTerminal::render 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.
GhosttyPaneTerminal::process_pty_bytes (cyclomatic 16) src/pane/terminal.rs:1353— GhosttyPaneTerminal::process_pty_bytes 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.
RetainedTextBuffer::search_window (cyclomatic 20) src/pane/terminal.rs:825— RetainedTextBuffer::search_window 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.
RetainedTextBuffer::build (cyclomatic 18) src/pane/terminal.rs:727— RetainedTextBuffer::build 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.
KeysConfig::local_profile (cognitive 176) src/config/model.rs:718— KeysConfig::local_profile has cognitive complexity 176 (threshold 15). Drivers by points: if/else 176. 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.
KeysConfig::deserialize (cognitive 67) src/config/model.rs:612— KeysConfig::deserialize has cognitive complexity 67 (threshold 15). Drivers by points: if/else 64, match/switch 1 (2 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.
PaneRuntime::spawn_command_builder (cognitive 140) src/pane.rs:2687— PaneRuntime::spawn_command_builder has cognitive complexity 140 (threshold 15). Drivers by points: if/else 41 (107 pts), boolean chains 16, match/switch 6 (14 pts), loops 2 (3 pts) (nesting depth added 75). 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.
PaneRuntime::from_handoff_fd (cognitive 17) src/pane.rs:2502— PaneRuntime::from_handoff_fd has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 3, loops 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, 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.
RawInputByteFramer::drain_available_chunks (cognitive 85) src/raw_input.rs:753— RawInputByteFramer::drain_available_chunks has cognitive complexity 85 (threshold 15). Drivers by points: if/else 26 (74 pts), boolean chains 7, match/switch 1 (3 pts), loops 1 (nesting depth added 50). 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.
RawInputByteFramer::flush_timeout (cognitive 64) src/raw_input.rs:476— RawInputByteFramer::flush_timeout has cognitive complexity 64 (threshold 15). Drivers by points: if/else 33 (48 pts), boolean chains 16 (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.
RetainedTextBuffer::build (cognitive 40) src/pane/terminal.rs:727— RetainedTextBuffer::build has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RetainedTextBuffer::search_window (cognitive 31) src/pane/terminal.rs:825— RetainedTextBuffer::search_window has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 4 (6 pts), match/switch 3 (5 pts), boolean chains 3 (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.
Terminal::viewport_link_regions (cognitive 34) crates/ghostty-vt/src/lib.rs:1442— Terminal::viewport_link_regions has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (28 pts), boolean chains 3, loops 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.
Terminal::kitty_virtual_image_placements (cognitive 31) crates/ghostty-vt/src/lib.rs:2172— Terminal::kitty_virtual_image_placements has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 3 (4 pts), match/switch 1 (3 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.
herdr-tui-session.setup::receive (cognitive 28) src/integration/assets/opencode/herdr-tui-session.js:535— herdr-tui-session.setup::receive has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 2 (4 pts), boolean chains 3, match/switch 1, ternaries 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 (herdr-tui-session.setup::reconcileBlockers) 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.
herdr-tui-session.setup::reconcileBlockers (cognitive 27) src/integration/assets/opencode/herdr-tui-session.js:477— herdr-tui-session.setup::reconcileBlockers has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 5 (11 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. This shape REPEATS in the file: one other method here (herdr-tui-session.setup::receive) 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.
PendingEndpointActivation::receive_response_for_boot (cognitive 27) src/client/endpoint/activation.rs:350— PendingEndpointActivation::receive_response_for_boot has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 5 (6 pts), 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.
PendingEndpointActivation::endpoint_disconnected (cognitive 21) src/client/endpoint/activation.rs:741— PendingEndpointActivation::endpoint_disconnected has cognitive complexity 21 (threshold 15). Drivers by points: match/switch 7 (14 pts), if/else 5 (6 pts), boolean chains 1 (nesting depth added 8). 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.
TextEditor::handle_key (cognitive 26) src/client/shell/text_editor.rs:163— TextEditor::handle_key has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 5, match/switch 2 (5 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.
TextEditor::word_boundary (cognitive 18) src/client/shell/text_editor.rs:115— TextEditor::word_boundary has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 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.
Palette::with_overrides (cognitive 19) src/app/state.rs:553— Palette::with_overrides has cognitive complexity 19 (threshold 15). Drivers by points: if/else 19. 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. This shape REPEATS in the file: one other method here (Palette::with_mode_overrides) 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.
Palette::with_mode_overrides (cognitive 19) src/app/state.rs:615— Palette::with_mode_overrides has cognitive complexity 19 (threshold 15). Drivers by points: if/else 19. 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. This shape REPEATS in the file: one other method here (Palette::with_overrides) 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.
EndpointSupervisors::spawn_due (cognitive 18) src/client/endpoint/supervisor.rs:180— EndpointSupervisors::spawn_due has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, 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.
EndpointSupervisors::host_power_event (cognitive 16) src/client/endpoint/supervisor.rs:319— EndpointSupervisors::host_power_event has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, loops 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.
D4 · Code Duplication· Edited copy of a member (43 corresponding lines) · ×2
Edited copy of a member (43 corresponding lines) src/ui/sidebar/tokens.rs:71— src/ui/sidebar/tokens.rs:71-122 | src/ui/sidebar/tokens.rs:136-178 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (43 corresponding lines) src/update.rs:1176— src/update.rs:1176-1219 | src/update.rs:1446-1488 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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) · ×2
Edited copy of a member (24 corresponding lines) src/platform/linux.rs:149— src/platform/linux.rs:149-172 | src/platform/macos.rs:151-184 — 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) src/client/endpoint/activation.rs:661— src/client/endpoint/activation.rs:661-688 | src/client/endpoint/activation.rs:694-717 — 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 (28 corresponding lines) · ×2
Edited copy of a member (28 corresponding lines) crates/ghostty-vt/src/pane_graphics_files.rs:136— crates/ghostty-vt/src/pane_graphics_files.rs:136-163 | crates/ghostty-vt/src/pane_graphics_files.rs:191-221 — 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) src/detect/mod.rs:124— src/detect/mod.rs:124-151 | src/detect/mod.rs:153-186 — 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.
D4 · Code Duplication· Edited copies of one member (3 members, 17+ corresponding lines) · ×2
Edited copies of one member (3 members, 17+ corresponding lines) src/integration/config_edit.rs:249— src/integration/config_edit.rs:249-268 | src/integration/config_edit.rs:274-293 | src/integration/config_edit.rs:324-340 — 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) src/workspace.rs:738— src/workspace.rs:738-754 | src/workspace/tab.rs:219-238 | src/workspace/tab.rs:293-309 — 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.
D4 · Code Duplication· Edited copies of one member (3 members, 7+ corresponding lines) · ×2
Edited copies of one member (3 members, 7+ corresponding lines) src/api/schema/common.rs:169— src/api/schema/common.rs:169-175 | src/api/schema/common.rs:177-198 | src/cli/plugin/bindings.rs:104-120 — 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) src/cli/agent/bindings.rs:33— src/cli/agent/bindings.rs:33-39 | src/cli/pane/bindings.rs:162-168 | src/cli/plugin/bindings.rs:25-31 — 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.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×2
Edited copy of a member (23 corresponding lines) src/platform/linux.rs:1050— src/platform/linux.rs:1050-1072 | src/platform/linux.rs:1074-1100 — 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) crates/ghostty-vt/src/lib.rs:2396— crates/ghostty-vt/src/lib.rs:2396-2418 | crates/ghostty-vt/src/lib.rs:3329-3361 — 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 (4 members, 19+ corresponding lines) · ×2
Edited copies of one member (4 members, 19+ corresponding lines) src/cli.rs:287— src/cli.rs:287-305 | src/cli.rs:422-441 | src/cli.rs:443-463 | src/cli/integration.rs:3-22 — 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.
Edited copies of one member (4 members, 19+ corresponding lines) src/pane/terminal.rs:985— src/pane/terminal.rs:985-1004 | src/pane/terminal.rs:1006-1024 | src/pane/terminal.rs:1051-1069 | src/pane/terminal.rs:1071-1089 — 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.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×2
Edited copy of a member (11 corresponding lines) src/cli/plugin.rs:52— src/cli/plugin.rs:52-62 | src/cli/plugin.rs:79-92 — 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) src/platform/macos.rs:1197— src/platform/macos.rs:1197-1207 | src/platform/linux.rs:843-853 — 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 copies of one member (4 members, 7+ corresponding lines) · ×2
Edited copies of one member (4 members, 7+ corresponding lines) crates/ghostty-vt/src/pane_graphics_files.rs:276— crates/ghostty-vt/src/pane_graphics_files.rs:276-282 | crates/ghostty-vt/src/pane_graphics_files.rs:327-333 | src/integration/config_file.rs:139-146 | src/platform/windows/config_backup.rs:44-52 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 7+ corresponding lines) src/cli/pane/bindings.rs:153— src/cli/pane/bindings.rs:153-160 | src/cli/pane/bindings.rs:296-302 | src/cli/plugin/bindings.rs:51-57 | src/cli/workspace_bindings.rs:30-37 — These 4 members are one piece of code written 4 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 4 times and the copies will drift further apart.
Duplicated block (30 lines × 2) src/app/api.rs:1335— src/app/api.rs:1335-1364 | src/server/headless.rs:3427-3456 — 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 (30 lines × 2) src/client/shell/overlays.rs:318— src/client/shell/overlays.rs:318-347 | src/client/shell/overlays.rs:433-462 — 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 `src/client/shell/overlays.rs: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 (23 lines × 2) src/pane/osc.rs:77— src/pane/osc.rs:77-99 | src/pane/osc.rs:183-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 `src/pane/osc.rs:77` 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 (23 lines × 2) src/server/headless.rs:1856— src/server/headless.rs:1856-1878 | src/server/headless.rs:1907-1929 — 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 `src/server/headless.rs:1856` 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) src/client/shell/overlays.rs:361— src/client/shell/overlays.rs:361-380 | src/client/shell/overlays.rs:477-496 — 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 `src/client/shell/overlays.rs:361` 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) src/server/client_transport.rs:1211— src/server/client_transport.rs:1211-1230 | src/server/client_transport.rs:1256-1275 — 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 `src/server/client_transport.rs:1211` 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 (19 lines × 2) src/client/shell/worktree_overlays.rs:60— src/client/shell/worktree_overlays.rs:60-78 | src/client/shell/worktree_overlays.rs:367-385 — 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 `src/client/shell/worktree_overlays.rs:60` 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 (19 lines × 2) src/config/keybinds.rs:876— src/config/keybinds.rs:876-894 | src/config/keybinds.rs:912-930 — 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 `src/config/keybinds.rs:876` 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) src/integration/registry.rs:162— src/integration/registry.rs:162-179 | src/pane.rs:2035-2050 — 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 (16–18 lines × 2) src/server/headless.rs:2361— src/server/headless.rs:2361-2376 | src/server/headless.rs:2459-2476 — 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 `src/server/headless.rs:2361` 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 (14–15 lines × 2) src/app/actions.rs:285— src/app/actions.rs:285-298 | src/app/actions.rs:338-352 — 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 `src/app/actions.rs: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 (14–15 lines × 2) src/client/shell/endpoint_sidebar.rs:247— src/client/shell/endpoint_sidebar.rs:247-260 | src/client/shell/sidebar.rs:208-222 — before extracting anything, compare `src/client/shell/endpoint_sidebar.rs` and `src/client/shell/sidebar.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 69 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 `src/client/shell/endpoint_sidebar.rs:247` 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 × 7) src/integration/targets.rs:177— src/integration/targets.rs:177-185 | src/integration/targets.rs:280-291 | src/integration/targets.rs:332-343 | src/integration/targets.rs:392-403 | src/integration/targets.rs:951-962 | src/integration/targets.rs:1011-1022 | src/integration/targets.rs:1179-1190 — all 7 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 `src/integration/targets.rs:177` 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 × 7) src/integration/targets.rs:127— src/integration/targets.rs:127-135 | src/integration/targets.rs:228-236 | src/integration/targets.rs:263-271 | src/integration/targets.rs:375-383 | src/integration/targets.rs:929-937 | src/integration/targets.rs:994-1002 | src/integration/targets.rs:1588-1596 — all 7 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 (9 lines × 3) src/integration/config_edit.rs:250— src/integration/config_edit.rs:250-258 | src/integration/config_edit.rs:275-283 | src/integration/config_edit.rs:325-333 — 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 (9 lines × 3) src/plugin_installations.rs:47— src/plugin_installations.rs:47-55 | src/plugin_installations.rs:118-126 | src/plugin_installations.rs:196-204 — 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 (8–9 lines × 2) src/cli/agent.rs:43— src/cli/agent.rs:43-51 | src/cli/server.rs:215-222 — 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 `src/cli/agent.rs:43` 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–9 lines × 2) src/cli/pane.rs:31— src/cli/pane.rs:31-38 | src/cli/plugin.rs:36-44 — 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 `src/cli/plugin.rs:36` 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 × 3) src/app/tab_bar_status.rs:311— src/app/tab_bar_status.rs:311-318 | src/app/tab_bar_status.rs:320-327 | src/app/tab_bar_status.rs:329-336 — 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 (8 lines × 3) src/client/shell_runtime.rs:504— src/client/shell_runtime.rs:504-511 | src/client/shell_runtime.rs:604-611 | src/client/shell_runtime.rs:663-670 — 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 `src/client/shell_runtime.rs:504` 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, `src/client/shell_runtime.rs:513` calls `present_frozen_chrome` and `src/client/shell_runtime.rs:612` 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–7 lines × 2) src/client/endpoint/activation.rs:504— src/client/endpoint/activation.rs:504-510 | src/client/endpoint/activation.rs:541-546 — 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–7 lines × 2) src/pane.rs:943— src/pane.rs:943-948 | src/pane.rs:2864-2870 — 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 `src/pane.rs:943` 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 lines × 3) src/client/shell/agent_sidebar.rs:209— src/client/shell/agent_sidebar.rs:209-213 | src/client/shell/endpoint_sidebar.rs:396-400 | src/client/shell/sidebar.rs:297-301 — before extracting anything, compare `src/client/shell/endpoint_sidebar.rs` and `src/client/shell/sidebar.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 69 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 `src/client/shell/agent_sidebar.rs:209` 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 × 3) scripts/changelog.py:135— scripts/changelog.py:135-139 | scripts/changelog.py:145-151 | scripts/preview.py: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. 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 `source_path` to `Path = PROTOCOL_SOURCE_PATH` in one and `Path = ENDPOINT_PROTOCOL_SOURCE_PATH` 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.
AX2 · Stateful singletons· Process-global static state · ×1
Process-global static state: Desktop scripts/windows_input/Native.cs:22— `Desktop` keeps mutable `static` state — one slot for the whole process, shared by every thread that reaches the type however its instances are created — and mutates it outside any lock (stopThread, stopThreadId, stopHook, stopError; e.g. `stopThread` at line 46). Concurrent callers lose updates, and a collection that is not built for concurrent writers can corrupt.
Config::validated_keybinds (cyclomatic 77) src/config/keybinds.rs:499— Config::validated_keybinds has cyclomatic complexity 77 (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.
PaneRuntime::spawn_command_builder (cyclomatic 61) src/pane.rs:2687— PaneRuntime::spawn_command_builder has cyclomatic complexity 61 (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.
C1XtgettcapQueryTracker::observe (cyclomatic 51) src/pane/xtgettcap.rs:40— C1XtgettcapQueryTracker::observe has cyclomatic complexity 51 (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.
PendingAltScreenRead::poll (cyclomatic 46) src/server/alt_screen_read.rs:136— PendingAltScreenRead::poll has cyclomatic complexity 46 (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.
herdr-agent-state.default (cyclomatic 36) src/integration/assets/omp/herdr-agent-state.ts:245— herdr-agent-state.default has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 2 of the 36 points are its own statements and the rest belongs to 15 function items inside it that branch (desiredState, a function literal at line 404, a function literal at line 439, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
TextEditor::handle_key (cyclomatic 32) src/client/shell/text_editor.rs:163— TextEditor::handle_key has cyclomatic complexity 32 (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.
OscStreamCollector::observe (cyclomatic 31) src/pane/osc.rs:373— OscStreamCollector::observe 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.
herdr-tui-session.setup::receive (cyclomatic 27) src/integration/assets/opencode/herdr-tui-session.js:535— herdr-tui-session.setup::receive 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.
DefaultColorOscTracker::observe (cyclomatic 26) src/pane/osc.rs:64— DefaultColorOscTracker::observe 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 shape REPEATS in the file: one other method here (DefaultColorEventTracker::observe) 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.
DefaultColorEventTracker::observe (cyclomatic 26) src/pane/osc.rs:170— DefaultColorEventTracker::observe 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 shape REPEATS in the file: one other method here (DefaultColorOscTracker::observe) 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.
herdr-agent-state.HerdrAgentStatePlugin.event (cyclomatic 24) src/integration/assets/opencode/herdr-agent-state.js:152— herdr-agent-state.HerdrAgentStatePlugin.event 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.
AttachEscapeState::filter_input (cyclomatic 23) src/client/attach.rs:57— AttachEscapeState::filter_input 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.
CursorPositionSettleState::observe (cyclomatic 22) src/pane/cursor.rs:111— CursorPositionSettleState::observe 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.
PtyIoActorRunner::run (cyclomatic 20) src/pty/actor/unix.rs:512— PtyIoActorRunner::run 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.
PaneTerminal::word_motion_target (cyclomatic 19) src/pane/terminal.rs:306— PaneTerminal::word_motion_target has cyclomatic complexity 19 (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.
RemoteSsh::prepare_shared_transport (cyclomatic 19) REDACTED:877— RemoteSsh::prepare_shared_transport 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.
Terminal::viewport_link_regions (cyclomatic 18) crates/ghostty-vt/src/lib.rs:1442— Terminal::viewport_link_regions 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.
Decoder::decode (cyclomatic 18) src/protocol/surface_reuse.rs:100— Decoder::decode 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.
DecscusrTracker::observe_byte (cyclomatic 17) src/pane/cursor.rs:40— DecscusrTracker::observe_byte 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.
Desktop.SetEmptyClipboardImage (cyclomatic 16) scripts/windows_input/Native.cs:178— Desktop.SetEmptyClipboardImage 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.
D10 · Test Quality· Fixed-sleep synchronisation · ×1
Fixed-sleep synchronisation: V2 resends the latest state after a failed delivery src/integration/assets/opencode/herdr-tui-session.test.ts:684— This test starts work it did not wait for (`resend`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 700))` — a fixed wait, not a signal that the work is done. Whether it passes depends on how loaded the machine is, which is why a test written this way is green on a developer's box and random in CI. Wait for the event itself instead: the process's own exit or output, a completion handle, or a condition polled to a timeout.
Config::validated_keybinds (cognitive 97) src/config/keybinds.rs:499— Config::validated_keybinds has cognitive complexity 97 (threshold 15). Drivers by points: if/else 76 (91 pts), boolean chains 4, loops 2 (nesting depth added 15). 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.
PendingAltScreenRead::poll (cognitive 69) src/server/alt_screen_read.rs:136— PendingAltScreenRead::poll has cognitive complexity 69 (threshold 15). Drivers by points: if/else 33 (55 pts), boolean chains 9, match/switch 3 (5 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.
C1XtgettcapQueryTracker::observe (cognitive 66) src/pane/xtgettcap.rs:40— C1XtgettcapQueryTracker::observe has cognitive complexity 66 (threshold 15). Drivers by points: if/else 23 (45 pts), match/switch 6 (17 pts), boolean chains 3, loops 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OscStreamCollector::observe (cognitive 48) src/pane/osc.rs:373— OscStreamCollector::observe has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (32 pts), match/switch 5 (15 pts), loops 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultColorOscTracker::observe (cognitive 41) src/pane/osc.rs:64— DefaultColorOscTracker::observe has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (35 pts), match/switch 2 (5 pts), loops 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. This shape REPEATS in the file: one other method here (DefaultColorEventTracker::observe) 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.
DefaultColorEventTracker::observe (cognitive 41) src/pane/osc.rs:170— DefaultColorEventTracker::observe has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (35 pts), match/switch 2 (5 pts), loops 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. This shape REPEATS in the file: one other method here (DefaultColorOscTracker::observe) 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.
AttachEscapeState::filter_input (cognitive 37) src/client/attach.rs:57— AttachEscapeState::filter_input has cognitive complexity 37 (threshold 15). Drivers by points: if/else 19 (29 pts), boolean chains 4, match/switch 1 (3 pts), 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.
herdr-agent-state.default (cognitive 34) src/integration/assets/omp/herdr-agent-state.ts:245— herdr-agent-state.default has cognitive complexity 34 (threshold 15). Drivers by points: if/else 24, boolean chains 10. Most of this is not in the body itself: 1 of the 34 points is its own statement and the rest belongs to 15 function items inside it that branch (desiredState, a function literal at line 404, a function literal at line 439, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
PtyIoActorRunner::run (cognitive 33) src/pty/actor/unix.rs:512— PtyIoActorRunner::run has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (22 pts), match/switch 3 (6 pts), boolean chains 4, 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.
Decoder::decode (cognitive 31) src/protocol/surface_reuse.rs:100— Decoder::decode has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 1 (4 pts), boolean chains 2, match/switch 2 (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.
ConsoleProbe.Read (cognitive 28) scripts/windows_input/Native.cs:452— ConsoleProbe.Read has cognitive complexity 28 (threshold 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.
CursorPositionSettleState::observe (cognitive 27) src/pane/cursor.rs:111— CursorPositionSettleState::observe has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 8 (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.
DecscusrTracker::observe_byte (cognitive 24) src/pane/cursor.rs:40— DecscusrTracker::observe_byte has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 3, 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.
Field::read_matches (cognitive 21) src/cli/projection.rs:570— Field::read_matches has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (8 pts), match/switch 1 (2 pts), 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.
WindowTitleTemplate::parse (cognitive 21) src/config/window_title.rs:62— WindowTitleTemplate::parse has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (4 pts), 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.
RemoteSsh::prepare_shared_transport (cognitive 20) REDACTED:877— RemoteSsh::prepare_shared_transport has cognitive complexity 20 (threshold 15). Drivers by points: if/else 18 (19 pts), match/switch 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.
Desktop.DeadKeyChord (cognitive 19) scripts/windows_input/Native.cs:299— Desktop.DeadKeyChord has cognitive complexity 19 (threshold 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.
KittyKeyboardTracker::observe (cognitive 19) src/pane/kitty_keyboard.rs:14— KittyKeyboardTracker::observe has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (3 pts), boolean chains 2, 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.
Desktop.SetEmptyClipboardImage (cognitive 18) scripts/windows_input/Native.cs:178— Desktop.SetEmptyClipboardImage has cognitive complexity 18 (threshold 15). 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.
PaneTerminal::word_motion_target (cognitive 17) src/pane/terminal.rs:306— PaneTerminal::word_motion_target has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 3 (5 pts), match/switch 2 (3 pts), loops 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.
SshStdioBridge::start_command (cognitive 17) REDACTED:3030— SshStdioBridge::start_command has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 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.
ActiveSubscription::poll_batch (cognitive 16) src/api/subscriptions.rs:282— ActiveSubscription::poll_batch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (4 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.
SourceInput::resolve (cognitive 16) src/app/api/worktrees/reads.rs:21— SourceInput::resolve has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 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.
InputFilter::push (cognitive 16) src/client/direct_graphics.rs:138— InputFilter::push has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 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.
PtyIoActor::spawn (cognitive 16) src/pty/actor.rs:205— PtyIoActor::spawn has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), match/switch 2 (4 pts), 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.
herdr-agent-state.HerdrAgentStatePlugin.event (cognitive 16) src/integration/assets/opencode/herdr-agent-state.js:152— herdr-agent-state.HerdrAgentStatePlugin.event has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, loops 1 (3 pts), 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.
Near-duplicate member pair (183 shared lines) src/pane.rs:942— src/pane.rs:942-1259 | src/pane.rs:2701-3296 — These two members are variants of one another: 183 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.
Near-duplicate member pair (84 shared lines) src/client/shell/overlays.rs:313— src/client/shell/overlays.rs:313-422 | src/client/shell/overlays.rs:428-538 — These two members are variants of one another: 84 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· Members sharing a duplicated core (17 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (17 members, 50+ identical tokens) src/app/state.rs:78— src/app/state.rs:78-100 | src/app/state.rs:103-125 | src/app/state.rs:153-175 | src/app/state.rs:178-200 | src/app/state.rs:203-225 | src/app/state.rs:228-250 | src/app/state.rs:253-275 | src/app/state.rs:278-300 | src/app/state.rs:303-325 | src/app/state.rs:328-350 | src/app/state.rs:353-375 | src/app/state.rs:378-400 | src/app/state.rs:403-425 | src/app/state.rs:428-450 | src/app/state.rs:453-475 | src/app/state.rs:478-500 | src/app/state.rs:503-525 — These 17 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 17 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 17 times.
D4 · Code Duplication· Members sharing a duplicated core (11 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (11 members, 50+ identical tokens) src/integration/targets.rs:372— src/integration/targets.rs:372-461 | src/integration/targets.rs:603-651 | src/integration/targets.rs:680-724 | src/integration/targets.rs:726-770 | src/integration/targets.rs:772-845 | src/integration/targets.rs:1303-1347 | src/integration/targets.rs:1349-1389 | src/integration/targets.rs:1391-1429 | src/integration/targets.rs:1431-1475 | src/integration/targets.rs:1536-1583 | src/integration/targets.rs:1661-1696 — These 11 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 11 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 11 times.
D4 · Code Duplication· Members sharing a duplicated core (10 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (10 members, 50+ identical tokens) src/integration/targets.rs:160— src/integration/targets.rs:160-223 | src/integration/targets.rs:260-313 | src/integration/targets.rs:315-370 | src/integration/targets.rs:372-461 | src/integration/targets.rs:926-989 | src/integration/targets.rs:991-1043 | src/integration/targets.rs:1162-1244 | src/integration/targets.rs:1246-1301 | src/integration/targets.rs:1488-1534 | src/integration/targets.rs:1585-1631 — These 10 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 10 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 10 times.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (5 members, 50+ identical tokens) src/platform/fallback.rs:114— src/platform/fallback.rs:114-127 | src/platform/linux.rs:331-345 | src/platform/macos.rs:226-240 | src/platform/unix_common.rs:527-540 | src/remote.rs:81-95 — 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 (86 corresponding lines) · ×1
Edited copy of a member (86 corresponding lines) src/pane/osc.rs:64— src/pane/osc.rs:64-153 | src/pane/osc.rs:170-255 — These two members are one piece of code written twice and then edited apart: 86 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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) src/app/api/panes.rs:1558— src/app/api/panes.rs:1558-1597 | src/app/api/panes.rs:1603-1643 — 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 (44 corresponding lines) · ×1
Edited copy of a member (44 corresponding lines) src/client/shell_runtime.rs:572— src/client/shell_runtime.rs:572-615 | src/client/shell_runtime.rs:627-674 — 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 copy of a member (37 corresponding lines) · ×1
Edited copy of a member (37 corresponding lines) src/api/subscriptions.rs:581— src/api/subscriptions.rs:581-620 | src/api/subscriptions.rs:626-662 — 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 (32 corresponding lines) · ×1
Edited copy of a member (32 corresponding lines) src/protocol/render_ansi.rs:347— src/protocol/render_ansi.rs:347-379 | src/protocol/render_ansi.rs:382-413 — 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· Edited copy of a member (30 corresponding lines) · ×1
Edited copy of a member (30 corresponding lines) src/pty/actor.rs:123— src/pty/actor.rs:123-153 | src/pty/actor/unix.rs:153-182 — 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 (33 corresponding lines) · ×1
Edited copy of a member (33 corresponding lines) src/integration/claude_settings.rs:153— src/integration/claude_settings.rs:153-185 | src/integration/config_edit.rs:207-243 — 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, 34+ corresponding lines) · ×1
Edited copies of one member (3 members, 34+ corresponding lines) src/integration/targets.rs:124— src/integration/targets.rs:124-158 | src/integration/targets.rs:225-258 | src/integration/targets.rs:517-553 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (26 corresponding lines) · ×1
Edited copy of a member (26 corresponding lines) src/pty/actor.rs:90— src/pty/actor.rs:90-115 | src/pty/actor/unix.rs:117-146 — 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, 29+ corresponding lines) · ×1
Edited copies of one member (3 members, 29+ corresponding lines) src/config/keybinds.rs:866— src/config/keybinds.rs:866-894 | src/config/keybinds.rs:902-930 | src/config/keybinds.rs:938-969 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 29 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, 24+ corresponding lines) · ×1
Edited copies of one member (3 members, 24+ corresponding lines) src/integration/targets.rs:575— src/integration/targets.rs:575-601 | src/integration/targets.rs:653-678 | src/integration/targets.rs:901-924 — 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 copies of one member (4 members, 18+ corresponding lines) · ×1
Edited copies of one member (4 members, 18+ corresponding lines) crates/ghostty-vt/src/lib.rs:810— crates/ghostty-vt/src/lib.rs:810-832 | crates/ghostty-vt/src/lib.rs:2335-2354 | crates/ghostty-vt/src/lib.rs:2359-2376 | crates/ghostty-vt/src/lib.rs:2860-2882 — These 4 members are one piece of code written 4 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 4 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) src/platform/fallback.rs:60— src/platform/fallback.rs:60-73 | src/platform/windows.rs:856-871 | src/plugin_paths.rs:28-42 | REDACTED:2809-2829 — 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 (3 members, 15+ corresponding lines) · ×1
Edited copies of one member (3 members, 15+ corresponding lines) crates/ghostty-vt/src/lib.rs:1817— crates/ghostty-vt/src/lib.rs:1817-1831 | crates/ghostty-vt/src/lib.rs:3646-3660 | crates/ghostty-vt/src/lib.rs:3662-3676 — These 3 members are one piece of code written 3 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 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×1
Edited copy of a member (22 corresponding lines) src/update.rs:339— src/update.rs:339-360 | src/update.rs:626-648 — 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 copies of one member (3 members, 16+ corresponding lines) · ×1
Edited copies of one member (3 members, 16+ corresponding lines) src/server/headless/client_views.rs:697— src/server/headless/client_views.rs:697-712 | src/server/headless/client_views.rs:718-734 | src/server/headless/client_views.rs:740-755 — 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.
D4 · Code Duplication· Edited copies of one member (3 members, 9+ corresponding lines) · ×1
Edited copies of one member (3 members, 9+ corresponding lines) src/app/agent_view.rs:178— src/app/agent_view.rs:178-191 | src/app/api/plugins/manifest.rs:599-607 | src/app/api/plugins/manifest.rs:609-617 — 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 (3 members, 12+ corresponding lines) · ×1
Edited copies of one member (3 members, 12+ corresponding lines) src/app/api/plugins/manifest.rs:322— src/app/api/plugins/manifest.rs:322-333 | src/app/api/plugins/manifest.rs:344-355 | src/app/api/plugins/manifest.rs:359-370 — 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, 11+ corresponding lines) · ×1
Edited copies of one member (3 members, 11+ corresponding lines) src/cli/api.rs:56— src/cli/api.rs:56-66 | src/cli/server.rs:53-63 | src/cli/server.rs:87-97 — 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, 8+ corresponding lines) · ×1
Edited copies of one member (3 members, 8+ corresponding lines) src/cli/agent/bindings.rs:103— src/cli/agent/bindings.rs:103-110 | src/cli/pane/bindings.rs:170-178 | src/cli/pane/bindings.rs:284-294 — 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 copy of a member (5 corresponding lines) · ×1
Edited copy of a member (5 corresponding lines) src/protocol/surface_delta.rs:106— src/protocol/surface_delta.rs:106-111 | src/protocol/surface_scroll.rs:267-271 — 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 (80 lines × 2) src/pane.rs:1177— src/pane.rs:1177-1256 | src/pane.rs:3185-3264 — 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 `src/pane.rs:1177` 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 (60 lines × 2) src/app/state.rs:554— src/app/state.rs:554-613 | src/app/state.rs:616-675 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `custom` to `&crate::config::CustomThemeColors` in one and `&crate::config::ModeThemeColors` 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 (40 lines × 2) src/pane/osc.rs:111— src/pane/osc.rs:111-150 | src/pane/osc.rs:215-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/pane/osc.rs:111` 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 (30–32 lines × 2) src/client/shell/overlays.rs:773— src/client/shell/overlays.rs:773-802 | src/client/shell/worktree_overlays.rs:155-186 — before extracting anything, compare `src/client/shell/overlays.rs` and `src/client/shell/worktree_overlays.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 64 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 `src/client/shell/worktree_overlays.rs:155` 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 (25 lines × 2) src/pane.rs:1151— src/pane.rs:1151-1175 | src/pane.rs:3157-3181 — 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 `src/pane.rs:1151` 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 (20–24 lines × 2) src/config/sidebar.rs:326— src/config/sidebar.rs:326-349 | src/config/sidebar.rs:379-398 — 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 (24 lines × 2) src/pane.rs:2595— src/pane.rs:2595-2618 | src/pane.rs:2800-2823 — 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 `src/pane.rs:2595` 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 (35–40 lines × 2) src/pane.rs:1061— src/pane.rs:1061-1095 | src/pane.rs:3026-3065 — 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 `src/pane.rs:3026` 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 × 3) src/client/mod.rs:927— src/client/mod.rs:927-946 | src/client/mod.rs:1120-1139 | src/client/mod.rs:1229-1248 — 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 `src/client/mod.rs:927` 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–20 lines × 2) src/client/shell/endpoint_sidebar.rs:562— src/client/shell/endpoint_sidebar.rs:562-580 | src/client/shell/sidebar.rs:437-456 — before extracting anything, compare `src/client/shell/endpoint_sidebar.rs` and `src/client/shell/sidebar.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 69 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 `src/client/shell/endpoint_sidebar.rs:562` 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, `src/client/shell/endpoint_sidebar.rs:559` calls `and_then`, `as_deref` and `src/client/shell/sidebar.rs:436` 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 (18–20 lines × 2) src/pane.rs:1109— src/pane.rs:1109-1126 | src/pane.rs:3083-3102 — 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 `src/pane.rs:1109` 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 × 3) src/client/shell/worktree_overlays.rs:83— src/client/shell/worktree_overlays.rs:83-101 | src/client/shell/worktree_overlays.rs:282-300 | src/client/shell/worktree_overlays.rs:394-412 — 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 `src/client/shell/worktree_overlays.rs:83` 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–17 lines × 2) src/protocol/render_ansi.rs:633— src/protocol/render_ansi.rs:633-647 | src/protocol/render_ansi.rs:1037-1053 — 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 `src/protocol/render_ansi.rs:633` 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 (14–15 lines × 3) src/app/agents.rs:279— src/app/agents.rs:279-292 | src/app/agents.rs:311-325 | src/app/agents.rs:352-365 — 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 `src/app/agents.rs:279` 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 (13–14 lines × 5) src/platform/fallback.rs:115— src/platform/fallback.rs:115-127 | src/platform/linux.rs:332-345 | src/platform/macos.rs:227-240 | src/platform/unix_common.rs:528-540 | src/remote.rs:82-95 — before extracting anything, compare `src/platform/linux.rs` and `src/platform/macos.rs` as WHOLE FILES: this scan already matched 5 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. 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 (10–14 lines × 4) src/app/api/panes.rs:581— src/app/api/panes.rs:581-590 | src/app/api/panes.rs:671-684 | src/app/api/panes.rs:723-732 | src/app/api/panes.rs:1412-1421 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `src/app/api/panes.rs:581` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) fn handle_pane_neighbor( &mut` in one and `super) fn handle_pane_focus_direction( &mut` 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 (13–14 lines × 2) src/app/api/panes.rs:1019— src/app/api/panes.rs:1019-1031 | src/app/api/panes.rs:1051-1064 — 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 `src/app/api/panes.rs:1019` 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–14 lines × 2) src/persist/io.rs:28— src/persist/io.rs:28-41 | src/persist/plugin_registry.rs:46-56 — 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 `src/persist/io.rs: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.
Duplicated block (9–13 lines × 6) src/app/api/panes.rs:510— src/app/api/panes.rs:510-518 | src/app/api/panes.rs:579-587 | src/app/api/panes.rs:612-621 | src/app/api/panes.rs:668-680 | src/app/api/panes.rs:721-729 | src/app/api/panes.rs:1410-1418 — 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 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `params` to `PaneLayoutParams` in one and `PaneNeighborParams` 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 × 3) src/integration/targets.rs:441— src/integration/targets.rs:441-453 | src/integration/targets.rs:793-804 | src/integration/targets.rs:821-832 — 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 `src/integration/targets.rs:441` 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 after the matched lines, `src/integration/targets.rs:835` calls `remove_file_if_exists`, `remove_legacy_bash_hook_file` and `src/integration/targets.rs:455` 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–13 lines × 2) src/app/api/agents.rs:320— src/app/api/agents.rs:320-328 | src/app/api/agents.rs:391-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 `src/app/api/agents.rs:320` 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. 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) fn handle_agent_explain(&mut` in one and `super) fn handle_agent_send_keys( &mut` 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 (8–12 lines × 10) src/integration/targets.rs:429— src/integration/targets.rs:429-436 | src/integration/targets.rs:611-619 | src/integration/targets.rs:687-698 | src/integration/targets.rs:733-744 | src/integration/targets.rs:780-788 | src/integration/targets.rs:806-816 | src/integration/targets.rs:1310-1321 | src/integration/targets.rs:1356-1367 | src/integration/targets.rs:1397-1408 | src/integration/targets.rs:1438-1446 — all 10 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 `src/integration/targets.rs:429` 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, `src/integration/targets.rs:607` calls `join` and `src/integration/targets.rs:729` 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–12 lines × 4) src/integration/targets.rs:275— src/integration/targets.rs:275-281 | src/integration/targets.rs:387-393 | src/integration/targets.rs:941-952 | src/integration/targets.rs:1006-1012 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `src/integration/targets.rs:275` 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–12 lines × 3) src/update.rs:1201— src/update.rs:1201-1211 | src/update.rs:1329-1340 | src/update.rs:1470-1480 — 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 `src/update.rs:1329` 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 (34 lines × 2) src/client/shell/overlays.rs:383— src/client/shell/overlays.rs:383-416 | src/client/shell/overlays.rs:499-532 — 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 `src/client/shell/overlays.rs:383` 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–12 lines × 2) REDACTED:2256— REDACTED:2256-2266 | REDACTED:2336-2347 — 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 `REDACTED:2336` 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 (11 lines × 3) src/integration/targets.rs:752— src/integration/targets.rs:752-762 | src/integration/targets.rs:825-835 | src/integration/targets.rs:1329-1339 — 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 `src/integration/targets.rs:752` 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 (10–11 lines × 3) src/platform/macos.rs:565— src/platform/macos.rs:565-575 | src/platform/macos.rs:1037-1047 | src/platform/macos.rs:1070-1079 — 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 (6–10 lines × 11) src/integration/targets.rs:428— src/integration/targets.rs:428-433 | src/integration/targets.rs:609-615 | src/integration/targets.rs:685-694 | src/integration/targets.rs:731-740 | src/integration/targets.rs:779-784 | src/integration/targets.rs:1308-1317 | src/integration/targets.rs:1354-1363 | src/integration/targets.rs:1395-1404 | src/integration/targets.rs:1436-1442 | src/integration/targets.rs:1543-1549 | src/integration/targets.rs:1666-1672 — 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 `src/integration/targets.rs:428` 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, `src/integration/targets.rs:607` calls `join` and `src/integration/targets.rs:729` 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–10 lines × 2) src/server/client_accept.rs:27— src/server/client_accept.rs:27-34 | src/server/headless.rs:287-296 — 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 `src/server/client_accept.rs:27` 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–10 lines × 2) src/server/headless/client_views.rs:190— src/server/headless/client_views.rs:190-198 | src/server/headless/client_views.rs:336-345 — 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 `src/server/headless/client_views.rs:190` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) fn focus_shell_client_on_tab(&mut` in one and `&mut` 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 (9 lines × 4) src/app/api/panes.rs:178— src/app/api/panes.rs:178-186 | src/app/api/panes.rs:194-202 | src/app/api/panes.rs:297-305 | src/app/api/panes.rs:412-420 — 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 first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) fn handle_pane_clear(&mut` in one and `super) fn handle_pane_scroll(&mut` 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 × 3) src/pane/terminal.rs:2786— src/pane/terminal.rs:2786-2795 | src/pane/terminal.rs:2814-2823 | src/pane/terminal/windows_recent_fallback.rs:163-172 — 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 (22 lines × 17) src/app/state.rs:79— src/app/state.rs:79-100 | src/app/state.rs:104-125 | src/app/state.rs:154-175 | src/app/state.rs:179-200 | src/app/state.rs:204-225 | src/app/state.rs:229-250 | src/app/state.rs:254-275 | src/app/state.rs:279-300 | src/app/state.rs:304-325 | src/app/state.rs:329-350 | src/app/state.rs:354-375 | src/app/state.rs:379-400 | src/app/state.rs:404-425 | src/app/state.rs:429-450 | src/app/state.rs:454-475 | src/app/state.rs:479-500 | src/app/state.rs:504-525 — all 17 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. 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 × 9) src/integration/targets.rs:176— src/integration/targets.rs:176-181 | src/integration/targets.rs:279-287 | src/integration/targets.rs:331-339 | src/integration/targets.rs:391-399 | src/integration/targets.rs:950-958 | src/integration/targets.rs:1010-1018 | src/integration/targets.rs:1178-1186 | src/integration/targets.rs:1500-1505 | src/integration/targets.rs:1604-1609 — all 9 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 `src/integration/targets.rs: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 (6 lines × 4) src/terminal/state.rs:1648— src/terminal/state.rs:1648-1653 | src/terminal/state.rs:1785-1790 | src/terminal/state.rs:1840-1845 | src/terminal/state.rs:1894-1899 — 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 (5 lines × 10) src/integration/targets.rs:175— src/integration/targets.rs:175-179 | src/integration/targets.rs:278-285 | src/integration/targets.rs:330-337 | src/integration/targets.rs:390-397 | src/integration/targets.rs:949-956 | src/integration/targets.rs:1009-1016 | src/integration/targets.rs:1177-1184 | src/integration/targets.rs:1261-1265 | src/integration/targets.rs:1499-1503 | src/integration/targets.rs:1603-1607 — all 10 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 `src/integration/targets.rs:175` 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, `src/integration/targets.rs:274` calls `write`, `make_executable` and `src/integration/targets.rs:1174` 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 × 7) src/app/api/panes.rs:511— src/app/api/panes.rs:511-518 | src/app/api/panes.rs:580-587 | src/app/api/panes.rs:613-620 | src/app/api/panes.rs:669-680 | src/app/api/panes.rs:722-729 | src/app/api/panes.rs:790-802 | src/app/api/panes.rs:1411-1418 — all 7 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 `src/app/api/panes.rs:511` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `self` to `super) fn handle_pane_layout(&mut` in one and `super) fn handle_pane_neighbor( &mut` 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.
D4 · Code Duplication· Edited copy of a member (67 corresponding lines) · ×1
Edited copy of a member (67 corresponding lines) scripts/capture_key_matrix.py:193— scripts/capture_key_matrix.py:193-266 | scripts/verify_suspicious_keys.py:153-219 — These two members are one piece of code written twice and then edited apart: 67 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 (41–43 lines × 2) scripts/capture_key_matrix.py:222— scripts/capture_key_matrix.py:222-264 | scripts/verify_suspicious_keys.py:178-218 — before extracting anything, compare `scripts/capture_key_matrix.py` and `scripts/verify_suspicious_keys.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 103 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 × 3) scripts/capture_key_matrix.py:66— scripts/capture_key_matrix.py:66-82 | scripts/capture_keys.py:34-50 | scripts/verify_suspicious_keys.py:42-58 — before extracting anything, compare `scripts/capture_key_matrix.py` and `scripts/verify_suspicious_keys.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 103 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 (14 lines × 3) scripts/capture_key_matrix.py:93— scripts/capture_key_matrix.py:93-106 | scripts/capture_keys.py:54-67 | scripts/verify_suspicious_keys.py:69-82 — before extracting anything, compare `scripts/capture_key_matrix.py` and `scripts/verify_suspicious_keys.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 103 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 (13 lines × 3) scripts/changelog.py:588— scripts/changelog.py:588-600 | scripts/changelog.py:614-627 | scripts/changelog.py:643-656 — 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.
End-of-life runtime: Rust 1.96 rust-toolchain.toml:1— rust-toolchain.toml declares Rust 1.96 as this project's toolchain file, and Rust 1.96, superseded by 1.97 on 2026-07-09 (the Rust project patches only the current stable). An unsupported runtime receives no security patches, so every vulnerability disclosed in it since 2026-07-09 is present and unfixable without moving off it. This is a migration rather than an upgrade: there is no newer release of a runtime that has ended.
Off the main sequence: ghostty-vt — ghostty-vt: abstractness 0.02, instability 0.00, distance 0.98 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
Sync-over-async blocking src/server/headless/lifecycle.rs:336— `complete_shutdown` is async and calls thread::sleep — a blocking call inside async code stalls the executor thread, and every task scheduled on it for as long as it runs.
SC1 · Supply-chain hygiene· JavaScript dependencies are not locked · ×1
JavaScript dependencies are not locked .pi/extensions/github-issues-autocomplete/package.json:16— .pi/extensions/github-issues-autocomplete/package.json declares dependencies that no committed lockfile resolves — there is no package-lock.json / yarn.lock / pnpm-lock.yaml / bun.lock beside it, and no locked workspace above it names it — so its installs aren't reproducible (SSDF PW.4.4). Commit its package manager's lockfile (or add it to the locked workspace) and install from it (`npm ci`, `yarn --immutable`, `pnpm i --frozen-lockfile` or `bun i --frozen-lockfile`). Advisory — never scored.
Duplicated predicate src/client/shell/endpoint_sidebar.rs:352— `!body.is_empty() && std::mem::take(state.reveal_focused_workspace)` appears character-identically in 2 files — src/client/shell/endpoint_sidebar.rs, src/client/shell/sidebar.rs. 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 src/server/headless/client_views.rs:639— `!client.is_active_shell_client() || client.writer.is_none()` appears character-identically in 2 files — src/server/headless/client_views.rs, src/server/headless/render.rs. 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 src/protocol/surface_delta/decode.rs:138— `!graphics.assets.is_empty() || !graphics.placements.is_empty() || !graphics.retained_assets.is_empty()` appears character-identically in 2 files — src/protocol/surface_delta/decode.rs, src/server/headless/render.rs. 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 src/client/shell/endpoint_sidebar.rs:217— `area.is_empty() || workspace_area.width == 0` appears character-identically in 2 files — src/client/shell/endpoint_sidebar.rs, src/client/shell/sidebar.rs. 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 src/client/shell/context_menu.rs:103— `candidate.key == worktree.key && candidate.is_linked_worktree` appears character-identically in 2 files — src/client/shell/context_menu.rs, src/client/shell/sidebar.rs. 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 src/server/headless.rs:952— `client.is_active_shell_client() && client.outer_terminal_focus == Some(true)` appears character-identically in 2 files — src/server/headless.rs, src/server/headless/client_views.rs. 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 src/server/headless/retained_surface.rs:179— `cursor.visible && !crate::ui::pane_is_scrolled_back(runtime)` appears character-identically in 2 files — src/server/headless/retained_surface.rs, src/server/render_stream.rs. 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 src/client/clipboard_images.rs:243— `extension.eq_ignore_ascii_case("jpg") || extension.eq_ignore_ascii_case("jpeg")` appears character-identically in 2 files — src/client/clipboard_images.rs, src/server/clipboard_image.rs. 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 src/client/terminal_setup.rs:492— `handle.is_null() || handle == INVALID_HANDLE_VALUE` appears character-identically in 2 files — src/client/terminal_setup.rs, src/platform/windows.rs. 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 src/input/parse.rs:1284— `line.is_empty() || line.starts_with('#')` appears character-identically in 2 files — src/input/parse.rs, src/raw_input.rs. 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 src/client/shell/agent_sidebar.rs:211— `metrics.max_offset_from_bottom > 0 && body.width > 1` appears character-identically in 3 files — src/client/shell/agent_sidebar.rs, src/client/shell/endpoint_sidebar.rs, src/client/shell/sidebar.rs. 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 src/server/headless/render.rs:963— `native_upload.is_some() || self.native_graphics.is_pending(client_id)` appears character-identically in 2 files — src/server/headless/render.rs, src/server/headless/retained_surface.rs. 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 src/app/api/panes.rs:776— `params.source_pane_id.is_some() || params.target_pane_id.is_some()` appears character-identically in 2 files — src/app/api/panes.rs, src/cli/pane.rs. 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 src/app/api.rs:1891— `runtime.cwd() != Some(live_cwd.clone()) && std::time::Instant::now() < deadline` appears character-identically in 2 files — src/app/api.rs, src/server/notifications.rs. 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 src/app/mod.rs:778— `self.pane_exit_checkpoint_pending && !self.state.session_dirty` appears character-identically in 2 files — src/app/mod.rs, src/app/session.rs. 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 src/client/shell/link_hover.rs:54— `surface.boot_id == snapshot.boot_id && surface.projection_revision == snapshot.revision` appears character-identically in 2 files — src/client/shell/link_hover.rs, src/client/shell/state.rs. 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 on Err src/api/event_hub.rs:35— `events_after` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src/api/event_hub.rs:70— `current_sequence` turns every `Err` into `0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src/app/api/panes.rs:1252— `handle_pane_move` turns every `Err` into `"/".into()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src/app/api/plugins/context.rs:388— `default_cwd_for_workspace` turns every `Err` into `"/".into()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src/app/api.rs:967— `handle_api_request_after_internal_events_drained` turns every `Err` into `"{}".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src/pane/terminal.rs:1768— `resize` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src/server/headless/notifications.rs:237— `handle_notification_show_api` turns every `Err` into `"{}".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src/server/headless.rs:1535— `handle_client_window_title_api` turns every `Err` into `"{}".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src/api/server.rs:568— `handle_request` turns every `Err` into `r#"{"id":"","error":{"code":"internal_error","message":"failed to encode response"}}"#.to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src/api/server.rs:1042— `error_response_json` turns every `Err` into `r#"{"id":"","error":{"code":"internal_error","message":"failed to encode error response"}}"#.to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src/persist/snapshot.rs:250— `legacy_identity_cwd` turns every `Err` into `"/".into()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src/persist/snapshot.rs:339— `capture_tab` turns every `Err` into `"/".into()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src/platform/linux.rs:560— `process_task_children` turns every `Err` into `Vec::new()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src/server/client_commands.rs:35— `error_response` turns every `Err` into `r#"{"id":"","error":{"code":"serialization_error","message":"failed to serialize endpoint response"}}"#.into()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
Silent fallback default on Err src/server/headless.rs:122— `notification_show_result` turns every `Err` into `"{}".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
Silent fallback default on Err vendor/portable-pty/src/cmdbuilder.rs:729— `get_shell` turns every `Err` into `"%CompSpec%".to_string()` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. 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 arm or in the doc comment, and the row stops firing.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 61 significant file(s) lose their only recent owner: src/kitty_graphics/surface.rs, src/workspace.rs, src/persist/snapshot.rs, src/pane/osc.rs, src/server/alt_screen_read.rs, crates/ghostty-vt/src/pane_graphics_files.rs, src/worktree.rs, src/api/schema/panes.rs (+53 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 4 significant file(s) lose their only recent owner: src/client/endpoint/registry.rs, scripts/package_windows_conpty.py, src/client/endpoint/health.rs, src/config/write.rs. Pair on, review, or document these before any departure.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 3 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (68 single-owned of 333 analysed files in total, 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; 333 of the 383 production source files in this repository met that bar). They are anonymized user #3 (1 file(s)), anonymized user #4 (1 file(s)), anonymized user #5 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: src/integration/claude_settings.rs, src/platform/macos/input.rs, src/cli/server_not_running.rs.
No ADRs found src/main.rs:1— 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 `src/main.rs` makes this repository a deployable product (line 1).
ED3 · Event naming· Event not named in past tense · ×1
Event not named in past tense: UpdateReady src/events.rs:78— `UpdateReady` is an imperative name inside a domain-event set whose siblings are past-tense facts — it reads as an intent, not something that happened. Name new events for the fact that occurred (e.g. `ItemAdded`). Do not rename this one if it is already stored or published: its type name is written with every event recorded under it, so a rename can break replay of the stored stream and every subscriber that reads it, and a clearer name does not pay for that. If it has never been written or sent, renaming it now is safe.
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.
M2 · Architecture documentation· No architecture diagram/doc · ×1
No architecture diagram/doc — No C4/Structurizr/PlantUML/Mermaid/Graphviz/D2 diagram, no drawn diagram named for the architecture, no file named `architecture` or `design` in any markup this check reads, and nothing in the README, docs or contributor guides that announces the shape — no `## Architecture` heading, no "architecture overview"/"high-level design" phrasing, no "the architecture is …" introduction, no guided code tour. A shape laid out in prose that never names itself as the architecture is not visible to this check, and neither is one kept outside the repository, so this row reports the absence of a re-findable shape document — not evidence that nobody wrote the shape down.
P3 · Security & performance tooling· Dependabot does not watch npm · ×1
Dependabot does not watch npm REDACTED:2— `REDACTED` schedules updates, but no `package-ecosystem` entry covers `npm`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list.
Nullable reference types not enabled everywhere — 0/1 C# file(s) are in a nullable-enabled context. This repository commits no project file, so nothing sets <Nullable>enable</Nullable> for it: a file is enabled only by its own `#nullable enable`, by a Unity `csc.rsp` with `-nullable:enable` for its assembly, or as a file-based app (`#:` directives) whose `#:property Nullable` does not turn it off. NRTs catch a whole class of null-deref bugs at compile time.
Outdated: interprocess — `interprocess` is locked at 2.4.4 but 2.4.8 is the current stable release on crates.io, and it already satisfies the `"2.4.2"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p interprocess` and commit the updated REDACTED.
Outdated: libc — `libc` is locked at 0.2.190 but 0.2.191 is the current stable release on crates.io, and it already satisfies the `"0.2"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p libc` and commit the updated REDACTED.
Outdated: ratatui — `ratatui` is locked at 0.30.0 but 0.30.2 is the current stable release on crates.io, and it already satisfies the `"0.30"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p ratatui` and commit the updated REDACTED.
Outdated: schemars — `schemars` is locked at 1.2.2 but 1.2.3 is the current stable release on crates.io, and it already satisfies the `"1.2.1"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p schemars` and commit the updated REDACTED.
Outdated: serde_json — `serde_json` is locked at 1.0.151 but 1.0.154 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p serde_json` and commit the updated REDACTED.
Outdated: tokio — `tokio` is locked at 1.50.0 but 1.54.1 is the current stable release on crates.io, and it already satisfies the `"1"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p tokio` and commit the updated REDACTED.
Outdated: unicode-width — `unicode-width` is locked at 0.2.2 but 0.2.3 is the current stable release on crates.io, and it already satisfies the `"0.2"` requirement declared in Cargo.toml — so the lockfile is behind this repository's own declared range. Run `cargo update -p unicode-width` and commit the updated REDACTED.
Skipped (documented): (unnamed test) scripts/release-workflows.test.ts:62— Skipped with a documented reason — a deferral, not lazy debt: switched off by test.skipIf
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.
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 01a1da93-7f8a-7880-93e3-842935b1e35a · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 2 · Warnings: 1004 · Recommendations: 43 · Info: 8 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 14-11-2026 @ 15:01 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.