@deepseek-ai/dsh-experimental-client-ui-forge 0.2.3-alpha.2 → 0.2.3-alpha.4
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.i18n.yaml +10 -10
- package/README.md +37 -19
- package/README.zh.md +37 -19
- package/lib/client.js +22 -17
- package/lib/client.js.map +1 -1
- package/lib/index.js +941 -188
- package/lib/typert.host.js +894 -175
- package/lib/typert.remote-client.d.ts +35 -17
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +751 -146
- package/lib/types/client/ActionToast.d.ts +1 -1
- package/lib/types/client/ActionToast.d.ts.map +1 -1
- package/lib/types/client/ActionToast.js.map +1 -1
- package/lib/types/client/BaseMenu.d.ts +6 -4
- package/lib/types/client/BaseMenu.d.ts.map +1 -1
- package/lib/types/client/BaseMenu.js.map +1 -1
- package/lib/types/client/BranchPicker.d.ts +84 -0
- package/lib/types/client/BranchPicker.d.ts.map +1 -0
- package/lib/types/client/BranchPicker.js.map +1 -0
- package/lib/types/client/ChangeRequestCard.d.ts +31 -13
- package/lib/types/client/ChangeRequestCard.d.ts.map +1 -1
- package/lib/types/client/ChangeRequestCard.js.map +1 -1
- package/lib/types/client/ChangeRequestOverview.d.ts +28 -6
- package/lib/types/client/ChangeRequestOverview.d.ts.map +1 -1
- package/lib/types/client/ChangeRequestOverview.js.map +1 -1
- package/lib/types/client/ChangeRequestsSection.d.ts +5 -3
- package/lib/types/client/ChangeRequestsSection.d.ts.map +1 -1
- package/lib/types/client/ChangeRequestsSection.js.map +1 -1
- package/lib/types/client/ChangeStatus.d.ts +41 -0
- package/lib/types/client/ChangeStatus.d.ts.map +1 -0
- package/lib/types/client/ChangeStatus.js.map +1 -0
- package/lib/types/client/ChangedFiles.d.ts +1 -1
- package/lib/types/client/ChangedFiles.d.ts.map +1 -1
- package/lib/types/client/ChangedFiles.js.map +1 -1
- package/lib/types/client/ChangesLoading.d.ts +1 -1
- package/lib/types/client/ChangesLoading.d.ts.map +1 -1
- package/lib/types/client/ChangesTab.d.ts +35 -12
- package/lib/types/client/ChangesTab.d.ts.map +1 -1
- package/lib/types/client/ChangesTab.js.map +1 -1
- package/lib/types/client/ChangesTabTitle.d.ts +1 -1
- package/lib/types/client/ChangesTabTitle.d.ts.map +1 -1
- package/lib/types/client/ChangesTabTitle.js.map +1 -1
- package/lib/types/client/CommitMenu.d.ts +11 -8
- package/lib/types/client/CommitMenu.d.ts.map +1 -1
- package/lib/types/client/CommitMenu.js.map +1 -1
- package/lib/types/client/CopyCommandButton.d.ts +19 -0
- package/lib/types/client/CopyCommandButton.d.ts.map +1 -0
- package/lib/types/client/CopyCommandButton.js.map +1 -0
- package/lib/types/client/DiffFile.d.ts +36 -5
- package/lib/types/client/DiffFile.d.ts.map +1 -1
- package/lib/types/client/DiffFile.js.map +1 -1
- package/lib/types/client/EnvironmentRows.d.ts +6 -6
- package/lib/types/client/EnvironmentRows.d.ts.map +1 -1
- package/lib/types/client/EnvironmentRows.js.map +1 -1
- package/lib/types/client/FileLabel.d.ts +5 -5
- package/lib/types/client/FileLabel.d.ts.map +1 -1
- package/lib/types/client/FileLabel.js.map +1 -1
- package/lib/types/client/HeadMenu.d.ts +35 -0
- package/lib/types/client/HeadMenu.d.ts.map +1 -0
- package/lib/types/client/HeadMenu.js.map +1 -0
- package/lib/types/client/HostSettings.d.ts +33 -0
- package/lib/types/client/HostSettings.d.ts.map +1 -0
- package/lib/types/client/HostSettings.js.map +1 -0
- package/lib/types/client/LensFilter.d.ts +2 -2
- package/lib/types/client/LensFilter.d.ts.map +1 -1
- package/lib/types/client/LensFilter.js.map +1 -1
- package/lib/types/client/ReasonButton.js.map +1 -1
- package/lib/types/client/RefreshGlyph.js.map +1 -1
- package/lib/types/client/ReviewComposer.d.ts +1 -1
- package/lib/types/client/ReviewComposer.d.ts.map +1 -1
- package/lib/types/client/ReviewComposer.js.map +1 -1
- package/lib/types/client/ReviewControls.d.ts +1 -1
- package/lib/types/client/ReviewControls.d.ts.map +1 -1
- package/lib/types/client/ReviewControls.js.map +1 -1
- package/lib/types/client/ReviewThread.d.ts +1 -1
- package/lib/types/client/ReviewThread.d.ts.map +1 -1
- package/lib/types/client/ReviewThread.js.map +1 -1
- package/lib/types/client/ReviewThreads.d.ts +21 -4
- package/lib/types/client/ReviewThreads.d.ts.map +1 -1
- package/lib/types/client/ReviewThreads.js.map +1 -1
- package/lib/types/client/SessionHoverForge.d.ts +1 -1
- package/lib/types/client/SessionHoverForge.d.ts.map +1 -1
- package/lib/types/client/SessionHoverForge.js.map +1 -1
- package/lib/types/client/SessionRowForge.d.ts +1 -1
- package/lib/types/client/SessionRowForge.d.ts.map +1 -1
- package/lib/types/client/SessionRowForge.js.map +1 -1
- package/lib/types/client/SubmitReview.d.ts +1 -1
- package/lib/types/client/SubmitReview.d.ts.map +1 -1
- package/lib/types/client/SubmitReview.js.map +1 -1
- package/lib/types/client/ThreadList.d.ts +3 -1
- package/lib/types/client/ThreadList.d.ts.map +1 -1
- package/lib/types/client/ThreadList.js.map +1 -1
- package/lib/types/client/ViewOptionsMenu.d.ts +1 -1
- package/lib/types/client/ViewOptionsMenu.d.ts.map +1 -1
- package/lib/types/client/ViewOptionsMenu.js.map +1 -1
- package/lib/types/client/WorktreeNameDialog.d.ts +1 -1
- package/lib/types/client/WorktreeNameDialog.d.ts.map +1 -1
- package/lib/types/client/WorktreeNameDialog.js.map +1 -1
- package/lib/types/client/WorktreeProgress.d.ts +1 -1
- package/lib/types/client/WorktreeProgress.d.ts.map +1 -1
- package/lib/types/client/WorktreeProgress.js.map +1 -1
- package/lib/types/client/WorktreeSettings.d.ts +1 -1
- package/lib/types/client/WorktreeSettings.d.ts.map +1 -1
- package/lib/types/client/WorktreeSettings.js.map +1 -1
- package/lib/types/client/WorktreeToggle.d.ts +1 -1
- package/lib/types/client/WorktreeToggle.d.ts.map +1 -1
- package/lib/types/client/WorktreeToggle.js.map +1 -1
- package/lib/types/client/annotations.d.ts +1 -1
- package/lib/types/client/annotations.d.ts.map +1 -1
- package/lib/types/client/branch-search.d.ts +1 -1
- package/lib/types/client/branch-search.d.ts.map +1 -1
- package/lib/types/client/branch-search.js.map +1 -1
- package/lib/types/client/changes-address.d.ts +1 -1
- package/lib/types/client/changes-address.d.ts.map +1 -1
- package/lib/types/client/changes-service.d.ts +1 -1
- package/lib/types/client/changes-service.d.ts.map +1 -1
- package/lib/types/client/changes-store.d.ts +25 -6
- package/lib/types/client/changes-store.d.ts.map +1 -1
- package/lib/types/client/changes-store.js.map +1 -1
- package/lib/types/client/checkout.d.ts +1 -1
- package/lib/types/client/checkout.d.ts.map +1 -1
- package/lib/types/client/code-selection.d.ts.map +1 -1
- package/lib/types/client/code-selection.js.map +1 -1
- package/lib/types/client/forge-copy.d.ts +8 -1
- package/lib/types/client/forge-copy.d.ts.map +1 -1
- package/lib/types/client/forge-copy.js.map +1 -1
- package/lib/types/client/format.d.ts +1 -1
- package/lib/types/client/format.d.ts.map +1 -1
- package/lib/types/client/format.js.map +1 -1
- package/lib/types/client/glyphs.d.ts +36 -1
- package/lib/types/client/glyphs.d.ts.map +1 -1
- package/lib/types/client/glyphs.js.map +1 -1
- package/lib/types/client/highlight-context.d.ts +1 -1
- package/lib/types/client/highlight-context.d.ts.map +1 -1
- package/lib/types/client/host-settings-form.d.ts +69 -0
- package/lib/types/client/host-settings-form.d.ts.map +1 -0
- package/lib/types/client/host-settings-form.js.map +1 -0
- package/lib/types/client/host-sign-in.d.ts +31 -0
- package/lib/types/client/host-sign-in.d.ts.map +1 -0
- package/lib/types/client/host-sign-in.js.map +1 -0
- package/lib/types/client/index.d.ts +1 -2
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js.map +1 -1
- package/lib/types/client/local-writes.d.ts +47 -0
- package/lib/types/client/local-writes.d.ts.map +1 -0
- package/lib/types/client/local-writes.js.map +1 -0
- package/lib/types/client/locales.d.ts +111 -13
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/locales.js.map +1 -1
- package/lib/types/client/minute-clock.d.ts +7 -0
- package/lib/types/client/minute-clock.d.ts.map +1 -0
- package/lib/types/client/minute-clock.js.map +1 -0
- package/lib/types/client/mount.d.ts +15 -1
- package/lib/types/client/mount.d.ts.map +1 -1
- package/lib/types/client/mount.js.map +1 -1
- package/lib/types/client/review-page/ReviewActivity.d.ts +44 -0
- package/lib/types/client/review-page/ReviewActivity.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewActivity.js.map +1 -0
- package/lib/types/client/review-page/ReviewChat.d.ts +1 -1
- package/lib/types/client/review-page/ReviewChat.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewChat.js.map +1 -1
- package/lib/types/client/review-page/ReviewDetail.d.ts +26 -9
- package/lib/types/client/review-page/ReviewDetail.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewDetail.js.map +1 -1
- package/lib/types/client/review-page/ReviewLabels.d.ts +1 -1
- package/lib/types/client/review-page/ReviewLabels.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewLabels.js.map +1 -1
- package/lib/types/client/review-page/ReviewList.d.ts +10 -8
- package/lib/types/client/review-page/ReviewList.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewList.js.map +1 -1
- package/lib/types/client/review-page/ReviewNav.d.ts +1 -1
- package/lib/types/client/review-page/ReviewNav.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewPage.d.ts +17 -14
- package/lib/types/client/review-page/ReviewPage.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewPage.js.map +1 -1
- package/lib/types/client/review-page/ReviewSkeleton.d.ts +26 -0
- package/lib/types/client/review-page/ReviewSkeleton.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewSkeleton.js.map +1 -0
- package/lib/types/client/review-page/ReviewStatus.d.ts +19 -13
- package/lib/types/client/review-page/ReviewStatus.d.ts.map +1 -1
- package/lib/types/client/review-page/ReviewStatus.js.map +1 -1
- package/lib/types/client/review-page/review-activity.d.ts +37 -0
- package/lib/types/client/review-page/review-activity.d.ts.map +1 -0
- package/lib/types/client/review-page/review-activity.js.map +1 -0
- package/lib/types/client/review-page/review-lists.d.ts +48 -13
- package/lib/types/client/review-page/review-lists.d.ts.map +1 -1
- package/lib/types/client/review-page/review-lists.js.map +1 -1
- package/lib/types/client/review-page/review-mount.d.ts +3 -1
- package/lib/types/client/review-page/review-mount.d.ts.map +1 -1
- package/lib/types/client/review-page/review-mount.js.map +1 -1
- package/lib/types/client/review-page/review-store.d.ts +19 -9
- package/lib/types/client/review-page/review-store.d.ts.map +1 -1
- package/lib/types/client/review-page/review-store.js.map +1 -1
- package/lib/types/client/review-queue.d.ts +1 -1
- package/lib/types/client/review-queue.d.ts.map +1 -1
- package/lib/types/client/review-queue.js.map +1 -1
- package/lib/types/client/review-threads.d.ts +15 -8
- package/lib/types/client/review-threads.d.ts.map +1 -1
- package/lib/types/client/review-threads.js.map +1 -1
- package/lib/types/client/review.d.ts +12 -1
- package/lib/types/client/review.d.ts.map +1 -1
- package/lib/types/client/review.js.map +1 -1
- package/lib/types/client/row-form-labels.d.ts +12 -0
- package/lib/types/client/row-form-labels.d.ts.map +1 -0
- package/lib/types/client/row-form-labels.js.map +1 -0
- package/lib/types/client/session-list.d.ts +1 -1
- package/lib/types/client/session-list.d.ts.map +1 -1
- package/lib/types/client/slots.d.ts +1 -1
- package/lib/types/client/slots.d.ts.map +1 -1
- package/lib/types/client/source.d.ts +1 -1
- package/lib/types/client/source.d.ts.map +1 -1
- package/lib/types/client/status.d.ts +7 -6
- package/lib/types/client/status.d.ts.map +1 -1
- package/lib/types/client/status.js.map +1 -1
- package/lib/types/client/thread-state.d.ts +2 -2
- package/lib/types/client/thread-state.d.ts.map +1 -1
- package/lib/types/client/thread-state.js.map +1 -1
- package/lib/types/client/toolbar-fold.d.ts +16 -6
- package/lib/types/client/toolbar-fold.d.ts.map +1 -1
- package/lib/types/client/toolbar-fold.js.map +1 -1
- package/lib/types/client/worktree-settings-form.d.ts +1 -1
- package/lib/types/client/worktree-settings-form.d.ts.map +1 -1
- package/lib/types/client/worktree-settings-form.js.map +1 -1
- package/lib/types/diff.d.ts.map +1 -1
- package/lib/types/diff.js.map +1 -1
- package/lib/types/git.d.ts +22 -0
- package/lib/types/git.d.ts.map +1 -1
- package/lib/types/git.js.map +1 -1
- package/lib/types/index.d.ts +137 -36
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/local-diff.d.ts +81 -23
- package/lib/types/local-diff.d.ts.map +1 -1
- package/lib/types/local-diff.js.map +1 -1
- package/lib/types/local-write.d.ts +44 -0
- package/lib/types/local-write.d.ts.map +1 -0
- package/lib/types/local-write.js.map +1 -0
- package/lib/types/panel.js.map +1 -1
- package/lib/types/parse.d.ts +12 -3
- package/lib/types/parse.d.ts.map +1 -1
- package/lib/types/parse.js.map +1 -1
- package/lib/types/restore.d.ts +12 -0
- package/lib/types/restore.d.ts.map +1 -0
- package/lib/types/restore.js.map +1 -0
- package/lib/types/types.d.ts +128 -13
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/viewer-lists.d.ts +22 -13
- package/lib/types/viewer-lists.d.ts.map +1 -1
- package/lib/types/viewer-lists.js.map +1 -1
- package/lib/types/worktree.js.map +1 -1
- package/package.json +62 -58
- package/src/client/ActionToast.tsx +2 -2
- package/src/client/BaseMenu.module.css +15 -3
- package/src/client/BaseMenu.tsx +25 -88
- package/src/client/BranchPicker.tsx +170 -0
- package/src/client/ChangeRequestCard.tsx +194 -70
- package/src/client/ChangeRequestOverview.tsx +194 -82
- package/src/client/ChangeRequestsSection.tsx +45 -14
- package/src/client/ChangeStatus.module.css +70 -0
- package/src/client/ChangeStatus.tsx +104 -0
- package/src/client/ChangedFiles.tsx +22 -9
- package/src/client/ChangesLoading.tsx +1 -1
- package/src/client/ChangesTab.module.css +181 -33
- package/src/client/ChangesTab.tsx +499 -183
- package/src/client/ChangesTabTitle.tsx +2 -2
- package/src/client/CommitMenu.tsx +83 -42
- package/src/client/CopyCommandButton.tsx +25 -0
- package/src/client/DiffFile.tsx +147 -29
- package/src/client/EnvironmentRows.tsx +34 -28
- package/src/client/FileLabel.module.css +16 -18
- package/src/client/FileLabel.tsx +16 -32
- package/src/client/Forge.module.css +26 -6
- package/src/client/HeadMenu.tsx +69 -0
- package/src/client/HostSettings.module.css +194 -0
- package/src/client/HostSettings.tsx +194 -0
- package/src/client/LensFilter.tsx +13 -11
- package/src/client/ReasonButton.tsx +1 -1
- package/src/client/RefreshGlyph.tsx +1 -1
- package/src/client/ReviewComposer.tsx +31 -19
- package/src/client/ReviewControls.tsx +18 -9
- package/src/client/ReviewThread.tsx +65 -23
- package/src/client/ReviewThreads.tsx +133 -38
- package/src/client/SessionHoverForge.tsx +2 -2
- package/src/client/SessionRowForge.tsx +2 -2
- package/src/client/SubmitReview.tsx +7 -5
- package/src/client/ThreadList.module.css +4 -3
- package/src/client/ThreadList.tsx +11 -8
- package/src/client/ViewOptionsMenu.tsx +12 -10
- package/src/client/WorktreeNameDialog.tsx +17 -13
- package/src/client/WorktreeProgress.tsx +13 -11
- package/src/client/WorktreeSettings.tsx +8 -14
- package/src/client/WorktreeToggle.tsx +67 -37
- package/src/client/annotations.ts +1 -1
- package/src/client/branch-search.tsx +2 -2
- package/src/client/changes-address.ts +1 -1
- package/src/client/changes-service.ts +1 -1
- package/src/client/changes-store.ts +57 -10
- package/src/client/checkout.ts +1 -1
- package/src/client/code-selection.ts +3 -1
- package/src/client/forge-copy.ts +11 -1
- package/src/client/format.ts +2 -2
- package/src/client/glyphs.tsx +72 -5
- package/src/client/highlight-context.ts +1 -1
- package/src/client/host-settings-form.ts +115 -0
- package/src/client/host-sign-in.ts +46 -0
- package/src/client/index.ts +1 -2
- package/src/client/local-writes.ts +129 -0
- package/src/client/locales.ts +881 -97
- package/src/client/minute-clock.ts +19 -0
- package/src/client/mount.ts +121 -57
- package/src/client/review-page/ReviewActivity.tsx +406 -0
- package/src/client/review-page/ReviewChat.tsx +48 -19
- package/src/client/review-page/ReviewDetail.tsx +246 -78
- package/src/client/review-page/ReviewLabels.tsx +2 -2
- package/src/client/review-page/ReviewList.tsx +173 -151
- package/src/client/review-page/ReviewNav.tsx +1 -1
- package/src/client/review-page/ReviewPage.module.css +571 -23
- package/src/client/review-page/ReviewPage.tsx +84 -53
- package/src/client/review-page/ReviewSkeleton.tsx +108 -0
- package/src/client/review-page/ReviewStatus.tsx +74 -44
- package/src/client/review-page/review-activity.ts +64 -0
- package/src/client/review-page/review-lists.ts +85 -22
- package/src/client/review-page/review-mount.ts +24 -7
- package/src/client/review-page/review-store.ts +24 -7
- package/src/client/review-queue.ts +7 -3
- package/src/client/review-threads.ts +24 -12
- package/src/client/review.ts +20 -2
- package/src/client/row-form-labels.ts +17 -0
- package/src/client/session-list.ts +1 -1
- package/src/client/slots.ts +1 -1
- package/src/client/source.ts +1 -1
- package/src/client/status.ts +20 -9
- package/src/client/thread-state.ts +8 -7
- package/src/client/toolbar-fold.ts +59 -14
- package/src/client/worktree-settings-form.ts +1 -1
- package/src/diff.ts +8 -5
- package/src/git.ts +31 -1
- package/src/index.ts +319 -70
- package/src/local-diff.ts +151 -48
- package/src/local-write.ts +159 -0
- package/src/panel.ts +1 -1
- package/src/parse.ts +26 -4
- package/src/restore.ts +15 -0
- package/src/types.ts +121 -17
- package/src/viewer-lists.ts +124 -48
- package/src/worktree.ts +1 -1
- package/lib/types/client/AttentionIndicator.d.ts +0 -22
- package/lib/types/client/AttentionIndicator.d.ts.map +0 -1
- package/lib/types/client/AttentionIndicator.js.map +0 -1
- package/src/client/AttentionIndicator.tsx +0 -37
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* being restored.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { useState, type ReactNode } from 'react'
|
|
7
|
+
import { useCallback, useState, type ReactNode } from 'react'
|
|
8
8
|
import {
|
|
9
9
|
Button, IconBranchOutlineRegular, IconCheckOutlineRegular, IconChevronRightOutlineRegular, IconCloseOutlineRegular, StateDot,
|
|
10
|
-
} from '@deepseek-ai/dsh-client-ui-primitives'
|
|
11
|
-
import type { HostObservable, InjectFace, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
|
|
10
|
+
} from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
11
|
+
import type { HostObservable, InjectFace, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
12
12
|
import type {} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
13
13
|
import { assertNever } from '@deepseek-ai/dsh-util-values'
|
|
14
14
|
import { branchLabel } from '../branch-name.ts'
|
|
@@ -202,6 +202,12 @@ function CreationCard({ creation, open: openRequest, prefix, stop, retry, withdr
|
|
|
202
202
|
const title = t(CREATION_TITLE[creation.state])
|
|
203
203
|
const name = openRequest?.name ?? null
|
|
204
204
|
const from = openRequest?.from ?? null
|
|
205
|
+
const requestThenRetry = useCallback(async (next: string | null): Promise<WorktreeRequestResult> => {
|
|
206
|
+
const result = await request(from, next)
|
|
207
|
+
if (result === 'accepted') retry(true)
|
|
208
|
+
return result
|
|
209
|
+
}, [from, request, retry])
|
|
210
|
+
const stopRenaming = useCallback((): void => { setRenaming(false) }, [])
|
|
205
211
|
return (
|
|
206
212
|
<div className={css.dock} data-forge-creation={running ? creation.phase : creation.state}>
|
|
207
213
|
<section className={css.card} aria-label={title} aria-busy={running}>
|
|
@@ -235,12 +241,8 @@ function CreationCard({ creation, open: openRequest, prefix, stop, retry, withdr
|
|
|
235
241
|
</section>
|
|
236
242
|
{renaming && name !== null && (
|
|
237
243
|
<WorktreeNameDialog mode="retry" initial={name} prefix={prefix} from={from} named
|
|
238
|
-
submit={
|
|
239
|
-
|
|
240
|
-
if (result === 'accepted') retry(true)
|
|
241
|
-
return result
|
|
242
|
-
}}
|
|
243
|
-
close={() => { setRenaming(false) }} t={t} />
|
|
244
|
+
submit={requestThenRetry}
|
|
245
|
+
close={stopRenaming} t={t} />
|
|
244
246
|
)}
|
|
245
247
|
</div>
|
|
246
248
|
)
|
|
@@ -259,7 +261,7 @@ function MissingCard({ created, missing, restoration, waiting, restore, leave, t
|
|
|
259
261
|
}): ReactNode {
|
|
260
262
|
const [restoring, setRestoring] = useState(false)
|
|
261
263
|
const [error, setError] = useState<string | null>(null)
|
|
262
|
-
const start = (): void => {
|
|
264
|
+
const start = useCallback((): void => {
|
|
263
265
|
setRestoring(true)
|
|
264
266
|
setError(null)
|
|
265
267
|
void restore().then(
|
|
@@ -272,7 +274,7 @@ function MissingCard({ created, missing, restoration, waiting, restore, leave, t
|
|
|
272
274
|
setError(failure instanceof Error ? failure.message : String(failure))
|
|
273
275
|
},
|
|
274
276
|
)
|
|
275
|
-
}
|
|
277
|
+
}, [restore])
|
|
276
278
|
// The restore this card asked for runs before the Host names its first step.
|
|
277
279
|
const phase = restoration?.phase ?? (restoring ? 'prepare' : null)
|
|
278
280
|
if (phase !== null) {
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
/** The worktree service's row page on the Plugins page: the archive cleanup switch. */
|
|
2
|
-
import { useId } from 'react'
|
|
3
|
-
import { SettingsForm, Switch } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
4
|
-
import type {
|
|
5
|
-
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'
|
|
2
|
+
import { useCallback, useId } from 'react'
|
|
3
|
+
import { SettingsForm, Switch } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
4
|
+
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
6
5
|
import type {} from '@deepseek-ai/dsh-client-ui-plugin-manager/client'
|
|
7
6
|
import type { NS } from './locales.ts'
|
|
7
|
+
import { rowFormLabels } from './row-form-labels.ts'
|
|
8
8
|
import type { WorktreeSettingsInjected } from './worktree-settings-form.ts'
|
|
9
9
|
import css from './WorktreeSettings.module.css'
|
|
10
10
|
|
|
11
11
|
export type WorktreeSettingsProps = PropsRuntime<'plugins.row.config'> & PropsLocale<typeof NS> & InjectFace<WorktreeSettingsInjected>
|
|
12
12
|
|
|
13
|
-
function formLabels(t: WorktreeSettingsProps['t']): SettingsFormLabels {
|
|
14
|
-
return {
|
|
15
|
-
unavailable: t('settings.unavailable'), readOnly: t('settings.readOnly'), saveFailed: t('settings.saveFailed'),
|
|
16
|
-
save: t('settings.save'), saving: t('settings.saving'),
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
13
|
/**
|
|
21
14
|
* Render the worktree row's configuration: one switch that keeps every
|
|
22
15
|
* checkout when its Session is archived. The summary view names the switch.
|
|
@@ -24,19 +17,20 @@ function formLabels(t: WorktreeSettingsProps['t']): SettingsFormLabels {
|
|
|
24
17
|
* @returns the row page's form, or the summary line.
|
|
25
18
|
*/
|
|
26
19
|
export function WorktreeSettings(props: WorktreeSettingsProps) {
|
|
27
|
-
const { t } = props
|
|
20
|
+
const { edit, t } = props
|
|
28
21
|
const id = useId()
|
|
29
22
|
const state = props.useWorktreeForm(value => value)
|
|
23
|
+
const changeRetention = useCallback((next: boolean): void => { edit('retainOnArchive', next ? 'true' : 'false') }, [edit])
|
|
30
24
|
if (props.view === 'summary') return t('settings.retainOnArchive.title')
|
|
31
25
|
const disabled = !state.writable || state.saving
|
|
32
|
-
return <SettingsForm labels={
|
|
26
|
+
return <SettingsForm labels={rowFormLabels(t, 'settings.unavailable')} state={state} onSave={props.save} onDiscard={props.discard}>
|
|
33
27
|
<div className={css.row}>
|
|
34
28
|
<div className={css.text}>
|
|
35
29
|
<label className={css.title} htmlFor={id}>{t('settings.retainOnArchive.title')}</label>
|
|
36
30
|
<p className={css.description}>{t('settings.retainOnArchive.description')}</p>
|
|
37
31
|
</div>
|
|
38
32
|
<Switch checked={state.retainOnArchive.text === 'true'} disabled={disabled} label={t('settings.retainOnArchive.title')}
|
|
39
|
-
onChange={
|
|
33
|
+
onChange={changeRetention} />
|
|
40
34
|
</div>
|
|
41
35
|
</SettingsForm>
|
|
42
36
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/** New Session option: start the Session in a new worktree, on a chosen or generated branch, from a local or remote branch. */
|
|
2
2
|
|
|
3
|
-
import { useState, type ReactNode } from 'react'
|
|
3
|
+
import { useCallback, useState, type ReactNode } from 'react'
|
|
4
4
|
import clsx from 'clsx'
|
|
5
5
|
import {
|
|
6
6
|
IconBranchOutlineRegular, IconCheckOutlineRegular, IconChevronDownOutlineRegular, IconEditOutlineRegular, IconPlusOutlineRegular,
|
|
7
7
|
Menu, MenuItemButton, Tooltip,
|
|
8
|
-
} from '@deepseek-ai/dsh-client-ui-primitives'
|
|
9
|
-
import type { HostObservable, InjectFace, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
|
|
8
|
+
} from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
9
|
+
import type { HostObservable, InjectFace, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
10
10
|
import type {} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
11
11
|
import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol'
|
|
12
12
|
import { branchLabel, LOCAL_REF_PREFIX, REMOTE_REF_PREFIX } from '../branch-name.ts'
|
|
@@ -79,28 +79,39 @@ function nameParts(branch: ForgeBaseBranch, remote: string | undefined): { reado
|
|
|
79
79
|
/** Id of the footer row that opens the naming dialog. */
|
|
80
80
|
const NAME_ENTRY = 'name'
|
|
81
81
|
|
|
82
|
+
/** One branch row of the worktree menu: the branch with its remote prefix and tag, choosing it as the request's base. */
|
|
83
|
+
function BranchRowButton({ branch, remote, tag, selected, onPick }: {
|
|
84
|
+
readonly branch: ForgeBaseBranch
|
|
85
|
+
readonly remote: string | undefined
|
|
86
|
+
readonly tag: string | undefined
|
|
87
|
+
readonly selected: boolean
|
|
88
|
+
readonly onPick: (ref: string) => void
|
|
89
|
+
}) {
|
|
90
|
+
const parts = nameParts(branch, remote)
|
|
91
|
+
const ref = branch.ref
|
|
92
|
+
const pick = useCallback((): void => { onPick(ref) }, [onPick, ref])
|
|
93
|
+
return (
|
|
94
|
+
<MenuItemButton icon={<IconBranchOutlineRegular size={14} />} current={selected} onSelect={pick}>
|
|
95
|
+
<span className={css.option} data-forge-worktree-base={ref}>
|
|
96
|
+
<span className={css.optionName}>
|
|
97
|
+
{parts.prefix !== '' && <span className={css.remotePrefix}>{parts.prefix}</span>}
|
|
98
|
+
{parts.rest}
|
|
99
|
+
</span>
|
|
100
|
+
{tag !== undefined && <span className={css.tag}>{tag}</span>}
|
|
101
|
+
{selected && <IconCheckOutlineRegular size={14} className={css.check} />}
|
|
102
|
+
</span>
|
|
103
|
+
</MenuItemButton>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
82
107
|
function BranchRows({ rows, chosen, pick }: {
|
|
83
108
|
readonly rows: readonly BaseRow[]
|
|
84
109
|
readonly chosen: string | null
|
|
85
110
|
readonly pick: (ref: string) => void
|
|
86
111
|
}): ReactNode {
|
|
87
|
-
return rows.map(({ branch, remote, tag }) =>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<MenuItemButton key={branch.ref} icon={<IconBranchOutlineRegular size={14} />} current={selected}
|
|
92
|
-
onSelect={() => { pick(branch.ref) }}>
|
|
93
|
-
<span className={css.option} data-forge-worktree-base={branch.ref}>
|
|
94
|
-
<span className={css.optionName}>
|
|
95
|
-
{parts.prefix !== '' && <span className={css.remotePrefix}>{parts.prefix}</span>}
|
|
96
|
-
{parts.rest}
|
|
97
|
-
</span>
|
|
98
|
-
{tag !== undefined && <span className={css.tag}>{tag}</span>}
|
|
99
|
-
{selected && <IconCheckOutlineRegular size={14} className={css.check} />}
|
|
100
|
-
</span>
|
|
101
|
-
</MenuItemButton>
|
|
102
|
-
)
|
|
103
|
-
})
|
|
112
|
+
return rows.map(({ branch, remote, tag }) => (
|
|
113
|
+
<BranchRowButton key={branch.ref} branch={branch} remote={remote} tag={tag} selected={branch.ref === chosen} onPick={pick} />
|
|
114
|
+
))
|
|
104
115
|
}
|
|
105
116
|
|
|
106
117
|
function WorktreeMenu({ from, name, held, bases, choose, nameBranch, t }: {
|
|
@@ -116,14 +127,18 @@ function WorktreeMenu({ from, name, held, bases, choose, nameBranch, t }: {
|
|
|
116
127
|
const [open, setOpen] = useState(false)
|
|
117
128
|
const { query, setQuery, listing, retry, reset } = useBranchSearch(open, bases)
|
|
118
129
|
const chosen = refOf(from)
|
|
119
|
-
const close = (): void => {
|
|
130
|
+
const close = useCallback((): void => {
|
|
120
131
|
setOpen(false)
|
|
121
132
|
reset()
|
|
122
|
-
}
|
|
123
|
-
const pick = (ref: string): void => {
|
|
133
|
+
}, [reset])
|
|
134
|
+
const pick = useCallback((ref: string): void => {
|
|
124
135
|
close()
|
|
125
136
|
if (ref !== chosen) choose(ref)
|
|
126
|
-
}
|
|
137
|
+
}, [choose, chosen, close])
|
|
138
|
+
const openNaming = useCallback((): void => {
|
|
139
|
+
close()
|
|
140
|
+
nameBranch()
|
|
141
|
+
}, [close, nameBranch])
|
|
127
142
|
const value = listing?.ok === true ? listing.value : null
|
|
128
143
|
const needle = query.trim().toLowerCase()
|
|
129
144
|
const matches = (branch: ForgeBaseBranch): boolean => branch.name.toLowerCase().includes(needle)
|
|
@@ -180,7 +195,7 @@ function WorktreeMenu({ from, name, held, bases, choose, nameBranch, t }: {
|
|
|
180
195
|
</span>
|
|
181
196
|
),
|
|
182
197
|
}]}
|
|
183
|
-
onSelect={
|
|
198
|
+
onSelect={openNaming}
|
|
184
199
|
anchor={
|
|
185
200
|
<Tooltip label={label} side="bottom" portal delayMs={500}>
|
|
186
201
|
<button type="button" className={clsx(css.base, name !== null && css.named)} aria-haspopup="menu" aria-expanded={open} aria-label={label}
|
|
@@ -200,6 +215,23 @@ function WorktreeMenu({ from, name, held, bases, choose, nameBranch, t }: {
|
|
|
200
215
|
)
|
|
201
216
|
}
|
|
202
217
|
|
|
218
|
+
/** The branch the option shows while no worktree is requested, or the base a request would start from. */
|
|
219
|
+
function CurrentBranchButton({ tip, text, requested }: {
|
|
220
|
+
readonly tip: string
|
|
221
|
+
readonly text: string
|
|
222
|
+
readonly requested: boolean
|
|
223
|
+
}) {
|
|
224
|
+
return (
|
|
225
|
+
<Tooltip label={tip} side="bottom" portal openOnClick>
|
|
226
|
+
<button type="button" className={css.current} aria-label={tip}
|
|
227
|
+
data-forge-current-branch={requested ? undefined : ''} data-forge-base-branch={requested ? '' : undefined}>
|
|
228
|
+
<IconBranchOutlineRegular size={14} />
|
|
229
|
+
<span className={css.baseLabel}>{text}</span>
|
|
230
|
+
</button>
|
|
231
|
+
</Tooltip>
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
|
|
203
235
|
/** What the option shows for a panel state, or undefined while it stays hidden. */
|
|
204
236
|
function optionOf(state: ForgePanelState | null): {
|
|
205
237
|
readonly blocker: Exclude<ForgeWorktreeBlocker, 'not-git'> | null
|
|
@@ -231,15 +263,19 @@ export function WorktreeToggle({ usePanel, request, cancel, bases, t }: Worktree
|
|
|
231
263
|
const [pending, setPending] = useState<boolean | null>(null)
|
|
232
264
|
const [naming, setNaming] = useState(false)
|
|
233
265
|
const option = optionOf(state)
|
|
266
|
+
const currentRef = option === undefined || option.current === null ? null : `${LOCAL_REF_PREFIX}${option.current}`
|
|
267
|
+
const from = state === null || state.worktree.request === null ? currentRef : state.worktree.request.from
|
|
268
|
+
const name = state?.worktree.request?.name ?? null
|
|
269
|
+
const submitName = useCallback((next: string | null): Promise<WorktreeRequestResult> => request(from, next), [from, request])
|
|
270
|
+
const closeNaming = useCallback((): void => { setNaming(false) }, [])
|
|
271
|
+
const chooseBase = useCallback((ref: string): void => { void request(ref, name) }, [name, request])
|
|
272
|
+
const openNaming = useCallback((): void => { setNaming(true) }, [])
|
|
234
273
|
if (state === null || option === undefined) return null
|
|
235
274
|
const held = state.worktree.creation !== null
|
|
236
275
|
const requested = pending ?? state.worktree.request !== null
|
|
237
276
|
const usable = option.blocker === null
|
|
238
277
|
const disabled = held || pending !== null || (!usable && !requested)
|
|
239
|
-
const currentRef = option.current === null ? null : `${LOCAL_REF_PREFIX}${option.current}`
|
|
240
278
|
const current = option.current ?? (option.commit === null ? t('checkout.detached') : t('worktree.detachedTip', { commit: option.commit }))
|
|
241
|
-
const from = state.worktree.request === null ? currentRef : state.worktree.request.from
|
|
242
|
-
const name = state.worktree.request?.name ?? null
|
|
243
279
|
const requestedText = name === null ? baseTextOf(from, t) : namedTipOf(name, from, t)
|
|
244
280
|
const branchText = requested ? requestedText : current
|
|
245
281
|
const branchTip = requested || option.current === null ? branchText : t('worktree.currentBranchTip', { branch: option.current })
|
|
@@ -251,15 +287,9 @@ export function WorktreeToggle({ usePanel, request, cancel, bases, t }: Worktree
|
|
|
251
287
|
<span className={css.root} data-forge-worktree="">
|
|
252
288
|
{requested && usable ? (
|
|
253
289
|
<WorktreeMenu from={from} name={name} held={held} bases={bases} t={t}
|
|
254
|
-
choose={
|
|
290
|
+
choose={chooseBase} nameBranch={openNaming} />
|
|
255
291
|
) : (
|
|
256
|
-
<
|
|
257
|
-
<button type="button" className={css.current} aria-label={branchTip}
|
|
258
|
-
data-forge-current-branch={requested ? undefined : ''} data-forge-base-branch={requested ? '' : undefined}>
|
|
259
|
-
<IconBranchOutlineRegular size={14} />
|
|
260
|
-
<span className={css.baseLabel}>{branchText}</span>
|
|
261
|
-
</button>
|
|
262
|
-
</Tooltip>
|
|
292
|
+
<CurrentBranchButton tip={branchTip} text={branchText} requested={requested} />
|
|
263
293
|
)}
|
|
264
294
|
<Tooltip label={option.blocker === null ? t('worktree.hint') : t(`worktree.blocked.${option.blocker}`)} side="bottom" delayMs={500}>
|
|
265
295
|
<label className={css.toggle} data-disabled={disabled ? '' : undefined}>
|
|
@@ -275,7 +305,7 @@ export function WorktreeToggle({ usePanel, request, cancel, bases, t }: Worktree
|
|
|
275
305
|
</Tooltip>
|
|
276
306
|
{naming && requested && (
|
|
277
307
|
<WorktreeNameDialog mode="name" initial={name ?? state.worktree.namePrefix} prefix={state.worktree.namePrefix} from={from}
|
|
278
|
-
named={name !== null} submit={
|
|
308
|
+
named={name !== null} submit={submitName} close={closeNaming} t={t} />
|
|
279
309
|
)}
|
|
280
310
|
</span>
|
|
281
311
|
)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* file's lines.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots'
|
|
6
|
+
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
7
7
|
import type { ChangesTarget } from './changes-address.ts'
|
|
8
8
|
import type { ForgeAnnotationSource, ForgeLineAnnotation } from './changes-service.ts'
|
|
9
9
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** The search shared by the branch pickers: the query, the listing it read, and the status a menu shows instead of rows. */
|
|
2
2
|
|
|
3
3
|
import { useCallback, useEffect, useState, type ReactNode } from 'react'
|
|
4
|
-
import { Button, StateDot } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
5
|
-
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
|
|
4
|
+
import { Button, StateDot } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
5
|
+
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
6
6
|
import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol'
|
|
7
7
|
import type { NS } from './locales.ts'
|
|
8
8
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { SidebarRightTabDefinition } from '@deepseek-ai/dsh-client-ui-sidebar-right/client'
|
|
10
|
-
import type { TranslateNS } from '@deepseek-ai/dsh-client-ui-slots'
|
|
10
|
+
import type { TranslateNS } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
11
11
|
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
|
12
12
|
import type { NS } from './locales.ts'
|
|
13
13
|
import { numberOf } from './status.ts'
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* changes tab's addresses and kinds, opening a view, the titles of Host lenses, and line annotation sources.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots'
|
|
6
|
+
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
7
7
|
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
|
8
8
|
import type { ForgeExtensionState, ForgeLensId } from '../types.ts'
|
|
9
9
|
import { changesAddress, parseChangesAddress, type ChangesParams, type ChangesTarget } from './changes-address.ts'
|
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Choices of each changes tab: the local scope,
|
|
3
|
-
* `branch` scope, the commits shown, the review layer, whether test files
|
|
2
|
+
* Choices of each changes tab: the local scope, what local changes show in place of the Session's own checkout,
|
|
3
|
+
* the base branch of the `branch` scope, the commits shown, the review layer, whether test files
|
|
4
4
|
* hide, the side-by-side view, line wrapping, and the navigation it last
|
|
5
5
|
* applied. One bucket per tab, so two views in one Session keep their own
|
|
6
6
|
* choices; the bucket ends with the tab record's signal.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { defineStore, type EngineStoreHandle } from '@deepseek-ai/dsh-client-store'
|
|
10
|
-
import type { ForgeBaseBranch,
|
|
10
|
+
import type { ForgeBaseBranch, ForgeChangeCommits, ForgeFileLayer, ForgeLocalScope } from '../types.ts'
|
|
11
|
+
|
|
12
|
+
/** The branch local changes show in place of the Session's checked-out one. */
|
|
13
|
+
export interface ChangesHead {
|
|
14
|
+
/** Full ref name of the branch. */
|
|
15
|
+
readonly ref: string
|
|
16
|
+
/** The ref without its prefix, which the picker shows. */
|
|
17
|
+
readonly name: string
|
|
18
|
+
/**
|
|
19
|
+
* Top-level directory of the worktree that has the branch checked out, as last listed or read; null when none has,
|
|
20
|
+
* so the branch has the `branch` scope alone.
|
|
21
|
+
*/
|
|
22
|
+
readonly worktree: string | null
|
|
23
|
+
}
|
|
11
24
|
|
|
12
25
|
/** Files a changes tab shows: every file, or the files of one review layer. */
|
|
13
26
|
export type ChangesLens = 'all' | ForgeFileLayer
|
|
@@ -16,10 +29,15 @@ export type ChangesLens = 'all' | ForgeFileLayer
|
|
|
16
29
|
export interface ChangesTabState {
|
|
17
30
|
/** Local changes shown; a change request view ignores it. */
|
|
18
31
|
scope: ForgeLocalScope['kind']
|
|
32
|
+
/** What local changes show in place of the Session's own checkout, or null for that checkout. */
|
|
33
|
+
head: ChangesHead | null
|
|
19
34
|
/** Branch the `branch` scope compares with, or null for the automatic fork point; other scopes keep it. */
|
|
20
35
|
base: ForgeBaseBranch | null
|
|
21
|
-
/**
|
|
22
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Commits shown instead of the whole change request or `branch` scope, or null for all of them. Only a change request
|
|
38
|
+
* view holds changes up to one commit.
|
|
39
|
+
*/
|
|
40
|
+
commits: ForgeChangeCommits | null
|
|
23
41
|
/** Review layer whose files show. */
|
|
24
42
|
lens: ChangesLens
|
|
25
43
|
/** Identity of the Host filter lens that keeps some of the shown files, or null for none. */
|
|
@@ -49,8 +67,10 @@ function bucket(state: ChangesState, tabId: string): ChangesTabState {
|
|
|
49
67
|
export type ChangesActions = {
|
|
50
68
|
navigated: (draft: ChangesState, tabId: string, revision: number) => void
|
|
51
69
|
scoped: (draft: ChangesState, tabId: string, scope: ForgeLocalScope['kind']) => void
|
|
70
|
+
headed: (draft: ChangesState, tabId: string, head: ChangesHead | null) => void
|
|
71
|
+
rooted: (draft: ChangesState, tabId: string, worktree: string | null) => void
|
|
52
72
|
based: (draft: ChangesState, tabId: string, base: ForgeBaseBranch | null) => void
|
|
53
|
-
committed: (draft: ChangesState, tabId: string, commits:
|
|
73
|
+
committed: (draft: ChangesState, tabId: string, commits: ForgeChangeCommits | null) => void
|
|
54
74
|
lensed: (draft: ChangesState, tabId: string, lens: ChangesLens) => void
|
|
55
75
|
filtered: (draft: ChangesState, tabId: string, lens: string | null) => void
|
|
56
76
|
toggledTests: (draft: ChangesState, tabId: string) => void
|
|
@@ -62,8 +82,8 @@ export type ChangesActions = {
|
|
|
62
82
|
/** The changes store's actions, also part of the review page's store, whose changes view writes the same choices. */
|
|
63
83
|
export const changesActions: ChangesActions = {
|
|
64
84
|
/**
|
|
65
|
-
* Apply a navigation; the first one seeds the `branch` scope with the automatic fork point,
|
|
66
|
-
* no filter lens, test files shown, two columns, and wrapped lines.
|
|
85
|
+
* Apply a navigation; the first one seeds the `branch` scope of the Session's own checkout with the automatic fork point,
|
|
86
|
+
* every commit and file, no filter lens, test files shown, two columns, and wrapped lines.
|
|
67
87
|
* @param d - draft state.
|
|
68
88
|
* @param tabId - the tab being drawn.
|
|
69
89
|
* @param revision - the navigation revision being applied.
|
|
@@ -72,7 +92,7 @@ export const changesActions: ChangesActions = {
|
|
|
72
92
|
const tab = d.byTab[tabId]
|
|
73
93
|
if (tab === undefined) {
|
|
74
94
|
d.byTab[tabId] = {
|
|
75
|
-
scope: 'branch', base: null, commits: null, lens: 'all', filterLens: null, hideTests: false, split: true, wrap: true, navigated: revision,
|
|
95
|
+
scope: 'branch', head: null, base: null, commits: null, lens: 'all', filterLens: null, hideTests: false, split: true, wrap: true, navigated: revision,
|
|
76
96
|
}
|
|
77
97
|
} else tab.navigated = revision
|
|
78
98
|
},
|
|
@@ -87,6 +107,33 @@ export const changesActions: ChangesActions = {
|
|
|
87
107
|
tab.scope = scope
|
|
88
108
|
tab.commits = null
|
|
89
109
|
},
|
|
110
|
+
/**
|
|
111
|
+
* Show local changes of another branch, compared with its automatic fork point and with all of its commits. A
|
|
112
|
+
* branch that no worktree has checked out has no working tree, so choosing one shows the `branch` scope.
|
|
113
|
+
* @param d - draft state.
|
|
114
|
+
* @param tabId - the tab being drawn.
|
|
115
|
+
* @param head - the branch, or null for the Session's own checkout.
|
|
116
|
+
*/
|
|
117
|
+
headed: (d, tabId: string, head: ChangesHead | null) => {
|
|
118
|
+
const tab = bucket(d, tabId)
|
|
119
|
+
tab.head = head
|
|
120
|
+
tab.base = null
|
|
121
|
+
tab.commits = null
|
|
122
|
+
if (head !== null && head.worktree === null) tab.scope = 'branch'
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* Record where the shown branch's worktree is now, as a read found it; without one the tab shows the `branch`
|
|
126
|
+
* scope. A tab that shows the Session's own checkout is unchanged.
|
|
127
|
+
* @param d - draft state.
|
|
128
|
+
* @param tabId - the tab being drawn.
|
|
129
|
+
* @param worktree - top-level directory of the worktree, or null when no worktree has the branch checked out.
|
|
130
|
+
*/
|
|
131
|
+
rooted: (d, tabId: string, worktree: string | null) => {
|
|
132
|
+
const tab = bucket(d, tabId)
|
|
133
|
+
if (tab.head === null) return
|
|
134
|
+
tab.head = { ...tab.head, worktree }
|
|
135
|
+
if (worktree === null) tab.scope = 'branch'
|
|
136
|
+
},
|
|
90
137
|
/**
|
|
91
138
|
* Compare the `branch` scope with another branch, showing all of its commits.
|
|
92
139
|
* @param d - draft state.
|
|
@@ -104,7 +151,7 @@ export const changesActions: ChangesActions = {
|
|
|
104
151
|
* @param tabId - the tab being drawn.
|
|
105
152
|
* @param commits - the commits, or null for all of them.
|
|
106
153
|
*/
|
|
107
|
-
committed: (d, tabId: string, commits:
|
|
154
|
+
committed: (d, tabId: string, commits: ForgeChangeCommits | null) => { bucket(d, tabId).commits = commits },
|
|
108
155
|
/**
|
|
109
156
|
* Show the files of another review layer.
|
|
110
157
|
* @param d - draft state.
|
package/src/client/checkout.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** What the panel's checkout row says about the checkout the Session works in. */
|
|
2
2
|
|
|
3
|
-
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
|
|
3
|
+
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
4
4
|
import { abbreviateHomePath } from '@deepseek-ai/dsh-util-workspace-path'
|
|
5
5
|
import { branchLabel } from '../branch-name.ts'
|
|
6
6
|
import type { ForgePanelState } from '../types.ts'
|
|
@@ -9,7 +9,9 @@ export interface CodeSelection {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
function codeAt(node: Node | null): HTMLElement | null {
|
|
12
|
-
|
|
12
|
+
// A text node has no `closest`, so its parent element answers.
|
|
13
|
+
return (node as Partial<Element> | null)?.closest?.<HTMLElement>('[data-review-code]')
|
|
14
|
+
?? node?.parentElement?.closest<HTMLElement>('[data-review-code]') ?? null
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
/**
|
package/src/client/forge-copy.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useMemo } from 'react'
|
|
4
4
|
import type { ForgeDescription } from '@deepseek-ai/dsh-experimental-forge/types'
|
|
5
|
-
import type { TranslateNS } from '@deepseek-ai/dsh-client-ui-slots'
|
|
5
|
+
import type { TranslateNS } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
6
6
|
import type { NS } from './locales.ts'
|
|
7
7
|
|
|
8
8
|
/** The `forge` and `noun` parameters of copy that names the code host; a type alias so it passes as notice parameters. */
|
|
@@ -47,3 +47,13 @@ export function useForgeCopy(translate: TranslateNS<typeof NS>, url: string | nu
|
|
|
47
47
|
function hostOf(url: string): string {
|
|
48
48
|
return /^[a-z][a-z\d+.-]*:\/\/([^/?#]+)/i.exec(url)?.[1] ?? url
|
|
49
49
|
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Name the action that opens a change request on its code host.
|
|
53
|
+
* @param translate - forge panel copy.
|
|
54
|
+
* @param forge - product name of the code host, or null when no provider names one.
|
|
55
|
+
* @returns the label that names the code host, or the one that names the browser without a name.
|
|
56
|
+
*/
|
|
57
|
+
export function openOnLabel(translate: TranslateNS<typeof NS>, forge: string | null): string {
|
|
58
|
+
return forge === null ? translate('change.view') : translate('change.viewOn', { forge })
|
|
59
|
+
}
|
package/src/client/format.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Localized durations and relative times shown on change request cards. */
|
|
2
2
|
|
|
3
|
-
import { relativeTime } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
4
|
-
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
|
|
3
|
+
import { relativeTime } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
4
|
+
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
5
5
|
import type { NS } from './locales.ts'
|
|
6
6
|
|
|
7
7
|
type Translate = PropsLocale<typeof NS>['t']
|
package/src/client/glyphs.tsx
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Lifecycle glyphs of change requests, outcome glyphs of their checks, the marks of their code hosts, the marks of file
|
|
3
|
+
* headers, and the mark of the review page's list column.
|
|
4
|
+
*/
|
|
2
5
|
|
|
3
6
|
import type { ReactNode } from 'react'
|
|
4
7
|
import clsx from 'clsx'
|
|
5
|
-
import { IconCheckCircleFillRegular } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
8
|
+
import { IconCheckCircleFillRegular, IconRightUpOutlineRegular, LinkIconRegular } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
6
9
|
import type { CheckState, ChecksRollup } from '@deepseek-ai/dsh-experimental-forge/types'
|
|
7
10
|
import type { ChangeRequestTone } from './status.ts'
|
|
8
11
|
import css from './Forge.module.css'
|
|
@@ -18,8 +21,8 @@ const BRANCH_ENDS = (
|
|
|
18
21
|
/** The head branch line that bends back toward the base, shared by the open and blocked shapes. */
|
|
19
22
|
const TOWARD_BASE = (
|
|
20
23
|
<>
|
|
21
|
-
<path d="M12 10.
|
|
22
|
-
<path d="M9.6
|
|
24
|
+
<path d="M12 10.9V5.5C12 4.4 11.1 3.5 10 3.5H8.2" />
|
|
25
|
+
<path d="M9.6 1.9L8 3.5L9.6 5.1" />
|
|
23
26
|
</>
|
|
24
27
|
)
|
|
25
28
|
|
|
@@ -60,7 +63,7 @@ const SHAPES: Record<ChangeRequestTone, ReactNode> = {
|
|
|
60
63
|
closed: (
|
|
61
64
|
<>
|
|
62
65
|
{BRANCH_ENDS}
|
|
63
|
-
<path d="M4 5.1V10.9M12 10.
|
|
66
|
+
<path d="M4 5.1V10.9M12 10.9V7.1M10.4 1.9L13.6 5.1M13.6 1.9L10.4 5.1" />
|
|
64
67
|
</>
|
|
65
68
|
),
|
|
66
69
|
}
|
|
@@ -148,3 +151,67 @@ export function CheckGlyph({ state, size = 16 }: { readonly state: CheckState; r
|
|
|
148
151
|
</span>
|
|
149
152
|
)
|
|
150
153
|
}
|
|
154
|
+
|
|
155
|
+
/** The public host whose site mark stands for each forge family, self-hosted instances included. */
|
|
156
|
+
const FORGE_SITE: Readonly<Record<string, string>> = { github: 'https://github.com', gitlab: 'https://gitlab.com' }
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Draw the mark of a code host on an action that opens it: the site mark of the provider's forge family, whatever the
|
|
160
|
+
* host name, or the leaving arrow for a family without a mark and for no provider.
|
|
161
|
+
* @param props.forge - forge family of the change request's provider, such as `github`, or null without one.
|
|
162
|
+
* @param props.size - width and height in pixels, 14 by default.
|
|
163
|
+
* @returns the decorative glyph.
|
|
164
|
+
*/
|
|
165
|
+
export function ForgeGlyph({ forge, size = 14 }: { readonly forge: string | null; readonly size?: number | undefined }): ReactNode {
|
|
166
|
+
const site = forge === null ? undefined : FORGE_SITE[forge]
|
|
167
|
+
return site === undefined ? <IconRightUpOutlineRegular size={size} /> : <LinkIconRegular kind="url" href={site} size={size} />
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** A file header mark the shared icons have no drawing of. */
|
|
171
|
+
export type FileMark = 'unstage' | 'restore' | 'unviewed'
|
|
172
|
+
|
|
173
|
+
const FILE_MARKS: Record<FileMark, ReactNode> = {
|
|
174
|
+
// The horizontal stroke of the shared plus, which stages.
|
|
175
|
+
unstage: <path vectorEffect="non-scaling-stroke" d="M2 8H14" />,
|
|
176
|
+
restore: (
|
|
177
|
+
<g strokeLinecap="round" strokeLinejoin="round">
|
|
178
|
+
<path vectorEffect="non-scaling-stroke" d="M5.5 2.5L2.5 5.5L5.5 8.5" />
|
|
179
|
+
<path vectorEffect="non-scaling-stroke" d="M2.5 5.5H9.5A4 4 0 0 1 9.5 13.5H6" />
|
|
180
|
+
</g>
|
|
181
|
+
),
|
|
182
|
+
// The ring of the shared check circle, which marks a viewed file.
|
|
183
|
+
unviewed: <circle vectorEffect="non-scaling-stroke" cx="8" cy="8" r="6.5" />,
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Draw a decorative mark of a file header at the weight of the shared Regular icons: a minus for unstaging, an arrow
|
|
188
|
+
* turning back for restoring, and the empty ring of a file that is not viewed.
|
|
189
|
+
* @param props.mark - which mark to draw.
|
|
190
|
+
* @returns the glyph, 16 pixels wide unless its control sizes it.
|
|
191
|
+
*/
|
|
192
|
+
export function FileMarkGlyph({ mark }: { readonly mark: FileMark }): ReactNode {
|
|
193
|
+
return (
|
|
194
|
+
<svg width={16} height={16} viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth={1} aria-hidden="true" data-forge-file-mark={mark}>
|
|
195
|
+
{FILE_MARKS[mark]}
|
|
196
|
+
</svg>
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Draw the decorative mark of the review page's list column, for the control that hides and shows it: the outline of
|
|
202
|
+
* the shared panel icon with three rows in its leading half, at the weight of the shared Regular icons. The rows tell
|
|
203
|
+
* it from the plain panel icon of the application sidebar's toggle, which can sit beside it.
|
|
204
|
+
* @param props.size - width and height in pixels, 16 by default.
|
|
205
|
+
* @returns the glyph.
|
|
206
|
+
*/
|
|
207
|
+
export function ListPanelGlyph({ size = 16 }: { readonly size?: number | undefined }): ReactNode {
|
|
208
|
+
return (
|
|
209
|
+
<svg width={size} height={size} viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth={1} strokeLinecap="round"
|
|
210
|
+
aria-hidden="true" data-forge-list-panel="">
|
|
211
|
+
<path vectorEffect="non-scaling-stroke"
|
|
212
|
+
d="M13.5 1.5H2.5C1.94772 1.5 1.5 1.94772 1.5 2.5V13.5C1.5 14.0523 1.94772 14.5 2.5 14.5H13.5C14.0523 14.5 14.5 14.0523 14.5 13.5V2.5C14.5 1.94772 14.0523 1.5 13.5 1.5Z" />
|
|
213
|
+
<path vectorEffect="non-scaling-stroke" d="M8 1.5V14.5" />
|
|
214
|
+
<path vectorEffect="non-scaling-stroke" d="M3.8 5H5.7M3.8 8H5.7M3.8 11H5.7" />
|
|
215
|
+
</svg>
|
|
216
|
+
)
|
|
217
|
+
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { useCallback, useEffect, useRef, useState, type RefObject } from 'react'
|
|
9
|
-
import type { CodeHighlighter, HighlightSpan } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
9
|
+
import type { CodeHighlighter, HighlightSpan } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
10
10
|
import type { ForgeDiffHunk } from '../types.ts'
|
|
11
11
|
import type { DiffRow } from './diff-rows.ts'
|
|
12
12
|
|