@xenonbyte/da-vinci-workflow 0.2.3 → 0.2.4

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 (41) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +32 -7
  3. package/README.zh-CN.md +151 -7
  4. package/commands/claude/dv/build.md +5 -0
  5. package/commands/claude/dv/continue.md +4 -0
  6. package/commands/claude/dv/tasks.md +6 -0
  7. package/commands/claude/dv/verify.md +2 -0
  8. package/commands/codex/prompts/dv-build.md +5 -0
  9. package/commands/codex/prompts/dv-continue.md +4 -0
  10. package/commands/codex/prompts/dv-tasks.md +6 -0
  11. package/commands/codex/prompts/dv-verify.md +2 -0
  12. package/commands/gemini/dv/build.toml +5 -0
  13. package/commands/gemini/dv/continue.toml +4 -0
  14. package/commands/gemini/dv/tasks.toml +6 -0
  15. package/commands/gemini/dv/verify.toml +2 -0
  16. package/commands/templates/dv-continue.shared.md +4 -0
  17. package/docs/discipline-and-orchestration-upgrade.md +83 -0
  18. package/docs/dv-command-reference.md +18 -2
  19. package/docs/execution-chain-migration.md +23 -0
  20. package/docs/prompt-entrypoints.md +5 -0
  21. package/docs/skill-usage.md +16 -0
  22. package/docs/workflow-overview.md +17 -0
  23. package/docs/zh-CN/dv-command-reference.md +16 -2
  24. package/docs/zh-CN/execution-chain-migration.md +23 -0
  25. package/docs/zh-CN/prompt-entrypoints.md +5 -0
  26. package/docs/zh-CN/skill-usage.md +16 -0
  27. package/docs/zh-CN/workflow-overview.md +17 -0
  28. package/lib/audit-parsers.js +148 -1
  29. package/lib/cli.js +106 -1
  30. package/lib/execution-profile.js +143 -0
  31. package/lib/execution-signals.js +19 -1
  32. package/lib/lint-tasks.js +86 -2
  33. package/lib/planning-parsers.js +255 -18
  34. package/lib/supervisor-review.js +2 -1
  35. package/lib/task-execution.js +160 -0
  36. package/lib/task-review.js +197 -0
  37. package/lib/verify.js +152 -1
  38. package/lib/workflow-state.js +452 -30
  39. package/lib/worktree-preflight.js +214 -0
  40. package/package.json +1 -1
  41. package/references/artifact-templates.md +56 -6
@@ -43,10 +43,11 @@ These commands do not replace route selection, but they support design execution
43
43
  - useful when the command surface is harder to remember than the workflow itself
44
44
  - `da-vinci workflow-status --project <path> [--change <id>] [--json]`
45
45
  - derives the current workflow stage from artifact and checkpoint truth
46
- - reports blockers, warnings, handoff-gate state, and one primary route recommendation
46
+ - reports blockers, warnings, handoff-gate state, discipline markers, execution profile hints, and verification-evidence freshness
47
47
  - keep this distinct from `audit`: route guidance is not completion truth
48
48
  - `da-vinci next-step --project <path> [--change <id>] [--json]`
49
49
  - provides a route-first continuation summary from the same derived workflow state
50
+ - JSON output includes `nextStep`, `executionProfile`, `worktreePreflight`, and discipline/freshness metadata for orchestration consumers
50
51
  - use this as the first continuation signal before free-form artifact scanning
51
52
  - `da-vinci lint-spec --project <path> [--change <id>] [--strict] [--json]`
52
53
  - validates Da Vinci runtime `spec.md` schema sections (`Behavior`, `States`, `Inputs`, `Outputs`, `Acceptance`, `Edge Cases`)
@@ -57,7 +58,7 @@ These commands do not replace route selection, but they support design execution
57
58
  - emits a machine-readable coverage matrix for pages and states
58
59
  - default behavior is advisory (`WARN` with zero exit); `--strict` upgrades findings to blocking
59
60
  - `da-vinci lint-tasks --project <path> [--change <id>] [--strict] [--json]`
60
- - validates top-level task groups, ordering, verification actions, and behavior-to-task coverage hints
61
+ - validates top-level task groups, ordering, discipline markers, execution-mode hints, file targets, verification commands, and behavior-to-task coverage hints
61
62
  - default behavior is advisory (`WARN` with zero exit); `--strict` upgrades findings to blocking
62
63
  - `da-vinci lint-bindings --project <path> [--change <id>] [--strict] [--json]`
63
64
  - validates implementation-to-Pencil mappings for parseability, source shape, and implementation landings
@@ -68,6 +69,15 @@ These commands do not replace route selection, but they support design execution
68
69
  - `da-vinci verify-bindings|verify-implementation|verify-structure|verify-coverage --project <path> [--change <id>] [--strict] [--json]`
69
70
  - verifies code landings, planned-state implementation evidence, and structural consistency against bindings
70
71
  - `verify-structure` reports whether checks used markup-backed analysis or heuristic fallback and exposes confidence
