mirror of
https://ghproxy.cflmy.top/https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-11-29 08:39:35 +08:00
The Code review page's detail shows Open on the code host, Copy link, and Refresh status as three icon buttons after the merge action; a narrow detail folds them into the More menu as before. The merge action also turns the code host's automatic merge on, shows that it is on with its cancellation, and names why the host would not merge. - forge-github: snapshots carry `autoMerge` from `viewerCanEnableAutoMerge`, `viewerCanDisableAutoMerge`, and `autoMergeRequest`; `setAutoMerge` sends `enablePullRequestAutoMerge` with the confirmed head or `disablePullRequestAutoMerge`. A base branch with a merge queue offers none. - forge-gitlab: snapshots carry `autoMerge` from `autoMergeEnabled` and the available strategies; `setAutoMerge` accepts with the strategy that waits for every merge check, or posts `cancel_auto_merge`. Merge trains offer none. - client-ui-forge (Host): `forgePanel.setAutoMerge` and `forgePanel.reviewSetAutoMerge`. - client-ui-forge (Client): the opening actions carry the mark of the provider's forge family and name the code host instead of the browser, on the review page, the Session panel card, the changes view, and review threads. While a change request, its description, or its activity is read, a skeleton of the same layout stands in. The comment field is three lines tall with a row that names the code host and a primary button. Where the header is tight, labels fold and the repository name is cut before the actions wrap.
115 lines
4.4 KiB
TypeScript
115 lines
4.4 KiB
TypeScript
import type { ChangeRequestRef, ForgeRepository } from '@deepseek-ai/dsh-experimental-forge'
|
|
|
|
/** Repository on github.com used across the provider tests. */
|
|
export const demo: ForgeRepository = { forge: 'github', host: 'github.com', owner: 'octo', name: 'demo' }
|
|
|
|
/** Build a pull request reference in `demo` or another repository. */
|
|
export function pull(number: number, repository: ForgeRepository = demo): ChangeRequestRef {
|
|
return { repository, number }
|
|
}
|
|
|
|
/** One CheckRun context node as GitHub returns it. */
|
|
export function checkRun(name: string, status: string, conclusion: string | null, workflow: string | null = 'ci'): Record<string, unknown> {
|
|
return {
|
|
__typename: 'CheckRun', id: 'check-1', databaseId: 1,
|
|
name,
|
|
status,
|
|
conclusion,
|
|
detailsUrl: `https://github.com/octo/demo/actions/runs/1/job/${name}`,
|
|
startedAt: status === 'QUEUED' ? null : '2026-10-09T01:00:00Z',
|
|
completedAt: status === 'COMPLETED' ? '2026-10-09T01:02:07Z' : null,
|
|
checkSuite: {
|
|
app: { id: 'github-actions' },
|
|
workflowRun: workflow === null ? null : { databaseId: 7, event: 'pull_request', workflow: { id: workflow, name: workflow } },
|
|
},
|
|
}
|
|
}
|
|
|
|
/** One StatusContext node as GitHub returns it. */
|
|
export function statusContext(context: string, state: string): Record<string, unknown> {
|
|
return { __typename: 'StatusContext', context, state, targetUrl: null, createdAt: '2026-10-09T01:00:00Z' }
|
|
}
|
|
|
|
/** Merge settings of a repository that allows squash and merge commits and whose viewer may merge, usually with a merge commit. */
|
|
export function repositorySettings(overrides: Record<string, unknown> = {}): Record<string, unknown> {
|
|
return {
|
|
squashMergeAllowed: true,
|
|
mergeCommitAllowed: true,
|
|
rebaseMergeAllowed: false,
|
|
viewerPermission: 'WRITE',
|
|
viewerDefaultMergeMethod: 'MERGE',
|
|
...overrides,
|
|
}
|
|
}
|
|
|
|
/** One pull request node as a brief query returns it. */
|
|
export function briefNode(number: number, overrides: Record<string, unknown> = {}): Record<string, unknown> {
|
|
return {
|
|
url: `https://github.com/octo/demo/pull/${number}`,
|
|
title: `Change ${number}`,
|
|
state: 'OPEN',
|
|
isDraft: false,
|
|
mergeable: 'MERGEABLE',
|
|
reviewDecision: null,
|
|
commits: { nodes: [{ commit: { statusCheckRollup: { state: 'SUCCESS' } } }] },
|
|
...overrides,
|
|
}
|
|
}
|
|
|
|
/** A pull request node with the fields the snapshot query selects. */
|
|
export function pullRequestNode(number: number, overrides: Record<string, unknown> = {}, contexts: unknown[] = [], rollupState: string | null = 'SUCCESS'): Record<string, unknown> {
|
|
return {
|
|
id: `pull-${number}`,
|
|
number,
|
|
url: `https://github.com/octo/demo/pull/${number}`,
|
|
title: `Change ${number}`,
|
|
state: 'OPEN',
|
|
isDraft: false,
|
|
updatedAt: '2026-10-09T01:02:03Z',
|
|
closedAt: null,
|
|
author: { login: 'octo' },
|
|
headRefName: `topic-${number}`,
|
|
headRefOid: 'f'.repeat(40),
|
|
baseRefName: 'master',
|
|
baseRefOid: 'b'.repeat(40),
|
|
additions: 128,
|
|
deletions: 14,
|
|
mergeable: 'MERGEABLE',
|
|
mergeStateStatus: 'CLEAN',
|
|
reviewDecision: null,
|
|
viewerCanUpdateBranch: false,
|
|
canBeRebased: false,
|
|
viewerCanEnableAutoMerge: false,
|
|
viewerCanDisableAutoMerge: false,
|
|
isMergeQueueEnabled: false,
|
|
autoMergeRequest: null,
|
|
reviewThreads: threadPage([true, false, false]),
|
|
reviewRequests: { totalCount: 0, nodes: [] },
|
|
latestReviews: { totalCount: 0, nodes: [] },
|
|
latestOpinionatedReviews: { totalCount: 0, nodes: [] },
|
|
closingIssuesReferences: { totalCount: 0, nodes: [] },
|
|
commits: {
|
|
nodes: [{
|
|
commit: {
|
|
statusCheckRollup: rollupState === null ? null : {
|
|
id: `rollup-${number}`, state: rollupState,
|
|
contexts: { pageInfo: { hasNextPage: false, endCursor: null }, nodes: contexts },
|
|
},
|
|
},
|
|
}],
|
|
},
|
|
...overrides,
|
|
}
|
|
}
|
|
|
|
/** A review thread connection page as GitHub returns it. */
|
|
export interface ThreadPage {
|
|
readonly pageInfo: { readonly hasNextPage: boolean; readonly endCursor: string | null }
|
|
readonly nodes: { readonly isResolved: boolean }[]
|
|
}
|
|
|
|
/** One review thread connection page with the threads' resolution, followed by the page after `next` when it is a cursor. */
|
|
export function threadPage(resolved: readonly boolean[], next: string | null = null): ThreadPage {
|
|
return { pageInfo: { hasNextPage: next !== null, endCursor: next }, nodes: resolved.map(isResolved => ({ isResolved })) }
|
|
}
|