@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.
Files changed (62) hide show
  1. package/CHANGELOG.md +23 -3
  2. package/README.md +48 -6
  3. package/README.zh-CN.md +46 -7
  4. package/SKILL.md +70 -3
  5. package/commands/claude/da-vinci.md +1 -0
  6. package/commands/claude/dv/continue.md +2 -0
  7. package/commands/claude/dv/design.md +3 -2
  8. package/commands/claude/dv/intake.md +2 -0
  9. package/commands/codex/prompts/da-vinci.md +1 -0
  10. package/commands/codex/prompts/dv-continue.md +2 -0
  11. package/commands/codex/prompts/dv-design.md +3 -2
  12. package/commands/codex/prompts/dv-intake.md +2 -1
  13. package/commands/gemini/da-vinci.toml +1 -0
  14. package/commands/gemini/dv/continue.toml +2 -0
  15. package/commands/gemini/dv/design.toml +3 -2
  16. package/commands/gemini/dv/intake.toml +2 -0
  17. package/docs/codex-natural-language-usage.md +8 -0
  18. package/docs/dv-command-reference.md +401 -0
  19. package/docs/mode-use-cases.md +96 -4
  20. package/docs/pencil-rendering-workflow.md +231 -0
  21. package/docs/prompt-entrypoints.md +25 -0
  22. package/docs/prompt-presets/README.md +81 -1
  23. package/docs/prompt-presets/desktop-app.md +62 -4
  24. package/docs/prompt-presets/mobile-app.md +62 -4
  25. package/docs/prompt-presets/tablet-app.md +62 -4
  26. package/docs/prompt-presets/web-app.md +62 -4
  27. package/docs/visual-adapters.md +12 -0
  28. package/docs/workflow-examples.md +30 -6
  29. package/docs/workflow-overview.md +231 -0
  30. package/docs/zh-CN/codex-natural-language-usage.md +8 -0
  31. package/docs/zh-CN/dv-command-reference.md +401 -0
  32. package/docs/zh-CN/mode-use-cases.md +54 -8
  33. package/docs/zh-CN/pencil-rendering-workflow.md +233 -0
  34. package/docs/zh-CN/prompt-entrypoints.md +23 -0
  35. package/docs/zh-CN/prompt-presets/README.md +81 -1
  36. package/docs/zh-CN/prompt-presets/desktop-app.md +62 -4
  37. package/docs/zh-CN/prompt-presets/mobile-app.md +62 -4
  38. package/docs/zh-CN/prompt-presets/tablet-app.md +62 -4
  39. package/docs/zh-CN/prompt-presets/web-app.md +62 -4
  40. package/docs/zh-CN/visual-adapters.md +12 -0
  41. package/docs/zh-CN/workflow-examples.md +31 -4
  42. package/docs/zh-CN/workflow-overview.md +233 -0
  43. package/lib/audit.js +66 -2
  44. package/lib/cli.js +262 -2
  45. package/lib/mcp-runtime-gate.js +53 -1
  46. package/lib/pen-persistence.js +192 -3
  47. package/lib/pencil-lock.js +128 -0
  48. package/lib/pencil-session.js +229 -0
  49. package/package.json +4 -1
  50. package/references/artifact-templates.md +46 -0
  51. package/references/checkpoints.md +21 -1
  52. package/references/design-inputs.md +6 -0
  53. package/references/modes.md +34 -0
  54. package/references/page-mapping.md +58 -0
  55. package/references/pencil-design-to-code.md +15 -2
  56. package/references/platform-adapters.md +1 -0
  57. package/references/prompt-recipes.md +39 -0
  58. package/scripts/test-mcp-runtime-gate.js +88 -0
  59. package/scripts/test-mode-consistency.js +155 -0
  60. package/scripts/test-pen-persistence.js +146 -6
  61. package/scripts/test-pencil-session.js +152 -0
  62. package/scripts/test-persistence-flows.js +315 -0
package/CHANGELOG.md CHANGED
@@ -1,16 +1,36 @@
1
1
  # Changelog
2
2
 
3
- ## v0.1.16 - 2026-03-28
3
+ ## v0.1.18 - 2026-03-28
4
+
5
+ ### Added
6
+ - `overhaul-from-code` as a fifth workflow mode for broad existing-product rewrites where the current codebase remains migration evidence, but new `proposal.md` and `specs/` become the target behavior truth
7
+ - `migration-contract.md` as a first-class change artifact for preserve / revise / retire / unknown decisions in overhaul work
8
+ - `docs/dv-command-reference.md` and `docs/zh-CN/dv-command-reference.md` to explain route responsibilities, stateful next-step recommendations, and verify rollback behavior
9
+
10
+ ### Changed
11
+ - intake, mode guides, prompt recipes, workflow examples, and natural-language usage now distinguish `overhaul-from-code` from `redesign-from-code` instead of forcing large product rewrites into UI-only redesign semantics
12
+ - workflow, checkpoint, and design-input guidance now require overhaul runs to stabilize `proposal.md`, `migration-contract.md`, target `specs/`, and `page-map.md` before broad Pencil generation
13
+ - visual-adapter and Pencil design guidance now explain how `overhaul-from-code` keeps current code as reference evidence while using the new truth sources to drive design and implementation
14
+ - prompt preset docs now include dedicated `overhaul-from-code` intake, breakdown, design, and continue templates for mobile, desktop, web, and tablet surfaces
15
+ - page-mapping, checkpoint, and command-reference docs now explain how to recover when bindings still exist but either implementation or the design source is missing
16
+
17
+ ## v0.1.17 - 2026-03-28
4
18
 
5
19
  ### Added
6
20
  - `da-vinci preflight-pencil` as a static preflight for non-trivial Pencil `batch_design` payloads, catching common syntax and schema drift before they hit MCP
7
21
  - `da-vinci write-pen` to atomically write a project-local `.pen` from MCP-readable node and variable snapshot data