72
+ - `da-vinci task-execution --project <path> --change <id> --task-group <id> --status <DONE|DONE_WITH_CONCERNS|NEEDS_CONTEXT|BLOCKED> --summary <text> [--changed-files <csv>] [--test-evidence <csv>] [--concerns <csv>] [--blockers <csv>] [--json]`
73
+ - persists normalized implementer-status envelopes into execution signals
74
+ - use this to keep resume routing machine-readable when implementation is blocked or concerns remain
75
+ - `da-vinci task-review --project <path> --change <id> --task-group <id> --stage <spec|quality> --status <PASS|WARN|BLOCK> --summary <text> [--issues <csv>] [--reviewer <name>] [--write-verification] [--json]`
76
+ - persists ordered two-stage task review evidence (`spec` before `quality`)
77
+ - rejects out-of-order quality approval and can append evidence into `verification.md`
78
+ - `da-vinci worktree-preflight --project <path> [--change <id>] [--json]`
79
+ - runs advisory worktree isolation checks (`.worktrees/` or `worktrees/` ignore safety, dirty workspace, baseline test heuristics)
80
+ - does not replace route truth; use it to decide whether bounded-parallel execution should downgrade to serial
71
81
  - `da-vinci diff-spec --project <path> [--change <id>] [--from <sidecars-dir>] [--json]`
72
82
  - compares normalized planning sidecars and reports added/removed/modified requirement planning items
73
83
  - includes normalized spec deltas plus broader planning summaries (tasks/page-map/bindings) under one surface
@@ -255,6 +265,10 @@ Build-stage self-check:
255
265
  - run `da-vinci scope-check --project <path> [--change <id>]`
256
266
  - if `tasks.md` exists, run `da-vinci lint-tasks --project <path> [--change <id>]`
257
267
  - if both `pencil-design.md` and `pencil-bindings.md` exist, run `da-vinci lint-bindings --project <path> [--change <id>]`
268
+ - inspect `executionProfile` from `da-vinci next-step --project <path> [--change <id>] --json`
269
+ - if profile mode is `bounded_parallel`, run `da-vinci worktree-preflight --project <path> [--change <id>]` and downgrade to serial unless isolation is ready or explicitly accepted
270
+ - persist per-task implementer outcomes via `da-vinci task-execution ...` and keep unresolved concerns visible before closure
271
+ - run task review in order: `da-vinci task-review ... --stage spec ...` then `da-vinci task-review ... --stage quality ...`
258
272
  - treat command output as the gate; do not downgrade `BLOCK` or non-zero results into soft guidance
259
273
  - treat any `BLOCK` or missing required planning/design artifact as a hard stop before broad implementation
260
274
 
@@ -286,6 +300,8 @@ Verify-stage self-check:
286
300
  - run `da-vinci verify-coverage --project <path> [--change <id>]`
287
301
  - treat command output as the gate; do not downgrade `BLOCK` or `FAIL` into soft guidance
288
302
  - if any verification surface is still `BLOCK` or `FAIL`, keep the workflow in verification and record the drift instead of claiming success
303
+ - require fresh verification evidence in `verify-coverage` and `workflow-status` before terminal completion wording
304
+ - if task-review evidence is being recorded, keep unresolved `WARN/BLOCK` review stages open instead of closing the task group
289
305
  - before terminal completion, require `da-vinci audit --mode completion --change <change-id> <project-path>` to pass
290
306
 
291
307
  ## State-Based Next-Step Rules
@@ -44,3 +44,26 @@ If any check fails, Da Vinci falls back to derived state from artifacts and reco
44
44
  - no multi-framework expansion in the MVP
45
45
  - scaffold boundaries come from `pencil-bindings.md` mappings
46
46
  - verify scaffold output with `verify-bindings`, `verify-implementation`, and `verify-structure` before acceptance
47
+
48
+ ## 5. Planned Next Upgrade: Discipline And Orchestration
49
+
50
+ After execution-chain surfaces are enabled, the next planned upgrade is:
51
+
52
+ - `openspec/changes/discipline-and-orchestration-upgrade/`
53
+
54
+ This planned change adds:
55
+
56
+ - stronger handoff discipline before implementation
57
+ - stronger task-plan quality checks
58
+ - bounded orchestration hints tied to workflow state
59
+ - structured task execution and review evidence
60
+ - completion wording discipline backed by fresh verification evidence
61
+ - optional worktree preflight guidance
62
+
63
+ Important boundary:
64
+
65
+ - this does not replace artifact truth, checkpoint truth, or completion-audit authority
66
+
67
+ See:
68
+
69
+ - `docs/discipline-and-orchestration-upgrade.md`
@@ -66,13 +66,17 @@ Continuation precedence:
66
66
 
67
67
  - when shell access is available, run `da-vinci workflow-status --project <path> [--change <id>] --json` before route selection
68
68
  - use `da-vinci next-step --project <path> [--change <id>]` as the first continuation routing signal
