@xenonbyte/da-vinci-workflow 0.1.25 → 0.2.1

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 (84) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +48 -67
  3. package/README.zh-CN.md +36 -66
  4. package/SKILL.md +3 -0
  5. package/commands/claude/dv/continue.md +5 -0
  6. package/commands/claude/dv/design.md +1 -0
  7. package/commands/codex/prompts/dv-continue.md +6 -1
  8. package/commands/codex/prompts/dv-design.md +1 -0
  9. package/commands/gemini/dv/continue.toml +5 -0
  10. package/commands/gemini/dv/design.toml +1 -0
  11. package/commands/templates/dv-continue.shared.md +33 -0
  12. package/docs/dv-command-reference.md +45 -2
  13. package/docs/execution-chain-migration.md +46 -0
  14. package/docs/execution-chain-plan.md +125 -0
  15. package/docs/pencil-rendering-workflow.md +9 -7
  16. package/docs/prompt-entrypoints.md +6 -0
  17. package/docs/prompt-presets/README.md +4 -0
  18. package/docs/visual-assist-presets/README.md +4 -0
  19. package/docs/workflow-examples.md +23 -11
  20. package/docs/workflow-overview.md +27 -0
  21. package/docs/zh-CN/dv-command-reference.md +45 -2
  22. package/docs/zh-CN/execution-chain-migration.md +46 -0
  23. package/docs/zh-CN/pencil-rendering-workflow.md +9 -7
  24. package/docs/zh-CN/prompt-entrypoints.md +6 -0
  25. package/docs/zh-CN/prompt-presets/README.md +5 -1
  26. package/docs/zh-CN/visual-assist-presets/README.md +5 -1
  27. package/docs/zh-CN/workflow-examples.md +23 -11
  28. package/docs/zh-CN/workflow-overview.md +27 -0
  29. package/examples/greenfield-spec-markupflow/README.md +6 -1
  30. package/lib/artifact-parsers.js +120 -0
  31. package/lib/async-offload-worker.js +26 -0
  32. package/lib/async-offload.js +82 -0
  33. package/lib/audit-parsers.js +152 -32
  34. package/lib/audit.js +145 -23
  35. package/lib/cli.js +1068 -437
  36. package/lib/diff-spec.js +242 -0
  37. package/lib/execution-signals.js +136 -0
  38. package/lib/fs-safety.js +1 -4
  39. package/lib/icon-aliases.js +7 -7
  40. package/lib/icon-search.js +21 -14
  41. package/lib/icon-sync.js +220 -41
  42. package/lib/install.js +128 -60
  43. package/lib/lint-bindings.js +143 -0
  44. package/lib/lint-spec.js +408 -0
  45. package/lib/lint-tasks.js +176 -0
  46. package/lib/mcp-runtime-gate.js +4 -7
  47. package/lib/pen-persistence.js +318 -46
  48. package/lib/pencil-lock.js +237 -25
  49. package/lib/pencil-preflight.js +233 -12
  50. package/lib/pencil-session.js +216 -36
  51. package/lib/planning-parsers.js +567 -0
  52. package/lib/scaffold.js +193 -0
  53. package/lib/scope-check.js +603 -0
  54. package/lib/sidecars.js +369 -0
  55. package/lib/supervisor-review.js +82 -35
  56. package/lib/utils.js +129 -0
  57. package/lib/verify.js +652 -0
  58. package/lib/workflow-bootstrap.js +255 -0
  59. package/lib/workflow-contract.js +107 -0
  60. package/lib/workflow-persisted-state.js +297 -0
  61. package/lib/workflow-state.js +785 -0
  62. package/package.json +21 -3
  63. package/references/artifact-templates.md +26 -0
  64. package/references/checkpoints.md +16 -0
  65. package/references/design-inputs.md +2 -0
  66. package/references/modes.md +10 -0
  67. package/references/pencil-design-to-code.md +2 -0
  68. package/scripts/fixtures/complex-sample.pen +0 -295
  69. package/scripts/fixtures/mock-pencil.js +0 -49
  70. package/scripts/test-audit-context-delta.js +0 -446
  71. package/scripts/test-audit-design-supervisor.js +0 -691
  72. package/scripts/test-audit-safety.js +0 -92
  73. package/scripts/test-icon-aliases.js +0 -96
  74. package/scripts/test-icon-search.js +0 -77
  75. package/scripts/test-icon-sync.js +0 -178
  76. package/scripts/test-mcp-runtime-gate.js +0 -287
  77. package/scripts/test-mode-consistency.js +0 -344
  78. package/scripts/test-pen-persistence.js +0 -403
  79. package/scripts/test-pencil-lock.js +0 -130
  80. package/scripts/test-pencil-preflight.js +0 -169
  81. package/scripts/test-pencil-session.js +0 -192
  82. package/scripts/test-persistence-flows.js +0 -345
  83. package/scripts/test-supervisor-review-cli.js +0 -619
  84. package/scripts/test-supervisor-review-integration.js +0 -115
