medesign 1.4.0 → 1.6.1

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 (51) hide show
  1. package/README.md +90 -72
  2. package/bin/mebolder.js +4 -0
  3. package/bin/medesign.js +370 -35
  4. package/bin/melint.js +4 -0
  5. package/bin/mepolish.js +4 -0
  6. package/bin/mequiet.js +4 -0
  7. package/bin/mesearch.js +4 -0
  8. package/bin/mesnapshot.js +4 -0
  9. package/examples/cadastral-qaqc-slide.html +577 -0
  10. package/examples/executive-summary-report.html +597 -0
  11. package/examples/executive-summary-report.pdf +0 -0
  12. package/examples/geospatial-banner-1200x630.html +370 -0
  13. package/examples/geospatial-banner-1200x630.svg +149 -0
  14. package/examples/linear-issue-board.html +1273 -0
  15. package/examples/snapshots/cadastral-qaqc-slide-desktop-1440x900.png +0 -0
  16. package/examples/snapshots/cadastral-qaqc-slide-mobile-390x844.png +0 -0
  17. package/examples/snapshots/cadastral-qaqc-slide-tablet-820x1180.png +0 -0
  18. package/examples/snapshots/executive-summary-report-desktop-1440x900.png +0 -0
  19. package/examples/snapshots/executive-summary-report-mobile-390x844.png +0 -0
  20. package/examples/snapshots/executive-summary-report-tablet-820x1180.png +0 -0
  21. package/examples/snapshots/geospatial-banner-1200x630-og-banner-1200x630.png +0 -0
  22. package/examples/snapshots/linear-issue-board-desktop-1440x900.png +0 -0
  23. package/examples/snapshots/linear-issue-board-mobile-390x844.png +0 -0
  24. package/examples/snapshots/linear-issue-board-tablet-820x1180.png +0 -0
  25. package/examples/snapshots/spotify-web-player-desktop-1440x900.png +0 -0
  26. package/examples/snapshots/spotify-web-player-mobile-390x844.png +0 -0
  27. package/examples/snapshots/spotify-web-player-tablet-820x1180.png +0 -0
  28. package/examples/spotify-web-player.html +1446 -0
  29. package/package.json +16 -4
  30. package/presets/metha/guidelines.md +26 -17
  31. package/presets/metha/preset.json +16 -16
  32. package/references/ai-tells.md +9 -2
  33. package/references/brand-design-tokens.md +27 -28
  34. package/references/brief-intake.md +90 -0
  35. package/references/catalog.json +1031 -1023
  36. package/references/cli-architecture.md +1 -1
  37. package/references/compositor-smoothness.md +161 -0
  38. package/references/design-core.md +11 -4
  39. package/references/executive-reports.md +234 -0
  40. package/references/image-mockup-direction.md +53 -53
  41. package/references/image-to-code.md +46 -46
  42. package/references/modern-craft-invariants.md +55 -9
  43. package/references/prompt-templates.md +49 -0
  44. package/references/quality-gate.md +42 -12
  45. package/references/typography-thai-latin.md +206 -0
  46. package/references/view-transitions-engine.md +89 -0
  47. package/references/web-retrofit-protocol.md +103 -0
  48. package/scripts/export-tokens.js +419 -403
  49. package/tests/browser-audit.js +463 -442
  50. package/tests/linter.js +49 -4
  51. package/tests/snapshot.js +266 -0
package/package.json CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "name": "medesign",
3
- "version": "1.4.0",
3
+ "version": "1.6.1",
4
4
  "description": "Autonomous Design Engineering Toolkit & Automated Linter for AI Coding Assistants",
5
5
  "main": "bin/medesign.js",
6
6
  "bin": {
7
- "medesign": "bin/medesign.js"
7
+ "medesign": "bin/medesign.js",
8
+ "mepolish": "bin/mepolish.js",
9
+ "mebolder": "bin/mebolder.js",
10
+ "mequiet": "bin/mequiet.js",
11
+ "melint": "bin/melint.js",
12
+ "mesearch": "bin/mesearch.js",
13
+ "mesnapshot": "bin/mesnapshot.js"
8
14
  },
9
15
  "files": [
10
16
  "bin",
@@ -14,26 +20,32 @@
14
20
  "scripts/export-tokens.js",
15
21
  "tests/linter.js",
16
22
  "tests/browser-audit.js",
23
+ "tests/snapshot.js",
17
24
  "tests/schemas",
18
25
  "tests/visual-testbed.html",
26
+ "examples",
19
27
  "medesign.config.js"
20
28
  ],
