@xenonbyte/da-vinci-workflow 0.1.14 → 0.1.16

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +20 -2
  2. package/README.md +41 -1
  3. package/README.zh-CN.md +42 -1
  4. package/SKILL.md +22 -0
  5. package/commands/claude/dv/design.md +8 -0
  6. package/commands/claude/dv/verify.md +2 -0
  7. package/commands/codex/prompts/dv-design.md +8 -0
  8. package/commands/codex/prompts/dv-verify.md +1 -0
  9. package/commands/gemini/dv/design.toml +8 -0
  10. package/commands/gemini/dv/verify.toml +1 -0
  11. package/docs/mcp-aware-gate-implementation.md +291 -0
  12. package/docs/mcp-aware-gate-tests.md +244 -0
  13. package/docs/mcp-aware-gate.md +246 -0
  14. package/docs/mode-use-cases.md +7 -1
  15. package/docs/prompt-presets/README.md +3 -0
  16. package/docs/prompt-presets/desktop-app.md +19 -1
  17. package/docs/prompt-presets/mobile-app.md +19 -1
  18. package/docs/prompt-presets/tablet-app.md +19 -1
  19. package/docs/prompt-presets/web-app.md +19 -1
  20. package/docs/visual-assist-presets/README.md +5 -0
  21. package/docs/workflow-examples.md +24 -5
  22. package/docs/zh-CN/mcp-aware-gate-implementation.md +290 -0
  23. package/docs/zh-CN/mcp-aware-gate-tests.md +244 -0
  24. package/docs/zh-CN/mcp-aware-gate.md +249 -0
  25. package/docs/zh-CN/mode-use-cases.md +15 -4
  26. package/docs/zh-CN/prompt-presets/README.md +3 -0
  27. package/docs/zh-CN/prompt-presets/desktop-app.md +19 -1
  28. package/docs/zh-CN/prompt-presets/mobile-app.md +19 -1
  29. package/docs/zh-CN/prompt-presets/tablet-app.md +19 -1
  30. package/docs/zh-CN/prompt-presets/web-app.md +19 -1
  31. package/docs/zh-CN/visual-assist-presets/README.md +5 -0
  32. package/docs/zh-CN/workflow-examples.md +24 -5
  33. package/lib/audit.js +348 -0
  34. package/lib/cli.js +142 -1
  35. package/lib/mcp-runtime-gate.js +342 -0
  36. package/lib/pen-persistence.js +326 -0
  37. package/lib/pencil-preflight.js +438 -0
  38. package/package.json +5 -2
  39. package/references/artifact-templates.md +28 -1
  40. package/references/checkpoints.md +75 -1
  41. package/references/design-inputs.md +2 -1
  42. package/references/pencil-design-to-code.md +16 -0
  43. package/scripts/fixtures/complex-sample.pen +295 -0
  44. package/scripts/test-mcp-runtime-gate.js +199 -0
  45. package/scripts/test-pen-persistence.js +110 -0
  46. package/scripts/test-pencil-preflight.js +153 -0