@@ -0,0 +1,46 @@
1
+ # Execution-Chain Migration Guide
2
+
3
+ Use this guide when enabling the execution-chain upgrade surfaces on existing projects.
4
+
5
+ ## 1. Sidecar Generation Lifecycle
6
+
7
+ Planning sidecars are explicit artifacts, not hidden by-products.
8
+
9
+ - generate with `da-vinci generate-sidecars --project <path> [--change <id>]`
10
+ - sidecars are written under `.da-vinci/changes/<change-id>/sidecars/`
11
+ - lint, status, and verify commands must not silently rewrite sidecars
12
+ - regenerate sidecars after meaningful proposal/spec/page-map/tasks/bindings changes
13
+
14
+ ## 2. Advisory vs Strict Rollout
15
+
16
+ Default policy:
17
+
18
+ - `lint-spec`, `scope-check`, `lint-tasks`, `lint-bindings` are advisory (`WARN` without hard exit)
19
+ - pass `--strict` to promote warnings to blocking command exits
20
+ - promote strict mode in CI only after warning baselines stabilize
21
+
22
+ Audit integration:
23
+
24
+ - integrity audit treats planning-signal `BLOCK` as warning-level advisory evidence
25
+ - completion audit treats verification-signal `BLOCK` as failure-level evidence
26
+
27
+ ## 3. Persisted Workflow State Fallback
28
+
29
+ `workflow-status` uses `.da-vinci/state/workflow.json` only when:
30
+
31
+ - state schema version is supported
32
+ - change entry exists
33
+ - state timestamp is fresh
34
+ - fingerprint matches current artifact truth
35
+
36
+ If any check fails, Da Vinci falls back to derived state from artifacts and records reconciliation notes.
37
+
38
+ ## 4. Scaffold Constraints
39
+
40
+ `da-vinci scaffold` is an MVP skeleton generator with strict constraints:
41
+
42
+ - output is TODO-marked and reviewable only
43
+ - output is not final code generation
44
+ - no multi-framework expansion in the MVP
45
+ - scaffold boundaries come from `pencil-bindings.md` mappings
46
+ - verify scaffold output with `verify-bindings`, `verify-implementation`, and `verify-structure` before acceptance
@@ -0,0 +1,125 @@
1
+ # Execution-Chain Upgrade Plan Notes
2
+
3
+ This document records planning decisions required by the execution-chain upgrade.
4
+
5
+ ## Phase 0 Pre-work Decisions
6
+
7
+ ### Workflow inventory summary
8
+
9
+ Canonical workflow definitions currently live across:
10
+
11
+ - `SKILL.md`
12
+ - `references/` (`modes`, `checkpoints`, `artifact-templates`)
13
+ - command assets (`commands/*/dv/*`)
14
+ - CLI surfaces (`lib/cli.js`)
15
+ - workflow tests (`scripts/test-mode-consistency.js`, workflow-state tests)
16
+
17
+ ### Canonical contract concepts
18
+
19
+ The workflow contract must own:
20
+
21
+ - modes
22
+ - required artifacts
23
+ - checkpoints
24
+ - route dependencies
25
+ - stage handoff gates
26
+ - status vocabulary (`PASS/WARN/BLOCK`)
27
+
28
+ ### Compatibility boundaries
29
+
30
+ Existing projects can adopt upgrades without mandatory rewrites when:
31
+
32
+ - sidecars are optional until explicitly generated
33
+ - persisted workflow state is optional and falls back to derived state
34
+ - legacy artifact headings remain parseable
35
+
36
+ ### Sequencing rules
37
+
38
+ - scaffolding is downstream from verification-backed planning decisions
39
+ - persisted write-back is downstream from derived read-model stability
40
+ - prompt-first `continue` remains route orchestration, not standalone CLI continuation
41
+
42
+ ### Schema boundary
43
+
44
+ - OpenSpec planning specs define this upgrade itself
45
+ - Da Vinci runtime artifacts (`spec.md`, `tasks.md`, `pencil-bindings.md`, etc.) remain independent runtime schemas
46
+
47
+ ### Runtime section inventory
48
+
49
+ - `spec.md`: `Behavior`, `States`, `Inputs`, `Outputs`, `Acceptance`, `Edge Cases`
50
+ - `page-map.md`: canonical pages and states-per-page
51
+ - `tasks.md`: top-level task groups and checklist execution items
52
+ - `pencil-bindings.md`: implementation -> design mappings
53
+ - `verification.md`: requirement/design/binding/outcome evidence
54
+
55
+ ### Parser ownership strategy
56
+
57
+ - heading and section primitives stay in `audit-parsers.js`
58
+ - runtime planning parsers live in `planning-parsers.js`
59
+ - runtime spec parser lives in `artifact-parsers.js`
60
+
61
+ ### Test layering strategy
62
+
63
+ - unit: parser and envelope tests
64
+ - integration: command-level fixture tests (`lint-*`, `scope-check`, `verify-*`, sidecars, diff)
65
+ - contract: workflow-contract and generated command-asset checks
66
+ - backward compatibility: fixtures missing sidecars/workflow state/new template metadata
67
+
68
+ ### Phase-level estimates and re-baseline rule
69
+
70
+ - Phase 1: 1-2 weeks
71
+ - Phase 2: 1-2 weeks
72
+ - Phase 3: 1-2 weeks
73
+ - Phase 4a: 1-2 weeks
74
+ - Phase 4b: 1-2 weeks
75
+ - Phase 4c: 1-2 weeks
76
+
77
+ Re-baseline rule:
78
+
79
+ - if phase-exit DoD misses by >20%, freeze scope expansion and re-estimate remaining phases before adding new surfaces
80
+
81
+ ## DoD and MVP Mapping
82
+
83
+ ### Measurable DoD checks
84
+
85
+ - Phase 0: inventory, parser ownership, schema boundaries, and test layers documented
86
+ - Phase 1: workflow-status/next-step + prompt-first continue integration + contract tests green
87
+ - Phase 2: lint/scope + deterministic sidecars + advisory/strict semantics tested
88
+ - Phase 3: verify surfaces + task-group metadata + audit wiring tested
89
+ - Phase 4a: persisted state + diff + compatibility hardening tested
90
+ - Phase 4b: constrained scaffold MVP tested
91
+ - Phase 4c: command-asset convergence + docs + release controls tested
92
+
93
+ ### First-release MVP scope
94
+
95
+ In scope:
96
+
97
+ - workflow-status/next-step
98
+ - lint-spec/lint-tasks/lint-bindings/scope-check
99
+ - generate-sidecars + diff-spec
100
+ - verify-bindings/verify-implementation/verify-structure/verify-coverage
101
+ - persisted workflow-state fallback
102
+ - constrained scaffold skeleton output
103
+
104
+ Out of scope:
105
+
106
+ - multi-framework scaffold generation
107
+ - autonomous production code generation from `.pen` without review
108
+
109
+ ### CI and validation mapping
110
+
111
+ - core regression lane: `npm run quality:ci:core`
112
+ - workflow e2e lane: `npm run quality:ci:e2e`
113
+ - reviewer bridge lane: `npm run quality:reviewer-bridge-smoke` (opt-in)
114
+ - contract lane: `npm run quality:ci:contracts`
115
+
116
+ ### Promotion rules
117
+
118
+ - MVP -> full rollout promotion requires all phase DoD checks green for two consecutive CI cycles
119
+ - advisory-to-strict promotion for planning lint requires warning baseline review and owner signoff
120
+
121
+ ### Release criteria and fallback
122
+
123
+ - release requires core + contracts + e2e lanes green
124
+ - stale persisted state always falls back to derived state
125
+ - verify-structure unsupported cases must emit heuristic fallback with confidence
@@ -196,6 +196,7 @@ It verifies:
196
196
  - the active editor matches that `.pen`
