@mstar-harness/opencode 0.6.20 → 0.6.21

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.
@@ -4,13 +4,137 @@ This document defines the normative structure, token naming conventions, and rul
4
4
 
5
5
  ## 1. File format
6
6
 
7
- - Plain Markdown (`.md`) in project root
7
+ - Markdown (`.md`) with YAML frontmatter in project root
8
8
  - UTF-8 encoding
9
+ - **YAML frontmatter** (`---` delimited block at top) contains structured, machine-readable token values
10
+ - **Markdown body** (everything after the `---` closing delimiter) contains human/agent-readable documentation, usage rules, and design intent
9
11
  - Multi-theme: `DESIGN.md` (light/default) + `DESIGN.dark.md` (dark variant, same token names)
10
12
 
13
+ ## 1.5. YAML Frontmatter — Structured Token Store
14
+
15
+ The YAML frontmatter is the **single source of truth** for token values. The Markdown body is supplementary documentation. Tools and agents MUST parse the frontmatter for token resolution; the body prose explains intent and rules.
16
+
17
+ ### Version field
18
+
19
+ ```yaml
20
+ version: 0.1.0
21
+ ```
22
+
23
+ Format version identifier. Current value: `0.1.0`.
24
+
25
+ ### Name and description
26
+
27
+ ```yaml
28
+ name: "[Design System Name]"
29
+ description: "[Brief description, noting light/dark theme relationship]"
30
+ ```
31
+
32
+ ### Colors (`colors:`)
33
+
34
+ Flat map of token names to hex (or `oklch()` for P3) values. All scales are flat — not nested:
35
+
36
+ ```yaml
37
+ colors:
38
+ background-100: "#ffffff"
39
+ gray-1000: "#171717"
40
+ blue-700: "#006bff"
41
+ blue-700-p3: "oklch(57.61% 0.2508 258.23)"
42
+ ```
43
+
44
+ - Color token names follow the `{namespace}-{step}` convention (see §3)
45
+ - `*-p3` variants are optional wide-gamut equivalents in `oklch()` for Display P3 screens
46
+ - Alpha tokens use `#rrggbbaa` hex-with-alpha format (8 hex digits)
47
+ - All tokens are at the top level of `colors:` — no sub-grouping by family
48
+
49
+ ### Typography (`typography:`)
50
+
51
+ Map of tokens to structured sub-objects:
52
+
53
+ ```yaml
54
+ typography:
55
+ copy-16:
56
+ fontFamily: Geist Sans
57
+ fontSize: 16px
58
+ fontWeight: 400
59
+ lineHeight: 1.6
60
+ letterSpacing: 0
61
+ ```
62
+
63
+ Each typography token sub-object contains exactly five properties: `fontFamily`, `fontSize`, `fontWeight`, `lineHeight`, `letterSpacing`. Typography token names follow the `{role}-{size}` convention (see §3).
64
+
65
+ ### Spacing (`spacing:`)
66
+
67
+ Flat map of numeric keys to pixel values:
68
+
69
+ ```yaml
70
+ spacing:
71
+ base: 4px
72
+ 1: 4px
73
+ 2: 8px
74
+ 3: 12px
75
+ 4: 16px
76
+ 6: 24px
77
+ 8: 32px
78
+ 10: 40px
79
+ 16: 64px
80
+ 24: 96px
81
+ ```
82
+
83
+ - `base` declares the base unit (typically `4px` or `8px`)
84
+ - Numeric keys are multipliers on the base unit
85
+
86
+ ### Border radius (`rounded:`)
87
+
88
+ Flat map of semantic keys to pixel values:
89
+
90
+ ```yaml
91
+ rounded:
92
+ sm: 6px
93
+ md: 12px
94
+ lg: 16px
95
+ full: 9999px
96
+ ```
97
+
98
+ ### Components (`components:`)
99
+
100
+ Map of component variant names to structured sub-objects. Values reference other frontmatter keys using `{path}` syntax:
101
+
102
+ ```yaml
103
+ components:
104
+ button-primary:
105
+ backgroundColor: "{colors.gray-1000}"
106
+ textColor: "{colors.background-100}"
107
+ typography: "{typography.button-14}"
108
+ rounded: "{rounded.sm}"
109
+ padding: "0 10px"
110
+ height: 40px
111
+ ```
112
+
113
+ - `{colors.X}` resolves to the value of `colors.X` in the same file's frontmatter
114
+ - `{typography.X}` resolves to the typography object (not a single value — consumers use the full object)
115
+ - `{rounded.X}` resolves to the border-radius value
116
+ - Direct values (like `"#ffffff"` or `40px`) are literal and do not reference other keys
117
+
118
+ ### Completeness level in frontmatter
119
+
120
+ The frontmatter always contains the full key structure for every level. Level 2+ keys that are not yet filled are YAML-commented out with `# LEVEL2_PLACEHOLDER:` comments. The audit workflow (see `completeness-checklist.md`) checks which keys are active (uncommented) vs. placeholder (commented or containing `[LEVEL` / placeholder values).
121
+
122
+ ### Frontmatter vs. body contract
123
+
124
+ | Aspect | Frontmatter (YAML) | Body (Markdown) |
125
+ |--------|-------------------|-----------------|
126
+ | Token values | **SSOT** — parse here | Descriptive prose referencing tokens |
127
+ | Color hex values | All active tokens here | Explanation of scale intent, usage rules |
128
+ | Typography specs | Exact CSS properties | Role descriptions, intent encoding |
129
+ | Spacing scale | Exact pixel values | Rhythm rules, usage patterns |
130
+ | Component tokens | Variants with references | State rules, size descriptions, focus patterns |
131
+ | Elevation | N/A (body-only) | box-shadow values per element |
132
+ | Motion | N/A (body-only) | Duration and easing tables |
133
+ | Voice rules | N/A (body-only) | Copy conventions and examples |
134
+
11
135
  ## 2. Section definitions
