web-stylebook-mcp 0.12.1 → 0.14.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.
Files changed (60) hide show
  1. package/README.ko.md +124 -8
  2. package/README.md +124 -8
  3. package/dist/audit/planner.d.ts +14 -2
  4. package/dist/audit/planner.js +61 -6
  5. package/dist/audit/planner.js.map +1 -1
  6. package/dist/catalog/validate.js +5 -1
  7. package/dist/catalog/validate.js.map +1 -1
  8. package/dist/protocol/register-prompts.js +4 -2
  9. package/dist/protocol/register-prompts.js.map +1 -1
  10. package/dist/protocol/register-resources.js +46 -1
  11. package/dist/protocol/register-resources.js.map +1 -1
  12. package/dist/protocol/register-tools.js +112 -12
  13. package/dist/protocol/register-tools.js.map +1 -1
  14. package/dist/recommendation/index.d.ts +3 -3
  15. package/dist/recommendation/index.js +5 -1
  16. package/dist/recommendation/index.js.map +1 -1
  17. package/dist/recommendation/types.d.ts +8 -0
  18. package/dist/server-info.d.ts +2 -2
  19. package/dist/server-info.js +4 -3
  20. package/dist/server-info.js.map +1 -1
  21. package/dist/structure/audit.d.ts +27 -2
  22. package/dist/structure/audit.js +142 -4
  23. package/dist/structure/audit.js.map +1 -1
  24. package/dist/structure/checks.d.ts +7 -4
  25. package/dist/structure/checks.js +23 -2
  26. package/dist/structure/checks.js.map +1 -1
  27. package/dist/structure/detect.d.ts +7 -0
  28. package/dist/structure/detect.js +3 -2
  29. package/dist/structure/detect.js.map +1 -1
  30. package/dist/structure/dom/page.d.ts +5 -0
  31. package/dist/structure/dom/page.js +1 -1
  32. package/dist/structure/dom/page.js.map +1 -1
  33. package/dist/structure/guidance.d.ts +10 -2
  34. package/dist/structure/guidance.js +7 -1
  35. package/dist/structure/guidance.js.map +1 -1
  36. package/dist/structure/must-have-detect.d.ts +30 -0
  37. package/dist/structure/must-have-detect.js +320 -0
  38. package/dist/structure/must-have-detect.js.map +1 -0
  39. package/dist/structure/must-haves.d.ts +99 -0
  40. package/dist/structure/must-haves.js +412 -0
  41. package/dist/structure/must-haves.js.map +1 -0
  42. package/dist/structure/revisions.d.ts +152 -0
  43. package/dist/structure/revisions.js +657 -0
  44. package/dist/structure/revisions.js.map +1 -0
  45. package/dist/structure/validate.d.ts +6 -0
  46. package/dist/structure/validate.js +51 -0
  47. package/dist/structure/validate.js.map +1 -1
  48. package/dist/tokens/compile.d.ts +19 -2
  49. package/dist/tokens/compile.js +17 -2
  50. package/dist/tokens/compile.js.map +1 -1
  51. package/dist/tokens/design-md.d.ts +30 -0
  52. package/dist/tokens/design-md.js +517 -0
  53. package/dist/tokens/design-md.js.map +1 -0
  54. package/dist/tokens/yaml.d.ts +4 -0
  55. package/dist/tokens/yaml.js +40 -0
  56. package/dist/tokens/yaml.js.map +1 -0
  57. package/package.json +1 -1
  58. package/skill/AGENTS.md +15 -5
  59. package/skill/CLAUDE.md +15 -5
  60. package/skill/web-stylebook-design/SKILL.md +29 -4
package/README.ko.md CHANGED
@@ -159,6 +159,67 @@ API 키 없음. 모델 호출 없음. 네트워크 없음. 프로젝트 파일
159
159
 
160
160
  발견 항목마다 위치, 관찰값, 그리고 그 자리에 대신 넣을 것을 알려 줍니다. 대신 넣을 것은 고른 스타일에서 같은 역할을 하는 시그니처 무브(로고 띠라면 근거 역할), 히어로 구성, 섹션 순서입니다. 다시 빌드하고 감사를 한 번 더 돌린 뒤, `get_design_audit_plan.includeGroups`에 `"structure"`를 넣고 돌려받은 `evidence`와 `results`를 `validate_design_audit_result`에 넘기세요. 뷰포트마다 다른 `targetId`로 감사하세요. 증거 id에 `targetId`가 들어가므로 여러 실행 결과를 함께 검증할 수 있습니다. 이 검사는 브라우저 렌더링이 아니라 제출한 HTML과 CSS에 대한 결정적 휴리스틱입니다. `clean`은 모든 검사가 실행되었고 이 패턴들을 찾지 못했다는 뜻이지, 디자인이 통과했다는 뜻이 아닙니다. 스타일별 지침(아키타입과 무브)은 카탈로그의 `layout`·`typography` 필드처럼 영어로 작성되어 있고, 패턴 이름과 안내 문장은 `locale`을 따릅니다.
161
161
 
