@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
@@ -65,6 +65,7 @@ Supported modes:
65
65
  - `greenfield-spec`
66
66
  - `greenfield-brainstorm`
67
67
  - `redesign-from-code`
68
+ - `overhaul-from-code`
68
69
  - `feature-change`
69
70
 
70
71
  ## Scenario Recipes
@@ -104,6 +105,12 @@ $da-vinci use redesign-from-code to inventory the current product, preserve exis
104
105
  $da-vinci use feature-change to add or update one scoped feature, generate any required Pencil design delta, and implement the change safely.
105
106
  ```
106
107
 
108
+ ### 5. Existing product with a large overhaul
109
+
110
+ ```text
111
+ $da-vinci use overhaul-from-code to inventory the current product, define preserve/revise/retire boundaries, rewrite the target flows and specs, and then generate Pencil-backed design work and implementation tasks.
112
+ ```
113
+
107
114
  ### 5. Existing Android project with global UI replacement
108
115
 
109
116
  ```text
@@ -175,4 +182,5 @@ Prefer:
175
182
 
176
183
  - `use intake` for unclear starts
177
184
  - `use redesign-from-code` for broad UI replacement
185
+ - `use overhaul-from-code` for broad existing-product rewrites where new specs replace old behavior truth
178
186
  - `use feature-change` for narrow existing-product work