12
136
 
13
- Each section below maps to one heading in `DESIGN.md`. Sections are ordered as shown in Vercel Geist (recommended), but projects may omit sections not yet relevant.
137
+ Each section below maps to one heading in `DESIGN.md`. Sections are ordered as shown in Vercel Geist (recommended), but projects may omit sections not yet relevant. Where a section has corresponding YAML frontmatter fields, the frontmatter holds the canonical values and the body provides documentation.
14
138
 
15
139
  ### 2.1 Overview
16
140
 
@@ -39,6 +163,8 @@ This is the Light theme. The Dark theme lives at `/DESIGN.dark.md`.
39
163
 
40
164
  **Purpose:** Define every color used in the UI, organized into scales.
41
165
 
166
+ **SSOT:** All concrete color values live in the frontmatter `colors:` map. The body prose below explains scale conventions and usage intent.
167
+
42
168
  **Conventions:**
43
169
  - Each color scale has 10 steps (`100`–`1000`), encoding intent:
44
170
  - `100`: default background
@@ -52,44 +178,34 @@ This is the Light theme. The Dark theme lives at `/DESIGN.dark.md`.
52
178
  - `900`: secondary text/icons
53
179
  - `1000`: primary text/icons
54
180
  - **Background scales** (`background-100`, `background-200`): page/card surfaces
55
- - **Alpha scales** (`gray-alpha-*`): translucent overlays, borders, dividers — layer over any background
181
+ - **Alpha scales** (`gray-alpha-*`): translucent overlays, borders, dividers — layer over any background; use `#rrggbbaa` hex-with-alpha or `rgba()` notation
56
182
  - **Solid scales** (`gray-*`): text, opaque fills — hold contrast on any surface
57
183
  - **Accent scales** (`blue`, `red`, `amber`, `green`, `teal`, `purple`, `pink`): carry meaning — success, error, warning, links, focus
58
184
  - Accent scales may use fewer steps if not all needed
59
185
 
60
- **Values:** sRGB hex (`#ffffff`), optionally with wide-gamut equivalents in `oklch()`.
186
+ **Values:** sRGB hex (`#ffffff`), optionally with wide-gamut equivalents in `oklch()` as `*-p3` suffix keys.
61
187
 
62
- **Example:**
188
+ **Example frontmatter:**
63
189
 