8
- - `da-vinci snapshot-pen` to reopen an existing `.pen`, capture a fresh MCP-readable snapshot, and rewrite a canonical project-local `.pen` with reopen verification
22
+ - `da-vinci ensure-pen` to seed or verify a registered project-local `.pen` before live editing starts
23
+ - `da-vinci check-pen-sync` to compare a current live MCP snapshot payload against the persisted project-local `.pen`
24
+ - `da-vinci pencil-lock` to serialize Pencil MCP write access across multiple projects on the same machine
25
+ - `da-vinci pencil-session begin / persist / end / status` as the preferred session-level wrapper for seeded `.pen` ownership, persistence, sync checks, and lock release
26
+ - `scripts/test-pencil-session.js` and `scripts/test-persistence-flows.js` to cover session lifecycle plus new/existing/parallel project flows
9
27
 
10
28
  ### Changed
11
29
  - active Pencil guidance now requires smaller anchor-surface batches, micro-batch fallback after repeated rollbacks, and structured screenshot-review records instead of self-affirming prose
12
30
  - design routes, prompt presets, workflow examples, and README guidance now call for `da-vinci audit --mode integrity <project-path>` immediately after the first successful Pencil write during active redesign work
13
- - project-local `.pen` persistence now treats headless interactive `save()` as non-authoritative; first-run sessions must persist the first approved live MCP snapshot, and resume sessions must overwrite the registered `.pen` from the current snapshot after material live edits
31
+ - project-local `.pen` persistence now treats headless interactive `save()` as non-authoritative; redesign passes should seed the registered `.pen` before the first edit, then persist current live MCP snapshots back to that same path after material edits
32
+ - `da-vinci snapshot-pen` is now documented and treated as a disk-to-disk utility only, not as a live-edit persistence step
33
+ - completion audit now expects `.da-vinci/state/pencil-session.json` plus matching persisted snapshot hashes before completion can pass
14
34
 
15
35
  ## v0.1.15 - 2026-03-27
16
36
 
package/README.md CHANGED
@@ -21,19 +21,23 @@ This workflow is intended for:
21
21
  - 0-to-1 product delivery
22
22
  - brainstorm-to-product delivery
23
23
  - redesign from existing code
24
+ - large existing-product overhauls where flows and logic also change
24
25
  - scoped feature delivery on an existing product
25
26
 
26
27
  ## Current release
27
28
 
28
29
  Latest published npm package:
29
30
 
30
- - `@xenonbyte/da-vinci-workflow@0.1.16`
31
+ - `@xenonbyte/da-vinci-workflow@0.1.18`
31
32
 
32
33
  Release highlights:
33
34
 
34
35
  - project-local `.pen` persistence now uses an MCP-snapshot-to-disk path instead of relying on headless interactive `save()`
36
+ - redesign runs now seed a registered project-local `.pen` before the first Pencil edit and record persisted snapshot hashes for later sync checks
35
37
  - `da-vinci write-pen` now atomically writes workflow-owned `.pen` files from MCP-readable node and variable payloads with optional reopen verification
36
- - `da-vinci snapshot-pen` now rebuilds a canonical local `.pen` from an existing Pencil source and verifies reopen with Pencil
38
+ - `da-vinci ensure-pen` now seeds or verifies a registered project-local `.pen` before live editing starts
39
+ - `da-vinci check-pen-sync` now compares a current live MCP snapshot payload against the persisted project-local `.pen`
40
+ - `da-vinci snapshot-pen` now serves only as a disk-to-disk utility for rebuilding an existing Pencil source and verifying reopen
37
41
  - visual-adapter execution now requires explicit runtime declaration of the resolved primary adapter and any unavailable requested adapters
38
42
  - cross-platform near-name adapters such as `frontend-skill` and `frontend-design` are now treated as distinct unless the current environment explicitly resolves them
39
43
  - complex `redesign-from-code` runs now require a visual thesis, content plan, interaction thesis, and anchor-surface structural-delta notes before broad Pencil generation
@@ -67,7 +71,7 @@ Release highlights:
67
71
 
68
72
  ## Supported workflow modes
69
73
 
70
- Da Vinci V2 supports four modes.
74
+ Da Vinci currently supports five modes.
71
75
 
72
76
  ### `greenfield-spec`
73
77
 
@@ -81,6 +85,10 @@ Use when the project is new but the inputs come from multiple rounds of rough pr
81
85
 
82
86
  Use when an existing project already has routes, pages, and UI, and the goal is a broad redesign or UI replacement.
83
87
 
88
+ ### `overhaul-from-code`
89
+
90
+ Use when an existing project is undergoing a broad system-level rewrite and current code is still valuable as migration evidence, but no longer the complete target behavior truth.
91
+
84
92
  ### `feature-change`
85
93
 
86
94
  Use when an existing product needs a scoped requirement change, page addition, or page update.
@@ -222,6 +230,7 @@ Depending on the mode, the workflow may use these artifacts:
222
230
  - `project-inventory.md`: current routes, pages, and UI patterns from an existing codebase
223
231
  - `DA-VINCI.md`: project-level visual contract for theme, palette, typography direction, component tone, and page-consistency rules
224
232
  - `design-brief.md`: form factor, style, density, brand constraints, and layout preferences
233
+ - `migration-contract.md`: preserve / revise / retire / unknown boundaries for existing-system overhaul work
225
234
  - `design-registry.md`: project-level `.pen` source inventory
226
235
  - `.da-vinci/designs/`: project-local persisted Pencil sources such as `project-baseline.pen` or change-specific `.pen` files
227
236
  - `page-map.md`: canonical page list and page responsibilities
@@ -239,6 +248,8 @@ Use specs as capability or redesign-slice boundaries, not as page counters.
239
248
 
240
249
  For broad `redesign-from-code` work, prefer multiple `specs/<slice>/spec.md` files over one oversized `ui-refresh/spec.md`.
241
250
 
