@xenonbyte/da-vinci-workflow 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.1.23 - 2026-03-29
4
+
5
+ ### Added
6
+ - `lib/audit-parsers.js` to isolate markdown/checkpoint/context-delta/design-supervisor parsing concerns from audit orchestration
7
+ - `lib/fs-safety.js` for bounded recursive traversal and project-root path-boundary checks
8
+ - `lib/icon-text.js` to share icon text normalization/tokenization across icon modules
9
+ - `scripts/test-audit-safety.js` to cover out-of-root registry paths and traversal truncation warnings
10
+ - `test:audit-safety` npm script
11
+
12
+ ### Changed
13
+ - `lib/audit.js` now uses bounded safe scans, emits traversal warnings, and rejects out-of-root registry `.pen` references
14
+ - `lib/install.js` now uses bounded safe traversal for asset enumeration
15
+ - `lib/pencil-preflight.js` now hardens VM execution with unsafe-source checks, disabled dynamic code generation, source-size limits, and explicit timeout classification
16
+ - `lib/icon-search.js` and `lib/icon-aliases.js` now consume shared text utilities instead of duplicate local implementations
17
+ - preflight/icon tests now include safety and normalization regression coverage
18
+
19
+ ## v0.1.22 - 2026-03-29
20
+
21
+ ### Added
22
+ - `da-vinci icon-sync` to fetch official icon-name catalogs for Material Symbols, Lucide, Feather, and Phosphor into a local cache
23
+ - `lib/icon-sync.js` and `scripts/test-icon-sync.js` for catalog sync, parsing, and offline validation coverage
24
+ - `lib/icon-aliases.js` and `scripts/test-icon-aliases.js` for project/business semantic alias expansion via `~/.da-vinci/icon-aliases.json`
25
+ - `references/icon-aliases.example.json` as a starter alias mapping template
26
+
27
+ ### Changed
28
+ - `da-vinci icon-search` now supports `--aliases <path>` and automatically expands query terms using alias mappings
29
+ - icon search now merges synced catalog entries with built-in fallback entries, preserving availability even when sync data is missing
30
+ - `da-vinci icon-sync` now reports explicit sync health (`OK` vs `DEGRADED`) and supports `--strict` for optional hard-gate behavior in CI
31
+ - `scripts/test-pen-persistence.js` now uses a local mock Pencil binary fixture to keep reopen-verification tests deterministic in sandboxed/no-network environments
32
+ - README, command-reference docs, workflow examples, and constraint-file docs (English and Chinese) now document the sync + search + alias icon workflow consistently
33
+ - `examples/greenfield-spec-markupflow/*` now include advisory icon-system guidance and icon-usage notes
34
+ - package version is aligned to `0.1.22`
35
+
3
36
  ## v0.1.21 - 2026-03-29
4
37
 
5
38
  ### Added
package/README.md CHANGED
@@ -28,10 +28,15 @@ This workflow is intended for:
28
28
 
29
29
  Latest published npm package:
30
30
 
31
- - `@xenonbyte/da-vinci-workflow@0.1.21`
31
+ - `@xenonbyte/da-vinci-workflow@0.1.23`
32
32
 
33
33
  Release highlights:
34
34
 
35
+ - audit parser logic is now split into `lib/audit-parsers.js`, reducing `lib/audit.js` size and making maintenance safer
36
+ - recursive file traversal now uses bounded safe scans with depth/count limits and symlink skipping
37
+ - completion/integrity audit now rejects out-of-root `.pen` references from `design-registry.md`
38
+ - `preflight-pencil` sandbox now blocks unsafe runtime tokens, disables dynamic code generation, and reports timeout failures explicitly
39
+ - icon text normalization/tokenization is now shared across `icon-search` and `icon-aliases`, removing duplicated logic and adding parity coverage
35
40
  - `da-vinci pencil-session end` now requires live snapshot input (`--nodes-file`) unless `--force` is used, preventing silent session close while live MCP and disk are out of sync
36
41
  - `build` route discipline now treats compile success as non-terminal and requires `da-vinci audit --mode completion --change <change-id> <project-path>` before reporting terminal completion
37
42
  - `continue` route guidance now blocks `build` recommendation whenever core design gates remain unresolved (missing project-local `.pen`, active session, runtime/design-source BLOCK, or required design-supervisor BLOCK)
@@ -446,6 +451,9 @@ da-vinci status
446
451
  da-vinci validate-assets
447
452
  da-vinci audit --mode integrity /abs/path/to/project
448
453
  da-vinci audit --mode completion --change <change-id> /abs/path/to/project
454
+ da-vinci icon-sync # tolerant by default; add --strict for hard gating
455
+ cp references/icon-aliases.example.json ~/.da-vinci/icon-aliases.json
456
+ da-vinci icon-search --query "settings lock" --family material --top 8
449
457
  da-vinci preflight-pencil --ops-file /abs/path/to/ops.txt
450
458
  da-vinci uninstall --platform codex,claude,gemini