190
+ ```yaml
191
+ colors:
192
+ background-100: "#ffffff"
193
+ background-200: "#f5f5f5"
194
+ gray-100: "#f5f5f5"
195
+ gray-700: "#333333"
196
+ gray-1000: "#111111"
197
+ blue-700: "#0066ff"
198
+ red-700: "#e60000"
64
199
  ```
65
- ## Colors
66
200
 
67
- ### Background
68
- | Token | Value |
69
- |-------|-------|
70
- | background-100 | #ffffff |
71
- | background-200 | #f5f5f5 |
72
-
73
- ### Gray (solid)
74
- | Token | Value |
75
- |-------|-------|
76
- | gray-100 | #f5f5f5 |
77
- | gray-700 | #333333 |
78
- | gray-1000 | #111111 |
79
-
80
- ### Accent
81
- | Token | Value |
82
- |-------|-------|
83
- | blue-700 | #0066ff |
84
- | red-700 | #e60000 |
85
- ```
86
-
87
- **Level relevance:** Level 1+ requires at least background, gray, and one accent. Level 2+ requires full 10-step scales, alpha scale, and all accent colors.
201
+ **Level relevance:** Level 1+ requires at least background, text (gray-900/1000), and one accent (blue-700, red-700, amber-700) active in frontmatter. Level 2+ requires all color scales uncommented and filled.
88
202
 
89
203
  ### 2.3 Typography
90
204
 
91
205
  **Purpose:** Define font families, sizes, weights, line heights, and letter spacing for every text role.
92
206
 
207
+ **SSOT:** All concrete typography values live in the frontmatter `typography:` map. The body prose explains role semantics and usage intent.
208
+
93
209
  **Conventions:**
94
210
  - **Heading tokens** (`heading-72` through `heading-14`): title pages and section headings
95
211
  - **Label tokens** (`label-20` through `label-12`): single-line scannable text — navigation, form labels, table headers
@@ -100,61 +216,63 @@ This is the Light theme. The Dark theme lives at `/DESIGN.dark.md`.
100
216
  - Token name encodes intended font size (e.g., `copy-14` ≈ 14px body copy)
101
217
  - Use tabular figures for numbers that need alignment
102
218
 
103
- **Example (minimal):**
104
-
105
- ```
106
- ## Typography
107
-
108
- ### Headings
109
- | Token | Font | Size | Weight | Line | Spacing |
110
- |-------|------|------|--------|------|---------|
111
- | heading-32 | Inter | 32px | 600 | 1.2 | -0.02em |
112
- | heading-20 | Inter | 20px | 600 | 1.3 | -0.01em |
113
-
114
- ### Body
115
- | Token | Font | Size | Weight | Line | Spacing |
116
- |-------|------|------|--------|------|---------|
117
- | copy-16 | Inter | 16px | 400 | 1.6 | 0 |
118
- | copy-14 | Inter | 14px | 400 | 1.5 | 0 |
219
+ **Example frontmatter (minimal):**
220
+
221
+ ```yaml
222
+ typography:
223
+ heading-32:
224
+ fontFamily: Inter
225
+ fontSize: 32px
226
+ fontWeight: 600
227
+ lineHeight: 1.2
228
+ letterSpacing: -0.02em
229
+ copy-16:
230
+ fontFamily: Inter
231
+ fontSize: 16px
232
+ fontWeight: 400
233
+ lineHeight: 1.6
234
+ letterSpacing: 0
119
235
  ```
120
236
 
121
- **Level relevance:** Level 1+ requires at least body text (one copy token) and one heading token. Level 2+ requires full heading/label/copy/button typography scale.
237
+ **Level relevance:** Level 1+ requires at least one copy and one heading token active in frontmatter. Level 2+ requires heading, label, copy, and button typography tokens.
122
238
 
123
239
  ### 2.4 Spacing & Layout
124
240
 
125
241
  **Purpose:** Define the spatial grid and responsive breakpoints.
126
242
 
243
+ **SSOT:** Spacing scale values live in the frontmatter `spacing:` map. Border radius values live in `rounded:`. Breakpoints are documented in the body.
244
+
127
245
  **Conventions:**
