@cerbur/clutch-dsh-worktree 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -46
- package/README.zh.md +92 -40
- package/lib/client/WorktreeSurface.d.ts +4 -7
- package/lib/client/WorktreeSurface.d.ts.map +1 -1
- package/lib/client/WorktreeSurface.js +44 -1243
- package/lib/client/WorktreeSurface.js.map +1 -1
- package/lib/client/{WorktreeContext.d.ts → context/WorktreeContext.d.ts} +2 -2
- package/lib/client/context/WorktreeContext.d.ts.map +1 -0
- package/lib/client/{WorktreeContext.js → context/WorktreeContext.js} +1 -1
- package/lib/client/context/WorktreeContext.js.map +1 -0
- package/lib/client/{WorktreeHeroContext.d.ts → context/WorktreeHeroContext.d.ts} +1 -1
- package/lib/client/context/WorktreeHeroContext.d.ts.map +1 -0
- package/lib/client/{WorktreeHeroContext.js → context/WorktreeHeroContext.js} +1 -1
- package/lib/client/context/WorktreeHeroContext.js.map +1 -0
- package/lib/client/{worktree-context-store.d.ts → context/worktree-context-store.d.ts} +7 -15
- package/lib/client/context/worktree-context-store.d.ts.map +1 -0
- package/lib/client/{worktree-context-store.js → context/worktree-context-store.js} +20 -13
- package/lib/client/context/worktree-context-store.js.map +1 -0
- package/lib/client/{worktree-context.d.ts → context/worktree-context.d.ts} +1 -1
- package/lib/client/context/worktree-context.d.ts.map +1 -0
- package/lib/client/{worktree-context.js → context/worktree-context.js} +5 -3
- package/lib/client/context/worktree-context.js.map +1 -0
- package/lib/client/dsh-slot-contract.d.ts +43 -0
- package/lib/client/dsh-slot-contract.d.ts.map +1 -0
- package/lib/client/dsh-slot-contract.js +2 -0
- package/lib/client/dsh-slot-contract.js.map +1 -0
- package/lib/client/entry.d.ts +3 -3
- package/lib/client/entry.d.ts.map +1 -1
- package/lib/client/entry.js +168 -38
- package/lib/client/entry.js.map +1 -1
- package/lib/client/index.d.ts +3 -3
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/index.js +2 -2
- package/lib/client/index.js.map +1 -1
- package/lib/client/locales.d.ts +66 -0
- package/lib/client/locales.d.ts.map +1 -1
- package/lib/client/locales.js +76 -10
- package/lib/client/locales.js.map +1 -1
- package/lib/client/{WorktreeOverlay.d.ts → overlay/WorktreeOverlay.d.ts} +2 -2
- package/lib/client/overlay/WorktreeOverlay.d.ts.map +1 -0
- package/lib/client/{WorktreeOverlay.js → overlay/WorktreeOverlay.js} +2 -2
- package/lib/client/overlay/WorktreeOverlay.js.map +1 -0
- package/lib/client/overlay/overlay-bounds.d.ts.map +1 -0
- package/lib/client/overlay/overlay-bounds.js.map +1 -0
- package/lib/client/overlay/sidebar-overlay-geometry.d.ts.map +1 -0
- package/lib/client/overlay/sidebar-overlay-geometry.js.map +1 -0
- package/lib/client/permission/worktree-permission-icon.d.ts.map +1 -0
- package/lib/client/permission/worktree-permission-icon.js.map +1 -0
- package/lib/client/permission/worktree-permission.d.ts.map +1 -0
- package/lib/client/permission/worktree-permission.js.map +1 -0
- package/lib/client/session/session-view.d.ts.map +1 -0
- package/lib/client/session/session-view.js.map +1 -0
- package/lib/client/session/virtual-workspace-membership.d.ts +29 -0
- package/lib/client/session/virtual-workspace-membership.d.ts.map +1 -0
- package/lib/client/session/virtual-workspace-membership.js +131 -0
- package/lib/client/session/virtual-workspace-membership.js.map +1 -0
- package/lib/client/{worktree-session-fork.d.ts → session/worktree-session-fork.d.ts} +25 -4
- package/lib/client/session/worktree-session-fork.d.ts.map +1 -0
- package/lib/client/session/worktree-session-fork.js +309 -0
- package/lib/client/session/worktree-session-fork.js.map +1 -0
- package/lib/client/{worktree-session-order.d.ts → session/worktree-session-order.d.ts} +2 -2
- package/lib/client/session/worktree-session-order.d.ts.map +1 -0
- package/lib/client/session/worktree-session-order.js.map +1 -0
- package/lib/client/session/worktree-session-position.d.ts.map +1 -0
- package/lib/client/session/worktree-session-position.js.map +1 -0
- package/lib/client/{worktree-session.d.ts → session/worktree-session.d.ts} +3 -3
- package/lib/client/session/worktree-session.d.ts.map +1 -0
- package/lib/client/{worktree-session.js → session/worktree-session.js} +3 -3
- package/lib/client/session/worktree-session.js.map +1 -0
- package/lib/client/surface/actions/lifecycle-commands.d.ts +9 -0
- package/lib/client/surface/actions/lifecycle-commands.d.ts.map +1 -0
- package/lib/client/surface/actions/lifecycle-commands.js +243 -0
- package/lib/client/surface/actions/lifecycle-commands.js.map +1 -0
- package/lib/client/surface/actions/useDragActions.d.ts +26 -0
- package/lib/client/surface/actions/useDragActions.d.ts.map +1 -0
- package/lib/client/surface/actions/useDragActions.js +125 -0
- package/lib/client/surface/actions/useDragActions.js.map +1 -0
- package/lib/client/surface/actions/useLifecycleActions.d.ts +30 -0
- package/lib/client/surface/actions/useLifecycleActions.d.ts.map +1 -0
- package/lib/client/surface/actions/useLifecycleActions.js +140 -0
- package/lib/client/surface/actions/useLifecycleActions.js.map +1 -0
- package/lib/client/surface/actions/useNativeActions.d.ts +48 -0
- package/lib/client/surface/actions/useNativeActions.d.ts.map +1 -0
- package/lib/client/surface/actions/useNativeActions.js +182 -0
- package/lib/client/surface/actions/useNativeActions.js.map +1 -0
- package/lib/client/surface/actions/useSessionActions.d.ts +24 -0
- package/lib/client/surface/actions/useSessionActions.d.ts.map +1 -0
- package/lib/client/surface/actions/useSessionActions.js +116 -0
- package/lib/client/surface/actions/useSessionActions.js.map +1 -0
- package/lib/client/surface/actions/useSurfaceMutation.d.ts +15 -0
- package/lib/client/surface/actions/useSurfaceMutation.d.ts.map +1 -0
- package/lib/client/surface/actions/useSurfaceMutation.js +24 -0
- package/lib/client/surface/actions/useSurfaceMutation.js.map +1 -0
- package/lib/client/surface/actions/useWorktreeRegistration.d.ts +31 -0
- package/lib/client/surface/actions/useWorktreeRegistration.d.ts.map +1 -0
- package/lib/client/surface/actions/useWorktreeRegistration.js +203 -0
- package/lib/client/surface/actions/useWorktreeRegistration.js.map +1 -0
- package/lib/client/surface/actions/worktree-cleanup-flow.d.ts +10 -0
- package/lib/client/surface/actions/worktree-cleanup-flow.d.ts.map +1 -0
- package/lib/client/surface/actions/worktree-cleanup-flow.js +19 -0
- package/lib/client/surface/actions/worktree-cleanup-flow.js.map +1 -0
- package/lib/client/surface/components/AccessConfirmation.d.ts +9 -0
- package/lib/client/surface/components/AccessConfirmation.d.ts.map +1 -0
- package/lib/client/surface/components/AccessConfirmation.js +18 -0
- package/lib/client/surface/components/AccessConfirmation.js.map +1 -0
- package/lib/client/surface/components/ActiveWorktree.d.ts +28 -0
- package/lib/client/surface/components/ActiveWorktree.d.ts.map +1 -0
- package/lib/client/surface/components/ActiveWorktree.js +154 -0
- package/lib/client/surface/components/ActiveWorktree.js.map +1 -0
- package/lib/client/surface/components/ArchivedWorktree.d.ts +24 -0
- package/lib/client/surface/components/ArchivedWorktree.d.ts.map +1 -0
- package/lib/client/surface/components/ArchivedWorktree.js +145 -0
- package/lib/client/surface/components/ArchivedWorktree.js.map +1 -0
- package/lib/client/surface/components/ArchivedWorktrees.d.ts +25 -0
- package/lib/client/surface/components/ArchivedWorktrees.d.ts.map +1 -0
- package/lib/client/surface/components/ArchivedWorktrees.js +20 -0
- package/lib/client/surface/components/ArchivedWorktrees.js.map +1 -0
- package/lib/client/surface/components/LifecycleDialogs.d.ts +20 -0
- package/lib/client/surface/components/LifecycleDialogs.d.ts.map +1 -0
- package/lib/client/surface/components/LifecycleDialogs.js +31 -0
- package/lib/client/surface/components/LifecycleDialogs.js.map +1 -0
- package/lib/client/surface/components/NativeDialogs.d.ts +9 -0
- package/lib/client/surface/components/NativeDialogs.d.ts.map +1 -0
- package/lib/client/surface/components/NativeDialogs.js +14 -0
- package/lib/client/surface/components/NativeDialogs.js.map +1 -0
- package/lib/client/surface/components/NotificationToasts.d.ts +7 -0
- package/lib/client/surface/components/NotificationToasts.d.ts.map +1 -0
- package/lib/client/surface/components/NotificationToasts.js +24 -0
- package/lib/client/surface/components/NotificationToasts.js.map +1 -0
- package/lib/client/surface/components/RegistrationDialog.d.ts +15 -0
- package/lib/client/surface/components/RegistrationDialog.d.ts.map +1 -0
- package/lib/client/surface/components/RegistrationDialog.js +22 -0
- package/lib/client/surface/components/RegistrationDialog.js.map +1 -0
- package/lib/client/surface/components/SurfaceContent.d.ts +31 -0
- package/lib/client/surface/components/SurfaceContent.d.ts.map +1 -0
- package/lib/client/surface/components/SurfaceContent.js +65 -0
- package/lib/client/surface/components/SurfaceContent.js.map +1 -0
- package/lib/client/surface/components/SurfaceHeader.d.ts +15 -0
- package/lib/client/surface/components/SurfaceHeader.d.ts.map +1 -0
- package/lib/client/surface/components/SurfaceHeader.js +42 -0
- package/lib/client/surface/components/SurfaceHeader.js.map +1 -0
- package/lib/client/surface/components/WorkspaceTree.d.ts +32 -0
- package/lib/client/surface/components/WorkspaceTree.d.ts.map +1 -0
- package/lib/client/surface/components/WorkspaceTree.js +145 -0
- package/lib/client/surface/components/WorkspaceTree.js.map +1 -0
- package/lib/client/{worktree-surface-dialogs.d.ts → surface/components/dialogs.d.ts} +5 -2
- package/lib/client/surface/components/dialogs.d.ts.map +1 -0
- package/lib/client/{worktree-surface-dialogs.js → surface/components/dialogs.js} +67 -24
- package/lib/client/surface/components/dialogs.js.map +1 -0
- package/lib/client/{worktree-surface-rows.d.ts → surface/components/rows.d.ts} +3 -3
- package/lib/client/surface/components/rows.d.ts.map +1 -0
- package/lib/client/{worktree-surface-rows.js → surface/components/rows.js} +79 -17
- package/lib/client/surface/components/rows.js.map +1 -0
- package/lib/client/surface/notification-queue.d.ts +11 -0
- package/lib/client/surface/notification-queue.d.ts.map +1 -0
- package/lib/client/surface/notification-queue.js +19 -0
- package/lib/client/surface/notification-queue.js.map +1 -0
- package/lib/client/{worktree-surface-selectors.d.ts → surface/selectors.d.ts} +10 -5
- package/lib/client/surface/selectors.d.ts.map +1 -0
- package/lib/client/{worktree-surface-selectors.js → surface/selectors.js} +23 -6
- package/lib/client/surface/selectors.js.map +1 -0
- package/lib/client/surface/shared.d.ts +40 -0
- package/lib/client/surface/shared.d.ts.map +1 -0
- package/lib/client/surface/shared.js +53 -0
- package/lib/client/surface/shared.js.map +1 -0
- package/lib/client/surface/state/useLifecycleState.d.ts +34 -0
- package/lib/client/surface/state/useLifecycleState.d.ts.map +1 -0
- package/lib/client/surface/state/useLifecycleState.js +39 -0
- package/lib/client/surface/state/useLifecycleState.js.map +1 -0
- package/lib/client/surface/state/useRegistrationState.d.ts +34 -0
- package/lib/client/surface/state/useRegistrationState.d.ts.map +1 -0
- package/lib/client/surface/state/useRegistrationState.js +44 -0
- package/lib/client/surface/state/useRegistrationState.js.map +1 -0
- package/lib/client/surface/state/useSessionExpansion.d.ts +39 -0
- package/lib/client/surface/state/useSessionExpansion.d.ts.map +1 -0
- package/lib/client/surface/state/useSessionExpansion.js +230 -0
- package/lib/client/surface/state/useSessionExpansion.js.map +1 -0
- package/lib/client/surface/state/useSessionOrdering.d.ts +15 -0
- package/lib/client/surface/state/useSessionOrdering.d.ts.map +1 -0
- package/lib/client/surface/state/useSessionOrdering.js +68 -0
- package/lib/client/surface/state/useSessionOrdering.js.map +1 -0
- package/lib/client/surface/state/useSurfaceMenus.d.ts +9 -0
- package/lib/client/surface/state/useSurfaceMenus.d.ts.map +1 -0
- package/lib/client/surface/state/useSurfaceMenus.js +15 -0
- package/lib/client/surface/state/useSurfaceMenus.js.map +1 -0
- package/lib/client/surface/state/useSurfaceRefresh.d.ts +39 -0
- package/lib/client/surface/state/useSurfaceRefresh.d.ts.map +1 -0
- package/lib/client/surface/state/useSurfaceRefresh.js +274 -0
- package/lib/client/surface/state/useSurfaceRefresh.js.map +1 -0
- package/lib/client/surface/state/useSurfaceSources.d.ts +31 -0
- package/lib/client/surface/state/useSurfaceSources.d.ts.map +1 -0
- package/lib/client/surface/state/useSurfaceSources.js +63 -0
- package/lib/client/surface/state/useSurfaceSources.js.map +1 -0
- package/lib/client/{worktree-surface-types.d.ts → surface/types.d.ts} +68 -13
- package/lib/client/surface/types.d.ts.map +1 -0
- package/lib/client/surface/types.js +2 -0
- package/lib/client/surface/types.js.map +1 -0
- package/lib/client/{WorktreeModeAction.d.ts → view/WorktreeModeAction.d.ts} +1 -1
- package/lib/client/view/WorktreeModeAction.d.ts.map +1 -0
- package/lib/client/{WorktreeModeAction.js → view/WorktreeModeAction.js} +1 -1
- package/lib/client/view/WorktreeModeAction.js.map +1 -0
- package/lib/client/view/navigation.d.ts.map +1 -0
- package/lib/client/view/navigation.js.map +1 -0
- package/lib/client/{view-mode-store.d.ts → view/view-mode-store.d.ts} +1 -1
- package/lib/client/view/view-mode-store.d.ts.map +1 -0
- package/lib/client/{view-mode-store.js → view/view-mode-store.js} +1 -1
- package/lib/client/view/view-mode-store.js.map +1 -0
- package/lib/client/{view-mode.d.ts → view/view-mode.d.ts} +20 -6
- package/lib/client/view/view-mode.d.ts.map +1 -0
- package/lib/client/{view-mode.js → view/view-mode.js} +35 -10
- package/lib/client/view/view-mode.js.map +1 -0
- package/lib/client/{worktree-error-copy.d.ts → view/worktree-error-copy.d.ts} +2 -2
- package/lib/client/view/worktree-error-copy.d.ts.map +1 -0
- package/lib/client/view/worktree-error-copy.js.map +1 -0
- package/lib/client/{worktree-expand-state.d.ts → view/worktree-expand-state.d.ts} +6 -4
- package/lib/client/view/worktree-expand-state.d.ts.map +1 -0
- package/lib/client/{worktree-expand-state.js → view/worktree-expand-state.js} +11 -0
- package/lib/client/view/worktree-expand-state.js.map +1 -0
- package/lib/client/{worktree-view-actions.d.ts → view/worktree-view-actions.d.ts} +11 -5
- package/lib/client/view/worktree-view-actions.d.ts.map +1 -0
- package/lib/client/{worktree-view-actions.js → view/worktree-view-actions.js} +13 -11
- package/lib/client/view/worktree-view-actions.js.map +1 -0
- package/lib/client/view/worktree-view-errors.d.ts.map +1 -0
- package/lib/client/view/worktree-view-errors.js.map +1 -0
- package/lib/client/{worktree-view-read.d.ts → view/worktree-view-read.d.ts} +21 -9
- package/lib/client/view/worktree-view-read.d.ts.map +1 -0
- package/lib/client/{worktree-view-read.js → view/worktree-view-read.js} +78 -10
- package/lib/client/view/worktree-view-read.js.map +1 -0
- package/lib/client/view/worktree-view.d.ts.map +1 -0
- package/lib/client/view/worktree-view.js.map +1 -0
- package/lib/client/worktree-connection.d.ts +5 -0
- package/lib/client/worktree-connection.d.ts.map +1 -1
- package/lib/client/worktree-connection.js +16 -0
- package/lib/client/worktree-connection.js.map +1 -1
- package/lib/client.js +5990 -3139
- package/lib/client.js.map +1 -1
- package/lib/contract/index.contract.js +10 -0
- package/lib/contract/index.contract.js.map +1 -1
- package/lib/contract/index.d.ts +46 -3
- package/lib/contract/index.d.ts.map +1 -1
- package/lib/contract/index.js +7 -0
- package/lib/contract/index.js.map +1 -1
- package/lib/host/dsh-read-adapter.d.ts +10 -1
- package/lib/host/dsh-read-adapter.d.ts.map +1 -1
- package/lib/host/dsh-read-adapter.js +18 -1
- package/lib/host/dsh-read-adapter.js.map +1 -1
- package/lib/host/remote.d.ts.map +1 -1
- package/lib/host/remote.js +14 -0
- package/lib/host/remote.js.map +1 -1
- package/lib/host/service.d.ts +24 -0
- package/lib/host/service.d.ts.map +1 -1
- package/lib/host/service.js +39 -1
- package/lib/host/service.js.map +1 -1
- package/lib/host/worktree-activity.d.ts +13 -0
- package/lib/host/worktree-activity.d.ts.map +1 -0
- package/lib/host/worktree-activity.js +23 -0
- package/lib/host/worktree-activity.js.map +1 -0
- package/lib/host/worktree-permission-manager.js +2 -2
- package/lib/host/worktree-permission-manager.js.map +1 -1
- package/lib/host/worktree-permission.d.ts +3 -2
- package/lib/host/worktree-permission.d.ts.map +1 -1
- package/lib/host/worktree-permission.js +29 -5
- package/lib/host/worktree-permission.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/manage/manager-context.d.ts +2 -1
- package/lib/manage/manager-context.d.ts.map +1 -1
- package/lib/manage/manager-sessions.js +4 -4
- package/lib/manage/manager-sessions.js.map +1 -1
- package/lib/manage/manager-worktree-lifecycle.d.ts +23 -0
- package/lib/manage/manager-worktree-lifecycle.d.ts.map +1 -0
- package/lib/manage/manager-worktree-lifecycle.js +165 -0
- package/lib/manage/manager-worktree-lifecycle.js.map +1 -0
- package/lib/manage/manager-worktrees.d.ts +1 -6
- package/lib/manage/manager-worktrees.d.ts.map +1 -1
- package/lib/manage/manager-worktrees.js +83 -114
- package/lib/manage/manager-worktrees.js.map +1 -1
- package/lib/manage/manager.d.ts +17 -1
- package/lib/manage/manager.d.ts.map +1 -1
- package/lib/manage/manager.js +25 -6
- package/lib/manage/manager.js.map +1 -1
- package/lib/provider/generated-name.d.ts +8 -0
- package/lib/provider/generated-name.d.ts.map +1 -0
- package/lib/provider/generated-name.js +29 -0
- package/lib/provider/generated-name.js.map +1 -0
- package/lib/provider/{git.d.ts → git/adapter.d.ts} +2 -2
- package/lib/provider/git/adapter.d.ts.map +1 -0
- package/lib/provider/{git.js → git/adapter.js} +15 -2
- package/lib/provider/git/adapter.js.map +1 -0
- package/lib/provider/{repository-fingerprint.d.ts → git/repository-fingerprint.d.ts} +1 -1
- package/lib/provider/git/repository-fingerprint.d.ts.map +1 -0
- package/lib/provider/git/repository-fingerprint.js.map +1 -0
- package/lib/provider/{subprocess.d.ts → git/subprocess.d.ts} +1 -1
- package/lib/provider/git/subprocess.d.ts.map +1 -0
- package/lib/provider/{subprocess.js → git/subprocess.js} +8 -0
- package/lib/provider/git/subprocess.js.map +1 -0
- package/lib/provider/git/worktree-status.d.ts +5 -0
- package/lib/provider/git/worktree-status.d.ts.map +1 -0
- package/lib/provider/git/worktree-status.js +23 -0
- package/lib/provider/git/worktree-status.js.map +1 -0
- package/lib/provider/index.d.ts +5 -5
- package/lib/provider/index.d.ts.map +1 -1
- package/lib/provider/index.js +5 -5
- package/lib/provider/index.js.map +1 -1
- package/lib/provider/mutation-token.d.ts +1 -1
- package/lib/provider/mutation-token.d.ts.map +1 -1
- package/lib/provider/mutation-token.js +1 -0
- package/lib/provider/mutation-token.js.map +1 -1
- package/lib/provider/sidecar/mutation-lock.d.ts.map +1 -0
- package/lib/provider/{mutation-lock.js → sidecar/mutation-lock.js} +1 -1
- package/lib/provider/sidecar/mutation-lock.js.map +1 -0
- package/lib/provider/{sidecar.d.ts → sidecar/repository.d.ts} +3 -3
- package/lib/provider/sidecar/repository.d.ts.map +1 -0
- package/lib/provider/{sidecar.js → sidecar/repository.js} +13 -6
- package/lib/provider/sidecar/repository.js.map +1 -0
- package/lib/provider/{sidecar-persistence.d.ts → sidecar/sidecar-persistence.d.ts} +1 -1
- package/lib/provider/sidecar/sidecar-persistence.d.ts.map +1 -0
- package/lib/provider/{sidecar-persistence.js → sidecar/sidecar-persistence.js} +29 -2
- package/lib/provider/sidecar/sidecar-persistence.js.map +1 -0
- package/lib/provider/{sidecar-schema.d.ts → sidecar/sidecar-schema.d.ts} +1 -1
- package/lib/provider/sidecar/sidecar-schema.d.ts.map +1 -0
- package/lib/provider/{sidecar-schema.js → sidecar/sidecar-schema.js} +52 -16
- package/lib/provider/sidecar/sidecar-schema.js.map +1 -0
- package/lib/provider/transaction/dependencies.d.ts +10 -0
- package/lib/provider/transaction/dependencies.d.ts.map +1 -0
- package/lib/provider/transaction/dependencies.js +2 -0
- package/lib/provider/transaction/dependencies.js.map +1 -0
- package/lib/provider/transaction/index.d.ts +17 -0
- package/lib/provider/transaction/index.d.ts.map +1 -0
- package/lib/provider/transaction/index.js +44 -0
- package/lib/provider/transaction/index.js.map +1 -0
- package/lib/provider/transaction/operations/adopt-branch.d.ts +6 -0
- package/lib/provider/transaction/operations/adopt-branch.d.ts.map +1 -0
- package/lib/provider/transaction/operations/adopt-branch.js +59 -0
- package/lib/provider/transaction/operations/adopt-branch.js.map +1 -0
- package/lib/provider/transaction/operations/clean.d.ts +4 -0
- package/lib/provider/transaction/operations/clean.d.ts.map +1 -0
- package/lib/provider/transaction/operations/clean.js +168 -0
- package/lib/provider/transaction/operations/clean.js.map +1 -0
- package/lib/provider/transaction/operations/create.d.ts +5 -0
- package/lib/provider/transaction/operations/create.d.ts.map +1 -0
- package/lib/provider/transaction/operations/create.js +136 -0
- package/lib/provider/transaction/operations/create.js.map +1 -0
- package/lib/provider/transaction/operations/import.d.ts +5 -0
- package/lib/provider/transaction/operations/import.d.ts.map +1 -0
- package/lib/provider/transaction/operations/import.js +92 -0
- package/lib/provider/transaction/operations/import.js.map +1 -0
- package/lib/provider/transaction/operations/remove.d.ts +4 -0
- package/lib/provider/transaction/operations/remove.d.ts.map +1 -0
- package/lib/provider/transaction/operations/remove.js +164 -0
- package/lib/provider/transaction/operations/remove.js.map +1 -0
- package/lib/provider/transaction/recovery/failure-recovery.d.ts +32 -0
- package/lib/provider/transaction/recovery/failure-recovery.d.ts.map +1 -0
- package/lib/provider/transaction/recovery/failure-recovery.js +147 -0
- package/lib/provider/transaction/recovery/failure-recovery.js.map +1 -0
- package/lib/provider/transaction/recovery/recover.d.ts +4 -0
- package/lib/provider/transaction/recovery/recover.d.ts.map +1 -0
- package/lib/provider/transaction/recovery/recover.js +162 -0
- package/lib/provider/transaction/recovery/recover.js.map +1 -0
- package/lib/provider/transaction/support/admission.d.ts +7 -0
- package/lib/provider/transaction/support/admission.d.ts.map +1 -0
- package/lib/provider/transaction/support/admission.js +90 -0
- package/lib/provider/transaction/support/admission.js.map +1 -0
- package/lib/provider/transaction/support/inspection.d.ts +11 -0
- package/lib/provider/transaction/support/inspection.d.ts.map +1 -0
- package/lib/provider/transaction/support/inspection.js +51 -0
- package/lib/provider/transaction/support/inspection.js.map +1 -0
- package/lib/provider/transaction/support/journal.d.ts +12 -0
- package/lib/provider/transaction/support/journal.d.ts.map +1 -0
- package/lib/provider/transaction/support/journal.js +72 -0
- package/lib/provider/transaction/support/journal.js.map +1 -0
- package/lib/provider/transaction/support/locking.d.ts +4 -0
- package/lib/provider/transaction/support/locking.d.ts.map +1 -0
- package/lib/provider/transaction/support/locking.js +11 -0
- package/lib/provider/transaction/support/locking.js.map +1 -0
- package/lib/provider/transaction/support/path-safety.d.ts +11 -0
- package/lib/provider/transaction/support/path-safety.d.ts.map +1 -0
- package/lib/provider/transaction/support/path-safety.js +82 -0
- package/lib/provider/transaction/support/path-safety.js.map +1 -0
- package/lib/provider/transaction/support/paths.d.ts +10 -0
- package/lib/provider/transaction/support/paths.d.ts.map +1 -0
- package/lib/provider/transaction/support/paths.js +68 -0
- package/lib/provider/transaction/support/paths.js.map +1 -0
- package/lib/provider/transaction/support/publication.d.ts +9 -0
- package/lib/provider/transaction/support/publication.d.ts.map +1 -0
- package/lib/provider/transaction/support/publication.js +92 -0
- package/lib/provider/transaction/support/publication.js.map +1 -0
- package/lib/provider/transaction/types.d.ts +38 -0
- package/lib/provider/transaction/types.d.ts.map +1 -0
- package/lib/provider/transaction/types.js +2 -0
- package/lib/provider/transaction/types.js.map +1 -0
- package/lib/provider/types.d.ts +22 -3
- package/lib/provider/types.d.ts.map +1 -1
- package/lib/provider/types.js +1 -1
- package/lib/provider/types.js.map +1 -1
- package/lib/provider/worktree-lifecycle.d.ts +19 -0
- package/lib/provider/worktree-lifecycle.d.ts.map +1 -0
- package/lib/provider/worktree-lifecycle.js +44 -0
- package/lib/provider/worktree-lifecycle.js.map +1 -0
- package/lib/typert.host.js +269 -30
- package/lib/typert.remote-client.d.ts +10 -0
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +269 -30
- package/package.json +48 -34
- package/lib/client/WorktreeContext.d.ts.map +0 -1
- package/lib/client/WorktreeContext.js.map +0 -1
- package/lib/client/WorktreeHeroContext.d.ts.map +0 -1
- package/lib/client/WorktreeHeroContext.js.map +0 -1
- package/lib/client/WorktreeModeAction.d.ts.map +0 -1
- package/lib/client/WorktreeModeAction.js.map +0 -1
- package/lib/client/WorktreeOverlay.d.ts.map +0 -1
- package/lib/client/WorktreeOverlay.js.map +0 -1
- package/lib/client/navigation.d.ts.map +0 -1
- package/lib/client/navigation.js.map +0 -1
- package/lib/client/overlay-bounds.d.ts.map +0 -1
- package/lib/client/overlay-bounds.js.map +0 -1
- package/lib/client/session-view.d.ts.map +0 -1
- package/lib/client/session-view.js.map +0 -1
- package/lib/client/sidebar-overlay-geometry.d.ts.map +0 -1
- package/lib/client/sidebar-overlay-geometry.js.map +0 -1
- package/lib/client/view-mode-store.d.ts.map +0 -1
- package/lib/client/view-mode-store.js.map +0 -1
- package/lib/client/view-mode.d.ts.map +0 -1
- package/lib/client/view-mode.js.map +0 -1
- package/lib/client/virtual-workspace-membership.d.ts +0 -27
- package/lib/client/virtual-workspace-membership.d.ts.map +0 -1
- package/lib/client/virtual-workspace-membership.js +0 -106
- package/lib/client/virtual-workspace-membership.js.map +0 -1
- package/lib/client/worktree-context-store.d.ts.map +0 -1
- package/lib/client/worktree-context-store.js.map +0 -1
- package/lib/client/worktree-context.d.ts.map +0 -1
- package/lib/client/worktree-context.js.map +0 -1
- package/lib/client/worktree-error-copy.d.ts.map +0 -1
- package/lib/client/worktree-error-copy.js.map +0 -1
- package/lib/client/worktree-expand-state.d.ts.map +0 -1
- package/lib/client/worktree-expand-state.js.map +0 -1
- package/lib/client/worktree-permission-icon.d.ts.map +0 -1
- package/lib/client/worktree-permission-icon.js.map +0 -1
- package/lib/client/worktree-permission.d.ts.map +0 -1
- package/lib/client/worktree-permission.js.map +0 -1
- package/lib/client/worktree-session-fork.d.ts.map +0 -1
- package/lib/client/worktree-session-fork.js +0 -174
- package/lib/client/worktree-session-fork.js.map +0 -1
- package/lib/client/worktree-session-order.d.ts.map +0 -1
- package/lib/client/worktree-session-order.js.map +0 -1
- package/lib/client/worktree-session-position.d.ts.map +0 -1
- package/lib/client/worktree-session-position.js.map +0 -1
- package/lib/client/worktree-session.d.ts.map +0 -1
- package/lib/client/worktree-session.js.map +0 -1
- package/lib/client/worktree-surface-dialogs.d.ts.map +0 -1
- package/lib/client/worktree-surface-dialogs.js.map +0 -1
- package/lib/client/worktree-surface-rows.d.ts.map +0 -1
- package/lib/client/worktree-surface-rows.js.map +0 -1
- package/lib/client/worktree-surface-selectors.d.ts.map +0 -1
- package/lib/client/worktree-surface-selectors.js.map +0 -1
- package/lib/client/worktree-surface-types.d.ts.map +0 -1
- package/lib/client/worktree-surface-types.js +0 -2
- package/lib/client/worktree-surface-types.js.map +0 -1
- package/lib/client/worktree-view-actions.d.ts.map +0 -1
- package/lib/client/worktree-view-actions.js.map +0 -1
- package/lib/client/worktree-view-errors.d.ts.map +0 -1
- package/lib/client/worktree-view-errors.js.map +0 -1
- package/lib/client/worktree-view-read.d.ts.map +0 -1
- package/lib/client/worktree-view-read.js.map +0 -1
- package/lib/client/worktree-view.d.ts.map +0 -1
- package/lib/client/worktree-view.js.map +0 -1
- package/lib/provider/git.d.ts.map +0 -1
- package/lib/provider/git.js.map +0 -1
- package/lib/provider/mutation-lock.d.ts.map +0 -1
- package/lib/provider/mutation-lock.js.map +0 -1
- package/lib/provider/repository-fingerprint.d.ts.map +0 -1
- package/lib/provider/repository-fingerprint.js.map +0 -1
- package/lib/provider/sidecar-persistence.d.ts.map +0 -1
- package/lib/provider/sidecar-persistence.js.map +0 -1
- package/lib/provider/sidecar-schema.d.ts.map +0 -1
- package/lib/provider/sidecar-schema.js.map +0 -1
- package/lib/provider/sidecar.d.ts.map +0 -1
- package/lib/provider/sidecar.js.map +0 -1
- package/lib/provider/subprocess.d.ts.map +0 -1
- package/lib/provider/subprocess.js.map +0 -1
- package/lib/provider/transaction.d.ts +0 -65
- package/lib/provider/transaction.d.ts.map +0 -1
- package/lib/provider/transaction.js +0 -1011
- package/lib/provider/transaction.js.map +0 -1
- /package/lib/client/{overlay-bounds.d.ts → overlay/overlay-bounds.d.ts} +0 -0
- /package/lib/client/{overlay-bounds.js → overlay/overlay-bounds.js} +0 -0
- /package/lib/client/{sidebar-overlay-geometry.d.ts → overlay/sidebar-overlay-geometry.d.ts} +0 -0
- /package/lib/client/{sidebar-overlay-geometry.js → overlay/sidebar-overlay-geometry.js} +0 -0
- /package/lib/client/{worktree-permission-icon.d.ts → permission/worktree-permission-icon.d.ts} +0 -0
- /package/lib/client/{worktree-permission-icon.js → permission/worktree-permission-icon.js} +0 -0
- /package/lib/client/{worktree-permission.d.ts → permission/worktree-permission.d.ts} +0 -0
- /package/lib/client/{worktree-permission.js → permission/worktree-permission.js} +0 -0
- /package/lib/client/{session-view.d.ts → session/session-view.d.ts} +0 -0
- /package/lib/client/{session-view.js → session/session-view.js} +0 -0
- /package/lib/client/{worktree-session-order.js → session/worktree-session-order.js} +0 -0
- /package/lib/client/{worktree-session-position.d.ts → session/worktree-session-position.d.ts} +0 -0
- /package/lib/client/{worktree-session-position.js → session/worktree-session-position.js} +0 -0
- /package/lib/client/{navigation.d.ts → view/navigation.d.ts} +0 -0
- /package/lib/client/{navigation.js → view/navigation.js} +0 -0
- /package/lib/client/{worktree-error-copy.js → view/worktree-error-copy.js} +0 -0
- /package/lib/client/{worktree-view-errors.d.ts → view/worktree-view-errors.d.ts} +0 -0
- /package/lib/client/{worktree-view-errors.js → view/worktree-view-errors.js} +0 -0
- /package/lib/client/{worktree-view.d.ts → view/worktree-view.d.ts} +0 -0
- /package/lib/client/{worktree-view.js → view/worktree-view.js} +0 -0
- /package/lib/provider/{repository-fingerprint.js → git/repository-fingerprint.js} +0 -0
- /package/lib/provider/{mutation-lock.d.ts → sidecar/mutation-lock.d.ts} +0 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { runWorktreeCleanupFlow } from './worktree-cleanup-flow.js';
|
|
2
|
+
import { executeWorktreeAction, toWorktreeViewError } from '../../view/worktree-view.js';
|
|
3
|
+
import { bindingIdsFor } from '../selectors.js';
|
|
4
|
+
/** Archive, disk cleanup and forget retain their separate commit/recovery semantics. */
|
|
5
|
+
export function createLifecycleCommands({ props, lifecycleState, mutation, lifecycle, expansion, read, session, }) {
|
|
6
|
+
const { manager, permission, onPermissionNotice, onWorktreeForgotten } = props;
|
|
7
|
+
const { worktreeBranchAdoption, setWorktreeBranchAdoption, worktreeRemoval, setWorktreeRemoval, setWorktreeCleanDisk, cleanupGuard, setWorktreeForget, } = lifecycleState;
|
|
8
|
+
const { runMutation, setActionError, setActionPending } = mutation;
|
|
9
|
+
const { cleanDiskTarget, forgetTarget } = lifecycle;
|
|
10
|
+
const { suppressCurrentSessionReveal, clearSessionGroups } = expansion;
|
|
11
|
+
const { readStateRef, setReadState, refresh, readState } = read;
|
|
12
|
+
const { pendingSessionBinding, setPendingSessionBinding } = session;
|
|
13
|
+
const confirmBranchAdoption = () => {
|
|
14
|
+
const target = worktreeBranchAdoption;
|
|
15
|
+
if (!manager || !target?.mutationToken || typeof target.currentBranch !== 'string')
|
|
16
|
+
return;
|
|
17
|
+
const expectedBranch = target.currentBranch;
|
|
18
|
+
const mutationToken = target.mutationToken;
|
|
19
|
+
void runMutation(async () => {
|
|
20
|
+
await manager.adoptWorktreeBranch({
|
|
21
|
+
workspaceId: target.workspaceId,
|
|
22
|
+
worktreeId: target.worktreeId,
|
|
23
|
+
mutationToken,
|
|
24
|
+
expectedBranch,
|
|
25
|
+
});
|
|
26
|
+
setWorktreeBranchAdoption(undefined);
|
|
27
|
+
}, { scope: { kind: 'workspace', workspaceId: target.workspaceId }, preserveCurrent: true });
|
|
28
|
+
};
|
|
29
|
+
const confirmArchive = () => {
|
|
30
|
+
if (manager === undefined || worktreeRemoval === undefined)
|
|
31
|
+
return;
|
|
32
|
+
const target = worktreeRemoval;
|
|
33
|
+
const mutationToken = target.mutationToken;
|
|
34
|
+
if (mutationToken === undefined) {
|
|
35
|
+
setActionError({
|
|
36
|
+
code: 'WORKTREE_STATE_CONFLICT',
|
|
37
|
+
message: '',
|
|
38
|
+
retryable: true,
|
|
39
|
+
details: {
|
|
40
|
+
workspaceId: target.workspaceId,
|
|
41
|
+
worktreeId: target.worktreeId,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
void runMutation(async () => {
|
|
47
|
+
await executeWorktreeAction(manager, {
|
|
48
|
+
type: 'removeWorktree',
|
|
49
|
+
input: {
|
|
50
|
+
workspaceId: target.workspaceId,
|
|
51
|
+
worktreeId: target.worktreeId,
|
|
52
|
+
mutationToken,
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
suppressCurrentSessionReveal('archived:' + target.workspaceId);
|
|
56
|
+
setWorktreeRemoval(undefined);
|
|
57
|
+
}, {
|
|
58
|
+
scope: { kind: 'workspace', workspaceId: target.workspaceId },
|
|
59
|
+
preserveCurrent: true,
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
const confirmDiskCleanup = () => {
|
|
63
|
+
if (manager === undefined || cleanDiskTarget === undefined)
|
|
64
|
+
return;
|
|
65
|
+
const target = cleanDiskTarget;
|
|
66
|
+
const mutationToken = target.mutationToken;
|
|
67
|
+
if (mutationToken === undefined) {
|
|
68
|
+
setActionError({
|
|
69
|
+
code: 'WORKTREE_STATE_CONFLICT',
|
|
70
|
+
message: '',
|
|
71
|
+
retryable: true,
|
|
72
|
+
details: {
|
|
73
|
+
workspaceId: target.workspaceId,
|
|
74
|
+
worktreeId: target.worktreeId,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const generation = cleanupGuard.current.begin();
|
|
80
|
+
const isCurrent = () => cleanupGuard.current.isCurrent(generation) &&
|
|
81
|
+
readStateRef.current.views.some((view) => view.workspaceId === target.workspaceId &&
|
|
82
|
+
view.worktrees.some((record) => record.worktreeId === target.worktreeId));
|
|
83
|
+
setActionPending(true);
|
|
84
|
+
setActionError(undefined);
|
|
85
|
+
void runWorktreeCleanupFlow({
|
|
86
|
+
clean: async () => {
|
|
87
|
+
await executeWorktreeAction(manager, {
|
|
88
|
+
type: 'cleanWorktree',
|
|
89
|
+
input: {
|
|
90
|
+
workspaceId: target.workspaceId,
|
|
91
|
+
worktreeId: target.worktreeId,
|
|
92
|
+
mutationToken,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
onCommitted: () => {
|
|
97
|
+
setWorktreeCleanDisk(undefined);
|
|
98
|
+
setReadState((current) => {
|
|
99
|
+
if (current.status !== 'ready')
|
|
100
|
+
return current;
|
|
101
|
+
return {
|
|
102
|
+
...current,
|
|
103
|
+
views: current.views.map((v) => {
|
|
104
|
+
if (v.workspaceId !== target.workspaceId)
|
|
105
|
+
return v;
|
|
106
|
+
return {
|
|
107
|
+
...v,
|
|
108
|
+
worktrees: v.worktrees.map((w) => {
|
|
109
|
+
if (w.worktreeId !== target.worktreeId)
|
|
110
|
+
return w;
|
|
111
|
+
return {
|
|
112
|
+
...w,
|
|
113
|
+
status: 'removed',
|
|
114
|
+
diskCleanup: 'completed',
|
|
115
|
+
health: 'cleaned',
|
|
116
|
+
mutationToken: undefined,
|
|
117
|
+
};
|
|
118
|
+
}),
|
|
119
|
+
bindings: v.bindings.map((b) => {
|
|
120
|
+
if (b.worktreeId !== target.worktreeId)
|
|
121
|
+
return b;
|
|
122
|
+
return {
|
|
123
|
+
...b,
|
|
124
|
+
status: 'detached',
|
|
125
|
+
};
|
|
126
|
+
}),
|
|
127
|
+
};
|
|
128
|
+
}),
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
refresh: async () => {
|
|
133
|
+
await refresh({
|
|
134
|
+
scope: { kind: 'workspace', workspaceId: target.workspaceId },
|
|
135
|
+
preserveCurrent: true,
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
normalize: async () => {
|
|
139
|
+
if (permission?.normalizeDetachedWorktreePermissions === undefined)
|
|
140
|
+
return;
|
|
141
|
+
try {
|
|
142
|
+
const result = await permission.normalizeDetachedWorktreePermissions({
|
|
143
|
+
workspaceId: target.workspaceId,
|
|
144
|
+
worktreeId: target.worktreeId,
|
|
145
|
+
});
|
|
146
|
+
if (result !== undefined && isCurrent()) {
|
|
147
|
+
onPermissionNotice?.({
|
|
148
|
+
workspaceId: target.workspaceId,
|
|
149
|
+
worktreeId: target.worktreeId,
|
|
150
|
+
}, result);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
if (isCurrent()) {
|
|
155
|
+
onPermissionNotice?.({
|
|
156
|
+
workspaceId: target.workspaceId,
|
|
157
|
+
worktreeId: target.worktreeId,
|
|
158
|
+
}, {
|
|
159
|
+
status: 'unverified',
|
|
160
|
+
retryable: true,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
isCurrent,
|
|
166
|
+
onFollowUpError: () => {
|
|
167
|
+
// Follow-up errors do not fail the clean mutation
|
|
168
|
+
},
|
|
169
|
+
})
|
|
170
|
+
.catch((error) => {
|
|
171
|
+
if (isCurrent())
|
|
172
|
+
setActionError(toWorktreeViewError(error));
|
|
173
|
+
})
|
|
174
|
+
.finally(() => {
|
|
175
|
+
if (isCurrent())
|
|
176
|
+
setActionPending(false);
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
const confirmForget = () => {
|
|
180
|
+
if (manager === undefined || forgetTarget === undefined)
|
|
181
|
+
return;
|
|
182
|
+
const target = forgetTarget;
|
|
183
|
+
const mutationToken = target.mutationToken;
|
|
184
|
+
if (mutationToken === undefined) {
|
|
185
|
+
setActionError({
|
|
186
|
+
code: 'WORKTREE_STATE_CONFLICT',
|
|
187
|
+
message: '',
|
|
188
|
+
retryable: true,
|
|
189
|
+
details: {
|
|
190
|
+
workspaceId: target.workspaceId,
|
|
191
|
+
worktreeId: target.worktreeId,
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const targetBindings = readState.status === 'ready'
|
|
197
|
+
? (readState.views.find((v) => v.workspaceId === target.workspaceId)?.bindings ?? [])
|
|
198
|
+
: [];
|
|
199
|
+
const affectedSessionIds = bindingIdsFor(targetBindings, target.worktreeId);
|
|
200
|
+
void runMutation(async () => {
|
|
201
|
+
await executeWorktreeAction(manager, {
|
|
202
|
+
type: 'forgetWorktree',
|
|
203
|
+
input: {
|
|
204
|
+
workspaceId: target.workspaceId,
|
|
205
|
+
worktreeId: target.worktreeId,
|
|
206
|
+
mutationToken,
|
|
207
|
+
},
|
|
208
|
+
});
|
|
209
|
+
cleanupGuard.current.invalidate();
|
|
210
|
+
onWorktreeForgotten?.({
|
|
211
|
+
workspaceId: target.workspaceId,
|
|
212
|
+
worktreeId: target.worktreeId,
|
|
213
|
+
sessionIds: affectedSessionIds,
|
|
214
|
+
});
|
|
215
|
+
if (pendingSessionBinding?.worktreeId === target.worktreeId) {
|
|
216
|
+
setPendingSessionBinding(undefined);
|
|
217
|
+
}
|
|
218
|
+
clearSessionGroups(['worktree:' + target.worktreeId]);
|
|
219
|
+
setReadState((current) => {
|
|
220
|
+
if (current.status !== 'ready')
|
|
221
|
+
return current;
|
|
222
|
+
return {
|
|
223
|
+
...current,
|
|
224
|
+
views: current.views.map((v) => {
|
|
225
|
+
if (v.workspaceId !== target.workspaceId)
|
|
226
|
+
return v;
|
|
227
|
+
return {
|
|
228
|
+
...v,
|
|
229
|
+
worktrees: v.worktrees.filter((w) => w.worktreeId !== target.worktreeId),
|
|
230
|
+
bindings: v.bindings.filter((b) => b.worktreeId !== target.worktreeId),
|
|
231
|
+
};
|
|
232
|
+
}),
|
|
233
|
+
};
|
|
234
|
+
});
|
|
235
|
+
setWorktreeForget(undefined);
|
|
236
|
+
}, {
|
|
237
|
+
scope: { kind: 'workspace', workspaceId: target.workspaceId },
|
|
238
|
+
preserveCurrent: true,
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
return { confirmBranchAdoption, confirmArchive, confirmDiskCleanup, confirmForget };
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=lifecycle-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle-commands.js","sourceRoot":"","sources":["../../../../src/client/surface/actions/lifecycle-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EA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tC,CAAC;YACD,kBAAkB,CAAC,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;YACtD,YAAY,CAAC,CAAC,OAAO,EAAE,EAAE;gBACvB,IAAI,OAAO,CAAC,MAAM,KAAK,OAAO;oBAAE,OAAO,OAAO,CAAC;gBAC/C,OAAO;oBACL,GAAG,OAAO;oBACV,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;wBAC7B,IAAI,CAAC,CAAC,WAAW,KAAK,MAAM,CAAC,WAAW;4BAAE,OAAO,CAAC,CAAC;wBACnD,OAAO;4BACL,GAAG,CAAC;4BACJ,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,MAAM,CAAC,UAAU,CAAC;4BACxE,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,MAAM,CAAC,UAAU,CAAC;yBACvE,CAAC;oBACJ,CAAC,CAAC;iBACH,CAAC;YACJ,CAAC,CAAC,CAAC;YACH,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAC/B,CAAC,EACD;YACE,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE;YAC7D,eAAe,EAAE,IAAI;SACtB,CACF,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAC;AACtF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SessionDragState, WorkspaceDragState, WorktreeDragState, WorktreeSurfaceProps } from '../types.js';
|
|
2
|
+
import type { useSurfaceMutation } from './useSurfaceMutation.js';
|
|
3
|
+
import type { useSurfaceRefresh } from '../state/useSurfaceRefresh.js';
|
|
4
|
+
import type { useSurfaceSources } from '../state/useSurfaceSources.js';
|
|
5
|
+
type Input = {
|
|
6
|
+
source: Pick<ReturnType<typeof useSurfaceSources>, 'workspaces' | 'sessionOrderSnapshot'>;
|
|
7
|
+
props: Pick<WorktreeSurfaceProps, 'insertWorkspaceBefore' | 'insertSessionBefore' | 'sessionOrder' | 'insertWorktreeBefore'>;
|
|
8
|
+
mutation: Pick<ReturnType<typeof useSurfaceMutation>, 'setActionError'>;
|
|
9
|
+
read: Pick<ReturnType<typeof useSurfaceRefresh>, 'refresh'>;
|
|
10
|
+
};
|
|
11
|
+
export declare function useDragActions({ source, props, mutation, read }: Input): {
|
|
12
|
+
workspaceDrag: WorkspaceDragState | undefined;
|
|
13
|
+
setWorkspaceDrag: import("react").Dispatch<import("react").SetStateAction<WorkspaceDragState | undefined>>;
|
|
14
|
+
workspaceDropCommitted: import("react").MutableRefObject<boolean>;
|
|
15
|
+
sessionDrag: SessionDragState | undefined;
|
|
16
|
+
setSessionDrag: import("react").Dispatch<import("react").SetStateAction<SessionDragState | undefined>>;
|
|
17
|
+
sessionDropCommitted: import("react").MutableRefObject<boolean>;
|
|
18
|
+
worktreeDrag: WorktreeDragState | undefined;
|
|
19
|
+
setWorktreeDrag: import("react").Dispatch<import("react").SetStateAction<WorktreeDragState | undefined>>;
|
|
20
|
+
worktreeDropCommitted: import("react").MutableRefObject<boolean>;
|
|
21
|
+
commitWorkspaceDrag: (activeDrag: WorkspaceDragState, over: NonNullable<WorkspaceDragState["over"]>) => void;
|
|
22
|
+
commitSessionDrag: (activeDrag: SessionDragState, over: NonNullable<SessionDragState["over"]>, sessionIds: readonly string[], workspaceId: string) => void;
|
|
23
|
+
commitWorktreeDrag: (activeDrag: WorktreeDragState, over: NonNullable<WorktreeDragState["over"]>, worktreeIds: readonly string[], workspaceId: string) => void;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=useDragActions.d.ts.map
|
|
@@ -0,0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|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { useRef, useState } from 'react';
|
|
2
|
+
import { reorderSessionIds } from '../../session/worktree-session-order.js';
|
|
3
|
+
import { resolveWorktreeMove, toRetryableWorktreeOrderError, toWorktreeViewError, } from '../../view/worktree-view.js';
|
|
4
|
+
export function useDragActions({ source, props, mutation, read }) {
|
|
5
|
+
const { workspaces, sessionOrderSnapshot } = source;
|
|
6
|
+
const { insertWorkspaceBefore, insertSessionBefore, sessionOrder, insertWorktreeBefore } = props;
|
|
7
|
+
const { setActionError } = mutation;
|
|
8
|
+
const { refresh } = read;
|
|
9
|
+
const [workspaceDrag, setWorkspaceDrag] = useState();
|
|
10
|
+
const workspaceDropCommitted = useRef(false);
|
|
11
|
+
const [sessionDrag, setSessionDrag] = useState();
|
|
12
|
+
const sessionDropCommitted = useRef(false);
|
|
13
|
+
const [worktreeDrag, setWorktreeDrag] = useState();
|
|
14
|
+
const worktreeDropCommitted = useRef(false);
|
|
15
|
+
const commitWorkspaceDrag = (activeDrag, over) => {
|
|
16
|
+
if (workspaceDropCommitted.current)
|
|
17
|
+
return;
|
|
18
|
+
workspaceDropCommitted.current = true;
|
|
19
|
+
setWorkspaceDrag(undefined);
|
|
20
|
+
const rows = workspaces.items;
|
|
21
|
+
const targetIndex = rows.findIndex((workspace) => workspace.workspaceId === over.workspaceId);
|
|
22
|
+
const sourceIndex = rows.findIndex((workspace) => workspace.workspaceId === activeDrag.workspaceId);
|
|
23
|
+
if (targetIndex === -1 || sourceIndex === -1)
|
|
24
|
+
return;
|
|
25
|
+
const beforeWorkspaceId = over.half === 'before' ? over.workspaceId : rows[targetIndex + 1]?.workspaceId;
|
|
26
|
+
const anchorIndex = beforeWorkspaceId === undefined
|
|
27
|
+
? rows.length
|
|
28
|
+
: rows.findIndex((workspace) => workspace.workspaceId === beforeWorkspaceId);
|
|
29
|
+
if (beforeWorkspaceId === activeDrag.workspaceId ||
|
|
30
|
+
anchorIndex === sourceIndex ||
|
|
31
|
+
anchorIndex === sourceIndex + 1) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (insertWorkspaceBefore === undefined) {
|
|
35
|
+
setActionError({
|
|
36
|
+
code: 'WORKSPACE_ORDER_UNAVAILABLE',
|
|
37
|
+
message: '',
|
|
38
|
+
retryable: true,
|
|
39
|
+
});
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
setActionError(undefined);
|
|
43
|
+
void insertWorkspaceBefore(activeDrag.workspaceId, beforeWorkspaceId).catch((error) => {
|
|
44
|
+
setActionError(toWorktreeViewError(error));
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
const commitSessionDrag = (activeDrag, over, sessionIds, workspaceId) => {
|
|
48
|
+
if (sessionDropCommitted.current)
|
|
49
|
+
return;
|
|
50
|
+
sessionDropCommitted.current = true;
|
|
51
|
+
setSessionDrag(undefined);
|
|
52
|
+
const targetIndex = sessionIds.indexOf(over.sessionId);
|
|
53
|
+
const sourceIndex = sessionIds.indexOf(activeDrag.sessionId);
|
|
54
|
+
if (targetIndex === -1 || sourceIndex === -1)
|
|
55
|
+
return;
|
|
56
|
+
const beforeSessionId = over.half === 'before' ? over.sessionId : sessionIds[targetIndex + 1];
|
|
57
|
+
const anchorIndex = beforeSessionId === undefined ? sessionIds.length : sessionIds.indexOf(beforeSessionId);
|
|
58
|
+
if (beforeSessionId === activeDrag.sessionId ||
|
|
59
|
+
anchorIndex === sourceIndex ||
|
|
60
|
+
anchorIndex === sourceIndex + 1) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (insertSessionBefore === undefined) {
|
|
64
|
+
setActionError({
|
|
65
|
+
code: 'SESSION_ORDER_UNAVAILABLE',
|
|
66
|
+
message: '',
|
|
67
|
+
retryable: true,
|
|
68
|
+
});
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
setActionError(undefined);
|
|
72
|
+
const currentOrder = sessionOrderSnapshot.accounts[activeDrag.groupKey]?.order ?? sessionIds;
|
|
73
|
+
void insertSessionBefore(workspaceId, activeDrag.sessionId, beforeSessionId)
|
|
74
|
+
.then(() => {
|
|
75
|
+
sessionOrder.actions.setOrder(activeDrag.groupKey, reorderSessionIds(currentOrder, activeDrag.sessionId, over.sessionId, over.half));
|
|
76
|
+
})
|
|
77
|
+
.catch((error) => {
|
|
78
|
+
setActionError(toWorktreeViewError(error));
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
const commitWorktreeDrag = (activeDrag, over, worktreeIds, workspaceId) => {
|
|
82
|
+
if (worktreeDropCommitted.current)
|
|
83
|
+
return;
|
|
84
|
+
worktreeDropCommitted.current = true;
|
|
85
|
+
setWorktreeDrag(undefined);
|
|
86
|
+
if (activeDrag.workspaceId !== workspaceId)
|
|
87
|
+
return;
|
|
88
|
+
const move = resolveWorktreeMove(worktreeIds, activeDrag.worktreeId, over.worktreeId, over.half);
|
|
89
|
+
if (move === undefined)
|
|
90
|
+
return;
|
|
91
|
+
if (insertWorktreeBefore === undefined) {
|
|
92
|
+
setActionError({
|
|
93
|
+
code: 'WORKTREE_ORDER_UNAVAILABLE',
|
|
94
|
+
message: '',
|
|
95
|
+
retryable: true,
|
|
96
|
+
});
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
setActionError(undefined);
|
|
100
|
+
void insertWorktreeBefore(workspaceId, activeDrag.worktreeId, move.beforeWorktreeId)
|
|
101
|
+
.then(() => refresh({
|
|
102
|
+
scope: { kind: 'workspace', workspaceId },
|
|
103
|
+
preserveCurrent: true,
|
|
104
|
+
invalidateContext: false,
|
|
105
|
+
}))
|
|
106
|
+
.catch((error) => {
|
|
107
|
+
setActionError(toRetryableWorktreeOrderError(error));
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
return {
|
|
111
|
+
workspaceDrag,
|
|
112
|
+
setWorkspaceDrag,
|
|
113
|
+
workspaceDropCommitted,
|
|
114
|
+
sessionDrag,
|
|
115
|
+
setSessionDrag,
|
|
116
|
+
sessionDropCommitted,
|
|
117
|
+
worktreeDrag,
|
|
118
|
+
setWorktreeDrag,
|
|
119
|
+
worktreeDropCommitted,
|
|
120
|
+
commitWorkspaceDrag,
|
|
121
|
+
commitSessionDrag,
|
|
122
|
+
commitWorktreeDrag,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=useDragActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDragActions.js","sourceRoot":"","sources":["../../../../src/client/surface/actions/useDragActions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAC7B,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AAqBrC,MAAM,UAAU,cAAc,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAS;IACrE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC;IACpD,MAAM,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,YAAY,EAAE,oBAAoB,EAAE,GAAG,KAAK,CAAC;IACjG,MAAM,EAAE,cAAc,EAAE,GAAG,QAAQ,CAAC;IACpC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACzB,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,EAAsB,CAAC;IACzE,MAAM,sBAAsB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,EAAoB,CAAC;IACnE,MAAM,oBAAoB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC3C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,EAAqB,CAAC;IACtE,MAAM,qBAAqB,GAAG,M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AI,EAAE,4BAA4B;gBAClC,OAAO,EAAE,EAAE;gBACX,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QACD,cAAc,CAAC,SAAS,CAAC,CAAC;QAC1B,KAAK,oBAAoB,CAAC,WAAW,EAAE,UAAU,CAAC,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC;aACjF,IAAI,CAAC,GAAG,EAAE,CACT,OAAO,CAAC;YACN,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE;YACzC,eAAe,EAAE,IAAI;YACrB,iBAAiB,EAAE,KAAK;SACzB,CAAC,CACH;aACA,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACf,cAAc,CAAC,6BAA6B,CAAC,KAAK,CAAC,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IACF,OAAO;QACL,aAAa;QACb,gBAAgB;QAChB,sBAAsB;QACtB,WAAW;QACX,cAAc;QACd,oBAAoB;QACpB,YAAY;QACZ,eAAe;QACf,qBAAqB;QACrB,mBAAmB;QACnB,iBAAiB;QACjB,kBAAkB;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { WorktreeRecord } from '../../../contract/index.js';
|
|
2
|
+
import { type WorktreeViewError } from '../../view/worktree-view.js';
|
|
3
|
+
import type { WorktreeSurfaceProps } from '../types.js';
|
|
4
|
+
import type { useLifecycleState } from '../state/useLifecycleState.js';
|
|
5
|
+
import type { useSurfaceMutation } from './useSurfaceMutation.js';
|
|
6
|
+
import type { useSurfaceRefresh } from '../state/useSurfaceRefresh.js';
|
|
7
|
+
import type { useSurfaceSources } from '../state/useSurfaceSources.js';
|
|
8
|
+
type Input = {
|
|
9
|
+
read: Pick<ReturnType<typeof useSurfaceRefresh>, 'viewByWorkspace' | 'readStateRef' | 'refresh' | 'setReadState'>;
|
|
10
|
+
lifecycleState: Pick<ReturnType<typeof useLifecycleState>, 'worktreeCleanDisk' | 'worktreeForget' | 'permissionRetryPending' | 'cleanupGuard' | 'setWorktreeBranchAdoption' | 'worktreeBranchAdoption' | 'branchAdoptionGuard'>;
|
|
11
|
+
source: Pick<ReturnType<typeof useSurfaceSources>, 'mode' | 'permissionNoticeSnapshot' | 'workspaceIdsRef'>;
|
|
12
|
+
props: Pick<WorktreeSurfaceProps, 'permission' | 'permissionNotice' | 'onPermissionNotice' | 'manager' | 't' | 'viewReader'>;
|
|
13
|
+
mutation: Pick<ReturnType<typeof useSurfaceMutation>, 'actionPending' | 'setActionPending' | 'runMutation' | 'setActionError'>;
|
|
14
|
+
};
|
|
15
|
+
export declare function useLifecycleActions({ read, lifecycleState, source, props, mutation }: Input): {
|
|
16
|
+
latestLifecycleTarget: (target: WorktreeRecord | undefined) => WorktreeRecord | undefined;
|
|
17
|
+
cleanDiskTarget: WorktreeRecord | undefined;
|
|
18
|
+
forgetTarget: WorktreeRecord | undefined;
|
|
19
|
+
permissionRetryTarget: WorktreeRecord | undefined;
|
|
20
|
+
retryCleanupPermissions: () => Promise<void>;
|
|
21
|
+
recoveryAction: (error: WorktreeViewError | undefined) => import("react").JSX.Element | null;
|
|
22
|
+
branchActions: (record: WorktreeRecord) => {
|
|
23
|
+
onAdoptBranch: (() => void) | undefined;
|
|
24
|
+
onRecover: (() => void) | undefined;
|
|
25
|
+
};
|
|
26
|
+
refreshBranchAdoption: () => Promise<void>;
|
|
27
|
+
branchLabel: (record: WorktreeRecord) => string;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=useLifecycleActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLifecycleActions.d.ts","sourceRoot":"","sources":["../../../../src/client/surface/actions/useLifecycleActions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,6B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OAAO,CAAC,IAAI,CAAC;0BAiCxB,cAAc,KAAG,MAAM;EAerD"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { mergeWorktreeView, toWorktreeViewError, } from '../../view/worktree-view.js';
|
|
3
|
+
import styles from '../../worktree.css';
|
|
4
|
+
export function useLifecycleActions({ read, lifecycleState, source, props, mutation }) {
|
|
5
|
+
const { viewByWorkspace, readStateRef, refresh, setReadState } = read;
|
|
6
|
+
const { worktreeCleanDisk, worktreeForget, permissionRetryPending, cleanupGuard, setWorktreeBranchAdoption, worktreeBranchAdoption, branchAdoptionGuard, } = lifecycleState;
|
|
7
|
+
const { mode, permissionNoticeSnapshot, workspaceIdsRef } = source;
|
|
8
|
+
const { permission, permissionNotice, onPermissionNotice, manager, t, viewReader } = props;
|
|
9
|
+
const { actionPending, setActionPending, runMutation, setActionError } = mutation;
|
|
10
|
+
const latestLifecycleTarget = (target) => target === undefined
|
|
11
|
+
? undefined
|
|
12
|
+
: viewByWorkspace
|
|
13
|
+
.get(target.workspaceId)
|
|
14
|
+
?.worktrees.find((record) => record.worktreeId === target.worktreeId);
|
|
15
|
+
const cleanDiskTarget = latestLifecycleTarget(worktreeCleanDisk);
|
|
16
|
+
const forgetTarget = latestLifecycleTarget(worktreeForget);
|
|
17
|
+
const permissionRetryTarget = mode === 'worktree' &&
|
|
18
|
+
permissionNoticeSnapshot?.result.retryable === true &&
|
|
19
|
+
permission?.normalizeDetachedWorktreePermissions !== undefined
|
|
20
|
+
? viewByWorkspace
|
|
21
|
+
.get(permissionNoticeSnapshot.workspaceId)
|
|
22
|
+
?.worktrees.find((record) => record.worktreeId === permissionNoticeSnapshot.worktreeId &&
|
|
23
|
+
record.diskCleanup === 'completed')
|
|
24
|
+
: undefined;
|
|
25
|
+
const retryCleanupPermissions = async () => {
|
|
26
|
+
if (!permissionRetryTarget || !permission || actionPending || permissionRetryPending.current)
|
|
27
|
+
return;
|
|
28
|
+
const target = {
|
|
29
|
+
workspaceId: permissionRetryTarget.workspaceId,
|
|
30
|
+
worktreeId: permissionRetryTarget.worktreeId,
|
|
31
|
+
};
|
|
32
|
+
const notice = permissionNoticeSnapshot;
|
|
33
|
+
const generation = cleanupGuard.current.begin();
|
|
34
|
+
const isCurrent = () => cleanupGuard.current.isCurrent(generation) &&
|
|
35
|
+
permissionNotice?.getSnapshot() === notice &&
|
|
36
|
+
readStateRef.current.views.some((view) => view.workspaceId === target.workspaceId &&
|
|
37
|
+
view.worktrees.some((record) => record.worktreeId === target.worktreeId && record.diskCleanup === 'completed'));
|
|
38
|
+
if (!isCurrent())
|
|
39
|
+
return;
|
|
40
|
+
permissionRetryPending.current = true;
|
|
41
|
+
setActionPending(true);
|
|
42
|
+
try {
|
|
43
|
+
const result = await permission.normalizeDetachedWorktreePermissions(target);
|
|
44
|
+
if (isCurrent())
|
|
45
|
+
onPermissionNotice?.(target, result);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
if (isCurrent())
|
|
49
|
+
onPermissionNotice?.(target, { status: 'unverified', retryable: true });
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
if (cleanupGuard.current.isCurrent(generation)) {
|
|
53
|
+
permissionRetryPending.current = false;
|
|
54
|
+
setActionPending(false);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const recoveryAction = (error) => {
|
|
59
|
+
const workspaceId = error?.details?.workspaceId;
|
|
60
|
+
if (!manager || error?.code !== 'WORKTREE_RECOVERY_REQUIRED' || typeof workspaceId !== 'string')
|
|
61
|
+
return null;
|
|
62
|
+
return (_jsx("button", { type: "button", className: styles.retryButton, disabled: actionPending, onClick: () => {
|
|
63
|
+
void runMutation(() => manager.recoverWorktrees({ workspaceId }), {
|
|
64
|
+
scope: { kind: 'workspace', workspaceId },
|
|
65
|
+
preserveCurrent: true,
|
|
66
|
+
});
|
|
67
|
+
}, children: t('worktree.retryRecovery') }));
|
|
68
|
+
};
|
|
69
|
+
const branchActions = (record) => ({
|
|
70
|
+
onAdoptBranch: record.health === 'branch-drift' && typeof record.currentBranch === 'string'
|
|
71
|
+
? () => {
|
|
72
|
+
setWorktreeBranchAdoption(record);
|
|
73
|
+
setActionError(undefined);
|
|
74
|
+
}
|
|
75
|
+
: undefined,
|
|
76
|
+
onRecover: record.health === 'recovery-needed'
|
|
77
|
+
? () => {
|
|
78
|
+
if (!manager)
|
|
79
|
+
return;
|
|
80
|
+
void runMutation(() => manager.recoverWorktrees({ workspaceId: record.workspaceId }), {
|
|
81
|
+
scope: { kind: 'workspace', workspaceId: record.workspaceId },
|
|
82
|
+
preserveCurrent: true,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
: undefined,
|
|
86
|
+
});
|
|
87
|
+
const refreshBranchAdoption = async () => {
|
|
88
|
+
const target = worktreeBranchAdoption;
|
|
89
|
+
if (!manager || !target)
|
|
90
|
+
return;
|
|
91
|
+
const generation = branchAdoptionGuard.current.begin();
|
|
92
|
+
const isCurrent = () => branchAdoptionGuard.current.isCurrent(generation);
|
|
93
|
+
setActionPending(true);
|
|
94
|
+
try {
|
|
95
|
+
await refresh({
|
|
96
|
+
scope: { kind: 'workspace', workspaceId: target.workspaceId },
|
|
97
|
+
preserveCurrent: true,
|
|
98
|
+
});
|
|
99
|
+
if (!isCurrent())
|
|
100
|
+
return;
|
|
101
|
+
const view = await viewReader.read(target.workspaceId);
|
|
102
|
+
if (!isCurrent())
|
|
103
|
+
return;
|
|
104
|
+
if (!workspaceIdsRef.current.includes(target.workspaceId)) {
|
|
105
|
+
setWorktreeBranchAdoption(undefined);
|
|
106
|
+
setActionError(undefined);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const latest = view.worktrees.find((record) => record.worktreeId === target.worktreeId);
|
|
110
|
+
setReadState((current) => ({ ...current, views: mergeWorktreeView(current.views, view) }));
|
|
111
|
+
setWorktreeBranchAdoption(latest?.health === 'branch-drift' && typeof latest.currentBranch === 'string'
|
|
112
|
+
? latest
|
|
113
|
+
: undefined);
|
|
114
|
+
setActionError(undefined);
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
if (isCurrent())
|
|
118
|
+
setActionError(toWorktreeViewError(error));
|
|
119
|
+
}
|
|
120
|
+
finally {
|
|
121
|
+
if (isCurrent())
|
|
122
|
+
setActionPending(false);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const branchLabel = (record) => record.health === 'branch-drift'
|
|
126
|
+
? `${record.branch} → ${record.currentBranch ?? t('worktree.detachedHead')}`
|
|
127
|
+
: record.branch;
|
|
128
|
+
return {
|
|
129
|
+
latestLifecycleTarget,
|
|
130
|
+
cleanDiskTarget,
|
|
131
|
+
forgetTarget,
|
|
132
|
+
permissionRetryTarget,
|
|
133
|
+
retryCleanupPermissions,
|
|
134
|
+
recoveryAction,
|
|
135
|
+
branchActions,
|
|
136
|
+
refreshBranchAdoption,
|
|
137
|
+
branchLabel,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=useLifecycleActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLifecycleActions.js","sourceRoot":"","sources":["../../../../src/client/surface/actions/useLifecycleActions.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GAEpB,MAAM,6BAA6B,CAAC;AACrC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAoCxC,MAAM,UAAU,mBAAmB,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAS;IAC1F,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IACtE,MAAM,EACJ,iBAAiB,EACjB,cAAc,EACd,sBAAsB,EACtB,YAAY,EACZ,yBAAyB,EACzB,sBAAsB,EACtB,mBAAmB,GACpB,GAAG,cAAc,CA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