@deepseek-ai/dsh-experimental-client-ui-forge 0.2.2-rc.5 → 0.2.3-alpha.2
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 +12 -12
- package/README.md +47 -30
- package/README.zh.md +47 -30
- package/lib/client.js +18 -8
- package/lib/client.js.map +1 -1
- package/lib/index.js +2444 -406
- package/lib/typert.host.js +3433 -950
- package/lib/typert.remote-client.d.ts +89 -14
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +3155 -978
- package/lib/types/branch-name.d.ts +30 -0
- package/lib/types/branch-name.d.ts.map +1 -0
- package/lib/types/branch-name.js.map +1 -0
- package/lib/types/client/AttentionIndicator.d.ts +22 -0
- package/lib/types/client/AttentionIndicator.d.ts.map +1 -0
- package/lib/types/client/AttentionIndicator.js.map +1 -0
- package/lib/types/client/BaseMenu.d.ts.map +1 -1
- package/lib/types/client/BaseMenu.js.map +1 -1
- package/lib/types/client/ChangeRequestCard.d.ts +87 -9
- 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 +126 -10
- 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 +76 -0
- package/lib/types/client/ChangeRequestsSection.d.ts.map +1 -0
- package/lib/types/client/ChangeRequestsSection.js.map +1 -0
- package/lib/types/client/ChangedFiles.d.ts +6 -2
- 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 +14 -0
- package/lib/types/client/ChangesLoading.d.ts.map +1 -0
- package/lib/types/client/ChangesLoading.js.map +1 -0
- package/lib/types/client/ChangesTab.d.ts +62 -14
- package/lib/types/client/ChangesTab.d.ts.map +1 -1
- package/lib/types/client/ChangesTab.js.map +1 -1
- package/lib/types/client/ChangesTabTitle.js.map +1 -1
- package/lib/types/client/DiffFile.d.ts +23 -4
- 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 +79 -0
- package/lib/types/client/EnvironmentRows.d.ts.map +1 -0
- package/lib/types/client/EnvironmentRows.js.map +1 -0
- package/lib/types/client/FileTreePane.d.ts +5 -2
- package/lib/types/client/FileTreePane.d.ts.map +1 -1
- package/lib/types/client/FileTreePane.js.map +1 -1
- package/lib/types/client/LensFilter.d.ts +50 -0
- package/lib/types/client/LensFilter.d.ts.map +1 -0
- package/lib/types/client/LensFilter.js.map +1 -0
- package/lib/types/client/ReasonButton.d.ts +15 -0
- package/lib/types/client/ReasonButton.d.ts.map +1 -0
- package/lib/types/client/ReasonButton.js.map +1 -0
- package/lib/types/client/ReviewComposer.d.ts +11 -4
- 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 +18 -7
- 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 +3 -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 +32 -2
- 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.map +1 -1
- package/lib/types/client/SessionHoverForge.js.map +1 -1
- package/lib/types/client/SubmitReview.d.ts +4 -4
- package/lib/types/client/SubmitReview.d.ts.map +1 -1
- package/lib/types/client/SubmitReview.js.map +1 -1
- package/lib/types/client/ThreadList.js.map +1 -1
- package/lib/types/client/ViewOptionsMenu.d.ts +7 -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 +38 -0
- package/lib/types/client/WorktreeNameDialog.d.ts.map +1 -0
- package/lib/types/client/WorktreeNameDialog.js.map +1 -0
- package/lib/types/client/WorktreeProgress.d.ts +14 -3
- package/lib/types/client/WorktreeProgress.d.ts.map +1 -1
- package/lib/types/client/WorktreeProgress.js.map +1 -1
- package/lib/types/client/WorktreeToggle.d.ts +22 -15
- package/lib/types/client/WorktreeToggle.d.ts.map +1 -1
- package/lib/types/client/WorktreeToggle.js.map +1 -1
- package/lib/types/client/action-notices.d.ts +25 -0
- package/lib/types/client/action-notices.d.ts.map +1 -0
- package/lib/types/client/action-notices.js.map +1 -0
- package/lib/types/client/annotations.d.ts +41 -0
- package/lib/types/client/annotations.d.ts.map +1 -0
- package/lib/types/client/annotations.js.map +1 -0
- package/lib/types/client/branch-search.d.ts +38 -0
- package/lib/types/client/branch-search.d.ts.map +1 -0
- package/lib/types/client/branch-search.js.map +1 -0
- package/lib/types/client/change-requests-store.d.ts +25 -0
- package/lib/types/client/change-requests-store.d.ts.map +1 -0
- package/lib/types/client/change-requests-store.js.map +1 -0
- package/lib/types/client/changes-address.d.ts +3 -1
- package/lib/types/client/changes-address.d.ts.map +1 -1
- package/lib/types/client/changes-address.js.map +1 -1
- package/lib/types/client/changes-service.d.ts +119 -0
- package/lib/types/client/changes-service.d.ts.map +1 -0
- package/lib/types/client/changes-service.js.map +1 -0
- package/lib/types/client/changes-store.d.ts +6 -2
- 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.map +1 -1
- package/lib/types/client/checkout.js.map +1 -1
- package/lib/types/client/diff-rows.d.ts +49 -7
- package/lib/types/client/diff-rows.d.ts.map +1 -1
- package/lib/types/client/diff-rows.js.map +1 -1
- package/lib/types/client/file-tree.d.ts +7 -0
- package/lib/types/client/file-tree.d.ts.map +1 -1
- package/lib/types/client/file-tree.js.map +1 -1
- package/lib/types/client/forge-copy.d.ts +29 -0
- package/lib/types/client/forge-copy.d.ts.map +1 -0
- package/lib/types/client/forge-copy.js.map +1 -0
- package/lib/types/client/format.d.ts +8 -0
- 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 +3 -3
- 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 +73 -0
- package/lib/types/client/highlight-context.d.ts.map +1 -0
- package/lib/types/client/highlight-context.js.map +1 -0
- package/lib/types/client/index.d.ts +9 -5
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/index.js.map +1 -1
- package/lib/types/client/lens-filter.d.ts +69 -0
- package/lib/types/client/lens-filter.d.ts.map +1 -0
- package/lib/types/client/lens-filter.js.map +1 -0
- package/lib/types/client/locales.d.ts +188 -36
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/locales.js.map +1 -1
- package/lib/types/client/mount.d.ts +0 -4
- 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/ReviewChat.d.ts +112 -0
- package/lib/types/client/review-page/ReviewChat.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewChat.js.map +1 -0
- package/lib/types/client/review-page/ReviewDetail.d.ts +56 -0
- package/lib/types/client/review-page/ReviewDetail.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewDetail.js.map +1 -0
- package/lib/types/client/review-page/ReviewLabels.d.ts +32 -0
- package/lib/types/client/review-page/ReviewLabels.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewLabels.js.map +1 -0
- package/lib/types/client/review-page/ReviewList.d.ts +68 -0
- package/lib/types/client/review-page/ReviewList.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewList.js.map +1 -0
- package/lib/types/client/review-page/ReviewNav.d.ts +28 -0
- package/lib/types/client/review-page/ReviewNav.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewNav.js.map +1 -0
- package/lib/types/client/review-page/ReviewPage.d.ts +61 -0
- package/lib/types/client/review-page/ReviewPage.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewPage.js.map +1 -0
- package/lib/types/client/review-page/ReviewStatus.d.ts +37 -0
- package/lib/types/client/review-page/ReviewStatus.d.ts.map +1 -0
- package/lib/types/client/review-page/ReviewStatus.js.map +1 -0
- package/lib/types/client/review-page/host-stream.d.ts +24 -0
- package/lib/types/client/review-page/host-stream.d.ts.map +1 -0
- package/lib/types/client/review-page/host-stream.js.map +1 -0
- package/lib/types/client/review-page/review-lists.d.ts +116 -0
- package/lib/types/client/review-page/review-lists.d.ts.map +1 -0
- package/lib/types/client/review-page/review-lists.js.map +1 -0
- package/lib/types/client/review-page/review-mount.d.ts +50 -0
- package/lib/types/client/review-page/review-mount.d.ts.map +1 -0
- package/lib/types/client/review-page/review-mount.js.map +1 -0
- package/lib/types/client/review-page/review-store.d.ts +79 -0
- package/lib/types/client/review-page/review-store.d.ts.map +1 -0
- package/lib/types/client/review-page/review-store.js.map +1 -0
- package/lib/types/client/review-queue.d.ts +19 -0
- 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 +0 -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 +18 -0
- package/lib/types/client/review.d.ts.map +1 -1
- package/lib/types/client/review.js.map +1 -1
- package/lib/types/client/slots.d.ts +114 -0
- package/lib/types/client/slots.d.ts.map +1 -0
- package/lib/types/client/slots.js.map +1 -0
- package/lib/types/client/source.d.ts +29 -23
- package/lib/types/client/source.d.ts.map +1 -1
- package/lib/types/client/source.js.map +1 -1
- package/lib/types/client/status.d.ts +13 -2
- package/lib/types/client/status.d.ts.map +1 -1
- package/lib/types/client/status.js.map +1 -1
- package/lib/types/git.d.ts +4 -15
- package/lib/types/git.d.ts.map +1 -1
- package/lib/types/git.js.map +1 -1
- package/lib/types/index.d.ts +346 -28
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/lens-version.d.ts +14 -0
- package/lib/types/lens-version.d.ts.map +1 -0
- package/lib/types/lens-version.js.map +1 -0
- package/lib/types/lenses.d.ts +122 -0
- package/lib/types/lenses.d.ts.map +1 -0
- package/lib/types/lenses.js.map +1 -0
- package/lib/types/local-diff.d.ts +16 -0
- package/lib/types/local-diff.d.ts.map +1 -1
- package/lib/types/local-diff.js.map +1 -1
- package/lib/types/panel.d.ts +59 -8
- package/lib/types/panel.d.ts.map +1 -1
- package/lib/types/panel.js.map +1 -1
- package/lib/types/parse.d.ts +24 -8
- package/lib/types/parse.d.ts.map +1 -1
- package/lib/types/parse.js.map +1 -1
- package/lib/types/review-cache.d.ts +29 -19
- package/lib/types/review-cache.d.ts.map +1 -1
- package/lib/types/review-cache.js.map +1 -1
- package/lib/types/states.d.ts +11 -7
- package/lib/types/states.d.ts.map +1 -1
- package/lib/types/states.js.map +1 -1
- package/lib/types/types.d.ts +266 -20
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/viewer-lists.d.ts +113 -0
- package/lib/types/viewer-lists.d.ts.map +1 -0
- package/lib/types/viewer-lists.js.map +1 -0
- package/lib/types/worktree.d.ts +20 -11
- package/lib/types/worktree.d.ts.map +1 -1
- package/lib/types/worktree.js.map +1 -1
- package/locale/de.json +1 -1
- package/locale/en.json +1 -1
- package/locale/es.json +1 -1
- package/locale/fr.json +1 -1
- package/locale/ja.json +1 -1
- package/locale/pt.json +1 -1
- package/locale/ru.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +61 -52
- package/src/branch-name.ts +74 -0
- package/src/client/AttentionIndicator.tsx +37 -0
- package/src/client/BaseMenu.module.css +0 -20
- package/src/client/BaseMenu.tsx +9 -52
- package/src/client/ChangeRequestCard.tsx +276 -131
- package/src/client/ChangeRequestOverview.module.css +1 -1
- package/src/client/ChangeRequestOverview.tsx +183 -67
- package/src/client/ChangeRequestsSection.tsx +234 -0
- package/src/client/ChangedFiles.module.css +5 -1
- package/src/client/ChangedFiles.tsx +72 -36
- package/src/client/ChangesLoading.module.css +110 -0
- package/src/client/ChangesLoading.tsx +69 -0
- package/src/client/ChangesTab.module.css +83 -114
- package/src/client/ChangesTab.tsx +331 -100
- package/src/client/ChangesTabTitle.tsx +3 -3
- package/src/client/DiffFile.tsx +241 -45
- package/src/client/EnvironmentRows.tsx +263 -0
- package/src/client/FileLabel.tsx +1 -1
- package/src/client/FileTreePane.tsx +11 -6
- package/src/client/{ForgeTab.module.css → Forge.module.css} +130 -275
- package/src/client/LensFilter.module.css +87 -0
- package/src/client/LensFilter.tsx +105 -0
- package/src/client/ReasonButton.tsx +23 -0
- package/src/client/ReviewComposer.module.css +2 -8
- package/src/client/ReviewComposer.tsx +27 -8
- package/src/client/ReviewControls.module.css +39 -0
- package/src/client/ReviewControls.tsx +71 -15
- package/src/client/ReviewThread.tsx +55 -30
- package/src/client/ReviewThreads.module.css +24 -0
- package/src/client/ReviewThreads.tsx +56 -21
- package/src/client/SessionHoverForge.tsx +2 -1
- package/src/client/SubmitReview.tsx +11 -8
- package/src/client/ThreadList.tsx +1 -1
- package/src/client/ViewOptionsMenu.tsx +19 -4
- package/src/client/WorktreeNameDialog.module.css +53 -0
- package/src/client/WorktreeNameDialog.tsx +93 -0
- package/src/client/WorktreeProgress.tsx +100 -35
- package/src/client/WorktreeToggle.module.css +121 -5
- package/src/client/WorktreeToggle.tsx +178 -61
- package/src/client/action-notices.ts +38 -0
- package/src/client/annotations.ts +105 -0
- package/src/client/branch-search.tsx +77 -0
- package/src/client/change-requests-store.ts +50 -0
- package/src/client/changes-address.ts +3 -1
- package/src/client/changes-service.ts +173 -0
- package/src/client/changes-store.ts +103 -91
- package/src/client/checkout.ts +2 -1
- package/src/client/diff-rows.ts +100 -16
- package/src/client/file-tree.ts +29 -0
- package/src/client/forge-copy.ts +49 -0
- package/src/client/format.ts +14 -0
- package/src/client/glyphs.tsx +12 -13
- package/src/client/highlight-context.ts +213 -0
- package/src/client/index.ts +20 -5
- package/src/client/lens-filter.ts +136 -0
- package/src/client/locales.ts +1504 -288
- package/src/client/mount.ts +228 -109
- package/src/client/review-page/ReviewChat.tsx +311 -0
- package/src/client/review-page/ReviewDetail.tsx +331 -0
- package/src/client/review-page/ReviewLabels.tsx +94 -0
- package/src/client/review-page/ReviewList.tsx +461 -0
- package/src/client/review-page/ReviewNav.tsx +47 -0
- package/src/client/review-page/ReviewPage.module.css +946 -0
- package/src/client/review-page/ReviewPage.tsx +287 -0
- package/src/client/review-page/ReviewStatus.tsx +259 -0
- package/src/client/review-page/host-stream.ts +63 -0
- package/src/client/review-page/review-lists.ts +207 -0
- package/src/client/review-page/review-mount.ts +228 -0
- package/src/client/review-page/review-store.ts +94 -0
- package/src/client/review-queue.ts +30 -0
- package/src/client/review-threads.ts +0 -12
- package/src/client/review.ts +27 -0
- package/src/client/slots.ts +92 -0
- package/src/client/source.ts +67 -43
- package/src/client/status.ts +16 -4
- package/src/git.ts +16 -38
- package/src/index.ts +900 -152
- package/src/lens-version.ts +27 -0
- package/src/lenses.ts +284 -0
- package/src/local-diff.ts +48 -1
- package/src/panel.ts +123 -28
- package/src/parse.ts +86 -10
- package/src/review-cache.ts +57 -37
- package/src/states.ts +38 -18
- package/src/types.ts +267 -21
- package/src/viewer-lists.ts +375 -0
- package/src/worktree.ts +64 -34
- package/lib/types/client/ForgeTab.d.ts +0 -65
- package/lib/types/client/ForgeTab.d.ts.map +0 -1
- package/lib/types/client/ForgeTab.js.map +0 -1
- package/lib/types/client/ForgeTabTitle.d.ts +0 -11
- package/lib/types/client/ForgeTabTitle.d.ts.map +0 -1
- package/lib/types/client/ForgeTabTitle.js.map +0 -1
- package/lib/types/client/HeaderButton.d.ts +0 -27
- package/lib/types/client/HeaderButton.d.ts.map +0 -1
- package/lib/types/client/HeaderButton.js.map +0 -1
- package/lib/types/client/LocalChangesCard.d.ts +0 -29
- package/lib/types/client/LocalChangesCard.d.ts.map +0 -1
- package/lib/types/client/LocalChangesCard.js.map +0 -1
- package/src/client/ForgeTab.tsx +0 -263
- package/src/client/ForgeTabTitle.tsx +0 -21
- package/src/client/HeaderButton.module.css +0 -29
- package/src/client/HeaderButton.tsx +0 -68
- package/src/client/LocalChangesCard.tsx +0 -83
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** The search shared by the branch pickers: the query, the listing it read, and the status a menu shows instead of rows. */
|
|
2
|
+
|
|
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'
|
|
6
|
+
import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol'
|
|
7
|
+
import type { NS } from './locales.ts'
|
|
8
|
+
|
|
9
|
+
/** Milliseconds between the last keystroke of a search and the listing it reads. */
|
|
10
|
+
const SEARCH_DELAY_MS = 150
|
|
11
|
+
|
|
12
|
+
/** A branch picker's search while its menu is shown. */
|
|
13
|
+
export interface BranchSearch<T> {
|
|
14
|
+
/** Text in the search field. */
|
|
15
|
+
readonly query: string
|
|
16
|
+
/** Change the search text; the listing is read again after a short pause. */
|
|
17
|
+
readonly setQuery: (query: string) => void
|
|
18
|
+
/** The last listing that arrived, or null before the first one. */
|
|
19
|
+
readonly listing: RemoteResult<T> | null
|
|
20
|
+
/** Read the listing again, as after a failed read. */
|
|
21
|
+
readonly retry: () => void
|
|
22
|
+
/** Clear the search text, as when the menu closes. */
|
|
23
|
+
readonly reset: () => void
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Read the branches of a picker while its menu is shown: at once on opening and on a retry, and after a pause while
|
|
28
|
+
* the search text changes. Each new read cancels the one before; the last listing stays until the next arrives.
|
|
29
|
+
* @param shown - whether the menu is shown.
|
|
30
|
+
* @param list - reads the branches whose names contain the query; the signal aborts the read.
|
|
31
|
+
* @returns the search state.
|
|
32
|
+
*/
|
|
33
|
+
export function useBranchSearch<T>(
|
|
34
|
+
shown: boolean,
|
|
35
|
+
list: (query: string, signal: AbortSignal) => Promise<RemoteResult<T>>,
|
|
36
|
+
): BranchSearch<T> {
|
|
37
|
+
const [query, setQuery] = useState('')
|
|
38
|
+
const [attempt, setAttempt] = useState(0)
|
|
39
|
+
const [listing, setListing] = useState<RemoteResult<T> | null>(null)
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!shown) return
|
|
42
|
+
const controller = new AbortController()
|
|
43
|
+
const timer = setTimeout(() => {
|
|
44
|
+
void list(query, controller.signal).then((result) => { if (!controller.signal.aborted) setListing(result) })
|
|
45
|
+
}, query === '' ? 0 : SEARCH_DELAY_MS)
|
|
46
|
+
return () => {
|
|
47
|
+
clearTimeout(timer)
|
|
48
|
+
controller.abort()
|
|
49
|
+
}
|
|
50
|
+
}, [shown, query, attempt, list])
|
|
51
|
+
const retry = useCallback(() => { setAttempt(count => count + 1) }, [])
|
|
52
|
+
const reset = useCallback(() => { setQuery('') }, [])
|
|
53
|
+
return { query, setQuery, listing, retry, reset }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The status a branch menu shows instead of its rows: reading, a failed read with a retry, or no matching branch.
|
|
58
|
+
* @param props - the listing, whether no row matches, the retry, the status row's class, and copy.
|
|
59
|
+
* @returns the status row, or null while the menu shows rows.
|
|
60
|
+
*/
|
|
61
|
+
export function branchSearchStatus({ listing, empty, retry, className, t }: {
|
|
62
|
+
readonly listing: RemoteResult<unknown> | null
|
|
63
|
+
readonly empty: boolean
|
|
64
|
+
readonly retry: () => void
|
|
65
|
+
readonly className: string | undefined
|
|
66
|
+
} & PropsLocale<typeof NS>): ReactNode {
|
|
67
|
+
if (listing === null) return <div className={className} role="status"><StateDot state="ongoing" />{t('diff.base.loading')}</div>
|
|
68
|
+
if (!listing.ok) {
|
|
69
|
+
return (
|
|
70
|
+
<div className={className} role="status">
|
|
71
|
+
<span>{t('toast.branchesFailed')}</span>
|
|
72
|
+
<Button size="sm" variant="outline" onClick={retry}>{t('retry')}</Button>
|
|
73
|
+
</div>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
return empty ? <div className={className}>{t('diff.base.empty')}</div> : null
|
|
77
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The expansion the user chose for the change request cards of one Session, and whether its list shows every card. The
|
|
3
|
+
* registration declares it as an exclusive store, so each Session keeps its
|
|
4
|
+
* choices while its scope is retained, across hiding and showing the panel.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { defineStore, type EngineStoreHandle } from '@deepseek-ai/dsh-client-store'
|
|
8
|
+
|
|
9
|
+
/** Card choices of one Session. */
|
|
10
|
+
export interface ChangeRequestsSectionState {
|
|
11
|
+
/** Whether the user expanded (true) or collapsed (false) a card, by change request URL; unchosen cards are absent. */
|
|
12
|
+
expanded: Record<string, boolean>
|
|
13
|
+
/** Whether the list shows the cards past its first three. */
|
|
14
|
+
unfolded: boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** The change requests section store's write set. */
|
|
18
|
+
type ChangeRequestsSectionActions = {
|
|
19
|
+
toggled: (draft: ChangeRequestsSectionState, url: string, expanded: boolean) => void
|
|
20
|
+
unfoldedSet: (draft: ChangeRequestsSectionState, unfolded: boolean) => void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Declare the change requests section's store.
|
|
25
|
+
* @returns the store handle to declare on the registration.
|
|
26
|
+
*/
|
|
27
|
+
export function createChangeRequestsSectionStore(): EngineStoreHandle<ChangeRequestsSectionState, ChangeRequestsSectionActions> {
|
|
28
|
+
return defineStore({
|
|
29
|
+
init: (): ChangeRequestsSectionState => ({ expanded: {}, unfolded: false }),
|
|
30
|
+
actions: {
|
|
31
|
+
/**
|
|
32
|
+
* Record the user's choice for one card.
|
|
33
|
+
* @param d - draft state.
|
|
34
|
+
* @param url - the change request's URL.
|
|
35
|
+
* @param expanded - whether the card is now expanded.
|
|
36
|
+
*/
|
|
37
|
+
toggled: (d, url: string, expanded: boolean) => {
|
|
38
|
+
d.expanded[url] = expanded
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Show every card of the list, or fold it to its first three again.
|
|
42
|
+
* @param d - draft state.
|
|
43
|
+
* @param unfolded - whether the list now shows every card.
|
|
44
|
+
*/
|
|
45
|
+
unfoldedSet: (d, unfolded: boolean) => {
|
|
46
|
+
d.unfolded = unfolded
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
}
|
|
@@ -39,11 +39,13 @@ export interface ChangesTarget {
|
|
|
39
39
|
export interface ChangesParams {
|
|
40
40
|
/** File to scroll to, by its path in the diff. */
|
|
41
41
|
readonly path?: string
|
|
42
|
+
/** Identity of the filter lens to choose. */
|
|
43
|
+
readonly lens?: string
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
declare module '@deepseek-ai/dsh-client-ui-sidebar-right/client' {
|
|
45
47
|
interface SidebarRightResourceParamsMap {
|
|
46
|
-
/** The file a changes tab scrolls to. */
|
|
48
|
+
/** The file a changes tab scrolls to and the lens it chooses. */
|
|
47
49
|
'forge-changes': ChangesParams
|
|
48
50
|
}
|
|
49
51
|
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The changes view's face for other Client plugins, which the forge panel provides as `ctx.forgeChanges`: the
|
|
3
|
+
* changes tab's addresses and kinds, opening a view, the titles of Host lenses, and line annotation sources.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots'
|
|
7
|
+
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
|
8
|
+
import type { ForgeExtensionState, ForgeLensId } from '../types.ts'
|
|
9
|
+
import { changesAddress, parseChangesAddress, type ChangesParams, type ChangesTarget } from './changes-address.ts'
|
|
10
|
+
|
|
11
|
+
declare module '@deepseek-ai/cordis' {
|
|
12
|
+
interface Context {
|
|
13
|
+
/** The changes view's face for other Client plugins. */
|
|
14
|
+
forgeChanges: ForgeChangesService
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** The title of a filter lens a Host plugin registers, which a Client plugin describes. */
|
|
19
|
+
export interface ForgeLensDescription {
|
|
20
|
+
/** Identity of the Host lens. */
|
|
21
|
+
readonly id: ForgeLensId
|
|
22
|
+
/** Title in the current language, read whenever the view draws. */
|
|
23
|
+
readonly title: () => string
|
|
24
|
+
/** Position among the lenses, lower first; equal positions keep registration order. Default 0. */
|
|
25
|
+
readonly order?: number
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Where one line annotation sits in a file of a changes view. */
|
|
29
|
+
export interface ForgeLineAnnotation {
|
|
30
|
+
/** Identity within its source, stable across updates; it keys the drawn entry. */
|
|
31
|
+
readonly key: string
|
|
32
|
+
/** Inclusive 1-based lines on the old (`L`) or new (`R`) side, or `file` for the whole file. */
|
|
33
|
+
readonly place: { readonly side: 'L' | 'R'; readonly startLine: number; readonly endLine: number } | 'file'
|
|
34
|
+
/** Digest of the file change it was written on; a file whose `digest` differs shows it in its outdated section. */
|
|
35
|
+
readonly digest?: string
|
|
36
|
+
/** Changes whenever the entry should draw again; equal keys and versions keep the drawn entry's props. */
|
|
37
|
+
readonly version: string | number
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** A Client plugin's line annotations, drawn through its `forge.diff.line.annotation` entry. */
|
|
41
|
+
export interface ForgeAnnotationSource {
|
|
42
|
+
/** Unique source identity, also the key of its `forge.diff.line.annotation` entry. */
|
|
43
|
+
readonly id: string
|
|
44
|
+
/** Position among sources in one stack, lower first; equal positions keep registration order. Default 0. */
|
|
45
|
+
readonly order?: number
|
|
46
|
+
/**
|
|
47
|
+
* Observe the annotations of one view, by path. The changes view calls it once per view and source registration;
|
|
48
|
+
* the source republishes through the same observable whenever the annotations change.
|
|
49
|
+
* @param target - the view's Session and source.
|
|
50
|
+
* @returns annotations by repository-relative path.
|
|
51
|
+
*/
|
|
52
|
+
observe(target: ChangesTarget): HostObservable<ReadonlyMap<string, readonly ForgeLineAnnotation[]>>
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** What the service needs from the right sidebar. */
|
|
56
|
+
export interface ForgeChangesSidebar {
|
|
57
|
+
/** Session whose sidebar shows, or undefined without one. */
|
|
58
|
+
readonly mounted: () => SessionId | undefined
|
|
59
|
+
/** Open a resource address in the shown Session's sidebar. */
|
|
60
|
+
readonly openResource: (address: string, params: ChangesParams | undefined) => void
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The position of an ordered entry, 0 without an `order`. */
|
|
64
|
+
function positionOf(entry: { readonly order?: number }): number {
|
|
65
|
+
return entry.order ?? 0
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Entries kept by identity in registration order, published sorted by `order`. */
|
|
69
|
+
class OrderedEntries<T extends { readonly id: string; readonly order?: number }> implements HostObservable<readonly T[]> {
|
|
70
|
+
private entries: readonly T[] = []
|
|
71
|
+
private readonly listeners = new Set<() => void>()
|
|
72
|
+
|
|
73
|
+
constructor(private readonly what: string) {}
|
|
74
|
+
|
|
75
|
+
readonly getSnapshot = (): readonly T[] => this.entries
|
|
76
|
+
|
|
77
|
+
readonly subscribe = (listener: () => void): (() => void) => {
|
|
78
|
+
this.listeners.add(listener)
|
|
79
|
+
return () => { this.listeners.delete(listener) }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
add(entry: T): () => void {
|
|
83
|
+
if (this.entries.some(item => item.id === entry.id)) throw new Error(`forge-panel: a ${this.what} "${entry.id}" is already registered`)
|
|
84
|
+
// A stable sort keeps registration order among equal positions.
|
|
85
|
+
this.publish([...this.entries, entry].sort((a, b) => positionOf(a) - positionOf(b)))
|
|
86
|
+
return () => { this.publish(this.entries.filter(item => item !== entry)) }
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private publish(next: readonly T[]): void {
|
|
90
|
+
if (next.length === this.entries.length && next.every((item, index) => item === this.entries[index])) return
|
|
91
|
+
this.entries = next
|
|
92
|
+
for (const listener of [...this.listeners]) listener()
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The changes view's face for other Client plugins. Registrations return their disposer, which the registering plugin
|
|
98
|
+
* holds in its own `ctx.effect` so a registration lives exactly as long as that plugin.
|
|
99
|
+
*/
|
|
100
|
+
export class ForgeChangesService {
|
|
101
|
+
/** Titles of Host lenses in display order. */
|
|
102
|
+
readonly lenses: HostObservable<readonly ForgeLensDescription[]>
|
|
103
|
+
/** Annotation sources in stacking order. */
|
|
104
|
+
readonly annotationSources: HostObservable<readonly ForgeAnnotationSource[]>
|
|
105
|
+
private readonly lensEntries = new OrderedEntries<ForgeLensDescription>('lens description')
|
|
106
|
+
private readonly sourceEntries = new OrderedEntries<ForgeAnnotationSource>('annotation source')
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @param sidebar - the right sidebar's open path.
|
|
110
|
+
* @param extensions - the Host's registered lenses and annotation limit, or null before the Host reports them.
|
|
111
|
+
* @param kinds - tab kind of the changes view.
|
|
112
|
+
*/
|
|
113
|
+
constructor(
|
|
114
|
+
private readonly sidebar: ForgeChangesSidebar,
|
|
115
|
+
readonly extensions: HostObservable<ForgeExtensionState | null>,
|
|
116
|
+
readonly kinds: { readonly changes: string },
|
|
117
|
+
) {
|
|
118
|
+
this.lenses = this.lensEntries
|
|
119
|
+
this.annotationSources = this.sourceEntries
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Mint the address of a changes view.
|
|
124
|
+
* @param target - Session and source.
|
|
125
|
+
* @returns the `dsh-resource://forge-changes/…` address.
|
|
126
|
+
*/
|
|
127
|
+
address(target: ChangesTarget): string {
|
|
128
|
+
return changesAddress(target)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Read the Session and source back out of a changes address.
|
|
133
|
+
* @param address - a resource address.
|
|
134
|
+
* @returns the target, or undefined for an address the forge panel did not mint.
|
|
135
|
+
*/
|
|
136
|
+
parse(address: string): ChangesTarget | undefined {
|
|
137
|
+
return parseChangesAddress(address)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Open or reveal a changes view in the shown Session's right sidebar, scrolled to `params.path` with the lens
|
|
142
|
+
* `params.lens` chosen.
|
|
143
|
+
* @param target - Session and source; the Session must be the one the sidebar shows.
|
|
144
|
+
* @param params - file to scroll to and lens to choose.
|
|
145
|
+
* @throws when `target.sessionId` is not the Session the sidebar shows.
|
|
146
|
+
*/
|
|
147
|
+
open(target: ChangesTarget, params?: ChangesParams): void {
|
|
148
|
+
if (this.sidebar.mounted() !== target.sessionId) {
|
|
149
|
+
throw new Error(`forge-panel: Session ${target.sessionId} is not the Session the sidebar shows`)
|
|
150
|
+
}
|
|
151
|
+
this.sidebar.openResource(changesAddress(target), params)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Describe the title of a Host lens. A lens the Host registers without a description shows its identity.
|
|
156
|
+
* @param description - the lens identity, title, and position.
|
|
157
|
+
* @returns the disposer that withdraws the description.
|
|
158
|
+
* @throws when another description holds the identity.
|
|
159
|
+
*/
|
|
160
|
+
describeLens(description: ForgeLensDescription): () => void {
|
|
161
|
+
return this.lensEntries.add(description)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Register a line annotation source; its `forge.diff.line.annotation` entry, keyed by `source.id`, draws each one.
|
|
166
|
+
* @param source - the source.
|
|
167
|
+
* @returns the disposer that withdraws the source and its annotations.
|
|
168
|
+
* @throws when another source holds the identity.
|
|
169
|
+
*/
|
|
170
|
+
registerAnnotations(source: ForgeAnnotationSource): () => void {
|
|
171
|
+
return this.sourceEntries.add(source)
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -22,6 +22,8 @@ export interface ChangesTabState {
|
|
|
22
22
|
commits: ForgeCommitRange | null
|
|
23
23
|
/** Review layer whose files show. */
|
|
24
24
|
lens: ChangesLens
|
|
25
|
+
/** Identity of the Host filter lens that keeps some of the shown files, or null for none. */
|
|
26
|
+
filterLens: string | null
|
|
25
27
|
/** Whether files of the `test` layer hide from the file tree and the diff. */
|
|
26
28
|
hideTests: boolean
|
|
27
29
|
/** Whether deletions and additions show in two columns. */
|
|
@@ -44,112 +46,122 @@ function bucket(state: ChangesState, tabId: string): ChangesTabState {
|
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
/** The changes store's write set; every action names the tab it writes. */
|
|
47
|
-
type ChangesActions = {
|
|
49
|
+
export type ChangesActions = {
|
|
48
50
|
navigated: (draft: ChangesState, tabId: string, revision: number) => void
|
|
49
51
|
scoped: (draft: ChangesState, tabId: string, scope: ForgeLocalScope['kind']) => void
|
|
50
52
|
based: (draft: ChangesState, tabId: string, base: ForgeBaseBranch | null) => void
|
|
51
53
|
committed: (draft: ChangesState, tabId: string, commits: ForgeCommitRange | null) => void
|
|
52
54
|
lensed: (draft: ChangesState, tabId: string, lens: ChangesLens) => void
|
|
55
|
+
filtered: (draft: ChangesState, tabId: string, lens: string | null) => void
|
|
53
56
|
toggledTests: (draft: ChangesState, tabId: string) => void
|
|
54
57
|
toggledSplit: (draft: ChangesState, tabId: string) => void
|
|
55
58
|
toggledWrap: (draft: ChangesState, tabId: string) => void
|
|
56
59
|
forget: (draft: ChangesState, tabId: string) => void
|
|
57
60
|
}
|
|
58
61
|
|
|
62
|
+
/** The changes store's actions, also part of the review page's store, whose changes view writes the same choices. */
|
|
63
|
+
export const changesActions: ChangesActions = {
|
|
64
|
+
/**
|
|
65
|
+
* Apply a navigation; the first one seeds the `branch` scope with the automatic fork point, every commit and file,
|
|
66
|
+
* no filter lens, test files shown, two columns, and wrapped lines.
|
|
67
|
+
* @param d - draft state.
|
|
68
|
+
* @param tabId - the tab being drawn.
|
|
69
|
+
* @param revision - the navigation revision being applied.
|
|
70
|
+
*/
|
|
71
|
+
navigated: (d, tabId: string, revision: number) => {
|
|
72
|
+
const tab = d.byTab[tabId]
|
|
73
|
+
if (tab === undefined) {
|
|
74
|
+
d.byTab[tabId] = {
|
|
75
|
+
scope: 'branch', base: null, commits: null, lens: 'all', filterLens: null, hideTests: false, split: true, wrap: true, navigated: revision,
|
|
76
|
+
}
|
|
77
|
+
} else tab.navigated = revision
|
|
78
|
+
},
|
|
79
|
+
/**
|
|
80
|
+
* Show another scope of local changes, with all of its commits.
|
|
81
|
+
* @param d - draft state.
|
|
82
|
+
* @param tabId - the tab being drawn.
|
|
83
|
+
* @param scope - the scope to show.
|
|
84
|
+
*/
|
|
85
|
+
scoped: (d, tabId: string, scope: ForgeLocalScope['kind']) => {
|
|
86
|
+
const tab = bucket(d, tabId)
|
|
87
|
+
tab.scope = scope
|
|
88
|
+
tab.commits = null
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* Compare the `branch` scope with another branch, showing all of its commits.
|
|
92
|
+
* @param d - draft state.
|
|
93
|
+
* @param tabId - the tab being drawn.
|
|
94
|
+
* @param base - the branch, or null for the automatic fork point.
|
|
95
|
+
*/
|
|
96
|
+
based: (d, tabId: string, base: ForgeBaseBranch | null) => {
|
|
97
|
+
const tab = bucket(d, tabId)
|
|
98
|
+
tab.base = base
|
|
99
|
+
tab.commits = null
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* Show consecutive commits instead of the whole change request or `branch` scope.
|
|
103
|
+
* @param d - draft state.
|
|
104
|
+
* @param tabId - the tab being drawn.
|
|
105
|
+
* @param commits - the commits, or null for all of them.
|
|
106
|
+
*/
|
|
107
|
+
committed: (d, tabId: string, commits: ForgeCommitRange | null) => { bucket(d, tabId).commits = commits },
|
|
108
|
+
/**
|
|
109
|
+
* Show the files of another review layer.
|
|
110
|
+
* @param d - draft state.
|
|
111
|
+
* @param tabId - the tab being drawn.
|
|
112
|
+
* @param lens - every file, or one layer.
|
|
113
|
+
*/
|
|
114
|
+
lensed: (d, tabId: string, lens: ChangesLens) => { bucket(d, tabId).lens = lens },
|
|
115
|
+
/**
|
|
116
|
+
* Choose the Host filter lens that keeps some of the shown files, or none.
|
|
117
|
+
* @param d - draft state.
|
|
118
|
+
* @param tabId - the tab being drawn.
|
|
119
|
+
* @param lens - the lens identity, or null for none.
|
|
120
|
+
*/
|
|
121
|
+
filtered: (d, tabId: string, lens: string | null) => { bucket(d, tabId).filterLens = lens },
|
|
122
|
+
/**
|
|
123
|
+
* Hide or show the files of the `test` layer; hiding them leaves the `test` lens for every file.
|
|
124
|
+
* @param d - draft state.
|
|
125
|
+
* @param tabId - the tab being drawn.
|
|
126
|
+
*/
|
|
127
|
+
toggledTests: (d, tabId: string) => {
|
|
128
|
+
const tab = bucket(d, tabId)
|
|
129
|
+
tab.hideTests = !tab.hideTests
|
|
130
|
+
if (tab.hideTests && tab.lens === 'test') tab.lens = 'all'
|
|
131
|
+
},
|
|
132
|
+
/**
|
|
133
|
+
* Switch between one column and two.
|
|
134
|
+
* @param d - draft state.
|
|
135
|
+
* @param tabId - the tab being drawn.
|
|
136
|
+
*/
|
|
137
|
+
toggledSplit: (d, tabId: string) => {
|
|
138
|
+
const tab = bucket(d, tabId)
|
|
139
|
+
tab.split = !tab.split
|
|
140
|
+
},
|
|
141
|
+
/**
|
|
142
|
+
* Switch line wrapping.
|
|
143
|
+
* @param d - draft state.
|
|
144
|
+
* @param tabId - the tab being drawn.
|
|
145
|
+
*/
|
|
146
|
+
toggledWrap: (d, tabId: string) => {
|
|
147
|
+
const tab = bucket(d, tabId)
|
|
148
|
+
tab.wrap = !tab.wrap
|
|
149
|
+
},
|
|
150
|
+
/**
|
|
151
|
+
* Drop a tab's bucket once its record is gone.
|
|
152
|
+
* @param d - draft state.
|
|
153
|
+
* @param tabId - the tab that ended.
|
|
154
|
+
*/
|
|
155
|
+
forget: (d, tabId: string) => {
|
|
156
|
+
d.byTab = Object.fromEntries(Object.entries(d.byTab).filter(([id]) => id !== tabId))
|
|
157
|
+
},
|
|
158
|
+
}
|
|
159
|
+
|
|
59
160
|
/**
|
|
60
161
|
* Declare the changes tab's store; the registration declares it as an
|
|
61
162
|
* exclusive store, so the framework mints one instance per Session.
|
|
62
163
|
* @returns the store handle to declare on the registration.
|
|
63
164
|
*/
|
|
64
165
|
export function createChangesStore(): EngineStoreHandle<ChangesState, ChangesActions> {
|
|
65
|
-
return defineStore({
|
|
66
|
-
init: (): ChangesState => ({ byTab: {} }),
|
|
67
|
-
actions: {
|
|
68
|
-
/**
|
|
69
|
-
* Apply a navigation; the first one seeds the `branch` scope with the automatic fork point, every commit and file,
|
|
70
|
-
* test files shown, two columns, and wrapped lines.
|
|
71
|
-
* @param d - draft state.
|
|
72
|
-
* @param tabId - the tab being drawn.
|
|
73
|
-
* @param revision - the navigation revision being applied.
|
|
74
|
-
*/
|
|
75
|
-
navigated: (d, tabId: string, revision: number) => {
|
|
76
|
-
const tab = d.byTab[tabId]
|
|
77
|
-
if (tab === undefined) {
|
|
78
|
-
d.byTab[tabId] = { scope: 'branch', base: null, commits: null, lens: 'all', hideTests: false, split: true, wrap: true, navigated: revision }
|
|
79
|
-
} else tab.navigated = revision
|
|
80
|
-
},
|
|
81
|
-
/**
|
|
82
|
-
* Show another scope of local changes, with all of its commits.
|
|
83
|
-
* @param d - draft state.
|
|
84
|
-
* @param tabId - the tab being drawn.
|
|
85
|
-
* @param scope - the scope to show.
|
|
86
|
-
*/
|
|
87
|
-
scoped: (d, tabId: string, scope: ForgeLocalScope['kind']) => {
|
|
88
|
-
const tab = bucket(d, tabId)
|
|
89
|
-
tab.scope = scope
|
|
90
|
-
tab.commits = null
|
|
91
|
-
},
|
|
92
|
-
/**
|
|
93
|
-
* Compare the `branch` scope with another branch, showing all of its commits.
|
|
94
|
-
* @param d - draft state.
|
|
95
|
-
* @param tabId - the tab being drawn.
|
|
96
|
-
* @param base - the branch, or null for the automatic fork point.
|
|
97
|
-
*/
|
|
98
|
-
based: (d, tabId: string, base: ForgeBaseBranch | null) => {
|
|
99
|
-
const tab = bucket(d, tabId)
|
|
100
|
-
tab.base = base
|
|
101
|
-
tab.commits = null
|
|
102
|
-
},
|
|
103
|
-
/**
|
|
104
|
-
* Show consecutive commits instead of the whole change request or `branch` scope.
|
|
105
|
-
* @param d - draft state.
|
|
106
|
-
* @param tabId - the tab being drawn.
|
|
107
|
-
* @param commits - the commits, or null for all of them.
|
|
108
|
-
*/
|
|
109
|
-
committed: (d, tabId: string, commits: ForgeCommitRange | null) => { bucket(d, tabId).commits = commits },
|
|
110
|
-
/**
|
|
111
|
-
* Show the files of another review layer.
|
|
112
|
-
* @param d - draft state.
|
|
113
|
-
* @param tabId - the tab being drawn.
|
|
114
|
-
* @param lens - every file, or one layer.
|
|
115
|
-
*/
|
|
116
|
-
lensed: (d, tabId: string, lens: ChangesLens) => { bucket(d, tabId).lens = lens },
|
|
117
|
-
/**
|
|
118
|
-
* Hide or show the files of the `test` layer; hiding them leaves the `test` lens for every file.
|
|
119
|
-
* @param d - draft state.
|
|
120
|
-
* @param tabId - the tab being drawn.
|
|
121
|
-
*/
|
|
122
|
-
toggledTests: (d, tabId: string) => {
|
|
123
|
-
const tab = bucket(d, tabId)
|
|
124
|
-
tab.hideTests = !tab.hideTests
|
|
125
|
-
if (tab.hideTests && tab.lens === 'test') tab.lens = 'all'
|
|
126
|
-
},
|
|
127
|
-
/**
|
|
128
|
-
* Switch between one column and two.
|
|
129
|
-
* @param d - draft state.
|
|
130
|
-
* @param tabId - the tab being drawn.
|
|
131
|
-
*/
|
|
132
|
-
toggledSplit: (d, tabId: string) => {
|
|
133
|
-
const tab = bucket(d, tabId)
|
|
134
|
-
tab.split = !tab.split
|
|
135
|
-
},
|
|
136
|
-
/**
|
|
137
|
-
* Switch line wrapping.
|
|
138
|
-
* @param d - draft state.
|
|
139
|
-
* @param tabId - the tab being drawn.
|
|
140
|
-
*/
|
|
141
|
-
toggledWrap: (d, tabId: string) => {
|
|
142
|
-
const tab = bucket(d, tabId)
|
|
143
|
-
tab.wrap = !tab.wrap
|
|
144
|
-
},
|
|
145
|
-
/**
|
|
146
|
-
* Drop a tab's bucket once its record is gone.
|
|
147
|
-
* @param d - draft state.
|
|
148
|
-
* @param tabId - the tab that ended.
|
|
149
|
-
*/
|
|
150
|
-
forget: (d, tabId: string) => {
|
|
151
|
-
d.byTab = Object.fromEntries(Object.entries(d.byTab).filter(([id]) => id !== tabId))
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
})
|
|
166
|
+
return defineStore({ init: (): ChangesState => ({ byTab: {} }), actions: changesActions })
|
|
155
167
|
}
|
package/src/client/checkout.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'
|
|
4
4
|
import { abbreviateHomePath } from '@deepseek-ai/dsh-util-workspace-path'
|
|
5
|
+
import { branchLabel } from '../branch-name.ts'
|
|
5
6
|
import type { ForgePanelState } from '../types.ts'
|
|
6
7
|
import type { NS } from './locales.ts'
|
|
7
8
|
|
|
@@ -52,7 +53,7 @@ export function checkoutLabel(state: ForgePanelState, home: string | undefined,
|
|
|
52
53
|
const { root, branch, linked, commit } = state.checkout.checkout
|
|
53
54
|
const path = abbreviateHomePath(root, home)
|
|
54
55
|
if (created !== null && created.path === root) {
|
|
55
|
-
const base = created.from
|
|
56
|
+
const base = created.from === null ? created.baseCommit.slice(0, 7) : branchLabel(created.from)
|
|
56
57
|
return {
|
|
57
58
|
name: branch ?? commit,
|
|
58
59
|
detached: branch === null,
|