197
197
  - the shell-visible file exists
198
198
  - the registered `.pen` is not still only in memory
199
+ - when external or secondary `.pen` files exist, baseline hash alignment and source-priority confirmation are explicitly recorded before a new edit round
199
200
  - `.da-vinci/designs/` is not polluted by markdown or PNG files
200
201
 
201
202
  ## MCP Runtime Gate
@@ -248,13 +249,14 @@ Context-delta audit expectations are warning-only:
248
249
  Typical autonomous chain:
249
250
 
250
251
  1. `da-vinci pencil-session begin --project <project-path> --pen <path>`
251
- 2. Pencil MCP edits
252
- 3. `da-vinci pencil-session persist --project <project-path> --pen <path> --nodes-file <nodes.json> --variables-file <vars.json> --version <version>`
253
- 4. screenshot review + layout hygiene
254
- 5. design checkpoint
255
- 6. design-supervisor review when configured
256
- 7. `da-vinci pencil-session end --project <project-path> --pen <path> --nodes-file <nodes.json> --variables-file <vars.json> --version <version>`
257
- 8. `da-vinci audit --mode completion --change <change-id> <project-path>`
252
+ 2. if external/secondary `.pen` files exist, run `da-vinci check-pen-baseline --pen <project-pen> --baseline <other-pen>` before edits; if diverged, sync the preferred source into `<project-pen>` first
253
+ 3. Pencil MCP edits
254
+ 4. `da-vinci pencil-session persist --project <project-path> --pen <path> --nodes-file <nodes.json> --variables-file <vars.json> --version <version>`
255
+ 5. screenshot review + layout hygiene
256
+ 6. design checkpoint
257
+ 7. design-supervisor review when configured
258
+ 8. `da-vinci pencil-session end --project <project-path> --pen <path> --nodes-file <nodes.json> --variables-file <vars.json> --version <version>`
259
+ 9. `da-vinci audit --mode completion --change <change-id> <project-path>`
258
260
 
259
261
  ## Flow Diagram
260
262
 
@@ -64,6 +64,12 @@ What it should output:
64
64
 
65
65
  Continuation precedence:
66
66
 
67
+ - when shell access is available, run `da-vinci workflow-status --project <path> [--change <id>] --json` before route selection
68
+ - use `da-vinci next-step --project <path> [--change <id>]` as the first continuation routing signal
69
+ - run `da-vinci lint-spec --project <path> [--change <id>]` when runtime spec quality is uncertain before routing into `build`
70
+ - run `da-vinci scope-check --project <path> [--change <id>]` when page or state propagation across planning artifacts is uncertain
71
+ - run `da-vinci verify-bindings --project <path> [--change <id>]` and `da-vinci verify-coverage --project <path> [--change <id>]` before terminal completion routing
72
+ - run `da-vinci diff-spec --project <path> [--change <id>]` after planning edits when continuation must reason about changed requirement slices
67
73
  - determine routing from artifact and checkpoint truth first
68
74
  - use contextual checkpoint deltas only as auxiliary recovery context
69
75
  - if contextual deltas conflict with current artifacts, ignore them for routing and note the conflict
@@ -1,7 +1,11 @@
1
1
  # Prompt Presets
2
2
 
3
+ ## Template Notes
4
+
3
5
  Use these presets when you want a copy-ready starting prompt for a specific product surface.
4
6
 
7
+ This section explains what each preset family is for, when to use it, and how it should pair with `Visual Assist` plus workflow gates.
8
+
5
9
  These presets primarily target screen-design work once the workflow mode is already clear.
6
10
  For broad existing-product rewrites where flows or logic are also changing, prefer `overhaul-from-code` plus `intake`/custom prompt setup first, then reuse the relevant design-oriented preset after `proposal.md`, `migration-contract.md`, and target `specs/` stabilize.
7
11
 
@@ -1,7 +1,11 @@
1
1
  # Visual Assist Presets
2
2
 
3
+ ## Template Notes
4
+
3
5
  Use these presets as starting points for the `## Visual Assist` section inside `DA-VINCI.md`.
4
6
 
7
+ This section explains the intent of each preset family, how the variants differ, and which workflow responsibilities must stay outside the preset itself.
8
+
5
9
  Each preset is intentionally conservative:
6
10
 
7
11
  - one primary adapter direction
@@ -17,6 +17,16 @@ Common rule:
17
17
  - `continue` should pick routes from artifact/checkpoint truth first, then use contextual deltas as auxiliary recovery notes
18
18
  - if contextual deltas conflict with current artifacts, ignore them for routing and record the conflict
19
19
 
