design-playbook 0.7.0
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/LICENSE +28 -0
- package/NOTICE +37 -0
- package/README.md +143 -0
- package/commands/design-io.md +8 -0
- package/commands/ui-review.md +8 -0
- package/commands/ux-spec.md +8 -0
- package/mcp/__init__.py +0 -0
- package/mcp/_transport.py +242 -0
- package/mcp/evidence/README.md +40 -0
- package/mcp/evidence/__init__.py +0 -0
- package/mcp/evidence/server.py +450 -0
- package/mcp/evidence/test_server_stdio.py +645 -0
- package/mcp/preview/__init__.py +0 -0
- package/mcp/preview/browser.py +661 -0
- package/mcp/preview/confirm.py +255 -0
- package/mcp/preview/control.py +1293 -0
- package/mcp/preview/i18n.py +162 -0
- package/mcp/preview/server.py +126 -0
- package/mcp/preview/test_browser_control.py +663 -0
- package/mcp/preview/test_server_stdio.py +630 -0
- package/mcp/preview/test_transaction.py +436 -0
- package/mcp/preview/transaction.py +536 -0
- package/mcp/preview/util.py +19 -0
- package/mcp/test_transport.py +39 -0
- package/package.json +42 -0
- package/skills/craft-guard/SKILL.md +59 -0
- package/skills/craft-guard/references/craft.md +29 -0
- package/skills/craft-guard/references/detectors.md +124 -0
- package/skills/design-baseline/SKILL.md +134 -0
- package/skills/design-baseline/agents/openai.yaml +4 -0
- package/skills/design-baseline/references/design-template.md +73 -0
- package/skills/design-baseline/references/extraction-guidance.md +39 -0
- package/skills/design-baseline/scripts/design_baseline.py +780 -0
- package/skills/design-playbook/SKILL.md +219 -0
- package/skills/native-craft/SKILL.md +59 -0
- package/skills/native-craft/references/native-feel.md +79 -0
- package/skills/reference-intake/SKILL.md +86 -0
- package/skills/reference-intake/references/contract-template.md +82 -0
- package/skills/ui-evaluator/SKILL.md +110 -0
- package/skills/ui-evaluator/references/rubric.md +45 -0
- package/skills/ui-picker/SKILL.md +63 -0
- package/skills/ui-picker/references/components.md +31 -0
- package/skills/ui-picker/references/design.md +21 -0
- package/skills/ui-picker/references/domain.md +26 -0
- package/skills/ui-picker/references/template.md +24 -0
- package/skills/ux-spec/SKILL.md +51 -0
- package/skills/ux-spec/references/spec-template.md +43 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# evaluator rubric
|
|
2
|
+
|
|
3
|
+
## 维度如何选
|
|
4
|
+
|
|
5
|
+
- **落地页**:设计质量 / 原创性 / 工艺 / 功能
|
|
6
|
+
- **控制台**:设计质量 / 可用性 / 信息密度 / 工艺 / 一致性
|
|
7
|
+
|
|
8
|
+
维度从场景读出,引擎不写死;**判据必须能回到声明**。
|
|
9
|
+
|
|
10
|
+
## 回流示例
|
|
11
|
+
|
|
12
|
+
| 发现 | 表层说法 | 回指 |
|
|
13
|
+
| --- | --- | --- |
|
|
14
|
+
| 失败无重试 | 交互不完整 | `spec` 状态流 |
|
|
15
|
+
| 高危灰标签 | 颜色不醒目 | `domain` + `components` |
|
|
16
|
+
| 按钮硬编码 hex(如 `#4f46e5`) | 代码不规范 | `design` token |
|
|
17
|
+
| 列表变卡片墙 | 版式不对 | `template` |
|
|
18
|
+
|
|
19
|
+
## 禁止
|
|
20
|
+
|
|
21
|
+
- 「整体还可以优化」无指征
|
|
22
|
+
- 只改 CSS 不回到声明
|
|
23
|
+
- 用新审美词覆盖未写清的 L5
|
|
24
|
+
|
|
25
|
+
## preview seam 健康(supporting,ADR-0008)
|
|
26
|
+
|
|
27
|
+
若该 run 跑了 `preview*`(`.scratch/<run>/preview/log.md` + `confirm-round-*.json` 存在),把它列为 supporting finding:
|
|
28
|
+
|
|
29
|
+
- 读 `preview/log.md` + confirm json:反馈是否驱动了 revision,还是空/无关锚点滑过结构 floor。`decision-round-*.json` 仅用于审计/恢复,不是确认权威或第二份语义输入(ADR-0013)。
|
|
30
|
+
- 结构 floor(adapter,G5)只挡空反馈/无注释锚点;**语义**问题(如「安师大」这种与被批注元素无关的合法字符串)floor 挡不住,靠这里兜。
|
|
31
|
+
- `source` 归 `preview* seam`(orchestrator 的 preview 步骤契约),不是 UI source —— 当缺陷在 adapter loop 契约而非生成 UI 本身时用这个。
|
|
32
|
+
- 过程缺口(seam 契约)与产品 findings(UI)分开记;不混在回流闭包 trail 里。
|
|
33
|
+
|
|
34
|
+
## observe* mirror surface(supporting)
|
|
35
|
+
|
|
36
|
+
若 `evidence/manifest.jsonl` 任一条 capture 声明 **`surface: mirror`**(或等价 note),必须有 finding:
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
issue: observe used semantic mirror, not live Fill host
|
|
40
|
+
source: observe* seam
|
|
41
|
+
fix: re-capture on live host URL when available; keep surface: mirror until then
|
|
42
|
+
severity: low
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Do not treat G6 artifact presence alone as proof the Fill tree was runtime-verified.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ui-picker
|
|
3
|
+
description: UI shell and component semantics. Use when scaffolding a product page (list, dashboard, settings, detail, agent-admin), or when the wrong template/Badge-Tag pairing is about to be coded.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ui-picker
|
|
7
|
+
|
|
8
|
+
Before code: map the job to a **template** (shell) and **component semantics**. Appearance follows meaning.
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
### 1. Density + scene
|
|
13
|
+
|
|
14
|
+
Choose density (console-tight vs marketing-loose) and scene class (list / detail / settings / dashboard / editor / agent-admin / …).
|
|
15
|
+
|
|
16
|
+
When a verified `.scratch/<run>/design-baseline/state.json` binds a baseline (`status: ready` from `design_baseline.verify`), read that binding path first (`baseline.path`, usually `DESIGN.md` or `.stitch/DESIGN.md`). It is the project-specific authority for atmosphere, visual roles, density, layout, motion, and component conventions. Preserve it unless the requested change explicitly revises the baseline.
|
|
17
|
+
|
|
18
|
+
When `.scratch/<run>/reference/contract.md` exists (ADR-0011), read its **Visual cues for ui-picker**, Keep/Change, and Do not copy / exclusions. Use them as input for density, scene, region weight, and risks — never as hex tokens or as a license to copy brand chrome.
|
|
19
|
+
|
|
20
|
+
**Done when:** one scene label and one density choice are explicit; a bound baseline is cited by path + SHA-256; if a reference contract exists, the decision report's risks or exclusions surface its Do not copy / brand risks (path citation is enough).
|
|
21
|
+
|
|
22
|
+
### 2. Template
|
|
23
|
+
|
|
24
|
+
Read [`references/template.md`](references/template.md). Assign main / side / action / status regions.
|
|
25
|
+
|
|
26
|
+
**Done when:** each region maps to a duty from `spec` L2 (or a stated gap in the spec).
|
|
27
|
+
|
|
28
|
+
### 3. Components
|
|
29
|
+
|
|
30
|
+
Read [`references/components.md`](references/components.md). For each field/action, pick by **role** (status vs category vs confirm vs detail).
|
|
31
|
+
|
|
32
|
+
Load only if needed:
|
|
33
|
+
|
|
34
|
+
- business risk / desensitize → [`references/domain.md`](references/domain.md)
|
|
35
|
+
- token roles while deciding surfaces → verified `<binding.path>` first, then generic fallback [`references/design.md`](references/design.md)
|
|
36
|
+
|
|
37
|
+
**Done when:** every primary datum/action has a named component role; easy-mix pairs (Badge/Tag, Dialog/Drawer, Dropdown/Menu/Command) are resolved in writing.
|
|
38
|
+
|
|
39
|
+
### 4. Decision report
|
|
40
|
+
|
|
41
|
+
Write, then wait for confirmation if the user is in the loop:
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
design-baseline: <binding.path> sha256:<digest> | waived:<reason>
|
|
45
|
+
scene:
|
|
46
|
+
density:
|
|
47
|
+
template:
|
|
48
|
+
regions: …
|
|
49
|
+
components: …
|
|
50
|
+
baseline-changes: none | <explicitly approved change>
|
|
51
|
+
risks: …
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Done when:** the report exists, records the bound baseline or explicit waiver, and coding has not started without it.
|
|
55
|
+
|
|
56
|
+
### Branch — structure still open
|
|
57
|
+
|
|
58
|
+
If template is underdetermined, offer 2–3 IA variants (same `spec`, different main-region weight), one-line tradeoff each, pick one, then complete step 4.
|
|
59
|
+
|
|
60
|
+
## Defaults that hold
|
|
61
|
+
|
|
62
|
+
- Brand color as token/role, not a hex literal.
|
|
63
|
+
- Easy-mix pair semantics and shell 禁用 rules live in `references/components.md` and `references/template.md` — resolve against those tables, not from memory.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# components(组件语义)
|
|
2
|
+
|
|
3
|
+
## 登记四层
|
|
4
|
+
|
|
5
|
+
| 层 | 要声明 |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| 来源 | shadcn / 自有 / 业务定制 |
|
|
8
|
+
| 语义角色 | 状态 / 分类 / 动作 / 容器 / 导航 / 反馈 |
|
|
9
|
+
| 变体与状态 | size、variant、loading、disabled… |
|
|
10
|
+
| 组合边界 | 允许/禁止嵌套与替代 |
|
|
11
|
+
|
|
12
|
+
## 易混
|
|
13
|
+
|
|
14
|
+
| 对 | 差别 |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| Badge / Tag | 状态·计数 vs 分类·可选·可移除 |
|
|
17
|
+
| Modal / Dialog / Drawer | 打断程度、信息密度、退出方式 |
|
|
18
|
+
| Tabs / Tabs-Switch | 同空间视图 vs 模式/口径 |
|
|
19
|
+
| Dropdown / Menu / Command | 局部选择 / 动作集 / 搜索式操作 |
|
|
20
|
+
|
|
21
|
+
## Illustrative mapping (agent-ops list row)
|
|
22
|
+
|
|
23
|
+
Generic example — adapt per product; not a fixed template.
|
|
24
|
+
|
|
25
|
+
| Datum | Role | Component |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
| running / failed | run status | Badge |
|
|
28
|
+
| high-risk | risk | RiskBadge (+ domain) |
|
|
29
|
+
| instance type / environment | category | Tag |
|
|
30
|
+
| view log | inline action | Link/Button |
|
|
31
|
+
| retry | recovery action | Button |
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# design.md(视觉系统执行约束)
|
|
2
|
+
|
|
3
|
+
## 意图(默认)
|
|
4
|
+
|
|
5
|
+
- CJK-first;控制台密度优先;品牌色克制;中性色承层级。
|
|
6
|
+
|
|
7
|
+
## 角色示例
|
|
8
|
+
|
|
9
|
+
- `--brand` 主 CTA
|
|
10
|
+
- `--brand-surface` 选中行/软徽章
|
|
11
|
+
- `--foreground-link` 正文链接
|
|
12
|
+
- `--warning-high` 高风险
|
|
13
|
+
- `--chart-1..12` 多系列图
|
|
14
|
+
|
|
15
|
+
## 执行三律
|
|
16
|
+
|
|
17
|
+
1. 所有视觉值走 `var(--*)`
|
|
18
|
+
2. hover/active/disabled/selected 从基础 token 派生
|
|
19
|
+
3. 找不到 token:记 `gaps.log` + 合法 fallback 或拒生成该细节
|
|
20
|
+
|
|
21
|
+
禁止裸写 hex、随意 px/ms/cubic-bezier 字面量绕过系统。
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# domain(领域语义,可按产品替换)
|
|
2
|
+
|
|
3
|
+
## 任务状态
|
|
4
|
+
|
|
5
|
+
| 状态 | 表达 |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| 排队 | 中性,不示风险 |
|
|
8
|
+
| 运行中 | 正常进行 |
|
|
9
|
+
| 完成 | 成功 |
|
|
10
|
+
| 失败 | 必须提供恢复动作 |
|
|
11
|
+
| 超时 | 原因 + 后续操作 |
|
|
12
|
+
|
|
13
|
+
## 风险色(示例 token 角色)
|
|
14
|
+
|
|
15
|
+
- 高危 → `var(--warning-high)`
|
|
16
|
+
- 可疑 → `var(--warning-medium)`
|
|
17
|
+
- 低风险 → `var(--warning-low)` 或 `var(--info)`
|
|
18
|
+
|
|
19
|
+
## Data safety
|
|
20
|
+
|
|
21
|
+
- Secrets, credentials, account IDs, host IPs default to masked
|
|
22
|
+
- Plaintext requires explicit click; reveal action may be audited
|
|
23
|
+
|
|
24
|
+
## 危险操作
|
|
25
|
+
|
|
26
|
+
关闭防护、批量删除、解除高危屏蔽等:二次确认 + 写清后果,禁止「确定吗?」空确认。
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# template(页面骨架声明)
|
|
2
|
+
|
|
3
|
+
## 看板 / 调度(默认示例)
|
|
4
|
+
|
|
5
|
+
- **场景**:任务调度、运行监控、队列、批处理进度。
|
|
6
|
+
- **骨架**:
|
|
7
|
+
- 顶:总览指标
|
|
8
|
+
- 主:任务列表或任务流
|
|
9
|
+
- 侧:趋势、队列压力、失败原因
|
|
10
|
+
- 操作:刷新、批量重试、暂停等
|
|
11
|
+
- **密度**:控制台密度;总览只承载核心指标;图不抢主列表。
|
|
12
|
+
- **禁用**:营销落地页、纯图表大屏、sample/playground 当生产。
|
|
13
|
+
|
|
14
|
+
## 列表页
|
|
15
|
+
|
|
16
|
+
- 筛 + 表 + 行操作 + 空/载/错;批量区与主表同级可见。
|
|
17
|
+
|
|
18
|
+
## 详情页
|
|
19
|
+
|
|
20
|
+
- 标题元信息 + 主内容 + 次级 tabs/侧栏;危险操作有确认。
|
|
21
|
+
|
|
22
|
+
## 设置页
|
|
23
|
+
|
|
24
|
+
- 分组表单 + 保存反馈;不把设置塞进随意 Modal 墙。
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ux-spec
|
|
3
|
+
description: Declaration-first UI spec (six-layer spec.md). Use when turning a short product/UI ask into six-layer spec.md, or when goal, edge-state, acceptance, or evidence requirements are missing before build.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ux-spec
|
|
7
|
+
|
|
8
|
+
Write a **six-layer `spec.md`**: the functional **declaration** for what must be true. Visual skin, tokens, and Badge-vs-Tag choices are out of scope.
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
### 1. Pin L1
|
|
13
|
+
|
|
14
|
+
From the ask, fix the user-visible goal, target user, in-scope scenes, **non-goals**, and always/ask/never boundaries. Ask only when a missing answer materially changes one of them; otherwise record a conservative assumption.
|
|
15
|
+
|
|
16
|
+
When `.scratch/<run>/reference/contract.md` exists (ADR-0011), **read it before writing L1–L6**. Fold its functional constraints, non-goals implied by Do not copy, and always/ask/never hints into L1 (and later L5/L6 edges). Cite the path; do not re-derive the screenshot from memory. The reference contract is input only — it does not replace any L1–L6 heading.
|
|
17
|
+
|
|
18
|
+
**Done when:** all five L1 fields are explicit — goal, target user, in-scope scenes, non-goals, and always/ask/never boundaries — with each assumption labeled as such; none left blank or implied; and if a reference contract exists, its functional constraints are reflected (or an explicit rejected-with-reason note is recorded).
|
|
19
|
+
|
|
20
|
+
### 2. Expand L2–L4
|
|
21
|
+
|
|
22
|
+
- L2 regions and duties
|
|
23
|
+
- L3 states and transitions
|
|
24
|
+
- L4 control behavior per relevant state
|
|
25
|
+
|
|
26
|
+
Use the headings in [`references/spec-template.md`](references/spec-template.md).
|
|
27
|
+
|
|
28
|
+
**Done when:** every primary user job has a state path; every region has an owner duty.
|
|
29
|
+
|
|
30
|
+
### 3. Force L5–L6
|
|
31
|
+
|
|
32
|
+
- L5: empty, loading, error, permission — each with what the user can do next
|
|
33
|
+
- L6: checkable acceptance; every top-level item explicitly contains `Given`, then `When`, then `Then`, with the proof required for that item
|
|
34
|
+
|
|
35
|
+
Evidence is criterion-shaped: visible states require rendered inspection at named target viewports; behavior requires an interaction trace or automated check; implementation health uses the relevant tests, type/lint checks, or affected build when available. Planning-only work names the future proof instead of claiming it exists. Where the proof is a runtime state, name the **capture seed** — the state to capture (e.g. "error-state screenshot") and the capture type. This is the seed the `observe*` step derives a capture plan from (`Given`/`When` → state+actions, `Then` → required); do not write selectors, URLs, or actions here — those are derived later.
|
|
36
|
+
|
|
37
|
+
**Done when:** L5 is not a single word (“loading”); every L6 item is a top-level list item that uses `Given -> When -> Then` in that order, can be ticked pass/fail without taste debate, and says what evidence will prove it (naming the capture seed where the proof is a runtime state).
|
|
38
|
+
|
|
39
|
+
### 4. Emit
|
|
40
|
+
|
|
41
|
+
Output the full `spec.md` using the template structure. Stop. Do not scaffold UI or pick components here.
|
|
42
|
+
|
|
43
|
+
**Done when:** one markdown spec exists containing every L1–L6 heading from the template, with steps 1–3 Done-when criteria still holding in the emitted file, ready for the next pipeline step (`ui-picker` / fill).
|
|
44
|
+
|
|
45
|
+
## Scope fence
|
|
46
|
+
|
|
47
|
+
| In | Out → |
|
|
48
|
+
| --- | --- |
|
|
49
|
+
| Functional truth, flows, edges, acceptance | Color/type/motion → `design` / `craft-guard` |
|
|
50
|
+
| | Risk/secrets meaning → `domain` |
|
|
51
|
+
| | Component identity → `ui-picker` / `components` |
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<!-- spec-schema: 1 -->
|
|
2
|
+
|
|
3
|
+
# [功能名] 交互设计 Spec
|
|
4
|
+
|
|
5
|
+
## L1 定位与意图
|
|
6
|
+
- 用户可见目标:
|
|
7
|
+
- 目标用户:
|
|
8
|
+
- 场景清单:
|
|
9
|
+
- 非目标:
|
|
10
|
+
- 行为边界:始终 / 询问后 / 永不
|
|
11
|
+
|
|
12
|
+
## L2 信息架构
|
|
13
|
+
- 空间区域定义:
|
|
14
|
+
- 区域边界规则:
|
|
15
|
+
- 内容生长规则:
|
|
16
|
+
|
|
17
|
+
## L3 核心链路
|
|
18
|
+
- 状态清单:
|
|
19
|
+
- 主链路:
|
|
20
|
+
- 分支链路:
|
|
21
|
+
|
|
22
|
+
## L4 组件功能细节
|
|
23
|
+
- 组件定位与功能清单
|
|
24
|
+
- 默认 / 悬停 / 加载 / 禁用 / 错误 等状态
|
|
25
|
+
- L4 declares control behavior only; reuse / no-internal-change constraints must name exceptions (for example, allow a minimal patch when they conflict with L5).
|
|
26
|
+
|
|
27
|
+
## L5 边界条件
|
|
28
|
+
- 空态:
|
|
29
|
+
- 加载态:
|
|
30
|
+
- 错误态:
|
|
31
|
+
- 权限降级:
|
|
32
|
+
|
|
33
|
+
## L6 验收标准
|
|
34
|
+
- 每条验收是一个顶层列表项,按序显式包含 `Given` → `When` → `Then`(顺序固定),并写明该条的必备证据
|
|
35
|
+
- 必备证据:规划声明覆盖 / 目标视口渲染 / 交互记录或自动化检查 / 相关 test、type、lint、build(按任务适用项选择)
|
|
36
|
+
- 证据为运行时状态时,命名 capture seed(要捕获的状态 + 捕获类型,如 "error-state screenshot");不写 selector/URL/actions
|
|
37
|
+
- 设计完成定义:
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Worked snippet (illustrative)
|
|
42
|
+
|
|
43
|
+
For an agent-ops list: a failed item must show cause + retry (L3/L4); no-data shows a non-blank empty state (L5); without permission the dangerous action is disabled with a reason (L5); acceptance ticks each of these (L6). Adapt to the actual product; this is not a fixed domain.
|