69
+ - prefer reading `da-vinci next-step --project <path> [--change <id>] --json` when available so discipline marker state, execution-profile hints, and verification freshness are explicit
69
70
  - run `da-vinci lint-spec --project <path> [--change <id>]` when runtime spec quality is uncertain before routing into `build`
70
71
  - run `da-vinci scope-check --project <path> [--change <id>]` when page or state propagation across planning artifacts is uncertain
72
+ - run `da-vinci lint-tasks --project <path> [--change <id>]` before routing into `build` when task metadata quality is uncertain
71
73
  - run `da-vinci verify-bindings --project <path> [--change <id>]` and `da-vinci verify-coverage --project <path> [--change <id>]` before terminal completion routing
72
74
  - run `da-vinci diff-spec --project <path> [--change <id>]` after planning edits when continuation must reason about changed requirement slices
73
75
  - determine routing from artifact and checkpoint truth first
74
76
  - use contextual checkpoint deltas only as auxiliary recovery context
75
77
  - if contextual deltas conflict with current artifacts, ignore them for routing and note the conflict
78
+ - if design approval discipline markers are missing, malformed, or stale, keep routing in `design` or `tasks` and avoid direct promotion into `build`
79
+ - if bounded-parallel execution is hinted, run `da-vinci worktree-preflight --project <path> [--change <id>]` before emitting a parallel build continuation prompt
76
80
 
77
81
  ## Default Flow
78
82
 
@@ -93,6 +97,7 @@ State rule:
93
97
 
94
98
  - if design is done but `tasks.md` does not exist yet, the next recommended route should usually be `tasks`, not `build`
95
99
  - only recommend `build` as the primary next step once tasks and implementation readiness are already clear
100
+ - never include terminal completion wording unless fresh verification evidence is present and completion audit is explicitly required
96
101
 
97
102
  ## Platform Syntax
98
103
 
@@ -85,6 +85,12 @@ When design is mostly ready and implementation is next, use these checks:
85
85
  - use this when runtime spec quality is still uncertain
86
86
  - `da-vinci scope-check`
87
87
  - use this when page/state propagation across planning artifacts looks ambiguous
88
+ - `da-vinci lint-tasks`
89
+ - confirm task groups have discipline markers, exact ownership targets, execution intent, and verification commands
90
+ - `da-vinci lint-bindings`
91
+ - run this when `pencil-design.md` and `pencil-bindings.md` both exist so implementation landing evidence stays parseable
92
+ - `da-vinci worktree-preflight`
93
+ - run this before bounded-parallel execution to decide whether local worktree isolation is recommended
88
94
 
89
95
  If you are already inside the project root directory, `--project` is optional because the CLI falls back to `cwd`.
90
96
 
@@ -95,8 +101,17 @@ da-vinci workflow-status
95
101
  da-vinci next-step
96
102
  da-vinci lint-spec
97
103
  da-vinci scope-check