451
459
  ```
@@ -476,6 +484,20 @@ Both modes check the most common workflow-integrity failures in a project:
476
484
  - flags common schema drift such as bad `padding`, invalid hex colors, `flex`, `margin`, and `overflow`
477
485
  - warns when anchor-surface batches are too large and should be split before retrying
478
486
 
487
+ `da-vinci icon-search` helps pick `icon_font` names before rendering:
488
+
489
+ - run `da-vinci icon-sync` first to fetch official icon names into `~/.da-vinci/icon-catalog.json`
490
+ - default catalog scope is user-level (under current HOME), so one sync is reusable across this user's projects
491
+ - run `da-vinci icon-sync` again when upstream icon libraries change or when you need newly added icons
492
+ - `icon-sync` is non-blocking on partial upstream failures by default (`Status: DEGRADED`); use `da-vinci icon-sync --strict` when CI must fail on any source error
493
+ - use `--catalog <path>` to keep an isolated project-level catalog when needed
494
+ - optionally create `~/.da-vinci/icon-aliases.json` (start from `references/icon-aliases.example.json`) for domain terms like `保险箱`, `解密`, `重试`
495
+ - supports mixed English/Chinese query terms
496
+ - supports family filtering (`material`, `rounded`, `outlined`, `sharp`, `lucide`, `feather`, `phosphor`)
497
+ - automatically expands query terms with alias mappings during ranking
498
+ - returns ranked candidates with ready-to-use `icon_font` node payload hints
499
+ - for a copy-ready `Icon System Guidance (Advisory)` template, see `docs/constraint-files.md` and `references/artifact-templates.md`
500
+
479
501
  When Pencil MCP is active, Da Vinci now also expects an MCP runtime gate record in `pencil-design.md` before terminal completion claims. That runtime gate checks live editor/source convergence separately from filesystem audit.
480
502
  During active redesign work, run `da-vinci audit --mode integrity <project-path>` immediately after the first successful Pencil write, then use `da-vinci preflight-pencil` plus smaller follow-up batches if the same anchor surface rolls back twice.
481
503
 
@@ -646,6 +668,7 @@ See:
646
668
  - includes `Simple redesign`, `Complex redesign`, `Design-only`, and `Continue` variants in each surface file
647
669
  - `docs/workflow-overview.md`
648
670
  - `docs/pencil-rendering-workflow.md`
671
+ - `docs/constraint-files.md`
649
672
  - `docs/codex-natural-language-usage.md`
650
673
  - `docs/visual-adapters.md`
651
674
  - `docs/visual-assist-presets/`
@@ -662,6 +685,7 @@ Chinese companion documents are included in this repository:
662
685
  - each surface file also includes `Simple redesign`, `Complex redesign`, `Design-only`, and `Continue`
663
686
  - `docs/zh-CN/workflow-overview.md`
664
687
  - `docs/zh-CN/pencil-rendering-workflow.md`
688
+ - `docs/zh-CN/constraint-files.md`
665
689
  - `docs/zh-CN/visual-adapters.md`
666
690
  - `docs/zh-CN/visual-assist-presets/`
667
691
  - `docs/zh-CN/`
package/README.zh-CN.md CHANGED
@@ -30,10 +30,15 @@ Da Vinci 是一个把产品需求一路推进到结构化规格、Pencil 设计
30
30
 
31
31
  最新已发布 npm 包:
32
32
 
33
- - `@xenonbyte/da-vinci-workflow@0.1.21`
33
+ - `@xenonbyte/da-vinci-workflow@0.1.23`
34
34
 
35
35
  已发布版本重点:
36
36
 
37
+ - audit 解析职责已拆分到 `lib/audit-parsers.js`,`lib/audit.js` 体量下降,可维护性更好
38
+ - 递归文件扫描改为安全有界遍历:增加深度/数量上限,并跳过符号链接
39
+ - completion/integrity audit 现在会拦截并忽略 `design-registry.md` 中越出项目根目录的 `.pen` 引用
40
+ - `preflight-pencil` 沙箱增强:拦截危险运行时 token、禁用动态代码生成,并对超时失败给出明确分类
41
+ - `icon-search` 与 `icon-aliases` 现在复用同一套文本归一化/分词逻辑,去掉重复实现并补了一致性回归测试
37
42
  - `da-vinci pencil-session end` 现在默认要求提供 live 快照输入(`--nodes-file`);只有显式 `--force` 才允许跳过,避免 live MCP 与磁盘未同步时被静默关闭
38
43
  - `build` 路由现在明确:编译成功不等于流程完成;对外宣布终态前必须通过 `da-vinci audit --mode completion --change <change-id> <project-path>`
39
44
  - `continue` 的推荐规则现在会拦截未过设计门禁时的 `build` 选路(缺少项目内 `.pen`、session 未关闭、runtime/design-source BLOCK、required design-supervisor BLOCK)
@@ -367,6 +372,9 @@ da-vinci status
367
372
  da-vinci validate-assets
368
373
  da-vinci audit --mode integrity /abs/path/to/project
369
374
  da-vinci audit --mode completion --change <change-id> /abs/path/to/project
375
+ da-vinci icon-sync # 默认容错;需要强门禁时加 --strict
376
+ cp references/icon-aliases.example.json ~/.da-vinci/icon-aliases.json
377
+ da-vinci icon-search --query "settings lock" --family material --top 8
370
378
  da-vinci preflight-pencil --ops-file /abs/path/to/ops.txt
371
379
  da-vinci uninstall --platform codex,claude,gemini
372
380
  ```
