dsforge-harness 0.1.2 → 0.1.6
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/README.md +143 -12
- package/package.json +1 -1
- package/plugins/dsforge/.claude-plugin/plugin.json +1 -1
- package/plugins/dsforge/skills/dsforge/SKILL.md +23 -11
- package/plugins/dsforge/skills/dsforge/references/00-portable-kit-and-runbook.md +7 -7
- package/plugins/dsforge/skills/dsforge/references/01-harness-design-and-validation-plan.md +3 -3
- package/plugins/dsforge/skills/dsforge/references/03-verifier-generalization-spec.md +10 -10
- package/plugins/dsforge/skills/dsforge/references/examples/smoke-fixture/README.md +2 -3
- package/plugins/dsforge/skills/dsforge/references/examples/smoke-fixture/validators/projects/smoke.json +1 -1
- package/plugins/dsforge/skills/dsforge/validators/check-layout.js +50 -7
- package/plugins/dsforge/skills/dsforge/validators/check2.js +4 -4
- package/plugins/dsforge/skills/dsforge/validators/check3.js +24 -1
- package/plugins/dsforge/skills/dsforge/validators/extract-tokens.js +1 -1
- package/plugins/dsforge/skills/dsforge/validators/projects/_TEMPLATE.json +4 -1
- package/plugins/dsforge/skills/dsforge/validators/test/check-layout.test.js +144 -8
- package/plugins/dsforge/skills/dsforge/validators/test/check3-icons.test.js +61 -0
- package/plugins/dsforge/skills/dsforge/validators/test/run-all.js +1 -1
- package/plugins/dsforge/skills/dsforge/validators/verify.js +6 -3
- package/templates/CLAUDE.md +4 -4
- package/plugins/dsforge/skills/dsforge/assets/code-scaffold-reference-ezp/DatasetManagement.tsx +0 -48
- package/plugins/dsforge/skills/dsforge/assets/code-scaffold-reference-ezp/ModelCreateEdit.tsx +0 -93
- package/plugins/dsforge/skills/dsforge/assets/code-scaffold-reference-ezp/components/DataTable.tsx +0 -64
- package/plugins/dsforge/skills/dsforge/assets/code-scaffold-reference-ezp/components/controls.tsx +0 -97
- package/plugins/dsforge/skills/dsforge/assets/code-scaffold-reference-ezp/components/forms.tsx +0 -41
- package/plugins/dsforge/skills/dsforge/assets/code-scaffold-reference-ezp/components/shell.tsx +0 -81
- package/plugins/dsforge/skills/dsforge/assets/code-scaffold-reference-ezp/ezp.css +0 -115
- package/plugins/dsforge/skills/dsforge/assets/code-scaffold-reference-ezp/tokens.css +0 -106
- package/plugins/dsforge/skills/dsforge/assets/code-scaffold-reference-ezp/tokens.ts +0 -94
- package/plugins/dsforge/skills/dsforge/references/examples/code-stage-instruction-dataset-management.md +0 -36
- package/plugins/dsforge/skills/dsforge/references/examples/ezp-states-elevation-augmentation-spec.md +0 -35
- package/plugins/dsforge/skills/dsforge/references/examples/run1-dataset-management-list-spec.md +0 -58
- package/plugins/dsforge/skills/dsforge/references/examples/run2-model-create-edit-spec.md +0 -38
- package/plugins/dsforge/skills/dsforge/references/examples/smoke-fixture/reports/22-verification-report.json +0 -53
- package/plugins/dsforge/skills/dsforge/validators/out/ezp-tokens.json +0 -7
- package/plugins/dsforge/skills/dsforge/validators/projects/ezp.json +0 -70
package/README.md
CHANGED
|
@@ -1,7 +1,141 @@
|
|
|
1
1
|
# dsforge
|
|
2
2
|
|
|
3
|
-
A verified **design → design-system → code** harness for Claude Code.
|
|
3
|
+
A verified **design → design-system → code** harness for Claude Code. / Claude Code용 검증형 **디자인 → 디자인시스템 → 코드** 하네스.
|
|
4
|
+
|
|
5
|
+
## 목차 / Table of Contents
|
|
6
|
+
- **한국어**
|
|
7
|
+
- [개요](#개요)
|
|
8
|
+
- [설치 / 사용](#설치--사용)
|
|
9
|
+
- [무엇을 입력받나](#무엇을-입력받나)
|
|
10
|
+
- [구조](#구조)
|
|
11
|
+
- [한계](#한계)
|
|
12
|
+
- [포크 / 리브랜딩 메모](#포크--리브랜딩-메모)
|
|
13
|
+
- **English**
|
|
14
|
+
- [Overview](#overview)
|
|
15
|
+
- [Install / use](#install--use)
|
|
16
|
+
- [What it asks for](#what-it-asks-for)
|
|
17
|
+
- [Structure](#structure)
|
|
18
|
+
- [Limits](#limits)
|
|
19
|
+
- [Notes for forking / rebranding](#notes-for-forking--rebranding)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# 한국어
|
|
24
|
+
|
|
25
|
+
## 개요
|
|
26
|
+
기능 명세와 Figma 디자인시스템(DS)을 주면 전체 파이프라인을 굴립니다 — Figma 시안, 토큰 바인딩 디자인시스템,
|
|
27
|
+
토큰 충실 프론트엔드 코드 — **자동 검사 게이트**(DS 감사 · 시안-명세 대조 · 코드-DS 대조)와 **사람 리뷰 게이트
|
|
28
|
+
2곳**과 함께. 원칙은 *추정하지 말고 측정하라*: 모든 단계를 빌드 보고서가 아니라 Figma 노드와 코드를 **직접 읽어**
|
|
29
|
+
검증합니다. 두 화면(리스트·폼) × 두 도메인에서 단계별로 검증됐고, DS가 없을 때 토큰 바인딩 DS를 처음부터 도출하는
|
|
30
|
+
**Branch B** 도 검증됐습니다.
|
|
31
|
+
|
|
32
|
+
> 엔진은 Claude입니다(시안·코드는 Claude가 만들고, 리뷰어가 검증). 번들 스크립트는 **검사만** 자동화합니다 —
|
|
33
|
+
> dsforge는 화면을 혼자 찍어내는 정적 생성기가 아닙니다.
|
|
34
|
+
|
|
35
|
+
## 설치 / 사용
|
|
36
|
+
**동작 모델:** dsforge 설치(`npx dsforge-harness init` 또는 아래 플러그인 경로)는 셸에서 실행하는 **유일한** 단계
|
|
37
|
+
입니다. skill과 `CLAUDE.md` 진입점만 깔아줍니다. 이후는 전부 **Claude Code 세션 안에서** 일어납니다: Claude가
|
|
38
|
+
Figma 시안과 코드를 만들고, Figma-MCP 검사(Check 1/2)와 Node 검사(Check 3 / `verify`)를 돌리고, **사람 게이트 2곳**
|
|
39
|
+
에서 멈춰 승인을 기다립니다. dsforge는 **터미널에서 호출하는 단독 생성기가 아니라** Claude Code가 따르는 하네스
|
|
40
|
+
입니다. `npx dsforge-harness verify/check3`는 Node 쪽 검사만 다시 돌릴 뿐 화면을 만들지 않습니다.
|
|
41
|
+
|
|
42
|
+
**A — npm으로 프로젝트별 설치 (공개 기본):**
|
|
43
|
+
```
|
|
44
|
+
npx dsforge-harness init
|
|
45
|
+
```
|
|
46
|
+
skill을 `.claude/skills/dsforge/`에 설치하고 현재 프로젝트에 `CLAUDE.md` 진입점을 씁니다. 그 폴더에서 Claude Code를
|
|
47
|
+
열면 읽고 시작합니다. "하네스를 한 리포에 떨궈서 바로 쓰는" 경로이며 누구나 됩니다(npm 패키지는 공개).
|
|
48
|
+
(`npx dsforge-harness verify <project> <screen>`로 검증기도 돌릴 수 있습니다.)
|
|
49
|
+
> npm 패키지명은 **`dsforge-harness`**, 설치되는 CLI 명령은 **`dsforge`** 입니다 — 전역 설치
|
|
50
|
+
> (`npm i -g dsforge-harness`) 후엔 `dsforge init` / `dsforge verify …`로 실행합니다.
|
|
51
|
+
|
|
52
|
+
**B — Claude Code 플러그인으로 (모든 프로젝트에서 사용):**
|
|
53
|
+
```
|
|
54
|
+
/plugin marketplace add jsiksn/dsforge # 이 GitHub 리포
|
|
55
|
+
/plugin install dsforge@dsforge
|
|
56
|
+
```
|
|
57
|
+
설치 후 아무 프로젝트나 열고, `dsforge` skill이 깔려 있으므로 명세로 화면을 만들어 달라고 하면 하네스가 트리거됩니다.
|
|
58
|
+
나중에 `/plugin marketplace update`로 갱신.
|
|
59
|
+
> **주의 — GitHub 리포는 현재 비공개입니다.** 마켓플레이스 경로(B)는 리포 소유자(또는 접근 허가된 계정)만 됩니다.
|
|
60
|
+
> 공개 전까지는 위 **npm 경로(A)** 를 쓰세요(공개 기본).
|
|
61
|
+
|
|
62
|
+
**C — 수동:** `plugins/dsforge/skills/dsforge/`를 `~/.claude/skills/`(모든 프로젝트) 또는 리포의
|
|
63
|
+
`.claude/skills/`(해당 프로젝트)로 복사.
|
|
64
|
+
|
|
65
|
+
**설치 후 Claude Code에 붙여넣어 하네스를 시작하는 프롬프트:**
|
|
66
|
+
```
|
|
67
|
+
Run the dsforge harness for this project. Inputs:
|
|
68
|
+
- Design-system Figma file key: <DS_FILE_KEY> (or: "no DS yet — propose mockups first, then derive the DS")
|
|
69
|
+
- Functional spec: <paste the spec, or a path/link>
|
|
70
|
+
- Working Figma file key (for mockups): <WORK_FILE_KEY>
|
|
71
|
+
- Screens to build: <e.g. a list screen; a create/edit form>
|
|
72
|
+
- Mockup options per screen: <default 2-3>
|
|
73
|
+
|
|
74
|
+
Follow the dsforge skill's pipeline exactly. First confirm whether a real DS exists
|
|
75
|
+
and how many mockup options per screen, then take the branch:
|
|
76
|
+
- Branch A (DS exists): audit the DS -> if it has gaps, ASK me augment-vs-mark-"(proposed)"
|
|
77
|
+
-> extract tokens -> per screen [ build 2-3 mockup OPTIONS -> run checks ->
|
|
78
|
+
STOP for my pick (GATE 1) -> build code -> run checks -> STOP for final review (GATE 2) ].
|
|
79
|
+
- Branch B (no DS): per screen build 2-3 mockup OPTIONS first -> STOP for my pick (GATE 1)
|
|
80
|
+
-> author a new token-bound DS in a new Figma file (variables, focus/disabled variants,
|
|
81
|
+
elevation) until check1 PASSes -> extract tokens -> build code -> run checks ->
|
|
82
|
+
STOP for final review (GATE 2).
|
|
83
|
+
Rules: tokens only (no hardcoded hex/px) once a DS exists; never fabricate spec content
|
|
84
|
+
(mark proposals "(제안)"/"(proposed)"); measure by reading Figma nodes and code, don't
|
|
85
|
+
trust build reports; hold at both human gates (exactly two) until I approve.
|
|
86
|
+
Craft: author every component with auto-layout (no clipped labels, no floating/detached
|
|
87
|
+
nodes, correctly-sized badges); keep the DS and the screens on SEPARATE pages
|
|
88
|
+
("Design System" / "Screens"); and render + self-critique each screen to a clean image
|
|
89
|
+
BEFORE running the mechanical checks — GATE 1 is the visual judgment point, and a green
|
|
90
|
+
check is a floor, not the quality bar.
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 무엇을 입력받나
|
|
94
|
+
트리거되면 Claude Code가 먼저 **진짜 DS가 이미 있는지**(Branch A) 없는지(Branch B)와 **화면당 시안 옵션 수**
|
|
95
|
+
(기본 2–3)를 확인한 뒤, ① 대상 **디자인시스템 Figma 파일 키**(Branch A) ② **기능 명세** ③ 시안용 **작업 Figma
|
|
96
|
+
파일 키** 를 받습니다. 그다음 둘 중 하나를 굴립니다:
|
|
97
|
+
- **Branch A (DS 있음):** DS 감사(빈틈 있으면 *보강 vs "(제안)" 표시* 를 물음) → 토큰 추출 → 화면마다
|
|
98
|
+
[시안 2–3안 → 검사 → *하나 선택* → 코드 → 검사 → *최종 리뷰*].
|
|
99
|
+
- **Branch B (DS 없음):** 화면마다 [시안 2–3안 → *하나 선택*] → 새 Figma 파일에 토큰 바인딩 DS 작성(변수,
|
|
100
|
+
focus/disabled variant, elevation)해서 DS 감사 통과까지 → 토큰 추출 → 코드 → 검사 → *최종 리뷰*.
|
|
4
101
|
|
|
102
|
+
어느 쪽이든 사람 게이트는 정확히 **둘**입니다.
|
|
103
|
+
|
|
104
|
+
## 구조
|
|
105
|
+
```
|
|
106
|
+
dsforge/
|
|
107
|
+
├── .claude-plugin/marketplace.json # 이 리포는 CC 플러그인 마켓플레이스
|
|
108
|
+
├── plugins/dsforge/
|
|
109
|
+
│ ├── .claude-plugin/plugin.json
|
|
110
|
+
│ └── skills/dsforge/
|
|
111
|
+
│ ├── SKILL.md # 하네스 skill (트리거 + 워크플로)
|
|
112
|
+
│ ├── validators/ # 검증기 + 토큰 추출기 (+ projects/_TEMPLATE.json)
|
|
113
|
+
│ └── references/ # 방법론, 런북, smoke 예시 (examples/smoke-fixture)
|
|
114
|
+
├── templates/CLAUDE.md # `dsforge init`가 프로젝트에 써줌
|
|
115
|
+
├── bin/dsforge.js # npm CLI (init / verify / check3)
|
|
116
|
+
└── package.json
|
|
117
|
+
```
|
|
118
|
+
제네릭·재사용: `validators/`(DS를 입력으로) 와 `references/`(방법). 예시:
|
|
119
|
+
`references/examples/smoke-fixture/` — Figma 없이 Node 검사를 돌려 보는 작은 예시일 뿐, 하네스의 일부가 아닙니다.
|
|
120
|
+
|
|
121
|
+
## 한계
|
|
122
|
+
**DS 조합형 화면**(리스트 / 폼 / 상세)에서 증명됨. **캔버스 / 그래프 에디터형 화면은 미검증.** 검사는 기계적
|
|
123
|
+
토큰/콘텐츠/구조 충실도만 검증하며, 시각적 판단과 디자인 의도는 사람 게이트의 몫입니다. 전제: Claude Code +
|
|
124
|
+
Figma MCP(당신 Figma에 인증), Node.js ≥ 18, 리뷰어.
|
|
125
|
+
|
|
126
|
+
## 포크 / 리브랜딩 메모
|
|
127
|
+
- 이름 `dsforge`가 전반(package, plugin, skill, marketplace)에 쓰입니다. 리브랜딩하려면 `package.json`,
|
|
128
|
+
`.claude-plugin/marketplace.json`, `plugins/dsforge/.claude-plugin/plugin.json`에서 바꾸고
|
|
129
|
+
`plugins/dsforge/` + `plugins/dsforge/skills/dsforge/`를 리네임하세요.
|
|
130
|
+
- `npm publish` 전에 npm 이름 가용성 확인 — 선점됐으면 스코프(`@<you>/dsforge`).
|
|
131
|
+
|
|
132
|
+
라이선스: MIT.
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
# English
|
|
137
|
+
|
|
138
|
+
## Overview
|
|
5
139
|
Give it a functional spec and a Figma design system, and it drives the whole pipeline — Figma mockups,
|
|
6
140
|
token-bound design system, token-faithful front-end code — with **automated check gates** (DS audit,
|
|
7
141
|
mockup-vs-spec, code-vs-DS) and **two human review gates**. Its rule is *measure, don't estimate*:
|
|
@@ -13,7 +147,6 @@ a brand-new token-bound design system from scratch when no DS exists.
|
|
|
13
147
|
> automate only the **checking** — dsforge is not a static generator that emits screens on its own.
|
|
14
148
|
|
|
15
149
|
## Install / use
|
|
16
|
-
|
|
17
150
|
**How it runs (operating model):** installing dsforge — `npx dsforge-harness init` or the plugin path below — is the
|
|
18
151
|
only step you run at a shell. It just places the skill and a `CLAUDE.md` entry point. Everything after that
|
|
19
152
|
happens **inside a Claude Code session**: Claude builds the Figma mockups and the code, runs the Figma-MCP
|
|
@@ -31,8 +164,7 @@ project. Open Claude Code in that folder → it reads them and starts. This is t
|
|
|
31
164
|
repo and go" path, and it works for anyone — the npm package is public. (You can also
|
|
32
165
|
`npx dsforge-harness verify <project> <screen>` to run the verifier.)
|
|
33
166
|
> The npm package is **`dsforge-harness`**, but the CLI command it installs is **`dsforge`** — so after a
|
|
34
|
-
> global install (`npm i -g dsforge-harness`) you run `dsforge init` / `dsforge verify …`.
|
|
35
|
-
> plugin, the `dsforge` skill, the repo `jsiksn/dsforge`, and the kickoff prompt are all unchanged.
|
|
167
|
+
> global install (`npm i -g dsforge-harness`) you run `dsforge init` / `dsforge verify …`.
|
|
36
168
|
|
|
37
169
|
**B — As a Claude Code plugin (available in every project):**
|
|
38
170
|
```
|
|
@@ -54,7 +186,7 @@ Run the dsforge harness for this project. Inputs:
|
|
|
54
186
|
- Design-system Figma file key: <DS_FILE_KEY> (or: "no DS yet — propose mockups first, then derive the DS")
|
|
55
187
|
- Functional spec: <paste the spec, or a path/link>
|
|
56
188
|
- Working Figma file key (for mockups): <WORK_FILE_KEY>
|
|
57
|
-
- Screens to build: <e.g.
|
|
189
|
+
- Screens to build: <e.g. a list screen; a create/edit form>
|
|
58
190
|
- Mockup options per screen: <default 2-3>
|
|
59
191
|
|
|
60
192
|
Follow the dsforge skill's pipeline exactly. First confirm whether a real DS exists
|
|
@@ -97,16 +229,15 @@ dsforge/
|
|
|
97
229
|
│ ├── .claude-plugin/plugin.json
|
|
98
230
|
│ └── skills/dsforge/
|
|
99
231
|
│ ├── SKILL.md # the harness skill (triggers + workflow)
|
|
100
|
-
│ ├── validators/
|
|
101
|
-
│
|
|
102
|
-
│ └── assets/code-scaffold-reference-ezp/ # reference React impl (a pattern, not drop-in)
|
|
232
|
+
│ ├── validators/ # verifier + token extractor (+ projects/_TEMPLATE.json)
|
|
233
|
+
│ └── references/ # methodology, runbook, smoke example (examples/smoke-fixture)
|
|
103
234
|
├── templates/CLAUDE.md # written into a project by `dsforge init`
|
|
104
|
-
├── bin/dsforge.js
|
|
235
|
+
├── bin/dsforge.js # the npm CLI (init / verify / check3)
|
|
105
236
|
└── package.json
|
|
106
237
|
```
|
|
107
|
-
Generic & reusable: `validators/` (DS-as-input) and `references/` (method).
|
|
108
|
-
`
|
|
109
|
-
|
|
238
|
+
Generic & reusable: `validators/` (DS-as-input) and `references/` (method). Example:
|
|
239
|
+
`references/examples/smoke-fixture/` — just a tiny fixture for running the Node checks without Figma, not part
|
|
240
|
+
of the harness.
|
|
110
241
|
|
|
111
242
|
## Limits
|
|
112
243
|
Proven for **DS-composition screens** (list / form / detail). **Canvas / graph-editor screens are
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsforge-harness",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Verified design→design-system→code harness: a functional spec becomes Figma mockups, a token-bound design system, and token-faithful code, with automated check gates and two human review gates. Ships as a Claude Code plugin/skill.",
|
|
5
5
|
"bin": { "dsforge": "bin/dsforge.js" },
|
|
6
6
|
"scripts": { "test": "node plugins/dsforge/skills/dsforge/validators/test/run-all.js" },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsforge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Verified design→design-system→code harness: a functional spec becomes Figma mockups, a token-bound design system, and token-faithful code, with automated check gates (DS audit, mockup-vs-spec, code-vs-DS) and two human review gates.",
|
|
5
5
|
"author": { "name": "jsiksn" },
|
|
6
6
|
"homepage": "https://github.com/jsiksn/dsforge",
|
|
@@ -24,7 +24,7 @@ make the judgment calls.
|
|
|
24
24
|
## When this triggers, first do this
|
|
25
25
|
1. **Read `references/00-portable-kit-and-runbook.md` fully** — the whole picture, runbook, and limits.
|
|
26
26
|
Pull in `references/02-…` (checks), `references/03-…` (generalizing the verifier), and
|
|
27
|
-
`references/examples/` (
|
|
27
|
+
`references/examples/smoke-fixture/` (a runnable Node-side example) as needed.
|
|
28
28
|
2. **Confirm prerequisites:** the Figma MCP is connected to the *target* Figma · Node.js is available ·
|
|
29
29
|
a reviewer (human, or a second Claude acting as reviewer) is available for the two human gates.
|
|
30
30
|
3. **Get three inputs from the user:** ① target design-system Figma file key (or "no DS yet")
|
|
@@ -50,16 +50,15 @@ appear *verbatim*) before building any mockup.
|
|
|
50
50
|
ask the user which way to go:**
|
|
51
51
|
ⓐ **augment the DS** first, then build on the augmented DS, or
|
|
52
52
|
ⓑ **leave the DS as-is** and mark the missing pieces "(제안)/(proposed)" in the mockup.
|
|
53
|
-
(
|
|
54
|
-
is done when check1 flips to PASS.)
|
|
53
|
+
(An augmented DS is done when check1 flips to PASS.)
|
|
55
54
|
2. **Extract tokens.** Run `validators/extract-tokens.js` via `use_figma` on the DS → save the returned
|
|
56
55
|
JSON to `validators/out/<project>-tokens.json` (this is the tokenRef). Generate the code tokens
|
|
57
|
-
(`tokens.css` / `tokens.ts`) from it, using `
|
|
58
|
-
*pattern* (rename to your DS — the
|
|
56
|
+
(`tokens.css` / `tokens.ts`) from it, using `references/examples/smoke-fixture/app/tokens.css` as the
|
|
57
|
+
*pattern* (rename to your DS — the smoke fixture is just a tiny runnable example).
|
|
59
58
|
3. **Write the project descriptor.** Copy `validators/projects/_TEMPLATE.json` to
|
|
60
59
|
`validators/projects/<project>.json` and fill it: DS file key, tokenRef path, naming map, shell
|
|
61
60
|
(viewport + shell component names), `structuralPxAllow`, per-screen anchors.
|
|
62
|
-
(`validators/projects/
|
|
61
|
+
(`references/examples/smoke-fixture/validators/projects/smoke.json` is a small filled example.)
|
|
63
62
|
4. **Per screen:**
|
|
64
63
|
- Build **2–3 mockup options** (the count from step 4) with `use_figma` — each a **full viewport +
|
|
65
64
|
app shell**, composed from DS component instances, **auto-layout/aligned/filling the viewport with
|
|
@@ -179,6 +178,20 @@ separate page** (`Screens`). Never pile the DS and the screens onto one page.
|
|
|
179
178
|
- **From-scratch isolation** — in Branch B, derive each screen from the **spec + empty files only**; never
|
|
180
179
|
reference or copy a prior screen or its data, generate fresh placeholders, and guard with `check-recall.js`
|
|
181
180
|
(re-test in a session that never saw the other screen).
|
|
181
|
+
- **Surface fills** — only genuinely *raised* surfaces (card / panel / table / status-card) carry a background
|
|
182
|
+
token; **layout / auto-layout wrappers have no fill (transparent)**. Don't repaint a region in the same
|
|
183
|
+
colour as the surface beneath it (white-on-white). `check-layout` surfaces such **nested same-fill** as an
|
|
184
|
+
**advisory** (a review signal, not a gate) — it doesn't block, because some same-fill repaints (inset
|
|
185
|
+
full-area body bgs, surface-in-surface) are discipline-true yet visually harmless and no geometric rule
|
|
186
|
+
cleanly separates those from real defects. The discipline is the real lever here; the advisory just flags
|
|
187
|
+
candidates. Applies at mockup, DS, and code.
|
|
188
|
+
- **Icon & vector assets** — **Branch A only:** extract the DS's icon / logo / glyph **vector** nodes
|
|
189
|
+
(`node.exportAsync({ format: 'SVG_STRING' })`) and emit them as **inline SVG**, not placeholder boxes. Keep
|
|
190
|
+
the colour-token discipline: monochrome icons → `fill="currentColor"` (the colour comes from the consuming
|
|
191
|
+
slot's `color` token); multi-colour logos → map each colour to its brand token `var(--…)`. **Strip every
|
|
192
|
+
baked raw hex** (`fill="#…"`) — currentColor or token vars only. **Branch B (from-scratch):** there is no DS
|
|
193
|
+
to export from, so icons stay **manual placeholders** (boxes, marked "(제안)") until a DS exists. `check3`
|
|
194
|
+
(`iconAssets`) verifies declared icon slots carry real `<svg>` with zero raw hex.
|
|
182
195
|
- **Zero fabrication** — anything not in the spec is marked "(제안)/(proposed)" with placeholder values.
|
|
183
196
|
- **Measure, don't estimate** — verify by reading nodes/code, never by trusting a build report.
|
|
184
197
|
Traverse **inside** component instances.
|
|
@@ -200,8 +213,7 @@ who independently re-derives the numbers. Don't collapse the two.
|
|
|
200
213
|
|
|
201
214
|
## Bundled resources
|
|
202
215
|
- `validators/` — the verifier + token extractor (`extract-tokens, check1, check2, check-layout, check3,
|
|
203
|
-
check-recall, verify`), plus `projects/_TEMPLATE.json` (fill per project)
|
|
204
|
-
|
|
205
|
-
- `references/` — methodology & runbook (`00`–`03`) and `examples/` (
|
|
206
|
-
|
|
207
|
-
+ two screens). A *pattern* to regenerate for your DS, not a drop-in. The `ezp` name is the test DS.
|
|
216
|
+
check-recall, verify`), plus `projects/_TEMPLATE.json` (fill per project) and `test/` (node regression
|
|
217
|
+
tests, run via `npm test`).
|
|
218
|
+
- `references/` — methodology & runbook (`00`–`03`) and `examples/smoke-fixture/` (a runnable Node-side
|
|
219
|
+
example, incl. a small filled descriptor `smoke.json`).
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
**전제:** Claude Code + Figma MCP(대상 Figma에 인증) · Node.js · 리뷰어(Claude 또는 사람) · 기능명세.
|
|
29
29
|
1. **대상 DS를 가리킨다**(Figma 파일키). `Check 1`로 진짜/완성 DS인지 판정 → 미달/없음이면 **빌드·보강 경로**(토큰·바인딩·상태·elevation 채우기; Check 1이 FAIL→PASS로 flip하면 완료).
|
|
30
30
|
2. **`extract-tokens.js`를 그 DS에 돌려** tokenRef(+코드 토큰 `tokens.css`/`tokens.ts`) 생성.
|
|
31
|
-
3. **`projects/<proj>.json` 작성** — `
|
|
31
|
+
3. **`projects/<proj>.json` 작성** — `_TEMPLATE.json`을 템플릿으로(파일키·네이밍맵·셸·structuralPxAllow·화면 앵커).
|
|
32
32
|
4. **화면마다:** 명세에서 앵커 뽑아 시안 빌드 → `Check 2` + 시안 확정(사람) → 코드 → `Check 3`.
|
|
33
33
|
5. **처음 세팅 시** 검사기 자가검증을 손검증과 한 번 대조해 도구를 신뢰한 뒤, 이후 자동 게이트로 사용.
|
|
34
34
|
|
|
35
35
|
## 4. 증거 (검증된 실행 — 모든 수치 리뷰어가 노드/코드로 독립 확인)
|
|
36
|
-
- **Run1 —
|
|
37
|
-
- **Run2 —
|
|
36
|
+
- **Run1 — 목록 화면 (리스트 · 첫 검증 프로젝트):** Check1 PASS · Check2 PASS(앵커 25/25 · 날조 0 · 화면작성 raw 0 · 1920×1080+셸) · Check3 PASS(토큰 72/72 · hex 0 · 행 액션 9/9 verbatim).
|
|
37
|
+
- **Run2 — 등록/수정 화면 (폼 · 첫 검증 프로젝트의 다른 도메인):** Check2 PASS(앵커 11/11 · 날조 0 · 화면작성 raw 0 · 셸 · **focus/disabled 실사용**) · Check3 PASS(72/72 · hex 0 · 앵커 7/7 verbatim).
|
|
38
38
|
- **일반화 재현:** 두 런을 제네릭 검사기 입력으로 그대로 재현, 자가검증 10/10.
|
|
39
39
|
- 과정에서 검사기 버그 2건을 게이트가 스스로 잡아 고침: **인스턴스 내부 미traversal**(raw 누락) · **px allowlist 누락**(둘 다 "도구가 손검증/자기와 어긋남 → 도구 수정"으로 해소).
|
|
40
40
|
|
|
41
|
-
## 5. DS 상태 (
|
|
41
|
+
## 5. DS 상태 (첫 검증 프로젝트의 DS)
|
|
42
42
|
색 44 + 숫자 21(간격9·radius5·size7) + 텍스트 7 + elevation 1 · 바인딩 100%(컴포넌트 raw 0, 인스턴스 내부 포함) · 인터랙티브 17셋 focus/disabled 17/17. Check 1 PASS(완성 DS).
|
|
43
43
|
|
|
44
44
|
## 6. 한계 & 백로그 (정직하게)
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
- 메뉴 hover/active 등 일부 상태는 정적/자리만(디자인 디테일은 사람이 다듬는 영역).
|
|
50
50
|
|
|
51
51
|
## 7. 키트 구성 (무엇을 가져가나)
|
|
52
|
-
- **`validators/`** — `extract-tokens.js` · `check1.js` · `check2.js` · `check3.js` · `verify.js` · `projects/<proj>.json`(템플릿 = `
|
|
53
|
-
- **블루프린트 문서** — 이 문서 + 검증 자동화 명세 + 검사기 일반화
|
|
54
|
-
- **코드
|
|
52
|
+
- **`validators/`** — `extract-tokens.js` · `check1.js` · `check2.js` · `check3.js` · `verify.js` · `projects/<proj>.json`(템플릿 = `_TEMPLATE.json`) · `out/`(결과). (구 하드코딩판은 이력으로만 보존, 제네릭판이 표준.)
|
|
53
|
+
- **블루프린트 문서** — 이 문서 + 검증 자동화 명세 + 검사기 일반화 명세.
|
|
54
|
+
- **코드 예시** — `examples/smoke-fixture/app/`(tokens.css + 토큰만 쓰는 화면 1개). 새 프로젝트는 자기 DS의 tokenRef로 토큰을 재생성해 갈아끼운다.
|
|
55
55
|
|
|
56
56
|
---
|
|
57
57
|
|
|
@@ -96,11 +96,11 @@
|
|
|
96
96
|
---
|
|
97
97
|
|
|
98
98
|
## 현황 (Phase 0 완료 — 전제 정정)
|
|
99
|
-
- **Phase 0 / Gate F 완료. 채택 DS =
|
|
100
|
-
-
|
|
99
|
+
- **Phase 0 / Gate F 완료. 채택 DS = 첫 검증 프로젝트의 DS.** (앞 판의 "색 변수 0 = 없음 → 2-2"는 초기 레퍼런스/우리 빌드 기준의 *오기* — **정정: 이 DS는 색 변수 44개 보유.**)
|
|
100
|
+
- **첫 검증 프로젝트 DS의 Gate F = FAIL(near-pass) = "수리 가능한 실재 DS".**
|
|
101
101
|
- PASS: 색 44 · 타이포 7 · 간격 16 · radius 5 · manifest · 바인딩 99.2%.
|
|
102
102
|
- strict FAIL 3: 컴포넌트 내부 하드코딩 raw 51 / elevation 토큰 0 / focus·disabled(및 form류 hover·active) variant 부재.
|
|
103
|
-
- **경로 확정 = 2-1 (기존 DS
|
|
103
|
+
- **경로 확정 = 2-1 (기존 DS=첫 검증 프로젝트의 DS + 확정 보완).** Run1·v2가 이미 이 DS로 빌드·검증됨(풀스크린+셸, D1·D2 통과).
|
|
104
104
|
- **Stage 2 보완 백로그 (노드 실증 — Gate S1/S2/S3 대상):**
|
|
105
105
|
- B1 내부 raw 51 → 변수 바인딩 · B2 focus/disabled(+form hover/active) variant 추가 · B3 elevation 토큰 신설(v2 팝오버 raw shadow 원인) · B4(권고) semantic 색 레이어 · B5(필요시) light/dark 모드.
|
|
106
106
|
- **다음:** Stage 2에서 B1~B3(필수) 적용 → Gate F 재실행으로 §2 전부 pass 확인 → Phase 1(명세→시안): §7 규율(1920×1080+셸) + 시그니처 화면 ≥1(§6).
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# 검사기 일반화 명세 — "대상 DS를 입력으로"
|
|
2
2
|
|
|
3
3
|
## 목적
|
|
4
|
-
검사기 3종 + verify.js에서
|
|
4
|
+
검사기 3종 + verify.js에서 **첫 검증 프로젝트 하드코딩을 제거**하고, **대상 디자인시스템(DS)을 입력**으로 받게 한다. 그래야 다른 프로젝트에 그대로 겨눌 수 있다. 지금까지 검증한 것(인스턴스 내부 traversal·bound-vs-authored 분류·자가검증 5종)은 **그대로 보존**하고, 첫 검증 프로젝트 고유 상수만 뺀다.
|
|
5
5
|
|
|
6
|
-
## 1. 입력 계약 — "DS 디스크립터" (
|
|
6
|
+
## 1. 입력 계약 — "DS 디스크립터" (첫 검증 프로젝트 하드코딩을 대체)
|
|
7
7
|
한 프로젝트는 아래 한 묶음으로 기술된다(예: `project.config.json`):
|
|
8
|
-
- `dsFileKey` — DS Figma 파일 키 (지금
|
|
9
|
-
- `tokenRef` — 토큰 레퍼런스 JSON 경로 (아래 추출기가 생성; 지금
|
|
10
|
-
- `shell` — 시안 규율 설정: 뷰포트(기본 1920×1080), 셸 컴포넌트 이름들(예: side-nav·gnb-wrap — 지금
|
|
8
|
+
- `dsFileKey` — DS Figma 파일 키 (지금 첫 검증 프로젝트의 키 하드코딩 → 입력)
|
|
9
|
+
- `tokenRef` — 토큰 레퍼런스 JSON 경로 (아래 추출기가 생성; 지금 첫 검증 프로젝트의 토큰 JSON 하드코딩 → 생성물)
|
|
10
|
+
- `shell` — 시안 규율 설정: 뷰포트(기본 1920×1080), 셸 컴포넌트 이름들(예: side-nav·gnb-wrap — 지금 첫 검증 프로젝트의 셸 이름 하드코딩 → 설정)
|
|
11
11
|
- `structuralPxAllow` — 토큰 없는 구조 수치 예외 목록(예: 보더 1px·포커스 링 2px·컨트롤 글리프 치수). size 토큰에서 유도되는 값은 자동, 나머지는 이 목록(지금 숫자 하드코딩 → 설정)
|
|
12
12
|
- 화면별: `screenSpec`(앵커 목록)·`mockupFileKey`+`frameId`·`codePath`
|
|
13
13
|
|
|
@@ -21,22 +21,22 @@
|
|
|
21
21
|
## 3. 검사별 변경 (하드코딩 제거)
|
|
22
22
|
- **Check 1 (진짜 DS인가):** 파일 키 → 입력. "인터랙티브 컴포넌트/필요 상태"의 그 17개 → **DS에서 탐지**(상태 variant 축을 가진 컴포넌트 세트를 찾음; 못 찾으면 설정으로 보완). 토큰 타입 존재·바인딩%·elevation·raw 분류 로직은 그대로.
|
|
23
23
|
- **Check 2 (시안 vs 명세·DS):** 토큰 레퍼런스 → 디스크립터에서 로드(하드코딩 ref 제거). 셸/뷰포트 기대 → `shell` 설정. 앵커 → `screenSpec`(이미 입력). bound-vs-authored 분류·인스턴스 내부 traversal 보존.
|
|
24
|
-
- **Check 3 (코드 vs DS·시안):** 토큰 값 → 디스크립터 ref와 대조(
|
|
24
|
+
- **Check 3 (코드 vs DS·시안):** 토큰 값 → 디스크립터 ref와 대조(첫 검증 프로젝트 값 하드코딩 제거). px 예외 → size 토큰에서 유도 + `structuralPxAllow`(숫자 하드코딩 제거). 앵커 → `screenSpec`.
|
|
25
25
|
- **verify.js:** 프로젝트 설정 하나를 받아 3검사 + 자가검증을 오케스트레이션.
|
|
26
26
|
|
|
27
27
|
## 4. 반드시 보존 (일반화하다 잃지 말 것)
|
|
28
28
|
- 인스턴스 **내부까지 전체 traversal** + node-id 디듀프 (그 버그 다시 만들지 말 것).
|
|
29
29
|
- raw를 **bound vs (인스턴스 내부 / 화면-작성)** 으로 분류 — 화면-작성분만 위반.
|
|
30
|
-
- 자가검증 5종(토큰 일치·화면작성 하드코딩 0·앵커 verbatim·날조 0·dsRawMatchesIndependent[raw==독립 스캔 AND 인스턴스내부>0]). 단, "known-good 기준값"은 **해당 프로젝트의 검증된 런**을 가리키게(
|
|
30
|
+
- 자가검증 5종(토큰 일치·화면작성 하드코딩 0·앵커 verbatim·날조 0·dsRawMatchesIndependent[raw==독립 스캔 AND 인스턴스내부>0]). 단, "known-good 기준값"은 **해당 프로젝트의 검증된 런**을 가리키게(첫 검증 프로젝트의 DS·Run1·Run2 고정값이 아니라 설정에서).
|
|
31
31
|
|
|
32
32
|
## 5. 일반화 자체의 검증 (필수 — 안 깨졌는지)
|
|
33
|
-
일반화 후
|
|
34
|
-
- Check 1(
|
|
33
|
+
일반화 후 **첫 검증 프로젝트의 DS·Run1·Run2를 "그냥 한 프로젝트 입력"으로 넣어** 돌렸을 때, 이미 손·검사기로 확정한 숫자를 **그대로 재현**해야 한다:
|
|
34
|
+
- Check 1(첫 검증 프로젝트의 DS) PASS: 상태 17/17 · elevation 1 · 컴포넌트 raw 0 · 인스턴스내부 16,603 스캔
|
|
35
35
|
- Run1 Check 2/3 PASS, Run2 Check 2/3 PASS (토큰 72/72 · hex 0 · 앵커 · 날조 0 · 화면작성 raw 0)
|
|
36
36
|
재현되면 일반화가 기존 동작을 안 깬 것. 다르면 일반화 버그 → 고친다. (리뷰어가 이 재현을 확인.)
|
|
37
37
|
|
|
38
38
|
## 6. 범위 밖 (gold-plating 금지)
|
|
39
|
-
- 비-Figma DS, 다중 토큰 포맷, CLI 미화 등은 안 함. "
|
|
39
|
+
- 비-Figma DS, 다중 토큰 포맷, CLI 미화 등은 안 함. "첫 검증 프로젝트의 DS 같은 Figma DS를 입력으로" 받는 최소 일반화까지만.
|
|
40
40
|
- 캔버스/그래프형 화면 검사는 별도(명세·빌드 모델 필요) — 이번 범위 아님.
|
|
41
41
|
|
|
42
42
|
## 끝나면
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
# smoke-fixture — runnable Node-plumbing check
|
|
2
2
|
|
|
3
3
|
A tiny, self-contained project that exercises the **Node** side of dsforge (`check3` and `verify`)
|
|
4
|
-
**without Figma**.
|
|
5
|
-
|
|
6
|
-
so the checks actually run. Use it to confirm the harness's plumbing works after install.
|
|
4
|
+
**without Figma**. Every path in this fixture resolves inside this folder, so the checks actually run.
|
|
5
|
+
Use it to confirm the harness's plumbing works after install.
|
|
7
6
|
|
|
8
7
|
## Layout
|
|
9
8
|
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_note": "Self-contained smoke fixture.
|
|
2
|
+
"_note": "Self-contained smoke fixture. Every path here resolves inside this folder, so the Node checks actually run. From this folder: `npx dsforge check3 smoke main` and `npx dsforge verify smoke`.",
|
|
3
3
|
"project": "smoke",
|
|
4
4
|
"ds": { "fileKey": "SMOKE", "name": "Smoke Fixture DS" },
|
|
5
5
|
"tokenRef": "validators/out/smoke-tokens.json",
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Check-layout — objective layout-breakage audit (generic, run via Figma MCP use_figma on a mockup frame).
|
|
3
3
|
* use_figma({ fileKey: <screen.mockup.fileKey>, skillNames: "figma-use", code: <this body> })
|
|
4
|
-
* CFG (top)
|
|
4
|
+
* CFG (top) — filled from the project descriptor (validators/projects/<project>.json), like check2:
|
|
5
|
+
* screenFrameId ← screens.<screen>.mockup.frameId · spacingMax ← shell · overlayRe ← shell.
|
|
6
|
+
* Replace the '0:0' placeholder with the screen's real frame id per run (don't hand-tune otherwise).
|
|
5
7
|
* READ-ONLY. Returns { hardFails:[], advisories:[] }.
|
|
6
8
|
*
|
|
7
9
|
* This catches the FLOOR of visual quality — objective breakage only. It does NOT judge aesthetics
|
|
@@ -9,12 +11,13 @@
|
|
|
9
11
|
* entering the visual gate, never a substitute for it.
|
|
10
12
|
*
|
|
11
13
|
* HARD FAIL (must be 0): textClip · outOfFrame · overlap · missingAutoLayout · junkFrame · textTruncateSetting
|
|
12
|
-
* ADVISORY (review): largeGap · overlayAnchorUnclear
|
|
14
|
+
* ADVISORY (review): largeGap · overlayAnchorUnclear · nestedSameFill
|
|
13
15
|
*/
|
|
16
|
+
// Fill from the descriptor (validators/projects/<project>.json) — these are not constants to hand-tune:
|
|
14
17
|
const CFG = {
|
|
15
|
-
screenFrameId: '0:0',
|
|
16
|
-
spacingMax: 64, // largest spacing token (px); largeGap advisory = gap > spacingMax*3
|
|
17
|
-
overlayRe: '(^|[ _-])(action-menu|context-menu|row-action-menu|dropdown|popover|tooltip|overlay|modal|toast)',
|
|
18
|
+
screenFrameId: '0:0', // ← screens.<screen>.mockup.frameId (replace this placeholder per screen)
|
|
19
|
+
spacingMax: 64, // ← shell.spacingMax: largest spacing token (px); largeGap advisory = gap > spacingMax*3
|
|
20
|
+
overlayRe: '(^|[ _-])(action-menu|context-menu|row-action-menu|dropdown|popover|tooltip|overlay|modal|toast)', // ← shell overlay name pattern
|
|
18
21
|
};
|
|
19
22
|
figma.skipInvisibleInstanceChildren = true; // skip hidden interior layers — DS components park hidden internals off-frame (false outOfFrame); visible TEXT inside instances is still traversed (label clipping lives there too)
|
|
20
23
|
const TOL = 2;
|
|
@@ -57,8 +60,12 @@ for (const n of authored) {
|
|
|
57
60
|
const defName = /^Frame(\s*\d+)?$/i.test(n.name || '');
|
|
58
61
|
if (defName || def100 || (kids.length === 0 && fillEmpty && !isFill)) hardFails.push({ type: 'junkFrame', node: n.name, id: n.id, w: Math.round(n.width), h: Math.round(n.height), children: kids.length });
|
|
59
62
|
}
|
|
60
|
-
// overlap among
|
|
61
|
-
|
|
63
|
+
// overlap among siblings — checked inside the screen frame itself (P2-1: its direct children are excluded from
|
|
64
|
+
// `all`/authored, so top-level region overlaps were a false-negative) and inside authored FRAMEs. INSTANCEs are
|
|
65
|
+
// treated as leaves (P1-2: their interiors are the DS's responsibility, audited by check1 — not a screen
|
|
66
|
+
// overlap). Intended overlays / absolute-positioned excluded.
|
|
67
|
+
const overlapParents = [screen, ...authored.filter((n) => n.type === 'FRAME')];
|
|
68
|
+
for (const n of overlapParents) {
|
|
62
69
|
const kids = (n.children || []).filter((c) => !isOverlay(c));
|
|
63
70
|
for (let i = 0; i < kids.length; i++) for (let j = i + 1; j < kids.length; j++) { const a = bb(kids[i]), b = bb(kids[j]); if (a && b && inter(a, b) > 4) hardFails.push({ type: 'overlap', a: kids[i].name, b: kids[j].name, parent: n.name }); }
|
|
64
71
|
}
|
|
@@ -78,4 +85,40 @@ for (const n of all) {
|
|
|
78
85
|
if (!near && ov.test(n.name || '')) advisories.push({ type: 'overlayAnchorUnclear', node: n.name, id: n.id });
|
|
79
86
|
}
|
|
80
87
|
|
|
88
|
+
// nestedSameFill (P7) — ADVISORY (not a hardFail): an authored node re-painting the SAME opaque surface fill
|
|
89
|
+
// as its nearest ancestor surface (white-on-white). It's a redundant-surface signal for review, not a gate:
|
|
90
|
+
// some same-fill repaints (inset full-area body bgs, surface-in-surface) are discipline-true but visually
|
|
91
|
+
// harmless, and no geometric rule cleanly separates those from real defects — so it informs, never blocks.
|
|
92
|
+
// The full geometric carve-out below only TRIMS obvious noise (it is not, and need not be, complete):
|
|
93
|
+
// only same-colour repaint is considered; a *different* opaque fill (white block over an #EEF2FF card) is left
|
|
94
|
+
// to the discipline. EXEMPT from the advisory: real raised cards (border/shadow), and full-bleed background
|
|
95
|
+
// layers spanning at least one FULL axis of the surface beneath them (a body bg inset only by a sidebar/topbar
|
|
96
|
+
// still spans the other axis). Authored-only (instance interiors are check1's job); TEXT/overlays/hidden excluded.
|
|
97
|
+
const solidFillKey = (n) => {
|
|
98
|
+
if (!Array.isArray(n.fills)) return null;
|
|
99
|
+
if (n.opacity != null && n.opacity < 0.999) return null;
|
|
100
|
+
const f = n.fills.find((p) => p && p.visible !== false && p.type === 'SOLID' && (p.opacity == null || p.opacity >= 0.999) && p.color);
|
|
101
|
+
if (!f) return null; const c = f.color;
|
|
102
|
+
return Math.round(c.r * 255) + ',' + Math.round(c.g * 255) + ',' + Math.round(c.b * 255);
|
|
103
|
+
};
|
|
104
|
+
// a real raised surface is distinguished by a border or a shadow; if so it may legitimately share the page's
|
|
105
|
+
// fill, so it is NOT a redundant repaint. Only edgeless same-fill nodes (layout wrappers) are flagged.
|
|
106
|
+
const hasEdge = (n) => (Array.isArray(n.strokes) && n.strokes.some((s) => s && s.visible !== false)) ||
|
|
107
|
+
(Array.isArray(n.effects) && n.effects.some((e) => e && e.visible !== false && /SHADOW/.test(e.type || '')));
|
|
108
|
+
// a full-bleed background layer fills the same-coloured surface beneath it on at least one FULL axis
|
|
109
|
+
// (edge-to-edge within TOL) — it IS that surface's background (e.g. a body bg inset only by a sidebar/topbar
|
|
110
|
+
// still spans the other axis), not a stacked sub-region. A gap-making sub-region spans NEITHER axis → flag.
|
|
111
|
+
const spansFullAxis = (c, a) => !!c && !!a && (
|
|
112
|
+
(Math.abs(c.x - a.x) <= TOL && Math.abs((c.x + c.width) - (a.x + a.width)) <= TOL) ||
|
|
113
|
+
(Math.abs(c.y - a.y) <= TOL && Math.abs((c.y + c.height) - (a.y + a.height)) <= TOL));
|
|
114
|
+
for (const n of all) {
|
|
115
|
+
if (n.type === 'TEXT' || isOverlay(n) || hidden(n) || inInstance(n)) continue;
|
|
116
|
+
const key = solidFillKey(n); if (!key || hasEdge(n)) continue;
|
|
117
|
+
let p = n.parent, anc = null;
|
|
118
|
+
while (p) { const k = solidFillKey(p); if (k) { anc = { node: p, key: k }; break; } if (p.id === CFG.screenFrameId) break; p = p.parent; }
|
|
119
|
+
if (!anc || anc.key !== key) continue;
|
|
120
|
+
if (spansFullAxis(bb(n), bb(anc.node))) continue; // full-bleed background over the same surface — exempt
|
|
121
|
+
advisories.push({ type: 'nestedSameFill', node: n.name, id: n.id, fill: key, parentSurface: anc.node.name });
|
|
122
|
+
}
|
|
123
|
+
|
|
81
124
|
return { screen: CFG.screenFrameId, hardFails, advisories, hardFailCount: hardFails.length, advisoryCount: advisories.length };
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
const CFG = {
|
|
10
10
|
screenFrameId: '315:170',
|
|
11
11
|
anchors: {
|
|
12
|
-
breadcrumb: ['
|
|
13
|
-
toolbar: ['
|
|
14
|
-
menu: ['
|
|
15
|
-
pagination: ['
|
|
12
|
+
breadcrumb: ['<breadcrumb item>'], title: ['<page title>'], caption: ['제안'],
|
|
13
|
+
toolbar: ['<toolbar label>'], columns: ['<column header>'],
|
|
14
|
+
menu: ['<row action>'],
|
|
15
|
+
pagination: ['<pagination label>'],
|
|
16
16
|
},
|
|
17
17
|
menuNodePrefix: 'row-action-menu', menuAnchorGroup: 'menu',
|
|
18
18
|
shellComponentNames: ['side-nav', 'gnb'], viewport: { w: 1920, h: 1080 },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Check 3 — code audit (generic, config-driven). Node.
|
|
3
|
-
* node validators/check3.js <project> <screen> (cwd = Poc/) e.g.
|
|
3
|
+
* node validators/check3.js <project> <screen> (cwd = Poc/) e.g. smoke main
|
|
4
4
|
* Reads validators/projects/<project>.json (DS descriptor). No project constants here.
|
|
5
5
|
* - Token compare: code token CSS vs generated tokenRef (color/float/text) via naming map
|
|
6
6
|
* - Hardcode scan: screen code files for hex / px not via token
|
|
@@ -87,10 +87,33 @@ if (sizeBindings.length) {
|
|
|
87
87
|
sizeFidelity = { applicable: true, total: sizeBindings.length, ok: sizeBindings.length - violations.length, violations };
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
// ---- icon/vector asset fidelity (P3a) — opt-in via descriptor `iconAssets` (Branch A only) ----
|
|
91
|
+
// Each declared icon slot selector must carry a real <svg> (not an empty placeholder box), and the inline SVG
|
|
92
|
+
// source files must contain no raw hex (currentColor / token var() only). Branch B has no DS to export from,
|
|
93
|
+
// so it declares no iconAssets and the pass stays inapplicable.
|
|
94
|
+
const ia = cfg.iconAssets;
|
|
95
|
+
let iconAssets = { applicable: false };
|
|
96
|
+
if (ia && Array.isArray(ia.selectors) && ia.selectors.length) {
|
|
97
|
+
const esc = (s) => s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
98
|
+
const codeBlob = (screen.code.files || []).map((f) => { try { return read(path.join(codeDir, f)); } catch (e) { return ''; } }).join('\n');
|
|
99
|
+
const placeholderSlots = [];
|
|
100
|
+
for (const sel of ia.selectors) {
|
|
101
|
+
const cls = sel.replace(/^\./, '');
|
|
102
|
+
// an empty self-closing element carrying the class = still a placeholder box (not replaced by an asset)
|
|
103
|
+
if (new RegExp('<(?:div|span)\\b[^>]*\\b' + esc(cls) + '\\b[^>]*/>', 'i').test(codeBlob)) placeholderSlots.push(sel);
|
|
104
|
+
}
|
|
105
|
+
const svgFiles = [...new Set([...(ia.files || []), ...((screen.code.files) || [])])];
|
|
106
|
+
const svgBlob = svgFiles.map((f) => { try { return read(path.join(codeDir, f)); } catch (e) { return ''; } }).join('\n');
|
|
107
|
+
const rawHexInSvg = [];
|
|
108
|
+
for (const m of svgBlob.matchAll(/<svg[\s\S]*?<\/svg>/gi)) for (const h of (m[0].match(/#[0-9a-fA-F]{3,8}\b/g) || [])) rawHexInSvg.push(h);
|
|
109
|
+
iconAssets = { applicable: true, selectors: ia.selectors.length, placeholderSlots, rawHexInSvg: [...new Set(rawHexInSvg)] };
|
|
110
|
+
}
|
|
111
|
+
|
|
90
112
|
console.log(JSON.stringify({
|
|
91
113
|
project, screen: screenKey,
|
|
92
114
|
tokenCompare: { match: tok.match, total: tok.total, pct: +((tok.match / tok.total) * 100).toFixed(1), mismatch: tok.mismatch, missing: tok.missing },
|
|
93
115
|
hardcode: { hexCount: hexHits.length, hexLiterals: hexHits, pxViolationCount: pxViolations.length, pxViolations, declaredColorLiterals: colorLiterals },
|
|
94
116
|
content,
|
|
95
117
|
sizeFidelity,
|
|
118
|
+
iconAssets,
|
|
96
119
|
}, null, 2));
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* use_figma({ fileKey: <dsFileKey>, skillNames: "figma-use", code: <this body> })
|
|
4
4
|
* Reads local Variables(COLOR/FLOAT) + Text Styles + Effect Styles → tokenRef JSON.
|
|
5
5
|
* No project constants — works on any Figma DS. Save the return value to the path
|
|
6
|
-
* named by the project descriptor's `tokenRef`. (Replaces hardcoded
|
|
6
|
+
* named by the project descriptor's `tokenRef`. (Replaces the first validation project's hardcoded tokens JSON.)
|
|
7
7
|
*/
|
|
8
8
|
const H = (x) => Math.round(Math.max(0, Math.min(1, x)) * 255).toString(16).padStart(2, '0');
|
|
9
9
|
const vars = await figma.variables.getLocalVariablesAsync();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_README": "Copy this to validators/projects/<project>.json and fill in. <...> are placeholders.
|
|
2
|
+
"_README": "Copy this to validators/projects/<project>.json and fill in. <...> are placeholders. references/examples/smoke-fixture/validators/projects/smoke.json is a small filled example.",
|
|
3
3
|
"project": "<PROJECT_NAME>",
|
|
4
4
|
"ds": { "fileKey": "<TARGET_DS_FIGMA_FILE_KEY>", "name": "<DS display name>" },
|
|
5
5
|
"tokenRef": "validators/out/<project>-tokens.json",
|
|
@@ -39,11 +39,14 @@
|
|
|
39
39
|
"_sizeBindings_note": "OPTIONAL (P4). Each bound element's dim must be height: var(--<ds>-size-<token>) + box-sizing:border-box, else check3 flags drift. Omit to skip the check.",
|
|
40
40
|
"recall": { "maxNonSpecOverlap": 0.5 },
|
|
41
41
|
"_recall_note": "OPTIONAL (P5). Threshold for check-recall.js: fail when a from-scratch screen's non-spec content overlap with a prior screen exceeds this.",
|
|
42
|
+
"iconAssets": { "selectors": ["<.icon-slot-class>"], "files": ["<file(s) holding the inline SVG, e.g. components/icons.tsx>"] },
|
|
43
|
+
"_iconAssets_note": "OPTIONAL (P3a, Branch A only). check3 requires each icon slot to carry a real <svg> (not an empty placeholder box) with zero raw hex (currentColor / token var only). Omit for from-scratch (Branch B): icons stay manual placeholders.",
|
|
42
44
|
"selfVerify": { "tokensTotal": "<total token count expected>", "dsRaw": 0 },
|
|
43
45
|
"screens": {
|
|
44
46
|
"<screenKey>": {
|
|
45
47
|
"label": "<human label>",
|
|
46
48
|
"mockup": { "fileKey": "<working figma file key>", "frameId": "<frame node id>" },
|
|
49
|
+
"_mockup_note": "mockup.frameId is the screen frame. Paste it into the use_figma CFG.screenFrameId for check2.js and check-layout.js (replacing their '0:0' placeholder); fileKey is the use_figma fileKey.",
|
|
47
50
|
"designAnchors": {
|
|
48
51
|
"_note": "Verbatim spec content that MUST appear in the mockup. Grouped freely.",
|
|
49
52
|
"breadcrumb": ["..."], "title": ["..."]
|