104
+ da-vinci lint-tasks
98
105
  ```
99
106
 
107
+ During implementation, persist machine-readable task evidence instead of relying on chat-only summaries:
108
+
109
+ - `da-vinci task-execution --project <path> --change <id> --task-group <id> --status <DONE|DONE_WITH_CONCERNS|NEEDS_CONTEXT|BLOCKED> --summary <text> ...`
110
+ - `da-vinci task-review --project <path> --change <id> --task-group <id> --stage spec ...`
111
+ - `da-vinci task-review --project <path> --change <id> --task-group <id> --stage quality ...`
112
+
113
+ `quality` review is valid only after `spec` review has a `PASS` record for the same task group.
114
+
100
115
  ## After Pausing Midway
101
116
 
102
117
  The safest resume order is:
@@ -107,6 +122,7 @@ The safest resume order is:
107
122
  4. if planning propagation is unclear, run `da-vinci scope-check`
108
123
  5. if planning artifacts changed since the last stable snapshot, run `da-vinci generate-sidecars` and `da-vinci diff-spec`
109
124
  6. before terminal completion, run `da-vinci verify-bindings` and `da-vinci verify-coverage`
125
+ 7. if completion wording is needed, confirm `verify-coverage` freshness is current and run `da-vinci audit --mode completion --change <id> <project-path>`
110
126
 
111
127
  Resume should follow the artifacts, not old conversation state:
112
128
 
@@ -30,6 +30,12 @@ This means:
30
30
  - project-local `.pen` files remain the design source of truth
31
31
  - implementation must stay traceable to both
32
32
 
33
+ Truth-versus-orchestration boundary:
34
+
35
+ - route and completion truth comes from artifacts, checkpoints, execution signals, and `audit`
36
+ - orchestration hints such as execution profiles and worktree preflight remain advisory guidance
37
+ - orchestration hints must never override explicit `BLOCK` truth from artifacts, checkpoints, or completion audit
38
+
33
39
  ## Main Flow
34
40
 
35
41
  1. Choose the correct mode.
@@ -60,6 +66,12 @@ Use these command surfaces to inspect route readiness before selecting the next
60
66
  - explicitly generates deterministic planning sidecars used by diff and downstream tooling
61
67
  - `da-vinci verify-bindings|verify-implementation|verify-structure|verify-coverage --project <path> [--change <id>] [--strict] [--json]`
62
68
  - validates execution-chain evidence from bindings through implementation and structural coverage
69
+ - `da-vinci task-execution --project <path> --change <id> --task-group <id> --status <DONE|DONE_WITH_CONCERNS|NEEDS_CONTEXT|BLOCKED> --summary <text> ...`
70
+ - persists normalized implementer evidence per task group so pause/resume routing can read unresolved blockers and concerns
71
+ - `da-vinci task-review --project <path> --change <id> --task-group <id> --stage <spec|quality> --status <PASS|WARN|BLOCK> --summary <text> ...`
72
+ - persists ordered two-stage review evidence (`spec` before `quality`) and can append review records into `verification.md`
73
+ - `da-vinci worktree-preflight --project <path> [--change <id>] [--json]`
74
+ - runs advisory worktree isolation checks before bounded-parallel execution
63
75
  - `da-vinci diff-spec --project <path> [--change <id>] [--from <sidecars-dir>] [--json]`
64
76
  - reports normalized planning deltas for spec/tasks/page-map/bindings sidecars to support safe continuation
65
77
 
@@ -185,7 +197,11 @@ These checks verify that:
185
197
  After mapping passes:
186
198
 
187
199
  - generate `tasks.md`
200
+ - keep task groups parseable with discipline markers plus explicit file targets, execution intent, review intent, and verification commands
188
201
  - implement from requirements plus Pencil data
202
+ - inspect `executionProfile` from `workflow-status` or `next-step --json` before broad implementation
203
+ - if bounded parallelism is suggested, run `da-vinci worktree-preflight --project <path> [--change <id>]` and downgrade to serial when isolation is not ready
204
+ - persist per-task implementer and review evidence via `task-execution` and ordered `task-review` records
189
205
  - verify requirement drift and design drift
190
206
 
191
207
  ### 8. Terminal Completion
@@ -195,6 +211,7 @@ The workflow must not report `design complete`, `workflow complete`, or any equi
195
211
  - design checkpoint is no longer blocking
196
212
  - design-source checkpoint is at least `PASS`
197
213
  - MCP runtime gate is acceptable when Pencil MCP was used
214
+ - fresh verification evidence is present for in-scope implementation and coverage claims
198
215
  - `da-vinci audit --mode completion --change <change-id> <project-path>` passes
199
216
 
200
217
  Notes:
@@ -45,10 +45,11 @@ Da Vinci 期望它们遵循工作流状态。
45
45
  - 当真正难记的是命令面而不是流程本身时,优先用它
46
46
  - `da-vinci workflow-status --project <path> [--change <id>] [--json]`
47
47
  - 从工件和 checkpoint 真相推导当前 workflow 阶段
48
- - 报告 blocker、warning、handoff gate 状态,以及主推荐路由
48
+ - 报告 blocker、warning、handoff gate、discipline marker、execution profile 提示与 verification freshness
49
49
  - 它和 `audit` 职责不同:它负责选路,不是终态审计真相
50
50
  - `da-vinci next-step --project <path> [--change <id>] [--json]`
51
51
  - 基于同一套 workflow-state 推导,给出 route-first 的续跑建议
52
+ - JSON 输出包含 `nextStep`、`executionProfile`、`worktreePreflight` 与 discipline/freshness 元数据
52
53
  - 在自由扫描工件之前,优先把它作为第一路由信号
53
54
  - `da-vinci lint-spec --project <path> [--change <id>] [--strict] [--json]`
54
55
  - 校验 Da Vinci 运行时 `spec.md` 的核心章节(`Behavior`、`States`、`Inputs`、`Outputs`、`Acceptance`、`Edge Cases`)
@@ -59,7 +60,7 @@ Da Vinci 期望它们遵循工作流状态。
59
60
  - 输出页面与状态两条线的机器可读覆盖矩阵
60
61
  - 默认 advisory(有发现给 `WARN` 且不阻断);显式 `--strict` 才升级为阻断
61
62
  - `da-vinci lint-tasks --project <path> [--change <id>] [--strict] [--json]`
62
- - 校验顶层 task groups、编号顺序、verification 动作和 behavior 覆盖提示
63
+ - 校验顶层 task groups、编号顺序、discipline markers、执行模式提示、文件目标、verification 命令与 behavior 覆盖提示
63
64
  - 默认 advisory(有发现给 `WARN` 且不阻断);显式 `--strict` 才升级为阻断
64
65
  - `da-vinci lint-bindings --project <path> [--change <id>] [--strict] [--json]`
65
66
  - 校验实现到 Pencil 的映射是否可解析、source 形态是否合理、实现落点是否可定位
@@ -70,6 +71,12 @@ Da Vinci 期望它们遵循工作流状态。
70
71
  - `da-vinci verify-bindings|verify-implementation|verify-structure|verify-coverage --project <path> [--change <id>] [--strict] [--json]`
71
72
  - 校验代码落点、计划状态实现证据、以及绑定驱动的结构一致性
72
73
  - `verify-structure` 会明确报告是 markup-backed 还是 heuristic fallback,并给出置信度
74
+ - `da-vinci task-execution --project <path> --change <id> --task-group <id> --status <DONE|DONE_WITH_CONCERNS|NEEDS_CONTEXT|BLOCKED> --summary <text> [--changed-files <csv>] [--test-evidence <csv>] [--concerns <csv>] [--blockers <csv>] [--json]`
75
+ - 持久化结构化 implementer 执行结果包,作为 task 级执行证据
76
+ - `da-vinci task-review --project <path> --change <id> --task-group <id> --stage <spec|quality> --status <PASS|WARN|BLOCK> --summary <text> [--issues <csv>] [--reviewer <name>] [--write-verification] [--json]`
77
+ - 持久化有序两阶段 task review 证据(`spec` 在前,`quality` 在后)
78
+ - `da-vinci worktree-preflight --project <path> [--change <id>] [--json]`
79
+ - 运行 advisory worktree 隔离预检(目录 ignore 安全、工作区脏状态、baseline 检查启发)
73
80
  - `da-vinci diff-spec --project <path> [--change <id>] [--from <sidecars-dir>] [--json]`
74
81
  - 比较规范化 planning sidecars,报告新增/删除/修改的规划项
75
82
  - 在同一 surface 下提供 spec 差异以及 tasks/page-map/bindings 摘要差异
@@ -255,6 +262,10 @@ Da Vinci 期望它们遵循工作流状态。
255
262
  - 跑 `da-vinci scope-check --project <path> [--change <id>]`
256
263
  - 如果 `tasks.md` 已存在,跑 `da-vinci lint-tasks --project <path> [--change <id>]`
257
264
  - 如果 `pencil-design.md` 和 `pencil-bindings.md` 都存在,跑 `da-vinci lint-bindings --project <path> [--change <id>]`
265
+ - 查看 `da-vinci next-step --project <path> [--change <id>] --json` 的 `executionProfile`
266
+ - 若 profile 为 `bounded_parallel`,先跑 `da-vinci worktree-preflight --project <path> [--change <id>]`;隔离未就绪则降级串行
267
+ - 用 `da-vinci task-execution ...` 持久化每个 task group 的 implementer 结果包,确保 concern/blocker 可追踪
268
+ - 按顺序执行 task review:先 `da-vinci task-review ... --stage spec ...`,再 `da-vinci task-review ... --stage quality ...`
258
269
  - 把命令结果当成门禁,不要把 `BLOCK` 或非零退出码降级成软提示
259
270
  - 只要还有 `BLOCK` 或缺少必要 planning/design 工件,就不要进入大范围实现
260
271
 
@@ -262,6 +273,7 @@ Da Vinci 期望它们遵循工作流状态。
262
273
 
263
274
  - `BUILD SUCCESSFUL` 只代表可编译,不代表 workflow 完成
264
275
  - 只要 in-scope task groups 还没做完,就不能宣告 `design complete` 或 `workflow complete`
276
+ - 终态 completion 表述前必须具备 fresh verification evidence
265
277
  - 任何终态声明前都要运行 `da-vinci audit --mode completion --change <change-id> <project-path>` 并通过
266
278
 
267
279
  ### `/dv:verify`
@@ -286,6 +298,8 @@ Da Vinci 期望它们遵循工作流状态。
286
298
  - 跑 `da-vinci verify-coverage --project <path> [--change <id>]`
287
299
  - 把命令结果当成门禁,不要把 `BLOCK` 或 `FAIL` 降级成软提示
288
300
  - 只要任何验证面仍然是 `BLOCK` 或 `FAIL`,就继续停留在验证阶段并记录 drift,而不是宣称成功
301
+ - 终态表述前要求 `verify-coverage` 和 `workflow-status` 中的验证证据 freshness 为最新
302
+ - 如果启用了 task-review 证据,存在未解决 `WARN/BLOCK` 评审阶段时不得关闭对应 task group
289
303
  - 如果要声称终态完成,先要求 `da-vinci audit --mode completion --change <change-id> <project-path>` 通过
290
304
 
291
305
  ## 基于状态的下一步规则
@@ -44,3 +44,26 @@ Audit 集成:
44
44
  - MVP 不做多框架扩展
45
45
  - scaffold 边界来自 `pencil-bindings.md` 映射
46
46
  - 接受前需跑 `verify-bindings`、`verify-implementation`、`verify-structure`
47
+
48
+ ## 5. 下一阶段规划升级:Discipline And Orchestration
49
+
50
+ execution-chain 能力落地后,下一项规划中的升级是:
51
+
52
+ - `openspec/changes/discipline-and-orchestration-upgrade/`
53
+
54
+ 该规划变更会补充:
55
+
56
+ - 实施前交接纪律的强化
57
+ - `tasks.md` 执行就绪质量检查强化
58
+ - 与 workflow state 绑定的有边界编排提示
59
+ - 结构化 task 执行与审查证据
60
+ - 基于 fresh verification evidence 的 completion 表述约束
61
+ - 可选 worktree preflight 隔离建议
62
+
63
+ 重要边界:
64
+
65
+ - 该升级不会替代 artifact truth、checkpoint truth 或 completion-audit 权威
66
+
67
+ 参考:
68
+
69
+ - `docs/discipline-and-orchestration-upgrade.md`
@@ -67,13 +67,17 @@
67
67
 
68
68
  - 有 shell 能力时,先运行 `da-vinci workflow-status --project <path> [--change <id>] --json`
69
69
  - 再用 `da-vinci next-step --project <path> [--change <id>]` 作为第一续跑路由信号
70
+ - 如可用,优先读取 `da-vinci next-step --project <path> [--change <id>] --json`,显式获取 discipline marker、execution-profile 与 verification freshness 信息
70
71
  - 如果运行时 spec 质量还不确定,进入 `build` 前先运行 `da-vinci lint-spec --project <path> [--change <id>]`
71
72
  - 如果页面或状态在规划工件中的传播关系不确定,进入 `build` 前先运行 `da-vinci scope-check --project <path> [--change <id>]`
73
+ - 如果任务拆解质量不确定,进入 `build` 前先运行 `da-vinci lint-tasks --project <path> [--change <id>]`
72
74
  - 进入终态前先运行 `da-vinci verify-bindings --project <path> [--change <id>]` 与 `da-vinci verify-coverage --project <path> [--change <id>]`
73
75
  - 当规划切片有改动且需要恢复判断时,运行 `da-vinci diff-spec --project <path> [--change <id>]`
74
76
  - 先根据工件和 checkpoint 真相决定路由
75
77
  - Context Delta 只用于恢复和解释,不用于覆盖选路
76
78
  - 如果 Context Delta 与当前工件冲突,选路时忽略冲突内容并标记冲突
79
+ - 如果 design approval discipline marker 缺失、格式错误或过期,路由应停留在 `design` 或 `tasks`,不能直接推进到 `build`
80
+ - 如果提示了 bounded parallel 执行,先运行 `da-vinci worktree-preflight --project <path> [--change <id>]`,再决定是否输出并行 build continuation prompt
77
81
 
78
82
  ## 默认推荐流程
79
83
 
@@ -94,6 +98,7 @@
94
98
 
95
99
  - 如果设计已经完成,但 `tasks.md` 还不存在,下一步主推荐通常应该是 `tasks`,而不是 `build`
96
100
  - 只有任务和实现就绪度都已经明确时,才把 `build` 作为主推荐下一步
101
+ - 在 fresh verification evidence 缺失时,不能输出终态 completion 表述;应明确要求 completion audit
97
102
 
98
103
  ## 平台语法
99
104
 
@@ -85,6 +85,12 @@ $da-vinci use continue for <existing workflow state>
85
85
  - 当运行时 spec 质量还不够确定时使用
86
86
  - `da-vinci scope-check`
87
87
  - 当规划工件之间页面/状态传播关系还不清楚时使用
88
+ - `da-vinci lint-tasks`
89
+ - 校验 task groups 是否包含 discipline markers、明确文件落点、执行意图与 verification 命令
90
+ - `da-vinci lint-bindings`
91
+ - 当 `pencil-design.md` 与 `pencil-bindings.md` 同时存在时运行,确保实现落点证据可解析
92
+ - `da-vinci worktree-preflight`
93
+ - 准备 bounded parallel 执行前先跑,用于判断是否建议启用本地 worktree 隔离
88
94
 
89
95
  如果你已经在项目根目录里,`--project` 通常可以省略,因为 CLI 默认会回退到当前目录。
90
96
 
@@ -95,8 +101,17 @@ da-vinci workflow-status
95
101
  da-vinci next-step
96
102
  da-vinci lint-spec
97
103
  da-vinci scope-check
104
+ da-vinci lint-tasks
98
105
  ```
