@openprd/cli 0.1.10 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.openprd/benchmarks/index.md +17 -15
- package/.openprd/benchmarks/sources.yaml +53 -1
- package/.openprd/changes/adaptive-project-framing/.openprd.yaml +2 -0
- package/.openprd/changes/adaptive-project-framing/design.md +47 -0
- package/.openprd/changes/adaptive-project-framing/proposal.md +35 -0
- package/.openprd/changes/adaptive-project-framing/specs/agent-requirements/spec.md +16 -0
- package/.openprd/changes/adaptive-project-framing/task-events.jsonl +20 -0
- package/.openprd/changes/adaptive-project-framing/tasks.md +340 -0
- package/.openprd/changes/docs-anti-pollution-and-design-direction-review/.openprd.yaml +2 -0
- package/.openprd/changes/docs-anti-pollution-and-design-direction-review/design.md +34 -0
- package/.openprd/changes/docs-anti-pollution-and-design-direction-review/proposal.md +23 -0
- package/.openprd/changes/docs-anti-pollution-and-design-direction-review/specs/agent-requirements/spec.md +16 -0
- package/.openprd/changes/docs-anti-pollution-and-design-direction-review/task-events.jsonl +14 -0
- package/.openprd/changes/docs-anti-pollution-and-design-direction-review/tasks.md +238 -0
- package/.openprd/changes/loop-isolated-worktree-commit/.openprd.yaml +2 -0
- package/.openprd/changes/loop-isolated-worktree-commit/design.md +53 -0
- package/.openprd/changes/loop-isolated-worktree-commit/proposal.md +38 -0
- package/.openprd/changes/loop-isolated-worktree-commit/specs/agent-requirements/spec.md +16 -0
- package/.openprd/changes/loop-isolated-worktree-commit/task-events.jsonl +22 -0
- package/.openprd/changes/loop-isolated-worktree-commit/tasks.md +357 -0
- package/.openprd/changes/openprd/.openprd.yaml +2 -0
- package/.openprd/changes/openprd/design.md +46 -0
- package/.openprd/changes/openprd/proposal.md +36 -0
- package/.openprd/changes/openprd/specs/agent-requirements/spec.md +16 -0
- package/.openprd/changes/openprd/task-events.jsonl +23 -0
- package/.openprd/changes/openprd/tasks.md +242 -0
- package/.openprd/changes/pm-human-in-the-loop/.openprd.yaml +2 -0
- package/.openprd/changes/pm-human-in-the-loop/design.md +38 -0
- package/.openprd/changes/pm-human-in-the-loop/proposal.md +29 -0
- package/.openprd/changes/pm-human-in-the-loop/specs/agent-requirements/spec.md +16 -0
- package/.openprd/changes/pm-human-in-the-loop/task-events.jsonl +18 -0
- package/.openprd/changes/pm-human-in-the-loop/tasks.md +306 -0
- package/.openprd/changes/test-strategy-router/.openprd.yaml +2 -0
- package/.openprd/changes/test-strategy-router/design.md +65 -0
- package/.openprd/changes/test-strategy-router/proposal.md +45 -0
- package/.openprd/changes/test-strategy-router/specs/agent-requirements/spec.md +16 -0
- package/.openprd/changes/test-strategy-router/task-events.jsonl +1 -0
- package/.openprd/changes/test-strategy-router/tasks.md +132 -0
- package/.openprd/changes/verify-boundaries-and-historical-refresh/.openprd.yaml +2 -0
- package/.openprd/changes/verify-boundaries-and-historical-refresh/design.md +28 -0
- package/.openprd/changes/verify-boundaries-and-historical-refresh/proposal.md +23 -0
- package/.openprd/changes/verify-boundaries-and-historical-refresh/specs/agent-requirements/spec.md +16 -0
- package/.openprd/changes/verify-boundaries-and-historical-refresh/task-events.jsonl +11 -0
- package/.openprd/changes/verify-boundaries-and-historical-refresh/tasks.md +66 -0
- package/.openprd/changes/vibe-coding-dev-check/.openprd.yaml +2 -0
- package/.openprd/changes/vibe-coding-dev-check/design.md +37 -0
- package/.openprd/changes/vibe-coding-dev-check/proposal.md +28 -0
- package/.openprd/changes/vibe-coding-dev-check/specs/agent-requirements/spec.md +16 -0
- package/.openprd/changes/vibe-coding-dev-check/task-events.jsonl +18 -0
- package/.openprd/changes/vibe-coding-dev-check/tasks.md +306 -0
- package/.openprd/design/README.md +11 -6
- package/.openprd/design/README_EN.md +4 -1
- package/.openprd/design/active/asset-spec.md +6 -0
- package/.openprd/design/active/direction-plan.md +5 -5
- package/.openprd/design/active/selected-direction.md +2 -0
- package/.openprd/design/anti-slop.md +26 -1
- package/.openprd/design/assets/surface-presets.md +6 -0
- package/.openprd/design/checklists/ui-quality-gate.md +7 -0
- package/.openprd/design/lenses/frontend-lenses.md +28 -0
- package/.openprd/design/recipes/content-experience.md +8 -1
- package/.openprd/design/recipes/operational-tool.md +7 -0
- package/.openprd/design/recipes/product-launch.md +8 -1
- package/.openprd/design/templates/README.md +6 -3
- package/.openprd/design/templates/README_EN.md +6 -3
- package/.openprd/design/templates/ops-dashboard.html +8 -1
- package/.openprd/design/templates/product-launch.html +2 -1
- package/.openprd/design/themes/theme-catalog.json +23 -5
- package/.openprd/engagements/active/prd.md +103 -100
- package/.openprd/schema/prd.schema.yaml +15 -0
- package/.openprd/standards/config.json +7 -1
- package/.openprd/templates/base/intake.md +13 -0
- package/.openprd/templates/base/prd.md +15 -0
- package/AGENTS.md +14 -4
- package/README.md +107 -14
- package/README_EN.md +131 -13
- package/package.json +1 -1
- package/scripts/dev-check-wrapup-copy.mjs +46 -21
- package/skills/openprd-benchmark-router/SKILL.md +2 -1
- package/skills/openprd-diagram-review/SKILL.md +27 -2
- package/skills/openprd-diagram-review/references/explanation-svg-patterns.md +131 -0
- package/skills/openprd-discovery-loop/SKILL.md +2 -2
- package/skills/openprd-frontend-design/SKILL.md +44 -20
- package/skills/openprd-frontend-design/references/design-asset-contract.md +6 -0
- package/skills/openprd-frontend-design/references/direction-engine.md +29 -4
- package/skills/openprd-harness/SKILL.md +22 -16
- package/skills/openprd-quality/SKILL.md +10 -8
- package/skills/openprd-requirement-intake/SKILL.md +5 -3
- package/skills/openprd-requirement-intake/references/prd-template-lenses.md +2 -2
- package/skills/openprd-requirement-intake/references/startup-validation-lens.md +98 -13
- package/skills/openprd-router/SKILL.md +2 -1
- package/skills/openprd-shared/SKILL.md +27 -17
- package/skills/openprd-standards/SKILL.md +4 -2
- package/src/agent-canonical-content.js +808 -0
- package/src/agent-integration.js +259 -778
- package/src/brainstorm-artifacts.js +156 -8
- package/src/brainstorm-presentation.js +14 -4
- package/src/brainstorm.js +165 -2
- package/src/canvas-app.html.js +2910 -0
- package/src/canvas-i18n.js +274 -0
- package/src/canvas-workspace.js +2271 -0
- package/src/cli/args.js +72 -4
- package/src/cli/basic-print.js +3 -0
- package/src/cli/canvas-print.js +106 -0
- package/src/cli/doctor-print.js +20 -0
- package/src/cli/print.js +2 -0
- package/src/cli/quality-commands.js +222 -0
- package/src/cli/quality-print.js +37 -5
- package/src/cli/run-print.js +5 -0
- package/src/cli/workflow-print.js +3 -0
- package/src/codex-app-server-relay.js +251 -0
- package/src/codex-hook-runner-template.mjs +963 -65
- package/src/design-starter-support.js +2 -2
- package/src/design-starter.js +39 -3
- package/src/dev-standards.js +125 -10
- package/src/diagram-core.js +390 -171
- package/src/discovery.js +2 -8
- package/src/docs-compact.js +125 -0
- package/src/execution-strategy.js +1 -1
- package/src/fleet.js +9 -3
- package/src/guide.js +227 -0
- package/src/html-artifacts.js +825 -51
- package/src/knowledge.js +101 -20
- package/src/language-policy.js +63 -3
- package/src/learning-review.js +1 -1
- package/src/loop.js +1 -1
- package/src/openprd.js +68 -131
- package/src/openspec/change-validate.js +2 -2
- package/src/openspec/constants.js +6 -7
- package/src/openspec/execute.js +2 -2
- package/src/openspec/generate.js +318 -102
- package/src/openspec/migration.js +168 -0
- package/src/openspec/paths.js +1 -22
- package/src/prd-core.js +102 -3
- package/src/quality-html-artifact.js +30 -5
- package/src/quality-visual-review.js +257 -14
- package/src/quality.js +66 -18
- package/src/review-presentation.js +60 -0
- package/src/run-harness.js +41 -3
- package/src/session-evidence.js +363 -0
- package/src/standards.js +64 -0
- package/src/test-strategy.js +7 -4
- package/src/visual-compare-centering.js +622 -0
- package/src/visual-compare-core.js +1123 -0
- package/src/visual-compare.js +620 -698
- package/src/workspace-core.js +132 -4
- package/src/workspace-workflow.js +172 -10
package/README.md
CHANGED
|
@@ -100,9 +100,15 @@ OpenPrd 会生成可以直接分享的 HTML 面板,让产品、研发和 Agent
|
|
|
100
100
|
### 效果图与截图拼图对比,自动优化
|
|
101
101
|
|
|
102
102
|
把效果图和实现截图放进同一张左右对比图里,适合登录入口改造、条款页本地化、弹窗复刻这类阶段性评审。
|
|
103
|
+
视觉证据会跟随当前任务语境选择语言:中文需求默认输出中文标签,英文需求默认输出英文标签;需要固定语言时可显式传入 `--locale zh-CN` 或 `--locale en`,证据板里的标题、摘要和检查项也会一起跟随。
|
|
103
104
|
|
|
104
105
|

