✨ feat(vscode): 审查通过写入工单状态并在卡片上区分

This commit is contained in:
cruldra committed 2026-10-03 03:22:20 +08:00
1 parent ac1b7ed641
commit 177e75910e
21 files changed
+203 -10

No files matched your search

+5
View File
@@ -10,6 +10,11 @@ describe('systemCommentText', () => {
expect(systemCommentText('{"column":"review","color":"terminal.ansiBlue"}')).toBe('更新了工单状态,放到审查')
})
it('审查是否通过不单写一句', () => {
expect(systemCommentText('{"reviewPassed":true}')).toBe('更新了工单状态')
expect(systemCommentText('{"column":"review","reviewPassed":false}')).toBe('更新了工单状态,放到审查')
})
it('普通评论不是系统消息', () => {
expect(systemCommentText('这个方案可以')).toBeUndefined()
})
+1
View File
@@ -23,6 +23,7 @@ const STATE_KEYS = new Set([
'worktreePath',
'color',
'autoReview',
'reviewPassed',
])
/** 插件自己写的评论。返回系统气泡文案;普通讨论返回 undefined。 */
+6
View File
@@ -99,6 +99,7 @@ function parseColumnFromComments(comments: GiteaComment[]): {
prototypeSessionId?: string
color?: string
autoReview?: boolean
reviewPassed?: boolean
handoffAttachmentId?: string
handoffFrom?: string
handoffRequestFrom?: string
@@ -150,6 +151,7 @@ function parseColumnFromComments(comments: GiteaComment[]): {
prototypeSessionId?: unknown
color?: unknown
autoReview?: unknown
reviewPassed?: unknown
handoffAttachmentId?: unknown
handoffFrom?: unknown
handoffRequestFrom?: unknown
@@ -209,6 +211,7 @@ function parseColumnFromComments(comments: GiteaComment[]): {
? obj.color
: undefined
const autoReview = typeof obj.autoReview === 'boolean' ? obj.autoReview : undefined
const reviewPassed = typeof obj.reviewPassed === 'boolean' ? obj.reviewPassed : undefined
const handoffAttachmentId = typeof obj.handoffAttachmentId === 'string' && obj.handoffAttachmentId.length > 0
? obj.handoffAttachmentId
: undefined
@@ -244,6 +247,7 @@ function parseColumnFromComments(comments: GiteaComment[]): {
prototypeSessionId,
color,
autoReview,
reviewPassed,
handoffAttachmentId,
handoffFrom,
handoffRequestFrom,
@@ -390,6 +394,7 @@ async function buildIssue(opts: {
prototypeSessionId,
color,
autoReview,
reviewPassed,
handoffAttachmentId,
handoffFrom,
handoffRequestFrom,
@@ -450,6 +455,7 @@ async function buildIssue(opts: {
...(prerequisite !== undefined ? { prerequisite } : {}),
...(color ? { color } : {}),
...(autoReview !== undefined ? { autoReview } : {}),
...(reviewPassed !== undefined ? { reviewPassed } : {}),
...(handoffAttachmentId ? { handoffAttachmentId } : {}),
...(handoffFrom ? { handoffFrom } : {}),
...(handoffRequestFrom ? { handoffRequestFrom } : {}),
+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', 'handoffRequestFrom', 'handoffRequestError'] 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', 'reviewPassed', 'handoffAttachmentId', 'handoffFrom', 'handoffRequestFrom', 'handoffRequestError'] as const
/**
* body 能 parse 成 object 且含至少一个已知 state 字段 → 认为是 state JSON。
+2
View File
@@ -131,6 +131,8 @@ export interface Issue {
* in the issue's state-JSON comment so it survives reloads.
*/
autoReview?: boolean
/** 最近一次审查是否通过。只影响审查列卡片上的小字,不改列。 */
reviewPassed?: boolean
/** Gitea assignee login 列表;接管按钮只对 assignee 含当前登录者的工单显示。 */
assignees?: string[]
/** Gitea 工单创建者 login;无 assignee 的工单靠它判定归属与卡片头像。 */