99
106
 
107
+ 实现阶段不要只靠聊天总结,建议同步写入机器可读证据:
108
+
109
+ - `da-vinci task-execution --project <path> --change <id> --task-group <id> --status <DONE|DONE_WITH_CONCERNS|NEEDS_CONTEXT|BLOCKED> --summary <text> ...`
110
+ - `da-vinci task-review --project <path> --change <id> --task-group <id> --stage spec ...`
111
+ - `da-vinci task-review --project <path> --change <id> --task-group <id> --stage quality ...`
112
+
113
+ 同一 task group 只有在 `spec` review 已是 `PASS` 时,`quality` review 才允许通过。
114
+
100
115
  ## 中途退出后,下次怎么恢复
101
116
 
102
117
  最稳妥的恢复顺序是:
@@ -107,6 +122,7 @@ da-vinci scope-check
107
122
  4. 如果规划传播关系不确定,跑 `da-vinci scope-check`
108
123
  5. 如果 planning 工件相对上次稳定状态有变化,跑 `da-vinci generate-sidecars` 和 `da-vinci diff-spec`
109
124
  6. 在终态前,跑 `da-vinci verify-bindings` 和 `da-vinci verify-coverage`
125
+ 7. 如果要做 completion 表述,确认 `verify-coverage` 的 freshness 仍然有效,并运行 `da-vinci audit --mode completion --change <id> <project-path>`
110
126
 