@@ -397,6 +405,20 @@ Context Delta 与 audit 的关系:
397
405
  - 直接标出常见 schema 漂移,比如错误 `padding`、非法 hex 颜色、`flex`、`margin`、`overflow`
398
406
  - 当 anchor-surface 批次太大时给出拆批警告,避免继续大块回滚
399
407
 
408
+ `da-vinci icon-search` 用于在渲染前选择更稳定的 `icon_font` 名称:
409
+
410
+ - 先运行 `da-vinci icon-sync`,把官方图标名同步到 `~/.da-vinci/icon-catalog.json`
411
+ - 默认是用户级缓存(当前 HOME 下),同一用户执行一次通常可被多个项目复用
412
+ - 当上游图标库有更新,或你需要最新新增图标时,建议重新执行 `da-vinci icon-sync`
413
+ - `icon-sync` 默认对上游部分失败不阻塞(会标记 `Status: DEGRADED`);如果 CI 需要任何源失败即退出,请使用 `da-vinci icon-sync --strict`
414
+ - 如果你要项目隔离,可用 `--catalog <path>` 指定项目级 catalog
415
+ - 可选创建 `~/.da-vinci/icon-aliases.json`(可从 `references/icon-aliases.example.json` 拷贝),用于 `保险箱`、`解密`、`重试` 这类业务词
416
+ - 支持中英文混合关键词检索
417
+ - 支持家族过滤(`material`、`rounded`、`outlined`、`sharp`、`lucide`、`feather`、`phosphor`)
418
+ - 检索排序会自动叠加别名扩展词
419
+ - 返回排序候选,并附带可直接复用的 `icon_font` 节点 payload 提示
420
+ - `Icon System Guidance (Advisory)` 可复制模板见 `docs/constraint-files.md` 与 `references/artifact-templates.md`
421
+
400
422
  当 Pencil MCP 可用时,Da Vinci 现在还要求在终态完成声明前,把 MCP runtime gate 结果记录到 `pencil-design.md`。这层 gate 负责检查 live editor/source convergence,与 filesystem audit 分工不同。
401
423
  在重设计进行中,如果有 shell 能力,应在第一次成功写入 Pencil 后立即运行 `da-vinci audit --mode integrity <project-path>`;如果同一个 anchor surface 连续回滚,则继续配合 `da-vinci preflight-pencil` 和更小的 follow-up batch。
402
424
 
@@ -551,6 +573,7 @@ Continue from proposal, migration-contract, and target specs into design or impl
551
573
  - 每个场景文件都包含 `Simple redesign`、`Complex redesign`、`Design-only`、`Continue`
552
574
  - `docs/workflow-overview.md`
553
575
  - `docs/pencil-rendering-workflow.md`
576
+ - `docs/constraint-files.md`
554
577
  - `docs/visual-adapters.md`
555
578
  - `docs/visual-assist-presets/`
556
579
  - `docs/workflow-examples.md`
@@ -565,6 +588,7 @@ Continue from proposal, migration-contract, and target specs into design or impl
565
588
  - 每个场景文件也都包含 `Simple redesign`、`Complex redesign`、`Design-only`、`Continue`
566
589
  - `docs/zh-CN/workflow-overview.md`
567
590
  - `docs/zh-CN/pencil-rendering-workflow.md`
591
+ - `docs/zh-CN/constraint-files.md`
568
592
  - `docs/zh-CN/visual-adapters.md`
569
593
  - `docs/zh-CN/visual-assist-presets/`
570
594
  - `docs/zh-CN/`