128
- - Base unit: 4px or 8px (consistent across the system)
246
+ - Base unit: 4px or 8px (declared as `spacing.base` in frontmatter)
129
247
  - Scale: `4, 8, 12, 16, 24, 32, 40, 64, 96` (on 4px) or equivalent on 8px
130
248
  - Three-step rhythm: small inside group → medium between groups → large between sections
131
249
  - Card padding: 24px default, 16px compact, 32px hero
132
250
  - Content max-width with responsive side padding
133
251
  - Breakpoints: provide explicit pixel values and names
134
252
 
135
- **Example:**
136
-
137
- ```
138
- ## Layout
139
-
140
- ### Spacing scale
141
- 4px, 8px, 12px, 16px, 24px, 32px, 40px, 64px, 96px
142
-
143
- ### Rhythm
144
- - 8px: inside a group (label + input, icon + text)
145
- - 16px: between related groups
146
- - 32-40px: between sections
147
-
148
- ### Breakpoints
149
- | Name | Width |
150
- |------|-------|
151
- | sm | 401px |
152
- | md | 601px |
153
- | lg | 961px |
154
- | xl | 1200px |
253
+ **Example frontmatter:**
254
+
255
+ ```yaml
256
+ spacing:
257
+ base: 4px
258
+ 1: 4px
259
+ 2: 8px
260
+ 3: 12px
261
+ 4: 16px
262
+ 6: 24px
263
+ 8: 32px
264
+ 10: 40px
265
+ 16: 64px
266
+ 24: 96px
267
+
268
+ rounded:
269
+ sm: 6px
270
+ md: 12px
271
+ lg: 16px
272
+ full: 9999px
155
273
  ```
156
274
 
157
- **Level relevance:** Level 1+ requires spacing scale and at least 2 breakpoints.
275
+ **Level relevance:** Level 1+ requires `spacing.base` and at least 5 scale steps in frontmatter, plus at least 2 breakpoints in body.
158
276
 
159
277
  ### 2.5 Elevation & Depth
160
278
 
@@ -238,33 +356,43 @@ Default: cubic-bezier(0.175, 0.885, 0.32, 1.1)
238
356
 
239
357
  **Purpose:** Define ready-to-use token values for common components.
240
358
 
359
+ **SSOT:** Component variant tokens live in the frontmatter `components:` map. Values reference other frontmatter keys using `{colors.X}`, `{typography.X}`, `{rounded.X}` syntax. The body prose documents state rules (hover/active/disabled/focus) and size variants.
360
+
241
361
  **Conventions:**
242
- - Each component gets: `backgroundColor`, `textColor`, `rounded`, `height` (and `borderColor` where applicable)
243
- - Size variants: default (40px), small (32px), large (48px)
362
+ - Each component variant gets: `backgroundColor`, `textColor`, `typography`, `rounded`, `height` (and `padding`, `borderColor` where applicable)
363
+ - Size variants: default (40px), small (32px), large (48px) — override only typography/padding/height
244
364
  - State mappings: hover steps foreground up one, active steps up two; border from 400→500→600
245
365
  - Focus ring: two-layer box-shadow (surface gap + accent ring)
246
366
  - Disabled: 100 fill + 700 text + not-allowed cursor
247
367
 
248
- **Example:**
249
-
250
- ```
251
- ## Components
252
-
253
- ### Button
254
- | Variant | Background | Text | Border | Radius | Height |
255
- |---------|-----------|------|--------|--------|--------|
256
- | primary | gray-1000 | background-100 | — | 6px | 40px |
257
- | secondary | background-100 | gray-1000 | gray-alpha-400 | 6px | 40px |
258
- | tertiary | transparent | gray-1000 | — | 6px | 40px |
259
- | error | red-800 | #fff | — | 6px | 40px |
260
-
261
- ### Input
262
- | Variant | Background | Text | Border | Radius | Height |
263
- |---------|-----------|------|--------|--------|--------|
264
- | default | background-100 | gray-1000 | gray-alpha-400 | 6px | 40px |
368
+ **Example frontmatter:**
369
+
370
+ ```yaml
371
+ components:
372
+ button-primary:
373
+ backgroundColor: "{colors.gray-1000}"
374
+ textColor: "{colors.background-100}"
375
+ typography: "{typography.button-14}"
376
+ rounded: "{rounded.sm}"
377
+ padding: "0 10px"
378
+ height: 40px
379
+ button-secondary:
380
+ backgroundColor: "{colors.background-100}"
381
+ textColor: "{colors.gray-1000}"
382
+ typography: "{typography.button-14}"
383
+ rounded: "{rounded.sm}"
384
+ padding: "0 10px"
385
+ height: 40px
386
+ input:
387
+ backgroundColor: "{colors.background-100}"
388
+ textColor: "{colors.gray-1000}"
389
+ typography: "{typography.label-14}"
390
+ rounded: "{rounded.sm}"
391
+ padding: "0 12px"
392
+ height: 40px
265
393
  ```
