@deepseek-ai/dsh-experimental-client-ui-forge 0.2.3-alpha.1 → 0.2.3-alpha.3
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 +8 -8
- package/README.md +29 -12
- package/README.zh.md +29 -12
- package/lib/client.js +21 -16
- package/lib/client.js.map +1 -1
- package/lib/index.js +874 -170
- package/lib/typert.host.js +831 -156
- package/lib/typert.remote-client.d.ts +29 -11
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +727 -134
- 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/AttentionIndicator.d.ts +1 -1
- package/lib/types/client/AttentionIndicator.d.ts.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 +21 -12
- 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 +12 -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/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 +15 -7
- 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 +3 -3
- package/lib/types/client/CommitMenu.d.ts.map +1 -1
- package/lib/types/client/CommitMenu.js.map +1 -1
- package/lib/types/client/DiffFile.d.ts +16 -2
- 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.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 +4 -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 +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 +18 -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 +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 +23 -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/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 +106 -9
- 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 +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 +23 -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 +15 -12
- 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 +5 -3
- 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 +18 -8
- 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 +1 -1
- package/lib/types/client/review-threads.d.ts.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 -0
- package/lib/types/client/status.d.ts.map +1 -1
- package/lib/types/client/status.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 +113 -25
- 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/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 +106 -8
- 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/package.json +60 -58
- package/src/client/ActionToast.tsx +2 -2
- package/src/client/AttentionIndicator.tsx +1 -1
- package/src/client/BaseMenu.module.css +12 -3
- package/src/client/BaseMenu.tsx +25 -88
- package/src/client/BranchPicker.tsx +161 -0
- package/src/client/ChangeRequestCard.tsx +138 -44
- package/src/client/ChangeRequestOverview.tsx +21 -9
- package/src/client/ChangeRequestsSection.tsx +12 -6
- package/src/client/ChangedFiles.tsx +2 -2
- package/src/client/ChangesLoading.tsx +1 -1
- package/src/client/ChangesTab.module.css +95 -16
- package/src/client/ChangesTab.tsx +190 -72
- package/src/client/ChangesTabTitle.tsx +2 -2
- package/src/client/CommitMenu.tsx +7 -5
- package/src/client/DiffFile.tsx +67 -11
- package/src/client/EnvironmentRows.tsx +21 -17
- package/src/client/FileLabel.tsx +1 -1
- package/src/client/Forge.module.css +28 -1
- package/src/client/HeadMenu.tsx +69 -0
- package/src/client/HostSettings.module.css +194 -0
- package/src/client/HostSettings.tsx +192 -0
- package/src/client/LensFilter.tsx +2 -2
- package/src/client/ReasonButton.tsx +1 -1
- package/src/client/RefreshGlyph.tsx +1 -1
- package/src/client/ReviewComposer.tsx +2 -2
- package/src/client/ReviewControls.tsx +10 -3
- package/src/client/ReviewThread.tsx +2 -2
- package/src/client/ReviewThreads.tsx +7 -4
- package/src/client/SessionHoverForge.tsx +2 -2
- package/src/client/SessionRowForge.tsx +2 -2
- package/src/client/SubmitReview.tsx +2 -2
- package/src/client/ThreadList.tsx +6 -3
- package/src/client/ViewOptionsMenu.tsx +2 -2
- package/src/client/WorktreeNameDialog.tsx +2 -2
- package/src/client/WorktreeProgress.tsx +2 -2
- package/src/client/WorktreeSettings.tsx +4 -11
- package/src/client/WorktreeToggle.tsx +2 -2
- 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 +49 -5
- 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 +50 -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/local-writes.ts +129 -0
- package/src/client/locales.ts +841 -65
- package/src/client/mount.ts +56 -7
- package/src/client/review-page/ReviewActivity.tsx +405 -0
- package/src/client/review-page/ReviewChat.tsx +2 -2
- package/src/client/review-page/ReviewDetail.tsx +201 -64
- package/src/client/review-page/ReviewLabels.tsx +2 -2
- package/src/client/review-page/ReviewList.tsx +153 -136
- package/src/client/review-page/ReviewNav.tsx +1 -1
- package/src/client/review-page/ReviewPage.module.css +490 -13
- package/src/client/review-page/ReviewPage.tsx +44 -21
- package/src/client/review-page/ReviewSkeleton.tsx +108 -0
- package/src/client/review-page/ReviewStatus.tsx +14 -9
- 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 +1 -1
- 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 -0
- 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 +241 -50
- package/src/local-diff.ts +151 -48
- package/src/local-write.ts +159 -0
- package/src/parse.ts +26 -4
- package/src/restore.ts +15 -0
- package/src/types.ts +97 -12
- package/src/viewer-lists.ts +124 -48
|
@@ -7,10 +7,12 @@ import type { Context } from '@deepseek-ai/cordis'
|
|
|
7
7
|
import type {} from '@deepseek-ai/dsh-api-remote-access/client'
|
|
8
8
|
import type {} from '@deepseek-ai/dsh-api-session-controller/client'
|
|
9
9
|
import type {} from '@deepseek-ai/dsh-api-workspace-controller/client'
|
|
10
|
+
import { createSnapshotStore } from '@deepseek-ai/dsh-client-store'
|
|
10
11
|
import type {} from '@deepseek-ai/dsh-client-ui-conversation/client'
|
|
12
|
+
import type {} from '@deepseek-ai/dsh-client-ui-plugin-manager/client'
|
|
11
13
|
import type {} from '@deepseek-ai/dsh-client-ui-workspace/client'
|
|
12
14
|
import type { MainPanelId } from '@deepseek-ai/dsh-client-ui-layout/client'
|
|
13
|
-
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots'
|
|
15
|
+
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
14
16
|
import type {} from '@deepseek-ai/dsh-client-ui-sidebar/client'
|
|
15
17
|
import type {} from '@deepseek-ai/dsh-experimental-client-ui-forge/remote'
|
|
16
18
|
import type { RemoteResult } from '@deepseek-ai/dsh-typert-protocol'
|
|
@@ -66,6 +68,8 @@ export interface ReviewPageDeps {
|
|
|
66
68
|
readonly quoteThread: ReviewPageInjected['quoteThread']
|
|
67
69
|
/** The UI language. */
|
|
68
70
|
readonly locale: HostObservable<string>
|
|
71
|
+
/** Package name of the bundle whose page on the Plugins page lists the provider rows with their host lists. */
|
|
72
|
+
readonly hostSettings: string
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
/**
|
|
@@ -82,7 +86,7 @@ export function registerReviewPage(ctx: Context, deps: ReviewPageDeps): void {
|
|
|
82
86
|
const actionsFor = (url: string, showChanges: () => void): ChangeRequestActions => ({
|
|
83
87
|
openLink,
|
|
84
88
|
copyLink: copyText,
|
|
85
|
-
retry: () => {
|
|
89
|
+
retry: async () => { settled(await remote.reviewPoll(url), 'toast.refreshFailed') },
|
|
86
90
|
markReady: async (entry) => {
|
|
87
91
|
reportAction(entry, await remote.reviewMarkReady(url), { done: 'toast.markedReady', failed: 'toast.markReadyFailed' })
|
|
88
92
|
},
|
|
@@ -90,6 +94,10 @@ export function registerReviewPage(ctx: Context, deps: ReviewPageDeps): void {
|
|
|
90
94
|
reportAction(entry, await remote.reviewMerge(url, request.method, request.headSha),
|
|
91
95
|
{ done: 'toast.merged', stale: 'toast.mergeStale', failed: 'toast.mergeFailed' })
|
|
92
96
|
},
|
|
97
|
+
autoMerge: async (entry, request) => {
|
|
98
|
+
reportAction(entry, await remote.reviewSetAutoMerge(url, request),
|
|
99
|
+
{ done: request.enabled ? 'toast.autoMergeEnabled' : 'toast.autoMergeCancelled', stale: 'toast.autoMergeStale', failed: 'toast.autoMergeFailed' })
|
|
100
|
+
},
|
|
93
101
|
readChecks: async (_url, headSha, signal) => {
|
|
94
102
|
const result = await remote.reviewChecks(url, headSha, signal)
|
|
95
103
|
if (!result.ok) throw new Error(result.error.message)
|
|
@@ -119,6 +127,7 @@ export function registerReviewPage(ctx: Context, deps: ReviewPageDeps): void {
|
|
|
119
127
|
const queues = new WeakMap<AbortSignal, ReviewQueue>()
|
|
120
128
|
const changes: ReviewChangesFace = {
|
|
121
129
|
localDiff: async () => await Promise.reject(new Error('forge-panel: the review page shows no local changes')),
|
|
130
|
+
localWrite: async () => await Promise.reject(new Error('forge-panel: the review page shows no local changes')),
|
|
122
131
|
diffBases: async () => await Promise.reject(new Error('forge-panel: the review page shows no local changes')),
|
|
123
132
|
localText: async () => await Promise.reject(new Error('forge-panel: the review page shows no local changes')),
|
|
124
133
|
localCommits: async () => await Promise.reject(new Error('forge-panel: the review page shows no local changes')),
|
|
@@ -183,6 +192,14 @@ export function registerReviewPage(ctx: Context, deps: ReviewPageDeps): void {
|
|
|
183
192
|
void remote.requestWorktree(sessionId, null, null).then(result => settled(result, 'toast.worktreeFailed'))
|
|
184
193
|
},
|
|
185
194
|
}
|
|
195
|
+
// The Plugins page provides its navigation only while the current Peer may use it.
|
|
196
|
+
const pluginNavigation = createSnapshotStore(false)
|
|
197
|
+
ctx.inject(['pluginNavigation'], (scope: Context) => {
|
|
198
|
+
scope.effect(() => {
|
|
199
|
+
pluginNavigation.set(true)
|
|
200
|
+
return () => { pluginNavigation.set(false) }
|
|
201
|
+
}, 'forge-panel: plugin navigation presence')
|
|
202
|
+
})
|
|
186
203
|
const count = createStreamSource<ForgeReviewCountFrame, number | null>({
|
|
187
204
|
open: signal => remote.reviewCount(signal),
|
|
188
205
|
subscribeReset,
|
|
@@ -196,15 +213,15 @@ export function registerReviewPage(ctx: Context, deps: ReviewPageDeps): void {
|
|
|
196
213
|
locale: NS,
|
|
197
214
|
store: createReviewStore(),
|
|
198
215
|
inject: (): ReviewPageInjected => ({
|
|
199
|
-
hooks: { locale: deps.locale },
|
|
200
|
-
openLists: (
|
|
201
|
-
const slash = scope.indexOf('/')
|
|
202
|
-
return remote.reviewLists(slash < 0 ? null : { owner: scope.slice(0, slash), name: scope.slice(slash + 1) }, signal)
|
|
203
|
-
},
|
|
216
|
+
hooks: { locale: deps.locale, pluginNavigation },
|
|
217
|
+
openLists: (repository, signal) => remote.reviewLists(repository, signal),
|
|
204
218
|
openChangeRequest: (url, signal) => remote.reviewChangeRequest(url, signal),
|
|
205
219
|
subscribeReset,
|
|
206
220
|
refresh: async () => { settled(await remote.reviewRefresh(), 'toast.refreshFailed') },
|
|
207
221
|
readDescription: (url, signal) => remote.reviewDescription(url, signal),
|
|
222
|
+
readActivity: (url, signal) => remote.reviewActivity(url, signal),
|
|
223
|
+
addComment: (url, body) => remote.reviewComment(url, body),
|
|
224
|
+
openHostSettings: () => { ctx.get('pluginNavigation')?.openBundle(deps.hostSettings) },
|
|
208
225
|
actionsFor,
|
|
209
226
|
changes,
|
|
210
227
|
copyText,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Choices of the review page that outlive its mount: the change request shown in full, its tab, whether the list column
|
|
3
|
-
* hides, which list sections fold, the repository the lists are
|
|
3
|
+
* hides, which list sections fold, the host or repository the lists are narrowed to, the search text, the conversation the page
|
|
4
4
|
* started for each change request, and the changes view's choices for each change request.
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ import { defineStore, type EngineStoreHandle } from '@deepseek-ai/dsh-client-sto
|
|
|
8
8
|
import type { ForgeViewerFilter } from '@deepseek-ai/dsh-experimental-forge/types'
|
|
9
9
|
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
|
10
10
|
import { changesActions, type ChangesState } from '../changes-store.ts'
|
|
11
|
-
import { mergeRepositories, type ReviewRepository } from './review-lists.ts'
|
|
11
|
+
import { mergeRepositories, type ReviewRepository, type ReviewScope } from './review-lists.ts'
|
|
12
12
|
|
|
13
13
|
/** A tab of the review page's detail. */
|
|
14
14
|
export type ReviewTab = 'summary' | 'changes' | 'chat'
|
|
@@ -16,6 +16,15 @@ export type ReviewTab = 'summary' | 'changes' | 'chat'
|
|
|
16
16
|
/** How the list column shows its items: two lines each, or one line each with the rest in a hover card. */
|
|
17
17
|
export type ReviewView = 'detailed' | 'compact'
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Name the changes view of a change request in the store's `byTab`.
|
|
21
|
+
* @param url - web URL of the change request.
|
|
22
|
+
* @returns the tab id the view keeps its choices under.
|
|
23
|
+
*/
|
|
24
|
+
export function changesTabOf(url: string): string {
|
|
25
|
+
return `review:${url}`
|
|
26
|
+
}
|
|
27
|
+
|
|
19
28
|
/** The review page's choices, and those of its changes view by change request URL. */
|
|
20
29
|
export interface ReviewPageState extends ChangesState {
|
|
21
30
|
/** Web URL of the change request shown in full, or null. */
|
|
@@ -26,8 +35,8 @@ export interface ReviewPageState extends ChangesState {
|
|
|
26
35
|
listHidden: boolean
|
|
27
36
|
/** List sections the reader folded. */
|
|
28
37
|
folded: Partial<Record<ForgeViewerFilter, boolean>>
|
|
29
|
-
/**
|
|
30
|
-
|
|
38
|
+
/** What the lists are narrowed to: one host, one repository, or null for every repository of every host. */
|
|
39
|
+
scope: ReviewScope | null
|
|
31
40
|
/**
|
|
32
41
|
* Repositories the lists named while they were read in every repository, which the repository menu keeps offering
|
|
33
42
|
* while the lists are read in one.
|
|
@@ -55,6 +64,14 @@ const reviewActions = {
|
|
|
55
64
|
state.tab = tab
|
|
56
65
|
if (tab === 'chat' && state.selected !== null) state.unseenQuotes[state.selected] = 0
|
|
57
66
|
},
|
|
67
|
+
/**
|
|
68
|
+
* Show the changes tab with one commit chosen in the changes view of a change request, which keeps its choices from
|
|
69
|
+
* the time the detail first shows.
|
|
70
|
+
*/
|
|
71
|
+
openedCommit: (state: ReviewPageState, url: string, sha: string) => {
|
|
72
|
+
changesActions.committed(state, changesTabOf(url), { from: sha, to: sha })
|
|
73
|
+
state.tab = 'changes'
|
|
74
|
+
},
|
|
58
75
|
viewed: (state: ReviewPageState, view: ReviewView) => { state.view = view },
|
|
59
76
|
quoted: (state: ReviewPageState, url: string) => {
|
|
60
77
|
if (state.selected === url && state.tab === 'chat') return
|
|
@@ -62,14 +79,14 @@ const reviewActions = {
|
|
|
62
79
|
},
|
|
63
80
|
toggledList: (state: ReviewPageState) => { state.listHidden = !state.listHidden },
|
|
64
81
|
folded: (state: ReviewPageState, filter: ForgeViewerFilter) => { state.folded[filter] = state.folded[filter] !== true },
|
|
65
|
-
scopedTo: (state: ReviewPageState,
|
|
82
|
+
scopedTo: (state: ReviewPageState, scope: ReviewScope | null) => { state.scope = scope },
|
|
66
83
|
/**
|
|
67
84
|
* Record the repositories the lists read in every repository name: a complete read replaces the record, and a read
|
|
68
85
|
* still under way or failed in part adds to it.
|
|
69
86
|
*/
|
|
70
87
|
listed: (state: ReviewPageState, repositories: ReviewPageState['repositories'], complete: boolean) => {
|
|
71
88
|
const next = complete ? mergeRepositories(repositories) : mergeRepositories(state.repositories, repositories)
|
|
72
|
-
const names = (list: ReviewPageState['repositories']): string => list.map(item => `${item.owner}/${item.name}`).join('\n')
|
|
89
|
+
const names = (list: ReviewPageState['repositories']): string => list.map(item => `${item.host} ${item.owner}/${item.name}`).join('\n')
|
|
73
90
|
if (names(next) !== names(state.repositories)) state.repositories = [...next]
|
|
74
91
|
},
|
|
75
92
|
searched: (state: ReviewPageState, query: string) => { state.query = query },
|
|
@@ -87,7 +104,7 @@ const reviewActions = {
|
|
|
87
104
|
export function createReviewStore(): EngineStoreHandle<ReviewPageState, typeof reviewActions> {
|
|
88
105
|
return defineStore({
|
|
89
106
|
init: (): ReviewPageState => ({
|
|
90
|
-
selected: null, tab: 'summary', listHidden: false, folded: {},
|
|
107
|
+
selected: null, tab: 'summary', listHidden: false, folded: {}, scope: null, repositories: [], query: '', directOnly: false, conversations: {}, view: 'detailed', unseenQuotes: {}, byTab: {},
|
|
91
108
|
}),
|
|
92
109
|
actions: reviewActions,
|
|
93
110
|
})
|
|
@@ -14,7 +14,10 @@ const selection = z.object({
|
|
|
14
14
|
})
|
|
15
15
|
const recordedSelection = selection.extend({ source: z.discriminatedUnion('kind', [
|
|
16
16
|
selection.shape.source,
|
|
17
|
-
z.object({
|
|
17
|
+
z.object({
|
|
18
|
+
kind: z.literal('local'), scope: z.string(), base: z.string().nullable().default(null), baseRef: z.string().nullable().default(null), commits,
|
|
19
|
+
head: z.object({ key: z.string(), name: z.string(), root: z.string().nullable() }).exactOptional(),
|
|
20
|
+
}),
|
|
18
21
|
]) })
|
|
19
22
|
const record = z.discriminatedUnion('kind', [
|
|
20
23
|
z.object({ kind: z.literal('agent'), selection: recordedSelection }),
|
|
@@ -277,10 +280,11 @@ export class ReviewQueue {
|
|
|
277
280
|
* Compare review identity while allowing records from an older PR head to remain visible.
|
|
278
281
|
* @param left - recorded source.
|
|
279
282
|
* @param right - displayed source.
|
|
280
|
-
* @returns whether the sources name the same PR, or the same local scope and base ref, with the same chosen commits.
|
|
283
|
+
* @returns whether the sources name the same PR, or the same local head, scope and base ref, with the same chosen commits.
|
|
281
284
|
*/
|
|
282
285
|
export function sameReviewSource(left: ReviewSource, right: ReviewSource): boolean {
|
|
283
286
|
if (left.commits?.from !== right.commits?.from || left.commits?.to !== right.commits?.to) return false
|
|
284
|
-
return left.kind === 'local'
|
|
287
|
+
return left.kind === 'local'
|
|
288
|
+
? right.kind === 'local' && left.scope === right.scope && left.baseRef === right.baseRef && left.head?.key === right.head?.key
|
|
285
289
|
: right.kind === 'change' && left.url === right.url
|
|
286
290
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* each filter of the thread list keeps, and the composer quote of a whole thread.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { QuoteSummary } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
6
|
+
import type { QuoteSummary } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
7
7
|
import type { ForgeAnchor, ForgeReviewThread } from '@deepseek-ai/dsh-experimental-forge/types'
|
|
8
8
|
import { assertNever } from '@deepseek-ai/dsh-util-values'
|
|
9
9
|
import type { ForgeCommitRange, ForgeDiffFile, ForgeDiffHunk } from '../types.ts'
|
package/src/client/review.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Frozen line selections shared by the diff UI, composer references, and review submission. */
|
|
2
2
|
|
|
3
|
-
import type { QuoteSummary } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
3
|
+
import type { QuoteSummary } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
4
4
|
import type { ForgeCommitRange, ForgeDiffFile } from '../types.ts'
|
|
5
5
|
import type { ForgePanelKey } from './locales.ts'
|
|
6
6
|
|
|
@@ -28,6 +28,7 @@ export type ReviewSource =
|
|
|
28
28
|
/**
|
|
29
29
|
* Local changes in a scope. `base` names what the `branch` scope compared with for the reader, and is null for
|
|
30
30
|
* other scopes; `baseRef` identifies the comparison: the chosen ref, or null for the automatic fork point and other scopes.
|
|
31
|
+
* `head` is absent for the Session's own checkout.
|
|
31
32
|
*/
|
|
32
33
|
| {
|
|
33
34
|
readonly kind: 'local'
|
|
@@ -35,6 +36,7 @@ export type ReviewSource =
|
|
|
35
36
|
readonly base: string | null
|
|
36
37
|
readonly baseRef: string | null
|
|
37
38
|
readonly commits: ForgeCommitRange | null
|
|
39
|
+
readonly head?: ReviewHead
|
|
38
40
|
}
|
|
39
41
|
/** A change request; `headSha` is the commit the shown changes end at: the head, or the last chosen commit. */
|
|
40
42
|
| { readonly kind: 'change'; readonly url: string; readonly headSha: string; readonly commits: ForgeCommitRange | null }
|
|
@@ -45,6 +47,16 @@ export interface ReviewSelection {
|
|
|
45
47
|
readonly comment: ReviewComment
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
/** The branch local changes showed in place of the Session's checked-out one when a comment was written. */
|
|
51
|
+
export interface ReviewHead {
|
|
52
|
+
/** Identity of the head among the heads of one Session: the branch's full ref name. */
|
|
53
|
+
readonly key: string
|
|
54
|
+
/** Branch name without its ref prefix. */
|
|
55
|
+
readonly name: string
|
|
56
|
+
/** Top-level directory of the worktree the changes were read in, or null for a branch read from its commits. */
|
|
57
|
+
readonly root: string | null
|
|
58
|
+
}
|
|
59
|
+
|
|
48
60
|
/**
|
|
49
61
|
* Capture a range only when both endpoints belong to the same displayed hunk.
|
|
50
62
|
* @param file - loaded diff file.
|
|
@@ -103,10 +115,16 @@ export function formatReviewComment(selection: ReviewSelection, index: number):
|
|
|
103
115
|
const commits = source.commits === null ? ''
|
|
104
116
|
: `\nCommits: ${source.commits.from === source.commits.to ? source.commits.from : `${source.commits.from}^..${source.commits.to}`}`
|
|
105
117
|
const origin = source.kind === 'change' ? `Source: ${source.url}\nCommit: ${source.headSha}${commits}`
|
|
106
|
-
: `Source: Local (${source.scope})${source.base === null ? '' : `\nBase: ${source.base}`}${commits}`
|
|
118
|
+
: `Source: Local (${source.scope})${headLines(source.head)}${source.base === null ? '' : `\nBase: ${source.base}`}${commits}`
|
|
107
119
|
return `## User Comment ${index}\nFile: ${comment.path}\nSide: ${comment.side}\nLines: ${range}\n${origin}\nDiff hunk:\n${fence}diff\n${comment.hunk}\n${fence}\nComment:\n${comment.body}`
|
|
108
120
|
}
|
|
109
121
|
|
|
122
|
+
/** The lines that say whose code a local comment quotes when it is not the Session's own checkout. */
|
|
123
|
+
function headLines(head: ReviewHead | undefined): string {
|
|
124
|
+
if (head === undefined) return ''
|
|
125
|
+
return head.root === null ? `\nBranch: ${head.name} (committed content)` : `\nWorktree: ${head.root}\nBranch: ${head.name}`
|
|
126
|
+
}
|
|
127
|
+
|
|
110
128
|
/**
|
|
111
129
|
* Check whether the current diff still contains the captured range and hunk.
|
|
112
130
|
* @param selection - saved comment source and patch.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Copy of the Plugins form that the row pages of the Forge bundle share. */
|
|
2
|
+
import type { SettingsFormLabels } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
3
|
+
import type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
4
|
+
import type { ForgePanelKey, NS } from './locales.ts'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Build the form copy of one row page.
|
|
8
|
+
* @param t - forge panel copy.
|
|
9
|
+
* @param unavailable - key of the text shown while the Host does not serve the row's form.
|
|
10
|
+
* @returns the labels of the shared settings form.
|
|
11
|
+
*/
|
|
12
|
+
export function rowFormLabels(t: PropsLocale<typeof NS>['t'], unavailable: ForgePanelKey): SettingsFormLabels {
|
|
13
|
+
return {
|
|
14
|
+
unavailable: t(unavailable), readOnly: t('settings.readOnly'), saveFailed: t('settings.saveFailed'),
|
|
15
|
+
save: t('settings.save'), saving: t('settings.saving'),
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** The forge facts a Session row shows, from the Session list and the change request states every row shares. */
|
|
2
2
|
|
|
3
3
|
import { useMemo } from 'react'
|
|
4
|
-
import type { HostObservable, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots'
|
|
4
|
+
import type { HostObservable, SnapshotSelectorHook } from '@deepseek-ai/dsh-client-ui-slots/client'
|
|
5
5
|
import type { UseSessions } from '@deepseek-ai/dsh-client-ui-session/client'
|
|
6
6
|
import type {} from '@deepseek-ai/dsh-experimental-forge-session/types'
|
|
7
7
|
import type { SessionId } from '@deepseek-ai/dsh-session/types'
|
package/src/client/slots.ts
CHANGED
|
@@ -74,7 +74,7 @@ export interface ForgeReviewConversationProps {
|
|
|
74
74
|
readonly onWorkspaceSelected: WorkspaceSelectedHandler
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
77
|
+
declare module '@deepseek-ai/dsh-client-ui-slots/client' {
|
|
78
78
|
interface SlotMap {
|
|
79
79
|
/** The review page's conversation about one change request, in the Session its chat tab shows. */
|
|
80
80
|
'forge.review.conversation': { kind: 'single'; scope: 'session'; owner: ForgeReviewConversationProps }
|
package/src/client/source.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* of the Session list) and the store behind action notices.
|
|
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 { ForgeChangeRequestListState, ForgeChangeRequestStatesFrame, ForgePanelState } from '../types.ts'
|
|
8
8
|
import type { ForgePanelKey } from './locales.ts'
|
|
9
9
|
|
package/src/client/status.ts
CHANGED
|
@@ -181,3 +181,23 @@ export function checkDuration(check: ChangeRequestCheck): number | undefined {
|
|
|
181
181
|
const elapsed = Date.parse(check.completedAt) - Date.parse(check.startedAt)
|
|
182
182
|
return Number.isFinite(elapsed) && elapsed >= 0 ? elapsed : undefined
|
|
183
183
|
}
|
|
184
|
+
|
|
185
|
+
/** What stands between an open change request and its merge, in the order a reader resolves them. */
|
|
186
|
+
const BLOCKERS: readonly { readonly key: ForgePanelKey; readonly applies: (snapshot: ChangeRequestSnapshot) => boolean }[] = [
|
|
187
|
+
{ key: 'change.blocked.conflict', applies: snapshot => snapshot.mergeability === 'conflicting' },
|
|
188
|
+
{ key: 'change.blocked.changesRequested', applies: snapshot => snapshot.reviewDecision === 'changes-requested' },
|
|
189
|
+
{ key: 'change.blocked.reviewRequired', applies: snapshot => snapshot.reviewDecision === 'review-required' },
|
|
190
|
+
{ key: 'change.blocked.checksFailed', applies: snapshot => snapshot.checksRollup === 'failure' },
|
|
191
|
+
{ key: 'change.blocked.checksPending', applies: snapshot => snapshot.checksRollup === 'pending' },
|
|
192
|
+
]
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Name why the code host would not merge an open change request now, from what its snapshot reports.
|
|
196
|
+
* @param snapshot - the change request's latest snapshot.
|
|
197
|
+
* @returns the dictionary key of each reason the snapshot shows, or of the general one when it shows none, as for a
|
|
198
|
+
* user without the right to merge.
|
|
199
|
+
*/
|
|
200
|
+
export function mergeBlockers(snapshot: ChangeRequestSnapshot): readonly ForgePanelKey[] {
|
|
201
|
+
const found = BLOCKERS.filter(blocker => blocker.applies(snapshot)).map(blocker => blocker.key)
|
|
202
|
+
return found.length > 0 ? found : ['change.blocked.other']
|
|
203
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Staged worktree row settings using the shared Plugins form model. */
|
|
2
2
|
import { SettingsFormModel, type SettingsFieldState, type SettingsFormActions, type SettingsFormScope,
|
|
3
|
-
type SettingsFormShell } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
3
|
+
type SettingsFormShell } from '@deepseek-ai/dsh-client-ui-primitives/client'
|
|
4
4
|
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store'
|
|
5
5
|
|
|
6
6
|
/** The volatile fields of the worktree service's Config. */
|
package/src/diff.ts
CHANGED
|
@@ -16,6 +16,9 @@ const BINARY_PROBE_BYTES = 8000
|
|
|
16
16
|
/** Blob names of both sides on a Git `index` header line, which identify a binary change that carries no hunks. */
|
|
17
17
|
const INDEX_LINE = /^index ([0-9a-f]+\.\.[0-9a-f]+)/m
|
|
18
18
|
|
|
19
|
+
/** A header line that carries the file mode of a submodule entry: the `index` line of a change, or a creation or deletion. */
|
|
20
|
+
const SUBMODULE_LINE = /^(?:index [0-9a-f]+\.\.[0-9a-f]+ 160000|(?:new|deleted) file mode 160000)$/m
|
|
21
|
+
|
|
19
22
|
/**
|
|
20
23
|
* Parse a Git-style unified patch, as `git diff` or a code host prints it,
|
|
21
24
|
* with `a/` and `b/` path prefixes. Hunk ranges follow jsdiff: a range that
|
|
@@ -48,13 +51,13 @@ export function parseDiff(patch: string): ParsedDiffFile[] {
|
|
|
48
51
|
const hunks = section.hunks.map(({ oldStart, oldLines, newStart, newLines, lines }) => (
|
|
49
52
|
{ oldStart, oldLines, newStart, newLines, lines }))
|
|
50
53
|
// Each header matches its parsed section only when every section starts with a Git header.
|
|
51
|
-
const header =
|
|
52
|
-
const blobs = INDEX_LINE.exec(header)?.[1] ?? ''
|
|
54
|
+
const header = headers.length === parsed.length ? String(headers[index]) : ''
|
|
55
|
+
const blobs = binary ? INDEX_LINE.exec(header)?.[1] ?? '' : ''
|
|
53
56
|
// A mode change, such as `chmod +x`, shows only in the `old mode` and `new mode` header lines.
|
|
54
57
|
const modes = `${section.oldMode ?? ''}..${section.newMode ?? ''}`
|
|
55
58
|
return [{
|
|
56
|
-
path, previousPath, status, binary, oversized: false, untracked: false, additions, deletions,
|
|
57
|
-
digest: changeDigest(path, previousPath, status, hunks, blobs, modes),
|
|
59
|
+
path, previousPath, status, binary, oversized: false, untracked: false, submodule: SUBMODULE_LINE.test(header), additions, deletions,
|
|
60
|
+
hunks, digest: changeDigest(path, previousPath, status, hunks, blobs, modes),
|
|
58
61
|
}]
|
|
59
62
|
})
|
|
60
63
|
}
|
|
@@ -104,7 +107,7 @@ function addedFile(path: string, hunks: readonly ForgeDiffHunk[], { binary, over
|
|
|
104
107
|
readonly content: string
|
|
105
108
|
}): ParsedDiffFile {
|
|
106
109
|
return {
|
|
107
|
-
path, previousPath: null, status: 'added', binary, oversized, untracked: true,
|
|
110
|
+
path, previousPath: null, status: 'added', binary, oversized, untracked: true, submodule: false,
|
|
108
111
|
additions: hunks[0]?.newLines ?? 0, deletions: 0, hunks, digest: changeDigest(path, null, 'added', hunks, content, ''),
|
|
109
112
|
}
|
|
110
113
|
}
|
package/src/git.ts
CHANGED
|
@@ -56,6 +56,20 @@ export class GitOutputTooLarge extends Error {
|
|
|
56
56
|
override name = 'GitOutputTooLarge'
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
/** Thrown when a Git command ends with an exit code its caller does not allow, or by a signal. */
|
|
60
|
+
export class GitFailed extends Error {
|
|
61
|
+
override name = 'GitFailed'
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @param command - the caller's name of the command.
|
|
65
|
+
* @param outcome - the exit code, or the signal that ended the process.
|
|
66
|
+
* @param diagnostic - first non-blank line Git printed on standard error, or `no diagnostic`.
|
|
67
|
+
*/
|
|
68
|
+
constructor(command: string, outcome: number | string | null, readonly diagnostic: string) {
|
|
69
|
+
super(`git ${command} failed (${String(outcome)}): ${diagnostic}`)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
59
73
|
/**
|
|
60
74
|
* Clear inherited repository, configuration, and replacement-ref selectors;
|
|
61
75
|
* disable prompts, optional index writes, and lazy fetches of missing objects.
|
|
@@ -189,6 +203,22 @@ export function gitIn(ctx: Context, config: GitConfig, session: Session, directo
|
|
|
189
203
|
runGit(ctx, config, policy, directory, name, args, signal, allowedExitCodes, configOverrides)
|
|
190
204
|
}
|
|
191
205
|
|
|
206
|
+
/**
|
|
207
|
+
* Bind a Git runner that no Session's sandbox policy confines, for a write a person asked for in the interface: the
|
|
208
|
+
* press is that person's authorization, as archiving is for the worktree service's removal of a checkout. Commands
|
|
209
|
+
* keep the mounted subprocess provider, the scrubbed environment, the fixed command prefix, and `config`'s limits.
|
|
210
|
+
* @param ctx - context that provides `subprocess`.
|
|
211
|
+
* @param config - executable and process limits.
|
|
212
|
+
* @param directory - working directory of every command.
|
|
213
|
+
* @param signal - cancellation of every command.
|
|
214
|
+
* @returns the runner.
|
|
215
|
+
*/
|
|
216
|
+
export function gitUnconfined(ctx: Context, config: GitConfig, directory: string, signal: AbortSignal): Git {
|
|
217
|
+
const policy: SandboxExecutionPolicy = { mode: 'danger-full-access', workspaceRoot: directory }
|
|
218
|
+
return (name, args, allowedExitCodes = [0], configOverrides = {}) =>
|
|
219
|
+
runGit(ctx, config, policy, directory, name, args, signal, allowedExitCodes, configOverrides)
|
|
220
|
+
}
|
|
221
|
+
|
|
192
222
|
/**
|
|
193
223
|
* Read the checked-out local branch, including an unborn one; null when HEAD is detached or names a ref outside
|
|
194
224
|
* `refs/heads/`. The full ref is read because the short form turns `main` into `heads/main` while a tag shares the name.
|
|
@@ -255,7 +285,7 @@ async function runGit(
|
|
|
255
285
|
const stdout = captured.stdout.readFrom(0)
|
|
256
286
|
const stderr = captured.stderr.readFrom(0)
|
|
257
287
|
if (outcome.exitCode === null || !allowedExitCodes.includes(outcome.exitCode)) {
|
|
258
|
-
throw new
|
|
288
|
+
throw new GitFailed(name, outcome.signal ?? outcome.exitCode, firstLine(stderr.text))
|
|
259
289
|
}
|
|
260
290
|
if (stdout.lossy) throw new GitOutputTooLarge(`git ${name} output exceeds maxOutputBytes`)
|
|
261
291
|
return { stdout: stdout.text, stderr: stderr.text, exitCode: outcome.exitCode }
|