251
+ For broad `overhaul-from-code` work, prefer multiple `specs/<slice>/spec.md` files plus one `migration-contract.md` over one oversized rewrite spec that mixes preserved and retired system behavior.
252
+
242
253
  ## Artifact placement
243
254
 
244
255
  Recommended project layout:
@@ -257,6 +268,7 @@ project/
257
268
  └── <change-id>/
258
269
  ├── brainstorm.md
259
270
  ├── design-brief.md
271
+ ├── migration-contract.md
260
272
  ├── proposal.md
261
273
  ├── design.md
262
274
  ├── pencil-design.md
@@ -329,6 +341,7 @@ Rules:
329
341
  - `page-map.md` is the source of truth for implementation pages
330
342
  - `pencil-bindings.md` is the source of truth for implementation page -> Pencil page mapping
331
343
  - in `redesign-from-code`, existing code is behavior truth, not layout truth
344
+ - in `overhaul-from-code`, existing code is reference evidence and migration baseline, not automatic final behavior truth
332
345
  - complex pages should be decomposed into subpages, states, overlays, and implementation surfaces before Pencil redesign is treated as final
333
346
  - the preferred `.pen` path recorded in `design-registry.md` is workflow-owned state, not user-authored config
334
347
  - when Pencil work starts, Da Vinci should use or create that exact project-local `.pen` path instead of relying on whichever Pencil document happens to be active
@@ -447,15 +460,23 @@ During active redesign work, prefer running `da-vinci audit --mode integrity <pr
447
460
 
448
461
  Project-local `.pen` persistence now has two supported paths:
449
462
 
450
- - first-run path: if no registered project-local `.pen` exists yet, let the first approved anchor surface happen in the live editor, then persist that approved MCP snapshot under `.da-vinci/designs/`
451
- - resume path: if a registered project-local `.pen` already exists, reopen it for continuity, but after material live edits persist a fresh MCP snapshot back to the same path instead of assuming interactive `save()` flushed it
463
+ - first-run path: seed the registered project-local `.pen` with `da-vinci ensure-pen --output <path> --verify-open`, open that exact path, then persist later MCP snapshot writes back to the same file
464
+ - resume path: if a registered project-local `.pen` already exists, reopen it for continuity, but after material live edits persist a fresh live MCP snapshot back to that same path and run `da-vinci check-pen-sync`
452
465
 
453
466
  Persistence helpers:
454
467
 
468
+ - preferred wrapper:
469
+ - `da-vinci pencil-session begin --project <project-path> --pen <path>`
470
+ - `da-vinci pencil-session persist --project <project-path> --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>`
471
+ - `da-vinci pencil-session end --project <project-path> --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>`
472
+ - `da-vinci ensure-pen --output <path> --verify-open`
455
473
  - `da-vinci write-pen --output <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version> --verify-open`
456
- - `da-vinci snapshot-pen --input <existing.pen> --output <target.pen> --verify-open`
474
+ - `da-vinci check-pen-sync --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>`
475
+ - `da-vinci snapshot-pen --input <existing.pen> --output <target.pen> --verify-open` (disk-to-disk only)
476
+ - `da-vinci pencil-lock acquire --project <project-path>` / `da-vinci pencil-lock release --project <project-path>`
457
477
 
458
478
  Do not treat headless interactive `save()` as authoritative persistence truth until the underlying Pencil behavior is proven reliable again.
479
+ Completion audit now also expects `.da-vinci/state/pencil-session.json` to reflect the latest persisted `.pen` hash, so autonomous runs should prefer the `pencil-session` wrapper.
459
480
 
460
481
  Installation targets:
461
482
 
@@ -551,6 +572,12 @@ $da-vinci use greenfield-brainstorm to turn several product ideas into a page ma
551
572
  $da-vinci use redesign-from-code to inventory the existing app, identify current pages, and generate a new Pencil-backed UI plan
552
573
  ```
553
574
 
575
+ ### Overhaul from code
576
+
577
+ ```text
578
+ $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 Pencil-backed overhaul plan
579
+ ```
580
+
554
581
  ### Feature change
555
582
 
556
583
  ```text
@@ -576,13 +603,25 @@ Use the existing Da Vinci artifacts.
576
603
  Continue into full-delivery.
577
604
  ```
578
605
 
606
+ ### Continue after overhaul planning
607
+
608
+ ```text
609
+ $da-vinci use continue for this existing overhaul-from-code workflow.
610
+
611
+ Use the existing Da Vinci artifacts.
612
+ Continue from proposal, migration-contract, and target specs into design or implementation.
613
+ ```
614
+
579
615
  ## Workflow examples
580
616
 
581
617
  See:
582
618
 
583
619
  - `docs/prompt-entrypoints.md`
620
+ - `docs/dv-command-reference.md`
584
621
  - `docs/prompt-presets/`
585
622
  - includes `Simple redesign`, `Complex redesign`, `Design-only`, and `Continue` variants in each surface file
623
+ - `docs/workflow-overview.md`
624
+ - `docs/pencil-rendering-workflow.md`
586
625
  - `docs/codex-natural-language-usage.md`
587
626
  - `docs/visual-adapters.md`
588
627
  - `docs/visual-assist-presets/`
@@ -594,8 +633,11 @@ See:
594
633
  Chinese companion documents are included in this repository:
595
634
 
596
635
  - `README.zh-CN.md`
636
+ - `docs/zh-CN/dv-command-reference.md`
597
637
  - `docs/zh-CN/prompt-presets/`
598
638
  - each surface file also includes `Simple redesign`, `Complex redesign`, `Design-only`, and `Continue`
639
+ - `docs/zh-CN/workflow-overview.md`
640
+ - `docs/zh-CN/pencil-rendering-workflow.md`
599
641
  - `docs/zh-CN/visual-adapters.md`
600
642
  - `docs/zh-CN/visual-assist-presets/`
601
643
  - `docs/zh-CN/`