21
29
  "scripts": {
22
- "test": "node tests/runner.js && node tests/validate-sarif.js && node tests/test-tokens.js && node tests/test-cli.js",
30
+ "test": "node tests/runner.js && node tests/validate-sarif.js && node tests/test-tokens.js && node tests/test-cli.js && node tests/test-behavioral-matrix.js",
23
31
  "test:unit": "node tests/runner.js",
24
32
  "test:sarif": "node tests/validate-sarif.js",
25
33
  "test:tokens": "node tests/test-tokens.js",
26
34
  "test:cli": "node tests/test-cli.js",
35
+ "test:benchmark": "node tests/test-blind-benchmark.js",
27
36
  "test:browser": "node tests/runner.js --browser",
37
+ "test:snapshot": "node tests/snapshot.js examples/cadastral-qaqc-slide.html",
28
38
  "search": "node bin/medesign.js search",
29
39
  "polish": "node bin/medesign.js polish",
30
40
  "bolder": "node bin/medesign.js bolder",
31
41
  "quiet": "node bin/medesign.js quiet",
32
42
  "lint": "node bin/medesign.js lint",
33
43
  "audit": "node bin/medesign.js audit",
44
+ "snapshot": "node bin/medesign.js snapshot",
34
45
  "tokens": "node bin/medesign.js tokens",
35
46
  "doctor": "node bin/medesign.js doctor",
36
- "prepublishOnly": "npm test"
47
+ "prepublishOnly": "npm test",
48
+ "test:behavioral": "node tests/test-behavioral-matrix.js"
37
49
  },