111
127
  恢复时应该遵循工件,而不是旧聊天上下文:
112
128
 
@@ -32,6 +32,12 @@ Da Vinci 围绕一个固定契约工作:
32
32
  - 项目内 `.pen` 是设计真相源
33
33
  - 实现必须能追溯到这两层
34
34
 
35
+ 真相与编排边界:
36
+
37
+ - 选路和 completion 真相来自工件、checkpoint、execution signals 与 `audit`
38
+ - execution profile、worktree preflight 等编排信息始终是 advisory 指导,不替代真相面
39
+ - 编排提示不能覆盖来自工件、checkpoint 或 completion audit 的明确 `BLOCK`
40
+
35
41
  ## 主流程
36
42
 
37
43
  1. 选择正确的 mode。
@@ -62,6 +68,12 @@ Da Vinci 围绕一个固定契约工作:
62
68
  - 显式生成确定性的 planning sidecars,供 diff 和下游工具消费
63
69
  - `da-vinci verify-bindings|verify-implementation|verify-structure|verify-coverage --project <path> [--change <id>] [--strict] [--json]`
64
70
  - 校验从 bindings 到实现与结构覆盖的执行链证据
71
+ - `da-vinci task-execution --project <path> --change <id> --task-group <id> --status <DONE|DONE_WITH_CONCERNS|NEEDS_CONTEXT|BLOCKED> --summary <text> ...`
72
+ - 按 task group 持久化 implementer 结果包,便于恢复时读取未解决 blocker/concern
73
+ - `da-vinci task-review --project <path> --change <id> --task-group <id> --stage <spec|quality> --status <PASS|WARN|BLOCK> --summary <text> ...`
74
+ - 持久化有序两阶段 review 证据(先 `spec` 再 `quality`),并可写回 `verification.md`
75
+ - `da-vinci worktree-preflight --project <path> [--change <id>] [--json]`
76
+ - 在准备 bounded-parallel 执行前提供 advisory 隔离预检
65
77
  - `da-vinci diff-spec --project <path> [--change <id>] [--from <sidecars-dir>] [--json]`