162
+ ### 스타일이 뺄 수 없는 필수 요소
163
+
164
+ 디자인 방향 때문에 페이지가 제 기능을 잃으면 안 됩니다. 보류된 쇼케이스 실험(#7)에서 MCP로 만든 럭셔리 스킨케어 페이지는 첫 화면에 구매 버튼 하나만 남겼습니다. 대조군 페이지는 용량, 하룻밤 기준 가격, 장바구니 담기, 배송·보증 안내를 보여 줬습니다. 그래서 `recommend_design_direction`은 `mustHaves`도 반환합니다. 판단한 제품 유형에 꼭 필요한 요소와 각 요소가 있어야 할 위치(zone)입니다. 스타일은 이 요소의 모양을 바꿀 수 있지만, 빼거나 정해진 위치 밖으로 옮기면 안 됩니다. 이 요소는 첫 화면에 대한 아키타입의 제한("행동 하나, 짧은 문장 하나")보다 우선합니다. 첫 화면 항목은 모두 히어로에 넣으세요. 후보마다 `structure.mustHaves`가 같은 역할을 하는 그 스타일의 시그니처 무브를 알려 줍니다. 예를 들어 배송·보증 안내를 담을 수 있는 근거 무브입니다.
165
+
166
+ | 제품 유형 | 페이지 | 첫 화면 | 페이지 어디든 |
167
+ |---|---|---|---|
168
+ | `operational-saas` | 메인 대시보드 | 현재 상태 (`current-status`), 변경 사항 (`recent-changes`) | — |
169
+ | `developer-tool` | 제품 랜딩 페이지 | 코드 예시 (`code-sample`), 문서 링크 (`docs-link`) | — |
170
+ | `documentation` | 문서 홈 | 검색 (`search`), 빠른 시작 (`quickstart`) | — |
171
+ | `data-analytics` | 분석 대시보드 | 현재 상태 (`current-status`), 변경 사항 (`recent-changes`), 기간 (`time-range`) | — |
172
+ | `security-console` | 보안 개요 화면 | 현재 상태 (`current-status`), 변경 사항 (`recent-changes`) | — |
173
+ | `finance-admin` | 재무 개요 화면 | 현재 상태 (`current-status`), 변경 사항 (`recent-changes`) | — |
174
+ | `healthcare-portal` | 포털 홈 | 주요 행동 (`primary-cta`) | 연락 방법 (`contact`), 개인정보 안내 (`privacy-notice`) |
175
+ | `commerce` | 상품 상세 페이지 | 가격 (`price`), 옵션 선택 (`variant-choice`), 장바구니 담기 (`add-to-cart`), 배송·보증 안내 (`purchase-assurance`) | — |
176
+ | `ai-chat` | 대화 화면 | 메시지 입력창 (`composer`) | AI 한계 안내 (`ai-limits`) |
177
+ | `content-editorial` | 기사 페이지 | 작성자 (`author`), 발행일 (`publish-date`) | — |
178
+ | `knowledge-base` | 도움말 센터 홈 | 검색 (`search`) | 주제별 목록 (`topic-index`) |
179
+ | `portfolio` | 포트폴리오 홈 | — | 작업 예시 (`work-samples`), 연락 방법 (`contact`) |
180
+ | `campaign` | 랜딩 페이지 | 주요 행동 (`primary-cta`) | 근거 (`proof`) |
181
+ | `consumer-app` | 앱 랜딩 페이지 | 주요 행동 (`primary-cta`) | 근거 (`proof`) |
182
+
183
+ 첫 화면은 첫 섹션(페이지의 `h1`이 있는 섹션)의 끝까지입니다. 지금까지의 섹션이 모두 짧으면 뒤따르는 섹션을 2개까지 더 넣습니다. 짧은 섹션은 40단어 이하이고, 이미지·비디오·표·큰 SVG가 없고, 화면을 채우는 높이를 선언하지 않은 섹션입니다. 사이트 헤더는 첫 화면에 들어가고, 푸터는 들어가지 않습니다. 제품 유형을 받지도 추론하지도 못한 설명은 `other`가 됩니다. `other`에는 목록이 없고, 결과는 목록을 지어내지 않고 그 사실을 알립니다. 모든 판단 기준은 `webstylebook://structure/must-haves`에 있습니다.
184
+
185
+ 같은 `productType`을 `audit_page_structure`에 넘기면, 빌드한 페이지에서 빠진 필수 요소를 알려 줍니다. 아래는 쇼케이스의 실패 사례를 fixture로 다시 만든 페이지([`commerce-buy-button-only.html`](https://github.com/seungdori/web-stylebook-mcp/blob/master/tests/fixtures/must-haves/commerce-buy-button-only.html))의 실제 출력입니다.
186
+
187
+ ```jsonc
188
+ // → audit_page_structure({ html, styleId: "midnight-noir", productType: "commerce", locale: "ko" })
189
+ // ← 필수 요소 감사 결과 (일부)
190
+ {
191
+ "mustHaves": {
192
+ "productType": "commerce",
193
+ "page": "상품 상세 페이지",
194
+ "missing": [],
195
+ "misplaced": ["price", "variant-choice", "purchase-assurance"],
196
+ "items": [
197
+ { "id": "price", "checkId": "structure-must-have-price", "zone": "first-screen", "status": "misplaced", "count": 1,
198
+ "locations": ["section#buy > div > p.price:nth-of-type(1)"] },
199
+ { "id": "add-to-cart", "checkId": "structure-must-have-add-to-cart", "zone": "first-screen", "status": "present", "count": 1,
200
+ "locations": ["body > main > section.masthead:nth-of-type(1) > div > a.button"] }
201
+ // 나머지 2개: variant-choice, purchase-assurance
202
+ ]
203
+ },
204
+ "findings": [
205
+ {
206
+ "patternId": "must-have/price",
207
+ "scope": "must-have",
208
+ "severity": "major",
209
+ "observed": { "status": "misplaced", "zone": "first-screen", "found": 1, "inZone": 0 },
210
+ "replaceWith": {
211
+ "instruction": "첫 화면으로 옮기세요. 검사에서는 페이지 더 아래에서만 찾았습니다. 상품명 옆에 통화와 함께 가격을 보여 주세요. 용량마다 가격이 다르면 고른 용량의 가격을 보여 주세요.",
212
+ "moves": [],
213
+ "archetype": { "hero": "Left-heavy and low: a 1.7fr/1fr grid with align-items: end …" }
214
+ }
215
+ }
216
+ // 나머지 2개: must-have/variant-choice, must-have/purchase-assurance
217
+ ]
218
+ }
219
+ ```
220
+
221
+ 필수 요소의 상태는 `present`(있음), `missing`(없음), `misplaced`(페이지에는 있지만 첫 화면에는 없음), `not-verified`(확인 못 함) 중 하나입니다. `not-verified`는 스타일시트가 선택자 한도를 넘었거나, 페이지 끝까지 분석하지 못했거나, 첫 화면을 정할 섹션이 없을 때입니다. 필수 요소마다 `structure-must-have-<id>` 검사도 있습니다. `get_design_audit_plan`에 `structure` 그룹과 `productType`을 함께 넘기면, 감사가 돌려준 evidence와 results를 그대로 검증할 수 있습니다. 탐지는 마크업, ARIA role, 영어·한국어·일본어로 된 보이는 텍스트를 읽습니다. 숨긴 요소(`hidden`, `display: none`, 시각적으로 숨긴 `sr-only` 상자, `aria-hidden="true"`)는 세지 않습니다. 기본 컨트롤은 안정적으로 찾습니다. 옵션은 `select`나 라디오 그룹, 검색은 `input type="search"`, 날짜는 `time` 요소를 쓰세요.
222
+
162
223
  ## 에이전트가 이걸로 만든 결과물
163
224
 
164
225
  다른 브리프 — *"흩어진 고객 피드백(지원 티켓, 세일즈 콜, 앱 리뷰, 슬랙)을 하나의 우선순위 로드맵으로 정리해주는 B2B SaaS **Throughline**의 마케팅 랜딩."* 레이아웃도, 히어로도, 스타일도 지정하지 않았습니다. 동반 스킬을 따라 에이전트는 스톡 히어로로 도망치는 대신 **제품의 핵심 아이디어에서** 첫 화면을 구성했습니다 — 오른쪽 절반은 다른 사이트에 복붙할 수 있는 장식 카드가 아니라, 제품의 실제 메커니즘(피드백 소스가 모여 자동 랭킹된 로드맵이 되는)을 그린 맞춤 다이어그램입니다.
@@ -188,7 +249,7 @@ flowchart LR
188
249
  C --> N[audit_page_structure]
189
250
  D & E & F & G & H & I & J & K & L -->|디자인 계약<br/>관찰 · 점수 · 사유<br/>배치 · 증거 · 토큰 · 구조| A
190
251
  A -->|빌드한 페이지 HTML · CSS| N
191
- N -->|금지 패턴 · 대체 무브<br/>구조 검사용 증거| A
252
+ N -->|금지 패턴 · 대체 무브<br/>빠진 필수 요소<br/>구조 검사용 증거| A
192
253
  A -->|대상 행렬 · 증거 참조<br/>검사/대상별 판정| M
193
254
  M -->|범위 · 정규화 판정<br/>plan/evidence/result hash| A
194
255
  A -->|근거로<br/>코드 작성| Z[당신의 UI]
@@ -275,21 +336,22 @@ MCP 설정에 추가:
275
336
 
276
337
  | 툴 | 받는 것 | 정직한 점 |
277
338
  |------|--------------|-----------------|
278
- | **`recommend_design_direction`** | 사유 코드가 붙은 점수화 스타일 후보, 1위가 2위를 이긴 이유(또는 동점)를 알리는 `ranking`, *이유*가 붙은 **탈락** 스타일, 보조 페어링, 신뢰도, 후보별 페이지 `structure` | 최종 선택은 모델이 — 이건 근거 제공자입니다 |
339
+ | **`recommend_design_direction`** | 사유 코드가 붙은 점수화 스타일 후보, 1위가 2위를 이긴 이유(또는 동점)를 알리는 `ranking`, *이유*가 붙은 **탈락** 스타일, 보조 페어링, 신뢰도, 후보별 페이지 `structure`, 제품 유형의 필수 요소와 각 위치를 담은 `mustHaves` | 최종 선택은 모델이 — 이건 근거 제공자입니다 |
279
340
  | **`compare_design_directions`** | 2~4개 방향을 제품 적합성·반복 사용·밀도·신뢰·차별성·접근성 리스크·모션·유지보수로 비교 | 정답 하나를 선언하지 않습니다 |
280
341
  | **`search_design_references`** | 실제 디자인 레퍼런스를 텍스트·카테고리·태그로 제한 검색하고 간결한 다국어 관찰 결과 제공 | 스크린샷이나 브랜드 자산 복제가 아니라 출처가 붙은 연구 요약을 반환합니다 |
281
342
  | **`get_design_reference`** | 팔레트·레이아웃·인터랙션·모션 관찰, 정규화 토큰, 원본 리비전, 출처와 권리 고지를 포함한 레퍼런스 1건 | 원 사이트 카피·서체·스크린샷·시각 정체성의 권리는 각 권리자에게 있습니다 |
282
343
  | **`get_design_principle_plan`** | 시각적 관심사·화면·설계 단계·원칙 ID로 고른 배치/적용/검증 계획 — 가능한 경우 출처 링크 포함 | 제작 원칙은 경험 법칙이나 고정 레시피가 아니라 검증 가능한 점검 질문입니다 |
283
344
  | **`get_ux_principle_plan`** | 결과 목표·화면·설계 단계·원칙 ID로 고른 적용/검증 계획 — 질문·주의점·근거 신뢰도·참고 링크 포함 | 원칙은 보편 법칙이나 사용자 조사의 대체물이 아니라 맥락별 점검 질문입니다 |
284
345
  | **`get_ui_state_plan`** | 표면(데이터 테이블·폼·체크아웃·채팅·개발자 콘솔)의 필수/권장/도메인 UI 상태 — 트리거·표시 필수·금지·접근성·모션 | 에이전트가 잊는 상태까지: 빈·에러·로딩·엣지 |
285
- | **`compose_design_tokens`** | 역할 기반 토큰을 `json` / `css-variables` / `tailwind` / `typescript`로 출력하며, 공통 시각 명세를 선택하면 스타일 원본과 편집값을 보존 | 명세에 작성된 색상 모드를 사용하며, 명시적으로 수락한 대비 수정만 적용합니다 |
346
+ | **`compose_design_tokens`** | 역할 기반 토큰을 `json` / `css-variables` / `tailwind` / `typescript`로 출력하거나 `DESIGN.md` 파일 하나(`design-md`)로 내보내며, 공통 시각 명세를 선택하면 스타일 원본과 편집값을 보존 | 명세에 작성된 색상 모드를 사용하며, 명시적으로 수락한 대비 수정만 적용합니다 |
286
347
  | **`get_design_audit_plan`** | 안정적인 검사 ID·심각도·적용 조건·필요 증거·수정 방향·사용자용 콘텐츠 검사·선택 원칙 검사·UI 상태 범위를 담은 다국어 감사 계획 | 프로젝트를 실제로 봤다고 가장하지 않으며, 증거가 없으면 `PASS`가 아니라 `NOT_VERIFIED`입니다 |
287
348
  | **`validate_design_audit_result`** | plan query·대상 행렬·지속 가능한 증거 참조·검사/대상별 판정을 검증하고 정규화 판정과 안정 hash를 반환 | 범위와 증거 정합성을 검증할 뿐 시각 품질을 판정하지 않으며, `valid: true`는 전체 디자인 통과가 아닙니다 |
288
- | **`audit_page_structure`** | 넘겨받은 HTML·CSS에서 일반 금지 패턴과 스타일 전용 금지 항목을 찾아, 위치·관찰값·고른 스타일의 대체 무브와 함께 반환하고 `structure` 감사 그룹용 증거와 결과도 만듭니다 | 브라우저가 아니라 선언된 스타일로 판단하며, 결과가 깨끗해도 디자인 통과가 아닙니다 |
349
+ | **`audit_page_structure`** | 넘겨받은 HTML·CSS에서 일반 금지 패턴과 스타일 전용 금지 항목을 찾아, 위치·관찰값·고른 스타일의 대체 무브와 함께 반환합니다. `productType`을 주면 페이지에 없거나 첫 화면 밖에 있는 필수 요소도 알려 줍니다. `structure` 감사 그룹용 증거와 결과도 만듭니다 | 브라우저가 아니라 선언된 스타일로 판단하며, 결과가 깨끗해도 디자인 통과가 아닙니다 |
350
+ | **`compare_page_revisions`** | 리디자인 전후를 비교해 링크, 폼 필드와 라벨, 핸들러, 테스트 훅, 스크립트 선택자, 제목, 그림, 랜드마크, 보이는 단어 수, 제품 필수 요소 중 무엇을 유지·문구 변경·삭제했는지 알려 줍니다. 의도한 삭제는 `acknowledged`로 표시합니다. `revisionPreservation` 감사 계획용 증거와 결과도 만듭니다 | 브라우저가 아니라 정적 마크업 비교이며, 스크립트를 실행하거나 스크린샷을 남기지 않습니다 |
289
351
 
290
352
  **카탈로그:** 실제 디자인 레퍼런스 520 · 스타일 48 · 인터페이스 디자인 원칙 25 · UX 원칙 23 · 구조화 감사 검사 51 · 컴포넌트 20 · 표면 5 · UI 상태 레시피 57 · 모션 프로파일 29 · 제품 아키타입 14.
291
353
 
292
- **구조:** 레이아웃 아키타입 48 · 시그니처 무브 144 · 일반 금지 패턴 9 · 탐지기 19종으로 만든 스타일 전용 금지 항목 142.
354
+ **구조:** 레이아웃 아키타입 48 · 시그니처 무브 144 · 일반 금지 패턴 9 · 탐지기 19종으로 만든 스타일 전용 금지 항목 142 · 제품 유형 14개의 필수 요소 21종.
293
355
 
294
356
  레퍼런스 라이브러리는 [OpenDesign](https://opendesign.cc)의 완성도 높은 항목을 선별·수정한 데이터이며, 구조화 스펙은 [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)으로 제공됩니다. Web Stylebook은 원본 스크린샷과 브랜드 자산을 포함하지 않습니다. 원 사이트·브랜드·카피·서체·시각 정체성의 권리는 각 권리자에게 있으므로 사용 전 상세 항목의 출처와 권리 고지를 확인하세요.
295
357
 
@@ -318,6 +380,28 @@ MCP 설정에 추가:
318
380
 
319
381
  수정안을 수락할 때는 `light` 또는 `dark`를 각각 요청합니다. `both`는 모드별 제안만 반환하며, 수락한 수정안을 두 모드에 일괄 적용하지 않습니다.
320
382
 
383
+ ## DESIGN.md로 내보내기
384
+
385
+ `compose_design_tokens`에 `format: "design-md"`를 주면 고른 방향을 [DESIGN.md](https://github.com/google-labs-code/design.md) 파일(스펙 버전 `alpha`)로 돌려줍니다. 다른 에이전트와 도구가 이 파일을 읽을 수 있습니다. 서버는 파일을 쓰지 않습니다. `content`를 프로젝트에 `DESIGN.md`로 저장하세요.
386
+
387
+ ```json
388
+ {
389
+ "primaryStyleId": "brutalist-grid",
390
+ "format": "design-md",
391
+ "contract": { "schema": "webstylebook.visual.v1" },
392
+ "locale": "ko",
393
+ "designMd": { "tokenPlacement": "interleaved", "productType": "developer-tool" }
394
+ }
395
+ ```
396
+
397
+ - `designMd.tokenPlacement`: `front-matter`(기본값)는 모든 토큰을 맨 위 YAML 블록 하나에 넣습니다. `interleaved`는 그 블록에 `name`과 `description`만 두고, 토큰 그룹은 각 섹션 안의 YAML 블록에 넣습니다.
398
+ - `includeProse`, `includeDoDont`, `includeStructure`(모두 기본값 `true`)는 산문, 스타일 금지 항목과 금지 페이지 패턴으로 만든 Do's and Don'ts, Layout의 페이지 구조를 켜고 끕니다. `productType`을 주면 그 제품 유형의 필수 요소를 Layout에 적습니다.
399
+ - 색 이름은 DESIGN.md 관례를 따릅니다. `primary`는 글자색, `surface`는 페이지 배경이고, 그다음 `accent`, `on-accent`, `surface-container`, `outline` 등이 옵니다. Colors 산문에 각 이름의 `compose_design_tokens` 역할을 적습니다. 색 값은 hex이고, 반투명 색은 8자리 hex로 바꿉니다. 컴포넌트는 `{colors.action-primary}`처럼 토큰을 참조합니다. 치수는 px, em, rem만 쓰고, 유동 크기 글자는 최댓값을 씁니다.
400
+ - 결과에는 `sections`, `omitted`(뺀 섹션과 이유), `lossy`(DESIGN.md에 키가 없는 값: 두 번째 색상 모드, 상태 색, 모션, 그림자 등), `specVersion`, `sourceHash`도 들어 있습니다. 입력이 같으면 출력 바이트도 같습니다.
401
+ - `webstylebook://design-md/{id}`는 스타일 하나의 같은 파일을 고정한 시각 명세로 만들어 돌려줍니다. 선택 쿼리: `locale`, `mode`, `placement`.
402
+
403
+ 모든 스타일을 두 배치 방식, 세 언어, 시각 명세 사용 여부별로 만들어 `npx @google/design.md lint`(0.4.0)로 검사했고, 오류는 없습니다. 경고는 글자/배경 대비가 4.5:1보다 낮은 쌍에서만 나오며, 이 쌍은 `compose_design_tokens`도 경고합니다.
404
+
321
405
  ## 다국어 출력
322
406
 
323
407
  모든 툴은 선택적 `locale`을 받습니다. 사유 코드·가이던스·라벨이 요청한 언어로 돌아옵니다:
@@ -341,7 +425,8 @@ webstylebook://states/surfaces · /states/{surface} · /states/{surface}/{state}
341
425
  webstylebook://products · /products/{id}
342
426
  webstylebook://references · /references/{id}
343
427
  webstylebook://policies/anti-patterns · /policies/verification · /policies/audit-checks
344
- webstylebook://structure/banned-patterns
428
+ webstylebook://structure/banned-patterns · /structure/must-haves
429
+ webstylebook://design-md/{id}
345
430
  ```
346
431
 
347
432
  스타일 상세에는 `locale`, `mode`, 기대하는 `revision`을 쿼리로 지정할 수 있습니다. 예: `webstylebook://styles/brutalist-grid?locale=ko&mode=light`. 선택한 언어와 모드 1개의 명세를 반환하며, 지원하지 않는 값·중복 인자·알 수 없는 쿼리 이름은 명확한 오류로 반환합니다.
@@ -361,6 +446,37 @@ webstylebook://structure/banned-patterns
361
446
  시각적 강조가 정보 가치·과업 관련성·근거 수준에 맞는지도 검사합니다. 카드·통계·Sitemap
362
447
  링크는 유형 자체를 금지하지 않고 실제 사용자 과업에 도움이 되는지로 판단합니다.
363
448
 
449
+ ## 리디자인에서 잘 되던 것 지키기
450
+
451
+ 리디자인을 하면 링크, 폼 필드, 핸들러, 스크립트가 찾는 선택자, 필수 요소가 조용히 사라지곤 합니다. 페이지를 리디자인하기 전에 렌더링된 HTML(예: `document.documentElement.outerHTML`)과 CSS를 보관하세요. 리디자인을 빌드한 뒤 두 버전을 `compare_page_revisions`에 넘기세요.
452
+
453
+ ```json
454
+ {
455
+ "before": { "html": "<!doctype html>…", "css": ["…"] },
456
+ "after": { "html": "<!doctype html>…", "css": ["…"] },
457
+ "scriptSelectors": ["#cart-form", ".js-variant"],
458
+ "productType": "commerce",
459
+ "acknowledged": [
460
+ { "kind": "link", "key": "/pricing", "change": "dropped", "reason": "가격 안내를 영업 문의 페이지로 옮겼습니다" }
461
+ ]
462
+ }
463
+ ```
464
+
465
+ | 인벤토리 | 비교 대상 | 사라지면 |
466
+ |---|---|---|
467
+ | 링크 | `a[href]`. scheme과 host는 소문자로 바꾸고, 끝의 슬래시는 떼고, 쿼리 인자는 정렬해 비교 | FIX_NOW, major |
468
+ | 필드 | `input`, `select`, `textarea`를 `name`(없으면 `id`)으로 비교하고 라벨이 남았는지 확인 | FIX_NOW, major |
469
+ | 핸들러 | 폼 action과 method, `formaction`, 인라인 `on*` 속성 | FIX_NOW, major |
470
+ | 테스트 훅 | `data-testid`, `data-test`, `data-cy` | FIX_NOW, minor |
471
+ | 스크립트 훅 | 원래 페이지에서 맞던 `scriptSelectors` 항목 | FIX_NOW, major |
472
+ | 제목, 그림, 랜드마크 | h1~h3 텍스트, 이미지 대체 텍스트와 그림 캡션, `main`/`nav`/`footer` | RISK |
473
+ | 단어 수 | 보이는 단어. 한국어·중국어·일본어는 글자 수 | 원래 80개를 넘고 리디자인이 60% 미만만 남기면 RISK |
474
+ | 필수 요소 | `productType`을 주면 `audit_page_structure`가 찾는 필수 요소 | 이전에 있던 요소가 없어지거나 첫 화면 밖으로 가면 FIX_NOW |
475
+
476
+ 위치나 링크 대상은 그대로인데 문구만 바뀐 제목과 링크는 `reworded`(RISK)로 보고합니다. `acknowledged` 항목은 `kind`, `key`, `change`가 맞아야 하고 이유가 12자 이상이어야 합니다. 이유가 더 짧으면 손실을 면제하지 않고 RISK 발견 항목을 하나 더 냅니다. 링크, 제목, 그림, 랜드마크, 단어 수, 필수 요소는 보이는 요소만 셉니다. 필드, 핸들러, 두 종류의 훅은 숨긴 요소도 셉니다. 숨긴 CSRF 필드, 닫힌 대화상자, `display: none` 뒤의 장바구니 서랍도 페이지 동작의 일부이기 때문입니다.
477
+
478
+ 결과에는 `verdict`(`PASS`, `FIX_NOW`, `RISK`), 유지·손실·문구 변경·인정 항목을 담은 `inventory`, `wordCount`, `findings`, 그리고 `redesign-kept-<inventory>` 검사용 `evidence`와 `results`가 들어 있습니다. 기록하려면 `revisionPreservation: true`(와 같은 `productType`)로 `get_design_audit_plan`을 호출하세요. 이 계획에는 이 검사들만 들어 있어서 `validate_design_audit_result`가 evidence와 results를 그대로 받습니다. `revisionPreservation`이 없는 계획은 검사와 hash가 바뀌지 않습니다.
479
+
364
480
  ## 감사 결과 계약
365
481
 
366
482
  `get_design_audit_plan`은 이제 catalog version/hash와 결정론적 `planHash`를 담은 `identity`를
@@ -375,8 +491,8 @@ webstylebook://structure/banned-patterns
375
491
  끊어진 evidence reference, 다른 target의 evidence, 잘못된 region, 부당한
376
492
  `NOT_APPLICABLE`, 필수 증거가 없거나 실패 증거와 모순되는 `PASS`를 거부합니다. 누락된
377
493
  결과는 숨기지 않고 `NOT_VERIFIED`로 구체화합니다. `includeGroups`에 `structure`를 넣고 `styleId`를 주면,
378
- plan에 금지 패턴마다 자동 검사가 1개씩 붙습니다. `audit_page_structure`는 이 검사 id에 맞는 evidence와
379
- results를 돌려주고, validator는 그대로 받습니다. 재검증 가능한 비교를 위해 plan,
494
+ plan에 금지 패턴마다 자동 검사가 1개씩 붙고, `productType`을 주면 필수 요소마다 1개씩 더 붙습니다. `audit_page_structure`는 이 검사 id에 맞는 evidence와
495
+ results를 돌려주고, validator는 그대로 받습니다. `revisionPreservation: true`를 주면 plan에는 `compare_page_revisions`가 답하는 `redesign-kept-*` 검사만 들어갑니다. 재검증 가능한 비교를 위해 plan,
380
496
  evidence bundle, 정규화된 result의 content-addressed hash도 반환합니다. 이 툴은 artifact를
381
497
  직접 열지 않으며 계약 유효성을 디자인 품질 점수로 바꾸지 않습니다.
382
498
 
package/README.md CHANGED
@@ -148,6 +148,67 @@ After building, pass the page's HTML and CSS to `audit_page_structure`. This is
148
148
 
149
149
  Each finding names where the pattern is, what was observed, and what to put there instead: the chosen style's signature moves for the same job (proof, in the logo strip's case), its hero composition, or its section order. Rebuild, run the audit again, then add `"structure"` to `get_design_audit_plan.includeGroups` and pass the returned `evidence` and `results` to `validate_design_audit_result`. Audit each viewport with its own `targetId`: the evidence ids include it, so the runs validate together. The checks are deterministic heuristics over the submitted HTML and CSS, not a browser render, so `clean` means every check ran and found none of these patterns, not that the design passed. Per-style guidance (archetypes and moves) is written in English, like the catalog's own `layout` and `typography` fields; pattern names and instructions follow `locale`.
150
150
 
151
+ ### Must-haves a style can't remove
152
+
153
+ A direction must not cost the page its function. In the shelved showcase run (#7), the luxury skincare page built with the MCP kept a single buy button above the fold, while the control page showed sizes, a per-night price, add to bag, and delivery and guarantee details. So `recommend_design_direction` also returns `mustHaves`: the elements the resolved product type requires and the zone each one must sit in. A style restyles them but never removes them or moves them out of their zone, and they come before the archetype's limits on the opening ("one action, one short line"): every first-screen item goes in the hero. Each candidate's `structure.mustHaves` names that style's signature moves that do the same job, for example the proof move that can carry delivery and guarantee details.
154
+
155
+ | Product type | Page | First screen | Anywhere on the page |
156
+ |---|---|---|---|
157
+ | `operational-saas` | main dashboard | Current status (`current-status`), What changed (`recent-changes`) | — |
158
+ | `developer-tool` | product landing page | Code sample (`code-sample`), Documentation link (`docs-link`) | — |
159
+ | `documentation` | docs home | Search (`search`), Quickstart (`quickstart`) | — |
160
+ | `data-analytics` | analytics dashboard | Current status (`current-status`), What changed (`recent-changes`), Time range (`time-range`) | — |
161
+ | `security-console` | security overview | Current status (`current-status`), What changed (`recent-changes`) | — |
162
+ | `finance-admin` | finance overview | Current status (`current-status`), What changed (`recent-changes`) | — |
163
+ | `healthcare-portal` | portal home | Primary action (`primary-cta`) | Contact (`contact`), Privacy notice (`privacy-notice`) |
164
+ | `commerce` | product detail page | Price (`price`), Variant choice (`variant-choice`), Add to cart (`add-to-cart`), Delivery and guarantee details (`purchase-assurance`) | — |
165
+ | `ai-chat` | chat screen | Message input (`composer`) | AI limits note (`ai-limits`) |
166
+ | `content-editorial` | article page | Author (`author`), Publication date (`publish-date`) | — |
167
+ | `knowledge-base` | help center home | Search (`search`) | Topic index (`topic-index`) |
168
+ | `portfolio` | portfolio home | — | Work samples (`work-samples`), Contact (`contact`) |
169
+ | `campaign` | landing page | Primary action (`primary-cta`) | Proof (`proof`) |
170
+ | `consumer-app` | app landing page | Primary action (`primary-cta`) | Proof (`proof`) |
171
+
172
+ The first screen is everything up to the end of the opening section (the section that holds the page's `h1`), plus up to two following sections while each section so far is short (≤ 40 words, no image, video, table, or large SVG, and not sized to fill the viewport). The site header counts; the footer does not. A brief whose product type is neither given nor inferred resolves to `other`, which has no list, and the result says so instead of inventing one. Every criterion is in `webstylebook://structure/must-haves`.
173
+
174
+ Pass the same `productType` to `audit_page_structure`, and it reports which must-haves the built page is missing. This is its real output for the showcase failure, rebuilt as a fixture ([`commerce-buy-button-only.html`](https://github.com/seungdori/web-stylebook-mcp/blob/master/tests/fixtures/must-haves/commerce-buy-button-only.html)):
175
+
176
+ ```jsonc
177
+ // → audit_page_structure({ html, styleId: "midnight-noir", productType: "commerce" })
178
+ // ← must-have audit (trimmed)
179
+ {
180
+ "mustHaves": {
181
+ "productType": "commerce",
182
+ "page": "product detail page",
183
+ "missing": [],
184
+ "misplaced": ["price", "variant-choice", "purchase-assurance"],
185
+ "items": [
186
+ { "id": "price", "checkId": "structure-must-have-price", "zone": "first-screen", "status": "misplaced", "count": 1,
187
+ "locations": ["section#buy > div > p.price:nth-of-type(1)"] },
188
+ { "id": "add-to-cart", "checkId": "structure-must-have-add-to-cart", "zone": "first-screen", "status": "present", "count": 1,
189
+ "locations": ["body > main > section.masthead:nth-of-type(1) > div > a.button"] }
190
+ // 2 more: variant-choice and purchase-assurance, both misplaced
191
+ ]
192
+ },
193
+ "findings": [
194
+ {
195
+ "patternId": "must-have/price",
196
+ "scope": "must-have",
197
+ "severity": "major",
198
+ "observed": { "status": "misplaced", "zone": "first-screen", "found": 1, "inZone": 0 },
199
+ "replaceWith": {
200
+ "instruction": "Move it onto the first screen; the audit found it only further down the page. Show the price with its currency next to the product name; when sizes differ in price, show the price of the selected size.",
201
+ "moves": [],
202
+ "archetype": { "hero": "Left-heavy and low: a 1.7fr/1fr grid with align-items: end …" }
203
+ }
204
+ }
205
+ // 2 more: must-have/variant-choice, must-have/purchase-assurance
206
+ ]
207
+ }
208
+ ```
209
+
210
+ Each must-have is `present`, `missing`, `misplaced` (on the page, but not on the first screen), or `not-verified` (the stylesheets exceeded the selector budget, parsing stopped before the end of the page, or the page has no section to place the first screen in). Each one is also a `structure-must-have-<id>` check: pass `productType` with the `structure` group to `get_design_audit_plan`, and the audit's evidence and results validate as they are. Detection reads markup, ARIA roles, and visible text in English, Korean, and Japanese. Anything hidden (`hidden`, `display: none`, a visually hidden `sr-only` box, or `aria-hidden="true"`) does not count. Native controls are found reliably: a `select` or radio group for variants, an `input type="search"` for search, a `time` element for dates.
211
+
151
212
  ## What an agent builds with it
152
213
 
153
214
  A different brief — *"a marketing landing page for **Throughline**, a B2B SaaS that turns scattered customer feedback (support tickets, sales calls, app reviews, Slack) into one prioritized roadmap."* No layout, no hero, no styling was specified. Following the companion skill, the agent composed the opening **from the product's core idea** instead of reaching for a stock hero: the right half is a bespoke diagram of the product's actual mechanic — feedback sources converging into an auto-ranked roadmap — not a decorative card you could paste onto any other site.
@@ -177,7 +238,7 @@ flowchart LR
177
238
  C --> N[audit_page_structure]
178
239
  D & E & F & G & H & I & J & K & L -->|design contracts<br/>observations · scores · reasons<br/>placement · evidence · tokens · structure| A
179
240
  A -->|built page HTML · CSS| N
180
- N -->|banned patterns · replacement moves<br/>evidence for the structure checks| A
241
+ N -->|banned patterns · replacement moves<br/>missing must-haves<br/>evidence for the structure checks| A
181
242
  A -->|target matrix · evidence refs<br/>one verdict per check/target| M
182
243
  M -->|coverage · normalized verdicts<br/>plan/evidence/result hashes| A
183
244
  A -->|writes code<br/>from evidence| Z[Your UI]
@@ -264,21 +325,22 @@ Add the same block to your `claude_desktop_config.json`, then restart:
264
325
 
265
326
  | Tool | What you get | The honest part |
266
327
  |------|--------------|-----------------|
267
- | **`recommend_design_direction`** | Scored style candidates with reason codes, a `ranking` that says why #1 beat #2 (or reports a tie), **rejected** styles with *why*, secondary pairings, confidence, and each candidate's page `structure` | The model makes the final pick — this is the evidence provider |
328
+ | **`recommend_design_direction`** | Scored style candidates with reason codes, a `ranking` that says why #1 beat #2 (or reports a tie), **rejected** styles with *why*, secondary pairings, confidence, each candidate's page `structure`, and the product type's `mustHaves` with the zone each must sit in | The model makes the final pick — this is the evidence provider |
268
329
  | **`compare_design_directions`** | 2–4 directions compared across product-fit, repeated-use, density, trust, distinctiveness, accessibility-risk, motion, maintenance | No single winner is declared |
269
330
  | **`search_design_references`** | Bounded search across real-world references by text, category, and tags, with concise localized observations | Returns attributed research summaries, not copied screenshots or brand assets |
270
331
  | **`get_design_reference`** | One complete localized reference with palette/layout/interaction/motion observations, normalized tokens, source revision, attribution, and rights notice | Original-site copy, typefaces, screenshots, and visual identity remain with their owners |
271
332
  | **`get_design_principle_plan`** | A focused placement, application, and verification plan selected by visual concerns, surface, phase, or principle ids — with source references where available | Craft prompts are testable guidance, not empirical laws or a fixed recipe |
272
333
  | **`get_ux_principle_plan`** | A focused apply-and-verify plan selected by outcomes, surface, phase, or principle ids — with questions, cautions, confidence, and references | Principles are contextual prompts, not universal laws or a substitute for research |
273
334
  | **`get_ui_state_plan`** | Required / recommended / domain UI states for a surface (data-table, form, checkout, chat, developer-console) — triggers, must-show, must-not, a11y, motion | Covers the states agents forget: empty, error, loading, edge |
274
- | **`compose_design_tokens`** | Role-based tokens as `json` / `css-variables` / `tailwind` / `typescript`; opt into the shared visual contract to preserve authored style values and editor changes | Contract mode uses authored color modes and applies only explicitly accepted contrast repairs |
335
+ | **`compose_design_tokens`** | Role-based tokens as `json` / `css-variables` / `tailwind` / `typescript`, or a whole `DESIGN.md` file (`design-md`); opt into the shared visual contract to preserve authored style values and editor changes | Contract mode uses authored color modes and applies only explicitly accepted contrast repairs |
275
336
  | **`get_design_audit_plan`** | Localized, surface-aware checks with stable ids, severity, applicability, required evidence, remediation, user-facing content checks, selected principle checks, and UI-state coverage | The tool plans the audit but never pretends it inspected your project; missing evidence is `NOT_VERIFIED`, not `PASS` |
276
337
  | **`validate_design_audit_result`** | Contract validation for the plan query, target matrix, durable evidence references, and one verdict per check/target, with normalized verdicts and stable hashes | It verifies coverage and evidence consistency, not visual quality; `valid: true` is never an overall design pass |
277
- | **`audit_page_structure`** | Banned generic and style-specific patterns found in the HTML and CSS you pass in, each with its location, observed values, and the chosen style's replacement moves, plus evidence and results for the `structure` audit group | Declared-style heuristics, not a browser; a clean result is not a design pass |
338
+ | **`audit_page_structure`** | Banned generic and style-specific patterns found in the HTML and CSS you pass in, each with its location, observed values, and the chosen style's replacement moves; with `productType`, the must-haves the page is missing or keeps off the first screen; plus evidence and results for the `structure` audit group | Declared-style heuristics, not a browser; a clean result is not a design pass |
339
+ | **`compare_page_revisions`** | Before/after comparison of a redesign: which links, form fields and labels, handlers, test hooks, script selectors, headings, figures, landmarks, visible words, and product must-haves it kept, reworded, or dropped, with `acknowledged` for intended removals; plus evidence and results for a `revisionPreservation` audit plan | Static markup, not a browser; it does not run your scripts or record screenshots |
278
340
 
279
341
  **Catalog:** 520 real-world design references · 48 styles · 25 interface design principles · 23 UX principles · 51 structured audit checks · 20 components · 5 surfaces · 57 UI-state recipes · 29 motion profiles · 14 product archetypes.
280
342
 
281
- **Structure:** 48 layout archetypes · 144 signature moves · 9 banned generic patterns · 142 style-specific bans from 19 detectors.
343
+ **Structure:** 48 layout archetypes · 144 signature moves · 9 banned generic patterns · 142 style-specific bans from 19 detectors · 21 must-haves across 14 product types.
282
344
 
283
345
  The reference library is an adapted, high-completeness subset of [OpenDesign](https://opendesign.cc), whose structured specifications are licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Web Stylebook excludes upstream screenshots and brand assets. Original sites, brands, copy, typefaces, and visual identities remain the property of their respective owners; inspect each detail's attribution and rights notice before use.
284
346
 
@@ -307,6 +369,28 @@ The result includes the selected `visualContract`, source identity in `contract`
307
369
 
308
370
  The shared runtime includes seven portable MIT sources, including `fontSources.ts` metadata for Korean/Japanese heavy display fallbacks. It includes no browser font loader or font binaries. `visual:sync` preflights the source import closure and license declarations before writing, and `visual:check` verifies the source hashes and artifact bytes. When updating the website revision, regenerate and synchronize `catalog.v1.json`, `manifest.v1.json`, and the visual artifact together; update the exact source pin in `.github/workflows/publish.yml` as well.
309
371
 
372
+ ## Export a DESIGN.md
373
+
374
+ `compose_design_tokens` with `format: "design-md"` returns the chosen direction as a [DESIGN.md](https://github.com/google-labs-code/design.md) file (spec version `alpha`), so other agents and tools can read it. The server never writes the file: save `content` as `DESIGN.md` in the project.
375
+
376
+ ```json
377
+ {
378
+ "primaryStyleId": "brutalist-grid",
379
+ "format": "design-md",
380
+ "contract": { "schema": "webstylebook.visual.v1" },
381
+ "locale": "ko",
382
+ "designMd": { "tokenPlacement": "interleaved", "productType": "developer-tool" }
383
+ }
384
+ ```
385
+
386
+ - `designMd.tokenPlacement`: `front-matter` (default) puts every token in one YAML block at the top. `interleaved` keeps only `name` and `description` there and puts each token group in a YAML block inside its section.
387
+ - `includeProse`, `includeDoDont`, and `includeStructure` (all `true` by default) control the prose, the Do's and Don'ts built from the style's bans and the banned page patterns, and the page structure in Layout. `productType` adds that product type's must-haves to Layout.
388
+ - Colors use DESIGN.md names: `primary` is the text color, `surface` the page background, then `accent`, `on-accent`, `surface-container`, `outline`, and so on. The Colors prose names the `compose_design_tokens` role behind each one. Color values are hex; translucent colors become 8-digit hex. Components reference tokens, for example `{colors.action-primary}`. Dimensions are px, em, or rem only, and fluid type keeps its maximum size.
389
+ - The result also has `sections`, `omitted` (sections left out, each with a reason), `lossy` (values DESIGN.md has no key for, such as a second color mode, status colors, motion, and shadows), `specVersion`, and `sourceHash`. The same input returns the same bytes.
390
+ - `webstylebook://design-md/{id}` serves the same file for one style from its pinned visual contract. Optional query parameters: `locale`, `mode`, `placement`.
391
+
392
+ Every style, in both placements, all three locales, and with or without a contract, passes `npx @google/design.md lint` (0.4.0) with no errors. Its only warnings are text/background pairs below 4.5:1, which `compose_design_tokens` also reports.
393
+
310
394
  ## Localized output
311
395
 
312
396
  Every tool takes an optional `locale`. Reason codes, guidance, and labels come back in the requested language:
@@ -330,7 +414,8 @@ webstylebook://states/surfaces · /states/{surface} · /states/{surface}/{state}
330
414
  webstylebook://products · /products/{id}
331
415
  webstylebook://references · /references/{id}
332
416
  webstylebook://policies/anti-patterns · /policies/verification · /policies/audit-checks
333
- webstylebook://structure/banned-patterns
417
+ webstylebook://structure/banned-patterns · /structure/must-haves
418
+ webstylebook://design-md/{id}
334
419
  ```
335
420
 
336
421
  Style detail accepts optional `locale`, `mode`, and expected `revision` query parameters, for example `webstylebook://styles/brutalist-grid?locale=ko&mode=light`. It returns one resolved locale and mode; unsupported values, duplicate parameters, and unknown query names return an explicit error.
@@ -352,6 +437,37 @@ context-specific information, and whether its visual emphasis matches informatio
352
437
  relevance, and support. Cards, statistics, and Sitemap links are still judged by their actual
353
438
  user-task value rather than banned as types.
354
439
 
440
+ ## Keep what worked through a redesign
441
+
442
+ Redesigns quietly drop links, form fields, handlers, the selectors a script queries, and must-haves. Before you redesign a page, save its rendered HTML (for example `document.documentElement.outerHTML`) and its CSS. When the redesign is built, pass both versions to `compare_page_revisions`:
443
+
444
+ ```json
445
+ {
446
+ "before": { "html": "<!doctype html>…", "css": ["…"] },
447
+ "after": { "html": "<!doctype html>…", "css": ["…"] },
448
+ "scriptSelectors": ["#cart-form", ".js-variant"],
449
+ "productType": "commerce",
450
+ "acknowledged": [
451
+ { "kind": "link", "key": "/pricing", "change": "dropped", "reason": "Pricing moved to the sales contact page" }
452
+ ]
453
+ }
454
+ ```
455
+
456
+ | Inventory | What is compared | When it is lost |
457
+ |---|---|---|
458
+ | links | `a[href]`, with scheme and host lowercased, a trailing slash dropped, and query parameters sorted | FIX_NOW, major |
459
+ | fields | `input`, `select`, `textarea` by `name` (else `id`), and whether each keeps a label | FIX_NOW, major |
460
+ | handlers | form action and method, `formaction`, inline `on*` attributes | FIX_NOW, major |
461
+ | test hooks | `data-testid`, `data-test`, `data-cy` | FIX_NOW, minor |
462
+ | script hooks | each `scriptSelectors` entry that matched the original | FIX_NOW, major |
463
+ | headings, figures, landmarks | h1–h3 text, image alt text and figure captions, `main`/`nav`/`footer` | RISK |
464
+ | words | visible words; Korean, Chinese, and Japanese by character | RISK when the original had more than 80 and the redesign keeps under 60% |
465
+ | must-haves | with `productType`, the must-haves `audit_page_structure` finds | FIX_NOW when one present before is missing or off the first screen |
466
+
467
+ A heading or link whose wording changed while its place or target stayed is reported as `reworded` (RISK). An `acknowledged` entry needs the matching `kind`, `key`, and `change` and a reason of at least 12 characters; a shorter reason does not excuse the loss and adds a RISK finding. Links, headings, figures, landmarks, words, and must-haves count visible elements only. Fields, handlers, and both kinds of hook also count hidden elements, because a hidden CSRF field, a closed dialog, or a cart drawer behind `display: none` is still part of how the page works.
468
+
469
+ The result has `verdict` (`PASS`, `FIX_NOW`, or `RISK`), an `inventory` with kept, lost, reworded, and acknowledged items, `wordCount`, `findings`, and `evidence` and `results` for the `redesign-kept-<inventory>` checks. To record them, call `get_design_audit_plan` with `revisionPreservation: true` (and the same `productType`); that plan holds only these checks, so `validate_design_audit_result` accepts the evidence and results as they are. Plans without `revisionPreservation` keep their checks and hash.
470
+
355
471
  ## Audit result contract
356
472
 
357
473
  `get_design_audit_plan` now returns an `identity` with the catalog version/hash and a deterministic
@@ -366,8 +482,8 @@ user-task value rather than banned as types.
366
482
  result slots, broken evidence references, cross-target evidence, invalid regions, unsupported
367
483
  `NOT_APPLICABLE`, and `PASS` that lacks required evidence or contradicts failed evidence. Missing result
368
484
  slots are materialized as `NOT_VERIFIED`, never hidden. With `includeGroups` containing `structure` and a
369
- `styleId`, the plan adds one automated check per banned pattern; `audit_page_structure` returns evidence and
370
- results for those check ids that the validator accepts as they are. The result carries content-addressed plan,
485
+ `styleId`, the plan adds one automated check per banned pattern, and `productType` adds one per must-have;
486
+ `audit_page_structure` returns evidence and results for those check ids that the validator accepts as they are. With `revisionPreservation: true`, the plan holds only the `redesign-kept-*` checks that `compare_page_revisions` answers. The result carries content-addressed plan,
371
487
  evidence-bundle, and normalized-result hashes for comparable rechecks. The tool never opens the
372
488
  artifact references and never turns contract validity into a design-quality score.
373
489
 
@@ -1,13 +1,16 @@
1
1
  import type { CatalogRepository } from '../catalog/repository.js';
2
- import type { AuditApplicability, AuditAutomationLevel, AuditCheckDefinition, AuditEvidenceType, AuditSeverity, Lang, UxPrinciple, UxSurface } from '../types.js';
2
+ import type { AuditApplicability, AuditAutomationLevel, AuditCheckDefinition, AuditEvidenceType, AuditSeverity, Lang, ProductType, UxPrinciple, UxSurface } from '../types.js';
3
3
  export declare const AUDIT_GROUP_IDS: readonly ["build", "layout", "fidelity", "content", "behavior", "principles", "docs", "anti-patterns", "structure"];
4
4
  export type AuditGroupId = (typeof AUDIT_GROUP_IDS)[number];
5
5
  /** `structure` is opt-in so that plans requested without includeGroups keep their earlier checks and hash. */
6
6
  export declare const DEFAULT_AUDIT_GROUP_IDS: readonly AuditGroupId[];
7
+ export declare const REVISION_GROUP_IDS: readonly AuditGroupId[];
7
8
  export declare const AUDIT_VERDICTS: readonly ["PASS", "FIX_NOW", "RISK", "NOT_APPLICABLE", "NOT_VERIFIED"];
8
9
  export type AuditVerdict = (typeof AUDIT_VERDICTS)[number];
9
10
  export interface DesignAuditPlanInput {
10
11
  styleId?: string;
12
+ /** With the structure group, adds one check per must-have of this product type. */
13
+ productType?: ProductType;
11
14
  surfaces?: UxSurface[];
12
15
  designPrincipleIds?: string[];
13
16
  uxPrincipleIds?: string[];
@@ -15,6 +18,7 @@ export interface DesignAuditPlanInput {
15
18
  domainSignals?: string[];
16
19
  includeGroups?: AuditGroupId[];
17
20
  includeDocumentation?: boolean;
21
+ revisionPreservation?: boolean;
18
22
  locale?: Lang;
19
23
  }
20
24
  export interface ResolvedAuditCheck {
@@ -31,7 +35,10 @@ export interface ResolvedAuditCheck {
31
35
  source: AuditCheckDefinition['source'] | {
32
36
  kind: 'structure';
33
37
  patternId: string;
34
- scope: 'global' | 'style';
38
+ scope: 'global' | 'style' | 'must-have';
39
+ } | {
40
+ kind: 'revision';
41
+ inventory: string;
35
42
  };
36
43
  }
37
44
  interface PrincipleAuditContract {
@@ -58,12 +65,16 @@ export interface DesignAuditPlan {
58
65
  };
59
66
  query: {
60
67
  styleId?: string;
68
+ /** Present only when passed, so plans without it keep their hash. */
69
+ productType?: ProductType;
61
70
  surfaces: UxSurface[];
62
71
  designPrincipleIds: string[];
63
72
  uxPrincipleIds: string[];
64
73
  stateSurfaceIds: string[];
65
74
  includeGroups: AuditGroupId[];
66
75
  includeDocumentation: boolean;
76
+ /** Present only when true, so other plans keep their hash. */
77
+ revisionPreservation?: true;
67
78
  locale: Lang;
68
79
  };
69
80
  verdicts: Array<{
@@ -96,6 +107,7 @@ export interface DesignAuditPlan {
96
107
  excludedChecks: number;
97
108
  /** Present only when the structure group is included; those checks come from the structure ruleset, not the catalog. */
98
109
  structureChecks?: number;
110
+ revisionChecks?: number;
99
111
  };
100
112
  resourceUris: string[];
101
113
  guidance: string[];