20
+ Execution-chain command bundle (before terminal completion):
21
+
22
+ - `da-vinci workflow-status --project <path> [--change <id>] --json`
23
+ - `da-vinci next-step --project <path> [--change <id>]`
24
+ - `da-vinci lint-spec|lint-tasks|lint-bindings --project <path> [--change <id>]`
25
+ - `da-vinci scope-check --project <path> [--change <id>]`
26
+ - `da-vinci generate-sidecars --project <path> [--change <id>]`
27
+ - `da-vinci verify-bindings|verify-implementation|verify-structure|verify-coverage --project <path> [--change <id>]`
28
+ - `da-vinci diff-spec --project <path> [--change <id>]`
29
+
20
30
  ## 1. `greenfield-spec`
21
31
 
22
32
  Use when a new project already has a stable requirement set.
@@ -88,17 +98,18 @@ Expected flow:
88
98
  10. for functional icons, run `da-vinci icon-sync` then `da-vinci icon-search --query "<intent>"` to pick `icon_font` names before writing icon nodes
89
99
  11. if the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds
90
100
  12. require `da-vinci pencil-session begin --project <project-path> --pen <path>` before the first Pencil edit so the registered `.pen` is seeded and the global Pencil lock is held
91
- 13. during live design work, use `da-vinci pencil-session persist --project <project-path> --pen <path> ...` after material edits, then end with `da-vinci pencil-session end ...`
92
- 14. verify the registered project-local `.pen` path becomes shell-visible immediately after the first successful Pencil write
93
- 15. run `da-vinci audit --mode integrity <project-path>` immediately after that first successful write
94
- 16. if Pencil MCP is active, run the MCP runtime gate and record it in `pencil-design.md`
95
- 17. run `design-source checkpoint` to confirm the registered project-local `.pen` path, the active Pencil source, and the shell-visible file all agree
96
- 18. export screenshots only under `.da-vinci/changes/<change-id>/exports/`, never into `.da-vinci/designs/`
97
- 19. record screenshot review with explicit `PASS` / `WARN` / `BLOCK`, issue list, and revision outcome before broad expansion
98
- 20. bind routes and pages to Pencil screens
99
- 21. generate tasks aligned to the redesign slices
100
- 22. run `da-vinci audit --mode completion --change <change-id> <project-path>` before any terminal completion claim
101
- 23. build and verify only after the completion gate can eventually pass
101
+ 13. when external or secondary `.pen` sources exist, run `da-vinci check-pen-baseline --pen <project-pen> --baseline <other-pen>` before the new session write phase; if diverged, sync the chosen source into `<project-pen>` first
102
+ 14. during live design work, use `da-vinci pencil-session persist --project <project-path> --pen <path> ...` after material edits, then end with `da-vinci pencil-session end ...`
103
+ 15. verify the registered project-local `.pen` path becomes shell-visible immediately after the first successful Pencil write
104
+ 16. run `da-vinci audit --mode integrity <project-path>` immediately after that first successful write
105
+ 17. if Pencil MCP is active, run the MCP runtime gate and record it in `pencil-design.md`
106
+ 18. run `design-source checkpoint` to confirm the registered project-local `.pen` path, the active Pencil source, and the shell-visible file all agree
107
+ 19. export screenshots only under `.da-vinci/changes/<change-id>/exports/`, never into `.da-vinci/designs/`
108
+ 20. record screenshot review with explicit `PASS` / `WARN` / `BLOCK`, issue list, and revision outcome before broad expansion
109
+ 21. bind routes and pages to Pencil screens
110
+ 22. generate tasks aligned to the redesign slices
111
+ 23. run `da-vinci audit --mode completion --change <change-id> <project-path>` before any terminal completion claim
112
+ 24. build and verify only after the completion gate can eventually pass
102
113
 
103
114
  ### Complex Android example
104
115
 
@@ -122,6 +133,7 @@ Before non-trivial `batch_design` calls, preflight the Pencil operations when sh
122
133
  If the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds.
123
134
  Use only Pencil-supported properties; do not use web-only props like flex or margin.
124
135
  Require `da-vinci pencil-session begin --project <project-path> --pen <path>` before the first Pencil edit.
136
+ When external or secondary `.pen` files exist, run `da-vinci check-pen-baseline --pen <project-pen> --baseline <other-pen>` first; if hashes diverge, sync the preferred source into `<project-pen>` before editing.
125
137
  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 `da-vinci pencil-session persist`.
126
138
  Verify the registered project-local `.pen` file exists as a shell-visible file after the first Pencil write.
127
139
  Run `da-vinci audit --mode integrity <project-path>` after that first successful Pencil write before broad expansion continues.
@@ -13,6 +13,7 @@ Use it when you need the high-level delivery chain:
13
13
  Use [pencil-rendering-workflow.md](/Users/xubo/x-skills/da-vinci/docs/pencil-rendering-workflow.md) when you need the lower-level Pencil session, persistence, gate, and audit details.
14
14
  Use [dv-command-reference.md](/Users/xubo/x-skills/da-vinci/docs/dv-command-reference.md) when you need route-by-route `dv:` command behavior, next-step recommendations, and verify rollback handling.
15
15
  Use [constraint-files.md](/Users/xubo/x-skills/da-vinci/docs/constraint-files.md) when you need a single map for project constraint files, hard-gate fields, and advisory guidance sections.
16
+ Use [execution-chain-migration.md](/Users/xubo/x-skills/da-vinci/docs/execution-chain-migration.md) for sidecar, enforcement, persisted-state fallback, and scaffold migration guidance.
16
17
 
17
18
  ## Core Contract
18
19
 
@@ -40,6 +41,30 @@ This means:
40
41
  8. Implement.
41
42
  9. Verify requirement drift and design drift.
42
43
 