package/README.zh-CN.md CHANGED
@@ -23,19 +23,23 @@ Da Vinci 是一个把产品需求一路推进到结构化规格、Pencil 设计
23
23
  - 0 到 1 的产品交付
24
24
  - 从 brainstorming 走向可实施产品
25
25
  - 基于现有代码做全局 UI 重设计
26
+ - 基于现有代码做流程、逻辑和 UI 一起变化的大改版
26
27
  - 在现有产品上做范围明确的 feature-change
27
28
 
28
29
  ## 当前发布状态
29
30
 
30
31
  最新已发布 npm 包:
31
32
 
32
- - `@xenonbyte/da-vinci-workflow@0.1.16`
33
+ - `@xenonbyte/da-vinci-workflow@0.1.18`
33
34
 
34
35
  已发布版本重点:
35
36
 
36
37
  - 项目内 `.pen` 持久化现在改为“从 MCP 快照写回磁盘”的正式路径,不再依赖 headless interactive `save()`
38
+ - 重设计流程现在要求在第一次 Pencil 编辑前先 seed 一个登记好的项目内 `.pen`,并记录后续持久化快照 hash 以便做同步校验
37
39
  - `da-vinci write-pen` 现在可以把 MCP 可读的节点和变量快照原子写成工作流管理的 `.pen` 文件,并可选地做 reopen 校验
38
- - `da-vinci snapshot-pen` 现在可以从现有 Pencil 源重建一个规范化的本地 `.pen`,并验证重新打开结果
40
+ - `da-vinci ensure-pen` 现在可以在 live 编辑开始前 seed 或校验登记好的项目内 `.pen`
41
+ - `da-vinci check-pen-sync` 现在可以把当前 live MCP 快照和已持久化的项目内 `.pen` 做同步比对
42
+ - `da-vinci snapshot-pen` 现在只作为 disk-to-disk 工具,用来从已有 Pencil 源重建规范化 `.pen` 并验证重新打开结果
39
43
  - visual adapter 的执行现在要求在运行时明确声明解析出来的主 adapter,以及哪些请求的 adapter 当前不可用
40
44
  - `frontend-skill`、`frontend-design` 这类跨平台近名 adapter 现在明确视为不同能力源,除非当前环境真的解析到了它们
41
45
  - 复杂 `redesign-from-code` 现在要求在大规模 Pencil 设计前先写 visual thesis、content plan、interaction thesis 和 anchor surface 的 structural-delta 说明
@@ -69,7 +73,7 @@ Da Vinci 是一个把产品需求一路推进到结构化规格、Pencil 设计
69
73
 
70
74
  ## 支持的工作流模式
71
75
 
72
- Da Vinci V2 支持四种模式:
76
+ Da Vinci 当前支持五种模式:
73
77
 
74
78
  ### `greenfield-spec`
75
79
 
@@ -83,6 +87,10 @@ Da Vinci V2 支持四种模式:
83
87
 
84
88
  已有项目,代码和行为已存在,目标是做广泛或全局的 UI 重设计。
85
89
 
90
+ ### `overhaul-from-code`
91
+
92
+ 已有项目,但目标是做系统级大改版;现有代码仍然是迁移基线和参考证据,但不再天然等于新版本的最终行为真相。
93
+
86
94
  ### `feature-change`
87
95
 
88
96
  已有项目,只做某个功能、页面、流程的局部修改。
@@ -227,6 +235,7 @@ Da Vinci 的默认顺序是:
227
235
  - `project-inventory.md`:现有代码库里的路由、页面、UI 结构盘点
228
236
  - `DA-VINCI.md`:项目级视觉契约
229
237
  - `design-brief.md`:设计方向、形态、密度、品牌和限制条件
238
+ - `migration-contract.md`:存量系统在大改版中哪些保留、修改、废弃、待确认的边界
230
239
  - `design-registry.md`:项目级 `.pen` 设计源登记
231
240
  - `.da-vinci/designs/`:项目内持久化的 Pencil 设计源,例如 `project-baseline.pen` 或按 change 保存的 `.pen` 文件
232
241
  - `page-map.md`:页面、职责、状态和共享区域
@@ -256,6 +265,7 @@ project/
256
265
  └── <change-id>/
257
266
  ├── brainstorm.md
258
267
  ├── design-brief.md
268
+ ├── migration-contract.md
259
269
  ├── proposal.md
260
270
  ├── design.md
261
271
  ├── pencil-design.md
@@ -281,6 +291,7 @@ project/
281
291
  - `page-map.md` 是实现页面和状态的真相源
282
292
  - `pencil-bindings.md` 是实现页面到 Pencil 页面绑定的真相源
283
293
  - 在 `redesign-from-code` 里,现有代码只是真相行为,不是真相布局
294
+ - 在 `overhaul-from-code` 里,现有代码是参考基线和迁移约束,不是新系统天然的最终行为真相
284
295
  - 复杂页面在 Pencil 重设计前应该先拆成 subpage、state、overlay 和 implementation surface
285
296
  - `design-registry.md` 里登记的首选 `.pen` 路径属于工作流自动维护的状态,不应该依赖用户手工填写
286
297
  - 一旦进入 Pencil 设计,Da Vinci 应该使用或创建这个项目内 `.pen` 路径,而不是继续沿用当前随手打开的 Pencil 文档
@@ -376,16 +387,23 @@ da-vinci uninstall --platform codex,claude,gemini
376
387
 
377
388
  项目内 `.pen` 持久化现在分成两条受支持路径:
378
389
 
379
- - 首次运行路径:如果当前还没有登记的项目内 `.pen`,先允许第一个通过审查的 anchor surface live editor 里完成,然后把这个 MCP 快照持久化到 `.da-vinci/designs/`
380
- - 继续迭代路径:如果项目里原本已有登记的 `.pen`,先打开它继续工作;但发生实质性 live edit 后,要把当前 MCP 快照重新持久化回同一路径,而不是假设 interactive `save()` 已经刷回磁盘
390
+ - 首次运行路径:先用 `da-vinci ensure-pen --output <path> --verify-open` seed 登记好的项目内 `.pen`,打开这个精确路径,然后把后续 MCP 快照持续写回同一个文件
391
+ - 继续迭代路径:如果项目里原本已有登记的 `.pen`,先打开它继续工作;但发生实质性 live edit 后,要把当前 live MCP 快照重新持久化回同一路径,并运行 `da-vinci check-pen-sync`
381
392
 
