@cerbur/clutch-dsh-worktree 0.1.17 → 0.1.19
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 +207 -42
- package/README.zh.md +174 -38
- package/assets/screenshots/screenshots-agent-steer.jpg +0 -0
- package/assets/screenshots/screenshots-baseline-sync.png +0 -0
- package/lib/client/WorktreeSurface.d.ts.map +1 -1
- package/lib/client/WorktreeSurface.js +55 -12
- package/lib/client/WorktreeSurface.js.map +1 -1
- package/lib/client/branch/GitBranchSelector.d.ts +23 -0
- package/lib/client/branch/GitBranchSelector.d.ts.map +1 -0
- package/lib/client/branch/GitBranchSelector.js +142 -0
- package/lib/client/branch/GitBranchSelector.js.map +1 -0
- package/lib/client/context/worktree-context-store.d.ts +3 -1
- package/lib/client/context/worktree-context-store.d.ts.map +1 -1
- package/lib/client/context/worktree-context-store.js +4 -2
- package/lib/client/context/worktree-context-store.js.map +1 -1
- package/lib/client/context/worktree-context.d.ts +3 -2
- package/lib/client/context/worktree-context.d.ts.map +1 -1
- package/lib/client/context/worktree-context.js +5 -3
- package/lib/client/context/worktree-context.js.map +1 -1
- package/lib/client/dashboard/WorktreeDashboard.d.ts +11 -3
- package/lib/client/dashboard/WorktreeDashboard.d.ts.map +1 -1
- package/lib/client/dashboard/WorktreeDashboard.js +181 -75
- package/lib/client/dashboard/WorktreeDashboard.js.map +1 -1
- package/lib/client/dashboard/dashboard-selection.d.ts +8 -3
- package/lib/client/dashboard/dashboard-selection.d.ts.map +1 -1
- package/lib/client/dashboard/dashboard-selection.js +29 -4
- package/lib/client/dashboard/dashboard-selection.js.map +1 -1
- package/lib/client/dashboard/git/GitChangedFiles.d.ts +2 -1
- package/lib/client/dashboard/git/GitChangedFiles.d.ts.map +1 -1
- package/lib/client/dashboard/git/GitChangedFiles.js +8 -6
- package/lib/client/dashboard/git/GitChangedFiles.js.map +1 -1
- package/lib/client/dashboard/git/GitCommitList.d.ts +6 -1
- package/lib/client/dashboard/git/GitCommitList.d.ts.map +1 -1
- package/lib/client/dashboard/git/GitCommitList.js +34 -29
- package/lib/client/dashboard/git/GitCommitList.js.map +1 -1
- package/lib/client/dashboard/git/GitCommitStats.d.ts +8 -0
- package/lib/client/dashboard/git/GitCommitStats.d.ts.map +1 -0
- package/lib/client/dashboard/git/GitCommitStats.js +7 -0
- package/lib/client/dashboard/git/GitCommitStats.js.map +1 -0
- package/lib/client/dashboard/git/WorktreeGitOverview.d.ts.map +1 -1
- package/lib/client/dashboard/git/WorktreeGitOverview.js +2 -1
- package/lib/client/dashboard/git/WorktreeGitOverview.js.map +1 -1
- package/lib/client/dashboard/git/WorktreeGitPanel.d.ts +1 -1
- package/lib/client/dashboard/git/WorktreeGitPanel.d.ts.map +1 -1
- package/lib/client/dashboard/git/WorktreeGitPanel.js +28 -9
- package/lib/client/dashboard/git/WorktreeGitPanel.js.map +1 -1
- package/lib/client/dashboard/git/file-address.d.ts +5 -2
- package/lib/client/dashboard/git/file-address.d.ts.map +1 -1
- package/lib/client/dashboard/git/file-address.js +50 -7
- package/lib/client/dashboard/git/file-address.js.map +1 -1
- package/lib/client/dashboard/git/git-facts.js +1 -1
- package/lib/client/dashboard/git/git-facts.js.map +1 -1
- package/lib/client/dashboard/git/useWorktreeGitState.d.ts +7 -2
- package/lib/client/dashboard/git/useWorktreeGitState.d.ts.map +1 -1
- package/lib/client/dashboard/git/useWorktreeGitState.js +84 -21
- package/lib/client/dashboard/git/useWorktreeGitState.js.map +1 -1
- package/lib/client/dsh-icons.d.ts +2 -0
- package/lib/client/dsh-icons.d.ts.map +1 -1
- package/lib/client/dsh-icons.js +2 -0
- package/lib/client/dsh-icons.js.map +1 -1
- package/lib/client/dsh-slot-contract.d.ts +8 -1
- package/lib/client/dsh-slot-contract.d.ts.map +1 -1
- package/lib/client/entry.d.ts.map +1 -1
- package/lib/client/entry.js +22 -4
- package/lib/client/entry.js.map +1 -1
- package/lib/client/locales.d.ts +86 -2
- package/lib/client/locales.d.ts.map +1 -1
- package/lib/client/locales.js +100 -16
- package/lib/client/locales.js.map +1 -1
- package/lib/client/permission/worktree-permission.d.ts.map +1 -1
- package/lib/client/permission/worktree-permission.js +14 -6
- package/lib/client/permission/worktree-permission.js.map +1 -1
- package/lib/client/select/SearchableSingleSelect.d.ts +44 -0
- package/lib/client/select/SearchableSingleSelect.d.ts.map +1 -0
- package/lib/client/select/SearchableSingleSelect.js +180 -0
- package/lib/client/select/SearchableSingleSelect.js.map +1 -0
- package/lib/client/select/WorktreeSelector.d.ts +14 -0
- package/lib/client/select/WorktreeSelector.d.ts.map +1 -0
- package/lib/client/select/WorktreeSelector.js +11 -0
- package/lib/client/select/WorktreeSelector.js.map +1 -0
- package/lib/client/settings/diagnostics.d.ts +4 -0
- package/lib/client/settings/diagnostics.d.ts.map +1 -1
- package/lib/client/settings/diagnostics.js +12 -0
- package/lib/client/settings/diagnostics.js.map +1 -1
- package/lib/client/steer/SteerDock.d.ts +8 -0
- package/lib/client/steer/SteerDock.d.ts.map +1 -0
- package/lib/client/steer/SteerDock.js +12 -0
- package/lib/client/steer/SteerDock.js.map +1 -0
- package/lib/client/steer/steer-activity.d.ts +18 -0
- package/lib/client/steer/steer-activity.d.ts.map +1 -0
- package/lib/client/steer/steer-activity.js +37 -0
- package/lib/client/steer/steer-activity.js.map +1 -0
- package/lib/client/steer/steer-state.d.ts +24 -0
- package/lib/client/steer/steer-state.d.ts.map +1 -0
- package/lib/client/steer/steer-state.js +102 -0
- package/lib/client/steer/steer-state.js.map +1 -0
- package/lib/client/surface/actions/useLifecycleActions.js +1 -1
- package/lib/client/surface/actions/useLifecycleActions.js.map +1 -1
- package/lib/client/surface/actions/useWorktreeRegistration.d.ts +1 -1
- package/lib/client/surface/actions/useWorktreeRegistration.d.ts.map +1 -1
- package/lib/client/surface/actions/useWorktreeRegistration.js +32 -11
- package/lib/client/surface/actions/useWorktreeRegistration.js.map +1 -1
- package/lib/client/surface/components/RegistrationDialog.d.ts +3 -3
- package/lib/client/surface/components/RegistrationDialog.d.ts.map +1 -1
- package/lib/client/surface/components/RegistrationDialog.js +70 -5
- package/lib/client/surface/components/RegistrationDialog.js.map +1 -1
- package/lib/client/surface/components/WorkspaceTree.d.ts.map +1 -1
- package/lib/client/surface/components/WorkspaceTree.js +11 -8
- package/lib/client/surface/components/WorkspaceTree.js.map +1 -1
- package/lib/client/surface/components/dialogs.d.ts +1 -1
- package/lib/client/surface/components/dialogs.d.ts.map +1 -1
- package/lib/client/surface/components/dialogs.js +24 -15
- package/lib/client/surface/components/dialogs.js.map +1 -1
- package/lib/client/surface/state/useRegistrationState.d.ts +6 -1
- package/lib/client/surface/state/useRegistrationState.d.ts.map +1 -1
- package/lib/client/surface/state/useRegistrationState.js +7 -0
- package/lib/client/surface/state/useRegistrationState.js.map +1 -1
- package/lib/client/surface/state/useSurfaceRefresh.d.ts.map +1 -1
- package/lib/client/surface/state/useSurfaceRefresh.js +6 -3
- package/lib/client/surface/state/useSurfaceRefresh.js.map +1 -1
- package/lib/client/surface/types.d.ts +10 -2
- package/lib/client/surface/types.d.ts.map +1 -1
- package/lib/client/view/worktree-error-copy.d.ts.map +1 -1
- package/lib/client/view/worktree-error-copy.js +4 -0
- package/lib/client/view/worktree-error-copy.js.map +1 -1
- package/lib/client/view/worktree-view-read.d.ts +7 -2
- package/lib/client/view/worktree-view-read.d.ts.map +1 -1
- package/lib/client/view/worktree-view-read.js +57 -18
- package/lib/client/view/worktree-view-read.js.map +1 -1
- package/lib/client/worktree-connection.d.ts +4 -0
- package/lib/client/worktree-connection.d.ts.map +1 -1
- package/lib/client/worktree-connection.js +20 -1
- package/lib/client/worktree-connection.js.map +1 -1
- package/lib/client.js +2361 -834
- package/lib/client.js.map +1 -1
- package/lib/contract/baseline-sync.d.ts +27 -0
- package/lib/contract/baseline-sync.d.ts.map +1 -0
- package/lib/contract/baseline-sync.js +2 -0
- package/lib/contract/baseline-sync.js.map +1 -0
- package/lib/contract/index.contract.js +16 -0
- package/lib/contract/index.contract.js.map +1 -1
- package/lib/contract/index.d.ts +73 -12
- package/lib/contract/index.d.ts.map +1 -1
- package/lib/contract/index.js +4 -0
- package/lib/contract/index.js.map +1 -1
- package/lib/contract/worktree-permission.d.ts +2 -0
- package/lib/contract/worktree-permission.d.ts.map +1 -1
- package/lib/contract/worktree-permission.js +1 -1
- package/lib/contract/worktree-permission.js.map +1 -1
- package/lib/contract/worktree-tool-changes.d.ts +2 -0
- package/lib/contract/worktree-tool-changes.d.ts.map +1 -1
- package/lib/host/baseline-sync.d.ts +15 -0
- package/lib/host/baseline-sync.d.ts.map +1 -0
- package/lib/host/baseline-sync.js +93 -0
- package/lib/host/baseline-sync.js.map +1 -0
- package/lib/host/remote.d.ts +2 -1
- package/lib/host/remote.d.ts.map +1 -1
- package/lib/host/remote.js +8 -1
- package/lib/host/remote.js.map +1 -1
- package/lib/host/service.d.ts +18 -6
- package/lib/host/service.d.ts.map +1 -1
- package/lib/host/service.js +45 -2
- package/lib/host/service.js.map +1 -1
- package/lib/host/worktree-permission.d.ts +12 -0
- package/lib/host/worktree-permission.d.ts.map +1 -1
- package/lib/host/worktree-permission.js +87 -16
- package/lib/host/worktree-permission.js.map +1 -1
- package/lib/host/worktree-tool-changes.d.ts +1 -1
- package/lib/host/worktree-tool-changes.d.ts.map +1 -1
- package/lib/host/worktree-tool-changes.js +5 -2
- package/lib/host/worktree-tool-changes.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/manage/manager-git-history.d.ts +5 -7
- package/lib/manage/manager-git-history.d.ts.map +1 -1
- package/lib/manage/manager-git-history.js +158 -65
- package/lib/manage/manager-git-history.js.map +1 -1
- package/lib/manage/manager-git-paths.d.ts +7 -0
- package/lib/manage/manager-git-paths.d.ts.map +1 -0
- package/lib/manage/manager-git-paths.js +62 -0
- package/lib/manage/manager-git-paths.js.map +1 -0
- package/lib/manage/manager-worktrees.d.ts +9 -1
- package/lib/manage/manager-worktrees.d.ts.map +1 -1
- package/lib/manage/manager-worktrees.js +69 -14
- package/lib/manage/manager-worktrees.js.map +1 -1
- package/lib/manage/manager.d.ts +17 -5
- package/lib/manage/manager.d.ts.map +1 -1
- package/lib/manage/manager.js +81 -4
- package/lib/manage/manager.js.map +1 -1
- package/lib/manage/types.d.ts +5 -0
- package/lib/manage/types.d.ts.map +1 -1
- package/lib/provider/git/adapter.d.ts +13 -12
- package/lib/provider/git/adapter.d.ts.map +1 -1
- package/lib/provider/git/adapter.js +152 -29
- package/lib/provider/git/adapter.js.map +1 -1
- package/lib/provider/git/branch-name.d.ts +5 -0
- package/lib/provider/git/branch-name.d.ts.map +1 -0
- package/lib/provider/git/branch-name.js +16 -0
- package/lib/provider/git/branch-name.js.map +1 -0
- package/lib/provider/git/branches.d.ts +11 -0
- package/lib/provider/git/branches.d.ts.map +1 -0
- package/lib/provider/git/branches.js +37 -0
- package/lib/provider/git/branches.js.map +1 -0
- package/lib/provider/sidecar/repository.d.ts.map +1 -1
- package/lib/provider/sidecar/repository.js +2 -1
- package/lib/provider/sidecar/repository.js.map +1 -1
- package/lib/provider/sidecar/sidecar-schema.d.ts.map +1 -1
- package/lib/provider/sidecar/sidecar-schema.js +2 -0
- package/lib/provider/sidecar/sidecar-schema.js.map +1 -1
- package/lib/provider/transaction/operations/create.d.ts.map +1 -1
- package/lib/provider/transaction/operations/create.js +18 -6
- package/lib/provider/transaction/operations/create.js.map +1 -1
- package/lib/provider/transaction/recovery/failure-recovery.d.ts.map +1 -1
- package/lib/provider/transaction/recovery/failure-recovery.js +3 -2
- package/lib/provider/transaction/recovery/failure-recovery.js.map +1 -1
- package/lib/provider/transaction/recovery/recover.d.ts.map +1 -1
- package/lib/provider/transaction/recovery/recover.js +8 -5
- package/lib/provider/transaction/recovery/recover.js.map +1 -1
- package/lib/provider/transaction/support/journal.d.ts.map +1 -1
- package/lib/provider/transaction/support/journal.js +1 -0
- package/lib/provider/transaction/support/journal.js.map +1 -1
- package/lib/provider/types.d.ts +24 -4
- package/lib/provider/types.d.ts.map +1 -1
- package/lib/provider/types.js.map +1 -1
- package/lib/tool/agent-relay.d.ts +55 -0
- package/lib/tool/agent-relay.d.ts.map +1 -0
- package/lib/tool/agent-relay.js +159 -0
- package/lib/tool/agent-relay.js.map +1 -0
- package/lib/tool/delegation.d.ts +1 -0
- package/lib/tool/delegation.d.ts.map +1 -1
- package/lib/tool/delegation.js +32 -6
- package/lib/tool/delegation.js.map +1 -1
- package/lib/tool/dispatch-session.d.ts +18 -0
- package/lib/tool/dispatch-session.d.ts.map +1 -0
- package/lib/tool/dispatch-session.js +41 -0
- package/lib/tool/dispatch-session.js.map +1 -0
- package/lib/tool/errors.d.ts +6 -0
- package/lib/tool/errors.d.ts.map +1 -1
- package/lib/tool/errors.js +16 -2
- package/lib/tool/errors.js.map +1 -1
- package/lib/tool/guidance.d.ts +1 -0
- package/lib/tool/guidance.d.ts.map +1 -1
- package/lib/tool/guidance.js +2 -0
- package/lib/tool/guidance.js.map +1 -1
- package/lib/tool/index.d.ts.map +1 -1
- package/lib/tool/index.js +38 -4
- package/lib/tool/index.js.map +1 -1
- package/lib/tool/inputs.d.ts.map +1 -1
- package/lib/tool/inputs.js +6 -6
- package/lib/tool/inputs.js.map +1 -1
- package/lib/tool/list-models.js +2 -2
- package/lib/tool/list-models.js.map +1 -1
- package/lib/tool/list-sessions.js +2 -2
- package/lib/tool/list-sessions.js.map +1 -1
- package/lib/tool/list-worktrees.d.ts.map +1 -1
- package/lib/tool/list-worktrees.js +9 -2
- package/lib/tool/list-worktrees.js.map +1 -1
- package/lib/tool/native-session.d.ts +4 -0
- package/lib/tool/native-session.d.ts.map +1 -1
- package/lib/tool/native-session.js +17 -0
- package/lib/tool/native-session.js.map +1 -1
- package/lib/tool/new-worktree.js +4 -4
- package/lib/tool/new-worktree.js.map +1 -1
- package/lib/tool/report-result.d.ts.map +1 -1
- package/lib/tool/report-result.js +9 -7
- package/lib/tool/report-result.js.map +1 -1
- package/lib/tool/schema.d.ts +8 -0
- package/lib/tool/schema.d.ts.map +1 -1
- package/lib/tool/schema.js +31 -2
- package/lib/tool/schema.js.map +1 -1
- package/lib/tool/send-message.d.ts.map +1 -1
- package/lib/tool/send-message.js +8 -7
- package/lib/tool/send-message.js.map +1 -1
- package/lib/tool/span-worktree.d.ts.map +1 -1
- package/lib/tool/span-worktree.js +33 -59
- package/lib/tool/span-worktree.js.map +1 -1
- package/lib/tool/types.d.ts +2 -0
- package/lib/tool/types.d.ts.map +1 -1
- package/lib/tool/wire-schema.d.ts +4 -0
- package/lib/tool/wire-schema.d.ts.map +1 -0
- package/lib/tool/wire-schema.js +24 -0
- package/lib/tool/wire-schema.js.map +1 -0
- package/lib/typert.host.js +283 -52
- package/lib/typert.remote-client.d.ts +13 -5
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +283 -52
- package/package.json +7 -2
|
@@ -1,23 +1,51 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { NotificationToasts } from '../surface/components/NotificationToasts.js';
|
|
3
|
+
import { worktreeDiagnostics } from '../settings/diagnostics.js';
|
|
3
4
|
import { toWorktreeViewError } from '../view/worktree-view.js';
|
|
4
5
|
import { formatWorktreeViewError } from '../view/worktree-error-copy.js';
|
|
5
|
-
import { useEffect, useId, useLayoutEffect, useRef, useState } from 'react';
|
|
6
|
-
import { Button,
|
|
7
|
-
import { IconBranchOutline16,
|
|
6
|
+
import { useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
7
|
+
import { Button, Modal, StateDot, Tooltip, writeClipboard, } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
8
|
+
import { IconBranchOutline16, IconChevronRightOutline14, IconCopyOutline16, IconEditOutline16, IconPanelLeftOutline16, } from '../dsh-icons.js';
|
|
8
9
|
import { isBlankSession, relativeTime, sessionDisplayLabel } from '../session/session-view.js';
|
|
9
10
|
import { currentSessionIdFromList } from '../session/session-selection.js';
|
|
10
11
|
import { sessionStatusLabel, sessionTimeLabel } from '../session/session-labels.js';
|
|
11
12
|
import { OpenInAppButton } from './OpenInAppButton.js';
|
|
12
13
|
import { mountDashboardOverlay } from './dashboard-overlay.js';
|
|
13
|
-
import { isMainWorktreeId } from './dashboard-selection.js';
|
|
14
|
+
import { isMainWorktreeId, selectDerivedWorktrees, selectBaseWorktree } from './dashboard-selection.js';
|
|
14
15
|
import { selectWorktreeAcquisitionFacts } from './worktree-acquisition-facts.js';
|
|
15
16
|
import styles from './dashboard.css';
|
|
16
17
|
import { WorktreeInstructions } from './WorktreeInstructions.js';
|
|
17
18
|
import { WorktreeGitPanel } from './git/WorktreeGitPanel.js';
|
|
18
19
|
import { useWorktreeGitOverview, WorktreeGitOverviewValue } from './git/WorktreeGitOverview.js';
|
|
20
|
+
import { GitBranchPicker } from '../branch/GitBranchSelector.js';
|
|
19
21
|
import { ToolSettings } from '../settings/ToolSettings.js';
|
|
20
22
|
const TABS = ['overview', 'git', 'sessions', 'children', 'settings'];
|
|
23
|
+
/** getRandomValues is also available on plain-HTTP LAN origins. */
|
|
24
|
+
function createSyncRequestId() {
|
|
25
|
+
return 'sync:' + Array.from(globalThis.crypto.getRandomValues(new Uint8Array(16)), (byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
26
|
+
}
|
|
27
|
+
function baselineSyncFailureNotices(record, requestId, result, t, onOpenSession) {
|
|
28
|
+
if (result.status === 'dispatched')
|
|
29
|
+
return [];
|
|
30
|
+
const status = result.status;
|
|
31
|
+
const context = record.branch + ' · ' + record.absolutePath;
|
|
32
|
+
return [{
|
|
33
|
+
key: JSON.stringify(['sync', record.workspaceId, record.worktreeId, requestId, result.sessionId]),
|
|
34
|
+
context,
|
|
35
|
+
error: {
|
|
36
|
+
code: 'WORKTREE_SYNC_PARTIAL', message: result.error ?? '', retryable: false,
|
|
37
|
+
details: { workspaceId: record.workspaceId, worktreeId: record.worktreeId,
|
|
38
|
+
requestId, sessionId: result.sessionId, status },
|
|
39
|
+
},
|
|
40
|
+
text: t(`dashboard.sync.${status}`) + ' ' + t('dashboard.sync.partial'),
|
|
41
|
+
message: (translate) => translate(`dashboard.sync.${status}`) + ' ' + translate('dashboard.sync.partial'),
|
|
42
|
+
describe: (translate) => translate('dashboard.action.sync') + ' · ' + context,
|
|
43
|
+
actions: onOpenSession === undefined ? [] : [{
|
|
44
|
+
label: t('dashboard.sync.openSession'), leaveSettings: true,
|
|
45
|
+
onClick: () => onOpenSession(result.sessionId),
|
|
46
|
+
}],
|
|
47
|
+
}];
|
|
48
|
+
}
|
|
21
49
|
function DashboardIcon({ kind }) {
|
|
22
50
|
const paths = {
|
|
23
51
|
overview: 'M3 3h7v7H3z M14 3h7v7h-7z M3 14h7v7H3z M14 14h7v7h-7z',
|
|
@@ -36,27 +64,34 @@ function Card({ title, icon, action, children, }) {
|
|
|
36
64
|
function DashboardFactRow({ label, children, action, baseline = false, }) {
|
|
37
65
|
return (_jsxs("div", { children: [_jsx("dt", { children: label }), _jsx("dd", { "data-dashboard-baseline": baseline ? true : undefined, children: children }), _jsx("span", { className: styles.dashboardFactAction, children: action })] }));
|
|
38
66
|
}
|
|
39
|
-
function
|
|
40
|
-
return (_jsx("button", { type: "button", className: styles.dashboardButton, disabled: true, title: t('dashboard.soon'), children: children }));
|
|
41
|
-
}
|
|
42
|
-
function WorktreeBaselineEditor({ value, branches, currentBranch, onSave, t, disabled, context, }) {
|
|
67
|
+
function WorktreeBaselineEditor({ value, renderValue, branches, loading, currentBranch, onSave, onFetch, onLoad, t, disabled, context, }) {
|
|
43
68
|
const [saved, setSaved] = useState(value);
|
|
44
69
|
const [draft, setDraft] = useState();
|
|
45
|
-
const [search, setSearch] = useState('');
|
|
46
70
|
const [pending, setPending] = useState(false);
|
|
47
71
|
const [error, setError] = useState();
|
|
48
72
|
const busy = useRef(false);
|
|
49
73
|
const alive = useRef(true);
|
|
50
|
-
const optionRefs = useRef([]);
|
|
51
74
|
const trigger = useRef(null);
|
|
52
75
|
const wasOpen = useRef(false);
|
|
53
76
|
const expected = useRef(value);
|
|
54
|
-
|
|
55
|
-
const
|
|
77
|
+
// Workspace projections omit the branch catalog; this editor owns on-demand results.
|
|
78
|
+
const [fetched, setFetched] = useState();
|
|
79
|
+
const [reading, setReading] = useState(false);
|
|
80
|
+
const editorOpen = useRef(false);
|
|
81
|
+
const editorGeneration = useRef(0);
|
|
82
|
+
const requestGeneration = useRef(0);
|
|
83
|
+
const roster = fetched ?? branches;
|
|
84
|
+
const options = useMemo(() => roster.filter((branch) => branch.kind === 'remote' || branch.name !== currentBranch), [roster, currentBranch]);
|
|
85
|
+
const draftMatches = options.filter((branch) => (branch.ref ?? branch.name) === draft ||
|
|
86
|
+
(!draft?.startsWith('refs/') && (branch.name === draft ||
|
|
87
|
+
(branch.kind === 'remote' && 'remotes/' + branch.name === draft))));
|
|
88
|
+
const validDraft = draftMatches.length === 1;
|
|
56
89
|
useEffect(() => {
|
|
57
90
|
alive.current = true;
|
|
58
91
|
return () => {
|
|
59
92
|
alive.current = false;
|
|
93
|
+
editorGeneration.current++;
|
|
94
|
+
requestGeneration.current++;
|
|
60
95
|
};
|
|
61
96
|
}, []);
|
|
62
97
|
useEffect(() => {
|
|
@@ -71,58 +106,48 @@ function WorktreeBaselineEditor({ value, branches, currentBranch, onSave, t, dis
|
|
|
71
106
|
const closeEditor = () => {
|
|
72
107
|
if (pending)
|
|
73
108
|
return;
|
|
109
|
+
editorOpen.current = false;
|
|
110
|
+
editorGeneration.current++;
|
|
111
|
+
requestGeneration.current++;
|
|
112
|
+
setReading(false);
|
|
74
113
|
setDraft(undefined);
|
|
75
|
-
setSearch('');
|
|
76
114
|
setError(undefined);
|
|
77
115
|
};
|
|
78
116
|
const openEditor = () => {
|
|
117
|
+
editorOpen.current = true;
|
|
118
|
+
editorGeneration.current++;
|
|
119
|
+
requestGeneration.current++;
|
|
120
|
+
setReading(false);
|
|
79
121
|
expected.current = saved;
|
|
80
122
|
setDraft(saved ?? '');
|
|
81
|
-
setSearch('');
|
|
82
123
|
setError(undefined);
|
|
83
124
|
};
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return;
|
|
98
|
-
setDraft(branch.name);
|
|
99
|
-
};
|
|
100
|
-
const moveOption = (offset) => {
|
|
101
|
-
if (filteredOptions.length === 0)
|
|
102
|
-
return;
|
|
103
|
-
const nextIndex = activeIndex < 0
|
|
104
|
-
? offset > 0
|
|
105
|
-
? 0
|
|
106
|
-
: filteredOptions.length - 1
|
|
107
|
-
: (activeIndex + offset + filteredOptions.length) % filteredOptions.length;
|
|
108
|
-
selectOption(nextIndex);
|
|
109
|
-
optionRefs.current[nextIndex]?.scrollIntoView({ block: 'nearest' });
|
|
110
|
-
};
|
|
111
|
-
const onSearchKeyDown = (event) => {
|
|
112
|
-
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
113
|
-
event.preventDefault();
|
|
114
|
-
moveOption(event.key === 'ArrowDown' ? 1 : -1);
|
|
125
|
+
const lifetime = editorGeneration.current;
|
|
126
|
+
const readBranches = async (read) => {
|
|
127
|
+
if (!alive.current || !editorOpen.current || editorGeneration.current !== lifetime)
|
|
128
|
+
return options;
|
|
129
|
+
const request = ++requestGeneration.current;
|
|
130
|
+
const isCurrent = () => alive.current && editorOpen.current &&
|
|
131
|
+
editorGeneration.current === lifetime && requestGeneration.current === request;
|
|
132
|
+
setReading(true);
|
|
133
|
+
try {
|
|
134
|
+
const next = await read();
|
|
135
|
+
if (isCurrent())
|
|
136
|
+
setFetched(next);
|
|
137
|
+
return next.filter((branch) => branch.kind === 'remote' || branch.name !== currentBranch);
|
|
115
138
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
139
|
+
finally {
|
|
140
|
+
if (isCurrent())
|
|
141
|
+
setReading(false);
|
|
119
142
|
}
|
|
120
143
|
};
|
|
121
144
|
const save = async () => {
|
|
122
145
|
if (busy.current ||
|
|
123
146
|
draft === undefined ||
|
|
124
147
|
onSave === undefined ||
|
|
125
|
-
|
|
148
|
+
loading ||
|
|
149
|
+
reading ||
|
|
150
|
+
!validDraft)
|
|
126
151
|
return;
|
|
127
152
|
busy.current = true;
|
|
128
153
|
setPending(true);
|
|
@@ -132,8 +157,10 @@ function WorktreeBaselineEditor({ value, branches, currentBranch, onSave, t, dis
|
|
|
132
157
|
if (alive.current) {
|
|
133
158
|
setSaved(result);
|
|
134
159
|
expected.current = result;
|
|
160
|
+
editorOpen.current = false;
|
|
161
|
+
editorGeneration.current++;
|
|
162
|
+
requestGeneration.current++;
|
|
135
163
|
setDraft(undefined);
|
|
136
|
-
setSearch('');
|
|
137
164
|
}
|
|
138
165
|
}
|
|
139
166
|
catch (cause) {
|
|
@@ -146,9 +173,7 @@ function WorktreeBaselineEditor({ value, branches, currentBranch, onSave, t, dis
|
|
|
146
173
|
setPending(false);
|
|
147
174
|
}
|
|
148
175
|
};
|
|
149
|
-
return (_jsxs(_Fragment, { children: [_jsx(DashboardFactRow, { label: t('dashboard.base'), baseline: true, action: onSave !== undefined ? (_jsx(Tooltip, { label: t('dashboard.editBase'), side: "bottom", delayMs: 500, disabled: disabled || options.length === 0, children: _jsx("button", { type: "button", ref: trigger, className: styles.dashboardIconButton, "data-dashboard-baseline-edit": true, "aria-label": t('dashboard.editBase'), title: t('dashboard.editBase'), "aria-haspopup": "dialog", "aria-expanded": draft !== undefined, disabled: disabled || options.length === 0, onClick: openEditor, children: _jsx(IconEditOutline16, {}) }) })) : undefined, children: saved === undefined ? (_jsx("span", { className: styles.dashboardHistorical, children: t('dashboard.historicalUnavailable') })) : (_jsx("span", { "data-dashboard-baseline-value": true, children: saved })) }), _jsx(Modal, { open: draft !== undefined, onClose: closeEditor, closeLabel: t('dialog.closeBaseline'), title: t('dashboard.editBase'), description: t('dashboard.editBaseDescription'), className: styles.dashboardBaselineModal, contentClassName: styles.dashboardBaselineModalContent, footer: _jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", disabled: pending, onClick: closeEditor, children: t('dashboard.cancelBase') }), _jsx(Button, { variant: "primary", "data-dashboard-baseline-save": true, disabled: pending || disabled ||
|
|
150
|
-
optionRefs.current[index] = element;
|
|
151
|
-
}, id: `${pickerId}-option-${index}`, className: styles.dashboardBaselineOption, "data-dashboard-baseline-option": branch.name, "data-highlighted": activeIndex === index ? true : undefined, role: "option", "aria-selected": branch.name === draft, onClick: () => selectOption(index), children: [_jsx(IconBranchOutline16, {}), _jsx("span", { className: styles.dashboardBaselineOptionLabel, children: branch.name }), branch.name === draft && _jsx(IconCheckOutline16, {})] }, branch.name))) })) : (_jsx("div", { className: styles.dashboardBaselineEmpty, "data-dashboard-baseline-empty": true, role: "status", "aria-live": "polite", children: t('dashboard.noMatchingBranches') })) }), _jsx(NotificationToasts, { notices: error === undefined
|
|
176
|
+
return (_jsxs(_Fragment, { children: [_jsx(DashboardFactRow, { label: t('dashboard.base'), baseline: true, action: onSave !== undefined ? (_jsx(Tooltip, { label: t('dashboard.editBase'), side: "bottom", delayMs: 500, disabled: disabled || (options.length === 0 && onLoad === undefined), children: _jsx("button", { type: "button", ref: trigger, className: styles.dashboardIconButton, "data-dashboard-baseline-edit": true, "aria-label": t('dashboard.editBase'), title: t('dashboard.editBase'), "aria-haspopup": "dialog", "aria-expanded": draft !== undefined, disabled: disabled || (options.length === 0 && onLoad === undefined), onClick: openEditor, children: _jsx(IconEditOutline16, {}) }) })) : undefined, children: renderValue !== undefined ? renderValue(saved) : saved === undefined ? (_jsx("span", { className: styles.dashboardHistorical, children: t('dashboard.historicalUnavailable') })) : (_jsx("span", { "data-dashboard-baseline-value": true, title: saved, children: saved.replace(/^refs\/(heads|remotes)\//u, '') })) }), _jsx(Modal, { open: draft !== undefined, onClose: closeEditor, closeLabel: t('dialog.closeBaseline'), title: t('dashboard.editBase'), description: t('dashboard.editBaseDescription'), className: styles.dashboardBaselineModal, contentClassName: styles.dashboardBaselineModalContent, footer: _jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", disabled: pending, onClick: closeEditor, children: t('dashboard.cancelBase') }), _jsx(Button, { variant: "primary", "data-dashboard-baseline-save": true, disabled: pending || disabled || loading || reading || !validDraft, onClick: () => void save(), children: t(pending ? 'dashboard.savingBase' : 'dashboard.saveBase') })] }), children: _jsxs("div", { className: styles.dashboardBaselinePicker, "data-dashboard-baseline-modal": true, children: [draft !== undefined && _jsx(GitBranchPicker, { branches: options, value: draft, onChange: setDraft, t: t, disabled: pending || disabled, loading: loading, onClose: closeEditor, onLoad: onLoad === undefined ? undefined : () => readBranches(onLoad), onFetch: onFetch === undefined ? undefined : () => readBranches(onFetch) }, lifetime), _jsx(NotificationToasts, { notices: error === undefined
|
|
152
177
|
? []
|
|
153
178
|
: [
|
|
154
179
|
{
|
|
@@ -167,7 +192,7 @@ function WorktreeBaselineEditor({ value, branches, currentBranch, onSave, t, dis
|
|
|
167
192
|
] })] }) })] }));
|
|
168
193
|
}
|
|
169
194
|
/** A managed Worktree or browser Main projection with explicit unavailable states for inapplicable facts. */
|
|
170
|
-
export function WorktreeDashboard({ manager, record, workspaceTitle, t, onClose, onOpenSidebar, isRightSidebarExpanded, sessions, sessionPresentations, sessionIds, actionPending, onOpenSession, onCreateSession, onCreateWorktree, onArchiveWorktree, onOpenFile, onSaveInstructions, onSaveBaseline, branches = [], }) {
|
|
195
|
+
export function WorktreeDashboard({ manager, record, worktrees = [], mainRecord, onOpenWorktree, workspaceTitle, t, onClose, onOpenSidebar, isRightSidebarExpanded, sessions, sessionPresentations, sessionIds, actionPending, onOpenSession, onCreateSession, onCreateWorktree, onArchiveWorktree, onSyncBaseline, onOpenFile, onSaveInstructions, onSaveBaseline, onFetchBranches, onLoadBranches, branches = [], branchesLoading = false, }) {
|
|
171
196
|
const surface = useRef(null);
|
|
172
197
|
const heading = useRef(null);
|
|
173
198
|
const [placement, setPlacement] = useState();
|
|
@@ -222,7 +247,7 @@ export function WorktreeDashboard({ manager, record, workspaceTitle, t, onClose,
|
|
|
222
247
|
return () => {
|
|
223
248
|
branchCopyGeneration.current += 1;
|
|
224
249
|
};
|
|
225
|
-
}, [record.branch]);
|
|
250
|
+
}, [record.branch, record.currentBranch, record.currentHead?.name]);
|
|
226
251
|
const copyPath = async () => {
|
|
227
252
|
if (copyPending.current)
|
|
228
253
|
return;
|
|
@@ -243,8 +268,10 @@ export function WorktreeDashboard({ manager, record, workspaceTitle, t, onClose,
|
|
|
243
268
|
copyPending.current = false;
|
|
244
269
|
}
|
|
245
270
|
};
|
|
246
|
-
const
|
|
247
|
-
const
|
|
271
|
+
const isMain = isMainWorktreeId(record.worktreeId);
|
|
272
|
+
const refName = record.currentHead?.name ?? record.currentBranch ?? record.branch;
|
|
273
|
+
const branchAvailable = refName.length > 0;
|
|
274
|
+
const displayBranch = branchAvailable ? refName : t('dashboard.branchUnavailable');
|
|
248
275
|
const copyBranch = async () => {
|
|
249
276
|
if (!branchAvailable || branchCopyPending.current)
|
|
250
277
|
return;
|
|
@@ -252,7 +279,7 @@ export function WorktreeDashboard({ manager, record, workspaceTitle, t, onClose,
|
|
|
252
279
|
const generation = branchCopyGeneration.current;
|
|
253
280
|
setBranchCopyState('pending');
|
|
254
281
|
try {
|
|
255
|
-
const copied = await writeClipboard(
|
|
282
|
+
const copied = await writeClipboard(refName);
|
|
256
283
|
if (generation === branchCopyGeneration.current)
|
|
257
284
|
setBranchCopyState(copied ? 'copied' : 'failed');
|
|
258
285
|
}
|
|
@@ -265,7 +292,7 @@ export function WorktreeDashboard({ manager, record, workspaceTitle, t, onClose,
|
|
|
265
292
|
branchCopyPending.current = false;
|
|
266
293
|
}
|
|
267
294
|
};
|
|
268
|
-
const healthKey = record.health === 'ready'
|
|
295
|
+
const healthKey = isMain ? 'dashboard.mainReady' : record.health === 'ready'
|
|
269
296
|
? 'worktree.ready'
|
|
270
297
|
: record.health === 'repair'
|
|
271
298
|
? 'worktree.repair'
|
|
@@ -276,10 +303,10 @@ export function WorktreeDashboard({ manager, record, workspaceTitle, t, onClose,
|
|
|
276
303
|
: record.health === 'cleaned'
|
|
277
304
|
? 'dashboard.cleaned'
|
|
278
305
|
: 'dashboard.unknown';
|
|
279
|
-
const liveBranch = record.currentBranch === null
|
|
306
|
+
const liveBranch = record.currentHead?.name ?? (record.currentBranch === null
|
|
280
307
|
? t('dashboard.detached')
|
|
281
308
|
: (record.currentBranch ??
|
|
282
|
-
(branchAvailable ? record.branch : t('dashboard.branchUnavailable')));
|
|
309
|
+
(branchAvailable ? record.branch : t('dashboard.branchUnavailable'))));
|
|
283
310
|
const baselineCurrentBranch = record.currentBranch === undefined ? record.branch : (record.currentBranch ?? undefined);
|
|
284
311
|
const persistBaseline = onSaveBaseline === undefined
|
|
285
312
|
? undefined
|
|
@@ -289,6 +316,73 @@ export function WorktreeDashboard({ manager, record, workspaceTitle, t, onClose,
|
|
|
289
316
|
return result;
|
|
290
317
|
};
|
|
291
318
|
const displayedBaseline = onSaveBaseline === undefined ? record.baseBranch : baselineBranch;
|
|
319
|
+
const [syncOpen, setSyncOpen] = useState(false);
|
|
320
|
+
const [syncStrategy, setSyncStrategy] = useState('rebase');
|
|
321
|
+
const [syncPending, setSyncPending] = useState(false);
|
|
322
|
+
const [syncError, setSyncError] = useState();
|
|
323
|
+
const [syncResult, setSyncResult] = useState();
|
|
324
|
+
const syncRequest = useRef();
|
|
325
|
+
const syncBusy = useRef(false);
|
|
326
|
+
const syncGeneration = useRef(0);
|
|
327
|
+
useEffect(() => {
|
|
328
|
+
syncGeneration.current++;
|
|
329
|
+
syncBusy.current = false;
|
|
330
|
+
syncRequest.current = undefined;
|
|
331
|
+
setSyncOpen(false);
|
|
332
|
+
setSyncPending(false);
|
|
333
|
+
setSyncError(undefined);
|
|
334
|
+
setSyncResult(undefined);
|
|
335
|
+
return () => { syncGeneration.current++; };
|
|
336
|
+
}, [record.workspaceId, record.worktreeId, displayedBaseline, manager]);
|
|
337
|
+
const closeSync = () => {
|
|
338
|
+
if (syncBusy.current)
|
|
339
|
+
return;
|
|
340
|
+
syncGeneration.current++;
|
|
341
|
+
setSyncOpen(false);
|
|
342
|
+
};
|
|
343
|
+
const startSync = async () => {
|
|
344
|
+
if (syncBusy.current || syncResult || !onSyncBaseline || !displayedBaseline)
|
|
345
|
+
return;
|
|
346
|
+
const generation = syncGeneration.current;
|
|
347
|
+
syncBusy.current = true;
|
|
348
|
+
setSyncPending(true);
|
|
349
|
+
setSyncError(undefined);
|
|
350
|
+
let requestId = syncRequest.current;
|
|
351
|
+
try {
|
|
352
|
+
requestId ??= createSyncRequestId();
|
|
353
|
+
syncRequest.current = requestId;
|
|
354
|
+
const result = await onSyncBaseline(syncStrategy, displayedBaseline, requestId);
|
|
355
|
+
if (generation !== syncGeneration.current) {
|
|
356
|
+
// Retiring navigation must not discard an already-created Session's failure.
|
|
357
|
+
// Capture the original identity without reviving UI sources or callbacks.
|
|
358
|
+
if (result.status !== 'dispatched')
|
|
359
|
+
worktreeDiagnostics.recordInactive('sync:' + requestId, baselineSyncFailureNotices(record, requestId, result, t));
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
setSyncResult(result);
|
|
363
|
+
if (result.status === 'dispatched') {
|
|
364
|
+
setSyncOpen(false);
|
|
365
|
+
onOpenSession(result.sessionId);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
catch (cause) {
|
|
369
|
+
if (generation === syncGeneration.current)
|
|
370
|
+
setSyncError(toWorktreeViewError(cause));
|
|
371
|
+
}
|
|
372
|
+
finally {
|
|
373
|
+
if (generation === syncGeneration.current) {
|
|
374
|
+
syncBusy.current = false;
|
|
375
|
+
setSyncPending(false);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
const partialSync = syncResult !== undefined && syncResult.status !== 'dispatched'
|
|
380
|
+
? { ...syncResult, status: syncResult.status } : undefined;
|
|
381
|
+
const renderBaseline = (value) => {
|
|
382
|
+
const label = value === undefined ? (_jsx("span", { className: styles.dashboardHistorical, children: t('dashboard.historicalUnavailable') })) : (_jsx("span", { "data-dashboard-baseline-value": true, title: value, children: value.replace(/^refs\/(heads|remotes)\//u, '') }));
|
|
383
|
+
const base = selectBaseWorktree(record, worktrees, mainRecord, value);
|
|
384
|
+
return base === undefined || onOpenWorktree === undefined ? label : (_jsxs("button", { type: "button", className: styles.dashboardBaseLink, "data-dashboard-base-worktree": base.worktreeId, "aria-label": t('dashboard.openBaseWorktree'), title: t('dashboard.openBaseWorktree'), onClick: () => onOpenWorktree(base), children: [label, _jsx(IconChevronRightOutline14, {})] }));
|
|
385
|
+
};
|
|
292
386
|
const gitOverview = useWorktreeGitOverview({
|
|
293
387
|
manager,
|
|
294
388
|
workspaceId: record.workspaceId,
|
|
@@ -300,14 +394,19 @@ export function WorktreeDashboard({ manager, record, workspaceTitle, t, onClose,
|
|
|
300
394
|
const acquisitionFacts = selectWorktreeAcquisitionFacts(record);
|
|
301
395
|
const acquisitionLabel = acquisitionFacts.timestampKind === 'imported' ? 'dashboard.imported' : 'dashboard.created';
|
|
302
396
|
const tabLabel = (value) => t(`dashboard.tab.${value}`);
|
|
303
|
-
const
|
|
397
|
+
const derivedWorktrees = selectDerivedWorktrees(record, worktrees);
|
|
398
|
+
const worktreeList = (records) => records.length === 0 ? (_jsx("div", { className: styles.dashboardEmpty, children: _jsx("p", { children: t('dashboard.noChildren') }) })) : (_jsx("ul", { className: styles.dashboardSessions, children: records.map((child) => (_jsx("li", { children: _jsxs("button", { type: "button", "data-dashboard-worktree": child.worktreeId, disabled: onOpenWorktree === undefined, onClick: () => onOpenWorktree?.(child), children: [_jsx(IconBranchOutline16, {}), _jsxs("span", { className: styles.dashboardSessionLabel, children: [_jsx("strong", { children: child.currentHead?.name ?? child.currentBranch ?? child.branch }), _jsx("code", { className: styles.dashboardChildPath, children: child.absolutePath })] }), _jsxs("span", { className: styles.dashboardChildState, children: [child.status === 'removed' && _jsx("span", { className: styles.dashboardSoon, children: t('dashboard.archived') }), _jsx("span", { className: styles.dashboardHealth, "data-health": child.health ?? 'unknown', children: t(child.health === 'ready' ? 'worktree.ready'
|
|
399
|
+
: child.health === 'repair' ? 'worktree.repair'
|
|
400
|
+
: child.health === 'recovery-needed' ? 'worktree.recovery'
|
|
401
|
+
: child.health === 'branch-drift' ? 'worktree.branchDrift'
|
|
402
|
+
: child.health === 'cleaned' ? 'dashboard.cleaned' : 'dashboard.unknown') })] }), _jsx("span", { "aria-hidden": "true", children: "\u2192" })] }) }, child.worktreeId))) }));
|
|
304
403
|
const selectTab = (next, focus = false) => {
|
|
305
404
|
setTab(next);
|
|
306
405
|
if (focus)
|
|
307
406
|
document.getElementById(`${id}-${next}`)?.focus();
|
|
308
407
|
};
|
|
309
408
|
const tabLink = (next, label) => (_jsxs("button", { type: "button", className: styles.dashboardLink, onClick: () => selectTab(next, true), children: [label, _jsx("span", { "aria-hidden": "true", children: "\u2192" })] }));
|
|
310
|
-
const sessionList = (ids) => ids.length === 0 ? (
|
|
409
|
+
const sessionList = (ids) => ids.length === 0 ? (_jsxs("div", { className: styles.dashboardEmpty, children: [_jsx("p", { children: t('dashboard.noSessions') }), onCreateSession !== undefined && _jsx("button", { type: "button", className: styles.dashboardButton, disabled: actionPending, onClick: onCreateSession, children: t('dashboard.newSession') })] })) : (_jsx("ul", { className: styles.dashboardSessions, children: ids.map((sessionId) => {
|
|
311
410
|
const presentation = sessionPresentations[sessionId];
|
|
312
411
|
const blank = isBlankSession(sessionId, sessions);
|
|
313
412
|
const statusLabel = presentation === undefined ? undefined : sessionStatusLabel(t, presentation.status);
|
|
@@ -327,6 +426,12 @@ export function WorktreeDashboard({ manager, record, workspaceTitle, t, onClose,
|
|
|
327
426
|
if (event.defaultPrevented)
|
|
328
427
|
return;
|
|
329
428
|
if (event.key === 'Escape') {
|
|
429
|
+
// Portal keys bubble through this React ancestor before the native
|
|
430
|
+
// Modal's document listener. Let it closeSync (including its busy guard).
|
|
431
|
+
if (syncOpen)
|
|
432
|
+
return;
|
|
433
|
+
if (event.target?.closest?.('[data-single-select-picker]'))
|
|
434
|
+
return;
|
|
330
435
|
// Other dashboard menus own Escape even when focus remains elsewhere in the surface.
|
|
331
436
|
if (event.currentTarget.querySelector('[role="menu"]'))
|
|
332
437
|
return;
|
|
@@ -343,14 +448,7 @@ export function WorktreeDashboard({ manager, record, workspaceTitle, t, onClose,
|
|
|
343
448
|
}, children: topActionIsCreateSession ? t('dashboard.newSession') : _jsxs(_Fragment, { children: ["\u2190 ", t('dashboard.back')] }) }), !rightSidebarOpen && onOpenSidebar !== undefined && (_jsx(Tooltip, { label: t('dashboard.openSidebar'), side: "bottom", delayMs: 500, children: _jsx("button", { type: "button", className: styles.dashboardSidebarButton, "aria-label": t('dashboard.openSidebar'), title: t('dashboard.openSidebar'), "data-sidebar-right-expand": true, onClick: () => {
|
|
344
449
|
onOpenSidebar();
|
|
345
450
|
setRightSidebarOpen(true);
|
|
346
|
-
}, children: _jsx(IconPanelLeftOutline16, {}) }) }))] })] }), _jsxs("div", { className: styles.dashboardPage, children: [_jsxs("header", { className: styles.dashboardHeader, children: [_jsxs("div", { className: styles.dashboardIdentity, children: [_jsxs("div", { className: styles.dashboardTitleRow,
|
|
347
|
-
? (event) => {
|
|
348
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
349
|
-
event.preventDefault();
|
|
350
|
-
void copyBranch();
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
: undefined, children: [_jsx(IconBranchOutline16, {}), _jsx("h1", { id: `${id}-title`, ref: heading, tabIndex: -1, children: displayBranch }), _jsxs("span", { className: styles.dashboardHealth, "data-health": record.health ?? 'unknown', children: [_jsx("span", { "aria-hidden": "true", children: "\u25CF" }), t(healthKey)] }), record.status === 'removed' && (_jsx("span", { className: styles.dashboardSoon, children: t('dashboard.archived') }))] }), _jsxs("div", { className: styles.dashboardPath, children: [_jsx("span", { className: styles.dashboardFieldLabel, children: "cwd" }), _jsx("code", { children: record.absolutePath }), _jsx("button", { type: "button", className: styles.dashboardIconButton, "aria-label": t('worktree.copyPath'), title: t('worktree.copyPath'), disabled: copyState === 'pending', onClick: () => {
|
|
451
|
+
}, children: _jsx(IconPanelLeftOutline16, {}) }) }))] })] }), _jsxs("div", { className: styles.dashboardPage, children: [_jsxs("header", { className: styles.dashboardHeader, children: [_jsxs("div", { className: styles.dashboardIdentity, children: [_jsxs("div", { className: styles.dashboardTitleRow, children: [_jsx(IconBranchOutline16, {}), _jsx("h1", { id: `${id}-title`, ref: heading, tabIndex: -1, children: _jsx("button", { type: "button", className: styles.dashboardRefButton, "data-dashboard-copy": "branch", disabled: !branchAvailable, "aria-label": branchAvailable ? t('dashboard.copyBranch') : undefined, title: branchAvailable ? t('dashboard.copyBranch') : undefined, "aria-busy": branchAvailable && branchCopyState === 'pending' ? true : undefined, onClick: branchAvailable ? () => void copyBranch() : undefined, children: displayBranch }) }), record.currentHead?.kind !== undefined && record.currentHead.kind !== 'branch' && _jsx("span", { className: styles.dashboardSoon, children: t(record.currentHead.kind === 'tag' ? 'dashboard.refKind.tag' : 'dashboard.refKind.commit') }), _jsxs("span", { className: styles.dashboardHealth, "data-health": isMain ? 'local' : record.health ?? 'unknown', children: [_jsx("span", { "aria-hidden": "true", children: "\u25CF" }), t(healthKey)] }), record.status === 'removed' && (_jsx("span", { className: styles.dashboardSoon, children: t('dashboard.archived') }))] }), _jsxs("div", { className: styles.dashboardPath, children: [_jsx("span", { className: styles.dashboardFieldLabel, children: "cwd" }), _jsx("code", { children: record.absolutePath }), _jsx("button", { type: "button", className: styles.dashboardIconButton, "aria-label": t('worktree.copyPath'), title: t('worktree.copyPath'), disabled: copyState === 'pending', onClick: () => {
|
|
354
452
|
void copyPath();
|
|
355
453
|
}, children: _jsx(IconCopyOutline16, {}) })] }), _jsx(NotificationToasts, { notices: [
|
|
356
454
|
...(branchCopyState === 'failed'
|
|
@@ -367,7 +465,7 @@ export function WorktreeDashboard({ manager, record, workspaceTitle, t, onClose,
|
|
|
367
465
|
? t('dashboard.branchCopied')
|
|
368
466
|
: copyState === 'copied'
|
|
369
467
|
? t('dashboard.copied')
|
|
370
|
-
: '\u00a0' })] }), _jsx("div", { className: styles.dashboardHeaderAside, children: _jsxs("dl", { className: styles.dashboardFacts
|
|
468
|
+
: '\u00a0' })] }), _jsx("div", { className: styles.dashboardHeaderAside, children: _jsxs("dl", { className: `${styles.dashboardFacts} ${styles.dashboardHeaderFacts}`, children: [!isMain && _jsx(DashboardFactRow, { label: t(acquisitionLabel), children: acquisitionFacts.timestamp ? (_jsx("time", { dateTime: acquisitionFacts.timestamp, children: new Date(acquisitionFacts.timestamp).toLocaleString() })) : (_jsx("span", { className: styles.dashboardHistorical, children: t('dashboard.historicalUnavailable') })) }), !isMain && (persistBaseline !== undefined ? (_jsx(WorktreeBaselineEditor, { context: workspaceTitle + ' · ' + record.branch + ' · ' + record.absolutePath, value: baselineBranch, renderValue: renderBaseline, branches: branches, loading: branchesLoading, currentBranch: baselineCurrentBranch, onSave: persistBaseline, onFetch: onFetchBranches, onLoad: onLoadBranches, t: t, disabled: record.status !== 'active' || record.health === 'recovery-needed' })) : (_jsx(DashboardFactRow, { label: t('dashboard.base'), baseline: true, children: renderBaseline(displayedBaseline) }))), _jsx(DashboardFactRow, { label: t('dashboard.source'), children: isMainWorktreeId(record.worktreeId)
|
|
371
469
|
? t('worktree.main')
|
|
372
470
|
: t(record.source === 'external' ? 'dashboard.external' : 'dashboard.plugin') })] }) })] }), _jsx("div", { className: styles.dashboardTabs, role: "tablist", "aria-label": t('dashboard.title'), children: TABS.map((value) => (_jsxs("button", { type: "button", id: `${id}-${value}`, role: "tab", "aria-selected": tab === value, "aria-controls": `${id}-panel`, tabIndex: tab === value ? 0 : -1, onClick: () => selectTab(value), onKeyDown: (event) => {
|
|
373
471
|
const index = TABS.indexOf(value);
|
|
@@ -384,11 +482,19 @@ export function WorktreeDashboard({ manager, record, workspaceTitle, t, onClose,
|
|
|
384
482
|
event.preventDefault();
|
|
385
483
|
selectTab(next, true);
|
|
386
484
|
}
|
|
387
|
-
}, children: [_jsx(DashboardIcon, { kind: value }), tabLabel(value)] }, value))) }), _jsx("div", { id: `${id}-panel`, role: "tabpanel", "aria-labelledby": `${id}-${tab}`, tabIndex: 0, className: styles.dashboardPanel, children: tab === 'overview' ? (_jsxs("div", { className: styles.dashboardGrid, children: [_jsxs("div", { className: styles.dashboardColumn, children: [_jsxs("section", { className: styles.dashboardStart, children: [_jsxs("h2", { children: [_jsx(IconBranchOutline16, {}), t('dashboard.start')] }), _jsx("p", { children: t('dashboard.startDescription') }), _jsxs("div", { className: styles.dashboardStartActions, children: [_jsxs("button", { type: "button", disabled: actionPending || !onCreateWorktree, onClick: onCreateWorktree, "data-dashboard-action": "create-worktree", children: [_jsx(DashboardIcon, { kind: "git" }), _jsxs("span", { children: [_jsx("strong", { children: t('dashboard.newWorktree') }), _jsx("small", { children: t('dashboard.newWorktreeDescription') })] })] }), _jsxs("button", { type: "button", disabled: actionPending || !onCreateSession, onClick: onCreateSession, "data-dashboard-action": "create-session", children: [_jsx(DashboardIcon, { kind: "sessions" }), _jsxs("span", { children: [_jsx("strong", { children: t('dashboard.newSession') }), _jsx("small", { children: t('dashboard.newSessionDescription') })] })] })] })] }), _jsxs(Card, { title: t('dashboard.instructions'), icon: _jsx(DashboardIcon, { kind: "instructions" }), children: [_jsx("p", { children: t('dashboard.instructionsDescription') }), _jsx(WorktreeInstructions, { context: workspaceTitle + ' · ' + record.branch + ' · ' + record.absolutePath, value: record.instructions ?? '', onSave: onSaveInstructions, t: t, disabled: actionPending || record.health === 'recovery-needed' })] }), _jsxs(Card, { title: tabLabel('sessions'), icon: _jsx(DashboardIcon, { kind: "sessions" }), action: _jsx("span", { children: sessionIds.length }), children: [sessionList(sessionIds.slice(0, 5)), tabLink('sessions', t('dashboard.viewSessions'))] })] }), _jsxs("div", { className: styles.dashboardColumn, children: [_jsxs(Card, { title: t('dashboard.status'), icon: _jsx(DashboardIcon, { kind: "git" }), children: [_jsx("p", { children: t('dashboard.statusHint') }), _jsxs("dl", { className: styles.dashboardFacts, children: [_jsx(DashboardFactRow, { label: t('dashboard.health'), children: t(healthKey) }), _jsx(DashboardFactRow, { label: t('dashboard.branch'), children: liveBranch }), _jsx(DashboardFactRow, { label: t('dashboard.base'), children: displayedBaseline ?? (_jsx("span", { className: styles.dashboardHistorical, children: t('dashboard.historicalUnavailable') })) }), _jsx(DashboardFactRow, { label: t('dashboard.aheadBehind'), children: _jsx(WorktreeGitOverviewValue, { state: gitOverview, metric: "aheadBehind", t: t }) }), _jsx(DashboardFactRow, { label: t('dashboard.committedChanges'), children: _jsx(WorktreeGitOverviewValue, { state: gitOverview, metric: "committed", t: t }) }), _jsx(DashboardFactRow, { label: t('dashboard.workingTree'), children: _jsx(WorktreeGitOverviewValue, { state: gitOverview, metric: "workingTree", t: t }) })] }), tabLink('git', t('dashboard.viewDetails'))] }), _jsxs(Card, { title: t('dashboard.derived'), icon: _jsx(DashboardIcon, { kind: "children" }), action:
|
|
485
|
+
}, children: [_jsx(DashboardIcon, { kind: value }), tabLabel(value)] }, value))) }), _jsx("div", { id: `${id}-panel`, role: "tabpanel", "aria-labelledby": `${id}-${tab}`, tabIndex: 0, className: styles.dashboardPanel, children: tab === 'overview' ? (_jsxs("div", { className: styles.dashboardGrid, children: [_jsxs("div", { className: styles.dashboardColumn, children: [_jsxs("section", { className: styles.dashboardStart, children: [_jsxs("h2", { children: [_jsx(IconBranchOutline16, {}), t('dashboard.start')] }), _jsx("p", { children: t('dashboard.startDescription') }), _jsxs("div", { className: styles.dashboardStartActions, children: [_jsxs("button", { type: "button", disabled: actionPending || !onCreateWorktree, onClick: onCreateWorktree, "data-dashboard-action": "create-worktree", children: [_jsx(DashboardIcon, { kind: "git" }), _jsxs("span", { children: [_jsx("strong", { children: t('dashboard.newWorktree') }), _jsx("small", { children: t('dashboard.newWorktreeDescription') })] })] }), _jsxs("button", { type: "button", disabled: actionPending || !onCreateSession, onClick: onCreateSession, "data-dashboard-action": "create-session", children: [_jsx(DashboardIcon, { kind: "sessions" }), _jsxs("span", { children: [_jsx("strong", { children: t('dashboard.newSession') }), _jsx("small", { children: t('dashboard.newSessionDescription') })] })] })] })] }), _jsxs(Card, { title: t('dashboard.instructions'), icon: _jsx(DashboardIcon, { kind: "instructions" }), children: [_jsx("p", { children: t('dashboard.instructionsDescription') }), _jsx(WorktreeInstructions, { context: workspaceTitle + ' · ' + record.branch + ' · ' + record.absolutePath, value: record.instructions ?? '', onSave: onSaveInstructions, t: t, disabled: actionPending || record.health === 'recovery-needed' })] }), _jsxs(Card, { title: tabLabel('sessions'), icon: _jsx(DashboardIcon, { kind: "sessions" }), action: _jsx("span", { children: sessionIds.length }), children: [sessionList(sessionIds.slice(0, 5)), tabLink('sessions', t('dashboard.viewSessions'))] })] }), _jsxs("div", { className: styles.dashboardColumn, children: [_jsxs(Card, { title: t('dashboard.status'), icon: _jsx(DashboardIcon, { kind: "git" }), children: [_jsx("p", { children: t('dashboard.statusHint') }), _jsxs("dl", { className: styles.dashboardFacts, children: [_jsx(DashboardFactRow, { label: t('dashboard.health'), children: t(healthKey) }), _jsx(DashboardFactRow, { label: t('dashboard.branch'), children: liveBranch }), !isMain && _jsx(DashboardFactRow, { label: t('dashboard.base'), children: displayedBaseline?.replace(/^refs\/(heads|remotes)\//u, '') ?? (_jsx("span", { className: styles.dashboardHistorical, children: t('dashboard.historicalUnavailable') })) }), _jsx(DashboardFactRow, { label: t('dashboard.aheadBehind'), children: _jsx(WorktreeGitOverviewValue, { state: gitOverview, metric: "aheadBehind", t: t }) }), _jsx(DashboardFactRow, { label: t('dashboard.committedChanges'), children: _jsx(WorktreeGitOverviewValue, { state: gitOverview, metric: "committed", t: t }) }), _jsx(DashboardFactRow, { label: t('dashboard.workingTree'), children: _jsx(WorktreeGitOverviewValue, { state: gitOverview, metric: "workingTree", t: t }) })] }), tabLink('git', t('dashboard.viewDetails'))] }), _jsxs(Card, { title: t('dashboard.derived'), icon: _jsx(DashboardIcon, { kind: "children" }), action: _jsx("span", { children: derivedWorktrees.length }), children: [_jsx("p", { children: t('dashboard.childrenHint') }), worktreeList(derivedWorktrees.slice(0, 5)), tabLink('children', t('dashboard.viewChildren'))] }), _jsx(Card, { title: t('dashboard.quickActions'), icon: _jsx(DashboardIcon, { kind: "actions" }), children: _jsxs("div", { className: styles.dashboardQuickActions, children: [_jsx("button", { type: "button", className: styles.dashboardButton, "data-dashboard-action": "sync-baseline", disabled: actionPending || !onSyncBaseline || !displayedBaseline, onClick: () => {
|
|
486
|
+
setSyncOpen(true);
|
|
487
|
+
}, children: t('dashboard.action.sync') }), _jsx("button", { type: "button", className: styles.dashboardButton, disabled: actionPending || !onArchiveWorktree, onClick: onArchiveWorktree, "data-dashboard-action": "archive-worktree", children: t('dashboard.action.archive') })] }) })] })] })) : tab === 'git' ? (_jsx(WorktreeGitPanel, { context: workspaceTitle + ' · ' + record.branch + ' · ' + record.absolutePath, manager: manager, workspaceId: record.workspaceId, worktreeId: record.worktreeId, defaultBaselineBranch: displayedBaseline, currentBranch: baselineCurrentBranch, capturedBaseline: record.baseCommit !== undefined, onOpenFile: onOpenFile === undefined ? undefined : (filePath) => {
|
|
388
488
|
onOpenFile?.(filePath);
|
|
389
|
-
setRightSidebarOpen(
|
|
489
|
+
setRightSidebarOpen(isRightSidebarExpanded?.() ?? false);
|
|
390
490
|
}, t: t })) : tab === 'sessions' ? (_jsx(Card, { title: tabLabel('sessions'), icon: _jsx(DashboardIcon, { kind: "sessions" }), action: _jsx("button", { type: "button", className: styles.dashboardButton, disabled: actionPending || !onCreateSession, onClick: onCreateSession, children: t('dashboard.newSession') }), children: sessionList(sessionIds) })) : tab === 'settings' ? (_jsx(Card, { title: tabLabel('settings'), icon: _jsx(DashboardIcon, { kind: "settings" }), children: _jsx(ToolSettings, { manager: manager, scope: isMainWorktreeId(record.worktreeId)
|
|
391
491
|
? { kind: 'local', workspaceId: record.workspaceId }
|
|
392
|
-
: { kind: 'worktree', workspaceId: record.workspaceId, worktreeId: record.worktreeId }, t: t }, JSON.stringify([record.workspaceId, record.worktreeId])) })) : (_jsxs("
|
|
492
|
+
: { kind: 'worktree', workspaceId: record.workspaceId, worktreeId: record.worktreeId }, t: t }, JSON.stringify([record.workspaceId, record.worktreeId])) })) : (_jsxs(Card, { title: tabLabel('children'), icon: _jsx(DashboardIcon, { kind: "children" }), action: _jsx("span", { children: derivedWorktrees.length }), children: [_jsx("p", { children: t('dashboard.childrenHint') }), worktreeList(derivedWorktrees)] })) }), _jsx("p", { className: styles.dashboardFooter, children: t('dashboard.mvpHint') })] }), _jsx(Modal, { open: syncOpen, onClose: closeSync, closeLabel: t('dialog.close'), title: t('dashboard.action.sync'), description: t('dashboard.sync.description'), className: styles.dashboardBaselineModal, footer: _jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", disabled: syncPending, onClick: closeSync, children: t('dashboard.cancelBase') }), syncResult ? _jsx(Button, { variant: "primary", onClick: () => onOpenSession(syncResult.sessionId), children: t('dashboard.sync.openSession') }) : _jsx(Button, { variant: "primary", disabled: syncPending, onClick: () => void startSync(), children: t(syncPending ? 'dashboard.sync.creating' : 'dashboard.sync.create') })] }), children: _jsxs("div", { className: styles.dashboardSyncOptions, children: [_jsxs("p", { children: [_jsx("code", { children: displayedBaseline }), _jsx("span", { "aria-hidden": "true", children: " \u2192 " }), _jsx("code", { children: record.currentBranch ?? record.branch })] }), ['rebase', 'merge'].map((strategy) => _jsxs("label", { children: [_jsx("input", { type: "radio", name: `${id}-sync-strategy`, value: strategy, checked: syncStrategy === strategy, disabled: syncPending || syncResult !== undefined || syncError !== undefined, onChange: () => { syncRequest.current = undefined; setSyncStrategy(strategy); } }), _jsxs("span", { children: [_jsx("strong", { children: strategy === 'rebase' ? 'Rebase' : 'Merge baseline' }), _jsx("small", { children: t(`dashboard.sync.${strategy}`) })] })] }, strategy)), partialSync && _jsxs("p", { role: "status", children: [t(`dashboard.sync.${partialSync.status}`), _jsx("br", {}), t('dashboard.sync.partial'), _jsx("br", {}), _jsx("code", { children: partialSync.sessionId })] })] }) }), _jsx(NotificationToasts, { notices: partialSync !== undefined
|
|
493
|
+
? baselineSyncFailureNotices(record, syncRequest.current, partialSync, t, onOpenSession)
|
|
494
|
+
: syncError === undefined ? [] : [{
|
|
495
|
+
key: 'sync:' + record.worktreeId, error: syncError,
|
|
496
|
+
text: t('dashboard.sync.failed') + ' ' + formatWorktreeViewError(syncError, t),
|
|
497
|
+
message: (translate) => translate('dashboard.sync.failed') + ' ' + formatWorktreeViewError(syncError, translate),
|
|
498
|
+
}] })] }));
|
|
393
499
|
}
|
|
394
500
|
//# sourceMappingURL=WorktreeDashboard.js.map
|