44
+ ## Workflow-State Surfaces
45
+
46
+ Use these command surfaces to inspect route readiness before selecting the next `dv:` stage:
47
+
48
+ - `da-vinci workflow-status --project <path> [--change <id>] [--json]`
49
+ - summarizes current stage, blockers, handoff gates, and route recommendation from artifact truth plus selected audit-visible evidence
50
+ - `da-vinci next-step --project <path> [--change <id>] [--json]`
51
+ - emits the first continuation action from the same derived workflow-state model
52
+ - `da-vinci lint-spec --project <path> [--change <id>] [--strict] [--json]`
53
+ - validates runtime `spec.md` schema quality before implementation planning or execution
54
+ - default behavior is advisory; `--strict` is explicit opt-in for blocking behavior
55
+ - `da-vinci scope-check --project <path> [--change <id>] [--strict] [--json]`
56
+ - validates page and state propagation across proposal, page-map, runtime specs, pencil-design, and tasks
57
+ - emits a machine-readable page/state coverage matrix for later verify and status consumers
58
+ - `da-vinci generate-sidecars --project <path> [--change <id>] [--json]`
59
+ - explicitly generates deterministic planning sidecars used by diff and downstream tooling
60
+ - `da-vinci verify-bindings|verify-implementation|verify-structure|verify-coverage --project <path> [--change <id>] [--strict] [--json]`
61
+ - validates execution-chain evidence from bindings through implementation and structural coverage
62
+ - `da-vinci diff-spec --project <path> [--change <id>] [--from <sidecars-dir>] [--json]`
63
+ - reports normalized planning deltas for spec/tasks/page-map/bindings sidecars to support safe continuation
64
+
65
+ These surfaces do not replace `da-vinci audit --mode integrity|completion`.
66
+ `audit` remains the formal integrity and completion truth surface.
67
+
43
68
  ## Standard Artifact Spine
44
69
 
45
70
  Depending on mode, Da Vinci typically builds this spine:
@@ -58,6 +83,8 @@ Depending on mode, Da Vinci typically builds this spine:
58
83
 
59
84
  `DA-VINCI.md` remains the project-level workflow and visual contract file.
60
85
 
86
+ If you are starting from an empty repo, a documentation-first example, or a half-hydrated workspace, run `da-vinci bootstrap-project --project <project-path> --change <change-id>` before the first strict audit. That command creates the minimum project spine plus a workflow-owned project-local `.pen` baseline.
87
+
61
88
  ## Phase Breakdown
62
89
 
63
90
  ### 1. Intake And Mode Selection
@@ -39,6 +39,36 @@ Da Vinci 期望它们遵循工作流状态。
39
39
 
40
40
  这些命令不会替代 `dv:` 选路,但能显著提升设计执行质量:
41
41
 
42
+ - `da-vinci workflow-status --project <path> [--change <id>] [--json]`
43
+ - 从工件和 checkpoint 真相推导当前 workflow 阶段
44
+ - 报告 blocker、warning、handoff gate 状态,以及主推荐路由
45
+ - 它和 `audit` 职责不同:它负责选路,不是终态审计真相
46
+ - `da-vinci next-step --project <path> [--change <id>] [--json]`
47
+ - 基于同一套 workflow-state 推导,给出 route-first 的续跑建议
48
+ - 在自由扫描工件之前,优先把它作为第一路由信号
49
+ - `da-vinci lint-spec --project <path> [--change <id>] [--strict] [--json]`
50
+ - 校验 Da Vinci 运行时 `spec.md` 的核心章节(`Behavior`、`States`、`Inputs`、`Outputs`、`Acceptance`、`Edge Cases`)
51
+ - 默认 advisory(有发现给 `WARN` 且不阻断);显式 `--strict` 才升级为阻断
52
+ - 不会把 OpenSpec 规划用的 `ADDED Requirements` 结构当成运行时 spec 合法结构
53
+ - `da-vinci scope-check --project <path> [--change <id>] [--strict] [--json]`
54
+ - 检查 proposal、page-map、运行时 spec、pencil-design 状态和 tasks 之间的 scope 传播一致性
55
+ - 输出页面与状态两条线的机器可读覆盖矩阵
56
+ - 默认 advisory(有发现给 `WARN` 且不阻断);显式 `--strict` 才升级为阻断
57
+ - `da-vinci lint-tasks --project <path> [--change <id>] [--strict] [--json]`
58
+ - 校验顶层 task groups、编号顺序、verification 动作和 behavior 覆盖提示
59
+ - 默认 advisory(有发现给 `WARN` 且不阻断);显式 `--strict` 才升级为阻断
60
+ - `da-vinci lint-bindings --project <path> [--change <id>] [--strict] [--json]`
61
+ - 校验实现到 Pencil 的映射是否可解析、source 形态是否合理、实现落点是否可定位
62
+ - 默认 advisory(有发现给 `WARN` 且不阻断);显式 `--strict` 才升级为阻断
63
+ - `da-vinci generate-sidecars --project <path> [--change <id>] [--json]`
64
+ - 显式生成确定性的 planning sidecars:`spec.index.json`、`tasks.index.json`、`page-map.index.json`、`bindings.index.json`
65
+ - sidecar 只允许通过这个命令写入;lint/status/verify 不应静默重写
66
+ - `da-vinci verify-bindings|verify-implementation|verify-structure|verify-coverage --project <path> [--change <id>] [--strict] [--json]`
67
+ - 校验代码落点、计划状态实现证据、以及绑定驱动的结构一致性
68
+ - `verify-structure` 会明确报告是 markup-backed 还是 heuristic fallback,并给出置信度
69
+ - `da-vinci diff-spec --project <path> [--change <id>] [--from <sidecars-dir>] [--json]`
70
+ - 比较规范化 planning sidecars,报告新增/删除/修改的规划项
71
+ - 在同一 surface 下提供 spec 差异以及 tasks/page-map/bindings 摘要差异
42
72
  - `da-vinci icon-sync`
43
73
  - 同步官方图标名(Material Symbols、Lucide、Feather、Phosphor)到 `~/.da-vinci/icon-catalog.json`