@@ -0,0 +1,244 @@
1
+ # MCP-Aware Gate 测试设计
2
+
3
+ 这份文档定义未来 MCP-aware gate 的测试覆盖设计。
4
+
5
+ 它是验证设计,不是测试实现。
6
+
7
+ ## 测试目标
8
+
9
+ 证明 MCP-aware gate:
10
+
11
+ - 能阻断假的 runtime 完成态
12
+ - 不会取代 filesystem audit
13
+ - 不会把健康的 runtime 设计会话误判成失败
14
+ - 在 runtime 信息不完整时,行为仍然可预测
15
+
16
+ ## 测试层级
17
+
18
+ 测试应覆盖三层。
19
+
20
+ ### 1. Evaluator 单元测试
21
+
22
+ 对纯 runtime-gate evaluator 输入 synthetic snapshot 做测试。
23
+
24
+ 原因:
25
+
26
+ - 反馈最快
27
+ - 可重复
28
+ - 不依赖真实 Pencil session
29
+
30
+ ### 2. Runtime 集成测试
31
+
32
+ 对 runtime-gate caller 使用真实或 fixture 化的 MCP 响应做测试。
33
+
34
+ 原因:
35
+
36
+ - 能证明 active editor 和 node 读取确实被正确解释
37
+
38
+ ### 3. 端到端工作流测试
39
+
40
+ 验证 runtime gate 和 filesystem audit 在真实工作流状态下是否能正确协作。
41
+
42
+ 原因:
43
+
44
+ - 防止 runtime gate 过了,但完成态仍然能说谎
45
+
46
+ ## 核心测试类别
47
+
48
+ ### A. 健康的 runtime source convergence
49
+
50
+ 期望:
51
+
52
+ - active editor 是有名的项目内 `.pen`
53
+ - 登记的 `.pen` 路径一致
54
+ - shell-visible `.pen` 存在
55
+ - 结果是 `PASS`
56
+
57
+ ### B. Live editor 仍然是 `new`
58
+
59
+ 期望:
60
+
61
+ - source convergence 为 `BLOCK`
62
+ - 即使 live editor 里有 screen,也不能完成
63
+
64
+ ### C. 登记的 `.pen` 在磁盘上不存在
65
+
66
+ 期望:
67
+
68
+ - source convergence 或 completion 状态变成 `BLOCK`
69
+ - runtime gate 不能把 live editor 单独当成充分条件
70
+
71
+ ### D. Live screen 存在,但没有持久化
72
+
73
+ 示例:
74
+
75
+ - active editor 中有 `Splash`、`Home`、`SafeBox`
76
+ - shell-visible `.pen` 不存在
77
+
78
+ 期望:
79
+
80
+ - runtime gate 能证明 screen 的确存在
81
+ - 但 source convergence 仍然是 `BLOCK`
82
+
83
+ ### E. 声称完成的 anchor id 缺失
84
+
85
+ 示例:
86
+
87
+ - `pencil-design.md` 声称有 `mCZ1G`
88
+ - 当前 live editor 中没有 `mCZ1G`
89
+
90
+ 期望:
91
+
92
+ - screen presence 为 `BLOCK`
93
+
94
+ ### F. Screenshot target 缺失
95
+
96
+ 期望:
97
+
98
+ - review execution 为 `BLOCK`
99
+
100
+ ### G. Review blocker 被忽略
101
+
102
+ 示例:
103
+
104
+ - screenshot review 已记录 blocker 级 layout-hygiene 问题
105
+ - 但工作流仍然把 anchor 标成 approved
106
+
107
+ 期望:
108
+
109
+ - review execution 为 `BLOCK`
110
+
111
+ ### H. Source mismatch 但有显式 reconciliation
112
+
113
+ 示例:
114
+
115
+ - active editor 路径和登记路径不同
116
+ - `pencil-design.md` 中记录了明确 reconciliation
117
+
118
+ 期望:
119
+
120
+ - 只有在 reconciliation 满足规则时,才允许 `WARN` 或 `PASS`
121
+
122
+ ### I. 还没有新的 Pencil 修改
123
+
124
+ 期望:
125
+
126
+ - runtime gate 返回 `WARN` 或 partial result
127
+ - 不能伪造 full `PASS`
128
+
129
+ ### J. Pencil MCP 不可用
130
+
131
+ 期望:
132
+
133
+ - runtime gate 报 unavailable 或 skipped
134
+ - 工作流不能把 runtime gate 视为已通过
135
+ - filesystem audit 仍然可以独立工作
136
+
137
+ ## 必须覆盖的端到端场景
138
+
139
+ ### 场景 1:Cipher 这次真实失败模式
140
+
141
+ 状态:
142
+
143
+ - active editor 是 `new`
144
+ - live screen 存在
145
+ - `.da-vinci/designs/` 被污染
146
+ - 没有 shell-visible `.pen`
147
+
148
+ 期望:
149
+
150
+ - runtime gate 阻断完成
151
+ - filesystem completion audit 也失败
152
+
153
+ ### 场景 2:健康的 redesign 完成态
154
+
155
+ 状态:
156
+
157
+ - active editor 就是登记的 `.pen`
158
+ - anchor ids 存在
159
+ - screenshot review 存在
160
+ - shell-visible `.pen` 存在
161
+ - completion audit 通过
162
+
163
+ 期望:
164
+
165
+ - runtime gate 通过
166
+ - completion audit 通过
167
+ - 允许终态完成
168
+
169
+ ### 场景 3:runtime 过了,filesystem 没过
170
+
171
+ 状态:
172
+
173
+ - active editor 正常
174
+ - shell-visible `.pen` 存在
175
+ - 但 `.da-vinci/designs/` 中混入 PNG 或 markdown
176
+
177
+ 期望:
178
+
179
+ - runtime gate 可以通过
180
+ - filesystem completion audit 失败
181
+ - 不允许终态完成
182
+
183
+ ### 场景 4:filesystem 过了,runtime 没过
184
+
185
+ 状态:
186
+
187
+ - shell-visible `.pen` 存在
188
+ - 磁盘结构也健康
189
+ - 但 active editor 仍然是 `new` 或指向别处
190
+
191
+ 期望:
192
+
193
+ - runtime gate 失败
194
+ - 不允许终态完成
195
+
196
+ ## 必须断言的内容
197
+
198
+ 每一条 runtime-gate 测试都应该断言:
199
+
200
+ - final status
201
+ - 各子层 status
202
+ - 触发的是哪条 blocking condition
203
+ - completion 是否允许继续
204
+ - 工件写入格式是否保持稳定
205
+
206
+ ## 工件记录测试
207
+
208
+ 需要验证 runtime gate 输出:
209
+
210
+ - 追加到 `pencil-design.md`
211
+ - 不会新增新的工件家族
212
+ - 不会写进 `.da-vinci/designs/`
213
+ - 不会覆盖无关 section
214
+
215
+ ## 回归场景
216
+
217
+ 这些回归必须覆盖:
218
+
219
+ 1. runtime gate 意外退化成 CLI-only audit
220
+ 2. runtime gate 静默接受 `new`
221
+ 3. runtime gate 把 PNG 当成设计源证据
222
+ 4. anchor id 缺失时 runtime gate 仍通过
223
+ 5. runtime gate 实际没跑,却被记成通过
224
+ 6. runtime gate 输出新的临时 markdown 文件到错误目录
225
+
226
+ ## 建议测试矩阵
227
+
228
+ 最小矩阵:
229
+
230
+ - form factor:先覆盖 mobile
231
+ - design stage:第一次 Pencil 写入 / anchor approved / terminal completion
232
+ - source state:healthy / `new` / diverged / missing `.pen`
233
+ - screen state:present / missing / stale ids
234
+ - review state:reviewed / missing / blocker ignored
235
+
236
+ ## Exit Criteria
237
+
238
+ 只有以下条件同时满足,才应该认为实现达标:
239
+
240
+ 1. evaluator 单元测试覆盖所有 blocker 分支
241
+ 2. 至少有一条 runtime 集成测试证明 live editor 检测可用
242
+ 3. Cipher 类失败场景被阻断
243
+ 4. 健康 redesign 场景可以通过
244
+ 5. runtime gate + filesystem audit 的双层组合,能够阻止假的终态完成
@@ -0,0 +1,249 @@
1
+ # MCP-Aware Gate 设计提案
2
+
3
+ 这份文档定义 Da Vinci 的 MCP-aware runtime gate 设计方向。
4
+
5
+ 它只是一份设计文档,不代表已经开始实现。
6
+
7
+ ## 当前状态
8
+
9
+ - 设计状态:提案中
10
+ - 可行性状态:已基于真实运行时行为做过部分验证
11
+ - 实现状态:未开始
12
+
13
+ ## 为什么需要它
14
+
15
+ 当前文件系统 `audit` 已经补上了一层重要兜底:
16
+
17
+ - 能证明项目内 `.pen` 是否真实落盘
18
+ - 能证明 `.da-vinci/designs/` 是否被污染
19
+ - 能证明截图导出是否写错目录
20
+
21
+ 但它证明不了这些 live 运行时事实:
22
+
23
+ - 当前 active Pencil editor 是否仍然是 `new`
24
+ - 声称完成的 anchor surface 是否真的存在于当前 editor
25
+ - 当前 active editor 和登记的项目内 `.pen` 是否已经收敛
26
+
27
+ 这些事实只存在于 MCP 驱动的设计会话里。
28
+
29
+ ## 已验证的可行性
30
+
31
+ 下面这些事实已经被验证为“当前可读”:
32
+
33
+ 1. 可以通过 MCP 读取 active Pencil editor。
34
+ 2. 可以通过 MCP 读取 live 顶层节点。
35
+ 3. 可以通过 MCP 读取具体 screen node id。
36
+ 4. 可以通过 shell 单独读取项目文件系统状态。
37
+
38
+ 这意味着 Da Vinci 已经可以对比:
39
+
40
+ - live editor truth
41
+ - live screen truth
42
+ - filesystem truth
43
+
44
+ 这个对比已经足够支持第一版 MCP-aware runtime gate。
45
+
46
+ ## 非目标
47
+
48
+ 这份提案不打算:
49
+
50
+ - 取代文件系统 `da-vinci audit`
51
+ - 直接把 MCP 状态暴露给 CLI
52
+ - 自动把 live editor 修复成持久化 `.pen`
53
+ - 让实现依赖未验证的 Pencil session 行为
54
+
55
+ ## 设计原则
56
+
57
+ 1. MCP-aware gate 只处理 runtime 真相。
58
+ 2. 文件系统 audit 继续作为终态持久化兜底。
59
+ 3. runtime gate 只负责阻断假进度,不负责自动修复。
60
+ 4. 设计只依赖已经验证过“当前可读”的事实。
61
+ 5. 当 Pencil MCP 不可用时,必须能优雅降级。
62
+
63
+ ## 在工作流里的位置
64
+
65
+ MCP-aware gate 应该插在两个时点:
66
+
67
+ 1. 第一次成功写入 Pencil 之后。
68
+ 2. 任何 `design complete` 或 `workflow complete` 声明之前。
69
+
70
+ 它不应该在每一个小操作后都运行。
71
+
72
+ ## 建议的 Gate 分层
73
+
74
+ ### 1. Source Convergence Gate
75
+
76
+ 目的:
77
+
78
+ - 判断 live editor、登记的 `.pen` 路径和 shell 可见 `.pen` 文件,是否已经足够收敛,可以把设计源视为可追踪
79
+
80
+ 输入:
81
+
82
+ - MCP 返回的 active Pencil editor 状态
83
+ - `design-registry.md` 中登记的 `.pen` 路径
84
+ - `.da-vinci/designs/` 下 shell 可见的 `.pen` 文件
85
+
86
+ 直接阻断条件:
87
+
88
+ - active editor 仍然是 `new` 这类未命名 live editor
89
+ - active editor 与登记的项目内设计源不一致,且没有显式记录 reconciliation
90
+ - live Pencil 工作已经发生,但 shell 上仍然没有 `.pen`
91
+ - runtime 会话明显在使用另一个设计源,而不是登记的项目级 `.pen`
92
+
93
+ 结果:
94
+
95
+ - `PASS`:设计源已收敛
96
+ - `WARN`:设计源暂时延后处理,但仍然可追踪
97
+ - `BLOCK`:设计源不稳定,不能继续
98
+
99
+ ### 2. Screen Presence Gate
100
+
101
+ 目的:
102
+
103
+ - 确认声称完成的 anchor surface 是否真的存在于当前 live editor 中
104
+
105
+ 输入:
106
+
107
+ - `pencil-design.md` 中记录的 node id 或 screen id
108
+ - 当前 MCP editor 中的顶层节点或目标节点读取结果
109
+
110
+ 直接阻断条件:
111
+
112
+ - 声称完成的 anchor screen 在当前 editor 中找不到
113
+ - 截图使用的 node id 在当前 live 文档里不存在
114
+ - 工作流声称完成的 anchor 数量已经超过当前 editor 能解释的范围
115
+
116
+ 结果:
117
+
118
+ - `PASS`:声称完成的 screen 确实存在
119
+ - `WARN`:命名有漂移,但仍能恢复映射
120
+ - `BLOCK`:设计输出无法追溯到当前 live 文档
121
+
122
+ ### 3. Review Execution Gate
123
+
124
+ 目的:
125
+
126
+ - 确认 screenshot review 真的是针对当前 live surface 做的,而不是形式化走流程
127
+
128
+ 输入:
129
+
130
+ - `pencil-design.md` 里记录的 review surface
131
+ - 当前设计会话里实际 review 的 screen id
132
+ - 当前 form factor 对应的 layout hygiene profile
133
+
134
+ 直接阻断条件:
135
+
136
+ - 一个 surface 被视为已批准,但没有任何 live screenshot review
137
+ - screenshot review 明确出现 blocker 级 layout hygiene 问题,但仍然被标成通过
138
+ - review 记录指向的 screen 在当前 active editor 里根本不存在
139
+
140
+ 结果:
141
+
142
+ - `PASS`:review 与 live 设计状态一致
143
+ - `WARN`:review 存在,但继续扩张前需要回改
144
+ - `BLOCK`:当前批准结论不可信
145
+
146
+ ## Runtime 输出格式
147
+
148
+ 这层 gate 不应该引入全新的工件类型。
149
+
150
+ 更合理的做法,是把结果追加到 `pencil-design.md` 或同类合法工件里:
151
+
152
+ ```md
153
+ ## MCP Runtime Gate
154
+ - Time:
155
+ - Active editor:
156
+ - Registered `.pen` path:
157
+ - Shell-visible `.pen` path:
158
+ - Reviewed screen ids:
159
+ - Source convergence: PASS | WARN | BLOCK
160
+ - Screen presence: PASS | WARN | BLOCK
161
+ - Review execution: PASS | WARN | BLOCK
162
+ - Notes:
163
+ ```
164
+
165
+ 这样 runtime 证据仍然附着在当前设计稿,而不是散落成新的临时文件。
166
+
167
+ ## 和 Filesystem Audit 的关系
168
+
169
+ 两者职责不同。
170
+
171
+ ### MCP-aware runtime gate
172
+
173
+ - 检查 live editor 真相
174
+ - 检查 live screen 真相
175
+ - 在假进度扩散前发现 runtime/source 不收敛
176
+
177
+ ### Filesystem audit
178
+
179
+ - 检查磁盘上的项目真相
180
+ - 检查目录卫生
181
+ - 检查完成态完整性
182
+
183
+ 建议的终态规则:
184
+
185
+ - 只有 MCP-aware runtime gate 通过,同时 filesystem completion audit 也通过,才能声明完成
186
+
187
+ ## 为什么不该先做成 CLI 功能
188
+
189
+ 当前 CLI 只能读文件系统。
190
+
191
+ 它没有 MCP transport、没有 session identity,也读不到当前 live Pencil editor。
192
+
193
+ 所以如果一上来把 MCP-aware gate 做成 CLI 功能,会在结构上不可靠。
194
+
195
+ 当前更合理的定位是:
196
+
197
+ - 作为 agent 执行的 runtime checkpoint
198
+ - 而不是独立 CLI audit mode
199
+
200
+ ## 需要避免的失败方式
201
+
202
+ 1. 把 `new` 当成已经持久化的 `.pen`
203
+ 2. 把 PNG 导出当成设计源证据
204
+ 3. 把旧 live document 的 node id 继续当成当前 editor 的事实
205
+ 4. runtime/source 不一致时静默自我“和解”
206
+ 5. 未经明确规则,就把 live editor 自动写回 `.pen`
207
+
208
+ ## 第一版最小实现范围
209
+
210
+ 第一版实现应该非常收敛。
211
+
212
+ 只做:
213
+
214
+ 1. 读取 active editor 状态
215
+ 2. 读取声称完成的 anchor screen id
216
+ 3. 和 `design-registry.md` 以及 shell-visible `.pen` 做对照
217
+ 4. 记录结构化 PASS/WARN/BLOCK 结果
218
+ 5. runtime truth 和 filesystem truth 不一致时阻断完成态
219
+
220
+ 不做:
221
+
222
+ - 自动重建 `.pen`
223
+ - 除 checkpoint 记录外的自动文件修改
224
+ - 新增面向 live runtime 的 CLI 命令
225
+
226
+ ## 仍待解答的问题
227
+
228
+ 这些问题应该在实现设计阶段解决,而不是在当前提案阶段拍板:
229
+
230
+ 1. 由哪个现有命令路由负责调用 runtime gate?
231
+ 2. runtime 证据只写进 `pencil-design.md`,还是也同步到 `design-registry.md`?
232
+ 3. editor-path mismatch 被 reconciliation 后,应如何记录才不会鼓励漂移?
233
+ 4. gate 应该按每个 approved anchor 运行,还是按每轮 design phase 运行?
234
+
235
+ ## 建议
236
+
237
+ 如果继续推进,只建议做一版收敛的 agent 执行型 MCP-aware runtime gate。
238
+
239
+ 不要顺手扩成:
240
+
241
+ - CLI transport 工程
242
+ - 自动持久化修复
243
+ - 通用 MCP session 管理
244
+
245
+ 当前已经验证过的稳妥路径是:
246
+
247
+ 1. 保留 filesystem `audit` 作为持久化和终态兜底
248
+ 2. 增加 runtime MCP-aware gate,专门处理 source convergence 和 live screen presence
249
+ 3. 只有两层都通过,才允许终态完成
@@ -91,7 +91,8 @@ Da Vinci 应该:
91
91
  - 优先登记 `.da-vinci/designs/` 下的本地 `.pen` 路径