66
78
  - 报告 spec/tasks/page-map/bindings sidecars 的规范化差异,支持安全续跑
67
79
 
@@ -187,7 +199,11 @@ anchor 通过后,再抽 shared primitives,然后再扩更多页面。
187
199
  mapping 通过后:
188
200
 
189
201
  - 生成 `tasks.md`
202
+ - 保持 task group 可解析:包含 discipline markers、文件目标、执行意图、review 意图和 verification 命令
190
203
  - 基于 requirements 和 Pencil 数据实现
204
+ - 在大范围实现前,从 `workflow-status` 或 `next-step --json` 查看 `executionProfile`
205
+ - 如果建议 bounded parallel,先跑 `da-vinci worktree-preflight --project <path> [--change <id>]`;隔离未就绪时降级为串行
206
+ - 通过 `task-execution` 与有序 `task-review` 记录每个 task group 的执行与审查证据
191
207
  - 验证需求漂移和设计漂移
192
208
 
193
209
  ### 8. 终态完成
@@ -197,6 +213,7 @@ mapping 通过后:
197
213
  - design checkpoint 不再阻塞
198
214
  - design-source checkpoint 至少 `PASS`
199
215
  - 如果用了 Pencil MCP,runtime gate 结果可接受
216
+ - in-scope 的实现和覆盖结论具备 fresh verification evidence
200
217
  - `da-vinci audit --mode completion --change <change-id> <project-path>` 通过
201
218
 
202
219
  补充说明:
@@ -760,6 +760,149 @@ function inspectDesignSupervisorReview(pencilDesignText) {
760
760
  };
761
761
  }
762
762
 