38
50
  "repository": {
39
51
  "type": "git",
@@ -1,23 +1,32 @@
1
1
  # Metha Preset Guidelines (`/medesign metha`)
2
2
 
3
- ## Designer & Domain Context
4
- - **Creator:** เมธา ตรีประพันธ์กิจ (Survey Engineering & Geoinformatics, Kasetsart University)
5
- - **Primary Archetype:** Archetype 32 (GIS Situation Awareness & Telemetry)
6
- - **Secondary Archetype:** Archetype 38 (Cadastral Survey & QA/QC Workbench)
3
+ ## Archetype Mapping
4
+ - **Primary Archetype:** Archetype 38 (Cadastral Survey & Mission-Critical QA/QC Workbench)
5
+ - **Secondary Archetype:** Archetype 32 (GIS Situation Awareness & Telemetry Cockpit)
6
+
7
+ ## World-Class Engineering Context
8
+ - **Philosophy:** Mission-Critical Precision, Geodetic Field Telemetry, and High-Density Spatial Computing.
9
+ - **Target Audience:** Survey engineers, GIS analysts, telemetry operators, and mission-critical dashboard creators worldwide.
10
+ - **Craft Standard:** 100% compliant with ME-DESIGN Neutral World-Class Invariants (Closed Spacing, Latin-First Bilingual Typography, 44px Hit-Target Halo, and 1px Hairline In-flow Surfaces).
7
11
 
8
12
  ## Invariants & Design Principles
9
- 1. **Engineering Precision & 8pt Spatial Rhythm:**
10
- Outer card radius `8px`, inner component radius `4px`. All geometry, paddings, and data cell heights align to an 8pt baseline grid (16px, 24px, 32px, 48px).
13
+ 1. **Engineering Precision & Closed Spacing System:**
14
+ - Outer card radius `8px`, inner nested component radius `4px` (`r_inner = max(0, r_outer - padding)`).
15
+ - Strict Closed Spacing Scale: `2, 4, 8, 12, 16, 24, 32, 48, 64, 96, 128px`.
16
+ - Proximity Ratio $\ge 2:1$ (space between functional card clusters is at least $2\times$ internal element gap).
11
17
  2. **Geodetic Coordinates & Tabular Typography:**
12
- - Coordinate, Distance, Azimuth, and Traverse Closure readouts MUST use monospace (`IBM Plex Mono` / `Fira Code`) with `tabular-nums` and `letter-spacing: 0.04em`.
13
- - UI chrome uses `Inter` or `Sukhumvit Set` with `1.25` line-height.
14
- - Thai diacritic headroom: minimum `4px` top padding to prevent tone mark clipping (`่ ้ ๊ ๋ ์`) on compact table headers.
18
+ - Coordinate, Distance, Azimuth, and Traverse Closure readouts MUST use monospace (`IBM Plex Mono` / `JetBrains Mono`) with `tabular-nums` and `letter-spacing: 0.04em`.
19
+ - UI chrome and labels use Latin-First `Geist` or `Inter`, paired with `IBM Plex Sans Thai` (Body line-height `1.7–1.8`, `letter-spacing: 0`, diacritic headroom $\ge 4$px).
15
20
  3. **Cockpit Color Palette & ISA-101 Situational Awareness:**
16
- - Dark Slate `#0c0e14` background prevents eye fatigue during 8+ hour surveying shifts.
17
- - Survey Electric Cyan `oklch(0.65 0.20 250)` for selected cadastral parcel or primary action.
18
- - Survey Precision Green `oklch(0.72 0.18 145)` strictly reserved for verified closures / fixed GPS solutions ($1\sigma < 5\text{mm}$).
19
- - Warning Amber `oklch(0.78 0.16 75)` for float solutions or high HDOP.
20
- 4. **Motion Profile:**
21
- `precision` motion profile (140ms entry, 90ms exit). Map selection and point inspection must respond instantly without distracting physics bounces.
22
- 5. **Layout Architecture:**
23
- 100dvh viewport canvas layout with floating telemetry docks, collapsible side inspectors, and non-scrambled Bento row grids (`grid-auto-flow: row`).
21
+ - Dark Slate `#0a0d14` canvas background prevents eye fatigue during continuous operational shifts.
22
+ - Surface Raised `#141721`, Surface Inset `#090a0f`.
23
+ - 1px Hairline Borders (`rgba(255, 255, 255, 0.09)`) on all in-flow cards with zero fake drop-shadows. Dark mode elevation achieved via luminance (+2% to +4% L).
24
+ - Survey Electric Cyan `oklch(0.85 0.18 198)` (#00f5fb) for primary active controls and vector geometries.
25
+ - Precision Green `oklch(0.72 0.18 145)` strictly reserved for verified closures, fixed GPS status, and valid tolerances ($1\sigma < 5\text{mm}$).
26
+ - Warning Amber `oklch(0.78 0.16 75)` for float solutions, high HDOP, or tolerance drift.
27
+ - Critical Crimson `oklch(0.62 0.22 25)` for boundary collisions or hardware telemetry loss.
28
+ 4. **Motion Profile (Precision):**
29
+ - Sub-second `precision` profile (120ms entry, 90ms exit, `cubic-bezier(0.16, 1, 0.3, 1)`).
30
+ - Coordinate updates and map point inspection respond instantly without physics bounces.
31
+ 5. **Layout Architecture (3-Pane Cockpit):**
32
+ - 100dvh viewport canvas layout with top coordinate command deck, left layer filter rail, center spatial map/vector canvas, and right docked telemetry inspector with collapsible bottom traverse closure table.
@@ -2,43 +2,43 @@
2
2
  "$schema": "../schema.json",
3
3
  "id": "metha",
4
4
  "name": "Metha Engineering & Geoinformatics Cockpit",
5
- "version": "1.0.0",
6
- "archetype": "Archetype 32: GIS Situation Awareness & Archetype 38: Cadastral Survey & QA/QC Workbench",
7
- "description": "Metha's personal engineering design signature: high-density cadastral tables, 8pt optical grid, Inter + IBM Plex Mono tabular coordinates, charcoal/deep slate dark canvas, and survey electric cyan/precision green accents.",
5
+ "version": "1.2.0",
6
+ "archetype": "Archetype 38: Cadastral Survey & Mission-Critical QA/QC Workbench (Archetype 32: GIS Situation Awareness)",
7
+ "description": "World-class mission-critical telemetry & geodetic engineering preset: high-density cadastral tables, 8pt optical grid, Geist + IBM Plex Mono tabular coordinates, deep slate/obsidian canvas, and electric cyan/precision green accents.",
8
8
  "typography": {
9
- "display": "'Inter', 'SF Pro Display', sans-serif",
10
- "sans": "'Inter', 'Sukhumvit Set', sans-serif",
11
- "mono": "'IBM Plex Mono', 'Fira Code', monospace",
9
+ "display": "'Geist', 'Inter', sans-serif",
10
+ "sans": "'Geist', 'IBM Plex Sans Thai', sans-serif",
11
+ "mono": "'IBM Plex Mono', 'JetBrains Mono', monospace",
12
12
  "headingTracking": "-0.020em",
13
13
  "uiLineHeight": "1.25",
14
- "proseLineHeight": "1.60",
14
+ "proseLineHeight": "1.70",
15
15
  "thaiHeadroom": "4px"
16
16
  },
17
17
  "color": {
18
- "canvas": "#0c0e14",
18
+ "canvas": "#0a0d14",
19
19
  "surfaceRaised": "#141721",
20
20
  "surfaceInset": "#090a0f",
21
21
  "borderSubtle": "rgba(255, 255, 255, 0.09)",
22
- "borderFocus": "oklch(0.68 0.20 250)",
23
- "accent": "oklch(0.65 0.20 250)",
24
- "accentForeground": "#ffffff",
22
+ "borderFocus": "oklch(0.85 0.18 198)",
23
+ "accent": "oklch(0.85 0.18 198)",
24
+ "accentForeground": "#0a0d14",
25
25
  "status": {
26
- "info": "oklch(0.68 0.20 250)",
26
+ "info": "oklch(0.85 0.18 198)",
27
27
  "success": "oklch(0.72 0.18 145)",
28
28
  "warning": "oklch(0.78 0.16 75)",
29
29
  "critical": "oklch(0.62 0.22 25)"
30
30
  }
31
31
  },
32
32
  "geometry": {
33
- "radiusBase": "6px",
33
+ "radiusBase": "4px",
34
34
  "radiusOuter": "8px",
35
- "concentricFormula": "max(0px, 8px - 1px - 4px) = 3px",
35
+ "concentricFormula": "max(0px, 8px - 4px) = 4px",
36
36
  "scalingFormula": "clamp(0.97, 1 - 2.2/max(W, H), 0.995)",
37
37
  "hitTargetMinTouch": "44px"
38
38
  },
39
39
  "motion": {
40
40
  "profile": "precision",
41
- "durationEntry": "140ms",
41
+ "durationEntry": "120ms",
42
42
  "durationExit": "90ms",
43
43
  "easingEntry": "cubic-bezier(0.16, 1, 0.3, 1)",
44
44
  "easingExit": "cubic-bezier(0.4, 0, 1, 1)"
@@ -50,4 +50,4 @@
50
50
  "MD004_DEAD_BUTTON_CONTRACT",
51
51
  "MD101_BENTO_ROW_FLOW"
52
52
  ]
53
- }
53
+ }
@@ -120,8 +120,15 @@ Scope: text rendered in the UI being built; does not apply to chat replies or sk
120
120
  - **NO Unjustified Table-to-Card Conversion:** ห้ามแปลงตารางข้อมูลเชิงวิเคราะห์/พิกัด/ราคา ให้เป็นการ์ดสี่เหลี่ยมเรียงต่อกัน หากการแปลงนั้นทำให้ผู้ใช้สูญเสียความสามารถในการสแกนเปรียบเทียบค่าทางสายตา (Visual Row Scanning)