92
92
  7. 生成 `design.md`
93
93
  8. 生成 `pencil-design.md`
94
- - 确保当前设计真正落到登记好的 `.da-vinci/designs/` 路径
94
+ - 如果一开始还没有登记的项目内 `.pen`,先把第一个通过审查的 MCP 快照真正落到登记好的 `.da-vinci/designs/` 路径
95
+ - 如果项目里原本已有 `.pen`,继续设计时先打开它,但发生实质性 live edit 后要把当前 MCP 快照重新覆盖写回同一路径
95
96
  9. 生成 `pencil-bindings.md`
96
97
  10. 生成 `tasks.md`
97
98
  11. 进入实现
@@ -112,7 +113,8 @@ Da Vinci 应该:
112
113
  5. 生成 `specs/<capability>/spec.md`
113
114
  6. 生成 `page-map.md`
114
115
  7. 继续到设计、绑定、任务和实现
115
- - 把当前设计真正落到登记好的 `.da-vinci/designs/` 路径
116
+ - 如果一开始还没有登记的项目内 `.pen`,先把第一个通过审查的 MCP 快照真正落到登记好的 `.da-vinci/designs/` 路径
117
+ - 如果项目里原本已有 `.pen`,继续设计时先打开它,但发生实质性 live edit 后要把当前 MCP 快照重新覆盖写回同一路径
116
118
 