@@ -0,0 +1,401 @@
1
+ # `dv:` Command Reference
2
+
3
+ This document explains the `dv:` routes as an operational state machine rather than a flat menu.
4
+
5
+ Use it when you need to know:
6
+
7
+ - what each `dv:` route does
8
+ - when each route should be the primary next step
9
+ - how the routes connect in normal delivery
10
+ - what to do when `verify` finds drift
11
+
12
+ Use [workflow-overview.md](/Users/xubo/x-skills/da-vinci/docs/workflow-overview.md) for the full end-to-end workflow and [pencil-rendering-workflow.md](/Users/xubo/x-skills/da-vinci/docs/pencil-rendering-workflow.md) for the dedicated Pencil rendering lifecycle.
13
+
14
+ ## Core Idea
15
+
16
+ The `dv:` routes are not meant to be equally likely next steps at every moment.
17
+
18
+ Da Vinci expects route recommendations to follow workflow state.
19
+
20
+ Default progression:
21
+
22
+ 1. `breakdown`
23
+ 2. `design`
24
+ 3. `tasks`
25
+ 4. `build`
26
+ 5. `verify`
27
+
28
+ Entry helpers:
29
+
30
+ - `intake`
31
+ - `prompt`
32
+ - `continue`
33
+
34
+ These helpers exist to select or resume the correct route. They are not substitutes for the main state machine.
35
+
36
+ ## Route Meanings
37
+
38
+ ### `/dv:intake`
39
+
40
+ Use when:
41
+
42
+ - the project situation is complex
43
+ - the user does not know how to phrase the first workflow request
44
+ - there are multiple truth sources
45
+
46
+ Outputs:
47
+
48
+ - recommended mode
49
+ - recommended delivery intent
50
+ - one executable first prompt
51
+ - one conservative alternative when useful
52
+ - one continuation prompt when useful
53
+
54
+ ### `/dv:prompt`
55
+
56
+ Use when:
57
+
58
+ - the scenario is already understood
59
+ - the user wants prompt text directly
60
+
61
+ Outputs:
62
+
63
+ - one or more copy-ready prompts
64
+
65
+ ### `/dv:continue`
66
+
67
+ Use when:
68
+
69
+ - `DA-VINCI.md` or `.da-vinci/` artifacts already exist
70
+ - the workflow paused and must resume
71
+
72
+ Outputs:
73
+
74
+ - detected workflow state
75
+ - missing or weak artifacts
76
+ - one primary continuation prompt
77
+ - one conservative continuation prompt when useful
78
+
79
+ Important continuation rule:
80
+
81
+ - if design exists but `tasks.md` does not, continuation should usually point to `tasks`
82
+ - it should not promote `build` as a co-equal next step yet
83
+
84
+ ### `/dv:breakdown`
85
+
86
+ Use when:
87
+
88
+ - scope, flows, states, or requirements still need to be stabilized
89
+
90
+ Creates or updates:
91
+
92
+ - `proposal.md`
93
+ - `specs/<capability>/spec.md`
94
+
95
+ For `overhaul-from-code`, this stage may also create:
96
+
97
+ - `migration-contract.md`
98
+
99
+ This is the behavior-truth shaping stage.
100
+
101
+ ### `/dv:design`
102
+
103
+ Use when:
104
+
105
+ - requirements are stable enough to design from
106
+ - Pencil-backed design work must begin or continue
107
+ - more anchor surfaces, states, overlays, or design variants still need to be rendered
108
+
109
+ Creates or updates:
110
+
111
+ - `design.md`
112
+ - `pencil-design.md`
113
+
114
+ This stage includes:
115
+
116
+ - anchor-first design
117
+ - screenshot review
118
+ - layout hygiene
119
+ - `.pen` persistence
120
+ - design checkpoint
121
+ - design-source checkpoint
122
+
123
+ ### `/dv:tasks`
124
+
125
+ Use when:
126
+
127
+ - design is ready enough to drive implementation planning
128
+ - requirements plus Pencil coverage should be turned into ordered task groups
129
+
130
+ Creates or updates:
131
+
132
+ - `tasks.md`
133
+
134
+ This is the implementation-planning stage.
135
+
136
+ It does not write code.
137
+
138
+ ### `/dv:build`
139
+
140
+ Use when:
141
+
142
+ - requirements are implementation-safe
143
+ - design and mapping are stable enough
144
+ - `tasks.md` exists or implementation order is already clear
145
+
146
+ Creates or updates:
147
+
148
+ - application code
149
+ - any artifacts that must be refreshed when drift is found
150
+
151
+ This is the execution stage.
152
+
153
+ ### `/dv:verify`
154
+
155
+ Use when:
156
+
157
+ - you want to check requirement coverage
158
+ - you want to check design coverage
159
+ - you want to detect drift across requirements, Pencil, tasks, and code
160
+
161
+ Creates or updates:
162
+
163
+ - `verification.md`
164
+
165
+ This is the truth-reconciliation stage.
166
+
167
+ ## State-Based Next-Step Rules
168
+
169
+ These are the intended route recommendations.
170
+
171
+ ### After `/dv:design`
172
+
173
+ If design is still blocking:
174
+
175
+ - primary next step: `/dv:design`
176
+
177
+ If design is healthy and `tasks.md` does not exist yet:
178
+
179
+ - primary next step: `/dv:tasks`
180
+ - optional: `/dv:design` if more in-scope surfaces still need design work
181
+ - optional: `/dv:verify` if you want to check current requirement/design coverage before generating tasks
182
+
183
+ Do not present `/dv:build` as a co-equal next step here.
184
+
185
+ ### After `/dv:tasks`
186
+
187
+ If task quality is blocking:
188
+
189
+ - primary next step: `/dv:tasks`
190
+
191
+ If task checkpoint is healthy:
192
+
193
+ - primary next step: `/dv:build`
194
+ - optional: `/dv:verify` if you want to inspect requirement/design/task consistency before implementation starts
195
+
196
+ ### After `/dv:build`
197
+
198
+ If implementation work remains:
199
+
200
+ - primary next step: `/dv:build`
201
+
202
+ If implementation is ready for drift checking:
203
+
204
+ - primary next step: `/dv:verify`
205
+
206
+ ## Route Matrix
207
+
208
+ | Current state | Primary next route | Secondary route |
209
+ | --- | --- | --- |
210
+ | Requirements unclear | `breakdown` | `intake` |
211
+ | Requirements stable, design missing | `design` | `continue` |
212
+ | Design unstable | `design` | `verify` |
213
+ | Design stable, no `tasks.md` | `tasks` | `design` / `verify` |
214
+ | Tasks unstable | `tasks` | `verify` |
215
+ | Tasks stable, implementation-ready | `build` | `verify` |
216
+ | Implementation underway | `build` | `verify` |
217
+ | Implementation finished or drift suspected | `verify` | `build` |
218
+
219
+ ## `verify` Rollback Rules
220
+
221
+ `verify` does not blindly send the workflow back one step.
222
+
223
+ It should return the workflow to the truth layer that is wrong.
224
+
225
+ ### If `verify` finds design coverage gaps
226
+
227
+ Examples:
228
+
229
+ - missing pages
230
+ - missing states
231
+ - missing dialogs, sheets, or overlays
232
+ - design disagrees with requirement scope
233
+
234
+ Go back to:
235
+
236
+ - `/dv:design`
237
+
238
+ ### If `verify` finds task decomposition gaps
239
+
240
+ Examples:
241
+
242
+ - missing implementation work
243
+ - missing integration tasks
244
+ - wrong dependency ordering
245
+ - design coverage exists but tasks do not reflect it
246
+
247
+ Go back to:
248
+
249
+ - `/dv:tasks`
250
+
251
+ ### If `verify` finds implementation drift
252
+
253
+ Examples:
254
+
255
+ - code does not match Pencil layout or content structure
256
+ - behavior does not match approved specs
257
+ - task groups were not fully implemented
258
+
259
+ Go back to:
260
+
261
+ - `/dv:build`
262
+
263
+ ### If bindings still exist but the implementation page is missing
264
+
265
+ Examples:
266
+
267
+ - the canonical page is still present in `page-map.md`
268
+ - `pencil-bindings.md` still points to a valid Pencil page
269
+ - but the code page, route implementation, or UI module is missing
270
+
271
+ Go back to:
272
+
273
+ - `/dv:tasks` if implementation recovery still needs explicit planning
274
+ - `/dv:build` if the rebuild path is already clear and the approved design still stands
275
+
276
+ Do not discard the design binding only because the implementation disappeared.
277
+
278
+ ### If bindings still exist but the design source is missing
279
+
280
+ Examples:
281
+
282
+ - implementation code still exists
283
+ - `pencil-bindings.md` still names a Pencil page
284
+ - but the registered `.pen` source is gone, stale beyond reconciliation, or not traceable anymore
285
+
286
+ Go back to:
287
+
288
+ - `/dv:design`
289
+
290
+ Reason:
291
+
292
+ - this is a design-source failure, not just a coding gap
293
+ - old code or exported PNGs are not enough to keep the binding healthy by themselves
294
+
295
+ ### If `verify` finds requirement-truth conflicts
296
+
297
+ Examples:
298
+
299
+ - proposal and spec disagree
300
+ - implementation exceeded scope
301
+ - code and spec conflict over behavior truth
302
+
303
+ Go back to:
304
+
305
+ - `/dv:breakdown`
306
+ - or the main workflow entry via `continue` if several earlier artifacts need to be reconciled together
307
+
308
+ ### If `verify` finds overhaul-boundary conflicts
309
+
310
+ Examples:
311
+
312
+ - preserve / revise / retire decisions are inconsistent
313
+ - old-system obligations and new target behavior are mixed together
314
+ - page map still follows the legacy route tree instead of the approved target product
315
+ - `DA-VINCI.md` or `design-brief.md` no longer matches the approved overhaul baseline
316
+
317
+ Go back to:
318
+
319
+ - `/dv:breakdown` when `proposal.md`, `migration-contract.md`, or specs are wrong
320
+ - `/dv:design` when the target design or page structure drifted from the approved overhaul truth
321
+
322
+ ## Typical User Handling After `verify`
323
+
324
+ If you are manually driving routes:
325
+
326
+ 1. run `/dv:verify`
327
+ 2. read which truth layer drifted
328
+ 3. execute the returned primary next route
329
+
330
+ Quick fallback matrix:
331
+
332
+ - binding exists, design healthy, code missing -> `/dv:tasks` or `/dv:build`
333
+ - binding exists, code healthy, design source missing -> `/dv:design`
334
+
335
+ If you do not want to decide manually:
336
+
337
+ 1. run `/dv:continue`
338
+ 2. let Da Vinci inspect the current artifacts
339
+ 3. follow the continuation prompt it generates
340
+
341
+ ## Recommended 0-to-1 Flow
342
+
343
+ For a typical new product or large redesign:
344
+
345
+ 1. `/dv:intake` when the request is still messy
346
+ 2. `/dv:breakdown`
347
+ 3. `/dv:design`
348
+ 4. `/dv:tasks`
349
+ 5. `/dv:build`
350
+ 6. `/dv:verify`
351
+
352
+ ## Recommended Resume Flow
353
+
354
+ When artifacts already exist:
355
+
356
+ 1. `/dv:continue`
357
+ 2. let it detect whether the next stage is:
358
+ - `design`
359
+ - `tasks`
360
+ - `build`
361
+ - `verify`
362
+
363
+ ## Flow Diagram
364
+
365
+ ```mermaid
366
+ flowchart TD
367
+ A[intake or continue] --> B[breakdown]
368
+ B --> C[design]
369
+ C --> D{Design checkpoint healthy?}
370
+ D -- No --> C
371
+ D -- Yes --> E{tasks.md exists?}
372
+ E -- No --> F[tasks]
373
+ E -- Yes --> G[build]
374
+ F --> H{Task checkpoint healthy?}
375
+ H -- No --> F
376
+ H -- Yes --> G
377
+ G --> I[verify]
378
+ I --> J{Drift found?}
379
+ J -- No --> K[done]
380
+ J -- Design drift --> C
381
+ J -- Task drift --> F
382
+ J -- Code drift --> G
383
+ J -- Requirement drift --> B
384
+ J -- Overhaul boundary drift --> B
385
+ ```
386
+
387
+ ## Verify Rollback Diagram
388
+
389
+ ```mermaid
390
+ flowchart TD
391
+ A[verify] --> B{Which truth layer failed?}
392
+ B -- Requirement or scope truth --> C[breakdown]
393
+ B -- Design truth --> D[design]
394
+ B -- Task truth --> E[tasks]
395
+ B -- Code truth --> F[build]
396
+ B -- Overhaul boundary truth --> C
397
+ C --> G[re-run verify later]
398
+ D --> G
399
+ E --> G
400
+ F --> G
401
+ ```
@@ -61,7 +61,12 @@ Choose the mode by project start condition:
61
61
  - current codebase is the behavior source of truth