|
|
105
106
|
|
|
107
|
+
```bash
|
|
108
|
+
openprd visual-compare . --reference ref.png --actual actual.png --locale zh-CN
|
|
109
|
+
openprd visual-compare . --board verification-board.json --locale en
|
|
110
|
+
```
|
|
111
|
+
|
|
106
112
|
## 自我成长机制
|
|
107
113
|
|
|
108
114
|
OpenPrd 会沿着两条看得见的循环,越用越贴合你们的协作方式。一条循环把真实项目里反复验证过的做法沉淀成可复用的 `项目级 Skill`;另一条循环把不同场景下更合适的协作设置沉淀成 `动态参数配置`,让下次启动时直接带上更合适的默认做法。
|
|
@@ -211,7 +217,7 @@ openprd init /path/to/project --template-pack agent
|
|
|
211
217
|
npx @openprd/cli@latest init /path/to/project --template-pack agent
|
|
212
218
|
```
|
|
213
219
|
|
|
214
|
-
`init` 会创建 `.openprd/`、`docs/basic/`、`AGENTS.md`,并生成 Codex / Claude / Cursor
|
|
220
|
+
`init` 会创建 `.openprd/`、`docs/basic/`、`AGENTS.md`,并生成 Codex / Claude / Cursor 三端引导。`.openprd/` 是项目内唯一的 OpenPrd 工作区;change、spec、task 和 archive 产物都会收敛到 `.openprd/changes/`、`.openprd/specs/` 和 `.openprd/archive/changes/`,不再在仓库根目录生成单独的 `openprd/` 目录。Codex 项目会同时写入 `.codex/config.toml`、`.codex/hooks.json`、`.codex/hooks/openprd-hook.mjs`,并开启用户级 Codex `hooks = true`。
|
|
215
221
|
|
|
216
222
|
Codex hooks 默认使用 `lite` 模式:安装 `UserPromptSubmit`、轻量
|
|
217
223
|
`PreToolUse` 写入门禁,以及轻量 `Stop` 收工回顾。明确提到 OpenPrd、PRD、深度调研、深度对标、复刻、
|
|
@@ -309,13 +315,17 @@ openprd review /path/to/project --mark confirmed --version <id> --digest <sha256
|
|
|
309
315
|
```
|
|
310
316
|
|
|
311
317
|
`review.html` 是当前 PRD 的稳定评审稿,但默认 approval policy 是
|
|
312
|
-
`decision-points`,不是“每次都必须停在这里”。常规 lane
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
318
|
+
`decision-points`,不是“每次都必须停在这里”。常规 lane 下,一句自然语言
|
|
319
|
+
确认(例如“确认这版,继续”,容忍“确认 v0276 评审稿”这类版本号插写)就足够:
|
|
320
|
+
hook 会自动把确认绑定到当前精确的 `--version`、`--digest`、`--work-unit`,
|
|
321
|
+
Agent 不允许反过来向用户索要 digest、work-unit 或完整命令。当这句确认同时
|
|
322
|
+
带有“继续执行”意图,或此前已确认过需求摘要时,一次确认会解锁整条链:评审
|
|
323
|
+
记录、change、tasks 与实现全程直通,不再逐环节停下(一次确认合同)。
|
|
324
|
+
`silent-record` lane 只有在用户一开始已经明确要求直接做、并显式表示不需要
|
|
325
|
+
额外评审或确认时,才允许直接记录当前这份精确 artifact。不要把实现授权当成
|
|
326
|
+
给任意评审稿补确认,也不要把评审记录当成实现授权。当前 artifact 记录完成后,
|
|
327
|
+
再生成 OpenPrd change 和任务拆解;如果用户原始意图已明确要求实现,tasks
|
|
328
|
+
就绪后即可直接执行,否则等待一句明确的执行指令:
|
|
319
329
|
|
|
320
330
|
```bash
|
|
321
331
|
openprd change /path/to/project --generate --change <change-id>
|
|
@@ -443,6 +453,22 @@ OpenPrd 生成的 change 会包含标准化维护任务,change 校验也会检
|
|
|
443
453
|
或产品行为变化影响,也必须同步更新。如果无需更新,应说明已经完成影响判定以及
|
|
444
454
|
为什么现有文档仍然准确。
|
|
445
455
|
|
|
456
|
+
## 生图路由:自动选对免费生图工具
|
|
457
|
+
|
|
458
|
+
图片、封面图、效果图、图标等生图请求按三层路由自动选工具,不需要用户指定:
|
|
459
|
+
|
|
460
|
+
1. **工具面判定**:Codex 环境用原生 `imagegen`(Image 2),Cursor 环境用内置
|
|
461
|
+
`GenerateImage`——两者都是对话工具内的免费能力,优先直接使用。
|
|
462
|
+
2. **已存偏好**:都不可用或无法判断时,先读
|
|
463
|
+
`.openprd/harness/image-generation-preference.json` 里用户已确认的偏好,
|
|
464
|
+
有就直接用,不再重复询问。
|
|
465
|
+
3. **询问并持久化**:没有偏好时才问用户一次,答复以 `user-confirmed` 来源
|
|
466
|
+
写回该文件,作为下次默认。
|
|
467
|
+
|
|
468
|
+
成本护栏:任何情况下都不允许在用户未明确指定时,擅自调用用户本地或自有的
|
|
469
|
+
付费生图 API(例如 OpenAI / Stability key)。路由协议由 install manifest 和
|
|
470
|
+
`.openprd/harness/runtime-environment.json` 的 `imageGenerationRouting` 字段承载。
|
|
471
|
+
|
|
446
472
|
## 效果图与截图拼图对比,自动优化
|
|
447
473
|
|
|
448
474
|
当界面任务已经有效果图、设计稿、用户给图或 Agent 自己生成的 mock 时,Agent
|
|
@@ -482,6 +508,65 @@ openprd visual-compare /path/to/project \
|
|
|
482
508
|
Agent 必须查看生成图并继续对标,直到没有明显视觉差异。最终回复里应给出本次
|
|
483
509
|
生成的对比图路径,并说明对比后是否仍有差异。
|
|
484
510
|
|
|
511
|
+
如果新功能或改动包含同构列表、卡片、网格或表格,或者用户反馈“没对齐”“排版
|
|
512
|
+
漂移”,Agent 还要把真实截图、辅助线、容器轨道量测和内部内容槽位量测放到一张对齐证据板里:
|
|
513
|
+
|
|
514
|
+
```bash
|
|
515
|
+
openprd visual-compare /path/to/project \
|
|
516
|
+
--board alignment-board.json
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
`alignment-board.json` 使用 `mode: "alignment-board"`,记录截图、辅助线、
|
|
520
|
+
容器分组和内容槽位分组。容器轨道包括卡片外框、列宽、行顶、间距等;
|
|
521
|
+
内容槽位包括标题、副标题、标签、描述、状态、价格、按钮、图标和操作区等
|
|
522
|
+
相同文案类型/相同组件槽位的 x/y/宽高/baseline spread。列表卡片、卡片网格和
|
|
523
|
+
表格这类重复结构属于默认触发场景,不需要等用户先指出“没有对齐”;只量外框、
|
|
524
|
+
列宽或行顶不算完整对齐验收。
|
|
525
|
+
|
|
526
|
+
如果要判断单个 logo、icon、avatar、badge、按钮图形或图片裁切内部是否居中,
|
|
527
|
+
或者用户反馈“偏心”“视觉重心不对”,Agent 应先裁出目标元素,再生成内部居中证据板:
|
|
528
|
+
|
|
529
|
+
```bash
|
|
530
|
+
openprd visual-compare /path/to/project \
|
|
531
|
+
--board centering-board.json
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
最小语法如下:
|
|
535
|
+
|
|
536
|
+
```json
|
|
537
|
+
{
|
|
538
|
+
"mode": "centering-board",
|
|
539
|
+
"title": "Logo 内部居中检查",
|
|
540
|
+
"image": ".openprd/harness/screenshots/logo.png",
|
|
541
|
+
"thresholdPx": 8,
|
|
542
|
+
"subject": {
|
|
543
|
+
"mode": "auto",
|
|
544
|
+
"weight": "contrast"
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
如果自动 mask 把背景、阴影或透明边缘算进主体,可以显式指定颜色范围:
|
|
550
|
+
|
|
551
|
+
```json
|
|
552
|
+
{
|
|
553
|
+
"mode": "centering-board",
|
|
554
|
+
"image": ".openprd/harness/screenshots/logo.png",
|
|
555
|
+
"subject": {
|
|
556
|
+
"mode": "range",
|
|
557
|
+
"ranges": [
|
|
558
|
+
{ "r": [180, 255], "g": [140, 255], "b": [0, 120] },
|
|
559
|
+
{ "r": [210, 255], "g": [210, 255], "b": [200, 255] }
|
|
560
|
+
],
|
|
561
|
+
"weight": "luma"
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
`centering-board` 会输出红色画布中心线、绿色主体外接框、黄色视觉重心点,
|
|
567
|
+
并在 metadata 里记录主体外接框中心偏移和视觉重心偏移。单张原始截图或
|
|
568
|
+
“看起来居中”的主观判断不能替代这张证据板。
|
|
569
|
+
|
|
485
570
|
## 回归测试与质量评估报告
|
|
486
571
|
|
|
487
572
|
`openprd init` 同时会创建质量契约:
|
|
@@ -510,7 +595,10 @@ openprd quality /path/to/project --verify
|
|
|
510
595
|
`openprd run --verify` 会再次执行这个质量门禁。Agent 不得在本期必测块缺证据或需关注时宣称就绪。
|
|
511
596
|
如果界面任务已有参考图,视觉就绪还需要 `.openprd/harness/visual-reviews/`
|
|
512
597
|
下存在本次 `openprd visual-compare --reference/--actual` 产物;如果没有参考图但改动界面,
|
|
513
|
-
还需要存在 `openprd visual-compare --before/--after`
|
|
598
|
+
还需要存在 `openprd visual-compare --before/--after` 修改前后产物。普通截图实测需要截图实测证据板;
|
|
599
|
+
同构列表、卡片、网格或表格还需要对齐辅助线证据板,并同时覆盖容器轨道和内部内容槽位;
|
|
600
|
+
单个素材、图标、头像、徽标、按钮图形或图片内部居中/视觉重心判断需要内部居中证据板。
|
|
601
|
+
对比图仍有明显差异、坐标偏差或漂移时,应回到实现继续调整。
|
|
514
602
|
|
|
515
603
|
当一个问题已经修复并完成验证后,可以把抽象模式沉淀为项目级经验:
|
|
516
604
|
|
|
@@ -568,10 +656,12 @@ openprd loop /path/to/project --run --agent codex --dry-run
|
|
|
568
656
|
|
|
569
657
|
`doctor` 会检查三端引导、Codex hooks 开关、项目标准化和 OpenPrd 工作区验证是否健康,同时展示像 Context7 / DeepWiki 这类可选增强建议。`update` 会从 OpenPrd 的统一源刷新这些生成文件,并保留用户自己已有的 hook 分组。
|
|
570
658
|
|
|
659
|
+
新版本更新会自动识别旧项目遗留的根目录 `openprd/changes/`、`openprd/specs/` 和 `openprd/archive/changes/`,并把内容迁移到 `.openprd/` 对应位置;无冲突时会删除空的旧 `openprd/` 目录。若同名文件内容不同,旧文件会保留在原处并让本次更新失败,避免静默覆盖用户数据。
|
|
660
|
+
|
|
571
661
|
`self-update` 只更新 OpenPrd CLI 自身,默认使用公开 npm 包。
|
|
572
662
|
`upgrade` 会编排两层更新:先执行 `self-update`,再重新解析安装后的
|
|
573
663
|
`openprd` 可执行文件,然后执行 `update <project>`;加 `--fleet` 时会执行
|
|
574
|
-
`fleet <root> --update-openprd
|
|
664
|
+
`fleet <root> --update-openprd`,刷新已有 `.openprd/` 的历史项目,并识别只有旧根目录 `openprd/` 工作产物的项目完成迁移。两个入口都支持
|
|
575
665
|
`--dry-run`,预演时只打印安装和刷新命令,不修改 CLI、项目、registry 或 harness 状态。
|
|
576
666
|
|
|
577
667
|
这套 harness 是有状态的,但 hook 重量由 profile 控制。默认 `lite` 保留轻量
|
|
@@ -589,7 +679,9 @@ Claude Code 中优先用 Playwright、MCP 浏览器自动化或项目已有 e2e
|
|
|
589
679
|
通过后,`loop --finish` 会写入阶段性测试报告,并可在隔离 worktree 中为该任务生成独立 commit。
|
|
590
680
|
界面任务完成前必须运行 `openprd visual-compare`:已有参考图时截实现图并走
|
|
591
681
|
`--reference/--actual`,没有参考图但改动界面时先留修改前截图、完成后留修改后截图并走
|
|
592
|
-
`--before/--after
|
|
682
|
+
`--before/--after`,普通截图实测走 `--board <verification-board.json>`,同构列表、卡片、网格或表格走
|
|
683
|
+
`--board <alignment-board.json>`,单元素内部居中/视觉重心问题走
|
|
684
|
+
`--board <centering-board.json>`,查看证据图后才能完成任务。
|
|
593
685
|
|
|
594
686
|
`openprd run --context` 可能展示 loop 相关执行命令,但它不是自动执行指令。
|
|
595
687
|
只有当用户当前明确要求开发、实现、继续任务、深度调研、深度对标、复刻落地或
|
|
@@ -636,10 +728,11 @@ Loop 状态会沉淀在 `.openprd/harness/`:
|
|
|
636
728
|
OpenPrd 面向用户的时间统一使用上海时区的 `YYYY-MM-DD HH:mm:ss` 格式,不输出
|
|
637
729
|
`T`、`Z` 或毫秒后缀。除命令、字段名、文件路径、API 名称、品牌名和产品名等必要
|
|
638
730
|
专有术语外,生成文档、进度日志、proposal、prompt、测试报告,以及 Agent 产出的
|
|
639
|
-
`spec.md` 与 tasks
|
|
640
|
-
|
|
731
|
+
`spec.md` 与 tasks 默认跟随当前输入和 PRD 快照的主语言:中文语境使用简体中文,
|
|
732
|
+
英文语境保持英文,无法判断时回退到简体中文。结构字段继续兼容历史英文
|
|
733
|
+
结构字段;明确要求 `zh-CN` 的图示和合同场景仍会强制使用中文。
|
|
641
734
|
|
|
642
|
-
历史项目不要手写 shell 循环批量改。使用 `fleet` 先扫描报告;它现在会顺带提示全局 registry 里已经登记了多少 OpenPrd 工作区、当前 root 外还有多少已知项目。`--sync-registry` 用来把当前 root 下已初始化的 `.openprd/` 工作区回填到 `~/.openprd/registry/workspaces.jsonl`。`--update-openprd`
|
|
735
|
+
历史项目不要手写 shell 循环批量改。使用 `fleet` 先扫描报告;它现在会顺带提示全局 registry 里已经登记了多少 OpenPrd 工作区、当前 root 外还有多少已知项目。`--sync-registry` 用来把当前 root 下已初始化的 `.openprd/` 工作区回填到 `~/.openprd/registry/workspaces.jsonl`。`--update-openprd` 会刷新已有 `.openprd/` 的项目,也会把只包含旧根目录 `openprd/changes/`、`openprd/specs/` 或 `openprd/archive/changes/` 的历史项目识别为 OpenPrd 工作区并迁移到 `.openprd/`;项目自身 standards 或 validate 缺口会作为“项目健康需关注”报告,但不阻断生成引导更新。只有 agent 配置或普通项目默认保持不变,除非显式用 `--setup-missing` 接管。
|
|
643
736
|
|
|
644
737
|
## 怎么看 `status` / `next`
|
|
645
738
|
|
package/README_EN.md
CHANGED
|
@@ -130,9 +130,18 @@ one human-readable quality surface before handoff, release, or publish.
|
|
|
130
130
|
Put the reference and implementation into one side-by-side artifact for staged
|
|
131
131
|
UI review, especially for auth-entry redesign, localized legal pages, and modal
|
|
132
132
|
replication work.
|
|
133
|
+
Visual evidence follows the current task language by default: Chinese requests
|
|
134
|
+
produce Chinese labels, English requests produce English labels, and
|
|
135
|
+
`--locale zh-CN` or `--locale en` can pin the output language for side-by-side labels,
|
|
136
|
+
board titles, summaries, and checks.
|
|
133
137
|
|
|
134
138
|

|
|
135
139
|
|
|
140
|
+
```bash
|
|
141
|
+
openprd visual-compare . --reference ref.png --actual actual.png --locale zh-CN
|
|
142
|
+
openprd visual-compare . --board verification-board.json --locale en
|
|
143
|
+
```
|
|
144
|
+
|
|
136
145
|
## Self-Evolving Collaboration
|
|
137
146
|
|
|
138
147
|
OpenPrd gets easier to work with over time through two visible loops. One loop
|
|
@@ -172,6 +181,7 @@ automatically.
|
|
|
172
181
|
- **Project-level benchmark registry**: support `benchmark add / observe / approve / verify` so repeatedly adopted external sources can become durable project references
|
|
173
182
|
- **Diagram review artifacts**: generate both architecture and product-flow diagrams
|
|
174
183
|
- **UI visual comparison artifacts**: combine reference images and implementation screenshots into side-by-side JPG reviews for visual replication work
|
|
184
|
+
- **Language-aware visual evidence**: localize comparison labels and board copy from the active request language, with `--locale` / `--lang` overrides when a project needs a fixed output language
|
|
175
185
|
- **Contract-driven diagrams**: render from validated JSON contracts
|
|
176
186
|
- **Review status tracking**: use `pending-confirmation`, `confirmed`, and `needs-revision`
|
|
177
187
|
- **Project release/version ledger**: optionally track project versions such as `0.1.23`, version-scoped change items, and local git tag coordination without mixing them with internal PRD `v000x` versions
|
|
@@ -355,16 +365,23 @@ openprd review /path/to/project --mark confirmed --version <id> --digest <sha256
|
|
|
355
365
|
|
|
356
366
|
`review.html` is the stable review artifact for the current PRD, but the default
|
|
357
367
|
approval policy is `decision-points`, not “always stop here”. In a normal lane,
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
+
one plain natural-language confirmation (for example “确认这版,继续”, including
|
|
369
|
+
wording with an inline version id such as “确认 v0276 评审稿”) is enough: the
|
|
370
|
+
hook binds it to the exact current `--version`, `--digest`, and `--work-unit`
|
|
371
|
+
tuple automatically, and the agent must never ask the user to paste a digest,
|
|
372
|
+
work-unit id, or a full command. When that confirmation also carries a
|
|
373
|
+
continue-execution intent, or a requirement summary was already confirmed
|
|
374
|
+
earlier, one confirmation authorizes the whole chain: review recording, change,
|
|
375
|
+
tasks, and implementation proceed without further stops (the one-time
|
|
376
|
+
confirmation contract). In a `silent-record` lane, OpenPrd can record the exact
|
|
377
|
+
current artifact without an extra stop only when the user already made direct
|
|
378
|
+
execution intent explicit and explicitly opted out of additional review
|
|
379
|
+
confirmation. Do not treat implementation approval as permission to mark a
|
|
380
|
+
different review artifact, and do not treat review recording as execution
|
|
381
|
+
authorization. After the current artifact is recorded, generate the OpenPrd
|
|
382
|
+
change and task breakdown. If the user originally asked to implement, execution
|
|
383
|
+
can continue once tasks are ready; otherwise wait for an explicit execution
|
|
384
|
+
request:
|
|
368
385
|
|
|
369
386
|
```bash
|
|
370
387
|
openprd change /path/to/project --generate --change <change-id>
|
|
@@ -501,6 +518,25 @@ the change affects responsibilities, flows, structure, dependencies, or product
|
|
|
501
518
|
behavior. If no documentation update is needed, agents should say the check was
|
|
502
519
|
performed and why the existing docs still match the code.
|
|
503
520
|
|
|
521
|
+
## Image-generation routing: pick the right free tool automatically
|
|
522
|
+
|
|
523
|
+
Image requests (covers, mockups, icons, effect images) follow a three-layer
|
|
524
|
+
routing protocol, so users never have to specify a provider:
|
|
525
|
+
|
|
526
|
+
1. **Surface built-ins first**: Codex uses native `imagegen` (Image 2), Cursor
|
|
527
|
+
uses the built-in `GenerateImage` tool — both are free inside their surfaces.
|
|
528
|
+
2. **Persisted preference**: when no built-in tool is available, OpenPrd reads
|
|
529
|
+
the user-confirmed preference from
|
|
530
|
+
`.openprd/harness/image-generation-preference.json` and reuses it silently.
|
|
531
|
+
3. **Ask once, persist**: only when no preference exists does OpenPrd ask the
|
|
532
|
+
user once, then writes the answer back with a `user-confirmed` source as the
|
|
533
|
+
future default.
|
|
534
|
+
|
|
535
|
+
Cost guardrail: OpenPrd never silently calls the user’s own paid image APIs
|
|
536
|
+
(for example OpenAI or Stability keys) unless the user explicitly picked one.
|
|
537
|
+
The routing contract ships in the install manifest and
|
|
538
|
+
`.openprd/harness/runtime-environment.json` under `imageGenerationRouting`.
|
|
539
|
+
|
|
504
540
|
## Auto-optimized reference-to-screenshot comparison
|
|
505
541
|
|
|
506
542
|
When UI work already has a reference effect image, design image, user-provided
|
|
@@ -547,6 +583,71 @@ obvious visual differences. The final response for reference-driven UI work
|
|
|
547
583
|
should include the generated review image path and note whether differences
|
|
548
584
|
remain.
|
|
549
585
|
|
|
586
|
+
When a new feature or visible change contains repeated homogeneous lists, cards,
|
|
587
|
+
grids, or tables, or when the user reports misalignment, the agent should also
|
|
588
|
+
capture the real UI, overlay guide lines, and measure both container-track and
|
|
589
|
+
internal content-slot coordinate spread in one alignment evidence board:
|
|
590
|
+
|
|
591
|
+
```bash
|
|
592
|
+
openprd visual-compare /path/to/project \
|
|
593
|
+
--board alignment-board.json
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
Use `mode: "alignment-board"` in the board JSON. Include the screenshot, guide
|
|
597
|
+
lines, container groups, content-slot groups, and x/y/width/height/baseline
|
|
598
|
+
spread. Container tracks include card edges, columns, row tops, and gaps.
|
|
599
|
+
Internal content slots include titles, subtitles, tags, descriptions, status,
|
|
600
|
+
prices, buttons, icons, and action areas. Repeated card lists, card grids, and
|
|
601
|
+
tables are default triggers even when the user did not explicitly complain
|
|
602
|
+
about alignment; measuring only outer frames, columns, or row tops is not enough.
|
|
603
|
+
|
|
604
|
+
When a single logo, icon, avatar, badge, button graphic, or image crop needs
|
|
605
|
+
internal centering review, or when the user reports that its visual weight feels
|
|
606
|
+
off-center, crop the target if needed and generate a centering evidence board:
|
|
607
|
+
|
|
608
|
+
```bash
|
|
609
|
+
openprd visual-compare /path/to/project \
|
|
610
|
+
--board centering-board.json
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
Minimal syntax:
|
|
614
|
+
|
|
615
|
+
```json
|
|
616
|
+
{
|
|
617
|
+
"mode": "centering-board",
|
|
618
|
+
"title": "Logo internal centering check",
|
|
619
|
+
"image": ".openprd/harness/screenshots/logo.png",
|
|
620
|
+
"thresholdPx": 8,
|
|
621
|
+
"subject": {
|
|
622
|
+
"mode": "auto",
|
|
623
|
+
"weight": "contrast"
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
If the automatic mask includes background, shadow, or transparent padding, use
|
|
629
|
+
explicit color ranges:
|
|
630
|
+
|
|
631
|
+
```json
|
|
632
|
+
{
|
|
633
|
+
"mode": "centering-board",
|
|
634
|
+
"image": ".openprd/harness/screenshots/logo.png",
|
|
635
|
+
"subject": {
|
|
636
|
+
"mode": "range",
|
|
637
|
+
"ranges": [
|
|
638
|
+
{ "r": [180, 255], "g": [140, 255], "b": [0, 120] },
|
|
639
|
+
{ "r": [210, 255], "g": [210, 255], "b": [200, 255] }
|
|
640
|
+
],
|
|
641
|
+
"weight": "luma"
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
`centering-board` draws the red canvas center, green active subject bounds, and
|
|
647
|
+
yellow visual centroid, then stores bounding-box center offset and
|
|
648
|
+
visual-centroid offset in metadata. A raw screenshot or subjective “looks
|
|
649
|
+
centered” note is not a substitute for this board.
|
|
650
|
+
|
|
550
651
|
## Quality Regression Reports
|
|
551
652
|
|
|
552
653
|
`openprd init` also creates a quality contract:
|
|
@@ -584,8 +685,14 @@ scope for the scenario.
|
|
|
584
685
|
|
|
585
686
|
For UI work with an existing reference image, visual readiness also requires a
|
|
586
687
|
current `openprd visual-compare` artifact under `.openprd/harness/visual-reviews/`.
|
|
587
|
-
|
|
588
|
-
|
|
688
|
+
Before/after UI changes require a before/after artifact, screenshot-based
|
|
689
|
+
runtime checks require a verification board, and homogeneous lists, cards,
|
|
690
|
+
grids, or tables require an alignment board that covers both container tracks
|
|
691
|
+
and internal content slots. Single-logo, icon, avatar, badge, button graphic, or
|
|
692
|
+
image-crop internal-centering reviews require a centering board. If the combined image still shows
|
|
693
|
+
obvious differences, coordinate drift, or layout spread beyond the intended
|
|
694
|
+
threshold, the task should return to implementation instead of treating the gap
|
|
695
|
+
as ready.
|
|
589
696
|
|
|
590
697
|
After a fix has been verified and reviewed, promote the abstract pattern into
|
|
591
698
|
project knowledge:
|
|
@@ -688,7 +795,11 @@ task, and can commit that task before moving on.
|
|
|
688
795
|
For UI tasks, the loop prompt and generated guidance require the agent to run
|
|
689
796
|
`openprd visual-compare` before finishing: use `--reference/--actual` when a
|
|
690
797
|
reference image exists, or `--before/--after` when the agent must verify a UI
|
|
691
|
-
change without an explicit reference image.
|
|
798
|
+
change without an explicit reference image. Use `--board <verification-board.json>`
|
|
799
|
+
for screenshot-based runtime evidence, and `--board <alignment-board.json>` for
|
|
800
|
+
homogeneous lists, cards, grids, or tables; the alignment board must cover both
|
|
801
|
+
outer tracks and internal content slots. Use `--board <centering-board.json>` for
|
|
802
|
+
single-element internal-centering or visual-centroid checks.
|
|
692
803
|
|
|
693
804
|
`openprd run --context` may surface loop commands as execution commands, but they
|
|
694
805
|
are not automatic instructions. Agents should run `openprd loop --run`,
|
|
@@ -736,6 +847,13 @@ without launching an agent. Use `--agent codex` or `--agent claude` for the defa
|
|
|
736
847
|
CLI integrations. Use `--agent-command "<custom command>"` only when you want to
|
|
737
848
|
pipe the OpenPrd prompt into a project-specific wrapper.
|
|
738
849
|
|
|
850
|
+
User-facing generated docs, progress logs, proposals, prompts, test reports, and
|
|
851
|
+
agent-produced specs/tasks follow the primary language of the current request
|
|
852
|
+
and PRD snapshot. Chinese contexts use Simplified Chinese, English contexts stay
|
|
853
|
+
English, and ambiguous contexts fall back to `zh-CN`; command names, field names,
|
|
854
|
+
paths, APIs, product names, and explicitly `zh-CN` diagram contracts remain
|
|
855
|
+
unchanged.
|
|
856
|
+
|
|
739
857
|
For historical projects, use `fleet` instead of hand-writing shell loops. By
|
|
740
858
|
default it scans and reports only, while also telling you how many known
|
|
741
859
|
OpenPrd workspaces already exist in the global registry and how many are outside
|
package/package.json
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
export const DEV_CHECK_WRAPUP_COPY_LIMIT = 20;
|
|
4
|
-
|
|
5
|
-
const
|
|
4
|
+
// 自动优化模式(默认)与仅推荐模式使用不同表头;字段别名成对等价。
|
|
5
|
+
const WRAPUP_FIELD_ALIASES = [
|
|
6
|
+
['源文件规模', '规模信号'],
|
|
7
|
+
['优化原因', '预警原因'],
|
|
8
|
+
['本次处理结果'],
|
|
9
|
+
['后续建议'],
|
|
10
|
+
];
|
|
11
|
+
const VALIDATE_USAGE = 'Usage: echo \'{"rows":[{"影响对象":"src/example.js","源文件规模":"701 行(> 700 行/文件)","优化原因":"文件偏大,维护成本升","本次处理结果":"本轮小改,未扩职责","后续建议":"继续改前先拆小"}]}\' | node scripts/dev-check-wrapup-copy.mjs --validate(仅推荐模式对应字段为“规模信号 / 预警原因”)';
|
|
6
12
|
|
|
7
13
|
function countChars(value) {
|
|
8
14
|
return Array.from(String(value ?? ''));
|
|
@@ -11,14 +17,15 @@ function countChars(value) {
|
|
|
11
17
|
function validateCompactRows(rows = [], limit = DEV_CHECK_WRAPUP_COPY_LIMIT) {
|
|
12
18
|
for (const [index, row] of rows.entries()) {
|
|
13
19
|
const rowLabel = row?.影响对象 ? String(row.影响对象) : (row?.影响位置 ? String(row.影响位置) : `第 ${index + 1} 行`);
|
|
14
|
-
for (const
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
throw new Error(
|
|
20
|
+
for (const aliases of WRAPUP_FIELD_ALIASES) {
|
|
21
|
+
const field = aliases.find((name) => typeof row?.[name] === 'string');
|
|
22
|
+
if (!field) {
|
|
23
|
+
throw new Error(`收口表格校验失败:${rowLabel} 缺少字段“${aliases.join('/')}”。${VALIDATE_USAGE}`);
|
|
18
24
|
}
|
|
25
|
+
const value = row[field];
|
|
19
26
|
const actual = countChars(value).length;
|
|
20
27
|
if (actual > limit) {
|
|
21
|
-
throw new Error(
|
|
28
|
+
throw new Error(`收口表格校验失败:${rowLabel} 的“${field}”有 ${actual} 个字,超过 ${limit} 字上限。当前内容:“${value}”。请缩短后重试。`);
|
|
22
29
|
}
|
|
23
30
|
}
|
|
24
31
|
}
|
|
@@ -56,29 +63,45 @@ function reasonText(file) {
|
|
|
56
63
|
return '待补充';
|
|
57
64
|
}
|
|
58
65
|
|
|
59
|
-
function currentResultText(file) {
|
|
60
|
-
if (file.status === 'warning')
|
|
61
|
-
|
|
66
|
+
function currentResultText(file, autoRefactor) {
|
|
67
|
+
if (file.status === 'warning') {
|
|
68
|
+
return autoRefactor ? '本轮执行拆分后回填' : '这次先完成需求,暂不拆分';
|
|
69
|
+
}
|
|
70
|
+
if (file.status === 'attention') {
|
|
71
|
+
return autoRefactor ? '按需小步拆分后回填' : '本轮小改,未扩职责';
|
|
72
|
+
}
|
|
62
73
|
if (file.status === 'error') return '本轮失败,未收口';
|
|
63
74
|
if (file.status === 'ok') return '本轮已回顾';
|
|
64
75
|
return '待确认';
|
|
65
76
|
}
|
|
66
77
|
|
|
67
|
-
function followUpText(file) {
|
|
68
|
-
if (file.status === 'warning')
|
|
69
|
-
|
|
78
|
+
function followUpText(file, autoRefactor) {
|
|
79
|
+
if (file.status === 'warning') {
|
|
80
|
+
return autoRefactor ? '拆完重跑测试验证' : '优先拆出独立职责';
|
|
81
|
+
}
|
|
82
|
+
if (file.status === 'attention') {
|
|
83
|
+
return autoRefactor ? '保持职责边界清晰' : '继续改前先拆小';
|
|
84
|
+
}
|
|
70
85
|
if (file.status === 'error') return '先修复后重跑';
|
|
71
86
|
if (file.status === 'ok') return '无需额外动作';
|
|
72
87
|
return '待确认';
|
|
73
88
|
}
|
|
74
89
|
|
|
75
|
-
export function buildCompactDevCheckWrapUpRows(files = []) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
90
|
+
export function buildCompactDevCheckWrapUpRows(files = [], options = {}) {
|
|
91
|
+
const autoRefactor = Boolean(options.autoRefactor);
|
|
92
|
+
return files.map((file) => (autoRefactor
|
|
93
|
+
? {
|
|
94
|
+
源文件规模: thresholdText(file),
|
|
95
|
+
优化原因: reasonText(file),
|
|
96
|
+
本次处理结果: currentResultText(file, autoRefactor),
|
|
97
|
+
后续建议: followUpText(file, autoRefactor),
|
|
98
|
+
}
|
|
99
|
+
: {
|
|
100
|
+
规模信号: thresholdText(file),
|
|
101
|
+
预警原因: reasonText(file),
|
|
102
|
+
本次处理结果: currentResultText(file, autoRefactor),
|
|
103
|
+
后续建议: followUpText(file, autoRefactor),
|
|
104
|
+
}));
|
|
82
105
|
}
|
|
83
106
|
|
|
84
107
|
async function readStdin() {
|
|
@@ -95,7 +118,9 @@ async function main() {
|
|
|
95
118
|
const payload = raw.trim() ? JSON.parse(raw) : {};
|
|
96
119
|
const rows = validateOnly
|
|
97
120
|
? (Array.isArray(payload.rows) ? payload.rows : [])
|
|
98
|
-
: buildCompactDevCheckWrapUpRows(Array.isArray(payload.files) ? payload.files : []
|
|
121
|
+
: buildCompactDevCheckWrapUpRows(Array.isArray(payload.files) ? payload.files : [], {
|
|
122
|
+
autoRefactor: Boolean(payload.autoRefactor),
|
|
123
|
+
});
|
|
99
124
|
validateCompactRows(rows);
|
|
100
125
|
process.stdout.write(JSON.stringify({
|
|
101
126
|
ok: true,
|
|
@@ -57,7 +57,7 @@ description: 为 OpenPrd 产品、CLI、Agent harness、AI code review / PR revi
|
|
|
57
57
|
## Source Map
|
|
58
58
|
|
|
59
59
|
- OpenPrd / PRD 设计对标:`obra/superpowers`、`Fission-AI/OpenSpec`。
|
|
60
|
-
- 创业验证 / 需求收口透镜:`slavingia/skills
|
|
60
|
+
- 创业验证 / 需求收口透镜:`slavingia/skills`,重点吸收 community-first、10 specific people、current workaround as competition、Magic Piece of Paper、spreadsheet / no-code first、automate-one-step-at-a-time、forms and lists / CRUD first、build for today's customers not hypothetical future ones、avoid irreversible decisions、one-thing MVP、weekend test、3-of-10 payment proof、10+ paying before productize、first-customer circles、100 paying before launch、charge-from-day-one、customer-1 profitability、spend time before money、minimalist review 和 default alive,并优先按 `find-community -> validate-idea -> processize -> mvp -> first-customers -> pricing -> marketing-plan -> grow-sustainably -> company-values -> minimalist-review` 的时序来落地。
|
|
61
61
|
- CLI 与 skill 体系对标:`larksuite/cli`、`anthropics/skills`、Claude Skills 官方文档、Claude Code Skills 官方文档。
|
|
62
62
|
- 长程 Agent 任务:Anthropic long-running agents harness 工程文章。
|
|
63
63
|
- 通用 harness:OpenAI harness engineering、LangChain agent harness anatomy。
|
|
@@ -81,6 +81,7 @@ description: 为 OpenPrd 产品、CLI、Agent harness、AI code review / PR revi
|
|
|
81
81
|
## 设计输出
|
|
82
82
|
|
|
83
83
|
- 给出 OpenPrd 应该内置什么、生成什么、路由什么、保留什么门禁。
|
|
84
|
+
- 如果来源本质上在讲 0 到 1 验证或创业判断,优先把“社区契合 -> 当前替代与痛点证据 -> 手工/表单/no-code 桥接 -> 付费验证 -> 单步自动化 / 最轻产品壳 -> 产品化门槛 -> 增长纪律”落到 requirement-intake、brainstorm、PRD 模板和 hook 提示里,而不是只加一条灵感备注。
|
|
84
85
|
- 优先把结论落到 `CANONICAL_SKILLS`、repo-local skills、AGENTS/CLAUDE/Cursor 生成规则、hooks 或测试,而不是停留在口头建议。
|
|
85
86
|
- 不把外部项目整包复制进 OpenPrd;只吸收可验证的路由、生成、门禁、状态承接和用户体验原则。
|
|
86
87
|
- 需要显式说明时,简短写出参考了哪个来源、借鉴点、适用原因、不照搬边界,以及落到当前任务的具体决策。
|
|
@@ -1,25 +1,37 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: openprd-diagram-review
|
|
3
|
-
description: 生成并迭代 OpenPrd
|
|
3
|
+
description: 生成并迭代 OpenPrd 图示产物,供用户确认或理解。适用于解释型 SVG、架构图、产品流程图、用户旅程、流程图、系统边界图、依赖图,以及 freeze 前的可视化评审场景。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# OpenPrd Diagram Review
|
|
7
7
|
|
|
8
8
|
## 概览
|
|
9
9
|
|
|
10
|
-
这份 skill
|
|
10
|
+
这份 skill 用来判断当前需要哪种图:轻量解释图、正式 diagram contract,或需要用户往返确认的评审循环。不要把所有图都当成 freeze 前评审图;很多时候用户只是需要先看懂问题。
|
|
11
11
|
|
|
12
12
|
## 动手前
|
|
13
13
|
|
|
14
14
|
1. 读取 `skills/openprd-shared/SKILL.md`
|
|
15
15
|
2. 重建当前工作区状态,判断用户究竟想确认什么
|
|
16
16
|
3. 决定用户需要的是:
|
|
17
|
+
- `explanation-svg` 轻量解释图
|
|
17
18
|
- `architecture` 视图
|
|
18
19
|
- `product-flow` 视图
|
|
19
20
|
4. 不要虚构今天还不存在的 OpenPrd diagram 命令
|
|
20
21
|
|
|
21
22
|
## 图示类型选择
|
|
22
23
|
|
|
24
|
+
当用户在问这些内容时,优先选 `explanation-svg`:
|
|
25
|
+
|
|
26
|
+
- 为什么会这样
|
|
27
|
+
- 这两个方案差在哪里
|
|
28
|
+
- 当前状态怎么走到目标状态
|
|
29
|
+
- 过去、现在、未来的关系
|
|
30
|
+
- 因果、依赖、边界、风险传播
|
|
31
|
+
- Agent 要向用户解释需求场景、问题结构、决策取舍或下一步路径
|
|
32
|
+
|
|
33
|
+
`explanation-svg` 是对话辅助。它可以用内联 SVG、HTML 片段或 Markdown 中的 SVG 代码块表达;它不需要写入 `.openprd/engagements/active/`,也不替代 `openprd diagram`、`review.html`、`visual-compare` 或测试证据。
|
|
34
|
+
|
|
23
35
|
当用户在问这些内容时,选 `architecture`:
|
|
24
36
|
|
|
25
37
|
- 模块
|
|
@@ -41,6 +53,17 @@ description: 生成并迭代 OpenPrd 图示产物,供用户确认。适用于
|
|
|
41
53
|
|
|
42
54
|
- 当用户行为和流程仍不清楚时,先做 `product-flow` contract
|
|
43
55
|
- 流程清楚后,再做架构评审
|
|
56
|
+
- 如果只是为了让用户先理解取舍,不进入定稿评审,先给 `explanation-svg`
|
|
57
|
+
|
|
58
|
+
## 解释型 SVG 规则
|
|
59
|
+
|
|
60
|
+
- 输出顺序优先是:一句结论、SVG 图、最多 3 条补充说明或开放问题。
|
|
61
|
+
- 图中每个节点只放短标签和 1 行例子;正文解释放到图下,不要把 SVG 变成文字墙截图。
|
|
62
|
+
- 优先使用 2 到 5 个节点、明确箭头、颜色分组、虚线边界、少量图例;避免复杂渐变、装饰背景和难读小字。
|
|
63
|
+
- 适合的图形包括:双栏对比、时间线、状态转移、边界/责任图、决策树、风险传播、因果反推。
|
|
64
|
+
- 图中用户可见文案跟随用户当前主语言;中文语境用简体中文,专有名词可保留,但不要在中文语境下整句英文。
|
|
65
|
+
- 如果没有足够事实支撑图中的节点或箭头,先把缺口写成“待确认”,不要把推测画成事实。
|
|
66
|
+
- 需要模板时读取 `references/explanation-svg-patterns.md`。
|
|
44
67
|
|
|
45
68
|
## 当前工具能力
|
|
46
69
|
|
|
@@ -52,6 +75,7 @@ description: 生成并迭代 OpenPrd 图示产物,供用户确认。适用于
|
|
|
52
75
|
|
|
53
76
|
因此:
|
|
54
77
|
|
|
78
|
+
- 对 `explanation-svg`,直接在对话或临时 HTML/SVG artifact 中生成轻量图,不声称已进入正式 diagram 评审
|
|
55
79
|
- 对 `architecture`,直接调用内置命令
|
|
56
80
|
- 对 `product-flow`,即使还没有专门渲染器,也先生成结构化 contract 和评审清单
|
|
57
81
|
- 如果工具还没有专用流程渲染器,就不要假装它已经存在
|
|
@@ -87,5 +111,6 @@ description: 生成并迭代 OpenPrd 图示产物,供用户确认。适用于
|
|
|
87
111
|
## 需要时阅读这些参考资料
|
|
88
112
|
|
|
89
113
|
- `references/diagram-contracts.md`:架构图和产品流程图 contract
|
|
114
|
+
- `references/explanation-svg-patterns.md`:解释型 SVG 的触发场景、图形模板和文案边界
|
|
90
115
|
- `references/review-checklist.md`:渲染后应该问用户什么
|
|
91
116
|
- `references/cocoon-patterns.md`:从 `Cocoon-AI/architecture-diagram-generator` 借来的可复用模式
|