266
394
 
267
- **Level relevance:** Level 2+ requires at least Button and Input tokens. Level 3 requires full component library.
395
+ **Level relevance:** Level 2+ requires at least Button (primary, secondary) and Input tokens in frontmatter. Level 3 requires full component library.
268
396
 
269
397
  ### 2.9 Voice & Content
270
398
 
@@ -365,14 +493,16 @@ DESIGN.md tokens should map to implementation as follows:
365
493
 
366
494
  | DESIGN.md | Implementation |
367
495
  |-----------|---------------|
368
- | Color tokens | CSS custom properties (`--color-gray-100`) or theme object |
369
- | Typography tokens | CSS classes or Tailwind prose config |
370
- | Spacing scale | CSS custom properties or Tailwind spacing config |
371
- | Breakpoints | CSS media queries or Tailwind screens |
372
- | Elevation | `box-shadow` or Tailwind shadow config |
373
- | Motion | `transition` or animation library config |
374
- | Shapes | `border-radius` or Tailwind radius config |
375
- | Component tokens | Component prop defaults or CSS classes |
376
- | Voice rules | Linter rules or prompt context for copy generation |
377
-
378
- The agent consuming DESIGN.md is responsible for this mapping, not DESIGN.md itself. DESIGN.md stays implementation-agnostic.
496
+ | Frontmatter `colors:` | CSS custom properties (`--color-gray-100`) or theme object |
497
+ | Frontmatter `typography:` | CSS classes or Tailwind prose config |
498
+ | Frontmatter `spacing:` | CSS custom properties or Tailwind spacing config |
499
+ | Frontmatter `rounded:` | CSS custom properties or Tailwind radius config |
500
+ | Body breakpoints | CSS media queries or Tailwind screens |
501
+ | Frontmatter `components:` | Component prop defaults or CSS classes |
502
+ | Body elevation | `box-shadow` or Tailwind shadow config |
503
+ | Body motion | `transition` or animation library config |
504
+ | Body voice rules | Linter rules or prompt context for copy generation |
505
+
506
+ **Frontmatter references** in `components:` (e.g., `"{colors.gray-1000}"`) MUST be resolved by tracing the `{path}` back to the frontmatter key. For example, `"{colors.gray-1000}"` → `colors.gray-1000` `"#171717"`.
507
+
508
+ The agent consuming DESIGN.md is responsible for frontmatter parsing and reference resolution, not DESIGN.md itself. DESIGN.md stays implementation-agnostic.
@@ -9,10 +9,71 @@ This is Vercel's Geist design system as published at `vercel.com/design.md`, pre
9
9
  - It defines a complete Level 3 design system covering all sections
10
10
  - The token naming conventions (100-1000 step scale with intent encoding) are widely adopted
11
11
  - Light/Dark dual-theme pattern shows how to split same-name tokens across two files
12
+ - The YAML frontmatter + Markdown body split is the standard DESIGN.md file structure
12
13
 
13
14
  ---
14
15
 
