Public report of google-gemini/gemini-cli, published 12 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 report Measured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.3). 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, 12 November 2026, 01:00 UTC · Survey ID cd_d2b67cb10a394915a247cce3d047ed52

google-gemini/gemini-cli

Measured 12 November 2026, 00:56 UTC, at code version aeb6c04

CAI score 43out of 100 At risk No change 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: 285,923 lines of product code in 10 projects, tests not counted · Estimated rebuild effort: about 4.2 person-years · Weakest lens: Accessibility, 39

Findings by how serious they are

136 critical 2094 serious 1352 minor

11 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

Assert small markCanine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
12 November 2026, 00:56 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.

A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.

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 ▸

64of 64 dimensions measured by tools.
3555of 3582 findings point to an exact file and line, so you can open each one in the code. The other 27 concern the repository as a whole, such as missing documentation.
64dimensions across 7 lenses, read from 285,923 lines of product code in 10 projects.
Chapters

Executive summary

google-gemini/gemini-cli is rated At risk because critical security findings are open, most of them in the packages it uses. Its score is held back because it has controls that only work with a mouse. It scores 43 out of 100, which the At risk rating leaves unchanged. We judged it as a preview release, against a lower bar.

Accessibility, at 39, is the weakest lens and counts most in the score. The best first step is making the controls keyboard-usable, worth about 4 points. Naming the access rules comes next, worth about 3 points. Raising Accessibility to 65 would lift the score to about 47.

Seventy-four known security holes in the packages the code depends on can be used by attackers. Fourteen settings leave the servers or containers unsafe, and eight controls can't be used without a mouse. Making the controls work with a keyboard, updating the vulnerable packages and correcting the unsafe settings would close these risks. Passing outside input through environment variables would fix the four pipeline steps that put outside input straight into a shell command, and fixing the weaknesses the scanner points to would deal with the three security weaknesses in the code. The ten uses of packages that aren't listed need adding to the project's list of dependencies.

The product code is 285,923 lines, about €610,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 for The 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.
Accessibility 39 · counts for 46%Security and Compliance 40 · counts for 25%Production Readiness 44 · counts for 14%Code Health 55 · counts for 8%Performance 60 · counts for 4%Architecture 66 · counts for 2%Maturity 76 · counts for 1%

If Accessibility rose from 39 to 65, the lowest score rated Strong, the score would rise from 43 to about 47.

Code composition: what the lines of code are
Business logic 0%Supporting code 0%Tests 100%
New since the last survey: 224 findings

These 224 critical or serious findings weren't in the previous survey, on 23 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.

  • Cyclomatic Complexity · textUtils.isWindowsDrivePathSegment (cyclomatic 60) packages/core/src/utils/textUtils.ts
  • Cyclomatic Complexity · GitService.setupShadowGitRepository (cyclomatic 53) packages/core/src/services/gitService.ts
  • Cyclomatic Complexity · shell-utils.isInteractiveGeminiSegment (cyclomatic 52) packages/core/src/utils/shell-utils.ts
  • Cyclomatic Complexity · shell-utils.stripSingleShellWrapper (cyclomatic 50) packages/core/src/utils/shell-utils.ts
  • Cyclomatic Complexity · shell-utils.isPowerShellKeywordBeforeParen (cyclomatic 39) packages/core/src/utils/shell-utils.ts
  • Cyclomatic Complexity · validate.validateExtension (cyclomatic 38) packages/cli/src/commands/extensions/validate.ts
  • Cyclomatic Complexity · errors.normalizeError (cyclomatic 36) packages/core/src/utils/errors.ts
  • Cyclomatic Complexity · shell-utils.tokenizeShellCommandWords (cyclomatic 34) packages/core/src/utils/shell-utils.ts
  • Cyclomatic Complexity · useLoadingIndicator.useLoadingIndicator (cyclomatic 32) packages/cli/src/ui/hooks/useLoadingIndicator.ts
  • Cyclomatic Complexity · shell-utils.unwrapPowerShellCommandArg (cyclomatic 32) packages/core/src/utils/shell-utils.ts
  • Cyclomatic Complexity · shell-utils.isPowerShellMemberOrTypeCallBeforeParen (cyclomatic 32) packages/core/src/utils/shell-utils.ts
  • Cyclomatic Complexity · github.downloadFile (cyclomatic 29) packages/cli/src/config/extensions/github.ts
  • Cyclomatic Complexity · shell-utils.findPurePowerShellExpressionParenClose (cyclomatic 29) packages/core/src/utils/shell-utils.ts
  • Cyclomatic Complexity · WhisperModelManager.executeDownload (cyclomatic 28) packages/core/src/voice/whisperModelManager.ts
  • Cyclomatic Complexity · ShellExecutionService.closeOrphanMasterFd (cyclomatic 27) packages/core/src/services/shellExecutionService.ts
  • Cyclomatic Complexity · chatCompressionService.truncateHistoryToBudget (cyclomatic 26) packages/core/src/context/chatCompressionService.ts
  • Cyclomatic Complexity · pathCorrector.resolveActiveWorkspaceDir (cyclomatic 25) packages/core/src/utils/pathCorrector.ts
  • Cyclomatic Complexity · geminiChat.isValidContent (cyclomatic 24) packages/core/src/core/geminiChat.ts
  • Cyclomatic Complexity · errors.toSafeSerializable (cyclomatic 23) packages/core/src/utils/errors.ts
  • Cyclomatic Complexity · geminiChat.stripToolCallIdPrefixes (cyclomatic 23) packages/core/src/core/geminiChat.ts
  • Cyclomatic Complexity · HeatmapComponent.HeatmapComponent (cyclomatic 21) packages/cli/src/ui/components/HeatmapComponent.tsx
  • Cyclomatic Complexity · ThemeManager.loadUserThemes (cyclomatic 20) packages/cli/src/ui/themes/theme-manager.ts
  • Cyclomatic Complexity · DiffRenderer.renderDiffLines.content (cyclomatic 19) packages/cli/src/ui/components/messages/DiffRenderer.tsx
  • Cyclomatic Complexity · shell-utils.unwrapCmdCommandArg (cyclomatic 19) packages/core/src/utils/shell-utils.ts
  • Cyclomatic Complexity · chatCompressionService.calculateHistoryByteSize (cyclomatic 19) packages/core/src/context/chatCompressionService.ts
  • Cyclomatic Complexity · trace.createEndSpan.<returned closure> (cyclomatic 19) packages/core/src/telemetry/trace.ts
  • Cyclomatic Complexity · paths.isTrustedSystemPath (cyclomatic 18) packages/core/src/utils/paths.ts
  • Cyclomatic Complexity · shell-utils.isAtPowerShellStatementBoundary (cyclomatic 18) packages/core/src/utils/shell-utils.ts
  • Cyclomatic Complexity · shell-utils.isPowerShellKeywordNestedParen (cyclomatic 18) packages/core/src/utils/shell-utils.ts
  • Cyclomatic Complexity · shell-utils.splitShellCommandSegments (cyclomatic 18) packages/core/src/utils/shell-utils.ts
  • Cyclomatic Complexity · textUtils.normalizeEscapedNewlines (cyclomatic 18) packages/core/src/utils/textUtils.ts
  • Cyclomatic Complexity · usageAggregator.collectFileTurnUsages (cyclomatic 18) packages/core/src/services/usageAggregator.ts
  • Cyclomatic Complexity · paths.tildeifyPath (cyclomatic 17) packages/core/src/utils/paths.ts
  • Cyclomatic Complexity · nextSpeakerChecker.checkNextSpeaker (cyclomatic 17) packages/core/src/utils/nextSpeakerChecker.ts
  • Cyclomatic Complexity · readStdin.readStdin (cyclomatic 17) packages/cli/src/utils/readStdin.ts
  • Cyclomatic Complexity · useStaticHistoryStartIndex.countToolResultChars (cyclomatic 16) packages/cli/src/ui/hooks/useStaticHistoryStartIndex.ts
  • Cyclomatic Complexity · DefaultAppLayout.DefaultAppLayout (cyclomatic 16) packages/cli/src/ui/layouts/DefaultAppLayout.tsx
  • Cyclomatic Complexity · useSuspend.useSuspend (cyclomatic 16) packages/cli/src/ui/hooks/useSuspend.ts
  • Cyclomatic Complexity · ShellExecutionService.background (cyclomatic 16) packages/core/src/services/shellExecutionService.ts
  • Cyclomatic Complexity · ignorePathUtils.getNormalizedRelativePath (cyclomatic 16) packages/core/src/utils/ignorePathUtils.ts
  • Cyclomatic Complexity · geminiChat.stripThoughts (cyclomatic 16) packages/core/src/core/geminiChat.ts
  • Cyclomatic Complexity · migrate.migrateClaudeHooks (cyclomatic 16) packages/cli/src/commands/hooks/migrate.ts
  • Cognitive Complexity · shell-utils.stripSingleShellWrapper (cognitive 103) packages/core/src/utils/shell-utils.ts
  • Cognitive Complexity · shell-utils.unwrapPowerShellCommandArg (cognitive 74) packages/core/src/utils/shell-utils.ts
  • Cognitive Complexity · shell-utils.isInteractiveGeminiSegment (cognitive 67) packages/core/src/utils/shell-utils.ts
  • Cognitive Complexity · GitService.setupShadowGitRepository (cognitive 51) packages/core/src/services/gitService.ts
  • Cognitive Complexity · shell-utils.unwrapCmdCommandArg (cognitive 48) packages/core/src/utils/shell-utils.ts
  • Cognitive Complexity · errors.normalizeError (cognitive 46) packages/core/src/utils/errors.ts
  • Cognitive Complexity · textUtils.isWindowsDrivePathSegment (cognitive 46) packages/core/src/utils/textUtils.ts
  • Cognitive Complexity · shell-utils.isPowerShellKeywordBeforeParen (cognitive 43) packages/core/src/utils/shell-utils.ts
  • Cognitive Complexity · github.downloadFile (cognitive 41) packages/cli/src/config/extensions/github.ts
  • Cognitive Complexity · WhisperModelManager.executeDownload (cognitive 41) packages/core/src/voice/whisperModelManager.ts
  • Cognitive Complexity · shell-utils.findPurePowerShellExpressionParenClose (cognitive 40) packages/core/src/utils/shell-utils.ts
  • Cognitive Complexity · usageAggregator.collectFileTurnUsages (cognitive 40) packages/core/src/services/usageAggregator.ts
  • Cognitive Complexity · trace.createEndSpan.<returned closure> (cognitive 39) packages/core/src/telemetry/trace.ts
  • Cognitive Complexity · geminiChat.stripToolCallIdPrefixes (cognitive 37) packages/core/src/core/geminiChat.ts
  • Cognitive Complexity · ThemeManager.loadUserThemes (cognitive 34) packages/cli/src/ui/themes/theme-manager.ts
  • Cognitive Complexity · shell-utils.tokenizeShellCommandWords (cognitive 31) packages/core/src/utils/shell-utils.ts
  • Cognitive Complexity · useStaticHistoryStartIndex.countToolResultChars (cognitive 29) packages/cli/src/ui/hooks/useStaticHistoryStartIndex.ts
  • Cognitive Complexity · pathCorrector.resolveActiveWorkspaceDir (cognitive 28) packages/core/src/utils/pathCorrector.ts
  • Cognitive Complexity · usageAggregator.computeHeatmapMetrics (cognitive 28) packages/core/src/services/usageAggregator.ts
  • Cognitive Complexity · HeatmapComponent.HeatmapComponent (cognitive 27) packages/cli/src/ui/components/HeatmapComponent.tsx
  • Cognitive Complexity · paths.tildeifyPath (cognitive 27) packages/core/src/utils/paths.ts
  • Cognitive Complexity · textUtils.normalizeEscapedNewlines (cognitive 25) packages/core/src/utils/textUtils.ts
  • Cognitive Complexity · errors.toSafeSerializable (cognitive 24) packages/core/src/utils/errors.ts
  • Cognitive Complexity · shell-utils.isPowerShellMemberOrTypeCallBeforeParen (cognitive 24) packages/core/src/utils/shell-utils.ts
  • Cognitive Complexity · geminiChat.stripThoughts (cognitive 24) packages/core/src/core/geminiChat.ts
  • Cognitive Complexity · DiffRenderer.renderDiffLines.content (cognitive 22) packages/cli/src/ui/components/messages/DiffRenderer.tsx
  • Cognitive Complexity · ShellExecutionService.closeOrphanMasterFd (cognitive 22) packages/core/src/services/shellExecutionService.ts
  • Cognitive Complexity · readStdin.readStdin (cognitive 20) packages/cli/src/utils/readStdin.ts
  • Cognitive Complexity · paths.isTrustedSystemPath (cognitive 19) packages/core/src/utils/paths.ts
  • Cognitive Complexity · chatRecordingService.computeContentDigest (cognitive 19) packages/core/src/services/chatRecordingService.ts
  • Cognitive Complexity · shell-utils.splitShellCommandSegments (cognitive 18) packages/core/src/utils/shell-utils.ts
  • Cognitive Complexity · process-utils.getProcessTableWindows (cognitive 18) packages/core/src/ide/process-utils.ts
  • Cognitive Complexity · retry.isRetryableError (cognitive 18) packages/core/src/utils/retry.ts
  • Cognitive Complexity · settings-validation.buildPrimitiveSchema (cognitive 17) packages/cli/src/config/settings-validation.ts
  • Cognitive Complexity · ThemeManager.parseUserThemeEntries (cognitive 17) packages/cli/src/ui/themes/theme-manager.ts
  • Cognitive Complexity · useGeminiStream.useGeminiStream.processGeminiStreamEvents (cognitive 17) packages/cli/src/ui/hooks/useGeminiStream.ts
  • Cognitive Complexity · shell-utils.findPowerShellExprValueStart (cognitive 17) packages/core/src/utils/shell-utils.ts
  • Cognitive Complexity · geminiChat.isValidContent (cognitive 17) packages/core/src/core/geminiChat.ts
  • Cognitive Complexity · chatCompressionService.collapseOlderFunctionResponses (cognitive 17) packages/core/src/context/chatCompressionService.ts
  • Cognitive Complexity · usageAggregator.listJsonlRecordingFiles (cognitive 17) packages/core/src/services/usageAggregator.ts
  • Cognitive Complexity · MessageBus.publish (cognitive 17) packages/core/src/confirmation-bus/message-bus.ts
  • Cognitive Complexity · formatError.formatCliError (cognitive 17) packages/cli/src/utils/formatError.ts
  • Cognitive Complexity · ThemeManager.loadCustomThemes (cognitive 16) packages/cli/src/ui/themes/theme-manager.ts
  • God Classes · FunctionTooLong: HeatmapComponent.HeatmapComponent packages/cli/src/ui/components/HeatmapComponent.tsx
  • God Classes · MethodTooLong: GitService.setupShadowGitRepository packages/core/src/services/gitService.ts
  • God Classes · FunctionTooLong: errors.normalizeError packages/core/src/utils/errors.ts
  • God Classes · ClassTooLong: ThemeManager packages/cli/src/ui/themes/theme-manager.ts
  • God Classes · FunctionTooLong: github.downloadFile packages/cli/src/config/extensions/github.ts
  • God Classes · FileTooLong: themes/theme-manager.ts packages/cli/src/ui/themes/theme-manager.ts
  • God Classes · FunctionTooLong: chatCompressionService.collapseOlderFunctionResponses packages/core/src/context/chatCompressionService.ts
  • God Classes · MethodTooLong: WhisperModelManager.executeDownload packages/core/src/voice/whisperModelManager.ts
  • God Classes · TooManyMethods: ThemeManager packages/cli/src/ui/themes/theme-manager.ts
  • God Classes · FileTooLong: context/chatCompressionService.ts packages/core/src/context/chatCompressionService.ts
  • God Classes · ClassTooLong: ToolExecutor packages/core/src/scheduler/tool-executor.ts
  • God Classes · MethodTooLong: TerminalCapabilityManager.detectCapabilities REDACTED
  • God Classes · MethodTooLong: GeminiClient.generateContent packages/core/src/core/client.ts
  • God Classes · FunctionTooLong: chatCompressionService.truncateHistoryToBudget packages/core/src/context/chatCompressionService.ts
  • God Classes · FunctionTooLong: ExpandableText._ExpandableText packages/cli/src/ui/components/shared/ExpandableText.tsx

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: 1816 findings

These 1816 critical or serious findings were in the previous survey, on 23 October 2026, and are gone from this one. The first 100 are listed here.

  • Cyclomatic Complexity · patch-create-comment.main (cyclomatic 54) REDACTED
  • Cyclomatic Complexity · patch-trigger.main (cyclomatic 38) scripts/releasing/patch-trigger.js
  • Cyclomatic Complexity · telemetry_utils.ensureBinary (cyclomatic 32) scripts/telemetry_utils.js
  • Cyclomatic Complexity · patch-comment.main (cyclomatic 30) scripts/releasing/patch-comment.js
  • Cyclomatic Complexity · Orchestrator.run (cyclomatic 29) tools/caretaker-agent/cloudrun/pr-generator/workflow/orchestrator.py
  • Cyclomatic Complexity · DiffRenderer.renderDiffLines (cyclomatic 28) packages/cli/src/ui/components/messages/DiffRenderer.tsx
  • Cyclomatic Complexity · summary.calc_summary (cyclomatic 27) tools/caretaker-agent/evals/triage/helpers/summary.py
  • Cyclomatic Complexity · eval-validate.validateInventory (cyclomatic 26) scripts/utils/eval-validate.ts
  • Cyclomatic Complexity · eval-report.summarizeReports (cyclomatic 24) scripts/utils/eval-report.ts
  • Cyclomatic Complexity · trace.runInDevTraceSpan (cyclomatic 23) packages/core/src/telemetry/trace.ts
  • Cyclomatic Complexity · fileUtils.readSecureFileBuffer (cyclomatic 22) packages/core/src/utils/fileUtils.ts
  • Cyclomatic Complexity · local_telemetry.main (cyclomatic 22) scripts/local_telemetry.js
  • Cyclomatic Complexity · create-patch-pr.main (cyclomatic 22) scripts/releasing/create-patch-pr.js
  • Cyclomatic Complexity · sync_project_dry_run.run (cyclomatic 22) scripts/sync_project_dry_run.js
  • Cyclomatic Complexity · summary._write_markdown (cyclomatic 22) tools/caretaker-agent/evals/triage/helpers/summary.py
  • Cyclomatic Complexity · changed_prompt.main (cyclomatic 20) scripts/changed_prompt.js
  • Cyclomatic Complexity · cleanup-branches.main (cyclomatic 20) scripts/cleanup-branches.ts
  • Cyclomatic Complexity · eval-inventory.formatInventoryReport (cyclomatic 20) scripts/utils/eval-inventory.ts
  • Cyclomatic Complexity · get-release-version.detectRollbackAndGetBaseline (cyclomatic 18) scripts/get-release-version.js
  • Cyclomatic Complexity · AgentRunner.run_agent (cyclomatic 18) tools/caretaker-agent/cloudrun/pr-generator/workflow/agent_runner.py
  • Cyclomatic Complexity · eval-coverage.formatCoverageReport (cyclomatic 17) scripts/utils/eval-coverage.ts
  • Cyclomatic Complexity · telemetry_utils.manageTelemetrySettings (cyclomatic 17) scripts/telemetry_utils.js
  • Cyclomatic Complexity · main.main (cyclomatic 17) tools/caretaker-agent/cloudrun/triage-worker/main.py
  • Cognitive Complexity · patch-create-comment.main (cognitive 67) REDACTED
  • Cognitive Complexity · eval-report.summarizeReports (cognitive 63) scripts/utils/eval-report.ts
  • Cognitive Complexity · eval-validate.validateInventory (cognitive 58) scripts/utils/eval-validate.ts
  • Cognitive Complexity · patch-trigger.main (cognitive 56) scripts/releasing/patch-trigger.js
  • Cognitive Complexity · Orchestrator.run (cognitive 54) tools/caretaker-agent/cloudrun/pr-generator/workflow/orchestrator.py
  • Cognitive Complexity · telemetry_utils.ensureBinary (cognitive 45) scripts/telemetry_utils.js
  • Cognitive Complexity · trace.runInDevTraceSpan (cognitive 44) packages/core/src/telemetry/trace.ts
  • Cognitive Complexity · summary._write_markdown (cognitive 42) tools/caretaker-agent/evals/triage/helpers/summary.py
  • Cognitive Complexity · sync_project_dry_run.run (cognitive 39) scripts/sync_project_dry_run.js
  • Cognitive Complexity · cleanup-branches.main (cognitive 36) scripts/cleanup-branches.ts
  • Cognitive Complexity · summary.calc_summary (cognitive 36) tools/caretaker-agent/evals/triage/helpers/summary.py
  • Cognitive Complexity · changed_prompt.main (cognitive 35) scripts/changed_prompt.js
  • Cognitive Complexity · eval-coverage.formatCoverageReport (cognitive 35) scripts/utils/eval-coverage.ts
  • Cognitive Complexity · create-patch-pr.main (cognitive 34) scripts/releasing/create-patch-pr.js
  • Cognitive Complexity · DiffRenderer.renderDiffLines (cognitive 33) packages/cli/src/ui/components/messages/DiffRenderer.tsx
  • Cognitive Complexity · AgentRunner.run_agent (cognitive 31) tools/caretaker-agent/cloudrun/pr-generator/workflow/agent_runner.py
  • Cognitive Complexity · download-ripgrep-binaries.downloadBinary (cognitive 30) scripts/download-ripgrep-binaries.ts
  • Cognitive Complexity · eval-coverage.computeCoverage (cognitive 30) scripts/utils/eval-coverage.ts
  • Cognitive Complexity · telemetry_utils.manageTelemetrySettings (cognitive 30) scripts/telemetry_utils.js
  • Cognitive Complexity · eval-inventory.formatInventoryReport (cognitive 29) scripts/utils/eval-inventory.ts
  • Cognitive Complexity · get-release-version.detectRollbackAndGetBaseline (cognitive 29) scripts/get-release-version.js
  • Cognitive Complexity · aggregate_evals.generateMarkdown (cognitive 28) scripts/aggregate_evals.js
  • Cognitive Complexity · get_trustworthy_evals.main (cognitive 27) scripts/get_trustworthy_evals.js
  • Cognitive Complexity · local_telemetry.main (cognitive 27) scripts/local_telemetry.js
  • Cognitive Complexity · compare_evals.main (cognitive 26) scripts/compare_evals.js
  • Cognitive Complexity · patch-comment.main (cognitive 25) scripts/releasing/patch-comment.js
  • Cognitive Complexity · dataset_metrics._validate_spec_integrity (cognitive 24) tools/caretaker-agent/evals/triage/tools/dataset_metrics.py
  • Cognitive Complexity · lint.runSensitiveKeywordLinter (cognitive 23) scripts/lint.js
  • Cognitive Complexity · shell-utils.stripShellWrapper (cognitive 22) packages/core/src/utils/shell-utils.ts
  • Cognitive Complexity · main.main (cognitive 22) tools/caretaker-agent/cloudrun/triage-worker/main.py
  • Cognitive Complexity · lint.runGithubActionsPinningLinter (cognitive 21) scripts/lint.js
  • Cognitive Complexity · CommandExecutor.run (cognitive 21) tools/caretaker-agent/cloudrun/pr-generator/workflow/command_executor.py
  • Cognitive Complexity · eval-validate.getNewEvalFiles (cognitive 20) scripts/utils/eval-validate.ts
  • Cognitive Complexity · Orchestrator._submit_pull_request (cognitive 20) tools/caretaker-agent/cloudrun/pr-generator/workflow/orchestrator.py
  • Cognitive Complexity · aggregate_evals.getStats (cognitive 19) scripts/aggregate_evals.js
  • Cognitive Complexity · actions_spend.getWorkflowMinutes (cognitive 19) tools/gemini-cli-bot/metrics/scripts/actions_spend.ts
  • Cognitive Complexity · close_duplicate_issues.run (cognitive 18) scripts/close_duplicate_issues.js
  • Cognitive Complexity · eval_utils.getStatsFromReports (cognitive 18) scripts/eval_utils.js
  • Cognitive Complexity · autogen.formatDefaultValue (cognitive 18) scripts/utils/autogen.ts
  • Cognitive Complexity · tool-log-formatter.formatToolLogChain (cognitive 17) scripts/utils/tool-log-formatter.ts
  • Cognitive Complexity · DiffRenderer.DiffRenderer (cognitive 17) packages/cli/src/ui/components/messages/DiffRenderer.tsx
  • Cognitive Complexity · fileUtils.readSecureFileBuffer (cognitive 17) packages/core/src/utils/fileUtils.ts
  • Cognitive Complexity · generate-settings-doc.collectEntries::visit (cognitive 17) scripts/generate-settings-doc.ts
  • Cognitive Complexity · lint.runTSConfigLinter (cognitive 17) scripts/lint.js
  • Cognitive Complexity · run_eval_regression.main (cognitive 17) scripts/run_eval_regression.js
  • Cognitive Complexity · history-helper.getHistoricalAverage (cognitive 17) tools/gemini-cli-bot/metrics/history-helper.ts
  • Cognitive Complexity · index.processOutputLine (cognitive 17) tools/gemini-cli-bot/metrics/index.ts
  • Cognitive Complexity · db_interface._release_lock_tx (cognitive 17) tools/caretaker-agent/cloudrun/pr-generator/workflow/db/db_interface.py
  • Cognitive Complexity · build_binary.signFile (cognitive 16) REDACTED
  • Cognitive Complexity · eval-inventory.formatInventoryJson (cognitive 16) scripts/utils/eval-inventory.ts
  • Cognitive Complexity · eval-validate-cli.main (cognitive 16) scripts/eval-validate-cli.ts
  • Cognitive Complexity · generate-settings-doc.renderSections (cognitive 16) scripts/generate-settings-doc.ts
  • Cognitive Complexity · run_regression_check.processResults (cognitive 16) scripts/run_regression_check.js
  • God Classes · FunctionTooLong: patch-create-comment.main REDACTED
  • God Classes · FunctionTooLong: patch-trigger.main scripts/releasing/patch-trigger.js
  • God Classes · FunctionTooLong: create-patch-pr.main scripts/releasing/create-patch-pr.js
  • God Classes · FunctionTooLong: patch-comment.main scripts/releasing/patch-comment.js
  • God Classes · FunctionTooLong: local_telemetry.main scripts/local_telemetry.js
  • God Classes · FunctionTooLong: cleanup-branches.main scripts/cleanup-branches.ts
  • God Classes · FunctionTooLong: github_fetch.fetchJson packages/cli/src/config/extensions/github_fetch.ts
  • God Classes · FileTooLong: workflow/orchestrator.py tools/caretaker-agent/cloudrun/pr-generator/workflow/orchestrator.py
  • Code Coverage · Low coverage: evals/test-helper.ts evals/test-helper.ts
  • Code Coverage · Low coverage: integration-tests/test-mcp-server.ts integration-tests/test-mcp-server.ts
  • Code Coverage · Low coverage: packages/a2a-server/src/agent/executor.ts packages/a2a-server/src/agent/executor.ts
  • Code Coverage · Low coverage: packages/a2a-server/src/agent/task.ts packages/a2a-server/src/agent/task.ts
  • Code Coverage · Low coverage: packages/a2a-server/src/commands/command-registry.ts packages/a2a-server/src/commands/command-registry.ts
  • Code Coverage · Low coverage: packages/a2a-server/src/commands/extensions.ts packages/a2a-server/src/commands/extensions.ts
  • Code Coverage · Low coverage: packages/a2a-server/src/commands/init.ts packages/a2a-server/src/commands/init.ts
  • Code Coverage · Low coverage: packages/a2a-server/src/commands/memory.ts packages/a2a-server/src/commands/memory.ts
  • Code Coverage · Low coverage: packages/a2a-server/src/commands/restore.ts packages/a2a-server/src/commands/restore.ts
  • Code Coverage · Low coverage: packages/a2a-server/src/commands/types.ts packages/a2a-server/src/commands/types.ts
  • Code Coverage · Low coverage: packages/a2a-server/src/config/config.ts packages/a2a-server/src/config/config.ts
  • Code Coverage · Low coverage: packages/a2a-server/src/config/extension.ts packages/a2a-server/src/config/extension.ts
  • Code Coverage · Low coverage: packages/a2a-server/src/config/settings.ts packages/a2a-server/src/config/settings.ts
  • Code Coverage · Low coverage: REDACTED REDACTED
  • Code Coverage · Low coverage: packages/a2a-server/src/http/requestStorage.ts packages/a2a-server/src/http/requestStorage.ts
  • Code Coverage · Low coverage: packages/a2a-server/src/persistence/gcs.ts packages/a2a-server/src/persistence/gcs.ts
Rebuild cost: about €610,000 · Estimate
Cost to rebuild€200,000 to €1,000,000, for 3,354 to 10,642 hours of work, about 4.2 person-years for 2 to 8 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.7 at a score of 43. 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.
SizeLarge: 285,923 lines of product code
Comment linesThe estimate prices 285,895 lines. Comment lines count towards the size of 285,923 lines but aren't priced as work.
What it is notNot 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
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Raises the score by about 4 points · Medium effort · Keyboard semantics
2
Name the access rules — give each one a named predicate/policy object your guards consult, so the rule set can be reviewed and unit-tested independently of the call sites that enforce it.
Raises the score by about 3 points · Medium effort · Access Controls
3
Resolve the 1 No assertions (empty test) finding(s) in Test Quality — start with gemini.test.tsx.
Raises the score by about 1 point · Low effort · Test Quality

Diagnosis: what the measurements show together

Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.

Files that change often carry extra risk · Combined risk
One file is changed often and is hard to read, which makes it the likeliest place for a mistake. It also has under half its code tested, or was written almost entirely by one person, so a mistake there is less likely to be caught, or only one person knows the code well enough to avoid it. A change to this file therefore carries more risk than the overall score suggests.
Based on: Churn × Complexity Hotspots (68 files) · Code Coverage (142 files under half tested) · Bus Factor (0 files written almost entirely by one person) · The files: index.ts
What to do: Add tests to these files and have a second person review every change to them, starting with index.ts.
Where the investment is most exposed · Value at risk
This code would cost about €610,000 to build again, about 4.2 person-years of work. Its weakest lens is Accessibility, at 39 (Weak). Accessibility is about whether the interface is built so that everyone can use it, including people who can't see the screen or can't use a mouse. Because the weakest lens counts most in the score, work on Accessibility also moves the score most.
Based on: the rebuild estimate · the Accessibility grade · how much each lens counts
What to do: Start with the Accessibility actions in Top priorities.
If you do one thing first · First action
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href. Of all the actions in this report, it raises the score most for the work it takes: about 4 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 6.0 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 11% on every change. The history of the code shows how much it changes: about 94,233 lines over the last 90 days, which is about 382,167 lines a year. At that pace, the extra work comes to an estimated 47.8 to 286.7 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.

arch @google/gemini-cli (.) ) @google/gemini-cli (packages/cli) cli) @google/gemini-cli-core gemini-cli-core @google/gemini-cli (packages/cli)->@google/gemini-cli-core @google/gemini-cli-a2a-server gemini-cli-a2a-server @google/gemini-cli-a2a-server->@google/gemini-cli-core @google/gemini-cli-devtools gemini-cli-devtools @google/gemini-cli-sdk gemini-cli-sdk @google/gemini-cli-sdk->@google/gemini-cli-core @lvce-editor/ripgrep ripgrep egress-service egress-service gemini-cli-vscode-ide-companion gemini-cli-vscode-ide-companion ingestion-service ingestion-service

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.

815 modules, with 1336 dependencies between them. One loop runs through 65 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 775 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.
uses →1 cli.src.config.settingsSchema2 cli.src.ui.commands.types3 cli.src.ui.components.shared4 cli.src.ui.key.keyBindings5 core.src.agent.types6 core.src.code_assist.types7 core.src.policy.types8 cli.src.config.settings9 core.src.agents.types10 core.src.confirmation-bus.message-bus11 core.src.core.contentGenerator12 core.src.scheduler.types13 core.src.core.baseLlmClient14 core.src.telemetry.types15 core.src.tools.mcp-client16 core.src.tools.tools17 cli.src.ui.types18 core.src.context.pipeline.environment19 core.src.services.chatRecordingTypes20 cli.src.ui.contexts.UIStateContext21 core.src.core.geminiChat22 core.src.telemetry.uiTelemetry23 core.src.core.client24 core.src.telemetry25 core.src.config.agent-loop-context26 core.src.config.config27 a2a-server.src.commands.types28 cli.src.config.extension-manager29 cli.src.ui.components30 cli.src.ui.utils31 cli.src.utils32 core.src.routing.routingStrategy33 core.src.scheduler.scheduler34 core.src.services35 core.src.tools36 core.src.utils37 a2a-server.src.agent.task38 cli.src.commands.extensions39 cli.src.config40 cli.src.ui.hooks
1 cli.src.config.settingsSchema
2 cli.src.ui.commands.types
3 cli.src.ui.components.shared
4 cli.src.ui.key.keyBindings
5 core.src.agent.types
6 core.src.code_assist.types
7 core.src.policy.types
8 cli.src.config.settings4
9 core.src.agents.types1
10 core.src.confirmation-bus.message-bus1
11 core.src.core.contentGenerator2
12 core.src.scheduler.types2
13 core.src.core.baseLlmClient21
14 core.src.telemetry.types52151
15 core.src.tools.mcp-client11
16 core.src.tools.tools113
17 cli.src.ui.types1121
18 core.src.context.pipeline.environment1
19 core.src.services.chatRecordingTypes1
20 cli.src.ui.contexts.UIStateContext11111
21 core.src.core.geminiChat11
22 core.src.telemetry.uiTelemetry211
23 core.src.core.client11111
24 core.src.telemetry5611310
25 core.src.config.agent-loop-context111
26 core.src.config.config1331311121
27 a2a-server.src.commands.types11
28 cli.src.config.extension-manager213
29 cli.src.ui.components113
30 cli.src.ui.utils121121
31 cli.src.utils61311
32 core.src.routing.routingStrategy22
33 core.src.scheduler.scheduler12121
34 core.src.services1413
35 core.src.tools1437
36 core.src.utils112341127
37 a2a-server.src.agent.task121111
38 cli.src.commands.extensions11
39 cli.src.config1025131
40 cli.src.ui.hooks33836222131
Uses a module listed above itPart of a loopThe module itself
1 cli.src.config.settingsSchema2 cli.src.ui.commands.types3 cli.src.ui.components.shared4 cli.src.ui.key.keyBindings5 core.src.agent.types6 core.src.code_assist.types7 core.src.policy.types8 cli.src.config.settings9 core.src.agents.types10 core.src.confirmation-bus.message-bus11 core.src.core.contentGenerator12 core.src.scheduler.types13 core.src.core.baseLlmClient14 core.src.telemetry.types15 core.src.tools.mcp-client16 core.src.tools.tools17 cli.src.ui.types18 core.src.context.pipeline.environment19 core.src.services.chatRecordingTypes20 cli.src.ui.contexts.UIStateContext21 core.src.core.geminiChat22 core.src.telemetry.uiTelemetry23 core.src.core.client24 core.src.telemetry25 core.src.config.agent-loop-context26 core.src.config.config27 a2a-server.src.commands.types28 cli.src.config.extension-manager29 cli.src.ui.components30 cli.src.ui.utils31 cli.src.utils32 core.src.routing.routingStrategy33 core.src.scheduler.scheduler34 core.src.services35 core.src.tools36 core.src.utils37 a2a-server.src.agent.task38 cli.src.commands.extensions39 cli.src.config40 cli.src.ui.hookscli.src.config.settingsSchema1cli.src.ui.commands.types2cli.src.ui.components.shared3cli.src.ui.key.keyBindings4core.src.agent.types5core.src.code_assist.types6core.src.policy.types7cli.src.config.settings8core.src.agents.types9core.src.confirmation-bus.message-bus10core.src.core.contentGenerator11core.src.scheduler.types12core.src.core.baseLlmClient13core.src.telemetry.types14core.src.tools.mcp-client15core.src.tools.tools16cli.src.ui.types17core.src.context.pipeline.environment18core.src.services.chatRecordingTypes19cli.src.ui.contexts.UIStateContext20core.src.core.geminiChat21core.src.telemetry.uiTelemetry22core.src.core.client23core.src.telemetry24core.src.config.agent-loop-context25core.src.config.config26a2a-server.src.commands.types27cli.src.config.extension-manager28cli.src.ui.components29cli.src.ui.utils30cli.src.utils31core.src.routing.routingStrategy32core.src.scheduler.scheduler33core.src.services34core.src.tools35core.src.utils36a2a-server.src.agent.task37cli.src.commands.extensions38cli.src.config39cli.src.ui.hooks404112221521511111311211111111112111111156113101111331311121112131131211216131122121211413143711234112712111111102513133836222131+775 more modules (most-connected shown)

At a glance — Code Health · 55% · Adequate · gated by D1, D2, X5 ·

At a glance — Architecture · 66% · Adequate · gated by R9 ·

At a glance — Maturity · 76% · Strong ·

At a glance — Readiness · 44% · Adequate · gated by R5, R8, P7 ·

At a glance — Security · 40% · Weak · gated by D29, D31, C2 ·

At a glance — Accessibility · 39% · Weak · gated by AC4 ·

At a glance — Performance · 60% · Adequate ·

Security & Compliance — OWASP Top-10 mapping

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 categoryFindingsSeverity
A03:2025 — Software Supply Chain Failures119High / Critical
A05:2025 — Injection89High / Critical
A02:2025 — Security Misconfiguration31High / Critical

Roadmap

Top priorities: Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href; Name the access rules — give each one a named predicate/policy object your guards consult, so the rule set can be reviewed and unit-tested independently of the call sites that enforce it; Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.

Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.

Do thisHelpsEffortDimension
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.+3.6 ptsMediumKeyboard semantics
Name the access rules — give each one a named predicate/policy object your guards consult, so the rule set can be reviewed and unit-tested independently of the call sites that enforce it.+3.3 ptsMediumAccess Controls
Resolve the 1 No assertions (empty test) finding(s) in Test Quality — start with gemini.test.tsx.+1.4 ptsLowTest Quality
Resolve the 1 End-of-life runtime finding(s) in Platform End-of-Life — start with .nvmrc.+1.3 ptsLowPlatform End-of-Life
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.+2.2 ptsMediumPage structure
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.+2.0 ptsMediumForms & labels
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.+1.8 ptsMediumDependency Hygiene
Resolve the 54 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (35), REDACTED (19).+1.5 ptsMediumDependency Vulnerabilities

File quality

Per-file score 0–10 — a quality signature. Of 867 files carrying findings, judged against the Preview bar: 1% slop · 13% mixed · 86% near-clean.

FileScoreBandWorst signal
REDACTED0.0SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED0.3SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED0.5SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED0.6SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED1.3SlopIaC & Container Security: High IaC: REDACTED
REDACTED2.3SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED2.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED2.7SlopIaC & Container Security: High IaC: REDACTED
REDACTED3.0MixedDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED3.6MixedStatic Analysis (SAST): High: REDACTED
REDACTED3.7MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED

How the grades work

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 — 136

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 — 2094

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 — 1352

Recorded, with no effect on how the codebase functions. Present so the survey is complete, not because it needs doing.

Could not be resolved — 11

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 64 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 — 64 dimensions across the health lenses
D1D2D3D4D5D6D8D10D13D14D15D16D17D19D20D21D23D24D27D29D30D31D34D35D36D37D43D44AC2AC3AC4AC6AX10AX3AX5AX6AX8C2GD1M1M2M3M4P1P10P2P3P4P6P7PF3R1R10R11R2R3R4R5R6R7R8R9X24X5

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
  1. 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, 3555 of 3582 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.)
  2. Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
  3. 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.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Canine Code Analyzer duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivySecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3✓ deterministic

Every finding is locatable in findings.md. Run 01a1cd41-5b9f-7ec0-b372-a6d4b28496c6.

The exact command behind every deep-scan dimension — tool, version, invocation and retained raw output — is in Appendix B — Reproduction & audit trail.

Run transparency — what happened this run

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 — 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. 668 test file(s) failed while being loaded here, so none of their cases ran (typically a native addon or generated module the package's install scripts build, which the analyzer's scripts-off install does not run). The 686 production file(s) those files import that read under half covered are unmeasured in this run, not untested, so their figures are left out of the per-file rows and the 66.5% rather than published as low coverage. You can widen what we reach: optional: commit the lcov report of a run where those test files load, and their modules are read from it.
  • 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 15,706 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 16 test source file(s) (.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 reliability not included — the JavaScript/TypeScript suite (vitest via `npm ci --ignore-scripts` in the repository root (6201 tests); vitest via `npm ci --ignore-scripts` in packages/a2a-server/ (10 tests); vitest via `npm ci --ignore-scripts` in packages/cli/ (0 tests); vitest via `npm ci --ignore-scripts` in packages/core/ (5406 tests); vitest via `npm ci --ignore-scripts` in packages/sdk/ (0 tests); vitest via `npm ci --ignore-scripts` in packages/test-utils/ (0 tests); vitest via `npm ci --ignore-scripts` in packages/vscode-ide-companion/ (75 tests); jest via `npm ci --ignore-scripts` in third_party/get-ripgrep/; vitest via `npm ci --ignore-scripts` in tools/caretaker-agent/cloudrun/egress-service/ (15 tests); vitest via `npm ci --ignore-scripts` in tools/caretaker-agent/cloudrun/ingestion-service/ (19 tests)) did not finish re-running within its budget: too large to re-run within its budget.
  • D12 Dependency Hygiene — 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. This repository's 9 shipped Python distribution(s) across 3 manifest(s) WERE read; what went unanswered is the currency half, because it grades an EXACT pin against the newest release and every declaration here is a floor or a range — which installs the newest release it admits and so cannot be behind one. So pypi.org was never asked. This is a true statement about the repository, and the healthy one, NOT a gap on our side: no reader we could write would find a currency question here.
  • D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares REDACTED, but the licence verdict published here was taken over its Python distribution dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
  • D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. D21's deterministic naming 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. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
  • D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D23 Boundary Type-Coupling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind measured 0/40 valid on a seeded held-out sample of its rows on 98 C# repositories (docs/plans/deterministic-engine/adjudication/P5c-D23-units.md, "Version 1 ON MAIN"): the noise rows were dependencies on layer folders, shared cores and grouping folders read as contexts. By the pre-registered fallback (PREREGISTRATION v37) it publishes no row until version 4 passes its gate. The candidates are counted here, not reported as findings, and the score does not include them.
  • D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
  • D28 Secrets (history) — 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. `gitleaks` TIMED OUT after 215.2s against a 215.2s budget, so we killed its process tree. The budget is ours; the work may simply be larger than it allows. Nothing about this repository is asserted by the absence of a result; the budget is ours to raise, and raising it is our backlog item, not an action for this repository's owner.
  • D31 IaC & Container Security — 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. Checkov ran but its report could not be read (checkov produced no output — not a clean result). Every misconfiguration only checkov reports — most of its Terraform, CloudFormation, Bicep and Ansible policies — is absent from this card, so its absence here is not evidence those resources are configured correctly.
  • D31 IaC & Container Security — 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. REDACTED.dockerignore carries no `FROM` instruction, so it declares no build stage and every REDACTED rule this engine owns — the runtime-hardening, key-material, mutable-clone, no-op-shim, build-context, trust-anchor, install-guard, setuid and world-writable-path rules — is outside its own premise there and returned nothing. That silence is deliberate and correct: with no base image there is no image to reason about. It is reported here because it is NOT the same fact as a clean file, and coverage is stated as 9 of 10 Infrastructure-as-Code manifest(s) fully judged rather than as 100%. The vendor scanners (trivy, checkov) do read these files and their findings above stand; only this engine's own stage-keyed rules are absent. No owner action: a build file with no FROM is a legitimate include fragment.
  • D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `packages/cli/src/config/settings.ts`, `packages/cli/src/config/settingsSchema.ts`, `packages/cli/src/nonInteractiveCliAgentSession.ts`, `packages/cli/src/ui/hooks/useAgentStream.ts`, `packages/cli/src/ui/hooks/useAtCompletion.ts`, … (+11 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • 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 REDACTED (REDACTED). docker build failed (exit -1) — #5 extracting sha256:804d4d68057cbb26cbcde9a735148ebc6589911bad32cf9dbddb5b0ba878bf1f 1.0s done #5 extracting sha256:64cfb949317c9824fd081d55c59a7225bfe1f650c6395ba42d7ed0ccf51993d2 0.0s done #5 extracting sha256:3c02fd806613748139b8b8a14a69ae3518a1b0e863c57c35aada3b92ed87fb31 0.0s done #5 DONE 2.8s #6 [2/6] WORKDIR /app #6 DONE 0.0s #7 [3/6] COPY package*.json ./ #7 DONE 0.0s #8 [4/6] RUN npm ci; 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.
  • PF3 Async & latency hygiene — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 135 further occurrence(s) are not listed individually; the score already reflects all 175.
  • R10 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 631 further occurrence(s) are not listed individually; the score already reflects all 671.
  • R3 Large Files — 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. 120 further occurrence(s) are not listed individually; the score already reflects all 160.
  • R7 Dead Code — 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. 12 further occurrence(s) are not listed individually; the score already reflects all 52.
  • 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.
  • 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 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.
  • X29 Per-element action decided by a fixed element — 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: 42 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.
  • D8 Code Coverage: Coverage is measured by building and running the test suite inside our isolated image — the target repo is never modified, and nothing on your systems runs. So coverage exists only when the suite builds and runs within the inline time budget; one that needs external services, can't build, or exceeds the budget yields no coverage (D8 then degrades to not-measured, not a low score). Line coverage also says nothing about assertion quality.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • 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.
  • D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
  • D23 Boundary Type-Coupling: Boundary leakage is detected from type references across detected contexts — leaks that flow through primitives, serialization or shared infrastructure may not surface as a typed reference.
  • D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
  • D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
  • 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.
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • 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 REDACTED (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.
  • AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
  • AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
  • AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
  • AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
  • 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.
  • 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.

Dimensions

D1 · Cyclomatic Complexity2.0 / 10Critical✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 2.0 / 10 · rule-coverage 100% · ceiling Prevented

426 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was InputPrompt.InputPrompt at 354. A further 6 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 vim.useVim.executeCommand at 48 — they are counted neither in the figure above nor in this dimension's score. 1 file carries no cyclomatic complexity row at all for this reason — every one of its over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: packages/cli/src/ui/components/views/ExtensionsList.tsx (ExtensionsList.ExtensionsList at 18). 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.

InputPrompt.InputPrompt (cyclomatic 354)packages/cli/src/ui/components/InputPrompt.tsx:207
AppContainer.AppContainer (cyclomatic 316)packages/cli/src/ui/AppContainer.tsx:338
vim-buffer-actions.handleVimAction (cyclomatic 246)packages/cli/src/ui/components/shared/vim-buffer-actions.ts:164
text-buffer.textBufferReducerLogic (cyclomatic 182)packages/cli/src/ui/components/shared/text-buffer.ts:1787
sandbox.start_sandbox (cyclomatic 157)packages/cli/src/utils/sandbox.ts:120

+ 420 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 34 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with InputPrompt.InputPrompt (cyclomatic 354), AppContainer.AppContainer (cyclomatic 316), vim-buffer-actions.handleVimAction (cyclomatic 246). — 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 34 together lifts Cyclomatic Complexity from 2.0 to about 3.8/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.

Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.

D2 · Cognitive Complexity2.0 / 10Critical✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 2.0 / 10 · rule-coverage 100% · ceiling Prevented

573 method(s) exceeded the cognitive complexity threshold of 15; the worst was InputPrompt.InputPrompt at 535.

settings.migrateDeprecatedSettings::processScope (cognitive 63) · ×2packages/cli/src/config/settings.ts:1241
ShellExecutionService.childProcessFallback::handleOutput (cognitive 29) · ×2packages/core/src/services/shellExecutionService.ts:805
InputPrompt.InputPrompt (cognitive 535)packages/cli/src/ui/components/InputPrompt.tsx:207
vim-buffer-actions.handleVimAction (cognitive 394)packages/cli/src/ui/components/shared/vim-buffer-actions.ts:164
AppContainer.AppContainer (cognitive 310)packages/cli/src/ui/AppContainer.tsx:338

+ 565 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 216 bodies over 30 down to 30 or less in Cognitive Complexity — start with InputPrompt.InputPrompt (cognitive 535), vim-buffer-actions.handleVimAction (cognitive 394), AppContainer.AppContainer (cognitive 310). — 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 216 together lifts Cognitive Complexity from 2.0 to about 5.6/10, projected with the scoring formula itself and assuming each lands exactly at 30; a cleaner split scores higher.

Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.

D3 · God Classes6.8 / 10Adequate✓ 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.

Maturity: Documented → Verified → Prevented · effective 6.8 / 10 · rule-coverage 100% · ceiling Prevented

318 god class(es) detected.

FunctionTooLong: useGeminiStream.useGeminiStream · ×150packages/cli/src/ui/hooks/useGeminiStream.ts:230
FileTooLong: config/settingsSchema.ts · ×66packages/cli/src/config/settingsSchema.ts
MethodTooLong: ShellToolInvocation.execute · ×60packages/core/src/tools/shell.ts:635
ClassTooLong: AppContainer · ×35packages/cli/src/ui/AppContainer.tsx:1
TooManyMethods: Config · ×7packages/core/src/config/config.ts:763

What to do

  1. Resolve the 150 FunctionTooLong finding(s) in God Classes — start with App.tsx (6), useGeminiStream.ts (5), config.ts (5). — One of this dimension's main actionable groups (150 warning-level).
  2. Resolve the 66 FileTooLong finding(s) in God Classes — start with config.ts (3), settings.ts (2), settingsSchema.ts. — One of this dimension's main actionable groups (66 warning-level).
  3. Resolve the 60 MethodTooLong finding(s) in God Classes — start with client.ts (4), shellExecutionService.ts (3), acpSession.ts (3). — One of this dimension's main actionable groups (60 warning-level).

Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.

D4 · Code Duplication10.0 / 10Stronggated by 2 serious findings✓ Tool-verified

What it measures: Copy-pasted code that should be shared instead.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

1 duplicated block group(s) detected. One further row reports members as variants of one another; it aggregates block groups already counted above and is not itself counted. 2 of the 2 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. Measured on part of this repository only: .ts, .tsx (99% of production source) was not exposed to THIS dimension's token comparison and is not in this count; duplication there is measured by R10 Code Duplication, the frontend lens's card running the same clone algorithm over the JS/TS token stream.

Edited copy of a member (58 corresponding lines)tools/caretaker-agent/cloudrun/pr-generator/workflow/db/db_interface.py:184
Duplicated block (13 lines × 2)tools/caretaker-agent/cloudrun/triage-worker/utils/egress.py:47

What to do

  1. Resolve the 1 Edited copy of a member (58 corresponding lines) finding(s) in Code Duplication — start with db_interface.py. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 Duplicated block (13 lines × 2) finding(s) in Code Duplication — start with egress.py. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.

D5 · Coupling9.2 / 10Stronggated by 1 serious finding✓ 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.

Maturity: Documented → Verified → Prevented · effective 9.2 / 10 · rule-coverage 100% · ceiling Prevented

10 production modules (npm), 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, with abstractness counted on 9 of the 10 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).

Off the main sequence: @google/gemini-cli-core

What to do

  1. 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.

D6 · Cohesion (LCOM4)10.0 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 239 classes have LCOM4 above 3.

✓ On the Gold path — maintain.

Detailed fixes: d6_recommendation.md.

D8 · Code Coverage9.6 / 10Stronggated by 158 serious findings✓ Tool-verified

What it measures: How much of the code is actually exercised by tests.

Method: Coverage from coverlet runs or committed reports (Cobertura/OpenCover/lcov), computed per-file with structured exclusions for generated, trivial, and glue code. When the suite can't be built/run in-image AND no report is committed, coverage is reported NOT-MEASURED (excluded from the score) with the precondition to make it measurable — never a LoC-ratio proxy folded in as if measured. Deterministic.

Maturity: Documented → Verified → Prevented · effective 9.6 / 10 · rule-coverage 100% · ceiling Verified

Line coverage 66.5% — 158 file(s) below 50%. Measured from the JavaScript/TypeScript suite (vitest + @vitest/coverage-v8 via `npm ci --ignore-scripts` in the repository root; vitest + @vitest/coverage-v8 via `npm ci --ignore-scripts` in packages/a2a-server/; vitest in packages/cli/: not run; vitest + @vitest/coverage-v8 via `npm ci --ignore-scripts` in packages/core/; vitest in packages/sdk/: not run; vitest in packages/test-utils/: not run; vitest + @vitest/coverage-v8 via `npm ci --ignore-scripts` in packages/vscode-ide-companion/; jest in third_party/get-ripgrep/: not run; vitest + @vitest/coverage-v8 via `npm ci --ignore-scripts` in tools/caretaker-agent/cloudrun/egress-service/; vitest + @vitest/coverage-v8 via `npm ci --ignore-scripts` in tools/caretaker-agent/cloudrun/ingestion-service/).

Low coverage: esbuild.config.js · ×158esbuild.config.js:1

What to do

  1. Resolve the 158 Low coverage finding(s) in Code Coverage — start with index.ts (11), globalSetup.ts (3), server.ts (3). — One of this dimension's main actionable groups (158 warning-level).

Detailed fixes: d8_recommendation.md · top locations in Appendix A, every location in findings.md.

D10 · Test Quality9.9 / 10Adequategated by 1 critical 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.

Maturity: Documented → Verified → Prevented · effective 9.9 / 10 · rule-coverage 100% · ceiling Prevented

43 skipped (21 with a documented reason), 67 zero-assertion, 9 synchronised by a fixed sleep, no mocking-framework packages referenced (hand-written doubles or no mocking) across 15706 tests. Measured on the JavaScript/TypeScript suite only — at least 16 test source file(s) (.py) went unread, so its test quality is unmeasured and is not in these counts.

No assertions (empty test): should set window title when hideWindowTitle is falsepackages/cli/src/gemini.test.tsx:392
No assertions: cold-startup-time: startup completes within baseline · ×66perf-tests/perf-usage.test.ts:49
Skipped test: returns secure=false if ancestor directory of normalized path is insecure · ×22packages/core/src/utils/security.test.ts:846
Fixed-sleep synchronisation: should include newly created directory when watcher is enabled · ×9packages/core/src/utils/filesearch/fileSearch.test.ts:154
Mock-dominated test: executes main logic · ×687sea/sea-launch.test.js:83

+ 1 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 1 No assertions (empty test) finding(s) in Test Quality — start with gemini.test.tsx. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 66 No assertions finding(s) in Test Quality — start with SettingsDialog.test.tsx (14), perf-usage.test.ts (10), memory-usage.test.ts (7). — One of this dimension's main actionable groups (66 warning-level).
  3. Resolve the 22 Skipped test finding(s) in Test Quality — start with run_shell_command.test.ts (6), security.test.ts (3), replace.test.ts (3). — One of this dimension's main actionable groups (22 warning-level).

Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.

D13 · Secret Scanning10.0 / 10Exemplary○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

Secret scan ran and found no leaked secrets. 2 detection(s) were excluded as holding no minted credential in material that runs: a name, reference or comparison rather than a value, a readable phrase or pattern, a value that declares itself fake, or development, test, example, mock or demo material.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

D14 · License Compliance10.0 / 10Exemplary○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 61 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 9 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (52 reached that way). Requirements it states ONLY under an extra, a PEP 735 dependency group, a Poetry dev group or a dev-named requirements file are excluded: pip does not install any of them for a consumer. ★ This repository commits no dependency lockfile that this pass reads, so each licence is the one PyPI publishes for the distribution's CURRENT release rather than for a pinned version. 1 of them publish no licence on PyPI this pass can read; that is missing data, not a violation, and none of them is charged. ★ COVERAGE OF THIS VERDICT: it grades this repository's Python distribution dependencies and nothing else. The repository also declares REDACTED, and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots8.7 / 10Strong✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 8.7 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: packages/cli/src/ui/AppContainer.tsx (13×316=4108); packages/cli/src/ui/components/InputPrompt.tsx (5×354=1770); packages/core/src/services/shellExecutionService.ts (13×79=1027) Repeated repair below the complexity floor: packages/cli/src/config/settingsSchema.ts (4 of 6 changes were fixes); packages/core/src/core/baseLlmClient.ts (4 of 4 changes were fixes); packages/cli/src/ui/utils/textUtils.ts (4 of 4 changes were fixes)

Hotspot: packages/cli/src/ui/AppContainer.tsx · ×64packages/cli/src/ui/AppContainer.tsx:338
Repeated repair: packages/cli/src/config/settingsSchema.ts · ×6packages/cli/src/config/settingsSchema.ts:61

What to do

  1. Resolve the 64 Hotspot finding(s) in Churn × Complexity Hotspots — start with config.ts (3), AppContainer.tsx, InputPrompt.tsx. — One of this dimension's main actionable groups (64 warning-level).
  2. Resolve the 6 Repeated repair finding(s) in Churn × Complexity Hotspots — start with settingsSchema.ts, baseLlmClient.ts, textUtils.ts. — One of this dimension's main actionable groups (6 warning-level).

Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.

D16 · Bus Factor9.2 / 10Exemplary✓ 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.

Maturity: Documented → Verified → Prevented · effective 9.2 / 10 · rule-coverage 100% · ceiling Documented

61 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is packages/cli/src/ui/components/InboxDialog.tsx. Counted over 788 of the 1203 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 · ×9
Further sole-owners (lower concentration)

✓ On the Gold path — maintain.

Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.

D17 · Explicit Debt10.0 / 10Stronggated by 70 serious findings✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

70 deducted task-comment markers across 278048 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.

TodoComment · ×68tools/caretaker-agent/cloudrun/pr-generator/workflow/orchestrator.py:202
HackComment · ×2packages/vscode-ide-companion/src/integration-tests/run-test.ts:25

What to do

  1. Resolve the 68 TodoComment finding(s) in Explicit Debt — start with types.ts (5), config.ts (4), useAgentStream.ts (3). — One of this dimension's main actionable groups (68 warning-level).
  2. Resolve the 2 HackComment finding(s) in Explicit Debt — start with run-test.ts, config.ts. — One of this dimension's main actionable groups (2 warning-level).

Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.

D19 · Documentation Quality7.5 / 10Strong✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 7.5 / 10 · rule-coverage 100% · ceiling Documented

1 of 2 documentation facets pass in full; short on: F2 example. 101 document(s) read across 10 unit(s).

Documentation: no build, run or usage example · ×2packages/a2a-server/README.md:1

What to do

  1. Resolve the 2 Documentation finding(s) in Documentation Quality — start with README.md (2). — One of this dimension's main actionable groups (2 recommendation-level).

Detailed fixes: d19_recommendation.md · top locations in Appendix A, every location in findings.md.

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.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

No architecture decision records were found.

No ADRs found

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.

D21 · Naming Consistency6.0 / 10Adequate✓ Tool-verified

What it measures: Whether names — types, methods, variables — are clear and consistent.

Method: Seven vocabulary-free rules (N1-N7) mine each naming convention from the repository and flag a name that breaks a convention its structural peers in the same unit follow; production C# and TypeScript, each its own population. Deterministic, no model, no sample. Advisory.

Maturity: Documented → Verified → Prevented · effective 6.0 / 10 · rule-coverage 100% · ceiling Verified

3 naming inconsistencies among 74 declarations measured against a convention their peers follow.

`{ extensionManager, onClose, extensionName, settingKey, scope = ExtensionSettingScope.USER, configureAll, loggerAdapter, }` spells `USE` where 23 names in the project spell it `Use`packages/cli/src/ui/components/ConfigExtensionDialog.tsx:56
`currentIDE` spells `IDE` where 34 names in the project spell it `Ide`packages/cli/src/ui/contexts/UIStateContext.tsx:184
`GeminiCLIExtension` spells `CLI` where 14 names in the project spell it `Cli`packages/core/src/config/config.ts:405

What to do

  1. Resolve the 1 `{ extensionManager, onClose, extensionName, settingKey, scope… finding(s) in Naming Consistency — start with ConfigExtensionDialog.tsx. — One of this dimension's main actionable groups (1 recommendation-level).
  2. Resolve the 1 `currentIDE` spells `IDE` where 34 names in the project spell it `Ide` finding(s) in Naming Consistency — start with UIStateContext.tsx. — One of this dimension's main actionable groups (1 recommendation-level).
  3. Resolve the 1 `GeminiCLIExtension` spells `CLI` where 14 names in the project spell it… finding(s) in Naming Consistency — start with config.ts. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d21_recommendation.md · top locations in Appendix A, every location in findings.md.

D23 · Boundary Type-Coupling10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether domain types (IDs, enums, value objects) leak across bounded-context boundaries.

Method: Cross-context domain-type leakage via Roslyn structural classification (strongly-typed IDs / value objects) over every public surface. Exhaustive, deterministic, type-level aggregate-boundary check.

Coverage: Bounded contexts derived from NAMESPACE prefix (or graph-inferred where available); cross-boundary domain-type leakage then checked exhaustively over every public member of every type.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

63 domain type(s) cross context boundaries across 7 contexts; they are measured and withheld (not published, not scored). Contexts: a2a-server, cli, core, devtools, sdk, test-utils, vscode-ide-companion.

✓ On the Gold path — maintain.

Detailed fixes: d23_recommendation.md.

D24 · Comment Value8.1 7.8 / 10Strong✓ Tool-verified

What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).

Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.

Maturity: Documented → Verified → Prevented · effective 7.8 / 10 · rule-coverage 97% · ceiling Documented

283 of 14493 judged comments only repeat the code they sit on (2.0 %). 510 comment(s) in another language or script were not judged.

redundant comment · ×224evals/ask_user.eval.ts:88
doc comments repeat the names · ×4REDACTED:142

What to do

  1. Resolve the 224 redundant comment finding(s) in Comment Value — start with config.test.ts (8), InputPrompt.test.tsx (4), vim.test.tsx (4). — One of this dimension's main actionable groups (224 recommendation-level).

Detailed fixes: d24_recommendation.md · top locations in Appendix A, every location in findings.md.

D27 · Navigability9.7 / 10Exemplary✓ Tool-verified

What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.

Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.

Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.

Maturity: Documented → Verified → Prevented · effective 9.7 / 10 · rule-coverage 100% · ceiling Documented

20 % of calls cross a namespace and 0 % go through an interface, but 67 % of collaborators are co-located — so following a call takes several hops. Baseline: small — navigation cost is tolerated.

Pass-through layer · ×3packages/core/src/agent/agent-session.ts:18

✓ On the Gold path — maintain.

Detailed fixes: d27_recommendation.md · top locations in Appendix A, every location in findings.md.

D29 · Static Analysis (SAST)0.0 / 10Critical✓ Tool-verified

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).

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

90 finding(s): 0 critical, 13 high, 76 medium, 1 low. semgrep hit a parse error in 34 file(s) — `.github/scripts/pr-triage.sh` (line 25, line 26), `packages/cli/src/config/config.test.ts`, `packages/cli/src/config/settings.ts` (line 1548, line 1565, line 1618), `packages/cli/src/config/settingsSchema.ts` (line 3046), `packages/cli/src/nonInteractiveCliAgentSession.test.ts`, … (+29 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 16 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 13 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (4 issue-level).
  2. Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
  3. 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.

D30 · Dependency Vulnerabilities0.0 / 10Critical✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

104 finding(s): 20 critical, 54 high, 26 medium, 4 low.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 1 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 54 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (35), REDACTED (19). — One of this dimension's main actionable groups (54 issue-level).
  2. Resolve the 25 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (18), REDACTED (7). — One of this dimension's main actionable groups (25 warning-level).
  3. Resolve the 20 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (12), REDACTED (8). — One of this dimension's main actionable groups (20 issue-level).

Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.

D31 · IaC & Container Security3.9 3.5 / 10Weak✓ Tool-verified

What it measures: Whether Dockerfiles / Terraform / Kubernetes config follow security best practices.

Method: IaC/container misconfiguration scan via trivy config (REDACTED/Terraform/K8s/Helm/CloudFormation); severity rules to 0-10 moderate normalizer. NotApplicable without manifests. Exhaustive, deterministic.

Maturity: Documented → Verified → Prevented · effective 3.5 / 10 · rule-coverage 90% · ceiling Documented

31 finding(s): 0 critical, 14 high, 14 medium, 3 low.

REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 14 High IaC finding(s) in IaC & Container Security — start with REDACTED.gemini-code-builder (6), REDACTED (6), REDACTED.development. — One of this dimension's main actionable groups (14 issue-level).
  2. Resolve the 14 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (10), REDACTED.development (2), REDACTED.gemini-code-builder (2). — One of this dimension's main actionable groups (14 warning-level).
  3. Resolve the 3 Low IaC finding(s) in IaC & Container Security — start with REDACTED (2), REDACTED. — One of this dimension's main actionable groups (3 recommendation-level).

Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.

D34 · Knowledge Freshness6.0 / 10Adequate✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 6.0 / 10 · rule-coverage 100% · ceiling Documented

312 of 788 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is packages/cli/src/ui/components/shared/vim-buffer-actions.ts. Counted over 788 of the 1203 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledge · ×5packages/cli/src/ui/components/shared/vim-buffer-actions.ts:1
Orphaned file · ×307packages/core/src/hooks/types.ts:1
Further orphaned files (smaller)

What to do

  1. Resolve the 307 Orphaned file finding(s) in Knowledge Freshness — start with types.ts (3), trackerTools.ts (2), integrity.ts (2). — One of this dimension's main actionable groups (307 recommendation-level).
  2. Resolve the 5 Orphaned knowledge finding(s) in Knowledge Freshness — start with vim-buffer-actions.ts, TriageDuplicates.tsx, VirtualizedList.tsx. — One of this dimension's main actionable groups (5 issue-level).
  3. Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.

D35 · Change Coupling9.6 / 10Stronggated by 21 serious findings✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 9.6 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: default-legacy.ts↔gemini-3.ts 93%; AboutBox.tsx↔types.ts 80%; AppContainer.tsx↔DialogManager.tsx 78%

Change coupling: default-legacy.ts ↔ gemini-3.ts · ×20packages/core/src/tools/definitions/model-family-sets/default-legacy.ts:1
Change-coupling hub: AppContainer.tsx → Composer.tsx, DialogManager.tsx, DefaultAppLayout.tsx, nonInteractiveUi.tspackages/cli/src/ui/AppContainer.tsx

What to do

  1. Resolve the 20 Change coupling finding(s) in Change Coupling — start with event-metadata-key.ts (2), config.ts (2), default-legacy.ts. — One of this dimension's main actionable groups (20 warning-level).
  2. Resolve the 1 Change-coupling hub finding(s) in Change Coupling — start with AppContainer.tsx. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.

D36 · Supply-chain Provenance & Signing5.0 / 10Adequate✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 5.0 / 10 · rule-coverage 100% · ceiling Documented

2/4 supply-chain integrity signals present (provenance, signing, SBOM, pinned actions).

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 2 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 6 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (6 warning-level).
  2. Resolve the 3 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (3 warning-level).
  3. Resolve the 2 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED (2). — One of this dimension's main actionable groups (2 warning-level).

Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.

D37 · Vulnerability-disclosure Policy10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.

Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

A vulnerability-disclosure policy (SECURITY.md) is published with a reporting contact.

✓ On the Gold path — maintain.

Detailed fixes: d37_recommendation.md.

D43 · Malicious Dependencies10.0 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No dependency in any ecosystem this repository declares is published as malicious.

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

D44 · Platform End-of-Life6.0 / 10Adequate✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 6.0 / 10 · rule-coverage 100% · ceiling Documented

1 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 15 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.

End-of-life runtime: Node.js 20.nvmrc:1

What to do

  1. Resolve the 1 End-of-life runtime finding(s) in Platform End-of-Life — start with .nvmrc. — 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.

Frontend & cross-cutting dimensions

R = React/JS · M = Maturity · P = Readiness.

AC2 · Forms & labels5.4 / 10Adequate✓ Tool-verified

Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.

Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. — packages/devtools/client/src/App.tsx:406
  • This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label. — packages/devtools/client/src/App.tsx:1047

What to do

  • Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
AC3 · Page structure4.8 / 10Adequate✓ Tool-verified

Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.

Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • No <main> (or role="main") means no "skip to content" target and a weaker landmark map. This document's body is only the mount point <div id="root">, so there is no content here to wrap — render the <main> from the component mounted into it. — packages/devtools/client/index.html:2

What to do

  • Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
AC4 · Keyboard semantics1.0 / 10Critical✓ Tool-verified

Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.

Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".

  • A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}. (×8) — packages/devtools/client/src/App.tsx:584, packages/devtools/client/src/App.tsx:706, packages/devtools/client/src/App.tsx:953, …

What to do

  • Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
AC6 · Visual & motion safety7.0 / 10Strong✓ Tool-verified

Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.

Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.

Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • <select> takes keyboard focus, and outline:none/0 in its inline style removes the focus ring with no chance of a :focus replacement (an inline style outranks every stylesheet rule). Keep a visible focus indicator. — packages/devtools/client/src/App.tsx:406
  • <div> moves — its inline style sets `animation: fadeInOut 5s ease forwards` — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:. — packages/devtools/client/src/App.tsx:539
  • <div> takes keyboard focus, and outline:none/0 in its inline style removes the focus ring with no chance of a :focus replacement (an inline style outranks every stylesheet rule). Keep a visible focus indicator. — packages/devtools/client/src/App.tsx:1904

What to do

  • Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
AX10 · Code composition9.2 / 10Exemplary✓ Tool-verified

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.

What to do

  • The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

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.

AX5 · Architecture & structure10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether the codebase has a recognisable, scale-appropriate structure (a named architectural style, or modular enough for its size) rather than being an ad-hoc ball of mud.

Method: Roslyn plus csproj analysis: architecture style detection (DDD, clean, vertical-slice, CQRS) and structure fitness for repo size. Deterministic.

AX6 · Interface segregation9.9 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').

Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.

  • `TextBuffer` declares 84 required operations: `setText`, `insert`, `newline`, `backspace`, `del`, `move`, `undo`, `redo`, `replaceRange`, `deleteWordLeft`, `deleteWordRight`, `killLineRight`, `killLineLeft`, `handleInput`, `openInExternalEditor`, `replaceRangeByOffset`, `getOffset`, `moveToOffset`, `moveToVisualPosition`, `getLogicalPositionFromVisual`, `getExpandedPasteAtLine`, `togglePasteExpansion`, `vimDeleteWordForward`, `vimDeleteWordBackward`, `vimDeleteWordEnd`, `vimDeleteBigWordForward`, `vimDeleteBigWordBackward`, `vimDeleteBigWordEnd`, `vimChangeWordForward`, `vimChangeWordBackward`, `vimChangeWordEnd`, `vimChangeBigWordForward`, `vimChangeBigWordBackward`, `vimChangeBigWordEnd`, `vimDeleteLine`, `vimChangeLine`, `vimDeleteToEndOfLine`, `vimDeleteToStartOfLine`, `vimChangeToEndOfLine`, `vimDeleteToFirstNonWhitespace`, and 44 more. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — packages/cli/src/ui/components/shared/text-buffer.ts:3913
  • `UIActions` declares 61 required operations: `handleThemeSelect`, `closeThemeDialog`, `handleThemeHighlight`, `handleAuthSelect`, `setAuthState`, `onAuthError`, `handleEditorSelect`, `exitEditorDialog`, `exitPrivacyNotice`, `closeSettingsDialog`, `closeModelDialog`, `openVoiceModelDialog`, `closeVoiceModelDialog`, `openAgentConfigDialog`, `closeAgentConfigDialog`, `openPermissionsDialog`, `closePermissionsDialog`, `setShellModeActive`, `vimHandleInput`, `handleIdePromptComplete`, `handleFolderTrustSelect`, `setIsPolicyUpdateDialogOpen`, `setConstrainHeight`, `onEscapePromptChange`, `refreshStatic`, `handleFinalSubmit`, `handleClearScreen`, `handleProQuotaChoice`, `handleValidationChoice`, `handleOverageMenuChoice`, `handleEmptyWalletChoice`, `openSessionBrowser`, `closeSessionBrowser`, `handleResumeSession`, `handleDeleteSession`, `setQueueErrorMessage`, `addMessage`, `popAllMessages`, `handleApiKeySubmit`, `handleApiKeyCancel`, and 21 more. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — packages/cli/src/ui/contexts/UIActionsContext.tsx:23

What to do

  • Split fat interfaces into focused role-interfaces so clients depend only on what they use.
AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.

Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.

C2 · Access Controls3.3 / 10Weak✓ Tool-verified

Other · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.

Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.

  • Authorization IS enforced here (by imperative guard methods that throw on violation) — this is NOT a claim that the code is unprotected. What's missing is a NAMED rule set: the guards encode the access rules inline, so the rules can't be listed, reviewed or tested apart from the call sites that apply them. Recommendation, not a defect.
  • Only 2 imperative guard call site(s) — too few to demonstrate default-deny across handlers.

What to do

  • Name the access rules — give each one a named predicate/policy object your guards consult, so the rule set can be reviewed and unit-tested independently of the call sites that enforce it.
  • Enforce authorization at every handler — call the guard method (throw-on-violation) from each one, or adopt [Authorize] so protected-by-default is demonstrable.
GD1 · Unfinished & placeholder code10.0 / 10Exemplary○ Nothing flagged

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.

M1 · Documentation (README)8.8 / 10Exemplary✓ Tool-verified

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.

What to do

  • Describe the projects a newcomer cannot place from the root README: 6 of 10 have no README of their own, in their folder or in their family's project (`packages/cli`, `packages/core`, `packages/devtools`, `packages/test-utils`, `tools/caretaker-agent/cloudrun/egress-service` and 1 more).
M2 · Architecture documentation5.0 / 10Adequate✓ Tool-verified

Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.

Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.

  • No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.

What to do

  • Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

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.

M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

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.

P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether an automated pipeline builds and tests every change.

Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.

P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.

Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.

P2 · Observability8.5 / 10Exemplary✓ Tool-verified

Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.

Method: Filesystem/Roslyn scan: structured-logging frameworks (Serilog, NLog), OpenTelemetry, and health-check endpoint patterns. Exhaustive, deterministic.

  • Only 3/6 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `packages/devtools`, `packages/vscode-ide-companion`.
  • `packages/core/src/voice/audioRecorder.ts` reports through `console.*` at line 85 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/core/src/voice/audioRecorder.ts:85
  • `packages/core/src/utils/debugLogger.ts` reports through `console.*` at line 35 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/core/src/utils/debugLogger.ts:35
  • `packages/core/src/utils/debugLogger.ts` reports through `console.*` at line 50 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/core/src/utils/debugLogger.ts:50
  • `packages/core/src/utils/debugLogger.ts` reports through `console.*` at line 55 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/core/src/utils/debugLogger.ts:55
  • `packages/core/src/utils/debugLogger.ts` reports through `console.*` at line 60 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/core/src/utils/debugLogger.ts:60
  • `packages/core/src/utils/debugLogger.ts` reports through `console.*` at line 65 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/core/src/utils/debugLogger.ts:65
  • `packages/core/src/utils/editCorrector.ts` reports through `console.*` at line 95 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/core/src/utils/editCorrector.ts:95
  • `packages/core/src/core/geminiChat.ts` reports through `console.*` at line 542 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/core/src/core/geminiChat.ts:542

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
  • Route service-code `console.*` output through the module's structured logger (with named fields), so delivery outcomes and failures reach the log pipeline with a level.
P3 · Security & performance tooling7.0 / 10Strong✓ Tool-verified

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.

  • `.github/dependabot.yml` schedules updates, but no `package-ecosystem` entry covers `pip`, 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. — .github/dependabot.yml:2

What to do

  • Dependabot is configured but does not watch `pip` — add that `package-ecosystem` entry to .github/dependabot.yml 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.
P4 · Deployment & Rollback10.0 / 10Exemplary✓ Tool-verified

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.

P6 · Release Hygiene10.0 / 10Exemplary✓ Tool-verified

Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.

Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.

P7 · Outbound HTTP resilience3.0 / 10Weak✓ Tool-verified

Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.

Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.

  • `fetch(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×9) — packages/core/src/code_assist/oauth2.ts:795, packages/core/src/mcp/oauth-provider.ts:133, packages/core/src/mcp/oauth-provider.ts:336, …

What to do

  • Bound every outbound call: pass `signal: AbortSignal.timeout(ms)` to `fetch`, set `timeout` on the axios instance (`axios.create({ timeout })`), and add retries with back-off (`axios-retry`, `p-retry`) and a breaker (`opossum`, `cockatiel`) around dependencies that fail.
PF3 · Async & latency hygiene6.0 / 10Adequate✓ Tool-verified

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.

  • `fs.rmSync` in `cleanup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — evals/component-test-helper.ts:112, evals/component-test-helper.ts:113
  • `fs.realpathSync` in `callback to withEvalRetries` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — evals/test-helper.ts:133, evals/test-helper.ts:140
  • `fs.mkdirSync` in `callback to withEvalRetries` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — evals/test-helper.ts:136
  • `fs.writeFileSync` in `callback to withEvalRetries` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — evals/test-helper.ts:151
  • `fs.realpathSync` in `prepareWorkspace` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — evals/test-helper.ts:295
  • `fs.mkdirSync` in `prepareWorkspace` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — evals/test-helper.ts:306, evals/test-helper.ts:336
  • `fs.writeFileSync` in `prepareWorkspace` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — evals/test-helper.ts:307, evals/test-helper.ts:337
  • `execSync` in `prepareWorkspace` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×8) — evals/test-helper.ts:341, evals/test-helper.ts:342, evals/test-helper.ts:343, …
  • `fs.writeFileSync` in `handleSubmitPromptResult` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/a2a-server/src/commands/init.ts:83
  • `fs.existsSync` in `execute` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — packages/a2a-server/src/commands/init.ts:142, packages/cli/src/acp/commands/init.ts:31
  • `gzipSync` in `save` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/a2a-server/src/persistence/gcs.ts:114
  • `gunzipSync` in `load` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/a2a-server/src/persistence/gcs.ts:248
  • `fs.writeFileSync` in `execute` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/src/acp/commands/init.ts:40
  • `fs.existsSync` in `validateExtension` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/src/commands/extensions/validate.ts:70
  • `fs.existsSync` in `downloadFile` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/src/commands/gemma/setup.ts:73
  • `fs.unlinkSync` in `downloadFile` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/src/commands/gemma/setup.ts:74
  • `fs.renameSync` in `downloadFile` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/src/commands/gemma/setup.ts:115
  • `fs.mkdirSync` in `handleSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/src/commands/gemma/setup.ts:213
  • `fs.rmSync` in `handleSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×3) — packages/cli/src/commands/gemma/setup.ts:234, packages/cli/src/commands/gemma/setup.ts:250, packages/cli/src/commands/gemma/setup.ts:264
  • `fs.chmodSync` in `handleSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/src/commands/gemma/setup.ts:273
  • `execFileSync` in `handleSetup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/src/commands/gemma/setup.ts:286
  • `fs.mkdirSync` in `startServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. (×2) — packages/cli/src/commands/gemma/start.ts:40, packages/cli/src/commands/gemma/start.ts:42
  • `fs.openSync` in `startServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/src/commands/gemma/start.ts:44
  • `fs.closeSync` in `startServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/src/commands/gemma/start.ts:62
  • `fs.unlinkSync` in `stopServer` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/cli/src/commands/gemma/stop.ts:45

What to do

  • TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
R1 · Type Safety9.7 / 10Exemplary✓ Tool-verified

React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.

Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.

What to do

  • Migrate the remaining .js/.jsx files to TypeScript.
R10 · Code Duplication8.9 / 10Exemplary✓ Tool-verified

React / JS · Code Health — Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm over JS/TS tokens, D-386): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.

Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Deterministic.

  • 33 duplicated blocks under packages/ have copies in at least two of the sibling directories a2a-server, cli, core, devtools — 24 of them are reported below, and 9 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 33 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 33 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 33 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/a2a-server/src/commands/restore.ts:66
  • 27 duplicated blocks under packages/core/src/ have copies in at least two of the sibling directories agent, agents, code_assist, commands, config, context (+14 more sibling(s) not listed) — 16 of them are reported below, and 11 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 27 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 27 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 27 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/core/src/context/chatCompressionService.ts:240
  • 16 duplicated blocks under packages/cli/src/ have copies in at least two of the sibling directories acp, commands, config, core, services, ui (+1 more sibling(s) not listed) — 10 of them are reported below, and 6 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 16 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 16 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 16 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/cli/src/ui/hooks/useExtensionUpdates.ts:176
  • 15 duplicated blocks under packages/cli/src/ui/ have copies in at least two of the sibling directories auth, commands, components, hooks, privacy — 5 of them are reported below, and 10 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 15 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 15 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 15 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/cli/src/ui/auth/ApiAuthDialog.tsx:94
  • 6 duplicated blocks under the repository root have copies in at least two of the sibling directories evals, packages, scripts — 1 of them are reported below, and 5 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 6 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 6 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 6 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/core/src/code_assist/experiments/client_metadata.ts:19
  • packages/core/src/tools/definitions/model-family-sets/default-legacy.ts:12 · packages/core/src/tools/definitions/model-family-sets/gemini-3.ts:12 — these 2 files are line-for-line copies of one another — 285 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — packages/core/src/tools/definitions/model-family-sets/default-legacy.ts:12
  • REDACTED:153 · REDACTED:189 — the two spans are one implementation copied and then locally edited — 1149 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — REDACTED:153
  • packages/core/src/agents/local-invocation.ts:71 · packages/core/src/agents/local-session-invocation.ts:82 — the two spans are one implementation copied and then locally edited — 1241 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/core/src/agents/local-invocation.ts:71
  • packages/core/src/prompts/snippets.legacy.ts:32 · packages/core/src/prompts/snippets.ts:43 — the two spans are one implementation copied and then locally edited — 995 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/core/src/prompts/snippets.legacy.ts:32
  • packages/cli/src/nonInteractiveCli.ts:90 · packages/cli/src/nonInteractiveCliAgentSession.ts:89 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/cli/src/nonInteractiveCli.ts:90
  • packages/cli/src/ui/components/triage/TriageDuplicates.tsx:25 · packages/cli/src/ui/components/triage/TriageIssues.tsx:25 — the two spans are one implementation copied and then locally edited — 710 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/cli/src/ui/components/triage/TriageDuplicates.tsx:25
  • evals/tool_output_masking.eval.ts:36 · evals/tool_output_masking.eval.ts:174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — evals/tool_output_masking.eval.ts:36
  • packages/cli/src/ui/components/shared/text-buffer.ts:3731 · packages/cli/src/ui/components/shared/text-buffer.ts:3837 — all 2 copies are in the same file, and what repeats is a LIST OF ENTRIES rather than behaviour — the same entries written out more than once. Extract them into one shared, exported constant and spread that constant into each site, rather than into a function the sites call: a list like this often lives in declarative metadata (a decorator's options object, a static configuration table) that a build step must be able to read statically, where a function call is not allowed. Adding an entry to one copy and not the other is the failure this prevents. — packages/cli/src/ui/components/shared/text-buffer.ts:3731
  • packages/cli/src/ui/hooks/useAgentStream.ts:599 · packages/cli/src/ui/hooks/useGeminiStream.ts:457 — the two spans are one implementation copied and then locally edited — 358 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/cli/src/ui/hooks/useAgentStream.ts:599
  • scripts/aggregate_evals.js:18 · scripts/eval_utils.js:15 — the two spans are one implementation copied and then locally edited — 478 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — scripts/aggregate_evals.js:18
  • packages/core/src/context/processors/rollingSummaryProcessor.ts:24 · packages/core/src/context/processors/stateSnapshotProcessor.ts:25 — the two spans are one implementation copied and then locally edited — 338 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/core/src/context/processors/rollingSummaryProcessor.ts:24
  • packages/cli/src/ui/components/shared/vim-buffer-actions.ts:194 · packages/cli/src/ui/components/shared/vim-buffer-actions.ts:377 — the two spans are one implementation copied and then locally edited — 245 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/cli/src/ui/components/shared/vim-buffer-actions.ts:194
  • packages/core/src/routing/strategies/classifierStrategy.ts:131 · packages/core/src/routing/strategies/numericalClassifierStrategy.ts:103 — the two spans are one implementation copied and then locally edited — 310 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/core/src/routing/strategies/classifierStrategy.ts:131
  • packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts:1515 · packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts:1656 — the two spans are one implementation copied and then locally edited — 272 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts:1515
  • packages/cli/src/commands/extensions/disable.ts:23 · packages/cli/src/commands/extensions/enable.ts:28 — the two spans are one implementation copied and then locally edited — 271 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/cli/src/commands/extensions/disable.ts:23
  • packages/cli/src/ui/components/shared/text-buffer.ts:420 · packages/cli/src/ui/components/shared/text-buffer.ts:521 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/cli/src/ui/components/shared/text-buffer.ts:420
  • REDACTED:465 · packages/core/src/tools/write-file.ts:227 — the two spans are one implementation copied and then locally edited — 242 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — REDACTED:465
  • packages/core/src/tools/list-mcp-resources.ts:26 · packages/core/src/tools/read-mcp-resource.ts:27 — the two spans are one implementation copied and then locally edited — 184 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/core/src/tools/list-mcp-resources.ts:26
  • packages/core/src/agents/local-subagent-protocol.ts:143 · packages/core/src/agents/remote-subagent-protocol.ts:129 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — packages/core/src/agents/local-subagent-protocol.ts:143
  • packages/cli/src/utils/agentSettings.ts:15 · packages/cli/src/utils/skillSettings.ts:18 — the two spans are one implementation copied and then locally edited — 222 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/cli/src/utils/agentSettings.ts:15
  • packages/a2a-server/src/commands/restore.ts:66 · packages/cli/src/acp/commands/restore.ts:62 — the two spans are one implementation copied and then locally edited — 280 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/a2a-server/src/commands/restore.ts:66
  • packages/core/src/agents/remote-invocation.ts:63 · packages/core/src/agents/remote-session-invocation.ts:74 — the two spans are one implementation copied and then locally edited — 240 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/core/src/agents/remote-invocation.ts:63
  • packages/core/src/tools/web-fetch.ts:836 · packages/core/src/tools/web-search.ts:131 — the two spans are one implementation copied and then locally edited — 227 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/core/src/tools/web-fetch.ts:836
  • packages/core/src/context/config/profiles.ts:82 · packages/core/src/context/config/profiles.ts:224 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/core/src/context/config/profiles.ts:82
  • packages/a2a-server/src/commands/memory.ts:18 · packages/cli/src/acp/commands/memory.ts:21 — the two spans are one implementation copied and then locally edited — 247 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/a2a-server/src/commands/memory.ts:18
  • packages/cli/src/utils/featureToggleUtils.ts:83 · packages/cli/src/utils/hookSettings.ts:36 — the two spans are one implementation copied and then locally edited — 257 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/cli/src/utils/featureToggleUtils.ts:83
  • packages/core/src/mcp/google-auth-provider.ts:60 · packages/core/src/mcp/sa-impersonation-provider.ts:65 — the two spans are one implementation copied and then locally edited — 192 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/core/src/mcp/google-auth-provider.ts:60
  • packages/core/src/services/sandboxedFileSystemService.ts:50 · packages/core/src/services/sandboxedFileSystemService.ts:114 — the two spans are one implementation copied and then locally edited — 234 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/core/src/services/sandboxedFileSystemService.ts:50
  • REDACTED:839 · REDACTED:1256 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:839
  • packages/core/src/agents/browser/browserAgentInvocation.ts:166 · packages/core/src/agents/local-invocation.ts:121 — the two spans are one implementation copied and then locally edited — 254 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/core/src/agents/browser/browserAgentInvocation.ts:166
  • packages/core/src/context/chatCompressionService.ts:240 · packages/core/src/utils/tool-utils.ts:193 — the two spans are one implementation copied and then locally edited — 249 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/core/src/context/chatCompressionService.ts:240
  • packages/core/src/utils/extensionLoader.ts:51 · packages/core/src/utils/extensionLoader.ts:159 — the two spans are one implementation copied and then locally edited — 221 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/core/src/utils/extensionLoader.ts:51
  • packages/cli/src/utils/agentUtils.ts:18 · packages/cli/src/utils/skillUtils.ts:29 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — packages/cli/src/utils/agentUtils.ts:18
  • packages/core/src/agents/local-subagent-protocol.ts:384 · packages/core/src/agents/remote-subagent-protocol.ts:375 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/core/src/agents/local-subagent-protocol.ts:384
  • packages/cli/src/ui/components/shared/vim-buffer-actions.ts:640 · packages/cli/src/ui/components/shared/vim-buffer-actions.ts:688 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/cli/src/ui/components/shared/vim-buffer-actions.ts:640

What to do

  • Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
R11 · Import Boundaries8.3 / 10Strong✓ Tool-verified

React / JS · Architecture — Conformance to the detected frontend architecture layout (feature-sliced / layered src) plus cross-package deep-import rules (D-386).

Method: Conformance to the detected frontend layout (feature-sliced / layered src) plus cross-package deep-import rules, over the module graph. Deterministic.

  • evals/app-test-helper.ts:7 reaches into another package with a relative path (../packages/cli/src/test-utils/AppRig.js) — import the package by name instead. — evals/app-test-helper.ts:7
  • evals/app-test-helper.ts:7 imports packages/cli/src/test-utils/AppRig.tsx, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on. — evals/app-test-helper.ts:7
  • evals/auto_memory_modes.eval.ts:12 reaches into another package with a relative path (../packages/core/src/services/chatRecordingService.js) — import the package by name instead. — evals/auto_memory_modes.eval.ts:12
  • evals/auto_memory_modes.eval.ts:332 reaches into another package with a relative path (../packages/core/src/services/memoryService.js) — import the package by name instead. — evals/auto_memory_modes.eval.ts:332
  • evals/auto_memory_modes.eval.ts:389 reaches into another package with a relative path (../packages/core/src/services/memoryService.js) — import the package by name instead. — evals/auto_memory_modes.eval.ts:389
  • evals/component-test-helper.ts:31 reaches into another package with a relative path (../packages/cli/src/test-utils/settings.js) — import the package by name instead. — evals/component-test-helper.ts:31
  • evals/component-test-helper.ts:31 imports packages/cli/src/test-utils/settings.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on. — evals/component-test-helper.ts:31
  • evals/test-helper.ts:12 imports packages/test-utils/src/index.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on. — evals/test-helper.ts:12
  • evals/test-helper.ts:24 imports packages/test-utils/src/index.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on. — evals/test-helper.ts:24
  • integration-tests/globalSetup.ts:15 reaches past another workspace package's public entry into its internals with a relative path (../packages/core/src/tools/ripGrep.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — integration-tests/globalSetup.ts:15
  • integration-tests/google_web_search.test.ts:7 reaches past another workspace package's public entry into its internals with a relative path (../packages/core/src/tools/tool-names.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — integration-tests/google_web_search.test.ts:7
  • integration-tests/ripgrep-real.test.ts:11 reaches past another workspace package's public entry into its internals with a relative path (../packages/core/src/tools/ripGrep.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — integration-tests/ripgrep-real.test.ts:11
  • integration-tests/ripgrep-real.test.ts:15 reaches past another workspace package's public entry into its internals with a relative path (../packages/core/src/config/config.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — integration-tests/ripgrep-real.test.ts:15
  • integration-tests/ripgrep-real.test.ts:16 reaches past another workspace package's public entry into its internals with a relative path (../packages/core/src/utils/workspaceContext.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — integration-tests/ripgrep-real.test.ts:16
  • integration-tests/run_shell_command.test.ts:14 reaches past another workspace package's public entry into its internals with a relative path (../packages/core/src/utils/shell-utils.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — integration-tests/run_shell_command.test.ts:14
  • memory-tests/globalSetup.ts:10 reaches past another workspace package's public entry into its internals with a relative path (../packages/core/src/tools/ripGrep.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — memory-tests/globalSetup.ts:10
  • packages/cli/src/patches/http-proxy-agent.ts:12 reaches into another package with a relative path (../../../../node_modules/http-proxy-agent/dist/index.js) — import the package by name instead. — packages/cli/src/patches/http-proxy-agent.ts:12
  • packages/cli/src/patches/https-proxy-agent.ts:12 reaches into another package with a relative path (../../../../node_modules/https-proxy-agent/dist/index.js) — import the package by name instead. — packages/cli/src/patches/https-proxy-agent.ts:12
  • REDACTED:63 imports @google/gemini-cli-devtools, a package this repository publishes, but this package's own REDACTED does not list it in dependencies (or peer/optional dependencies) — it resolves only through the workspace link, so an installed copy of this package is missing it. Add it to this package's dependencies. — REDACTED:63
  • packages/core/src/utils/schemaValidator.ts:10 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/core/src/utils/schemaValidator.ts:10
  • packages/vscode-ide-companion/src/diff-manager.ts:7 imports @google/gemini-cli-core/src/ide/types.js, a package this repository publishes, but this package's own REDACTED does not list it in dependencies (or peer/optional dependencies) — it resolves only through the workspace link, so an installed copy of this package is missing it. Add it to this package's dependencies. — packages/vscode-ide-companion/src/diff-manager.ts:7
  • packages/vscode-ide-companion/src/extension.ts:12 imports @google/gemini-cli-core/src/ide/detect-ide.js, a package this repository publishes, but this package's own REDACTED does not list it in dependencies (or peer/optional dependencies) — it resolves only through the workspace link, so an installed copy of this package is missing it. Add it to this package's dependencies. — packages/vscode-ide-companion/src/extension.ts:12
  • packages/vscode-ide-companion/src/ide-server.ts:8 imports @google/gemini-cli-core/src/ide/types.js, a package this repository publishes, but this package's own REDACTED does not list it in dependencies (or peer/optional dependencies) — it resolves only through the workspace link, so an installed copy of this package is missing it. Add it to this package's dependencies. — packages/vscode-ide-companion/src/ide-server.ts:8
  • packages/vscode-ide-companion/src/ide-server.ts:26 imports @google/gemini-cli-core/src/utils/paths.js, a package this repository publishes, but this package's own REDACTED does not list it in dependencies (or peer/optional dependencies) — it resolves only through the workspace link, so an installed copy of this package is missing it. Add it to this package's dependencies. — packages/vscode-ide-companion/src/ide-server.ts:26
  • packages/vscode-ide-companion/src/open-files-manager.ts:8 imports @google/gemini-cli-core/src/ide/ideContext.js, a package this repository publishes, but this package's own REDACTED does not list it in dependencies (or peer/optional dependencies) — it resolves only through the workspace link, so an installed copy of this package is missing it. Add it to this package's dependencies. — packages/vscode-ide-companion/src/open-files-manager.ts:8
  • perf-tests/globalSetup.ts:10 reaches past another workspace package's public entry into its internals with a relative path (../packages/core/src/tools/ripGrep.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — perf-tests/globalSetup.ts:10
  • scripts/build_sandbox.js:32 reaches into another package with a relative path (../REDACTED) — import the package by name instead. — scripts/build_sandbox.js:32
  • scripts/generate-keybindings-doc.ts:11 reaches into another package with a relative path (../packages/cli/src/ui/key/keyBindings.js) — import the package by name instead. — scripts/generate-keybindings-doc.ts:11
  • scripts/generate-keybindings-doc.ts:12 reaches into another package with a relative path (../packages/cli/src/ui/key/keyBindings.js) — import the package by name instead. — scripts/generate-keybindings-doc.ts:12
  • scripts/generate-keybindings-doc.ts:30 reaches into another package with a relative path (../packages/cli/src/ui/key/keybindingUtils.js) — import the package by name instead. — scripts/generate-keybindings-doc.ts:30
  • scripts/generate-settings-doc.ts:19 reaches into another package with a relative path (../packages/cli/src/config/settingsSchema.js) — import the package by name instead. — scripts/generate-settings-doc.ts:19
  • scripts/generate-settings-schema.ts:11 reaches into another package with a relative path (../packages/cli/src/config/settingsSchema.js) — import the package by name instead. — scripts/generate-settings-schema.ts:11
  • scripts/tests/generate-keybindings-doc.test.ts:13 reaches past another workspace package's public entry into its internals with a relative path (../../packages/cli/src/ui/key/keyBindings.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead. — scripts/tests/generate-keybindings-doc.test.ts:13

What to do

  • Fix the listed violations: import through the target package's declared public entry rather than a deep path into its internals or a relative path into its directory (23 rows); declare the workspace packages these files import in the importing package's own REDACTED dependencies (6 rows) — those imports are already bare package specifiers, so the import statements do not change, only the manifest; move the shared test helper into a source directory production code may depend on (4 rows).
R2 · Cyclomatic Complexity8.0 / 10Strong✓ Tool-verified

React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.

Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.

  • handleVimAction has cyclomatic complexity 246 and cognitive complexity 407; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/cli/src/ui/components/shared/vim-buffer-actions.ts:164
  • (anonymous) has cyclomatic complexity 205 and cognitive complexity 313; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/cli/src/ui/components/InputPrompt.tsx:686
  • textBufferReducerLogic has cyclomatic complexity 194 and cognitive complexity 212; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/cli/src/ui/components/shared/text-buffer.ts:1787
  • constructor has cyclomatic complexity 151 and cognitive complexity 147; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/core/src/config/config.ts:1004
  • start_sandbox has cyclomatic complexity 140 and cognitive complexity 235; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/cli/src/utils/sandbox.ts:120
  • (anonymous) has cyclomatic complexity 136 and cognitive complexity 274; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/cli/src/ui/hooks/vim.ts:660
  • loadCliConfig has cyclomatic complexity 127 and cognitive complexity 132; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/cli/src/config/config.ts:663
  • emitKeys has cyclomatic complexity 98 and cognitive complexity 204; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/cli/src/ui/contexts/KeypressContext.tsx:380
  • (anonymous) has cyclomatic complexity 94 and cognitive complexity 212; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/cli/src/nonInteractiveCli.ts:90
  • isSafeToCallWithExec has cyclomatic complexity 91 and cognitive complexity 284; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/core/src/sandbox/utils/commandSafety.ts:230
  • (anonymous) has cyclomatic complexity 90 and cognitive complexity 173; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/cli/src/nonInteractiveCliAgentSession.ts:89
  • #resolvePrompt has cyclomatic complexity 86 and cognitive complexity 202; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/cli/src/acp/acpSession.ts:1007
  • processLine has cyclomatic complexity 83 and cognitive complexity 213; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/core/src/services/chatRecordingService.ts:319
  • processStreamResponse has cyclomatic complexity 76 and cognitive complexity 174; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/core/src/core/geminiChat.ts:1590
  • main has cyclomatic complexity 75 and cognitive complexity 109; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/cli/src/gemini.tsx:469
  • AppContainer has cyclomatic complexity 74 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/cli/src/ui/AppContainer.tsx:338
  • installOrUpdateExtension has cyclomatic complexity 72 and cognitive complexity 95; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/cli/src/config/extension-manager.ts:202
  • classifyGoogleError has cyclomatic complexity 71 and cognitive complexity 102; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/core/src/utils/googleQuotaErrors.ts:229
  • detectPowerShellSubstitution has cyclomatic complexity 68 and cognitive complexity 138; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/core/src/utils/shell-utils.ts:2009
  • retryWithBackoff has cyclomatic complexity 66 and cognitive complexity 203; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/core/src/utils/retry.ts:284

What to do

  • Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
R3 · Large Files4.7 / 10Adequate✓ Tool-verified

React / JS · Code Health — How many source files exceed the large-file threshold.

Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.

  • packages/cli/src/ui/components/shared/text-buffer.ts has 3821 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/ui/components/shared/text-buffer.ts:1
  • packages/core/src/config/config.ts has 3812 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/core/src/config/config.ts:1
  • packages/cli/src/config/settingsSchema.ts has 3639 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/config/settingsSchema.ts:1
  • packages/cli/src/ui/AppContainer.tsx has 2969 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/ui/AppContainer.tsx:1
  • packages/core/src/utils/shell-utils.ts has 2400 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/core/src/utils/shell-utils.ts:1
  • packages/core/src/tools/mcp-client.ts has 2284 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/core/src/tools/mcp-client.ts:1
  • packages/cli/src/ui/hooks/useGeminiStream.ts has 2281 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/ui/hooks/useGeminiStream.ts:1
  • packages/core/src/telemetry/types.ts has 2233 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/core/src/telemetry/types.ts:1
  • packages/core/src/core/geminiChat.ts has 2114 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/core/src/core/geminiChat.ts:1
  • packages/core/src/services/shellExecutionService.ts has 2025 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/core/src/services/shellExecutionService.ts:1
  • packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts has 2003 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts:1
  • packages/devtools/client/src/App.tsx has 1808 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/devtools/client/src/App.tsx:1
  • packages/cli/src/ui/components/InputPrompt.tsx has 1777 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/ui/components/InputPrompt.tsx:1
  • packages/cli/src/ui/components/shared/vim-buffer-actions.ts has 1691 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/ui/components/shared/vim-buffer-actions.ts:1
  • packages/core/src/services/chatRecordingService.ts has 1689 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/core/src/services/chatRecordingService.ts:1
  • packages/core/src/telemetry/metrics.ts has 1649 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/core/src/telemetry/metrics.ts:1
  • packages/test-utils/src/test-rig.ts has 1543 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/test-utils/src/test-rig.ts:1
  • packages/cli/src/config/settings.ts has 1512 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/config/settings.ts:1
  • packages/cli/src/config/extension-manager.ts has 1466 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/config/extension-manager.ts:1
  • packages/core/src/agents/local-executor.ts has 1449 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/core/src/agents/local-executor.ts:1
  • packages/cli/src/acp/acpSession.ts has 1441 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/acp/acpSession.ts:1
  • packages/cli/src/utils/sandbox.ts has 1441 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/utils/sandbox.ts:1
  • REDACTED has 1412 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
  • packages/cli/src/ui/hooks/vim.ts has 1375 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/ui/hooks/vim.ts:1
  • packages/cli/src/ui/components/InboxDialog.tsx has 1333 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/ui/components/InboxDialog.tsx:1
  • REDACTED has 1331 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
  • packages/a2a-server/src/agent/task.ts has 1288 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/a2a-server/src/agent/task.ts:1
  • packages/core/src/tools/shell.ts has 1270 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/core/src/tools/shell.ts:1
  • packages/core/src/core/client.ts has 1246 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/core/src/core/client.ts:1
  • REDACTED has 1238 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
  • packages/cli/src/ui/components/AskUserDialog.tsx has 1189 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/ui/components/AskUserDialog.tsx:1
  • packages/cli/src/config/config.ts has 1177 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/config/config.ts:1
  • packages/core/src/policy/policy-engine.ts has 1142 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/core/src/policy/policy-engine.ts:1
  • packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx has 1053 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx:1
  • packages/core/src/tools/tools.ts has 1026 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/core/src/tools/tools.ts:1
  • packages/cli/src/gemini.tsx has 1002 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/gemini.tsx:1
  • REDACTED has 995 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
  • packages/cli/src/ui/components/triage/TriageDuplicates.tsx has 974 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/cli/src/ui/components/triage/TriageDuplicates.tsx:1
  • packages/core/src/telemetry/loggers.ts has 954 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/core/src/telemetry/loggers.ts:1
  • packages/a2a-server/src/config/settings.ts has 951 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/a2a-server/src/config/settings.ts:1

What to do

  • Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
R4 · Test Coverage9.9 / 10Exemplary✓ Tool-verified

React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.

Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.

  • No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×13) — packages/vscode-ide-companion/scripts/generate-notices.js:1, packages/core/scripts/bundle-browser-mcp.mjs:1, packages/core/scripts/compile-windows-sandbox.js:1, …

What to do

  • Add tests that import the unreached modules (directly or through their public entry).
R5 · Dependency Freshness2.0 / 10Weak✓ Tool-verified

React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).

Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.

  • 128 outdated package(s); JS/npm CVEs scored in D30 (newest versions read from registry.npmjs.org: the repository's own registry, wombat-dressing-room.appspot.com, refused the analyzer)

What to do

  • Bump outdated dependencies to current versions to limit upgrade debt.
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified

React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each REDACTED script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.

Method: REDACTED scanned for test/lint/typecheck script wiring. Deterministic presence check.

R7 · Dead Code8.5 / 10Strong✓ Tool-verified

React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).

Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.

  • Unreachable from the 244 application, 49 tooling and 1092 test entry point(s) detected in this repo. Gate removals on `npm run build` — an undetected custom entry would make these reachable.
  • no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make (×23) — scripts/sync_project_dry_run.js, scripts/cleanup-branches.ts, scripts/close_duplicate_issues.js, …
  • no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), but 9 in-repo import(s) from 9 other file(s) do name it (tools/gemini-cli-bot/metrics/scripts/backlog_age.ts, tools/gemini-cli-bot/metrics/scripts/domain_expertise.ts, tools/gemini-cli-bot/metrics/scripts/latency.ts and 6 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it — tools/gemini-cli-bot/metrics/types.ts
  • Nothing imports this binding — it is safe to review for removal. (×15) — packages/cli/src/ui/components/AsciiArt.ts:40, packages/cli/src/ui/components/AsciiArt.ts:54, packages/cli/src/ui/contexts/AskUserActionsContext.tsx:30, …

What to do

  • Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
R8 · Dependency Hygiene0.0 / 10Critical✓ Tool-verified

React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.

Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.

  • Imported but not declared in any reachable REDACTED — installs work only by hoisting accident. (×10) — integration-tests/context-fidelity.test.ts:11, integration-tests/voice-mode.test.ts:14, scripts/sandbox_command.js:27, …
  • Declared in the root REDACTED but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it. (×3)
  • Only test files import it (first: packages/core/src/utils/memoryImportProcessor.test.ts:12) — move it to devDependencies. — REDACTED:76

What to do

  • Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
R9 · Circular Imports0.0 / 10Critical✓ Tool-verified

React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.

Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.

  • packages/cli/src/acp/acpRpcDispatcher.ts → packages/cli/src/acp/acpSessionManager.ts → packages/cli/src/config/config.ts → packages/cli/src/commands/extensions.tsx → packages/cli/src/gemini.tsx → packages/cli/src/acp/acpStdioTransport.ts → packages/cli/src/acp/acpRpcDispatcher.ts (one verified cycle inside a mutually-dependent group of 13 files) — packages/cli/src/acp/acpRpcDispatcher.ts:18
  • packages/cli/src/commands/extensions/utils.ts → packages/cli/src/config/extension-manager.ts → packages/cli/src/commands/extensions/utils.ts — packages/cli/src/commands/extensions/utils.ts:6
  • packages/cli/src/ui/components/shared/text-buffer.ts → packages/cli/src/ui/components/shared/vim-buffer-actions.ts → packages/cli/src/ui/components/shared/text-buffer.ts — packages/cli/src/ui/components/shared/text-buffer.ts:31
  • packages/cli/src/ui/contexts/KeypressContext.tsx → packages/cli/src/ui/hooks/useFocus.ts → packages/cli/src/ui/hooks/useKeypress.ts → packages/cli/src/ui/contexts/KeypressContext.tsx — packages/cli/src/ui/contexts/KeypressContext.tsx:22
  • packages/cli/src/ui/hooks/shell-completions/gitProvider.ts → packages/cli/src/ui/hooks/useShellCompletion.ts → packages/cli/src/ui/hooks/shell-completions/index.ts → packages/cli/src/ui/hooks/shell-completions/gitProvider.ts (one verified cycle inside a mutually-dependent group of 4 files) — packages/cli/src/ui/hooks/shell-completions/gitProvider.ts:10
  • packages/core/index.ts → packages/core/src/code_assist/codeAssist.ts → packages/core/src/code_assist/oauth2.ts → packages/core/src/code_assist/oauth-credential-storage.ts → packages/core/src/mcp/token-storage/hybrid-token-storage.ts → packages/core/src/mcp/token-storage/keychain-token-storage.ts → packages/core/src/services/keychainService.ts → packages/core/src/telemetry/types.ts → packages/core/src/core/contentGenerator.ts → packages/core/index.ts (one verified cycle inside a mutually-dependent group of 97 files) — packages/core/index.ts:49
  • packages/core/src/services/sandboxManager.ts → packages/core/src/sandbox/utils/commandSafety.ts → packages/core/src/utils/shell-utils.ts → packages/core/src/services/sandboxManager.ts (one verified cycle inside a mutually-dependent group of 14 files) — packages/core/src/services/sandboxManager.ts:10
  • packages/core/src/services/chatRecordingService.ts → packages/core/src/utils/sessionUtils.ts → packages/core/src/services/chatRecordingService.ts — packages/core/src/services/chatRecordingService.ts:27
  • packages/vscode-ide-companion/src/diff-manager.ts → packages/vscode-ide-companion/src/extension.ts → packages/vscode-ide-companion/src/diff-manager.ts — packages/vscode-ide-companion/src/diff-manager.ts:14

What to do

  • Break each cycle by extracting the shared piece into a module both sides can import.
X24 · Document value interpolated into markup unescaped5.4 / 10Adequate✓ Tool-verified

Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.

Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.

  • `error.replace(/</g,'&lt;').replace(/>/g,'&gt;')` is text this program did not author, and it is written into the text of an element through `res.end` (the page this server sends) with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:247
  • `(url.searchParams.get('error_description')||'').replace(/</g,'&lt;').replace(/>/g,'&gt;')` is text this program did not author, and it is written into the text of an element through `res.end` (the page this server sends) with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — REDACTED:248

What to do

  • Each finding names the expression, the attribute it lands in and the line. Confirm the value's origin from the read this analyzer traced, then escape it at the sink or validate it against the shape the attribute accepts before interpolating.
X5 · Nullable reference types2.0 / 10Critical✓ Tool-verified

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 `!`.

WCAG coverage — what static analysis assessed

Statically assessed 12 of 55 WCAG 2.2 Level A/AA success criteria (22%; ≈24% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 43 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).

DimensionWCAG 2.2 A/AA criteriaCoverage
AC2 · Forms & labels1.3.1, 3.3.2, 4.1.2Partial signal
AC3 · Page structure1.4.4, 2.2.1, 2.4.1, 2.4.2, 3.1.1, 4.1.2Partial signal
AC4 · Keyboard semantics2.1.1, 2.4.3Partial signal
AC6 · Visual & motion safety1.4.3, 2.4.7Partial — literal CSS only

Not statically assessed — these 43 Level A/AA criteria need runtime or manual evaluation (WCAG-EM): 1.1.1, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.4.1, 1.4.2, 1.4.5, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 2.1.2, 2.1.4, 2.2.2, 2.3.1, 2.4.4, 2.4.5, 2.4.6, 2.4.11, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.7, 2.5.8, 3.1.2, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.6, 3.3.1, 3.3.3, 3.3.4, 3.3.7, 3.3.8, 4.1.3.

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.

LensScoreRatingImpact
Code Health55%Adequate — gated by D1, D2, X5Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture66%Adequate — gated by R9Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity76%StrongStrongest area.
Readiness44%Adequate — gated by R5, R8, P7Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security40%Weak — gated by D29, D31, C2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Accessibility39%Weak — gated by AC4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance60%AdequateAcceptable, with room to improve.
Unscored — 4 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.

  • P12 CI test-gate honesty — 2 observation(s) recorded · Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
  • SC1 Supply-chain hygiene — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 20 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 — 60 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 image/media element found in the parsed markup — AC1 not applicable here.
  • AC5 ARIA correctness — No ARIA usage found in the parsed markup — AC5 not applicable here.
  • AX1 Captive dependencies — no DI registrations detected
  • AX2 Stateful singletons — no singleton implementations detected
  • AX4 Dependency direction — not applicable to a transaction-script/CRUD architecture (the inward-dependency rule is for layered/clean styles)
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
  • 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) — #5 extracting sha256:804d4d68057cbb26cbcde9a735148ebc6589911bad32cf9dbddb5b0ba878bf1f 1.0s done #5 extracting sha256:64cfb949317c9824fd081d55c59a7225bfe1f650c6395ba42d7ed0ccf51993d2 0.0s done #5 extracting sha256:3c02fd806613748139b8b8a14a69ae3518a1b0e863c57c35aada3b92ed87fb31 0.0s done #5 DONE 2.8s #6 [2/6] WORKDIR /app #6 DONE 0.0s #7 [3/6] COPY package*.json ./ #7 DONE 0.0s #8 [4/6] RUN npm ci; 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.
  • 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
  • D12 Dependency Hygiene — Dependency currency not established — no declaration carries an exact pin to grade
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed TypeScript surface was not measured.
  • 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.
  • D28 Secrets (history) — gitleaks killed before it finished — this repository's git history not scanned
  • D32 Data Compliance (PII/GDPR) — 16 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • 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
  • DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (7 domain event(s); its domain events are published by services or handlers — no domain entity raises one)
  • ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
  • 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)
  • ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
  • IC1 Incompleteness & stubs — IC1 reached only 0% of this repository's production lines — typescript (274,104 lines), javascript (7,875 lines), python (3,455 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • 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 data present for 1256 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
  • 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 — typescript (274,104 lines), javascript (7,875 lines), python (3,455 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 — typescript (274,104 lines), javascript (7,875 lines), python (3,455 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 — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X2 Cancellation propagation — 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
  • 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 — X27 reached only 0% of this repository's production lines — typescript (274,104 lines), javascript (7,875 lines), python (3,455 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X28 Index access outside its own emptiness guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X29 Per-element action decided by a fixed element — X29 reached only 0% of this repository's production lines — typescript (274,104 lines), javascript (7,875 lines), python (3,455 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X3 Exception handling — X3 reached only 0% of this repository's production lines — typescript (274,104 lines), javascript (7,875 lines), python (3,455 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.

Critical — 136 finding(s)
D30 · Dependency Vulnerabilities · High CVE · ×54
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 29 more in this group — see findings.md.
D30 · Dependency Vulnerabilities · Critical CVE · ×20
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D31 · IaC & Container Security · High IaC · ×14
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
AC4 · Keyboard semantics · Click handler on a non-interactive <div> · ×7
  • Click handler on a non-interactive <div> packages/devtools/client/src/App.tsx:584 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
  • Click handler on a non-interactive <div> packages/devtools/client/src/App.tsx:706 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
  • Click handler on a non-interactive <div> packages/devtools/client/src/App.tsx:953 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
  • Click handler on a non-interactive <div> packages/devtools/client/src/App.tsx:1083 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
  • Click handler on a non-interactive <div> packages/devtools/client/src/App.tsx:1266 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
  • Click handler on a non-interactive <div> packages/devtools/client/src/App.tsx:1345 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
  • Click handler on a non-interactive <div> packages/devtools/client/src/App.tsx:1922 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
D34 · Knowledge Freshness · Orphaned knowledge · ×5
  • Orphaned knowledge packages/cli/src/ui/components/shared/vim-buffer-actions.ts:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge packages/cli/src/ui/components/triage/TriageDuplicates.tsx:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge packages/cli/src/ui/components/shared/VirtualizedList.tsx:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge packages/cli/src/ui/components/SessionBrowser.tsx:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge packages/cli/src/ui/components/triage/TriageIssues.tsx:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
R9 · Circular Imports · Import cycle (2 files) · ×4
  • Import cycle (2 files) packages/cli/src/commands/extensions/utils.ts:6 — packages/cli/src/commands/extensions/utils.ts → packages/cli/src/config/extension-manager.ts → packages/cli/src/commands/extensions/utils.ts
  • Import cycle (2 files) packages/cli/src/ui/components/shared/text-buffer.ts:31 — packages/cli/src/ui/components/shared/text-buffer.ts → packages/cli/src/ui/components/shared/vim-buffer-actions.ts → packages/cli/src/ui/components/shared/text-buffer.ts
  • Import cycle (2 files) packages/core/src/services/chatRecordingService.ts:27 — packages/core/src/services/chatRecordingService.ts → packages/core/src/utils/sessionUtils.ts → packages/core/src/services/chatRecordingService.ts
  • Import cycle (2 files) packages/vscode-ide-companion/src/diff-manager.ts:14 — packages/vscode-ide-companion/src/diff-manager.ts → packages/vscode-ide-companion/src/extension.ts → packages/vscode-ide-companion/src/diff-manager.ts
R9 · Circular Imports · Import cycle (3 files) · ×3
  • Import cycle (3 files) packages/cli/src/ui/contexts/KeypressContext.tsx:22 — packages/cli/src/ui/contexts/KeypressContext.tsx → packages/cli/src/ui/hooks/useFocus.ts → packages/cli/src/ui/hooks/useKeypress.ts → packages/cli/src/ui/contexts/KeypressContext.tsx
  • Import cycle (3 files) packages/cli/src/ui/hooks/shell-completions/gitProvider.ts:10 — packages/cli/src/ui/hooks/shell-completions/gitProvider.ts → packages/cli/src/ui/hooks/useShellCompletion.ts → packages/cli/src/ui/hooks/shell-completions/index.ts → packages/cli/src/ui/hooks/shell-completions/gitProvider.ts (one verified cycle inside a mutually-dependent group of 4 files)
  • Import cycle (3 files) packages/core/src/services/sandboxManager.ts:10 — packages/core/src/services/sandboxManager.ts → packages/core/src/sandbox/utils/commandSafety.ts → packages/core/src/utils/shell-utils.ts → packages/core/src/services/sandboxManager.ts (one verified cycle inside a mutually-dependent group of 14 files)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
R8 · Dependency Hygiene · Unlisted import 'zod' · ×2
  • Unlisted import 'zod' integration-tests/test-mcp-server.ts:14 — Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
  • Unlisted import 'zod' packages/a2a-server/src/config/settings.ts:9 — Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
AC2 · Forms & labels · <select> without a programmatic label · ×1
  • <select> without a programmatic label packages/devtools/client/src/App.tsx:406 — This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC2 · Forms & labels · <input> without a programmatic label · ×1
  • <input> without a programmatic label packages/devtools/client/src/App.tsx:1047 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
AC4 · Keyboard semantics · Click handler on a non-interactive <span> · ×1
  • Click handler on a non-interactive <span> packages/devtools/client/src/App.tsx:1809 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabIndex={0}.
D10 · Test Quality · No assertions (empty test) · ×1
  • No assertions (empty test): should set window title when hideWindowTitle is false packages/cli/src/gemini.test.tsx:392 — Test method has an empty body — it asserts nothing and exercises no code.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
R8 · Dependency Hygiene · Unlisted import '@google/genai' · ×1
  • Unlisted import '@google/genai' integration-tests/context-fidelity.test.ts:11 — Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
R8 · Dependency Hygiene · Unlisted import 'command-exists' · ×1
  • Unlisted import 'command-exists' integration-tests/voice-mode.test.ts:14 — Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
R8 · Dependency Hygiene · Unlisted import 'dotenv' · ×1
  • Unlisted import 'dotenv' scripts/sandbox_command.js:27 — Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
R8 · Dependency Hygiene · Unlisted import 'shell-quote' · ×1
  • Unlisted import 'shell-quote' scripts/run_regression_check.js:20 — Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
R8 · Dependency Hygiene · Unlisted import 'strip-json-comments' · ×1
  • Unlisted import 'strip-json-comments' scripts/sandbox_command.js:23 — Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
R8 · Dependency Hygiene · Unlisted import 'execa' · ×1
  • Unlisted import 'execa' packages/cli/src/config/config.ts:11 — Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
R8 · Dependency Hygiene · Unlisted import 'tinycolor2' · ×1
  • Unlisted import 'tinycolor2' packages/cli/src/ui/themes/theme.ts:18 — Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
R8 · Dependency Hygiene · Unlisted import 'ws' · ×1
  • Unlisted import 'ws' packages/core/src/voice/geminiLiveTranscriptionProvider.ts:7 — Imported but not declared in any reachable REDACTED — installs work only by hoisting accident.
R9 · Circular Imports · Import cycle (6 files) · ×1
  • Import cycle (6 files) packages/cli/src/acp/acpRpcDispatcher.ts:18 — packages/cli/src/acp/acpRpcDispatcher.ts → packages/cli/src/acp/acpSessionManager.ts → packages/cli/src/config/config.ts → packages/cli/src/commands/extensions.tsx → packages/cli/src/gemini.tsx → packages/cli/src/acp/acpStdioTransport.ts → packages/cli/src/acp/acpRpcDispatcher.ts (one verified cycle inside a mutually-dependent group of 13 files)
R9 · Circular Imports · Import cycle (9 files) · ×1
  • Import cycle (9 files) packages/core/index.ts:49 — packages/core/index.ts → packages/core/src/code_assist/codeAssist.ts → packages/core/src/code_assist/oauth2.ts → packages/core/src/code_assist/oauth-credential-storage.ts → packages/core/src/mcp/token-storage/hybrid-token-storage.ts → packages/core/src/mcp/token-storage/keychain-token-storage.ts → packages/core/src/services/keychainService.ts → packages/core/src/telemetry/types.ts → packages/core/src/core/contentGenerator.ts → packages/core/index.ts (one verified cycle inside a mutually-dependent group of 97 files)
Serious — 2094 finding(s)
D8 · Code Coverage · Low coverage · ×158
  • Low coverage: esbuild.config.js esbuild.config.js:1 — 0.0% line coverage (0/167).
  • Low coverage: evals/answer-vs-act.eval.ts evals/answer-vs-act.eval.ts:1 — 0.0% line coverage (0/168).
  • Low coverage: evals/app-test-helper.ts evals/app-test-helper.ts:1 — 0.0% line coverage (0/42).
  • Low coverage: evals/ask_user.eval.ts evals/ask_user.eval.ts:1 — 0.0% line coverage (0/143).
  • Low coverage: REDACTED REDACTED:1 — 0.0% line coverage (0/489).
  • Low coverage: evals/auto_memory_modes.eval.ts evals/auto_memory_modes.eval.ts:1 — 0.0% line coverage (0/360).
  • Low coverage: evals/automated-tool-use.eval.ts evals/automated-tool-use.eval.ts:1 — 0.0% line coverage (0/117).
  • Low coverage: evals/background_processes.eval.ts evals/background_processes.eval.ts:1 — 0.0% line coverage (0/60).
  • Low coverage: evals/calendar-all-day.eval.ts evals/calendar-all-day.eval.ts:1 — 0.0% line coverage (0/27).
  • Low coverage: evals/cli_help_delegation.eval.ts evals/cli_help_delegation.eval.ts:1 — 0.0% line coverage (0/34).
  • Low coverage: evals/component-test-helper.ts evals/component-test-helper.ts:1 — 0.0% line coverage (0/152).
  • Low coverage: evals/concurrency-safety.eval.ts evals/concurrency-safety.eval.ts:1 — 0.0% line coverage (0/39).
  • Low coverage: evals/edit-locations-eval.eval.ts evals/edit-locations-eval.eval.ts:1 — 0.0% line coverage (0/64).
  • Low coverage: evals/file_creation_behavior.eval.ts evals/file_creation_behavior.eval.ts:1 — 0.0% line coverage (0/110).
  • Low coverage: evals/frugalReads.eval.ts evals/frugalReads.eval.ts:1 — 0.0% line coverage (0/285).
  • Low coverage: evals/frugalSearch.eval.ts evals/frugalSearch.eval.ts:1 — 0.0% line coverage (0/63).
  • Low coverage: evals/generalist_agent.eval.ts evals/generalist_agent.eval.ts:1 — 0.0% line coverage (0/44).
  • Low coverage: evals/generalist_delegation.eval.ts evals/generalist_delegation.eval.ts:1 — 0.0% line coverage (0/153).
  • Low coverage: evals/gitRepo.eval.ts evals/gitRepo.eval.ts:1 — 0.0% line coverage (0/86).
  • Low coverage: evals/grep_search_functionality.eval.ts evals/grep_search_functionality.eval.ts:1 — 0.0% line coverage (0/160).
  • Low coverage: evals/hierarchical_memory.eval.ts evals/hierarchical_memory.eval.ts:1 — 0.0% line coverage (0/64).
  • Low coverage: evals/interactive-hang.eval.ts evals/interactive-hang.eval.ts:1 — 0.0% line coverage (0/61).
  • Low coverage: evals/llm-judge.ts evals/llm-judge.ts:1 — 0.0% line coverage (0/114).
  • Low coverage: evals/memory_persistence.eval.ts evals/memory_persistence.eval.ts:1 — 0.0% line coverage (0/551).
  • Low coverage: evals/model_steering.eval.ts evals/model_steering.eval.ts:1 — 0.0% line coverage (0/66).
  • + 133 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×150
  • FunctionTooLong: useGeminiStream.useGeminiStream packages/cli/src/ui/hooks/useGeminiStream.ts:230 — FunctionTooLong — useGeminiStream runs 1513 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1413 over it, 15.13× 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: vim-buffer-actions.handleVimAction packages/cli/src/ui/components/shared/vim-buffer-actions.ts:164 — FunctionTooLong — handleVimAction runs 1187 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1087 over it, 11.87× 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: vim.useVim packages/cli/src/ui/hooks/vim.ts:187 — FunctionTooLong — useVim runs 846 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 746 over it, 8.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.
  • FunctionTooLong: InboxDialog.InboxDialog packages/cli/src/ui/components/InboxDialog.tsx:331 — FunctionTooLong — InboxDialog runs 801 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 701 over it, 8.01× 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: text-buffer.useTextBuffer packages/cli/src/ui/components/shared/text-buffer.ts:2832 — FunctionTooLong — useTextBuffer runs 747 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 647 over it, 7.47× 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: TriageDuplicates.TriageDuplicates packages/cli/src/ui/components/triage/TriageDuplicates.tsx:105 — FunctionTooLong — TriageDuplicates runs 720 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 620 over it, 7.20× 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: sandbox.start_sandbox packages/cli/src/utils/sandbox.ts:120 — FunctionTooLong — start_sandbox runs 642 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 542 over it, 6.42× 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: vim.useVim.handleInput packages/cli/src/ui/hooks/vim.ts:660 — FunctionTooLong — useVim.handleInput runs 537 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 437 over it, 5.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.
  • FunctionTooLong: useAgentStream.useAgentStream packages/cli/src/ui/hooks/useAgentStream.ts:114 — FunctionTooLong — useAgentStream runs 493 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 393 over it, 4.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: slashCommandProcessor.useSlashCommandProcessor packages/cli/src/ui/hooks/slashCommandProcessor.ts:98 — FunctionTooLong — useSlashCommandProcessor runs 492 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 392 over it, 4.92× 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: nonInteractiveCliAgentSession.runNonInteractive packages/cli/src/nonInteractiveCliAgentSession.ts:82 — FunctionTooLong — runNonInteractive runs 480 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 380 over it, 4.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: nonInteractiveCli.runNonInteractive packages/cli/src/nonInteractiveCli.ts:77 — FunctionTooLong — runNonInteractive runs 453 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 353 over it, 4.53× 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: VirtualizedList.VirtualizedList packages/cli/src/ui/components/shared/VirtualizedList.tsx:129 — FunctionTooLong — VirtualizedList runs 453 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 353 over it, 4.53× 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: App.App packages/devtools/client/src/App.tsx:28 — FunctionTooLong — App runs 434 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 334 over it, 4.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: useExecutionLifecycle.useExecutionLifecycle packages/cli/src/ui/hooks/useExecutionLifecycle.ts:77 — FunctionTooLong — useExecutionLifecycle runs 431 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 331 over it, 4.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.
  • FunctionTooLong: useGeminiStream.useGeminiStream.pendingToolGroupItems packages/cli/src/ui/hooks/useGeminiStream.ts:610 — FunctionTooLong — useGeminiStream.pendingToolGroupItems runs 400 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 300 over it, 4.00× 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: AskUserDialog.ChoiceQuestionView packages/cli/src/ui/components/AskUserDialog.tsx:520 — FunctionTooLong — ChoiceQuestionView runs 369 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 269 over it, 3.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: BaseSettingsDialog.BaseSettingsDialog packages/cli/src/ui/components/shared/BaseSettingsDialog.tsx:128 — FunctionTooLong — BaseSettingsDialog runs 363 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 263 over it, 3.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: config.parseArguments packages/cli/src/config/config.ts:166 — FunctionTooLong — parseArguments runs 362 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 262 over it, 3.62× 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: gemini.main packages/cli/src/gemini.tsx:469 — FunctionTooLong — main runs 332 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 232 over it, 3.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.
  • FunctionTooLong: useCommandCompletion.useCommandCompletion packages/cli/src/ui/hooks/useCommandCompletion.tsx:77 — FunctionTooLong — useCommandCompletion runs 295 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 195 over it, 2.95× 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: BackgroundTaskDisplay.BackgroundTaskDisplay packages/cli/src/ui/components/BackgroundTaskDisplay.tsx:64 — FunctionTooLong — BackgroundTaskDisplay runs 294 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 194 over it, 2.94× 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: ToolGroupMessage.ToolGroupMessage packages/cli/src/ui/components/messages/ToolGroupMessage.tsx:89 — FunctionTooLong — ToolGroupMessage runs 292 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 192 over it, 2.92× 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: MainContent.MainContent packages/cli/src/ui/components/MainContent.tsx:87 — FunctionTooLong — MainContent runs 288 significant lines (blank, comment-only and punctuation-only lines excluded) 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: App.NetworkView packages/devtools/client/src/App.tsx:831 — FunctionTooLong — NetworkView runs 286 significant lines (blank, comment-only and punctuation-only lines excluded) 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.
  • + 125 more in this group — see findings.md.
D17 · Explicit Debt · TodoComment · ×68
  • TodoComment tools/caretaker-agent/cloudrun/pr-generator/workflow/orchestrator.py:202 — # TODO: Add logic to fetch and checkout the existing branch if responding to user feedback — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment tools/caretaker-agent/cloudrun/pr-generator/workflow/db/db_interface.py:203 — # TODO: defensive programming for when PR revision is implemented — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/sdk/src/session.ts:90 — // TODO: Revisit this default when we have a mechanism for wiring up approvals — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/sdk/src/session.ts:130 — // TODO: refactor this to use a proper logger interface — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/utils/bfsFileSearch.ts:15 — // TODO: Integrate with a more robust server-side logger. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/utils/extensionLoader.ts:96 — // TODO: Update custom command updating away from the event based system — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/utils/extensionLoader.ts:211 — // TODO: Update custom command updating away from the event based system — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/utils/ignorePatterns.ts:169 — // TODO: getCustomExcludes method needs to be implemented in Config interface — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/utils/ignorePatterns.ts:204 — // TODO: getCustomExcludes method needs to be implemented in Config interface — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/utils/memoryDiscovery.ts:28 — // TODO: Integrate with a more robust server-side logger if available/appropriate. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment REDACTED:877 — // TODO(chrstn): See https://github.com/google-gemini/gemini-cli/pull/5618#discussion_r2255413084
  • TodoComment packages/core/src/tools/shell.ts:1282 — // TODO: Add support for terminal display type (AnsiOutput) — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/telemetry/metrics.ts:1305 — // TODO: Add specific performance monitoring settings to config — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/telemetry/clearcut-logger/clearcut-logger.test.ts:162 — // TODO(richieforeman): Consider moving this to test setup globally. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/cli/src/config/config.integration.test.ts:32 — // TODO(richieforeman): Consider moving this to test setup globally. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/services/modelConfigService.ts:151 — // TODO(12597): Process config to build a typed alias hierarchy. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/services/modelConfigService.ts:656 — // TODO(joshualitt): Consider knobs here, i.e. opt-in to deep merging — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/scheduler/confirmation.ts:85 — // TODO: Remove legacy confirmed boolean fallback once migration complete — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/scheduler/policy.ts:194 — // TODO: This is a temporary fix to enable AUTO_EDIT mode for specific — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/scheduler/scheduler.ts:224 — // TODO: Optimize policy checks. Currently, tools check policy via — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/scheduler/state-manager.ts:412 — // TODO: Remove legacy callback shape once event-driven migration is complete — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/scheduler/state-manager.ts:464 — // TODO: Refactor this tool-specific logic into the confirmation details payload. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/scheduler/types.ts:187 — // TODO: Make required after migration. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/safety/registry.ts:63 — // TODO: Phase 5 - Add support for custom external checkers — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/core/src/routing/strategies/classifierStrategy.ts:149 — // TODO - Consider using function req/res if they help accuracy. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • + 43 more in this group — see findings.md.
D10 · Test Quality · No assertions · ×66
  • No assertions: cold-startup-time: startup completes within baseline perf-tests/perf-usage.test.ts:49 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: idle-cpu-usage: CPU stays low when idle perf-tests/perf-usage.test.ts:76 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: asian-language-conv: verify perf is acceptable perf-tests/perf-usage.test.ts:111 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: skill-loading-time: startup with many skills within baseline perf-tests/perf-usage.test.ts:141 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: high-volume-shell-output: handles large output efficiently perf-tests/perf-usage.test.ts:195 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: session-load: resume a 60MB chat history perf-tests/perf-usage.test.ts:353 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: typing: latency when typing into a large session perf-tests/perf-usage.test.ts:384 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: execution: response latency for a simple shell command perf-tests/perf-usage.test.ts:421 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: terminal-scrolling: latency when scrolling a large terminal buffer perf-tests/perf-usage.test.ts:458 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: alternate-scrolling: latency when scrolling a large alternate buffer perf-tests/perf-usage.test.ts:559 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: should emit addDir and unlinkDir events for directories packages/core/src/utils/filesearch/fileWatcher.test.ts:102 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: should NOT start a timeout if timeoutMs is <= 0 packages/core/src/tools/shell.test.ts:685 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: should allow luci.app packages/core/src/mcp/google-auth-provider.test.ts:50 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: should allow sub.luci.app packages/core/src/mcp/google-auth-provider.test.ts:60 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: should handle invalid callback request packages/core/src/mcp/oauth-provider.test.ts:1089 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: should safely process random response streams in generateContentStream (consumed/remaining credits) packages/core/src/code_assist/server.test.ts:1023 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: should not call connectMcp twice when ensureConnection is called concurrently packages/core/src/agents/browser/browserManager.test.ts:1093 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: should NOT re-inject overlay when tool returns an error result packages/core/src/agents/browser/browserManager.test.ts:1211 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: handles debug mode state packages/cli/src/ui/AppContainer.test.tsx:945 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: handles config methods that might throw packages/cli/src/ui/AppContainer.test.tsx:1029 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: establishes correct provider nesting order packages/cli/src/ui/AppContainer.test.tsx:1054 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: handles resumed session data correctly packages/cli/src/ui/AppContainer.test.tsx:1064 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: renders without resumed session data packages/cli/src/ui/AppContainer.test.tsx:1103 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: initializes chat recording service when config has it packages/cli/src/ui/AppContainer.test.tsx:1116 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: handles extremely small terminal widths without crashing packages/cli/src/ui/utils/TableRenderer.test.tsx:268 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • + 41 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×66
  • FileTooLong: config/settingsSchema.ts packages/cli/src/config/settingsSchema.ts — FileTooLong — 3100 significant lines (blank, comment-only and punctuation-only lines excluded), about 81% of them inside a single declaration: SETTINGS_SCHEMA (163-3046). The bar is 500 significant lines; this is 2600 over it, 6.20× 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: config/config.ts packages/core/src/config/config.ts — FileTooLong — 2733 significant lines (blank, comment-only and punctuation-only lines excluded), about 78% of them inside a single declaration: Config (763-4286). The bar is 500 significant lines; this is 2233 over it, 5.47× 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: shared/text-buffer.ts packages/cli/src/ui/components/shared/text-buffer.ts — FileTooLong — 2701 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2201 over it, 5.40× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: ui/AppContainer.tsx packages/cli/src/ui/AppContainer.tsx — FileTooLong — 2402 significant lines (blank, comment-only and punctuation-only lines excluded), about 90% of them inside a single declaration: AppContainer (338-3226). The bar is 500 significant lines; this is 1902 over it, 4.80× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: telemetry/types.ts packages/core/src/telemetry/types.ts — FileTooLong — 1845 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1345 over it, 3.69× 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: utils/shell-utils.ts packages/core/src/utils/shell-utils.ts — FileTooLong — 1740 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1240 over it, 3.48× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: hooks/useGeminiStream.ts packages/cli/src/ui/hooks/useGeminiStream.ts — FileTooLong — 1687 significant lines (blank, comment-only and punctuation-only lines excluded), about 90% of them inside a single declaration: useGeminiStream (230-2469). The bar is 500 significant lines; this is 1187 over it, 3.37× 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: src/App.tsx packages/devtools/client/src/App.tsx — FileTooLong — 1535 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1035 over it, 3.07× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: tools/mcp-client.ts packages/core/src/tools/mcp-client.ts — FileTooLong — 1481 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 981 over it, 2.96× 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: services/shellExecutionService.ts packages/core/src/services/shellExecutionService.ts — FileTooLong — 1433 significant lines (blank, comment-only and punctuation-only lines excluded), about 83% of them inside a single declaration: ShellExecutionService (400-2256). The bar is 500 significant lines; this is 933 over it, 2.87× 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: components/InputPrompt.tsx packages/cli/src/ui/components/InputPrompt.tsx — FileTooLong — 1400 significant lines (blank, comment-only and punctuation-only lines excluded), about 89% of them inside a single declaration: InputPrompt (207-1939). The bar is 500 significant lines; this is 900 over it, 2.80× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: core/geminiChat.ts packages/core/src/core/geminiChat.ts — FileTooLong — 1398 significant lines (blank, comment-only and punctuation-only lines excluded), about 68% of them inside a single declaration: GeminiChat (446-2011). The bar is 500 significant lines; this is 898 over it, 2.80× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: services/chatRecordingService.ts packages/core/src/services/chatRecordingService.ts — FileTooLong — 1268 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 768 over it, 2.54× 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: telemetry/metrics.ts packages/core/src/telemetry/metrics.ts — FileTooLong — 1260 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 760 over it, 2.52× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: shared/vim-buffer-actions.ts packages/cli/src/ui/components/shared/vim-buffer-actions.ts — FileTooLong — 1255 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: handleVimAction (164-1849). The bar is 500 significant lines; this is 755 over it, 2.51× 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: clearcut-logger/clearcut-logger.ts packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts — FileTooLong — 1233 significant lines (blank, comment-only and punctuation-only lines excluded), about 83% of them inside a single declaration: ClearcutLogger (294-2205). The bar is 500 significant lines; this is 733 over it, 2.47× 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: acp/acpSession.ts packages/cli/src/acp/acpSession.ts — FileTooLong — 1082 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: Session (67-1586). The bar is 500 significant lines; this is 582 over it, 2.16× 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: config/settings.ts packages/cli/src/config/settings.ts — FileTooLong — 1068 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 568 over it, 2.14× 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 — 1034 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 534 over it, 2.07× 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: agents/local-executor.ts packages/core/src/agents/local-executor.ts — FileTooLong — 1029 significant lines (blank, comment-only and punctuation-only lines excluded), about 89% of them inside a single declaration: LocalAgentExecutor (133-1603). The bar is 500 significant lines; this is 529 over it, 2.06× 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: config/extension-manager.ts packages/cli/src/config/extension-manager.ts — FileTooLong — 1027 significant lines (blank, comment-only and punctuation-only lines excluded), about 75% of them inside a single declaration: ExtensionManager (127-1308). The bar is 500 significant lines; this is 527 over it, 2.05× 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: components/InboxDialog.tsx packages/cli/src/ui/components/InboxDialog.tsx — FileTooLong — 1008 significant lines (blank, comment-only and punctuation-only lines excluded), about 79% of them inside a single declaration: InboxDialog (331-1446). The bar is 500 significant lines; this is 508 over it, 2.02× 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: agent/task.ts packages/a2a-server/src/agent/task.ts — FileTooLong — 985 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: Task (75-1400). The bar is 500 significant lines; this is 485 over it, 1.97× 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: utils/sandbox.ts packages/cli/src/utils/sandbox.ts — FileTooLong — 976 significant lines (blank, comment-only and punctuation-only lines excluded), about 66% of them inside a single declaration: start_sandbox (120-1180). The bar is 500 significant lines; this is 476 over it, 1.95× 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: hooks/vim.ts packages/cli/src/ui/hooks/vim.ts — FileTooLong — 974 significant lines (blank, comment-only and punctuation-only lines excluded), about 87% of them inside a single declaration: useVim (187-1536). The bar is 500 significant lines; this is 474 over it, 1.95× 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.
  • + 41 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×64
  • Hotspot: packages/cli/src/ui/AppContainer.tsx packages/cli/src/ui/AppContainer.tsx:338 — packages/cli/src/ui/AppContainer.tsx changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 316 in AppContainer.AppContainer at line 338. 13 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/cli/src/ui/AppContainer.tsx`: 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: packages/cli/src/ui/components/InputPrompt.tsx packages/cli/src/ui/components/InputPrompt.tsx:207 — packages/cli/src/ui/components/InputPrompt.tsx changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 354 in InputPrompt.InputPrompt at line 207. 5 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/cli/src/ui/components/InputPrompt.tsx`: 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: packages/core/src/services/shellExecutionService.ts packages/core/src/services/shellExecutionService.ts:1266 — packages/core/src/services/shellExecutionService.ts changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 79 in ShellExecutionService.executeWithPty at line 1266. 12 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/core/src/services/shellExecutionService.ts`: 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: packages/core/src/tools/shell.ts packages/core/src/tools/shell.ts:635 — packages/core/src/tools/shell.ts changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 134 in ShellToolInvocation.execute at line 635. 7 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/core/src/tools/shell.ts`: 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: packages/core/src/core/geminiChat.ts packages/core/src/core/geminiChat.ts:1590 — packages/core/src/core/geminiChat.ts changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 78 in GeminiChat.processStreamResponse at line 1590. 12 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/core/src/core/geminiChat.ts`: 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: packages/cli/src/acp/acpSession.ts packages/cli/src/acp/acpSession.ts:1007 — packages/cli/src/acp/acpSession.ts changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 93 in Session.#resolvePrompt at line 1007. 9 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/cli/src/acp/acpSession.ts`: 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: packages/cli/src/utils/sandbox.ts packages/cli/src/utils/sandbox.ts:120 — packages/cli/src/utils/sandbox.ts changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 157 in sandbox.start_sandbox at line 120. 4 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/cli/src/utils/sandbox.ts`: 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: packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx:65 — packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 156 in ToolConfirmationMessage.ToolConfirmationMessage at line 65. 5 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx`: 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: packages/cli/src/config/config.ts packages/cli/src/config/config.ts:663 — packages/cli/src/config/config.ts changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 103 in config.loadCliConfig at line 663. 4 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/cli/src/config/config.ts`: 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: packages/cli/src/ui/hooks/useGeminiStream.ts packages/cli/src/ui/hooks/useGeminiStream.ts:230 — packages/cli/src/ui/hooks/useGeminiStream.ts changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 66 in useGeminiStream.useGeminiStream at line 230. 6 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/cli/src/ui/hooks/useGeminiStream.ts`: 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: packages/core/src/policy/policy-engine.ts packages/core/src/policy/policy-engine.ts:730 — packages/core/src/policy/policy-engine.ts changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 67 in PolicyEngine.check at line 730. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/core/src/policy/policy-engine.ts`: 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: packages/cli/src/nonInteractiveCliAgentSession.ts packages/cli/src/nonInteractiveCliAgentSession.ts:82 — packages/cli/src/nonInteractiveCliAgentSession.ts changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 128 in nonInteractiveCliAgentSession.runNonInteractive at line 82. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/cli/src/nonInteractiveCliAgentSession.ts`: 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: packages/cli/src/nonInteractiveCli.ts packages/cli/src/nonInteractiveCli.ts:77 — packages/cli/src/nonInteractiveCli.ts changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 111 in nonInteractiveCli.runNonInteractive at line 77. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/cli/src/nonInteractiveCli.ts`: 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: packages/cli/src/gemini.tsx packages/cli/src/gemini.tsx:469 — packages/cli/src/gemini.tsx changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 77 in gemini.main at line 469. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/cli/src/gemini.tsx`: 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: packages/core/src/services/chatRecordingService.ts packages/core/src/services/chatRecordingService.ts:1548 — packages/core/src/services/chatRecordingService.ts changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 57 in ChatRecordingService.updateMessagesFromHistory at line 1548. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/core/src/services/chatRecordingService.ts`: 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: packages/core/src/config/models.ts packages/core/src/config/models.ts:213 — packages/core/src/config/models.ts changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 45 in models.resolveModel at line 213. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/core/src/config/models.ts`: 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: packages/cli/src/config/extension-manager.ts packages/cli/src/config/extension-manager.ts:202 — packages/cli/src/config/extension-manager.ts changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 63 in ExtensionManager.installOrUpdateExtension at line 202. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/cli/src/config/extension-manager.ts`: 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: packages/cli/src/ui/components/MainContent.tsx packages/cli/src/ui/components/MainContent.tsx:87 — packages/cli/src/ui/components/MainContent.tsx changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in MainContent.MainContent at line 87. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/cli/src/ui/components/MainContent.tsx`: 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: packages/core/src/utils/retry.ts packages/core/src/utils/retry.ts:284 — packages/core/src/utils/retry.ts changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 67 in retry.retryWithBackoff at line 284. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/core/src/utils/retry.ts`: 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: packages/a2a-server/src/agent/executor.ts packages/a2a-server/src/agent/executor.ts:441 — packages/a2a-server/src/agent/executor.ts changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 67 in CoderAgentExecutor.execute at line 441. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/a2a-server/src/agent/executor.ts`: 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: packages/core/src/mcp/oauth-provider.ts packages/core/src/mcp/oauth-provider.ts:315 — packages/core/src/mcp/oauth-provider.ts changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in MCPOAuthProvider.authenticate at line 315. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/core/src/mcp/oauth-provider.ts`: 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: packages/core/src/config/config.ts packages/core/src/config/config.ts:1004 — packages/core/src/config/config.ts changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in Config.constructor at line 1004. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/core/src/config/config.ts`: 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: packages/cli/src/ui/components/messages/ToolGroupMessage.tsx packages/cli/src/ui/components/messages/ToolGroupMessage.tsx:89 — packages/cli/src/ui/components/messages/ToolGroupMessage.tsx changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 83 in ToolGroupMessage.ToolGroupMessage at line 89. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/cli/src/ui/components/messages/ToolGroupMessage.tsx`: 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: packages/cli/src/ui/hooks/atCommandProcessor.ts packages/cli/src/ui/hooks/atCommandProcessor.ts:239 — packages/cli/src/ui/hooks/atCommandProcessor.ts changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in atCommandProcessor.resolveFilePaths at line 239. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/cli/src/ui/hooks/atCommandProcessor.ts`: 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: packages/core/src/context/chatCompressionService.ts packages/core/src/context/chatCompressionService.ts:177 — packages/core/src/context/chatCompressionService.ts changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in chatCompressionService.collapseOlderFunctionResponses at line 177. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/core/src/context/chatCompressionService.ts`: 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.
  • + 39 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×60
  • MethodTooLong: ShellToolInvocation.execute packages/core/src/tools/shell.ts:635 — MethodTooLong — execute runs 481 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 381 over it, 4.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.
  • MethodTooLong: ShellExecutionService.executeWithPty packages/core/src/services/shellExecutionService.ts:1266 — MethodTooLong — executeWithPty runs 423 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 323 over it, 4.23× 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: Session.#resolvePrompt packages/cli/src/acp/acpSession.ts:1007 — MethodTooLong — #resolvePrompt runs 389 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 289 over it, 3.89× 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: CoderAgentExecutor.execute packages/a2a-server/src/agent/executor.ts:441 — MethodTooLong — execute runs 360 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 260 over it, 3.60× 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.constructor packages/core/src/config/config.ts:1004 — MethodTooLong — constructor runs 355 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 255 over it, 3.55× 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: ExtensionManager.installOrUpdateExtension packages/cli/src/config/extension-manager.ts:202 — MethodTooLong — installOrUpdateExtension runs 278 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 178 over it, 2.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: ShellExecutionService.childProcessFallback packages/core/src/services/shellExecutionService.ts:688 — MethodTooLong — childProcessFallback runs 259 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 159 over it, 2.59× 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: BrowserAgentInvocation.execute packages/core/src/agents/browser/browserAgentInvocation.ts:111 — MethodTooLong — execute runs 242 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 142 over it, 2.42× 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: GeminiChat.sendMessageStream packages/core/src/core/geminiChat.ts:546 — MethodTooLong — sendMessageStream runs 233 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 133 over it, 2.33× 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: PolicyEngine.check packages/core/src/policy/policy-engine.ts:730 — MethodTooLong — check runs 230 significant lines (blank, comment-only and punctuation-only lines excluded) 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: Session.runTool packages/cli/src/acp/acpSession.ts:684 — MethodTooLong — runTool runs 229 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 129 over it, 2.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.
  • MethodTooLong: ActivityLogger.patchNodeHttp REDACTED:442 — MethodTooLong — patchNodeHttp runs 229 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 129 over it, 2.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.
  • MethodTooLong: GeminiChat.makeApiCallAndProcessStream packages/core/src/core/geminiChat.ts:1029 — MethodTooLong — makeApiCallAndProcessStream runs 224 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 124 over it, 2.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.
  • MethodTooLong: ReadManyFilesToolInvocation.execute packages/core/src/tools/read-many-files.ts:232 — MethodTooLong — execute runs 220 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 120 over it, 2.20× 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: LocalAgentExecutor.runInternal packages/core/src/agents/local-executor.ts:584 — MethodTooLong — runInternal runs 218 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 118 over it, 2.18× 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: GeminiChat.processStreamResponse packages/core/src/core/geminiChat.ts:1590 — MethodTooLong — processStreamResponse runs 218 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 118 over it, 2.18× 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: LocalSessionInvocation.execute packages/core/src/agents/local-session-invocation.ts:111 — MethodTooLong — execute runs 211 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 111 over it, 2.11× 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: Session.prompt packages/cli/src/acp/acpSession.ts:337 — MethodTooLong — prompt runs 208 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 108 over it, 2.08× 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: MCPOAuthProvider.authenticate packages/core/src/mcp/oauth-provider.ts:315 — MethodTooLong — authenticate runs 202 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 102 over it, 2.02× 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: ExtensionManager._buildExtension packages/cli/src/config/extension-manager.ts:759 — MethodTooLong — _buildExtension runs 198 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 98 over it, 1.98× 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: GeminiClient.processTurn packages/core/src/core/client.ts:654 — MethodTooLong — processTurn runs 197 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 97 over it, 1.97× 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: LocalSubagentInvocation.execute packages/core/src/agents/local-invocation.ts:102 — MethodTooLong — execute runs 192 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 92 over it, 1.92× 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: PromptProvider.getCoreSystemPrompt packages/core/src/prompts/promptProvider.ts:47 — MethodTooLong — getCoreSystemPrompt runs 186 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 86 over it, 1.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: LocalAgentExecutor.processFunctionCalls packages/core/src/agents/local-executor.ts:1148 — MethodTooLong — processFunctionCalls runs 178 significant lines (blank, comment-only and punctuation-only lines excluded) 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: ToolExecutor.truncateOutputIfNeeded packages/core/src/scheduler/tool-executor.ts:210 — MethodTooLong — truncateOutputIfNeeded runs 178 significant lines (blank, comment-only and punctuation-only lines excluded) 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.
  • + 35 more in this group — see findings.md.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×40
  • Sync-over-async blocking evals/component-test-helper.ts:112 — `fs.rmSync` in `cleanup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/component-test-helper.ts:113 — `fs.rmSync` in `cleanup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/test-helper.ts:133 — `fs.realpathSync` in `callback to withEvalRetries` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/test-helper.ts:136 — `fs.mkdirSync` in `callback to withEvalRetries` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/test-helper.ts:140 — `fs.realpathSync` in `callback to withEvalRetries` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/test-helper.ts:151 — `fs.writeFileSync` in `callback to withEvalRetries` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/test-helper.ts:295 — `fs.realpathSync` in `prepareWorkspace` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/test-helper.ts:306 — `fs.mkdirSync` in `prepareWorkspace` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/test-helper.ts:307 — `fs.writeFileSync` in `prepareWorkspace` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/test-helper.ts:336 — `fs.mkdirSync` in `prepareWorkspace` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/test-helper.ts:337 — `fs.writeFileSync` in `prepareWorkspace` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/test-helper.ts:341 — `execSync` in `prepareWorkspace` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/test-helper.ts:342 — `execSync` in `prepareWorkspace` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/test-helper.ts:343 — `execSync` in `prepareWorkspace` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/test-helper.ts:349 — `execSync` in `prepareWorkspace` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/test-helper.ts:350 — `execSync` in `prepareWorkspace` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/test-helper.ts:351 — `execSync` in `prepareWorkspace` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/test-helper.ts:352 — `execSync` in `prepareWorkspace` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking evals/test-helper.ts:353 — `execSync` in `prepareWorkspace` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking packages/a2a-server/src/commands/init.ts:83 — `fs.writeFileSync` in `handleSubmitPromptResult` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking packages/a2a-server/src/commands/init.ts:142 — `fs.existsSync` in `execute` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking packages/a2a-server/src/persistence/gcs.ts:114 — `gzipSync` in `save` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking packages/a2a-server/src/persistence/gcs.ts:248 — `gunzipSync` in `load` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking packages/cli/src/acp/commands/init.ts:31 — `fs.existsSync` in `execute` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking packages/cli/src/acp/commands/init.ts:40 — `fs.writeFileSync` in `execute` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • + 15 more in this group — see findings.md.
D3 · God Classes · ClassTooLong · ×35
  • ClassTooLong: AppContainer packages/cli/src/ui/AppContainer.tsx:1 — ClassTooLong — 2150 significant lines (blank, comment-only and punctuation-only lines excluded), 3 methods. The bar is 400 significant lines; this is 1750 over it, 5.38× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Config packages/core/src/config/config.ts:763 — ClassTooLong — 2139 significant lines (blank, comment-only and punctuation-only lines excluded), 276 methods. The bar is 400 significant lines; this is 1739 over it, 5.35× 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: useGeminiStream packages/cli/src/ui/hooks/useGeminiStream.ts:1 — ClassTooLong — 1513 significant lines (blank, comment-only and punctuation-only lines excluded), 33 methods. The bar is 400 significant lines; this is 1113 over it, 3.78× 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: InputPrompt packages/cli/src/ui/components/InputPrompt.tsx:1 — ClassTooLong — 1244 significant lines (blank, comment-only and punctuation-only lines excluded), 5 methods. The bar is 400 significant lines; this is 844 over it, 3.11× 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: ShellExecutionService packages/core/src/services/shellExecutionService.ts:400 — ClassTooLong — 1193 significant lines (blank, comment-only and punctuation-only lines excluded), 25 methods. The bar is 400 significant lines; this is 793 over it, 2.98× 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: ClearcutLogger packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts:294 — ClassTooLong — 1027 significant lines (blank, comment-only and punctuation-only lines excluded), 71 methods. The bar is 400 significant lines; this is 627 over it, 2.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Session packages/cli/src/acp/acpSession.ts:67 — ClassTooLong — 1025 significant lines (blank, comment-only and punctuation-only lines excluded), 18 methods. The bar is 400 significant lines; this is 625 over it, 2.56× 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: GeminiChat packages/core/src/core/geminiChat.ts:446 — ClassTooLong — 955 significant lines (blank, comment-only and punctuation-only lines excluded), 26 methods. The bar is 400 significant lines; this is 555 over it, 2.39× 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: Task packages/a2a-server/src/agent/task.ts:75 — ClassTooLong — 919 significant lines (blank, comment-only and punctuation-only lines excluded), 31 methods. The bar is 400 significant lines; this is 519 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.
  • ClassTooLong: LocalAgentExecutor packages/core/src/agents/local-executor.ts:133 — ClassTooLong — 919 significant lines (blank, comment-only and punctuation-only lines excluded), 18 methods. The bar is 400 significant lines; this is 519 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.
  • ClassTooLong: GeminiClient packages/core/src/core/client.ts:99 — ClassTooLong — 850 significant lines (blank, comment-only and punctuation-only lines excluded), 35 methods. The bar is 400 significant lines; this is 450 over it, 2.13× 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: ShellToolInvocation packages/core/src/tools/shell.ts:110 — ClassTooLong — 822 significant lines (blank, comment-only and punctuation-only lines excluded), 15 methods. The bar is 400 significant lines; this is 422 over it, 2.06× 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: ToolConfirmationMessage packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx:1 — ClassTooLong — 818 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 418 over it, 2.05× 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: InboxDialog packages/cli/src/ui/components/InboxDialog.tsx:1 — ClassTooLong — 801 significant lines (blank, comment-only and punctuation-only lines excluded), 9 methods. The bar is 400 significant lines; this is 401 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: ExtensionManager packages/cli/src/config/extension-manager.ts:127 — ClassTooLong — 775 significant lines (blank, comment-only and punctuation-only lines excluded), 21 methods. The bar is 400 significant lines; this is 375 over it, 1.94× 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: ChatRecordingService packages/core/src/services/chatRecordingService.ts:685 — ClassTooLong — 726 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods. The bar is 400 significant lines; this is 326 over it, 1.82× 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: TriageDuplicates packages/cli/src/ui/components/triage/TriageDuplicates.tsx:1 — ClassTooLong — 720 significant lines (blank, comment-only and punctuation-only lines excluded), 3 methods. The bar is 400 significant lines; this is 320 over it, 1.80× 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: PolicyEngine packages/core/src/policy/policy-engine.ts:243 — ClassTooLong — 622 significant lines (blank, comment-only and punctuation-only lines excluded), 23 methods. The bar is 400 significant lines; this is 222 over it, 1.56× 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: CoderAgentExecutor packages/a2a-server/src/agent/executor.ts:101 — ClassTooLong — 596 significant lines (blank, comment-only and punctuation-only lines excluded), 10 methods. The bar is 400 significant lines; this is 196 over it, 1.49× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Scheduler packages/core/src/scheduler/scheduler.ts:139 — ClassTooLong — 577 significant lines (blank, comment-only and punctuation-only lines excluded), 18 methods. The bar is 400 significant lines; this is 177 over it, 1.44× 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: ThemeManager packages/cli/src/ui/themes/theme-manager.ts:96 — ClassTooLong — 516 significant lines (blank, comment-only and punctuation-only lines excluded), 33 methods. The bar is 400 significant lines; this is 116 over it, 1.29× 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: useAgentStream packages/cli/src/ui/hooks/useAgentStream.ts:1 — ClassTooLong — 493 significant lines (blank, comment-only and punctuation-only lines excluded), 13 methods. The bar is 400 significant lines; this is 93 over it, 1.23× 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: EditToolInvocation REDACTED:463 — ClassTooLong — 474 significant lines (blank, comment-only and punctuation-only lines excluded), 10 methods. The bar is 400 significant lines; this is 74 over it, 1.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: TriageIssues packages/cli/src/ui/components/triage/TriageIssues.tsx:1 — ClassTooLong — 470 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 70 over it, 1.18× 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: BrowserManager REDACTED:113 — ClassTooLong — 464 significant lines (blank, comment-only and punctuation-only lines excluded), 22 methods. The bar is 400 significant lines; this is 64 over it, 1.16× 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.
  • + 10 more in this group — see findings.md.
R11 · Import Boundaries · Boundary violation [package · ×33
  • Boundary violation [package:relative-cross-package] evals/app-test-helper.ts:7 — evals/app-test-helper.ts:7 reaches into another package with a relative path (../packages/cli/src/test-utils/AppRig.js) — import the package by name instead.
  • Boundary violation [package:test-suite-dependency] evals/app-test-helper.ts:7 — evals/app-test-helper.ts:7 imports packages/cli/src/test-utils/AppRig.tsx, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on.
  • Boundary violation [package:relative-cross-package] evals/auto_memory_modes.eval.ts:12 — evals/auto_memory_modes.eval.ts:12 reaches into another package with a relative path (../packages/core/src/services/chatRecordingService.js) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] evals/auto_memory_modes.eval.ts:332 — evals/auto_memory_modes.eval.ts:332 reaches into another package with a relative path (../packages/core/src/services/memoryService.js) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] evals/auto_memory_modes.eval.ts:389 — evals/auto_memory_modes.eval.ts:389 reaches into another package with a relative path (../packages/core/src/services/memoryService.js) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] evals/component-test-helper.ts:31 — evals/component-test-helper.ts:31 reaches into another package with a relative path (../packages/cli/src/test-utils/settings.js) — import the package by name instead.
  • Boundary violation [package:test-suite-dependency] evals/component-test-helper.ts:31 — evals/component-test-helper.ts:31 imports packages/cli/src/test-utils/settings.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on.
  • Boundary violation [package:test-suite-dependency] evals/test-helper.ts:12 — evals/test-helper.ts:12 imports packages/test-utils/src/index.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on.
  • Boundary violation [package:test-suite-dependency] evals/test-helper.ts:24 — evals/test-helper.ts:24 imports packages/test-utils/src/index.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on.
  • Boundary violation [package:test-cross-package-internals] integration-tests/globalSetup.ts:15 — integration-tests/globalSetup.ts:15 reaches past another workspace package's public entry into its internals with a relative path (../packages/core/src/tools/ripGrep.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
  • Boundary violation [package:test-cross-package-internals] integration-tests/google_web_search.test.ts:7 — integration-tests/google_web_search.test.ts:7 reaches past another workspace package's public entry into its internals with a relative path (../packages/core/src/tools/tool-names.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
  • Boundary violation [package:test-cross-package-internals] integration-tests/ripgrep-real.test.ts:11 — integration-tests/ripgrep-real.test.ts:11 reaches past another workspace package's public entry into its internals with a relative path (../packages/core/src/tools/ripGrep.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
  • Boundary violation [package:test-cross-package-internals] integration-tests/ripgrep-real.test.ts:15 — integration-tests/ripgrep-real.test.ts:15 reaches past another workspace package's public entry into its internals with a relative path (../packages/core/src/config/config.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
  • Boundary violation [package:test-cross-package-internals] integration-tests/ripgrep-real.test.ts:16 — integration-tests/ripgrep-real.test.ts:16 reaches past another workspace package's public entry into its internals with a relative path (../packages/core/src/utils/workspaceContext.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
  • Boundary violation [package:test-cross-package-internals] integration-tests/run_shell_command.test.ts:14 — integration-tests/run_shell_command.test.ts:14 reaches past another workspace package's public entry into its internals with a relative path (../packages/core/src/utils/shell-utils.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
  • Boundary violation [package:test-cross-package-internals] memory-tests/globalSetup.ts:10 — memory-tests/globalSetup.ts:10 reaches past another workspace package's public entry into its internals with a relative path (../packages/core/src/tools/ripGrep.js) — the test is coupled to a file layout that package makes no promise about, so a refactor behind its entry point breaks the suite. Import the package by name instead.
  • Boundary violation [package:relative-cross-package] packages/cli/src/patches/http-proxy-agent.ts:12 — packages/cli/src/patches/http-proxy-agent.ts:12 reaches into another package with a relative path (../../../../node_modules/http-proxy-agent/dist/index.js) — import the package by name instead.
  • Boundary violation [package:relative-cross-package] packages/cli/src/patches/https-proxy-agent.ts:12 — packages/cli/src/patches/https-proxy-agent.ts:12 reaches into another package with a relative path (../../../../node_modules/https-proxy-agent/dist/index.js) — import the package by name instead.
  • Boundary violation [package:undeclared-workspace-dep] REDACTED:63 — REDACTED:63 imports @google/gemini-cli-devtools, a package this repository publishes, but this package's own REDACTED does not list it in dependencies (or peer/optional dependencies) — it resolves only through the workspace link, so an installed copy of this package is missing it. Add it to this package's dependencies.
  • Boundary violation [package:third-party-deep-import] packages/core/src/utils/schemaValidator.ts:10 — packages/core/src/utils/schemaValidator.ts:10 imports ajv/dist/2020.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:undeclared-workspace-dep] packages/vscode-ide-companion/src/diff-manager.ts:7 — packages/vscode-ide-companion/src/diff-manager.ts:7 imports @google/gemini-cli-core/src/ide/types.js, a package this repository publishes, but this package's own REDACTED does not list it in dependencies (or peer/optional dependencies) — it resolves only through the workspace link, so an installed copy of this package is missing it. Add it to this package's dependencies.
  • Boundary violation [package:undeclared-workspace-dep] packages/vscode-ide-companion/src/extension.ts:12 — packages/vscode-ide-companion/src/extension.ts:12 imports @google/gemini-cli-core/src/ide/detect-ide.js, a package this repository publishes, but this package's own REDACTED does not list it in dependencies (or peer/optional dependencies) — it resolves only through the workspace link, so an installed copy of this package is missing it. Add it to this package's dependencies.
  • Boundary violation [package:undeclared-workspace-dep] packages/vscode-ide-companion/src/ide-server.ts:8 — packages/vscode-ide-companion/src/ide-server.ts:8 imports @google/gemini-cli-core/src/ide/types.js, a package this repository publishes, but this package's own REDACTED does not list it in dependencies (or peer/optional dependencies) — it resolves only through the workspace link, so an installed copy of this package is missing it. Add it to this package's dependencies.
  • Boundary violation [package:undeclared-workspace-dep] packages/vscode-ide-companion/src/ide-server.ts:26 — packages/vscode-ide-companion/src/ide-server.ts:26 imports @google/gemini-cli-core/src/utils/paths.js, a package this repository publishes, but this package's own REDACTED does not list it in dependencies (or peer/optional dependencies) — it resolves only through the workspace link, so an installed copy of this package is missing it. Add it to this package's dependencies.
  • Boundary violation [package:undeclared-workspace-dep] packages/vscode-ide-companion/src/open-files-manager.ts:8 — packages/vscode-ide-companion/src/open-files-manager.ts:8 imports @google/gemini-cli-core/src/ide/ideContext.js, a package this repository publishes, but this package's own REDACTED does not list it in dependencies (or peer/optional dependencies) — it resolves only through the workspace link, so an installed copy of this package is missing it. Add it to this package's dependencies.
  • + 8 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED · ×30
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 5 more in this group — see findings.md.
D30 · Dependency Vulnerabilities · Medium CVE · ×25
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D10 · Test Quality · Skipped test · ×22
  • Skipped test: returns secure=false if ancestor directory of normalized path is insecure packages/core/src/utils/security.test.ts:846 — Skipped — switched off by it.skip
  • Skipped test: returns secure=false if ancestor directory of canonical target is insecure packages/core/src/utils/security.test.ts:1002 — Skipped — switched off by it.skip
  • Skipped test: returns secure=false if grandparent directory is an insecure symlink packages/core/src/utils/security.test.ts:1110 — Skipped — switched off by it.skip
  • Skipped test: will not attempt to compress context after a failure packages/core/src/core/client.test.ts:620 — Skipped — switched off by it.skip
  • Skipped test: should replace an existing dynamic policy when an agent is overwritten packages/core/src/agents/registry.test.ts:1242 — Skipped — switched off by it.skip
  • Skipped test: should log error when cleanupExpiredSessions fails packages/cli/src/gemini.test.tsx:1012 — Skipped — switched off by it.skip
  • Skipped test: should log error when cleanupExpiredSessions fails packages/cli/src/gemini_cleanup.test.tsx:203 — Skipped — switched off by it.skip
  • Skipped test: should combine and resolve paths from settings and CLI arguments packages/cli/src/config/config.test.ts:2035 — Skipped — switched off by it.skip
  • Skipped test: should handle compression failure on token inflation integration-tests/context-compress-interactive.test.ts:66 — Skipped — switched off by it.skip
  • Skipped test: installs a local extension, updates it, checks it was reloaded properly integration-tests/extensions-reload.test.ts:27 — Skipped — switched off by it.skip
  • Skipped test: should replace multiple instances of a string integration-tests/file-system.test.ts:178 — Skipped — switched off by it.skip
  • Skipped test: should switch from a pro model to a flash model after exiting plan mode integration-tests/plan-mode.test.ts:235 — Skipped — switched off by it.skip
  • Skipped test: should be able to read multiple files integration-tests/read_many_files.test.ts:24 — Skipped — switched off by it.skip
  • Skipped test: should handle $ literally when replacing text ending with $ integration-tests/replace.test.ts:39 — Skipped — switched off by it.skip
  • Skipped test: should insert a multi-line block of text integration-tests/replace.test.ts:61 — Skipped — switched off by it.skip
  • Skipped test: should delete a block of text integration-tests/replace.test.ts:81 — Skipped — switched off by it.skip
  • Skipped test: should run allowed sub-command in non-interactive mode integration-tests/run_shell_command.test.ts:169 — Skipped — switched off by it.skip
  • Skipped test: should succeed with no parens in non-interactive mode integration-tests/run_shell_command.test.ts:213 — Skipped — switched off by it.skip
  • Skipped test: should work with ShellTool alias integration-tests/run_shell_command.test.ts:286 — Skipped — switched off by it.skip
  • Skipped test: should combine multiple --allowed-tools flags integration-tests/run_shell_command.test.ts:331 — Skipped — switched off by it.skip
  • Skipped test: should reject chained commands when only the first segment is allowlisted in non-interactive mode integration-tests/run_shell_command.test.ts:448 — Skipped — switched off by it.skip
  • Skipped test: should run a platform-specific file listing command integration-tests/run_shell_command.test.ts:559 — Skipped — switched off by it.skip
D35 · Change Coupling · Change coupling · ×20
  • Change coupling: default-legacy.ts ↔ gemini-3.ts packages/core/src/tools/definitions/model-family-sets/default-legacy.ts:1 — `packages/core/src/tools/definitions/model-family-sets/default-legacy.ts` and `packages/core/src/tools/definitions/model-family-sets/gemini-3.ts` change together 93% of the time (14 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 between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise 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 `120dfc72` fix(core): update read_file schema for v1 compatibility (#22183) (#26…; `f16f1cce` feat(core): add tools to list and read MCP resources (#25395); `e7f8d9cf` Revert "feat: Introduce an AI-driven interactive shell mode with new" — run `git show` on any of them.
  • Change coupling: AboutBox.tsx ↔ types.ts packages/cli/src/ui/components/AboutBox.tsx:1 — `packages/cli/src/ui/components/AboutBox.tsx` and `packages/cli/src/ui/types.ts` change together 80% of the time (8 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) 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 `bee1267e` feat(cli): add user identity info to stats command (#17612); `5c649d8d` feat(ui): display user tier in about command (#17400); `43d6dc36` Add User email detail to about box (#13459) — run `git show` on any of them.
  • Change coupling: event-metadata-key.ts ↔ types.ts packages/core/src/telemetry/clearcut-logger/event-metadata-key.ts:1 — `packages/core/src/telemetry/clearcut-logger/event-metadata-key.ts` and `packages/core/src/telemetry/types.ts` change together 72% of the time (49 of the 68 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 49 shared commits counted here, the most recent 3 are `397ff84b` Refine onboarding metrics to log the duration explicitly and use the …; `244a6081` feat(core): set up onboarding telemetry (#23118); `b459e1a1` feat(telemetry): track if session is running in a Git worktree (#23265) — run `git show` on any of them.
  • Change coupling: snippets.ts ↔ dynamic-declaration-helpers.ts packages/core/src/prompts/snippets.ts:1 — `packages/core/src/prompts/snippets.ts` and `packages/core/src/tools/definitions/dynamic-declaration-helpers.ts` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) 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 7 shared commits counted here, the most recent 3 are `e7f8d9cf` Revert "feat: Introduce an AI-driven interactive shell mode with new"; `651ad63e` feat: Introduce an AI-driven interactive shell mode with new `read-sh…; `ca43f8c2` feat(core): prioritize discussion before formal plan approval (#24423) — run `git show` on any of them.
  • Change coupling: constants.ts ↔ types.ts packages/core/src/telemetry/constants.ts:1 — `packages/core/src/telemetry/constants.ts` and `packages/core/src/telemetry/types.ts` change together 63% of the time (19 of the 30 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 between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 19 shared commits counted here, the most recent 3 are `83075b28` refactor: make log/event structure clear (#10467); `70610c74` feat(telemetry): Add telemetry for web_fetch fallback attempts (#10749); `c0552ceb` feat(core): add telemetry for subagent execution (#10456) — run `git show` on any of them.
  • Change coupling: UIStateContext.tsx ↔ nonInteractiveUi.ts packages/cli/src/ui/contexts/UIStateContext.tsx:1 — `packages/cli/src/ui/contexts/UIStateContext.tsx` and `packages/cli/src/ui/noninteractive/nonInteractiveUi.ts` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) 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 `1f1cf756` Add shortcuts hint and panel for discoverability (#18035); `902e5d6d` feat(cli): Add state management and plumbing for agent configuration …; `9786c4dc` Check folder trust before allowing add directory (#12652) — run `git show` on any of them.
  • Change coupling: event-metadata-key.ts ↔ loggers.ts packages/core/src/telemetry/clearcut-logger/event-metadata-key.ts:1 — `packages/core/src/telemetry/clearcut-logger/event-metadata-key.ts` and `packages/core/src/telemetry/loggers.ts` change together 56% of the time (38 of the 68 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 38 shared commits counted here, the most recent 3 are `4c5e8877` feat(telemetry): add browser agent clearcut metrics (#24688); `397ff84b` Refine onboarding metrics to log the duration explicitly and use the …; `244a6081` feat(core): set up onboarding telemetry (#23118) — run `git show` on any of them.
  • Change coupling: App.tsx ↔ ContextSummaryDisplay.tsx packages/cli/src/ui/App.tsx:1 — `packages/cli/src/ui/App.tsx` and `packages/cli/src/ui/components/ContextSummaryDisplay.tsx` change together 56% of the time (10 of the 18 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 10 shared commits counted here, the most recent 3 are `4f2974db` feat(ui): Improve UI layout adaptation for narrow terminals (#5651); `e2754416` Updates schema, UX and prompt for IDE context (#5046); `1d3ad9d0` Add drawer for active files in IDE mode (#4682) — run `git show` on any of them.
  • Change coupling: policy-engine.ts ↔ toml-loader.ts packages/core/src/policy/policy-engine.ts:1 — `packages/core/src/policy/policy-engine.ts` and `packages/core/src/policy/toml-loader.ts` change together 55% of the time (11 of the 20 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 between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `eb5a1baf` fix(core): fix Windows PowerShell substitution false positives and po…; `b35c12d8` fix(core)!: Force policy config to specify toolName (#23330); `1725ec34` feat(plan): support plan mode in non-interactive mode (#22670) — run `git show` on any of them.
  • Change coupling: config.ts ↔ dynamic-declaration-helpers.ts packages/core/src/config/config.ts:1 — `packages/core/src/config/config.ts` and `packages/core/src/tools/definitions/dynamic-declaration-helpers.ts` 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) 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 `e7f8d9cf` Revert "feat: Introduce an AI-driven interactive shell mode with new"; `651ad63e` feat: Introduce an AI-driven interactive shell mode with new `read-sh…; `f5103947` Implement background process monitoring and inspection tools (#23799) — run `git show` on any of them.
  • Change coupling: auth.ts ↔ AuthDialog.tsx packages/cli/src/config/auth.ts:1 — `packages/cli/src/config/auth.ts` and `packages/cli/src/ui/auth/AuthDialog.tsx` change together 53% of the time (9 of the 17 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 `1e7063bb` fix(cli): allow keychain auth for --list-sessions and non-interactive…; `9d74b7c0` feat(auth): Add option for metadata server application default creden…; `06035d5d` feat(auth): improve API key authentication flow (#11760) — run `git show` on any of them.
  • Change coupling: config.ts ↔ memoryCommand.ts packages/cli/src/config/config.ts:1 — `packages/cli/src/config/config.ts` and `packages/cli/src/ui/commands/memoryCommand.ts` change together 53% of the time (9 of the 17 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 `85736502` feat(config): split memoryManager flag into autoMemory (#25601); `2e229d3b` feat(core): Implement JIT context memory loading and UI sync (#14469); `47603ef8` Reload gemini memory on extension load/unload + memory refresh refact… — run `git show` on any of them.
  • Change coupling: useGeminiStream.ts ↔ useLoadingIndicator.ts packages/cli/src/ui/hooks/useGeminiStream.ts:1 — `packages/cli/src/ui/hooks/useGeminiStream.ts` and `packages/cli/src/ui/hooks/useLoadingIndicator.ts` change together 50% of the time (8 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise 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 `77027dff` fix(cli): clear stale retry/loading state after cancellation (#21096)…; `8303edbb` Code review fixes as a pr (#20612); `7f8ce865` Add low/full CLI error verbosity mode for cleaner UI (#20399) — run `git show` on any of them.
  • Change coupling: REDACTED ↔ remote-invocation.ts REDACTED:1 — `REDACTED` and `packages/core/src/agents/remote-invocation.ts` change together 50% of the time (7 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `0c919857` feat(core): support inline agentCardJson for remote agents (#23743); `7ae39fd6` feat(a2a): add agent acknowledgment command and enhance registry disc…; `4b76fe00` feat(core): add google credentials provider for remote agents (#21024) — run `git show` on any of them.
  • Change coupling: extensions.tsx ↔ extension.ts packages/cli/src/commands/extensions.tsx:1 — `packages/cli/src/commands/extensions.tsx` and `packages/cli/src/config/extension.ts` 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 `6a581a69` Add `gemini extensions link` command (#7241); `51bb624d` Add extensions enable command (#7042); `f32a54fe` [extensions] Add extensions update command (#6878) — run `git show` on any of them.
  • Change coupling: shell.ts ↔ tool-utils.ts packages/core/src/tools/shell.ts:1 — `packages/core/src/tools/shell.ts` and `packages/core/src/utils/tool-utils.ts` 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 `f3bbe6e7` fix(core): send shell output to model on cancel (#20501); `7ca3a33f` Subagent activity UX. (#17570); `2e6d69c9` Fix --allowed-tools in non-interactive mode to do substring matching … — run `git show` on any of them.
  • Change coupling: GeminiMessage.tsx ↔ ToolMessage.tsx packages/cli/src/ui/components/messages/GeminiMessage.tsx:1 — `packages/cli/src/ui/components/messages/GeminiMessage.tsx` and `packages/cli/src/ui/components/messages/ToolMessage.tsx` 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 between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise 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 `6ded45e5` feat: Add markdown toggle (alt+m) to switch between rendered and raw……; `fe5bb669` Screen reader updates (#7307); `b0bc7c3d` Fix flicker issues by ensuring all actively changing content fits in … — run `git show` on any of them.
  • Change coupling: errorParsing.ts ↔ retry.ts packages/core/src/utils/errorParsing.ts:1 — `packages/core/src/utils/errorParsing.ts` and `packages/core/src/utils/retry.ts` 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 between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise 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 `ee92db75` fix: handle request retries and model fallback correctly (#11624); `996c9f59` Revert "fix: handle request retries and model fallback correctly" (#1…; `319f43fa` fix: handle request retries and model fallback correctly (#9407) — run `git show` on any of them.
  • Change coupling: aboutCommand.ts ↔ AboutBox.tsx packages/cli/src/ui/commands/aboutCommand.ts:1 — `packages/cli/src/ui/commands/aboutCommand.ts` and `packages/cli/src/ui/components/AboutBox.tsx` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) 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 5 shared commits counted here, the most recent 3 are `5c649d8d` feat(ui): display user tier in about command (#17400); `43d6dc36` Add User email detail to about box (#13459); `925d747b` Revert "feat: add explicit license selection and status visibility (#… — run `git show` on any of them.
  • Change coupling: ProQuotaDialog.tsx ↔ useQuotaAndFallback.ts packages/cli/src/ui/components/ProQuotaDialog.tsx:1 — `packages/cli/src/ui/components/ProQuotaDialog.tsx` and `packages/cli/src/ui/hooks/useQuotaAndFallback.ts` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) 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 5 shared commits counted here, the most recent 3 are `188e255b` fix(core,cli): resolve false model capacity exhaustion and fix core q…; `edb1fdea` fix(cli): support quota error fallbacks for all authentication types …; `d8a3d08f` fallback to flash for TerminalQuota errors (#13791) — run `git show` on any of them.
D29 · Static Analysis (SAST) · REDACTED · ×16
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D31 · IaC & Container Security · Medium IaC · ×14
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
R4 · Test Coverage · No test reaches this file · ×13
  • No test reaches this file packages/vscode-ide-companion/scripts/generate-notices.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/core/scripts/bundle-browser-mcp.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/core/scripts/compile-windows-sandbox.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/vscode-ide-companion/scripts/check-vscode-release.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/vscode-ide-companion/esbuild.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/a2a-server/src/utils/path_utils.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/cli/src/ui/utils/terminalUtils.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/vscode-ide-companion/scripts/run-integration-tests.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/a2a-server/src/http/server.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/cli/src/patches/is-in-ci.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/devtools/client/src/main.tsx:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file tools/caretaker-agent/cloudrun/egress-service/src/server.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file tools/caretaker-agent/cloudrun/ingestion-service/server.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
D10 · Test Quality · Fixed-sleep synchronisation · ×9
  • Fixed-sleep synchronisation: should include newly created directory when watcher is enabled packages/core/src/utils/filesearch/fileSearch.test.ts:154 — This test starts work it did not wait for (`fileSearch`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 300))` — 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.
  • Fixed-sleep synchronisation: should include newly created file and remove it after deletion when watcher is enabled packages/core/src/utils/filesearch/fileSearch.test.ts:182 — This test starts work it did not wait for (`fileSearch`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 300))` — 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.
  • Fixed-sleep synchronisation: should propagate serverName to ToolConfirmationRequest packages/core/src/tools/base-tool-invocation.test.ts:39 — This test starts work it did not wait for (`confirmationPromise`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 0))` — 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.
  • Fixed-sleep synchronisation: should NOT propagate serverName if not provided packages/core/src/tools/base-tool-invocation.test.ts:97 — This test starts work it did not wait for (`confirmationPromise`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 0))` — 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.
  • Fixed-sleep synchronisation: should queue requests when scheduler is busy (overlapping batches) packages/core/src/scheduler/scheduler.test.ts:548 — This test starts work it did not wait for (`promise1`, still running when the sleep starts) and then orders itself against it with `new Promise((r) => setTimeout(r, 0))` — 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.
  • Fixed-sleep synchronisation: should distinguish between primary and secondary execution packages/a2a-server/src/agent/executor.test.ts:144 — This test starts work it did not wait for (`primaryPromise`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 50))` — 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.
  • Fixed-sleep synchronisation: should evict task from cache when it reaches terminal state packages/a2a-server/src/agent/executor.test.ts:243 — This test starts work it did not wait for (`primaryPromise`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 50))` — 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.
  • Fixed-sleep synchronisation: should allow executing a task that is in a terminal state by re-activating it packages/a2a-server/src/agent/executor.test.ts:449 — This test starts work it did not wait for (`primaryPromise`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 10))` — 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.
  • Fixed-sleep synchronisation: should not evict or treat a new request as secondary when preceding request is canceled and winding down packages/a2a-server/src/agent/executor.test.ts:495 — This test starts work it did not wait for (`primaryPromise`, still running when the sleep starts) and then orders itself against it with `new Promise((resolve) => setTimeout(resolve, 20))` — 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.
P7 · Outbound HTTP resilience · Outbound HTTP without resilience · ×9
  • Outbound HTTP without resilience packages/core/src/code_assist/oauth2.ts:795 — `fetch(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience packages/core/src/mcp/oauth-provider.ts:133 — `fetch(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience packages/core/src/mcp/oauth-provider.ts:336 — `fetch(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience packages/core/src/mcp/oauth-utils.ts:281 — `fetch(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience packages/core/src/mcp/oauth-utils.ts:318 — `fetch(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts:557 — `fetch(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience REDACTED:660 — `fetch(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience REDACTED:722 — `fetch(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience packages/vscode-ide-companion/src/extension.ts:48 — `fetch(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
D29 · Static Analysis (SAST) · REDACTED · ×7
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×7
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D3 · God Classes · TooManyMethods · ×7
  • TooManyMethods: Config packages/core/src/config/config.ts:763 — TooManyMethods — 276 methods. The bar is 30 methods; this is 246 over it, 9.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: ClearcutLogger packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts:294 — TooManyMethods — 71 methods. The bar is 30 methods; this is 41 over it, 2.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Storage packages/core/src/config/storage.ts:30 — TooManyMethods — 62 methods. The bar is 30 methods; this is 32 over it, 2.07× 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: GeminiClient packages/core/src/core/client.ts:99 — TooManyMethods — 35 methods. The bar is 30 methods; 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.
  • TooManyMethods: SchedulerStateManager packages/core/src/scheduler/state-manager.ts:47 — TooManyMethods — 35 methods. The bar is 30 methods; 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.
  • TooManyMethods: ThemeManager packages/cli/src/ui/themes/theme-manager.ts:96 — TooManyMethods — 33 methods. The bar is 30 methods; this is 3 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.
  • TooManyMethods: Task packages/a2a-server/src/agent/task.ts:75 — TooManyMethods — 31 methods. The bar is 30 methods; 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.
D15 · Churn × Complexity Hotspots · Repeated repair · ×6
  • Repeated repair: packages/cli/src/config/settingsSchema.ts packages/cli/src/config/settingsSchema.ts:61 — packages/cli/src/config/settingsSchema.ts changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is settingsSchema.oneLine at line 61), 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(core,cli): allow overriding 60s API headers timeout across all auth modes (`model.requestTimeoutMs` / `GEMINI_API_HEADERS_TIMEOUT_MS`) (#30183)”; “fix(cli): add missing active and focus keys to custom theme ui schema (#30032)”; “fix(core): support opt-in private network endpoints for MCP OAuth flows (#29844)”; “fix(core): align OAuth callback iss parameter validation with RFC 9207 metadata (#29616)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/cli/src/config/settingsSchema.ts`: 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: packages/core/src/core/baseLlmClient.ts packages/core/src/core/baseLlmClient.ts:290 — packages/core/src/core/baseLlmClient.ts changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is BaseLlmClient._generateWithRetry at line 290), 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(core): prevent multi-hour quota retries and notify ACP client on retry attempts (#30187)”; “fix(core,cli): prevent silent multi-minute loading hangs on network failures (#30182)”; “fix(core,cli): preserve selected model across transient fallback, cancel, and rewind (#30059)”; “fix(cli): surface 429 rate limit cool-down and countdown in loading indicator (#30012)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/core/src/core/baseLlmClient.ts`: 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: packages/cli/src/ui/utils/textUtils.ts packages/cli/src/ui/utils/textUtils.ts:264 — packages/cli/src/ui/utils/textUtils.ts changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is textUtils.escapeAnsiCtrlCodes at line 264), 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(core,cli): fix instances of incorrect \n escape behavior (#29989)”; “fix(ui): handle surrogate pairs when truncating in sanitizeForDisplay (#29993)”; “fix(cli): handle terminals that render ambiguous-width characters as wide (#29905)”; “fix(cli): correct Thai and Lao SARA AM display width (#29883)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/cli/src/ui/utils/textUtils.ts`: 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: packages/cli/src/utils/processUtils.ts packages/cli/src/utils/processUtils.ts:33 — packages/cli/src/utils/processUtils.ts changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is processUtils.setupSignalForwarding at line 33), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): preserve selected worktree across authentication restarts (#30078) (#30176)”; “fix(cli): forward termination signals from bootstrap parent to child process (#29790)”; “fix(auth): prevent infinite auth loop from file contention, headless keyring, and supervisor state drops (#28341) (#29448)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/cli/src/utils/processUtils.ts`: 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: packages/core/src/ide/process-utils.ts packages/core/src/ide/process-utils.ts:231 — packages/core/src/ide/process-utils.ts changed 3 times in last 90 days and 3 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 process-utils.getIdeProcessInfoForWindows at line 231), 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(core): honor .git/info/exclude and core.excludesFile in shadow repo (#30034)”; “fix(core): use PowerShell CIM fallback for Windows IDE process lookup (#30006)”; “[SSR Agent] Issue Fix (21477): Prevent indefinite TUI hang by adding execution timeouts (#28812)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/core/src/ide/process-utils.ts`: 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: packages/core/src/tools/read-file.ts packages/core/src/tools/read-file.ts:125 — packages/core/src/tools/read-file.ts changed 3 times in last 90 days and 3 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 ReadFileToolInvocation.execute at line 125), 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(core): resolve relative file paths against active IDE workspace root (#29838)”; “fix(core): align policy redirection gates, path validation, and workflow parsing (#29506)”; “fix(core): ensure consistent symlink evaluation in ignore path handling (#28915)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-13..2026-11-11, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-13 21:16:26 +00:00' --until='2026-11-11 21:16:26 +00:00' --full-history --no-merges -- packages/core/src/tools/read-file.ts`: 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.
D29 · Static Analysis (SAST) · REDACTED · ×6
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×5
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
R10 · Code Duplication · Duplicated block with local edits (50 matched lines × 2 locations) · ×3
  • Duplicated block with local edits (50 matched lines × 2 locations) packages/a2a-server/src/commands/restore.ts:66 — packages/a2a-server/src/commands/restore.ts:66 · packages/cli/src/acp/commands/restore.ts:62 — the two spans are one implementation copied and then locally edited — 280 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (50 matched lines × 2 locations) packages/core/src/agents/remote-invocation.ts:63 — packages/core/src/agents/remote-invocation.ts:63 · packages/core/src/agents/remote-session-invocation.ts:74 — the two spans are one implementation copied and then locally edited — 240 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (50 matched lines × 2 locations) packages/core/src/tools/web-fetch.ts:836 — packages/core/src/tools/web-fetch.ts:836 · packages/core/src/tools/web-search.ts:131 — the two spans are one implementation copied and then locally edited — 227 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R7 · Dead Code · Dead file (~120 LoC) · ×3
  • Dead file (~120 LoC) tools/gemini-cli-bot/history/sync.ts — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
  • Dead file (~120 LoC) tools/gemini-cli-bot/metrics/scripts/latency.ts — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
  • Dead file (~120 LoC) tools/gemini-cli-bot/metrics/scripts/throughput.ts — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
AC6 · Visual & motion safety · Focus outline removed inline · ×2
  • Focus outline removed inline packages/devtools/client/src/App.tsx:406 — <select> takes keyboard focus, and outline:none/0 in its inline style removes the focus ring with no chance of a :focus replacement (an inline style outranks every stylesheet rule). Keep a visible focus indicator.
  • Focus outline removed inline packages/devtools/client/src/App.tsx:1904 — <div> takes keyboard focus, and outline:none/0 in its inline style removes the focus ring with no chance of a :focus replacement (an inline style outranks every stylesheet rule). Keep a visible focus indicator.
D17 · Explicit Debt · HackComment · ×2
  • HackComment packages/vscode-ide-companion/src/integration-tests/run-test.ts:25 — // Hack: Intercept require('vscode') globally in this process — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
  • HackComment packages/core/src/config/config.ts:1161 — // HACK: The settings loading logic doesn't currently merge the default — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
D2 · Cognitive Complexity · settings.migrateDeprecatedSettings · ×2
  • settings.migrateDeprecatedSettings::processScope (cognitive 63) packages/cli/src/config/settings.ts:1241 — settings.migrateDeprecatedSettings::processScope has cognitive complexity 63 (threshold 15). Drivers by points: if/else 23 (59 pts), boolean chains 4 (nesting depth added 36). 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. This shape REPEATS in the file: one other method here (settings.migrateDeprecatedSettings::migrateBoolean) 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.
  • settings.migrateDeprecatedSettings::migrateBoolean (cognitive 18) packages/cli/src/config/settings.ts:1201 — settings.migrateDeprecatedSettings::migrateBoolean has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (settings.migrateDeprecatedSettings::processScope) 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.
D2 · Cognitive Complexity · ShellExecutionService.childProcessFallback · ×2
  • ShellExecutionService.childProcessFallback::handleOutput (cognitive 29) packages/core/src/services/shellExecutionService.ts:805 — ShellExecutionService.childProcessFallback::handleOutput has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ShellExecutionService.childProcessFallback::cleanup) 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.
  • ShellExecutionService.childProcessFallback::cleanup (cognitive 29) packages/core/src/services/shellExecutionService.ts:962 — ShellExecutionService.childProcessFallback::cleanup has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (23 pts), error handling 3 (6 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. This shape REPEATS in the file: one other method here (ShellExecutionService.childProcessFallback::handleOutput) 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.
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
R10 · Code Duplication · Duplicated block with local edits (46 matched lines × 2 locations) · ×2
  • Duplicated block with local edits (46 matched lines × 2 locations) packages/a2a-server/src/commands/memory.ts:18 — packages/a2a-server/src/commands/memory.ts:18 · packages/cli/src/acp/commands/memory.ts:21 — the two spans are one implementation copied and then locally edited — 247 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (46 matched lines × 2 locations) packages/cli/src/utils/featureToggleUtils.ts:83 — packages/cli/src/utils/featureToggleUtils.ts:83 · packages/cli/src/utils/hookSettings.ts:36 — the two spans are one implementation copied and then locally edited — 257 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (45 matched lines × 2 locations) · ×2
  • Duplicated block with local edits (45 matched lines × 2 locations) packages/core/src/mcp/google-auth-provider.ts:60 — packages/core/src/mcp/google-auth-provider.ts:60 · packages/core/src/mcp/sa-impersonation-provider.ts:65 — the two spans are one implementation copied and then locally edited — 192 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (45 matched lines × 2 locations) packages/core/src/services/sandboxedFileSystemService.ts:50 — packages/core/src/services/sandboxedFileSystemService.ts:50 · packages/core/src/services/sandboxedFileSystemService.ts:114 — the two spans are one implementation copied and then locally edited — 234 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (42 matched lines × 2 locations) · ×2
  • Duplicated block with local edits (42 matched lines × 2 locations) packages/core/src/agents/browser/browserAgentInvocation.ts:166 — packages/core/src/agents/browser/browserAgentInvocation.ts:166 · packages/core/src/agents/local-invocation.ts:121 — the two spans are one implementation copied and then locally edited — 254 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (42 matched lines × 2 locations) packages/core/src/context/chatCompressionService.ts:240 — packages/core/src/context/chatCompressionService.ts:240 · packages/core/src/utils/tool-utils.ts:193 — the two spans are one implementation copied and then locally edited — 249 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (40 lines × 2 locations) · ×2
  • Duplicated block (40 lines × 2 locations) packages/cli/src/utils/agentUtils.ts:18 — packages/cli/src/utils/agentUtils.ts:18 · packages/cli/src/utils/skillUtils.ts:29 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
  • Duplicated block (40 lines × 2 locations) packages/core/src/agents/local-subagent-protocol.ts:384 — packages/core/src/agents/local-subagent-protocol.ts:384 · packages/core/src/agents/remote-subagent-protocol.ts:375 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R7 · Dead Code · Dead file (~32 LoC) · ×2
  • Dead file (~32 LoC) tools/gemini-cli-bot/metrics/scripts/open_issues.ts — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
  • Dead file (~32 LoC) tools/gemini-cli-bot/metrics/scripts/open_prs.ts — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
X24 · Document value interpolated into markup unescaped · Untrusted text written into markup unescaped · ×2
  • Untrusted text written into markup unescaped REDACTED:247 — `error.replace(/</g,'&lt;').replace(/>/g,'&gt;')` is text this program did not author, and it is written into the text of an element through `res.end` (the page this server sends) with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped REDACTED:248 — `(url.searchParams.get('error_description')||'').replace(/</g,'&lt;').replace(/>/g,'&gt;')` is text this program did not author, and it is written into the text of an element through `res.end` (the page this server sends) with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
AC3 · Page structure · Page without a main landmark · ×1
  • Page without a main landmark packages/devtools/client/index.html:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. This document's body is only the mount point <div id="root">, so there is no content here to wrap — render the <main> from the component mounted into it.
AC6 · Visual & motion safety · Animation without a prefers-reduced-motion guard · ×1
  • Animation without a prefers-reduced-motion guard packages/devtools/client/src/App.tsx:539 — <div> moves — its inline style sets `animation: fadeInOut 5s ease forwards` — and nothing reads prefers-reduced-motion for it, so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Gate it on @media (prefers-reduced-motion: no-preference) or motion-safe:.
D1 · Cyclomatic Complexity · InputPrompt.InputPrompt (cyclomatic 354) · ×1
  • InputPrompt.InputPrompt (cyclomatic 354) packages/cli/src/ui/components/InputPrompt.tsx:207 — InputPrompt.InputPrompt has cyclomatic complexity 354 (threshold 15). Of this number, 42 points are the body's own statements and 312 belong to 21 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AppContainer.AppContainer (cyclomatic 316) · ×1
  • AppContainer.AppContainer (cyclomatic 316) packages/cli/src/ui/AppContainer.tsx:338 — AppContainer.AppContainer has cyclomatic complexity 316 (threshold 15). Of this number, 73 points are the body's own statements and 243 belong to 63 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · vim-buffer-actions.handleVimAction (cyclomatic 246) · ×1
  • vim-buffer-actions.handleVimAction (cyclomatic 246) packages/cli/src/ui/components/shared/vim-buffer-actions.ts:164 — vim-buffer-actions.handleVimAction has cyclomatic complexity 246 (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.
D1 · Cyclomatic Complexity · text-buffer.textBufferReducerLogic (cyclomatic 182) · ×1
  • text-buffer.textBufferReducerLogic (cyclomatic 182) packages/cli/src/ui/components/shared/text-buffer.ts:1787 — text-buffer.textBufferReducerLogic has cyclomatic complexity 182 (threshold 15). Of this number, 176 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sandbox.start_sandbox (cyclomatic 157) · ×1
  • sandbox.start_sandbox (cyclomatic 157) packages/cli/src/utils/sandbox.ts:120 — sandbox.start_sandbox has cyclomatic complexity 157 (threshold 15). Of this number, 139 points are the body's own statements and 18 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ToolConfirmationMessage.ToolConfirmationMessage (cyclomatic 156) · ×1
  • ToolConfirmationMessage.ToolConfirmationMessage (cyclomatic 156) packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx:65 — ToolConfirmationMessage.ToolConfirmationMessage has cyclomatic complexity 156 (threshold 15). Of this number, 20 points are the body's own statements and 136 belong to 14 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · vim.useVim.handleInput (cyclomatic 136) · ×1
  • vim.useVim.handleInput (cyclomatic 136) packages/cli/src/ui/hooks/vim.ts:660 — vim.useVim.handleInput has cyclomatic complexity 136 (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.
D1 · Cyclomatic Complexity · ShellToolInvocation.execute (cyclomatic 134) · ×1
  • ShellToolInvocation.execute (cyclomatic 134) packages/core/src/tools/shell.ts:635 — ShellToolInvocation.execute has cyclomatic complexity 134 (threshold 15). Of this number, 109 points are the body's own statements and 25 belong to 8 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · nonInteractiveCliAgentSession.runNonInteractive (cyclomatic 128) · ×1
  • nonInteractiveCliAgentSession.runNonInteractive (cyclomatic 128) packages/cli/src/nonInteractiveCliAgentSession.ts:82 — nonInteractiveCliAgentSession.runNonInteractive has cyclomatic complexity 128 (threshold 15). Most of this is not in the body itself: 1 of the 128 points is its own statement and the rest belongs to 11 function literals inside it that branch (lines 89, 413, 218, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · TriageDuplicates.TriageDuplicates (cyclomatic 124) · ×1
  • TriageDuplicates.TriageDuplicates (cyclomatic 124) packages/cli/src/ui/components/triage/TriageDuplicates.tsx:105 — TriageDuplicates.TriageDuplicates has cyclomatic complexity 124 (threshold 15). Of this number, 31 points are the body's own statements and 93 belong to 22 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · InboxDialog.InboxDialog (cyclomatic 118) · ×1
  • InboxDialog.InboxDialog (cyclomatic 118) packages/cli/src/ui/components/InboxDialog.tsx:331 — InboxDialog.InboxDialog has cyclomatic complexity 118 (threshold 15). Of this number, 41 points are the body's own statements and 77 belong to 24 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · nonInteractiveCli.runNonInteractive (cyclomatic 111) · ×1
  • nonInteractiveCli.runNonInteractive (cyclomatic 111) packages/cli/src/nonInteractiveCli.ts:77 — nonInteractiveCli.runNonInteractive has cyclomatic complexity 111 (threshold 15). Most of this is not in the body itself: 2 of the 111 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 90, 221, 110, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · VirtualizedList.VirtualizedList (cyclomatic 106) · ×1
  • VirtualizedList.VirtualizedList (cyclomatic 106) packages/cli/src/ui/components/shared/VirtualizedList.tsx:129 — VirtualizedList.VirtualizedList has cyclomatic complexity 106 (threshold 15). Of this number, 24 points are the body's own statements and 82 belong to 19 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · config.loadCliConfig (cyclomatic 103) · ×1
  • config.loadCliConfig (cyclomatic 103) packages/cli/src/config/config.ts:663 — config.loadCliConfig has cyclomatic complexity 103 (threshold 15). Of this number, 100 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · KeypressContext.emitKeys (cyclomatic 94) · ×1
  • KeypressContext.emitKeys (cyclomatic 94) packages/cli/src/ui/contexts/KeypressContext.tsx:380 — KeypressContext.emitKeys has cyclomatic complexity 94 (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.
D1 · Cyclomatic Complexity · AskUserDialog.ChoiceQuestionView (cyclomatic 93) · ×1
  • AskUserDialog.ChoiceQuestionView (cyclomatic 93) packages/cli/src/ui/components/AskUserDialog.tsx:520 — AskUserDialog.ChoiceQuestionView has cyclomatic complexity 93 (threshold 15). Most of this is not in the body itself: 15 of the 93 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 673, 927, 801, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Session.#resolvePrompt (cyclomatic 93) · ×1
  • Session.#resolvePrompt (cyclomatic 93) packages/cli/src/acp/acpSession.ts:1007 — Session.#resolvePrompt has cyclomatic complexity 93 (threshold 15). Of this number, 85 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · chatRecordingService.createJsonlRecordAccumulator.processLine (cyclomatic 86) · ×1
  • chatRecordingService.createJsonlRecordAccumulator.processLine (cyclomatic 86) packages/core/src/services/chatRecordingService.ts:319 — chatRecordingService.createJsonlRecordAccumulator.processLine has cyclomatic complexity 86 (threshold 15). Of this number, 83 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ToolGroupMessage.ToolGroupMessage (cyclomatic 83) · ×1
  • ToolGroupMessage.ToolGroupMessage (cyclomatic 83) packages/cli/src/ui/components/messages/ToolGroupMessage.tsx:89 — ToolGroupMessage.ToolGroupMessage has cyclomatic complexity 83 (threshold 15). Most of this is not in the body itself: 15 of the 83 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 332, 161, 142, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ShellExecutionService.executeWithPty (cyclomatic 79) · ×1
  • ShellExecutionService.executeWithPty (cyclomatic 79) packages/core/src/services/shellExecutionService.ts:1266 — ShellExecutionService.executeWithPty has cyclomatic complexity 79 (threshold 15). Of this number, 22 points are the body's own statements and 57 belong to 20 function items inside it that branch. 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.
D1 · Cyclomatic Complexity · GeminiChat.processStreamResponse (cyclomatic 78) · ×1
  • GeminiChat.processStreamResponse (cyclomatic 78) packages/core/src/core/geminiChat.ts:1590 — GeminiChat.processStreamResponse has cyclomatic complexity 78 (threshold 15). Of this number, 75 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · gemini.main (cyclomatic 77) · ×1
  • gemini.main (cyclomatic 77) packages/cli/src/gemini.tsx:469 — gemini.main has cyclomatic complexity 77 (threshold 15). Of this number, 72 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StatusRow.StatusRow (cyclomatic 74) · ×1
  • StatusRow.StatusRow (cyclomatic 74) packages/cli/src/ui/components/StatusRow.tsx:168 — StatusRow.StatusRow has cyclomatic complexity 74 (threshold 15). Of this number, 54 points are the body's own statements and 20 belong to 5 function items inside it that branch. 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.
D1 · Cyclomatic Complexity · BaseSettingsDialog.BaseSettingsDialog (cyclomatic 71) · ×1
  • BaseSettingsDialog.BaseSettingsDialog (cyclomatic 71) packages/cli/src/ui/components/shared/BaseSettingsDialog.tsx:128 — BaseSettingsDialog.BaseSettingsDialog has cyclomatic complexity 71 (threshold 15). Of this number, 18 points are the body's own statements and 53 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · text-buffer.useTextBuffer (cyclomatic 69) · ×1
  • text-buffer.useTextBuffer (cyclomatic 69) packages/cli/src/ui/components/shared/text-buffer.ts:2832 — text-buffer.useTextBuffer has cyclomatic complexity 69 (threshold 15). Most of this is not in the body itself: 4 of the 69 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 3372, 2948, 3552, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · shell-utils.detectPowerShellSubstitution (cyclomatic 68) · ×1
  • shell-utils.detectPowerShellSubstitution (cyclomatic 68) packages/core/src/utils/shell-utils.ts:2009 — shell-utils.detectPowerShellSubstitution has cyclomatic complexity 68 (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.
D1 · Cyclomatic Complexity · config.parseArguments (cyclomatic 68) · ×1
  • config.parseArguments (cyclomatic 68) packages/cli/src/config/config.ts:166 — config.parseArguments has cyclomatic complexity 68 (threshold 15). Of this number, 39 points are the body's own statements and 29 belong to 7 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · retry.retryWithBackoff (cyclomatic 67) · ×1
  • retry.retryWithBackoff (cyclomatic 67) packages/core/src/utils/retry.ts:284 — retry.retryWithBackoff has cyclomatic complexity 67 (threshold 15). Of this number, 66 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PolicyEngine.check (cyclomatic 67) · ×1
  • PolicyEngine.check (cyclomatic 67) packages/core/src/policy/policy-engine.ts:730 — PolicyEngine.check has cyclomatic complexity 67 (threshold 15). Of this number, 64 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CoderAgentExecutor.execute (cyclomatic 67) · ×1
  • CoderAgentExecutor.execute (cyclomatic 67) packages/a2a-server/src/agent/executor.ts:441 — CoderAgentExecutor.execute has cyclomatic complexity 67 (threshold 15). Most of this is not in the body itself: 12 of the 67 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 494, 584, 504, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · useGeminiStream.useGeminiStream (cyclomatic 66) · ×1
  • useGeminiStream.useGeminiStream (cyclomatic 66) packages/cli/src/ui/hooks/useGeminiStream.ts:230 — useGeminiStream.useGeminiStream has cyclomatic complexity 66 (threshold 15). Most of this is not in the body itself: 3 of the 66 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 477, 320, 2392, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ExtensionManager.installOrUpdateExtension (cyclomatic 63) · ×1
  • ExtensionManager.installOrUpdateExtension (cyclomatic 63) packages/cli/src/config/extension-manager.ts:202 — ExtensionManager.installOrUpdateExtension has cyclomatic complexity 63 (threshold 15). Of this number, 58 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · slashCommandProcessor.useSlashCommandProcessor.handleSlashCommand (cyclomatic 62) · ×1
  • slashCommandProcessor.useSlashCommandProcessor.handleSlashCommand (cyclomatic 62) packages/cli/src/ui/hooks/slashCommandProcessor.ts:367 — slashCommandProcessor.useSlashCommandProcessor.handleSlashCommand has cyclomatic complexity 62 (threshold 15). Of this number, 57 points are the body's own statements and 5 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · googleQuotaErrors.classifyGoogleError (cyclomatic 61) · ×1
  • googleQuotaErrors.classifyGoogleError (cyclomatic 61) packages/core/src/utils/googleQuotaErrors.ts:229 — googleQuotaErrors.classifyGoogleError 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.
D1 · Cyclomatic Complexity · Footer.Footer (cyclomatic 60) · ×1
  • Footer.Footer (cyclomatic 60) packages/cli/src/ui/components/Footer.tsx:179 — Footer.Footer has cyclomatic complexity 60 (threshold 15). Of this number, 47 points are the body's own statements and 13 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · textUtils.isWindowsDrivePathSegment (cyclomatic 60) · ×1
  • textUtils.isWindowsDrivePathSegment (cyclomatic 60) packages/core/src/utils/textUtils.ts:195 — textUtils.isWindowsDrivePathSegment has cyclomatic complexity 60 (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.
D1 · Cyclomatic Complexity · untrustedContextTracker.findUntrustedFlags (cyclomatic 57) · ×1
  • untrustedContextTracker.findUntrustedFlags (cyclomatic 57) packages/core/src/utils/untrustedContextTracker.ts:453 — untrustedContextTracker.findUntrustedFlags has cyclomatic complexity 57 (threshold 15). Of this number, 50 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatRecordingService.updateMessagesFromHistory (cyclomatic 57) · ×1
  • ChatRecordingService.updateMessagesFromHistory (cyclomatic 57) packages/core/src/services/chatRecordingService.ts:1548 — ChatRecordingService.updateMessagesFromHistory has cyclomatic complexity 57 (threshold 15). Of this number, 55 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ContextCompressionService.compressHistory (cyclomatic 57) · ×1
  • ContextCompressionService.compressHistory (cyclomatic 57) packages/core/src/context/contextCompressionService.ts:108 — ContextCompressionService.compressHistory has cyclomatic complexity 57 (threshold 15). Of this number, 56 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TriageIssues.TriageIssues (cyclomatic 56) · ×1
  • TriageIssues.TriageIssues (cyclomatic 56) packages/cli/src/ui/components/triage/TriageIssues.tsx:66 — TriageIssues.TriageIssues has cyclomatic complexity 56 (threshold 15). Of this number, 20 points are the body's own statements and 36 belong to 13 function items inside it that branch. 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.
D1 · Cyclomatic Complexity · Session.prompt (cyclomatic 56) · ×1
  • Session.prompt (cyclomatic 56) packages/cli/src/acp/acpSession.ts:337 — Session.prompt has cyclomatic complexity 56 (threshold 15). Of this number, 54 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · App.App (cyclomatic 56) · ×1
  • App.App (cyclomatic 56) packages/devtools/client/src/App.tsx:28 — App.App has cyclomatic complexity 56 (threshold 15). Of this number, 16 points are the body's own statements and 40 belong to 15 function items inside it that branch. 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.
D1 · Cyclomatic Complexity · MainContent.MainContent (cyclomatic 54) · ×1
  • MainContent.MainContent (cyclomatic 54) packages/cli/src/ui/components/MainContent.tsx:87 — MainContent.MainContent has cyclomatic complexity 54 (threshold 15). Most of this is not in the body itself: 4 of the 54 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 216, 279, 148, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · PolicyEngine.checkShellCommand (cyclomatic 54) · ×1
  • PolicyEngine.checkShellCommand (cyclomatic 54) packages/core/src/policy/policy-engine.ts:473 — PolicyEngine.checkShellCommand 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.
D1 · Cyclomatic Complexity · McpStatus.McpStatus (cyclomatic 53) · ×1
  • McpStatus.McpStatus (cyclomatic 53) packages/cli/src/ui/components/views/McpStatus.tsx:35 — McpStatus.McpStatus has cyclomatic complexity 53 (threshold 15). Most of this is not in the body itself: 4 of the 53 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 89, 284, 220, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · GitService.setupShadowGitRepository (cyclomatic 53) · ×1
  • GitService.setupShadowGitRepository (cyclomatic 53) packages/core/src/services/gitService.ts:136 — GitService.setupShadowGitRepository has cyclomatic complexity 53 (threshold 15). Of this number, 48 points are the body's own statements and 5 belong to 2 function items inside it that branch. 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.
D1 · Cyclomatic Complexity · useSlashCompletion.useCommandSuggestions (cyclomatic 52) · ×1
  • useSlashCompletion.useCommandSuggestions (cyclomatic 52) packages/cli/src/ui/hooks/useSlashCompletion.ts:145 — useSlashCompletion.useCommandSuggestions has cyclomatic complexity 52 (threshold 15). Most of this is not in the body itself: 1 of the 52 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 278, 229, 173, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · shell-utils.isInteractiveGeminiSegment (cyclomatic 52) · ×1
  • shell-utils.isInteractiveGeminiSegment (cyclomatic 52) packages/core/src/utils/shell-utils.ts:2427 — shell-utils.isInteractiveGeminiSegment 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.
D1 · Cyclomatic Complexity · GeminiClient.processTurn (cyclomatic 52) · ×1
  • GeminiClient.processTurn (cyclomatic 52) packages/core/src/core/client.ts:654 — GeminiClient.processTurn 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.
D1 · Cyclomatic Complexity · ExtensionManager._buildExtension (cyclomatic 50) · ×1
  • ExtensionManager._buildExtension (cyclomatic 50) packages/cli/src/config/extension-manager.ts:759 — ExtensionManager._buildExtension has cyclomatic complexity 50 (threshold 15). Of this number, 49 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · shell-utils.stripSingleShellWrapper (cyclomatic 50) · ×1
  • shell-utils.stripSingleShellWrapper (cyclomatic 50) packages/core/src/utils/shell-utils.ts:1136 — shell-utils.stripSingleShellWrapper has cyclomatic complexity 50 (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.
D1 · Cyclomatic Complexity · sessionUtils.convertSessionToClientHistory (cyclomatic 50) · ×1
  • sessionUtils.convertSessionToClientHistory (cyclomatic 50) packages/core/src/utils/sessionUtils.ts:121 — sessionUtils.convertSessionToClientHistory has cyclomatic complexity 50 (threshold 15). Of this number, 46 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · contentGenerator.createContentGenerator (cyclomatic 50) · ×1
  • contentGenerator.createContentGenerator (cyclomatic 50) packages/core/src/core/contentGenerator.ts:210 — contentGenerator.createContentGenerator has cyclomatic complexity 50 (threshold 15). Most of this is not in the body itself: 2 of the 50 points are its own statements and the rest belongs to one function literal inside it that branches (line 215). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · BackgroundTaskDisplay.BackgroundTaskDisplay (cyclomatic 48) · ×1
  • BackgroundTaskDisplay.BackgroundTaskDisplay (cyclomatic 48) packages/cli/src/ui/components/BackgroundTaskDisplay.tsx:64 — BackgroundTaskDisplay.BackgroundTaskDisplay has cyclomatic complexity 48 (threshold 15). Most of this is not in the body itself: 7 of the 48 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 146, renderTabs, a function literal at line 111, …). 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.
D1 · Cyclomatic Complexity · ToolExecutor.truncateOutputIfNeeded (cyclomatic 47) · ×1
  • ToolExecutor.truncateOutputIfNeeded (cyclomatic 47) packages/core/src/scheduler/tool-executor.ts:210 — ToolExecutor.truncateOutputIfNeeded has cyclomatic complexity 47 (threshold 15). Of this number, 45 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GrepToolInvocation.performGrepSearch (cyclomatic 47) · ×1
  • GrepToolInvocation.performGrepSearch (cyclomatic 47) REDACTED:413 — GrepToolInvocation.performGrepSearch has cyclomatic complexity 47 (threshold 15). Of this number, 41 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · consent.extensionConsentString (cyclomatic 46) · ×1
  • consent.extensionConsentString (cyclomatic 46) packages/cli/src/config/extensions/consent.ts:189 — consent.extensionConsentString 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.
D1 · Cyclomatic Complexity · useGeminiStream.useGeminiStream.cancelOngoingRequest (cyclomatic 46) · ×1
  • useGeminiStream.useGeminiStream.cancelOngoingRequest (cyclomatic 46) packages/cli/src/ui/hooks/useGeminiStream.ts:829 — useGeminiStream.useGeminiStream.cancelOngoingRequest has cyclomatic complexity 46 (threshold 15). Of this number, 41 points are the body's own statements and 5 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · config.createPolicyEngineConfig (cyclomatic 46) · ×1
  • config.createPolicyEngineConfig (cyclomatic 46) packages/core/src/policy/config.ts:286 — config.createPolicyEngineConfig has cyclomatic complexity 46 (threshold 15). Of this number, 35 points are the body's own statements and 11 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · memoryService.startMemoryService (cyclomatic 46) · ×1
  • memoryService.startMemoryService (cyclomatic 46) REDACTED:1133 — memoryService.startMemoryService has cyclomatic complexity 46 (threshold 15). Of this number, 38 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · models.resolveModel (cyclomatic 45) · ×1
  • models.resolveModel (cyclomatic 45) packages/core/src/config/models.ts:213 — models.resolveModel has cyclomatic complexity 45 (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.
D1 · Cyclomatic Complexity · MarkdownDisplay.MarkdownDisplayInternal (cyclomatic 44) · ×1
  • MarkdownDisplay.MarkdownDisplayInternal (cyclomatic 44) packages/cli/src/ui/utils/MarkdownDisplay.tsx:31 — MarkdownDisplay.MarkdownDisplayInternal has cyclomatic complexity 44 (threshold 15). Most of this is not in the body itself: 9 of the 44 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 88, addContentBlock). 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.
D1 · Cyclomatic Complexity · MCPOAuthProvider.authenticate (cyclomatic 43) · ×1
  • MCPOAuthProvider.authenticate (cyclomatic 43) packages/core/src/mcp/oauth-provider.ts:315 — MCPOAuthProvider.authenticate has cyclomatic complexity 43 (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.
D1 · Cyclomatic Complexity · atCommandProcessor.resolveFilePaths (cyclomatic 41) · ×1
  • atCommandProcessor.resolveFilePaths (cyclomatic 41) packages/cli/src/ui/hooks/atCommandProcessor.ts:239 — atCommandProcessor.resolveFilePaths has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LocalAgentExecutor.runInternal (cyclomatic 41) · ×1
  • LocalAgentExecutor.runInternal (cyclomatic 41) packages/core/src/agents/local-executor.ts:584 — LocalAgentExecutor.runInternal has cyclomatic complexity 41 (threshold 15). Of this number, 38 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sea-launch.prepareRuntime (cyclomatic 41) · ×1
  • sea-launch.prepareRuntime (cyclomatic 41) sea/sea-launch.cjs:93 — sea-launch.prepareRuntime has cyclomatic complexity 41 (threshold 15). Of this number, 33 points are the body's own statements and 8 belong to 2 function items inside it that branch. 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.
D1 · Cyclomatic Complexity · HistoryItemDisplay.HistoryItemDisplay (cyclomatic 40) · ×1
  • HistoryItemDisplay.HistoryItemDisplay (cyclomatic 40) packages/cli/src/ui/components/HistoryItemDisplay.tsx:59 — HistoryItemDisplay.HistoryItemDisplay has cyclomatic complexity 40 (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.
D1 · Cyclomatic Complexity · SettingsDialog.SettingsDialog (cyclomatic 40) · ×1
  • SettingsDialog.SettingsDialog (cyclomatic 40) packages/cli/src/ui/components/SettingsDialog.tsx:100 — SettingsDialog.SettingsDialog has cyclomatic complexity 40 (threshold 15). Most of this is not in the body itself: 6 of the 40 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 300, 222, 195, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · useCommandCompletion.useCommandCompletion (cyclomatic 40) · ×1
  • useCommandCompletion.useCommandCompletion (cyclomatic 40) packages/cli/src/ui/hooks/useCommandCompletion.tsx:77 — useCommandCompletion.useCommandCompletion has cyclomatic complexity 40 (threshold 15). Most of this is not in the body itself: 14 of the 40 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 121, 313, 335). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · LocalSessionInvocation.execute · ×1
  • LocalSessionInvocation.execute::onActivity (cyclomatic 40) packages/core/src/agents/local-session-invocation.ts:118 — LocalSessionInvocation.execute::onActivity 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. This shape REPEATS in the file: one other method here (LocalSessionInvocation.execute) 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.
D1 · Cyclomatic Complexity · policy-engine.ruleMatches (cyclomatic 40) · ×1
  • policy-engine.ruleMatches (cyclomatic 40) packages/core/src/policy/policy-engine.ts:130 — policy-engine.ruleMatches 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.
D1 · Cyclomatic Complexity · text-buffer.findWordEndInLine (cyclomatic 39) · ×1
  • text-buffer.findWordEndInLine (cyclomatic 39) packages/cli/src/ui/components/shared/text-buffer.ts:182 — text-buffer.findWordEndInLine has cyclomatic complexity 39 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · shell-utils.isPowerShellKeywordBeforeParen (cyclomatic 39) · ×1
  • shell-utils.isPowerShellKeywordBeforeParen (cyclomatic 39) packages/core/src/utils/shell-utils.ts:1741 — shell-utils.isPowerShellKeywordBeforeParen has cyclomatic complexity 39 (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.
D1 · Cyclomatic Complexity · config.createPolicyUpdater (cyclomatic 39) · ×1
  • config.createPolicyUpdater (cyclomatic 39) packages/core/src/policy/config.ts:717 — config.createPolicyUpdater has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 1 of the 39 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 803, 727). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · sdk.initializeTelemetry (cyclomatic 39) · ×1
  • sdk.initializeTelemetry (cyclomatic 39) packages/core/src/telemetry/sdk.ts:188 — sdk.initializeTelemetry has cyclomatic complexity 39 (threshold 15). Of this number, 38 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Task.acceptAgentMessage (cyclomatic 39) · ×1
  • Task.acceptAgentMessage (cyclomatic 39) packages/a2a-server/src/agent/task.ts:858 — Task.acceptAgentMessage has cyclomatic complexity 39 (threshold 15). Of this number, 37 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · setup.handleSetup (cyclomatic 39) · ×1
  • setup.handleSetup (cyclomatic 39) packages/cli/src/commands/gemma/setup.ts:159 — setup.handleSetup 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.
D1 · Cyclomatic Complexity · sessionCleanup.cleanupExpiredSessions (cyclomatic 38) · ×1
  • sessionCleanup.cleanupExpiredSessions (cyclomatic 38) packages/cli/src/utils/sessionCleanup.ts:102 — sessionCleanup.cleanupExpiredSessions has cyclomatic complexity 38 (threshold 15). Of this number, 36 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · markdownParsingUtils.parseMarkdownToANSI (cyclomatic 38) · ×1
  • markdownParsingUtils.parseMarkdownToANSI (cyclomatic 38) packages/cli/src/ui/utils/markdownParsingUtils.ts:106 — markdownParsingUtils.parseMarkdownToANSI has cyclomatic complexity 38 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SubagentGroupDisplay.SubagentGroupDisplay (cyclomatic 38) · ×1
  • SubagentGroupDisplay.SubagentGroupDisplay (cyclomatic 38) packages/cli/src/ui/components/messages/SubagentGroupDisplay.tsx:34 — SubagentGroupDisplay.SubagentGroupDisplay has cyclomatic complexity 38 (threshold 15). Of this number, 16 points are the body's own statements and 22 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DenseToolMessage.DenseToolMessage (cyclomatic 38) · ×1
  • DenseToolMessage.DenseToolMessage (cyclomatic 38) packages/cli/src/ui/components/messages/DenseToolMessage.tsx:258 — DenseToolMessage.DenseToolMessage has cyclomatic complexity 38 (threshold 15). Of this number, 16 points are the body's own statements and 22 belong to 4 function items inside it that branch. 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.
D1 · Cyclomatic Complexity · chatCompressionService.collapseOlderFunctionResponses (cyclomatic 38) · ×1
  • chatCompressionService.collapseOlderFunctionResponses (cyclomatic 38) packages/core/src/context/chatCompressionService.ts:177 — chatCompressionService.collapseOlderFunctionResponses has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 12 of the 38 points are its own statements and the rest belongs to 6 function items inside it that branch (collapseValue, a function literal at line 301, a function literal at line 294, …). 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.
D1 · Cyclomatic Complexity · mcp-client.connectToMcpServer (cyclomatic 38) · ×1
  • mcp-client.connectToMcpServer (cyclomatic 38) packages/core/src/tools/mcp-client.ts:1861 — mcp-client.connectToMcpServer has cyclomatic complexity 38 (threshold 15). Of this number, 36 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · validate.validateExtension (cyclomatic 38) · ×1
  • validate.validateExtension (cyclomatic 38) packages/cli/src/commands/extensions/validate.ts:36 — validate.validateExtension 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.
D1 · Cyclomatic Complexity · ModelDialog.ModelDialog (cyclomatic 37) · ×1
  • ModelDialog.ModelDialog (cyclomatic 37) packages/cli/src/ui/components/ModelDialog.tsx:41 — ModelDialog.ModelDialog has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 4 of the 37 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 195, 76, 107, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · DialogManager.DialogManager (cyclomatic 37) · ×1
  • DialogManager.DialogManager (cyclomatic 37) packages/cli/src/ui/components/DialogManager.tsx:50 — DialogManager.DialogManager has cyclomatic complexity 37 (threshold 15). Of this number, 36 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
D1 · Cyclomatic Complexity · LoadingIndicator.LoadingIndicator (cyclomatic 37) · ×1
  • LoadingIndicator.LoadingIndicator (cyclomatic 37) packages/cli/src/ui/components/LoadingIndicator.tsx:38 — LoadingIndicator.LoadingIndicator has cyclomatic complexity 37 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ExtensionDetails.ExtensionDetails (cyclomatic 37) · ×1
  • ExtensionDetails.ExtensionDetails (cyclomatic 37) packages/cli/src/ui/components/views/ExtensionDetails.tsx:31 — ExtensionDetails.ExtensionDetails has cyclomatic complexity 37 (threshold 15). Of this number, 22 points are the body's own statements and 15 belong to 2 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · useVoiceMode.useVoiceMode.startVoiceRecording (cyclomatic 36) · ×1
  • useVoiceMode.useVoiceMode.startVoiceRecording (cyclomatic 36) packages/cli/src/ui/hooks/useVoiceMode.ts:102 — useVoiceMode.useVoiceMode.startVoiceRecording has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 6 of the 36 points are its own statements and the rest belongs to 7 function items inside it that branch (startAsync, a function literal at line 189, startAsync::cleanupIfStopped, …). 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.
D1 · Cyclomatic Complexity · errors.normalizeError (cyclomatic 36) · ×1
  • errors.normalizeError (cyclomatic 36) packages/core/src/utils/errors.ts:453 — errors.normalizeError 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.
D1 · Cyclomatic Complexity · ContextWorkingBufferImpl.syncPristineHistory (cyclomatic 36) · ×1
  • ContextWorkingBufferImpl.syncPristineHistory (cyclomatic 36) packages/core/src/context/pipeline/contextWorkingBuffer.ts:184 — ContextWorkingBufferImpl.syncPristineHistory has cyclomatic complexity 36 (threshold 15). Of this number, 21 points are the body's own statements and 15 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GeminiClient.getIdeContextParts (cyclomatic 36) · ×1
  • GeminiClient.getIdeContextParts (cyclomatic 36) packages/core/src/core/client.ts:466 — GeminiClient.getIdeContextParts 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.
D1 · Cyclomatic Complexity · LocalSubagentInvocation.execute · ×1
  • LocalSubagentInvocation.execute::onActivity (cyclomatic 36) packages/core/src/agents/local-invocation.ts:121 — LocalSubagentInvocation.execute::onActivity 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. This shape REPEATS in the file: one other method here (LocalSubagentInvocation.execute) 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.
D1 · Cyclomatic Complexity · ReadManyFilesToolInvocation.execute (cyclomatic 36) · ×1
  • ReadManyFilesToolInvocation.execute (cyclomatic 36) packages/core/src/tools/read-many-files.ts:232 — ReadManyFilesToolInvocation.execute has cyclomatic complexity 36 (threshold 15). Of this number, 29 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · toml-loader.loadPoliciesFromToml (cyclomatic 36) · ×1
  • toml-loader.loadPoliciesFromToml (cyclomatic 36) packages/core/src/policy/toml-loader.ts:325 — toml-loader.loadPoliciesFromToml has cyclomatic complexity 36 (threshold 15). Of this number, 24 points are the body's own statements and 12 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionBrowser.useSessionBrowserInput (cyclomatic 35) · ×1
  • SessionBrowser.useSessionBrowserInput (cyclomatic 35) packages/cli/src/ui/components/SessionBrowser.tsx:542 — SessionBrowser.useSessionBrowserInput has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 551, 624, 640). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · activityLogger.setupNetworkLogging (cyclomatic 35) · ×1
  • activityLogger.setupNetworkLogging (cyclomatic 35) REDACTED:813 — activityLogger.setupNetworkLogging has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to 10 function items inside it that branch (a function literal at line 843, flushBuffer, handleServerMessage, …). 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.
D1 · Cyclomatic Complexity · LegacyAgentProtocol._runLoop (cyclomatic 35) · ×1
  • LegacyAgentProtocol._runLoop (cyclomatic 35) packages/core/src/agent/legacy-agent-session.ts:174 — LegacyAgentProtocol._runLoop has cyclomatic complexity 35 (threshold 15). Of this number, 34 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sandbox.start_lxc_sandbox (cyclomatic 35) · ×1
  • sandbox.start_lxc_sandbox (cyclomatic 35) packages/cli/src/utils/sandbox.ts:1188 — sandbox.start_lxc_sandbox has cyclomatic complexity 35 (threshold 15). Of this number, 29 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · installationInfo.getInstallationInfo (cyclomatic 34) · ×1
  • installationInfo.getInstallationInfo (cyclomatic 34) packages/cli/src/utils/installationInfo.ts:36 — installationInfo.getInstallationInfo has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · useAtCompletion.useAtCompletion (cyclomatic 34) · ×1
  • useAtCompletion.useAtCompletion (cyclomatic 34) packages/cli/src/ui/hooks/useAtCompletion.ts:206 — useAtCompletion.useAtCompletion has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 1 of the 34 points is its own statement and the rest belongs to 11 function literals inside it that branch (lines 357, 274, 303, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · shell-utils.tokenizeShellCommandWords (cyclomatic 34) · ×1
  • shell-utils.tokenizeShellCommandWords (cyclomatic 34) packages/core/src/utils/shell-utils.ts:2346 — shell-utils.tokenizeShellCommandWords has cyclomatic complexity 34 (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.
D1 · Cyclomatic Complexity · historyHardening.pairToolsAndEnforceSignatures (cyclomatic 34) · ×1
  • historyHardening.pairToolsAndEnforceSignatures (cyclomatic 34) packages/core/src/utils/historyHardening.ts:228 — historyHardening.pairToolsAndEnforceSignatures 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.
D1 · Cyclomatic Complexity · app.app.post("/webhook") (cyclomatic 34) · ×1
  • app.app.post("/webhook") (cyclomatic 34) REDACTED:67 — app.app.post("/webhook") 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.
D1 · Cyclomatic Complexity · GeminiSandbox.Main (cyclomatic 33) · ×1
  • GeminiSandbox.Main (cyclomatic 33) packages/core/src/sandbox/windows/GeminiSandbox.cs:191 — GeminiSandbox.Main has cyclomatic complexity 33 (threshold 15). Of this number, 32 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
D1 · Cyclomatic Complexity · borderStyles.getToolGroupBorderAppearance (cyclomatic 33) · ×1
  • borderStyles.getToolGroupBorderAppearance (cyclomatic 33) packages/cli/src/ui/utils/borderStyles.ts:33 — borderStyles.getToolGroupBorderAppearance has cyclomatic complexity 33 (threshold 15). Of this number, 17 points are the body's own statements and 16 belong to 4 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · AskUserDialog.AskUserDialog (cyclomatic 33) · ×1
  • AskUserDialog.AskUserDialog (cyclomatic 33) packages/cli/src/ui/components/AskUserDialog.tsx:1032 — AskUserDialog.AskUserDialog has cyclomatic complexity 33 (threshold 15). Of this number, 16 points are the body's own statements and 17 belong to 8 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · useQuotaAndFallback.useQuotaAndFallback (cyclomatic 33) · ×1
  • useQuotaAndFallback.useQuotaAndFallback (cyclomatic 33) packages/cli/src/ui/hooks/useQuotaAndFallback.ts:52 — useQuotaAndFallback.useQuotaAndFallback has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 76, 268). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · GeminiChat.makeApiCallAndProcessStream · ×1
  • GeminiChat.makeApiCallAndProcessStream::apiCall (cyclomatic 33) packages/core/src/core/geminiChat.ts:1077 — GeminiChat.makeApiCallAndProcessStream::apiCall 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.
D1 · Cyclomatic Complexity · App.NetworkView (cyclomatic 33) · ×1
  • App.NetworkView (cyclomatic 33) packages/devtools/client/src/App.tsx:831 — App.NetworkView has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 7 of the 33 points are its own statements and the rest belongs to 9 function items inside it that branch (renderLogItem, a function literal at line 889, a function literal at line 1081, …). 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.
D1 · Cyclomatic Complexity · ModelStatsDisplay.ModelStatsDisplay (cyclomatic 32) · ×1
  • ModelStatsDisplay.ModelStatsDisplay (cyclomatic 32) packages/cli/src/ui/components/ModelStatsDisplay.tsx:48 — ModelStatsDisplay.ModelStatsDisplay has cyclomatic complexity 32 (threshold 15). Of this number, 20 points are the body's own statements and 12 belong to 5 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · AuthDialog.AuthDialog (cyclomatic 32) · ×1
  • AuthDialog.AuthDialog (cyclomatic 32) packages/cli/src/ui/auth/AuthDialog.tsx:37 — AuthDialog.AuthDialog has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 9 of the 32 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 118, a function literal at line 98, handleAuthSelect, …). 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.
D1 · Cyclomatic Complexity · Composer.Composer (cyclomatic 32) · ×1
  • Composer.Composer (cyclomatic 32) packages/cli/src/ui/components/Composer.tsx:32 — Composer.Composer has cyclomatic complexity 32 (threshold 15). Of this number, 28 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · McpPromptLoader.loadCommands (cyclomatic 32) · ×1
  • McpPromptLoader.loadCommands (cyclomatic 32) packages/cli/src/services/McpPromptLoader.ts:35 — McpPromptLoader.loadCommands has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 8 of the 32 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 152, 57, 88, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · useGeminiStream.useGeminiStream.processGeminiStreamEvents (cyclomatic 32) · ×1
  • useGeminiStream.useGeminiStream.processGeminiStreamEvents (cyclomatic 32) packages/cli/src/ui/hooks/useGeminiStream.ts:1667 — useGeminiStream.useGeminiStream.processGeminiStreamEvents 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.
D1 · Cyclomatic Complexity · useGeminiStream.useGeminiStream.handleCompletedTools (cyclomatic 32) · ×1
  • useGeminiStream.useGeminiStream.handleCompletedTools (cyclomatic 32) packages/cli/src/ui/hooks/useGeminiStream.ts:2137 — useGeminiStream.useGeminiStream.handleCompletedTools has cyclomatic complexity 32 (threshold 15). Of this number, 29 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useLoadingIndicator.useLoadingIndicator (cyclomatic 32) · ×1
  • useLoadingIndicator.useLoadingIndicator (cyclomatic 32) packages/cli/src/ui/hooks/useLoadingIndicator.ts:50 — useLoadingIndicator.useLoadingIndicator has cyclomatic complexity 32 (threshold 15). Of this number, 21 points are the body's own statements and 11 belong to 3 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · shell-utils.unwrapPowerShellCommandArg (cyclomatic 32) · ×1
  • shell-utils.unwrapPowerShellCommandArg (cyclomatic 32) packages/core/src/utils/shell-utils.ts:1042 — shell-utils.unwrapPowerShellCommandArg has cyclomatic complexity 32 (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.
D1 · Cyclomatic Complexity · shell-utils.isPowerShellMemberOrTypeCallBeforeParen (cyclomatic 32) · ×1
  • shell-utils.isPowerShellMemberOrTypeCallBeforeParen (cyclomatic 32) packages/core/src/utils/shell-utils.ts:1618 — shell-utils.isPowerShellMemberOrTypeCallBeforeParen has cyclomatic complexity 32 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · policyHelpers.resolvePolicyChain (cyclomatic 32) · ×1
  • policyHelpers.resolvePolicyChain (cyclomatic 32) packages/core/src/availability/policyHelpers.ts:41 — policyHelpers.resolvePolicyChain has cyclomatic complexity 32 (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.
D1 · Cyclomatic Complexity · Turn.run (cyclomatic 32) · ×1
  • Turn.run (cyclomatic 32) packages/core/src/core/turn.ts:270 — Turn.run has cyclomatic complexity 32 (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.
D1 · Cyclomatic Complexity · AgentSession.stream (cyclomatic 32) · ×1
  • AgentSession.stream (cyclomatic 32) packages/core/src/agent/agent-session.ts:64 — AgentSession.stream has cyclomatic complexity 32 (threshold 15). Of this number, 21 points are the body's own statements and 11 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BrowserAgentInvocation.execute · ×1
  • BrowserAgentInvocation.execute::onActivity (cyclomatic 32) packages/core/src/agents/browser/browserAgentInvocation.ts:166 — BrowserAgentInvocation.execute::onActivity has cyclomatic complexity 32 (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 (BrowserAgentInvocation.execute) 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.
D1 · Cyclomatic Complexity · oauth2.initOauthClient (cyclomatic 32) · ×1
  • oauth2.initOauthClient (cyclomatic 32) packages/core/src/code_assist/oauth2.ts:129 — oauth2.initOauthClient has cyclomatic complexity 32 (threshold 15). Of this number, 29 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · McpClientManager.maybeDiscoverMcpServer (cyclomatic 32) · ×1
  • McpClientManager.maybeDiscoverMcpServer (cyclomatic 32) packages/core/src/tools/mcp-client-manager.ts:375 — McpClientManager.maybeDiscoverMcpServer has cyclomatic complexity 32 (threshold 15). Of this number, 22 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · settings.migrateDeprecatedSettings (cyclomatic 32) · ×1
  • settings.migrateDeprecatedSettings (cyclomatic 32) packages/a2a-server/src/config/settings.ts:428 — settings.migrateDeprecatedSettings has cyclomatic complexity 32 (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.
D1 · Cyclomatic Complexity · IDEServer.start (cyclomatic 32) · ×1
  • IDEServer.start (cyclomatic 32) packages/vscode-ide-companion/src/ide-server.ts:144 — IDEServer.start has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 1 of the 32 points is its own statement and the rest belongs to 12 function literals inside it that branch (lines 227, 317, 184, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ThemeDialog.ThemeDialog (cyclomatic 31) · ×1
  • ThemeDialog.ThemeDialog (cyclomatic 31) packages/cli/src/ui/components/ThemeDialog.tsx:90 — ThemeDialog.ThemeDialog has cyclomatic complexity 31 (threshold 15). Of this number, 17 points are the body's own statements and 14 belong to 6 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useShellCompletion.useShellCompletion (cyclomatic 31) · ×1
  • useShellCompletion.useShellCompletion (cyclomatic 31) packages/cli/src/ui/hooks/useShellCompletion.ts:443 — useShellCompletion.useShellCompletion has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 5 of the 31 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 489, 616, 458, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ConfigExtensionDialog.ConfigExtensionDialog (cyclomatic 31) · ×1
  • ConfigExtensionDialog.ConfigExtensionDialog (cyclomatic 31) packages/cli/src/ui/components/ConfigExtensionDialog.tsx:56 — ConfigExtensionDialog.ConfigExtensionDialog has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 10 of the 31 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 211, a function literal at line 127, a function literal at line 95, …). 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.
D1 · Cyclomatic Complexity · RewindViewer.RewindViewer (cyclomatic 31) · ×1
  • RewindViewer.RewindViewer (cyclomatic 31) packages/cli/src/ui/components/RewindViewer.tsx:48 — RewindViewer.RewindViewer has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 5 of the 31 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 264, 104, 246, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · paths.shortenPath (cyclomatic 31) · ×1
  • paths.shortenPath (cyclomatic 31) packages/core/src/utils/paths.ts:101 — paths.shortenPath has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 10 of the 31 points are its own statements and the rest belongs to 6 function items inside it that branch (truncateComponent, trailingFallback, pickIndexToReduce, …). 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.
D1 · Cyclomatic Complexity · SnapshotGenerator.synthesizeSnapshot (cyclomatic 31) · ×1
  • SnapshotGenerator.synthesizeSnapshot (cyclomatic 31) packages/core/src/context/utils/snapshotGenerator.ts:128 — SnapshotGenerator.synthesizeSnapshot 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.
D1 · Cyclomatic Complexity · toolMaskingProcessor.createToolMaskingProcessor.process (cyclomatic 31) · ×1
  • toolMaskingProcessor.createToolMaskingProcessor.process (cyclomatic 31) packages/core/src/context/processors/toolMaskingProcessor.ts:92 — toolMaskingProcessor.createToolMaskingProcessor.process has cyclomatic complexity 31 (threshold 15). Of this number, 19 points are the body's own statements and 12 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ShellToolInvocation.shouldConfirmExecute (cyclomatic 31) · ×1
  • ShellToolInvocation.shouldConfirmExecute (cyclomatic 31) packages/core/src/tools/shell.ts:358 — ShellToolInvocation.shouldConfirmExecute has cyclomatic complexity 31 (threshold 15). Of this number, 27 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useExecutionLifecycle.useExecutionLifecycle.handleShellCommand · ×1
  • useExecutionLifecycle.useExecutionLifecycle.handleShellCommand::executeCommand (cyclomatic 30) packages/cli/src/ui/hooks/useExecutionLifecycle.ts:375 — useExecutionLifecycle.useExecutionLifecycle.handleShellCommand::executeCommand 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.
D1 · Cyclomatic Complexity · editorUtils.openFileInEditor (cyclomatic 30) · ×1
  • editorUtils.openFileInEditor (cyclomatic 30) packages/cli/src/ui/utils/editorUtils.ts:47 — editorUtils.openFileInEditor has cyclomatic complexity 30 (threshold 15). Of this number, 27 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useSelectionList.useSelectionList.handleKeypress (cyclomatic 30) · ×1
  • useSelectionList.useSelectionList.handleKeypress (cyclomatic 30) packages/cli/src/ui/hooks/useSelectionList.ts:393 — useSelectionList.useSelectionList.handleKeypress 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.
D1 · Cyclomatic Complexity · FooterConfigDialog.FooterConfigDialog (cyclomatic 30) · ×1
  • FooterConfigDialog.FooterConfigDialog (cyclomatic 30) packages/cli/src/ui/components/FooterConfigDialog.tsx:87 — FooterConfigDialog.FooterConfigDialog has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 5 of the 30 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 338, 185, 168, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · useGeminiStream.useGeminiStream.submitQuery (cyclomatic 30) · ×1
  • useGeminiStream.useGeminiStream.submitQuery (cyclomatic 30) packages/cli/src/ui/hooks/useGeminiStream.ts:1842 — useGeminiStream.useGeminiStream.submitQuery has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 2 of the 30 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1890, 1854, 1963). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · GeminiChat.sendMessageStream · ×1
  • GeminiChat.sendMessageStream::streamWithRetries (cyclomatic 30) packages/core/src/core/geminiChat.ts:717 — GeminiChat.sendMessageStream::streamWithRetries 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. This shape REPEATS in the file: one other method here (GeminiChat.sendMessageStream) 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.
D1 · Cyclomatic Complexity · ContextManager.renderHistory (cyclomatic 30) · ×1
  • ContextManager.renderHistory (cyclomatic 30) packages/core/src/context/contextManager.ts:94 — ContextManager.renderHistory has cyclomatic complexity 30 (threshold 15). Of this number, 27 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sandboxUtils.isSensitiveHostPath (cyclomatic 30) · ×1
  • sandboxUtils.isSensitiveHostPath (cyclomatic 30) packages/cli/src/utils/sandboxUtils.ts:151 — sandboxUtils.isSensitiveHostPath has cyclomatic complexity 30 (threshold 15). Of this number, 27 points are the body's own statements and 3 belong to 2 function items inside it that branch. 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.
D1 · Cyclomatic Complexity · Session.runTool (cyclomatic 30) · ×1
  • Session.runTool (cyclomatic 30) packages/cli/src/acp/acpSession.ts:684 — Session.runTool has cyclomatic complexity 30 (threshold 15). Of this number, 28 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sessionCleanup.cleanupToolOutputFiles (cyclomatic 29) · ×1
  • sessionCleanup.cleanupToolOutputFiles (cyclomatic 29) packages/cli/src/utils/sessionCleanup.ts:479 — sessionCleanup.cleanupToolOutputFiles has cyclomatic complexity 29 (threshold 15). Of this number, 26 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · github.downloadFile (cyclomatic 29) · ×1
  • github.downloadFile (cyclomatic 29) packages/cli/src/config/extensions/github.ts:531 — github.downloadFile has cyclomatic complexity 29 (threshold 15). Of this number, 15 points are the body's own statements and 14 belong to 7 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · googleErrors.parseGoogleApiError (cyclomatic 29) · ×1
  • googleErrors.parseGoogleApiError (cyclomatic 29) packages/core/src/utils/googleErrors.ts:151 — googleErrors.parseGoogleApiError 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.
D1 · Cyclomatic Complexity · shell-utils.findPurePowerShellExpressionParenClose (cyclomatic 29) · ×1
  • shell-utils.findPurePowerShellExpressionParenClose (cyclomatic 29) packages/core/src/utils/shell-utils.ts:1927 — shell-utils.findPurePowerShellExpressionParenClose 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.
D1 · Cyclomatic Complexity · oauth-utils.validateOAuthEndpointUrl (cyclomatic 29) · ×1
  • oauth-utils.validateOAuthEndpointUrl (cyclomatic 29) packages/core/src/mcp/oauth-utils.ts:68 — oauth-utils.validateOAuthEndpointUrl 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.
D1 · Cyclomatic Complexity · GeminiClient.sendMessageStream (cyclomatic 29) · ×1
  • GeminiClient.sendMessageStream (cyclomatic 29) packages/core/src/core/client.ts:953 — GeminiClient.sendMessageStream 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.
D1 · Cyclomatic Complexity · LocalAgentExecutor.processFunctionCalls (cyclomatic 29) · ×1
  • LocalAgentExecutor.processFunctionCalls (cyclomatic 29) packages/core/src/agents/local-executor.ts:1148 — LocalAgentExecutor.processFunctionCalls 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.
D1 · Cyclomatic Complexity · settings.migrateDeprecatedSettings · ×1
  • settings.migrateDeprecatedSettings::processScope (cyclomatic 28) packages/cli/src/config/settings.ts:1241 — settings.migrateDeprecatedSettings::processScope 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.
D1 · Cyclomatic Complexity · MaxSizedBox.MaxSizedBox (cyclomatic 28) · ×1
  • MaxSizedBox.MaxSizedBox (cyclomatic 28) packages/cli/src/ui/components/shared/MaxSizedBox.tsx:36 — MaxSizedBox.MaxSizedBox has cyclomatic complexity 28 (threshold 15). Of this number, 22 points are the body's own statements and 6 belong to 3 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · ToolGroupDisplay.ToolDisplayMessage (cyclomatic 28) · ×1
  • ToolGroupDisplay.ToolDisplayMessage (cyclomatic 28) packages/cli/src/ui/components/messages/ToolGroupDisplay.tsx:118 — ToolGroupDisplay.ToolDisplayMessage has cyclomatic complexity 28 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · useAgentStream.useAgentStream.handleEvent (cyclomatic 28) · ×1
  • useAgentStream.useAgentStream.handleEvent (cyclomatic 28) packages/cli/src/ui/hooks/useAgentStream.ts:352 — useAgentStream.useAgentStream.handleEvent has cyclomatic complexity 28 (threshold 15). Of this number, 20 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · render.render (cyclomatic 28) · ×1
  • render.render (cyclomatic 28) packages/core/src/context/graph/render.ts:34 — render.render 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.
D1 · Cyclomatic Complexity · untrustedContextTracker.extractUntrustedContext (cyclomatic 28) · ×1
  • untrustedContextTracker.extractUntrustedContext (cyclomatic 28) packages/core/src/utils/untrustedContextTracker.ts:335 — untrustedContextTracker.extractUntrustedContext has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · security.isFileAndDirectorySecureSync (cyclomatic 28) · ×1
  • security.isFileAndDirectorySecureSync (cyclomatic 28) packages/core/src/utils/security.ts:595 — security.isFileAndDirectorySecureSync has cyclomatic complexity 28 (threshold 15). Of this number, 22 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BrowserManager.connectMcp (cyclomatic 28) · ×1
  • BrowserManager.connectMcp (cyclomatic 28) REDACTED:559 — BrowserManager.connectMcp has cyclomatic complexity 28 (threshold 15). Of this number, 26 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · memoryImportProcessor.processImports (cyclomatic 28) · ×1
  • memoryImportProcessor.processImports (cyclomatic 28) packages/core/src/utils/memoryImportProcessor.ts:190 — memoryImportProcessor.processImports has cyclomatic complexity 28 (threshold 15). Of this number, 18 points are the body's own statements and 10 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WhisperModelManager.executeDownload (cyclomatic 28) · ×1
  • WhisperModelManager.executeDownload (cyclomatic 28) packages/core/src/voice/whisperModelManager.ts:130 — WhisperModelManager.executeDownload has cyclomatic complexity 28 (threshold 15). Of this number, 24 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TerminalCapabilityManager.detectCapabilities (cyclomatic 27) · ×1
  • TerminalCapabilityManager.detectCapabilities (cyclomatic 27) REDACTED:129 — TerminalCapabilityManager.detectCapabilities has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 4 of the 27 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 183, 161, 144). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · handleAutoUpdate.handleAutoUpdate (cyclomatic 27) · ×1
  • handleAutoUpdate.handleAutoUpdate (cyclomatic 27) packages/cli/src/utils/handleAutoUpdate.ts:71 — handleAutoUpdate.handleAutoUpdate has cyclomatic complexity 27 (threshold 15). Of this number, 16 points are the body's own statements and 11 belong to one function literal inside it that branches. 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.
D1 · Cyclomatic Complexity · useShellCompletion.getTokenAtCursor (cyclomatic 27) · ×1
  • useShellCompletion.getTokenAtCursor (cyclomatic 27) packages/cli/src/ui/hooks/useShellCompletion.ts:59 — useShellCompletion.getTokenAtCursor 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.
D1 · Cyclomatic Complexity · usePhraseCycler.usePhraseCycler (cyclomatic 27) · ×1
  • usePhraseCycler.usePhraseCycler (cyclomatic 27) packages/cli/src/ui/hooks/usePhraseCycler.ts:27 — usePhraseCycler.usePhraseCycler has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 4 of the 27 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 52, 81, 113, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · paths.robustRealpath (cyclomatic 27) · ×1
  • paths.robustRealpath (cyclomatic 27) packages/core/src/utils/paths.ts:506 — paths.robustRealpath 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.
D1 · Cyclomatic Complexity · ShellExecutionService.closeOrphanMasterFd (cyclomatic 27) · ×1
  • ShellExecutionService.closeOrphanMasterFd (cyclomatic 27) packages/core/src/services/shellExecutionService.ts:1086 — ShellExecutionService.closeOrphanMasterFd has cyclomatic complexity 27 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · WriteFileToolInvocation.applyWrite (cyclomatic 27) · ×1
  • WriteFileToolInvocation.applyWrite (cyclomatic 27) packages/core/src/tools/write-file.ts:418 — WriteFileToolInvocation.applyWrite has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · event-translator.translateEvent (cyclomatic 27) · ×1
  • event-translator.translateEvent (cyclomatic 27) packages/core/src/agent/event-translator.ts:97 — event-translator.translateEvent has cyclomatic complexity 27 (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.
D1 · Cyclomatic Complexity · sandboxConfig.getSandboxCommand (cyclomatic 27) · ×1
  • sandboxConfig.getSandboxCommand (cyclomatic 27) packages/cli/src/config/sandboxConfig.ts:43 — sandboxConfig.getSandboxCommand 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.
D1 · Cyclomatic Complexity · useToolScheduler.useToolScheduler (cyclomatic 26) · ×1
  • useToolScheduler.useToolScheduler (cyclomatic 26) packages/cli/src/ui/hooks/useToolScheduler.ts:71 — useToolScheduler.useToolScheduler has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 256, 130, 142, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Notifications.Notifications (cyclomatic 26) · ×1
  • Notifications.Notifications (cyclomatic 26) packages/cli/src/ui/components/Notifications.tsx:37 — Notifications.Notifications has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 11 of the 26 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 71, 55, 59, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ContextSummaryDisplay.ContextSummaryDisplay (cyclomatic 26) · ×1
  • ContextSummaryDisplay.ContextSummaryDisplay (cyclomatic 26) packages/cli/src/ui/components/ContextSummaryDisplay.tsx:24 — ContextSummaryDisplay.ContextSummaryDisplay has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 9 of the 26 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 68, 57, 48, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · googleErrors.fromCauseError (cyclomatic 26) · ×1
  • googleErrors.fromCauseError (cyclomatic 26) packages/core/src/utils/googleErrors.ts:389 — googleErrors.fromCauseError has cyclomatic complexity 26 (threshold 15). Of this number, 22 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · process-utils.killProcessGroup (cyclomatic 26) · ×1
  • process-utils.killProcessGroup (cyclomatic 26) packages/core/src/utils/process-utils.ts:38 — process-utils.killProcessGroup has cyclomatic complexity 26 (threshold 15). Of this number, 24 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · ide-connection-utils.getConnectionConfigFromFile (cyclomatic 26) · ×1
  • ide-connection-utils.getConnectionConfigFromFile (cyclomatic 26) packages/core/src/ide/ide-connection-utils.ts:151 — ide-connection-utils.getConnectionConfigFromFile has cyclomatic complexity 26 (threshold 15). Of this number, 18 points are the body's own statements and 8 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · generateContentResponseUtilities.convertToFunctionResponse (cyclomatic 26) · ×1
  • generateContentResponseUtilities.convertToFunctionResponse (cyclomatic 26) packages/core/src/utils/generateContentResponseUtilities.ts:49 — generateContentResponseUtilities.convertToFunctionResponse 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.
D1 · Cyclomatic Complexity · chatCompressionService.truncateHistoryToBudget (cyclomatic 26) · ×1
  • chatCompressionService.truncateHistoryToBudget (cyclomatic 26) packages/core/src/context/chatCompressionService.ts:462 — chatCompressionService.truncateHistoryToBudget has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ShellToolInvocation.getConfirmationDetails (cyclomatic 26) · ×1
  • ShellToolInvocation.getConfirmationDetails (cyclomatic 26) packages/core/src/tools/shell.ts:488 — ShellToolInvocation.getConfirmationDetails has cyclomatic complexity 26 (threshold 15). Of this number, 18 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · fileUtils.processSingleFileContent (cyclomatic 26) · ×1
  • fileUtils.processSingleFileContent (cyclomatic 26) packages/core/src/utils/fileUtils.ts:602 — fileUtils.processSingleFileContent has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Task._handleToolConfirmationPart (cyclomatic 26) · ×1
  • Task._handleToolConfirmationPart (cyclomatic 26) packages/a2a-server/src/agent/task.ts:1032 — Task._handleToolConfirmationPart has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · sandboxUtils.isCredentialOrSensitivePath (cyclomatic 26) · ×1
  • sandboxUtils.isCredentialOrSensitivePath (cyclomatic 26) packages/cli/src/utils/sandboxUtils.ts:56 — sandboxUtils.isCredentialOrSensitivePath has cyclomatic complexity 26 (threshold 15). Of this number, 22 points are the body's own statements and 4 belong to one function item inside it that branches. 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.
D1 · Cyclomatic Complexity · useShellCompletion.resolvePathCompletions (cyclomatic 25) · ×1
  • useShellCompletion.resolvePathCompletions (cyclomatic 25) packages/cli/src/ui/hooks/useShellCompletion.ts:316 — useShellCompletion.resolvePathCompletions has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ActivityLogger.patchNodeHttp · ×1
  • ActivityLogger.patchNodeHttp::wrapRequest (cyclomatic 25) REDACTED:448 — ActivityLogger.patchNodeHttp::wrapRequest has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · oauth-flow.parseTokenEndpointResponse (cyclomatic 25) · ×1
  • oauth-flow.parseTokenEndpointResponse (cyclomatic 25) REDACTED:513 — oauth-flow.parseTokenEndpointResponse 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.
D1 · Cyclomatic Complexity · ToolRegistry.discoverAndRegisterToolsFromCommand (cyclomatic 25) · ×1
  • ToolRegistry.discoverAndRegisterToolsFromCommand (cyclomatic 25) packages/core/src/tools/tool-registry.ts:376 — ToolRegistry.discoverAndRegisterToolsFromCommand has cyclomatic complexity 25 (threshold 15). Of this number, 19 points are the body's own statements and 6 belong to 3 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · ToolOutputMaskingService.mask (cyclomatic 25) · ×1
  • ToolOutputMaskingService.mask (cyclomatic 25) packages/core/src/context/toolOutputMaskingService.ts:68 — ToolOutputMaskingService.mask has cyclomatic complexity 25 (threshold 15). Of this number, 24 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · pathCorrector.resolveActiveWorkspaceDir (cyclomatic 25) · ×1
  • pathCorrector.resolveActiveWorkspaceDir (cyclomatic 25) packages/core/src/utils/pathCorrector.ts:45 — pathCorrector.resolveActiveWorkspaceDir has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HookRunner.executeCommandHook (cyclomatic 25) · ×1
  • HookRunner.executeCommandHook (cyclomatic 25) packages/core/src/hooks/hookRunner.ts:307 — HookRunner.executeCommandHook has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 434, 315, 385, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · index.run (cyclomatic 25) · ×1
  • index.run (cyclomatic 25) packages/cli/index.ts:59 — index.run has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 11 of the 25 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 98, a function literal at line 171, runner). 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.
D1 · Cyclomatic Complexity · MockAgentProtocol.send (cyclomatic 25) · ×1
  • MockAgentProtocol.send (cyclomatic 25) packages/core/src/agent/mock.ts:108 — MockAgentProtocol.send has cyclomatic complexity 25 (threshold 15). Of this number, 24 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · github.isGitHubWebhookPayload (cyclomatic 25) · ×1
  • github.isGitHubWebhookPayload (cyclomatic 25) tools/caretaker-agent/cloudrun/ingestion-service/auth/github.ts:89 — github.isGitHubWebhookPayload has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · shellReducer.shellReducer (cyclomatic 24) · ×1
  • shellReducer.shellReducer (cyclomatic 24) packages/cli/src/ui/hooks/shellReducer.ts:55 — shellReducer.shellReducer 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.
D1 · Cyclomatic Complexity · CodeColorizer.colorizeCode (cyclomatic 24) · ×1
  • CodeColorizer.colorizeCode (cyclomatic 24) packages/cli/src/ui/utils/CodeColorizer.tsx:155 — CodeColorizer.colorizeCode has cyclomatic complexity 24 (threshold 15). Of this number, 17 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · github.checkForExtensionUpdate (cyclomatic 24) · ×1
  • github.checkForExtensionUpdate (cyclomatic 24) packages/cli/src/config/extensions/github.ts:184 — github.checkForExtensionUpdate 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.
D1 · Cyclomatic Complexity · AgentConfigDialog.AgentConfigDialog (cyclomatic 24) · ×1
  • AgentConfigDialog.AgentConfigDialog (cyclomatic 24) packages/cli/src/ui/components/AgentConfigDialog.tsx:190 — AgentConfigDialog.AgentConfigDialog has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 2 of the 24 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 258, 335, 308, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · GeminiChat.sendMessageStream (cyclomatic 24) · ×1
  • GeminiChat.sendMessageStream (cyclomatic 24) packages/core/src/core/geminiChat.ts:546 — GeminiChat.sendMessageStream 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. This shape REPEATS in the file: one other method here (GeminiChat.sendMessageStream::streamWithRetries) 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.
D1 · Cyclomatic Complexity · geminiChat.isValidContent (cyclomatic 24) · ×1
  • geminiChat.isValidContent (cyclomatic 24) packages/core/src/core/geminiChat.ts:177 — geminiChat.isValidContent has cyclomatic complexity 24 (threshold 15). Of this number, 17 points are the body's own statements and 7 belong to 3 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · AgentRegistry.registerRemoteAgent (cyclomatic 24) · ×1
  • AgentRegistry.registerRemoteAgent (cyclomatic 24) REDACTED:456 — AgentRegistry.registerRemoteAgent has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
D1 · Cyclomatic Complexity · GrepToolInvocation.performRipgrepSearch (cyclomatic 24) · ×1
  • GrepToolInvocation.performRipgrepSearch (cyclomatic 24) REDACTED:409 — GrepToolInvocation.performRipgrepSearch 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.
D1 · Cyclomatic Complexity · mcp-client.createTransport (cyclomatic 24) · ×1
  • mcp-client.createTransport (cyclomatic 24) packages/core/src/tools/mcp-client.ts:2312 — mcp-client.createTransport 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.
D1 · Cyclomatic Complexity · sessionUtils.getAllSessionFiles (cyclomatic 23) · ×1
  • sessionUtils.getAllSessionFiles (cyclomatic 23) packages/cli/src/utils/sessionUtils.ts:243 — sessionUtils.getAllSessionFiles has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 259, 252, 316). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · sessionUtils.convertSessionToHistoryFormats (cyclomatic 23) · ×1
  • sessionUtils.convertSessionToHistoryFormats (cyclomatic 23) packages/cli/src/utils/sessionUtils.ts:668 — sessionUtils.convertSessionToHistoryFormats has cyclomatic complexity 23 (threshold 15). Of this number, 20 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · TopicMessage.TopicMessage (cyclomatic 23) · ×1
  • TopicMessage.TopicMessage (cyclomatic 23) packages/cli/src/ui/components/messages/TopicMessage.tsx:32 — TopicMessage.TopicMessage has cyclomatic complexity 23 (threshold 15). Of this number, 16 points are the body's own statements and 7 belong to 2 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · useVoiceMode.useVoiceMode.handleVoiceInput (cyclomatic 23) · ×1
  • useVoiceMode.useVoiceMode.handleVoiceInput (cyclomatic 23) packages/cli/src/ui/hooks/useVoiceMode.ts:319 — useVoiceMode.useVoiceMode.handleVoiceInput 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.
D1 · Cyclomatic Complexity · HooksDialog.HooksDialog (cyclomatic 23) · ×1
  • HooksDialog.HooksDialog (cyclomatic 23) packages/cli/src/ui/components/HooksDialog.tsx:48 — HooksDialog.HooksDialog has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 7 of the 23 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 176, 93, 66). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · useAgentStream.useAgentStream.cancelOngoingRequest (cyclomatic 23) · ×1
  • useAgentStream.useAgentStream.cancelOngoingRequest (cyclomatic 23) packages/cli/src/ui/hooks/useAgentStream.ts:197 — useAgentStream.useAgentStream.cancelOngoingRequest has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 6 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 215, 237). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · errors.toSafeSerializable (cyclomatic 23) · ×1
  • errors.toSafeSerializable (cyclomatic 23) packages/core/src/utils/errors.ts:340 — errors.toSafeSerializable 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.
D1 · Cyclomatic Complexity · geminiChat.stripToolCallIdPrefixes (cyclomatic 23) · ×1
  • geminiChat.stripToolCallIdPrefixes (cyclomatic 23) packages/core/src/core/geminiChat.ts:2099 — geminiChat.stripToolCallIdPrefixes has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 9 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 2103, 2131). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · EditToolInvocation.applyEdit (cyclomatic 23) · ×1
  • EditToolInvocation.applyEdit (cyclomatic 23) REDACTED:962 — EditToolInvocation.applyEdit 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.
D1 · Cyclomatic Complexity · BrowserAgentInvocation.execute (cyclomatic 23) · ×1
  • BrowserAgentInvocation.execute (cyclomatic 23) packages/core/src/agents/browser/browserAgentInvocation.ts:111 — BrowserAgentInvocation.execute 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. This shape REPEATS in the file: one other method here (BrowserAgentInvocation.execute::onActivity) 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.
D1 · Cyclomatic Complexity · coreToolHookTriggers.executeToolWithHooks (cyclomatic 23) · ×1
  • coreToolHookTriggers.executeToolWithHooks (cyclomatic 23) packages/core/src/core/coreToolHookTriggers.ts:68 — coreToolHookTriggers.executeToolWithHooks 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.
D1 · Cyclomatic Complexity · Scheduler._processNextItem (cyclomatic 23) · ×1
  • Scheduler._processNextItem (cyclomatic 23) packages/core/src/scheduler/scheduler.ts:487 — Scheduler._processNextItem has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LocalAgentExecutor.create (cyclomatic 23) · ×1
  • LocalAgentExecutor.create (cyclomatic 23) packages/core/src/agents/local-executor.ts:172 — LocalAgentExecutor.create has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 11 of the 23 points are its own statements and the rest belongs to 2 function items inside it that branch (registerToolByName, registerToolInstance). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · memory.applyInboxPatch (cyclomatic 23) · ×1
  • memory.applyInboxPatch (cyclomatic 23) REDACTED:1189 — memory.applyInboxPatch has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · config.setTargetDir (cyclomatic 23) · ×1
  • config.setTargetDir (cyclomatic 23) packages/a2a-server/src/config/config.ts:483 — config.setTargetDir 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.
D1 · Cyclomatic Complexity · SessionContext.areMetricsEqual (cyclomatic 22) · ×1
  • SessionContext.areMetricsEqual (cyclomatic 22) packages/cli/src/ui/contexts/SessionContext.tsx:89 — SessionContext.areMetricsEqual has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · text-buffer.calculateLayout (cyclomatic 22) · ×1
  • text-buffer.calculateLayout (cyclomatic 22) packages/cli/src/ui/components/shared/text-buffer.ts:1288 — text-buffer.calculateLayout has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 6 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 1299). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · MouseContext.MouseProvider (cyclomatic 22) · ×1
  • MouseContext.MouseProvider (cyclomatic 22) packages/cli/src/ui/contexts/MouseContext.tsx:63 — MouseContext.MouseProvider has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 102, 148, 95). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ExpandableText._ExpandableText (cyclomatic 22) · ×1
  • ExpandableText._ExpandableText (cyclomatic 22) packages/cli/src/ui/components/shared/ExpandableText.tsx:23 — ExpandableText._ExpandableText 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.
D1 · Cyclomatic Complexity · vim.useVim.handleInsertModeInput (cyclomatic 22) · ×1
  • vim.useVim.handleInsertModeInput (cyclomatic 22) packages/cli/src/ui/hooks/vim.ts:473 — vim.useVim.handleInsertModeInput has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: vim.useVim.executeCommand (cyclomatic 48) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · oauth-flow.startCallbackServer (cyclomatic 22) · ×1
  • oauth-flow.startCallbackServer (cyclomatic 22) REDACTED:193 — oauth-flow.startCallbackServer has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 225, 221, 407). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · gitUtils.getSafeGitEnv (cyclomatic 22) · ×1
  • gitUtils.getSafeGitEnv (cyclomatic 22) packages/core/src/utils/gitUtils.ts:11 — gitUtils.getSafeGitEnv has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · getFolderStructure.readFullStructure (cyclomatic 22) · ×1
  • getFolderStructure.readFullStructure (cyclomatic 22) packages/core/src/utils/getFolderStructure.ts:71 — getFolderStructure.readFullStructure 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.
D1 · Cyclomatic Complexity · PromptProvider.getCoreSystemPrompt (cyclomatic 22) · ×1
  • PromptProvider.getCoreSystemPrompt (cyclomatic 22) packages/core/src/prompts/promptProvider.ts:47 — PromptProvider.getCoreSystemPrompt has cyclomatic complexity 22 (threshold 15). Of this number, 19 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · loggingContentGenerator.estimateContextBreakdown (cyclomatic 22) · ×1
  • loggingContentGenerator.estimateContextBreakdown (cyclomatic 22) packages/core/src/core/loggingContentGenerator.ts:79 — loggingContentGenerator.estimateContextBreakdown 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.
D1 · Cyclomatic Complexity · browserAgentFactory.createBrowserAgentDefinition (cyclomatic 22) · ×1
  • browserAgentFactory.createBrowserAgentDefinition (cyclomatic 22) packages/core/src/agents/browser/browserAgentFactory.ts:68 — browserAgentFactory.createBrowserAgentDefinition has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · atCommandUtils.resolveAtCommandPath (cyclomatic 22) · ×1
  • atCommandUtils.resolveAtCommandPath (cyclomatic 22) packages/core/src/utils/atCommandUtils.ts:52 — atCommandUtils.resolveAtCommandPath 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.
D1 · Cyclomatic Complexity · sessionSummaryUtils.getPreviousSession (cyclomatic 22) · ×1
  • sessionSummaryUtils.getPreviousSession (cyclomatic 22) packages/core/src/services/sessionSummaryUtils.ts:460 — sessionSummaryUtils.getPreviousSession 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.
D1 · Cyclomatic Complexity · GrepToolInvocation.execute (cyclomatic 22) · ×1
  • GrepToolInvocation.execute (cyclomatic 22) REDACTED:146 — GrepToolInvocation.execute has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HookAggregator.mergeWithOrDecision (cyclomatic 22) · ×1
  • HookAggregator.mergeWithOrDecision (cyclomatic 22) packages/core/src/hooks/hookAggregator.ts:116 — HookAggregator.mergeWithOrDecision 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.
D1 · Cyclomatic Complexity · Config.refreshUserQuota (cyclomatic 22) · ×1
  • Config.refreshUserQuota (cyclomatic 22) packages/core/src/config/config.ts:2330 — Config.refreshUserQuota 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.
D1 · Cyclomatic Complexity · fileUtils.detectBOM (cyclomatic 22) · ×1
  • fileUtils.detectBOM (cyclomatic 22) packages/core/src/utils/fileUtils.ts:78 — fileUtils.detectBOM has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ChatRecordingService.doInitialize (cyclomatic 22) · ×1
  • ChatRecordingService.doInitialize (cyclomatic 22) packages/core/src/services/chatRecordingService.ts:727 — ChatRecordingService.doInitialize 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.
D1 · Cyclomatic Complexity · config.loadConfig (cyclomatic 22) · ×1
  • config.loadConfig (cyclomatic 22) packages/a2a-server/src/config/config.ts:251 — config.loadConfig 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.
D1 · Cyclomatic Complexity · Task.scheduleToolCalls (cyclomatic 22) · ×1
  • Task.scheduleToolCalls (cyclomatic 22) packages/a2a-server/src/agent/task.ts:748 — Task.scheduleToolCalls has cyclomatic complexity 22 (threshold 15). Of this number, 12 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · gemini.resolveSessionId (cyclomatic 22) · ×1
  • gemini.resolveSessionId (cyclomatic 22) packages/cli/src/gemini.tsx:322 — gemini.resolveSessionId has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DevTools.start (cyclomatic 22) · ×1
  • DevTools.start (cyclomatic 22) packages/devtools/src/index.ts:161 — DevTools.start has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 167, 259, 185, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Scrollable.Scrollable (cyclomatic 21) · ×1
  • Scrollable.Scrollable (cyclomatic 21) packages/cli/src/ui/components/shared/Scrollable.tsx:41 — Scrollable.Scrollable has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 189, 145, 76, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ToolResultDisplay.ToolResultDisplay · ×1
  • ToolResultDisplay.ToolResultDisplay::renderContent (cyclomatic 21) packages/cli/src/ui/components/messages/ToolResultDisplay.tsx:108 — ToolResultDisplay.ToolResultDisplay::renderContent 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.
D1 · Cyclomatic Complexity · ToolGroupDisplay.ToolGroupDisplay (cyclomatic 21) · ×1
  • ToolGroupDisplay.ToolGroupDisplay (cyclomatic 21) packages/cli/src/ui/components/messages/ToolGroupDisplay.tsx:25 — ToolGroupDisplay.ToolGroupDisplay has cyclomatic complexity 21 (threshold 15). Of this number, 14 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HeatmapComponent.HeatmapComponent (cyclomatic 21) · ×1
  • HeatmapComponent.HeatmapComponent (cyclomatic 21) packages/cli/src/ui/components/HeatmapComponent.tsx:242 — HeatmapComponent.HeatmapComponent has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AppHeader.AppHeader (cyclomatic 21) · ×1
  • AppHeader.AppHeader (cyclomatic 21) packages/cli/src/ui/components/AppHeader.tsx:59 — AppHeader.AppHeader has cyclomatic complexity 21 (threshold 15). Of this number, 16 points are the body's own statements and 5 belong to 2 function items inside it that branch. 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.
D1 · Cyclomatic Complexity · highlight.parseInputForHighlighting (cyclomatic 21) · ×1
  • highlight.parseInputForHighlighting (cyclomatic 21) packages/cli/src/ui/utils/highlight.ts:36 — highlight.parseInputForHighlighting has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useRunEventNotifications.useRunEventNotifications (cyclomatic 21) · ×1
  • useRunEventNotifications.useRunEventNotifications (cyclomatic 21) packages/cli/src/ui/hooks/useRunEventNotifications.ts:39 — useRunEventNotifications.useRunEventNotifications has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 81, 140). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · LocalSessionInvocation.execute (cyclomatic 21) · ×1
  • LocalSessionInvocation.execute (cyclomatic 21) packages/core/src/agents/local-session-invocation.ts:111 — LocalSessionInvocation.execute has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (LocalSessionInvocation.execute::onActivity) 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.
D1 · Cyclomatic Complexity · AgentRegistry.loadAgents (cyclomatic 21) · ×1
  • AgentRegistry.loadAgents (cyclomatic 21) REDACTED:160 — AgentRegistry.loadAgents has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ToolExecutor.execute (cyclomatic 21) · ×1
  • ToolExecutor.execute (cyclomatic 21) packages/core/src/scheduler/tool-executor.ts:66 — ToolExecutor.execute has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 6 of the 21 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 101, 107). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Scheduler._processToolCall (cyclomatic 21) · ×1
  • Scheduler._processToolCall (cyclomatic 21) packages/core/src/scheduler/scheduler.ts:640 — Scheduler._processToolCall 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.
D1 · Cyclomatic Complexity · memory.applyMemoryPatchFile (cyclomatic 21) · ×1
  • memory.applyMemoryPatchFile (cyclomatic 21) REDACTED:782 — memory.applyMemoryPatchFile has cyclomatic complexity 21 (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.
D1 · Cyclomatic Complexity · LSToolInvocation.execute (cyclomatic 21) · ×1
  • LSToolInvocation.execute (cyclomatic 21) REDACTED:159 — LSToolInvocation.execute has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 belong to 3 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · tool-utils.truncateFunctionResponsePart (cyclomatic 21) · ×1
  • tool-utils.truncateFunctionResponsePart (cyclomatic 21) packages/core/src/utils/tool-utils.ts:210 — tool-utils.truncateFunctionResponsePart has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to 2 function items inside it that branch (truncateValue, a function literal at line 257). 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.
D1 · Cyclomatic Complexity · contentGenerator.createContentGeneratorConfig (cyclomatic 21) · ×1
  • contentGenerator.createContentGeneratorConfig (cyclomatic 21) packages/core/src/core/contentGenerator.ts:141 — contentGenerator.createContentGeneratorConfig has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
D1 · Cyclomatic Complexity · Config.constructor (cyclomatic 21) · ×1
  • Config.constructor (cyclomatic 21) packages/core/src/config/config.ts:1004 — Config.constructor has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChatRecordingService.recordToolCalls (cyclomatic 21) · ×1
  • ChatRecordingService.recordToolCalls (cyclomatic 21) packages/core/src/services/chatRecordingService.ts:1199 — ChatRecordingService.recordToolCalls has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · acpUtils.toPermissionOptions (cyclomatic 21) · ×1
  • acpUtils.toPermissionOptions (cyclomatic 21) packages/cli/src/acp/acpUtils.ts:139 — acpUtils.toPermissionOptions has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · interactiveCli.startInteractiveUI (cyclomatic 21) · ×1
  • interactiveCli.startInteractiveUI (cyclomatic 21) packages/cli/src/interactiveCli.tsx:60 — interactiveCli.startInteractiveUI has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to 3 function items inside it that branch. 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.
D1 · Cyclomatic Complexity · ContextCompressionService.applyCompressionDecision (cyclomatic 21) · ×1
  • ContextCompressionService.applyCompressionDecision (cyclomatic 21) packages/core/src/context/contextCompressionService.ts:332 — ContextCompressionService.applyCompressionDecision has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · deepMerge.mergeRecursively (cyclomatic 20) · ×1
  • deepMerge.mergeRecursively (cyclomatic 20) packages/cli/src/utils/deepMerge.ts:24 — deepMerge.mergeRecursively 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.
D1 · Cyclomatic Complexity · ThemeManager.loadUserThemes (cyclomatic 20) · ×1
  • ThemeManager.loadUserThemes (cyclomatic 20) packages/cli/src/ui/themes/theme-manager.ts:331 — ThemeManager.loadUserThemes 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.
D1 · Cyclomatic Complexity · ScrollableList.ScrollableList (cyclomatic 20) · ×1
  • ScrollableList.ScrollableList (cyclomatic 20) packages/cli/src/ui/components/shared/ScrollableList.tsx:46 — ScrollableList.ScrollableList has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 200, 113, 165, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · SubagentProgressDisplay.formatToolArgs (cyclomatic 20) · ×1
  • SubagentProgressDisplay.formatToolArgs (cyclomatic 20) packages/cli/src/ui/components/messages/SubagentProgressDisplay.tsx:27 — SubagentProgressDisplay.formatToolArgs has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · github.downloadFromGitHubRelease (cyclomatic 20) · ×1
  • github.downloadFromGitHubRelease (cyclomatic 20) packages/cli/src/config/extensions/github.ts:333 — github.downloadFromGitHubRelease 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.
D1 · Cyclomatic Complexity · SuggestionsDisplay.SuggestionsDisplay (cyclomatic 20) · ×1
  • SuggestionsDisplay.SuggestionsDisplay (cyclomatic 20) packages/cli/src/ui/components/SuggestionsDisplay.tsx:38 — SuggestionsDisplay.SuggestionsDisplay has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 86, getFullLabel). 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.
D1 · Cyclomatic Complexity · ShellProcessor.processString (cyclomatic 20) · ×1
  • ShellProcessor.processString (cyclomatic 20) packages/cli/src/services/prompt-processors/shellProcessor.ts:65 — ShellProcessor.processString has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SearchableList.SearchableList (cyclomatic 20) · ×1
  • SearchableList.SearchableList (cyclomatic 20) packages/cli/src/ui/components/shared/SearchableList.tsx:77 — SearchableList.SearchableList has cyclomatic complexity 20 (threshold 15). Of this number, 12 points are the body's own statements and 8 belong to 4 function items inside it that branch. 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.
D1 · Cyclomatic Complexity · terminalSerializer.serializeTerminalToObject (cyclomatic 20) · ×1
  • terminalSerializer.serializeTerminalToObject (cyclomatic 20) packages/core/src/utils/terminalSerializer.ts:160 — terminalSerializer.serializeTerminalToObject 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.
D1 · Cyclomatic Complexity · ChatCompressionService.compress (cyclomatic 20) · ×1
  • ChatCompressionService.compress (cyclomatic 20) packages/core/src/context/chatCompressionService.ts:621 — ChatCompressionService.compress has cyclomatic complexity 20 (threshold 15). Of this number, 15 points are the body's own statements and 5 belong to 4 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · A2AResultReassembler.update (cyclomatic 20) · ×1
  • A2AResultReassembler.update (cyclomatic 20) packages/core/src/agents/a2aUtils.ts:35 — A2AResultReassembler.update 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.
D1 · Cyclomatic Complexity · setup._doSetupUser (cyclomatic 20) · ×1
  • setup._doSetupUser (cyclomatic 20) packages/core/src/code_assist/setup.ts:153 — setup._doSetupUser 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.
D1 · Cyclomatic Complexity · RecursiveFileSearch.search (cyclomatic 20) · ×1
  • RecursiveFileSearch.search (cyclomatic 20) packages/core/src/utils/filesearch/fileSearch.ts:274 — RecursiveFileSearch.search has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sessionSummaryUtils.generateAndSaveSummary (cyclomatic 20) · ×1
  • sessionSummaryUtils.generateAndSaveSummary (cyclomatic 20) packages/core/src/services/sessionSummaryUtils.ts:324 — sessionSummaryUtils.generateAndSaveSummary 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.
D1 · Cyclomatic Complexity · settings.mergeRecursively (cyclomatic 20) · ×1
  • settings.mergeRecursively (cyclomatic 20) packages/a2a-server/src/config/settings.ts:289 — settings.mergeRecursively 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.
D1 · Cyclomatic Complexity · app.createApp (cyclomatic 20) · ×1
  • app.createApp (cyclomatic 20) REDACTED:197 — app.createApp has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 357, 285, 386, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · install.handleInstall (cyclomatic 20) · ×1
  • install.handleInstall (cyclomatic 20) packages/cli/src/commands/extensions/install.ts:43 — install.handleInstall 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.
D1 · Cyclomatic Complexity · DiffRenderer.renderDiffLines.content (cyclomatic 19) · ×1
  • DiffRenderer.renderDiffLines.content (cyclomatic 19) packages/cli/src/ui/components/messages/DiffRenderer.tsx:292 — DiffRenderer.renderDiffLines.content 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.
D1 · Cyclomatic Complexity · SubagentProgressDisplay.SubagentProgressDisplay (cyclomatic 19) · ×1
  • SubagentProgressDisplay.SubagentProgressDisplay (cyclomatic 19) packages/cli/src/ui/components/messages/SubagentProgressDisplay.tsx:62 — SubagentProgressDisplay.SubagentProgressDisplay has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 91). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · FolderTrustDialog.FolderTrustDialog (cyclomatic 19) · ×1
  • FolderTrustDialog.FolderTrustDialog (cyclomatic 19) packages/cli/src/ui/components/FolderTrustDialog.tsx:45 — FolderTrustDialog.FolderTrustDialog has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 belong to 4 function items inside it that branch. 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.
D1 · Cyclomatic Complexity · ValidationDialog.ValidationDialog (cyclomatic 19) · ×1
  • ValidationDialog.ValidationDialog (cyclomatic 19) packages/cli/src/ui/components/ValidationDialog.tsx:31 — ValidationDialog.ValidationDialog has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 88, 58, 74, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · usePromptCompletion.usePromptCompletion.generatePromptSuggestions (cyclomatic 19) · ×1
  • usePromptCompletion.usePromptCompletion.generatePromptSuggestions (cyclomatic 19) packages/cli/src/ui/hooks/usePromptCompletion.ts:68 — usePromptCompletion.usePromptCompletion.generatePromptSuggestions 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.
D1 · Cyclomatic Complexity · mcpCommand.listAction (cyclomatic 19) · ×1
  • mcpCommand.listAction (cyclomatic 19) packages/cli/src/ui/commands/mcpCommand.ts:177 — mcpCommand.listAction has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · shell-utils.extractNameFromNode (cyclomatic 19) · ×1
  • shell-utils.extractNameFromNode (cyclomatic 19) packages/core/src/utils/shell-utils.ts:376 — shell-utils.extractNameFromNode 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.
D1 · Cyclomatic Complexity · shell-utils.unwrapCmdCommandArg (cyclomatic 19) · ×1
  • shell-utils.unwrapCmdCommandArg (cyclomatic 19) packages/core/src/utils/shell-utils.ts:982 — shell-utils.unwrapCmdCommandArg 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.
D1 · Cyclomatic Complexity · ShellExecutionService.closeOrphanSlaveFd (cyclomatic 19) · ×1
  • ShellExecutionService.closeOrphanSlaveFd (cyclomatic 19) packages/core/src/services/shellExecutionService.ts:1172 — ShellExecutionService.closeOrphanSlaveFd 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.
D1 · Cyclomatic Complexity · HookTranslatorGenAIv1.fromHookLLMRequest (cyclomatic 19) · ×1
  • HookTranslatorGenAIv1.fromHookLLMRequest (cyclomatic 19) packages/core/src/hooks/hookTranslator.ts:228 — HookTranslatorGenAIv1.fromHookLLMRequest has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · chatCompressionService.calculateHistoryByteSize (cyclomatic 19) · ×1
  • chatCompressionService.calculateHistoryByteSize (cyclomatic 19) packages/core/src/context/chatCompressionService.ts:108 — chatCompressionService.calculateHistoryByteSize 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.
D1 · Cyclomatic Complexity · stateSnapshotProcessor.createStateSnapshotProcessor.process (cyclomatic 19) · ×1
  • stateSnapshotProcessor.createStateSnapshotProcessor.process (cyclomatic 19) packages/core/src/context/processors/stateSnapshotProcessor.ts:56 — stateSnapshotProcessor.createStateSnapshotProcessor.process 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.
D1 · Cyclomatic Complexity · ContextWorkingBufferImpl.applyProcessorResult (cyclomatic 19) · ×1
  • ContextWorkingBufferImpl.applyProcessorResult (cyclomatic 19) packages/core/src/context/pipeline/contextWorkingBuffer.ts:61 — ContextWorkingBufferImpl.applyProcessorResult 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.
D1 · Cyclomatic Complexity · ContextManager.evaluateTriggers (cyclomatic 19) · ×1
  • ContextManager.evaluateTriggers (cyclomatic 19) packages/core/src/context/contextManager.ts:349 — ContextManager.evaluateTriggers 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.
D1 · Cyclomatic Complexity · CodeAssistServer.generateContentStream (cyclomatic 19) · ×1
  • CodeAssistServer.generateContentStream (cyclomatic 19) packages/core/src/code_assist/server.ts:93 — CodeAssistServer.generateContentStream has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 134, 172). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · trace.createEndSpan.<returned closure> (cyclomatic 19) · ×1
  • trace.createEndSpan.<returned closure> (cyclomatic 19) packages/core/src/telemetry/trace.ts:131 — trace.createEndSpan.<returned closure> 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.
D1 · Cyclomatic Complexity · LocalSubagentInvocation.execute (cyclomatic 19) · ×1
  • LocalSubagentInvocation.execute (cyclomatic 19) packages/core/src/agents/local-invocation.ts:102 — LocalSubagentInvocation.execute 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. This shape REPEATS in the file: one other method here (LocalSubagentInvocation.execute::onActivity) 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.
D1 · Cyclomatic Complexity · memoryService.buildExistingSkillsSummary (cyclomatic 19) · ×1
  • memoryService.buildExistingSkillsSummary (cyclomatic 19) REDACTED:729 — memoryService.buildExistingSkillsSummary 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.
D1 · Cyclomatic Complexity · WebFetchToolInvocation.executeExperimental (cyclomatic 19) · ×1
  • WebFetchToolInvocation.executeExperimental (cyclomatic 19) packages/core/src/tools/web-fetch.ts:596 — WebFetchToolInvocation.executeExperimental 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.
D1 · Cyclomatic Complexity · mcp-client.discoverTools (cyclomatic 19) · ×1
  • mcp-client.discoverTools (cyclomatic 19) packages/core/src/tools/mcp-client.ts:1309 — mcp-client.discoverTools has cyclomatic complexity 19 (threshold 15). Of this number, 10 points are the body's own statements and 9 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AcpSessionManager.newSession (cyclomatic 19) · ×1
  • AcpSessionManager.newSession (cyclomatic 19) packages/cli/src/acp/acpSessionManager.ts:66 — AcpSessionManager.newSession 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.
D1 · Cyclomatic Complexity · commentJson.preserveCommentsOnPropertyDeletion (cyclomatic 18) · ×1
  • commentJson.preserveCommentsOnPropertyDeletion (cyclomatic 18) packages/cli/src/utils/commentJson.ts:115 — commentJson.preserveCommentsOnPropertyDeletion has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
D1 · Cyclomatic Complexity · settings.migrateExperimentalSettings (cyclomatic 18) · ×1
  • settings.migrateExperimentalSettings (cyclomatic 18) packages/cli/src/config/settings.ts:1498 — settings.migrateExperimentalSettings has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 1535, a function literal at line 1610, migrateExperimental, …). 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.
D1 · Cyclomatic Complexity · formatters.formatResetTime (cyclomatic 18) · ×1
  • formatters.formatResetTime (cyclomatic 18) packages/cli/src/ui/utils/formatters.ts:109 — formatters.formatResetTime 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.
D1 · Cyclomatic Complexity · TableRenderer.TableRenderer (cyclomatic 18) · ×1
  • TableRenderer.TableRenderer (cyclomatic 18) packages/cli/src/ui/utils/TableRenderer.tsx:66 — TableRenderer.TableRenderer has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 10 function items inside it that branch (a function literal at line 95, a function literal at line 183, renderDataRow, …). 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.
D1 · Cyclomatic Complexity · StatsDisplay.StatsDisplay (cyclomatic 18) · ×1
  • StatsDisplay.StatsDisplay (cyclomatic 18) packages/cli/src/ui/components/StatsDisplay.tsx:242 — StatsDisplay.StatsDisplay has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to 2 function items inside it that branch. 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.
D1 · Cyclomatic Complexity · useTabbedNavigation.tabbedNavigationReducer (cyclomatic 18) · ×1
  • useTabbedNavigation.tabbedNavigationReducer (cyclomatic 18) packages/cli/src/ui/hooks/useTabbedNavigation.ts:69 — useTabbedNavigation.tabbedNavigationReducer 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.
D1 · Cyclomatic Complexity · useExtensionUpdates.useExtensionUpdates (cyclomatic 18) · ×1
  • useExtensionUpdates.useExtensionUpdates (cyclomatic 18) packages/cli/src/ui/hooks/useExtensionUpdates.ts:83 — useExtensionUpdates.useExtensionUpdates has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 118, 95, 129, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · useAgentStream.useAgentStream (cyclomatic 18) · ×1
  • useAgentStream.useAgentStream (cyclomatic 18) packages/cli/src/ui/hooks/useAgentStream.ts:114 — useAgentStream.useAgentStream has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 618, 539, 596, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · useGeminiStream.useGeminiStream.pendingToolGroupItems (cyclomatic 18) · ×1
  • useGeminiStream.useGeminiStream.pendingToolGroupItems (cyclomatic 18) packages/cli/src/ui/hooks/useGeminiStream.ts:610 — useGeminiStream.useGeminiStream.pendingToolGroupItems has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useApprovalModeIndicator.useApprovalModeIndicator (cyclomatic 18) · ×1
  • useApprovalModeIndicator.useApprovalModeIndicator (cyclomatic 18) packages/cli/src/ui/hooks/useApprovalModeIndicator.ts:26 — useApprovalModeIndicator.useApprovalModeIndicator has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to one function literal inside it that branches (line 42). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · activityLogger.callHttpRequest (cyclomatic 18) · ×1
  • activityLogger.callHttpRequest (cyclomatic 18) REDACTED:55 — activityLogger.callHttpRequest has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: ActivityLogger.patchGlobalFetch (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · paths.isTrustedSystemPath (cyclomatic 18) · ×1
  • paths.isTrustedSystemPath (cyclomatic 18) packages/core/src/utils/paths.ts:614 — paths.isTrustedSystemPath has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to 3 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · shell-utils.execStreaming (cyclomatic 18) · ×1
  • shell-utils.execStreaming (cyclomatic 18) packages/core/src/utils/shell-utils.ts:1354 — shell-utils.execStreaming has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 1443, a function literal at line 1436, a function literal at line 1390, …). 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.
D1 · Cyclomatic Complexity · shell-utils.detectBashSubstitution (cyclomatic 18) · ×1
  • shell-utils.detectBashSubstitution (cyclomatic 18) packages/core/src/utils/shell-utils.ts:1496 — shell-utils.detectBashSubstitution 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.
D1 · Cyclomatic Complexity · shell-utils.isAtPowerShellStatementBoundary (cyclomatic 18) · ×1
  • shell-utils.isAtPowerShellStatementBoundary (cyclomatic 18) packages/core/src/utils/shell-utils.ts:1687 — shell-utils.isAtPowerShellStatementBoundary has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · shell-utils.isPowerShellKeywordNestedParen (cyclomatic 18) · ×1
  • shell-utils.isPowerShellKeywordNestedParen (cyclomatic 18) packages/core/src/utils/shell-utils.ts:1847 — shell-utils.isPowerShellKeywordNestedParen has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · shell-utils.splitShellCommandSegments (cyclomatic 18) · ×1
  • shell-utils.splitShellCommandSegments (cyclomatic 18) packages/core/src/utils/shell-utils.ts:2301 — shell-utils.splitShellCommandSegments 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.
D1 · Cyclomatic Complexity · textUtils.normalizeEscapedNewlines (cyclomatic 18) · ×1
  • textUtils.normalizeEscapedNewlines (cyclomatic 18) packages/core/src/utils/textUtils.ts:315 — textUtils.normalizeEscapedNewlines has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · stdio.createWorkingStdio (cyclomatic 18) · ×1
  • stdio.createWorkingStdio (cyclomatic 18) packages/core/src/utils/stdio.ts:173 — stdio.createWorkingStdio has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 2 function items inside it that branch (workingStdoutWrite, a function literal at line 194). 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.
D1 · Cyclomatic Complexity · handler.handleFallback (cyclomatic 18) · ×1
  • handler.handleFallback (cyclomatic 18) packages/core/src/fallback/handler.ts:26 — handler.handleFallback has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sessionUtils.ensureStableToolIds (cyclomatic 18) · ×1
  • sessionUtils.ensureStableToolIds (cyclomatic 18) packages/core/src/utils/sessionUtils.ts:21 — sessionUtils.ensureStableToolIds has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ContextGraphBuilder.processHistory (cyclomatic 18) · ×1
  • ContextGraphBuilder.processHistory (cyclomatic 18) packages/core/src/context/graph/toGraph.ts:190 — ContextGraphBuilder.processHistory has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RemoteSessionInvocation.execute (cyclomatic 18) · ×1
  • RemoteSessionInvocation.execute (cyclomatic 18) packages/core/src/agents/remote-session-invocation.ts:117 — RemoteSessionInvocation.execute has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AnalyzeScreenshotInvocation.execute (cyclomatic 18) · ×1
  • AnalyzeScreenshotInvocation.execute (cyclomatic 18) packages/core/src/agents/browser/analyzeScreenshot.ts:84 — AnalyzeScreenshotInvocation.execute has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Scheduler._execute (cyclomatic 18) · ×1
  • Scheduler._execute (cyclomatic 18) packages/core/src/scheduler/scheduler.ts:787 — Scheduler._execute has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
D1 · Cyclomatic Complexity · memoryDiscovery.loadJitSubdirectoryMemory (cyclomatic 18) · ×1
  • memoryDiscovery.loadJitSubdirectoryMemory (cyclomatic 18) packages/core/src/utils/memoryDiscovery.ts:512 — memoryDiscovery.loadJitSubdirectoryMemory has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RecursiveFileSearch.handleFileWatcherEvent (cyclomatic 18) · ×1
  • RecursiveFileSearch.handleFileWatcherEvent (cyclomatic 18) packages/core/src/utils/filesearch/fileSearch.ts:207 — RecursiveFileSearch.handleFileWatcherEvent 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.
D1 · Cyclomatic Complexity · usageAggregator.collectFileTurnUsages (cyclomatic 18) · ×1
  • usageAggregator.collectFileTurnUsages (cyclomatic 18) packages/core/src/services/usageAggregator.ts:302 — usageAggregator.collectFileTurnUsages 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.
D1 · Cyclomatic Complexity · ide-installer.findCommand (cyclomatic 18) · ×1
  • ide-installer.findCommand (cyclomatic 18) REDACTED:24 — ide-installer.findCommand 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.
D1 · Cyclomatic Complexity · GrepToolInvocation.execute (cyclomatic 18) · ×1
  • GrepToolInvocation.execute (cyclomatic 18) REDACTED:182 — GrepToolInvocation.execute has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RipGrepTool.validateToolParamValues (cyclomatic 18) · ×1
  • RipGrepTool.validateToolParamValues (cyclomatic 18) REDACTED:659 — RipGrepTool.validateToolParamValues 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.
D1 · Cyclomatic Complexity · GlobToolInvocation.execute (cyclomatic 18) · ×1
  • GlobToolInvocation.execute (cyclomatic 18) packages/core/src/tools/glob.ts:138 — GlobToolInvocation.execute has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · config.resolveTelemetrySettings (cyclomatic 18) · ×1
  • config.resolveTelemetrySettings (cyclomatic 18) packages/core/src/telemetry/config.ts:218 — config.resolveTelemetrySettings 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.
D1 · Cyclomatic Complexity · PolicyEngine.applyShellHeuristics (cyclomatic 18) · ×1
  • PolicyEngine.applyShellHeuristics (cyclomatic 18) packages/core/src/policy/policy-engine.ts:391 — PolicyEngine.applyShellHeuristics has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · list.listMcpServers (cyclomatic 18) · ×1
  • list.listMcpServers (cyclomatic 18) packages/cli/src/commands/mcp/list.ts:194 — list.listMcpServers has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · useSnowfall.useSnowfall (cyclomatic 18) · ×1
  • useSnowfall.useSnowfall (cyclomatic 18) packages/cli/src/ui/hooks/useSnowfall.ts:60 — useSnowfall.useSnowfall has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 151, 113, 69, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · settings._doLoadSettings (cyclomatic 17) · ×1
  • settings._doLoadSettings (cyclomatic 17) packages/cli/src/config/settings.ts:938 — settings._doLoadSettings has cyclomatic complexity 17 (threshold 15). Of this number, 10 points are the body's own statements and 7 belong to 2 function items inside it that branch. 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.
D1 · Cyclomatic Complexity · extensionSettings.maybePromptForSettings (cyclomatic 17) · ×1
  • extensionSettings.maybePromptForSettings (cyclomatic 17) packages/cli/src/config/extensions/extensionSettings.ts:62 — extensionSettings.maybePromptForSettings 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.
D1 · Cyclomatic Complexity · KeypressContext.KeypressProvider (cyclomatic 17) · ×1
  • KeypressContext.KeypressProvider (cyclomatic 17) packages/cli/src/ui/contexts/KeypressContext.tsx:782 — KeypressContext.KeypressProvider has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 847, 868, 803, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · useSelectionList.useSelectionList (cyclomatic 17) · ×1
  • useSelectionList.useSelectionList (cyclomatic 17) packages/cli/src/ui/hooks/useSelectionList.ts:284 — useSelectionList.useSelectionList has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 354, 316, 334, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ToolConfirmationQueue.ToolConfirmationQueue (cyclomatic 17) · ×1
  • ToolConfirmationQueue.ToolConfirmationQueue (cyclomatic 17) packages/cli/src/ui/components/ToolConfirmationQueue.tsx:52 — ToolConfirmationQueue.ToolConfirmationQueue 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.
D1 · Cyclomatic Complexity · ColorsDisplay.ColorsDisplay (cyclomatic 17) · ×1
  • ColorsDisplay.ColorsDisplay (cyclomatic 17) packages/cli/src/ui/components/ColorsDisplay.tsx:80 — ColorsDisplay.ColorsDisplay has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (flattenColors, a function literal at line 193). 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.
D1 · Cyclomatic Complexity · EditorSettingsDialog.EditorSettingsDialog (cyclomatic 17) · ×1
  • EditorSettingsDialog.EditorSettingsDialog (cyclomatic 17) packages/cli/src/ui/components/EditorSettingsDialog.tsx:38 — EditorSettingsDialog.EditorSettingsDialog has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to 4 function items inside it that branch. 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.
D1 · Cyclomatic Complexity · FileCommandLoader.parseAndAdaptFile (cyclomatic 17) · ×1
  • FileCommandLoader.parseAndAdaptFile (cyclomatic 17) packages/cli/src/services/FileCommandLoader.ts:257 — FileCommandLoader.parseAndAdaptFile has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · rewindFileOps.revertFileChanges (cyclomatic 17) · ×1
  • rewindFileOps.revertFileChanges (cyclomatic 17) packages/cli/src/ui/utils/rewindFileOps.ts:183 — rewindFileOps.revertFileChanges 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.
D1 · Cyclomatic Complexity · mcpCommand.handleEnableDisable (cyclomatic 17) · ×1
  • mcpCommand.handleEnableDisable (cyclomatic 17) packages/cli/src/ui/commands/mcpCommand.ts:396 — mcpCommand.handleEnableDisable 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.
D1 · Cyclomatic Complexity · BuiltinCommandLoader.loadCommands (cyclomatic 17) · ×1
  • BuiltinCommandLoader.loadCommands (cyclomatic 17) packages/cli/src/services/BuiltinCommandLoader.ts:83 — BuiltinCommandLoader.loadCommands has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to 2 function items inside it that branch. 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.
D1 · Cyclomatic Complexity · paths.tildeifyPath (cyclomatic 17) · ×1
  • paths.tildeifyPath (cyclomatic 17) packages/core/src/utils/paths.ts:42 — paths.tildeifyPath 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.
D1 · Cyclomatic Complexity · ShellExecutionService.childProcessFallback · ×1
  • ShellExecutionService.childProcessFallback::handleOutput (cyclomatic 17) packages/core/src/services/shellExecutionService.ts:805 — ShellExecutionService.childProcessFallback::handleOutput 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.
D1 · Cyclomatic Complexity · AllowedPathChecker.check (cyclomatic 17) · ×1
  • AllowedPathChecker.check (cyclomatic 17) packages/core/src/safety/built-in.ts:34 — AllowedPathChecker.check 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.
D1 · Cyclomatic Complexity · getFolderStructure.formatStructure (cyclomatic 17) · ×1
  • getFolderStructure.formatStructure (cyclomatic 17) packages/core/src/utils/getFolderStructure.ts:233 — getFolderStructure.formatStructure 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.
D1 · Cyclomatic Complexity · retry.isRetryableError (cyclomatic 17) · ×1
  • retry.isRetryableError (cyclomatic 17) packages/core/src/utils/retry.ts:191 — retry.isRetryableError 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.
D1 · Cyclomatic Complexity · ModelConfigService.getAvailableModelOptions (cyclomatic 17) · ×1
  • ModelConfigService.getAvailableModelOptions (cyclomatic 17) packages/core/src/services/modelConfigService.ts:158 — ModelConfigService.getAvailableModelOptions has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 197, 170, 176, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · nextSpeakerChecker.checkNextSpeaker (cyclomatic 17) · ×1
  • nextSpeakerChecker.checkNextSpeaker (cyclomatic 17) packages/core/src/utils/nextSpeakerChecker.ts:44 — nextSpeakerChecker.checkNextSpeaker 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.
D1 · Cyclomatic Complexity · rollingSummaryProcessor.createRollingSummaryProcessor.process (cyclomatic 17) · ×1
  • rollingSummaryProcessor.createRollingSummaryProcessor.process (cyclomatic 17) packages/core/src/context/processors/rollingSummaryProcessor.ts:74 — rollingSummaryProcessor.createRollingSummaryProcessor.process 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.
D1 · Cyclomatic Complexity · EditTool.validateToolParamValues (cyclomatic 17) · ×1
  • EditTool.validateToolParamValues (cyclomatic 17) REDACTED:1191 — EditTool.validateToolParamValues 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.
D1 · Cyclomatic Complexity · EditTool.getModifyContext (cyclomatic 17) · ×1
  • EditTool.getModifyContext (cyclomatic 17) REDACTED:1280 — EditTool.getModifyContext has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 3 function items inside it that branch (resolvePath, a function literal at line 1350, a function literal at line 1339). 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.
D1 · Cyclomatic Complexity · agentLoader.markdownToAgentDefinition (cyclomatic 17) · ×1
  • agentLoader.markdownToAgentDefinition (cyclomatic 17) REDACTED:497 — agentLoader.markdownToAgentDefinition 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.
D1 · Cyclomatic Complexity · memoryDiscovery.findProjectRoot (cyclomatic 17) · ×1
  • memoryDiscovery.findProjectRoot (cyclomatic 17) packages/core/src/utils/memoryDiscovery.ts:150 — memoryDiscovery.findProjectRoot 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.
D1 · Cyclomatic Complexity · WebFetchToolInvocation.execute (cyclomatic 17) · ×1
  • WebFetchToolInvocation.execute (cyclomatic 17) packages/core/src/tools/web-fetch.ts:772 — WebFetchToolInvocation.execute has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · ShellToolInvocation.simplifyPaths (cyclomatic 17) · ×1
  • ShellToolInvocation.simplifyPaths (cyclomatic 17) packages/core/src/tools/shell.ts:184 — ShellToolInvocation.simplifyPaths 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.
D1 · Cyclomatic Complexity · chatRecordingService.createJsonlRecordAccumulator.finalize (cyclomatic 17) · ×1
  • chatRecordingService.createJsonlRecordAccumulator.finalize (cyclomatic 17) packages/core/src/services/chatRecordingService.ts:566 — chatRecordingService.createJsonlRecordAccumulator.finalize has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
D1 · Cyclomatic Complexity · add.addMcpServer (cyclomatic 17) · ×1
  • add.addMcpServer (cyclomatic 17) packages/cli/src/commands/mcp/add.ts:17 — add.addMcpServer has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · readStdin.readStdin (cyclomatic 17) · ×1
  • readStdin.readStdin (cyclomatic 17) packages/cli/src/utils/readStdin.ts:35 — readStdin.readStdin has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 59, 114, 100, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · gemini.setupUnhandledRejectionHandler · ×1
  • gemini.setupUnhandledRejectionHandler::geminiUncaughtExceptionListener (cyclomatic 17) packages/cli/src/gemini.tsx:228 — gemini.setupUnhandledRejectionHandler::geminiUncaughtExceptionListener 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.
D1 · Cyclomatic Complexity · EnumSelector.EnumSelector (cyclomatic 17) · ×1
  • EnumSelector.EnumSelector (cyclomatic 17) packages/cli/src/ui/components/shared/EnumSelector.tsx:23 — EnumSelector.EnumSelector has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to 2 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · extension.activate (cyclomatic 17) · ×1
  • extension.activate (cyclomatic 17) packages/vscode-ide-companion/src/extension.ts:113 — extension.activate has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 199, 144, 152, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · GeminiSandbox.ApplyBulkAcls (cyclomatic 16) · ×1
  • GeminiSandbox.ApplyBulkAcls (cyclomatic 16) packages/core/src/sandbox/windows/GeminiSandbox.cs:422 — GeminiSandbox.ApplyBulkAcls 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.
D1 · Cyclomatic Complexity · settings-validation.buildZodSchemaFromJsonSchema (cyclomatic 16) · ×1
  • settings-validation.buildZodSchemaFromJsonSchema (cyclomatic 16) packages/cli/src/config/settings-validation.ts:17 — settings-validation.buildZodSchemaFromJsonSchema 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.
D1 · Cyclomatic Complexity · settings.loadEnvironment (cyclomatic 16) · ×1
  • settings.loadEnvironment (cyclomatic 16) packages/cli/src/config/settings.ts:701 — settings.loadEnvironment 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.
D1 · Cyclomatic Complexity · useHistoryManager.useHistory (cyclomatic 16) · ×1
  • useHistoryManager.useHistory (cyclomatic 16) packages/cli/src/ui/hooks/useHistoryManager.ts:37 — useHistoryManager.useHistory has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 65, 74, 144). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · SessionContext.areModelMetricsEqual (cyclomatic 16) · ×1
  • SessionContext.areModelMetricsEqual (cyclomatic 16) packages/cli/src/ui/contexts/SessionContext.tsx:31 — SessionContext.areModelMetricsEqual has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · clipboardUtils.saveClipboardImage (cyclomatic 16) · ×1
  • clipboardUtils.saveClipboardImage (cyclomatic 16) packages/cli/src/ui/utils/clipboardUtils.ts:272 — clipboardUtils.saveClipboardImage 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.
D1 · Cyclomatic Complexity · SlicingMaxSizedBox.SlicingMaxSizedBox (cyclomatic 16) · ×1
  • SlicingMaxSizedBox.SlicingMaxSizedBox (cyclomatic 16) packages/cli/src/ui/components/shared/SlicingMaxSizedBox.tsx:27 — SlicingMaxSizedBox.SlicingMaxSizedBox has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function literal inside it that branches (line 34). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ScrollProvider.ScrollProvider · ×1
  • ScrollProvider.ScrollProvider::handleLeftPress (cyclomatic 16) packages/cli/src/ui/contexts/ScrollProvider.tsx:258 — ScrollProvider.ScrollProvider::handleLeftPress 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.
D1 · Cyclomatic Complexity · ShellToolMessage.ShellToolMessage (cyclomatic 16) · ×1
  • ShellToolMessage.ShellToolMessage (cyclomatic 16) packages/cli/src/ui/components/messages/ShellToolMessage.tsx:44 — ShellToolMessage.ShellToolMessage has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 100, a function literal at line 129, handleFocus). 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.
D1 · Cyclomatic Complexity · github_fetch.fetchJson (cyclomatic 16) · ×1
  • github_fetch.fetchJson (cyclomatic 16) packages/cli/src/config/extensions/github_fetch.ts:63 — github_fetch.fetchJson has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 112, 173, 87, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · useStaticHistoryStartIndex.countToolResultChars (cyclomatic 16) · ×1
  • useStaticHistoryStartIndex.countToolResultChars (cyclomatic 16) packages/cli/src/ui/hooks/useStaticHistoryStartIndex.ts:26 — useStaticHistoryStartIndex.countToolResultChars 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.
D1 · Cyclomatic Complexity · useInlineEditBuffer.editBufferReducer (cyclomatic 16) · ×1
  • useInlineEditBuffer.editBufferReducer (cyclomatic 16) packages/cli/src/ui/hooks/useInlineEditBuffer.ts:33 — useInlineEditBuffer.editBufferReducer has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · useAuth.useAuthCommand (cyclomatic 16) · ×1
  • useAuth.useAuthCommand (cyclomatic 16) packages/cli/src/ui/auth/useAuth.ts:43 — useAuth.useAuthCommand has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 91, 82). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · SessionBrowser.SessionItem (cyclomatic 16) · ×1
  • SessionBrowser.SessionItem (cyclomatic 16) packages/cli/src/ui/components/SessionBrowser.tsx:198 — SessionBrowser.SessionItem has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
D1 · Cyclomatic Complexity · VoiceModelDialog.VoiceModelDialog (cyclomatic 16) · ×1
  • VoiceModelDialog.VoiceModelDialog (cyclomatic 16) packages/cli/src/ui/components/VoiceModelDialog.tsx:52 — VoiceModelDialog.VoiceModelDialog has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · useShellCompletion.scanPathExecutables (cyclomatic 16) · ×1
  • useShellCompletion.scanPathExecutables (cyclomatic 16) packages/cli/src/ui/hooks/useShellCompletion.ts:183 — useShellCompletion.scanPathExecutables has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 262, 254). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · useCommandCompletion.useCommandCompletion.handleAutocomplete (cyclomatic 16) · ×1
  • useCommandCompletion.useCommandCompletion.handleAutocomplete (cyclomatic 16) packages/cli/src/ui/hooks/useCommandCompletion.tsx:405 — useCommandCompletion.useCommandCompletion.handleAutocomplete has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · DefaultAppLayout.DefaultAppLayout (cyclomatic 16) · ×1
  • DefaultAppLayout.DefaultAppLayout (cyclomatic 16) packages/cli/src/ui/layouts/DefaultAppLayout.tsx:22 — DefaultAppLayout.DefaultAppLayout 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.
D1 · Cyclomatic Complexity · ExtensionRegistryView.ExtensionRegistryView (cyclomatic 16) · ×1
  • ExtensionRegistryView.ExtensionRegistryView (cyclomatic 16) packages/cli/src/ui/components/views/ExtensionRegistryView.tsx:44 — ExtensionRegistryView.ExtensionRegistryView has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 139, 72, 205). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · extensionsCommand.restartAction (cyclomatic 16) · ×1
  • extensionsCommand.restartAction (cyclomatic 16) packages/cli/src/ui/commands/extensionsCommand.ts:155 — extensionsCommand.restartAction has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
D1 · Cyclomatic Complexity · skillUtils.installSkill (cyclomatic 16) · ×1
  • skillUtils.installSkill (cyclomatic 16) packages/cli/src/utils/skillUtils.ts:93 — skillUtils.installSkill 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.
D1 · Cyclomatic Complexity · useGeminiStream.useGeminiStream.prepareQueryForGemini (cyclomatic 16) · ×1
  • useGeminiStream.useGeminiStream.prepareQueryForGemini (cyclomatic 16) packages/cli/src/ui/hooks/useGeminiStream.ts:1093 — useGeminiStream.useGeminiStream.prepareQueryForGemini 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.
D1 · Cyclomatic Complexity · useGeminiStream.useGeminiStream.handleApprovalModeChange (cyclomatic 16) · ×1
  • useGeminiStream.useGeminiStream.handleApprovalModeChange (cyclomatic 16) packages/cli/src/ui/hooks/useGeminiStream.ts:2055 — useGeminiStream.useGeminiStream.handleApprovalModeChange has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to 2 function literals inside it that branch. 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.
D1 · Cyclomatic Complexity · useIncludeDirsTrust.useIncludeDirsTrust (cyclomatic 16) · ×1
  • useIncludeDirsTrust.useIncludeDirsTrust (cyclomatic 16) packages/cli/src/ui/hooks/useIncludeDirsTrust.tsx:54 — useIncludeDirsTrust.useIncludeDirsTrust has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function literal inside it that branches (line 62). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · useSuspend.useSuspend (cyclomatic 16) · ×1
  • useSuspend.useSuspend (cyclomatic 16) packages/cli/src/ui/hooks/useSuspend.ts:33 — useSuspend.useSuspend has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 56, 93, 43). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ShellExecutionService.background (cyclomatic 16) · ×1
  • ShellExecutionService.background (cyclomatic 16) packages/core/src/services/shellExecutionService.ts:1951 — ShellExecutionService.background 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.
D1 · Cyclomatic Complexity · ShellExecutionService.resizePty (cyclomatic 16) · ×1
  • ShellExecutionService.resizePty (cyclomatic 16) packages/core/src/services/shellExecutionService.ts:2064 — ShellExecutionService.resizePty 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.
D1 · Cyclomatic Complexity · grep-utils.enrichWithAutoContext (cyclomatic 16) · ×1
  • grep-utils.enrichWithAutoContext (cyclomatic 16) packages/core/src/tools/grep-utils.ts:66 — grep-utils.enrichWithAutoContext 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.
D1 · Cyclomatic Complexity · stable-stringify.stableStringify · ×1
  • stable-stringify.stableStringify::stringify (cyclomatic 16) packages/core/src/policy/stable-stringify.ts:60 — stable-stringify.stableStringify::stringify 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.
D1 · Cyclomatic Complexity · markdownUtils.jsonToMarkdown (cyclomatic 16) · ×1
  • markdownUtils.jsonToMarkdown (cyclomatic 16) packages/core/src/utils/markdownUtils.ts:23 — markdownUtils.jsonToMarkdown has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · fetch.safeLookup (cyclomatic 16) · ×1
  • fetch.safeLookup (cyclomatic 16) packages/core/src/utils/fetch.ts:57 — fetch.safeLookup has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · partUtils.partToString (cyclomatic 16) · ×1
  • partUtils.partToString (cyclomatic 16) packages/core/src/utils/partUtils.ts:18 — partUtils.partToString 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.
D1 · Cyclomatic Complexity · ignorePathUtils.getNormalizedRelativePath (cyclomatic 16) · ×1
  • ignorePathUtils.getNormalizedRelativePath (cyclomatic 16) packages/core/src/utils/ignorePathUtils.ts:16 — ignorePathUtils.getNormalizedRelativePath 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.
D1 · Cyclomatic Complexity · historyHardening.scrubPart (cyclomatic 16) · ×1
  • historyHardening.scrubPart (cyclomatic 16) packages/core/src/utils/historyHardening.ts:590 — historyHardening.scrubPart 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.
D1 · Cyclomatic Complexity · geminiChat.stripThoughts (cyclomatic 16) · ×1
  • geminiChat.stripThoughts (cyclomatic 16) packages/core/src/core/geminiChat.ts:2224 — geminiChat.stripThoughts has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · toGraph.getStableId (cyclomatic 16) · ×1
  • toGraph.getStableId (cyclomatic 16) packages/core/src/context/graph/toGraph.ts:97 — toGraph.getStableId 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.
D1 · Cyclomatic Complexity · ToolOutputMaskingService.formatShellPreview (cyclomatic 16) · ×1
  • ToolOutputMaskingService.formatShellPreview (cyclomatic 16) packages/core/src/context/toolOutputMaskingService.ts:301 — ToolOutputMaskingService.formatShellPreview 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.
D1 · Cyclomatic Complexity · edit.calculateFuzzyReplacement (cyclomatic 16) · ×1
  • edit.calculateFuzzyReplacement (cyclomatic 16) REDACTED:1430 — edit.calculateFuzzyReplacement has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · security.parseWindowsBatchSecurityOutput (cyclomatic 16) · ×1
  • security.parseWindowsBatchSecurityOutput (cyclomatic 16) packages/core/src/utils/security.ts:185 — security.parseWindowsBatchSecurityOutput has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · agentLoader.guessIntendedKind (cyclomatic 16) · ×1
  • agentLoader.guessIntendedKind (cyclomatic 16) REDACTED:265 — agentLoader.guessIntendedKind has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · McpToolInvocation.execute (cyclomatic 16) · ×1
  • McpToolInvocation.execute (cyclomatic 16) packages/core/src/agents/browser/mcpToolWrapper.ts:121 — McpToolInvocation.execute has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sessionScratchpadUtils.tokenizeShellCommand (cyclomatic 16) · ×1
  • sessionScratchpadUtils.tokenizeShellCommand (cyclomatic 16) packages/core/src/services/sessionScratchpadUtils.ts:15 — sessionScratchpadUtils.tokenizeShellCommand 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.
D1 · Cyclomatic Complexity · admin_controls.sanitizeAdminSettings (cyclomatic 16) · ×1
  • admin_controls.sanitizeAdminSettings (cyclomatic 16) packages/core/src/code_assist/admin/admin_controls.ts:22 — admin_controls.sanitizeAdminSettings 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.
D1 · Cyclomatic Complexity · sessionOperations.deleteSessionFileAndArtifacts (cyclomatic 16) · ×1
  • sessionOperations.deleteSessionFileAndArtifacts (cyclomatic 16) packages/core/src/utils/sessionOperations.ts:215 — sessionOperations.deleteSessionFileAndArtifacts 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.
D1 · Cyclomatic Complexity · GrepTool.validateToolParamValues (cyclomatic 16) · ×1
  • GrepTool.validateToolParamValues (cyclomatic 16) REDACTED:711 — GrepTool.validateToolParamValues 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.
D1 · Cyclomatic Complexity · WebSearchToolInvocation.execute (cyclomatic 16) · ×1
  • WebSearchToolInvocation.execute (cyclomatic 16) packages/core/src/tools/web-search.ts:89 — WebSearchToolInvocation.execute has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · McpClient.refreshTools (cyclomatic 16) · ×1
  • McpClient.refreshTools (cyclomatic 16) packages/core/src/tools/mcp-client.ts:699 — McpClient.refreshTools 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.
D1 · Cyclomatic Complexity · config.parseOtlpHeaders (cyclomatic 16) · ×1
  • config.parseOtlpHeaders (cyclomatic 16) packages/core/src/telemetry/config.ts:141 — config.parseOtlpHeaders 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.
D1 · Cyclomatic Complexity · CheckerRunner.executeCheckerProcess (cyclomatic 16) · ×1
  • CheckerRunner.executeCheckerProcess (cyclomatic 16) packages/core/src/safety/checker-runner.ts:163 — CheckerRunner.executeCheckerProcess has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 168, 213, 255, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · PolicyEngine.constructor (cyclomatic 16) · ×1
  • PolicyEngine.constructor (cyclomatic 16) packages/core/src/policy/policy-engine.ts:255 — PolicyEngine.constructor 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.
D1 · Cyclomatic Complexity · tools.hasCycleInSchema · ×1
  • tools.hasCycleInSchema::traverse (cyclomatic 16) packages/core/src/tools/tools.ts:823 — tools.hasCycleInSchema::traverse 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.
D1 · Cyclomatic Complexity · ReadMcpResourceToolInvocation.execute (cyclomatic 16) · ×1
  • ReadMcpResourceToolInvocation.execute (cyclomatic 16) packages/core/src/tools/read-mcp-resource.ts:82 — ReadMcpResourceToolInvocation.execute 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.
D1 · Cyclomatic Complexity · chatRecordingService.createJsonlRecordAccumulator.applySinglePatch (cyclomatic 16) · ×1
  • chatRecordingService.createJsonlRecordAccumulator.applySinglePatch (cyclomatic 16) packages/core/src/services/chatRecordingService.ts:283 — chatRecordingService.createJsonlRecordAccumulator.applySinglePatch 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.
D1 · Cyclomatic Complexity · chatRecordingService.parseLegacyContentFallback (cyclomatic 16) · ×1
  • chatRecordingService.parseLegacyContentFallback (cyclomatic 16) packages/core/src/services/chatRecordingService.ts:1774 — chatRecordingService.parseLegacyContentFallback has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · migrate.migrateClaudeHooks (cyclomatic 16) · ×1
  • migrate.migrateClaudeHooks (cyclomatic 16) packages/cli/src/commands/hooks/migrate.ts:115 — migrate.migrateClaudeHooks has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · logs.readLastLines (cyclomatic 16) · ×1
  • logs.readLastLines (cyclomatic 16) packages/cli/src/commands/gemma/logs.ts:14 — logs.readLastLines 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.
D1 · Cyclomatic Complexity · sandboxUtils.entrypoint (cyclomatic 16) · ×1
  • sandboxUtils.entrypoint (cyclomatic 16) packages/cli/src/utils/sandboxUtils.ts:375 — sandboxUtils.entrypoint 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.
D1 · Cyclomatic Complexity · Session.streamHistory (cyclomatic 16) · ×1
  • Session.streamHistory (cyclomatic 16) packages/cli/src/acp/acpSession.ts:267 — Session.streamHistory 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.
D1 · Cyclomatic Complexity · validate_skill.validateSkill (cyclomatic 16) · ×1
  • validate_skill.validateSkill (cyclomatic 16) REDACTED:15 — validate_skill.validateSkill 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.
D1 · Cyclomatic Complexity · package_skill.main (cyclomatic 16) · ×1
  • package_skill.main (cyclomatic 16) packages/core/src/skills/builtin/skill-creator/scripts/package_skill.cjs:20 — package_skill.main 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.
D1 · Cyclomatic Complexity · App.CodeView (cyclomatic 16) · ×1
  • App.CodeView (cyclomatic 16) packages/devtools/client/src/App.tsx:1829 — App.CodeView has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 3 function items inside it that branch (handleKeyDown, a function literal at line 1919, a function literal at line 1835). 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.
D1 · Cyclomatic Complexity · github.handleEgressEvent (cyclomatic 16) · ×1
  • github.handleEgressEvent (cyclomatic 16) tools/caretaker-agent/cloudrun/egress-service/src/actions/github.ts:39 — github.handleEgressEvent 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.
D2 · Cognitive Complexity · InputPrompt.InputPrompt (cognitive 535) · ×1
  • InputPrompt.InputPrompt (cognitive 535) packages/cli/src/ui/components/InputPrompt.tsx:207 — InputPrompt.InputPrompt has cognitive complexity 535 (threshold 15). Drivers by points: if/else 173 (337 pts), boolean chains 105, ternaries 36 (74 pts), loops 5 (18 pts), error handling 1 (nesting depth added 215). Of this number, 45 points are the body's own statements and 490 belong to 21 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · vim-buffer-actions.handleVimAction (cognitive 394) · ×1
  • vim-buffer-actions.handleVimAction (cognitive 394) packages/cli/src/ui/components/shared/vim-buffer-actions.ts:164 — vim-buffer-actions.handleVimAction has cognitive complexity 394 (threshold 15). Drivers by points: if/else 116 (272 pts), loops 24 (50 pts), boolean chains 49, ternaries 10 (20 pts), match/switch 2 (3 pts) (nesting depth added 193). 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.
D2 · Cognitive Complexity · AppContainer.AppContainer (cognitive 310) · ×1
  • AppContainer.AppContainer (cognitive 310) packages/cli/src/ui/AppContainer.tsx:338 — AppContainer.AppContainer has cognitive complexity 310 (threshold 15). Drivers by points: if/else 141 (197 pts), boolean chains 79, ternaries 15 (24 pts), error handling 6 (9 pts), match/switch 1 (nesting depth added 68). Of this number, 28 points are the body's own statements and 282 belong to 63 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · vim.useVim.handleInput (cognitive 274) · ×1
  • vim.useVim.handleInput (cognitive 274) packages/cli/src/ui/hooks/vim.ts:660 — vim.useVim.handleInput has cognitive complexity 274 (threshold 15). Drivers by points: if/else 83 (234 pts), ternaries 5 (23 pts), boolean chains 11, loops 1 (3 pts), match/switch 1 (2 pts), error handling 1 (nesting depth added 172). 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.
D2 · Cognitive Complexity · ShellToolInvocation.execute (cognitive 254) · ×1
  • ShellToolInvocation.execute (cognitive 254) packages/core/src/tools/shell.ts:635 — ShellToolInvocation.execute has cognitive complexity 254 (threshold 15). Drivers by points: if/else 74 (157 pts), boolean chains 36, loops 5 (24 pts), error handling 6 (22 pts), ternaries 9 (14 pts), match/switch 1 (nesting depth added 123). Of this number, 221 points are the body's own statements and 33 belong to 8 function items inside it that branch. 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.
D2 · Cognitive Complexity · sandbox.start_sandbox (cognitive 231) · ×1
  • sandbox.start_sandbox (cognitive 231) packages/cli/src/utils/sandbox.ts:120 — sandbox.start_sandbox has cognitive complexity 231 (threshold 15). Drivers by points: if/else 93 (171 pts), error handling 11 (27 pts), boolean chains 22, ternaries 13 (21 pts), loops 6 (14 pts) (nesting depth added 110). To reduce it, split the body into named stages: move each independent 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 (sandbox.start_sandbox::cleanup) 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.
D2 · Cognitive Complexity · nonInteractiveCli.runNonInteractive (cognitive 225) · ×1
  • nonInteractiveCli.runNonInteractive (cognitive 225) packages/cli/src/nonInteractiveCli.ts:77 — nonInteractiveCli.runNonInteractive has cognitive complexity 225 (threshold 15). Drivers by points: if/else 72 (137 pts), ternaries 15 (55 pts), boolean chains 20, error handling 3 (7 pts), loops 3 (6 pts) (nesting depth added 112). Most of this is not in the body itself: 1 of the 225 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 90, 110, 221, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · chatRecordingService.createJsonlRecordAccumulator.processLine (cognitive 212) · ×1
  • chatRecordingService.createJsonlRecordAccumulator.processLine (cognitive 212) packages/core/src/services/chatRecordingService.ts:319 — chatRecordingService.createJsonlRecordAccumulator.processLine has cognitive complexity 212 (threshold 15). Drivers by points: if/else 56 (155 pts), loops 12 (43 pts), boolean chains 13, error handling 1 (nesting depth added 130). 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.
D2 · Cognitive Complexity · Session.#resolvePrompt (cognitive 205) · ×1
  • Session.#resolvePrompt (cognitive 205) packages/cli/src/acp/acpSession.ts:1007 — Session.#resolvePrompt has cognitive complexity 205 (threshold 15). Drivers by points: if/else 59 (141 pts), ternaries 6 (20 pts), boolean chains 18, error handling 5 (16 pts), loops 5 (9 pts), match/switch 1 (nesting depth added 111). Of this number, 200 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
D2 · Cognitive Complexity · nonInteractiveCliAgentSession.runNonInteractive (cognitive 203) · ×1
  • nonInteractiveCliAgentSession.runNonInteractive (cognitive 203) packages/cli/src/nonInteractiveCliAgentSession.ts:82 — nonInteractiveCliAgentSession.runNonInteractive has cognitive complexity 203 (threshold 15). Drivers by points: if/else 62 (130 pts), ternaries 19 (47 pts), boolean chains 17, loops 2 (5 pts), match/switch 2 (3 pts), error handling 1 (nesting depth added 100). None of this is in the body itself: all 203 points belong to 11 function literals inside it that branch (lines 89, 413, 109, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · text-buffer.textBufferReducerLogic (cognitive 200) · ×1
  • text-buffer.textBufferReducerLogic (cognitive 200) packages/cli/src/ui/components/shared/text-buffer.ts:1787 — text-buffer.textBufferReducerLogic has cognitive complexity 200 (threshold 15). Drivers by points: if/else 66 (152 pts), boolean chains 20, ternaries 6 (14 pts), loops 2 (8 pts), match/switch 3 (6 pts) (nesting depth added 103). Of this number, 192 points are the body's own statements and 8 belong to 2 function items inside it that branch. 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.
D2 · Cognitive Complexity · KeypressContext.emitKeys (cognitive 199) · ×1
  • KeypressContext.emitKeys (cognitive 199) packages/cli/src/ui/contexts/KeypressContext.tsx:380 — KeypressContext.emitKeys has cognitive complexity 199 (threshold 15). Drivers by points: if/else 52 (140 pts), boolean chains 29, loops 6 (25 pts), error handling 1 (5 pts) (nesting depth added 111). 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.
D2 · Cognitive Complexity · retry.retryWithBackoff (cognitive 184) · ×1
  • retry.retryWithBackoff (cognitive 184) packages/core/src/utils/retry.ts:284 — retry.retryWithBackoff has cognitive complexity 184 (threshold 15). Drivers by points: if/else 34 (124 pts), ternaries 5 (21 pts), boolean chains 19, error handling 4 (19 pts), loops 1 (nesting depth added 121). Of this number, 183 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
D2 · Cognitive Complexity · ToolConfirmationMessage.ToolConfirmationMessage (cognitive 181) · ×1
  • ToolConfirmationMessage.ToolConfirmationMessage (cognitive 181) packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx:65 — ToolConfirmationMessage.ToolConfirmationMessage has cognitive complexity 181 (threshold 15). Drivers by points: if/else 63 (98 pts), boolean chains 52, ternaries 14 (25 pts), error handling 2 (4 pts), loops 1 (2 pts) (nesting depth added 49). Of this number, 20 points are the body's own statements and 161 belong to 14 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiChat.processStreamResponse (cognitive 181) · ×1
  • GeminiChat.processStreamResponse (cognitive 181) packages/core/src/core/geminiChat.ts:1590 — GeminiChat.processStreamResponse has cognitive complexity 181 (threshold 15). Drivers by points: if/else 51 (136 pts), loops 9 (20 pts), boolean chains 16, ternaries 3 (9 pts) (nesting depth added 102). Of this number, 172 points are the body's own statements and 9 belong to 2 function literals inside it that branch. 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.
D2 · Cognitive Complexity · sessionUtils.convertSessionToClientHistory (cognitive 180) · ×1
  • sessionUtils.convertSessionToClientHistory (cognitive 180) packages/core/src/utils/sessionUtils.ts:121 — sessionUtils.convertSessionToClientHistory has cognitive complexity 180 (threshold 15). Drivers by points: if/else 32 (124 pts), loops 6 (28 pts), ternaries 4 (18 pts), boolean chains 10 (nesting depth added 128). Of this number, 160 points are the body's own statements and 20 belong to 2 function literals inside it that branch. 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.
D2 · Cognitive Complexity · TriageDuplicates.TriageDuplicates (cognitive 159) · ×1
  • TriageDuplicates.TriageDuplicates (cognitive 159) packages/cli/src/ui/components/triage/TriageDuplicates.tsx:105 — TriageDuplicates.TriageDuplicates has cognitive complexity 159 (threshold 15). Drivers by points: if/else 56 (77 pts), boolean chains 38, ternaries 20 (38 pts), error handling 4, loops 2 (nesting depth added 39). Of this number, 29 points are the body's own statements and 130 belong to 22 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · shell-utils.detectPowerShellSubstitution (cognitive 138) · ×1
  • shell-utils.detectPowerShellSubstitution (cognitive 138) packages/core/src/utils/shell-utils.ts:2009 — shell-utils.detectPowerShellSubstitution has cognitive complexity 138 (threshold 15). Drivers by points: if/else 38 (104 pts), boolean chains 23, ternaries 2 (7 pts), loops 2 (4 pts) (nesting depth added 73). 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.
D2 · Cognitive Complexity · ContextCompressionService.compressHistory (cognitive 131) · ×1
  • ContextCompressionService.compressHistory (cognitive 131) packages/core/src/context/contextCompressionService.ts:108 — ContextCompressionService.compressHistory has cognitive complexity 131 (threshold 15). Drivers by points: if/else 29 (96 pts), loops 10 (20 pts), boolean chains 15 (nesting depth added 77). Of this number, 130 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
D2 · Cognitive Complexity · VirtualizedList.VirtualizedList (cognitive 129) · ×1
  • VirtualizedList.VirtualizedList (cognitive 129) packages/cli/src/ui/components/shared/VirtualizedList.tsx:129 — VirtualizedList.VirtualizedList has cognitive complexity 129 (threshold 15). Drivers by points: if/else 42 (65 pts), boolean chains 34, ternaries 18 (25 pts), loops 5 (nesting depth added 30). Of this number, 22 points are the body's own statements and 107 belong to 19 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CoderAgentExecutor.execute (cognitive 119) · ×1
  • CoderAgentExecutor.execute (cognitive 119) packages/a2a-server/src/agent/executor.ts:441 — CoderAgentExecutor.execute has cognitive complexity 119 (threshold 15). Drivers by points: if/else 46 (80 pts), error handling 10 (20 pts), boolean chains 7, ternaries 3 (7 pts), loops 3 (5 pts) (nesting depth added 50). Most of this is not in the body itself: 10 of the 119 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 494, 584, 504, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · PolicyEngine.check (cognitive 118) · ×1
  • PolicyEngine.check (cognitive 118) packages/core/src/policy/policy-engine.ts:730 — PolicyEngine.check has cognitive complexity 118 (threshold 15). Drivers by points: if/else 34 (75 pts), boolean chains 20, loops 5 (12 pts), ternaries 3 (7 pts), error handling 1 (4 pts) (nesting depth added 55). Of this number, 115 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
D2 · Cognitive Complexity · toml-loader.loadPoliciesFromToml (cognitive 115) · ×1
  • toml-loader.loadPoliciesFromToml (cognitive 115) packages/core/src/policy/toml-loader.ts:325 — toml-loader.loadPoliciesFromToml has cognitive complexity 115 (threshold 15). Drivers by points: if/else 16 (55 pts), ternaries 6 (22 pts), loops 7 (20 pts), error handling 5 (16 pts), boolean chains 2 (nesting depth added 79). Of this number, 78 points are the body's own statements and 37 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InboxDialog.InboxDialog (cognitive 114) · ×1
  • InboxDialog.InboxDialog (cognitive 114) packages/cli/src/ui/components/InboxDialog.tsx:331 — InboxDialog.InboxDialog has cognitive complexity 114 (threshold 15). Drivers by points: if/else 38 (47 pts), ternaries 16 (26 pts), boolean chains 25, error handling 9 (11 pts), loops 3 (5 pts) (nesting depth added 23). Of this number, 24 points are the body's own statements and 90 belong to 24 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config.loadCliConfig (cognitive 110) · ×1
  • config.loadCliConfig (cognitive 110) packages/cli/src/config/config.ts:663 — config.loadCliConfig has cognitive complexity 110 (threshold 15). Drivers by points: if/else 35 (49 pts), boolean chains 38, ternaries 14 (18 pts), error handling 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 20). Of this number, 105 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gemini.main (cognitive 110) · ×1
  • gemini.main (cognitive 110) packages/cli/src/gemini.tsx:469 — gemini.main has cognitive complexity 110 (threshold 15). Drivers by points: if/else 44 (71 pts), boolean chains 18, ternaries 6 (10 pts), error handling 3 (7 pts), loops 2 (4 pts) (nesting depth added 37). Of this number, 99 points are the body's own statements and 11 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatRecordingService.updateMessagesFromHistory (cognitive 106) · ×1
  • ChatRecordingService.updateMessagesFromHistory (cognitive 106) packages/core/src/services/chatRecordingService.ts:1548 — ChatRecordingService.updateMessagesFromHistory has cognitive complexity 106 (threshold 15). Drivers by points: if/else 30 (80 pts), boolean chains 12, loops 5 (8 pts), ternaries 2 (5 pts), error handling 1 (nesting depth added 56). Of this number, 104 points are the body's own statements and 2 belong to 2 function items inside it that branch. 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.
D2 · Cognitive Complexity · sessionCleanup.cleanupExpiredSessions (cognitive 105) · ×1
  • sessionCleanup.cleanupExpiredSessions (cognitive 105) packages/cli/src/utils/sessionCleanup.ts:102 — sessionCleanup.cleanupExpiredSessions has cognitive complexity 105 (threshold 15). Drivers by points: if/else 21 (58 pts), ternaries 5 (21 pts), error handling 5 (16 pts), boolean chains 6, loops 2 (4 pts) (nesting depth added 66). Of this number, 103 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · consent.extensionConsentString (cognitive 105) · ×1
  • consent.extensionConsentString (cognitive 105) packages/cli/src/config/extensions/consent.ts:189 — consent.extensionConsentString has cognitive complexity 105 (threshold 15). Drivers by points: if/else 26 (57 pts), ternaries 5 (23 pts), loops 4 (14 pts), boolean chains 11 (nesting depth added 59). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · shell-utils.stripSingleShellWrapper (cognitive 103) · ×1
  • shell-utils.stripSingleShellWrapper (cognitive 103) packages/core/src/utils/shell-utils.ts:1136 — shell-utils.stripSingleShellWrapper has cognitive complexity 103 (threshold 15). Drivers by points: if/else 21 (68 pts), boolean chains 15, ternaries 2 (10 pts), error handling 1 (6 pts), loops 2 (4 pts) (nesting depth added 62). 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.
D2 · Cognitive Complexity · ExtensionManager._buildExtension (cognitive 102) · ×1
  • ExtensionManager._buildExtension (cognitive 102) packages/cli/src/config/extension-manager.ts:759 — ExtensionManager._buildExtension has cognitive complexity 102 (threshold 15). Drivers by points: if/else 32 (65 pts), loops 7 (22 pts), boolean chains 7, error handling 3 (4 pts), ternaries 1 (4 pts) (nesting depth added 52). Of this number, 100 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
D2 · Cognitive Complexity · useGeminiStream.useGeminiStream (cognitive 101) · ×1
  • useGeminiStream.useGeminiStream (cognitive 101) packages/cli/src/ui/hooks/useGeminiStream.ts:230 — useGeminiStream.useGeminiStream has cognitive complexity 101 (threshold 15). Drivers by points: if/else 30 (53 pts), boolean chains 24, ternaries 4 (11 pts), loops 4 (8 pts), error handling 2 (5 pts) (nesting depth added 37). Most of this is not in the body itself: 2 of the 101 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 477, 320, 2392, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useSlashCompletion.useCommandSuggestions (cognitive 98) · ×1
  • useSlashCompletion.useCommandSuggestions (cognitive 98) packages/cli/src/ui/hooks/useSlashCompletion.ts:145 — useSlashCompletion.useCommandSuggestions has cognitive complexity 98 (threshold 15). Drivers by points: if/else 28 (70 pts), boolean chains 22, error handling 2 (6 pts) (nesting depth added 46). None of this is in the body itself: all 98 points belong to 7 function literals inside it that branch (lines 229, 278, 173, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · slashCommandProcessor.useSlashCommandProcessor.handleSlashCommand (cognitive 98) · ×1
  • slashCommandProcessor.useSlashCommandProcessor.handleSlashCommand (cognitive 98) packages/cli/src/ui/hooks/slashCommandProcessor.ts:367 — slashCommandProcessor.useSlashCommandProcessor.handleSlashCommand has cognitive complexity 98 (threshold 15). Drivers by points: if/else 22 (61 pts), ternaries 4 (13 pts), match/switch 2 (9 pts), boolean chains 8, error handling 2 (7 pts) (nesting depth added 60). Of this number, 84 points are the body's own statements and 14 belong to 4 function literals inside it that branch. 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.
D2 · Cognitive Complexity · BaseSettingsDialog.BaseSettingsDialog (cognitive 97) · ×1
  • BaseSettingsDialog.BaseSettingsDialog (cognitive 97) packages/cli/src/ui/components/shared/BaseSettingsDialog.tsx:128 — BaseSettingsDialog.BaseSettingsDialog has cognitive complexity 97 (threshold 15). Drivers by points: if/else 32 (54 pts), boolean chains 22, ternaries 13 (21 pts) (nesting depth added 30). Most of this is not in the body itself: 13 of the 97 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 290, 489, 163, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · mcp-client.connectToMcpServer (cognitive 97) · ×1
  • mcp-client.connectToMcpServer (cognitive 97) packages/core/src/tools/mcp-client.ts:1861 — mcp-client.connectToMcpServer has cognitive complexity 97 (threshold 15). Drivers by points: if/else 27 (75 pts), error handling 5 (10 pts), boolean chains 8, ternaries 1 (3 pts), loops 1 (nesting depth added 55). Of this number, 95 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
D2 · Cognitive Complexity · text-buffer.useTextBuffer (cognitive 91) · ×1
  • text-buffer.useTextBuffer (cognitive 91) packages/cli/src/ui/components/shared/text-buffer.ts:2832 — text-buffer.useTextBuffer has cognitive complexity 91 (threshold 15). Drivers by points: if/else 48 (71 pts), boolean chains 8, loops 4 (5 pts), ternaries 4, error handling 3 (nesting depth added 24). Most of this is not in the body itself: 3 of the 91 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 3372, 2948, 3552, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · untrustedContextTracker.findUntrustedFlags (cognitive 90) · ×1
  • untrustedContextTracker.findUntrustedFlags (cognitive 90) packages/core/src/utils/untrustedContextTracker.ts:453 — untrustedContextTracker.findUntrustedFlags has cognitive complexity 90 (threshold 15). Drivers by points: if/else 19 (51 pts), boolean chains 27, ternaries 4 (10 pts), error handling 1, loops 1 (nesting depth added 38). Of this number, 81 points are the body's own statements and 9 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GrepToolInvocation.performGrepSearch (cognitive 90) · ×1
  • GrepToolInvocation.performGrepSearch (cognitive 90) REDACTED:413 — GrepToolInvocation.performGrepSearch has cognitive complexity 90 (threshold 15). Drivers by points: if/else 25 (65 pts), boolean chains 10, error handling 4 (7 pts), loops 4 (7 pts), ternaries 1 (nesting depth added 46). Of this number, 82 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · historyHardening.pairToolsAndEnforceSignatures (cognitive 89) · ×1
  • historyHardening.pairToolsAndEnforceSignatures (cognitive 89) packages/core/src/utils/historyHardening.ts:228 — historyHardening.pairToolsAndEnforceSignatures has cognitive complexity 89 (threshold 15). Drivers by points: if/else 18 (56 pts), loops 6 (20 pts), boolean chains 13 (nesting depth added 52). 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.
D2 · Cognitive Complexity · ToolGroupMessage.ToolGroupMessage (cognitive 88) · ×1
  • ToolGroupMessage.ToolGroupMessage (cognitive 88) packages/cli/src/ui/components/messages/ToolGroupMessage.tsx:89 — ToolGroupMessage.ToolGroupMessage has cognitive complexity 88 (threshold 15). Drivers by points: if/else 18 (34 pts), boolean chains 28, ternaries 12 (18 pts), loops 5 (8 pts) (nesting depth added 25). Of this number, 18 points are the body's own statements and 70 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AskUserDialog.ChoiceQuestionView (cognitive 88) · ×1
  • AskUserDialog.ChoiceQuestionView (cognitive 88) packages/cli/src/ui/components/AskUserDialog.tsx:520 — AskUserDialog.ChoiceQuestionView has cognitive complexity 88 (threshold 15). Drivers by points: if/else 34 (44 pts), boolean chains 30, ternaries 11 (14 pts) (nesting depth added 13). Most of this is not in the body itself: 14 of the 88 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 927, 673, 801, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · atCommandProcessor.resolveFilePaths (cognitive 87) · ×1
  • atCommandProcessor.resolveFilePaths (cognitive 87) packages/cli/src/ui/hooks/atCommandProcessor.ts:239 — atCommandProcessor.resolveFilePaths has cognitive complexity 87 (threshold 15). Drivers by points: if/else 11 (28 pts), ternaries 7 (27 pts), boolean chains 15, error handling 2 (12 pts), loops 2 (5 pts) (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.
D2 · Cognitive Complexity · googleQuotaErrors.classifyGoogleError (cognitive 87) · ×1
  • googleQuotaErrors.classifyGoogleError (cognitive 87) packages/core/src/utils/googleQuotaErrors.ts:229 — googleQuotaErrors.classifyGoogleError has cognitive complexity 87 (threshold 15). Drivers by points: if/else 32 (67 pts), boolean chains 16, loops 2 (4 pts) (nesting depth added 37). 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.
D2 · Cognitive Complexity · ExtensionManager.installOrUpdateExtension (cognitive 85) · ×1
  • ExtensionManager.installOrUpdateExtension (cognitive 85) packages/cli/src/config/extension-manager.ts:202 — ExtensionManager.installOrUpdateExtension has cognitive complexity 85 (threshold 15). Drivers by points: if/else 37 (51 pts), boolean chains 19, error handling 5 (10 pts), ternaries 3 (5 pts) (nesting depth added 21). Of this number, 79 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · validate.validateExtension (cognitive 79) · ×1
  • validate.validateExtension (cognitive 79) packages/cli/src/commands/extensions/validate.ts:36 — validate.validateExtension has cognitive complexity 79 (threshold 15). Drivers by points: if/else 17 (46 pts), error handling 2 (12 pts), boolean chains 10, loops 4 (9 pts), ternaries 1 (2 pts) (nesting depth added 45). 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.
D2 · Cognitive Complexity · ToolExecutor.truncateOutputIfNeeded (cognitive 78) · ×1
  • ToolExecutor.truncateOutputIfNeeded (cognitive 78) packages/core/src/scheduler/tool-executor.ts:210 — ToolExecutor.truncateOutputIfNeeded has cognitive complexity 78 (threshold 15). Drivers by points: if/else 25 (55 pts), boolean chains 10, ternaries 2 (7 pts), loops 2 (4 pts), error handling 1 (2 pts) (nesting depth added 38). Of this number, 75 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
D2 · Cognitive Complexity · useGeminiStream.useGeminiStream.cancelOngoingRequest (cognitive 77) · ×1
  • useGeminiStream.useGeminiStream.cancelOngoingRequest (cognitive 77) packages/cli/src/ui/hooks/useGeminiStream.ts:829 — useGeminiStream.useGeminiStream.cancelOngoingRequest has cognitive complexity 77 (threshold 15). Drivers by points: if/else 24 (49 pts), boolean chains 11, loops 3 (7 pts), error handling 3 (6 pts), ternaries 1 (4 pts) (nesting depth added 35). Of this number, 71 points are the body's own statements and 6 belong to 4 function literals inside it that branch. 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.
D2 · Cognitive Complexity · untrustedContextTracker.extractUntrustedContext (cognitive 77) · ×1
  • untrustedContextTracker.extractUntrustedContext (cognitive 77) packages/core/src/utils/untrustedContextTracker.ts:335 — untrustedContextTracker.extractUntrustedContext has cognitive complexity 77 (threshold 15). Drivers by points: if/else 11 (38 pts), loops 5 (18 pts), ternaries 2 (15 pts), boolean chains 6 (nesting depth added 53). Of this number, 72 points are the body's own statements and 5 belong to one function item inside it that branches. 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.
D2 · Cognitive Complexity · policy-engine.ruleMatches (cognitive 76) · ×1
  • policy-engine.ruleMatches (cognitive 76) packages/core/src/policy/policy-engine.ts:130 — policy-engine.ruleMatches has cognitive complexity 76 (threshold 15). Drivers by points: if/else 29 (64 pts), boolean chains 10, loops 1 (2 pts) (nesting depth added 36). 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.
D2 · Cognitive Complexity · shell-utils.unwrapPowerShellCommandArg (cognitive 74) · ×1
  • shell-utils.unwrapPowerShellCommandArg (cognitive 74) packages/core/src/utils/shell-utils.ts:1042 — shell-utils.unwrapPowerShellCommandArg has cognitive complexity 74 (threshold 15). Drivers by points: if/else 17 (57 pts), boolean chains 9, loops 3 (8 pts) (nesting depth added 45). 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.
D2 · Cognitive Complexity · PolicyEngine.checkShellCommand (cognitive 74) · ×1
  • PolicyEngine.checkShellCommand (cognitive 74) packages/core/src/policy/policy-engine.ts:473 — PolicyEngine.checkShellCommand has cognitive complexity 74 (threshold 15). Drivers by points: if/else 29 (57 pts), boolean chains 12, ternaries 4, 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.
D2 · Cognitive Complexity · Footer.Footer (cognitive 72) · ×1
  • Footer.Footer (cognitive 72) packages/cli/src/ui/components/Footer.tsx:179 — Footer.Footer has cognitive complexity 72 (threshold 15). Drivers by points: if/else 19 (35 pts), ternaries 14 (22 pts), boolean chains 8, loops 3 (5 pts), match/switch 1 (2 pts) (nesting depth added 27). Of this number, 61 points are the body's own statements and 11 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · setup.handleSetup (cognitive 72) · ×1
  • setup.handleSetup (cognitive 72) packages/cli/src/commands/gemma/setup.ts:159 — setup.handleSetup has cognitive complexity 72 (threshold 15). Drivers by points: if/else 23 (33 pts), error handling 8 (20 pts), ternaries 6 (14 pts), boolean chains 5 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · chatCompressionService.truncateHistoryToBudget (cognitive 71) · ×1
  • chatCompressionService.truncateHistoryToBudget (cognitive 71) packages/core/src/context/chatCompressionService.ts:462 — chatCompressionService.truncateHistoryToBudget has cognitive complexity 71 (threshold 15). Drivers by points: if/else 17 (47 pts), boolean chains 8, error handling 1 (7 pts), ternaries 1 (5 pts), loops 2 (4 pts) (nesting depth added 42). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Session.prompt (cognitive 71) · ×1
  • Session.prompt (cognitive 71) packages/cli/src/acp/acpSession.ts:337 — Session.prompt has cognitive complexity 71 (threshold 15). Drivers by points: if/else 16 (38 pts), boolean chains 14, ternaries 2 (8 pts), loops 4 (6 pts), match/switch 1 (3 pts), error handling 1 (2 pts) (nesting depth added 33). Of this number, 69 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiClient.processTurn (cognitive 69) · ×1
  • GeminiClient.processTurn (cognitive 69) packages/core/src/core/client.ts:654 — GeminiClient.processTurn has cognitive complexity 69 (threshold 15). Drivers by points: if/else 31 (48 pts), boolean chains 16, ternaries 2 (4 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memoryService.startMemoryService (cognitive 69) · ×1
  • memoryService.startMemoryService (cognitive 69) REDACTED:1133 — memoryService.startMemoryService has cognitive complexity 69 (threshold 15). Drivers by points: if/else 27 (40 pts), ternaries 5 (13 pts), error handling 5 (8 pts), boolean chains 5, loops 3 (nesting depth added 24). Of this number, 59 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReadManyFilesToolInvocation.execute (cognitive 68) · ×1
  • ReadManyFilesToolInvocation.execute (cognitive 68) packages/core/src/tools/read-many-files.ts:232 — ReadManyFilesToolInvocation.execute has cognitive complexity 68 (threshold 15). Drivers by points: if/else 27 (46 pts), loops 6 (8 pts), ternaries 3 (7 pts), error handling 3 (5 pts), boolean chains 2 (nesting depth added 27). Of this number, 60 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · shell-utils.isInteractiveGeminiSegment (cognitive 67) · ×1
  • shell-utils.isInteractiveGeminiSegment (cognitive 67) packages/core/src/utils/shell-utils.ts:2427 — shell-utils.isInteractiveGeminiSegment has cognitive complexity 67 (threshold 15). Drivers by points: if/else 21 (45 pts), boolean chains 15, loops 5 (7 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.
D2 · Cognitive Complexity · LegacyAgentProtocol._runLoop (cognitive 67) · ×1
  • LegacyAgentProtocol._runLoop (cognitive 67) packages/core/src/agent/legacy-agent-session.ts:174 — LegacyAgentProtocol._runLoop has cognitive complexity 67 (threshold 15). Drivers by points: if/else 14 (35 pts), ternaries 5 (15 pts), error handling 2 (5 pts), loops 3 (5 pts), boolean chains 4, match/switch 1 (3 pts) (nesting depth added 38). Of this number, 66 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BackgroundTaskDisplay.BackgroundTaskDisplay (cognitive 66) · ×1
  • BackgroundTaskDisplay.BackgroundTaskDisplay (cognitive 66) packages/cli/src/ui/components/BackgroundTaskDisplay.tsx:64 — BackgroundTaskDisplay.BackgroundTaskDisplay has cognitive complexity 66 (threshold 15). Drivers by points: if/else 29 (41 pts), ternaries 14 (19 pts), boolean chains 5, loops 1 (nesting depth added 17). Most of this is not in the body itself: 6 of the 66 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 146, renderTabs, a function literal at line 111, …). 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.
D2 · Cognitive Complexity · contentGenerator.createContentGenerator (cognitive 66) · ×1
  • contentGenerator.createContentGenerator (cognitive 66) packages/core/src/core/contentGenerator.ts:210 — contentGenerator.createContentGenerator has cognitive complexity 66 (threshold 15). Drivers by points: if/else 20 (32 pts), boolean chains 19, ternaries 6 (15 pts) (nesting depth added 21). Most of this is not in the body itself: 1 of the 66 points is its own statement and the rest belongs to one function literal inside it that branches (line 215). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · TriageIssues.TriageIssues (cognitive 65) · ×1
  • TriageIssues.TriageIssues (cognitive 65) packages/cli/src/ui/components/triage/TriageIssues.tsx:66 — TriageIssues.TriageIssues has cognitive complexity 65 (threshold 15). Drivers by points: if/else 30 (34 pts), ternaries 11 (18 pts), boolean chains 10, error handling 3 (nesting depth added 11). Of this number, 20 points are the body's own statements and 45 belong to 13 function items inside it that branch. 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.
D2 · Cognitive Complexity · config.parseArguments (cognitive 65) · ×1
  • config.parseArguments (cognitive 65) packages/cli/src/config/config.ts:166 — config.parseArguments has cognitive complexity 65 (threshold 15). Drivers by points: if/else 30 (34 pts), boolean chains 20, loops 2 (6 pts), ternaries 4, error handling 1 (nesting depth added 8). Of this number, 28 points are the body's own statements and 37 belong to 7 function literals inside it that branch. 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.
D2 · Cognitive Complexity · McpPromptLoader.loadCommands (cognitive 64) · ×1
  • McpPromptLoader.loadCommands (cognitive 64) packages/cli/src/services/McpPromptLoader.ts:35 — McpPromptLoader.loadCommands has cognitive complexity 64 (threshold 15). Drivers by points: if/else 13 (40 pts), boolean chains 9, loops 3 (6 pts), ternaries 2 (6 pts), error handling 1 (3 pts) (nesting depth added 36). Most of this is not in the body itself: 8 of the 64 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 152, 57, 88, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · GeminiChat.sendMessageStream · ×1
  • GeminiChat.sendMessageStream::streamWithRetries (cognitive 64) packages/core/src/core/geminiChat.ts:717 — GeminiChat.sendMessageStream::streamWithRetries has cognitive complexity 64 (threshold 15). Drivers by points: if/else 15 (41 pts), ternaries 3 (10 pts), boolean chains 7, error handling 2 (3 pts), loops 2 (3 pts) (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. This shape REPEATS in the file: one other method here (GeminiChat.sendMessageStream) 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.
D2 · Cognitive Complexity · prepareRuntime (cognitive 64) · ×1
  • prepareRuntime (cognitive 64) sea/sea-launch.cjs:93 — prepareRuntime has cognitive complexity 64 (threshold 15). Drivers by points: if/else 16 (25 pts), error handling 8 (21 pts), boolean chains 14, loops 1 (3 pts), ternaries 1 (nesting depth added 24). Of this number, 54 points are the body's own statements and 10 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalAgentExecutor.runInternal (cognitive 63) · ×1
  • LocalAgentExecutor.runInternal (cognitive 63) packages/core/src/agents/local-executor.ts:584 — LocalAgentExecutor.runInternal has cognitive complexity 63 (threshold 15). Drivers by points: if/else 25 (44 pts), error handling 3 (9 pts), boolean chains 7, ternaries 2, loops 1 (nesting depth added 25). Of this number, 59 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · chatCompressionService.calculateHistoryByteSize (cognitive 62) · ×1
  • chatCompressionService.calculateHistoryByteSize (cognitive 62) packages/core/src/context/chatCompressionService.ts:108 — chatCompressionService.calculateHistoryByteSize has cognitive complexity 62 (threshold 15). Drivers by points: if/else 10 (44 pts), loops 3 (9 pts), error handling 1 (6 pts), boolean chains 3 (nesting depth added 45). 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.
D2 · Cognitive Complexity · ShellToolInvocation.shouldConfirmExecute (cognitive 62) · ×1
  • ShellToolInvocation.shouldConfirmExecute (cognitive 62) packages/core/src/tools/shell.ts:358 — ShellToolInvocation.shouldConfirmExecute has cognitive complexity 62 (threshold 15). Drivers by points: if/else 15 (49 pts), boolean chains 13 (nesting depth added 34). Of this number, 55 points are the body's own statements and 7 belong to 3 function items inside it that branch. 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.
D2 · Cognitive Complexity · ContextWorkingBufferImpl.syncPristineHistory (cognitive 61) · ×1
  • ContextWorkingBufferImpl.syncPristineHistory (cognitive 61) packages/core/src/context/pipeline/contextWorkingBuffer.ts:184 — ContextWorkingBufferImpl.syncPristineHistory has cognitive complexity 61 (threshold 15). Drivers by points: if/else 17 (34 pts), loops 11 (18 pts), boolean chains 6, ternaries 1 (3 pts) (nesting depth added 26). Of this number, 39 points are the body's own statements and 22 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalSessionInvocation.execute · ×1
  • LocalSessionInvocation.execute::onActivity (cognitive 61) packages/core/src/agents/local-session-invocation.ts:118 — LocalSessionInvocation.execute::onActivity has cognitive complexity 61 (threshold 15). Drivers by points: if/else 11 (23 pts), ternaries 11 (23 pts), boolean chains 8, loops 2 (6 pts), match/switch 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. This shape REPEATS in the file: one other method here (LocalSessionInvocation.execute) 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.
D2 · Cognitive Complexity · oauth2.initOauthClient (cognitive 61) · ×1
  • oauth2.initOauthClient (cognitive 61) packages/core/src/code_assist/oauth2.ts:129 — oauth2.initOauthClient has cognitive complexity 61 (threshold 15). Drivers by points: if/else 19 (37 pts), error handling 6 (17 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 30). Of this number, 58 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rewindFileOps.revertFileChanges (cognitive 60) · ×1
  • rewindFileOps.revertFileChanges (cognitive 60) packages/cli/src/ui/utils/rewindFileOps.ts:183 — rewindFileOps.revertFileChanges has cognitive complexity 60 (threshold 15). Drivers by points: if/else 14 (43 pts), error handling 2 (10 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 39). 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.
D2 · Cognitive Complexity · models.resolveModel (cognitive 60) · ×1
  • models.resolveModel (cognitive 60) packages/core/src/config/models.ts:213 — models.resolveModel has cognitive complexity 60 (threshold 15). Drivers by points: if/else 13 (24 pts), ternaries 8 (24 pts), boolean chains 9, match/switch 2 (3 pts) (nesting depth added 28). 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.
D2 · Cognitive Complexity · MCPOAuthProvider.authenticate (cognitive 59) · ×1
  • MCPOAuthProvider.authenticate (cognitive 59) packages/core/src/mcp/oauth-provider.ts:315 — MCPOAuthProvider.authenticate has cognitive complexity 59 (threshold 15). Drivers by points: if/else 22 (39 pts), boolean chains 10, error handling 4 (5 pts), ternaries 3 (5 pts) (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.
D2 · Cognitive Complexity · settings.migrateDeprecatedSettings (cognitive 59) · ×1
  • settings.migrateDeprecatedSettings (cognitive 59) packages/a2a-server/src/config/settings.ts:428 — settings.migrateDeprecatedSettings has cognitive complexity 59 (threshold 15). Drivers by points: if/else 24 (49 pts), boolean chains 5, ternaries 1 (3 pts), loops 2 (nesting depth added 27). 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.
D2 · Cognitive Complexity · MainContent.MainContent (cognitive 58) · ×1
  • MainContent.MainContent (cognitive 58) packages/cli/src/ui/components/MainContent.tsx:87 — MainContent.MainContent has cognitive complexity 58 (threshold 15). Drivers by points: ternaries 17 (22 pts), boolean chains 20, if/else 13 (15 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 3 of the 58 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 216, 279, 101, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · MarkdownDisplay.MarkdownDisplayInternal (cognitive 57) · ×1
  • MarkdownDisplay.MarkdownDisplayInternal (cognitive 57) packages/cli/src/ui/utils/MarkdownDisplay.tsx:31 — MarkdownDisplay.MarkdownDisplayInternal has cognitive complexity 57 (threshold 15). Drivers by points: if/else 27 (36 pts), boolean chains 10, ternaries 3 (7 pts), loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 15). Most of this is not in the body itself: 9 of the 57 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 88, addContentBlock). 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.
D2 · Cognitive Complexity · SubagentGroupDisplay.SubagentGroupDisplay (cognitive 57) · ×1
  • SubagentGroupDisplay.SubagentGroupDisplay (cognitive 57) packages/cli/src/ui/components/messages/SubagentGroupDisplay.tsx:34 — SubagentGroupDisplay.SubagentGroupDisplay has cognitive complexity 57 (threshold 15). Drivers by points: if/else 24 (37 pts), boolean chains 7, ternaries 4 (6 pts), match/switch 2 (5 pts), loops 1 (2 pts) (nesting depth added 19). Of this number, 27 points are the body's own statements and 30 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiClient.getIdeContextParts (cognitive 57) · ×1
  • GeminiClient.getIdeContextParts (cognitive 57) packages/core/src/core/client.ts:466 — GeminiClient.getIdeContextParts has cognitive complexity 57 (threshold 15). Drivers by points: if/else 19 (40 pts), boolean chains 13, loops 2 (4 pts) (nesting depth added 23). 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.
D2 · Cognitive Complexity · useShellCompletion.getTokenAtCursor (cognitive 55) · ×1
  • useShellCompletion.getTokenAtCursor (cognitive 55) packages/cli/src/ui/hooks/useShellCompletion.ts:59 — useShellCompletion.getTokenAtCursor has cognitive complexity 55 (threshold 15). Drivers by points: if/else 12 (33 pts), loops 6 (13 pts), boolean chains 7, ternaries 2 (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.
D2 · Cognitive Complexity · config.createPolicyEngineConfig (cognitive 55) · ×1
  • config.createPolicyEngineConfig (cognitive 55) packages/core/src/policy/config.ts:286 — config.createPolicyEngineConfig has cognitive complexity 55 (threshold 15). Drivers by points: if/else 21 (35 pts), loops 10 (21 pts), ternaries 9 (21 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent 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 (config.createPolicyEngineConfig::mapToolsToRules) 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.
D2 · Cognitive Complexity · GeminiClient.sendMessageStream (cognitive 54) · ×1
  • GeminiClient.sendMessageStream (cognitive 54) packages/core/src/core/client.ts:953 — GeminiClient.sendMessageStream has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (41 pts), boolean chains 7, ternaries 1 (5 pts), error handling 1 (nesting depth added 26). 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.
D2 · Cognitive Complexity · LocalAgentExecutor.processFunctionCalls (cognitive 54) · ×1
  • LocalAgentExecutor.processFunctionCalls (cognitive 54) packages/core/src/agents/local-executor.ts:1148 — LocalAgentExecutor.processFunctionCalls has cognitive complexity 54 (threshold 15). Drivers by points: if/else 15 (36 pts), loops 5 (9 pts), boolean chains 7, error handling 1 (2 pts) (nesting depth added 26). 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.
D2 · Cognitive Complexity · sdk.initializeTelemetry (cognitive 54) · ×1
  • sdk.initializeTelemetry (cognitive 54) packages/core/src/telemetry/sdk.ts:188 — sdk.initializeTelemetry has cognitive complexity 54 (threshold 15). Drivers by points: if/else 20 (31 pts), boolean chains 11, error handling 2 (6 pts), loops 1 (4 pts), ternaries 1 (2 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.
D2 · Cognitive Complexity · useCommandCompletion.useCommandCompletion (cognitive 53) · ×1
  • useCommandCompletion.useCommandCompletion (cognitive 53) packages/cli/src/ui/hooks/useCommandCompletion.tsx:77 — useCommandCompletion.useCommandCompletion has cognitive complexity 53 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 14, loops 4 (12 pts), ternaries 3 (4 pts) (nesting depth added 20). Most of this is not in the body itself: 9 of the 53 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 121, 313, 335). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · LocalSubagentInvocation.execute · ×1
  • LocalSubagentInvocation.execute::onActivity (cognitive 53) packages/core/src/agents/local-invocation.ts:121 — LocalSubagentInvocation.execute::onActivity has cognitive complexity 53 (threshold 15). Drivers by points: if/else 10 (21 pts), ternaries 8 (17 pts), boolean chains 8, loops 2 (6 pts), match/switch 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. This shape REPEATS in the file: one other method here (LocalSubagentInvocation.execute) 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.
D2 · Cognitive Complexity · sandbox.start_lxc_sandbox (cognitive 53) · ×1
  • sandbox.start_lxc_sandbox (cognitive 53) packages/cli/src/utils/sandbox.ts:1188 — sandbox.start_lxc_sandbox has cognitive complexity 53 (threshold 15). Drivers by points: if/else 14 (25 pts), error handling 5 (9 pts), ternaries 3 (8 pts), loops 4 (6 pts), boolean chains 5 (nesting depth added 22). Of this number, 48 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useVoiceMode.useVoiceMode.handleVoiceInput (cognitive 52) · ×1
  • useVoiceMode.useVoiceMode.handleVoiceInput (cognitive 52) packages/cli/src/ui/hooks/useVoiceMode.ts:319 — useVoiceMode.useVoiceMode.handleVoiceInput has cognitive complexity 52 (threshold 15). Drivers by points: if/else 18 (49 pts), boolean chains 3 (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.
D2 · Cognitive Complexity · RewindViewer.RewindViewer (cognitive 52) · ×1
  • RewindViewer.RewindViewer (cognitive 52) packages/cli/src/ui/components/RewindViewer.tsx:48 — RewindViewer.RewindViewer has cognitive complexity 52 (threshold 15). Drivers by points: if/else 20 (34 pts), ternaries 6 (11 pts), boolean chains 7 (nesting depth added 19). Most of this is not in the body itself: 6 of the 52 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 264, 104, 246, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · SettingsDialog.SettingsDialog (cognitive 51) · ×1
  • SettingsDialog.SettingsDialog (cognitive 51) packages/cli/src/ui/components/SettingsDialog.tsx:100 — SettingsDialog.SettingsDialog has cognitive complexity 51 (threshold 15). Drivers by points: if/else 21 (28 pts), boolean chains 11, ternaries 5 (8 pts), loops 3 (4 pts) (nesting depth added 11). Most of this is not in the body itself: 5 of the 51 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 300, 195, 222, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Turn.run (cognitive 51) · ×1
  • Turn.run (cognitive 51) packages/core/src/core/turn.ts:270 — Turn.run has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (37 pts), loops 4 (7 pts), boolean chains 4, ternaries 1 (2 pts), error handling 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GitService.setupShadowGitRepository (cognitive 51) · ×1
  • GitService.setupShadowGitRepository (cognitive 51) packages/core/src/services/gitService.ts:136 — GitService.setupShadowGitRepository has cognitive complexity 51 (threshold 15). Drivers by points: if/else 15 (24 pts), error handling 11 (14 pts), boolean chains 11, ternaries 1 (2 pts) (nesting depth added 13). Of this number, 47 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatRecordingService.doInitialize (cognitive 50) · ×1
  • ChatRecordingService.doInitialize (cognitive 50) packages/core/src/services/chatRecordingService.ts:727 — ChatRecordingService.doInitialize has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (36 pts), loops 2 (7 pts), boolean chains 4, ternaries 1 (2 pts), error handling 1 (nesting depth added 25). 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.
D2 · Cognitive Complexity · getFolderStructure.readFullStructure (cognitive 49) · ×1
  • getFolderStructure.readFullStructure (cognitive 49) packages/core/src/utils/getFolderStructure.ts:71 — getFolderStructure.readFullStructure has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (37 pts), boolean chains 5, loops 3 (5 pts), error handling 1 (2 pts) (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.
D2 · Cognitive Complexity · GeminiChat.makeApiCallAndProcessStream · ×1
  • GeminiChat.makeApiCallAndProcessStream::apiCall (cognitive 49) packages/core/src/core/geminiChat.ts:1077 — GeminiChat.makeApiCallAndProcessStream::apiCall has cognitive complexity 49 (threshold 15). Drivers by points: if/else 21 (37 pts), boolean chains 8, loops 1 (3 pts), ternaries 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.
D2 · Cognitive Complexity · sessionCleanup.cleanupToolOutputFiles (cognitive 48) · ×1
  • sessionCleanup.cleanupToolOutputFiles (cognitive 48) packages/cli/src/utils/sessionCleanup.ts:479 — sessionCleanup.cleanupToolOutputFiles has cognitive complexity 48 (threshold 15). Drivers by points: if/else 12 (20 pts), ternaries 4 (10 pts), error handling 6 (9 pts), loops 4 (7 pts), boolean chains 2 (nesting depth added 20). Of this number, 44 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · editorUtils.openFileInEditor (cognitive 48) · ×1
  • editorUtils.openFileInEditor (cognitive 48) packages/cli/src/ui/utils/editorUtils.ts:47 — editorUtils.openFileInEditor has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (31 pts), ternaries 4 (11 pts), boolean chains 6 (nesting depth added 21). Of this number, 43 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · googleErrors.parseGoogleApiError (cognitive 48) · ×1
  • googleErrors.parseGoogleApiError (cognitive 48) packages/core/src/utils/googleErrors.ts:151 — googleErrors.parseGoogleApiError has cognitive complexity 48 (threshold 15). Drivers by points: if/else 14 (33 pts), boolean chains 7, error handling 2 (4 pts), loops 2 (4 pts) (nesting depth added 23). 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.
D2 · Cognitive Complexity · shell-utils.unwrapCmdCommandArg (cognitive 48) · ×1
  • shell-utils.unwrapCmdCommandArg (cognitive 48) packages/core/src/utils/shell-utils.ts:982 — shell-utils.unwrapCmdCommandArg has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (35 pts), loops 2 (6 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 30). 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.
D2 · Cognitive Complexity · AgentSession.stream (cognitive 48) · ×1
  • AgentSession.stream (cognitive 48) packages/core/src/agent/agent-session.ts:64 — AgentSession.stream has cognitive complexity 48 (threshold 15). Drivers by points: if/else 22 (33 pts), loops 5 (9 pts), boolean chains 6 (nesting depth added 15). Of this number, 36 points are the body's own statements and 12 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BrowserAgentInvocation.execute · ×1
  • BrowserAgentInvocation.execute::onActivity (cognitive 48) packages/core/src/agents/browser/browserAgentInvocation.ts:166 — BrowserAgentInvocation.execute::onActivity has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (21 pts), ternaries 7 (14 pts), loops 3 (8 pts), boolean chains 4, match/switch 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent 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 (BrowserAgentInvocation.execute) 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.
D2 · Cognitive Complexity · mcp-client.createTransport (cognitive 48) · ×1
  • mcp-client.createTransport (cognitive 48) packages/core/src/tools/mcp-client.ts:2312 — mcp-client.createTransport has cognitive complexity 48 (threshold 15). Drivers by points: if/else 15 (35 pts), boolean chains 5, loops 2 (5 pts), ternaries 1 (3 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · App.App (cognitive 48) · ×1
  • App.App (cognitive 48) packages/devtools/client/src/App.tsx:28 — App.App has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 22 (25 pts), if/else 12, boolean chains 11 (nesting depth added 3). Most of this is not in the body itself: 13 of the 48 points are its own statements and the rest belongs to 15 function items inside it that branch (a function literal at line 78, handleImport, a function literal at line 223, …). 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.
D2 · Cognitive Complexity · GeminiSandbox.Main (cognitive 47) · ×1
  • GeminiSandbox.Main (cognitive 47) packages/core/src/sandbox/windows/GeminiSandbox.cs:191 — GeminiSandbox.Main has cognitive complexity 47 (threshold 15). Of this number, 45 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
D2 · Cognitive Complexity · AuthDialog.AuthDialog (cognitive 47) · ×1
  • AuthDialog.AuthDialog (cognitive 47) packages/cli/src/ui/auth/AuthDialog.tsx:37 — AuthDialog.AuthDialog has cognitive complexity 47 (threshold 15). Drivers by points: if/else 20 (29 pts), ternaries 4 (7 pts), boolean chains 6, error handling 2 (5 pts) (nesting depth added 15). Most of this is not in the body itself: 9 of the 47 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 118, handleAuthSelect, a function literal at line 199, …). 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.
D2 · Cognitive Complexity · process-utils.killProcessGroup (cognitive 47) · ×1
  • process-utils.killProcessGroup (cognitive 47) packages/core/src/utils/process-utils.ts:38 — process-utils.killProcessGroup has cognitive complexity 47 (threshold 15). Drivers by points: error handling 11 (26 pts), if/else 7 (12 pts), loops 3 (5 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 23). Of this number, 45 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentRegistry.loadAgents (cognitive 47) · ×1
  • AgentRegistry.loadAgents (cognitive 47) REDACTED:160 — AgentRegistry.loadAgents has cognitive complexity 47 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 3 (10 pts), loops 4 (8 pts), error handling 3 (7 pts), boolean chains 2 (nesting depth added 25). Of this number, 30 points are the body's own statements and 17 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Session.streamHistory (cognitive 47) · ×1
  • Session.streamHistory (cognitive 47) packages/cli/src/acp/acpSession.ts:267 — Session.streamHistory has cognitive complexity 47 (threshold 15). Drivers by points: if/else 9 (27 pts), ternaries 2 (10 pts), loops 3 (9 pts), boolean chains 1 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · text-buffer.calculateLayout (cognitive 46) · ×1
  • text-buffer.calculateLayout (cognitive 46) packages/cli/src/ui/components/shared/text-buffer.ts:1288 — text-buffer.calculateLayout has cognitive complexity 46 (threshold 15). Drivers by points: if/else 13 (35 pts), boolean chains 6, loops 2 (5 pts) (nesting depth added 25). Most of this is not in the body itself: 8 of the 46 points are its own statements and the rest belongs to one function literal inside it that branches (line 1299). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · StatusRow.StatusRow (cognitive 46) · ×1
  • StatusRow.StatusRow (cognitive 46) packages/cli/src/ui/components/StatusRow.tsx:168 — StatusRow.StatusRow has cognitive complexity 46 (threshold 15). Drivers by points: boolean chains 29, if/else 9 (12 pts), ternaries 4 (5 pts) (nesting depth added 4). Of this number, 25 points are the body's own statements and 21 belong to 5 function items inside it that branch. 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.
D2 · Cognitive Complexity · useQuotaAndFallback.useQuotaAndFallback (cognitive 46) · ×1
  • useQuotaAndFallback.useQuotaAndFallback (cognitive 46) packages/cli/src/ui/hooks/useQuotaAndFallback.ts:52 — useQuotaAndFallback.useQuotaAndFallback has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (19 pts), ternaries 9 (19 pts), boolean chains 8 (nesting depth added 15). None of this is in the body itself: all 46 points belong to 2 function literals inside it that branch (lines 76, 268). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · errors.normalizeError (cognitive 46) · ×1
  • errors.normalizeError (cognitive 46) packages/core/src/utils/errors.ts:453 — errors.normalizeError has cognitive complexity 46 (threshold 15). Drivers by points: if/else 19 (30 pts), boolean chains 9, error handling 3 (6 pts), ternaries 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · textUtils.isWindowsDrivePathSegment (cognitive 46) · ×1
  • textUtils.isWindowsDrivePathSegment (cognitive 46) packages/core/src/utils/textUtils.ts:195 — textUtils.isWindowsDrivePathSegment has cognitive complexity 46 (threshold 15). Drivers by points: boolean chains 24, if/else 11 (17 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ContextManager.evaluateTriggers (cognitive 45) · ×1
  • ContextManager.evaluateTriggers (cognitive 45) packages/core/src/context/contextManager.ts:349 — ContextManager.evaluateTriggers has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (37 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 25). 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.
D2 · Cognitive Complexity · index.run (cognitive 45) · ×1
  • index.run (cognitive 45) packages/cli/index.ts:59 — index.run has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 3 (9 pts), error handling 3 (8 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 22). Of this number, 19 points are the body's own statements and 26 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionBrowser.useSessionBrowserInput (cognitive 44) · ×1
  • SessionBrowser.useSessionBrowserInput (cognitive 44) packages/cli/src/ui/components/SessionBrowser.tsx:542 — SessionBrowser.useSessionBrowserInput has cognitive complexity 44 (threshold 15). Drivers by points: if/else 24 (34 pts), boolean chains 6, ternaries 1 (4 pts) (nesting depth added 13). None of this is in the body itself: all 44 points belong to 3 function literals inside it that branch (lines 551, 624, 640). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ModelDialog.ModelDialog (cognitive 44) · ×1
  • ModelDialog.ModelDialog (cognitive 44) packages/cli/src/ui/components/ModelDialog.tsx:41 — ModelDialog.ModelDialog has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (21 pts), ternaries 10 (16 pts), boolean chains 7 (nesting depth added 8). Most of this is not in the body itself: 3 of the 44 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 195, 76, 107, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useGeminiStream.useGeminiStream.handleCompletedTools (cognitive 44) · ×1
  • useGeminiStream.useGeminiStream.handleCompletedTools (cognitive 44) packages/cli/src/ui/hooks/useGeminiStream.ts:2137 — useGeminiStream.useGeminiStream.handleCompletedTools has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (31 pts), boolean chains 9, loops 2 (4 pts) (nesting depth added 14). Of this number, 42 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · render.render (cognitive 44) · ×1
  • render.render (cognitive 44) packages/core/src/context/graph/render.ts:34 — render.render has cognitive complexity 44 (threshold 15). Drivers by points: if/else 11 (20 pts), ternaries 6 (10 pts), boolean chains 7, loops 4 (7 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings.mergeRecursively (cognitive 44) · ×1
  • settings.mergeRecursively (cognitive 44) packages/a2a-server/src/config/settings.ts:289 — settings.mergeRecursively has cognitive complexity 44 (threshold 15). Drivers by points: if/else 11 (26 pts), ternaries 3 (9 pts), loops 3 (7 pts), boolean chains 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.
D2 · Cognitive Complexity · app.app.post("/webhook") (cognitive 44) · ×1
  • app.app.post("/webhook") (cognitive 44) REDACTED:67 — app.app.post("/webhook") has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 13, ternaries 2 (3 pts), error handling 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · text-buffer.findWordEndInLine (cognitive 43) · ×1
  • text-buffer.findWordEndInLine (cognitive 43) packages/cli/src/ui/components/shared/text-buffer.ts:182 — text-buffer.findWordEndInLine has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 17, if/else 8 (15 pts), loops 6 (11 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.
D2 · Cognitive Complexity · shell-utils.isPowerShellKeywordBeforeParen (cognitive 43) · ×1
  • shell-utils.isPowerShellKeywordBeforeParen (cognitive 43) packages/core/src/utils/shell-utils.ts:1741 — shell-utils.isPowerShellKeywordBeforeParen has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 13, loops 7 (12 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.
D2 · Cognitive Complexity · oauth-utils.validateOAuthEndpointUrl (cognitive 43) · ×1
  • oauth-utils.validateOAuthEndpointUrl (cognitive 43) packages/core/src/mcp/oauth-utils.ts:68 — oauth-utils.validateOAuthEndpointUrl has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 7, ternaries 2 (7 pts), error handling 4 (6 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.
D2 · Cognitive Complexity · ContextWorkingBufferImpl.applyProcessorResult (cognitive 43) · ×1
  • ContextWorkingBufferImpl.applyProcessorResult (cognitive 43) packages/core/src/context/pipeline/contextWorkingBuffer.ts:61 — ContextWorkingBufferImpl.applyProcessorResult has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 8 (19 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.
D2 · Cognitive Complexity · ToolOutputMaskingService.mask (cognitive 43) · ×1
  • ToolOutputMaskingService.mask (cognitive 43) packages/core/src/context/toolOutputMaskingService.ts:68 — ToolOutputMaskingService.mask has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (32 pts), boolean chains 6, loops 3 (4 pts), ternaries 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · admin_controls.sanitizeAdminSettings (cognitive 43) · ×1
  • admin_controls.sanitizeAdminSettings (cognitive 43) packages/core/src/code_assist/admin/admin_controls.ts:22 — admin_controls.sanitizeAdminSettings has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (32 pts), loops 2 (8 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 28). 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.
D2 · Cognitive Complexity · policyHelpers.resolvePolicyChain (cognitive 42) · ×1
  • policyHelpers.resolvePolicyChain (cognitive 42) packages/core/src/availability/policyHelpers.ts:41 — policyHelpers.resolvePolicyChain has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 10, ternaries 4 (10 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HookTranslatorGenAIv1.fromHookLLMRequest (cognitive 42) · ×1
  • HookTranslatorGenAIv1.fromHookLLMRequest (cognitive 42) packages/core/src/hooks/hookTranslator.ts:228 — HookTranslatorGenAIv1.fromHookLLMRequest has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (22 pts), ternaries 6 (16 pts), loops 2 (4 pts) (nesting depth added 23). Of this number, 38 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loggingContentGenerator.estimateContextBreakdown (cognitive 42) · ×1
  • loggingContentGenerator.estimateContextBreakdown (cognitive 42) packages/core/src/core/loggingContentGenerator.ts:79 — loggingContentGenerator.estimateContextBreakdown has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 4 (9 pts), boolean chains 7 (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.
D2 · Cognitive Complexity · coreToolHookTriggers.executeToolWithHooks (cognitive 42) · ×1
  • coreToolHookTriggers.executeToolWithHooks (cognitive 42) packages/core/src/core/coreToolHookTriggers.ts:68 — coreToolHookTriggers.executeToolWithHooks has cognitive complexity 42 (threshold 15). Drivers by points: if/else 18 (30 pts), ternaries 2 (6 pts), error handling 1 (4 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · github.downloadFile (cognitive 41) · ×1
  • github.downloadFile (cognitive 41) packages/cli/src/config/extensions/github.ts:531 — github.downloadFile has cognitive complexity 41 (threshold 15). Drivers by points: if/else 18 (24 pts), error handling 6 (11 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 13). Of this number, 23 points are the body's own statements and 18 belong to 7 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpStatus.McpStatus (cognitive 41) · ×1
  • McpStatus.McpStatus (cognitive 41) packages/cli/src/ui/components/views/McpStatus.tsx:35 — McpStatus.McpStatus has cognitive complexity 41 (threshold 15). Drivers by points: boolean chains 21, if/else 10, ternaries 5 (8 pts), match/switch 1 (2 pts) (nesting depth added 4). Most of this is not in the body itself: 3 of the 41 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 89, 322, 220, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · terminalSerializer.serializeTerminalToObject (cognitive 41) · ×1
  • terminalSerializer.serializeTerminalToObject (cognitive 41) packages/core/src/utils/terminalSerializer.ts:160 — terminalSerializer.serializeTerminalToObject has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 4 (16 pts), if/else 6 (14 pts), boolean chains 7, loops 3 (4 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.
D2 · Cognitive Complexity · WhisperModelManager.executeDownload (cognitive 41) · ×1
  • WhisperModelManager.executeDownload (cognitive 41) packages/core/src/voice/whisperModelManager.ts:130 — WhisperModelManager.executeDownload has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 6, ternaries 4 (6 pts), error handling 2, loops 2 (nesting depth added 13). Of this number, 32 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcp-client.discoverTools (cognitive 41) · ×1
  • mcp-client.discoverTools (cognitive 41) packages/core/src/tools/mcp-client.ts:1309 — mcp-client.discoverTools has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (24 pts), error handling 3 (6 pts), loops 2 (4 pts), ternaries 1 (4 pts), boolean chains 3 (nesting depth added 23). Of this number, 18 points are the body's own statements and 23 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · atCommandProcessor.readLocalFiles (cognitive 40) · ×1
  • atCommandProcessor.readLocalFiles (cognitive 40) packages/cli/src/ui/hooks/atCommandProcessor.ts:535 — atCommandProcessor.readLocalFiles has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (28 pts), loops 2 (8 pts), boolean chains 3, error handling 1 (nesting depth added 25). Of this number, 39 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
D2 · Cognitive Complexity · ThemeDialog.ThemeDialog (cognitive 40) · ×1
  • ThemeDialog.ThemeDialog (cognitive 40) packages/cli/src/ui/components/ThemeDialog.tsx:90 — ThemeDialog.ThemeDialog has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 14 (22 pts), if/else 8 (11 pts), boolean chains 7 (nesting depth added 11). Of this number, 20 points are the body's own statements and 20 belong to 6 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useShellCompletion.useShellCompletion (cognitive 40) · ×1
  • useShellCompletion.useShellCompletion (cognitive 40) packages/cli/src/ui/hooks/useShellCompletion.ts:443 — useShellCompletion.useShellCompletion has cognitive complexity 40 (threshold 15). Drivers by points: if/else 22 (30 pts), boolean chains 5, ternaries 2 (4 pts), error handling 1 (nesting depth added 10). Most of this is not in the body itself: 3 of the 40 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 489, 616, 458, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · shell-utils.findPurePowerShellExpressionParenClose (cognitive 40) · ×1
  • shell-utils.findPurePowerShellExpressionParenClose (cognitive 40) packages/core/src/utils/shell-utils.ts:1927 — shell-utils.findPurePowerShellExpressionParenClose has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (30 pts), boolean chains 8, loops 1, ternaries 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sessionUtils.ensureStableToolIds (cognitive 40) · ×1
  • sessionUtils.ensureStableToolIds (cognitive 40) packages/core/src/utils/sessionUtils.ts:21 — sessionUtils.ensureStableToolIds has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (32 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 25). Of this number, 38 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SnapshotGenerator.synthesizeSnapshot (cognitive 40) · ×1
  • SnapshotGenerator.synthesizeSnapshot (cognitive 40) packages/core/src/context/utils/snapshotGenerator.ts:128 — SnapshotGenerator.synthesizeSnapshot has cognitive complexity 40 (threshold 15). Drivers by points: if/else 21 (31 pts), boolean chains 3, error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · toolMaskingProcessor.createToolMaskingProcessor.process (cognitive 40) · ×1
  • toolMaskingProcessor.createToolMaskingProcessor.process (cognitive 40) packages/core/src/context/processors/toolMaskingProcessor.ts:92 — toolMaskingProcessor.createToolMaskingProcessor.process has cognitive complexity 40 (threshold 15). Drivers by points: if/else 22 (54 pts), loops 3 (7 pts), boolean chains 6 (nesting depth added 36). 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. This shape REPEATS in the file: one other method here (toolMaskingProcessor.createToolMaskingProcessor.process::maskAsync) 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.
D2 · Cognitive Complexity · usageAggregator.collectFileTurnUsages (cognitive 40) · ×1
  • usageAggregator.collectFileTurnUsages (cognitive 40) packages/core/src/services/usageAggregator.ts:302 — usageAggregator.collectFileTurnUsages has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 3 (8 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useAtCompletion.useAtCompletion (cognitive 39) · ×1
  • useAtCompletion.useAtCompletion (cognitive 39) packages/cli/src/ui/hooks/useAtCompletion.ts:206 — useAtCompletion.useAtCompletion has cognitive complexity 39 (threshold 15). Drivers by points: if/else 23 (29 pts), boolean chains 5, error handling 3, loops 2 (nesting depth added 6). None of this is in the body itself: all 39 points belong to 11 function literals inside it that branch (lines 357, 274, 303, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · GeminiChat.sendMessageStream (cognitive 39) · ×1
  • GeminiChat.sendMessageStream (cognitive 39) packages/core/src/core/geminiChat.ts:546 — GeminiChat.sendMessageStream has cognitive complexity 39 (threshold 15). Drivers by points: if/else 30 (67 pts), boolean chains 15, ternaries 5 (15 pts), error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 49). To reduce it, split the body into named stages: move each independent 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 (GeminiChat.sendMessageStream::streamWithRetries) 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.
D2 · Cognitive Complexity · EditTool.validateToolParamValues (cognitive 39) · ×1
  • EditTool.validateToolParamValues (cognitive 39) REDACTED:1191 — EditTool.validateToolParamValues has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 5 (16 pts), if/else 8 (11 pts), error handling 4 (10 pts), loops 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.
D2 · Cognitive Complexity · trace.createEndSpan.<returned closure> (cognitive 39) · ×1
  • trace.createEndSpan.<returned closure> (cognitive 39) packages/core/src/telemetry/trace.ts:131 — trace.createEndSpan.<returned closure> has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (33 pts), loops 2 (4 pts), boolean chains 1, error handling 1 (nesting depth added 21). 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.
D2 · Cognitive Complexity · security.isFileAndDirectorySecureSync (cognitive 39) · ×1
  • security.isFileAndDirectorySecureSync (cognitive 39) packages/core/src/utils/security.ts:595 — security.isFileAndDirectorySecureSync has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 4 (5 pts), error handling 3 (4 pts), boolean chains 3, ternaries 2 (nesting depth added 13). Of this number, 32 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · install.handleInstall (cognitive 39) · ×1
  • install.handleInstall (cognitive 39) packages/cli/src/commands/extensions/install.ts:43 — install.handleInstall has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 4 (17 pts), boolean chains 2, ternaries 2, error handling 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.
D2 · Cognitive Complexity · TerminalCapabilityManager.detectCapabilities (cognitive 38) · ×1
  • TerminalCapabilityManager.detectCapabilities (cognitive 38) REDACTED:129 — TerminalCapabilityManager.detectCapabilities has cognitive complexity 38 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 5, ternaries 1 (3 pts), loops 1 (2 pts), error handling 1 (nesting depth added 11). Most of this is not in the body itself: 3 of the 38 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 183, 161, 144). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · shellReducer.shellReducer (cognitive 38) · ×1
  • shellReducer.shellReducer (cognitive 38) packages/cli/src/ui/hooks/shellReducer.ts:55 — shellReducer.shellReducer has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (31 pts), ternaries 2 (5 pts), boolean chains 1, match/switch 1 (nesting depth added 21). 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.
D2 · Cognitive Complexity · github.checkForExtensionUpdate (cognitive 37) · ×1
  • github.checkForExtensionUpdate (cognitive 37) packages/cli/src/config/extensions/github.ts:184 — github.checkForExtensionUpdate has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 5, error handling 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.
D2 · Cognitive Complexity · useAgentStream.useAgentStream.cancelOngoingRequest (cognitive 37) · ×1
  • useAgentStream.useAgentStream.cancelOngoingRequest (cognitive 37) packages/cli/src/ui/hooks/useAgentStream.ts:197 — useAgentStream.useAgentStream.cancelOngoingRequest has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 2 (5 pts), error handling 3 (4 pts), boolean chains 3 (nesting depth added 17). Most of this is not in the body itself: 7 of the 37 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 215, 237). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · AllowedPathChecker.check (cognitive 37) · ×1
  • AllowedPathChecker.check (cognitive 37) packages/core/src/safety/built-in.ts:34 — AllowedPathChecker.check has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 4 (8 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · geminiChat.stripToolCallIdPrefixes (cognitive 37) · ×1
  • geminiChat.stripToolCallIdPrefixes (cognitive 37) packages/core/src/core/geminiChat.ts:2099 — geminiChat.stripToolCallIdPrefixes has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (25 pts), boolean chains 8, loops 2 (4 pts) (nesting depth added 18). Of this number, 19 points are the body's own statements and 18 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContextGraphBuilder.processHistory (cognitive 37) · ×1
  • ContextGraphBuilder.processHistory (cognitive 37) packages/core/src/context/graph/toGraph.ts:190 — ContextGraphBuilder.processHistory has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 5 (17 pts), if/else 4 (9 pts), loops 3 (7 pts), boolean chains 4 (nesting depth added 21). Of this number, 36 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpClientManager.maybeDiscoverMcpServer (cognitive 37) · ×1
  • McpClientManager.maybeDiscoverMcpServer (cognitive 37) packages/core/src/tools/mcp-client-manager.ts:375 — McpClientManager.maybeDiscoverMcpServer has cognitive complexity 37 (threshold 15). Drivers by points: if/else 21 (28 pts), boolean chains 5, error handling 2, ternaries 1 (2 pts) (nesting depth added 8). Of this number, 28 points are the body's own statements and 9 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · installationInfo.getInstallationInfo (cognitive 36) · ×1
  • installationInfo.getInstallationInfo (cognitive 36) packages/cli/src/utils/installationInfo.ts:36 — installationInfo.getInstallationInfo has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (18 pts), ternaries 5 (9 pts), boolean chains 6, error handling 2 (3 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · DialogManager.DialogManager (cognitive 36) · ×1
  • DialogManager.DialogManager (cognitive 36) packages/cli/src/ui/components/DialogManager.tsx:50 — DialogManager.DialogManager has cognitive complexity 36 (threshold 15). Drivers by points: if/else 30 (31 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 2). Of this number, 34 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
D2 · Cognitive Complexity · useShellCompletion.resolvePathCompletions (cognitive 36) · ×1
  • useShellCompletion.resolvePathCompletions (cognitive 36) packages/cli/src/ui/hooks/useShellCompletion.ts:316 — useShellCompletion.resolvePathCompletions has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (22 pts), ternaries 5 (8 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 11). Of this number, 33 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigExtensionDialog.ConfigExtensionDialog (cognitive 36) · ×1
  • ConfigExtensionDialog.ConfigExtensionDialog (cognitive 36) packages/cli/src/ui/components/ConfigExtensionDialog.tsx:56 — ConfigExtensionDialog.ConfigExtensionDialog has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 8, ternaries 2 (5 pts), error handling 1 (nesting depth added 7). Most of this is not in the body itself: 9 of the 36 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 211, a function literal at line 127, a function literal at line 95, …). 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.
D2 · Cognitive Complexity · paths.shortenPath (cognitive 36) · ×1
  • paths.shortenPath (cognitive 36) packages/core/src/utils/paths.ts:101 — paths.shortenPath has cognitive complexity 36 (threshold 15). Drivers by points: if/else 26 (32 pts), loops 3, boolean chains 1 (nesting depth added 6). Most of this is not in the body itself: 12 of the 36 points are its own statements and the rest belongs to 6 function items inside it that branch (truncateComponent, trailingFallback, pickIndexToReduce, …). 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.
D2 · Cognitive Complexity · BrowserAgentInvocation.execute (cognitive 36) · ×1
  • BrowserAgentInvocation.execute (cognitive 36) packages/core/src/agents/browser/browserAgentInvocation.ts:111 — BrowserAgentInvocation.execute has cognitive complexity 36 (threshold 15). Drivers by points: if/else 20 (36 pts), ternaries 11 (21 pts), loops 5 (13 pts), error handling 4 (8 pts), boolean chains 7, match/switch 1 (nesting depth added 38). To reduce it, split the body into named stages: move each independent 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 (BrowserAgentInvocation.execute::onActivity) 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.
D2 · Cognitive Complexity · HookRunner.executeCommandHook (cognitive 36) · ×1
  • HookRunner.executeCommandHook (cognitive 36) packages/core/src/hooks/hookRunner.ts:307 — HookRunner.executeCommandHook has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (20 pts), error handling 4 (9 pts), boolean chains 7 (nesting depth added 11). None of this is in the body itself: all 36 points belong to 5 function literals inside it that branch (lines 434, 315, 385, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · IDEServer.start (cognitive 36) · ×1
  • IDEServer.start (cognitive 36) packages/vscode-ide-companion/src/ide-server.ts:144 — IDEServer.start has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (18 pts), ternaries 4 (8 pts), boolean chains 7, error handling 2, loops 1 (nesting depth added 7). None of this is in the body itself: all 36 points belong to 12 function literals inside it that branch (lines 227, 317, 184, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · DenseToolMessage.DenseToolMessage (cognitive 35) · ×1
  • DenseToolMessage.DenseToolMessage (cognitive 35) packages/cli/src/ui/components/messages/DenseToolMessage.tsx:258 — DenseToolMessage.DenseToolMessage has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 13, ternaries 4 (6 pts) (nesting depth added 3). Most of this is not in the body itself: 9 of the 35 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 311, a function literal at line 421, handleToggle, …). 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.
D2 · Cognitive Complexity · HistoryItemDisplay.HistoryItemDisplay (cognitive 35) · ×1
  • HistoryItemDisplay.HistoryItemDisplay (cognitive 35) packages/cli/src/ui/components/HistoryItemDisplay.tsx:59 — HistoryItemDisplay.HistoryItemDisplay has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 33, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AskUserDialog.AskUserDialog (cognitive 35) · ×1
  • AskUserDialog.AskUserDialog (cognitive 35) packages/cli/src/ui/components/AskUserDialog.tsx:1032 — AskUserDialog.AskUserDialog has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (18 pts), ternaries 7 (9 pts), boolean chains 8 (nesting depth added 3). Of this number, 16 points are the body's own statements and 19 belong to 8 function literals inside it that branch. 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.
D2 · Cognitive Complexity · googleErrors.fromApiError (cognitive 35) · ×1
  • googleErrors.fromApiError (cognitive 35) packages/core/src/utils/googleErrors.ts:333 — googleErrors.fromApiError has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (23 pts), error handling 2 (9 pts), boolean chains 3 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · googleErrors.fromCauseError (cognitive 35) · ×1
  • googleErrors.fromCauseError (cognitive 35) packages/core/src/utils/googleErrors.ts:389 — googleErrors.fromCauseError has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 7, ternaries 5 (6 pts) (nesting depth added 12). Of this number, 31 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · grep-utils.enrichWithAutoContext (cognitive 35) · ×1
  • grep-utils.enrichWithAutoContext (cognitive 35) packages/core/src/tools/grep-utils.ts:66 — grep-utils.enrichWithAutoContext has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (21 pts), loops 3 (11 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 24). 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.
D2 · Cognitive Complexity · generateContentResponseUtilities.convertToFunctionResponse (cognitive 35) · ×1
  • generateContentResponseUtilities.convertToFunctionResponse (cognitive 35) packages/core/src/utils/generateContentResponseUtilities.ts:49 — generateContentResponseUtilities.convertToFunctionResponse has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 7, loops 2, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Scheduler._processNextItem (cognitive 35) · ×1
  • Scheduler._processNextItem (cognitive 35) packages/core/src/scheduler/scheduler.ts:487 — Scheduler._processNextItem has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 7, loops 3 (6 pts) (nesting depth added 12). Of this number, 33 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · atCommandUtils.resolveAtCommandPath (cognitive 35) · ×1
  • atCommandUtils.resolveAtCommandPath (cognitive 35) packages/core/src/utils/atCommandUtils.ts:52 — atCommandUtils.resolveAtCommandPath has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 6, error handling 2 (4 pts), loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Session.runTool (cognitive 35) · ×1
  • Session.runTool (cognitive 35) packages/cli/src/acp/acpSession.ts:684 — Session.runTool has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 9 (16 pts), if/else 7 (10 pts), boolean chains 6, match/switch 1 (2 pts), error handling 1 (nesting depth added 11). Of this number, 33 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ThemeManager.loadUserThemes (cognitive 34) · ×1
  • ThemeManager.loadUserThemes (cognitive 34) packages/cli/src/ui/themes/theme-manager.ts:331 — ThemeManager.loadUserThemes has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (20 pts), error handling 2 (5 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useExecutionLifecycle.useExecutionLifecycle.handleShellCommand · ×1
  • useExecutionLifecycle.useExecutionLifecycle.handleShellCommand::executeCommand (cognitive 34) packages/cli/src/ui/hooks/useExecutionLifecycle.ts:375 — useExecutionLifecycle.useExecutionLifecycle.handleShellCommand::executeCommand has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 6, error handling 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · markdownParsingUtils.parseMarkdownToANSI (cognitive 34) · ×1
  • markdownParsingUtils.parseMarkdownToANSI (cognitive 34) packages/cli/src/ui/utils/markdownParsingUtils.ts:106 — markdownParsingUtils.parseMarkdownToANSI has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 12, error handling 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.
D2 · Cognitive Complexity · nodeDistillationProcessor.createNodeDistillationProcessor.process (cognitive 34) · ×1
  • nodeDistillationProcessor.createNodeDistillationProcessor.process (cognitive 34) packages/core/src/context/processors/nodeDistillationProcessor.ts:75 — nodeDistillationProcessor.createNodeDistillationProcessor.process has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (24 pts), error handling 1 (5 pts), boolean chains 2, match/switch 1 (2 pts), 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.
D2 · Cognitive Complexity · ContextManager.renderHistory (cognitive 34) · ×1
  • ContextManager.renderHistory (cognitive 34) packages/core/src/context/contextManager.ts:94 — ContextManager.renderHistory has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 9, loops 4 (5 pts), ternaries 3 (nesting depth added 6). Of this number, 30 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · setup._doSetupUser (cognitive 34) · ×1
  • setup._doSetupUser (cognitive 34) packages/core/src/code_assist/setup.ts:153 — setup._doSetupUser has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 3, loops 2 (3 pts), error handling 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GrepToolInvocation.execute (cognitive 34) · ×1
  • GrepToolInvocation.execute (cognitive 34) REDACTED:146 — GrepToolInvocation.execute has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (20 pts), error handling 4 (6 pts), ternaries 2 (4 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · deepMerge.mergeRecursively (cognitive 33) · ×1
  • deepMerge.mergeRecursively (cognitive 33) packages/cli/src/utils/deepMerge.ts:24 — deepMerge.mergeRecursively has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 3 (9 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · settings.migrateExperimentalSettings (cognitive 33) · ×1
  • settings.migrateExperimentalSettings (cognitive 33) packages/cli/src/config/settings.ts:1498 — settings.migrateExperimentalSettings has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 2 (nesting depth added 16). Most of this is not in the body itself: 6 of the 33 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 1535, a function literal at line 1610, migrateExperimental, …). 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.
D2 · Cognitive Complexity · useToolScheduler.useToolScheduler (cognitive 33) · ×1
  • useToolScheduler.useToolScheduler (cognitive 33) packages/cli/src/ui/hooks/useToolScheduler.ts:71 — useToolScheduler.useToolScheduler has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 7, loops 3 (5 pts), error handling 1 (3 pts), ternaries 2 (nesting depth added 10). None of this is in the body itself: all 33 points belong to 9 function literals inside it that branch (lines 256, 290, 130, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useAgentStream.useAgentStream.handleEvent (cognitive 33) · ×1
  • useAgentStream.useAgentStream.handleEvent (cognitive 33) packages/cli/src/ui/hooks/useAgentStream.ts:352 — useAgentStream.useAgentStream.handleEvent has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (21 pts), ternaries 4 (8 pts), loops 1 (3 pts), match/switch 1 (nesting depth added 17). Of this number, 19 points are the body's own statements and 14 belong to 2 function literals inside it that branch. 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.
D2 · Cognitive Complexity · useGeminiStream.useGeminiStream.submitQuery (cognitive 33) · ×1
  • useGeminiStream.useGeminiStream.submitQuery (cognitive 33) packages/cli/src/ui/hooks/useGeminiStream.ts:1842 — useGeminiStream.useGeminiStream.submitQuery has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 8, error handling 1, ternaries 1 (nesting depth added 6). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 1890, 1854, 1963). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · UiTelemetryService.hydrate (cognitive 33) · ×1
  • UiTelemetryService.hydrate (cognitive 33) packages/core/src/telemetry/uiTelemetry.ts:222 — UiTelemetryService.hydrate has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (25 pts), loops 2 (5 pts), boolean chains 3 (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.
D2 · Cognitive Complexity · rollingSummaryProcessor.createRollingSummaryProcessor.process (cognitive 33) · ×1
  • rollingSummaryProcessor.createRollingSummaryProcessor.process (cognitive 33) packages/core/src/context/processors/rollingSummaryProcessor.ts:74 — rollingSummaryProcessor.createRollingSummaryProcessor.process has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 2 (5 pts), boolean chains 2, error handling 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.
D2 · Cognitive Complexity · WriteFileToolInvocation.applyWrite (cognitive 33) · ×1
  • WriteFileToolInvocation.applyWrite (cognitive 33) packages/core/src/tools/write-file.ts:418 — WriteFileToolInvocation.applyWrite has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (18 pts), ternaries 7 (8 pts), boolean chains 5, error handling 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · LocalSessionInvocation.execute (cognitive 33) · ×1
  • LocalSessionInvocation.execute (cognitive 33) packages/core/src/agents/local-session-invocation.ts:111 — LocalSessionInvocation.execute has cognitive complexity 33 (threshold 15). Drivers by points: if/else 23 (46 pts), ternaries 13 (27 pts), boolean chains 11, loops 3 (8 pts), error handling 1, match/switch 1 (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. This shape REPEATS in the file: one other method here (LocalSessionInvocation.execute::onActivity) 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.
D2 · Cognitive Complexity · Task.scheduleToolCalls (cognitive 33) · ×1
  • Task.scheduleToolCalls (cognitive 33) packages/a2a-server/src/agent/task.ts:748 — Task.scheduleToolCalls has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 3 (8 pts), boolean chains 3 (nesting depth added 17). Of this number, 25 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · clipboardUtils.saveClipboardImage (cognitive 32) · ×1
  • clipboardUtils.saveClipboardImage (cognitive 32) packages/cli/src/ui/utils/clipboardUtils.ts:272 — clipboardUtils.saveClipboardImage has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), error handling 4 (9 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ScrollProvider.ScrollProvider · ×1
  • ScrollProvider.ScrollProvider::handleLeftPress (cognitive 32) packages/cli/src/ui/contexts/ScrollProvider.tsx:258 — ScrollProvider.ScrollProvider::handleLeftPress has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), ternaries 2 (6 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · ExtensionDetails.ExtensionDetails (cognitive 32) · ×1
  • ExtensionDetails.ExtensionDetails (cognitive 32) packages/cli/src/ui/components/views/ExtensionDetails.tsx:31 — ExtensionDetails.ExtensionDetails has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 20, if/else 9 (11 pts), ternaries 1 (nesting depth added 2). Of this number, 19 points are the body's own statements and 13 belong to 2 function literals inside it that branch. 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.
D2 · Cognitive Complexity · partUtils.partToString (cognitive 32) · ×1
  • partUtils.partToString (cognitive 32) packages/core/src/utils/partUtils.ts:18 — partUtils.partToString has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (20 pts), ternaries 3 (12 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · EditToolInvocation.applyEdit (cognitive 32) · ×1
  • EditToolInvocation.applyEdit (cognitive 32) REDACTED:962 — EditToolInvocation.applyEdit has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 5 (10 pts), error handling 3 (5 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings.loadEnvironment (cognitive 31) · ×1
  • settings.loadEnvironment (cognitive 31) packages/cli/src/config/settings.ts:701 — settings.loadEnvironment has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (22 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (2 pts), ternaries 1 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Scrollable.Scrollable (cognitive 31) · ×1
  • Scrollable.Scrollable (cognitive 31) packages/cli/src/ui/components/shared/Scrollable.tsx:41 — Scrollable.Scrollable has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 5, ternaries 1 (nesting depth added 10). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 189, 145, 76, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useGeminiStream.useGeminiStream.prepareQueryForGemini (cognitive 31) · ×1
  • useGeminiStream.useGeminiStream.prepareQueryForGemini (cognitive 31) packages/cli/src/ui/hooks/useGeminiStream.ts:1093 — useGeminiStream.useGeminiStream.prepareQueryForGemini has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (23 pts), match/switch 1 (4 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · activityLogger.setupNetworkLogging (cognitive 31) · ×1
  • activityLogger.setupNetworkLogging (cognitive 31) REDACTED:813 — activityLogger.setupNetworkLogging has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 10, ternaries 2 (3 pts), error handling 2, loops 2, match/switch 1 (nesting depth added 3). None of this is in the body itself: all 31 points belong to 10 function items inside it that branch (a function literal at line 843, sendToNetwork, flushBuffer, …). 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.
D2 · Cognitive Complexity · shell-utils.tokenizeShellCommandWords (cognitive 31) · ×1
  • shell-utils.tokenizeShellCommandWords (cognitive 31) packages/core/src/utils/shell-utils.ts:2346 — shell-utils.tokenizeShellCommandWords has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 10, 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.
D2 · Cognitive Complexity · ProjectRegistry.claimNewSlug (cognitive 31) · ×1
  • ProjectRegistry.claimNewSlug (cognitive 31) packages/core/src/config/projectRegistry.ts:304 — ProjectRegistry.claimNewSlug has cognitive complexity 31 (threshold 15). Drivers by points: if/else 5 (14 pts), error handling 2 (6 pts), ternaries 2 (5 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ide-connection-utils.getConnectionConfigFromFile (cognitive 31) · ×1
  • ide-connection-utils.getConnectionConfigFromFile (cognitive 31) packages/core/src/ide/ide-connection-utils.ts:151 — ide-connection-utils.getConnectionConfigFromFile has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 4, error handling 3 (nesting depth added 7). Of this number, 24 points are the body's own statements and 7 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · A2AResultReassembler.update (cognitive 31) · ×1
  • A2AResultReassembler.update (cognitive 31) packages/core/src/agents/a2aUtils.ts:35 — A2AResultReassembler.update has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 2 (7 pts), boolean chains 2, match/switch 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.
D2 · Cognitive Complexity · BrowserManager.connectMcp (cognitive 31) · ×1
  • BrowserManager.connectMcp (cognitive 31) REDACTED:559 — BrowserManager.connectMcp has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 5, error handling 2 (4 pts), ternaries 3 (4 pts) (nesting depth added 6). Of this number, 29 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
D2 · Cognitive Complexity · browserAgentFactory.createBrowserAgentDefinition (cognitive 31) · ×1
  • browserAgentFactory.createBrowserAgentDefinition (cognitive 31) packages/core/src/agents/browser/browserAgentFactory.ts:68 — browserAgentFactory.createBrowserAgentDefinition has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 2 (4 pts), boolean chains 3, error handling 1, ternaries 1 (nesting depth added 11). Of this number, 26 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RecursiveFileSearch.search (cognitive 31) · ×1
  • RecursiveFileSearch.search (cognitive 31) packages/core/src/utils/filesearch/fileSearch.ts:274 — RecursiveFileSearch.search has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 4, error handling 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.
D2 · Cognitive Complexity · GrepToolInvocation.performRipgrepSearch (cognitive 31) · ×1
  • GrepToolInvocation.performRipgrepSearch (cognitive 31) REDACTED:409 — GrepToolInvocation.performRipgrepSearch has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (24 pts), loops 2 (3 pts), boolean chains 2, error handling 1, ternaries 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.
D2 · Cognitive Complexity · HookAggregator.mergeWithOrDecision (cognitive 31) · ×1
  • HookAggregator.mergeWithOrDecision (cognitive 31) packages/core/src/hooks/hookAggregator.ts:116 — HookAggregator.mergeWithOrDecision has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 4, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MockAgentProtocol.send (cognitive 31) · ×1
  • MockAgentProtocol.send (cognitive 31) packages/core/src/agent/mock.ts:108 — MockAgentProtocol.send has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 5, ternaries 3 (5 pts), loops 2 (3 pts) (nesting depth added 8). Of this number, 29 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · clipboardUtils.splitDragAndDropPaths (cognitive 30) · ×1
  • clipboardUtils.splitDragAndDropPaths (cognitive 30) packages/cli/src/ui/utils/clipboardUtils.ts:442 — clipboardUtils.splitDragAndDropPaths has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExpandableText._ExpandableText (cognitive 30) · ×1
  • ExpandableText._ExpandableText (cognitive 30) packages/cli/src/ui/components/shared/ExpandableText.tsx:23 — ExpandableText._ExpandableText has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 3, loops 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.
D2 · Cognitive Complexity · FooterConfigDialog.FooterConfigDialog (cognitive 30) · ×1
  • FooterConfigDialog.FooterConfigDialog (cognitive 30) packages/cli/src/ui/components/FooterConfigDialog.tsx:87 — FooterConfigDialog.FooterConfigDialog has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 8 (9 pts), boolean chains 6 (nesting depth added 3). Most of this is not in the body itself: 4 of the 30 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 185, 338, 168, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useLoadingIndicator.useLoadingIndicator (cognitive 30) · ×1
  • useLoadingIndicator.useLoadingIndicator (cognitive 30) packages/cli/src/ui/hooks/useLoadingIndicator.ts:50 — useLoadingIndicator.useLoadingIndicator has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 6 (13 pts), boolean chains 11, if/else 6 (nesting depth added 7). Of this number, 21 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ShellExecutionService.executeWithPty (cognitive 30) · ×1
  • ShellExecutionService.executeWithPty (cognitive 30) packages/core/src/services/shellExecutionService.ts:1266 — ShellExecutionService.executeWithPty has cognitive complexity 30 (threshold 15). Drivers by points: if/else 33 (44 pts), error handling 10 (16 pts), boolean chains 12, ternaries 6, loops 1 (nesting depth added 17). 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. This shape REPEATS in the file: one other method here (ShellExecutionService.executeWithPty::renderFn) 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.
D2 · Cognitive Complexity · stateSnapshotProcessor.createStateSnapshotProcessor.process (cognitive 30) · ×1
  • stateSnapshotProcessor.createStateSnapshotProcessor.process (cognitive 30) packages/core/src/context/processors/stateSnapshotProcessor.ts:56 — stateSnapshotProcessor.createStateSnapshotProcessor.process has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17 (24 pts), loops 2 (3 pts), boolean chains 1, error handling 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memoryService.buildExistingSkillsSummary (cognitive 30) · ×1
  • memoryService.buildExistingSkillsSummary (cognitive 30) REDACTED:729 — memoryService.buildExistingSkillsSummary has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (21 pts), error handling 3 (4 pts), loops 2 (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.
D2 · Cognitive Complexity · PolicyEngine.getExcludedTools (cognitive 30) · ×1
  • PolicyEngine.getExcludedTools (cognitive 30) packages/core/src/policy/policy-engine.ts:1179 — PolicyEngine.getExcludedTools has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 2 (3 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Task.acceptAgentMessage (cognitive 30) · ×1
  • Task.acceptAgentMessage (cognitive 30) packages/a2a-server/src/agent/task.ts:858 — Task.acceptAgentMessage has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 5 (12 pts), boolean chains 11, if/else 3 (6 pts), match/switch 1 (nesting depth added 10). Of this number, 26 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gemini.resolveSessionId (cognitive 30) · ×1
  • gemini.resolveSessionId (cognitive 30) packages/cli/src/gemini.tsx:322 — gemini.resolveSessionId has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, ternaries 2 (5 pts), error handling 2 (3 pts), loops 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · borderStyles.getToolGroupBorderAppearance (cognitive 29) · ×1
  • borderStyles.getToolGroupBorderAppearance (cognitive 29) packages/cli/src/ui/utils/borderStyles.ts:33 — borderStyles.getToolGroupBorderAppearance has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 15, if/else 7, ternaries 4 (7 pts) (nesting depth added 3). Of this number, 18 points are the body's own statements and 11 belong to 4 function literals inside it that branch. 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.
D2 · Cognitive Complexity · useSelectionList.useSelectionList.handleKeypress (cognitive 29) · ×1
  • useSelectionList.useSelectionList.handleKeypress (cognitive 29) packages/cli/src/ui/hooks/useSelectionList.ts:393 — useSelectionList.useSelectionList.handleKeypress has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 10 (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.
D2 · Cognitive Complexity · handleAutoUpdate.handleAutoUpdate (cognitive 29) · ×1
  • handleAutoUpdate.handleAutoUpdate (cognitive 29) packages/cli/src/utils/handleAutoUpdate.ts:71 — handleAutoUpdate.handleAutoUpdate has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 4, error handling 2 (4 pts), ternaries 1 (nesting depth added 6). Of this number, 16 points are the body's own statements and 13 belong to one function literal inside it that branches. 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.
D2 · Cognitive Complexity · useStaticHistoryStartIndex.countToolResultChars (cognitive 29) · ×1
  • useStaticHistoryStartIndex.countToolResultChars (cognitive 29) packages/cli/src/ui/hooks/useStaticHistoryStartIndex.ts:26 — useStaticHistoryStartIndex.countToolResultChars has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ValidationDialog.ValidationDialog (cognitive 29) · ×1
  • ValidationDialog.ValidationDialog (cognitive 29) packages/cli/src/ui/components/ValidationDialog.tsx:31 — ValidationDialog.ValidationDialog has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 6, ternaries 1 (4 pts), error handling 1 (3 pts) (nesting depth added 9). Most of this is not in the body itself: 6 of the 29 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 88, 58, 74, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · highlight.parseInputForHighlighting (cognitive 29) · ×1
  • highlight.parseInputForHighlighting (cognitive 29) packages/cli/src/ui/utils/highlight.ts:36 — highlight.parseInputForHighlighting has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 5 (9 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 9). Of this number, 15 points are the body's own statements and 14 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcpCommand.listAction (cognitive 29) · ×1
  • mcpCommand.listAction (cognitive 29) packages/cli/src/ui/commands/mcpCommand.ts:177 — mcpCommand.listAction has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 7, loops 3 (nesting depth added 8). Of this number, 28 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · paths.robustRealpath (cognitive 29) · ×1
  • paths.robustRealpath (cognitive 29) packages/core/src/utils/paths.ts:506 — paths.robustRealpath has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 6, error handling 2 (4 pts), ternaries 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.
D2 · Cognitive Complexity · shell-utils.detectBashSubstitution (cognitive 29) · ×1
  • shell-utils.detectBashSubstitution (cognitive 29) packages/core/src/utils/shell-utils.ts:1496 — shell-utils.detectBashSubstitution has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 6, 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.
D2 · Cognitive Complexity · LocalSubagentInvocation.execute (cognitive 29) · ×1
  • LocalSubagentInvocation.execute (cognitive 29) packages/core/src/agents/local-invocation.ts:102 — LocalSubagentInvocation.execute has cognitive complexity 29 (threshold 15). Drivers by points: if/else 19 (38 pts), ternaries 11 (23 pts), boolean chains 11, loops 3 (8 pts), error handling 1, match/switch 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. This shape REPEATS in the file: one other method here (LocalSubagentInvocation.execute::onActivity) 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.
D2 · Cognitive Complexity · ShellToolInvocation.getConfirmationDetails (cognitive 29) · ×1
  • ShellToolInvocation.getConfirmationDetails (cognitive 29) packages/core/src/tools/shell.ts:488 — ShellToolInvocation.getConfirmationDetails has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 12, if/else 9 (12 pts), ternaries 3 (4 pts), error handling 1 (nesting depth added 4). Of this number, 19 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config.resolveTelemetrySettings (cognitive 29) · ×1
  • config.resolveTelemetrySettings (cognitive 29) packages/core/src/telemetry/config.ts:218 — config.resolveTelemetrySettings has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 4 (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.
D2 · Cognitive Complexity · sandboxConfig.getSandboxCommand (cognitive 29) · ×1
  • sandboxConfig.getSandboxCommand (cognitive 29) packages/cli/src/config/sandboxConfig.ts:43 — sandboxConfig.getSandboxCommand has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 10 (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.
D2 · Cognitive Complexity · sessionUtils.formatRelativeTime (cognitive 28) · ×1
  • sessionUtils.formatRelativeTime (cognitive 28) packages/cli/src/utils/sessionUtils.ts:188 — sessionUtils.formatRelativeTime has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 4 (11 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.
D2 · Cognitive Complexity · SlicingMaxSizedBox.SlicingMaxSizedBox (cognitive 28) · ×1
  • SlicingMaxSizedBox.SlicingMaxSizedBox (cognitive 28) packages/cli/src/ui/components/shared/SlicingMaxSizedBox.tsx:27 — SlicingMaxSizedBox.SlicingMaxSizedBox has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 2 (6 pts), boolean chains 2 (nesting depth added 14). None of this is in the body itself: all 28 points belong to one function literal inside it that branches (line 34). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useExtensionUpdates.useExtensionUpdates (cognitive 28) · ×1
  • useExtensionUpdates.useExtensionUpdates (cognitive 28) packages/cli/src/ui/hooks/useExtensionUpdates.ts:83 — useExtensionUpdates.useExtensionUpdates has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 2, error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 9). None of this is in the body itself: all 28 points belong to 6 function literals inside it that branch (lines 118, 129, 95, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · oauth-flow.parseTokenEndpointResponse (cognitive 28) · ×1
  • oauth-flow.parseTokenEndpointResponse (cognitive 28) REDACTED:513 — oauth-flow.parseTokenEndpointResponse has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 10, ternaries 5 (9 pts), if/else 5 (6 pts), error handling 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolRegistry.discoverAndRegisterToolsFromCommand (cognitive 28) · ×1
  • ToolRegistry.discoverAndRegisterToolsFromCommand (cognitive 28) packages/core/src/tools/tool-registry.ts:376 — ToolRegistry.discoverAndRegisterToolsFromCommand has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 3, loops 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 5). Of this number, 22 points are the body's own statements and 6 belong to 3 function literals inside it that branch. 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.
D2 · Cognitive Complexity · pathCorrector.resolveActiveWorkspaceDir (cognitive 28) · ×1
  • pathCorrector.resolveActiveWorkspaceDir (cognitive 28) packages/core/src/utils/pathCorrector.ts:45 — pathCorrector.resolveActiveWorkspaceDir has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 7, ternaries 3 (5 pts), error handling 3 (4 pts), loops 1 (nesting depth added 6). Of this number, 26 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · telemetry.summarizeToolCalls (cognitive 28) · ×1
  • telemetry.summarizeToolCalls (cognitive 28) packages/core/src/code_assist/telemetry.ts:117 — telemetry.summarizeToolCalls has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (22 pts), boolean chains 4, loops 1, ternaries 1 (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.
D2 · Cognitive Complexity · config.createPolicyUpdater (cognitive 28) · ×1
  • config.createPolicyUpdater (cognitive 28) packages/core/src/policy/config.ts:717 — config.createPolicyUpdater has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 8, ternaries 3 (6 pts), loops 1 (2 pts) (nesting depth added 9). None of this is in the body itself: all 28 points belong to 2 function literals inside it that branch (lines 727, 803). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · confirmation.resolveConfirmation (cognitive 28) · ×1
  • confirmation.resolveConfirmation (cognitive 28) packages/core/src/scheduler/confirmation.ts:110 — confirmation.resolveConfirmation has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memory.listInboxMemoryPatches (cognitive 28) · ×1
  • memory.listInboxMemoryPatches (cognitive 28) REDACTED:449 — memory.listInboxMemoryPatches has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (14 pts), error handling 2 (6 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memoryDiscovery.readGeminiMdFiles (cognitive 28) · ×1
  • memoryDiscovery.readGeminiMdFiles (cognitive 28) packages/core/src/utils/memoryDiscovery.ts:209 — memoryDiscovery.readGeminiMdFiles has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 2 (9 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 16). Most of this is not in the body itself: 11 of the 28 points are its own statements and the rest belongs to one function literal inside it that branches (line 221). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · usageAggregator.computeHeatmapMetrics (cognitive 28) · ×1
  • usageAggregator.computeHeatmapMetrics (cognitive 28) packages/core/src/services/usageAggregator.ts:387 — usageAggregator.computeHeatmapMetrics has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (9 pts), boolean chains 3, ternaries 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.
D2 · Cognitive Complexity · sessionSummaryUtils.getPreviousSession (cognitive 28) · ×1
  • sessionSummaryUtils.getPreviousSession (cognitive 28) packages/core/src/services/sessionSummaryUtils.ts:460 — sessionSummaryUtils.getPreviousSession has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 3 (4 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatRecordingService.recordToolCalls (cognitive 28) · ×1
  • ChatRecordingService.recordToolCalls (cognitive 28) packages/core/src/services/chatRecordingService.ts:1199 — ChatRecordingService.recordToolCalls has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 6, loops 2 (3 pts), error handling 1 (nesting depth added 8). Of this number, 25 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config.loadConfig (cognitive 28) · ×1
  • config.loadConfig (cognitive 28) packages/a2a-server/src/config/config.ts:251 — config.loadConfig has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 7, ternaries 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config.refreshAuthentication (cognitive 28) · ×1
  • config.refreshAuthentication (cognitive 28) packages/a2a-server/src/config/config.ts:658 — config.refreshAuthentication has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 3 (12 pts), if/else 5 (10 pts), error handling 2 (5 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SubagentProgressDisplay.SubagentProgressDisplay (cognitive 27) · ×1
  • SubagentProgressDisplay.SubagentProgressDisplay (cognitive 27) packages/cli/src/ui/components/messages/SubagentProgressDisplay.tsx:62 — SubagentProgressDisplay.SubagentProgressDisplay has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 6 (15 pts), boolean chains 6, if/else 6 (nesting depth added 9). Most of this is not in the body itself: 7 of the 27 points are its own statements and the rest belongs to one function literal inside it that branches (line 91). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ToolResultDisplay.ToolResultDisplay (cognitive 27) · ×1
  • ToolResultDisplay.ToolResultDisplay (cognitive 27) packages/cli/src/ui/components/messages/ToolResultDisplay.tsx:59 — ToolResultDisplay.ToolResultDisplay has cognitive complexity 27 (threshold 15). Drivers by points: if/else 21 (28 pts), ternaries 6 (11 pts), boolean chains 9 (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. This shape REPEATS in the file: one other method here (ToolResultDisplay.ToolResultDisplay::renderContent) 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.
D2 · Cognitive Complexity · ToolGroupDisplay.ToolGroupDisplay (cognitive 27) · ×1
  • ToolGroupDisplay.ToolGroupDisplay (cognitive 27) packages/cli/src/ui/components/messages/ToolGroupDisplay.tsx:25 — ToolGroupDisplay.ToolGroupDisplay has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 9 (17 pts), boolean chains 8, if/else 2 (nesting depth added 8). Of this number, 20 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HeatmapComponent.HeatmapComponent (cognitive 27) · ×1
  • HeatmapComponent.HeatmapComponent (cognitive 27) packages/cli/src/ui/components/HeatmapComponent.tsx:242 — HeatmapComponent.HeatmapComponent has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 3 (8 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 8). Of this number, 24 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentConfigDialog.AgentConfigDialog (cognitive 27) · ×1
  • AgentConfigDialog.AgentConfigDialog (cognitive 27) packages/cli/src/ui/components/AgentConfigDialog.tsx:190 — AgentConfigDialog.AgentConfigDialog has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (16 pts), ternaries 6, boolean chains 4, loops 1 (nesting depth added 3). Most of this is not in the body itself: 1 of the 27 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 258, 335, 308, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ShellProcessor.processString (cognitive 27) · ×1
  • ShellProcessor.processString (cognitive 27) packages/cli/src/services/prompt-processors/shellProcessor.ts:65 — ShellProcessor.processString has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 3, loops 2 (nesting depth added 8). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · paths.tildeifyPath (cognitive 27) · ×1
  • paths.tildeifyPath (cognitive 27) packages/core/src/utils/paths.ts:42 — paths.tildeifyPath has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 3 (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.
D2 · Cognitive Complexity · HookTranslatorGenAIv1.toHookLLMRequest (cognitive 27) · ×1
  • HookTranslatorGenAIv1.toHookLLMRequest (cognitive 27) packages/core/src/hooks/hookTranslator.ts:166 — HookTranslatorGenAIv1.toHookLLMRequest has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 4 (15 pts), if/else 4 (9 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AgentRegistry.registerRemoteAgent (cognitive 27) · ×1
  • AgentRegistry.registerRemoteAgent (cognitive 27) REDACTED:456 — AgentRegistry.registerRemoteAgent has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 4, error handling 1 (nesting depth added 4). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
D2 · Cognitive Complexity · memoryDiscovery.findProjectRoot (cognitive 27) · ×1
  • memoryDiscovery.findProjectRoot (cognitive 27) packages/core/src/utils/memoryDiscovery.ts:150 — memoryDiscovery.findProjectRoot has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 5, error handling 1 (3 pts), 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.
D2 · Cognitive Complexity · ide-installer.findCommand (cognitive 27) · ×1
  • ide-installer.findCommand (cognitive 27) REDACTED:24 — ide-installer.findCommand has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 3, error handling 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.
D2 · Cognitive Complexity · RipGrepTool.validateToolParamValues (cognitive 27) · ×1
  • RipGrepTool.validateToolParamValues (cognitive 27) REDACTED:659 — RipGrepTool.validateToolParamValues has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 4 (8 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GlobToolInvocation.execute (cognitive 27) · ×1
  • GlobToolInvocation.execute (cognitive 27) packages/core/src/tools/glob.ts:138 — GlobToolInvocation.execute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (16 pts), error handling 4 (5 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 7). Of this number, 24 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AskUserTool.validateToolParamValues (cognitive 27) · ×1
  • AskUserTool.validateToolParamValues (cognitive 27) packages/core/src/tools/ask-user.ts:46 — AskUserTool.validateToolParamValues has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HookRunner.applyHookOutputToInput (cognitive 27) · ×1
  • HookRunner.applyHookOutputToInput (cognitive 27) packages/core/src/hooks/hookRunner.ts:172 — HookRunner.applyHookOutputToInput has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (22 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sessionUtils.convertSessionToHistoryFormats (cognitive 26) · ×1
  • sessionUtils.convertSessionToHistoryFormats (cognitive 26) packages/cli/src/utils/sessionUtils.ts:668 — sessionUtils.convertSessionToHistoryFormats has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 6, ternaries 2 (5 pts), loops 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 11). Of this number, 21 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodeColorizer.colorizeCode (cognitive 26) · ×1
  • CodeColorizer.colorizeCode (cognitive 26) packages/cli/src/ui/utils/CodeColorizer.tsx:155 — CodeColorizer.colorizeCode has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 7 (10 pts), if/else 6 (9 pts), boolean chains 6, error handling 1 (nesting depth added 6). Of this number, 20 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MouseContext.MouseProvider (cognitive 26) · ×1
  • MouseContext.MouseProvider (cognitive 26) packages/cli/src/ui/contexts/MouseContext.tsx:63 — MouseContext.MouseProvider has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 9). None of this is in the body itself: all 26 points belong to 3 function literals inside it that branch (lines 102, 148, 95). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ModelStatsDisplay.ModelStatsDisplay (cognitive 26) · ×1
  • ModelStatsDisplay.ModelStatsDisplay (cognitive 26) packages/cli/src/ui/components/ModelStatsDisplay.tsx:48 — ModelStatsDisplay.ModelStatsDisplay has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 8, ternaries 4 (nesting depth added 1). Most of this is not in the body itself: 12 of the 26 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 304, 102, 256, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · PromptProvider.getCoreSystemPrompt (cognitive 26) · ×1
  • PromptProvider.getCoreSystemPrompt (cognitive 26) packages/core/src/prompts/promptProvider.ts:47 — PromptProvider.getCoreSystemPrompt has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 6 (10 pts), boolean chains 5 (nesting depth added 7). Of this number, 22 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config.createPolicyEngineConfig · ×1
  • config.createPolicyEngineConfig::mapToolsToRules (cognitive 26) packages/core/src/policy/config.ts:445 — config.createPolicyEngineConfig::mapToolsToRules has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (7 pts), ternaries 2 (6 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (config.createPolicyEngineConfig) 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.
D2 · Cognitive Complexity · LocalAgentExecutor.callModel (cognitive 26) · ×1
  • LocalAgentExecutor.callModel (cognitive 26) packages/core/src/agents/local-executor.ts:998 — LocalAgentExecutor.callModel has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 5, error handling 1 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sessionSummaryUtils.generateAndSaveSummary (cognitive 26) · ×1
  • sessionSummaryUtils.generateAndSaveSummary (cognitive 26) packages/core/src/services/sessionSummaryUtils.ts:324 — sessionSummaryUtils.generateAndSaveSummary has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 3, ternaries 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.
D2 · Cognitive Complexity · Config.refreshUserQuota (cognitive 26) · ×1
  • Config.refreshUserQuota (cognitive 26) packages/core/src/config/config.ts:2330 — Config.refreshUserQuota has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 6, loops 1 (2 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · app.createApp (cognitive 26) · ×1
  • app.createApp (cognitive 26) REDACTED:197 — app.createApp has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 3 (6 pts), error handling 4, boolean chains 2, loops 1 (nesting depth added 5). Most of this is not in the body itself: 7 of the 26 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 357, 285, 386, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · sandboxUtils.safeResolveToRealPath (cognitive 26) · ×1
  • sandboxUtils.safeResolveToRealPath (cognitive 26) packages/cli/src/utils/sandboxUtils.ts:106 — sandboxUtils.safeResolveToRealPath has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (14 pts), error handling 2 (6 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings-validation.buildZodSchemaFromJsonSchema (cognitive 25) · ×1
  • settings-validation.buildZodSchemaFromJsonSchema (cognitive 25) packages/cli/src/config/settings-validation.ts:17 — settings-validation.buildZodSchemaFromJsonSchema has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings.findEnvFile (cognitive 25) · ×1
  • settings.findEnvFile (cognitive 25) packages/cli/src/config/settings.ts:607 — settings.findEnvFile has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (22 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · PersistentState.load (cognitive 25) · ×1
  • PersistentState.load (cognitive 25) packages/cli/src/utils/persistentState.ts:40 — PersistentState.load has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 4 (11 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Notifications.Notifications (cognitive 25) · ×1
  • Notifications.Notifications (cognitive 25) packages/cli/src/ui/components/Notifications.tsx:37 — Notifications.Notifications has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 12, if/else 10 (12 pts), error handling 1 (nesting depth added 2). Most of this is not in the body itself: 8 of the 25 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 71, 55, 59, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · VoiceModelDialog.VoiceModelDialog (cognitive 25) · ×1
  • VoiceModelDialog.VoiceModelDialog (cognitive 25) packages/cli/src/ui/components/VoiceModelDialog.tsx:52 — VoiceModelDialog.VoiceModelDialog has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 8 (13 pts), if/else 7 (8 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 7). Most of this is not in the body itself: 10 of the 25 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 113, 76, 93, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · HooksDialog.HooksDialog (cognitive 25) · ×1
  • HooksDialog.HooksDialog (cognitive 25) packages/cli/src/ui/components/HooksDialog.tsx:48 — HooksDialog.HooksDialog has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 10, if/else 6 (9 pts), ternaries 4 (6 pts) (nesting depth added 5). Most of this is not in the body itself: 6 of the 25 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 176, 93, 66). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useSuspend.useSuspend (cognitive 25) · ×1
  • useSuspend.useSuspend (cognitive 25) packages/cli/src/ui/hooks/useSuspend.ts:33 — useSuspend.useSuspend has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (25 pts) (nesting depth added 10). None of this is in the body itself: all 25 points belong to 3 function literals inside it that branch (lines 56, 93, 43). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · activityLogger.callHttpRequest (cognitive 25) · ×1
  • activityLogger.callHttpRequest (cognitive 25) REDACTED:55 — activityLogger.callHttpRequest has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · shell-utils.collectCommandDetails (cognitive 25) · ×1
  • shell-utils.collectCommandDetails (cognitive 25) packages/core/src/utils/shell-utils.ts:425 — shell-utils.collectCommandDetails has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · shell-utils.execStreaming (cognitive 25) · ×1
  • shell-utils.execStreaming (cognitive 25) packages/core/src/utils/shell-utils.ts:1354 — shell-utils.execStreaming has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 3, ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 5). Most of this is not in the body itself: 9 of the 25 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 1443, a function literal at line 1436, a function literal at line 1390, …). 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.
D2 · Cognitive Complexity · textUtils.normalizeEscapedNewlines (cognitive 25) · ×1
  • textUtils.normalizeEscapedNewlines (cognitive 25) packages/core/src/utils/textUtils.ts:315 — textUtils.normalizeEscapedNewlines has cognitive complexity 25 (threshold 15). Drivers by points: loops 6 (11 pts), if/else 5 (8 pts), boolean chains 6 (nesting depth added 8). Of this number, 24 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodeAssistServer.generateContentStream (cognitive 25) · ×1
  • CodeAssistServer.generateContentStream (cognitive 25) packages/core/src/code_assist/server.ts:93 — CodeAssistServer.generateContentStream has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 7, loops 2 (4 pts), ternaries 2 (nesting depth added 8). Most of this is not in the body itself: 5 of the 25 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 134, 172). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · agentLoader.markdownToAgentDefinition (cognitive 25) · ×1
  • agentLoader.markdownToAgentDefinition (cognitive 25) REDACTED:497 — agentLoader.markdownToAgentDefinition has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 5, ternaries 3 (4 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RemoteSessionInvocation.execute (cognitive 25) · ×1
  • RemoteSessionInvocation.execute (cognitive 25) packages/core/src/agents/remote-session-invocation.ts:117 — RemoteSessionInvocation.execute has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 4 (8 pts), boolean chains 3, error handling 1 (nesting depth added 8). Of this number, 21 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolExecutor.execute (cognitive 25) · ×1
  • ToolExecutor.execute (cognitive 25) packages/core/src/scheduler/tool-executor.ts:66 — ToolExecutor.execute has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 4 (7 pts), boolean chains 5, error handling 1 (nesting depth added 5). Most of this is not in the body itself: 4 of the 25 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 101, 107). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · memoryDiscovery.loadJitSubdirectoryMemory (cognitive 25) · ×1
  • memoryDiscovery.loadJitSubdirectoryMemory (cognitive 25) packages/core/src/utils/memoryDiscovery.ts:512 — memoryDiscovery.loadJitSubdirectoryMemory has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (14 pts), error handling 2 (4 pts), loops 3 (4 pts), boolean chains 2, ternaries 1 (nesting depth added 8). Of this number, 22 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LSToolInvocation.execute (cognitive 25) · ×1
  • LSToolInvocation.execute (cognitive 25) REDACTED:159 — LSToolInvocation.execute has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 3 (5 pts), error handling 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 5). Of this number, 19 points are the body's own statements and 6 belong to 3 function literals inside it that branch. 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.
D2 · Cognitive Complexity · ShellToolInvocation.simplifyPaths (cognitive 25) · ×1
  • ShellToolInvocation.simplifyPaths (cognitive 25) packages/core/src/tools/shell.ts:184 — ShellToolInvocation.simplifyPaths has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 5 (7 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tool-utils.doesToolInvocationMatch (cognitive 25) · ×1
  • tool-utils.doesToolInvocationMatch (cognitive 25) packages/core/src/utils/tool-utils.ts:106 — tool-utils.doesToolInvocationMatch has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 1, 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.
D2 · Cognitive Complexity · fileUtils.processSingleFileContent (cognitive 25) · ×1
  • fileUtils.processSingleFileContent (cognitive 25) packages/core/src/utils/fileUtils.ts:602 — fileUtils.processSingleFileContent has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 3, ternaries 1 (2 pts), error handling 1, match/switch 1 (nesting depth added 8). Of this number, 23 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Task._handleToolConfirmationPart (cognitive 25) · ×1
  • Task._handleToolConfirmationPart (cognitive 25) packages/a2a-server/src/agent/task.ts:1032 — Task._handleToolConfirmationPart has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17, boolean chains 4, ternaries 2 (3 pts), error handling 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.
D2 · Cognitive Complexity · ContextCompressionService.applyCompressionDecision (cognitive 25) · ×1
  • ContextCompressionService.applyCompressionDecision (cognitive 25) packages/core/src/context/contextCompressionService.ts:332 — ContextCompressionService.applyCompressionDecision has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · github.isGitHubWebhookPayload (cognitive 25) · ×1
  • github.isGitHubWebhookPayload (cognitive 25) tools/caretaker-agent/cloudrun/ingestion-service/auth/github.ts:89 — github.isGitHubWebhookPayload has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 8 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · GeminiSandbox.ApplyBulkAcls (cognitive 24) · ×1
  • GeminiSandbox.ApplyBulkAcls (cognitive 24) packages/core/src/sandbox/windows/GeminiSandbox.cs:422 — GeminiSandbox.ApplyBulkAcls has cognitive complexity 24 (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.
D2 · Cognitive Complexity · textUtils.escapeAnsiCtrlCodes (cognitive 24) · ×1
  • textUtils.escapeAnsiCtrlCodes (cognitive 24) packages/cli/src/ui/utils/textUtils.ts:264 — textUtils.escapeAnsiCtrlCodes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (3 pts), ternaries 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.
D2 · Cognitive Complexity · keyBindings.loadCustomKeybindings (cognitive 24) · ×1
  • keyBindings.loadCustomKeybindings (cognitive 24) packages/cli/src/ui/key/keyBindings.ts:734 — keyBindings.loadCustomKeybindings has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2 (4 pts), ternaries 1 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · text-buffer.findNextWordAcrossLines (cognitive 24) · ×1
  • text-buffer.findNextWordAcrossLines (cognitive 24) packages/cli/src/ui/components/shared/text-buffer.ts:415 — text-buffer.findNextWordAcrossLines has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 3, loops 2 (3 pts), 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 (text-buffer.findNextBigWordAcrossLines) 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.
D2 · Cognitive Complexity · text-buffer.findNextBigWordAcrossLines (cognitive 24) · ×1
  • text-buffer.findNextBigWordAcrossLines (cognitive 24) packages/cli/src/ui/components/shared/text-buffer.ts:516 — text-buffer.findNextBigWordAcrossLines has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 3, loops 2 (3 pts), 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 (text-buffer.findNextWordAcrossLines) 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.
D2 · Cognitive Complexity · github.downloadFromGitHubRelease (cognitive 24) · ×1
  • github.downloadFromGitHubRelease (cognitive 24) packages/cli/src/config/extensions/github.ts:333 — github.downloadFromGitHubRelease has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (13 pts), error handling 4, boolean chains 3, loops 1 (3 pts), ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · usePhraseCycler.usePhraseCycler (cognitive 24) · ×1
  • usePhraseCycler.usePhraseCycler (cognitive 24) packages/cli/src/ui/hooks/usePhraseCycler.ts:27 — usePhraseCycler.usePhraseCycler has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15, boolean chains 6, ternaries 3. Most of this is not in the body itself: 3 of the 24 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 52, 81, 113, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · LoadingIndicator.LoadingIndicator (cognitive 24) · ×1
  • LoadingIndicator.LoadingIndicator (cognitive 24) packages/cli/src/ui/components/LoadingIndicator.tsx:38 — LoadingIndicator.LoadingIndicator has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 16, ternaries 5 (6 pts), if/else 2 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ActivityLogger.patchNodeHttp · ×1
  • ActivityLogger.patchNodeHttp::wrapRequest (cognitive 24) REDACTED:448 — ActivityLogger.patchNodeHttp::wrapRequest has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 11, if/else 10, ternaries 2 (3 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AppContainer.discardCorkedStdoutBuffer (cognitive 24) · ×1
  • AppContainer.discardCorkedStdoutBuffer (cognitive 24) packages/cli/src/ui/AppContainer.tsx:291 — AppContainer.discardCorkedStdoutBuffer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (4 pts), boolean chains 3, error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · errors.toSafeSerializable (cognitive 24) · ×1
  • errors.toSafeSerializable (cognitive 24) packages/core/src/utils/errors.ts:340 — errors.toSafeSerializable has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · shell-utils.isPowerShellMemberOrTypeCallBeforeParen (cognitive 24) · ×1
  • shell-utils.isPowerShellMemberOrTypeCallBeforeParen (cognitive 24) packages/core/src/utils/shell-utils.ts:1618 — shell-utils.isPowerShellMemberOrTypeCallBeforeParen has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, if/else 6 (7 pts), loops 4 (5 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · oauth-flow.startCallbackServer (cognitive 24) · ×1
  • oauth-flow.startCallbackServer (cognitive 24) REDACTED:193 — oauth-flow.startCallbackServer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 6, error handling 1 (nesting depth added 4). None of this is in the body itself: all 24 points belong to 3 function literals inside it that branch (lines 225, 221, 407). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · historyHardening.refineToolResponses (cognitive 24) · ×1
  • historyHardening.refineToolResponses (cognitive 24) packages/core/src/utils/historyHardening.ts:392 — historyHardening.refineToolResponses has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (19 pts), boolean chains 4, loops 1 (nesting depth added 14). Of this number, 14 points are the body's own statements and 10 belong to one function literal inside it that branches. 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.
D2 · Cognitive Complexity · geminiChat.stripThoughts (cognitive 24) · ×1
  • geminiChat.stripThoughts (cognitive 24) packages/core/src/core/geminiChat.ts:2224 — geminiChat.stripThoughts has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 5, ternaries 1 (2 pts), loops 1 (nesting depth added 11). Of this number, 14 points are the body's own statements and 10 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · skillLoader.parseSimpleFrontmatter (cognitive 24) · ×1
  • skillLoader.parseSimpleFrontmatter (cognitive 24) packages/core/src/skills/skillLoader.ts:79 — skillLoader.parseSimpleFrontmatter has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (7 pts), loops 2 (4 pts), boolean chains 3 (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.
D2 · Cognitive Complexity · memoryPatchUtils.applyParsedPatchesWithAllowedRoots (cognitive 24) · ×1
  • memoryPatchUtils.applyParsedPatchesWithAllowedRoots (cognitive 24) packages/core/src/services/memoryPatchUtils.ts:681 — memoryPatchUtils.applyParsedPatchesWithAllowedRoots has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2 (6 pts), boolean chains 4, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Scheduler._processToolCall (cognitive 24) · ×1
  • Scheduler._processToolCall (cognitive 24) packages/core/src/scheduler/scheduler.ts:640 — Scheduler._processToolCall has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 7, 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.
D2 · Cognitive Complexity · memory.applyInboxPatch (cognitive 24) · ×1
  • memory.applyInboxPatch (cognitive 24) REDACTED:1189 — memory.applyInboxPatch has cognitive complexity 24 (threshold 15). Drivers by points: error handling 5 (7 pts), ternaries 3 (6 pts), if/else 5, loops 2 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memoryImportProcessor.processImports (cognitive 24) · ×1
  • memoryImportProcessor.processImports (cognitive 24) packages/core/src/utils/memoryImportProcessor.ts:190 — memoryImportProcessor.processImports has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (30 pts), boolean chains 7, ternaries 2 (6 pts), error handling 2 (5 pts), loops 2 (3 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. This shape REPEATS in the file: one other method here (memoryImportProcessor.processImports::processFlat) 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.
D2 · Cognitive Complexity · ExtensionLoader.stopExtension (cognitive 24) · ×1
  • ExtensionLoader.stopExtension (cognitive 24) packages/core/src/utils/extensionLoader.ts:172 — ExtensionLoader.stopExtension has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (8 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GrepTool.validateToolParamValues (cognitive 24) · ×1
  • GrepTool.validateToolParamValues (cognitive 24) REDACTED:711 — GrepTool.validateToolParamValues has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 4 (7 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WebSearchToolInvocation.execute (cognitive 24) · ×1
  • WebSearchToolInvocation.execute (cognitive 24) packages/core/src/tools/web-search.ts:89 — WebSearchToolInvocation.execute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 6, loops 2 (6 pts), error handling 1 (nesting depth added 9). Of this number, 18 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcp-tool.extractToolExplanation (cognitive 24) · ×1
  • mcp-tool.extractToolExplanation (cognitive 24) packages/core/src/tools/mcp-tool.ts:244 — mcp-tool.extractToolExplanation has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 2 (9 pts), boolean chains 3, loops 1 (nesting depth added 11). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
D2 · Cognitive Complexity · AcpSessionManager.newSession (cognitive 24) · ×1
  • AcpSessionManager.newSession (cognitive 24) packages/cli/src/acp/acpSessionManager.ts:66 — AcpSessionManager.newSession has cognitive complexity 24 (threshold 15). Drivers by points: error handling 5 (10 pts), if/else 5 (6 pts), boolean chains 5, ternaries 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mcpCommand.handleEnableDisable (cognitive 23) · ×1
  • mcpCommand.handleEnableDisable (cognitive 23) packages/cli/src/ui/commands/mcpCommand.ts:396 — mcpCommand.handleEnableDisable has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 3, ternaries 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
D2 · Cognitive Complexity · googleErrors.fromGaxiosError (cognitive 23) · ×1
  • googleErrors.fromGaxiosError (cognitive 23) packages/core/src/utils/googleErrors.ts:279 — googleErrors.fromGaxiosError has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 pts), error handling 1 (3 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.
D2 · Cognitive Complexity · ShellExecutionService.closeOrphanSlaveFd (cognitive 23) · ×1
  • ShellExecutionService.closeOrphanSlaveFd (cognitive 23) packages/core/src/services/shellExecutionService.ts:1172 — ShellExecutionService.closeOrphanSlaveFd has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 4 (7 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · tool-names.isValidToolName (cognitive 23) · ×1
  • tool-names.isValidToolName (cognitive 23) packages/core/src/tools/tool-names.ts:303 — tool-names.isValidToolName has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (20 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.
D2 · Cognitive Complexity · edit.calculateFuzzyReplacement (cognitive 23) · ×1
  • edit.calculateFuzzyReplacement (cognitive 23) REDACTED:1430 — edit.calculateFuzzyReplacement has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 3 (4 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 8). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Scheduler._execute (cognitive 23) · ×1
  • Scheduler._execute (cognitive 23) packages/core/src/scheduler/scheduler.ts:787 — Scheduler._execute has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 6, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 4). Of this number, 21 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
D2 · Cognitive Complexity · McpClient.refreshTools (cognitive 23) · ×1
  • McpClient.refreshTools (cognitive 23) packages/core/src/tools/mcp-client.ts:699 — McpClient.refreshTools has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 6, loops 3 (6 pts), error handling 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tools.hasCycleInSchema · ×1
  • tools.hasCycleInSchema::traverse (cognitive 23) packages/core/src/tools/tools.ts:823 — tools.hasCycleInSchema::traverse has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · chatRecordingService.createJsonlRecordAccumulator.applySinglePatch (cognitive 23) · ×1
  • chatRecordingService.createJsonlRecordAccumulator.applySinglePatch (cognitive 23) packages/core/src/services/chatRecordingService.ts:283 — chatRecordingService.createJsonlRecordAccumulator.applySinglePatch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GCSTaskStore.save (cognitive 23) · ×1
  • GCSTaskStore.save (cognitive 23) packages/a2a-server/src/persistence/gcs.ts:94 — GCSTaskStore.save has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 3 (7 pts) (nesting depth added 11). Of this number, 20 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sandboxUtils.entrypoint (cognitive 23) · ×1
  • sandboxUtils.entrypoint (cognitive 23) packages/cli/src/utils/sandboxUtils.ts:375 — sandboxUtils.entrypoint has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 4 (6 pts), loops 2 (4 pts), boolean chains 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.
D2 · Cognitive Complexity · formatters.formatResetTime (cognitive 22) · ×1
  • formatters.formatResetTime (cognitive 22) packages/cli/src/ui/utils/formatters.ts:109 — formatters.formatResetTime has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 4 (9 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MaxSizedBox.MaxSizedBox (cognitive 22) · ×1
  • MaxSizedBox.MaxSizedBox (cognitive 22) packages/cli/src/ui/components/shared/MaxSizedBox.tsx:36 — MaxSizedBox.MaxSizedBox has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 10, if/else 6 (7 pts), ternaries 5 (nesting depth added 1). Of this number, 15 points are the body's own statements and 7 belong to 3 function literals inside it that branch. 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.
D2 · Cognitive Complexity · DiffRenderer.renderDiffLines.content (cognitive 22) · ×1
  • DiffRenderer.renderDiffLines.content (cognitive 22) packages/cli/src/ui/components/messages/DiffRenderer.tsx:292 — DiffRenderer.renderDiffLines.content has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 8 (14 pts), if/else 4 (5 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · usePromptCompletion.usePromptCompletion.generatePromptSuggestions (cognitive 22) · ×1
  • usePromptCompletion.usePromptCompletion.generatePromptSuggestions (cognitive 22) packages/cli/src/ui/hooks/usePromptCompletion.ts:68 — usePromptCompletion.usePromptCompletion.generatePromptSuggestions has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4, ternaries 1 (3 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContextSummaryDisplay.ContextSummaryDisplay (cognitive 22) · ×1
  • ContextSummaryDisplay.ContextSummaryDisplay (cognitive 22) packages/cli/src/ui/components/ContextSummaryDisplay.tsx:24 — ContextSummaryDisplay.ContextSummaryDisplay has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 6 (7 pts), boolean chains 5 (nesting depth added 2). Most of this is not in the body itself: 4 of the 22 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 68, 57, 48, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Composer.Composer (cognitive 22) · ×1
  • Composer.Composer (cognitive 22) packages/cli/src/ui/components/Composer.tsx:32 — Composer.Composer has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 18, if/else 3, ternaries 1. Of this number, 18 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
D2 · Cognitive Complexity · useGeminiStream.useGeminiStream.handleApprovalModeChange (cognitive 22) · ×1
  • useGeminiStream.useGeminiStream.handleApprovalModeChange (cognitive 22) packages/cli/src/ui/hooks/useGeminiStream.ts:2055 — useGeminiStream.useGeminiStream.handleApprovalModeChange has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (7 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 10). Of this number, 21 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useApprovalModeIndicator.useApprovalModeIndicator (cognitive 22) · ×1
  • useApprovalModeIndicator.useApprovalModeIndicator (cognitive 22) packages/cli/src/ui/hooks/useApprovalModeIndicator.ts:26 — useApprovalModeIndicator.useApprovalModeIndicator has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, error handling 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 10). None of this is in the body itself: all 22 points belong to one function literal inside it that branches (line 42). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · shell-utils.hasRedirection (cognitive 22) · ×1
  • shell-utils.hasRedirection (cognitive 22) packages/core/src/utils/shell-utils.ts:821 — shell-utils.hasRedirection has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (5 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ShellExecutionService.closeOrphanMasterFd (cognitive 22) · ×1
  • ShellExecutionService.closeOrphanMasterFd (cognitive 22) packages/core/src/services/shellExecutionService.ts:1086 — ShellExecutionService.closeOrphanMasterFd has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6, error handling 2 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · shellExecutionService.getFullBufferText (cognitive 22) · ×1
  • shellExecutionService.getFullBufferText (cognitive 22) packages/core/src/services/shellExecutionService.ts:277 — shellExecutionService.getFullBufferText has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · stdio.createWorkingStdio (cognitive 22) · ×1
  • stdio.createWorkingStdio (cognitive 22) packages/core/src/utils/stdio.ts:173 — stdio.createWorkingStdio has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 2 (nesting depth added 5). Most of this is not in the body itself: 8 of the 22 points are its own statements and the rest belongs to 2 function items inside it that branch (workingStdoutWrite, a function literal at line 194). 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.
D2 · Cognitive Complexity · handler.handleFallback (cognitive 22) · ×1
  • handler.handleFallback (cognitive 22) packages/core/src/fallback/handler.ts:26 — handler.handleFallback has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, ternaries 2 (4 pts), error handling 1 (nesting depth added 5). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiChat.ensureActiveLoopHasThoughtSignatures (cognitive 22) · ×1
  • GeminiChat.ensureActiveLoopHasThoughtSignatures (cognitive 22) packages/core/src/core/geminiChat.ts:1514 — GeminiChat.ensureActiveLoopHasThoughtSignatures has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (17 pts), loops 2 (4 pts), boolean chains 1 (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.
D2 · Cognitive Complexity · truncation.normalizeFunctionResponse (cognitive 22) · ×1
  • truncation.normalizeFunctionResponse (cognitive 22) packages/core/src/context/truncation.ts:81 — truncation.normalizeFunctionResponse has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · A2AAuthProviderFactory.findMatchingScheme (cognitive 22) · ×1
  • A2AAuthProviderFactory.findMatchingScheme (cognitive 22) packages/core/src/agents/auth-provider/factory.ts:156 — A2AAuthProviderFactory.findMatchingScheme has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (18 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memoryDiscovery.deduplicatePathsByFileIdentity (cognitive 22) · ×1
  • memoryDiscovery.deduplicatePathsByFileIdentity (cognitive 22) packages/core/src/utils/memoryDiscovery.ts:54 — memoryDiscovery.deduplicatePathsByFileIdentity has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (4 pts), ternaries 1 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 9). Of this number, 17 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RecursiveFileSearch.handleFileWatcherEvent (cognitive 22) · ×1
  • RecursiveFileSearch.handleFileWatcherEvent (cognitive 22) packages/core/src/utils/filesearch/fileSearch.ts:207 — RecursiveFileSearch.handleFileWatcherEvent has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, loops 2 (4 pts), ternaries 2 (4 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · content-utils.geminiPartsToContentParts (cognitive 22) · ×1
  • content-utils.geminiPartsToContentParts (cognitive 22) packages/core/src/agent/content-utils.ts:16 — content-utils.geminiPartsToContentParts has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, ternaries 1 (4 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TrustedHooksManager.getUntrustedHooks (cognitive 22) · ×1
  • TrustedHooksManager.getUntrustedHooks (cognitive 22) packages/core/src/hooks/trustedHooks.ts:68 — TrustedHooksManager.getUntrustedHooks has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (6 pts), boolean chains 3 (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.
D2 · Cognitive Complexity · pathReader.readPathFromWorkspace (cognitive 22) · ×1
  • pathReader.readPathFromWorkspace (cognitive 22) packages/core/src/utils/pathReader.ts:23 — pathReader.readPathFromWorkspace has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2 (4 pts), error handling 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update.handleUpdate (cognitive 22) · ×1
  • update.handleUpdate (cognitive 22) packages/cli/src/commands/extensions/update.ts:35 — update.handleUpdate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (18 pts), error handling 2 (4 pts) (nesting depth added 10). Of this number, 20 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · acpUtils.toToolCallContent (cognitive 22) · ×1
  • acpUtils.toToolCallContent (cognitive 22) packages/cli/src/acp/acpUtils.ts:80 — acpUtils.toToolCallContent has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 2 (9 pts) (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · sandboxUtils.isSensitiveHostPath (cognitive 22) · ×1
  • sandboxUtils.isSensitiveHostPath (cognitive 22) packages/cli/src/utils/sandboxUtils.ts:151 — sandboxUtils.isSensitiveHostPath has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 8, ternaries 3, error handling 1 (nesting depth added 2). Of this number, 19 points are the body's own statements and 3 belong to 2 function items inside it that branch. 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.
D2 · Cognitive Complexity · extensionSettings.maybePromptForSettings (cognitive 21) · ×1
  • extensionSettings.maybePromptForSettings (cognitive 21) packages/cli/src/config/extensions/extensionSettings.ts:62 — extensionSettings.maybePromptForSettings has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, loops 4 (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.
D2 · Cognitive Complexity · KeypressContext.KeypressProvider (cognitive 21) · ×1
  • KeypressContext.KeypressProvider (cognitive 21) packages/cli/src/ui/contexts/KeypressContext.tsx:782 — KeypressContext.KeypressProvider has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 6). None of this is in the body itself: all 21 points belong to 6 function literals inside it that branch (lines 847, 803, 868, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ToolResultDisplay.ToolResultDisplay · ×1
  • ToolResultDisplay.ToolResultDisplay::renderContent (cognitive 21) packages/cli/src/ui/components/messages/ToolResultDisplay.tsx:108 — ToolResultDisplay.ToolResultDisplay::renderContent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 6, ternaries 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (ToolResultDisplay.ToolResultDisplay) 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.
D2 · Cognitive Complexity · ToolGroupDisplay.ToolDisplayMessage (cognitive 21) · ×1
  • ToolGroupDisplay.ToolDisplayMessage (cognitive 21) packages/cli/src/ui/components/messages/ToolGroupDisplay.tsx:118 — ToolGroupDisplay.ToolDisplayMessage has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 17, if/else 4. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · useAuth.useAuthCommand (cognitive 21) · ×1
  • useAuth.useAuthCommand (cognitive 21) packages/cli/src/ui/auth/useAuth.ts:43 — useAuth.useAuthCommand has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 2, error handling 1, ternaries 1 (nesting depth added 4). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 91, 82). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · OAuthUtils.discoverOAuthConfig (cognitive 21) · ×1
  • OAuthUtils.discoverOAuthConfig (cognitive 21) packages/core/src/mcp/oauth-utils.ts:445 — OAuthUtils.discoverOAuthConfig has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 2, error handling 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · models.resolveClassifierModel (cognitive 21) · ×1
  • models.resolveClassifierModel (cognitive 21) packages/core/src/config/models.ts:384 — models.resolveClassifierModel has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (6 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · ignorePathUtils.canNegationMatchInsideDir (cognitive 21) · ×1
  • ignorePathUtils.canNegationMatchInsideDir (cognitive 21) packages/core/src/utils/ignorePathUtils.ts:73 — ignorePathUtils.canNegationMatchInsideDir has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, ternaries 1 (2 pts), 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.
D2 · Cognitive Complexity · FileDiscoveryService._shouldIgnore (cognitive 21) · ×1
  • FileDiscoveryService._shouldIgnore (cognitive 21) packages/core/src/services/fileDiscoveryService.ts:290 — FileDiscoveryService._shouldIgnore has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (17 pts), error handling 2 (3 pts), ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatCompressionService.compress (cognitive 21) · ×1
  • ChatCompressionService.compress (cognitive 21) packages/core/src/context/chatCompressionService.ts:621 — ChatCompressionService.compress has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6, ternaries 4 (nesting depth added 2). Of this number, 17 points are the body's own statements and 4 belong to 4 function literals inside it that branch. 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.
D2 · Cognitive Complexity · toGraph.getStableId (cognitive 21) · ×1
  • toGraph.getStableId (cognitive 21) packages/core/src/context/graph/toGraph.ts:97 — toGraph.getStableId has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WriteFileTool.validateToolParamValues (cognitive 21) · ×1
  • WriteFileTool.validateToolParamValues (cognitive 21) packages/core/src/tools/write-file.ts:653 — WriteFileTool.validateToolParamValues has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (8 pts), error handling 3 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memory.applyMemoryPatchFile (cognitive 21) · ×1
  • memory.applyMemoryPatchFile (cognitive 21) REDACTED:782 — memory.applyMemoryPatchFile has cognitive complexity 21 (threshold 15). Drivers by points: error handling 5 (7 pts), ternaries 3 (5 pts), if/else 4, loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GrepToolInvocation.execute (cognitive 21) · ×1
  • GrepToolInvocation.execute (cognitive 21) REDACTED:182 — GrepToolInvocation.execute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, error handling 4, ternaries 2 (3 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, 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.
D2 · Cognitive Complexity · McpClient.refreshPrompts (cognitive 21) · ×1
  • McpClient.refreshPrompts (cognitive 21) packages/core/src/tools/mcp-client.ts:600 — McpClient.refreshPrompts has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (6 pts), boolean chains 4, error handling 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fileUtils.detectFileType (cognitive 21) · ×1
  • fileUtils.detectFileType (cognitive 21) packages/core/src/utils/fileUtils.ts:524 — fileUtils.detectFileType has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config.setTargetDir (cognitive 21) · ×1
  • config.setTargetDir (cognitive 21) packages/a2a-server/src/config/config.ts:483 — config.setTargetDir has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, error handling 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.
D2 · Cognitive Complexity · logs.readLastLines (cognitive 21) · ×1
  • logs.readLastLines (cognitive 21) packages/cli/src/commands/gemma/logs.ts:14 — logs.readLastLines has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiSandbox.QuoteArgument (cognitive 20) · ×1
  • GeminiSandbox.QuoteArgument (cognitive 20) packages/core/src/sandbox/windows/GeminiSandbox.cs:526 — GeminiSandbox.QuoteArgument has cognitive complexity 20 (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.
D2 · Cognitive Complexity · commentJson.preserveCommentsOnPropertyDeletion (cognitive 20) · ×1
  • commentJson.preserveCommentsOnPropertyDeletion (cognitive 20) packages/cli/src/utils/commentJson.ts:115 — commentJson.preserveCommentsOnPropertyDeletion has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5, ternaries 2 (nesting depth added 2). Of this number, 18 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
D2 · Cognitive Complexity · extensionSettings.updateSetting (cognitive 20) · ×1
  • extensionSettings.updateSetting (cognitive 20) packages/cli/src/config/extensions/extensionSettings.ts:230 — extensionSettings.updateSetting has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), error handling 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 5). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
D2 · Cognitive Complexity · text-buffer.calculateTransformedLine (cognitive 20) · ×1
  • text-buffer.calculateTransformedLine (cognitive 20) packages/cli/src/ui/components/shared/text-buffer.ts:1170 — text-buffer.calculateTransformedLine has cognitive complexity 20 (threshold 15). Drivers by points: loops 5 (10 pts), ternaries 2 (6 pts), if/else 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · TableRenderer.TableRenderer (cognitive 20) · ×1
  • TableRenderer.TableRenderer (cognitive 20) packages/cli/src/ui/utils/TableRenderer.tsx:66 — TableRenderer.TableRenderer has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (5 pts), ternaries 3 (4 pts), loops 3 (nesting depth added 2). None of this is in the body itself: all 20 points belong to 10 function items inside it that branch (a function literal at line 95, a function literal at line 183, renderDataRow, …). 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.
D2 · Cognitive Complexity · ScrollableList.ScrollableList (cognitive 20) · ×1
  • ScrollableList.ScrollableList (cognitive 20) packages/cli/src/ui/components/shared/ScrollableList.tsx:46 — ScrollableList.ScrollableList has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 3 (5 pts), boolean chains 4 (nesting depth added 3). None of this is in the body itself: all 20 points belong to 4 function literals inside it that branch (lines 200, 113, 102, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useSelectionList.findNextValidIndex (cognitive 20) · ×1
  • useSelectionList.findNextValidIndex (cognitive 20) packages/cli/src/ui/hooks/useSelectionList.ts:85 — useSelectionList.findNextValidIndex has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, loops 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useTabbedNavigation.tabbedNavigationReducer (cognitive 20) · ×1
  • useTabbedNavigation.tabbedNavigationReducer (cognitive 20) packages/cli/src/ui/hooks/useTabbedNavigation.ts:69 — useTabbedNavigation.tabbedNavigationReducer has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 1 (2 pts), boolean chains 1, 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.
D2 · Cognitive Complexity · useShellCompletion.scanPathExecutables (cognitive 20) · ×1
  • useShellCompletion.scanPathExecutables (cognitive 20) packages/cli/src/ui/hooks/useShellCompletion.ts:183 — useShellCompletion.scanPathExecutables has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (5 pts), boolean chains 2, error handling 2, ternaries 1 (nesting depth added 5). Of this number, 10 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SearchableList.SearchableList (cognitive 20) · ×1
  • SearchableList.SearchableList (cognitive 20) packages/cli/src/ui/components/shared/SearchableList.tsx:77 — SearchableList.SearchableList has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 8, if/else 6, ternaries 5 (6 pts) (nesting depth added 1). Of this number, 11 points are the body's own statements and 9 belong to 4 function items inside it that branch. 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.
D2 · Cognitive Complexity · extensionsCommand.restartAction (cognitive 20) · ×1
  • extensionsCommand.restartAction (cognitive 20) packages/cli/src/ui/commands/extensionsCommand.ts:155 — extensionsCommand.restartAction has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, error handling 1 (2 pts), ternaries 2 (nesting depth added 4). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
D2 · Cognitive Complexity · McpPromptLoader.parseArgs (cognitive 20) · ×1
  • McpPromptLoader.parseArgs (cognitive 20) packages/cli/src/services/McpPromptLoader.ts:231 — McpPromptLoader.parseArgs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 6). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IdeClient.connect (cognitive 20) · ×1
  • IdeClient.connect (cognitive 20) REDACTED:129 — IdeClient.connect has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fetch.fetchWithTimeout (cognitive 20) · ×1
  • fetch.fetchWithTimeout (cognitive 20) packages/core/src/utils/fetch.ts:485 — fetch.fetchWithTimeout has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 1, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · errorReporting.reportError (cognitive 20) · ×1
  • errorReporting.reportError (cognitive 20) packages/core/src/utils/errorReporting.ts:26 — errorReporting.reportError has cognitive complexity 20 (threshold 15). Drivers by points: error handling 5 (11 pts), if/else 6 (8 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · geminiChat.extractCuratedHistory (cognitive 20) · ×1
  • geminiChat.extractCuratedHistory (cognitive 20) packages/core/src/core/geminiChat.ts:276 — geminiChat.extractCuratedHistory has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EditTool.getModifyContext (cognitive 20) · ×1
  • EditTool.getModifyContext (cognitive 20) REDACTED:1280 — EditTool.getModifyContext has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 4, boolean chains 3, ternaries 1 (2 pts) (nesting depth added 4). None of this is in the body itself: all 20 points belong to 3 function items inside it that branch (resolvePath, a function literal at line 1350, a function literal at line 1339). 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.
D2 · Cognitive Complexity · security.parseWindowsBatchSecurityOutput (cognitive 20) · ×1
  • security.parseWindowsBatchSecurityOutput (cognitive 20) packages/core/src/utils/security.ts:185 — security.parseWindowsBatchSecurityOutput has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 5). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BrowserManager.callTool (cognitive 20) · ×1
  • BrowserManager.callTool (cognitive 20) REDACTED:321 — BrowserManager.callTool has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnalyzeScreenshotInvocation.execute (cognitive 20) · ×1
  • AnalyzeScreenshotInvocation.execute (cognitive 20) packages/core/src/agents/browser/analyzeScreenshot.ts:84 — AnalyzeScreenshotInvocation.execute has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (8 pts), if/else 4 (6 pts), boolean chains 3, loops 1 (2 pts), error handling 1 (nesting depth added 5). Of this number, 18 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalAgentExecutor.create · ×1
  • LocalAgentExecutor.create::registerToolByName (cognitive 20) packages/core/src/agents/local-executor.ts:221 — LocalAgentExecutor.create::registerToolByName has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (8 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (LocalAgentExecutor.create) 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.
D2 · Cognitive Complexity · sessionScratchpadUtils.tokenizeShellCommand (cognitive 20) · ×1
  • sessionScratchpadUtils.tokenizeShellCommand (cognitive 20) packages/core/src/services/sessionScratchpadUtils.ts:15 — sessionScratchpadUtils.tokenizeShellCommand has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memoryService.validatePatches (cognitive 20) · ×1
  • memoryService.validatePatches (cognitive 20) REDACTED:856 — memoryService.validatePatches has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 3 (6 pts), match/switch 1 (4 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sessionOperations.deleteSessionFileAndArtifacts (cognitive 20) · ×1
  • sessionOperations.deleteSessionFileAndArtifacts (cognitive 20) packages/core/src/utils/sessionOperations.ts:215 — sessionOperations.deleteSessionFileAndArtifacts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 4 (6 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FolderTrustDiscoveryService.discoverSettings (cognitive 20) · ×1
  • FolderTrustDiscoveryService.discoverSettings (cognitive 20) packages/core/src/services/FolderTrustDiscoveryService.ts:133 — FolderTrustDiscoveryService.discoverSettings has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (5 pts), ternaries 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config.parseOtlpHeaders (cognitive 20) · ×1
  • config.parseOtlpHeaders (cognitive 20) packages/core/src/telemetry/config.ts:141 — config.parseOtlpHeaders has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (4 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · migrate.migrateClaudeHooks (cognitive 20) · ×1
  • migrate.migrateClaudeHooks (cognitive 20) packages/cli/src/commands/hooks/migrate.ts:115 — migrate.migrateClaudeHooks has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 7, loops 1 (nesting depth added 5). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 140). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · readStdin.readStdin (cognitive 20) · ×1
  • readStdin.readStdin (cognitive 20) packages/cli/src/utils/readStdin.ts:35 — readStdin.readStdin has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 1, loops 1 (nesting depth added 7). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 59, 114, 100, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · logCleanup.cleanupBackgroundLogs (cognitive 20) · ×1
  • logCleanup.cleanupBackgroundLogs (cognitive 20) packages/cli/src/utils/logCleanup.ts:19 — logCleanup.cleanupBackgroundLogs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 3 (5 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · interactiveCli.startInteractiveUI (cognitive 20) · ×1
  • interactiveCli.startInteractiveUI (cognitive 20) packages/cli/src/interactiveCli.tsx:60 — interactiveCli.startInteractiveUI has cognitive complexity 20 (threshold 15). Drivers by points: error handling 6 (7 pts), if/else 7, boolean chains 5, ternaries 1 (nesting depth added 1). Of this number, 16 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · App.CodeView (cognitive 20) · ×1
  • App.CodeView (cognitive 20) packages/devtools/client/src/App.tsx:1829 — App.CodeView has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 6, ternaries 4 (5 pts), loops 1 (nesting depth added 3). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to 3 function items inside it that branch (handleKeyDown, a function literal at line 1919, a function literal at line 1835). 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.
D2 · Cognitive Complexity · sessionUtils.getAllSessionFiles (cognitive 19) · ×1
  • sessionUtils.getAllSessionFiles (cognitive 19) packages/cli/src/utils/sessionUtils.ts:243 — sessionUtils.getAllSessionFiles has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 6, ternaries 4, error handling 2 (nesting depth added 1). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 259, 252, 316). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · sessionCleanup.identifySessionsToDelete (cognitive 19) · ×1
  • sessionCleanup.identifySessionsToDelete (cognitive 19) packages/cli/src/utils/sessionCleanup.ts:302 — sessionCleanup.identifySessionsToDelete has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 1 (2 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · envVarResolver.resolveEnvVarsInObjectInternal (cognitive 19) · ×1
  • envVarResolver.resolveEnvVarsInObjectInternal (cognitive 19) packages/cli/src/utils/envVarResolver.ts:99 — envVarResolver.resolveEnvVarsInObjectInternal has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · commentJson.applyKeyDiff (cognitive 19) · ×1
  • commentJson.applyKeyDiff (cognitive 19) packages/cli/src/utils/commentJson.ts:176 — commentJson.applyKeyDiff has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionContext.areMetricsEqual (cognitive 19) · ×1
  • SessionContext.areMetricsEqual (cognitive 19) packages/cli/src/ui/contexts/SessionContext.tsx:89 — SessionContext.areMetricsEqual has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6, 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.
D2 · Cognitive Complexity · StatusRow.StatusNode (cognitive 19) · ×1
  • StatusRow.StatusNode (cognitive 19) packages/cli/src/ui/components/StatusRow.tsx:72 — StatusRow.StatusNode has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 6). Of this number, 10 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileCommandLoader.parseAndAdaptFile (cognitive 19) · ×1
  • FileCommandLoader.parseAndAdaptFile (cognitive 19) packages/cli/src/services/FileCommandLoader.ts:257 — FileCommandLoader.parseAndAdaptFile has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 2 (4 pts), error handling 3, boolean chains 2, loops 1 (nesting depth added 3). Of this number, 13 points are the body's own statements and 6 belong to 2 function literals inside it that branch. 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.
D2 · Cognitive Complexity · status.formatGemmaStatus (cognitive 19) · ×1
  • status.formatGemmaStatus (cognitive 19) packages/cli/src/commands/gemma/status.ts:62 — status.formatGemmaStatus has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (16 pts), ternaries 2 (3 pts) (nesting depth added 3). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
D2 · Cognitive Complexity · paths.isTrustedSystemPath (cognitive 19) · ×1
  • paths.isTrustedSystemPath (cognitive 19) packages/core/src/utils/paths.ts:614 — paths.isTrustedSystemPath has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 6 (9 pts) (nesting depth added 3). Of this number, 16 points are the body's own statements and 3 belong to 3 function literals inside it that branch. 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.
D2 · Cognitive Complexity · ShellExecutionService.background (cognitive 19) · ×1
  • ShellExecutionService.background (cognitive 19) packages/core/src/services/shellExecutionService.ts:1951 — ShellExecutionService.background has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 1, error handling 1, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ShellExecutionService.resizePty (cognitive 19) · ×1
  • ShellExecutionService.resizePty (cognitive 19) packages/core/src/services/shellExecutionService.ts:2064 — ShellExecutionService.resizePty has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, error handling 2 (3 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.
D2 · Cognitive Complexity · shellExecutionService.writeBufferToLogStream (cognitive 19) · ×1
  • shellExecutionService.writeBufferToLogStream (cognitive 19) packages/core/src/services/shellExecutionService.ts:331 — shellExecutionService.writeBufferToLogStream has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · grep-utils.formatGrepResults (cognitive 19) · ×1
  • grep-utils.formatGrepResults (cognitive 19) packages/core/src/tools/grep-utils.ts:139 — grep-utils.formatGrepResults has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8 (13 pts), if/else 4 (5 pts), loops 1 (nesting depth added 6). Of this number, 15 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · stable-stringify.stableStringify · ×1
  • stable-stringify.stableStringify::stringify (cognitive 19) packages/core/src/policy/stable-stringify.ts:60 — stable-stringify.stableStringify::stringify has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · markdownUtils.jsonToMarkdown (cognitive 19) · ×1
  • markdownUtils.jsonToMarkdown (cognitive 19) packages/core/src/utils/markdownUtils.ts:23 — markdownUtils.jsonToMarkdown has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 6). Of this number, 11 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fetch.safeLookup (cognitive 19) · ×1
  • fetch.safeLookup (cognitive 19) packages/core/src/utils/fetch.ts:57 — fetch.safeLookup has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, ternaries 2 (3 pts), loops 1 (nesting depth added 4). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 101, 131). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · bfsFileSearch.bfsFileSearch (cognitive 19) · ×1
  • bfsFileSearch.bfsFileSearch (cognitive 19) packages/core/src/utils/bfsFileSearch.ts:38 — bfsFileSearch.bfsFileSearch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (5 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 9). Of this number, 14 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memoryService.scanEligibleSessions (cognitive 19) · ×1
  • memoryService.scanEligibleSessions (cognitive 19) REDACTED:577 — memoryService.scanEligibleSessions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 3 (5 pts), boolean chains 2, loops 2, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memoryImportProcessor.processImports · ×1
  • memoryImportProcessor.processImports::processFlat (cognitive 19) packages/core/src/utils/memoryImportProcessor.ts:227 — memoryImportProcessor.processImports::processFlat has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 1 (4 pts), boolean chains 2, error handling 1 (2 pts), 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: one other method here (memoryImportProcessor.processImports) 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.
D2 · Cognitive Complexity · errorParsing.parseAndFormatApiError (cognitive 19) · ×1
  • errorParsing.parseAndFormatApiError (cognitive 19) packages/core/src/utils/errorParsing.ts:35 — errorParsing.parseAndFormatApiError has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 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.
D2 · Cognitive Complexity · sessionSummaryUtils.collectPathsFromValue (cognitive 19) · ×1
  • sessionSummaryUtils.collectPathsFromValue (cognitive 19) packages/core/src/services/sessionSummaryUtils.ts:138 — sessionSummaryUtils.collectPathsFromValue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WebFetchToolInvocation.executeExperimental (cognitive 19) · ×1
  • WebFetchToolInvocation.executeExperimental (cognitive 19) packages/core/src/tools/web-fetch.ts:596 — WebFetchToolInvocation.executeExperimental has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, error handling 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.
D2 · Cognitive Complexity · HookEventHandler.logHookExecution (cognitive 19) · ×1
  • HookEventHandler.logHookExecution (cognitive 19) packages/core/src/hooks/hookEventHandler.ts:390 — HookEventHandler.logHookExecution has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · semantic.getStringReferences (cognitive 19) · ×1
  • semantic.getStringReferences (cognitive 19) packages/core/src/telemetry/semantic.ts:34 — semantic.getStringReferences has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CheckerRunner.executeCheckerProcess (cognitive 19) · ×1
  • CheckerRunner.executeCheckerProcess (cognitive 19) packages/core/src/safety/checker-runner.ts:163 — CheckerRunner.executeCheckerProcess has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 3 (6 pts), error handling 2 (nesting depth added 4). None of this is in the body itself: all 19 points belong to 4 function literals inside it that branch (lines 168, 213, 255, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · PolicyEngine.constructor (cognitive 19) · ×1
  • PolicyEngine.constructor (cognitive 19) packages/core/src/policy/policy-engine.ts:255 — PolicyEngine.constructor has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 7, 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.
D2 · Cognitive Complexity · PolicyEngine.applyShellHeuristics (cognitive 19) · ×1
  • PolicyEngine.applyShellHeuristics (cognitive 19) packages/core/src/policy/policy-engine.ts:391 — PolicyEngine.applyShellHeuristics has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, ternaries 2, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ReadMcpResourceToolInvocation.execute (cognitive 19) · ×1
  • ReadMcpResourceToolInvocation.execute (cognitive 19) packages/core/src/tools/read-mcp-resource.ts:82 — ReadMcpResourceToolInvocation.execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (4 pts), boolean chains 3, loops 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Config.constructor (cognitive 19) · ×1
  • Config.constructor (cognitive 19) packages/core/src/config/config.ts:1004 — Config.constructor has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, boolean chains 5, error handling 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Config._initialize (cognitive 19) · ×1
  • Config._initialize (cognitive 19) packages/core/src/config/config.ts:1468 — Config._initialize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 2 (4 pts), ternaries 1 (3 pts), boolean chains 1, 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.
D2 · Cognitive Complexity · fileUtils.detectBOM (cognitive 19) · ×1
  • fileUtils.detectBOM (cognitive 19) packages/core/src/utils/fileUtils.ts:78 — fileUtils.detectBOM has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 6 (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.
D2 · Cognitive Complexity · chatRecordingService.computeContentDigest (cognitive 19) · ×1
  • chatRecordingService.computeContentDigest (cognitive 19) packages/core/src/services/chatRecordingService.ts:131 — chatRecordingService.computeContentDigest has cognitive complexity 19 (threshold 15). Drivers by points: loops 5 (9 pts), if/else 7, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 5). None of this is in the body itself: all 19 points belong to 2 function items inside it that branch (visit, mixString). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · chatRecordingService.parseLegacyContentFallback (cognitive 19) · ×1
  • chatRecordingService.parseLegacyContentFallback (cognitive 19) packages/core/src/services/chatRecordingService.ts:1774 — chatRecordingService.parseLegacyContentFallback has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 7, error handling 1 (nesting depth added 6). Of this number, 17 points are the body's own statements and 2 belong to 3 function items inside it that branch. 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.
D2 · Cognitive Complexity · validateNonInterActiveAuth.validateNonInteractiveAuth (cognitive 19) · ×1
  • validateNonInterActiveAuth.validateNonInteractiveAuth (cognitive 19) packages/cli/src/validateNonInterActiveAuth.ts:20 — validateNonInterActiveAuth.validateNonInteractiveAuth has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (8 pts), boolean chains 2, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gemini.setupUnhandledRejectionHandler · ×1
  • gemini.setupUnhandledRejectionHandler::geminiUncaughtExceptionListener (cognitive 19) packages/cli/src/gemini.tsx:228 — gemini.setupUnhandledRejectionHandler::geminiUncaughtExceptionListener has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (8 pts), error handling 1 (2 pts), ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · compile-windows-sandbox.compileWindowsSandbox (cognitive 19) · ×1
  • compile-windows-sandbox.compileWindowsSandbox (cognitive 19) packages/core/scripts/compile-windows-sandbox.js:22 — compile-windows-sandbox.compileWindowsSandbox has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 1, loops 1 (nesting depth added 6). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · package_skill.main (cognitive 19) · ×1
  • package_skill.main (cognitive 19) packages/core/src/skills/builtin/skill-creator/scripts/package_skill.cjs:20 — package_skill.main has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, error handling 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · GeminiCliSession.initialize (cognitive 19) · ×1
  • GeminiCliSession.initialize (cognitive 19) packages/sdk/src/session.ts:112 — GeminiCliSession.initialize has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 1 (2 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 6). Of this number, 10 points are the body's own statements and 9 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · extension.activate (cognitive 19) · ×1
  • extension.activate (cognitive 19) packages/vscode-ide-companion/src/extension.ts:113 — extension.activate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, ternaries 2 (3 pts), error handling 1 (nesting depth added 2). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 199, 144, 152, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · updateCheck.checkForUpdates (cognitive 18) · ×1
  • updateCheck.checkForUpdates (cognitive 18) packages/cli/src/ui/utils/updateCheck.ts:56 — updateCheck.checkForUpdates has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, error handling 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.
D2 · Cognitive Complexity · SubagentProgressDisplay.formatToolArgs (cognitive 18) · ×1
  • SubagentProgressDisplay.formatToolArgs (cognitive 18) packages/cli/src/ui/components/messages/SubagentProgressDisplay.tsx:27 — SubagentProgressDisplay.formatToolArgs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 8, error handling 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.
D2 · Cognitive Complexity · github_fetch.fetchJson (cognitive 18) · ×1
  • github_fetch.fetchJson (cognitive 18) packages/cli/src/config/extensions/github_fetch.ts:63 — github_fetch.fetchJson has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), error handling 2 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 112, 173, 87, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ExtensionManager.toOutputString (cognitive 18) · ×1
  • ExtensionManager.toOutputString (cognitive 18) packages/cli/src/config/extension-manager.ts:1174 — ExtensionManager.toOutputString has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, ternaries 1 (nesting depth added 5). Of this number, 13 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AskUserDialog.choiceQuestionReducer (cognitive 18) · ×1
  • AskUserDialog.choiceQuestionReducer (cognitive 18) packages/cli/src/ui/components/AskUserDialog.tsx:437 — AskUserDialog.choiceQuestionReducer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (6 pts), loops 1 (3 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · injectionParser.extractInjections (cognitive 18) · ×1
  • injectionParser.extractInjections (cognitive 18) packages/cli/src/services/prompt-processors/injectionParser.ts:31 — injectionParser.extractInjections has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · skillUtils.installSkill (cognitive 18) · ×1
  • skillUtils.installSkill (cognitive 18) packages/cli/src/utils/skillUtils.ts:93 — skillUtils.installSkill has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 2 (3 pts), boolean chains 1, loops 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.
D2 · Cognitive Complexity · useAgentStream.useAgentStream (cognitive 18) · ×1
  • useAgentStream.useAgentStream (cognitive 18) packages/cli/src/ui/hooks/useAgentStream.ts:114 — useAgentStream.useAgentStream has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 3). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 618, 596, 539, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useIncludeDirsTrust.useIncludeDirsTrust (cognitive 18) · ×1
  • useIncludeDirsTrust.useIncludeDirsTrust (cognitive 18) packages/cli/src/ui/hooks/useIncludeDirsTrust.tsx:54 — useIncludeDirsTrust.useIncludeDirsTrust has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4, loops 1 (nesting depth added 2). None of this is in the body itself: all 18 points belong to one function literal inside it that branches (line 62). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · shell-utils.hasPromptCommandTransform (cognitive 18) · ×1
  • shell-utils.hasPromptCommandTransform (cognitive 18) packages/core/src/utils/shell-utils.ts:476 — shell-utils.hasPromptCommandTransform has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · shell-utils.splitShellCommandSegments (cognitive 18) · ×1
  • shell-utils.splitShellCommandSegments (cognitive 18) packages/core/src/utils/shell-utils.ts:2301 — shell-utils.splitShellCommandSegments has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 5, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProjectRegistry.ensureOwnershipMarkers (cognitive 18) · ×1
  • ProjectRegistry.ensureOwnershipMarkers (cognitive 18) packages/core/src/config/projectRegistry.ts:372 — ProjectRegistry.ensureOwnershipMarkers has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · process-utils.getProcessTableWindows (cognitive 18) · ×1
  • process-utils.getProcessTableWindows (cognitive 18) packages/core/src/ide/process-utils.ts:38 — process-utils.getProcessTableWindows has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 2 (3 pts), boolean chains 2, error handling 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ignorePathUtils.expandWildcardDirectoryPatterns (cognitive 18) · ×1
  • ignorePathUtils.expandWildcardDirectoryPatterns (cognitive 18) packages/core/src/utils/ignorePathUtils.ts:128 — ignorePathUtils.expandWildcardDirectoryPatterns has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, loops 2, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gitUtils.getSafeGitEnv (cognitive 18) · ×1
  • gitUtils.getSafeGitEnv (cognitive 18) packages/core/src/utils/gitUtils.ts:11 — gitUtils.getSafeGitEnv has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (5 pts), ternaries 5, 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.
D2 · Cognitive Complexity · retry.isRetryableError (cognitive 18) · ×1
  • retry.isRetryableError (cognitive 18) packages/core/src/utils/retry.ts:191 — retry.isRetryableError has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6 (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.
D2 · Cognitive Complexity · historyHardening.scrubPart (cognitive 18) · ×1
  • historyHardening.scrubPart (cognitive 18) packages/core/src/utils/historyHardening.ts:590 — historyHardening.scrubPart has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (14 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.
D2 · Cognitive Complexity · StaticTokenCalculator.calculateTokenBreakdown (cognitive 18) · ×1
  • StaticTokenCalculator.calculateTokenBreakdown (cognitive 18) packages/core/src/context/utils/contextTokenCalculator.ts:117 — StaticTokenCalculator.calculateTokenBreakdown has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · toolMaskingProcessor.createToolMaskingProcessor.process · ×1
  • toolMaskingProcessor.createToolMaskingProcessor.process::maskAsync (cognitive 18) packages/core/src/context/processors/toolMaskingProcessor.ts:160 — toolMaskingProcessor.createToolMaskingProcessor.process::maskAsync has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (toolMaskingProcessor.createToolMaskingProcessor.process) 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.
D2 · Cognitive Complexity · diff-utils.getDiffContextSnippet (cognitive 18) · ×1
  • diff-utils.getDiffContextSnippet (cognitive 18) packages/core/src/tools/diff-utils.ts:12 — diff-utils.getDiffContextSnippet has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 3 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EditToolInvocation.constructor (cognitive 18) · ×1
  • EditToolInvocation.constructor (cognitive 18) REDACTED:469 — EditToolInvocation.constructor has cognitive complexity 18 (threshold 15). Drivers by points: error handling 4 (10 pts), if/else 5 (6 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · snapshotSuperseder.supersedeStaleSnapshots (cognitive 18) · ×1
  • snapshotSuperseder.supersedeStaleSnapshots (cognitive 18) packages/core/src/agents/browser/snapshotSuperseder.ts:41 — snapshotSuperseder.supersedeStaleSnapshots has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (4 pts), boolean chains 1, ternaries 1 (nesting depth added 6). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · McpToolInvocation.execute (cognitive 18) · ×1
  • McpToolInvocation.execute (cognitive 18) packages/core/src/agents/browser/mcpToolWrapper.ts:121 — McpToolInvocation.execute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, ternaries 1 (2 pts), error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tool-utils.truncateFunctionResponsePart · ×1
  • tool-utils.truncateFunctionResponsePart::truncateValue (cognitive 18) packages/core/src/utils/tool-utils.ts:247 — tool-utils.truncateFunctionResponsePart::truncateValue has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · toml-loader.validateMcpPolicyToolNames (cognitive 18) · ×1
  • toml-loader.validateMcpPolicyToolNames (cognitive 18) packages/core/src/policy/toml-loader.ts:704 — toml-loader.validateMcpPolicyToolNames has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 1 (2 pts), boolean chains 1, 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.
D2 · Cognitive Complexity · McpClient.refreshResources (cognitive 18) · ×1
  • McpClient.refreshResources (cognitive 18) packages/core/src/tools/mcp-client.ts:501 — McpClient.refreshResources has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, error handling 2 (3 pts), loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · acpUtils.toPermissionOptions (cognitive 18) · ×1
  • acpUtils.toPermissionOptions (cognitive 18) packages/cli/src/acp/acpUtils.ts:139 — acpUtils.toPermissionOptions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · App.highlightLine (cognitive 18) · ×1
  • App.highlightLine (cognitive 18) packages/devtools/client/src/App.tsx:1700 — App.highlightLine has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 1 (3 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sessionCleanup.validateRetentionConfig (cognitive 17) · ×1
  • sessionCleanup.validateRetentionConfig (cognitive 17) packages/cli/src/utils/sessionCleanup.ts:414 — sessionCleanup.validateRetentionConfig has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 2 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings-validation.buildPrimitiveSchema (cognitive 17) · ×1
  • settings-validation.buildPrimitiveSchema (cognitive 17) packages/cli/src/config/settings-validation.ts:129 — settings-validation.buildPrimitiveSchema has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), ternaries 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 9). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 148, 139). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ThemeManager.parseUserThemeEntries (cognitive 17) · ×1
  • ThemeManager.parseUserThemeEntries (cognitive 17) packages/cli/src/ui/themes/theme-manager.ts:253 — ThemeManager.parseUserThemeEntries has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 5). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ShellToolMessage.ShellToolMessage (cognitive 17) · ×1
  • ShellToolMessage.ShellToolMessage (cognitive 17) packages/cli/src/ui/components/messages/ShellToolMessage.tsx:44 — ShellToolMessage.ShellToolMessage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, error handling 1 (2 pts) (nesting depth added 4). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 100, a function literal at line 129, handleFocus). 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.
D2 · Cognitive Complexity · TopicMessage.TopicMessage (cognitive 17) · ×1
  • TopicMessage.TopicMessage (cognitive 17) packages/cli/src/ui/components/messages/TopicMessage.tsx:32 — TopicMessage.TopicMessage has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 11, if/else 3, ternaries 3. Of this number, 11 points are the body's own statements and 6 belong to 2 function literals inside it that branch. 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.
D2 · Cognitive Complexity · ColorsDisplay.ColorsDisplay · ×1
  • ColorsDisplay.ColorsDisplay::flattenColors (cognitive 17) packages/cli/src/ui/components/ColorsDisplay.tsx:100 — ColorsDisplay.ColorsDisplay::flattenColors has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useVoiceMode.useVoiceMode.startVoiceRecording · ×1
  • useVoiceMode.useVoiceMode.startVoiceRecording::startAsync (cognitive 17) packages/cli/src/ui/hooks/useVoiceMode.ts:131 — useVoiceMode.useVoiceMode.startVoiceRecording::startAsync has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 1 (2 pts), boolean chains 1, error handling 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.
D2 · Cognitive Complexity · extensionsCommand.configAction (cognitive 17) · ×1
  • extensionsCommand.configAction (cognitive 17) packages/cli/src/ui/commands/extensionsCommand.ts:673 — extensionsCommand.configAction has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BuiltinCommandLoader.loadCommands (cognitive 17) · ×1
  • BuiltinCommandLoader.loadCommands (cognitive 17) packages/cli/src/services/BuiltinCommandLoader.ts:83 — BuiltinCommandLoader.loadCommands has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 13 (14 pts), if/else 3 (nesting depth added 1). Of this number, 13 points are the body's own statements and 4 belong to 2 function items inside it that branch. 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.
D2 · Cognitive Complexity · useGeminiStream.useGeminiStream.pendingToolGroupItems (cognitive 17) · ×1
  • useGeminiStream.useGeminiStream.pendingToolGroupItems (cognitive 17) packages/cli/src/ui/hooks/useGeminiStream.ts:610 — useGeminiStream.useGeminiStream.pendingToolGroupItems has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, loops 1 (nesting depth added 4). Of this number, 15 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · useGeminiStream.useGeminiStream.processGeminiStreamEvents (cognitive 17) · ×1
  • useGeminiStream.useGeminiStream.processGeminiStreamEvents (cognitive 17) packages/cli/src/ui/hooks/useGeminiStream.ts:1667 — useGeminiStream.useGeminiStream.processGeminiStreamEvents has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · vim.useVim.handleInsertModeInput (cognitive 17) · ×1
  • vim.useVim.handleInsertModeInput (cognitive 17) packages/cli/src/ui/hooks/vim.ts:473 — vim.useVim.handleInsertModeInput has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (8 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · useRunEventNotifications.useRunEventNotifications (cognitive 17) · ×1
  • useRunEventNotifications.useRunEventNotifications (cognitive 17) packages/cli/src/ui/hooks/useRunEventNotifications.ts:39 — useRunEventNotifications.useRunEventNotifications has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 6, ternaries 1. None of this is in the body itself: all 17 points belong to 2 function literals inside it that branch (lines 81, 140). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · shell-utils.findPowerShellExprValueStart (cognitive 17) · ×1
  • shell-utils.findPowerShellExprValueStart (cognitive 17) packages/core/src/utils/shell-utils.ts:1881 — shell-utils.findPowerShellExprValueStart has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sandboxManager.resolveSandboxPaths (cognitive 17) · ×1
  • sandboxManager.resolveSandboxPaths (cognitive 17) packages/core/src/services/sandboxManager.ts:371 — sandboxManager.resolveSandboxPaths has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, ternaries 2, error handling 1 (nesting depth added 6). Of this number, 12 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MCPOAuthProvider.discoverAuthServerMetadataForRegistration (cognitive 17) · ×1
  • MCPOAuthProvider.discoverAuthServerMetadataForRegistration (cognitive 17) packages/core/src/mcp/oauth-provider.ts:166 — MCPOAuthProvider.discoverAuthServerMetadataForRegistration has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (3 pts), loops 2, 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.
D2 · Cognitive Complexity · ignorePathUtils.getNormalizedRelativePath (cognitive 17) · ×1
  • ignorePathUtils.getNormalizedRelativePath (cognitive 17) packages/core/src/utils/ignorePathUtils.ts:16 — ignorePathUtils.getNormalizedRelativePath has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 4, ternaries 2 (3 pts), error handling 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.
D2 · Cognitive Complexity · getFolderStructure.formatStructure (cognitive 17) · ×1
  • getFolderStructure.formatStructure (cognitive 17) packages/core/src/utils/getFolderStructure.ts:233 — getFolderStructure.formatStructure has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (8 pts), boolean chains 4, if/else 3, loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClearcutLogger.logToolCallEvent (cognitive 17) · ×1
  • ClearcutLogger.logToolCallEvent (cognitive 17) packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts:756 — ClearcutLogger.logToolCallEvent has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelConfigService.resolveAliasChain (cognitive 17) · ×1
  • ModelConfigService.resolveAliasChain (cognitive 17) packages/core/src/services/modelConfigService.ts:450 — ModelConfigService.resolveAliasChain has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · geminiChat.isValidContent (cognitive 17) · ×1
  • geminiChat.isValidContent (cognitive 17) packages/core/src/core/geminiChat.ts:177 — geminiChat.isValidContent has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (6 pts), loops 1 (nesting depth added 2). Of this number, 16 points are the body's own statements and 1 belongs to 3 function literals inside it that branch. 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.
D2 · Cognitive Complexity · chatCompressionService.collapseOlderFunctionResponses (cognitive 17) · ×1
  • chatCompressionService.collapseOlderFunctionResponses (cognitive 17) packages/core/src/context/chatCompressionService.ts:177 — chatCompressionService.collapseOlderFunctionResponses has cognitive complexity 17 (threshold 15). Drivers by points: if/else 22 (33 pts), boolean chains 8, loops 4 (5 pts), ternaries 3 (5 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (chatCompressionService.collapseOlderFunctionResponses::collapseValue) 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.
D2 · Cognitive Complexity · write-file.getCorrectedFileContent (cognitive 17) · ×1
  • write-file.getCorrectedFileContent (cognitive 17) packages/core/src/tools/write-file.ts:116 — write-file.getCorrectedFileContent has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (7 pts), error handling 3 (5 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · a2a-errors.collectErrorMessages (cognitive 17) · ×1
  • a2a-errors.collectErrorMessages (cognitive 17) packages/core/src/agents/a2a-errors.ts:122 — a2a-errors.collectErrorMessages has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 1, 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.
D2 · Cognitive Complexity · value-resolver.resolveAuthValue (cognitive 17) · ×1
  • value-resolver.resolveAuthValue (cognitive 17) packages/core/src/agents/auth-provider/value-resolver.ts:26 — value-resolver.resolveAuthValue has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RemoteAgentInvocation.execute (cognitive 17) · ×1
  • RemoteAgentInvocation.execute (cognitive 17) packages/core/src/agents/remote-invocation.ts:130 — RemoteAgentInvocation.execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 1 (2 pts), error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalAgentExecutor.create (cognitive 17) · ×1
  • LocalAgentExecutor.create (cognitive 17) packages/core/src/agents/local-executor.ts:172 — LocalAgentExecutor.create has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (22 pts), loops 6 (15 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (LocalAgentExecutor.create::registerToolByName) 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.
D2 · Cognitive Complexity · usageAggregator.listJsonlRecordingFiles (cognitive 17) · ×1
  • usageAggregator.listJsonlRecordingFiles (cognitive 17) packages/core/src/services/usageAggregator.ts:268 — usageAggregator.listJsonlRecordingFiles has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), error handling 2 (4 pts), loops 2 (4 pts), boolean chains 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.
D2 · Cognitive Complexity · SessionSummaryService.generateSummary (cognitive 17) · ×1
  • SessionSummaryService.generateSummary (cognitive 17) packages/core/src/services/sessionSummaryService.ts:55 — SessionSummaryService.generateSummary has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (5 pts), boolean chains 3, error handling 1 (nesting depth added 3). Of this number, 13 points are the body's own statements and 4 belong to 2 function literals inside it that branch. 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.
D2 · Cognitive Complexity · ReadFileToolInvocation.execute (cognitive 17) · ×1
  • ReadFileToolInvocation.execute (cognitive 17) packages/core/src/tools/read-file.ts:125 — ReadFileToolInvocation.execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 4, ternaries 3 (4 pts), error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
D2 · Cognitive Complexity · WebFetchToolInvocation.execute (cognitive 17) · ×1
  • WebFetchToolInvocation.execute (cognitive 17) packages/core/src/tools/web-fetch.ts:772 — WebFetchToolInvocation.execute has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts), error handling 1 (nesting depth added 1). Of this number, 12 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
D2 · Cognitive Complexity · TrustedHooksManager.trustHooks (cognitive 17) · ×1
  • TrustedHooksManager.trustHooks (cognitive 17) packages/core/src/hooks/trustedHooks.ts:99 — TrustedHooksManager.trustHooks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageBus.publish (cognitive 17) · ×1
  • MessageBus.publish (cognitive 17) packages/core/src/confirmation-bus/message-bus.ts:100 — MessageBus.publish has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LLMJudge.judgeYesNo (cognitive 17) · ×1
  • LLMJudge.judgeYesNo (cognitive 17) evals/llm-judge.ts:37 — LLMJudge.judgeYesNo has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 3). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Task.handleEventDrivenToolCall (cognitive 17) · ×1
  • Task.handleEventDrivenToolCall (cognitive 17) packages/a2a-server/src/agent/task.ts:498 — Task.handleEventDrivenToolCall has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · formatError.formatCliError (cognitive 17) · ×1
  • formatError.formatCliError (cognitive 17) packages/cli/src/utils/formatError.ts:74 — formatError.formatCliError has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (6 pts), ternaries 2 (6 pts), boolean chains 5 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · validate_skill.validateSkill (cognitive 17) · ×1
  • validate_skill.validateSkill (cognitive 17) REDACTED:15 — validate_skill.validateSkill has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 2 (3 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · App.ConsoleLogEntry (cognitive 17) · ×1
  • App.ConsoleLogEntry (cognitive 17) packages/devtools/client/src/App.tsx:610 — App.ConsoleLogEntry has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (9 pts), boolean chains 4, if/else 3 (4 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.
D2 · Cognitive Complexity · App.NetworkView · ×1
  • App.NetworkView::renderLogItem (cognitive 17) packages/devtools/client/src/App.tsx:931 — App.NetworkView::renderLogItem has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 3, error handling 1 (2 pts), if/else 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.
D2 · Cognitive Complexity · settings-validation.buildZodSchemaFromDefinition (cognitive 16) · ×1
  • settings-validation.buildZodSchemaFromDefinition (cognitive 16) packages/cli/src/config/settings-validation.ts:171 — settings-validation.buildZodSchemaFromDefinition has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ThemeManager.loadCustomThemes (cognitive 16) · ×1
  • ThemeManager.loadCustomThemes (cognitive 16) packages/cli/src/ui/themes/theme-manager.ts:172 — ThemeManager.loadCustomThemes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · atCommandProcessor.checkPermissions (cognitive 16) · ×1
  • atCommandProcessor.checkPermissions (cognitive 16) packages/cli/src/ui/hooks/atCommandProcessor.ts:182 — atCommandProcessor.checkPermissions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 2 (5 pts), 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.
D2 · Cognitive Complexity · mouse.parseX11MouseEvent (cognitive 16) · ×1
  • mouse.parseX11MouseEvent (cognitive 16) REDACTED:131 — mouse.parseX11MouseEvent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), match/switch 2 (5 pts), boolean chains 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.
D2 · Cognitive Complexity · text-buffer.findNextWordStartInLine (cognitive 16) · ×1
  • text-buffer.findNextWordStartInLine (cognitive 16) packages/cli/src/ui/components/shared/text-buffer.ts:96 — text-buffer.findNextWordStartInLine has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), loops 3 (5 pts), boolean chains 4, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · text-buffer.findPrevWordStartInLine (cognitive 16) · ×1
  • text-buffer.findPrevWordStartInLine (cognitive 16) packages/cli/src/ui/components/shared/text-buffer.ts:140 — text-buffer.findPrevWordStartInLine has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 3 (5 pts), boolean chains 4 (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.
D2 · Cognitive Complexity · useSelectionList.useSelectionList (cognitive 16) · ×1
  • useSelectionList.useSelectionList (cognitive 16) packages/cli/src/ui/hooks/useSelectionList.ts:284 — useSelectionList.useSelectionList has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6 (nesting depth added 1). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 354, 316, 334, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · useBanner.useBanner (cognitive 16) · ×1
  • useBanner.useBanner (cognitive 16) packages/cli/src/ui/hooks/useBanner.ts:30 — useBanner.useBanner has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (6 pts), ternaries 2 (nesting depth added 2). Of this number, 9 points are the body's own statements and 7 belong to 2 function literals inside it that branch. 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.
D2 · Cognitive Complexity · AppHeader.AppHeader (cognitive 16) · ×1
  • AppHeader.AppHeader (cognitive 16) packages/cli/src/ui/components/AppHeader.tsx:59 — AppHeader.AppHeader has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 2 (3 pts), ternaries 2 (nesting depth added 1). Of this number, 11 points are the body's own statements and 5 belong to 2 function items inside it that branch. 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.
D2 · Cognitive Complexity · ToolConfirmationQueue.ToolConfirmationQueue (cognitive 16) · ×1
  • ToolConfirmationQueue.ToolConfirmationQueue (cognitive 16) packages/cli/src/ui/components/ToolConfirmationQueue.tsx:52 — ToolConfirmationQueue.ToolConfirmationQueue has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, ternaries 5 (6 pts), if/else 2 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · EditorSettingsDialog.EditorSettingsDialog (cognitive 16) · ×1
  • EditorSettingsDialog.EditorSettingsDialog (cognitive 16) packages/cli/src/ui/components/EditorSettingsDialog.tsx:38 — EditorSettingsDialog.EditorSettingsDialog has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, ternaries 6 (7 pts), boolean chains 2 (nesting depth added 1). Of this number, 9 points are the body's own statements and 7 belong to 4 function items inside it that branch. 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.
D2 · Cognitive Complexity · ToastDisplay.ToastDisplay (cognitive 16) · ×1
  • ToastDisplay.ToastDisplay (cognitive 16) packages/cli/src/ui/components/ToastDisplay.tsx:29 — ToastDisplay.ToastDisplay has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · useSlashCompletion.useCommandParser (cognitive 16) · ×1
  • useSlashCompletion.useCommandParser (cognitive 16) packages/cli/src/ui/hooks/useSlashCompletion.ts:60 — useSlashCompletion.useCommandParser has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 5, loops 1 (nesting depth added 4). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 64). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ConfigInitDisplay.ConfigInitDisplay (cognitive 16) · ×1
  • ConfigInitDisplay.ConfigInitDisplay (cognitive 16) packages/cli/src/ui/components/ConfigInitDisplay.tsx:18 — ConfigInitDisplay.ConfigInitDisplay has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 3 (6 pts), boolean chains 3, loops 1 (nesting depth added 4). None of this is in the body itself: all 16 points belong to one function literal inside it that branches (line 26). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ExtensionRegistryView.ExtensionRegistryView (cognitive 16) · ×1
  • ExtensionRegistryView.ExtensionRegistryView (cognitive 16) packages/cli/src/ui/components/views/ExtensionRegistryView.tsx:44 — ExtensionRegistryView.ExtensionRegistryView has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (8 pts), boolean chains 6, if/else 2 (nesting depth added 1). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 139, 72, 205). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · rewindFileOps.calculateTurnStats (cognitive 16) · ×1
  • rewindFileOps.calculateTurnStats (cognitive 16) packages/cli/src/ui/utils/rewindFileOps.ts:73 — rewindFileOps.calculateTurnStats has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · restoreCommand.restoreAction (cognitive 16) · ×1
  • restoreCommand.restoreAction (cognitive 16) packages/cli/src/ui/commands/restoreCommand.ts:39 — restoreCommand.restoreAction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 1, error handling 1, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · skillsCommand.reloadAction (cognitive 16) · ×1
  • skillsCommand.reloadAction (cognitive 16) packages/cli/src/ui/commands/skillsCommand.ts:247 — skillsCommand.reloadAction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (6 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · terminalSetup.detectTerminal (cognitive 16) · ×1
  • terminalSetup.detectTerminal (cognitive 16) packages/cli/src/ui/utils/terminalSetup.ts:147 — terminalSetup.detectTerminal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, error handling 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.
D2 · Cognitive Complexity · ActivityLogger.sanitizeNetworkLog (cognitive 16) · ×1
  • ActivityLogger.sanitizeNetworkLog (cognitive 16) REDACTED:224 — ActivityLogger.sanitizeNetworkLog has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 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.
D2 · Cognitive Complexity · environmentSanitization.shouldRedactEnvironmentVariable (cognitive 16) · ×1
  • environmentSanitization.shouldRedactEnvironmentVariable (cognitive 16) packages/core/src/services/environmentSanitization.ts:143 — environmentSanitization.shouldRedactEnvironmentVariable has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 2 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ProjectRegistry.save (cognitive 16) · ×1
  • ProjectRegistry.save (cognitive 16) packages/core/src/config/projectRegistry.ts:103 — ProjectRegistry.save has cognitive complexity 16 (threshold 15). Drivers by points: error handling 3 (5 pts), if/else 3 (5 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Cell.update (cognitive 16) · ×1
  • Cell.update (cognitive 16) packages/core/src/utils/terminalSerializer.ts:59 — Cell.update has cognitive complexity 16 (threshold 15). Drivers by points: if/else 16. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ExecutionLifecycleService.settleExecution (cognitive 16) · ×1
  • ExecutionLifecycleService.settleExecution (cognitive 16) packages/core/src/services/executionLifecycleService.ts:409 — ExecutionLifecycleService.settleExecution has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (4 pts), ternaries 2 (4 pts), boolean chains 3, error handling 1 (3 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ShellExecutionService.executeWithPty · ×1
  • ShellExecutionService.executeWithPty::renderFn (cognitive 16) packages/core/src/services/shellExecutionService.ts:1450 — ShellExecutionService.executeWithPty::renderFn has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 1 (2 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ShellExecutionService.executeWithPty) 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.
D2 · Cognitive Complexity · IdeContextStore.set (cognitive 16) · ×1
  • IdeContextStore.set (cognitive 16) packages/core/src/ide/ideContext.ts:58 — IdeContextStore.set has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2 (nesting depth added 6). Of this number, 13 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ToolRegistry.isActiveTool (cognitive 16) · ×1
  • ToolRegistry.isActiveTool (cognitive 16) packages/core/src/tools/tool-registry.ts:605 — ToolRegistry.isActiveTool has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModelConfigService.getAvailableModelOptions (cognitive 16) · ×1
  • ModelConfigService.getAvailableModelOptions (cognitive 16) packages/core/src/services/modelConfigService.ts:158 — ModelConfigService.getAvailableModelOptions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, boolean chains 5. None of this is in the body itself: all 16 points belong to 4 function literals inside it that branch (lines 197, 170, 176, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · LoopDetectionService.checkForLoopWithLLM (cognitive 16) · ×1
  • LoopDetectionService.checkForLoopWithLLM (cognitive 16) packages/core/src/services/loopDetectionService.ts:563 — LoopDetectionService.checkForLoopWithLLM has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 5, boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · chatCompressionService.collapseOlderFunctionResponses · ×1
  • chatCompressionService.collapseOlderFunctionResponses::collapseValue (cognitive 16) packages/core/src/context/chatCompressionService.ts:255 — chatCompressionService.collapseOlderFunctionResponses::collapseValue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (chatCompressionService.collapseOlderFunctionResponses) 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.
D2 · Cognitive Complexity · formatNodesForLlm.formatNodesForLlm (cognitive 16) · ×1
  • formatNodesForLlm.formatNodesForLlm (cognitive 16) packages/core/src/context/utils/formatNodesForLlm.ts:39 — formatNodesForLlm.formatNodesForLlm has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · security.isPathSecureSync (cognitive 16) · ×1
  • security.isPathSecureSync (cognitive 16) packages/core/src/utils/security.ts:503 — security.isPathSecureSync has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 3, boolean chains 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memoryPatchUtils.validateParsedSkillPatchHeaders (cognitive 16) · ×1
  • memoryPatchUtils.validateParsedSkillPatchHeaders (cognitive 16) packages/core/src/services/memoryPatchUtils.ts:139 — memoryPatchUtils.validateParsedSkillPatchHeaders has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memoryPatchUtils.validateInboxMemoryPatchFile (cognitive 16) · ×1
  • memoryPatchUtils.validateInboxMemoryPatchFile (cognitive 16) packages/core/src/services/memoryPatchUtils.ts:529 — memoryPatchUtils.validateInboxMemoryPatchFile has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 3 (4 pts), error handling 2, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agentLoader.authConfigSchema (cognitive 16) · ×1
  • agentLoader.authConfigSchema (cognitive 16) REDACTED:170 — agentLoader.authConfigSchema has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (16 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GoogleCredentialsAuthProvider.headers (cognitive 16) · ×1
  • GoogleCredentialsAuthProvider.headers (cognitive 16) packages/core/src/agents/auth-provider/google-credentials-provider.ts:83 — GoogleCredentialsAuthProvider.headers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 2 (5 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BrowserManager.checkNavigationRestrictions (cognitive 16) · ×1
  • BrowserManager.checkNavigationRestrictions (cognitive 16) REDACTED:907 — BrowserManager.checkNavigationRestrictions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 2 (3 pts), boolean chains 2, loops 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.
D2 · Cognitive Complexity · hook-utils.evaluateBeforeToolHook (cognitive 16) · ×1
  • hook-utils.evaluateBeforeToolHook (cognitive 16) packages/core/src/scheduler/hook-utils.ts:28 — hook-utils.evaluateBeforeToolHook has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 1 (4 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · atCommandUtils.tryExtractPath (cognitive 16) · ×1
  • atCommandUtils.tryExtractPath (cognitive 16) packages/core/src/utils/atCommandUtils.ts:184 — atCommandUtils.tryExtractPath has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · contentGenerator.createContentGeneratorConfig (cognitive 16) · ×1
  • contentGenerator.createContentGeneratorConfig (cognitive 16) packages/core/src/core/contentGenerator.ts:141 — contentGenerator.createContentGeneratorConfig has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 5. Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
D2 · Cognitive Complexity · ReadBackgroundOutputInvocation.execute (cognitive 16) · ×1
  • ReadBackgroundOutputInvocation.execute (cognitive 16) packages/core/src/tools/shellBackgroundTools.ts:133 — ReadBackgroundOutputInvocation.execute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 4, ternaries 2 (3 pts), error handling 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · chatRecordingService.createJsonlRecordAccumulator.finalize (cognitive 16) · ×1
  • chatRecordingService.createJsonlRecordAccumulator.finalize (cognitive 16) packages/core/src/services/chatRecordingService.ts:566 — chatRecordingService.createJsonlRecordAccumulator.finalize has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 4 (5 pts), ternaries 5 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · settings.resolveEnvVarsInObjectInternal (cognitive 16) · ×1
  • settings.resolveEnvVarsInObjectInternal (cognitive 16) packages/a2a-server/src/config/settings.ts:959 — settings.resolveEnvVarsInObjectInternal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 1 (2 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.
D2 · Cognitive Complexity · config.loadEnvironment (cognitive 16) · ×1
  • config.loadEnvironment (cognitive 16) packages/a2a-server/src/config/config.ts:571 — config.loadEnvironment has cognitive complexity 16 (threshold 15). Drivers by points: error handling 3 (7 pts), if/else 4 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · add.addMcpServer (cognitive 16) · ×1
  • add.addMcpServer (cognitive 16) packages/cli/src/commands/mcp/add.ts:17 — add.addMcpServer has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, match/switch 1, ternaries 1 (nesting depth added 2). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
D2 · Cognitive Complexity · sandbox.start_sandbox · ×1
  • sandbox.start_sandbox::cleanup (cognitive 16) packages/cli/src/utils/sandbox.ts:137 — sandbox.start_sandbox::cleanup has cognitive complexity 16 (threshold 15). Drivers by points: error handling 4 (8 pts), if/else 6 (8 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (sandbox.start_sandbox) 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.
D2 · Cognitive Complexity · EnumSelector.EnumSelector (cognitive 16) · ×1
  • EnumSelector.EnumSelector (cognitive 16) packages/cli/src/ui/components/shared/EnumSelector.tsx:23 — EnumSelector.EnumSelector has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7, boolean chains 6, if/else 3. Of this number, 10 points are the body's own statements and 6 belong to 2 function literals inside it that branch. 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.
D2 · Cognitive Complexity · GeminiCliSession.sendStream (cognitive 16) · ×1
  • GeminiCliSession.sendStream (cognitive 16) packages/sdk/src/session.ts:211 — GeminiCliSession.sendStream has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenFilesManager.constructor (cognitive 16) · ×1
  • OpenFilesManager.constructor (cognitive 16) packages/vscode-ide-companion/src/open-files-manager.ts:28 — OpenFilesManager.constructor has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, loops 2 (nesting depth added 4). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 63, 54, 30, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · github.handleEgressEvent (cognitive 16) · ×1
  • github.handleEgressEvent (cognitive 16) tools/caretaker-agent/cloudrun/egress-service/src/actions/github.ts:39 — github.handleEgressEvent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, loops 1 (2 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.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Medium vulnerability · ×1
  • REDACTED
D35 · Change Coupling · Change-coupling hub · ×1
  • Change-coupling hub: AppContainer.tsx → Composer.tsx, DialogManager.tsx, DefaultAppLayout.tsx, nonInteractiveUi.ts packages/cli/src/ui/AppContainer.tsx — `packages/cli/src/ui/AppContainer.tsx` changes together with 4 other files — `packages/cli/src/ui/components/Composer.tsx`, `packages/cli/src/ui/components/DialogManager.tsx`, `packages/cli/src/ui/layouts/DefaultAppLayout.tsx`, `packages/cli/src/ui/noninteractive/nonInteractiveUi.ts` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Edited copy of a member (58 corresponding lines) · ×1
  • Edited copy of a member (58 corresponding lines) tools/caretaker-agent/cloudrun/pr-generator/workflow/db/db_interface.py:184 — tools/caretaker-agent/cloudrun/pr-generator/workflow/db/db_interface.py:184-246 | tools/caretaker-agent/cloudrun/triage-worker/db/issues_store.py:57-114 — These two members are one piece of code written twice and then edited apart: 58 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport 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 · Duplicated block (13 lines × 2) · ×1
  • Duplicated block (13 lines × 2) tools/caretaker-agent/cloudrun/triage-worker/utils/egress.py:47 — tools/caretaker-agent/cloudrun/triage-worker/utils/egress.py:47-59 | tools/caretaker-agent/cloudrun/triage-worker/utils/events.py:42-54 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D44 · Platform End-of-Life · End-of-life runtime · ×1
  • End-of-life runtime: Node.js 20 .nvmrc:1 — .nvmrc declares Node.js 20 as this project's version file, and Node.js 20, support ended 2026-04-30. An unsupported runtime receives no security patches, so every vulnerability disclosed in it since 2026-04-30 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.
D5 · Coupling · Off the main sequence · ×1
  • Off the main sequence: @google/gemini-cli-core — @google/gemini-cli-core: abstractness 0.12, instability 0.00, distance 0.88 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
P12 · CI test-gate honesty · Test failure does not fail the CI gate · ×1
  • Test failure does not fail the CI gate .github/workflows/ci.yml:248 — `continue-on-error: true` lets the step or job that runs `npm run test:ci --workspace "@google/gemini-cli" -- --coverage.enabled=false` fail without failing the pipeline — the suite can go red and the change still merges. Remove it from the test step, or quarantine the specific failing tests instead.
P12 · CI test-gate honesty · Runner config excludes tests no gate runs · ×1
  • Runner config excludes tests no gate runs packages/vscode-ide-companion/vitest.config.ts:14 — `**integration-tests/**` removes 1 test(s) in 1 file(s) (e.g. `packages/vscode-ide-companion/src/integration-tests/focus.test.ts`) from what vitest collects, and no other runner or CI command runs them — they are dead tests. Run them (another runner, project or job), or delete them.
R10 · Code Duplication · Duplication concentrated across 4 sibling directories (33 clone groups) · ×1
  • Duplication concentrated across 4 sibling directories (33 clone groups) packages/a2a-server/src/commands/restore.ts:66 — 33 duplicated blocks under packages/ have copies in at least two of the sibling directories a2a-server, cli, core, devtools — 24 of them are reported below, and 9 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 33 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 33 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 33 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 20 sibling directories (27 clone groups) · ×1
  • Duplication concentrated across 20 sibling directories (27 clone groups) packages/core/src/context/chatCompressionService.ts:240 — 27 duplicated blocks under packages/core/src/ have copies in at least two of the sibling directories agent, agents, code_assist, commands, config, context (+14 more sibling(s) not listed) — 16 of them are reported below, and 11 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 27 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 27 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 27 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 7 sibling directories (16 clone groups) · ×1
  • Duplication concentrated across 7 sibling directories (16 clone groups) packages/cli/src/ui/hooks/useExtensionUpdates.ts:176 — 16 duplicated blocks under packages/cli/src/ have copies in at least two of the sibling directories acp, commands, config, core, services, ui (+1 more sibling(s) not listed) — 10 of them are reported below, and 6 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 16 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 16 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 16 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 5 sibling directories (15 clone groups) · ×1
  • Duplication concentrated across 5 sibling directories (15 clone groups) packages/cli/src/ui/auth/ApiAuthDialog.tsx:94 — 15 duplicated blocks under packages/cli/src/ui/ have copies in at least two of the sibling directories auth, commands, components, hooks, privacy — 5 of them are reported below, and 10 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 15 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 15 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 15 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 3 sibling directories (6 clone groups) · ×1
  • Duplication concentrated across 3 sibling directories (6 clone groups) packages/core/src/code_assist/experiments/client_metadata.ts:19 — 6 duplicated blocks under the repository root have copies in at least two of the sibling directories evals, packages, scripts — 1 of them are reported below, and 5 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 6 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 6 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 6 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Wholesale file copy (285 identical lines × 2 files) · ×1
  • Wholesale file copy (285 identical lines × 2 files) packages/core/src/tools/definitions/model-family-sets/default-legacy.ts:12 — packages/core/src/tools/definitions/model-family-sets/default-legacy.ts:12 · packages/core/src/tools/definitions/model-family-sets/gemini-3.ts:12 — these 2 files are line-for-line copies of one another — 285 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block with local edits (248 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (248 matched lines × 2 locations) REDACTED:153 — REDACTED:153 · REDACTED:189 — the two spans are one implementation copied and then locally edited — 1149 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (228 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (228 matched lines × 2 locations) packages/core/src/agents/local-invocation.ts:71 — packages/core/src/agents/local-invocation.ts:71 · packages/core/src/agents/local-session-invocation.ts:82 — the two spans are one implementation copied and then locally edited — 1241 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (199 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (199 matched lines × 2 locations) packages/core/src/prompts/snippets.legacy.ts:32 — packages/core/src/prompts/snippets.legacy.ts:32 · packages/core/src/prompts/snippets.ts:43 — the two spans are one implementation copied and then locally edited — 995 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (194 lines × 2 locations) · ×1
  • Duplicated block (194 lines × 2 locations) packages/cli/src/nonInteractiveCli.ts:90 — packages/cli/src/nonInteractiveCli.ts:90 · packages/cli/src/nonInteractiveCliAgentSession.ts:89 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block with local edits (130 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (130 matched lines × 2 locations) packages/cli/src/ui/components/triage/TriageDuplicates.tsx:25 — packages/cli/src/ui/components/triage/TriageDuplicates.tsx:25 · packages/cli/src/ui/components/triage/TriageIssues.tsx:25 — the two spans are one implementation copied and then locally edited — 710 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (110 lines × 2 locations) · ×1
  • Duplicated block (110 lines × 2 locations) evals/tool_output_masking.eval.ts:36 — evals/tool_output_masking.eval.ts:36 · evals/tool_output_masking.eval.ts:174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication · Duplicated block (71 lines × 2 locations) · ×1
  • Duplicated block (71 lines × 2 locations) packages/cli/src/ui/components/shared/text-buffer.ts:3731 — packages/cli/src/ui/components/shared/text-buffer.ts:3731 · packages/cli/src/ui/components/shared/text-buffer.ts:3837 — all 2 copies are in the same file, and what repeats is a LIST OF ENTRIES rather than behaviour — the same entries written out more than once. Extract them into one shared, exported constant and spread that constant into each site, rather than into a function the sites call: a list like this often lives in declarative metadata (a decorator's options object, a static configuration table) that a build step must be able to read statically, where a function call is not allowed. Adding an entry to one copy and not the other is the failure this prevents.
R10 · Code Duplication · Duplicated block with local edits (71 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (71 matched lines × 2 locations) packages/cli/src/ui/hooks/useAgentStream.ts:599 — packages/cli/src/ui/hooks/useAgentStream.ts:599 · packages/cli/src/ui/hooks/useGeminiStream.ts:457 — the two spans are one implementation copied and then locally edited — 358 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (70 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (70 matched lines × 2 locations) scripts/aggregate_evals.js:18 — scripts/aggregate_evals.js:18 · scripts/eval_utils.js:15 — the two spans are one implementation copied and then locally edited — 478 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (67 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (67 matched lines × 2 locations) packages/core/src/context/processors/rollingSummaryProcessor.ts:24 — packages/core/src/context/processors/rollingSummaryProcessor.ts:24 · packages/core/src/context/processors/stateSnapshotProcessor.ts:25 — the two spans are one implementation copied and then locally edited — 338 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (66 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (66 matched lines × 2 locations) packages/cli/src/ui/components/shared/vim-buffer-actions.ts:194 — packages/cli/src/ui/components/shared/vim-buffer-actions.ts:194 · packages/cli/src/ui/components/shared/vim-buffer-actions.ts:377 — the two spans are one implementation copied and then locally edited — 245 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (59 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (59 matched lines × 2 locations) packages/core/src/routing/strategies/classifierStrategy.ts:131 — packages/core/src/routing/strategies/classifierStrategy.ts:131 · packages/core/src/routing/strategies/numericalClassifierStrategy.ts:103 — the two spans are one implementation copied and then locally edited — 310 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (57 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (57 matched lines × 2 locations) packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts:1515 — packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts:1515 · packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts:1656 — the two spans are one implementation copied and then locally edited — 272 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (56 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (56 matched lines × 2 locations) packages/cli/src/commands/extensions/disable.ts:23 — packages/cli/src/commands/extensions/disable.ts:23 · packages/cli/src/commands/extensions/enable.ts:28 — the two spans are one implementation copied and then locally edited — 271 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (55 lines × 2 locations) · ×1
  • Duplicated block (55 lines × 2 locations) packages/cli/src/ui/components/shared/text-buffer.ts:420 — packages/cli/src/ui/components/shared/text-buffer.ts:420 · packages/cli/src/ui/components/shared/text-buffer.ts:521 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block with local edits (55 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (55 matched lines × 2 locations) REDACTED:465 — REDACTED:465 · packages/core/src/tools/write-file.ts:227 — the two spans are one implementation copied and then locally edited — 242 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (53 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (53 matched lines × 2 locations) packages/core/src/tools/list-mcp-resources.ts:26 — packages/core/src/tools/list-mcp-resources.ts:26 · packages/core/src/tools/read-mcp-resource.ts:27 — the two spans are one implementation copied and then locally edited — 184 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (52 lines × 2 locations) · ×1
  • Duplicated block (52 lines × 2 locations) packages/core/src/agents/local-subagent-protocol.ts:143 — packages/core/src/agents/local-subagent-protocol.ts:143 · packages/core/src/agents/remote-subagent-protocol.ts:129 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
R10 · Code Duplication · Duplicated block with local edits (51 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (51 matched lines × 2 locations) packages/cli/src/utils/agentSettings.ts:15 — packages/cli/src/utils/agentSettings.ts:15 · packages/cli/src/utils/skillSettings.ts:18 — the two spans are one implementation copied and then locally edited — 222 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (49 lines × 2 locations) · ×1
  • Duplicated block (49 lines × 2 locations) packages/core/src/context/config/profiles.ts:82 — packages/core/src/context/config/profiles.ts:82 · packages/core/src/context/config/profiles.ts:224 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (43 lines × 2 locations) · ×1
  • Duplicated block (43 lines × 2 locations) REDACTED:839 — REDACTED:839 · REDACTED:1256 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block with local edits (41 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (41 matched lines × 2 locations) packages/core/src/utils/extensionLoader.ts:51 — packages/core/src/utils/extensionLoader.ts:51 · packages/core/src/utils/extensionLoader.ts:159 — the two spans are one implementation copied and then locally edited — 221 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (39 lines × 2 locations) · ×1
  • Duplicated block (39 lines × 2 locations) packages/cli/src/ui/components/shared/vim-buffer-actions.ts:640 — packages/cli/src/ui/components/shared/vim-buffer-actions.ts:640 · packages/cli/src/ui/components/shared/vim-buffer-actions.ts:688 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R2 · Cyclomatic Complexity · Complex function handleVimAction (cyclomatic 246, cognitive 407) · ×1
  • Complex function handleVimAction (cyclomatic 246, cognitive 407) packages/cli/src/ui/components/shared/vim-buffer-actions.ts:164 — handleVimAction has cyclomatic complexity 246 and cognitive complexity 407; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 205, cognitive 313) · ×1
  • Complex function (anonymous) (cyclomatic 205, cognitive 313) packages/cli/src/ui/components/InputPrompt.tsx:686 — (anonymous) has cyclomatic complexity 205 and cognitive complexity 313; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function textBufferReducerLogic (cyclomatic 194, cognitive 212) · ×1
  • Complex function textBufferReducerLogic (cyclomatic 194, cognitive 212) packages/cli/src/ui/components/shared/text-buffer.ts:1787 — textBufferReducerLogic has cyclomatic complexity 194 and cognitive complexity 212; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function constructor (cyclomatic 151, cognitive 147) · ×1
  • Complex function constructor (cyclomatic 151, cognitive 147) packages/core/src/config/config.ts:1004 — constructor has cyclomatic complexity 151 and cognitive complexity 147; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function start_sandbox (cyclomatic 140, cognitive 235) · ×1
  • Complex function start_sandbox (cyclomatic 140, cognitive 235) packages/cli/src/utils/sandbox.ts:120 — start_sandbox has cyclomatic complexity 140 and cognitive complexity 235; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 136, cognitive 274) · ×1
  • Complex function (anonymous) (cyclomatic 136, cognitive 274) packages/cli/src/ui/hooks/vim.ts:660 — (anonymous) has cyclomatic complexity 136 and cognitive complexity 274; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function loadCliConfig (cyclomatic 127, cognitive 132) · ×1
  • Complex function loadCliConfig (cyclomatic 127, cognitive 132) packages/cli/src/config/config.ts:663 — loadCliConfig has cyclomatic complexity 127 and cognitive complexity 132; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function emitKeys (cyclomatic 98, cognitive 204) · ×1
  • Complex function emitKeys (cyclomatic 98, cognitive 204) packages/cli/src/ui/contexts/KeypressContext.tsx:380 — emitKeys has cyclomatic complexity 98 and cognitive complexity 204; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 94, cognitive 212) · ×1
  • Complex function (anonymous) (cyclomatic 94, cognitive 212) packages/cli/src/nonInteractiveCli.ts:90 — (anonymous) has cyclomatic complexity 94 and cognitive complexity 212; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function isSafeToCallWithExec (cyclomatic 91, cognitive 284) · ×1
  • Complex function isSafeToCallWithExec (cyclomatic 91, cognitive 284) packages/core/src/sandbox/utils/commandSafety.ts:230 — isSafeToCallWithExec has cyclomatic complexity 91 and cognitive complexity 284; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 90, cognitive 173) · ×1
  • Complex function (anonymous) (cyclomatic 90, cognitive 173) packages/cli/src/nonInteractiveCliAgentSession.ts:89 — (anonymous) has cyclomatic complexity 90 and cognitive complexity 173; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function #resolvePrompt (cyclomatic 86, cognitive 202) · ×1
  • Complex function #resolvePrompt (cyclomatic 86, cognitive 202) packages/cli/src/acp/acpSession.ts:1007 — #resolvePrompt has cyclomatic complexity 86 and cognitive complexity 202; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function processLine (cyclomatic 83, cognitive 213) · ×1
  • Complex function processLine (cyclomatic 83, cognitive 213) packages/core/src/services/chatRecordingService.ts:319 — processLine has cyclomatic complexity 83 and cognitive complexity 213; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function processStreamResponse (cyclomatic 76, cognitive 174) · ×1
  • Complex function processStreamResponse (cyclomatic 76, cognitive 174) packages/core/src/core/geminiChat.ts:1590 — processStreamResponse has cyclomatic complexity 76 and cognitive complexity 174; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function main (cyclomatic 75, cognitive 109) · ×1
  • Complex function main (cyclomatic 75, cognitive 109) packages/cli/src/gemini.tsx:469 — main has cyclomatic complexity 75 and cognitive complexity 109; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function AppContainer (cyclomatic 74, cognitive 29) · ×1
  • Complex function AppContainer (cyclomatic 74, cognitive 29) packages/cli/src/ui/AppContainer.tsx:338 — AppContainer has cyclomatic complexity 74 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function installOrUpdateExtension (cyclomatic 72, cognitive 95) · ×1
  • Complex function installOrUpdateExtension (cyclomatic 72, cognitive 95) packages/cli/src/config/extension-manager.ts:202 — installOrUpdateExtension has cyclomatic complexity 72 and cognitive complexity 95; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function classifyGoogleError (cyclomatic 71, cognitive 102) · ×1
  • Complex function classifyGoogleError (cyclomatic 71, cognitive 102) packages/core/src/utils/googleQuotaErrors.ts:229 — classifyGoogleError has cyclomatic complexity 71 and cognitive complexity 102; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function detectPowerShellSubstitution (cyclomatic 68, cognitive 138) · ×1
  • Complex function detectPowerShellSubstitution (cyclomatic 68, cognitive 138) packages/core/src/utils/shell-utils.ts:2009 — detectPowerShellSubstitution has cyclomatic complexity 68 and cognitive complexity 138; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function retryWithBackoff (cyclomatic 66, cognitive 203) · ×1
  • Complex function retryWithBackoff (cyclomatic 66, cognitive 203) packages/core/src/utils/retry.ts:284 — retryWithBackoff has cyclomatic complexity 66 and cognitive complexity 203; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files · packages/cli/src/ui/components/shared/text-buffer.ts · ×1
  • packages/cli/src/ui/components/shared/text-buffer.ts: 3821 lines of code packages/cli/src/ui/components/shared/text-buffer.ts:1 — packages/cli/src/ui/components/shared/text-buffer.ts has 3821 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/core/src/config/config.ts · ×1
  • packages/core/src/config/config.ts: 3812 lines of code packages/core/src/config/config.ts:1 — packages/core/src/config/config.ts has 3812 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/cli/src/config/settingsSchema.ts · ×1
  • packages/cli/src/config/settingsSchema.ts: 3639 lines of code packages/cli/src/config/settingsSchema.ts:1 — packages/cli/src/config/settingsSchema.ts has 3639 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/cli/src/ui/AppContainer.tsx · ×1
  • packages/cli/src/ui/AppContainer.tsx: 2969 lines of code packages/cli/src/ui/AppContainer.tsx:1 — packages/cli/src/ui/AppContainer.tsx has 2969 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/core/src/utils/shell-utils.ts · ×1
  • packages/core/src/utils/shell-utils.ts: 2400 lines of code packages/core/src/utils/shell-utils.ts:1 — packages/core/src/utils/shell-utils.ts has 2400 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/core/src/tools/mcp-client.ts · ×1
  • packages/core/src/tools/mcp-client.ts: 2284 lines of code packages/core/src/tools/mcp-client.ts:1 — packages/core/src/tools/mcp-client.ts has 2284 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/cli/src/ui/hooks/useGeminiStream.ts · ×1
  • packages/cli/src/ui/hooks/useGeminiStream.ts: 2281 lines of code packages/cli/src/ui/hooks/useGeminiStream.ts:1 — packages/cli/src/ui/hooks/useGeminiStream.ts has 2281 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/core/src/telemetry/types.ts · ×1
  • packages/core/src/telemetry/types.ts: 2233 lines of code packages/core/src/telemetry/types.ts:1 — packages/core/src/telemetry/types.ts has 2233 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/core/src/core/geminiChat.ts · ×1
  • packages/core/src/core/geminiChat.ts: 2114 lines of code packages/core/src/core/geminiChat.ts:1 — packages/core/src/core/geminiChat.ts has 2114 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/core/src/services/shellExecutionService.ts · ×1
  • packages/core/src/services/shellExecutionService.ts: 2025 lines of code packages/core/src/services/shellExecutionService.ts:1 — packages/core/src/services/shellExecutionService.ts has 2025 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts · ×1
  • packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts: 2003 lines of code packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts:1 — packages/core/src/telemetry/clearcut-logger/clearcut-logger.ts has 2003 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/devtools/client/src/App.tsx · ×1
  • packages/devtools/client/src/App.tsx: 1808 lines of code packages/devtools/client/src/App.tsx:1 — packages/devtools/client/src/App.tsx has 1808 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/cli/src/ui/components/InputPrompt.tsx · ×1
  • packages/cli/src/ui/components/InputPrompt.tsx: 1777 lines of code packages/cli/src/ui/components/InputPrompt.tsx:1 — packages/cli/src/ui/components/InputPrompt.tsx has 1777 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/cli/src/ui/components/shared/vim-buffer-actions.ts · ×1
  • packages/cli/src/ui/components/shared/vim-buffer-actions.ts: 1691 lines of code packages/cli/src/ui/components/shared/vim-buffer-actions.ts:1 — packages/cli/src/ui/components/shared/vim-buffer-actions.ts has 1691 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/core/src/services/chatRecordingService.ts · ×1
  • packages/core/src/services/chatRecordingService.ts: 1689 lines of code packages/core/src/services/chatRecordingService.ts:1 — packages/core/src/services/chatRecordingService.ts has 1689 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/core/src/telemetry/metrics.ts · ×1
  • packages/core/src/telemetry/metrics.ts: 1649 lines of code packages/core/src/telemetry/metrics.ts:1 — packages/core/src/telemetry/metrics.ts has 1649 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/test-utils/src/test-rig.ts · ×1
  • packages/test-utils/src/test-rig.ts: 1543 lines of code packages/test-utils/src/test-rig.ts:1 — packages/test-utils/src/test-rig.ts has 1543 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/cli/src/config/settings.ts · ×1
  • packages/cli/src/config/settings.ts: 1512 lines of code packages/cli/src/config/settings.ts:1 — packages/cli/src/config/settings.ts has 1512 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/cli/src/config/extension-manager.ts · ×1
  • packages/cli/src/config/extension-manager.ts: 1466 lines of code packages/cli/src/config/extension-manager.ts:1 — packages/cli/src/config/extension-manager.ts has 1466 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/core/src/agents/local-executor.ts · ×1
  • packages/core/src/agents/local-executor.ts: 1449 lines of code packages/core/src/agents/local-executor.ts:1 — packages/core/src/agents/local-executor.ts has 1449 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/cli/src/acp/acpSession.ts · ×1
  • packages/cli/src/acp/acpSession.ts: 1441 lines of code packages/cli/src/acp/acpSession.ts:1 — packages/cli/src/acp/acpSession.ts has 1441 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/cli/src/utils/sandbox.ts · ×1
  • packages/cli/src/utils/sandbox.ts: 1441 lines of code packages/cli/src/utils/sandbox.ts:1 — packages/cli/src/utils/sandbox.ts has 1441 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · REDACTED · ×1
  • REDACTED: 1412 lines of code REDACTED:1 — REDACTED has 1412 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/cli/src/ui/hooks/vim.ts · ×1
  • packages/cli/src/ui/hooks/vim.ts: 1375 lines of code packages/cli/src/ui/hooks/vim.ts:1 — packages/cli/src/ui/hooks/vim.ts has 1375 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/cli/src/ui/components/InboxDialog.tsx · ×1
  • packages/cli/src/ui/components/InboxDialog.tsx: 1333 lines of code packages/cli/src/ui/components/InboxDialog.tsx:1 — packages/cli/src/ui/components/InboxDialog.tsx has 1333 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · REDACTED · ×1
  • REDACTED: 1331 lines of code REDACTED:1 — REDACTED has 1331 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/a2a-server/src/agent/task.ts · ×1
  • packages/a2a-server/src/agent/task.ts: 1288 lines of code packages/a2a-server/src/agent/task.ts:1 — packages/a2a-server/src/agent/task.ts has 1288 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/core/src/tools/shell.ts · ×1
  • packages/core/src/tools/shell.ts: 1270 lines of code packages/core/src/tools/shell.ts:1 — packages/core/src/tools/shell.ts has 1270 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/core/src/core/client.ts · ×1
  • packages/core/src/core/client.ts: 1246 lines of code packages/core/src/core/client.ts:1 — packages/core/src/core/client.ts has 1246 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · REDACTED · ×1
  • REDACTED: 1238 lines of code REDACTED:1 — REDACTED has 1238 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/cli/src/ui/components/AskUserDialog.tsx · ×1
  • packages/cli/src/ui/components/AskUserDialog.tsx: 1189 lines of code packages/cli/src/ui/components/AskUserDialog.tsx:1 — packages/cli/src/ui/components/AskUserDialog.tsx has 1189 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/cli/src/config/config.ts · ×1
  • packages/cli/src/config/config.ts: 1177 lines of code packages/cli/src/config/config.ts:1 — packages/cli/src/config/config.ts has 1177 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/core/src/policy/policy-engine.ts · ×1
  • packages/core/src/policy/policy-engine.ts: 1142 lines of code packages/core/src/policy/policy-engine.ts:1 — packages/core/src/policy/policy-engine.ts has 1142 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx · ×1
  • packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx: 1053 lines of code packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx:1 — packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx has 1053 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/core/src/tools/tools.ts · ×1
  • packages/core/src/tools/tools.ts: 1026 lines of code packages/core/src/tools/tools.ts:1 — packages/core/src/tools/tools.ts has 1026 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/cli/src/gemini.tsx · ×1
  • packages/cli/src/gemini.tsx: 1002 lines of code packages/cli/src/gemini.tsx:1 — packages/cli/src/gemini.tsx has 1002 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · REDACTED · ×1
  • REDACTED: 995 lines of code REDACTED:1 — REDACTED has 995 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/cli/src/ui/components/triage/TriageDuplicates.tsx · ×1
  • packages/cli/src/ui/components/triage/TriageDuplicates.tsx: 974 lines of code packages/cli/src/ui/components/triage/TriageDuplicates.tsx:1 — packages/cli/src/ui/components/triage/TriageDuplicates.tsx has 974 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/core/src/telemetry/loggers.ts · ×1
  • packages/core/src/telemetry/loggers.ts: 954 lines of code packages/core/src/telemetry/loggers.ts:1 — packages/core/src/telemetry/loggers.ts has 954 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/a2a-server/src/config/settings.ts · ×1
  • packages/a2a-server/src/config/settings.ts: 951 lines of code packages/a2a-server/src/config/settings.ts:1 — packages/a2a-server/src/config/settings.ts has 951 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R5 · Dependency Freshness · Dependency Freshness · ×1
  • Dependency Freshness — 128 outdated package(s); JS/npm CVEs scored in D30 (newest versions read from registry.npmjs.org: the repository's own registry, wombat-dressing-room.appspot.com, refused the analyzer)
R7 · Dead Code · Dead file (~251 LoC) · ×1
  • Dead file (~251 LoC) scripts/sync_project_dry_run.js — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~180 LoC) · ×1
  • Dead file (~180 LoC) scripts/cleanup-branches.ts — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~151 LoC) · ×1
  • Dead file (~151 LoC) scripts/close_duplicate_issues.js — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~148 LoC) · ×1
  • Dead file (~148 LoC) tools/gemini-cli-bot/metrics/scripts/domain_expertise.ts — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~141 LoC) · ×1
  • Dead file (~141 LoC) tools/gemini-cli-bot/metrics/scripts/time_to_first_response.ts — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~125 LoC) · ×1
  • Dead file (~125 LoC) tools/gemini-cli-bot/metrics/scripts/actions_spend.ts — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~121 LoC) · ×1
  • Dead file (~121 LoC) packages/core/scripts/compile-windows-sandbox.js — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~99 LoC) · ×1
  • Dead file (~99 LoC) packages/vscode-ide-companion/scripts/check-vscode-release.js — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~86 LoC) · ×1
  • Dead file (~86 LoC) tools/gemini-cli-bot/metrics/scripts/user_touches.ts — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~77 LoC) · ×1
  • Dead file (~77 LoC) tools/gemini-cli-bot/metrics/scripts/review_distribution.ts — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~68 LoC) · ×1
  • Dead file (~68 LoC) scripts/prepare-github-release.js — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~67 LoC) · ×1
  • Dead file (~67 LoC) scripts/prepare-npm-release.js — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~62 LoC) · ×1
  • Dead file (~62 LoC) packages/a2a-server/src/utils/path_utils.ts — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~59 LoC) · ×1
  • Dead file (~59 LoC) tools/gemini-cli-bot/metrics/scripts/backlog_age.ts — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~51 LoC) · ×1
  • Dead file (~51 LoC) scripts/test-windows-paths.js — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~45 LoC) · ×1
  • Dead file (~45 LoC) packages/cli/src/ui/utils/terminalUtils.ts — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~14 LoC) · ×1
  • Dead file (~14 LoC) tools/gemini-cli-bot/metrics/types.ts — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), but 9 in-repo import(s) from 9 other file(s) do name it (tools/gemini-cli-bot/metrics/scripts/backlog_age.ts, tools/gemini-cli-bot/metrics/scripts/domain_expertise.ts, tools/gemini-cli-bot/metrics/scripts/latency.ts and 6 more) — every one of those referrers is itself unreachable, so this file is dead only as a member of that cluster: if any referrer is in fact alive, this row falls with it
R7 · Dead Code · Dead file (~10 LoC) · ×1
  • Dead file (~10 LoC) packages/core/src/policy/index.ts — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R7 · Dead Code · Dead file (~8 LoC) · ×1
  • Dead file (~8 LoC) packages/core/src/confirmation-bus/index.ts — no import path from any entry point (244 application, 49 tooling, 1092 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R8 · Dependency Hygiene · Unused dependency 'depcheck' · ×1
  • Unused dependency 'depcheck' — Declared in the root REDACTED but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
R8 · Dependency Hygiene · Unused dependency 'domexception' · ×1
  • Unused dependency 'domexception' — Declared in the root REDACTED but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
R8 · Dependency Hygiene · Unused dependency 'node-fetch-native' · ×1
  • Unused dependency 'node-fetch-native' — Declared in the root REDACTED but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
SC1 · Supply-chain hygiene · JavaScript dependencies are not locked · ×1
  • JavaScript dependencies are not locked REDACTED:24 — REDACTED declares dependencies that no committed lockfile resolves — there is no REDACTED / 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.
Minor — 1326 finding(s)
D10 · Test Quality · Mock-dominated test · ×687
  • Mock-dominated test: executes main logic sea/sea-launch.test.js:83 — This test sets up 3 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: recreates runtime if existing has wrong owner sea/sea-launch.test.js:296 — This test sets up 12 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: recreates runtime if existing has wrong permissions sea/sea-launch.test.js:353 — This test sets up 12 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: creates new runtime if existing is invalid (integrity check) sea/sea-launch.test.js:406 — This test sets up 12 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: handles rename race condition: fails if target is insecure sea/sea-launch.test.js:529 — This test sets up 14 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: uses LOCALAPPDATA on Windows if available sea/sea-launch.test.js:595 — This test sets up 12 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: should show an update notification if a newer version is available packages/vscode-ide-companion/src/extension.test.ts:180 — This test sets up 3 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: should not show an update notification if the version is the same packages/vscode-ide-companion/src/extension.test.ts:208 — This test sets up 3 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: does not show install or update messages for $ide.name packages/vscode-ide-companion/src/extension.test.ts:233 — This test sets up 4 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: should not show an update notification if the version is older packages/vscode-ide-companion/src/extension.test.ts:268 — This test sets up 3 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: should execute the install command when the user clicks "Update" packages/vscode-ide-companion/src/extension.test.ts:293 — This test sets up 3 test doubles (for example `vi.spyOn`) against 1 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: should handle fetch errors gracefully packages/vscode-ide-companion/src/extension.test.ts:324 — This test sets up 3 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: should dispose OpenFilesManager and event subscriptions on stop packages/vscode-ide-companion/src/ide-server.test.ts:335 — This test sets up 5 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 6 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: should log and stop pinging if closing the evicted session fails packages/vscode-ide-companion/src/ide-server.test.ts:694 — This test sets up 3 test doubles (for example `vi.spyOn`) against 2 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: disposes all watchers, clears pending debounce timer, and disposes emitter on dispose() packages/vscode-ide-companion/src/open-files-manager.test.ts:592 — This test sets up 7 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 6 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: calls setUserMemory and updateSystemInstruction when instructions is a function packages/sdk/src/session.test.ts:293 — This test sets up 3 test doubles (for example `vi .fn`) against 1 real object(s) of its own, and its only verification is 7 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: should include privacy policy link in the prompt packages/core/src/utils/browserConsent.test.ts:102 — This test sets up 3 test doubles (for example `vi.spyOn`) against 1 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: should handle multiple arguments correctly for all methods packages/core/src/utils/debugLogger.test.ts:51 — This test sets up 4 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 4 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: should emit ExternalEditorClosed when ${editor} exits with non-zero code packages/core/src/utils/editor.test.ts:489 — This test sets up 3 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: should ${reloadingEnabled ? '' : 'not '}reload extension features packages/core/src/utils/extensionLoader.test.ts:186 — This test sets up 8 test doubles (for example `a double assigned in a shared setup`) against 1 real object(s) of its own, and its only verification is 29 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: should stop and then start the extension packages/core/src/utils/extensionLoader.test.ts:276 — This test sets up 4 test doubles (for example `vi.spyOn`) against 1 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: should generate and use a fallback promptId when context is not available packages/core/src/utils/llm-edit-fixer.test.ts:93 — This test sets up 3 test doubles (for example `vi .spyOn`) against 0 real object(s) of its own, and its only verification is 3 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: should use pty fallback on Unix if group kill fails packages/core/src/utils/process-utils.test.ts:148 — This test sets up 3 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: should attempt process group kill on Unix after pty fallback to reap orphaned descendants packages/core/src/utils/process-utils.test.ts:160 — This test sets up 3 test doubles (for example `vi.fn`) against 1 real object(s) of its own, and its only verification is 2 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: falls back to C:\Windows if SystemRoot is invalid or a UNC path packages/core/src/utils/security.test.ts:364 — This test sets up 4 test doubles (for example `vi.spyOn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • + 662 more in this group — see findings.md.
D34 · Knowledge Freshness · Orphaned file · ×307
  • Orphaned file packages/core/src/hooks/types.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file scripts/utils/eval-validate.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/core/src/tools/trackerTools.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/test-utils/src/perf-test-harness.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/cli/src/ui/hooks/useShellCompletion.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/core/src/context/contextCompressionService.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/cli/src/ui/utils/terminalSetup.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/cli/src/ui/utils/latexToUnicode.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/core/src/hooks/hookEventHandler.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/cli/src/commands/gemma/setup.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file tools/caretaker-agent/evals/triage/helpers/summary.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/cli/src/ui/hooks/useVoiceMode.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/test-utils/src/memory-test-harness.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/cli/src/services/FileCommandLoader.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/cli/src/ui/components/FooterConfigDialog.tsx:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/core/src/telemetry/memory-monitor.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/core/src/telemetry/semantic.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/core/src/telemetry/uiTelemetry.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/cli/src/ui/components/StatsDisplay.tsx:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/cli/src/config/extensions/extensionSettings.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/cli/src/services/McpPromptLoader.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/cli/src/ui/commands/skillsCommand.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/cli/src/ui/hooks/useToolScheduler.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/cli/src/ui/utils/commandUtils.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/core/src/hooks/hookAggregator.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • + 282 more in this group — see findings.md.
D24 · Comment Value · redundant comment · ×224
  • redundant comment evals/ask_user.eval.ts:88 — "It might call enter_plan_mode first." repeats the code it sits on: 4 of its 5 words (call, enter, plan, mode) are already in `let confirmation = await rig.waitForPendingConfirmation([`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment evals/background_processes.eval.ts:36 — "Check if read_background_output was called" repeats the code it sits on: 5 of its 5 words (check, read, background, output, called) are already in `const hasReadCall = toolCalls.some(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment evals/background_processes.eval.ts:70 — "Check if list_background_processes was called" repeats the code it sits on: 5 of its 5 words (check, list, background, processes, called) are already in `const hasListCall = toolCalls.some(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment evals/plan_mode.eval.ts:445 — "Check if exit_plan_mode was called as a tool" repeats the code it sits on: 6 of its 6 words (check, exit, plan, mode, called, tool) are already in `const exitPlanToolCall = toolLogs.find(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment integration-tests/hooks-system.test.ts:702 — 7 comments in this file only repeat the code they sit on (lines 702, 1097, 1404, 1473, 1484, 1711, 1734), for example "Create a test file". Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment memory-tests/memory-usage.test.ts:512 — "Wait for streams to finish" repeats the code it sits on: 3 of its 3 words (wait, streams, finish) are already in `await Promise.all([`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/a2a-server/src/agent/task-event-driven.test.ts:659 — "Trigger _schedulerOutputUpdate with subagent progress" repeats the code it sits on: 5 of its 6 words (scheduler, output, update, subagent, progress) are already in `task['_schedulerOutputUpdate']('tool-1', {`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/a2a-server/src/agent/task-event-driven.test.ts:686 — "Register tool 1 as executing" repeats the code it sits on: 3 of its 3 words (register, tool, executing) are already in `task['_registerToolCall']('1', 'executing');`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/a2a-server/src/agent/task.test.ts:741 — "Call checkInputRequiredState" repeats the code it sits on: 4 of its 5 words (check, input, required, state) are already in `task['checkInputRequiredState']();`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/a2a-server/src/agent/task.ts:1248 — "Set task state to working as we are about to call LLM" repeats the code it sits on: 5 of its 6 words (set, task, state, working, call) are already in `this.setTaskStateAndPublishUpdate('working', stateChange);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/a2a-server/src/agent/task.ts:1294 — "Set task state to working as we are about to call LLM" repeats the code it sits on: 5 of its 6 words (set, task, state, working, call) are already in `this.setTaskStateAndPublishUpdate('working', stateChange);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/a2a-server/src/config/rce_vulnerability.test.ts:41 — "Mock process.cwd to return the untrusted workspace" repeats the code it sits on: 5 of its 6 words (mock, process, cwd, return, workspace) are already in `vi.spyOn(process, 'cwd').mockReturnValue(tempWorkspaceDir);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/a2a-server/src/http/app.test.ts:153 — 5 comments in this file only repeat the code they sit on (lines 153, 214, 222, 845, 990), for example "Status update: text-content". Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/cli/src/acp/acpSession.ts:1059 — "Get centralized file discovery service" repeats the code it sits on: 4 of its 5 words (get, file, discovery, service) are already in `const fileDiscovery = this.context.config.getFileService();`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/cli/src/commands/extensions.test.tsx:33 — "Mock gemini.js" repeats the code it sits on: 3 of its 3 words (mock, gemini, js) are already in `vi.mock('../gemini.js', () => ({`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/cli/src/commands/mcp/add.test.ts:368 — "We expect setValue to be called once." repeats the code it sits on: 4 of its 5 words (expect, set, value, called) are already in `expect(mockSetValue).toHaveBeenCalledTimes(1);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/cli/src/commands/mcp/add.test.ts:371 — "We get the scope that setValue was called with." repeats the code it sits on: 4 of its 5 words (scope, set, value, called) are already in `const calledScope = mockSetValue.mock.calls[0][0];`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/cli/src/config/config.test.ts:764 — "Hooks command enabled via hooksConfig settings" repeats the code it sits on: 4 of its 5 words (hooks, enabled, config, settings) are already in `const settings = createTestMergedSettings({`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/cli/src/config/extension-manager-agents.test.ts:27 — "Mock @google/gemini-cli-core" repeats the code it sits on: 5 of its 5 words (mock, google, gemini, cli, core) are already in `vi.mock('@google/gemini-cli-core', async (importOriginal) =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/cli/src/config/extension-manager-hydration.test.ts:31 — "Mock @google/gemini-cli-core" repeats the code it sits on: 5 of its 5 words (mock, google, gemini, cli, core) are already in `vi.mock('@google/gemini-cli-core', async (importOriginal) =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/cli/src/config/extension-manager-skills.test.ts:31 — "Mock @google/gemini-cli-core" repeats the code it sits on: 5 of its 5 words (mock, google, gemini, cli, core) are already in `vi.mock('@google/gemini-cli-core', async (importOriginal) =>`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/cli/src/config/extensions/github.test.ts:456 — "Mock fs.promises.unlink" repeats the code it sits on: 4 of its 4 words (mock, fs, promises, unlink) are already in `vi.mocked(fs.promises.unlink).mockResolvedValue(undefined);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/cli/src/config/extensions/github.test.ts:514 — "Mock fs.promises.unlink" repeats the code it sits on: 4 of its 4 words (mock, fs, promises, unlink) are already in `vi.mocked(fs.promises.unlink).mockResolvedValue(undefined);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/cli/src/config/policy-engine.integration.test.ts:262 — "MCP server tools" repeats the code it sits on: 3 of its 3 words (mcp, server, tools) are already in `expect(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/cli/src/config/settings.test.ts:1944 — "Save settings for workspace 1" repeats the code it sits on: 3 of its 3 words (save, settings, workspace) are already in `saveSettings(settings1W1.workspace);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • + 199 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×25
  • Duplicated predicate packages/cli/src/utils/deepMerge.ts:21 — `!!item && typeof item === 'object' && !Array.isArray(item)` appears character-identically in 2 files — packages/cli/src/utils/deepMerge.ts, packages/core/src/services/modelConfigService.ts. 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 REDACTED:588 — `!!sandboxType && sandboxType !== 'sandbox-exec' && sandboxType !== 'sandbox:none'` appears character-identically in 2 files — REDACTED, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/utils/eval-inventory.ts:259 — `!generatedDate && process.env.SOURCE_DATE_EPOCH` appears character-identically in 2 files — scripts/utils/eval-inventory.ts, scripts/utils/eval-validate.ts. 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 packages/cli/src/ui/hooks/useAgentStream.ts:548 — `!isEditorDialogOpen && (streamingState === StreamingState.Responding || streamingState === StreamingState.WaitingForConfirmation)` appears character-identically in 2 files — packages/cli/src/ui/hooks/useAgentStream.ts, packages/cli/src/ui/hooks/useGeminiStream.ts. 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 packages/core/src/routing/strategies/classifierStrategy.ts:166 — `!isFunctionCall(content) && !isFunctionResponse(content)` appears character-identically in 2 files — packages/core/src/routing/strategies/classifierStrategy.ts, packages/core/src/routing/strategies/gemmaClassifierStrategy.ts. 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 packages/a2a-server/src/agent/task.ts:721 — `!isNodeError(err) || err.code !== 'ENOENT'` appears character-identically in 3 files — packages/a2a-server/src/agent/task.ts, REDACTED, packages/core/src/tools/modifiable-tool.ts. 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 packages/core/src/agents/acknowledgedAgents.ts:33 — `!isNodeError(error) || error.code !== 'ENOENT'` appears character-identically in 3 files — packages/core/src/agents/acknowledgedAgents.ts, packages/core/src/utils/atCommandUtils.ts, packages/core/src/utils/sessionOperations.ts. 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 packages/cli/index.ts:65 — `!isSeaEnvironment() && process.argv[1] && !isAbsolute(process.argv[1])` appears character-identically in 2 files — packages/cli/index.ts, packages/cli/src/utils/relaunch.ts. 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 packages/core/src/agents/local-invocation.ts:345 — `!lastActivity || lastActivity.status !== SubagentState.ERROR` appears character-identically in 2 files — packages/core/src/agents/local-invocation.ts, packages/core/src/agents/local-session-invocation.ts. 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 packages/core/src/tools/shell.ts:497 — `!parsed || parsed.hasError || parsed.details.length === 0` appears character-identically in 2 files — packages/core/src/tools/shell.ts, packages/core/src/utils/shell-utils.ts. 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 packages/cli/src/commands/mcp/enableDisable.ts:52 — `!result.allowed && (result.blockType === 'allowlist' || result.blockType === 'excludelist')` appears character-identically in 2 files — packages/cli/src/commands/mcp/enableDisable.ts, packages/cli/src/ui/commands/mcpCommand.ts. 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 packages/cli/src/ui/components/triage/TriageDuplicates.tsx:352 — `!state.analysisCache.has(issue.number) && !state.analyzingIds.has(issue.number)` appears character-identically in 2 files — packages/cli/src/ui/components/triage/TriageDuplicates.tsx, packages/cli/src/ui/components/triage/TriageIssues.tsx. 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 packages/core/src/agents/local-subagent-protocol.ts:347 — `!this._agentEndEmitted && this._agentStartEmitted` appears character-identically in 2 files — packages/core/src/agents/local-subagent-protocol.ts, packages/core/src/agents/remote-subagent-protocol.ts. 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 packages/core/src/agent/legacy-agent-session.ts:429 — `'exitCode' in err && typeof err.exitCode === 'number'` appears character-identically in 2 files — packages/core/src/agent/legacy-agent-session.ts, packages/core/src/agents/local-subagent-protocol.ts. 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 packages/core/src/agent/content-utils.ts:43 — `'functionCall' in part && part.functionCall` appears character-identically in 2 files — packages/core/src/agent/content-utils.ts, packages/core/src/utils/historyHardening.ts. 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 packages/core/src/agent/content-utils.ts:45 — `'functionResponse' in part && part.functionResponse` appears character-identically in 2 files — packages/core/src/agent/content-utils.ts, packages/core/src/utils/historyHardening.ts. 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 packages/core/src/agent/content-utils.ts:19 — `'text' in part && part.text !== undefined` appears character-identically in 2 files — packages/core/src/agent/content-utils.ts, packages/core/src/agents/local-executor.ts. 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 packages/core/src/agents/local-invocation.ts:331 — `(error instanceof Error && error.name === 'AbortError') || errorMessage.includes('Aborted')` appears character-identically in 3 files — packages/core/src/agents/local-invocation.ts, packages/core/src/agents/local-session-invocation.ts, packages/core/src/agents/remote-session-invocation.ts. 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 packages/cli/src/nonInteractiveCli.ts:213 — `(key && key.ctrl && key.name === 'c') || str === '\u0003'` appears character-identically in 2 files — packages/cli/src/nonInteractiveCli.ts, packages/cli/src/nonInteractiveCliAgentSession.ts. 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 tools/gemini-cli-bot/metrics/scripts/domain_expertise.ts:100 — `['MEMBER', 'OWNER', 'COLLABORATOR'].includes( review.authorAssociation, ) && review.author?.login` appears character-identically in 2 files — tools/gemini-cli-bot/metrics/scripts/domain_expertise.ts, tools/gemini-cli-bot/metrics/scripts/review_distribution.ts. 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 packages/cli/src/nonInteractiveCli.ts:726 — `abortController.signal.aborted || isFatalCancellationError(errorToHandle)` appears character-identically in 2 files — packages/cli/src/nonInteractiveCli.ts, packages/cli/src/nonInteractiveCliAgentSession.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/releasing/patch-comment.js:84 — `argv.originalPr || process.env.ORIGINAL_PR` appears character-identically in 2 files — scripts/releasing/patch-comment.js, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate scripts/releasing/patch-comment.js:67 — `argv.test || process.env.TEST_MODE === 'true'` appears character-identically in 3 files — scripts/releasing/patch-comment.js, REDACTED, scripts/releasing/patch-trigger.js. 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 packages/cli/src/ui/AppContainer.tsx:1067 — `authType === AuthType.LOGIN_WITH_GOOGLE && config.isBrowserLaunchSuppressed()` appears character-identically in 2 files — packages/cli/src/ui/AppContainer.tsx, packages/cli/src/ui/auth/AuthDialog.tsx. 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 packages/core/src/code_assist/codeAssist.ts:22 — `authType === AuthType.LOGIN_WITH_GOOGLE || authType === AuthType.COMPUTE_ADC` appears character-identically in 2 files — packages/core/src/code_assist/codeAssist.ts, packages/core/src/core/contentGenerator.ts. 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.
X7 · Silent fallback defaults · Silent fallback default in catch · ×18
  • Silent fallback default in catch packages/cli/src/ui/hooks/useShellCompletion.ts:285 — `scanPathExecutables` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch packages/cli/src/ui/hooks/useShellCompletion.ts:353 — `resolvePathCompletions` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch packages/cli/src/ui/commands/chatCommand.ts:68 — `getSavedChatTags` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch packages/cli/src/ui/utils/directoryUtils.ts:138 — `getDirectorySuggestions` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch packages/cli/src/ui/commands/restoreCommand.ts:158 — `completion` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch packages/core/src/utils/gitIgnoreParser.ts:64 — `loadPatternsForFile` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch packages/core/src/utils/pathCorrector.ts:76 — `resolveActiveWorkspaceDir` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch packages/core/src/tools/jit-context.ts:36 — `discoverJitContext` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch REDACTED:583 — `scanEligibleSessions` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch REDACTED:126 — `listInboxSkills` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch REDACTED:1149 — `listInboxPatches` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch packages/core/src/utils/filesearch/crawler.ts:83 — `crawl` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch packages/core/src/services/usageAggregator.ts:272 — `listJsonlRecordingFiles` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch evals/skill_extraction.eval.ts:594 — `readSkillBodies` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch evals/subagents.eval.ts:28 — `expectSubagentCall` swallows every exception into `return false` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch packages/test-utils/src/test-rig.ts:1069 — `waitForTelemetryReady` swallows every exception into `return false` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch scripts/utils/autogen.ts:73 — `formatDefaultValue` swallows every exception into `return '[object Object]'` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default in catch tools/gemini-cli-bot/history/sync.ts:26 — `runCommand` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
D16 · Bus Factor · Off-boarding risk · ×9
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 14 significant file(s) lose their only recent owner: packages/core/src/context/utils/snapshotGenerator.ts, packages/core/src/context/pipeline/contextWorkingBuffer.ts, packages/core/src/context/testing/contextTestUtils.ts, packages/core/src/context/config/profiles.ts, packages/core/src/context/graph/toGraph.ts, packages/core/src/context/graph/render.ts, packages/core/src/context/processors/stateSnapshotProcessor.ts, packages/core/src/context/utils/contextTokenCalculator.ts (+6 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 9 significant file(s) lose their only recent owner: tools/caretaker-agent/cloudrun/triage-worker/db/issues_store.py, tools/caretaker-agent/cloudrun/triage-worker/main.py, tools/caretaker-agent/evals/triage/tools/dataset_metrics.py, tools/caretaker-agent/cloudrun/triage-worker/triage_orchestrator.py, tools/caretaker-agent/evals/triage/helpers/github_api.py, tools/caretaker-agent/cloudrun/egress-service/src/actions/github.ts, tools/caretaker-agent/evals/triage/tools/generate_golden_issue.py, tools/caretaker-agent/evals/triage/tools/sync_firestore.py (+1 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 6 significant file(s) lose their only recent owner: packages/cli/src/ui/components/InboxDialog.tsx, REDACTED, evals/skill_extraction.eval.ts, packages/core/src/agents/skill-extraction-agent.ts, packages/core/src/services/memoryPatchUtils.ts, REDACTED. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 6 significant file(s) lose their only recent owner: evals/frugalReads.eval.ts, evals/answer-vs-act.eval.ts, evals/automated-tool-use.eval.ts, tools/gemini-cli-bot/metrics/scripts/actions_spend.ts, evals/frugalSearch.eval.ts, evals/edit-locations-eval.eval.ts. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 4 significant file(s) lose their only recent owner: scripts/utils/eval-analysis.ts, scripts/utils/eval-report.ts, scripts/utils/eval-coverage.ts, scripts/utils/tool-registry.ts. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #6 — If anonymized user #6 becomes unavailable, 4 significant file(s) lose their only recent owner: packages/core/src/agents/remote-subagent-protocol.ts, packages/core/src/agents/local-subagent-protocol.ts, packages/core/src/agents/local-session-invocation.ts, packages/core/src/agents/remote-session-invocation.ts. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #7 — If anonymized user #7 becomes unavailable, 3 significant file(s) lose their only recent owner: tools/caretaker-agent/cloudrun/pr-generator/workflow/orchestrator.py, tools/caretaker-agent/cloudrun/pr-generator/workflow/db/db_interface.py, tools/caretaker-agent/cloudrun/pr-generator/workflow/agent_runner.py. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #8 — If anonymized user #8 becomes unavailable, 3 significant file(s) lose their only recent owner: packages/core/src/tools/trackerTools.ts, packages/core/src/services/trackerService.ts, packages/core/src/tools/definitions/trackerTools.ts. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #9 — If anonymized user #9 becomes unavailable, 3 significant file(s) lose their only recent owner: REDACTED, scripts/cleanup-branches.ts, packages/cli/src/ui/hooks/useAnimatedScrollbar.ts. Pair on, review, or document these before any departure.
P2 · Observability · Console output used as the logging channel · ×8
  • Console output used as the logging channel packages/core/src/voice/audioRecorder.ts:85 — `packages/core/src/voice/audioRecorder.ts` reports through `console.*` at line 85 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/core/src/utils/debugLogger.ts:35 — `packages/core/src/utils/debugLogger.ts` reports through `console.*` at line 35 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/core/src/utils/debugLogger.ts:50 — `packages/core/src/utils/debugLogger.ts` reports through `console.*` at line 50 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/core/src/utils/debugLogger.ts:55 — `packages/core/src/utils/debugLogger.ts` reports through `console.*` at line 55 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/core/src/utils/debugLogger.ts:60 — `packages/core/src/utils/debugLogger.ts` reports through `console.*` at line 60 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/core/src/utils/debugLogger.ts:65 — `packages/core/src/utils/debugLogger.ts` reports through `console.*` at line 65 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/core/src/utils/editCorrector.ts:95 — `packages/core/src/utils/editCorrector.ts` reports through `console.*` at line 95 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/core/src/core/geminiChat.ts:542 — `packages/core/src/core/geminiChat.ts` reports through `console.*` at line 542 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
D27 · Navigability · Pass-through layer · ×3
  • Pass-through layer packages/core/src/agent/agent-session.ts:18 — AgentSession: all 3 public methods forward their arguments unchanged to _protocol and add no behaviour — an extra hop (and usually an extra interface) to trace through. Call _protocol directly, or give the layer a job.
  • Pass-through layer packages/core/src/telemetry/sdk.ts:73 — DiagLoggerAdapter: all 5 public methods forward their arguments unchanged to debugLogger and add no behaviour — an extra hop (and usually an extra interface) to trace through. Call debugLogger directly, or give the layer a job.
  • Pass-through layer packages/core/src/tools/mcp-compliance-transport.ts:23 — McpComplianceTransport: all 3 public methods forward their arguments unchanged to transport and add no behaviour — an extra hop (and usually an extra interface) to trace through. Call transport directly, or give the layer a job.
D30 · Dependency Vulnerabilities · Low CVE · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D31 · IaC & Container Security · Low IaC · ×3
  • REDACTED
  • REDACTED
  • REDACTED
AX6 · Interface segregation · Fat interface · ×2
  • Fat interface: TextBuffer (84 required operations) packages/cli/src/ui/components/shared/text-buffer.ts:3913 — `TextBuffer` declares 84 required operations: `setText`, `insert`, `newline`, `backspace`, `del`, `move`, `undo`, `redo`, `replaceRange`, `deleteWordLeft`, `deleteWordRight`, `killLineRight`, `killLineLeft`, `handleInput`, `openInExternalEditor`, `replaceRangeByOffset`, `getOffset`, `moveToOffset`, `moveToVisualPosition`, `getLogicalPositionFromVisual`, `getExpandedPasteAtLine`, `togglePasteExpansion`, `vimDeleteWordForward`, `vimDeleteWordBackward`, `vimDeleteWordEnd`, `vimDeleteBigWordForward`, `vimDeleteBigWordBackward`, `vimDeleteBigWordEnd`, `vimChangeWordForward`, `vimChangeWordBackward`, `vimChangeWordEnd`, `vimChangeBigWordForward`, `vimChangeBigWordBackward`, `vimChangeBigWordEnd`, `vimDeleteLine`, `vimChangeLine`, `vimDeleteToEndOfLine`, `vimDeleteToStartOfLine`, `vimChangeToEndOfLine`, `vimDeleteToFirstNonWhitespace`, and 44 more. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: UIActions (61 required operations) packages/cli/src/ui/contexts/UIActionsContext.tsx:23 — `UIActions` declares 61 required operations: `handleThemeSelect`, `closeThemeDialog`, `handleThemeHighlight`, `handleAuthSelect`, `setAuthState`, `onAuthError`, `handleEditorSelect`, `exitEditorDialog`, `exitPrivacyNotice`, `closeSettingsDialog`, `closeModelDialog`, `openVoiceModelDialog`, `closeVoiceModelDialog`, `openAgentConfigDialog`, `closeAgentConfigDialog`, `openPermissionsDialog`, `closePermissionsDialog`, `setShellModeActive`, `vimHandleInput`, `handleIdePromptComplete`, `handleFolderTrustSelect`, `setIsPolicyUpdateDialogOpen`, `setConstrainHeight`, `onEscapePromptChange`, `refreshStatic`, `handleFinalSubmit`, `handleClearScreen`, `handleProQuotaChoice`, `handleValidationChoice`, `handleOverageMenuChoice`, `handleEmptyWalletChoice`, `openSessionBrowser`, `closeSessionBrowser`, `handleResumeSession`, `handleDeleteSession`, `setQueueErrorMessage`, `addMessage`, `popAllMessages`, `handleApiKeySubmit`, `handleApiKeyCancel`, and 21 more. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
D19 · Documentation Quality · Documentation · ×2
  • Documentation: no build, run or usage example packages/a2a-server/README.md:1 — `a2a-server` is a command-line package (`bin` in `REDACTED`) and neither `packages/a2a-server/README.md` nor the documents it links hold a code block or a command. Show the command that builds or runs it, or a usage snippet.
  • Documentation: no build, run or usage example packages/vscode-ide-companion/README.md:1 — `vscode-ide-companion` is a published package (`REDACTED` without `"private": true`) and neither `packages/vscode-ide-companion/README.md` nor the documents it links hold a code block or a command. Show the command that builds or runs it, or a usage snippet.
X7 · Silent fallback defaults · Pending state with no failure state · ×2
  • Pending state with no failure state packages/cli/src/ui/components/AppHeader.tsx:119 — The view draws `Updating` under `updateInfo ?. isUpdating`, but `updateInfo` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
  • Pending state with no failure state packages/cli/src/ui/components/NewAgentsNotification.tsx:121 — The view draws `Processing...` under `isProcessing`, but `isProcessing` is settled by a load that can fail and the component draws no failure state, so a failed load is shown as "not yet" for ever, or as the loaded state over its initial value. Give the component a failure state and draw it.
C2 · Access Controls · No named authorization policies · ×1
  • No named authorization policies — Authorization IS enforced here (by imperative guard methods that throw on violation) — this is NOT a claim that the code is unprotected. What's missing is a NAMED rule set: the guards encode the access rules inline, so the rules can't be listed, reviewed or tested apart from the call sites that apply them. Recommendation, not a defect.
C2 · Access Controls · Thin authorization enforcement · ×1
  • Thin authorization enforcement — Only 2 imperative guard call site(s) — too few to demonstrate default-deny across handlers.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 9 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 (61 single-owned of 788 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; 788 of the 1203 production source files in this repository met that bar). They are anonymized user #10 (1 file(s)), anonymized user #11 (1 file(s)), anonymized user #12 (1 file(s)), anonymized user #13 (1 file(s)), anonymized user #14 (1 file(s)), anonymized user #15 (1 file(s)) (+3 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: packages/core/src/voice/whisperModelManager.ts, packages/cli/src/ui/hooks/creditsFlowHandler.ts, packages/cli/src/acp/acpCommandHandler.ts, evals/provenance_attribution.eval.ts, evals/shell_command_safety.eval.ts, packages/core/src/utils/pathMutex.ts, packages/cli/src/commands/extensions/configure.ts, packages/cli/src/deferred.ts (+1 more).
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found — 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/`.
D21 · Naming Consistency · `{ extensionManager, onClose, extensionName, settingKey, scope = ExtensionSettingScope.USER, configureAll, loggerAdapter, }` spells `USE` where 23 names in the project spell it `Use` · ×1
  • `{ extensionManager, onClose, extensionName, settingKey, scope = ExtensionSettingScope.USER, configureAll, loggerAdapter, }` spells `USE` where 23 names in the project spell it `Use` packages/cli/src/ui/components/ConfigExtensionDialog.tsx:56 — 23 of 24 names in project @google/gemini-cli spell the token `Use` (23 of 24; unit: names in project @google/gemini-cli containing `Use`). Peers: AcpFileSystemService.shouldUseFallback (packages/cli/src/acp/acpFileSystemService.ts:26); MockShellExecutionService.execute(shouldUseNodePty) (packages/cli/src/test-utils/MockShellExecutionService.ts:65); UseSuspendProps.shouldUseAlternateScreen (packages/cli/src/ui/hooks/useSuspend.ts:30); useSuspend.useSuspend({ handleWarning, setRawMode, shouldUseAlternateScreen, }) (packages/cli/src/ui/hooks/useSuspend.ts:33); commandUtils.shouldUseOsc52 (packages/cli/src/ui/utils/commandUtils.ts:172). Rename to `{ extensionManager, onClose, extensionName, settingKey, scope = ExtensionSettingScope.UseR, configureAll, loggerAdapter, }`. [rule N6]
D21 · Naming Consistency · `currentIDE` spells `IDE` where 34 names in the project spell it `Ide` · ×1
  • `currentIDE` spells `IDE` where 34 names in the project spell it `Ide` packages/cli/src/ui/contexts/UIStateContext.tsx:184 — 34 of 35 names in project @google/gemini-cli spell the token `Ide` (34 of 35; unit: names in project @google/gemini-cli containing `Ide`). Peers: about.getIdeClientName (packages/cli/src/acp/commands/about.ts:68); aboutCommand.getIdeClientName (packages/cli/src/ui/commands/aboutCommand.ts:71); bugCommand.getIdeClientName (packages/cli/src/ui/commands/bugCommand.ts:188); ideCommand.getIdeStatusMessage (packages/cli/src/ui/commands/ideCommand.ts:30); ideCommand.getIdeStatusMessageWithFiles (packages/cli/src/ui/commands/ideCommand.ts:85). Rename to `currentIde`. [rule N6]
D21 · Naming Consistency · `GeminiCLIExtension` spells `CLI` where 14 names in the project spell it `Cli` · ×1
  • `GeminiCLIExtension` spells `CLI` where 14 names in the project spell it `Cli` packages/core/src/config/config.ts:405 — 14 of 15 names in project @google/gemini-cli spell the token `Cli` (14 of 15; unit: names in project @google/gemini-cli containing `Cli`). Peers: utils.exitCli (packages/cli/src/commands/utils.ts:9); packages.cli.src.config.config.LoadCliConfigOptions (packages/cli/src/config/config.ts:653); config.loadCliConfig (packages/cli/src/config/config.ts:663); packages.cli.src.config.sandboxConfig.SandboxCliArgs (packages/cli/src/config/sandboxConfig.ts:23); formatError.isCliDebugEnabled (packages/cli/src/utils/formatError.ts:21). Rename to `GeminiCliExtension`. [rule N6]
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Low vulnerability · ×1
  • REDACTED
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 307 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: packages/core/src/hooks/types.ts, scripts/utils/eval-validate.ts, packages/core/src/tools/trackerTools.ts, packages/test-utils/src/perf-test-harness.ts, packages/cli/src/ui/hooks/useShellCompletion.ts, packages/core/src/context/contextCompressionService.ts, packages/cli/src/ui/utils/terminalSetup.ts, packages/cli/src/ui/utils/latexToUnicode.ts (and 299 more) (312 orphaned of 788 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; 788 of the 1203 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • 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.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 3/6 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`, `packages/devtools`, `packages/vscode-ide-companion`.
P3 · Security & performance tooling · Dependabot does not watch pip · ×1
  • Dependabot does not watch pip .github/dependabot.yml:2 — `.github/dependabot.yml` schedules updates, but no `package-ecosystem` entry covers `pip`, 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.
R7 · Dead Code · Unused export 'shortAsciiLogoCompactText' · ×1
  • Unused export 'shortAsciiLogoCompactText' packages/cli/src/ui/components/AsciiArt.ts:40 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'tinyAsciiLogoCompactText' · ×1
  • Unused export 'tinyAsciiLogoCompactText' packages/cli/src/ui/components/AsciiArt.ts:54 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'useAskUserActions' · ×1
  • Unused export 'useAskUserActions' packages/cli/src/ui/contexts/AskUserActionsContext.tsx:30 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'REDIRECTION_WARNING_NOTE_LABEL' · ×1
  • Unused export 'REDIRECTION_WARNING_NOTE_LABEL' packages/cli/src/ui/textConstants.ts:15 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'REDIRECTION_WARNING_NOTE_TEXT' · ×1
  • Unused export 'REDIRECTION_WARNING_NOTE_TEXT' packages/cli/src/ui/textConstants.ts:16 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'REDIRECTION_WARNING_TIP_LABEL' · ×1
  • Unused export 'REDIRECTION_WARNING_TIP_LABEL' packages/cli/src/ui/textConstants.ts:18 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'getRedirectionWarningTipText' · ×1
  • Unused export 'getRedirectionWarningTipText' packages/cli/src/ui/textConstants.ts:19 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'getSafeLowColorBackground' · ×1
  • Unused export 'getSafeLowColorBackground' packages/cli/src/ui/themes/color-utils.ts:62 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'LIGHT_THEME_LUMINANCE_THRESHOLD' · ×1
  • Unused export 'LIGHT_THEME_LUMINANCE_THRESHOLD' packages/cli/src/ui/themes/color-utils.ts:85 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'DARK_THEME_LUMINANCE_THRESHOLD' · ×1
  • Unused export 'DARK_THEME_LUMINANCE_THRESHOLD' packages/cli/src/ui/themes/color-utils.ts:86 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'ansiTheme' · ×1
  • Unused export 'ansiTheme' packages/cli/src/ui/themes/theme.ts:230 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'GeminiEventType' · ×1
  • Unused export 'GeminiEventType' packages/cli/src/ui/types.ts:58 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'isAnsiOutput' · ×1
  • Unused export 'isAnsiOutput' packages/cli/src/ui/types.ts:106 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'QUOTA_THRESHOLD_HIGH' · ×1
  • Unused export 'QUOTA_THRESHOLD_HIGH' packages/cli/src/ui/utils/displayUtils.ts:19 — Nothing imports this binding — it is safe to review for removal.
R7 · Dead Code · Unused export 'QUOTA_THRESHOLD_MEDIUM' · ×1
  • Unused export 'QUOTA_THRESHOLD_MEDIUM' packages/cli/src/ui/utils/displayUtils.ts:20 — Nothing imports this binding — it is safe to review for removal.
R8 · Dependency Hygiene · Test-only dependency 'marked' in production deps · ×1
  • Test-only dependency 'marked' in production deps REDACTED:76 — Only test files import it (first: packages/core/src/utils/memoryImportProcessor.test.ts:12) — move it to devDependencies.
X5 · Nullable reference types · Nullable reference types not enabled everywhere · ×1
  • 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.
Minor — 26 finding(s)
D10 · Test Quality · Skipped (documented) · ×21
  • Skipped (documented): (unnamed test) packages/vscode-ide-companion/src/ide-server.test.ts:719 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): (unnamed test) packages/core/src/utils/extensionLoader.test.ts:247 — Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
  • Skipped (documented): (unnamed test) packages/core/src/utils/pathReader.test.ts:524 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): (unnamed test) packages/core/src/utils/shell-utils.test.ts:588 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): (unnamed test) packages/core/src/utils/workspaceContext.test.ts:88 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): (unnamed test) packages/core/src/tools/write-file.test.ts:875 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): (unnamed test) packages/core/src/services/fileSystemService.atomic.test.ts:82 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): (unnamed test) packages/core/src/services/fileSystemService.atomic.test.ts:119 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): (unnamed test) packages/core/src/services/sandboxManager.integration.test.ts:208 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): (unnamed test) packages/core/src/services/sandboxManager.integration.test.ts:535 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): (unnamed test) packages/core/src/services/sandboxManager.integration.test.ts:1225 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): (unnamed test) packages/core/src/sandbox/windows/WindowsSandboxManager.test.ts:351 — Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
  • Skipped (documented): (unnamed test) packages/core/src/sandbox/windows/WindowsSandboxManager.test.ts:374 — Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
  • Skipped (documented): (unnamed test) packages/core/src/ide/ide-connection-utils.test.ts:508 — Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
  • Skipped (documented): (unnamed test) packages/core/src/ide/ide-connection-utils.test.ts:661 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): (unnamed test) packages/core/src/commands/memory.test.ts:526 — Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
  • Skipped (documented): (unnamed test) packages/core/src/commands/memory.test.ts:753 — Skipped with a documented reason — a deferral, not lazy debt: declared with no body — a pending test the runner lists but never runs
  • Skipped (documented): (unnamed test) packages/cli/src/utils/sessionCleanup.test.ts:669 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): (unnamed test) packages/cli/src/utils/sessionCleanup.test.ts:699 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): (unnamed test) integration-tests/browser-policy.test.ts:67 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): (unnamed test) integration-tests/hooks-system.test.ts:583 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
D24 · Comment Value · doc comments repeat the names · ×4
  • doc comments repeat the names REDACTED:142 — 9 of 190 documented parameters and 7 of 1103 summaries in `@google/gemini-cli` only repeat the member or parameter name (e.g. "The name of the extension." for `extensionName`). 3 documentation tag(s) are empty. Delete the restating tags, or add what the name does not say.
  • doc comments repeat the names REDACTED:254 — 31 of 577 documented parameters and 52 of 2545 summaries in `@google/gemini-cli-core` only repeat the member or parameter name (e.g. "The name of the agent." for `agentName`). 1 documentation tag(s) are empty. Delete the restating tags, or add what the name does not say.
  • doc comments repeat the names packages/sdk/src/types.ts:238 — 0 of 14 documented parameters and 1 of 55 summaries in `@google/gemini-cli-sdk` only repeat the member or parameter name (e.g. "The current session instance." for `session`). Delete the restating tags, or add what the name does not say.
  • doc comments repeat the names packages/test-utils/src/memory-test-harness.ts:50 — 0 of 18 documented parameters and 2 of 84 summaries in `@google/gemini-cli-test-utils` only repeat the member or parameter name (e.g. "Options for the MemoryTestHarness." for `MemoryTestHarnessOptions`). Delete the restating tags, or add what the name does not say.
D12 · Dependency Hygiene · Dependency hygiene PARTLY measured · ×1
  • Dependency hygiene PARTLY measured — Python dependencies read, no exact pin to grade for currency — This repository's Python dependencies were read: 9 shipped distribution(s) across 3 manifest(s) (0 development or optional declaration(s) excluded, because a consumer does not install them). Whether any of them is behind its current release is the dependency-CURRENCY question, and no declaration here carries an EXACT pin to ask it about — every one is a floor or a range, which installs the newest release it admits and therefore cannot be behind one. That is a healthy declaration style, NOT a defect and NOT a gap in this analyzer; there is simply no currency question to answer. This is NOT a finding that these dependencies are current or healthy. Lockfiles are deliberately not read (poetry.lock, uv.lock, Pipfile.lock, pdm.lock): the four disagree about dev/optional membership, and misreading one would charge a test-only package a consumer never receives. Known CVEs in the same dependency graph are a separate question, reported under D30.

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.

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-c5c22d5442ad44e0965ad96d5f191edb/history.json --exit-code 0 --source .0—
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude .gemini/skills/agent-tui --exclude .gemini/skills/behavioral-evals/references --exclude .gemini/skills/ci --exclude .gemini/skills/code-reviewer --exclude .gemini/skills/docs-changelog --exclude .gemini/skills/docs-writer --exclude .gemini/skills/github-issue-creator --exclude .gemini/skills/pr-address-comments --exclude .gemini/skills/pr-creator --exclude .gemini/skills/review-duplication --exclude .gemini/skills/string-reviewer --exclude .gemini/skills/tui-tester --exclude packages/cli/src/commands/extensions/examples/skills/skills --exclude packages/core/src/skills/builtin/antigravity-support --exclude packages/sdk/test-data --exclude tools/caretaker-agent/cloudrun/triage-worker/.gemini/skills --exclude tools/gemini-cli-bot/.gemini/skills .90artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .104artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .31artifacts/raw/trivy-config.json
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 16 file(s) — `packages/cli/src/config/settings.ts`, `packages/cli/src/config/settingsSchema.ts`, `packages/cli/src/nonInteractiveCliAgentSession.ts`, `packages/cli/src/ui/hooks/useAgentStream.ts`, `packages/cli/src/ui/hooks/useAtCompletion.ts`, … (+11 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.0—
D40 · Network Egress Confinementruntime-hardening—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.0—
D41 · Kernel & Syscall Confinementruntime-hardening—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.0—
D42 · Runtime Threat Enforcementruntime-hardening—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.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .0artifacts/raw/trivy-fs.json

Run 01a1cd41-5b9f-7ec0-b372-a6d4b28496c6 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

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.

⬇ Findings, MITRE CWE-tagged .sarif⬇ Health changelog .md