44
74
  - 默认是用户级范围(当前 HOME),同一用户可跨项目复用
@@ -49,12 +79,24 @@ Da Vinci 期望它们遵循工作流状态。
49
79
  - `da-vinci icon-search --query "<关键词>" [--family ...] [--top ...] [--aliases ...]`
50
80
  - 在写 Pencil `batch_design` 前先收敛可用的 `icon_font` 名称
51
81
  - 支持中英文混合词,并可通过 `~/.da-vinci/icon-aliases.json` 做语义扩展
52
- - `da-vinci supervisor-review --project <path> --change <id> [--run-reviewers] [--review-concurrency <value>] [--review-retries <value>] [--review-retry-delay-ms <value>] [--source <skill|manual|inferred>] [--executed-reviewers <csv>] [--status ...] [--issue-list ...] [--revision-outcome ...] [--write]`
82
+ - `da-vinci bootstrap-project --project <path> [--change <id>] [--force]`
83
+ - 给还没水合完成的仓库补齐最小 `.da-vinci/` 工作流骨架
84
+ - 会在 `.da-vinci/designs/` 下 seed 一个工作流管理的项目内 `.pen`
85
+ - 传 `--change <id>` 时会顺手创建当前 change 所需的最小设计工件(`design-brief.md`、`design.md`、`pencil-design.md`、`pencil-bindings.md`)
86
+ - 适合从空仓库、文档示例、或只做了一半的工作区开始时,先补齐 audit 所需的基础工件
87
+ - `da-vinci supervisor-review --project <path> --change <id> [--run-reviewers] [--review-concurrency <value>] [--review-retries <value>] [--review-retry-delay-ms <value>] [--review-retry-max-delay-ms <value>] [--source <skill|manual|inferred>] [--executed-reviewers <csv>] [--status ...] [--issue-list ...] [--revision-outcome ...] [--write]`
53
88
  - 持久化结构化 supervisor review 记录(`Configured reviewers`、`Executed reviewers`、`Review source`、`Status`、`Issue list`、`Revision outcome`)到 `pencil-design.md`
54
89
  - 推荐直接用 `--run-reviewers --write` 一步完成 reviewer skills 执行与记录落盘
55
- - 通过 `--review-concurrency`、`--review-retries`、`--review-retry-delay-ms` 可调 reviewer 并发与重试退避
90
+ - 通过 `--review-concurrency`、`--review-retries`、`--review-retry-delay-ms`、`--review-retry-max-delay-ms` 可调 reviewer 并发与有上限的重试退避
56
91
  - 当 `Require Supervisor Review: true` 时,`manual/inferred` 记录会被 completion 阻断
57
92
  - `design-supervisor review` 作为兼容别名保留,并会转发到该命令
93
+ - `da-vinci check-pen-baseline --pen <project-pen> --baseline <other-pen>[,<other-pen>...] [--prefer-source <path>]`
94
+ - 在新一轮设计前比较项目内/外部(或次要)`.pen` 的 canonical snapshot hash
95
+ - 默认在 hash 分叉时阻断,直到来源优先级被显式确认
96
+ - `--prefer-source <project-pen>` 可记录“继续以项目内路径为准”的显式决策
97
+ - `da-vinci sync-pen-source --from <preferred-source> --to <project-pen>`
98
+ - 把被选中的最新 `.pen` 来源同步到项目内 `.pen` 路径,并刷新 Da Vinci state 元数据
99
+ - 当外部备份是最新基线时,在 `pencil-session begin` 前先执行
58
100
 
59
101
  建议在 `/dv:design` 阶段使用,尤其是在 anchor surface 的图标定稿前。
60
102
 
@@ -104,6 +146,7 @@ Da Vinci 期望它们遵循工作流状态。
104
146
 
105
147
  重要规则:
106
148
 
149
+ - 有 shell 能力时,先跑 `da-vinci workflow-status --project <path> [--change <id>] --json`,再用 `da-vinci next-step --project <path> [--change <id>]` 作为第一选路信号
107
150
  - 如果设计已经有了,但 `tasks.md` 还没有,`continue` 通常应该把你送到 `tasks`
108
151
  - 这时候不应该把 `build` 当成同级主推荐
109
152
  - 选路必须先基于工件和 checkpoint 真相,再参考 Context Delta
@@ -0,0 +1,46 @@
1
+ # Execution-Chain 升级迁移指南
2
+
3
+ 当你要在已有项目上启用 execution-chain 升级能力时,使用这份指南。
4
+
5
+ ## 1. Sidecar 生成生命周期
6
+
7
+ Planning sidecar 是显式工件,不是隐式副产物。
8
+
9
+ - 用 `da-vinci generate-sidecars --project <path> [--change <id>]` 生成
10
+ - sidecar 写入 `.da-vinci/changes/<change-id>/sidecars/`
11
+ - lint/status/verify 不应静默改写 sidecar
12
+ - proposal/spec/page-map/tasks/bindings 有实质改动后应重新生成
13
+
14
+ ## 2. Advisory 与 Strict 推广策略
15
+
16
+ 默认策略:
17
+
18
+ - `lint-spec`、`scope-check`、`lint-tasks`、`lint-bindings` 默认 advisory(`WARN` 不硬阻断)
19
+ - 传 `--strict` 才把 warning 升级为阻断退出
20
+ - 只有在 warning 基线稳定后,才在 CI 打开 strict
21
+
22
+ Audit 集成:
23
+
24
+ - integrity audit 把 planning-signal 的 `BLOCK` 当 warning 级信号
25
+ - completion audit 把 verification-signal 的 `BLOCK` 当 failure 级信号
26
+
27
+ ## 3. 持久化工作流状态回退
28
+
29
+ `workflow-status` 只有在以下条件全部满足时才会使用 `.da-vinci/state/workflow.json`:
30
+
31
+ - schema 版本可识别
32
+ - change 条目存在
33
+ - 时间戳未过期
34
+ - 指纹与当前工件真相一致
35
+
36
+ 任一条件不满足时,会自动回退到基于工件的派生状态,并记录 reconciliation 说明。
37
+
38
+ ## 4. Scaffold 约束
39
+
40
+ `da-vinci scaffold` 是 MVP 脚手架能力,约束如下:
41
+
42
+ - 输出只用于 TODO 标记和人工审阅
43
+ - 不是最终代码生成
44
+ - MVP 不做多框架扩展
45
+ - scaffold 边界来自 `pencil-bindings.md` 映射
46
+ - 接受前需跑 `verify-bindings`、`verify-implementation`、`verify-structure`
@@ -198,6 +198,7 @@ active Pencil 工作一旦存在,就要跑 `design-source checkpoint`。
198
198
  - active editor 是否就是这个 `.pen`