763
+ const DISCIPLINE_MARKER_NAMES = Object.freeze({
764
+ designApproval: "design_approval",
765
+ planSelfReview: "plan_self_review",
766
+ operatorReviewAck: "operator_review_ack"
767
+ });
768
+
769
+ const DISCIPLINE_MARKER_ALIASES = Object.freeze({
770
+ [DISCIPLINE_MARKER_NAMES.designApproval]: [
771
+ "design approval",
772
+ "design-approved",
773
+ "design approved",
774
+ "design_approval",
775
+ "design-approval"
776
+ ],
777
+ [DISCIPLINE_MARKER_NAMES.planSelfReview]: [
778
+ "plan self review",
779
+ "plan_self_review",
780
+ "plan-self-review",
781
+ "plan review",
782
+ "plan-review"
783
+ ],
784
+ [DISCIPLINE_MARKER_NAMES.operatorReviewAck]: [
785
+ "operator review ack",
786
+ "operator review acknowledgement",
787
+ "operator review acknowledgment",
788
+ "operator_ack",
789
+ "operator-review-ack",
790
+ "operator-review-acknowledgement",
791
+ "operator-review-acknowledgment"
792
+ ]
793
+ });
794
+
795
+ const DISCIPLINE_MARKER_KEYWORDS = Object.freeze(
796
+ Object.values(DISCIPLINE_MARKER_ALIASES)
797
+ .flat()
798
+ .map((token) => String(token).replace(/[_-]+/g, " ").toLowerCase())
799
+ );
800
+
801
+ function normalizeDisciplineMarkerName(value) {
802
+ const normalized = String(value || "")
803
+ .toLowerCase()
804
+ .replace(/[`*_~]/g, "")
805
+ .replace(/[_-]+/g, " ")
806
+ .replace(/\s+/g, " ")
807
+ .trim();
808
+ if (!normalized) {
809
+ return "";
810
+ }
811
+ for (const [canonicalName, aliases] of Object.entries(DISCIPLINE_MARKER_ALIASES)) {
812
+ if (aliases.some((alias) => normalized === String(alias).replace(/[_-]+/g, " ").toLowerCase())) {
813
+ return canonicalName;
814
+ }
815
+ }
816
+ return "";
817
+ }
818
+
819
+ function normalizeDisciplineMarkerStatus(value) {
820
+ return String(value || "")
821
+ .toUpperCase()
822
+ .replace(/[`*_~]/g, "")
823
+ .replace(/[()]/g, "")
824
+ .replace(/\s+/g, "_")
825
+ .replace(/[^A-Z0-9_]+/g, "_")
826
+ .replace(/^_+|_+$/g, "");
827
+ }
828
+
829
+ function parseDisciplineMarkers(markdownText) {
830
+ const markers = {};
831
+ const ordered = [];
832
+ const malformed = [];
833
+ const lines = String(markdownText || "").replace(/\r\n?/g, "\n").split("\n");
834
+ const markerPattern =
835
+ /^\s*-\s*`?([A-Za-z][A-Za-z0-9 _-]{1,80})`?\s*:\s*`?([A-Za-z0-9 _-]{1,80})`?(?:\s*@\s*`?([^`]+?)`?)?\s*$/;
836
+
837
+ for (let index = 0; index < lines.length; index += 1) {
838
+ const rawLine = lines[index];
839
+ const match = rawLine.match(markerPattern);
840
+ if (!match) {
841
+ const normalizedLine = String(rawLine || "")
842
+ .toLowerCase()
843
+ .replace(/[_-]+/g, " ")
844
+ .replace(/\s+/g, " ")
845
+ .trim();
846
+ if (!normalizedLine.startsWith("-")) {
847
+ continue;
848
+ }
849
+ if (DISCIPLINE_MARKER_KEYWORDS.some((keyword) => normalizedLine.includes(keyword))) {
850
+ malformed.push({
851
+ line: index + 1,
852
+ reason: "Malformed discipline marker syntax.",
853
+ raw: rawLine
854
+ });
855
+ }
856
+ continue;
857
+ }
858
+
859
+ const markerName = normalizeDisciplineMarkerName(match[1]);
860
+ if (!markerName) {
861
+ continue;
862
+ }
863
+
864
+ const status = normalizeDisciplineMarkerStatus(match[2]);
865
+ if (!status) {
866
+ malformed.push({
867
+ line: index + 1,
868
+ reason: "Missing marker status token.",
869
+ raw: rawLine
870
+ });
871
+ continue;
872
+ }
873
+
874
+ const rawTime = String(match[3] || "").trim();
875
+ let time = "";
876
+ if (rawTime) {
877
+ time = normalizeTimeToken(rawTime);
878
+ if (!time) {
879
+ malformed.push({
880
+ line: index + 1,
881
+ reason: "Invalid marker timestamp.",
882
+ raw: rawLine
883
+ });
884
+ }
885
+ }
886
+
887
+ const record = {
888
+ name: markerName,
889
+ status,
890
+ time,
891
+ rawTime,
892
+ line: index + 1,
893
+ raw: rawLine
894
+ };
895
+ ordered.push(record);
896
+ markers[markerName] = record;
897
+ }
898
+
899
+ return {
900
+ markers,
901
+ ordered,
902
+ malformed
903
+ };
904
+ }
905
+
763
906
  module.exports = {
764
907
  hasMarkdownHeading,
765
908
  getMarkdownSection,
@@ -775,5 +918,9 @@ module.exports = {
775
918
  getConfiguredDesignSupervisorReviewers,
776
919
  hasConfiguredDesignSupervisorReview,
777
920
  isDesignSupervisorReviewRequired,
778
- inspectDesignSupervisorReview
921
+ inspectDesignSupervisorReview,
922
+ DISCIPLINE_MARKER_NAMES,
923
+ normalizeDisciplineMarkerName,
924
+ normalizeDisciplineMarkerStatus,
925
+ parseDisciplineMarkers
779
926
  };