382
393
  推荐使用的持久化命令:
383
394
 
395
+ - 优先使用封装好的 session 命令:
396
+ - `da-vinci pencil-session begin --project <project-path> --pen <path>`
397
+ - `da-vinci pencil-session persist --project <project-path> --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>`
398
+ - `da-vinci pencil-session end --project <project-path> --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>`
399
+ - `da-vinci ensure-pen --output <path> --verify-open`
384
400
  - `da-vinci write-pen --output <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version> --verify-open`
385
- - `da-vinci snapshot-pen --input <existing.pen> --output <target.pen> --verify-open`
401
+ - `da-vinci check-pen-sync --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>`
402
+ - `da-vinci snapshot-pen --input <existing.pen> --output <target.pen> --verify-open`(仅限 disk-to-disk)
403
+ - `da-vinci pencil-lock acquire --project <project-path>` / `da-vinci pencil-lock release --project <project-path>`
386
404
 
387
405
  在 Pencil 底层 `save()` 语义再次被证明可靠之前,不要把 headless interactive `save()` 当作权威持久化真相。
388
- 在重设计进行中,建议在第一次成功写入 Pencil 后立刻跑一次 `da-vinci audit --mode integrity <project-path>`;如果同一个 anchor surface 连续回滚两次,就配合 `da-vinci preflight-pencil` 改成更小的后续批次。
406
+ completion audit 现在还会检查 `.da-vinci/state/pencil-session.json` 是否记录了最新的 `.pen` hash,所以自治运行优先走 `pencil-session` 封装。
389
407
 
390
408
  安装目标:
391
409
 
@@ -464,6 +482,12 @@ $da-vinci use greenfield-brainstorm to turn several product ideas into a page ma
464
482
  $da-vinci use redesign-from-code to inventory the existing app, identify current pages, and generate a new Pencil-backed UI plan
465
483
  ```
466
484
 
485
+ ### Overhaul from code
486
+
487
+ ```text
488
+ $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 Pencil-backed overhaul plan
489
+ ```
490
+
467
491
  ### Feature change
468
492
 
469
493
  ```text
@@ -489,14 +513,26 @@ Use the existing Da Vinci artifacts.
489
513
  Continue into full-delivery.
