refactor(cli): organize command dispatch and orchestration owners (#41562)

* refactor(cli): organize command dispatch and orchestration owners

* test(orchestration): retire superseded unbound mail refusal case
This commit is contained in:
Neil
2026-11-12 08:12:55 -08:00
committed by GitHub
parent 757b1e6167
commit 560a22e00f
321 changed files with 1189 additions and 2569 deletions
@@ -8,8 +8,8 @@ import type { FolderWorkspace } from '../../shared/folder-workspaces/folder-work
import { FOLDER_WORKSPACE_UNIQUE_ID_MUTATION_RUNTIME_CAPABILITY } from '../../shared/worktree-runtime-capabilities'
import { folderIdOfSelector, folderWorkspaceKey } from '../../shared/workspace-scope'
import { formatWorktreeShow } from './workspace-format'
import { printResult } from '../command-result-output'
import { getOptionalStringFlag, getOptionalStringFlagAllowingEmpty } from '../flags'
import { printResult } from '../output/command-result-output'
import { getOptionalStringFlag, getOptionalStringFlagAllowingEmpty } from '../arguments/flags'
import { RuntimeClientError } from '../runtime/types'
import type { RuntimeClient } from '../runtime/client'
import type { RuntimeRpcSuccess } from '../../shared/runtime-rpc-envelope'
@@ -12,7 +12,7 @@ import {
selectEnclosingRepoOnHost,
selectEnclosingWorktreeSelectionOnHost
} from '../workspace-selection/caller-host-worktree-selection'
import { buildWorktree } from '../test-fixtures'
import { buildWorktree } from '../runtime/fixtures/runtime-rpc-fixtures'
import { toSshExecutionHostId } from '../../shared/execution-host'
const UPPER = String.raw`\\wsl.localhost\Ubuntu\home\Alice\App`
+1 -1
View File
@@ -4,7 +4,7 @@ import { parseWorkspaceKey } from '../../shared/workspace-scope'
import type { CrossStoreParentRef } from '../../shared/worktree/lineage-types'
import { LOCAL_ENVIRONMENT } from '../hosts/local-environment-selector'
import type { RuntimeClient } from '../runtime/client'
import { quoteCliCommandArgument } from '../shell-command-quote'
import { quoteCliCommandArgument } from '../arguments/shell-command-quote'
/** Which Orca answered: `local`, a saved environment, or a one-off pairing-code connection (id null). */
export type WorkspaceEnvironment = { id: string | null; name: string | null }
+2 -2
View File
@@ -1,5 +1,5 @@
import type { CommandHandler } from '../dispatch'
import { printResult } from '../command-result-output'
import type { CommandHandler } from '../dispatch/dispatch'
import { printResult } from '../output/command-result-output'
import { getRequiredWorktreeSelector } from '../workspace-selection/workspace-selector'
import { folderIdOfSelector } from '../../shared/workspace-scope'
import { refuseFolderWorkspaceActivation } from './folder-workspace-mutations'
@@ -22,7 +22,7 @@ import {
SURFACE_UNSUPPORTED_MESSAGE
} from '../agents/agent-launch-request'
import { formatWorktreeShow } from './workspace-format'
import { printResult } from '../command-result-output'
import { printResult } from '../output/command-result-output'
import { RuntimeClientError } from '../runtime/types'
import type { RuntimeClient } from '../runtime/client'
import { printLineageSummary } from './worktree-lineage-summary'
@@ -1,5 +1,5 @@
import { isWorkspaceKey, worktreeWorkspaceKey } from '../../shared/workspace-scope'
import { getOptionalStringFlag } from '../flags'
import { getOptionalStringFlag } from '../arguments/flags'
import { RuntimeClientError } from '../runtime/types'
import type { RuntimeClient } from '../runtime/client'
import { getOptionalParentSelector } from '../workspace-selection/caller-folder-workspace'
@@ -1,4 +1,4 @@
import type { HandlerGroup } from '../handler-group-manifest'
import type { HandlerGroup } from '../dispatch/handler-group-manifest'
export const WORKTREE_HANDLER_GROUPS: readonly HandlerGroup[] = [
{
@@ -9,13 +9,13 @@ import {
WORKTREE_CROSS_STORE_LINEAGE_RUNTIME_CAPABILITY
} from '../../shared/worktree-runtime-capabilities'
import { getOptionalParentSelector } from '../workspace-selection/caller-folder-workspace'
import { getOptionalStringFlag } from '../flags'
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 type { RuntimeRpcSuccess } from '../../shared/runtime-rpc-envelope'
import { quoteCliCommandArgument } from '../shell-command-quote'
import { quoteCliCommandArgument } from '../arguments/shell-command-quote'
import { describeClientEnvironment, environmentLabel } from './workspace-address'
import { attachCliErrorData } from './worktree-setup-decision-recovery'
+1 -1
View File
@@ -8,7 +8,7 @@ import {
assertFolderParentSetSupported,
supportsCrossStoreLineage
} from '../../shared/worktree-runtime-capabilities'
import { getOptionalStringFlag } from '../flags'
import { getOptionalStringFlag } from '../arguments/flags'
import { RuntimeClient } from '../runtime/client'
import { RuntimeClientError } from '../runtime/types'
import { resolveWorktreeCreateCwdContext } from '../workspace-selection/workspace-selector'
@@ -4,7 +4,7 @@ import { hostFilterMatchesHostId, resolveHostFlagTarget } from '../hosts/executi
import { findProjectSetups, setupHostId } from '../projects/project-selector'
import type { RuntimeClient } from '../runtime/client'
import { RuntimeClientError } from '../runtime/types'
import { getPresentStringFlag } from '../flags'
import { getPresentStringFlag } from '../arguments/flags'
import { getFolderWorkspaceMissingRepoError } from '../workspace-selection/caller-folder-workspace'
export type ProjectCreateTarget = {
@@ -1,9 +1,9 @@
import { getOptionalStringFlag } from '../flags'
import { getOptionalStringFlag } from '../arguments/flags'
import { assertLocalCwdWorktreeSelector } from '../hosts/local-environment-selector'
import { RuntimeClientError } from '../runtime/types'
import type { RuntimeClient } from '../runtime/client'
import { resolveCurrentWorktreeSelector } from '../workspace-selection/workspace-selector'
import { quoteCliCommandArgument } from '../shell-command-quote'
import { quoteCliCommandArgument } from '../arguments/shell-command-quote'
/** What current/active names right now: one selector, the ambiguous choices, or nothing. */
async function describeCurrent(
@@ -1,4 +1,4 @@
import { getOptionalNullableNumberFlag, getOptionalNumberFlag } from '../flags'
import { getOptionalNullableNumberFlag, getOptionalNumberFlag } from '../arguments/flags'
import { RuntimeClientError } from '../runtime/types'
import { getOptionalWorktreeLinkFlagValue } from './worktree-link-flag-value'
import { getOptionalGitLabLinkFlag } from './worktree-gitlab-link'
@@ -1,4 +1,4 @@
import { getPresentStringFlag } from '../flags'
import { getPresentStringFlag } from '../arguments/flags'
import { RuntimeClientError, RuntimeRpcFailureError } from '../runtime/types'
// Hosts use generic runtime_error here; this message is the stable discriminator.
+4 -4
View File
@@ -7,12 +7,12 @@ import type {
RuntimeWorktreeSetResult,
RuntimeWorktreeCreateResult
} from '../../shared/runtime-worktree-contracts'
import type { CommandHandler } from '../dispatch'
import type { CommandHandler } from '../dispatch/dispatch'
import { printHookWarning, printPreservedBranchWarning } from './worktree-removal-warnings'
import { requestWorktreeRemoval } from './worktree-removal-request'
import { removeIfFolderWorkspace, setIfFolderWorkspace } from './folder-workspace-mutations'
import { formatWorktreeList, formatWorktreePs, formatWorktreeShow } from './workspace-format'
import { printResult } from '../command-result-output'
import { printResult } from '../output/command-result-output'
import {
annotateOmittedHostScope,
type WithAnnotatedHostScope
@@ -24,7 +24,7 @@ import {
getOptionalStringFlagAllowingEmpty,
getPresentStringFlag,
getRequiredStringFlag
} from '../flags'
} from '../arguments/flags'
import {
getRequiredWorktreeSelector,
resolveWorktreeCreateCwdContext,
@@ -62,7 +62,7 @@ import {
assertReferenceWritesSupported,
getCreateReferenceInputs,
resolveReferenceInputs
} from '../reference-input'
} from '../references/reference-input'
function getOptionalStartupAgent(flags: Map<string, string | boolean>): TuiAgent | undefined {
const agent = getPresentStringFlag(flags, 'agent')