dsh-vscode-mode 0.39.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/lib/client.js +83 -64
- package/lib/client.js.map +1 -1
- package/lib/index.js +4765 -1886
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/dsh-vscodemode-test-check/SKILL.md +82 -0
- package/src/attachmentBytes.ts +84 -0
- package/src/client/index.ts +6 -0
- package/src/client/openReceipt.ts +5 -2
- 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/styles/editor.css +78 -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 +69 -6
- package/src/htmlPlanAttachments.ts +4 -1
- package/src/htmlPlanCommand.ts +4 -62
- package/src/index.ts +4 -0
- package/src/rpc.ts +3 -0
- package/src/shared/rpc.ts +44 -0
- 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/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
|
@@ -45,6 +45,7 @@ import { clampZoom, clearZoomMem, dataUrlOf, isImagePath, isSvgPath, recallZoom,
|
|
|
45
45
|
import { isMarkdownPath } from '../markdownPreview.js'
|
|
46
46
|
import { hasOfficialHtmlPreview, isHtmlPath } from '../htmlPreview.js'
|
|
47
47
|
import { HtmlPlanPanel } from '../htmlPlan/HtmlPlanPanel.js'
|
|
48
|
+
import { TestCheckPanel } from '../testCheck/TestCheckPanel.js'
|
|
48
49
|
import { isExcelPath } from '../excel/model.js'
|
|
49
50
|
import { isUniverPath, isOfficePath } from '../../shared/univer.js'
|
|
50
51
|
import { routesUniver } from '../univer/routing.js'
|
|
@@ -301,10 +302,18 @@ export function EditorView(props) {
|
|
|
301
302
|
const planHostRef = React.useRef(null)
|
|
302
303
|
// 进入只读计划预览前的磁盘选中页签,关闭该计划页签时恢复,避免跳到第一个页签。
|
|
303
304
|
const planReturnRef = React.useRef(null)
|
|
304
|
-
|
|
305
|
+
// 测试验收单:与计划页签同一套虚拟页签轨道(只存内存,不落磁盘、不进保存/差异/LSP 流程)。
|
|
306
|
+
const [sheetTabs, setSheetTabs] = React.useState([])
|
|
307
|
+
const [sheetActive, setSheetActive] = React.useState(null)
|
|
308
|
+
const sheetActiveRef = React.useRef(null)
|
|
309
|
+
sheetActiveRef.current = sheetActive
|
|
310
|
+
const sheetHostRef = React.useRef(null)
|
|
311
|
+
const sheetReturnRef = React.useRef(null)
|
|
312
|
+
React.useEffect(() => { setPlanTabs([]); setPlanActive(null); setSheetTabs([]); setSheetActive(null) }, [sessionId, cwd])
|
|
305
313
|
/** @private @author ddj 2026年10月08号 @param path Disk tab selection. Leave read-only plan mode before any disk navigation. */
|
|
306
314
|
function setActive(path) {
|
|
307
315
|
setPlanActive(null)
|
|
316
|
+
setSheetActive(null)
|
|
308
317
|
setDiskActive(path)
|
|
309
318
|
setWorkbench((current) => syncTabs(current, tabsRef.current, path))
|
|
310
319
|
}
|
|
@@ -4269,6 +4278,7 @@ export function EditorView(props) {
|
|
|
4269
4278
|
|
|
4270
4279
|
/** 关闭当前活动页签(Ctrl+F4 与菜单动作共用;无页签时提示)。 */
|
|
4271
4280
|
const closeActiveTab = () => {
|
|
4281
|
+
if (sheetActiveRef.current) { closeSheet(sheetActiveRef.current); return }
|
|
4272
4282
|
if (planActiveRef.current) { closePlan(planActiveRef.current); return }
|
|
4273
4283
|
if (!activeRef.current) { setStatus('无打开的文件'); return }
|
|
4274
4284
|
closeTab(activeRef.current)
|
|
@@ -4466,8 +4476,32 @@ export function EditorView(props) {
|
|
|
4466
4476
|
planReturnRef.current = null
|
|
4467
4477
|
setActive(tabsRef.current.some((tab) => tab.path === previous) ? previous : (tabsRef.current[0]?.path ?? null))
|
|
4468
4478
|
}
|
|
4479
|
+
/** @private @author ddj 2026年11月25号 @param sheet 验收单身份。打开只读虚拟页签,不碰磁盘/保存/LSP。 */
|
|
4480
|
+
function openSheetDoc(sheet) {
|
|
4481
|
+
const id = typeof sheet?.id === 'string' ? sheet.id.trim() : ''
|
|
4482
|
+
if (!id) return
|
|
4483
|
+
flushSave()
|
|
4484
|
+
saveViewState(active)
|
|
4485
|
+
if (!sheetActiveRef.current) sheetReturnRef.current = active
|
|
4486
|
+
setDiskActive(null)
|
|
4487
|
+
const title = typeof sheet?.title === 'string' && sheet.title ? sheet.title : '验收单 · ' + id
|
|
4488
|
+
setSheetTabs((prev) => [...prev.filter((item) => item.id !== id), { id, title }].slice(-8))
|
|
4489
|
+
setSheetActive(id)
|
|
4490
|
+
setError(null)
|
|
4491
|
+
setStatus('验收单 · 数据自动刷新')
|
|
4492
|
+
}
|
|
4493
|
+
/** @private @author ddj 2026年11月25号 @param id 验收单 id。 @param event 可选的关闭点击。只移除内存页签。 */
|
|
4494
|
+
function closeSheet(id, event) {
|
|
4495
|
+
event?.stopPropagation()
|
|
4496
|
+
setSheetTabs((prev) => prev.filter((item) => item.id !== id))
|
|
4497
|
+
if (sheetActiveRef.current !== id) return
|
|
4498
|
+
const previous = sheetReturnRef.current
|
|
4499
|
+
sheetReturnRef.current = null
|
|
4500
|
+
setActive(tabsRef.current.some((tab) => tab.path === previous) ? previous : (tabsRef.current[0]?.path ?? null))
|
|
4501
|
+
}
|
|
4469
4502
|
/** @private @author ddj 2026年10月08号 @param request Claimed disk or virtual open. Flushes saves without replacing dirty models. */
|
|
4470
4503
|
function openReceiptFile(request) {
|
|
4504
|
+
if (request.sheet) { openSheetDoc(request.sheet); return }
|
|
4471
4505
|
if (request.plan) { openPlanDoc(request.plan); return }
|
|
4472
4506
|
if (!request.path) return
|
|
4473
4507
|
let path = receiptTabPath(request.path, cwd)
|
|
@@ -4523,6 +4557,8 @@ export function EditorView(props) {
|
|
|
4523
4557
|
const host = viewRootRef.current?.querySelector('.edrv-uv-host')
|
|
4524
4558
|
return request.sessionId === sessionId && sameFile(active, request.path) && host?.getAttribute('data-univer-path') === active
|
|
4525
4559
|
}
|
|
4560
|
+
if (request.sheet) return request.sessionId === sessionId && sheetActive === request.sheet.id
|
|
4561
|
+
&& sheetHostRef.current?.getAttribute('data-sheet-id') === request.sheet.id
|
|
4526
4562
|
if (request.plan) return request.sessionId === sessionId && planActive === request.plan.address
|
|
4527
4563
|
&& planTabs.some((item) => item.address === request.plan.address && item.markdown === request.plan.markdown)
|
|
4528
4564
|
&& planHostRef.current?.getAttribute('data-plan-address') === request.plan.address
|
|
@@ -4530,6 +4566,7 @@ export function EditorView(props) {
|
|
|
4530
4566
|
}
|
|
4531
4567
|
/** @private @author ddj 2026年09月28号 @param request Claimed target. @returns Only its current load/render error. */
|
|
4532
4568
|
function receiptError(request) {
|
|
4569
|
+
if (request.sheet) return request.sheet.id ? null : '验收单 id 无效'
|
|
4533
4570
|
if (request.plan) return planDocument(request.plan.address, request.plan) ? null : '计划内容或资源地址无效'
|
|
4534
4571
|
return receiptErrorFor(request, receiptView(request))
|
|
4535
4572
|
}
|
|
@@ -4847,9 +4884,9 @@ export function EditorView(props) {
|
|
|
4847
4884
|
// 页面工具列固定在行尾(滚动区之外,横滚不带走)。焦点落在浮窗时,这一行仍留在页面分组上,
|
|
4848
4885
|
// 避免整条工具栏跟着搬进浮窗;页签缓存 ref 只认页面上的这条行。
|
|
4849
4886
|
const chrome = !floating && id === rowOwner
|
|
4850
|
-
//
|
|
4851
|
-
const hideDiskActive = Boolean(planActive) && (chrome || focused)
|
|
4852
|
-
return React.createElement(EditorPane, { key: id, group, focused, dirty: dirtyMap, suppressActive: hideDiskActive, previewActive: chrome ? planActive : undefined, tabsRef: chrome ? tabsHostRef : undefined, extras: chrome ?
|
|
4887
|
+
// 计划预览 / 验收单占用的正文只会在焦点组里;承载页签行的组同时收起磁盘选中态,保证整屏只有一条下划线。
|
|
4888
|
+
const hideDiskActive = Boolean(planActive || sheetActive) && (chrome || focused)
|
|
4889
|
+
return React.createElement(EditorPane, { key: id, group, focused, dirty: dirtyMap, suppressActive: hideDiskActive, previewActive: chrome ? (planActive ?? sheetActive) : undefined, tabsRef: chrome ? tabsHostRef : undefined, extras: chrome ? tabExtras : undefined, tools: chrome ? rowTools : undefined, onSelect: selectGroup, onClose: closeTab, onMenu: paneMenu, onDrag: dragTab, consumeClick: consumeDrag },
|
|
4853
4890
|
focused ? React.createElement('div', { className: 'edrv-full-slot', ref: mountFull }) : React.createElement(React.Fragment, null,
|
|
4854
4891
|
React.createElement(GroupPathbar, { path: group.active, onFocus: () => selectGroup(id) }),
|
|
4855
4892
|
React.createElement(PassiveEditor, { key: JSON.stringify([scope, sessionId, group.active]), path: group.active, groupId: id, mount: passiveMount })))
|
|
@@ -4870,12 +4907,27 @@ export function EditorView(props) {
|
|
|
4870
4907
|
}, React.createElement('span', { className: 'edrv-group-tab-name' }, plan.title),
|
|
4871
4908
|
React.createElement('span', { className: 'edrv-tab-x', title: '关闭', onClick: (event) => closePlan(plan.address, event) }, '×')))
|
|
4872
4909
|
: null
|
|
4910
|
+
const sheetTabExtras = sheetTabs.length
|
|
4911
|
+
? sheetTabs.map((sheet) => React.createElement('div', {
|
|
4912
|
+
key: 'sheet:' + sheet.id, className: 'edrv-tab edrv-tab-plan edrv-tab-sheet' + (sheet.id === sheetActive ? ' edrv-tab-active' : ''),
|
|
4913
|
+
title: sheet.title + '(测试验收单 · 数据自动刷新)', onClick: () => openSheetDoc(sheet),
|
|
4914
|
+
}, React.createElement('span', { className: 'edrv-group-tab-name' }, sheet.title),
|
|
4915
|
+
React.createElement('span', { className: 'edrv-tab-x', title: '关闭', onClick: (event) => closeSheet(sheet.id, event) }, '×')))
|
|
4916
|
+
: null
|
|
4917
|
+
// 计划页签与验收单页签共用同一条滚动区(EditorPane 的 extras):整块工作台仍然只有一行页签。
|
|
4918
|
+
const tabExtras = (planTabExtras || sheetTabExtras)
|
|
4919
|
+
? React.createElement(React.Fragment, null, planTabExtras, sheetTabExtras)
|
|
4920
|
+
: null
|
|
4873
4921
|
const openControl = openInput
|
|
4874
4922
|
? React.createElement('input', { className: 'edrv-path-input', autoFocus: true, placeholder: '输入工作区相对/绝对路径,回车打开', value: pathDraft, onChange: (e) => setPathDraft(e.target.value), onKeyDown: (e) => { if (e.key === 'Enter') openPath(); if (e.key === 'Escape') setOpenInput(false) } })
|
|
4875
4923
|
: React.createElement('button', { className: 'edrv-tab-add', title: '打开文件(输入路径)', onClick: () => setOpenInput(true) }, '+')
|
|
4876
4924
|
|
|
4877
4925
|
const activePlan = planTabs.find((plan) => plan.address === planActive)
|
|
4878
|
-
const
|
|
4926
|
+
const activeSheet = sheetTabs.find((sheet) => sheet.id === sheetActive)
|
|
4927
|
+
const pathBar = activeSheet ? React.createElement('div', { className: 'edrv-pathbar', title: 'test-check://' + activeSheet.id },
|
|
4928
|
+
React.createElement('span', { className: 'edrv-pb-name' }, activeSheet.title),
|
|
4929
|
+
React.createElement('span', { className: 'edrv-pb-meta' }, '测试验收单 · 结果随 events/ 自动刷新'))
|
|
4930
|
+
: activePlan ? React.createElement('div', { className: 'edrv-pathbar', title: activePlan.address },
|
|
4879
4931
|
React.createElement('span', { className: 'edrv-pb-name' }, activePlan.title),
|
|
4880
4932
|
React.createElement('span', { className: 'edrv-pb-meta' }, '计划预览 · 只读 · 审批请使用对话中的官方控件'))
|
|
4881
4933
|
: React.createElement('div', { className: 'edrv-pathbar', title: active || '' },
|
|
@@ -5086,7 +5138,16 @@ export function EditorView(props) {
|
|
|
5086
5138
|
const [planMarkdownFallback, setPlanMarkdownFallback] = React.useState('')
|
|
5087
5139
|
|
|
5088
5140
|
let body
|
|
5089
|
-
if (
|
|
5141
|
+
if (activeSheet) {
|
|
5142
|
+
body = React.createElement('div', { className: 'edrv-testcheck-host', ref: sheetHostRef, 'data-sheet-id': activeSheet.id },
|
|
5143
|
+
React.createElement(TestCheckPanel, {
|
|
5144
|
+
key: activeSheet.id,
|
|
5145
|
+
sessionId,
|
|
5146
|
+
cwd,
|
|
5147
|
+
id: activeSheet.id,
|
|
5148
|
+
title: activeSheet.title,
|
|
5149
|
+
}))
|
|
5150
|
+
} else if (activePlan) {
|
|
5090
5151
|
const planPanelAllowed = Boolean(activePlan.htmlPath || activePlan.htmlPlanMode)
|
|
5091
5152
|
const planFallenBack = planMarkdownFallback === activePlan.address
|
|
5092
5153
|
body = React.createElement('div', { className: 'edrv-mdview', ref: planHostRef, 'data-plan-address': activePlan.address },
|
|
@@ -5353,6 +5414,8 @@ export function EditorView(props) {
|
|
|
5353
5414
|
sessionId,
|
|
5354
5415
|
// 当前会话工作区(反应式 cwd;规则面板项目 Tab 自动匹配)
|
|
5355
5416
|
cwd: cwd ?? null,
|
|
5417
|
+
// 编辑器里正开着的验收单:测试验收面板据此认定「当前验收项」
|
|
5418
|
+
testCheckId: activeSheet?.id,
|
|
5356
5419
|
// 状态作用域键(工作区优先,无 cwd 回退会话;面板持久化统一走它)
|
|
5357
5420
|
scope,
|
|
5358
5421
|
openFile: (p) => openFile(p, false),
|
|
@@ -55,6 +55,8 @@ export interface AttachmentStageDeps {
|
|
|
55
55
|
readFile: (ref: unknown, signal?: AbortSignal) => Promise<Uint8Array>
|
|
56
56
|
/** 写一个附件(参数是工作区相对路径)。 */
|
|
57
57
|
write: (relativePath: string, bytes: Uint8Array) => Promise<void>
|
|
58
|
+
/** 落盘根目录(工作区相对路径);缺省 `plans/<slug>`,测试验收模式用它指到 `.dsh/test-check/<id>`。 */
|
|
59
|
+
root?: string
|
|
58
60
|
/** 单文件上限,默认 25 MB。 */
|
|
59
61
|
maxBytes?: number
|
|
60
62
|
/** 附件数量上限,默认 12 个。 */
|
|
@@ -287,7 +289,8 @@ function refOf(block: unknown): AttachmentRefView | null {
|
|
|
287
289
|
*/
|
|
288
290
|
export async function stageAttachments(deps: AttachmentStageDeps): Promise<AttachmentStage> {
|
|
289
291
|
const slug = String(deps.slug ?? '')
|
|
290
|
-
const
|
|
292
|
+
const root = typeof deps.root === 'string' && deps.root.trim() ? deps.root.trim().replace(/\/+$/, '') : 'plans/' + slug
|
|
293
|
+
const dir = root + '/' + ATTACHMENTS_DIR
|
|
291
294
|
const maxBytes = deps.maxBytes ?? MAX_ATTACHMENT_BYTES
|
|
292
295
|
const maxCount = deps.maxCount ?? MAX_ATTACHMENTS
|
|
293
296
|
const files: StagedAttachment[] = []
|
package/src/htmlPlanCommand.ts
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
* 处理器把字节复制到 `plans/<slug>/assets/`(作者页可引用),并把路径写进送给模型的任务消息。
|
|
10
10
|
* @author ddj 2026年11月25号
|
|
11
11
|
*/
|
|
12
|
-
import { mkdir,
|
|
12
|
+
import { mkdir, writeFile } from 'node:fs/promises'
|
|
13
13
|
import { dirname, join } from 'node:path'
|
|
14
|
-
import { log } from './log.js'
|
|
15
14
|
import { cwdOfSession, type Ctx } from './store.js'
|
|
16
|
-
import { attachmentLines, slugFromTask, stageAttachments
|
|
15
|
+
import { attachmentLines, slugFromTask, stageAttachments } from './htmlPlanAttachments.js'
|
|
16
|
+
import { readChunks, rollbackFiles, toBytes } from './attachmentBytes.js'
|
|
17
17
|
import { HTML_PLAN_COMMAND } from './shared/htmlPlanMode.js'
|
|
18
18
|
|
|
19
19
|
//region 命令元信息
|
|
@@ -120,64 +120,6 @@ function messageOf(error: unknown): string {
|
|
|
120
120
|
return String(error ?? '未知错误')
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
/**
|
|
124
|
-
* 把流式字节拼成一个 Uint8Array(附件可能是任意长度,不假设单块)。
|
|
125
|
-
* @author ddj 2026年11月25号
|
|
126
|
-
* @param source 按顺序产出的字节块
|
|
127
|
-
* @returns 拼接后的字节
|
|
128
|
-
*/
|
|
129
|
-
async function readChunks(source: AsyncIterable<Uint8Array>): Promise<Uint8Array> {
|
|
130
|
-
const parts: Uint8Array[] = []
|
|
131
|
-
let total = 0
|
|
132
|
-
for await (const part of source) {
|
|
133
|
-
parts.push(part)
|
|
134
|
-
total += part.byteLength
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
const merged = new Uint8Array(total)
|
|
138
|
-
let offset = 0
|
|
139
|
-
for (const part of parts) {
|
|
140
|
-
merged.set(part, offset)
|
|
141
|
-
offset += part.byteLength
|
|
142
|
-
}
|
|
143
|
-
return merged
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* 归一化附件存储返回的字节。
|
|
148
|
-
* @author ddj 2026年11月25号
|
|
149
|
-
* @param value 服务返回值
|
|
150
|
-
* @returns 字节视图
|
|
151
|
-
* @throws 无法识别时抛错(由上层记入 skipped)
|
|
152
|
-
*/
|
|
153
|
-
function toBytes(value: unknown): Uint8Array {
|
|
154
|
-
if (value instanceof Uint8Array) return value
|
|
155
|
-
if (value instanceof ArrayBuffer) return new Uint8Array(value)
|
|
156
|
-
if (ArrayBuffer.isView(value)) return new Uint8Array(value.buffer, value.byteOffset, value.byteLength)
|
|
157
|
-
throw new Error('附件存储返回了无法识别的字节')
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* 回滚本次写入的附件:逐个删除文件,再尝试移除空目录。
|
|
162
|
-
* @author ddj 2026年11月25号
|
|
163
|
-
* @param workspace 工作区绝对路径
|
|
164
|
-
* @param stage 落盘结果
|
|
165
|
-
* @returns 完成后的 Promise(单步失败只忽略)
|
|
166
|
-
*/
|
|
167
|
-
async function rollbackStage(workspace: string, stage: AttachmentStage): Promise<void> {
|
|
168
|
-
for (const file of stage.files) {
|
|
169
|
-
try {
|
|
170
|
-
await unlink(join(workspace, file.relativePath))
|
|
171
|
-
} catch {
|
|
172
|
-
/* 文件可能已被删除 */
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
try {
|
|
176
|
-
await rmdir(join(workspace, stage.dir))
|
|
177
|
-
} catch {
|
|
178
|
-
/* 目录非空或已不存在 */
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
123
|
|
|
182
124
|
/**
|
|
183
125
|
* 默认附件准备:把 composer 的图片/文件复制到 plans/<slug>/assets/。
|
|
@@ -232,7 +174,7 @@ export async function stagePlanFiles(
|
|
|
232
174
|
slug,
|
|
233
175
|
count: stage.files.length,
|
|
234
176
|
lines: attachmentLines(stage),
|
|
235
|
-
rollback: () =>
|
|
177
|
+
rollback: () => rollbackFiles(workspace, stage),
|
|
236
178
|
}
|
|
237
179
|
} catch (error) {
|
|
238
180
|
return { slug: null, count: 0, lines: ['附件读取失败:' + messageOf(error) + ';本次按无附件规划。'], rollback: async () => {} }
|
package/src/index.ts
CHANGED
|
@@ -44,6 +44,8 @@ import { createDapRpc } from './dap/rpc.js'
|
|
|
44
44
|
import { installRulesSection } from './rules.js'
|
|
45
45
|
import { installSkillGroup } from './skills.js'
|
|
46
46
|
import { installHtmlPlanMode } from './htmlPlanMode.js'
|
|
47
|
+
import { installCheckMode } from './testCheckMode.js'
|
|
48
|
+
import { disposeTestCheck } from './testCheckStore.js'
|
|
47
49
|
import type { RpcHandlerMap, RpcMethod, RpcRequestMap } from './shared/rpc.js'
|
|
48
50
|
import type { Registry } from './registry.js'
|
|
49
51
|
import type { Ctx } from './store.js'
|
|
@@ -147,6 +149,7 @@ function attachRuntime(ctx: Ctx, runtime: Runtime): void {
|
|
|
147
149
|
loopWatch.dispose()
|
|
148
150
|
windows.dispose()
|
|
149
151
|
runtime.fileVersions.dispose()
|
|
152
|
+
disposeTestCheck()
|
|
150
153
|
closeArchiveDbs()
|
|
151
154
|
disposeAllServers()
|
|
152
155
|
const tasks = [() => runtime.lspManager.disposeAll(), () => runtime.svnRpc.dispose(), () => runtime.dapRpc.dispose()]
|
|
@@ -186,6 +189,7 @@ export async function apply(ctx: Ctx, config?: unknown): Promise<void> {
|
|
|
186
189
|
attachRuntime(ctx, runtime)
|
|
187
190
|
installContent(ctx)
|
|
188
191
|
if (!installHtmlPlanMode(ctx)) log.warn('/html-plan 未调度:DSH 未提供 ctx.inject')
|
|
192
|
+
if (!installCheckMode(ctx)) log.warn('/test-check 未调度:DSH 未提供 ctx.inject')
|
|
189
193
|
/** @author ddj 2026年09月28号 @param method RPC name. @param args Typed request. @returns RPC result. */
|
|
190
194
|
function dispatch<M extends RpcMethod>(method: M, args: RpcRequestMap[M]) {
|
|
191
195
|
const { registry, searcher, contentSearcher, lspRpc, aiRpc, fileVersions, svnRpc, dapRpc } = runtime
|
package/src/rpc.ts
CHANGED
|
@@ -74,6 +74,7 @@ import { createTextPages } from './textPages.js'
|
|
|
74
74
|
import { reviewHandlers } from './reviewRpc.js'
|
|
75
75
|
import { pendingHandlers } from './pendingRpc.js'
|
|
76
76
|
import { univerHandlers } from './univerRpc.js'
|
|
77
|
+
import { checkHandlers } from './testCheckRpc.js'
|
|
77
78
|
import { fileAbsent, missingReview, missingDecide, missingPath, refusalCodeOf } from './missingReview.js'
|
|
78
79
|
import { pendingCovers } from './pendingCompat.js'
|
|
79
80
|
import { runReplace } from './search/replaceRun.js'
|
|
@@ -750,6 +751,8 @@ export function buildHandlers(
|
|
|
750
751
|
...(reviewHandlers(ctx, registry) as RpcHandlerMap),
|
|
751
752
|
...(pendingHandlers(ctx, registry) as RpcHandlerMap),
|
|
752
753
|
...(univerHandlers(ctx) as RpcHandlerMap),
|
|
754
|
+
// edrv.testCheck.* 由 checkHandlers 提供(验收单视图/上报/导出),这里并入。
|
|
755
|
+
...(checkHandlers(ctx) as RpcHandlerMap),
|
|
753
756
|
'edrv.list': async (args) => {
|
|
754
757
|
// #region debug log
|
|
755
758
|
const start = performance.now()
|
package/src/shared/rpc.ts
CHANGED
|
@@ -33,6 +33,17 @@ import type {
|
|
|
33
33
|
PendingDecide, PendingDetail, PendingHistoryMove,
|
|
34
34
|
PendingItem, PendingPage, PendingRemove, PendingRequest,
|
|
35
35
|
} from './pendingReview.js'
|
|
36
|
+
import type { TestCheckSheetSummary, TestCheckView } from './testCheck.js'
|
|
37
|
+
|
|
38
|
+
/** 项目测试规范读写结果(三个 policy 方法共用)。 */
|
|
39
|
+
export interface TestCheckPolicyPayload {
|
|
40
|
+
/** 规范文件绝对路径(`<项目根>/.dsh/test-check/policy.md`)。 */
|
|
41
|
+
path: string
|
|
42
|
+
/** 当前生效正文(有文件用文件内容,否则默认规则;超 8 KB 已截断)。 */
|
|
43
|
+
text: string
|
|
44
|
+
/** true = 用的是默认规则(文件不存在或空白)。 */
|
|
45
|
+
isDefault: boolean
|
|
46
|
+
}
|
|
36
47
|
|
|
37
48
|
/** webServer 精确路由。 */
|
|
38
49
|
export const RPC_PATH = '/edrv/rpc'
|
|
@@ -585,6 +596,30 @@ export interface RpcRequestMap {
|
|
|
585
596
|
'edrv.planPage.render': { sessionId?: string; markdown: string }
|
|
586
597
|
/** HTML 计划模式:把作者页用技能 pack.mjs 打包成单文件 HTML(只写系统临时文件)。 */
|
|
587
598
|
'edrv.planPage.pack': { sessionId?: string; path: string }
|
|
599
|
+
/** 测试验收模式:读派生视图(页签与 chip 轮询;force 跳过缓存)。 */
|
|
600
|
+
'edrv.testCheck.get': { sessionId?: string; id?: string; force?: boolean }
|
|
601
|
+
/** 测试验收模式:手动上报一条结果(页签工具栏;summary 就是证据)。 */
|
|
602
|
+
'edrv.testCheck.report': {
|
|
603
|
+
sessionId?: string
|
|
604
|
+
id: string
|
|
605
|
+
item: string
|
|
606
|
+
status: 'pass' | 'fail' | 'blocked' | 'skip'
|
|
607
|
+
summary: string
|
|
608
|
+
}
|
|
609
|
+
/** 测试验收模式:导出交付快照到 docs/acceptance-<id>.html。 */
|
|
610
|
+
'edrv.testCheck.snapshot': { sessionId?: string; id: string }
|
|
611
|
+
/** 测试验收模式:读项目测试规范(有文件用文件,否则默认规则)。 */
|
|
612
|
+
'edrv.testCheck.policy.get': { sessionId?: string }
|
|
613
|
+
/** 测试验收模式:保存项目测试规范(空文本=删除文件回默认)。 */
|
|
614
|
+
'edrv.testCheck.policy.save': { sessionId?: string; text: string }
|
|
615
|
+
/** 测试验收模式:重置项目测试规范(删文件回默认)。 */
|
|
616
|
+
'edrv.testCheck.policy.reset': { sessionId?: string }
|
|
617
|
+
/** 测试验收模式:读随包技能正文(面板只读展示)。 */
|
|
618
|
+
'edrv.testCheck.skill': {}
|
|
619
|
+
/** 测试验收模式:列出项目内全部验收单与快照状态(force 跳过 30 秒列表缓存)。 */
|
|
620
|
+
'edrv.testCheck.sheets': { sessionId?: string; force?: boolean }
|
|
621
|
+
/** 测试验收模式:删除一张验收单目录与对应快照。 */
|
|
622
|
+
'edrv.testCheck.remove': { sessionId?: string; id: string }
|
|
588
623
|
}
|
|
589
624
|
|
|
590
625
|
export type RpcMethod = keyof RpcRequestMap
|
|
@@ -789,6 +824,15 @@ export interface RpcOkMap {
|
|
|
789
824
|
'edrv.uiState.set': object
|
|
790
825
|
'edrv.planPage.render': { html: string }
|
|
791
826
|
'edrv.planPage.pack': { html: string }
|
|
827
|
+
'edrv.testCheck.get': { view: TestCheckView }
|
|
828
|
+
'edrv.testCheck.report': { view: TestCheckView; filed: string }
|
|
829
|
+
'edrv.testCheck.snapshot': { path: string; view: TestCheckView }
|
|
830
|
+
'edrv.testCheck.policy.get': TestCheckPolicyPayload
|
|
831
|
+
'edrv.testCheck.policy.save': TestCheckPolicyPayload
|
|
832
|
+
'edrv.testCheck.policy.reset': TestCheckPolicyPayload
|
|
833
|
+
'edrv.testCheck.skill': { name: string; path: string; content: string }
|
|
834
|
+
'edrv.testCheck.sheets': { root: string; sheets: TestCheckSheetSummary[] }
|
|
835
|
+
'edrv.testCheck.remove': { removed: string[] }
|
|
792
836
|
}
|
|
793
837
|
|
|
794
838
|
/** 缺失文件预览的稳定拒绝码:客户端据此显示「已删除」终态,而不是把错误原文当加载失败重试。 */
|