refactor(cli): group runtime modules by responsibility (#42378)

* refactor(cli): group runtime modules by responsibility

* test(cli): retain QR privacy and mounted AppImage observations
This commit is contained in:
Neil
2026-11-14 04:43:56 -08:00
committed by GitHub
parent aa4076f1e6
commit 8af94ff899
264 changed files with 550 additions and 708 deletions
@@ -18,7 +18,7 @@ import { formatWorktreeShow } from './workspace-format'
import { printHookWarning } from './worktree-removal-warnings'
import { printResult } from '../output/command-result-output'
import { getOptionalStringFlag, getOptionalStringFlagAllowingEmpty } from '../arguments/flags'
import { RuntimeClientError } from '../runtime/types'
import { RuntimeClientError } from '../runtime/connection/types'
import type { RuntimeClient } from '../runtime/client'
import type { RuntimeRpcSuccess } from '../../shared/runtime-rpc-envelope'
import { getWorktreeReadFlags } from './worktree-unread-flag'
+1 -1
View File
@@ -6,7 +6,7 @@ import type {
import type { RuntimeRpcSuccess } from '../../shared/runtime-rpc-envelope'
import type { CommandHandler, HandlerContext } from '../dispatch/dispatch'
import { printResult } from '../output/command-result-output'
import { RuntimeClientError } from '../runtime/types'
import { RuntimeClientError } from '../runtime/connection/types'
import {
formatWorkspaceCleanupPreview,
formatWorkspaceCleanupReport,
@@ -23,7 +23,7 @@ import {
} from '../agents/agent-launch-request'
import { formatWorktreeShow } from './workspace-format'
import { printResult } from '../output/command-result-output'
import { RuntimeClientError } from '../runtime/types'
import { RuntimeClientError } from '../runtime/connection/types'
import type { RuntimeClient } from '../runtime/client'
import { printLineageSummary } from './worktree-lineage-summary'
import { printHookWarning } from './worktree-removal-warnings'
@@ -1,6 +1,6 @@
import { isWorkspaceKey, worktreeWorkspaceKey } from '../../shared/workspace-scope'
import { getOptionalStringFlag } from '../arguments/flags'
import { RuntimeClientError } from '../runtime/types'
import { RuntimeClientError } from '../runtime/connection/types'
import type { RuntimeClient } from '../runtime/client'
import { getOptionalParentSelector } from '../workspace-selection/caller-folder-workspace'
import { resolveParentEnvironment, type ParentEnvironment } from './worktree-parent-environment'
@@ -2,7 +2,7 @@ import { parseRemoteProjectRefCandidate } from '../../main/gitlab/projects/proje
import type { Repo } from '../../shared/repo-types'
import type { RuntimeWorktreeRecord } from '../../shared/runtime-worktree-contracts'
import { parseGitLabIssueOrMRLink, type ProjectSlug } from '../../shared/new-workspace/gitlab-links'
import { RuntimeClientError } from '../runtime/types'
import { RuntimeClientError } from '../runtime/connection/types'
import type { RuntimeClient } from '../runtime/client'
import type { CliRepoTarget } from './worktree-project-target'
+1 -1
View File
@@ -1,5 +1,5 @@
import { parseGitLabIssueOrMRLink } from '../../shared/new-workspace/gitlab-links'
import { RuntimeClientError } from '../runtime/types'
import { RuntimeClientError } from '../runtime/connection/types'
import { getOptionalWorktreeLinkFlagValue } from './worktree-link-flag-value'
export type GitLabLinkKind = 'issue' | 'mr'
@@ -3,7 +3,7 @@ import {
LINEAR_ISSUE_LINK_CLEARED,
type LinearIssueLinkUpdates
} from '../../shared/linear/links'
import { RuntimeClientError } from '../runtime/types'
import { RuntimeClientError } from '../runtime/connection/types'
import { getOptionalWorktreeLinkFlagValue } from './worktree-link-flag-value'
export function getOptionalLinearIssueLinkFlag(
@@ -1,4 +1,4 @@
import { RuntimeClientError } from '../runtime/types'
import { RuntimeClientError } from '../runtime/connection/types'
export function getOptionalWorktreeLinkFlagValue(
flags: Map<string, string | boolean>,
@@ -13,7 +13,7 @@ import { getOptionalStringFlag } from '../arguments/flags'
import { mayNameFolderWorkspace } from '../workspace-selection/folder-workspace-selector'
import { isLocalEnvironmentSelector, LOCAL_ENVIRONMENT } from '../hosts/local-environment-selector'
import { RuntimeClient } from '../runtime/client'
import { RuntimeClientError } from '../runtime/types'
import { RuntimeClientError } from '../runtime/connection/types'
import type { RuntimeRpcSuccess } from '../../shared/runtime-rpc-envelope'
import { quoteCliCommandArgument } from '../arguments/shell-command-quote'
import { describeClientEnvironment, environmentLabel } from './workspace-address'
+1 -1
View File
@@ -10,7 +10,7 @@ import {
} from '../../shared/worktree-runtime-capabilities'
import { getOptionalStringFlag } from '../arguments/flags'
import { RuntimeClient } from '../runtime/client'
import { RuntimeClientError } from '../runtime/types'
import { RuntimeClientError } from '../runtime/connection/types'
import { resolveWorktreeCreateCwdContext } from '../workspace-selection/workspace-selector'
import { mayNameFolderWorkspace } from '../workspace-selection/folder-workspace-selector'
import { parentCwdNextSteps, withWorktreeSelectorRecovery } from './worktree-selector-recovery'
@@ -3,7 +3,7 @@ import type { ProjectHostSetup } from '../../shared/project-types'
import { hostFilterMatchesHostId, resolveHostFlagTarget } from '../hosts/execution-host-flag'
import { findProjectSetups, setupHostId } from '../projects/project-selector'
import type { RuntimeClient } from '../runtime/client'
import { RuntimeClientError } from '../runtime/types'
import { RuntimeClientError } from '../runtime/connection/types'
import { getPresentStringFlag } from '../arguments/flags'
import { getFolderWorkspaceMissingRepoError } from '../workspace-selection/caller-folder-workspace'
@@ -1,6 +1,6 @@
import { getOptionalStringFlag } from '../arguments/flags'
import { assertLocalCwdWorktreeSelector } from '../hosts/local-environment-selector'
import { RuntimeClientError } from '../runtime/types'
import { RuntimeClientError } from '../runtime/connection/types'
import type { RuntimeClient } from '../runtime/client'
import { resolveCurrentWorktreeSelector } from '../workspace-selection/workspace-selector'
import { quoteCliCommandArgument } from '../arguments/shell-command-quote'
@@ -2,7 +2,7 @@ import { z } from 'zod'
import { WORKTREE_REMOVE_BRANCH_POLICY_RUNTIME_CAPABILITY } from '../../shared/worktree-runtime-capabilities'
import type { RuntimeWorktreeRemoveResult } from '../../shared/runtime-worktree-contracts'
import { worktreeRemovalReplyTimeoutMs } from '../../shared/worktree/removal/archive-hook-removal-gate'
import { RuntimeClientError } from '../runtime/types'
import { RuntimeClientError } from '../runtime/connection/types'
import type { RuntimeClient } from '../runtime/client'
import type { RuntimeRpcSuccess } from '../../shared/runtime-rpc-envelope'
@@ -1,5 +1,5 @@
import { getOptionalNullableNumberFlag, getOptionalNumberFlag } from '../arguments/flags'
import { RuntimeClientError } from '../runtime/types'
import { RuntimeClientError } from '../runtime/connection/types'
import { getOptionalWorktreeLinkFlagValue } from './worktree-link-flag-value'
import { getOptionalGitLabLinkFlag } from './worktree-gitlab-link'
@@ -1,5 +1,5 @@
import { parseWorkspaceKey } from '../../shared/workspace-scope'
import { RuntimeClientError } from '../runtime/types'
import { RuntimeClientError } from '../runtime/connection/types'
import { attachCliErrorData } from './worktree-setup-decision-recovery'
// The runtime omits the typed selector from not-found errors; add it and its grammar at the CLI boundary.
@@ -1,5 +1,5 @@
import { getPresentStringFlag } from '../arguments/flags'
import { RuntimeClientError, RuntimeRpcFailureError } from '../runtime/types'
import { RuntimeClientError, RuntimeRpcFailureError } from '../runtime/connection/types'
// Hosts use generic runtime_error here; this message is the stable discriminator.
const SETUP_DECISION_REQUIRED = 'Setup decision required for this repository'
+1 -1
View File
@@ -1,4 +1,4 @@
import { RuntimeClientError } from '../runtime/types'
import { RuntimeClientError } from '../runtime/connection/types'
export function getWorktreeReadFlags(flags: Map<string, string | boolean>): {
isUnread?: boolean
+1 -1
View File
@@ -17,7 +17,7 @@ import {
annotateOmittedHostScope,
type WithAnnotatedHostScope
} from '../hosts/omitted-host-scope-selectors'
import { RuntimeClientError } from '../runtime/types'
import { RuntimeClientError } from '../runtime/connection/types'
import {
getOptionalPositiveIntegerFlag,
getOptionalStringFlag,