15
- # Geist
16
+ ## YAML Frontmatter: Structured Token Store
17
+
18
+ Vercel Geist DESIGN.md uses a YAML frontmatter block (`---` ... `---`) as the **single source of truth for token values**. The Markdown body below is human-readable documentation. Every DESIGN.md file must follow this pattern.
19
+
20
+ ### Frontmatter structure
21
+
22
+ ```yaml
23
+ ---
24
+ version: 0.1.0
25
+ name: Geist
26
+ description: Vercel's Geist design system, Light theme.
27
+ colors:
28
+ background-100: "#ffffff"
29
+ gray-1000: "#171717"
30
+ blue-700: "#006bff"
31
+ # … all color tokens as flat map …
32
+ typography:
33
+ copy-16:
34
+ fontFamily: Geist Sans
35
+ fontSize: 16px
36
+ fontWeight: 400
37
+ lineHeight: 1.6
38
+ letterSpacing: 0
39
+ # … all typography tokens with 5 properties each …
40
+ spacing:
41
+ base: 4px
42
+ 1: 4px
43
+ 2: 8px
44
+ # … full scale …
45
+ rounded:
46
+ sm: 6px
47
+ md: 12px
48
+ lg: 16px
49
+ full: 9999px
50
+ components:
51
+ button-primary:
52
+ backgroundColor: "{colors.gray-1000}"
53
+ textColor: "{colors.background-100}"
54
+ typography: "{typography.button-14}"
55
+ rounded: "{rounded.sm}"
56
+ padding: "0 10px"
57
+ height: 40px
58
+ # … all component variants referencing other frontmatter keys …
59
+ ---
60
+ ```
61
+
62
+ > **Design note:** The frontmatter-body split is fundamental to the DESIGN.md format. The frontmatter is structured, parseable data; the body is prose documentation. This is the same pattern used by Jekyll, Hugo, and many static site generators — it's well-understood by tooling and agents. The `{colors.X}` reference syntax in components enables single-point-of-change: update `colors.gray-1000` in one place and all components that reference it automatically follow.
63
+
64
+ ### Key design decisions in the frontmatter
65
+
66
+ 1. **Flat color map, not nested by family** — `gray-100: "#…"` not `gray: {100: "#…"}`. This allows flat lookups and avoids deep nesting.
67
+ 2. **10-step color scale encodes intent** — `400 = border`, `700 = solid fill`, `1000 = primary text`. Agent reads the step number and knows the role.
68
+ 3. **All 5 typography properties per token** — no defaults assumed; every token is self-contained.
69
+ 4. **Reference syntax for components** — `"{colors.gray-1000}"` keeps components declarative and avoids value duplication.
70
+ 5. **Full frontmatter even for dark theme** — `design.dark.md` has the exact same frontmatter keys with different values.
71
+
72
+ ---
73
+
74
+ ## Markdown Body (documentation)
75
+
76
+ Below the frontmatter, the body provides human/agent-readable documentation:
16
77
 
17
78
  ## Overview
18
79
 
@@ -130,9 +191,10 @@ Copy is part of the design; keep it precise and free of filler.
130
191
 
131
192
  ## Key takeaways for creating your own DESIGN.md
132
193
 
133
- 1. **Encode intent in token names**, not just values `gray-400 = border`, `copy-14 = body text`
134
- 2. **State rules, not just values**"three-step spacing rhythm" is more useful than a raw scale
135
- 3. **Give negative examples** — agents need to know what NOT to do as much as what to do
136
- 4. **Make state derivable** — "100 200 300 on hover" means the agent can compute any component's state
137
- 5. **Tie tokens to concrete UI elements** — "card shadow", not "level-1 shadow"
138
- 6. **Voice rules should be mechanical** — fill-in-the-blank templates, not vague principles
194
+ 1. **Use YAML frontmatter as the token SSOT** structured colors, typography, spacing, rounded, and components in parseable form; the body is documentation
195
+ 2. **Encode intent in token names**, not just values — `gray-400 = border`, `copy-14 = body text`
196
+ 3. **State rules, not just values** — "three-step spacing rhythm" is more useful than a raw scale
197
+ 4. **Give negative examples** — agents need to know what NOT to do as much as what to do
198
+ 5. **Make state derivable** — "100 200 → 300 on hover" means the agent can compute any component's state
199
+ 6. **Tie tokens to concrete UI elements** — "card shadow", not "level-1 shadow"
200
+ 7. **Voice rules should be mechanical** — fill-in-the-blank templates, not vague principles