121
121
  - **NO Workflow-Agnostic Responsive Stacking:** บนมือถือ ห้ามแค่สั่ง `grid-cols-1` ทื่อๆ โดยไม่จัดลำดับความสำคัญใหม่ หน้าทำงานระดับวิศวกรรมต้องตรึงเครื่องมือหลักและแผนที่/กราฟไว้ด้านบนเสมอ
122
122
 
123
- 2. **Interaction Slop (Dead Feedback):**
123
+ 2. **Interaction Slop & Design Theater (The Unglamorous Gaps):**
124
+ - **NO Design Theater:** ห้ามสร้างหน้าจอสวยที่ขาดกลไกเบื้องหลังที่จำเป็น เช่น เมื่อผู้ใช้กดกระทำ (Action) ห้ามเงียบเฉย ต้องมี Micro-Feedback ตอบสนองภายใน $\le 100$ms เสมอ
125
+ - **NO Dead-End Error States (Service Recovery Paradox):** ห้ามแสดงข้อความแจ้งเตือนสีแดงลอยๆ โดยไม่มีทางออก ต้องบอกความจริงภาษามนุษย์ + ยืนยันความปลอดภัยข้อมูล + มีปุ่ม Action กู้คืนใน 1 คลิก (Retry / Undo / Contact)
124
126
  - **NO Cosmetic Hover on Static Elements:** ห้ามใส่ `hover:-translate-y-1` หรือ Hover Glow บนการ์ดที่คลิกไม่ได้และไม่มี Navigation Link
125
- - **NO Broken State Contract:** ทุกปุ่มต้องมีสถานะครบ 6 ชั้น (`default → hover → pressed → focus-visible → disabled/loading → success/error`) ห้ามมีปุ่มที่กดแล้วนิ่งสนิท
127
+ - **NO Broken State Contract:** ทุก Interactive Component และปุ่มต้องรองรับสถานะตาม **10-State Machine Matrix** (`default → hover → pressed → focus-visible → loading-skeleton (200ms delay) → empty (3 forms) → error (actionable recovery) → disabled → partial-swr → overflow (min-width: 0)`) ห้ามมีปุ่มที่กดแล้วนิ่งสนิท
126
128
  - **NO Accent Color Inflation:** สีเน้น (Accent Color) ต้องใช้ไม่เกิน 10-15% ของพื้นที่หน้าจอทั้งหมด ห้ามระบายสีเน้นลงบนไอคอน หัวข้อ และการ์ดทุกใบจนปุ่ม CTA สูญเสียแรงดึงดูดสายตา (Visual Gravity)
127
129
 
130
+ 3. **Optical Geometry & Component Craft Slop (Hit-Target Conflation):**
131
+ - **NO Unpadded Boundary Collision on Sliders/Pills:** ห้ามวางแถบสเกลหรือเส้นสถานะ (`width: 100%`) ในกล่องแคปซูลโค้งมน (`border-radius: full / >10px`) ที่มีสีพื้นหลังหรือเส้นกรอบ โดยไม่มีระยะเว้นสายตาอย่างน้อย `12px` (`padding: 0 12px;`)
132
+ - **NO Hit-Target Visual Contamination (The Invisible Touch Halo Rule):** เมื่อทำขนาดปุ่ม/แถบควบคุม $\ge 44$px ตามเกณฑ์การเข้าถึง ห้ามใส่สีพื้นหลังทึบลงบนกล่อง 44px ให้คงสภาพกล่อง 44px เป็นสีโปร่งใส (Transparent Hit Box) แล้วปล่อยให้แถบ Visual Track ขนาด 4px หรือไอคอนอยู่ตรงกลางอย่างอิสระ
133
+ - **NO Stretched Dash Frequency Spectrum:** ห้ามทำ Audio Spectrum ด้วย Flex Div ขยายเต็มความกว้างหน้าจอจนกลายเป็นขีดนอนแบน ต้องใช้แท่งความถี่แนวตั้ง 32-48 แท่ง (กว้าง 3-4px) ตามเส้นโค้งความถี่เสียงจริง
134
+
@@ -1,14 +1,10 @@
1
- ---
2
- name: brand-design-md
3
- description: "คลังต้นแบบดีไซน์หน้าเว็บและ UI จาก 73 แบรนด์ระดับโลก (Stripe, Linear, Apple, Vercel) — ใช้เมื่อต้องการดึงโทนสี ฟอนต์ และการจัดวางเว็บระดับพรีเมียม (Production brand design tokens, HEX/HSL palettes, typography, and layout specs from 73 top tech brands)"
4
- ---
5
-
6
1
  # Brand Design System Intelligence (Awesome DESIGN.md)