117
119
  ## 3. `redesign-from-code`
118
120
 
@@ -138,8 +140,10 @@ Da Vinci 应该:
138
140
  - 在大规模 anchor 设计前,先写 visual thesis、content plan、interaction thesis 和 structural-delta 说明
139
141
  - 先做 1 到 3 个 anchor surface,再扩展更多页面
140
142
  - 首轮设计由解析出来的主 visual adapter 主导
141
- - 把新的 Pencil 基线真正落到登记好的 `.da-vinci/designs/` 路径
143
+ - 如果一开始还没有登记的项目内 `.pen`,先把第一个通过审查的 MCP 快照真正落到登记好的 `.da-vinci/designs/` 路径
144
+ - 如果项目里原本已有 `.pen`,继续设计时先打开它,但发生实质性 live edit 后要把当前 MCP 快照重新覆盖写回同一路径
142
145
  - 在第一次成功写入 Pencil 后,立即验证登记的 `.pen` 路径已经成为 shell 可见文件
146
+ - 截图导出必须写到 `.da-vinci/changes/<change-id>/exports/`,不能写进 `.da-vinci/designs/`
143
147
  9. 生成 `pencil-bindings.md`
144
148
  10. 生成 `tasks.md`
145
149
  11. 进入实现
@@ -158,13 +162,19 @@ Da Vinci 应该:
158
162
  - 对复杂产品,先把 1 到 3 个 anchor surface 做到通过截图审查,再扩展其他页面
