@xenonbyte/da-vinci-workflow 0.1.16 → 0.1.18
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/CHANGELOG.md +23 -3
- package/README.md +48 -6
- package/README.zh-CN.md +46 -7
- package/SKILL.md +70 -3
- package/commands/claude/da-vinci.md +1 -0
- package/commands/claude/dv/continue.md +2 -0
- package/commands/claude/dv/design.md +3 -2
- package/commands/claude/dv/intake.md +2 -0
- package/commands/codex/prompts/da-vinci.md +1 -0
- package/commands/codex/prompts/dv-continue.md +2 -0
- package/commands/codex/prompts/dv-design.md +3 -2
- package/commands/codex/prompts/dv-intake.md +2 -1
- package/commands/gemini/da-vinci.toml +1 -0
- package/commands/gemini/dv/continue.toml +2 -0
- package/commands/gemini/dv/design.toml +3 -2
- package/commands/gemini/dv/intake.toml +2 -0
- package/docs/codex-natural-language-usage.md +8 -0
- package/docs/dv-command-reference.md +401 -0
- package/docs/mode-use-cases.md +96 -4
- package/docs/pencil-rendering-workflow.md +231 -0
- package/docs/prompt-entrypoints.md +25 -0
- package/docs/prompt-presets/README.md +81 -1
- package/docs/prompt-presets/desktop-app.md +62 -4
- package/docs/prompt-presets/mobile-app.md +62 -4
- package/docs/prompt-presets/tablet-app.md +62 -4
- package/docs/prompt-presets/web-app.md +62 -4
- package/docs/visual-adapters.md +12 -0
- package/docs/workflow-examples.md +30 -6
- package/docs/workflow-overview.md +231 -0
- package/docs/zh-CN/codex-natural-language-usage.md +8 -0
- package/docs/zh-CN/dv-command-reference.md +401 -0
- package/docs/zh-CN/mode-use-cases.md +54 -8
- package/docs/zh-CN/pencil-rendering-workflow.md +233 -0
- package/docs/zh-CN/prompt-entrypoints.md +23 -0
- package/docs/zh-CN/prompt-presets/README.md +81 -1
- package/docs/zh-CN/prompt-presets/desktop-app.md +62 -4
- package/docs/zh-CN/prompt-presets/mobile-app.md +62 -4
- package/docs/zh-CN/prompt-presets/tablet-app.md +62 -4
- package/docs/zh-CN/prompt-presets/web-app.md +62 -4
- package/docs/zh-CN/visual-adapters.md +12 -0
- package/docs/zh-CN/workflow-examples.md +31 -4
- package/docs/zh-CN/workflow-overview.md +233 -0
- package/lib/audit.js +66 -2
- package/lib/cli.js +262 -2
- package/lib/mcp-runtime-gate.js +53 -1
- package/lib/pen-persistence.js +192 -3
- package/lib/pencil-lock.js +128 -0
- package/lib/pencil-session.js +229 -0
- package/package.json +4 -1
- package/references/artifact-templates.md +46 -0
- package/references/checkpoints.md +21 -1
- package/references/design-inputs.md +6 -0
- package/references/modes.md +34 -0
- package/references/page-mapping.md +58 -0
- package/references/pencil-design-to-code.md +15 -2
- package/references/platform-adapters.md +1 -0
- package/references/prompt-recipes.md +39 -0
- package/scripts/test-mcp-runtime-gate.js +88 -0
- package/scripts/test-mode-consistency.js +155 -0
- package/scripts/test-pen-persistence.js +146 -6
- package/scripts/test-pencil-session.js +152 -0
- package/scripts/test-persistence-flows.js +315 -0
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
适用于平板优先,或强依赖扩展触控区域的产品。
|
|
4
4
|
|
|
5
|
+
这些提示词变体主要服务于设计驱动的 `redesign-from-code` 场景,前提是 workflow mode 已经明确。
|
|
6
|
+
如果当前 mode 是 `overhaul-from-code`,应该先把 `proposal.md`、`migration-contract.md` 和目标 `specs/` 稳定下来,再按需要改写这个模板,而不是直接原样套用。
|
|
7
|
+
|
|
5
8
|
建议搭配:
|
|
6
9
|
|
|
7
10
|
- `docs/zh-CN/visual-assist-presets/tablet-app.md`
|
|
@@ -19,6 +22,61 @@
|
|
|
19
22
|
- `Design-only` 适合先把设计链路和绑定做完,但暂时不改代码。
|
|
20
23
|
- `Continue` 适合已经有 `.da-vinci/` 工件,需要继续推进的项目。
|
|
21
24
|
|
|
25
|
+
## Overhaul From Code
|
|
26
|
+
|
|
27
|
+
当平板产品已经存在,但 split-pane 行为、流程逻辑、方向感知结构或页面职责也要一起重写,而不是只做视觉翻新时,用这组模板。
|
|
28
|
+
|
|
29
|
+
### Overhaul Intake
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
$da-vinci use intake for this existing tablet product.
|
|
33
|
+
|
|
34
|
+
This is a broad overhaul, not only a UI refresh.
|
|
35
|
+
Current tablet codebase is important reference evidence and migration baseline, but it should not be treated as the final target behavior truth.
|
|
36
|
+
We need to redefine flows, orientation-aware structure, page responsibilities, and selected surfaces while preserving only approved integrations, permissions, and constraints.
|
|
37
|
+
Recommend the best Da Vinci mode and generate the best executable next-step prompt.
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Overhaul Breakdown
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
$da-vinci use overhaul-from-code to inventory the current tablet product, define preserve/revise/retire/unknown boundaries, and stabilize the new target requirements before broad design.
|
|
44
|
+
|
|
45
|
+
Current tablet codebase is reference evidence and migration baseline, not the final target behavior truth.
|
|
46
|
+
Create or update:
|
|
47
|
+
- .da-vinci/project-inventory.md
|
|
48
|
+
- .da-vinci/changes/<change-id>/proposal.md
|
|
49
|
+
- .da-vinci/changes/<change-id>/migration-contract.md
|
|
50
|
+
- .da-vinci/changes/<change-id>/specs/
|
|
51
|
+
- .da-vinci/page-map.md
|
|
52
|
+
|
|
53
|
+
Inventory split-pane regions, sidebars, expanded canvases, dialogs, sheets, orientation-driven changes, and materially different states before broad Pencil work.
|
|
54
|
+
Do not start broad Pencil work until the new proposal, migration contract, target specs, and page map are stable enough to drive design.
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Overhaul Design
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
$da-vinci use overhaul-from-code to design the new target tablet surfaces from the approved overhaul artifacts.
|
|
61
|
+
|
|
62
|
+
Use the existing .da-vinci/project-inventory.md, proposal.md, migration-contract.md, target specs, page-map.md, DA-VINCI.md, and design-registry.md.
|
|
63
|
+
Treat the new proposal and specs as the target behavior truth.
|
|
64
|
+
Treat the old tablet codebase only as reference evidence and migration context.
|
|
65
|
+
Design 1-3 anchor surfaces first, review screenshots, then expand.
|
|
66
|
+
Persist project-local Pencil files under .da-vinci/designs/.
|
|
67
|
+
Run the normal Pencil runtime gate and completion audit before terminal completion claims.
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Overhaul Continue
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
$da-vinci use continue for this existing overhaul-from-code tablet workflow.
|
|
74
|
+
|
|
75
|
+
Use the existing Da Vinci artifacts.
|
|
76
|
+
Detect whether the workflow should return to breakdown, continue with design, generate tasks, continue implementation, or verify drift.
|
|
77
|
+
Prefer the artifact-backed next safe stage instead of restarting the overhaul from scratch.
|
|
78
|
+
```
|
|
79
|
+
|
|
22
80
|
## Simple Redesign
|
|
23
81
|
|
|
24
82
|
```text
|
|
@@ -28,7 +86,7 @@ Existing code is the behavior source of truth, not the layout truth.
|
|
|
28
86
|
Preserve current behavior, permissions, integrations, validations, and state transitions unless explicitly required otherwise.
|
|
29
87
|
Inventory the current tablet surfaces and important states before Pencil work.
|
|
30
88
|
Use the Visual Assist preferences declared in DA-VINCI.md.
|
|
31
|
-
|
|
89
|
+
在第一次 Pencil 编辑前,优先执行 `da-vinci pencil-session begin --project <project-path> --pen <path>`,让登记好的项目内 `.pen` 先完成 seed 并持有全局 Pencil 锁;只有 session wrapper 不可用时,再退回 `da-vinci ensure-pen --output <path> --verify-open`。
|
|
32
90
|
如果 Pencil MCP 可用,在第一次成功写入 Pencil 后运行 MCP runtime gate,并把结果记录到 `pencil-design.md`。
|
|
33
91
|
在声明 `design complete` 或 `workflow complete` 之前,必须同时通过 MCP runtime gate 和 `da-vinci audit --mode completion --change <change-id> <project-path>`。
|
|
34
92
|
Do not pass design checkpoint if the result ignores tablet-scale composition or collapses into a stretched phone layout.
|
|
@@ -55,7 +113,7 @@ Design 1-3 anchor surfaces first, review screenshots, then expand.
|
|
|
55
113
|
如果同一个 anchor surface 连续两次回滚,就切到每批不超过 6 个操作的微批次,直到拿到干净的 schema-safe pass。
|
|
56
114
|
在第一次成功写入 Pencil 后、继续大范围扩展前,先运行 `da-vinci audit --mode integrity <project-path>`。
|
|
57
115
|
如果 Pencil MCP 可用,在第一次成功写入 Pencil 后运行 MCP runtime gate,并把结果记录到 `pencil-design.md`。
|
|
58
|
-
|
|
116
|
+
在第一次 Pencil 编辑前,优先执行 `da-vinci pencil-session begin --project <project-path> --pen <path>`;发生实质性 live edit 后,优先执行 `da-vinci pencil-session persist --project <project-path> --pen <path> ...`。只有 session wrapper 不可用时,才退回 `ensure-pen + write-pen + check-pen-sync` 这条底层链路。
|
|
59
117
|
截图导出只能写到 `.da-vinci/changes/<change-id>/exports/`,不能写进 `.da-vinci/designs/`。
|
|
60
118
|
截图审查必须记录明确的 `PASS` / `WARN` / `BLOCK`、问题列表和是否回改;“看起来很好”不算审查记录。
|
|
61
119
|
如果登记的 `.pen` 设计源只存在于内存中,或只剩下导出的 PNG,就不能宣布完成。
|
|
@@ -76,7 +134,7 @@ Decompose complex pages into real design surfaces before Pencil work.
|
|
|
76
134
|
Use the Visual Assist preferences declared in DA-VINCI.md.
|
|
77
135
|
If the product is complex, design 1-3 anchor surfaces first, review screenshots, then expand.
|
|
78
136
|
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
|
-
|
|
137
|
+
在第一次 Pencil 编辑前,优先执行 `da-vinci pencil-session begin --project <project-path> --pen <path>`,让登记好的项目内 `.pen` 先完成 seed 并持有锁;只有 session wrapper 不可用时,再退回 `da-vinci ensure-pen --output <path> --verify-open`。
|
|
80
138
|
如果 Pencil MCP 可用,在第一次成功写入 Pencil 后运行 MCP runtime gate,并把结果记录到 `pencil-design.md`。
|
|
81
139
|
在声明 `design complete` 之前,必须同时通过 MCP runtime gate 和 `da-vinci audit --mode completion --change <change-id> <project-path>`。
|
|
82
140
|
Do not start code changes yet.
|
|
@@ -89,7 +147,7 @@ $da-vinci use continue for this existing tablet-product redesign workflow.
|
|
|
89
147
|
|
|
90
148
|
Use the existing Da Vinci artifacts in this project.
|
|
91
149
|
Do not restart discovery unless an artifact is missing or clearly wrong.
|
|
92
|
-
把登记的项目内 Pencil 源保持在 `.da-vinci/designs/`
|
|
150
|
+
把登记的项目内 Pencil 源保持在 `.da-vinci/designs/` 下,作为设计真相源。继续设计时优先执行 `da-vinci pencil-session begin --project <project-path> --pen <path>`,发生实质性 live edit 后优先执行 `da-vinci pencil-session persist --project <project-path> --pen <path> ...`;只有 session wrapper 不可用时,才退回 `write-pen + check-pen-sync` 这条底层链路。
|
|
93
151
|
If the redesign is complex, continue from the approved anchor surfaces instead of restarting broad scaffolding.
|
|
94
152
|
如果 Pencil MCP 可用,且这一轮继续做了新的 Pencil 写入,就重新运行 MCP runtime gate,并把最新结果记录到 `pencil-design.md`。
|
|
95
153
|
在声明 `design complete` 或 `workflow complete` 之前,必须同时通过 MCP runtime gate 和 `da-vinci audit --mode completion --change <change-id> <project-path>`。
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
适用于浏览器中的产品型界面,或带有 app surface 的 Web 产品。
|
|
4
4
|
|
|
5
|
+
这些提示词变体主要服务于设计驱动的 `redesign-from-code` 场景,前提是 workflow mode 已经明确。
|
|
6
|
+
如果当前 mode 是 `overhaul-from-code`,应该先把 `proposal.md`、`migration-contract.md` 和目标 `specs/` 稳定下来,再按需要改写这个模板,而不是直接原样套用。
|
|
7
|
+
|
|
5
8
|
建议搭配:
|
|
6
9
|
|
|
7
10
|
- `docs/zh-CN/visual-assist-presets/web-app.md`
|
|
@@ -19,6 +22,61 @@
|
|
|
19
22
|
- `Design-only` 适合先把设计链路和绑定做完,但暂时不改代码。
|
|
20
23
|
- `Continue` 适合已经有 `.da-vinci/` 工件,需要继续推进的项目。
|
|
21
24
|
|
|
25
|
+
## Overhaul From Code
|
|
26
|
+
|
|
27
|
+
当 Web 产品已经存在,但 routes、流程逻辑、信息架构或认证后产品结构也要一起重写,而不是只做视觉翻新时,用这组模板。
|
|
28
|
+
|
|
29
|
+
### Overhaul Intake
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
$da-vinci use intake for this existing web product.
|
|
33
|
+
|
|
34
|
+
This is a broad overhaul, not only a UI refresh.
|
|
35
|
+
Current web codebase is important reference evidence and migration baseline, but it should not be treated as the final target behavior truth.
|
|
36
|
+
We need to redefine flows, route structure, page responsibilities, and selected surfaces while preserving only approved integrations, permissions, and constraints.
|
|
37
|
+
Recommend the best Da Vinci mode and generate the best executable next-step prompt.
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Overhaul Breakdown
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
$da-vinci use overhaul-from-code to inventory the current web product, define preserve/revise/retire/unknown boundaries, and stabilize the new target requirements before broad design.
|
|
44
|
+
|
|
45
|
+
Current web codebase is reference evidence and migration baseline, not the final target behavior truth.
|
|
46
|
+
Create or update:
|
|
47
|
+
- .da-vinci/project-inventory.md
|
|
48
|
+
- .da-vinci/changes/<change-id>/proposal.md
|
|
49
|
+
- .da-vinci/changes/<change-id>/migration-contract.md
|
|
50
|
+
- .da-vinci/changes/<change-id>/specs/
|
|
51
|
+
- .da-vinci/page-map.md
|
|
52
|
+
|
|
53
|
+
Inventory product surfaces, auth surfaces, responsive shells, dialogs, drawers, overlays, and materially different states before broad Pencil work.
|
|
54
|
+
Do not start broad Pencil work until the new proposal, migration contract, target specs, and page map are stable enough to drive design.
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Overhaul Design
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
$da-vinci use overhaul-from-code to design the new target web surfaces from the approved overhaul artifacts.
|
|
61
|
+
|
|
62
|
+
Use the existing .da-vinci/project-inventory.md, proposal.md, migration-contract.md, target specs, page-map.md, DA-VINCI.md, and design-registry.md.
|
|
63
|
+
Treat the new proposal and specs as the target behavior truth.
|
|
64
|
+
Treat the old web codebase only as reference evidence and migration context.
|
|
65
|
+
Design 1-3 anchor surfaces first, review screenshots, then expand.
|
|
66
|
+
Persist project-local Pencil files under .da-vinci/designs/.
|
|
67
|
+
Run the normal Pencil runtime gate and completion audit before terminal completion claims.
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Overhaul Continue
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
$da-vinci use continue for this existing overhaul-from-code web workflow.
|
|
74
|
+
|
|
75
|
+
Use the existing Da Vinci artifacts.
|
|
76
|
+
Detect whether the workflow should return to breakdown, continue with design, generate tasks, continue implementation, or verify drift.
|
|
77
|
+
Prefer the artifact-backed next safe stage instead of restarting the overhaul from scratch.
|
|
78
|
+
```
|
|
79
|
+
|
|
22
80
|
## Simple Redesign
|
|
23
81
|
|
|
24
82
|
```text
|
|
@@ -28,7 +86,7 @@ Existing code is the behavior source of truth, not the layout truth.
|
|
|
28
86
|
Preserve current business logic, routes, permissions, integrations, validations, and state transitions unless explicitly required otherwise.
|
|
29
87
|
Inventory the current product surfaces and important states before Pencil work.
|
|
30
88
|
Use the Visual Assist preferences declared in DA-VINCI.md.
|
|
31
|
-
|
|
89
|
+
在第一次 Pencil 编辑前,优先执行 `da-vinci pencil-session begin --project <project-path> --pen <path>`,让登记好的项目内 `.pen` 先完成 seed 并持有全局 Pencil 锁;只有 session wrapper 不可用时,再退回 `da-vinci ensure-pen --output <path> --verify-open`。
|
|
32
90
|
如果 Pencil MCP 可用,在第一次成功写入 Pencil 后运行 MCP runtime gate,并把结果记录到 `pencil-design.md`。
|
|
33
91
|
在声明 `design complete` 或 `workflow complete` 之前,必须同时通过 MCP runtime gate 和 `da-vinci audit --mode completion --change <change-id> <project-path>`。
|
|
34
92
|
Do not pass design checkpoint if the result is a generic SaaS card grid or a recolor of the old interface.
|
|
@@ -56,7 +114,7 @@ Design 1-3 anchor surfaces first, review screenshots, then expand.
|
|
|
56
114
|
如果同一个 anchor surface 连续两次回滚,就切到每批不超过 6 个操作的微批次,直到拿到干净的 schema-safe pass。
|
|
57
115
|
在第一次成功写入 Pencil 后、继续大范围扩展前,先运行 `da-vinci audit --mode integrity <project-path>`。
|
|
58
116
|
如果 Pencil MCP 可用,在第一次成功写入 Pencil 后运行 MCP runtime gate,并把结果记录到 `pencil-design.md`。
|
|
59
|
-
|
|
117
|
+
在第一次 Pencil 编辑前,优先执行 `da-vinci pencil-session begin --project <project-path> --pen <path>`;发生实质性 live edit 后,优先执行 `da-vinci pencil-session persist --project <project-path> --pen <path> ...`。只有 session wrapper 不可用时,才退回 `ensure-pen + write-pen + check-pen-sync` 这条底层链路。
|
|
60
118
|
截图导出只能写到 `.da-vinci/changes/<change-id>/exports/`,不能写进 `.da-vinci/designs/`。
|
|
61
119
|
截图审查必须记录明确的 `PASS` / `WARN` / `BLOCK`、问题列表和是否回改;“看起来很好”不算审查记录。
|
|
62
120
|
如果登记的 `.pen` 设计源只存在于内存中,或只剩下导出的 PNG,就不能宣布完成。
|
|
@@ -77,7 +135,7 @@ Decompose complex pages into real design surfaces before Pencil work.
|
|
|
77
135
|
Use the Visual Assist preferences declared in DA-VINCI.md.
|
|
78
136
|
If the product is complex, design 1-3 anchor surfaces first, review screenshots, then expand.
|
|
79
137
|
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.
|
|
80
|
-
|
|
138
|
+
在第一次 Pencil 编辑前,优先执行 `da-vinci pencil-session begin --project <project-path> --pen <path>`,让登记好的项目内 `.pen` 先完成 seed 并持有锁;只有 session wrapper 不可用时,再退回 `da-vinci ensure-pen --output <path> --verify-open`。
|
|
81
139
|
如果 Pencil MCP 可用,在第一次成功写入 Pencil 后运行 MCP runtime gate,并把结果记录到 `pencil-design.md`。
|
|
82
140
|
在声明 `design complete` 之前,必须同时通过 MCP runtime gate 和 `da-vinci audit --mode completion --change <change-id> <project-path>`。
|
|
83
141
|
Do not start code changes yet.
|
|
@@ -90,7 +148,7 @@ $da-vinci use continue for this existing web-product redesign workflow.
|
|
|
90
148
|
|
|
91
149
|
Use the existing Da Vinci artifacts in this project.
|
|
92
150
|
Do not restart discovery unless an artifact is missing or clearly wrong.
|
|
93
|
-
把登记的项目内 Pencil 源保持在 `.da-vinci/designs/`
|
|
151
|
+
把登记的项目内 Pencil 源保持在 `.da-vinci/designs/` 下,作为设计真相源。继续设计时优先执行 `da-vinci pencil-session begin --project <project-path> --pen <path>`,发生实质性 live edit 后优先执行 `da-vinci pencil-session persist --project <project-path> --pen <path> ...`;只有 session wrapper 不可用时,才退回 `write-pen + check-pen-sync` 这条底层链路。
|
|
94
152
|
If the redesign is complex, continue from the approved anchor surfaces instead of restarting broad scaffolding.
|
|
95
153
|
如果 Pencil MCP 可用,且这一轮继续做了新的 Pencil 写入,就重新运行 MCP runtime gate,并把最新结果记录到 `pencil-design.md`。
|
|
96
154
|
在声明 `design complete` 或 `workflow complete` 之前,必须同时通过 MCP runtime gate 和 `da-vinci audit --mode completion --change <change-id> <project-path>`。
|
|
@@ -167,6 +167,12 @@ adapter 选择经验:
|
|
|
167
167
|
- 在大规模 Pencil 设计前先拆 activities、fragments、tabs、overlays 和明显不同的 states
|
|
168
168
|
- 明确要求 fresh composition,而不是旧 UI 改色或轻微挪位置
|
|
169
169
|
|
|
170
|
+
对于 `overhaul-from-code`,还应该补三句:
|
|
171
|
+
|
|
172
|
+
- 重申 existing code 是参考基线和迁移约束,不是新系统自动成立的最终行为真相
|
|
173
|
+
- 在大规模 Pencil 设计前先稳定 `proposal.md`、`migration-contract.md`、目标 `specs/` 和 `page-map.md`
|
|
174
|
+
- 要求 anchor surface 体现新的流程和信息架构,而不是只给旧壳换皮
|
|
175
|
+
|
|
170
176
|
## 解析顺序
|
|
171
177
|
|
|
172
178
|
adapter 的解析顺序建议固定为:
|
|
@@ -263,6 +269,12 @@ If it is unavailable, fall back to native Da Vinci design rules and continue.
|
|
|
263
269
|
Persist project-local Pencil files under .da-vinci/designs/.
|
|
264
270
|
```
|
|
265
271
|
|
|
272
|
+
如果是流程和逻辑也会一起变化的存量系统大改版,应该改用:
|
|
273
|
+
|
|
274
|
+
```text
|
|
275
|
+
$da-vinci use overhaul-from-code to inventory the current Android product, define preserve/revise/retire boundaries, rewrite the target flows and specs, and then create a new Pencil-backed overhaul plan.
|
|
276
|
+
```
|
|
277
|
+
|
|
266
278
|
如果是复杂 Android 或多 surface 项目,建议再额外加上:
|
|
267
279
|
|
|
268
280
|
```text
|
|
@@ -127,8 +127,8 @@ Do not treat screenshot analysis as an automatic pass if it reports hierarchy, s
|
|
|
127
127
|
Before non-trivial `batch_design` calls, preflight the Pencil operations when shell access is available.
|
|
128
128
|
If the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds.
|
|
129
129
|
Use only Pencil-supported properties; do not use web-only props like flex or margin.
|
|
130
|
-
|
|
131
|
-
如果项目里原本已有登记的 `.pen`,继续设计时先打开它,但实质性 live edit
|
|
130
|
+
优先在第一次 Pencil 编辑前执行 `da-vinci pencil-session begin --project <project-path> --pen <path>`,这样会先 seed 登记好的 `.pen` 并持有全局 Pencil 锁。
|
|
131
|
+
如果项目里原本已有登记的 `.pen`,继续设计时先打开它,但实质性 live edit 后优先通过 `da-vinci pencil-session persist` 把当前 live MCP 快照重新覆盖写回同一路径。
|
|
132
132
|
Verify the registered project-local `.pen` file exists as a shell-visible file after the first Pencil write.
|
|
133
133
|
在第一次成功写入 Pencil 后、继续大范围扩展前,先运行 `da-vinci audit --mode integrity <project-path>`。
|
|
134
134
|
Keep `.da-vinci/designs/` reserved for `.pen` files only.
|
|
@@ -138,7 +138,33 @@ Do not report completion if the `.pen` source exists only in memory or only as e
|
|
|
138
138
|
Do not pass design checkpoint if the result is just a skin-swap of the old UI.
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
## 4. `
|
|
141
|
+
## 4. `overhaul-from-code`
|
|
142
|
+
|
|
143
|
+
适用:
|
|
144
|
+
|
|
145
|
+
- 现有产品已经存在
|
|
146
|
+
- 但流程、逻辑、信息架构和 UI 都可能被一起重写
|
|
147
|
+
|
|
148
|
+
示例请求:
|
|
149
|
+
|
|
150
|
+
```text
|
|
151
|
+
$da-vinci use overhaul-from-code to inventory the current product, define preserve/revise/retire boundaries, rewrite the target flows and specs, and generate a new Pencil-backed overhaul plan.
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
预期流程:
|
|
155
|
+
|
|
156
|
+
1. 先把现有产品盘点成 `project-inventory.md`
|
|
157
|
+
2. 在 `proposal.md` 里定义目标方向、范围和非目标
|
|
158
|
+
3. 创建 `migration-contract.md`,标记 preserve / revise / retire / unknown
|
|
159
|
+
4. 当一个大 spec 过粗时,把 rewrite 拆成多个 `specs/<slice>/spec.md`
|
|
160
|
+
5. 重建 `page-map.md`,描述目标产品,而不是只复制旧 route tree
|
|
161
|
+
6. 再进入 `DA-VINCI.md`、`design-registry.md`、`design-brief.md`、`design.md`
|
|
162
|
+
7. 通过现有 anchor-first 渲染链生成 Pencil overhaul 页面
|
|
163
|
+
8. 绑定目标实现页和 Pencil 页面
|
|
164
|
+
9. 生成和 overhaul slice、migration boundary 对齐的任务
|
|
165
|
+
10. 基于新的 specs 实现和验证,而不是默认继承旧行为
|
|
166
|
+
|
|
167
|
+
## 5. `feature-change`
|
|
142
168
|
|
|
143
169
|
适用:
|
|
144
170
|
|
|
@@ -174,7 +200,7 @@ Use the visual-adapter preferences declared in DA-VINCI.md.
|
|
|
174
200
|
If frontend-skill is available, use it as the primary visual adapter.
|
|
175
201
|
If it is unavailable, fall back to native Da Vinci design rules and continue.
|
|
176
202
|
Persist project-local Pencil files under .da-vinci/designs/.
|
|
177
|
-
如果当前还没有登记的项目内 `.pen
|
|
203
|
+
如果当前还没有登记的项目内 `.pen`,先在这里 seed 一个登记好的 `.pen`,再开始第一次 Pencil 编辑,并把后续 live 编辑持续绑定到这个路径。
|
|
178
204
|
如果项目里原本已有 `.pen`,继续设计后要把当前 MCP 快照覆盖写回同一路径。
|
|
179
205
|
```
|
|
180
206
|
|
|
@@ -214,3 +240,4 @@ Continue into full-delivery.
|
|
|
214
240
|
- `pencil-bindings.md` 追踪实现页面与 Pencil 页面之间的绑定
|
|
215
241
|
- `pencil-design.md` 在需要时记录 adapter 如何影响这次设计稿
|
|
216
242
|
- 工作流默认是 `autonomous-by-default`
|
|
243
|
+
- `overhaul-from-code` 仍然要遵守同一套 `.pen` 持久化、runtime gate 和 completion audit 规则
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# 工作流总览
|
|
2
|
+
|
|
3
|
+
> 中文配套文档。若与英文原文存在差异,请以 `docs/workflow-overview.md` 为准。
|
|
4
|
+
|
|
5
|
+
这份文档描述当前 Da Vinci 的完整主工作流。
|
|
6
|
+
|
|
7
|
+
适合在你需要理解下面这些内容时阅读:
|
|
8
|
+
|
|
9
|
+
- mode 选择
|
|
10
|
+
- 工件生成顺序
|
|
11
|
+
- Pencil 支撑的设计阶段
|
|
12
|
+
- 页面到设计的绑定
|
|
13
|
+
- 实现与验证
|
|
14
|
+
|
|
15
|
+
如果你想看 Pencil 渲染、持久化、门禁和审计的专门说明,请看 [pencil-rendering-workflow.md](/Users/xubo/x-skills/da-vinci/docs/zh-CN/pencil-rendering-workflow.md)。
|
|
16
|
+
如果你想看逐个 `dv:` 命令的职责、下一步推荐和 `verify` 回退规则,请看 [dv-command-reference.md](/Users/xubo/x-skills/da-vinci/docs/zh-CN/dv-command-reference.md)。
|
|
17
|
+
|
|
18
|
+
## 核心契约
|
|
19
|
+
|
|
20
|
+
Da Vinci 围绕一个固定契约工作:
|
|
21
|
+
|
|
22
|
+
- requirements 决定 behavior
|
|
23
|
+
- Pencil 决定 presentation
|
|
24
|
+
- code 同时遵循两者
|
|
25
|
+
|
|
26
|
+
这意味着:
|
|
27
|
+
|
|
28
|
+
- requirements 和 specs 是行为真相源
|
|
29
|
+
- 项目内 `.pen` 是设计真相源
|
|
30
|
+
- 实现必须能追溯到这两层
|
|
31
|
+
|
|
32
|
+
## 主流程
|
|
33
|
+
|
|
34
|
+
1. 选择正确的 mode。
|
|
35
|
+
2. 生成 discovery 和 scope 工件。
|
|
36
|
+
3. 解析项目内设计源,并登记优先 `.pen` 路径。
|
|
37
|
+
4. 先做 anchor surfaces 并完成设计审查。
|
|
38
|
+
5. 让 live Pencil 会话和登记好的 `.pen` 收敛。
|
|
39
|
+
6. 建立实现页面到 Pencil 页面之间的绑定。
|
|
40
|
+
7. 生成任务。
|
|
41
|
+
8. 实现。
|
|
42
|
+
9. 验证需求漂移和设计漂移。
|
|
43
|
+
|
|
44
|
+
## 标准工件骨架
|
|
45
|
+
|
|
46
|
+
根据 mode 的不同,Da Vinci 一般会围绕这组工件推进:
|
|
47
|
+
|
|
48
|
+
- `.da-vinci/project-inventory.md`
|
|
49
|
+
- `.da-vinci/changes/<change-id>/design-brief.md`
|
|
50
|
+
- `.da-vinci/design-registry.md`
|
|
51
|
+
- `.da-vinci/page-map.md`
|
|
52
|
+
- `.da-vinci/changes/<change-id>/proposal.md`
|
|
53
|
+
- `.da-vinci/changes/<change-id>/specs/<capability>/spec.md`
|
|
54
|
+
- `.da-vinci/changes/<change-id>/design.md`
|
|
55
|
+
- `.da-vinci/changes/<change-id>/pencil-design.md`
|
|
56
|
+
- `.da-vinci/changes/<change-id>/pencil-bindings.md`
|
|
57
|
+
- `.da-vinci/changes/<change-id>/tasks.md`
|
|
58
|
+
- `.da-vinci/changes/<change-id>/verification.md`
|
|
59
|
+
|
|
60
|
+
`DA-VINCI.md` 仍然是项目级工作流和视觉约束文件。
|
|
61
|
+
|
|
62
|
+
## 分阶段说明
|
|
63
|
+
|
|
64
|
+
### 1. Intake 与 Mode 选择
|
|
65
|
+
|
|
66
|
+
可选 mode:
|
|
67
|
+
|
|
68
|
+
- `greenfield-spec`
|
|
69
|
+
- `greenfield-brainstorm`
|
|
70
|
+
- `redesign-from-code`
|
|
71
|
+
- `overhaul-from-code`
|
|
72
|
+
- `feature-change`
|
|
73
|
+
|
|
74
|
+
提示词入口:
|
|
75
|
+
|
|
76
|
+
- `intake`
|
|
77
|
+
- `prompt`
|
|
78
|
+
- `continue`
|
|
79
|
+
|
|
80
|
+
### 2. Discovery 与 Scope
|
|
81
|
+
|
|
82
|
+
在大规模 Pencil 设计前,工作流应该已经明确:
|
|
83
|
+
|
|
84
|
+
- 产品形态和 form factor
|
|
85
|
+
- 当前 change scope
|
|
86
|
+
- 当前页面与明显不同的状态
|
|
87
|
+
- 项目里是否已经有登记的 `.pen`
|
|
88
|
+
|
|
89
|
+
对 redesign 工作来说,在 discovery 和 design-source 工件落标准路径前,不允许直接开始大范围 Pencil 生成。
|
|
90
|
+
|
|
91
|
+
如果是 `overhaul-from-code`,在大规模 Pencil 设计前还必须至少稳定这些工件:
|
|
92
|
+
|
|
93
|
+
- `project-inventory.md`
|
|
94
|
+
- `proposal.md`
|
|
95
|
+
- `migration-contract.md`
|
|
96
|
+
- 目标 `specs/`
|
|
97
|
+
- `page-map.md`
|
|
98
|
+
- `DA-VINCI.md`
|
|
99
|
+
- `design-registry.md`
|
|
100
|
+
- `design-brief.md`
|
|
101
|
+
- `design.md`
|
|
102
|
+
|
|
103
|
+
它们共同定义了新的真相源和迁移边界。
|
|
104
|
+
|
|
105
|
+
### 3. 设计源登记
|
|
106
|
+
|
|
107
|
+
`design-registry.md` 必须登记一个明确的项目内 `.pen` 路径,位于 `.da-vinci/designs/` 下。
|
|
108
|
+
|
|
109
|
+
这个路径是工作流状态,不是随意写的占位符。
|
|
110
|
+
|
|
111
|
+
### 4. Anchor-First 设计
|
|
112
|
+
|
|
113
|
+
先做 1 到 3 个 anchor surfaces。
|
|
114
|
+
|
|
115
|
+
每个 anchor 都必须:
|
|
116
|
+
|
|
117
|
+
- 在 redesign-from-code 下写 structural-delta 说明
|
|
118
|
+
- 如果当前 mode 是 `overhaul-from-code`,还要和已经批准的 `migration-contract.md`、`page-map.md`、新 `specs/` 保持一致
|
|
119
|
+
- 经过 screenshot review
|
|
120
|
+
- 满足当前 form factor 的 layout-hygiene 规则
|
|
121
|
+
- 通过 design checkpoint 才能扩屏
|
|
122
|
+
|
|
123
|
+
anchor 通过后,再抽 shared primitives,然后再扩更多页面。
|
|
124
|
+
|
|
125
|
+
### 5. 设计源收敛
|
|
126
|
+
|
|
127
|
+
在 mapping 或实现被视为安全之前,Da Vinci 会跑:
|
|
128
|
+
|
|
129
|
+
- `design-source checkpoint`
|
|
130
|
+
- 如果启用了 Pencil MCP,则跑 `MCP runtime gate`
|
|
131
|
+
- 工作中期跑 `da-vinci audit --mode integrity <project-path>`
|
|
132
|
+
|
|
133
|
+
这些检查用来确认:
|
|
134
|
+
|
|
135
|
+
- 登记好的 `.pen` 路径是明确的
|
|
136
|
+
- active editor 是正确的设计源
|
|
137
|
+
- shell 上确实有 `.pen`
|
|
138
|
+
- live snapshot 和 persisted snapshot 已同步
|
|
139
|
+
|
|
140
|
+
### 6. Mapping
|
|
141
|
+
|
|
142
|
+
`pencil-bindings.md` 用来绑定实现页面和 Pencil 页面。
|
|
143
|
+
|
|
144
|
+
`mapping checkpoint` 会确保实现不再靠猜:
|
|
145
|
+
|
|
146
|
+
- 每个实现页面都有 Pencil 页面或明确例外
|
|
147
|
+
- route 名和 Pencil 名能追溯
|
|
148
|
+
- shared layout 和 reusable region 已清楚
|
|
149
|
+
|
|
150
|
+
### 7. Tasks 与实现
|
|
151
|
+
|
|
152
|
+
mapping 通过后:
|
|
153
|
+
|
|
154
|
+
- 生成 `tasks.md`
|
|
155
|
+
- 基于 requirements 和 Pencil 数据实现
|
|
156
|
+
- 验证需求漂移和设计漂移
|
|
157
|
+
|
|
158
|
+
### 8. 终态完成
|
|
159
|
+
|
|
160
|
+
在下面这些条件未满足前,不能宣布 `design complete` 或 `workflow complete`:
|
|
161
|
+
|
|
162
|
+
- design checkpoint 不再阻塞
|
|
163
|
+
- design-source checkpoint 至少 `PASS`
|
|
164
|
+
- 如果用了 Pencil MCP,runtime gate 结果可接受
|
|
165
|
+
- `da-vinci audit --mode completion --change <change-id> <project-path>` 通过
|
|
166
|
+
|
|
167
|
+
## 门禁与审计
|
|
168
|
+
|
|
169
|
+
### Design Checkpoint
|
|
170
|
+
|
|
171
|
+
会拦截:
|
|
172
|
+
|
|
173
|
+
- anchor 未稳定就扩屏
|
|
174
|
+
- 旧 UI 换皮
|
|
175
|
+
- 大量 placeholder scaffold
|
|
176
|
+
- 视觉锚点很弱
|
|
177
|
+
- 忽略 screenshot review 问题
|
|
178
|
+
|
|
179
|
+
### Design-Source Checkpoint
|
|
180
|
+
|
|
181
|
+
确认:
|
|
182
|
+
|
|
183
|
+
- 登记的 `.pen`
|
|
184
|
+
- 当前 active editor
|
|
185
|
+
- shell 可见 `.pen`
|
|
186
|
+
|
|
187
|
+
已经收敛为同一个项目级设计源。
|
|
188
|
+
|
|
189
|
+
### MCP Runtime Gate
|
|
190
|
+
|
|
191
|
+
确认 live 会话真相:
|
|
192
|
+
|
|
193
|
+
- 不是 `new`
|
|
194
|
+
- registered `.pen` 存在后没有继续用空 `filePath`
|
|
195
|
+
- claimed anchor id 在 active editor 里真实存在
|
|
196
|
+
- completion 阶段 live snapshot hash 和 persisted hash 一致
|
|
197
|
+
|
|
198
|
+
### Integrity Audit
|
|
199
|
+
|
|
200
|
+
`da-vinci audit --mode integrity <project-path>`
|
|
201
|
+
|
|
202
|
+
在工作中跑,尤其是在第一次成功写入 `.pen` 之后。
|
|
203
|
+
|
|
204
|
+
### Completion Audit
|
|
205
|
+
|
|
206
|
+
`da-vinci audit --mode completion --change <change-id> <project-path>`
|
|
207
|
+
|
|
208
|
+
在任何终态完成声明前跑。
|
|
209
|
+
|
|
210
|
+
## 流程图
|
|
211
|
+
|
|
212
|
+
```mermaid
|
|
213
|
+
flowchart TD
|
|
214
|
+
A[选择 mode 或使用 intake/prompt/continue] --> B[生成 discovery 和 scope 工件]
|
|
215
|
+
B --> C[在 design-registry.md 中登记项目内 .pen]
|
|
216
|
+
C --> D[渲染 1 到 3 个 anchor surfaces]
|
|
217
|
+
D --> E{design checkpoint 通过?}
|
|
218
|
+
E -- 否 --> D
|
|
219
|
+
E -- 是 --> F[持久化并收敛项目内 .pen]
|
|
220
|
+
F --> G{design-source checkpoint 通过?}
|
|
221
|
+
G -- 否 --> F
|
|
222
|
+
G -- 是 --> H[运行 MCP runtime gate 和 integrity audit]
|
|
223
|
+
H --> I{runtime 与 integrity 健康?}
|
|
224
|
+
I -- 否 --> F
|
|
225
|
+
I -- 是 --> J[建立 pencil-bindings.md 和 page mapping]
|
|
226
|
+
J --> K{mapping checkpoint 通过?}
|
|
227
|
+
K -- 否 --> J
|
|
228
|
+
K -- 是 --> L[生成任务并实现]
|
|
229
|
+
L --> M[运行 verification]
|
|
230
|
+
M --> N{completion audit 通过?}
|
|
231
|
+
N -- 否 --> F
|
|
232
|
+
N -- 是 --> O[workflow complete]
|
|
233
|
+
```
|
package/lib/audit.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const path = require("path");
|
|
3
|
+
const { getStandardPenStatePath, readPenState, hashPenDocument, readPenDocument } = require("./pen-persistence");
|
|
4
|
+
const { getSessionStatePath, readSessionState } = require("./pencil-session");
|
|
3
5
|
|
|
4
6
|
const IMAGE_EXPORT_PATTERN = /\.(png|jpe?g|webp|pdf)$/i;
|
|
5
7
|
|
|
@@ -105,9 +107,12 @@ function resolveScopedChangeDirs(projectRoot, changesDir, options, failures, war
|
|
|
105
107
|
}
|
|
106
108
|
|
|
107
109
|
function addMissingArtifacts(projectRoot, artifactPaths, targetList) {
|
|
108
|
-
for (const artifactPath of artifactPaths) {
|
|
110
|
+
for (const artifactPath of [...new Set(artifactPaths)]) {
|
|
109
111
|
if (!pathExists(artifactPath)) {
|
|
110
|
-
|
|
112
|
+
const message = `Missing required artifact: ${relativeTo(projectRoot, artifactPath)}`;
|
|
113
|
+
if (!targetList.includes(message)) {
|
|
114
|
+
targetList.push(message);
|
|
115
|
+
}
|
|
111
116
|
}
|
|
112
117
|
}
|
|
113
118
|
}
|
|
@@ -119,6 +124,7 @@ function auditProject(projectPathInput, options = {}) {
|
|
|
119
124
|
const designsDir = path.join(daVinciDir, "designs");
|
|
120
125
|
const changesDir = path.join(daVinciDir, "changes");
|
|
121
126
|
const designRegistryPath = path.join(daVinciDir, "design-registry.md");
|
|
127
|
+
const pencilSessionPath = getSessionStatePath(projectRoot);
|
|
122
128
|
|
|
123
129
|
const failures = [];
|
|
124
130
|
const warnings = [];
|
|
@@ -228,6 +234,64 @@ function auditProject(projectPathInput, options = {}) {
|
|
|
228
234
|
failures.push(
|
|
229
235
|
`Registered design source is missing on disk: ${relativeTo(projectRoot, registeredPenPath)}`
|
|
230
236
|
);
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const statePath = getStandardPenStatePath(registeredPenPath);
|
|
241
|
+
const state = readPenState(registeredPenPath);
|
|
242
|
+
if (!state) {
|
|
243
|
+
const message = `Registered design source is missing state metadata: ${relativeTo(projectRoot, statePath)}`;
|
|
244
|
+
if (mode === "completion") {
|
|
245
|
+
failures.push(message);
|
|
246
|
+
} else {
|
|
247
|
+
warnings.push(message);
|
|
248
|
+
}
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const persistedDocument = readPenDocument(registeredPenPath);
|
|
253
|
+
const currentHash = hashPenDocument(persistedDocument);
|
|
254
|
+
if (state.snapshotHash !== currentHash) {
|
|
255
|
+
failures.push(
|
|
256
|
+
`Registered design source hash does not match its state metadata: ${relativeTo(projectRoot, registeredPenPath)}`
|
|
257
|
+
);
|
|
258
|
+
} else {
|
|
259
|
+
notes.push(
|
|
260
|
+
`Detected persisted design-source hash for ${relativeTo(projectRoot, registeredPenPath)}.`
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const sessionState = readSessionState(projectRoot);
|
|
266
|
+
if (registeredPenPaths.length > 0 || penFiles.length > 0) {
|
|
267
|
+
if (!sessionState) {
|
|
268
|
+
const message = `Missing Pencil session state: ${relativeTo(projectRoot, pencilSessionPath)}`;
|
|
269
|
+
if (mode === "completion") {
|
|
270
|
+
failures.push(message);
|
|
271
|
+
} else {
|
|
272
|
+
warnings.push(message);
|
|
273
|
+
}
|
|
274
|
+
} else {
|
|
275
|
+
if (!sessionState.penPath) {
|
|
276
|
+
failures.push("Pencil session state is missing the bound `.pen` path.");
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (mode === "completion" && sessionState.status !== "closed") {
|
|
280
|
+
failures.push("Completion audit requires the Pencil session to be ended and recorded as `closed`.");
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
if (sessionState.penPath && pathExists(sessionState.penPath)) {
|
|
284
|
+
const penState = readPenState(sessionState.penPath);
|
|
285
|
+
const persistedHash = penState && penState.snapshotHash ? String(penState.snapshotHash) : "";
|
|
286
|
+
|
|
287
|
+
if (sessionState.lastPersistedHash && persistedHash && sessionState.lastPersistedHash !== persistedHash) {
|
|
288
|
+
failures.push("Pencil session state hash does not match the current persisted `.pen` state hash.");
|
|
289
|
+
} else if (persistedHash) {
|
|
290
|
+
notes.push(
|
|
291
|
+
`Detected Pencil session state for ${relativeTo(projectRoot, sessionState.penPath)}.`
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
231
295
|
}
|
|
232
296
|
}
|
|
233
297
|
|