@xenonbyte/da-vinci-workflow 0.1.23 → 0.1.24
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 +15 -0
- package/README.md +12 -1
- package/README.zh-CN.md +12 -1
- package/SKILL.md +2 -2
- package/bin/design-supervisor.js +39 -0
- package/commands/claude/dv/design.md +1 -1
- package/commands/codex/prompts/dv-design.md +1 -1
- package/commands/gemini/dv/design.toml +1 -1
- package/docs/constraint-files.md +4 -1
- package/docs/dv-command-reference.md +6 -0
- package/docs/zh-CN/constraint-files.md +4 -1
- package/docs/zh-CN/dv-command-reference.md +6 -0
- package/lib/audit-parsers.js +156 -10
- package/lib/audit.js +89 -3
- package/lib/cli.js +97 -0
- package/lib/supervisor-review.js +680 -0
- package/package.json +6 -3
- package/references/artifact-templates.md +2 -0
- package/scripts/test-audit-design-supervisor.js +189 -0
- package/scripts/test-supervisor-review-cli.js +619 -0
- package/scripts/test-supervisor-review-integration.js +115 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.1.24 - 2026-03-29
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- `da-vinci supervisor-review` now supports structured reviewer provenance fields: `Configured reviewers`, `Executed reviewers`, and `Review source`
|
|
7
|
+
- `design-supervisor` compatibility binary (`design-supervisor review`) that forwards to `da-vinci supervisor-review`
|
|
8
|
+
- `scripts/test-supervisor-review-cli.js` coverage for alias behavior, inferred mode, and skill-source reviewer execution metadata
|
|
9
|
+
- `scripts/test-supervisor-review-integration.js` optional real `codex exec` smoke test (`DA_VINCI_RUN_SUPERVISOR_INTEGRATION=1`)
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- supervisor-review audit parsing now accepts latest `## Design-Supervisor Review (Round X Attempt)` sections, multiline issue/outcome fields, and `Result` as a status alias
|
|
13
|
+
- completion audit now enforces skill-backed supervisor evidence (`Review source: skill` + executed configured reviewers) when `Require Supervisor Review: true`
|
|
14
|
+
- design prompts/skill docs now require configured reviewer skills to actually execute review before writing supervisor results
|
|
15
|
+
- command references and constraint docs (EN/ZH) now document structured reviewer fields and required skill-backed behavior for hard-gate projects
|
|
16
|
+
- `da-vinci supervisor-review --run-reviewers` now supports parallel execution (`--review-concurrency`) and resilient retries (`--review-retries`, `--review-retry-delay-ms`)
|
|
17
|
+
|
|
3
18
|
## v0.1.23 - 2026-03-29
|
|
4
19
|
|
|
5
20
|
### Added
|
package/README.md
CHANGED
|
@@ -28,10 +28,12 @@ This workflow is intended for:
|
|
|
28
28
|
|
|
29
29
|
Latest published npm package:
|
|
30
30
|
|
|
31
|
-
- `@xenonbyte/da-vinci-workflow@0.1.
|
|
31
|
+
- `@xenonbyte/da-vinci-workflow@0.1.24`
|
|
32
32
|
|
|
33
33
|
Release highlights:
|
|
34
34
|
|
|
35
|
+
- `da-vinci supervisor-review --run-reviewers` now supports configurable parallel reviewer execution and resilient retry backoff (`--review-concurrency`, `--review-retries`, `--review-retry-delay-ms`)
|
|
36
|
+
- added optional `test:supervisor-review-integration` smoke coverage for real `codex exec` review runner flows (enabled via `DA_VINCI_RUN_SUPERVISOR_INTEGRATION=1`)
|
|
35
37
|
- audit parser logic is now split into `lib/audit-parsers.js`, reducing `lib/audit.js` size and making maintenance safer
|
|
36
38
|
- recursive file traversal now uses bounded safe scans with depth/count limits and symlink skipping
|
|
37
39
|
- completion/integrity audit now rejects out-of-root `.pen` references from `design-registry.md`
|
|
@@ -454,6 +456,7 @@ da-vinci audit --mode completion --change <change-id> /abs/path/to/project
|
|
|
454
456
|
da-vinci icon-sync # tolerant by default; add --strict for hard gating
|
|
455
457
|
cp references/icon-aliases.example.json ~/.da-vinci/icon-aliases.json
|
|
456
458
|
da-vinci icon-search --query "settings lock" --family material --top 8
|
|
459
|
+
da-vinci supervisor-review --project /abs/path/to/project --change <change-id> --run-reviewers --write
|
|
457
460
|
da-vinci preflight-pencil --ops-file /abs/path/to/ops.txt
|
|
458
461
|
da-vinci uninstall --platform codex,claude,gemini
|
|
459
462
|
```
|
|
@@ -498,6 +501,14 @@ Both modes check the most common workflow-integrity failures in a project:
|
|
|
498
501
|
- returns ranked candidates with ready-to-use `icon_font` node payload hints
|
|
499
502
|
- for a copy-ready `Icon System Guidance (Advisory)` template, see `docs/constraint-files.md` and `references/artifact-templates.md`
|
|
500
503
|
|
|
504
|
+
`da-vinci supervisor-review` provides a local structured reviewer record:
|
|
505
|
+
|
|
506
|
+
- writes `Configured reviewers`, `Executed reviewers`, `Review source`, `Status`, `Issue list`, and `Revision outcome` into `pencil-design.md` when `--write` is provided
|
|
507
|
+
- accepts explicit status input (`--status PASS|WARN|BLOCK`) or can infer a conservative status from current design artifacts
|
|
508
|
+
- for required supervisor gates, prefer `--run-reviewers --write` so configured reviewer skills execute and the record is persisted in one step
|
|
509
|
+
- reviewer execution tuning is available via `--review-concurrency`, `--review-retries`, and `--review-retry-delay-ms` (exponential backoff)
|
|
510
|
+
- keeps `design-supervisor review` available as a compatibility alias
|
|
511
|
+
|
|
501
512
|
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.
|
|
502
513
|
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.
|
|
503
514
|
|
package/README.zh-CN.md
CHANGED
|
@@ -30,10 +30,12 @@ Da Vinci 是一个把产品需求一路推进到结构化规格、Pencil 设计
|
|
|
30
30
|
|
|
31
31
|
最新已发布 npm 包:
|
|
32
32
|
|
|
33
|
-
- `@xenonbyte/da-vinci-workflow@0.1.
|
|
33
|
+
- `@xenonbyte/da-vinci-workflow@0.1.24`
|
|
34
34
|
|
|
35
35
|
已发布版本重点:
|
|
36
36
|
|
|
37
|
+
- `da-vinci supervisor-review --run-reviewers` 现已支持 reviewer 并发执行与失败重试退避(`--review-concurrency`、`--review-retries`、`--review-retry-delay-ms`)
|
|
38
|
+
- 新增可选 `test:supervisor-review-integration` 烟测,用于覆盖真实 `codex exec` 评审执行链路(通过 `DA_VINCI_RUN_SUPERVISOR_INTEGRATION=1` 启用)
|
|
37
39
|
- audit 解析职责已拆分到 `lib/audit-parsers.js`,`lib/audit.js` 体量下降,可维护性更好
|
|
38
40
|
- 递归文件扫描改为安全有界遍历:增加深度/数量上限,并跳过符号链接
|
|
39
41
|
- completion/integrity audit 现在会拦截并忽略 `design-registry.md` 中越出项目根目录的 `.pen` 引用
|
|
@@ -375,6 +377,7 @@ da-vinci audit --mode completion --change <change-id> /abs/path/to/project
|
|
|
375
377
|
da-vinci icon-sync # 默认容错;需要强门禁时加 --strict
|
|
376
378
|
cp references/icon-aliases.example.json ~/.da-vinci/icon-aliases.json
|
|
377
379
|
da-vinci icon-search --query "settings lock" --family material --top 8
|
|
380
|
+
da-vinci supervisor-review --project /abs/path/to/project --change <change-id> --run-reviewers --write
|
|
378
381
|
da-vinci preflight-pencil --ops-file /abs/path/to/ops.txt
|
|
379
382
|
da-vinci uninstall --platform codex,claude,gemini
|
|
380
383
|
```
|
|
@@ -419,6 +422,14 @@ Context Delta 与 audit 的关系:
|
|
|
419
422
|
- 返回排序候选,并附带可直接复用的 `icon_font` 节点 payload 提示
|
|
420
423
|
- `Icon System Guidance (Advisory)` 可复制模板见 `docs/constraint-files.md` 与 `references/artifact-templates.md`
|
|
421
424
|
|
|
425
|
+
`da-vinci supervisor-review` 提供本地结构化评审记录能力:
|
|
426
|
+
|
|
427
|
+
- 加上 `--write` 时,会把 `Configured reviewers`、`Executed reviewers`、`Review source`、`Status`、`Issue list`、`Revision outcome` 写入 `pencil-design.md`
|
|
428
|
+
- 可通过 `--status PASS|WARN|BLOCK` 显式指定,也可基于当前设计工件做保守推断
|
|
429
|
+
- 对 required supervisor gate,优先使用 `--run-reviewers --write`,让 reviewer skills 执行与结果持久化一体完成
|
|
430
|
+
- reviewer 执行参数可通过 `--review-concurrency`、`--review-retries`、`--review-retry-delay-ms` 调优(指数退避)
|
|
431
|
+
- `design-supervisor review` 作为兼容别名仍可使用
|
|
432
|
+
|
|
422
433
|
当 Pencil MCP 可用时,Da Vinci 现在还要求在终态完成声明前,把 MCP runtime gate 结果记录到 `pencil-design.md`。这层 gate 负责检查 live editor/source convergence,与 filesystem audit 分工不同。
|
|
423
434
|
在重设计进行中,如果有 shell 能力,应在第一次成功写入 Pencil 后立即运行 `da-vinci audit --mode integrity <project-path>`;如果同一个 anchor surface 连续回滚,则继续配合 `da-vinci preflight-pencil` 和更小的 follow-up batch。
|
|
424
435
|
|
package/SKILL.md
CHANGED
|
@@ -280,9 +280,9 @@ During active Pencil work:
|
|
|
280
280
|
- exported screenshots are review artifacts only; place them under `.da-vinci/changes/<change-id>/exports/` and never treat them as a substitute for the project-local `.pen` source
|
|
281
281
|
- screenshot review is binding: if the review calls out hierarchy, spacing, clarity, inconsistency, or unresolved-placeholder issues, revise the screen before treating the checkpoint as `PASS`
|
|
282
282
|
- screenshot review must record an explicit `PASS`, `WARN`, or `BLOCK` plus the concrete issue list and revision outcome; phrases such as "looks good" do not count as review evidence
|
|
283
|
-
- if `DA-VINCI.md` declares `Design-supervisor reviewers`, run
|
|
283
|
+
- if `DA-VINCI.md` declares `Design-supervisor reviewers`, run an explicit review pass with those reviewer skills on the approved anchor set, then persist the structured result with `da-vinci supervisor-review --project <project-path> --change <change-id> --run-reviewers --write` (or the compatibility alias `design-supervisor review --run-reviewers --write`)
|
|
284
284
|
- keep `Design-supervisor reviewers` separate from `Preferred adapters`; adapters lead the design pass, reviewers judge whether the final style quality is strong enough to expand or implement
|
|
285
|
-
- when `design-supervisor review` is active, review screenshots together with Pencil theme variables, `visual-thesis.md`, `content-plan.md`, and `interaction-thesis.md
|
|
285
|
+
- when `design-supervisor review` is active, review screenshots together with Pencil theme variables, `visual-thesis.md`, `content-plan.md`, and `interaction-thesis.md`; record `Configured reviewers`, `Executed reviewers`, `Review source`, explicit `PASS`/`WARN`/`BLOCK`, issue list, and revision outcome in `pencil-design.md`
|
|
286
286
|
- if `DA-VINCI.md` sets `Require Supervisor Review: true`, treat missing, blocked, or unaccepted `design-supervisor review` as a blocker before broad expansion, implementation-task handoff, or terminal completion
|
|
287
287
|
|
|
288
288
|
## Load References On Demand
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { runCli } = require("../lib/cli");
|
|
4
|
+
|
|
5
|
+
function printHelp() {
|
|
6
|
+
console.log(
|
|
7
|
+
[
|
|
8
|
+
"Design Supervisor CLI (Da Vinci bridge)",
|
|
9
|
+
"",
|
|
10
|
+
"Usage:",
|
|
11
|
+
" design-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 <PASS|WARN|BLOCK>] [--issue-list <text>] [--revision-outcome <text>] [--write] [--json]",
|
|
12
|
+
"",
|
|
13
|
+
"Notes:",
|
|
14
|
+
" - This command is a compatibility alias for `da-vinci supervisor-review`.",
|
|
15
|
+
" - It does not replace completion gating; use `da-vinci audit --mode completion` for final gate checks."
|
|
16
|
+
].join("\n")
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function main() {
|
|
21
|
+
const args = process.argv.slice(2);
|
|
22
|
+
const [subcommand] = args;
|
|
23
|
+
|
|
24
|
+
if (!subcommand || subcommand === "--help" || subcommand === "-h" || subcommand === "help") {
|
|
25
|
+
printHelp();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (subcommand !== "review") {
|
|
30
|
+
throw new Error(`Unknown subcommand: ${subcommand}`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
await runCli(["supervisor-review", ...args.slice(1)]);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
main().catch((error) => {
|
|
37
|
+
console.error(error.message || String(error));
|
|
38
|
+
process.exit(1);
|
|
39
|
+
});
|
|
@@ -26,5 +26,5 @@ If a registered project-local `.pen` already exists, reopen it for continuity bu
|
|
|
26
26
|
After the first successful Pencil write, run `da-vinci audit --mode integrity <project-path>` before broad expansion continues.
|
|
27
27
|
If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
|
|
28
28
|
Screenshot review must record an explicit `PASS`, `WARN`, or `BLOCK` plus the issue list and revision outcome; "looks good" is not a valid review record.
|
|
29
|
-
If `DA-VINCI.md` declares `Design-supervisor reviewers`,
|
|
29
|
+
If `DA-VINCI.md` declares `Design-supervisor reviewers`, execute those reviewer skills on the approved anchor screenshots (do not skip to inferred review), then persist the structured result via `da-vinci supervisor-review --project <project-path> --change <change-id> --run-reviewers --write` (or the compatibility alias `design-supervisor review --run-reviewers --write`). Record configured/ executed reviewers, review source, status, issue list, and revision outcome in `pencil-design.md`. If `Require Supervisor Review: true`, treat missing, blocked, unaccepted, or non-skill-backed review results as blocking before broad expansion or terminal completion.
|
|
30
30
|
Before reporting `design complete` or `workflow complete`, run `da-vinci audit --mode completion --change <change-id> <project-path>` and treat any failure as blocking.
|
|
@@ -20,5 +20,5 @@ If a registered project-local `.pen` already exists, reopen it for continuity bu
|
|
|
20
20
|
After the first successful Pencil write, run `da-vinci audit --mode integrity <project-path>` before broad expansion continues.
|
|
21
21
|
If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
|
|
22
22
|
Screenshot review must record an explicit `PASS`, `WARN`, or `BLOCK` plus the issue list and revision outcome; "looks good" is not a valid review record.
|
|
23
|
-
If `DA-VINCI.md` declares `Design-supervisor reviewers`,
|
|
23
|
+
If `DA-VINCI.md` declares `Design-supervisor reviewers`, execute those reviewer skills on the approved anchor screenshots (do not skip to inferred review), then persist the structured result via `da-vinci supervisor-review --project <project-path> --change <change-id> --run-reviewers --write` (or the compatibility alias `design-supervisor review --run-reviewers --write`). Record configured/ executed reviewers, review source, status, issue list, and revision outcome in `pencil-design.md`. If `Require Supervisor Review: true`, treat missing, blocked, unaccepted, or non-skill-backed review results as blocking before broad expansion or terminal completion.
|
|
24
24
|
Before claiming `design complete` or `workflow complete`, run `da-vinci audit --mode completion --change <change-id> <project-path>` and treat any failure as blocking.
|
|
@@ -19,6 +19,6 @@ If a registered project-local `.pen` already exists, reopen it for continuity bu
|
|
|
19
19
|
After the first successful Pencil write, run `da-vinci audit --mode integrity <project-path>` before broad expansion continues.
|
|
20
20
|
If Pencil MCP is active, run the MCP runtime gate after the first successful Pencil write and record it in `pencil-design.md`.
|
|
21
21
|
Screenshot review must record an explicit `PASS`, `WARN`, or `BLOCK` plus the issue list and revision outcome; "looks good" is not a valid review record.
|
|
22
|
-
If `DA-VINCI.md` declares `Design-supervisor reviewers`,
|
|
22
|
+
If `DA-VINCI.md` declares `Design-supervisor reviewers`, execute those reviewer skills on the approved anchor screenshots (do not skip to inferred review), then persist the structured result via `da-vinci supervisor-review --project <project-path> --change <change-id> --run-reviewers --write` (or the compatibility alias `design-supervisor review --run-reviewers --write`). Record configured/ executed reviewers, review source, status, issue list, and revision outcome in `pencil-design.md`. If `Require Supervisor Review: true`, treat missing, blocked, unaccepted, or non-skill-backed review results as blocking before broad expansion or terminal completion.
|
|
23
23
|
Before reporting `design complete` or `workflow complete`, run `da-vinci audit --mode completion --change <change-id> <project-path>` and treat any failure as blocking.
|
|
24
24
|
"""
|
package/docs/constraint-files.md
CHANGED
|
@@ -38,11 +38,14 @@ The workflow audit currently parses specific fields. Keep these names stable.
|
|
|
38
38
|
|
|
39
39
|
### `pencil-design.md` -> `## Design-Supervisor Review`
|
|
40
40
|
|
|
41
|
+
- `Configured reviewers`
|
|
42
|
+
- `Executed reviewers`
|
|
43
|
+
- `Review source`
|
|
41
44
|
- `Status`
|
|
42
45
|
- `Issue list`
|
|
43
46
|
- `Revision outcome`
|
|
44
47
|
|
|
45
|
-
When supervisor review is required, missing or
|
|
48
|
+
When supervisor review is required, missing, blocked, unaccepted, or non-skill-backed review evidence blocks completion.
|
|
46
49
|
|
|
47
50
|
## Advisory Constraint Sections (Customizable)
|
|
48
51
|
|
|
@@ -47,6 +47,12 @@ These commands do not replace route selection, but they support design execution
|
|
|
47
47
|
- `da-vinci icon-search --query "<text>" [--family ...] [--top ...] [--aliases ...]`
|
|
48
48
|
- resolve likely `icon_font` names before writing Pencil `batch_design` operations
|
|
49
49
|
- supports mixed EN/ZH terms and optional alias expansion via `~/.da-vinci/icon-aliases.json`
|
|
50
|
+
- `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]`
|
|
51
|
+
- persists a structured supervisor-review record (`Configured reviewers`, `Executed reviewers`, `Review source`, `Status`, `Issue list`, `Revision outcome`) in `pencil-design.md`
|
|
52
|
+
- use `--run-reviewers --write` for one-step execution + record persistence through configured reviewer skills
|
|
53
|
+
- `--review-concurrency`, `--review-retries`, and `--review-retry-delay-ms` control parallelism and retry backoff for reviewer execution
|
|
54
|
+
- when `Require Supervisor Review: true`, inferred/manual records are completion-blocking
|
|
55
|
+
- `design-supervisor review` is kept as a compatibility alias that forwards to this command
|
|
50
56
|
|
|
51
57
|
Use these utilities during `/dv:design`, especially before anchor-surface icon finalization.
|
|
52
58
|
|
|
@@ -40,11 +40,14 @@
|
|
|
40
40
|
|
|
41
41
|
### `pencil-design.md` -> `## Design-Supervisor Review`
|
|
42
42
|
|
|
43
|
+
- `Configured reviewers`
|
|
44
|
+
- `Executed reviewers`
|
|
45
|
+
- `Review source`
|
|
43
46
|
- `Status`
|
|
44
47
|
- `Issue list`
|
|
45
48
|
- `Revision outcome`
|
|
46
49
|
|
|
47
|
-
当 supervisor review
|
|
50
|
+
当 supervisor review 是必需时,缺失、`BLOCK`、未接受、或非 skill-backed 的评审证据都会阻断 completion。
|
|
48
51
|
|
|
49
52
|
## 指导型约束段(可定制)
|
|
50
53
|
|
|
@@ -49,6 +49,12 @@ Da Vinci 期望它们遵循工作流状态。
|
|
|
49
49
|
- `da-vinci icon-search --query "<关键词>" [--family ...] [--top ...] [--aliases ...]`
|
|
50
50
|
- 在写 Pencil `batch_design` 前先收敛可用的 `icon_font` 名称
|
|
51
51
|
- 支持中英文混合词,并可通过 `~/.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]`
|
|
53
|
+
- 持久化结构化 supervisor review 记录(`Configured reviewers`、`Executed reviewers`、`Review source`、`Status`、`Issue list`、`Revision outcome`)到 `pencil-design.md`
|
|
54
|
+
- 推荐直接用 `--run-reviewers --write` 一步完成 reviewer skills 执行与记录落盘
|
|
55
|
+
- 通过 `--review-concurrency`、`--review-retries`、`--review-retry-delay-ms` 可调 reviewer 并发与重试退避
|
|
56
|
+
- 当 `Require Supervisor Review: true` 时,`manual/inferred` 记录会被 completion 阻断
|
|
57
|
+
- `design-supervisor review` 作为兼容别名保留,并会转发到该命令
|
|
52
58
|
|
|
53
59
|
建议在 `/dv:design` 阶段使用,尤其是在 anchor surface 的图标定稿前。
|
|
54
60
|
|
package/lib/audit-parsers.js
CHANGED
|
@@ -32,6 +32,133 @@ function getMarkdownSection(text, heading) {
|
|
|
32
32
|
return sectionLines.join("\n").trim();
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
function getMarkdownSectionsByHeading(text, heading, options = {}) {
|
|
36
|
+
if (!text) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const escapedHeading = escapeRegExp(heading);
|
|
41
|
+
const allowParentheticalSuffix = options.allowParentheticalSuffix === true;
|
|
42
|
+
const suffixPattern = allowParentheticalSuffix ? String.raw`(?:\s*\([^)\n]*\))?` : "";
|
|
43
|
+
const headingPattern = new RegExp(`^##\\s+${escapedHeading}${suffixPattern}\\s*$`, "i");
|
|
44
|
+
const anyHeadingPattern = /^##\s+/;
|
|
45
|
+
const lines = String(text).replace(/\r\n?/g, "\n").split("\n");
|
|
46
|
+
const sections = [];
|
|
47
|
+
let capturing = false;
|
|
48
|
+
let currentHeading = "";
|
|
49
|
+
let sectionLines = [];
|
|
50
|
+
|
|
51
|
+
function flushSection() {
|
|
52
|
+
if (!capturing) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
sections.push({
|
|
57
|
+
heading: currentHeading,
|
|
58
|
+
content: sectionLines.join("\n").trim()
|
|
59
|
+
});
|
|
60
|
+
capturing = false;
|
|
61
|
+
currentHeading = "";
|
|
62
|
+
sectionLines = [];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
for (const line of lines) {
|
|
66
|
+
if (capturing && anyHeadingPattern.test(line)) {
|
|
67
|
+
flushSection();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (!capturing && headingPattern.test(line)) {
|
|
71
|
+
capturing = true;
|
|
72
|
+
currentHeading = line.trim();
|
|
73
|
+
sectionLines = [];
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (capturing) {
|
|
78
|
+
sectionLines.push(line);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
flushSection();
|
|
83
|
+
return sections;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function extractReviewFieldValue(section, fieldNames) {
|
|
87
|
+
const lines = String(section || "").replace(/\r\n?/g, "\n").split("\n");
|
|
88
|
+
const escapedFieldNames = fieldNames.map((fieldName) => escapeRegExp(fieldName)).join("|");
|
|
89
|
+
const fieldPattern = new RegExp(`^\\s*-\\s*(?:${escapedFieldNames})\\s*:\\s*(.*)$`, "i");
|
|
90
|
+
const topLevelFieldPattern = /^\s*-\s+[^:\n]+:\s*.*$/;
|
|
91
|
+
const bulletPattern = /^\s*-\s+(.+)$/;
|
|
92
|
+
const nestedTextPattern = /^\s{2,}(.+)$/;
|
|
93
|
+
const values = [];
|
|
94
|
+
let capturing = false;
|
|
95
|
+
|
|
96
|
+
for (const rawLine of lines) {
|
|
97
|
+
if (/^##\s+/.test(rawLine)) {
|
|
98
|
+
if (capturing) {
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const fieldMatch = rawLine.match(fieldPattern);
|
|
105
|
+
if (!capturing && fieldMatch) {
|
|
106
|
+
capturing = true;
|
|
107
|
+
const inlineValue = String(fieldMatch[1] || "").trim();
|
|
108
|
+
if (inlineValue) {
|
|
109
|
+
values.push(inlineValue);
|
|
110
|
+
}
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (!capturing) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (topLevelFieldPattern.test(rawLine)) {
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const bulletMatch = rawLine.match(bulletPattern);
|
|
123
|
+
if (bulletMatch) {
|
|
124
|
+
const value = String(bulletMatch[1] || "").trim();
|
|
125
|
+
if (value) {
|
|
126
|
+
values.push(value);
|
|
127
|
+
}
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const nestedTextMatch = rawLine.match(nestedTextPattern);
|
|
132
|
+
if (nestedTextMatch) {
|
|
133
|
+
const value = String(nestedTextMatch[1] || "").trim();
|
|
134
|
+
if (value) {
|
|
135
|
+
values.push(value);
|
|
136
|
+
}
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (rawLine.trim() === "") {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return values.join("\n").trim();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function parseListTokens(value) {
|
|
151
|
+
return String(value || "")
|
|
152
|
+
.split(/[,\n;]/)
|
|
153
|
+
.map((token) =>
|
|
154
|
+
token
|
|
155
|
+
.replace(/^[\-\*\u2022]\s*/, "")
|
|
156
|
+
.replace(/`/g, "")
|
|
157
|
+
.trim()
|
|
158
|
+
)
|
|
159
|
+
.filter(Boolean);
|
|
160
|
+
}
|
|
161
|
+
|
|
35
162
|
function normalizeCheckpointLabel(value) {
|
|
36
163
|
return String(value || "")
|
|
37
164
|
.toLowerCase()
|
|
@@ -398,6 +525,12 @@ function hasConfiguredDesignSupervisorReview(daVinciText) {
|
|
|
398
525
|
return getVisualAssistFieldValues(daVinciText, "Design-supervisor reviewers").length > 0;
|
|
399
526
|
}
|
|
400
527
|
|
|
528
|
+
function getConfiguredDesignSupervisorReviewers(daVinciText) {
|
|
529
|
+
return getVisualAssistFieldValues(daVinciText, "Design-supervisor reviewers")
|
|
530
|
+
.flatMap((value) => parseListTokens(value))
|
|
531
|
+
.filter(Boolean);
|
|
532
|
+
}
|
|
533
|
+
|
|
401
534
|
function isDesignSupervisorReviewRequired(daVinciText) {
|
|
402
535
|
return getVisualAssistFieldValues(daVinciText, "Require Supervisor Review").some((value) =>
|
|
403
536
|
/^true$/i.test(String(value).trim())
|
|
@@ -405,8 +538,10 @@ function isDesignSupervisorReviewRequired(daVinciText) {
|
|
|
405
538
|
}
|
|
406
539
|
|
|
407
540
|
function inspectDesignSupervisorReview(pencilDesignText) {
|
|
408
|
-
const
|
|
409
|
-
|
|
541
|
+
const sections = getMarkdownSectionsByHeading(pencilDesignText, "Design-Supervisor Review", {
|
|
542
|
+
allowParentheticalSuffix: true
|
|
543
|
+
});
|
|
544
|
+
if (sections.length === 0) {
|
|
410
545
|
return {
|
|
411
546
|
found: false,
|
|
412
547
|
status: null,
|
|
@@ -416,25 +551,35 @@ function inspectDesignSupervisorReview(pencilDesignText) {
|
|
|
416
551
|
};
|
|
417
552
|
}
|
|
418
553
|
|
|
419
|
-
const
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
const revisionOutcomeMatch = section.match(
|
|
423
|
-
/(?:^|\n)\s*-\s*(?:Revision outcome|修订结果)\s*:\s*(.+)$/im
|
|
554
|
+
const section = sections[sections.length - 1].content;
|
|
555
|
+
const statusMatch = section.match(
|
|
556
|
+
/(?:^|\n)\s*-\s*(?:Status|状态|Result|结果)\s*:\s*`?(PASS|WARN|BLOCK)`?\b/i
|
|
424
557
|
);
|
|
425
|
-
const
|
|
558
|
+
const status = statusMatch ? statusMatch[1].toUpperCase() : null;
|
|
559
|
+
const issueList = extractReviewFieldValue(section, ["Issue list", "问题列表"]);
|
|
560
|
+
const revisionOutcome = extractReviewFieldValue(section, ["Revision outcome", "修订结果"]);
|
|
561
|
+
const configuredReviewersRaw = extractReviewFieldValue(section, ["Configured reviewers", "配置评审"]);
|
|
562
|
+
const executedReviewersRaw = extractReviewFieldValue(section, ["Executed reviewers", "Executed reviewer skills", "执行评审"]);
|
|
563
|
+
const reviewSource = extractReviewFieldValue(section, ["Review source", "评审来源"]).toLowerCase();
|
|
426
564
|
const acceptedWarn =
|
|
427
565
|
status === "WARN" &&
|
|
428
566
|
/(accepted|accepted with follow-up|accepted warning|warn accepted|接受|已接受|接受警告)/i.test(
|
|
429
567
|
revisionOutcome
|
|
430
568
|
);
|
|
569
|
+
const configuredReviewers = parseListTokens(configuredReviewersRaw);
|
|
570
|
+
const executedReviewers = parseListTokens(executedReviewersRaw);
|
|
431
571
|
|
|
432
572
|
return {
|
|
433
573
|
found: true,
|
|
434
574
|
status,
|
|
435
575
|
acceptedWarn,
|
|
436
|
-
hasIssueList: Boolean(
|
|
437
|
-
hasRevisionOutcome: Boolean(revisionOutcome)
|
|
576
|
+
hasIssueList: Boolean(issueList),
|
|
577
|
+
hasRevisionOutcome: Boolean(revisionOutcome),
|
|
578
|
+
configuredReviewers,
|
|
579
|
+
executedReviewers,
|
|
580
|
+
reviewSource,
|
|
581
|
+
hasConfiguredReviewers: configuredReviewers.length > 0,
|
|
582
|
+
hasExecutedReviewers: executedReviewers.length > 0
|
|
438
583
|
};
|
|
439
584
|
}
|
|
440
585
|
|
|
@@ -446,6 +591,7 @@ module.exports = {
|
|
|
446
591
|
buildContextDeltaReferenceIndex,
|
|
447
592
|
resolveSupersedesReferenceIndices,
|
|
448
593
|
inspectContextDelta,
|
|
594
|
+
getConfiguredDesignSupervisorReviewers,
|
|
449
595
|
hasConfiguredDesignSupervisorReview,
|
|
450
596
|
isDesignSupervisorReviewRequired,
|
|
451
597
|
inspectDesignSupervisorReview
|
package/lib/audit.js
CHANGED
|
@@ -11,6 +11,7 @@ const {
|
|
|
11
11
|
buildContextDeltaReferenceIndex,
|
|
12
12
|
resolveSupersedesReferenceIndices,
|
|
13
13
|
inspectContextDelta,
|
|
14
|
+
getConfiguredDesignSupervisorReviewers,
|
|
14
15
|
hasConfiguredDesignSupervisorReview,
|
|
15
16
|
isDesignSupervisorReviewRequired,
|
|
16
17
|
inspectDesignSupervisorReview
|
|
@@ -195,6 +196,10 @@ function appendTraversalWarnings(projectRoot, rootDir, scan, warnings) {
|
|
|
195
196
|
}
|
|
196
197
|
}
|
|
197
198
|
|
|
199
|
+
function normalizeReviewerToken(value) {
|
|
200
|
+
return String(value || "").trim().toLowerCase();
|
|
201
|
+
}
|
|
202
|
+
|
|
198
203
|
function auditProject(projectPathInput, options = {}) {
|
|
199
204
|
const projectRoot = path.resolve(projectPathInput || process.cwd());
|
|
200
205
|
const mode = options.mode || "integrity";
|
|
@@ -204,6 +209,8 @@ function auditProject(projectPathInput, options = {}) {
|
|
|
204
209
|
const designRegistryPath = path.join(daVinciDir, "design-registry.md");
|
|
205
210
|
const pencilSessionPath = getSessionStatePath(projectRoot);
|
|
206
211
|
const daVinciText = readTextIfExists(path.join(projectRoot, "DA-VINCI.md"));
|
|
212
|
+
const configuredSupervisorReviewers = getConfiguredDesignSupervisorReviewers(daVinciText);
|
|
213
|
+
const configuredReviewerSet = new Set(configuredSupervisorReviewers.map((value) => normalizeReviewerToken(value)));
|
|
207
214
|
const designSupervisorConfigured = hasConfiguredDesignSupervisorReview(daVinciText);
|
|
208
215
|
const designSupervisorRequired = isDesignSupervisorReviewRequired(daVinciText);
|
|
209
216
|
|
|
@@ -467,6 +474,8 @@ function auditProject(projectPathInput, options = {}) {
|
|
|
467
474
|
const enforceAsFailure =
|
|
468
475
|
mode === "completion" && scopedChangeDirs.includes(changeDir) && designSupervisorRequired;
|
|
469
476
|
|
|
477
|
+
let reviewRecordValid = true;
|
|
478
|
+
|
|
470
479
|
if (!review.found) {
|
|
471
480
|
const message =
|
|
472
481
|
`DA-VINCI.md configures Design-supervisor reviewers, but ${relativeTo(projectRoot, pencilDesignPath)} ` +
|
|
@@ -476,6 +485,7 @@ function auditProject(projectPathInput, options = {}) {
|
|
|
476
485
|
} else {
|
|
477
486
|
warnings.push(message);
|
|
478
487
|
}
|
|
488
|
+
reviewRecordValid = false;
|
|
479
489
|
} else if (!review.status) {
|
|
480
490
|
const message =
|
|
481
491
|
`Design-supervisor review is recorded in ${relativeTo(projectRoot, pencilDesignPath)} ` +
|
|
@@ -485,6 +495,7 @@ function auditProject(projectPathInput, options = {}) {
|
|
|
485
495
|
} else {
|
|
486
496
|
warnings.push(message);
|
|
487
497
|
}
|
|
498
|
+
reviewRecordValid = false;
|
|
488
499
|
} else if (!review.hasIssueList || !review.hasRevisionOutcome) {
|
|
489
500
|
const missingFields = [
|
|
490
501
|
!review.hasIssueList ? "Issue list" : null,
|
|
@@ -500,7 +511,82 @@ function auditProject(projectPathInput, options = {}) {
|
|
|
500
511
|
} else {
|
|
501
512
|
warnings.push(message);
|
|
502
513
|
}
|
|
503
|
-
|
|
514
|
+
reviewRecordValid = false;
|
|
515
|
+
} else if (!review.hasConfiguredReviewers) {
|
|
516
|
+
const message =
|
|
517
|
+
`Design-supervisor review in ${relativeTo(projectRoot, pencilDesignPath)} ` +
|
|
518
|
+
"is missing required field(s): Configured reviewers.";
|
|
519
|
+
if (enforceAsFailure) {
|
|
520
|
+
failures.push(message);
|
|
521
|
+
} else {
|
|
522
|
+
warnings.push(message);
|
|
523
|
+
}
|
|
524
|
+
reviewRecordValid = false;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
if (reviewRecordValid && configuredReviewerSet.size > 0) {
|
|
528
|
+
const reviewConfiguredSet = new Set(
|
|
529
|
+
review.configuredReviewers.map((value) => normalizeReviewerToken(value))
|
|
530
|
+
);
|
|
531
|
+
const missingConfiguredReviewers = configuredSupervisorReviewers.filter(
|
|
532
|
+
(reviewer) => !reviewConfiguredSet.has(normalizeReviewerToken(reviewer))
|
|
533
|
+
);
|
|
534
|
+
if (missingConfiguredReviewers.length > 0) {
|
|
535
|
+
const message =
|
|
536
|
+
`Design-supervisor review in ${relativeTo(projectRoot, pencilDesignPath)} ` +
|
|
537
|
+
`does not list configured reviewer(s): ${missingConfiguredReviewers.join(", ")}.`;
|
|
538
|
+
if (enforceAsFailure) {
|
|
539
|
+
failures.push(message);
|
|
540
|
+
} else {
|
|
541
|
+
warnings.push(message);
|
|
542
|
+
}
|
|
543
|
+
reviewRecordValid = false;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
if (reviewRecordValid) {
|
|
548
|
+
if (designSupervisorRequired && review.reviewSource !== "skill") {
|
|
549
|
+
const message =
|
|
550
|
+
`Design-supervisor review in ${relativeTo(projectRoot, pencilDesignPath)} ` +
|
|
551
|
+
"must be skill-backed (`Review source: skill`) when `Require Supervisor Review: true`.";
|
|
552
|
+
if (enforceAsFailure) {
|
|
553
|
+
failures.push(message);
|
|
554
|
+
} else {
|
|
555
|
+
warnings.push(message);
|
|
556
|
+
}
|
|
557
|
+
reviewRecordValid = false;
|
|
558
|
+
} else if (designSupervisorRequired && !review.hasExecutedReviewers) {
|
|
559
|
+
const message =
|
|
560
|
+
`Design-supervisor review in ${relativeTo(projectRoot, pencilDesignPath)} ` +
|
|
561
|
+
"is missing required field(s): Executed reviewers.";
|
|
562
|
+
if (enforceAsFailure) {
|
|
563
|
+
failures.push(message);
|
|
564
|
+
} else {
|
|
565
|
+
warnings.push(message);
|
|
566
|
+
}
|
|
567
|
+
reviewRecordValid = false;
|
|
568
|
+
} else if (designSupervisorRequired && configuredReviewerSet.size > 0) {
|
|
569
|
+
const executedReviewerSet = new Set(
|
|
570
|
+
review.executedReviewers.map((value) => normalizeReviewerToken(value))
|
|
571
|
+
);
|
|
572
|
+
const missingExecuted = configuredSupervisorReviewers.filter(
|
|
573
|
+
(reviewer) => !executedReviewerSet.has(normalizeReviewerToken(reviewer))
|
|
574
|
+
);
|
|
575
|
+
if (missingExecuted.length > 0) {
|
|
576
|
+
const message =
|
|
577
|
+
`Design-supervisor review in ${relativeTo(projectRoot, pencilDesignPath)} ` +
|
|
578
|
+
`did not execute configured reviewer skill(s): ${missingExecuted.join(", ")}.`;
|
|
579
|
+
if (enforceAsFailure) {
|
|
580
|
+
failures.push(message);
|
|
581
|
+
} else {
|
|
582
|
+
warnings.push(message);
|
|
583
|
+
}
|
|
584
|
+
reviewRecordValid = false;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
if (reviewRecordValid && review.status === "BLOCK") {
|
|
504
590
|
const message =
|
|
505
591
|
`Design-supervisor review is still BLOCK in ${relativeTo(projectRoot, pencilDesignPath)}.`;
|
|
506
592
|
if (enforceAsFailure) {
|
|
@@ -508,7 +594,7 @@ function auditProject(projectPathInput, options = {}) {
|
|
|
508
594
|
} else {
|
|
509
595
|
warnings.push(message);
|
|
510
596
|
}
|
|
511
|
-
} else if (review.status === "WARN" && !review.acceptedWarn) {
|
|
597
|
+
} else if (reviewRecordValid && review.status === "WARN" && !review.acceptedWarn) {
|
|
512
598
|
const message =
|
|
513
599
|
`Design-supervisor review is WARN in ${relativeTo(projectRoot, pencilDesignPath)} ` +
|
|
514
600
|
"but the warning was not explicitly accepted.";
|
|
@@ -517,7 +603,7 @@ function auditProject(projectPathInput, options = {}) {
|
|
|
517
603
|
} else {
|
|
518
604
|
warnings.push(message);
|
|
519
605
|
}
|
|
520
|
-
} else {
|
|
606
|
+
} else if (reviewRecordValid) {
|
|
521
607
|
notes.push(
|
|
522
608
|
`Detected design-supervisor review status ${review.status} in ${relativeTo(projectRoot, pencilDesignPath)}.`
|
|
523
609
|
);
|