62
62
  - UI needs broad or global redesign
63
63
 
64
- 4. `feature-change`
64
+ 4. `overhaul-from-code`
65
+ - project already exists
66
+ - current code is still migration evidence
67
+ - flows, logic, information architecture, or UI are being broadly redefined
68
+
69
+ 5. `feature-change`
65
70
  - project already exists
66
71
  - a scoped feature, page, or flow needs to be added or updated
67
72
 
@@ -138,8 +143,8 @@ Generate DA-VINCI.md, proposal, specs, page map, Pencil-backed launch pages, bin
138
143
 
139
144
  8. create `pencil-design.md`
140
145
  - record the generated Pencil screens
141
- - if no registered project-local `.pen` exists yet, persist the first approved MCP snapshot into the registered `.pen` path under `.da-vinci/designs/`
142
- - if a registered project-local `.pen` already exists, reopen it for continuity but overwrite it from the current MCP snapshot after material live edits
146
+ - prefer `da-vinci pencil-session begin` before the first Pencil edit so the registered `.pen` is seeded and locked up front
147
+ - if a registered project-local `.pen` already exists, reopen it for continuity but overwrite it from the current live MCP snapshot through `da-vinci pencil-session persist` after material live edits
143
148
  - keep screenshot exports under `.da-vinci/changes/<change-id>/exports/` rather than `.da-vinci/designs/`
