✨ feat(vscode): 审查列可以申请同事移交工单

This commit is contained in:
cruldra committed 2026-09-28 00:17:09 +08:00
1 parent 65583a001c
commit 6342f39de0
22 files changed
+450 -31

No files matched your search

+16
View File
@@ -102,6 +102,8 @@ function parseColumnFromComments(comments: GiteaComment[]): {
autoReview?: boolean
handoffAttachmentId?: string
handoffFrom?: string
handoffRequestFrom?: string
handoffRequestError?: string
} {
if (comments.length === 0)
return { column: null }
@@ -151,6 +153,8 @@ function parseColumnFromComments(comments: GiteaComment[]): {
autoReview?: unknown
handoffAttachmentId?: unknown
handoffFrom?: unknown
handoffRequestFrom?: unknown
handoffRequestError?: unknown
}
if (isIssueColumn(obj.column)) {
const sessionId = typeof obj.sessionId === 'string' && obj.sessionId.length > 0
@@ -212,6 +216,12 @@ function parseColumnFromComments(comments: GiteaComment[]): {
const handoffFrom = typeof obj.handoffFrom === 'string' && obj.handoffFrom.length > 0
? obj.handoffFrom
: undefined
const handoffRequestFrom = typeof obj.handoffRequestFrom === 'string' && obj.handoffRequestFrom.length > 0
? obj.handoffRequestFrom
: undefined
const handoffRequestError = typeof obj.handoffRequestError === 'string' && obj.handoffRequestError.length > 0
? obj.handoffRequestError
: undefined
return {
column: obj.column,
sessionId,
@@ -237,6 +247,8 @@ function parseColumnFromComments(comments: GiteaComment[]): {
autoReview,
handoffAttachmentId,
handoffFrom,
handoffRequestFrom,
handoffRequestError,
}
}
}
@@ -381,6 +393,8 @@ async function buildIssue(opts: {
autoReview,
handoffAttachmentId,
handoffFrom,
handoffRequestFrom,
handoffRequestError,
} = parseColumnFromComments(comments)
// 优先用 PR API 实时结果;失败时退回 state JSON 持久化值。
const prMerged = liveMerged !== undefined ? liveMerged : persistedMerged
@@ -449,6 +463,8 @@ async function buildIssue(opts: {
...(autoReview !== undefined ? { autoReview } : {}),
...(handoffAttachmentId ? { handoffAttachmentId } : {}),
...(handoffFrom ? { handoffFrom } : {}),
...(handoffRequestFrom ? { handoffRequestFrom } : {}),
...(handoffRequestError ? { handoffRequestError } : {}),
assignees: (issue.assignees ?? []).map(a => a.login),
...(issue.user?.login ? { poster: issue.user.login } : {}),
htmlUrl: issue.html_url,
+1 -1
View File
@@ -19,7 +19,7 @@ import { listIssueComments, postIssueComment } from './api'
* 普通文本评论、审查评论、Gitea 自动关联评论都不含这些字段,因此从尾往前
* 扫描时会被跳过,避免它们插队后下一次 merge 从空状态开始丢历史。
*/
const KNOWN_STATE_FIELDS = ['column', 'sessionId', 'implementSessionId', 'reviewSessionId', 'testSessionId', 'prototypeSessionId', 'profilePath', 'brainstormProfilePath', 'testProfilePath', 'prototypeProfilePath', 'specFile', 'planFile', 'prototypeFile', 'prDiffFile', 'pr', 'prMerged', 'prMergedAt', 'branch', 'worktreePath', 'implementStatus', 'color', 'autoReview', 'handoffAttachmentId', 'handoffFrom'] as const
const KNOWN_STATE_FIELDS = ['column', 'sessionId', 'implementSessionId', 'reviewSessionId', 'testSessionId', 'prototypeSessionId', 'profilePath', 'brainstormProfilePath', 'testProfilePath', 'prototypeProfilePath', 'specFile', 'planFile', 'prototypeFile', 'prDiffFile', 'pr', 'prMerged', 'prMergedAt', 'branch', 'worktreePath', 'implementStatus', 'color', 'autoReview', 'handoffAttachmentId', 'handoffFrom', 'handoffRequestFrom', 'handoffRequestError'] as const
/**
* body 能 parse 成 object 且含至少一个已知 state 字段 → 认为是 state JSON。
+4
View File
@@ -139,6 +139,10 @@ export interface Issue {
handoffAttachmentId?: string
/** 发起移交的 Gitea login。 */
handoffFrom?: string
/** 谁在申请把这个审查工单移交给自己。 */
handoffRequestFrom?: string
/** 同意移交失败的原因。对方拒绝时为 rejected。 */
handoffRequestError?: string
/** Whether the brainstorm terminal tab is currently alive in this VS Code window. */
brainstormTabOpen?: boolean
/** Whether the implementation terminal tab is currently alive in this VS Code window. */