@cerbur/clutch-dsh-worktree 0.1.9 → 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 +99 -23
- package/README.zh.md +75 -19
- package/lib/client/WorktreeSurface.d.ts +4 -7
- package/lib/client/WorktreeSurface.d.ts.map +1 -1
- package/lib/client/WorktreeSurface.js +44 -1419
- package/lib/client/WorktreeSurface.js.map +1 -1
- package/lib/client/{WorktreeContext.d.ts → context/WorktreeContext.d.ts} +1 -1
- package/lib/client/context/WorktreeContext.d.ts.map +1 -0
- 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/context/WorktreeHeroContext.js.map +1 -0
- package/lib/client/{worktree-context-store.d.ts → context/worktree-context-store.d.ts} +1 -1
- package/lib/client/context/worktree-context-store.d.ts.map +1 -0
- package/lib/client/{worktree-context-store.js → context/worktree-context-store.js} +2 -2
- 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/entry.d.ts +1 -1
- package/lib/client/entry.d.ts.map +1 -1
- package/lib/client/entry.js +25 -13
- 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/{virtual-workspace-membership.d.ts → session/virtual-workspace-membership.d.ts} +1 -1
- package/lib/client/session/virtual-workspace-membership.d.ts.map +1 -0
- package/lib/client/{virtual-workspace-membership.js → session/virtual-workspace-membership.js} +1 -1
- 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} +7 -1
- package/lib/client/session/worktree-session-fork.d.ts.map +1 -0
- package/lib/client/{worktree-session-fork.js → session/worktree-session-fork.js} +50 -4
- package/lib/client/session/worktree-session-fork.js.map +1 -0
- 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} +50 -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/view-mode-store.d.ts.map +1 -0
- package/lib/client/view/view-mode-store.js.map +1 -0
- package/lib/client/view/view-mode.d.ts.map +1 -0
- 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} +1 -0
- 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} +4 -2
- package/lib/client/view/worktree-view-read.d.ts.map +1 -0
- package/lib/client/{worktree-view-read.js → view/worktree-view-read.js} +4 -1
- 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 +4295 -2634
- 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/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 +78 -112
- 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 +23 -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} +11 -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/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} +12 -5
- 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 +1 -1
- 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/dsh-rc1-slot-contract.d.ts +0 -43
- package/lib/client/dsh-rc1-slot-contract.d.ts.map +0 -1
- package/lib/client/dsh-rc1-slot-contract.js +0 -2
- package/lib/client/dsh-rc1-slot-contract.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.map +0 -1
- 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.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/{WorktreeContext.js → context/WorktreeContext.js} +0 -0
- /package/lib/client/{WorktreeHeroContext.js → context/WorktreeHeroContext.js} +0 -0
- /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.d.ts → session/worktree-session-order.d.ts} +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/{view-mode-store.d.ts → view/view-mode-store.d.ts} +0 -0
- /package/lib/client/{view-mode-store.js → view/view-mode-store.js} +0 -0
- /package/lib/client/{view-mode.d.ts → view/view-mode.d.ts} +0 -0
- /package/lib/client/{view-mode.js → view/view-mode.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/{subprocess.js → git/subprocess.js} +0 -0
- /package/lib/provider/{mutation-lock.d.ts → sidecar/mutation-lock.d.ts} +0 -0
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAoClE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,iCAAiC,EACjC,uBAAuB,GACxB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAmB7B,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAM/E,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,8BAA8B,EAC9B,kCAAkC,EAClC,+BAA+B,GAChC,MAAM,iBAAiB,CAAC;AAQzB,uDAAuD;AACvD,uFAAuF;AACvF,0DAA0D;AAC1D,OAAO,EAAE,qBAAqB,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { WorktreeManagerOptions } from './types.js';
|
|
2
2
|
import type { GitWorktreeAdapter, SidecarStore } from '../provider/types.js';
|
|
3
|
-
import type { WorktreeMutationTransaction } from '../provider/transaction.js';
|
|
3
|
+
import type { WorktreeMutationTransaction } from '../provider/transaction/index.js';
|
|
4
4
|
/** Internal Manage composition context shared by the responsibility-specific use-case modules. */
|
|
5
5
|
export interface WorktreeManagerContext {
|
|
6
6
|
readonly dsh: WorktreeManagerOptions['dsh'];
|
|
@@ -9,5 +9,6 @@ export interface WorktreeManagerContext {
|
|
|
9
9
|
readonly sidecar: SidecarStore;
|
|
10
10
|
readonly transaction: WorktreeMutationTransaction;
|
|
11
11
|
readonly idFactory: () => string;
|
|
12
|
+
readonly signal: AbortSignal;
|
|
12
13
|
}
|
|
13
14
|
//# sourceMappingURL=manager-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager-context.d.ts","sourceRoot":"","sources":["../../src/manage/manager-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"manager-context.d.ts","sourceRoot":"","sources":["../../src/manage/manager-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAEpF,kGAAkG;AAClG,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,GAAG,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,kBAAkB,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,2BAA2B,CAAC;IAClD,QAAQ,CAAC,SAAS,EAAE,MAAM,MAAM,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B"}
|
|
@@ -17,8 +17,8 @@ export async function bindSession(context, input) {
|
|
|
17
17
|
worktreeId: input.worktreeId,
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
if (worktree.
|
|
21
|
-
throw providerError('WORKTREE_REMOVED', `Worktree has been
|
|
20
|
+
if (worktree.diskCleanup === 'completed') {
|
|
21
|
+
throw providerError('WORKTREE_REMOVED', `Worktree has been cleaned: ${input.worktreeId}`, {
|
|
22
22
|
workspaceId: input.workspaceId,
|
|
23
23
|
worktreeId: input.worktreeId,
|
|
24
24
|
});
|
|
@@ -71,8 +71,8 @@ export async function resolveRuntimeCwd(context, input) {
|
|
|
71
71
|
sessionId: input.sessionId,
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
if (worktree.
|
|
75
|
-
throw providerError('WORKTREE_REMOVED', `Active binding points to a
|
|
74
|
+
if (worktree.diskCleanup === 'completed') {
|
|
75
|
+
throw providerError('WORKTREE_REMOVED', `Active binding points to a cleaned Worktree: ${worktree.worktreeId}`, {
|
|
76
76
|
workspaceId: input.workspaceId,
|
|
77
77
|
worktreeId: worktree.worktreeId,
|
|
78
78
|
sessionId: input.sessionId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager-sessions.js","sourceRoot":"","sources":["../../src/manage/manager-sessions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,6BAA6B,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEpG,kEAAkE;AAClE,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAA+B,EAC/B,KAA4C;IAE5C,MAAM,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IACnD,OAAO,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;AAClE,CAAC;AAED,yEAAyE;AACzE,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAA+B,EAC/B,KAAqG;IAErG,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAErE,uFAAuF;IACvF,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;QAClE,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU,CAAC,CAAC;QACnG,IAAI,CAAC,Q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AE,EAAE;YAC9G,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,SAAS,EAAE,KAAK,CAAC,SAAS;SAC3B,CAAC,CAAC;IACL,CAAC;IACD,IAAI,QAAQ,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;QACzC,MAAM,aAAa,CAAC,kBAAkB,EAAE,gDAAgD,QAAQ,CAAC,UAAU,EAAE,EAAE;YAC7G,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,SAAS,EAAE,KAAK,CAAC,SAAS;SAC3B,CAAC,CAAC;IACL,CAAC;IACD,IAAI,CAAC,CAAC,MAAM,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;QAChD,MAAM,aAAa,CAAC,oBAAoB,EAAE,wCAAwC,QAAQ,CAAC,YAAY,EAAE,EAAE;YACzG,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,UAAU,EAAE,QAAQ,CAAC,UAAU;YAC/B,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,YAAY,EAAE,QAAQ,CAAC,YAAY;SACpC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC,YAAY,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { WorktreeLifecycleInput } from '../contract/index.js';
|
|
2
|
+
import type { WorktreeManagerContext } from './manager-context.js';
|
|
3
|
+
/**
|
|
4
|
+
* Remove (archive) a Worktree: change status to 'removed', preserving its directory,
|
|
5
|
+
* active Session bindings, and runtime cwd.
|
|
6
|
+
*/
|
|
7
|
+
export declare function archiveWorktree(context: WorktreeManagerContext, input: WorktreeLifecycleInput): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Unarchive a Worktree: change status from 'removed' back to 'active'.
|
|
10
|
+
* Requires that the Worktree was not cleaned from disk, exists physically in Git,
|
|
11
|
+
* and has no active conflict on branch or physical path.
|
|
12
|
+
*/
|
|
13
|
+
export declare function unarchiveWorktree(context: WorktreeManagerContext, input: WorktreeLifecycleInput): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Clean Worktree from disk: performs real git worktree removal with journal protection,
|
|
16
|
+
* marks record diskCleanup: 'completed', and detaches bindings.
|
|
17
|
+
*/
|
|
18
|
+
export declare function cleanWorktree(context: WorktreeManagerContext, input: WorktreeLifecycleInput): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Forget Worktree: removes the record and all its Session bindings completely from sidecar.
|
|
21
|
+
*/
|
|
22
|
+
export declare function forgetWorktree(context: WorktreeManagerContext, input: WorktreeLifecycleInput): Promise<void>;
|
|
23
|
+
//# sourceMappingURL=manager-worktree-lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager-worktree-lifecycle.d.ts","sourceRoot":"","sources":["../../src/manage/manager-worktree-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EAEvB,MAAM,sBAAsB,CAAC;AAU9B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAiBnE;;;GAGG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,sBAAsB,EAC/B,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAqBf;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,sBAAsB,EAC/B,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAAC,IAAI,CAAC,CA6Ff;AAED;;;GAGG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,sBAAsB,EAC/B,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAcf;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,sBAAsB,EAC/B,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAyBf"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { createWorktreeMutationToken } from '../provider/mutation-token.js';
|
|
2
|
+
import { providerError } from '../provider/types.js';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { archiveWorktreeSnapshot, unarchiveWorktreeSnapshot, forgetWorktreeSnapshot, } from '../provider/worktree-lifecycle.js';
|
|
5
|
+
import { asSidecarError, requireWorkspace, samePhysicalPath } from './manager-support.js';
|
|
6
|
+
function assertMutationToken(snapshot, record, token) {
|
|
7
|
+
const expected = createWorktreeMutationToken(snapshot, record);
|
|
8
|
+
if (token === undefined || token !== expected) {
|
|
9
|
+
throw providerError('WORKTREE_STATE_CONFLICT', 'Worktree state changed after it was loaded', {
|
|
10
|
+
workspaceId: record.workspaceId,
|
|
11
|
+
worktreeId: record.worktreeId,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Remove (archive) a Worktree: change status to 'removed', preserving its directory,
|
|
17
|
+
* active Session bindings, and runtime cwd.
|
|
18
|
+
*/
|
|
19
|
+
export async function archiveWorktree(context, input) {
|
|
20
|
+
await requireWorkspace(context, input.workspaceId);
|
|
21
|
+
try {
|
|
22
|
+
await context.sidecar.mutate(input.workspaceId, (snapshot) => {
|
|
23
|
+
const record = snapshot.worktrees.find((w) => w.worktreeId === input.worktreeId);
|
|
24
|
+
if (!record) {
|
|
25
|
+
throw providerError('WORKTREE_NOT_FOUND', `Worktree not found: ${input.worktreeId}`, {
|
|
26
|
+
worktreeId: input.worktreeId,
|
|
27
|
+
workspaceId: input.workspaceId,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
assertMutationToken(snapshot, record, input.mutationToken);
|
|
31
|
+
if (record.status === 'removed') {
|
|
32
|
+
return { result: undefined, snapshot, changed: false };
|
|
33
|
+
}
|
|
34
|
+
const next = archiveWorktreeSnapshot(snapshot, input.worktreeId);
|
|
35
|
+
return { result: undefined, snapshot: next, changed: true };
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
throw asSidecarError(error, input.workspaceId);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Unarchive a Worktree: change status from 'removed' back to 'active'.
|
|
44
|
+
* Requires that the Worktree was not cleaned from disk, exists physically in Git,
|
|
45
|
+
* and has no active conflict on branch or physical path.
|
|
46
|
+
*/
|
|
47
|
+
export async function unarchiveWorktree(context, input) {
|
|
48
|
+
const workspace = await requireWorkspace(context, input.workspaceId);
|
|
49
|
+
try {
|
|
50
|
+
await context.sidecar.mutate(input.workspaceId, async (snapshot) => {
|
|
51
|
+
const record = snapshot.worktrees.find((w) => w.worktreeId === input.worktreeId);
|
|
52
|
+
if (!record) {
|
|
53
|
+
throw providerError('WORKTREE_NOT_FOUND', `Worktree not found: ${input.worktreeId}`, {
|
|
54
|
+
worktreeId: input.worktreeId,
|
|
55
|
+
workspaceId: input.workspaceId,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
assertMutationToken(snapshot, record, input.mutationToken);
|
|
59
|
+
if (record.status === 'active') {
|
|
60
|
+
return { result: undefined, snapshot, changed: false };
|
|
61
|
+
}
|
|
62
|
+
if (record.diskCleanup === 'completed') {
|
|
63
|
+
throw providerError('WORKTREE_STATE_CONFLICT', 'Cleaned worktrees cannot be unarchived', {
|
|
64
|
+
workspaceId: input.workspaceId,
|
|
65
|
+
worktreeId: input.worktreeId,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
// Check conflict with other active worktrees in the same workspace
|
|
69
|
+
const conflict = snapshot.worktrees.find((w) => w.status === 'active' &&
|
|
70
|
+
w.worktreeId !== record.worktreeId &&
|
|
71
|
+
(w.branch === record.branch || w.absolutePath === record.absolutePath));
|
|
72
|
+
if (conflict) {
|
|
73
|
+
throw providerError('WORKTREE_STATE_CONFLICT', `Another active worktree is using branch ${record.branch} or path ${record.absolutePath}`, {
|
|
74
|
+
workspaceId: input.workspaceId,
|
|
75
|
+
worktreeId: input.worktreeId,
|
|
76
|
+
conflictingWorktreeId: conflict.worktreeId,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
// Verify physical existence / git registration
|
|
80
|
+
if (context.git.listWorktrees) {
|
|
81
|
+
let gitWorktrees;
|
|
82
|
+
try {
|
|
83
|
+
const gitRoot = context.git.resolveRepositoryRoot
|
|
84
|
+
? await context.git.resolveRepositoryRoot(workspace.rootPath)
|
|
85
|
+
: workspace.rootPath;
|
|
86
|
+
gitWorktrees = await context.git.listWorktrees(gitRoot);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
gitWorktrees = undefined;
|
|
90
|
+
}
|
|
91
|
+
if (!gitWorktrees) {
|
|
92
|
+
throw providerError('WORKTREE_STATE_CONFLICT', 'Git worktree repository cannot be inspected; cannot unarchive', {
|
|
93
|
+
workspaceId: input.workspaceId,
|
|
94
|
+
worktreeId: input.worktreeId,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
let foundInGit = false;
|
|
98
|
+
for (const gw of gitWorktrees) {
|
|
99
|
+
if (path.resolve(gw.absolutePath) === path.resolve(record.absolutePath) ||
|
|
100
|
+
(await samePhysicalPath(gw.absolutePath, record.absolutePath))) {
|
|
101
|
+
foundInGit = true;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (!foundInGit) {
|
|
106
|
+
throw providerError('WORKTREE_STATE_CONFLICT', 'Worktree directory or Git registration is missing; cannot unarchive', {
|
|
107
|
+
workspaceId: input.workspaceId,
|
|
108
|
+
worktreeId: input.worktreeId,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const next = unarchiveWorktreeSnapshot(snapshot, input.worktreeId);
|
|
113
|
+
return { result: undefined, snapshot: next, changed: true };
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
throw asSidecarError(error, input.workspaceId);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Clean Worktree from disk: performs real git worktree removal with journal protection,
|
|
122
|
+
* marks record diskCleanup: 'completed', and detaches bindings.
|
|
123
|
+
*/
|
|
124
|
+
export async function cleanWorktree(context, input) {
|
|
125
|
+
const workspace = await requireWorkspace(context, input.workspaceId);
|
|
126
|
+
if (!context.sidecar.runExclusive) {
|
|
127
|
+
throw providerError('WORKTREE_RECOVERY_REQUIRED', 'Clean requires transactional sidecar lock', {
|
|
128
|
+
workspaceId: input.workspaceId,
|
|
129
|
+
worktreeId: input.worktreeId,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
await context.transaction.clean({
|
|
133
|
+
workspaceId: input.workspaceId,
|
|
134
|
+
workspaceRoot: workspace.rootPath,
|
|
135
|
+
worktreeId: input.worktreeId,
|
|
136
|
+
mutationToken: input.mutationToken,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Forget Worktree: removes the record and all its Session bindings completely from sidecar.
|
|
141
|
+
*/
|
|
142
|
+
export async function forgetWorktree(context, input) {
|
|
143
|
+
await requireWorkspace(context, input.workspaceId);
|
|
144
|
+
try {
|
|
145
|
+
await context.sidecar.mutate(input.workspaceId, (snapshot) => {
|
|
146
|
+
const record = snapshot.worktrees.find((w) => w.worktreeId === input.worktreeId);
|
|
147
|
+
if (!record) {
|
|
148
|
+
return { result: undefined, snapshot, changed: false };
|
|
149
|
+
}
|
|
150
|
+
if (record.status !== 'removed') {
|
|
151
|
+
throw providerError('WORKTREE_STATE_CONFLICT', 'Worktree must be archived before it can be removed from management', {
|
|
152
|
+
workspaceId: input.workspaceId,
|
|
153
|
+
worktreeId: input.worktreeId,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
assertMutationToken(snapshot, record, input.mutationToken);
|
|
157
|
+
const next = forgetWorktreeSnapshot(snapshot, input.worktreeId);
|
|
158
|
+
return { result: undefined, snapshot: next, changed: true };
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
throw asSidecarError(error, input.workspaceId);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=manager-worktree-lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager-worktree-lifecycle.js","sourceRoot":"","sources":["../../src/manage/manager-worktree-lifecycle.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE1F,SAAS,mBAAmB,CAC1B,QAA6E,EAC7E,MAAsB,EACtB,KAAyB;IAEzB,MAAM,QAAQ,GAAG,2BAA2B,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC/D,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9C,MAAM,aAAa,CAAC,yBAAyB,EAAE,4CAA4C,EAAE;YAC3F,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,UAAU,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAA+B,EAC/B,KAA6B;IAE7B,MAAM,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IACnD,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,EA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AAC,WAAW,CAAC,CAAC;IACnD,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,EAAE;YAC3D,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU,CAAC,CAAC;YACjF,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;YACzD,CAAC;YACD,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBAChC,MAAM,aAAa,CACjB,yBAAyB,EACzB,oEAAoE,EACpE;oBACE,WAAW,EAAE,KAAK,CAAC,WAAW;oBAC9B,UAAU,EAAE,KAAK,CAAC,UAAU;iBAC7B,CACF,CAAC;YACJ,CAAC;YACD,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;YAC3D,MAAM,IAAI,GAAG,sBAAsB,CAAC,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;YAChE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC9D,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;AACH,CAAC"}
|
|
@@ -23,12 +23,7 @@ export declare function importWorktree(context: WorktreeManagerContext, input: {
|
|
|
23
23
|
readonly workspaceId: WorkspaceId;
|
|
24
24
|
readonly absolutePath: string;
|
|
25
25
|
}): Promise<WorktreeRecord>;
|
|
26
|
-
|
|
27
|
-
export declare function removeWorktree(context: WorktreeManagerContext, input: {
|
|
28
|
-
readonly workspaceId: WorkspaceId;
|
|
29
|
-
readonly worktreeId: string;
|
|
30
|
-
readonly mutationToken: string;
|
|
31
|
-
}): Promise<void>;
|
|
26
|
+
export { archiveWorktree as removeWorktree, unarchiveWorktree, cleanWorktree, forgetWorktree, } from './manager-worktree-lifecycle.js';
|
|
32
27
|
/** Reconcile one Workspace's durable Git/sidecar operation marker. */
|
|
33
28
|
export declare function recoverWorktrees(context: WorktreeManagerContext, input: {
|
|
34
29
|
readonly workspaceId: WorkspaceId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager-worktrees.d.ts","sourceRoot":"","sources":["../../src/manage/manager-worktrees.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manager-worktrees.d.ts","sourceRoot":"","sources":["../../src/manage/manager-worktrees.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,YAAY,EAEZ,UAAU,EACV,uBAAuB,EACvB,cAAc,EACd,WAAW,EACZ,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAkCnE,+EAA+E;AAC/E,wBAAsB,aAAa,CACjC,OAAO,EAAE,sBAAsB,EAC/B,KAAK,EAAE;IAAE,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;CAAE,GAC3C,OAAO,CAAC,SAAS,cAAc,EAAE,CAAC,CAyFpC;AAED,gGAAgG;AAChG,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,sBAAsB,EAC/B,KAAK,EAAE;IAAE,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;CAAE,GAC3C,OAAO,CAAC,SAAS,uBAAuB,EAAE,CAAC,CA0B7C;AAED,wFAAwF;AACxF,wBAAsB,YAAY,CAChC,OAAO,EAAE,sBAAsB,EAC/B,KAAK,EAAE;IAAE,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;CAAE,GAC3C,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC,CAqClC;AAED,qFAAqF;AACrF,wBAAsB,cAAc,CAClC,OAAO,EAAE,sBAAsB,EAC/B,KAAK,EAAE;IAAE,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACjG,OAAO,CAAC,cAAc,CAAC,CAazB;AAmKD,8FAA8F;AAC9F,wBAAsB,cAAc,CAClC,OAAO,EAAE,sBAAsB,EAC/B,KAAK,EAAE;IAAE,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC1E,OAAO,CAAC,cAAc,CAAC,CA+EzB;AAoCD,OAAO,EACL,eAAe,IAAI,cAAc,EACjC,iBAAiB,EACjB,aAAa,EACb,cAAc,GACf,MAAM,iCAAiC,CAAC;AAEzC,sEAAsE;AACtE,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,sBAAsB,EAC/B,KAAK,EAAE;IAAE,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;CAAE,GAC3C,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,sBAAsB,EAC/B,KAAK,EAAE;IAAE,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,UAAU,CAAA;CAAE,GACpH,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC,CAWhC"}
|
|
@@ -1,28 +1,22 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
+
import { assertGeneratedNameAvailable, GeneratedWorktreeNameCollision } from '../provider/generated-name.js';
|
|
3
|
+
import { readWorktreeStatus } from '../provider/git/worktree-status.js';
|
|
2
4
|
import { createWorktreeMutationToken } from '../provider/mutation-token.js';
|
|
3
5
|
import { providerError } from '../provider/types.js';
|
|
4
|
-
import { asGitError, asSidecarError, canonicalPath, describeError, generatedId, isDirectory,
|
|
5
|
-
function projectRuntimeRecord(snapshot, record, health) {
|
|
6
|
-
const { health: _health, mutationToken: _mutationToken, ...durableRecord } = record;
|
|
6
|
+
import { asGitError, asSidecarError, canonicalPath, describeError, generatedId, isDirectory, requireWorkspace, samePhysicalPath, validateGeneratedPath, validatePhysicalGeneratedPath, } from './manager-support.js';
|
|
7
|
+
function projectRuntimeRecord(snapshot, record, health, activity) {
|
|
8
|
+
const { health: _health, mutationToken: _mutationToken, activity: _activity, currentBranch: _currentBranch, ...durableRecord } = record;
|
|
7
9
|
void _health;
|
|
8
10
|
void _mutationToken;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
void _activity;
|
|
12
|
+
void _currentBranch;
|
|
11
13
|
return {
|
|
12
14
|
...durableRecord,
|
|
13
15
|
mutationToken: createWorktreeMutationToken(snapshot, record),
|
|
14
16
|
...(health === undefined ? {} : { health }),
|
|
17
|
+
...(activity === undefined ? {} : { activity }),
|
|
15
18
|
};
|
|
16
19
|
}
|
|
17
|
-
function assertMutationToken(snapshot, record, token) {
|
|
18
|
-
const expected = createWorktreeMutationToken(snapshot, record);
|
|
19
|
-
if (token === undefined || token !== expected) {
|
|
20
|
-
throw providerError('WORKTREE_STATE_CONFLICT', 'Worktree state changed after it was loaded', {
|
|
21
|
-
workspaceId: record.workspaceId,
|
|
22
|
-
worktreeId: record.worktreeId,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
20
|
/** Return the sidecar Worktree projection with runtime Git health attached. */
|
|
27
21
|
export async function listWorktrees(context, input) {
|
|
28
22
|
const workspace = await requireWorkspace(context, input.workspaceId);
|
|
@@ -35,6 +29,23 @@ export async function listWorktrees(context, input) {
|
|
|
35
29
|
...(snapshot.pendingOperation ? { operationId: snapshot.pendingOperation.id } : {}),
|
|
36
30
|
});
|
|
37
31
|
}
|
|
32
|
+
const getActivity = async (record) => {
|
|
33
|
+
const ids = [
|
|
34
|
+
...new Set(snapshot.bindings
|
|
35
|
+
.filter((b) => b.worktreeId === record.worktreeId)
|
|
36
|
+
.map((b) => b.sessionId)),
|
|
37
|
+
];
|
|
38
|
+
if (ids.length === 0)
|
|
39
|
+
return { state: 'idle' };
|
|
40
|
+
if (!context.dsh.readWorktreeActivity)
|
|
41
|
+
return { state: 'unknown' };
|
|
42
|
+
try {
|
|
43
|
+
return await context.dsh.readWorktreeActivity(ids);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return { state: 'unknown' };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
38
49
|
let gitWorktrees;
|
|
39
50
|
try {
|
|
40
51
|
const gitRoot = context.git.resolveRepositoryRoot
|
|
@@ -43,26 +54,37 @@ export async function listWorktrees(context, input) {
|
|
|
43
54
|
gitWorktrees = await context.git.listWorktrees(gitRoot);
|
|
44
55
|
}
|
|
45
56
|
catch {
|
|
46
|
-
|
|
47
|
-
? recoveryNeeded ? 'recovery-needed' : 'repair'
|
|
48
|
-
: undefined));
|
|
57
|
+
gitWorktrees = undefined;
|
|
49
58
|
}
|
|
50
59
|
const nextRecords = [];
|
|
51
60
|
for (const record of records) {
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
const activity = await getActivity(record);
|
|
62
|
+
const recordRecoveryNeeded = (snapshot.pendingOperation !== undefined &&
|
|
63
|
+
(snapshot.pendingOperation.worktreeId === undefined ||
|
|
64
|
+
snapshot.pendingOperation.worktreeId === record.worktreeId)) ||
|
|
65
|
+
snapshot.recoveryIssues?.some((issue) => issue.worktreeId === undefined || issue.worktreeId === record.worktreeId) === true;
|
|
66
|
+
if (record.diskCleanup === 'completed') {
|
|
67
|
+
nextRecords.push(projectRuntimeRecord(snapshot, record, recordRecoveryNeeded ? 'recovery-needed' : 'cleaned', activity));
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (gitWorktrees === undefined) {
|
|
71
|
+
nextRecords.push(projectRuntimeRecord(snapshot, record, recordRecoveryNeeded ? 'recovery-needed' : 'repair', activity));
|
|
54
72
|
continue;
|
|
55
73
|
}
|
|
56
74
|
let ready = false;
|
|
75
|
+
let currentBranch;
|
|
57
76
|
for (const gitWorktree of gitWorktrees) {
|
|
58
77
|
if (path.resolve(gitWorktree.absolutePath) === path.resolve(record.absolutePath) ||
|
|
59
78
|
(await samePhysicalPath(gitWorktree.absolutePath, record.absolutePath))) {
|
|
60
|
-
|
|
79
|
+
const status = await readWorktreeStatus(gitWorktree);
|
|
80
|
+
ready = status === 'ready' || status === 'detached';
|
|
81
|
+
currentBranch = gitWorktree.detached ? null : gitWorktree.branch;
|
|
61
82
|
break;
|
|
62
83
|
}
|
|
63
84
|
}
|
|
64
85
|
nextRecords.push({
|
|
65
|
-
...projectRuntimeRecord(snapshot, record,
|
|
86
|
+
...projectRuntimeRecord(snapshot, record, recordRecoveryNeeded ? 'recovery-needed' : ready ? currentBranch === undefined || currentBranch === record.branch ? 'ready' : 'branch-drift' : 'repair', activity),
|
|
87
|
+
...(currentBranch === undefined ? {} : { currentBranch }),
|
|
66
88
|
});
|
|
67
89
|
}
|
|
68
90
|
return nextRecords;
|
|
@@ -82,6 +104,8 @@ export async function listImportCandidates(context, input) {
|
|
|
82
104
|
for (const worktree of gitWorktrees) {
|
|
83
105
|
if (!worktree.branch || await samePhysicalPath(worktree.absolutePath, gitRoot))
|
|
84
106
|
continue;
|
|
107
|
+
if (await readWorktreeStatus(worktree) !== 'ready')
|
|
108
|
+
continue;
|
|
85
109
|
let managed = false;
|
|
86
110
|
for (const record of snapshot.worktrees) {
|
|
87
111
|
if (await samePhysicalPath(worktree.absolutePath, record.absolutePath)) {
|
|
@@ -135,6 +159,23 @@ export async function listBranches(context, input) {
|
|
|
135
159
|
}
|
|
136
160
|
/** Create a Git Worktree first, then commit its external relation to the sidecar. */
|
|
137
161
|
export async function createWorktree(context, input) {
|
|
162
|
+
let baseId = '';
|
|
163
|
+
for (let attempt = 0n;; attempt++) {
|
|
164
|
+
context.signal.throwIfAborted();
|
|
165
|
+
// Reroll first, then make progress even if an injected random source repeats forever.
|
|
166
|
+
if (attempt < 8n)
|
|
167
|
+
baseId = generatedId(context.idFactory);
|
|
168
|
+
const worktreeId = attempt < 8n ? baseId : `${baseId}_${attempt - 7n}`;
|
|
169
|
+
try {
|
|
170
|
+
return await createWorktreeAttempt(context, input, worktreeId);
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
if (!(error instanceof GeneratedWorktreeNameCollision))
|
|
174
|
+
throw error;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
async function createWorktreeAttempt(context, input, worktreeId) {
|
|
138
179
|
const workspace = await requireWorkspace(context, input.workspaceId);
|
|
139
180
|
const transactional = context.sidecar.runExclusive !== undefined;
|
|
140
181
|
if (!transactional)
|
|
@@ -189,19 +230,11 @@ export async function createWorktree(context, input) {
|
|
|
189
230
|
});
|
|
190
231
|
}
|
|
191
232
|
}
|
|
192
|
-
const worktreeId = generatedId(context.idFactory);
|
|
193
233
|
const targetPath = path.resolve(context.dshHome, 'clutch-dsh-worktree', 'worktree', worktreeId);
|
|
194
234
|
// 创建前同时检查词法和物理目录边界,阻止配置、ID 或 symlink 将目标引回 Workspace 或带出插件根目录。
|
|
195
235
|
// Check lexical and physical directory boundaries before creation so configuration, IDs, or symlinks cannot redirect the target into the Workspace or outside the plugin root.
|
|
196
236
|
validateGeneratedPath(context, workspace.rootPath, targetPath, worktreeId);
|
|
197
237
|
await validatePhysicalGeneratedPath(context, workspace.rootPath, targetPath);
|
|
198
|
-
if (await pathExists(targetPath)) {
|
|
199
|
-
throw providerError('GIT_OPERATION_FAILED', `Generated Worktree path already exists: ${targetPath}`, {
|
|
200
|
-
workspaceRoot: workspace.rootPath,
|
|
201
|
-
targetPath,
|
|
202
|
-
worktreeId,
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
238
|
// The default Workspace-sharded sidecar exposes the transaction seam. Legacy
|
|
206
239
|
// injected stores keep the previous path below for compatibility with older
|
|
207
240
|
// Host compositions and failure-injection tests.
|
|
@@ -216,6 +249,7 @@ export async function createWorktree(context, input) {
|
|
|
216
249
|
targetBranch,
|
|
217
250
|
});
|
|
218
251
|
}
|
|
252
|
+
await assertGeneratedNameAvailable(worktreeId, targetPath, await context.sidecar.read(input.workspaceId), await context.git.listWorktrees(workspace.rootPath));
|
|
219
253
|
// Git is the first external side effect; the sidecar mutation below is the relation commit point.
|
|
220
254
|
try {
|
|
221
255
|
await context.git.createWorktree(workspace.rootPath, targetPath, baseBranch, newBranch);
|
|
@@ -232,7 +266,7 @@ export async function createWorktree(context, input) {
|
|
|
232
266
|
status: 'active',
|
|
233
267
|
};
|
|
234
268
|
try {
|
|
235
|
-
return await context.sidecar.mutate(input.workspaceId, (snapshot) => {
|
|
269
|
+
return await context.sidecar.mutate(input.workspaceId, async (snapshot) => {
|
|
236
270
|
// Recheck ID and branch inside the serialized mutation so concurrent writes cannot create duplicate active records.
|
|
237
271
|
const idConflict = snapshot.worktrees.find((worktree) => worktree.worktreeId === worktreeId);
|
|
238
272
|
if (idConflict) {
|
|
@@ -241,12 +275,17 @@ export async function createWorktree(context, input) {
|
|
|
241
275
|
existingStatus: idConflict.status,
|
|
242
276
|
});
|
|
243
277
|
}
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
278
|
+
const branchClaims = snapshot.worktrees.filter((worktree) => worktree.status === 'active' && worktree.branch === targetBranch);
|
|
279
|
+
if (branchClaims.length > 0) {
|
|
280
|
+
const live = await context.git.listWorktrees(workspace.rootPath);
|
|
281
|
+
for (const claim of branchClaims) {
|
|
282
|
+
const actual = await findGitWorktreeByPhysicalPath(live, claim.absolutePath);
|
|
283
|
+
if (!actual || (!actual.detached && (!actual.branch || actual.branch === targetBranch))) {
|
|
284
|
+
throw providerError('WORKTREE_BRANCH_CONFLICT', `Branch is already recorded as active: ${targetBranch}`, {
|
|
285
|
+
branch: targetBranch, worktreeId: claim.worktreeId,
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
}
|
|
250
289
|
}
|
|
251
290
|
const next = {
|
|
252
291
|
...snapshot,
|
|
@@ -300,7 +339,7 @@ export async function importWorktree(context, input) {
|
|
|
300
339
|
await context.git.validateRepository(workspace.rootPath);
|
|
301
340
|
const gitWorktrees = await context.git.listWorktrees(workspace.rootPath);
|
|
302
341
|
const gitWorktree = await findGitWorktreeByPhysicalPath(gitWorktrees, requestedPath);
|
|
303
|
-
if (!gitWorktree || !gitWorktree.branch || await samePhysicalPath(gitWorktree.absolutePath, workspace.rootPath)) {
|
|
342
|
+
if (!gitWorktree || !gitWorktree.branch || await readWorktreeStatus(gitWorktree) !== 'ready' || await samePhysicalPath(gitWorktree.absolutePath, workspace.rootPath)) {
|
|
304
343
|
throw providerError('WORKTREE_IMPORT_INVALID', `Path is not an importable Worktree: ${requestedPath}`, {
|
|
305
344
|
workspaceId: input.workspaceId,
|
|
306
345
|
absolutePath: requestedPath,
|
|
@@ -318,6 +357,7 @@ export async function importWorktree(context, input) {
|
|
|
318
357
|
const liveWorktree = await findGitWorktreeByPhysicalPath(await context.git.listWorktrees(workspace.rootPath), normalizedPath);
|
|
319
358
|
if (!liveWorktree ||
|
|
320
359
|
!liveWorktree.branch ||
|
|
360
|
+
await readWorktreeStatus(liveWorktree) !== 'ready' ||
|
|
321
361
|
await samePhysicalPath(liveWorktree.absolutePath, workspace.rootPath)) {
|
|
322
362
|
throw providerError('WORKTREE_IMPORT_INVALID', `Path is not an importable Worktree: ${normalizedPath}`, {
|
|
323
363
|
workspaceId: input.workspaceId,
|
|
@@ -371,81 +411,7 @@ function importConflictOrExisting(existing, workspaceId, absolutePath) {
|
|
|
371
411
|
status: existing.status,
|
|
372
412
|
});
|
|
373
413
|
}
|
|
374
|
-
|
|
375
|
-
export async function removeWorktree(context, input) {
|
|
376
|
-
const workspace = await requireWorkspace(context, input.workspaceId);
|
|
377
|
-
if (context.sidecar.runExclusive) {
|
|
378
|
-
await context.transaction.remove({
|
|
379
|
-
workspaceId: input.workspaceId,
|
|
380
|
-
workspaceRoot: workspace.rootPath,
|
|
381
|
-
worktreeId: input.worktreeId,
|
|
382
|
-
mutationToken: input.mutationToken,
|
|
383
|
-
});
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
386
|
-
let gitRemoved = false;
|
|
387
|
-
try {
|
|
388
|
-
await context.sidecar.mutate(input.workspaceId, async (snapshot) => {
|
|
389
|
-
const record = snapshot.worktrees.find((worktree) => worktree.worktreeId === input.worktreeId);
|
|
390
|
-
if (!record) {
|
|
391
|
-
throw providerError('WORKTREE_NOT_FOUND', `Worktree not found: ${input.worktreeId}`, {
|
|
392
|
-
worktreeId: input.worktreeId,
|
|
393
|
-
workspaceId: input.workspaceId,
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
if (record.status === 'removed') {
|
|
397
|
-
throw providerError('WORKTREE_REMOVED', `Worktree has already been removed: ${input.worktreeId}`, {
|
|
398
|
-
worktreeId: input.worktreeId,
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
|
-
assertMutationToken(snapshot, record, input.mutationToken);
|
|
402
|
-
try {
|
|
403
|
-
await context.git.removeWorktree(workspace.rootPath, record.absolutePath);
|
|
404
|
-
}
|
|
405
|
-
catch (error) {
|
|
406
|
-
let stillRegistered;
|
|
407
|
-
try {
|
|
408
|
-
stillRegistered = false;
|
|
409
|
-
for (const worktree of await context.git.listWorktrees(workspace.rootPath)) {
|
|
410
|
-
if (await samePhysicalPath(worktree.absolutePath, record.absolutePath)) {
|
|
411
|
-
stillRegistered = true;
|
|
412
|
-
break;
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
catch {
|
|
417
|
-
throw asGitError('remove worktree', workspace.rootPath, record.absolutePath, error);
|
|
418
|
-
}
|
|
419
|
-
if (stillRegistered) {
|
|
420
|
-
throw asGitError('remove worktree', workspace.rootPath, record.absolutePath, error);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
gitRemoved = true;
|
|
424
|
-
// Preserve Worktree and binding history while changing lifecycle only; DSH Sessions are never read or deleted here.
|
|
425
|
-
const next = {
|
|
426
|
-
...snapshot,
|
|
427
|
-
worktrees: snapshot.worktrees.map((candidate) => candidate.worktreeId === record.worktreeId ? { ...candidate, status: 'removed' } : candidate),
|
|
428
|
-
bindings: snapshot.bindings.map((binding) => binding.worktreeId === record.worktreeId && binding.status === 'active'
|
|
429
|
-
? { ...binding, status: 'detached' }
|
|
430
|
-
: binding),
|
|
431
|
-
};
|
|
432
|
-
return { result: undefined, snapshot: next };
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
catch (error) {
|
|
436
|
-
if (gitRemoved) {
|
|
437
|
-
// Git removal cannot be rolled back here, so expose the divergence for a safe retry.
|
|
438
|
-
const sidecarError = asSidecarError(error, input.workspaceId);
|
|
439
|
-
throw providerError('SIDECAR_SYNC_REQUIRED', `Git removed Worktree ${input.worktreeId}, but sidecar synchronization failed`, {
|
|
440
|
-
workspaceId: input.workspaceId,
|
|
441
|
-
worktreeId: input.worktreeId,
|
|
442
|
-
workspaceRoot: workspace.rootPath,
|
|
443
|
-
sidecarError: sidecarError.message,
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
throw error;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
414
|
+
export { archiveWorktree as removeWorktree, unarchiveWorktree, cleanWorktree, forgetWorktree, } from './manager-worktree-lifecycle.js';
|
|
449
415
|
/** Reconcile one Workspace's durable Git/sidecar operation marker. */
|
|
450
416
|
export async function recoverWorktrees(context, input) {
|
|
451
417
|
const workspace = await requireWorkspace(context, input.workspaceId);
|