159
163
  - 对每个 anchor surface,都要说明“新的构图与当前布局结构相比具体改了什么”
160
164
  - 只要截图分析指出 hierarchy、spacing、clarity、inconsistency 或 unresolved placeholder 问题,就不能自动判通过
165
+ - 不要把截图审查写成“看起来很好”;必须记录明确的 `PASS` / `WARN` / `BLOCK`、问题列表和是否回改
161
166
  - 在扩展更多页面前,先从已通过的 anchor surface 中抽出一组 shared primitives
162
167
  - 只使用 Pencil 支持的属性,不要继续使用 `flex`、`margin` 这类 Web/CSS 属性
168
+ - 在发送非小型 `batch_design` 之前,如果有 shell 能力,先对 Pencil operations 做 preflight
169
+ - 如果同一个 anchor surface 连续两次回滚,就切到每批不超过 6 个操作的微批次,直到拿到干净的 schema-safe pass
163
170
  - 一个实现页如果包含多个 Fragment、多个 tab、多个状态或多个 overlay,应该拆成多个设计 surface
164
171
  - `design-registry.md` 里的首选 `.pen` 路径由工作流自动维护,不应该依赖用户手工填写
165
172
  - 不要因为当前 Pencil 里正好打开了一个文档,就直接在那个文档上继续做重设计