7
2
 
8
- This skill provides direct access to **73 production-grade `DESIGN.md`** design specifications from world-class brands, cloned from [VoltAgent/awesome-design-md](https://github.com/VoltAgent/awesome-design-md).
3
+ คลังมาตรฐานสถาปัตยกรรมและโทเค็นการออกแบบจาก **74 แบรนด์ระดับโลก & Presets มาตรฐาน** สำหรับใช้ร่วมกับโหมด `/medesign like <แบรนด์>` หรือ `/medesign <แบรนด์>`
9
4
 
10
- ## Available Brands (73 Brands)
5
+ ## Available Brands (74 Brands)
11
6
 
7
+ - **Mission-Critical Engineering & Telemetry:** `metha` (Cadastral & GIS Cockpit, ISA-101 Situational Awareness, Deep Slate `#0a0d14`, Hairline `rgba(255,255,255,0.09)`, Electric Cyan `oklch(0.85 0.18 198)`, Tabular Mono)
12
8
  - **Developer Tools & SaaS:** `linear.app`, `stripe`, `vercel`, `supabase`, `raycast`, `posthog`, `resend`, `sentry`, `warp`, `hashicorp`, `mintlify`, `clickhouse`, `mongodb`, `cursor`, `expo`, `sanity`, `composio`, `airtable`, `cal`, `clay`, `opencode.ai`, `lovable`
13
9
  - **AI & LLM Platforms:** `claude`, `elevenlabs`, `mistral.ai`, `together.ai`, `x.ai`, `replicate`, `runwayml`, `cohere`, `minimax`, `ollama`, `voltagent`
14
10
  - **Productivity & Collaboration:** `notion`, `figma`, `framer`, `webflow`, `miro`, `slack`, `superhuman`, `zapier`, `intercom`
@@ -19,24 +15,27 @@ This skill provides direct access to **73 production-grade `DESIGN.md`** design
19
15
 
20
16
  ## How to Apply a Brand Design System
21
17
 
22
- When the user asks to build or style an interface like a specific brand (e.g., *"Make it look like Linear"*, *"Use Stripe style"*, or *"Design a dark SaaS dashboard like Supabase"*):
23
-
24
- 1. **Locate the Brand Specification:**
25
- Primary path: `references/brand-design-tokens.md` หรือ `awesome-design-md-src/design-md/<brand_name>/DESIGN.md`
26
- *(Example: `awesome-design-md-src/design-md/linear.app/DESIGN.md`)*
27
-
28
- 2. **Read the Token Definitions:**
29
- - **Colors:** Extract the exact semantic hex codes (`primary`, `canvas`, `surface-1` through `surface-4`, `hairline`, `ink`, `ink-muted`).
30
- - **Typography:** Apply the specified font families, font sizes, line heights, and letter spacing (tracking).
31
- - **Component Styles:** Replicate the cards, buttons, input fields, badges, and focus rings defined in the document.
32
- - **Elevation & Lighting:** Use the subtle gradients, hairline borders (e.g. `1px solid rgba(255,255,255,0.08)`), and glow effects.
33
-
34
- 3. **Enforce Cohesion:**
35
- Never mix random colors with a brand's palette. Always build the CSS Variables (`:root`) directly from the `DESIGN.md` specification.
36
-
37
- ## Updating the Collection
38
-
39
- To pull latest brands from upstream:
40
- ```powershell
41
- git -C "path/to/awesome-design-md-src" pull
42
- ```
18
+ เมื่อผู้ใช้สั่งออกแบบตามแบรนด์ (เช่น `/medesign like linear`, `/medesign like stripe`, `/medesign metha`):
19
+
20
+ 1. **ลำดับการค้นหาไฟล์สเปก (Resolution Hierarchy & Fallback):**
21
+ - **Preset ภายในระบบ:** หากเป็น `metha`, `apple`, `tesla` ให้อ่านจาก `presets/<name>/guidelines.md` และ `presets/<name>/design-tokens.css`
22
+ - **Upstream Cache:** หากมีโฟลเดอร์ `awesome-design-md-src/design-md/<brand>/DESIGN.md` ให้อ่านสเปกจากไฟล์ดังกล่าว
23
+ - **Live Web Extraction Fallback:** หากไม่มีไฟล์ในเครื่อง และเข้าถึงอินเทอร์เน็ตได้ ให้เรียกโหมด `/medesign extract <url>` เพื่อสกัดโทเค็นสดจากเว็บไซต์จริง
24
+ - **User Input Fallback:** หากไม่มีไฟล์ในเครื่องและเข้าเว็บไม่ได้ ให้แจ้งผู้ใช้ตามตรงและขอ URL หรือภาพหน้าจอ ห้ามเดาหรือแต่งค่า Token ขึ้นเองจากความจำเด็ดขาด (Anti-Hallucination)
25
+
26
+ 2. **ดึงโทเค็นหลัก 4 เลเยอร์:**
27
+ - **Colors:** สี Canvas, Surface, Hairline, และ Accent หลัก (เช่น Linear Dark `#08090a`, Supabase Emerald, Metha Electric Cyan `#00f5fb`)
28
+ - **Typography:** คู่ฟอนต์ละติน-ไทย และ Line-height (เช่น Linear ใช้ `Geist` + `Noto Sans Thai`)
29
+ - **Component Geometry:** รัศมีขอบ Concentric Radii และขนาดปุ่มตาม Control Ladder
30
+ - **Lighting & Surface:** ใช้เส้น Hairline 1px และยกเลิกเงาดำฟุ้งบนการ์ด In-flow ทั้งหมด
31
+
32
+ 3. **Brand-to-Layout Pairing Matrix (เฉพาะงาน App & Dashboard):**
33
+ > [!IMPORTANT]
34
+ > **ลำดับความสำคัญ:** สิ่งที่ผู้ใช้ระบุใน Brief Intake ชนะ Pairing Matrix นี้เสมอ และ Pairing Matrix มีผลบังคับเฉพาะงานประเภท Web Application, Dashboard, และ Cockpit เท่านั้น (หากเป็น Landing Page, Blog, หรือ Marketing ให้ใช้ Layout มาตรฐานของหน้านั้นๆ)
35
+
36
+ - **Metha / Engineering Telemetry:** 3-Pane Cockpit Architecture (Top coordinate command deck, Left layer rail, Center spatial canvas, Right precision telemetry inspector & traverse table).
37
+ - **BMW / Tesla / Automotive:** 3-Pane Cockpit Architecture (Top Command Deck, Left Telemetry/Filmstrip, Center Canvas, Right Docked Inspector).
38
+ - **Linear / Raycast / DevTools:** Split Navigation Rail + Command Palette (Cmd+K) + High-density tabular grid with instant inline actions.
39
+ - **Apple / Consumer Luxury:** Floating Frosted Glass Header + Generous Asymmetric Bento + Floating Action Capsules + Concentric Card Physics.
40
+ - **Stripe / Fintech:** Seamless Multi-step Flow + Sticky Progress Summary on right + Clean Form Fields with micro-glow focus.
41
+ - **Notion / Productivity:** Full-bleed distraction-free canvas + Side peek drawer + Minimalist Slash command menu.
@@ -0,0 +1,90 @@
1
+ # Brief Intake Gate (v2.3)
2
+
3
+ ด่านบังคับก่อนเขียนโค้ด UI ทุกงานที่เป็น new / revamp / like
4
+ ข้ามได้เฉพาะ: ผู้ใช้ระบุเป้าหมายชัดเจนแล้วสั่ง "ลุยเลย" หรือ "skip intake" / แก้งานระดับ "จุดเล็ก" (แตะไม่เกิน 1 ไฟล์ และไม่เปลี่ยน layout/สีหลัก/ฟอนต์)
5
+
6
+ > [!IMPORTANT]
7
+ > **กฎเหล็กเรื่องเป้าหมายงาน (The Target Subject Invariant):**
8
+ > - **นิยามของ "ระบุเป้าหมายแล้ว":** มีอย่างใดอย่างหนึ่ง: มีไฟล์/โค้ดเดิมแนบมา, มีชนิดงานที่ระบุชัดเจน (เช่น landing page, dashboard, เว็บพอร์ต, สไลด์ ฯลฯ), หรือมีบริบทงานก่อนหน้าในบทสนทนาที่เจาะจงชัดเจน
9
+ > - **หากยังไม่ระบุเป้าหมาย:** ห้ามเดาโจทย์ ห้ามแต่งเนื้อหาเอง และห้ามกระโดดเขียนโค้ดเด็ดขาด
10
+ > - **การถามเพื่อคลายความกำกวม (One-Turn Max 3 Questions):**
11
+ > - บรรทัดแรกต้องประกาศ `โหมด: ...` เสมอ
12
+ > - ถามคำถามปลายเปิดโดย**ไม่ใส่ตัวอย่างนำทาง** และใช้ภาษาเดียวกับผู้ใช้: *"จะให้สร้างหรือแก้อะไรครับ?"*
13
+ > - หากมีช่อง brief อื่นที่ขาด ให้รวมถามในข้อความเดียวกัน (รวมกันไม่เกิน 3 ข้อ)
14
+ > - หากผู้ใช้สั่ง "ลุยเลย" แต่ยังไม่ระบุเป้าหมาย: ให้ถามข้อเดียวสั้นๆ เท่านั้นว่า *"จะให้สร้างหรือแก้อะไรครับ?"* (เมื่อผู้ใช้ตอบ จึงล็อก Direction A แล้วลุยทันที)
15
+ > - หากผู้ใช้ตอบว่า "อะไรก็ได้" หรือ "ตามสบาย": ให้เลือกชนิดงานทั่วไป 1 อย่าง ประกาศเป็น "สมมติฐาน: ..." บรรทัดเดียว แล้วไปต่อได้ทันที
16
+
17
+ ---
18
+
19
+ ## 0. ล็อกโหมด (Single Source of Truth)
20
+
21
+ คำสั่งที่ผู้ใช้พิมพ์ (`new`, `revamp`, `like`) ชนะการจับคำในข้อความเสมอ ถ้าไม่ได้พิมพ์โหมด ให้อนุมานตามลำดับนี้:
22
+
23
+ 1. **อ้างอิงแบรนด์หรือสไตล์ (`like`):**
24
+ - มี URL หรือชื่อแบรนด์ที่มีคำขยายว่า "เหมือน", "สไตล์", "แบบ", "อ้างอิง", "like", "inspired by" -> `like`
25
+ - หากผู้ใช้ระบุ "ทำใหม่หมดเหมือน Stripe" ให้ถือเป็น `like` (สร้างใหม่โดยอิงสไตล์แบรนด์ ไม่อิงไฟล์เดิม)
26
+ - หากมีไฟล์เดิมแนบมากับ `like` (และไม่ได้สั่งทำใหม่หมด): ให้คง Business Logic และ Props เดิมไว้ เปลี่ยนเฉพาะ Visual Layer
27
+ - คำสั่ง Preset: `/medesign apple`, `tesla`, `metha` หรือ `/medesign <brand>` ถือเป็น `like` ที่มีสเปกพร้อมใช้ (ข้ามการค้นหาโทเค็น แต่ยังคงต้องรู้เป้าหมายงานตามกฎเหล็กด้านบน และตรวจ §1 เรื่องข้อจำกัด โดยรวมถามในรอบเดียว)
28
+ - *ข้อยกเว้น:* หากชื่อแบรนด์เป็นโจทย์ของงาน (เช่น "ทำเว็บขายรองเท้า Nike") ไม่ใช่สไตล์อ้างอิง ให้จัดเป็น `new`
29
+
30
+ 2. **มีไฟล์/โค้ดเดิมแนบมา (`revamp`):**
31
+ - มีไฟล์หรือโค้ดเดิมแนบมา และไม่ได้ระบุว่า "ทำใหม่หมด" -> `revamp`
32
+
33
+ 3. **สร้างใหม่จากศูนย์ (`new`):**
34
+ - ผู้ใช้ระบุว่า "ทำใหม่หมด" / "start over" หรือไม่มีทั้งไฟล์และแบรนด์อ้างอิง -> `new`
35
+
36
+ บรรทัดแรกของคำตอบต้องประกาศ `โหมด: new` (หรือ `revamp` / `like`) เสมอ ห้ามถามเรื่องโหมดซ้ำ และห้ามใส่วงเล็บหรือข้อความอื่นต่อท้าย (เพื่อให้ตรวจจับตรงกัน)
37
+ อนุมานไม่ได้จริงๆ ถามข้อเดียวเท่านั้น: "งานนี้คือ สร้างใหม่ / แก้ของเดิม / ทำตามเว็บอ้างอิง?"
38
+
39
+ **เส้นทางของแต่ละโหมด:**
40
+ - `new` -> `references/design-core.md` -> `references/quality-gate.md`
41
+ - `revamp` -> `references/redesign-audit.md` -> `references/quality-gate.md`
42
+ - `like`:
43
+ - หากเป็นแบรนด์ที่มีสเปกใน `presets/<name>/` หรือ `references/brand-design-tokens.md` (เฉพาะแบรนด์ที่มีสเปกโทเค็นกำกับ) -> อ่านสเปกก่อน -> เสนอ Direction A/B ได้ทันที
44
+ - **like ที่ไม่มีสเปกในเครื่อง:**
45
+ 1. ห้ามแต่งตัวเลขหรือค่าสีขึ้นเองจากความจำเด็ดขาด (Anti-Hallucination)
46
+ 2. ใช้ภาษาธรรมชาติสื่อสารกับผู้ใช้ (ห้ามหลุดชื่อกฎภายใน เช่น Token Spec Hierarchy หรือ Anti-Hallucination Invariant) เช่น *"ผมไม่มีไฟล์สเปกของแบรนด์นี้ในเครื่อง จะดึงสดจากเว็บจริงให้แทนครับ"*
47
+ 3. หากเข้าถึงอินเทอร์เน็ตได้: ให้สกัดจากเว็บจริงผ่าน `/medesign extract <url>` โดยอัตโนมัติ (เลือกหน้าหลักเป็นค่าเริ่มต้น ไม่ต้องถามขออนุญาตผู้ใช้) เมื่อได้สเปกแล้วจึงเสนอ 2 ทิศทาง A/B
48
+ 4. หากเข้าอินเทอร์เน็ตไม่ได้ หรือไม่มีเครื่องมือตรวจจับ: แจ้งผู้ใช้ตามตรงว่าเข้าเว็บไม่ได้ และขอ URL หรือภาพหน้าจอ ห้ามแอบใส่ค่าสีจากความจำ
49
+ - จากนั้นไปที่ `references/design-core.md` -> `references/quality-gate.md` (ห้ามเข้า `audit`)
50
+
51
+ ## 1. ตรวจ Brief 5 ช่อง (One-Roundtrip Alignment)
52
+
53
+ เป้าหมาย+ผู้ใช้ / อารมณ์ 3 คำ / อ้างอิง (ยืมอะไร ไม่ยืมอะไร) / ไม่เอา / ข้อจำกัด (stack, อุปกรณ์, ภาษา, สิ่งที่ห้ามแตะ)
54
+ - ช่องไหนผู้ใช้ตอบแล้ว ใช้เลย ห้ามถามซ้ำ และห้ามถามสิ่งที่อ่านได้จากโค้ดที่แนบ
55
+ - **One-Shot Alignment:**
56
+ - หากรู้เป้าหมายและ Brief ครบแล้ว: เสนอ 2 ทิศทาง (§2) ทันทีในข้อความแรก
57
+ - หากขาด: รวมคำถามเป้าหมายและ Brief ที่ขาดถามในข้อความเดียว ไม่เกิน 3 คำถาม พร้อมเสนอทิศทางชั่วคราวให้ตอบ "ok" หรือ "ลุยเลย" ได้ในรอบเดียว
58
+ - การตอบ **"ok"** ต่อทิศทางชั่วคราว มีความหมายเท่ากับ: `ยอมรับค่าเริ่มต้นที่เสนอ + เลือก Direction A`
59
+ - ใช้ `ask_question` ถ้ามี หากไม่มีให้ถามเป็นข้อความธรรมดาในแชต ถามได้รอบเดียวเท่านั้น
60
+
61
+ ## 2. เสนอ 2 ทิศทาง
62
+
63
+ Direction A ใกล้ brief ที่สุด / Direction B ต่างอย่างชัดเจน (ต่างกันอย่างน้อย 2 ใน 4: โครง layout, สีหลัก, คู่ฟอนต์, ความหนาแน่น)
64
+ แต่ละทิศทางไม่เกิน 5 บรรทัด:
65
+ - ชื่อ + อารมณ์ 1 บรรทัด
66
+ - Layout และความหนาแน่น
67
+ - สี 3 ค่า (hex หรือ oklch) + ฟอนต์ (Latin + ไทย)
68
+ - Motion: เลือก 1 ใน 4 Profiles มาตรฐานเท่านั้น (`precision`, `soft-settle`, `spring-settle`, `instant`) ห้ามแต่งชื่อ profile เอง
69
+ - เหมาะเมื่อ / เสี่ยงเมื่อ
70
+
71
+ เพิ่มตามโหมด:
72
+ - `revamp`: ระบุ "คงอะไร / เปลี่ยนอะไร"
73
+ - `like`: ระบุ "ยืมอะไร / ไม่ยืมอะไร" (A ใกล้ต้นฉบับ, B ตีความใหม่ให้เข้าตัวตนผู้ใช้) ห้ามลอกโลโก้ ข้อความ รูป
74
+ - **Hierarchy Rule:** สิ่งที่ผู้ใช้เลือกใน Intake ชนะ Layout Pairing Matrix เสมอ และ Matrix ใช้เฉพาะงาน App/Dashboard/Cockpit (หากเป็น Landing Page/Marketing ให้ใช้ Layout ที่ผู้ใช้เลือก หรือค่าเริ่มต้นใน `references/design-core.md`)
75
+
76
+ ปิดท้ายด้วย: "เลือก A / B / ผสม (ระบุ) หรือพิมพ์ 'ลุยเลย' (ผมจะใช้ A)"
77
+ *(AI สามารถปรับปรุงรายละเอียดทิศทาง A/B ได้ 1 ครั้งหลังได้รับคำตอบจากผู้ใช้)*
78
+
79
+ ## 3. Gate & ทางลัด
80
+
81
+ - ห้ามเขียนโค้ดหรือสร้างไฟล์จนกว่าผู้ใช้เลือก (หรือสั่ง "ลุยเลย")
82
+ - **ลุยเลย Escape Hatch:**
83
+ - เมื่อผู้ใช้ระบุเป้าหมายชัดเจนแล้วสั่ง "ลุยเลย" / "skip intake": ให้ประกาศ `Locked Direction: Direction A` 3 บรรทัด แล้วลงมือเขียนโค้ดทันทีโดยไม่ถามซ้ำ
84
+ - หากสั่ง "ลุยเลย" แต่ยังไม่ระบุเป้าหมายงาน (เช่น `/medesign new ลุยเลย`): ให้ถามข้อความเดียวสั้นๆ ก่อนว่า *"จะให้สร้างหรือแก้อะไรครับ?"* (ไม่ใส่ตัวอย่างชี้นำ) เมื่อผู้ใช้ตอบ จึงล็อก Direction A แล้วลงมือทันที
85
+ - เมื่อเลือกแล้ว สรุป "Locked Direction" 3 บรรทัด (บันทึกใน DESIGN.md ถ้ามี) แล้วไป workflow ของโหมด -> `quality-gate.md`
86
+
87
+ ## 4. ข้อห้าม
88
+
89
+ - ห้ามใช้ `user-profile.json` หรือ DNA ส่วนตัว เว้นแต่ผู้ใช้สั่ง `/medesign auto` หรือ `/medesign metha` เองโดยตรง (ห้ามอนุมานจาก Path โฟลเดอร์ของเครื่อง)
90
+ - ห้ามเสนอเกิน 2 ทิศทาง ห้ามถามเกิน 1 รอบ