dsh-vscode-mode 0.38.0 → 0.40.0
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.md +38 -33
- package/lib/client.js +87 -68
- package/lib/client.js.map +1 -1
- package/lib/index.js +11406 -4920
- package/lib/index.js.map +1 -1
- package/package.json +3 -2
- package/skills/dsh-vscodemode-html-plan/SKILL.md +44 -42
- package/skills/dsh-vscodemode-test-check/SKILL.md +82 -0
- package/src/archiveDb.ts +24 -0
- package/src/attachmentBytes.ts +84 -0
- package/src/client/htmlPlan/HtmlPlanModeChip.ts +181 -0
- package/src/client/htmlPlan/HtmlPlanPanel.ts +230 -61
- package/src/client/htmlPlan/planActions.ts +38 -8
- package/src/client/htmlPlan/planPage.ts +111 -9
- package/src/client/index.ts +9 -0
- package/src/client/openReceipt.ts +5 -2
- package/src/client/planBridge.ts +27 -2
- package/src/client/planState.ts +51 -4
- package/src/client/sidebar/panels/TestCheckPanel.ts +485 -0
- package/src/client/sidebar/panels/useTestCheckData.ts +414 -0
- package/src/client/sidebar/types.ts +2 -0
- package/src/client/state/diffSummary.ts +3 -0
- package/src/client/styles/editor.css +91 -0
- package/src/client/testCheck/TestCheckChip.ts +181 -0
- package/src/client/testCheck/TestCheckPanel.ts +339 -0
- package/src/client/testCheckPanelState.ts +173 -0
- package/src/client/ui/EditorView.ts +77 -7
- package/src/client/ui/McpSettings.ts +2 -2
- package/src/client/ui/OfficialReview.ts +6 -4
- package/src/htmlPlanAttachments.ts +4 -1
- package/src/htmlPlanCommand.ts +87 -235
- package/src/htmlPlanGuidance.ts +67 -0
- package/src/htmlPlanMode.ts +547 -0
- package/src/index.ts +28 -55
- package/src/officialCapture.ts +58 -9
- package/src/pending/externalCapture.ts +195 -401
- package/src/pending/kernel.ts +24 -1
- package/src/pending/persist.ts +109 -22
- package/src/pending/provenance.ts +5 -28
- package/src/pending/store.ts +109 -100
- package/src/pending/tracking.ts +81 -0
- package/src/pendingCompat.ts +26 -1
- package/src/pendingRpc.ts +8 -56
- package/src/planAutoPage.ts +306 -0
- package/src/planPagePack.ts +148 -0
- package/src/registry.ts +7 -2
- package/src/reviewDb.ts +1 -1
- package/src/reviewRpc.ts +14 -6
- package/src/rpc.ts +34 -0
- package/src/shared/htmlPlanMode.ts +26 -0
- package/src/shared/pendingReview.ts +15 -7
- package/src/shared/review.ts +5 -0
- package/src/shared/rpc.ts +53 -7
- package/src/shared/testCheck.ts +759 -0
- package/src/shared/testCheckHtml.ts +276 -0
- package/src/shared/testCheckPolicyDefault.ts +37 -0
- package/src/shared/testCheckSnippets.ts +197 -0
- package/src/store.ts +17 -1
- package/src/testCheckCommand.ts +287 -0
- package/src/testCheckGuidance.ts +79 -0
- package/src/testCheckMode.ts +654 -0
- package/src/testCheckPolicy.ts +141 -0
- package/src/testCheckRpc.ts +196 -0
- package/src/testCheckStore.ts +822 -0
- package/src/pending/externalAlign.ts +0 -297
- package/src/pending/vcs.ts +0 -584
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-vscode-mode client — 侧栏「测试验收」面板的取数与动作。
|
|
3
|
+
*
|
|
4
|
+
* 面板组件只管摆位置,状态、轮询、错误分区与三个动作都在这里:
|
|
5
|
+
* - `usePolicyDraft`:规范正文的读写(保存空内容=恢复默认)。
|
|
6
|
+
* - `useSheetSnapshot`:全部单列表 + 当前单视图(2.5 秒轮询只读当前单)。
|
|
7
|
+
* - `useSheetActions`:打开页签 / 打开快照 / 移除一张单。
|
|
8
|
+
*
|
|
9
|
+
* 当前单优先取 `SidebarCtx.testCheckId`(编辑器里正开着的验收单页签),
|
|
10
|
+
* 没有时退回列表里最近更新的一张,避免多单项目里「当前项」指错单。
|
|
11
|
+
* @author ddj 2026年11月26号
|
|
12
|
+
*/
|
|
13
|
+
import React from 'react'
|
|
14
|
+
import { openOriginal } from '../../remoteOpenRouter.js'
|
|
15
|
+
import { requestOpen } from '../../openReceipt.js'
|
|
16
|
+
import { rpc } from '../../rpc.js'
|
|
17
|
+
import { TEST_CHECK_CHIP_MS } from '../../../shared/testCheck.js'
|
|
18
|
+
import type { TestCheckSheetSummary, TestCheckView } from '../../../shared/testCheck.js'
|
|
19
|
+
import type { SidebarCtx } from '../types.js'
|
|
20
|
+
import { mergeSheetCounts, removeConfirmText, type PolicyView } from '../../testCheckPanelState.js'
|
|
21
|
+
|
|
22
|
+
//region 类型
|
|
23
|
+
|
|
24
|
+
/** 取数结果:成功带值,失败带可读原因。 */
|
|
25
|
+
type Fetched<T> = { value: T } | { error: string }
|
|
26
|
+
|
|
27
|
+
/** 面板要用的全部数据与动作。 */
|
|
28
|
+
export interface TestCheckData {
|
|
29
|
+
/** 规范状态(null = 还没读到)。 */
|
|
30
|
+
policy: PolicyView | null
|
|
31
|
+
/** 编辑框草稿。 */
|
|
32
|
+
draft: string
|
|
33
|
+
/** 规范读写错误。 */
|
|
34
|
+
policyError: string
|
|
35
|
+
/** 是否正在保存。 */
|
|
36
|
+
saving: boolean
|
|
37
|
+
/** 改草稿。 */
|
|
38
|
+
setDraft: (text: string) => void
|
|
39
|
+
/** 保存(空内容=恢复默认)。 */
|
|
40
|
+
savePolicy: () => Promise<void>
|
|
41
|
+
/** 恢复默认。 */
|
|
42
|
+
resetPolicy: () => Promise<void>
|
|
43
|
+
/** 当前单视图。 */
|
|
44
|
+
view: TestCheckView | null
|
|
45
|
+
/** 当前单读取错误(与列表错误分开显示)。 */
|
|
46
|
+
currentError: string
|
|
47
|
+
/** 全部单。 */
|
|
48
|
+
rows: readonly TestCheckSheetSummary[]
|
|
49
|
+
/** 列表读取错误。 */
|
|
50
|
+
sheetsError: string
|
|
51
|
+
/** 列表是否正在重扫。 */
|
|
52
|
+
sheetsBusy: boolean
|
|
53
|
+
/** 重扫列表与当前单(force 跳过列表缓存)。 */
|
|
54
|
+
refreshAll: (force?: boolean) => Promise<void>
|
|
55
|
+
/** 打开验收单页签。 */
|
|
56
|
+
openSheetTab: () => Promise<void>
|
|
57
|
+
/** 用系统默认程序打开快照。 */
|
|
58
|
+
openSnapshot: (row: TestCheckSheetSummary) => Promise<void>
|
|
59
|
+
/** 移除一张单(已确认)。 */
|
|
60
|
+
removeRow: (row: TestCheckSheetSummary) => Promise<void>
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//endregion
|
|
64
|
+
|
|
65
|
+
//region 取数
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 取异常的展示文案。
|
|
69
|
+
* @author ddj 2026年11月26号
|
|
70
|
+
* @param error 捕获值
|
|
71
|
+
* @returns 可读文本
|
|
72
|
+
*/
|
|
73
|
+
function messageOf(error: unknown): string {
|
|
74
|
+
return error instanceof Error ? error.message : String(error ?? '未知错误')
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* 读项目测试规范。
|
|
79
|
+
* @author ddj 2026年11月26号
|
|
80
|
+
* @param sessionId 会话
|
|
81
|
+
* @returns 规范或错误
|
|
82
|
+
*/
|
|
83
|
+
async function fetchPolicy(sessionId: string): Promise<Fetched<PolicyView>> {
|
|
84
|
+
const raw = await rpc('edrv.testCheck.policy.get', { sessionId })
|
|
85
|
+
if (!raw.ok) return { error: raw.error }
|
|
86
|
+
return { value: { path: raw.path, text: raw.text, isDefault: raw.isDefault } }
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 读全部验收单列表。
|
|
91
|
+
* @author ddj 2026年11月26号
|
|
92
|
+
* @param sessionId 会话
|
|
93
|
+
* @returns 行列表或错误
|
|
94
|
+
*/
|
|
95
|
+
async function fetchSheets(sessionId: string, force = false): Promise<Fetched<readonly TestCheckSheetSummary[]>> {
|
|
96
|
+
const raw = await rpc('edrv.testCheck.sheets', force ? { sessionId, force: true } : { sessionId })
|
|
97
|
+
if (!raw.ok) return { error: raw.error }
|
|
98
|
+
return { value: raw.sheets }
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* 读一张单的派生视图(id 为空时由宿主按目录认领)。
|
|
103
|
+
* @author ddj 2026年11月26号
|
|
104
|
+
* @param sessionId 会话
|
|
105
|
+
* @param id 单子 id
|
|
106
|
+
* @returns 视图或错误
|
|
107
|
+
*/
|
|
108
|
+
async function fetchView(sessionId: string, id: string): Promise<Fetched<TestCheckView>> {
|
|
109
|
+
const raw = await rpc('edrv.testCheck.get', id ? { sessionId, id } : { sessionId })
|
|
110
|
+
if (!raw.ok) return { error: raw.error }
|
|
111
|
+
return { value: raw.view }
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
//endregion
|
|
115
|
+
|
|
116
|
+
//region 规范
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* 规范编辑状态与读写动作。
|
|
120
|
+
* @author ddj 2026年11月26号
|
|
121
|
+
* @param sessionId 会话(空串表示没有活动会话)
|
|
122
|
+
* @param notify 动作反馈
|
|
123
|
+
* @returns 规范状态与三个动作
|
|
124
|
+
*/
|
|
125
|
+
export function usePolicyDraft(sessionId: string, notify?: (message: string) => void) {
|
|
126
|
+
const [policy, setPolicy] = React.useState<PolicyView | null>(null)
|
|
127
|
+
const [draft, setDraft] = React.useState('')
|
|
128
|
+
const [policyError, setPolicyError] = React.useState('')
|
|
129
|
+
const [saving, setSaving] = React.useState(false)
|
|
130
|
+
const aliveRef = React.useRef(true)
|
|
131
|
+
|
|
132
|
+
/** 读一次规范(会话变化时重读)。 */
|
|
133
|
+
async function loadPolicy(): Promise<void> {
|
|
134
|
+
if (!sessionId) {
|
|
135
|
+
setPolicy(null)
|
|
136
|
+
setDraft('')
|
|
137
|
+
setPolicyError('')
|
|
138
|
+
return
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
const fetched = await fetchPolicy(sessionId)
|
|
142
|
+
if (!aliveRef.current) return
|
|
143
|
+
if ('error' in fetched) { setPolicyError(fetched.error); return }
|
|
144
|
+
setPolicy(fetched.value)
|
|
145
|
+
setDraft(fetched.value.text)
|
|
146
|
+
setPolicyError('')
|
|
147
|
+
} catch (error) {
|
|
148
|
+
if (aliveRef.current) setPolicyError('读取项目测试规范失败:' + messageOf(error))
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* 写规范:传 null 表示恢复默认(删文件),传文本表示保存。
|
|
154
|
+
* @param text 要保存的正文;null = 恢复默认
|
|
155
|
+
*/
|
|
156
|
+
async function writePolicy(text: string | null): Promise<void> {
|
|
157
|
+
if (!sessionId || saving) return
|
|
158
|
+
setSaving(true)
|
|
159
|
+
setPolicyError('')
|
|
160
|
+
try {
|
|
161
|
+
const raw = text === null
|
|
162
|
+
? await rpc('edrv.testCheck.policy.reset', { sessionId })
|
|
163
|
+
: await rpc('edrv.testCheck.policy.save', { sessionId, text })
|
|
164
|
+
if (!aliveRef.current) return
|
|
165
|
+
if (!raw.ok) { setPolicyError(raw.error); return }
|
|
166
|
+
const next: PolicyView = { path: raw.path, text: raw.text, isDefault: raw.isDefault }
|
|
167
|
+
setPolicy(next)
|
|
168
|
+
setDraft(next.text)
|
|
169
|
+
notify?.(next.isDefault ? '已恢复默认规则,下一条消息生效' : '项目测试规范已保存,下一条消息生效')
|
|
170
|
+
} catch (error) {
|
|
171
|
+
if (aliveRef.current) setPolicyError('保存失败:' + messageOf(error))
|
|
172
|
+
} finally {
|
|
173
|
+
if (aliveRef.current) setSaving(false)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
React.useEffect(() => {
|
|
178
|
+
aliveRef.current = true
|
|
179
|
+
void loadPolicy()
|
|
180
|
+
return () => { aliveRef.current = false }
|
|
181
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
182
|
+
}, [sessionId])
|
|
183
|
+
|
|
184
|
+
return {
|
|
185
|
+
policy,
|
|
186
|
+
draft,
|
|
187
|
+
policyError,
|
|
188
|
+
saving,
|
|
189
|
+
setDraft,
|
|
190
|
+
savePolicy: () => writePolicy(draft),
|
|
191
|
+
resetPolicy: () => writePolicy(null),
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
//endregion
|
|
196
|
+
|
|
197
|
+
//region 验收单
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* 全部单列表 + 当前单视图(轮询只读当前单)。
|
|
201
|
+
* @author ddj 2026年11月26号
|
|
202
|
+
* @param sessionId 会话
|
|
203
|
+
* @param preferredId 编辑器里正开着的验收单 id(可空)
|
|
204
|
+
* @returns 两个列表、两处错误与刷新动作
|
|
205
|
+
*/
|
|
206
|
+
export function useSheetSnapshot(sessionId: string, preferredId: string) {
|
|
207
|
+
const [view, setView] = React.useState<TestCheckView | null>(null)
|
|
208
|
+
const [rows, setRows] = React.useState<readonly TestCheckSheetSummary[]>([])
|
|
209
|
+
const [currentError, setCurrentError] = React.useState('')
|
|
210
|
+
const [sheetsError, setSheetsError] = React.useState('')
|
|
211
|
+
const [sheetsBusy, setSheetsBusy] = React.useState(false)
|
|
212
|
+
const currentRef = React.useRef('')
|
|
213
|
+
const aliveRef = React.useRef(true)
|
|
214
|
+
|
|
215
|
+
/** 轮询:只读当前单,并把计数合并回列表那一行(不再请求列表)。 */
|
|
216
|
+
async function pollCurrent(): Promise<void> {
|
|
217
|
+
const id = currentRef.current || preferredId
|
|
218
|
+
const fetched = await fetchView(sessionId, id)
|
|
219
|
+
if (!aliveRef.current) return
|
|
220
|
+
if ('error' in fetched) { setCurrentError(fetched.error); return }
|
|
221
|
+
setCurrentError('')
|
|
222
|
+
setView(fetched.value)
|
|
223
|
+
currentRef.current = fetched.value.id
|
|
224
|
+
setRows((prev) => mergeSheetCounts(prev, fetched.value))
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** 重扫列表与当前单:两路并发;没有首选单时按列表第一张补读一次。 */
|
|
228
|
+
async function refreshAll(force = false): Promise<void> {
|
|
229
|
+
if (!sessionId) { setRows([]); setView(null); return }
|
|
230
|
+
setSheetsBusy(true)
|
|
231
|
+
try {
|
|
232
|
+
const prefer = currentRef.current || preferredId
|
|
233
|
+
const [listed, first] = await Promise.all([fetchSheets(sessionId, force), fetchView(sessionId, prefer)])
|
|
234
|
+
if (!aliveRef.current) return
|
|
235
|
+
|
|
236
|
+
const nextRows = 'error' in listed ? [] : listed.value
|
|
237
|
+
setSheetsError('error' in listed ? listed.error : '')
|
|
238
|
+
setRows(nextRows)
|
|
239
|
+
|
|
240
|
+
let current: TestCheckView | null = 'error' in first ? null : first.value
|
|
241
|
+
setCurrentError('error' in first ? first.error : '')
|
|
242
|
+
if (!prefer && current && current.state === 'missing' && nextRows.length) {
|
|
243
|
+
const retry = await fetchView(sessionId, nextRows[0].id)
|
|
244
|
+
if (!('error' in retry)) { current = retry.value; setCurrentError('') }
|
|
245
|
+
}
|
|
246
|
+
setView(current)
|
|
247
|
+
currentRef.current = current?.id ?? ''
|
|
248
|
+
} catch (error) {
|
|
249
|
+
if (!aliveRef.current) return
|
|
250
|
+
setSheetsError('读取验收单失败:' + messageOf(error))
|
|
251
|
+
} finally {
|
|
252
|
+
if (aliveRef.current) setSheetsBusy(false)
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
React.useEffect(() => {
|
|
257
|
+
aliveRef.current = true
|
|
258
|
+
currentRef.current = ''
|
|
259
|
+
setView(null)
|
|
260
|
+
void refreshAll()
|
|
261
|
+
return () => { aliveRef.current = false }
|
|
262
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
263
|
+
}, [sessionId, preferredId])
|
|
264
|
+
|
|
265
|
+
React.useEffect(() => {
|
|
266
|
+
if (!sessionId) return undefined
|
|
267
|
+
const timer = window.setInterval(() => { void pollCurrent() }, TEST_CHECK_CHIP_MS)
|
|
268
|
+
return () => window.clearInterval(timer)
|
|
269
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
270
|
+
}, [sessionId, preferredId])
|
|
271
|
+
|
|
272
|
+
return { view, rows, currentError, sheetsError, sheetsBusy, currentRef, refreshAll }
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** 三个列表动作的入参。 */
|
|
276
|
+
interface SheetActionInput {
|
|
277
|
+
/** 会话。 */
|
|
278
|
+
sessionId: string
|
|
279
|
+
/** 会话工作区(打开快照时定位)。 */
|
|
280
|
+
cwd: string | null
|
|
281
|
+
/** 确认弹窗(缺省用 window.confirm)。 */
|
|
282
|
+
confirm?: (message: string) => boolean
|
|
283
|
+
/** 动作反馈。 */
|
|
284
|
+
notify?: (message: string) => void
|
|
285
|
+
/** 当前视图(打开页签要用标题)。 */
|
|
286
|
+
view: TestCheckView | null
|
|
287
|
+
/** 当前单 id(引用,轮询会更新)。 */
|
|
288
|
+
currentRef: { current: string }
|
|
289
|
+
/** 重扫列表与当前单(force 跳过列表缓存)。 */
|
|
290
|
+
refreshAll: (force?: boolean) => Promise<void>
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* 打开验收单页签 / 打开快照 / 移除一张单。
|
|
295
|
+
* @author ddj 2026年11月26号
|
|
296
|
+
* @param input 会话、确认与反馈
|
|
297
|
+
* @returns 三个动作
|
|
298
|
+
*/
|
|
299
|
+
export function useSheetActions(input: SheetActionInput) {
|
|
300
|
+
const { sessionId, cwd, confirm, notify, view, currentRef, refreshAll } = input
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* 问一句再做(优先用注入的 confirm,便于测试注入)。
|
|
304
|
+
* @param message 确认文案
|
|
305
|
+
* @returns 用户是否同意
|
|
306
|
+
*/
|
|
307
|
+
function askConfirm(message: string): boolean {
|
|
308
|
+
if (typeof confirm === 'function') return confirm(message)
|
|
309
|
+
return typeof window === 'undefined' ? false : window.confirm(message)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/** 打开验收单页签(虚拟页签,与底部 chip 同一入口)。 */
|
|
313
|
+
async function openSheetTab(): Promise<void> {
|
|
314
|
+
const id = currentRef.current || view?.id || ''
|
|
315
|
+
if (!sessionId) { notify?.('当前没有活动会话'); return }
|
|
316
|
+
if (!id) { notify?.('还没有验收单可以打开'); return }
|
|
317
|
+
try {
|
|
318
|
+
const ok = await requestOpen(null, undefined, undefined, sessionId, {
|
|
319
|
+
preview: true,
|
|
320
|
+
sheet: { id, title: view?.title ?? id },
|
|
321
|
+
timeoutMs: 4000,
|
|
322
|
+
})
|
|
323
|
+
if (!ok) notify?.('打开验收单失败:编辑器没有回执,请重试')
|
|
324
|
+
} catch (error) {
|
|
325
|
+
notify?.('打开验收单失败:' + messageOf(error))
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* 用系统默认程序打开快照;缺失时提示可移除。
|
|
331
|
+
* @param row 列表行
|
|
332
|
+
*/
|
|
333
|
+
async function openSnapshot(row: TestCheckSheetSummary): Promise<void> {
|
|
334
|
+
if (!row.hasSnapshot) {
|
|
335
|
+
notify?.('这张单还没有导出快照:先导出,或直接移除这一条(' + row.snapshotPath + ')')
|
|
336
|
+
return
|
|
337
|
+
}
|
|
338
|
+
try {
|
|
339
|
+
await openOriginal({ path: row.snapshotPath }, cwd ?? undefined)
|
|
340
|
+
} catch (error) {
|
|
341
|
+
notify?.('打开快照失败:' + messageOf(error))
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* 移除一张单:确认后删目录与快照,再重扫列表。
|
|
347
|
+
* @param row 列表行
|
|
348
|
+
*/
|
|
349
|
+
async function removeRow(row: TestCheckSheetSummary): Promise<void> {
|
|
350
|
+
if (!sessionId) { notify?.('当前没有活动会话'); return }
|
|
351
|
+
const dir = row.itemsPath.replace(/\/items\.json$/, '')
|
|
352
|
+
if (!askConfirm(removeConfirmText(row.title, dir, row.snapshotPath))) return
|
|
353
|
+
try {
|
|
354
|
+
const raw = await rpc('edrv.testCheck.remove', { sessionId, id: row.id })
|
|
355
|
+
if (!raw.ok) { notify?.(raw.error); return }
|
|
356
|
+
notify?.(raw.removed.length ? '已移除 ' + String(raw.removed.length) + ' 项' : '这张单已经不在了')
|
|
357
|
+
if (currentRef.current === row.id) currentRef.current = ''
|
|
358
|
+
await refreshAll(true)
|
|
359
|
+
} catch (error) {
|
|
360
|
+
notify?.('移除失败:' + messageOf(error))
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return { openSheetTab, openSnapshot, removeRow }
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
//endregion
|
|
368
|
+
|
|
369
|
+
//region 组合
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* 面板数据总入口:组合规范、列表与三个动作。
|
|
373
|
+
* @author ddj 2026年11月26号
|
|
374
|
+
* @param ctx 侧栏共享上下文
|
|
375
|
+
* @returns 面板要用的全部数据与动作
|
|
376
|
+
*/
|
|
377
|
+
export function useTestCheckData(ctx?: SidebarCtx): TestCheckData {
|
|
378
|
+
const sessionId = ctx?.sessionId ?? ''
|
|
379
|
+
const cwd = ctx?.cwd ?? null
|
|
380
|
+
const preferredId = typeof ctx?.testCheckId === 'string' ? ctx.testCheckId : ''
|
|
381
|
+
const notify = ctx?.notify
|
|
382
|
+
const confirm = ctx?.confirm
|
|
383
|
+
|
|
384
|
+
const policy = usePolicyDraft(sessionId, notify)
|
|
385
|
+
const snapshot = useSheetSnapshot(sessionId, preferredId)
|
|
386
|
+
const actions = useSheetActions({
|
|
387
|
+
sessionId,
|
|
388
|
+
cwd,
|
|
389
|
+
confirm,
|
|
390
|
+
notify,
|
|
391
|
+
view: snapshot.view,
|
|
392
|
+
currentRef: snapshot.currentRef,
|
|
393
|
+
refreshAll: snapshot.refreshAll,
|
|
394
|
+
})
|
|
395
|
+
|
|
396
|
+
return {
|
|
397
|
+
policy: policy.policy,
|
|
398
|
+
draft: policy.draft,
|
|
399
|
+
policyError: policy.policyError,
|
|
400
|
+
saving: policy.saving,
|
|
401
|
+
setDraft: policy.setDraft,
|
|
402
|
+
savePolicy: policy.savePolicy,
|
|
403
|
+
resetPolicy: policy.resetPolicy,
|
|
404
|
+
view: snapshot.view,
|
|
405
|
+
currentError: snapshot.currentError,
|
|
406
|
+
rows: snapshot.rows,
|
|
407
|
+
sheetsError: snapshot.sheetsError,
|
|
408
|
+
sheetsBusy: snapshot.sheetsBusy,
|
|
409
|
+
refreshAll: snapshot.refreshAll,
|
|
410
|
+
...actions,
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
//endregion
|
|
@@ -14,6 +14,8 @@ export interface SidebarCtx {
|
|
|
14
14
|
visible?: boolean
|
|
15
15
|
/** 当前会话工作区 cwd(来自 sessions 快照;规则面板项目 Tab 自动匹配用)。 */
|
|
16
16
|
cwd?: string | null
|
|
17
|
+
/** 编辑器里正开着的验收单 id(测试验收面板据此认定「当前验收项」,没开页签时不带)。 */
|
|
18
|
+
testCheckId?: string
|
|
17
19
|
/** 状态作用域键(工作区优先,无 cwd 回退会话;面板持久化统一走它,scopeStore 产出)。 */
|
|
18
20
|
scope?: string
|
|
19
21
|
openFile: (path: string) => void
|
|
@@ -75,6 +75,8 @@ function pendingCoverKeys(page: ReviewPage | null): Set<string> {
|
|
|
75
75
|
keys.add(diffPathKey(item.currentPath || item.path))
|
|
76
76
|
keys.add(diffPathKey(item.id.slice(PENDING_PREFIX.length)))
|
|
77
77
|
}
|
|
78
|
+
// 已关窗的条目不在 items 里,但路径仍算被窗口接管:旧行与旧工具记录都不能再回来。
|
|
79
|
+
for (const path of page?.pendingCoveredPaths ?? []) keys.add(diffPathKey(path))
|
|
78
80
|
return keys
|
|
79
81
|
}
|
|
80
82
|
|
|
@@ -128,6 +130,7 @@ export function diffSummary(records: (RecordView & { archived?: boolean })[], pa
|
|
|
128
130
|
&& !pending.covered.has(diffPathKey(record.path)) && !officialPath(record.path, page)))
|
|
129
131
|
const files: DiffFile[] = [...pending.rows]
|
|
130
132
|
for (const file of page?.overview?.files ?? []) {
|
|
133
|
+
// 被窗口接管过的路径(含已关窗)不再列官方概览行,否则同一文件处理完又会出现一条。
|
|
131
134
|
if (pending.covered.has(diffPathKey(file.path))) continue
|
|
132
135
|
files.push({ ...file, recs: [] })
|
|
133
136
|
}
|
|
@@ -1264,3 +1264,94 @@
|
|
|
1264
1264
|
@media (prefers-reduced-motion: reduce) { .edrv-drag-overlay { transition: none; } }
|
|
1265
1265
|
/* 宿主节点在表格引擎 chunk 加载前就必须有高度,故留在根样式而非 panel.css。 */
|
|
1266
1266
|
.edrv-excel-host { height: 100%; min-height: 0; flex: 1; }
|
|
1267
|
+
|
|
1268
|
+
/* ── HTML 计划模式:计划签徽标(编辑器面板内) ── */
|
|
1269
|
+
[data-edrv-view] .edrv-htmlplan-mode { font-size: 11px; padding: 1px 8px; border-radius: 9px; border: 1px solid var(--dsw-alias-state-accent-primary, #2563eb); color: var(--dsw-alias-state-accent-primary, #2563eb); white-space: nowrap; }
|
|
1270
|
+
[data-edrv-view] .edrv-htmlplan-src { font-size: 11px; padding: 1px 8px; border-radius: 9px; border: 1px solid var(--dsw-alias-state-success-primary, #15803d); color: var(--dsw-alias-state-success-primary, #15803d); white-space: nowrap; }
|
|
1271
|
+
|
|
1272
|
+
/* ── HTML 计划模式:输入框底部栏 chip(composer 区,不在编辑器面板内,选择器不加作用域) ── */
|
|
1273
|
+
.edrv-htmlplan-chip-wrap { display: inline-flex; align-items: center; gap: 6px; }
|
|
1274
|
+
.edrv-htmlplan-chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--dsw-alias-state-accent-primary, #2563eb); background: transparent; color: var(--dsw-alias-state-accent-primary, #2563eb); font-size: 12px; font-weight: 600; cursor: pointer; }
|
|
1275
|
+
.edrv-htmlplan-chip:hover:not(:disabled) { filter: brightness(.96); }
|
|
1276
|
+
.edrv-htmlplan-chip:disabled { opacity: .55; cursor: default; }
|
|
1277
|
+
.edrv-htmlplan-chip-glyph { font-size: 9px; }
|
|
1278
|
+
.edrv-htmlplan-chip-x { font-size: 10px; opacity: .75; }
|
|
1279
|
+
.edrv-htmlplan-chip-error { font-size: 11px; color: var(--dsw-alias-state-warning-primary, #b45309); }
|
|
1280
|
+
|
|
1281
|
+
/* ── 测试验收模式:验收单页签(编辑器面板内) ── */
|
|
1282
|
+
[data-edrv-view] .edrv-testcheck-host { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; position: relative; }
|
|
1283
|
+
[data-edrv-view] .edrv-testcheck { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
|
|
1284
|
+
[data-edrv-view] .edrv-testcheck-bar { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; flex: 0 0 auto; border-bottom: 1px solid var(--dsw-alias-border-l1, rgba(0,0,0,.08)); }
|
|
1285
|
+
[data-edrv-view] .edrv-testcheck-title { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
|
|
1286
|
+
[data-edrv-view] .edrv-testcheck-tally { font-size: 11.5px; opacity: .8; white-space: nowrap; }
|
|
1287
|
+
[data-edrv-view] .edrv-testcheck-frame { flex: 1 1 auto; width: 100%; min-height: 0; border: none; background: #fff; }
|
|
1288
|
+
[data-edrv-view] .edrv-testcheck-notice { font-size: 11.5px; color: var(--dsw-alias-label-secondary, #6b6659); padding: 4px 10px; flex: 0 0 auto; }
|
|
1289
|
+
[data-edrv-view] .edrv-testcheck-error { font-size: 12px; color: var(--dsw-alias-state-danger-primary, #b42318); padding: 6px 10px; flex: 0 0 auto; }
|
|
1290
|
+
[data-edrv-view] .edrv-testcheck-guide { flex: 1 1 auto; overflow: auto; padding: 14px 16px; }
|
|
1291
|
+
[data-edrv-view] .edrv-testcheck-guide h3 { font-size: 14px; margin: 0 0 8px; }
|
|
1292
|
+
[data-edrv-view] .edrv-testcheck-guide p { font-size: 12.5px; margin: 0 0 8px; line-height: 1.6; }
|
|
1293
|
+
[data-edrv-view] .edrv-testcheck-guide code { font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; background: var(--dsw-alias-markdown-code-block, rgba(0,0,0,.05)); padding: 1px 4px; border-radius: 3px; }
|
|
1294
|
+
[data-edrv-view] .edrv-testcheck-errors { margin: 0 0 8px; padding-left: 18px; font-size: 12.5px; color: var(--dsw-alias-state-danger-primary, #b42318); }
|
|
1295
|
+
[data-edrv-view] .edrv-testcheck-pre { margin: 6px 0 10px; padding: 10px 12px; border-radius: 6px; background: var(--dsw-alias-markdown-code-block, rgba(0,0,0,.05)); overflow: auto; font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; line-height: 1.5; white-space: pre; }
|
|
1296
|
+
[data-edrv-view] .edrv-testcheck-actions { display: flex; gap: 8px; margin: 4px 0 10px; }
|
|
1297
|
+
[data-edrv-view] .edrv-testcheck-details { margin-top: 10px; font-size: 12.5px; }
|
|
1298
|
+
[data-edrv-view] .edrv-testcheck-snippet { margin-top: 8px; }
|
|
1299
|
+
[data-edrv-view] .edrv-testcheck-snippet-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 12px; }
|
|
1300
|
+
[data-edrv-view] .edrv-testcheck-manual { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--dsw-alias-border-l1, rgba(0,0,0,.08)); flex: 0 0 auto; }
|
|
1301
|
+
[data-edrv-view] .edrv-testcheck-manual select, [data-edrv-view] .edrv-testcheck-input { height: 26px; font-size: 12px; border-radius: 6px; border: 1px solid var(--dsw-alias-border-l1, rgba(0,0,0,.18)); background: transparent; color: inherit; padding: 0 6px; }
|
|
1302
|
+
[data-edrv-view] .edrv-testcheck-input { flex: 1 1 auto; min-width: 120px; }
|
|
1303
|
+
[data-edrv-view] .edrv-tab-sheet { border-left: 2px solid var(--dsw-alias-state-success-primary, #15803d); }
|
|
1304
|
+
|
|
1305
|
+
/* ── 测试验收:侧栏面板(说明 + 技能 + 规范 + 当前项/全部单两张列表) ── */
|
|
1306
|
+
[data-edrv-view] .edrv-tc-panel { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 12px; padding: 10px 10px 16px; font-size: 12px; }
|
|
1307
|
+
[data-edrv-view] .edrv-tc-block { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
|
|
1308
|
+
[data-edrv-view] .edrv-tc-row { display: flex; align-items: center; gap: 8px; min-height: 22px; min-width: 0; }
|
|
1309
|
+
[data-edrv-view] .edrv-tc-label { font-weight: 600; white-space: nowrap; color: var(--dsw-alias-label-primary, #1f2933); }
|
|
1310
|
+
[data-edrv-view] .edrv-tc-dim { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-tertiary, #9aa5b1); font-size: 11px; }
|
|
1311
|
+
[data-edrv-view] .edrv-tc-btn { flex: 0 0 auto; height: 22px; padding: 0 9px; border-radius: 6px; border: 1px solid var(--dsw-alias-border-l1, #e0e6e8); background: transparent; color: var(--dsw-alias-label-secondary, #52606d); font-size: 11.5px; cursor: pointer; white-space: nowrap; }
|
|
1312
|
+
[data-edrv-view] .edrv-tc-btn:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover, rgba(15,157,88,.08)); }
|
|
1313
|
+
[data-edrv-view] .edrv-tc-btn:disabled { opacity: .45; cursor: default; }
|
|
1314
|
+
[data-edrv-view] .edrv-tc-btn.primary { border-color: var(--dsw-alias-brand-primary, #0f9d58); color: var(--dsw-alias-brand-primary, #0f9d58); }
|
|
1315
|
+
[data-edrv-view] .edrv-tc-btn.danger { border-color: var(--dsw-alias-state-error-primary, rgba(217,83,79,.45)); color: var(--dsw-alias-state-error-primary, #d9534f); }
|
|
1316
|
+
[data-edrv-view] .edrv-tc-icon-btn { flex: 0 0 auto; width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 1px solid var(--dsw-alias-border-l1, #e0e6e8); background: transparent; color: var(--dsw-alias-label-secondary, #52606d); font-size: 11px; line-height: 18px; cursor: pointer; }
|
|
1317
|
+
[data-edrv-view] .edrv-tc-icon-btn:hover { background: var(--dsw-alias-interactive-bg-hover, rgba(15,157,88,.08)); }
|
|
1318
|
+
[data-edrv-view] .edrv-tc-editor { min-height: 108px; max-height: 220px; resize: vertical; padding: 8px; border-radius: 8px; border: 1px solid var(--dsw-alias-border-l1, #e0e6e8); background: var(--dsw-alias-bg-layer-2, #f0f4f4); color: var(--dsw-alias-label-primary, #1f2933); font-family: var(--ds-font-family-code, ui-monospace, Consolas, monospace); font-size: 11.5px; line-height: 1.6; }
|
|
1319
|
+
[data-edrv-view] .edrv-tc-editor:disabled { opacity: .6; }
|
|
1320
|
+
[data-edrv-view] .edrv-tc-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-secondary, #52606d); font-size: 11px; }
|
|
1321
|
+
[data-edrv-view] .edrv-tc-hint { color: var(--dsw-alias-label-tertiary, #9aa5b1); font-size: 10.5px; line-height: 1.55; overflow-wrap: anywhere; }
|
|
1322
|
+
[data-edrv-view] .edrv-tc-hint.warn { color: var(--dsw-alias-state-warn-primary, #d97706); }
|
|
1323
|
+
[data-edrv-view] .edrv-tc-error { color: var(--dsw-alias-state-error-primary, #d9534f); font-size: 11.5px; line-height: 1.5; overflow-wrap: anywhere; }
|
|
1324
|
+
[data-edrv-view] .edrv-tc-actions { display: flex; gap: 6px; }
|
|
1325
|
+
[data-edrv-view] .edrv-tc-list { max-height: 180px; overflow: auto; display: flex; flex-direction: column; gap: 1px; padding: 3px; border-radius: 8px; border: 1px solid var(--dsw-alias-border-l1, #e0e6e8); background: var(--dsw-alias-bg-layer-1, #ffffff); }
|
|
1326
|
+
[data-edrv-view] .edrv-tc-item, [data-edrv-view] .edrv-tc-sheet { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 3px 6px; border-radius: 5px; cursor: pointer; }
|
|
1327
|
+
[data-edrv-view] .edrv-tc-item:hover, [data-edrv-view] .edrv-tc-sheet:hover { background: var(--dsw-alias-interactive-bg-hover, rgba(15,157,88,.08)); }
|
|
1328
|
+
[data-edrv-view] .edrv-tc-item:focus-visible, [data-edrv-view] .edrv-tc-sheet:focus-visible { outline: 1px solid var(--dsw-alias-brand-primary, #0f9d58); outline-offset: -1px; }
|
|
1329
|
+
/* 有快照的行:移除按钮平时收起来,悬停或键盘聚焦时才显形(点行本身是「打开」,别让误触删数据) */
|
|
1330
|
+
[data-edrv-view] .edrv-tc-sheet:not(.is-missing) .edrv-tc-btn.danger { opacity: 0; pointer-events: none; transition: opacity .12s; }
|
|
1331
|
+
[data-edrv-view] .edrv-tc-sheet:not(.is-missing):hover .edrv-tc-btn.danger,
|
|
1332
|
+
[data-edrv-view] .edrv-tc-sheet:not(.is-missing):focus-within .edrv-tc-btn.danger { opacity: 1; pointer-events: auto; }
|
|
1333
|
+
[data-edrv-view] .edrv-tc-sheet.is-missing { opacity: .82; }
|
|
1334
|
+
[data-edrv-view] .edrv-tc-dot { flex: 0 0 auto; font-size: 9px; line-height: 1; color: var(--dsw-alias-label-tertiary, #9aa5b1); }
|
|
1335
|
+
[data-edrv-view] .edrv-tc-dot.is-pass { color: var(--dsw-alias-state-success-primary, #0f9d58); }
|
|
1336
|
+
[data-edrv-view] .edrv-tc-dot.is-fail { color: var(--dsw-alias-state-error-primary, #d9534f); }
|
|
1337
|
+
[data-edrv-view] .edrv-tc-dot.is-blocked, [data-edrv-view] .edrv-tc-dot.is-stale, [data-edrv-view] .edrv-tc-dot.is-claimed { color: var(--dsw-alias-state-warn-primary, #d97706); }
|
|
1338
|
+
[data-edrv-view] .edrv-tc-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-primary, #1f2933); }
|
|
1339
|
+
[data-edrv-view] .edrv-tc-tag { flex: 0 0 auto; color: var(--dsw-alias-label-tertiary, #9aa5b1); font-size: 10.5px; }
|
|
1340
|
+
[data-edrv-view] .edrv-tc-tag.warn { color: var(--dsw-alias-state-warn-primary, #d97706); }
|
|
1341
|
+
[data-edrv-view] .edrv-tc-empty { padding: 8px; border-radius: 8px; border: 1px dashed var(--dsw-alias-border-l1, #e0e6e8); color: var(--dsw-alias-label-tertiary, #9aa5b1); font-size: 11.5px; line-height: 1.6; overflow-wrap: anywhere; }
|
|
1342
|
+
[data-edrv-view] .edrv-tc-dialog { display: flex; flex-direction: column; max-height: min(78vh, 720px); }
|
|
1343
|
+
[data-edrv-view] .edrv-tc-dialog-head { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--dsw-alias-border-l1, #e0e6e8); }
|
|
1344
|
+
[data-edrv-view] .edrv-tc-dialog-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 13px; }
|
|
1345
|
+
[data-edrv-view] .edrv-tc-dialog-sub { flex: 0 0 auto; padding: 6px 12px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--dsw-alias-label-tertiary, #9aa5b1); font-size: 11px; }
|
|
1346
|
+
[data-edrv-view] .edrv-tc-dialog-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 10px 12px 14px; }
|
|
1347
|
+
[data-edrv-view] .edrv-tc-dialog-body p { margin: 0 0 8px; font-size: 12.5px; line-height: 1.7; }
|
|
1348
|
+
[data-edrv-view] .edrv-tc-pre { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--dsw-alias-markdown-code-block, rgba(0,0,0,.05)); font-family: ui-monospace, Consolas, monospace; font-size: 11.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
|
|
1349
|
+
|
|
1350
|
+
/* ── 测试验收模式:输入框底部栏 chip(composer 区,不在编辑器面板内,选择器不加作用域) ── */
|
|
1351
|
+
.edrv-testcheck-chip-wrap { display: inline-flex; align-items: center; gap: 6px; }
|
|
1352
|
+
.edrv-testcheck-chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--dsw-alias-state-success-primary, #15803d); background: transparent; color: var(--dsw-alias-state-success-primary, #15803d); font-size: 12px; font-weight: 600; cursor: pointer; }
|
|
1353
|
+
.edrv-testcheck-chip:hover:not(:disabled) { filter: brightness(.96); }
|
|
1354
|
+
.edrv-testcheck-chip:disabled { opacity: .55; cursor: default; }
|
|
1355
|
+
.edrv-testcheck-chip-glyph { font-size: 10px; }
|
|
1356
|
+
.edrv-testcheck-chip-open { font-size: 12px; opacity: .7; }
|
|
1357
|
+
.edrv-testcheck-chip-error { font-size: 11px; color: var(--dsw-alias-state-warning-primary, #b45309); }
|