173
+ - 不要把 interactive `save()` 当作可靠的持久化真相;应从当前 MCP 可读快照重建并覆盖项目内 `.pen`
166
174
  - 如果 Pencil MCP 没有自动把登记路径的 `.pen` 文件落到磁盘,就应该先补写这个项目内文件,再把 mapping 或 implementation 视为完成
167
175
  - `.da-vinci/designs/` 应该只作为 `.pen` 目录使用,不应该混入 inventory、proposal 之类的 markdown
176
+ - 截图 PNG 只是审查产物,不能替代登记好的 `.pen` 设计源
177
+ - 如果当前 Pencil editor 仍然是 `new` 或其他未命名 live document,就不能宣布工作流完成
168
178
 
169
179
  ## 4. `feature-change`
170
180
 
@@ -180,7 +190,8 @@ Da Vinci 应该:
180
190
  4. 复用或更新 `design-registry.md`
181
191
  - 如果已有项目内 `.pen` 文件,优先登记 `.da-vinci/designs/` 下的路径
182
192
  5. 生成 `pencil-design.md` 增量
183
- - 把更新后的 `.pen` 文件真正落到登记好的 `.da-vinci/designs/` 路径
193
+ - 如果项目里原本已有 `.pen`,继续设计时先打开它,但发生实质性 live edit 后要把当前 MCP 快照重新覆盖写回同一路径
194
+ - 如果这次改动还没有登记的项目内 `.pen`,先把第一个通过审查的 MCP 快照真正落到登记好的 `.da-vinci/designs/` 路径
184
195
  6. 更新 `pencil-bindings.md`
185
196
  7. 生成 `tasks.md`
186
197
  8. 进入实现
@@ -13,6 +13,8 @@
13
13
  3. 再选和项目复杂度、交付意图匹配的提示词版本
14
14
  4. 两者一起放进工作流设置
15
15
  5. 只有在项目存在特殊真相源或平台约束时,再继续收紧提示词
16
+ 6. 如果 Pencil MCP 可用,优先使用已经明确要求 MCP runtime gate 和 completion audit 的那版 redesign 提示词
17
+ 7. 如果项目要把 `.pen` 真正持久化到本地,优先使用已经区分“首次生成快照”和“继续迭代覆盖保存”的那版提示词,不要依赖 interactive `save()`
16
18
 
17
19
  可用模板:
18
20
 
@@ -26,6 +28,7 @@
26
28
  - 提示词模板负责定义工作流意图、拆分规则和真相源处理方式
27
29
  - `Visual Assist` 模板负责定义 UI 设计增强偏好
28
30
  - form factor 专用的 layout hygiene 仍然是独立硬闸门,screen 在通过 screenshot review 前必须应用对应规则
31
+ - MCP runtime gate 和 `da-vinci audit --mode completion ...` 属于工作流 gate,不属于 `Visual Assist` 配置本身
29
32
  - 两者一起使用,结果通常更稳
30
33
 
31
34
  现在每个场景模板里都固定包含:
@@ -28,6 +28,9 @@ Existing code is the behavior source of truth, not the layout truth.
28
28
  Preserve current behavior, flows, integrations, and validation rules unless explicitly required otherwise.
29
29
  Inventory the current workspaces, dialogs, overlays, and important states before Pencil work.
30
30
  Use the Visual Assist preferences declared in DA-VINCI.md.
31
+ 如果当前还没有登记的项目内 `.pen`,先把第一个通过审查的 MCP 快照持久化到 `.da-vinci/designs/`,不要依赖 interactive `save()`。
32
+ 如果 Pencil MCP 可用,在第一次成功写入 Pencil 后运行 MCP runtime gate,并把结果记录到 `pencil-design.md`。
33
+ 在声明 `design complete` 或 `workflow complete` 之前,必须同时通过 MCP runtime gate 和 `da-vinci audit --mode completion --change <change-id> <project-path>`。
31
34
  Do not pass design checkpoint if the result is just a boxed-up recolor of the old UI or if workspace hierarchy remains unclear.
32
35
  Persist project-local Pencil files under .da-vinci/designs/.