199
199
  - shell 上是否真的存在这个 `.pen`
200
200
  - 登记的 `.pen` 是否还停留在“只有内存,没有磁盘”
201
+ - 如果存在外部或次要 `.pen`,是否在新一轮编辑前显式完成了基线 hash 对齐和来源优先级确认
201
202
  - `.da-vinci/designs/` 是否被 markdown 或 PNG 污染
202
203
 
203
204
  ## MCP Runtime Gate
@@ -250,13 +251,14 @@ Context Delta 相关审计期望都是告警级:
250
251
  典型自治流程:
251
252
 
252
253
  1. `da-vinci pencil-session begin --project <project-path> --pen <path>`
253
- 2. Pencil MCP 编辑
254
- 3. `da-vinci pencil-session persist --project <project-path> --pen <path> --nodes-file <nodes.json> --variables-file <vars.json> --version <version>`
255
- 4. screenshot review + layout hygiene
256
- 5. design checkpoint
257
- 6. 如果配置了,就执行 design-supervisor review
258
- 7. `da-vinci pencil-session end --project <project-path> --pen <path> --nodes-file <nodes.json> --variables-file <vars.json> --version <version>`
259
- 8. `da-vinci audit --mode completion --change <change-id> <project-path>`
254
+ 2. 如果存在外部/次要 `.pen`,在编辑前先运行 `da-vinci check-pen-baseline --pen <project-pen> --baseline <other-pen>`;若分叉,先把优先来源同步回 `<project-pen>`
255
+ 3. Pencil MCP 编辑
256
+ 4. `da-vinci pencil-session persist --project <project-path> --pen <path> --nodes-file <nodes.json> --variables-file <vars.json> --version <version>`
257
+ 5. screenshot review + layout hygiene
258
+ 6. design checkpoint
259
+ 7. 如果配置了,就执行 design-supervisor review
260
+ 8. `da-vinci pencil-session end --project <project-path> --pen <path> --nodes-file <nodes.json> --variables-file <vars.json> --version <version>`
261
+ 9. `da-vinci audit --mode completion --change <change-id> <project-path>`
260
262
 
261
263
  ## 流程图
262
264
 
@@ -65,6 +65,12 @@
65
65
 
66
66
  继续规则优先级:
67
67
 
68
+ - 有 shell 能力时,先运行 `da-vinci workflow-status --project <path> [--change <id>] --json`
69
+ - 再用 `da-vinci next-step --project <path> [--change <id>]` 作为第一续跑路由信号
70
+ - 如果运行时 spec 质量还不确定,进入 `build` 前先运行 `da-vinci lint-spec --project <path> [--change <id>]`
71
+ - 如果页面或状态在规划工件中的传播关系不确定,进入 `build` 前先运行 `da-vinci scope-check --project <path> [--change <id>]`
72
+ - 进入终态前先运行 `da-vinci verify-bindings --project <path> [--change <id>]` 与 `da-vinci verify-coverage --project <path> [--change <id>]`
73
+ - 当规划切片有改动且需要恢复判断时,运行 `da-vinci diff-spec --project <path> [--change <id>]`
68
74
  - 先根据工件和 checkpoint 真相决定路由
69
75
  - Context Delta 只用于恢复和解释,不用于覆盖选路
70
76
  - 如果 Context Delta 与当前工件冲突,选路时忽略冲突内容并标记冲突
@@ -1,7 +1,11 @@
1
- # 场景提示词模板
1
+ # 场景提示词模版说明
2
+
3
+ ## 模版说明
2
4
 
3
5
  这些模板用于在不同产品形态下,快速拿到可直接执行的起始提示词。
4
6
 
7
+ 这部分主要说明每类模板适合什么场景、应该怎么搭配使用,以及它和 `Visual Assist`、workflow gate 之间的边界。
8
+
5
9
  这些模板主要服务于 screen 设计阶段。
6
10
  如果是存量系统的大改版,且流程或逻辑也会一起变化,应该先用 `overhaul-from-code` 搭配 `intake` 或自定义提示词把 `proposal.md`、`migration-contract.md` 和目标 `specs/` 稳定下来,再复用对应的设计模板。
7
11
 
@@ -1,7 +1,11 @@
1
- # Visual Assist 场景模板
1
+ # Visual Assist 场景模版说明
2
+
3
+ ## 模版说明
2
4
 
3
5
  这些模板用于作为 `DA-VINCI.md` 里 `## Visual Assist` 的起始配置。
4
6
 
7
+ 这部分主要说明每类模板的用途、不同变体的差别,以及哪些 workflow gate 仍然必须放在模板外单独处理。
8
+
5
9
  每个模板都刻意保持保守:
6
10
 
7
11
  - 一个主要 adapter 方向
@@ -19,6 +19,16 @@
19
19
  - `continue` 选路先看工件/checkpoint 真相,再把 Context Delta 当作辅助恢复信息
20
20
  - 如果 Context Delta 与当前工件冲突,选路时应忽略冲突内容并记录冲突
21
21
 