@@ -0,0 +1,109 @@
1
+ # Constraint Files
2
+
3
+ This document maps the workflow constraint files and clarifies which fields are machine-parsed gates versus advisory guidance.
4
+
5
+ Use this when you want one place to understand:
6
+
7
+ - where constraints live
8
+ - what can be customized freely
9
+ - what can block completion
10
+
11
+ ## Constraint File Map
12
+
13
+ - `DA-VINCI.md`: project-level visual and workflow contract
14
+ - `.da-vinci/design-registry.md`: preferred project-local `.pen` path and source ownership
15
+ - `.da-vinci/changes/<change-id>/design-brief.md`: form-factor profile, visual direction, and layout-hygiene focus
16
+ - `.da-vinci/changes/<change-id>/design.md`: design plan and composition decisions
17
+ - `.da-vinci/changes/<change-id>/pencil-design.md`: live design record, screenshot review notes, gate evidence
18
+ - `.da-vinci/changes/<change-id>/pencil-bindings.md`: implementation page to Pencil page mapping
19
+ - `.da-vinci/changes/<change-id>/tasks.md`: implementation task plan
20
+ - `.da-vinci/changes/<change-id>/verification.md`: verification and drift summary
21
+
22
+ ## Hard-Gate Fields (Machine Parsed)
23
+
24
+ The workflow audit currently parses specific fields. Keep these names stable.
25
+
26
+ ### `DA-VINCI.md` -> `## Visual Assist`
27
+
28
+ - `Preferred adapters`
29
+ - `Design-supervisor reviewers`
30
+ - `Design-supervisor review mode`
31
+ - `Design-supervisor review inputs`
32
+ - `Scope`
33
+ - `Fallback`
34
+ - `Require Adapter`
35
+ - `Require Supervisor Review`
36
+
37
+ `Require Supervisor Review: true` makes missing or blocked supervisor review a completion blocker.
38
+
39
+ ### `pencil-design.md` -> `## Design-Supervisor Review`
40
+
41
+ - `Status`
42
+ - `Issue list`
43
+ - `Revision outcome`
44
+
45
+ When supervisor review is required, missing or blocked review evidence blocks completion.
46
+
47
+ ## Advisory Constraint Sections (Customizable)
48
+
49
+ Any additional section can be used as project guidance. These sections are not hard-gated unless you add custom checks.
50
+
51
+ For icon guidance specifically, route-level workflow checks do not include a dedicated Pencil icon-lookup API. Use explicit `icon_font` constraints plus screenshot review, and rely on CLI helpers for icon discovery.
52
+ When shell access is available, run `da-vinci icon-sync` to fetch official icon names first, then use `da-vinci icon-search --query "<text>"` to resolve likely `iconFontFamily` + `iconFontName` pairs before writing `batch_design` operations. By default `icon-sync` is non-blocking on partial source failures (reports `Status: DEGRADED`); use `--strict` only when you intentionally want hard gating in CI.
53
+ For product-specific vocabulary, add `~/.da-vinci/icon-aliases.json` (example: `references/icon-aliases.example.json`) so terms like `保险箱`, `解密`, and `重试` expand into icon-friendly query tokens automatically.
54
+
55
+ Recommended example:
56
+
57
+ ```md
58
+ ## Icon System Guidance (Advisory)
59
+ - Goal: improve icon consistency and visual quality without blocking delivery.
60
+ - Source: functional icons should prefer `icon_font`.
61
+ - Allowed families: `Material Symbols Rounded`, `lucide`, `feather`, `phosphor`.
62
+ - Default family: `Material Symbols Rounded`.
63
+ - Default spec: `24x24`, `weight 700` (when supported), unified color token per surface.
64
+ - Reuse rule: prefer reusable `Icon/*` components, then `ref` reuse.
65
+ - Placeholder policy: avoid placeholder geometry for functional icons.
66
+ - Review requirement: each anchor screenshot review should include an `icon consistency` note.
67
+ - Checkpoint policy: icon inconsistency => `WARN` (not `BLOCK`), then fix in next visual pass.
68
+ ```
69
+
70
+ How to use this template in practice:
71
+
72
+ 1. Copy the section into project-root `DA-VINCI.md`.
73
+ 2. Keep it advisory first (`WARN`), and only convert to hard gate when explicit signoff requires it.
74
+ 3. Use `da-vinci icon-sync` as a periodic cache refresh (not every design pass).
75
+ 4. Run `da-vinci icon-search` when icon intent is ambiguous, icon quality drifts, or a new domain term appears.
76
+ 5. Record one `icon consistency` note per anchor screenshot review in `pencil-design.md`.
77
+
78
+ Field guidance:
79
+
80
+ - `Goal`: the expected icon-quality outcome for the project.
81
+ - `Source`: require `icon_font` for functional icons; avoid placeholder vectors for real actions.
82
+ - `Allowed families`: approved icon families for this project.
83
+ - `Default family`: preferred first choice to avoid mixed-family drift.
84
+ - `Default spec`: baseline size/weight/color-token policy.
85
+ - `Reuse rule`: whether icon components should be reusable before page-wide expansion.
86
+ - `Placeholder policy`: what is considered unacceptable placeholder behavior.
87
+ - `Review requirement`: what reviewers must explicitly check.
88
+ - `Checkpoint policy`: expected severity (`WARN` or `BLOCK`) and remediation expectation.
89
+
90
+ Minimal template (recommended default):
91
+
92
+ ```md
93
+ ## Icon System Guidance (Advisory)
94
+ - Goal: improve icon consistency and visual quality without blocking delivery.
95
+ - Source: functional icons should prefer `icon_font`.
96
+ - Allowed families: `Material Symbols Rounded`, `lucide`, `feather`, `phosphor`.
97
+ - Default family: `Material Symbols Rounded`.
98
+ - Default spec: `24x24`, `weight 700` (when supported), unified color token per surface.
99
+ - Reuse rule: prefer reusable `Icon/*` components, then `ref` reuse.
100
+ - Placeholder policy: avoid placeholder geometry for functional icons.
101
+ - Review requirement: each anchor screenshot review should include an `icon consistency` note.
102
+ - Checkpoint policy: icon inconsistency => `WARN` (not `BLOCK`), then fix in next visual pass.
103
+ ```
104
+
105
+ ## Recommended Defaults
106
+
107
+ - keep `Require Supervisor Review: false` unless reviewer signoff is a delivery requirement
108
+ - keep icon guidance advisory by default (`WARN`)
109
+ - raise icon issues to hard-gate only for explicit signoff workflows
@@ -33,6 +33,23 @@ Entry helpers:
33
33
 
34
34
  These helpers exist to select or resume the correct route. They are not substitutes for the main state machine.
35
35
 
36
+ ## Supporting CLI Utilities (Outside `dv:` Routes)
37
+
38
+ These commands do not replace route selection, but they support design execution quality:
39
+
40
+ - `da-vinci icon-sync`
41
+ - sync official icon names (Material Symbols, Lucide, Feather, Phosphor) into `~/.da-vinci/icon-catalog.json`
42
+ - default scope is user-level (current HOME), reusable across projects for the same user
43
+ - rerun when upstream icon libraries are updated or when you need newly added icons
44
+ - default behavior is non-blocking on partial source failures (`Status: DEGRADED`)
45
+ - use `--strict` only when CI should fail on any upstream source error
46
+ - use `--catalog <path>` for an isolated project-level catalog
47
+ - `da-vinci icon-search --query "<text>" [--family ...] [--top ...] [--aliases ...]`
48
+ - resolve likely `icon_font` names before writing Pencil `batch_design` operations
49
+ - supports mixed EN/ZH terms and optional alias expansion via `~/.da-vinci/icon-aliases.json`
50
+
51
+ Use these utilities during `/dv:design`, especially before anchor-surface icon finalization.
52
+
36
53
  ## Route Meanings
37
54
 
38
55
  ### `/dv:intake`
@@ -85,19 +85,20 @@ Expected flow:
85
85
  7. write the visual thesis, content plan, interaction thesis, and structural-delta notes for the anchor surfaces
86
86
  8. create new or updated Pencil pages from fresh composition rather than a recolor of the old UI, preferring persistence under `.da-vinci/designs/`
87
87
  9. preflight non-trivial `batch_design` operation strings before sending them to Pencil, and keep anchor-surface batches small
88
- 10. if the same anchor surface rolls back twice, switch to micro-batches of 6 or fewer operations until a clean schema-safe pass succeeds
89
- 11. 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
90
- 12. 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 ...`
91
- 13. verify the registered project-local `.pen` path becomes shell-visible immediately after the first successful Pencil write
92
- 14. run `da-vinci audit --mode integrity <project-path>` immediately after that first successful write
93
- 15. if Pencil MCP is active, run the MCP runtime gate and record it in `pencil-design.md`
94
- 16. run `design-source checkpoint` to confirm the registered project-local `.pen` path, the active Pencil source, and the shell-visible file all agree
95
- 17. export screenshots only under `.da-vinci/changes/<change-id>/exports/`, never into `.da-vinci/designs/`
96
- 18. record screenshot review with explicit `PASS` / `WARN` / `BLOCK`, issue list, and revision outcome before broad expansion
97
- 19. bind routes and pages to Pencil screens
98
- 20. generate tasks aligned to the redesign slices
99
- 21. run `da-vinci audit --mode completion --change <change-id> <project-path>` before any terminal completion claim
100
- 22. build and verify only after the completion gate can eventually pass
88
+ 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
+ 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
+ 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
102
 
102
103
  ### Complex Android example
103
104
 
@@ -191,6 +192,21 @@ If no registered project-local `.pen` exists yet, seed it there before the first
191
192
  If a registered project-local `.pen` already exists, reopen it for continuity but overwrite it from the current MCP snapshot after material live edits.
192
193
  ```
193
194
 
195
+ ## Icon-library helper example
196
+
197
+ Use:
198
+
199
+ ```text
200
+ da-vinci icon-sync
201
+ cp references/icon-aliases.example.json ~/.da-vinci/icon-aliases.json
202
+ da-vinci icon-search --query "保险箱 解密 重试" --family material --top 8
203
+ ```
204
+
205
+ Notes:
206
+
207
+ - use `icon-sync --strict` only in CI or explicit hard-gate workflows
208
+ - keep icon-family consistency per anchor surface unless there is a deliberate rationale
209
+
194
210
  ## Cross-mode rule
195
211
 
196
212
  In every mode:
@@ -12,6 +12,7 @@ Use it when you need the high-level delivery chain:
12
12
 
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
+ 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.
15
16
 
16
17
  ## Core Contract
17
18
 
@@ -115,6 +116,7 @@ Anchor surfaces must:
115
116
  - include structural-delta notes for redesign-from-code
116
117
  - stay aligned with the approved `migration-contract.md`, `page-map.md`, and new `specs/` when the active mode is `overhaul-from-code`
117
118
  - go through screenshot review
119
+ - resolve functional icon names with `da-vinci icon-sync` + `da-vinci icon-search` when shell access is available
118
120
  - satisfy the active form-factor layout-hygiene profile
119
121
  - pass the design checkpoint before broad expansion
120
122
  - run `design-supervisor review` when `DA-VINCI.md` configures `Design-supervisor reviewers`, and treat it as blocking only when `Require Supervisor Review: true`
@@ -0,0 +1,111 @@
1
+ # 约束文件说明
2
+
3
+ > 中文配套文档。若与英文原文存在差异,请以 `docs/constraint-files.md` 为准。
4
+
5
+ 这份文档用于统一说明 Da Vinci 的约束文件,以及哪些字段是机器硬门禁,哪些只是设计指导。
6
+
7
+ 适合在你需要确认下面问题时阅读:
8
+
9
+ - 约束写在哪些文件
10
+ - 哪些内容可以自由定制
11
+ - 哪些字段会阻断 completion
12
+
13
+ ## 约束文件地图
14
+
15
+ - `DA-VINCI.md`:项目级视觉与工作流契约
16
+ - `.da-vinci/design-registry.md`:项目内优先 `.pen` 路径与设计源归属
17
+ - `.da-vinci/changes/<change-id>/design-brief.md`:form-factor、视觉方向、layout-hygiene 重点
18
+ - `.da-vinci/changes/<change-id>/design.md`:设计计划与构图决策
19
+ - `.da-vinci/changes/<change-id>/pencil-design.md`:实时设计记录、截图评审、门禁证据
20
+ - `.da-vinci/changes/<change-id>/pencil-bindings.md`:实现页面到 Pencil 页面的绑定
21
+ - `.da-vinci/changes/<change-id>/tasks.md`:实现任务拆分
22
+ - `.da-vinci/changes/<change-id>/verification.md`:验证与漂移总结
23
+
24
+ ## 硬门禁字段(机器解析)
25
+
26
+ 当前审计会解析特定字段名。以下字段建议保持稳定。
27
+
28
+ ### `DA-VINCI.md` -> `## Visual Assist`
29
+
30
+ - `Preferred adapters`
31
+ - `Design-supervisor reviewers`
32
+ - `Design-supervisor review mode`
33
+ - `Design-supervisor review inputs`
34
+ - `Scope`
35
+ - `Fallback`
36
+ - `Require Adapter`
37
+ - `Require Supervisor Review`
38
+
39
+ 当 `Require Supervisor Review: true` 时,缺失或阻断的 supervisor review 会卡住 completion。
40
+
41
+ ### `pencil-design.md` -> `## Design-Supervisor Review`
42
+
43
+ - `Status`
44
+ - `Issue list`
45
+ - `Revision outcome`
46
+
47
+ 当 supervisor review 是必需时,缺失或 `BLOCK` 的评审证据会阻断 completion。
48
+
49
+ ## 指导型约束段(可定制)
50
+
51
+ 你可以增加任意自定义段作为项目指导。默认不会成为硬门禁,除非你额外实现自定义检查。
52
+
53
+ 图标指导当前也属于这个层级:`dv:` 路由本身没有独立的 Pencil 图标检索 API,通常通过显式 `icon_font` 约束 + 截图复核来收敛质量,再配合 CLI 图标检索能力。
54
+ 如果有 shell 能力,建议先运行 `da-vinci icon-sync` 同步官方图标名,再运行 `da-vinci icon-search --query "<关键词>"`,先收敛 `iconFontFamily` + `iconFontName`,再写入 `batch_design`。`icon-sync` 默认对上游部分失败不阻塞(会显示 `Status: DEGRADED`);只有在 CI 里确实需要强门禁时再加 `--strict`。
55
+ 如果有业务语义词,建议补充 `~/.da-vinci/icon-aliases.json`(可用 `references/icon-aliases.example.json` 作为起点),让 `保险箱`、`解密`、`重试` 这类词自动扩展成更稳定的图标检索词。
56
+
57
+ 推荐示例:
58
+
59
+ ```md
60
+ ## Icon System Guidance (Advisory)
61
+ - Goal: improve icon consistency and visual quality without blocking delivery.
62
+ - Source: functional icons should prefer `icon_font`.
63
+ - Allowed families: `Material Symbols Rounded`, `lucide`, `feather`, `phosphor`.
64
+ - Default family: `Material Symbols Rounded`.
65
+ - Default spec: `24x24`, `weight 700` (when supported), unified color token per surface.
66
+ - Reuse rule: prefer reusable `Icon/*` components, then `ref` reuse.
67
+ - Placeholder policy: avoid placeholder geometry for functional icons.
68
+ - Review requirement: each anchor screenshot review should include an `icon consistency` note.
69
+ - Checkpoint policy: icon inconsistency => `WARN` (not `BLOCK`), then fix in next visual pass.
70
+ ```
71
+
72
+ 落地使用建议:
73
+
74
+ 1. 把这一段直接复制到项目根目录 `DA-VINCI.md`。
75
+ 2. 默认先保持指导型(`WARN`),只有明确签收流程才升级成硬门禁。
76
+ 3. `da-vinci icon-sync` 作为周期性缓存刷新使用,不需要每次 design 都执行。
77
+ 4. 只有在图标语义不明确、图标质量漂移、或出现新业务词时,再执行 `da-vinci icon-search`。
78
+ 5. 每个 anchor 的截图评审在 `pencil-design.md` 里至少记录一条 `icon consistency` 结论。
79
+
80
+ 字段解释:
81
+
82
+ - `Goal`:本项目希望达到的图标质量目标。
83
+ - `Source`:功能图标的来源约束,通常要求优先 `icon_font`。
84
+ - `Allowed families`:项目允许的图标家族范围。
85
+ - `Default family`:默认首选家族,用于避免混用漂移。
86
+ - `Default spec`:默认尺寸、字重、颜色 token 规则。
87
+ - `Reuse rule`:是否要求先沉淀可复用 Icon 组件再扩屏。
88
+ - `Placeholder policy`:哪些占位图标行为不可接受。
89
+ - `Review requirement`:评审时必须显式检查什么。
90
+ - `Checkpoint policy`:问题严重度(`WARN` / `BLOCK`)和回改预期。
91
+
92
+ 最小模板(推荐默认):
93
+
94
+ ```md
95
+ ## Icon System Guidance (Advisory)
96
+ - Goal: improve icon consistency and visual quality without blocking delivery.
97
+ - Source: functional icons should prefer `icon_font`.
98
+ - Allowed families: `Material Symbols Rounded`, `lucide`, `feather`, `phosphor`.
99
+ - Default family: `Material Symbols Rounded`.
100
+ - Default spec: `24x24`, `weight 700` (when supported), unified color token per surface.
101
+ - Reuse rule: prefer reusable `Icon/*` components, then `ref` reuse.
102
+ - Placeholder policy: avoid placeholder geometry for functional icons.
103
+ - Review requirement: each anchor screenshot review should include an `icon consistency` note.
104
+ - Checkpoint policy: icon inconsistency => `WARN` (not `BLOCK`), then fix in next visual pass.
105
+ ```
106
+
107
+ ## 推荐默认值
108
+
109
+ - 除非确实需要 reviewer 签字,否则保持 `Require Supervisor Review: false`
110
+ - 默认把图标策略作为指导型约束(`WARN`)
111
+ - 只有在明确签收流程里,才把图标问题升级成硬门禁
@@ -35,6 +35,23 @@ Da Vinci 期望它们遵循工作流状态。
35
35
 
36
36
  这些辅助入口负责选路和续跑,不是主状态机本身。
37
37
 
38
+ ## 路由外的辅助 CLI 能力
39
+
40
+ 这些命令不会替代 `dv:` 选路,但能显著提升设计执行质量:
41
+
42
+ - `da-vinci icon-sync`
43
+ - 同步官方图标名(Material Symbols、Lucide、Feather、Phosphor)到 `~/.da-vinci/icon-catalog.json`
44
+ - 默认是用户级范围(当前 HOME),同一用户可跨项目复用
45
+ - 当上游图标库更新或需要最新新增图标时,应重新执行
46
+ - 默认对上游部分失败不阻塞(`Status: DEGRADED`)
47
+ - 只有在 CI 需要强门禁时才加 `--strict`
48
+ - 需要项目隔离时可用 `--catalog <path>` 指定项目级 catalog
49
+ - `da-vinci icon-search --query "<关键词>" [--family ...] [--top ...] [--aliases ...]`
50
+ - 在写 Pencil `batch_design` 前先收敛可用的 `icon_font` 名称
51
+ - 支持中英文混合词,并可通过 `~/.da-vinci/icon-aliases.json` 做语义扩展
52
+
53
+ 建议在 `/dv:design` 阶段使用,尤其是在 anchor surface 的图标定稿前。
54
+
38
55
  ## 每个路由的含义
39
56
 
40
57
  ### `/dv:intake`
@@ -96,19 +96,20 @@ $da-vinci use redesign-from-code to inventory the current app, identify current
96
96
  7. 先写出 anchor surface 的 visual thesis、content plan、interaction thesis 和 structural-delta 说明
97
97
  8. 创建新的或更新后的 Pencil 页面,基于重新构图而不是旧 UI 换皮,并优先持久化到 `.da-vinci/designs/`
98
98
  9. 在把 operations 发给 Pencil 前,先对非小型 `batch_design` 做 preflight,并保持 anchor-surface 批次足够小
99
- 10. 如果同一个 anchor surface 连续两次回滚,就切到每批不超过 6 个操作的微批次,直到拿到干净的 schema-safe pass
100
- 11. 如果这一轮开始时还没有登记的项目内 `.pen`,必须先执行 `da-vinci pencil-session begin --project <project-path> --pen <path>`,先 seed 登记路径并拿到全局锁,再开始第一次 Pencil 编辑
101
- 12. 如果项目里原本已有登记的 `.pen`,继续设计时也必须先通过 `da-vinci pencil-session begin --project <project-path> --pen <path>` reopen 它;发生了实质性 live edit 后,再通过 `da-vinci pencil-session persist` 把当前 MCP 快照重新覆盖写回同一路径
102
- 13. 在第一次成功写入 Pencil 后,立即验证登记的项目内 `.pen` 路径已经成为 shell 可见文件
103
- 14. 紧接着运行 `da-vinci audit --mode integrity <project-path>`
104
- 15. 如果 Pencil MCP 可用,先运行 MCP runtime gate,并把结果记录到 `pencil-design.md`
105
- 16. 运行 `design-source checkpoint`,确认登记的项目内 `.pen` 路径、当前 Pencil 设计源和 shell 可见文件是一致的
106
- 17. 截图导出只放到 `.da-vinci/changes/<change-id>/exports/`,绝不能写进 `.da-vinci/designs/`
107
- 18. broad expansion 前,先把 screenshot review 的 `PASS` / `WARN` / `BLOCK`、问题列表和回改结果记清楚
108
- 19. 绑定路由和 Pencil 页面
109
- 20. 生成和 redesign slice 对齐的任务
110
- 21. 在任何终态完成声明之前,先运行 `da-vinci audit --mode completion --change <change-id> <project-path>`
111
- 22. 只有在 completion gate 最终能通过时,才进入实现和验证
99
+ 10. 对功能性图标,先运行 `da-vinci icon-sync` 再运行 `da-vinci icon-search --query "<意图词>"`,先选定 `icon_font` 名称再写图标节点
100
+ 11. 如果同一个 anchor surface 连续两次回滚,就切到每批不超过 6 个操作的微批次,直到拿到干净的 schema-safe pass
101
+ 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
113
 
113
114
  ### 复杂 Android 页面示例
114
115
 
@@ -208,6 +209,21 @@ Persist project-local Pencil files under .da-vinci/designs/.
208
209
  如果项目里原本已有 `.pen`,继续设计后要把当前 MCP 快照覆盖写回同一路径。
209
210
  ```
210
211
 
212
+ ## 图标库辅助示例
213
+
214
+ 可执行示例:
215
+
216
+ ```text
217
+ da-vinci icon-sync
218
+ cp references/icon-aliases.example.json ~/.da-vinci/icon-aliases.json
219
+ da-vinci icon-search --query "保险箱 解密 重试" --family material --top 8
220
+ ```
221
+
222
+ 说明:
223
+
224
+ - 只有在 CI 或明确强门禁流程里,才建议使用 `icon-sync --strict`
225
+ - 单个 anchor surface 内尽量保持同一图标家族,除非有明确设计理由
226
+
211
227
  ## 复杂重设计的入口辅助示例
212
228
 
213
229
  如果用户起点是复杂的存量项目重设计,可以先这样:
@@ -14,6 +14,7 @@
14
14
 
15
15
  如果你想看 Pencil 渲染、持久化、门禁和审计的专门说明,请看 [pencil-rendering-workflow.md](/Users/xubo/x-skills/da-vinci/docs/zh-CN/pencil-rendering-workflow.md)。
16
16
  如果你想看逐个 `dv:` 命令的职责、下一步推荐和 `verify` 回退规则,请看 [dv-command-reference.md](/Users/xubo/x-skills/da-vinci/docs/zh-CN/dv-command-reference.md)。
17
+ 如果你想看约束文件总览(哪些字段是硬门禁、哪些是指导项),请看 [constraint-files.md](/Users/xubo/x-skills/da-vinci/docs/zh-CN/constraint-files.md)。
17
18
 
18
19
  ## 核心契约
19
20
 
@@ -117,6 +118,7 @@ Da Vinci 围绕一个固定契约工作:
117
118
  - 在 redesign-from-code 下写 structural-delta 说明
118
119
  - 如果当前 mode 是 `overhaul-from-code`,还要和已经批准的 `migration-contract.md`、`page-map.md`、新 `specs/` 保持一致
119
120
  - 经过 screenshot review
121
+ - 如果有 shell 能力,先用 `da-vinci icon-sync` + `da-vinci icon-search` 收敛功能性图标名称
120
122
  - 满足当前 form factor 的 layout-hygiene 规则
121
123
  - 通过 design checkpoint 才能扩屏
122
124
  - 如果 `DA-VINCI.md` 配置了 `Design-supervisor reviewers`,还要运行 `design-supervisor review`;只有 `Require Supervisor Review: true` 时,它才是阻断性的最终风格质量 gate
@@ -40,6 +40,15 @@
40
40
  - Fallback: native-da-vinci
41
41
  - Require Adapter: false
42
42
 
43
+ ## Icon System Guidance (Advisory)
44
+ - Goal: keep product-marketing icons coherent and functional
45
+ - Source: prefer `icon_font` for functional icons
46
+ - Allowed families: `Material Symbols Rounded`, `lucide`, `feather`, `phosphor`
47
+ - Default family: `Material Symbols Rounded`
48
+ - Default spec: `24x24`, `weight 700` (when supported)
49
+ - Reuse rule: define reusable icon instances before broad expansion
50
+ - Checkpoint policy: icon inconsistency is `WARN`, fix in next visual pass
51
+
43
52
  ## Do
44
53
  - keep page sections clearly bounded
45
54
  - use contrast panels to explain structured output
@@ -46,6 +46,13 @@ Visual adapter used for this forward test:
46
46
  - runtime declaration: explicit before first anchor pass
47
47
  - fallback: `native-da-vinci` if no local adapter were available
48
48
 
49
+ Icon library workflow used for this forward test:
50
+
51
+ - sync command: `da-vinci icon-sync`
52
+ - alias template: `cp references/icon-aliases.example.json ~/.da-vinci/icon-aliases.json`
53
+ - lookup command example: `da-vinci icon-search --query "settings publish workflow" --family material --top 6`
54
+ - gate policy: icon lookup remains advisory by default; use `--strict` only for explicit CI hard gates
55
+
49
56
  Important note:
50
57
 
51
58
  - the `.pen` source was authored in a live Pencil session and the example records `.da-vinci/designs/project-baseline.pen` as the intended project-local persisted path
@@ -41,6 +41,11 @@
41
41
  - keep the structural emphasis on three core capabilities on page one
42
42
  - keep the import, annotate, publish pipeline readable on page two
43
43
 
44
+ ## Icon Notes
45
+ - functional icons are expected to use `icon_font` instead of placeholder geometry
46
+ - preferred family for this pass: `Material Symbols Rounded`
47
+ - when icon intent is ambiguous, resolve candidates via `da-vinci icon-search` before writing `batch_design`
48
+
44
49
  ## Validation Notes
45
50
  - both screens were reviewed in Pencil during authoring
46
51
  - no obvious clipping, overlap, or alignment failures were observed in the design pass