33
36
  ```
@@ -41,12 +44,22 @@ Existing code is the behavior source of truth, not the layout truth.
41
44
  Preserve current behavior, flows, integrations, and validation rules unless explicitly required otherwise.
42
45
  Inventory primary workspaces, side panels, inspectors, dialogs, settings flows, overlays, and materially different states before broad Pencil work.
43
46
  Decompose complex screens into primary surfaces, secondary surfaces, overlays, and implementation surfaces.
47
+ 在开始第一个 anchor surface 之前,先把 discovery 和 design-source 工件写到标准路径。
44
48
  Use the Visual Assist preferences declared in DA-VINCI.md.
45
49
  Treat the resolved primary visual adapter as the first-pass design lead.
46
50
  Use Pencil guides only as workspace constraints, not as the design direction.
47
51
  Do not start with broad multi-screen scaffolding.
48
52
  Design 1-3 anchor surfaces first, review screenshots, then expand.
49
53
  在通过 screenshot review 之前,先应用桌面端专用的 form-factor layout hygiene 规则。
54
+ 在发送非小型 `batch_design` 之前,如果有 shell 能力,先对 Pencil operations 做 preflight。
55
+ 如果同一个 anchor surface 连续两次回滚,就切到每批不超过 6 个操作的微批次,直到拿到干净的 schema-safe pass。
56
+ 在第一次成功写入 Pencil 后、继续大范围扩展前,先运行 `da-vinci audit --mode integrity <project-path>`。
57
+ 如果 Pencil MCP 可用,在第一次成功写入 Pencil 后运行 MCP runtime gate,并把结果记录到 `pencil-design.md`。
58
+ 如果当前还没有登记的项目内 `.pen`,先把第一个通过审查的 MCP 快照持久化到 `.da-vinci/designs/`;如果原本已有 `.pen`,继续设计时先打开它,但发生实质性 live edit 后要把当前 MCP 快照重新覆盖写回同一路径。
59
+ 截图导出只能写到 `.da-vinci/changes/<change-id>/exports/`,不能写进 `.da-vinci/designs/`。
60
+ 截图审查必须记录明确的 `PASS` / `WARN` / `BLOCK`、问题列表和是否回改;“看起来很好”不算审查记录。
61
+ 如果登记的 `.pen` 设计源只存在于内存中,或只剩下导出的 PNG,就不能宣布完成。
62
+ 在声明 `design complete` 或 `workflow complete` 之前,必须同时通过 MCP runtime gate 和 `da-vinci audit --mode completion --change <change-id> <project-path>`。
50
63
  Do not pass design checkpoint if the result is a repeated placeholder scaffold, flat panel soup, or a recolor of the old desktop shell.
51
64
  Persist project-local Pencil files under .da-vinci/designs/.
52
65
  ```
@@ -63,6 +76,9 @@ Decompose complex screens into real design surfaces before Pencil work.
63
76
  Use the Visual Assist preferences declared in DA-VINCI.md.
64
77
  If the product is complex, design 1-3 anchor surfaces first, review screenshots, then expand.
65
78
  Stop after DA-VINCI.md, design-registry.md, page-map.md, proposal.md, specs, design.md, pencil-design.md, pencil-bindings.md, and tasks.md.
79
+ 如果当前还没有登记的项目内 `.pen`,先把第一个通过审查的 MCP 快照持久化到 `.da-vinci/designs/`,不要依赖 interactive `save()`。
80
+ 如果 Pencil MCP 可用,在第一次成功写入 Pencil 后运行 MCP runtime gate,并把结果记录到 `pencil-design.md`。
81
+ 在声明 `design complete` 之前,必须同时通过 MCP runtime gate 和 `da-vinci audit --mode completion --change <change-id> <project-path>`。
66
82
  Do not start code changes yet.
67
83
  ```
68
84
 
@@ -73,8 +89,10 @@ $da-vinci use continue for this existing desktop-product redesign workflow.
73
89
 
74
90
  Use the existing Da Vinci artifacts in this project.
75
91
  Do not restart discovery unless an artifact is missing or clearly wrong.
76
- Keep the registered project-local Pencil source under .da-vinci/designs/ as the design source of truth.
92
+ 把登记的项目内 Pencil 源保持在 `.da-vinci/designs/` 下,作为设计真相源。继续设计时先打开这个文件,但发生实质性 live edit 后,要把当前 MCP 快照重新覆盖写回同一路径,不要假设 interactive `save()` 已经刷回磁盘。
77
93
  If the redesign is complex, continue from the approved anchor surfaces instead of restarting broad scaffolding.
94
+ 如果 Pencil MCP 可用,且这一轮继续做了新的 Pencil 写入,就重新运行 MCP runtime gate,并把最新结果记录到 `pencil-design.md`。
95
+ 在声明 `design complete` 或 `workflow complete` 之前,必须同时通过 MCP runtime gate 和 `da-vinci audit --mode completion --change <change-id> <project-path>`。
78
96
  Continue into the next unfinished stage and do not stop at tasks.md when the active intent is full-delivery.
79
97
  ```
80
98
 
@@ -28,6 +28,9 @@ Existing code is the behavior source of truth, not the layout truth.
28
28
  Preserve business logic, navigation, permissions, integrations, validations, and state transitions unless explicitly required otherwise.
29
29
  Inventory the current screens and important states before Pencil work.
30
30
  Use the Visual Assist preferences declared in DA-VINCI.md.
31
+ 如果当前还没有登记的项目内 `.pen`,先把第一个通过审查的 MCP 快照持久化到 `.da-vinci/designs/`,不要依赖 interactive `save()`。
32
+ 如果 Pencil MCP 可用,在第一次成功写入 Pencil 后运行 MCP runtime gate,并把结果记录到 `pencil-design.md`。
33
+ 在声明 `design complete` 或 `workflow complete` 之前,必须同时通过 MCP runtime gate 和 `da-vinci audit --mode completion --change <change-id> <project-path>`。
31
34
  Do not pass design checkpoint if the result is a skin-swap of the old UI, a generic card grid, or a weak mobile hierarchy.
32
35
  Persist project-local Pencil files under .da-vinci/designs/.