490
514
  ```
491
515
 
516
+ ### 大改版场景继续推进
517
+
518
+ ```text
519
+ $da-vinci use continue for this existing overhaul-from-code workflow.
520
+
521
+ Use the existing Da Vinci artifacts.
522
+ Continue from proposal, migration-contract, and target specs into design or implementation.
523
+ ```
524
+
492
525
  ## 文档导航
493
526
 
494
527
  英文文档:
495
528
 
496
529
  - `docs/codex-natural-language-usage.md`
530
+ - `docs/dv-command-reference.md`
497
531
  - `docs/prompt-entrypoints.md`
498
532
  - `docs/prompt-presets/`
499
533
  - 每个场景文件都包含 `Simple redesign`、`Complex redesign`、`Design-only`、`Continue`
534
+ - `docs/workflow-overview.md`
535
+ - `docs/pencil-rendering-workflow.md`
500
536
  - `docs/visual-adapters.md`
501
537
  - `docs/visual-assist-presets/`
502
538
  - `docs/workflow-examples.md`
@@ -506,8 +542,11 @@ Continue into full-delivery.
506
542
  中文文档:
507
543
 
508
544
  - `README.zh-CN.md`
545
+ - `docs/zh-CN/dv-command-reference.md`
509
546
  - `docs/zh-CN/prompt-presets/`
510
547
  - 每个场景文件也都包含 `Simple redesign`、`Complex redesign`、`Design-only`、`Continue`
548
+ - `docs/zh-CN/workflow-overview.md`
549
+ - `docs/zh-CN/pencil-rendering-workflow.md`
511
550
  - `docs/zh-CN/visual-adapters.md`
512
551
  - `docs/zh-CN/visual-assist-presets/`
513
552
  - `docs/zh-CN/`
package/SKILL.md CHANGED
@@ -16,6 +16,7 @@ Keep these rules fixed:
16
16
  - Tasks decide implementation order.
17
17
  - Code must follow both requirements and Pencil data.
18
18
  - Existing code is behavior truth, not layout truth, during `redesign-from-code`.
19
+ - Existing code is reference evidence and migration baseline, not default final behavior truth, during `overhaul-from-code`.
19
20
  - When requirements and Pencil drift apart, stop and update the source artifacts before continuing implementation.
20
21
 
21
22
  ## Execution Policy
@@ -75,6 +76,25 @@ Do not stop merely because:
75
76
 
76
77
  Those are warnings unless they prevent safe implementation of the current in-scope work.
77
78
 
79
+ ## Next-Step Recommendation Discipline
80
+
81
+ When Da Vinci reports a "next recommended step" or offers route suggestions, make the recommendation stateful rather than listing every possible command as if they were equally valid.
82
+
83
+ Use this order:
84
+
85
+ - if discovery or design-source artifacts are still missing, recommend the missing discovery or design work first
86
+ - if design is still blocking, recommend `design`
87
+ - if design is ready enough for implementation planning but `.da-vinci/changes/<change-id>/tasks.md` does not exist yet, recommend `tasks`
88
+ - if `tasks.md` exists and `task checkpoint` is at least `PASS` or an explicitly accepted `WARN`, recommend `build`
89
+ - if implementation is already underway or complete enough to check drift, recommend `verify`
90
+
91
+ Hard rules:
92
+
93
+ - do not present `build` as a co-equal next step when `tasks.md` does not exist yet
94
+ - do not present `build` as the primary next step immediately after design completion unless task generation is already done and implementation readiness is clear
95
+ - if design is complete but more in-scope surfaces still need design work, `design` may remain an optional branch, but `tasks` stays the primary next step before `build`
96
+ - if multiple commands are shown, clearly mark only one as the primary next step for the current workflow state
97
+
78
98
  ## Invocation Model
79
99
 
80
100
  Canonical workflow name is `da-vinci`.
@@ -134,7 +154,10 @@ Supported modes:
134
154
  3. `redesign-from-code`
135
155
  - use when an existing product already has code and the UI must be redesigned globally or broadly
136
156
 
137
- 4. `feature-change`
157
+ 4. `overhaul-from-code`
158
+ - use when an existing product needs a broad system-level rewrite where flows, logic, information architecture, and UI may all change
159
+
160
+ 5. `feature-change`
138
161
  - use when an existing product needs a scoped requirement change, page addition, or page update
139
162
 
140
163
  If the user does not specify a mode:
@@ -142,6 +165,7 @@ If the user does not specify a mode:
142
165
  - choose `greenfield-spec` for new projects with clear requirements
143
166
  - choose `greenfield-brainstorm` for exploratory new product ideation
144
167
  - choose `redesign-from-code` for broad UI replacement on existing code
168
+ - choose `overhaul-from-code` for broad existing-project rewrites where old code is no longer the full behavior truth
145
169
  - choose `feature-change` for incremental product work
146
170
 
147
171
  ## Design Input Collection
@@ -229,12 +253,21 @@ During active Pencil work:
229
253
  - when shell access is available, preflight non-trivial `batch_design` operation strings before sending them to Pencil
230
254
  - prefer 12 or fewer operations on anchor-surface batches; if the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds
231
255
  - do not rely on headless interactive `save()` as the persistence truth; when live MCP edits exist, persist project-local `.pen` files from MCP-readable document snapshots
232
- - when no registered project-local `.pen` exists yet, let the first anchor work happen in the live editor, then persist the first complete MCP snapshot to the registered `.pen` path before broad expansion continues
233
- - when a registered project-local `.pen` already exists, reopen it for continuity, but after material live edits persist a fresh MCP snapshot back to the same path instead of assuming live edits were flushed automatically
256
+ - prefer the session wrapper commands:
257
+ `da-vinci pencil-session begin --project <project-path> --pen <path>`
258
+ `da-vinci pencil-session persist --project <project-path> --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>`
259
+ `da-vinci pencil-session end --project <project-path> --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>`
260
+ - before the first Pencil edit on a redesign pass, begin a Pencil session so the registered project-local `.pen` exists before editing and the global Pencil lock is held for that project
261
+ - acquire the global Pencil lock before MCP write operations on a project and release it after the write phase so two projects do not compete for the same active editor
262
+ - when a registered project-local `.pen` already exists, reopen it for continuity, but after material live edits persist a fresh MCP snapshot back to that same path instead of assuming live edits were flushed automatically
263
+ - `da-vinci snapshot-pen` is a disk-to-disk utility for rebuilding an existing `.pen`; do not use it as live-edit persistence
234
264
  - use `da-vinci write-pen --output <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version> --verify-open` to atomically write the registered project-local `.pen` from MCP snapshot data
265
+ - after writing the project-local `.pen`, run `da-vinci check-pen-sync --pen <path> --nodes-file <batch-get-json> --variables-file <get-variables-json> --version <version>` before treating the disk source as current
266
+ - completion audit expects a recorded Pencil session state under `.da-vinci/state/pencil-session.json`; do not bypass the session wrapper on autonomous runs
235
267
  - after the first successful Pencil write, verify that the registered project-local `.pen` path exists as a shell-visible file before treating the design source as persistent
236
268
  - after the first successful Pencil write, run `da-vinci audit --mode integrity <project-path>` when shell access is available before broad expansion continues
237
269
  - after the first successful Pencil write, run the MCP runtime gate when Pencil MCP is available and record the result in `pencil-design.md`
270
+ - if the workflow already has a registered `.pen`, do not send Pencil write operations with an empty `filePath`
238
271
  - do not treat an unnamed live editor such as `new` as a persisted project design source; reconcile it to the registered project-local `.pen` path before the design pass is considered traceable
239
272
  - use only Pencil-supported properties; do not emit web- or CSS-only layout properties such as `flex` or `margin`
240
273
  - if unsupported Pencil properties cause repeated rolled-back batches on the same anchor surface, treat that pass as unstable and fix the schema usage before expanding further
@@ -369,6 +402,12 @@ Use these minimum flows:
369
402
 
370
403
  For broad refreshes, treat `.da-vinci/changes/<change-id>/specs/` as a redesign-slice directory, not as a single-file location.
371
404
 
405
+ ### `overhaul-from-code`
406
+
407
+ `.da-vinci/project-inventory` -> `.da-vinci/changes/<change-id>/proposal` -> `.da-vinci/changes/<change-id>/migration-contract` -> `.da-vinci/changes/<change-id>/specs` -> `.da-vinci/page-map` -> `DA-VINCI` -> `.da-vinci/design-registry` -> `.da-vinci/changes/<change-id>/design-brief` -> `.da-vinci/changes/<change-id>/design` -> `.da-vinci/changes/<change-id>/pencil-design` -> `.da-vinci/changes/<change-id>/pencil-bindings` -> `.da-vinci/changes/<change-id>/tasks` -> `.da-vinci/changes/<change-id>/verification`
408
+
409
+ For broad overhauls, treat `.da-vinci/changes/<change-id>/specs/` as an overhaul-slice directory and keep `migration-contract.md` singular for preserve/revise/retire decisions.
410
+
372
411
  ### `feature-change`
373
412
 
374
413
  `.da-vinci/changes/<change-id>/proposal` -> `.da-vinci/changes/<change-id>/specs` -> `.da-vinci/page-map` for affected pages -> `DA-VINCI` -> `.da-vinci/design-registry` -> `.da-vinci/changes/<change-id>/design` -> `.da-vinci/changes/<change-id>/pencil-design` delta -> `.da-vinci/changes/<change-id>/pencil-bindings` delta -> `.da-vinci/changes/<change-id>/tasks` -> `.da-vinci/changes/<change-id>/verification`
@@ -396,6 +435,15 @@ If the active mode is `redesign-from-code`:
396
435
  - default to fresh visual composition unless the user explicitly asks to preserve the current layout skeleton
397
436
  - partition specs by redesign slice when one oversized `ui-refresh` spec would hide important implementation boundaries
398
437
 
438
+ If the active mode is `overhaul-from-code`:
439
+
440
+ - inventory current routes, pages, modules, key flows, integrations, and permission boundaries before redefining the target product
441
+ - treat existing code as reference evidence and migration baseline rather than default final behavior truth
442
+ - classify current system areas into `preserve`, `revise`, `retire`, and `unknown` in `migration-contract.md`
443
+ - stabilize new `proposal.md` and `specs/` before broad Pencil design or implementation
444
+ - update `page-map.md` to reflect the new target page set, not only the old route tree
445
+ - route verify failures back to `migration-contract.md`, `page-map.md`, or specs when overhaul truth is still unstable
446
+
399
447
  ## Spec Partitioning Rules
400
448
 
401
449
  Do not default to one oversized `ui-refresh` spec for broad redesign work.
@@ -429,6 +477,24 @@ One redesign spec is acceptable when the refresh is mostly cosmetic, narrow, or
429
477
 
430
478
  Do not split page-by-page unless the product is unusually fragmented. Prefer implementable redesign slices over raw page counts.
431
479
 
480
+ For `overhaul-from-code`:
481
+
482
+ - keep one overall `proposal.md`
483
+ - keep one `migration-contract.md`
484
+ - keep one project-level `DA-VINCI.md`
485
+ - keep one project-level `project-inventory.md`
486
+ - keep one project-level `design-registry.md`
487
+ - keep one project-level `page-map.md`
488
+ - split `specs/` by overhaul slice when the rewrite spans multiple implementation or migration boundaries
489
+
490
+ Preferred overhaul slices:
491
+
492
+ - `shell-and-navigation`
493
+ - `core-flows`
494
+ - `account-and-settings`
495
+ - `legacy-migration`
496
+ - `admin-or-restricted`
497
+
432
498
  ## Design Source Rules
433
499
 
434
500
  Use `design-registry.md` as the project-level inventory of `.pen` sources.
@@ -689,3 +755,4 @@ After meaningful work, report:
689
755
  5. blockers or drift
690
756
 
691
757
  Keep updates concise and operational.
758
+ Make `next recommended step` follow the state rules above; do not list `build` next to `tasks` as if they were equivalent when task generation has not happened yet.
@@ -22,6 +22,7 @@ Notes:
22
22
  - Requirements decide behavior.
23
23
  - Pencil decides presentation.
24
24
  - Code must follow both.
25
+ - After design but before `tasks.md` exists, prefer `/dv:tasks` as the next route; treat `/dv:build` as implementation-ready only.
25
26
  - If `Visual Assist` is configured, resolve and state the actual primary visual adapter for this environment instead of assuming cross-platform skill equivalence.
26
27
  - Keep `.da-vinci/designs/` reserved for `.pen` files only.
27
28
  - On complex redesigns, design 1-3 anchor surfaces first and treat screenshot review as a binding gate before broad expansion.
@@ -21,4 +21,6 @@ Output should include:
21
21
  Route discipline:
22
22
  - do not restart discovery if the current artifacts already contain enough truth
23
23
  - do not default the user into `/dv:build` unless the project is clearly implementation-ready
24
+ - if design artifacts exist but `tasks.md` does not, prefer a continuation prompt that moves into `/dv:tasks`
25
+ - only prefer `/dv:build` once task generation and implementation readiness are already clear
24
26
  - continuation prompts should usually target the main workflow entry so Da Vinci can resume the full state machine
@@ -20,8 +20,9 @@ Create or update:
20
20
  Run the `design checkpoint` before locking implementation tasks.
21
21
  Before non-trivial `batch_design` calls, preflight the Pencil operations when shell access is available.
22
22
  If the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds.
23
- If no registered project-local `.pen` exists yet, persist the first approved MCP snapshot under `.da-vinci/designs/` instead of relying on interactive `save()`.
24
- If a registered project-local `.pen` already exists, reopen it for continuity but persist a fresh MCP snapshot back to that same path after material live edits.
23
+ Prefer the session wrapper commands: `da-vinci pencil-session begin`, `da-vinci pencil-session persist`, and `da-vinci pencil-session end`.
24
+ Before the first Pencil edit, begin a Pencil session so the registered project-local `.pen` is seeded and locked before editing starts.
25
+ If a registered project-local `.pen` already exists, reopen it for continuity but persist a fresh live MCP snapshot back to that same path through `pencil-session persist` after material edits.
25
26
  After the first successful Pencil write, run `da-vinci audit --mode integrity <project-path>` before broad expansion continues.
26
27
  If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
27
28
  Screenshot review must record an explicit `PASS`, `WARN`, or `BLOCK` plus the issue list and revision outcome; "looks good" is not a valid review record.
@@ -24,3 +24,5 @@ Output should include:
24
24
  Route discipline:
25
25
  - do not default the user into `/dv:build`
26
26
  - `intake` should usually produce a main workflow prompt, not a build-only prompt
27
+ - prefer `redesign-from-code`, `overhaul-from-code`, or `feature-change` when the request starts from an existing project
28
+ - prefer `overhaul-from-code` when an existing project is redefining flows or logic rather than only replacing UI
@@ -21,6 +21,7 @@ Available routes:
21
21
 
22
22
  Important:
23
23
  - Treat `/prompts:*` as action selectors in Codex.
24
+ - After design but before `tasks.md` exists, prefer `/prompts:dv-tasks` as the next route; treat `/prompts:dv-build` as implementation-ready only.
24
25
  - If `Visual Assist` is configured, resolve and state the actual primary visual adapter for this environment instead of assuming cross-platform skill equivalence.
25
26
  - Keep `.da-vinci/designs/` reserved for `.pen` files only.
26
27
  - On complex redesigns, design 1-3 anchor surfaces first and treat screenshot review as a binding gate before broad expansion.
@@ -21,4 +21,6 @@ Output should include:
21
21
  Route discipline:
22
22
  - do not restart discovery if the current artifacts already contain enough truth
23
23
  - do not default the user into `/prompts:dv-build` unless the project is clearly implementation-ready
24
+ - if design artifacts exist but `tasks.md` does not, prefer a continuation prompt that moves into `/prompts:dv-tasks`
25
+ - only prefer `/prompts:dv-build` once task generation and implementation readiness are already clear
24
26
  - continuation prompts should usually target the main workflow entry so Da Vinci can resume the full state machine
@@ -14,8 +14,9 @@ Output should move the work toward:
14
14
  Use Pencil-backed structure as the design source when available.
15
15
  Before non-trivial `batch_design` calls, preflight the Pencil operations when shell access is available.
16
16
  If the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds.
17
- If no registered project-local `.pen` exists yet, persist the first approved MCP snapshot under `.da-vinci/designs/` instead of relying on interactive `save()`.
18
- If a registered project-local `.pen` already exists, reopen it for continuity but persist a fresh MCP snapshot back to that same path after material live edits.
17
+ Prefer the session wrapper commands: `da-vinci pencil-session begin`, `da-vinci pencil-session persist`, and `da-vinci pencil-session end`.
18
+ Before the first Pencil edit, begin a Pencil session so the registered project-local `.pen` is seeded and locked before editing starts.
19
+ If a registered project-local `.pen` already exists, reopen it for continuity but persist a fresh live MCP snapshot back to that same path through `pencil-session persist` after material edits.
19
20
  After the first successful Pencil write, run `da-vinci audit --mode integrity <project-path>` before broad expansion continues.
20
21
  If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
21
22
  Screenshot review must record an explicit `PASS`, `WARN`, or `BLOCK` plus the issue list and revision outcome; "looks good" is not a valid review record.
@@ -24,4 +24,5 @@ Output should include:
24
24
  Route discipline:
25
25
  - do not default the user into `/prompts:dv-build`
26
26
  - `intake` should usually produce a main workflow prompt, not a build-only prompt
27
- - prefer `redesign-from-code` or `feature-change` when the request starts from an existing project
27
+ - prefer `redesign-from-code`, `overhaul-from-code`, or `feature-change` when the request starts from an existing project
28
+ - prefer `overhaul-from-code` when an existing project is redefining flows or logic rather than only replacing UI
@@ -24,6 +24,7 @@ Notes:
24
24
  - Requirements decide behavior.
25
25
  - Pencil decides presentation.
26
26
  - Code must follow both.
27
+ - After design but before `tasks.md` exists, prefer `/dv:tasks` as the next route; treat `/dv:build` as implementation-ready only.
27
28
  - If `Visual Assist` is configured, resolve and state the actual primary visual adapter for this environment instead of assuming cross-platform skill equivalence.
28
29
  - Keep `.da-vinci/designs/` reserved for `.pen` files only.
29
30
  - On complex redesigns, design 1-3 anchor surfaces first and treat screenshot review as a binding gate before broad expansion.
@@ -20,5 +20,7 @@ Output should include:
20
20
  Route discipline:
21
21
  - do not restart discovery if the current artifacts already contain enough truth
22
22
  - do not default the user into `/dv:build` unless the project is clearly implementation-ready
23
+ - if design artifacts exist but `tasks.md` does not, prefer a continuation prompt that moves into `/dv:tasks`
24
+ - only prefer `/dv:build` once task generation and implementation readiness are already clear
23
25
  - continuation prompts should usually target the main workflow entry so Da Vinci can resume the full state machine
24
26
  """
@@ -13,8 +13,9 @@ Create or update:
13
13
  Use Pencil-backed page coverage as the source of presentation truth.
14
14
  Before non-trivial `batch_design` calls, preflight the Pencil operations when shell access is available.
15
15
  If the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds.
16
- If no registered project-local `.pen` exists yet, persist the first approved MCP snapshot under `.da-vinci/designs/` instead of relying on interactive `save()`.
17
- If a registered project-local `.pen` already exists, reopen it for continuity but persist a fresh MCP snapshot back to that same path after material live edits.
16
+ Prefer the session wrapper commands: `da-vinci pencil-session begin`, `da-vinci pencil-session persist`, and `da-vinci pencil-session end`.
17
+ Before the first Pencil edit, begin a Pencil session so the registered project-local `.pen` is seeded and locked before editing starts.
18
+ If a registered project-local `.pen` already exists, reopen it for continuity but persist a fresh live MCP snapshot back to that same path through `pencil-session persist` after material edits.
18
19
  After the first successful Pencil write, run `da-vinci audit --mode integrity <project-path>` before broad expansion continues.
19
20
  If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
20
21
  Screenshot review must record an explicit `PASS`, `WARN`, or `BLOCK` plus the issue list and revision outcome; "looks good" is not a valid review record.
@@ -23,4 +23,6 @@ Output should include:
23
23
  Route discipline:
24
24
  - do not default the user into `/dv:build`
25
25
  - `intake` should usually produce a main workflow prompt, not a build-only prompt
26
+ - prefer `redesign-from-code`, `overhaul-from-code`, or `feature-change` when the request starts from an existing project
27
+ - prefer `overhaul-from-code` when an existing project is redefining flows or logic rather than only replacing UI
26
28
  """