22
+ execution-chain 命令组合(终态前建议):
23
+
24
+ - `da-vinci workflow-status --project <path> [--change <id>] --json`
25
+ - `da-vinci next-step --project <path> [--change <id>]`
26
+ - `da-vinci lint-spec|lint-tasks|lint-bindings --project <path> [--change <id>]`
27
+ - `da-vinci scope-check --project <path> [--change <id>]`
28
+ - `da-vinci generate-sidecars --project <path> [--change <id>]`
29
+ - `da-vinci verify-bindings|verify-implementation|verify-structure|verify-coverage --project <path> [--change <id>]`
30
+ - `da-vinci diff-spec --project <path> [--change <id>]`
31
+
22
32
  ## 1. `greenfield-spec`
23
33
 
24
34
  适用:
@@ -99,17 +109,18 @@ $da-vinci use redesign-from-code to inventory the current app, identify current
99
109
  10. 对功能性图标,先运行 `da-vinci icon-sync` 再运行 `da-vinci icon-search --query "<意图词>"`,先选定 `icon_font` 名称再写图标节点
100
110
  11. 如果同一个 anchor surface 连续两次回滚,就切到每批不超过 6 个操作的微批次,直到拿到干净的 schema-safe pass
101
111
  12. 如果这一轮开始时还没有登记的项目内 `.pen`,必须先执行 `da-vinci pencil-session begin --project <project-path> --pen <path>`,先 seed 登记路径并拿到全局锁,再开始第一次 Pencil 编辑
102
- 13. 如果项目里原本已有登记的 `.pen`,继续设计时也必须先通过 `da-vinci pencil-session begin --project <project-path> --pen <path>` reopen 它;发生了实质性 live edit 后,再通过 `da-vinci pencil-session persist` 把当前 MCP 快照重新覆盖写回同一路径
103
- 14. 在第一次成功写入 Pencil 后,立即验证登记的项目内 `.pen` 路径已经成为 shell 可见文件
104
- 15. 紧接着运行 `da-vinci audit --mode integrity <project-path>`
105
- 16. 如果 Pencil MCP 可用,先运行 MCP runtime gate,并把结果记录到 `pencil-design.md`
106
- 17. 运行 `design-source checkpoint`,确认登记的项目内 `.pen` 路径、当前 Pencil 设计源和 shell 可见文件是一致的
107
- 18. 截图导出只放到 `.da-vinci/changes/<change-id>/exports/`,绝不能写进 `.da-vinci/designs/`
108
- 19. broad expansion 前,先把 screenshot review 的 `PASS` / `WARN` / `BLOCK`、问题列表和回改结果记清楚
109
- 20. 绑定路由和 Pencil 页面
110
- 21. 生成和 redesign slice 对齐的任务
111
- 22. 在任何终态完成声明之前,先运行 `da-vinci audit --mode completion --change <change-id> <project-path>`
112
- 23. 只有在 completion gate 最终能通过时,才进入实现和验证
112
+ 13. 如果存在外部或历史 `.pen` 备份,在新一轮写入前先运行 `da-vinci check-pen-baseline --pen <project-pen> --baseline <other-pen>`;若 hash 不一致,先把选中的优先来源同步回 `<project-pen>`
113
+ 14. 如果项目里原本已有登记的 `.pen`,继续设计时也必须先通过 `da-vinci pencil-session begin --project <project-path> --pen <path>` reopen 它;发生了实质性 live edit 后,再通过 `da-vinci pencil-session persist` 把当前 MCP 快照重新覆盖写回同一路径
114
+ 15. 在第一次成功写入 Pencil 后,立即验证登记的项目内 `.pen` 路径已经成为 shell 可见文件
115
+ 16. 紧接着运行 `da-vinci audit --mode integrity <project-path>`
116
+ 17. 如果 Pencil MCP 可用,先运行 MCP runtime gate,并把结果记录到 `pencil-design.md`
117
+ 18. 运行 `design-source checkpoint`,确认登记的项目内 `.pen` 路径、当前 Pencil 设计源和 shell 可见文件是一致的
118
+ 19. 截图导出只放到 `.da-vinci/changes/<change-id>/exports/`,绝不能写进 `.da-vinci/designs/`
119
+ 20. broad expansion 前,先把 screenshot review 的 `PASS` / `WARN` / `BLOCK`、问题列表和回改结果记清楚
120
+ 21. 绑定路由和 Pencil 页面
121
+ 22. 生成和 redesign slice 对齐的任务
122
+ 23. 在任何终态完成声明之前,先运行 `da-vinci audit --mode completion --change <change-id> <project-path>`
123
+ 24. 只有在 completion gate 最终能通过时,才进入实现和验证
113
124
 
114
125
  ### 复杂 Android 页面示例
115
126
 
@@ -133,6 +144,7 @@ Before non-trivial `batch_design` calls, preflight the Pencil operations when sh
133
144
  If the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds.
134
145
  Use only Pencil-supported properties; do not use web-only props like flex or margin.
135
146
  在第一次 Pencil 编辑前,必须执行 `da-vinci pencil-session begin --project <project-path> --pen <path>`,这样会先 seed 登记好的 `.pen` 并持有全局 Pencil 锁。
147
+ 如果存在外部或历史 `.pen`,先运行 `da-vinci check-pen-baseline --pen <project-pen> --baseline <other-pen>`;若 hash 分叉,先确认来源优先级并把选中的来源同步回 `<project-pen>` 再继续。
136
148
  如果项目里原本已有登记的 `.pen`,继续设计时先打开它,但实质性 live edit 后优先通过 `da-vinci pencil-session persist` 把当前 live MCP 快照重新覆盖写回同一路径。
137
149
  Verify the registered project-local `.pen` file exists as a shell-visible file after the first Pencil write.
138
150
  在第一次成功写入 Pencil 后、继续大范围扩展前,先运行 `da-vinci audit --mode integrity <project-path>`。