33
36
  ```
@@ -41,6 +44,7 @@ Existing code is the behavior source of truth, not the layout truth.
41
44
  Preserve business logic, navigation, permissions, integrations, validations, and state transitions unless explicitly required otherwise.
42
45
  Inventory activities, fragments, tabs, dialogs, bottom sheets, nested flows, overlays, and materially different states before broad Pencil work.
43
46
  Decompose complex screens into subpages, overlays, materially different states, and implementation surfaces.
47
+ 在开始第一个 anchor surface 之前,先把 discovery 和 design-source 工件写到标准路径。
44
48
  Use the Visual Assist preferences declared in DA-VINCI.md.
45
49
  Treat the resolved primary visual adapter as the first-pass design lead.
46
50
  State the resolved primary visual adapter explicitly in the log and name any requested adapters that are unavailable.
@@ -51,9 +55,18 @@ Design 1-3 anchor surfaces first, review screenshots, then expand.
51
55
  For each anchor surface, explain how the new composition differs structurally from the current layout.
52
56
  Do not treat screenshot analysis as an automatic pass if it reports hierarchy, spacing, clarity, or inconsistency issues.
53
57
  在通过 screenshot review 之前,先应用移动端专用的 form-factor layout hygiene 规则。
58
+ 在发送非小型 `batch_design` 之前,如果有 shell 能力,先对 Pencil operations 做 preflight。
59
+ 如果同一个 anchor surface 连续两次回滚,就切到每批不超过 6 个操作的微批次,直到拿到干净的 schema-safe pass。
54
60
  Use only Pencil-supported properties; do not use web-only props like flex or margin.
55
61
  Verify the registered project-local `.pen` file exists as a shell-visible file after the first Pencil write.
62
+ 在第一次成功写入 Pencil 后、继续大范围扩展前,先运行 `da-vinci audit --mode integrity <project-path>`。
63
+ 如果 Pencil MCP 可用,在第一次成功写入 Pencil 后运行 MCP runtime gate,并把结果记录到 `pencil-design.md`。
64
+ 如果当前还没有登记的项目内 `.pen`,先把第一个通过审查的 MCP 快照持久化到 `.da-vinci/designs/`;如果原本已有 `.pen`,继续设计时先打开它,但发生实质性 live edit 后要把当前 MCP 快照重新覆盖写回同一路径。
56
65
  Keep non-`.pen` workflow artifacts out of `.da-vinci/designs/`.
66
+ 截图导出只能写到 `.da-vinci/changes/<change-id>/exports/`,不能写进 `.da-vinci/designs/`。
67
+ 截图审查必须记录明确的 `PASS` / `WARN` / `BLOCK`、问题列表和是否回改;“看起来很好”不算审查记录。
68
+ 如果登记的 `.pen` 设计源只存在于内存中,或只剩下导出的 PNG,就不能宣布完成。
69
+ 在声明 `design complete` 或 `workflow complete` 之前,必须同时通过 MCP runtime gate 和 `da-vinci audit --mode completion --change <change-id> <project-path>`。
57
70
  Define shared primitives from the approved anchor surfaces before broad page expansion.
58
71
  Do not pass design checkpoint if the result is a skin-swap of the old UI, a generic card grid, repeated placeholder templates, or weak visual anchors.
59
72
  Persist project-local Pencil files under .da-vinci/designs/.
@@ -71,6 +84,9 @@ Decompose complex screens into real design surfaces before Pencil work.
71
84
  Use the Visual Assist preferences declared in DA-VINCI.md.
72
85
  If the app is complex, design 1-3 anchor surfaces first, review screenshots, then expand.
73
86
  Stop after DA-VINCI.md, design-registry.md, page-map.md, proposal.md, specs, design.md, pencil-design.md, pencil-bindings.md, and tasks.md.
87
+ 如果当前还没有登记的项目内 `.pen`,先把第一个通过审查的 MCP 快照持久化到 `.da-vinci/designs/`,不要依赖 interactive `save()`。
88
+ 如果 Pencil MCP 可用,在第一次成功写入 Pencil 后运行 MCP runtime gate,并把结果记录到 `pencil-design.md`。
89
+ 在声明 `design complete` 之前,必须同时通过 MCP runtime gate 和 `da-vinci audit --mode completion --change <change-id> <project-path>`。
74
90
  Do not start code changes yet.
75
91
  ```
76
92
 
@@ -81,8 +97,10 @@ $da-vinci use continue for this existing mobile-app redesign workflow.
81
97
 
82
98
  Use the existing Da Vinci artifacts in this project.
83
99
  Do not restart discovery unless an artifact is missing or clearly wrong.
84
- Keep the registered project-local Pencil source under .da-vinci/designs/ as the design source of truth.
100
+ 把登记的项目内 Pencil 源保持在 `.da-vinci/designs/` 下,作为设计真相源。继续设计时先打开这个文件,但发生实质性 live edit 后,要把当前 MCP 快照重新覆盖写回同一路径,不要假设 interactive `save()` 已经刷回磁盘。
85
101
  If the redesign is complex, keep the anchor-first flow until the design checkpoint passes.
102
+ 如果 Pencil MCP 可用,且这一轮继续做了新的 Pencil 写入,就重新运行 MCP runtime gate,并把最新结果记录到 `pencil-design.md`。
103
+ 在声明 `design complete` 或 `workflow complete` 之前,必须同时通过 MCP runtime gate 和 `da-vinci audit --mode completion --change <change-id> <project-path>`。
86
104
  Continue into the next unfinished stage and do not stop at tasks.md when the active intent is full-delivery.
87
105
  ```
88
106