dsh-vscode-mode 0.39.0 → 0.41.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 +11 -8
- 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/skills/dsh-vscodemode-ui-kit/SKILL.md +84 -0
- package/skills/dsh-vscodemode-ui-kit/fixtures/selftest/spec.json +65 -0
- package/skills/dsh-vscodemode-ui-kit/references/detect.md +90 -0
- package/skills/dsh-vscodemode-ui-kit/references/lib.md +48 -0
- package/skills/dsh-vscodemode-ui-kit/references/questions.md +68 -0
- package/skills/dsh-vscodemode-ui-kit/references/spec.md +99 -0
- package/skills/dsh-vscodemode-ui-kit/references/verify.md +37 -0
- package/skills/dsh-vscodemode-ui-kit/runtime/build.mjs +348 -0
- package/skills/dsh-vscodemode-ui-kit/runtime/css/framework.css +398 -0
- package/skills/dsh-vscodemode-ui-kit/runtime/js/01-core.js +182 -0
- package/skills/dsh-vscodemode-ui-kit/runtime/js/02-state.js +96 -0
- package/skills/dsh-vscodemode-ui-kit/runtime/js/03-tree.js +144 -0
- package/skills/dsh-vscodemode-ui-kit/runtime/js/04-canvas.js +194 -0
- package/skills/dsh-vscodemode-ui-kit/runtime/js/05-inspector.js +241 -0
- package/skills/dsh-vscodemode-ui-kit/runtime/js/06-diff.js +52 -0
- package/skills/dsh-vscodemode-ui-kit/runtime/js/07-reply.js +71 -0
- package/skills/dsh-vscodemode-ui-kit/runtime/js/08-main.js +147 -0
- package/skills/dsh-vscodemode-ui-kit/runtime/spec.schema.json +79 -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
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* 07 · 回传:一句人话 + json 代码块,优先走计划签通道,否则复制 */
|
|
2
|
+
(function (UK) {
|
|
3
|
+
'use strict'
|
|
4
|
+
|
|
5
|
+
UK.buildPatch = function () {
|
|
6
|
+
var st = UK.state
|
|
7
|
+
var patch = { v: 1, page: 'design', base: st.baseHash, ops: UK.clone(st.ops) }
|
|
8
|
+
if (st.note) patch.note = st.note
|
|
9
|
+
return patch
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
UK.replyText = function () {
|
|
13
|
+
var st = UK.state
|
|
14
|
+
var head = st.note || ('设计页改了 ' + st.ops.length + ' 处:' + (st.ops.length ? UK.opLabel(st.ops[0]) : '无'))
|
|
15
|
+
return head + '\n\n```json\n' + JSON.stringify(UK.buildPatch(), null, 2) + '\n```\n'
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
UK.copyText = function (text) {
|
|
19
|
+
var done = function (ok) {
|
|
20
|
+
UK.flash(ok ? '已复制,粘进对话就行' : '复制失败:手动选中抽屉里的 patch')
|
|
21
|
+
}
|
|
22
|
+
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
23
|
+
navigator.clipboard.writeText(text).then(function () { done(true) }, function () { legacyCopy(text, done) })
|
|
24
|
+
} else {
|
|
25
|
+
legacyCopy(text, done)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function legacyCopy(text, done) {
|
|
30
|
+
try {
|
|
31
|
+
var area = document.createElement('textarea')
|
|
32
|
+
area.value = text
|
|
33
|
+
area.style.position = 'fixed'
|
|
34
|
+
area.style.left = '-9999px'
|
|
35
|
+
document.body.appendChild(area)
|
|
36
|
+
area.select()
|
|
37
|
+
var ok = document.execCommand('copy')
|
|
38
|
+
area.remove()
|
|
39
|
+
done(ok)
|
|
40
|
+
} catch (e) {
|
|
41
|
+
done(false)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
UK.sendReply = function () {
|
|
46
|
+
var text = UK.replyText()
|
|
47
|
+
var sent = false
|
|
48
|
+
try {
|
|
49
|
+
if (window.parent && window.parent !== window) {
|
|
50
|
+
window.parent.postMessage({ source: 'edrv-htmlplan', type: 'respond', text: text }, '*')
|
|
51
|
+
sent = true
|
|
52
|
+
}
|
|
53
|
+
} catch (e) {
|
|
54
|
+
sent = false
|
|
55
|
+
}
|
|
56
|
+
if (sent) {
|
|
57
|
+
UK.flash('已发送到对话输入框')
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
UK.copyText(text)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
UK.flash = function (message) {
|
|
64
|
+
var el = document.getElementById('uk-flash')
|
|
65
|
+
if (!el) return
|
|
66
|
+
el.textContent = message
|
|
67
|
+
el.style.opacity = '1'
|
|
68
|
+
clearTimeout(UK.__flashTimer)
|
|
69
|
+
UK.__flashTimer = setTimeout(function () { el.style.opacity = '0' }, 2600)
|
|
70
|
+
}
|
|
71
|
+
})(window.__UIKIT__ = window.__UIKIT__ || {})
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/* 08 · 外壳与启动:三栏、底栏、键盘 */
|
|
2
|
+
(function (UK) {
|
|
3
|
+
'use strict'
|
|
4
|
+
|
|
5
|
+
var hosts = {}
|
|
6
|
+
var started = false
|
|
7
|
+
|
|
8
|
+
UK.renderAll = function () {
|
|
9
|
+
if (!started) return
|
|
10
|
+
UK.renderTree(hosts.tree)
|
|
11
|
+
UK.renderCanvas(hosts.stage)
|
|
12
|
+
UK.renderInspector(hosts.insp)
|
|
13
|
+
UK.renderDiff(hosts.drawer)
|
|
14
|
+
UK.renderBar()
|
|
15
|
+
UK.renderStatusLine()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
UK.renderBar = function () {
|
|
19
|
+
var st = UK.state
|
|
20
|
+
if (hosts.zoom) hosts.zoom.textContent = Math.round(st.zoom * 100) + '%'
|
|
21
|
+
if (hosts.opcount) hosts.opcount.textContent = String(st.ops.length)
|
|
22
|
+
if (hosts.opcount) hosts.opcount.parentNode.classList.toggle('ui-dirty', st.ops.length > 0)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
UK.renderStatusLine = function () {
|
|
26
|
+
var st = UK.state
|
|
27
|
+
var node = UK.selectedNode()
|
|
28
|
+
var total = (st.spec.nodes || []).length
|
|
29
|
+
if (!hosts.status) return
|
|
30
|
+
hosts.status.textContent = node
|
|
31
|
+
? '已选 ' + node.id + ' · rect ' + (node.rect || []).join(', ') + ' · 共 ' + total + ' 个节点'
|
|
32
|
+
: '未选中 · 共 ' + total + ' 个节点 · 滚轮缩放,空白拖动平移'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function buildShell(app) {
|
|
36
|
+
var st = UK.state
|
|
37
|
+
var screen = st.spec.screen || { name: '未命名', w: 1080, h: 1920 }
|
|
38
|
+
app.className = 'ui-app'
|
|
39
|
+
|
|
40
|
+
var zoomChip = UK.el('span', { class: 'ui-chip', text: '100%' })
|
|
41
|
+
var opCount = UK.el('b', { text: '0' })
|
|
42
|
+
hosts.zoom = zoomChip
|
|
43
|
+
hosts.opcount = opCount
|
|
44
|
+
|
|
45
|
+
var bar = UK.el('div', { class: 'ui-bar' }, [
|
|
46
|
+
UK.el('span', { class: 'ui-title', text: screen.name || '未命名' }),
|
|
47
|
+
UK.el('span', { class: 'ui-meta', text: screen.w + '×' + screen.h }),
|
|
48
|
+
UK.el('span', { class: 'ui-chip', text: 'base ' + st.baseHash }),
|
|
49
|
+
UK.el('span', { style: { flex: '1' } }),
|
|
50
|
+
UK.el('button', { class: 'ui-btn ui-ghost', text: '−', title: '缩小', onclick: function () { UK.setZoom(st.zoom / 1.2, null) } }),
|
|
51
|
+
zoomChip,
|
|
52
|
+
UK.el('button', { class: 'ui-btn ui-ghost', text: '+', title: '放大', onclick: function () { UK.setZoom(st.zoom * 1.2, null) } }),
|
|
53
|
+
UK.el('button', { class: 'ui-btn', text: '适应', onclick: function () { UK.fit(hosts.stage) } }),
|
|
54
|
+
UK.el('button', {
|
|
55
|
+
class: 'ui-btn', title: '查看改动与 patch',
|
|
56
|
+
onclick: function () { st.drawer = !st.drawer; UK.renderAll() }
|
|
57
|
+
}, ['改动 ', opCount])
|
|
58
|
+
])
|
|
59
|
+
|
|
60
|
+
var tree = UK.el('aside', { class: 'ui-pane ui-tree', id: 'uk-tree' })
|
|
61
|
+
var stage = UK.el('main', { class: 'ui-stage', id: 'uk-stage' })
|
|
62
|
+
var insp = UK.el('aside', { class: 'ui-pane ui-insp', id: 'uk-insp' })
|
|
63
|
+
hosts.tree = tree
|
|
64
|
+
hosts.stage = stage
|
|
65
|
+
hosts.insp = insp
|
|
66
|
+
|
|
67
|
+
var status = UK.el('span', { class: 'ui-status', text: '' })
|
|
68
|
+
hosts.status = status
|
|
69
|
+
var foot = UK.el('div', { class: 'ui-foot' }, [
|
|
70
|
+
status,
|
|
71
|
+
UK.el('span', { class: 'ui-chip', text: '设计页不落盘,提交回传 patch' }),
|
|
72
|
+
UK.el('button', { class: 'ui-btn', text: '撤销全部', onclick: function () { UK.resetOps() } }),
|
|
73
|
+
UK.el('button', { class: 'ui-btn ui-primary', text: '提交改动', onclick: function () { UK.state.drawer = true; UK.renderAll() } })
|
|
74
|
+
])
|
|
75
|
+
|
|
76
|
+
var drawer = UK.el('div', { class: 'ui-drawer', id: 'uk-drawer', hidden: 'hidden' })
|
|
77
|
+
hosts.drawer = drawer
|
|
78
|
+
|
|
79
|
+
var flash = UK.el('div', {
|
|
80
|
+
id: 'uk-flash',
|
|
81
|
+
style: {
|
|
82
|
+
position: 'fixed', left: '50%', bottom: '56px', transform: 'translateX(-50%)',
|
|
83
|
+
background: '#24211d', color: '#fff', padding: '6px 12px', 'border-radius': '6px',
|
|
84
|
+
font: '12px/1.4 system-ui, sans-serif', opacity: '0', transition: 'opacity .18s',
|
|
85
|
+
'pointer-events': 'none', 'z-index': '80'
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
app.appendChild(bar)
|
|
90
|
+
app.appendChild(UK.el('div', { class: 'ui-body' }, [tree, stage, insp]))
|
|
91
|
+
app.appendChild(foot)
|
|
92
|
+
app.appendChild(drawer)
|
|
93
|
+
app.appendChild(flash)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function bindKeys() {
|
|
97
|
+
window.addEventListener('keydown', function (e) {
|
|
98
|
+
var tag = (e.target && e.target.tagName) || ''
|
|
99
|
+
var typing = tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT'
|
|
100
|
+
if (typing) return
|
|
101
|
+
|
|
102
|
+
var node = UK.selectedNode()
|
|
103
|
+
if (e.key === 'Escape') { UK.closeMenu(); UK.select(null); return }
|
|
104
|
+
if ((e.ctrlKey || e.metaKey) && e.key === 'z') {
|
|
105
|
+
e.preventDefault()
|
|
106
|
+
if (UK.state.ops.length) UK.removeOp(UK.state.ops.length - 1)
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
if (!node) return
|
|
110
|
+
|
|
111
|
+
if (e.key === 'Delete' || e.key === 'Backspace') {
|
|
112
|
+
e.preventDefault()
|
|
113
|
+
UK.deleteNode(node.id)
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
var step = e.shiftKey ? 10 : 1
|
|
117
|
+
var dx = 0, dy = 0
|
|
118
|
+
if (e.key === 'ArrowLeft') dx = -step
|
|
119
|
+
else if (e.key === 'ArrowRight') dx = step
|
|
120
|
+
else if (e.key === 'ArrowUp') dy = -step
|
|
121
|
+
else if (e.key === 'ArrowDown') dy = step
|
|
122
|
+
else return
|
|
123
|
+
e.preventDefault()
|
|
124
|
+
var rect = (node.rect || [0, 0, 4, 4]).slice()
|
|
125
|
+
rect[0] = rect[0] + dx
|
|
126
|
+
rect[1] = rect[1] + dy
|
|
127
|
+
UK.commit({ op: 'set', id: node.id, field: 'rect', value: rect })
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function boot() {
|
|
132
|
+
var app = document.getElementById('app')
|
|
133
|
+
if (!app) return
|
|
134
|
+
if (!window.__UIKIT__ || !UK.state) return
|
|
135
|
+
buildShell(app)
|
|
136
|
+
started = true
|
|
137
|
+
UK.bindStage(hosts.stage)
|
|
138
|
+
bindKeys()
|
|
139
|
+
UK.renderAll()
|
|
140
|
+
requestAnimationFrame(function () {
|
|
141
|
+
UK.fit(hosts.stage)
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot)
|
|
146
|
+
else boot()
|
|
147
|
+
})(window.__UIKIT__ = window.__UIKIT__ || {})
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "ui-kit spec v1",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"required": ["v", "screen", "nodes"],
|
|
6
|
+
"additionalProperties": true,
|
|
7
|
+
"properties": {
|
|
8
|
+
"v": { "const": 1 },
|
|
9
|
+
"page": { "enum": ["design", "library"], "default": "design" },
|
|
10
|
+
"hash": { "type": "string", "pattern": "^[0-9a-f]{8}$" },
|
|
11
|
+
"screen": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"required": ["w", "h"],
|
|
14
|
+
"properties": {
|
|
15
|
+
"name": { "type": "string" },
|
|
16
|
+
"w": { "type": "number", "exclusiveMinimum": 0 },
|
|
17
|
+
"h": { "type": "number", "exclusiveMinimum": 0 }
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"mock": {
|
|
21
|
+
"type": ["object", "null"],
|
|
22
|
+
"required": ["src"],
|
|
23
|
+
"properties": {
|
|
24
|
+
"src": { "type": "string" },
|
|
25
|
+
"w": { "type": "number" },
|
|
26
|
+
"h": { "type": "number" },
|
|
27
|
+
"scale": { "type": "number", "default": 1 }
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"nodes": {
|
|
31
|
+
"type": "array",
|
|
32
|
+
"items": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"required": ["id", "kind", "rect"],
|
|
35
|
+
"properties": {
|
|
36
|
+
"id": { "type": "string", "pattern": "^[^/][^\\s]*$" },
|
|
37
|
+
"parent": { "type": ["string", "null"] },
|
|
38
|
+
"kind": { "enum": ["group", "text", "image", "sprite", "button", "list", "prefab"] },
|
|
39
|
+
"rect": {
|
|
40
|
+
"type": "array",
|
|
41
|
+
"minItems": 4,
|
|
42
|
+
"maxItems": 4,
|
|
43
|
+
"items": { "type": "number" }
|
|
44
|
+
},
|
|
45
|
+
"anchor": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"properties": {
|
|
48
|
+
"min": { "type": "array", "minItems": 2, "maxItems": 2, "items": { "type": "number" } },
|
|
49
|
+
"max": { "type": "array", "minItems": 2, "maxItems": 2, "items": { "type": "number" } },
|
|
50
|
+
"pivot": { "type": "array", "minItems": 2, "maxItems": 2, "items": { "type": "number" } }
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"text": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"required": ["s"],
|
|
56
|
+
"properties": {
|
|
57
|
+
"s": { "type": "string" },
|
|
58
|
+
"size": { "type": "number" },
|
|
59
|
+
"color": { "type": "string" },
|
|
60
|
+
"align": { "enum": ["left", "center", "right"] }
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"bind": { "type": "string" },
|
|
64
|
+
"ref": { "type": "string", "pattern": "^lib:" },
|
|
65
|
+
"params": { "type": "object" },
|
|
66
|
+
"prefab": { "type": "string" },
|
|
67
|
+
"opaque": { "type": "boolean" },
|
|
68
|
+
"src": { "type": "string" }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"allOf": [
|
|
74
|
+
{
|
|
75
|
+
"if": { "properties": { "page": { "const": "design" } } },
|
|
76
|
+
"then": { "required": ["nodes"] }
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-vscode-mode host — 附件字节处理(`/html-plan` 与 `/test-check` 共用)。
|
|
3
|
+
*
|
|
4
|
+
* 两个命令都要把 composer 里的图片/文件落盘到自己的子目录,差别只在目标目录与说明文案;
|
|
5
|
+
* 读流拼字节、归一字节类型、失败回滚这三段完全一致,所以抽在这里,避免复制两份后各自跑偏。
|
|
6
|
+
* @author ddj 2026年11月25号
|
|
7
|
+
*/
|
|
8
|
+
import { rmdir, unlink } from 'node:fs/promises'
|
|
9
|
+
import { join } from 'node:path'
|
|
10
|
+
|
|
11
|
+
//region 读取
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 把流式字节拼成一个 Uint8Array(附件可能是任意长度,不假设单块)。
|
|
15
|
+
* @author ddj 2026年11月25号
|
|
16
|
+
* @param source 按顺序产出的字节块
|
|
17
|
+
* @returns 拼接后的字节
|
|
18
|
+
*/
|
|
19
|
+
export async function readChunks(source: AsyncIterable<Uint8Array>): Promise<Uint8Array> {
|
|
20
|
+
const parts: Uint8Array[] = []
|
|
21
|
+
let total = 0
|
|
22
|
+
for await (const part of source) {
|
|
23
|
+
parts.push(part)
|
|
24
|
+
total += part.byteLength
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const merged = new Uint8Array(total)
|
|
28
|
+
let offset = 0
|
|
29
|
+
for (const part of parts) {
|
|
30
|
+
merged.set(part, offset)
|
|
31
|
+
offset += part.byteLength
|
|
32
|
+
}
|
|
33
|
+
return merged
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 归一化附件存储返回的字节。
|
|
38
|
+
* @author ddj 2026年11月25号
|
|
39
|
+
* @param value 服务返回值
|
|
40
|
+
* @returns 字节视图
|
|
41
|
+
* @throws 无法识别时抛错(由上层记入 skipped)
|
|
42
|
+
*/
|
|
43
|
+
export function toBytes(value: unknown): Uint8Array {
|
|
44
|
+
if (value instanceof Uint8Array) return value
|
|
45
|
+
if (value instanceof ArrayBuffer) return new Uint8Array(value)
|
|
46
|
+
if (ArrayBuffer.isView(value)) return new Uint8Array(value.buffer, value.byteOffset, value.byteLength)
|
|
47
|
+
throw new Error('附件存储返回了无法识别的字节')
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//endregion
|
|
51
|
+
|
|
52
|
+
//region 回滚
|
|
53
|
+
|
|
54
|
+
/** 回滚需要的落盘结果(只要路径与目录名)。 */
|
|
55
|
+
export interface StagedFiles {
|
|
56
|
+
/** 已写入文件的工作区相对路径。 */
|
|
57
|
+
files: ReadonlyArray<{ relativePath: string }>
|
|
58
|
+
/** assets 目录(工作区相对路径)。 */
|
|
59
|
+
dir: string
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 回滚本次写入的附件:逐个删除文件,再尝试移除空目录。
|
|
64
|
+
* @author ddj 2026年11月25号
|
|
65
|
+
* @param workspace 工作区绝对路径
|
|
66
|
+
* @param stage 落盘结果
|
|
67
|
+
* @returns 完成后的 Promise(单步失败只忽略)
|
|
68
|
+
*/
|
|
69
|
+
export async function rollbackFiles(workspace: string, stage: StagedFiles): Promise<void> {
|
|
70
|
+
for (const file of stage.files) {
|
|
71
|
+
try {
|
|
72
|
+
await unlink(join(workspace, file.relativePath))
|
|
73
|
+
} catch {
|
|
74
|
+
/* 文件可能已被删除 */
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
await rmdir(join(workspace, stage.dir))
|
|
79
|
+
} catch {
|
|
80
|
+
/* 目录非空或已不存在 */
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
//endregion
|
package/src/client/index.ts
CHANGED
|
@@ -47,6 +47,7 @@ import { setNativeCsv, setNativeOpenHandler, resetNativeOpen } from './nativeOpe
|
|
|
47
47
|
import { hasOfficialHtmlPreview, installHtmlPreviewProbe, isHtmlPath } from './htmlPreview.js'
|
|
48
48
|
import { installHtmlPlanActions } from './htmlPlan/planActions.js'
|
|
49
49
|
import { installHtmlPlanModeChip } from './htmlPlan/HtmlPlanModeChip.js'
|
|
50
|
+
import { installCheckChip } from './testCheck/TestCheckChip.js'
|
|
50
51
|
import { setFeaturePrefs } from './featurePrefs.js'
|
|
51
52
|
import { SideEditorTab } from './ui/SideEditorTab.js'
|
|
52
53
|
import { OfficialSideTab } from './ui/OfficialSideTab.js'
|
|
@@ -64,6 +65,7 @@ import { createSearchPanel } from './sidebar/panels/index.js'
|
|
|
64
65
|
import { createRulesPanel } from './sidebar/panels/index.js'
|
|
65
66
|
import { createSvnPanel } from './sidebar/panels/index.js'
|
|
66
67
|
import { createDebugPanel } from './sidebar/panels/index.js'
|
|
68
|
+
import { createTestCheckPanel } from './sidebar/panels/TestCheckPanel.js'
|
|
67
69
|
import { createTreeMenuRegistry } from './sidebar/contextMenu.js'
|
|
68
70
|
import { createDefaultFileMenuItems } from './sidebar/menuItems.js'
|
|
69
71
|
import { createOutlinePanel } from './outline/index.js'
|
|
@@ -336,6 +338,8 @@ export async function apply(ctx: any): Promise<void> {
|
|
|
336
338
|
ctx.effect(() => installHtmlPlanActions(ctx), 'vscode-mode: html plan actions')
|
|
337
339
|
// HTML 计划模式 chip:输入框工具行的 list 槽,模式活跃时出现,点击执行 /html-plan off。
|
|
338
340
|
ctx.effect(() => installHtmlPlanModeChip(ctx), 'vscode-mode: html plan mode chip')
|
|
341
|
+
// 测试验收模式 chip:同一槽位,显示「验收 x/y」,点开文件编辑里的验收单页签。
|
|
342
|
+
ctx.effect(() => installCheckChip(ctx), 'vscode-mode: test-check chip')
|
|
339
343
|
// 官方代码审阅扩展位(0.2.3+):变更视图工具条与文件菜单加两条动作。
|
|
340
344
|
// 服务/slot 缺失时零注册,不影响自有 diff 面板。
|
|
341
345
|
ctx.effect(() => installOfficialReview(ctx, {
|
|
@@ -525,6 +529,8 @@ export async function apply(ctx: any): Promise<void> {
|
|
|
525
529
|
ctx.effect(() => sidebarPanels.register(createSvnPanel()), 'vscode-mode: sidebar panel svn')
|
|
526
530
|
// 调试面板:活动栏「调试」页签(VS Code 调试视图四段布局 + REPL;DAP 桥接)
|
|
527
531
|
ctx.effect(() => sidebarPanels.register(createDebugPanel()), 'vscode-mode: sidebar panel debug')
|
|
532
|
+
// 测试验收面板:活动栏「测试验收」页签(使用说明 + 专属技能 + 项目规范 + 两张验收单列表)
|
|
533
|
+
ctx.effect(() => sidebarPanels.register(createTestCheckPanel()), 'vscode-mode: sidebar panel testcheck')
|
|
528
534
|
// 客户端(重)装配对账:host 的 DapSession 常驻,而本模块状态随刷新/HMR 归零,
|
|
529
535
|
// 不对账则调试面板与暂停态 hover 静默失效(见 dapStore.resync)。
|
|
530
536
|
void dapStore.resync()
|
|
@@ -3,8 +3,10 @@ import { createRequestId } from './requestId.js'
|
|
|
3
3
|
|
|
4
4
|
import type { PlanDocument } from './planState.js'
|
|
5
5
|
|
|
6
|
-
export interface EditorRequest { requestId: string; sessionId: string; path: string | null; line?: number; column?: number; preview?: boolean; plan?: PlanDocument }
|
|
7
|
-
|
|
6
|
+
export interface EditorRequest { requestId: string; sessionId: string; path: string | null; line?: number; column?: number; preview?: boolean; plan?: PlanDocument; sheet?: SheetRef }
|
|
7
|
+
/** 测试验收单页签身份(虚拟页签,不落磁盘)。 */
|
|
8
|
+
export interface SheetRef { id: string; title: string }
|
|
9
|
+
export interface OpenOptions { preview?: boolean; plan?: PlanDocument; sheet?: SheetRef; signal?: AbortSignal; timeoutMs?: number }
|
|
8
10
|
interface Waiter { request: EditorRequest; finish: (success: boolean) => void; claimed?: boolean }
|
|
9
11
|
const waiters = new Map<string, Waiter>()
|
|
10
12
|
|
|
@@ -47,6 +49,7 @@ export function requestOpen(path: string | null, line?: number, column?: number,
|
|
|
47
49
|
const request: EditorRequest = { requestId, sessionId, path, line, column }
|
|
48
50
|
if (options.preview !== undefined) request.preview = options.preview
|
|
49
51
|
if (options.plan) request.plan = options.plan
|
|
52
|
+
if (options.sheet) request.sheet = options.sheet
|
|
50
53
|
return new Promise((resolve) => {
|
|
51
54
|
let timer: ReturnType<typeof setTimeout>
|
|
52
55
|
/** @private @author ddj 2026年09月28号 Complete once and release the deadline. */
|