144
149
 
145
150
  9. create `pencil-bindings.md`
@@ -468,7 +473,88 @@ Use this mode whenever the project already exists and the real work starts from
468
473
 
469
474
  ---
470
475
 
471
- ## 4. `feature-change`
476
+ ## 4. `overhaul-from-code`
477
+
478
+ ### Typical scenario
479
+
480
+ The product already exists, but this is not only a visual refresh.
481
+
482
+ You may be:
483
+
484
+ - redefining major flows
485
+ - replacing parts of the logic model
486
+ - resetting information architecture
487
+ - preserving some integrations or constraints while retiring other legacy behavior
488
+
489
+ ### Example case
490
+
491
+ Project:
492
+
493
+ - existing B2B desktop product with legacy shell, permissions, and integrations
494
+
495
+ Goal:
496
+
497
+ - preserve selected integrations and data contracts
498
+ - retire part of the old workflow
499
+ - replace navigation, flows, and UI around a new operating model
500
+
501
+ ### Recommended request
502
+
503
+ ```text
504
+ $da-vinci use overhaul-from-code to overhaul this existing product.
505
+ Treat current code as migration evidence and reference baseline, not automatic final behavior truth.
506
+ Inventory the current system, define preserve/revise/retire/unknown boundaries, rewrite the target flows and specs, then generate Pencil-backed design work and implementation tasks.
507
+ ```
508
+
509
+ ### What Da Vinci should do
510
+
511
+ 1. create `project-inventory.md`
512
+ - inventory routes
513
+ - inventory key flows
514
+ - inventory integrations, permissions, and legacy constraints
515
+
516
+ 2. create `proposal.md`
517
+ - define the target product direction
518
+ - define scope and non-goals
519
+
520
+ 3. create `migration-contract.md`
521
+ - classify `preserve`
522
+ - classify `revise`
523
+ - classify `retire`
524
+ - classify `unknown`
525
+
526
+ 4. create `specs/<slice>/spec.md`
527
+ - write the new target behavior truth
528
+ - split overhaul work by implementation or migration slice
529
+
530
+ 5. create or rebuild `page-map.md`
531
+ - define the target page set
532
+ - do not merely inherit the old route tree
533
+
534
+ 6. continue into:
535
+ - `DA-VINCI.md`
536
+ - `design-registry.md`
537
+ - `design-brief.md`
538
+ - `design.md`
539
+ - `pencil-design.md`
540
+ - `pencil-bindings.md`
541
+ - `tasks.md`
542
+ - `verification.md`
543
+
544
+ ### Where this mode differs from `redesign-from-code`
545
+
546
+ - `redesign-from-code` keeps old code as behavior truth
547
+ - `overhaul-from-code` treats old code as reference baseline and migration context
548
+ - `redesign-from-code` is mainly for broad UI replacement
549
+ - `overhaul-from-code` is for broad product rewrites on top of an existing system
550
+
551
+ ### Best fit
552
+
553
+ Use this mode when the product already exists, but the new version must be defined through new specs rather than inherited automatically from the current code.
554
+
555
+ ---
556
+
557
+ ## 5. `feature-change`
472
558
 
473
559
  ### Typical scenario
474
560
 
@@ -610,6 +696,12 @@ $da-vinci use greenfield-brainstorm to synthesize the product idea, establish th
610
696
  $da-vinci use redesign-from-code to inventory the current product, establish or update DA-VINCI.md, generate a Pencil-backed redesign baseline, and prepare implementation tasks.
611
697
  ```
612
698
 
699
+ ### Existing project system-level overhaul
700
+
701
+ ```text
702
+ $da-vinci use overhaul-from-code to inventory the current product, define migration boundaries, replace the target flows and specs, generate Pencil-backed overhaul pages, and prepare implementation tasks.
703
+ ```
704
+
613
705
  ### Existing project scoped feature
614
706
 
615
707
  ```text