@snap/valdi 1.0.8 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.bootstrap/apps/cli_application/BUILD.bazel.template +7 -0
- package/.bootstrap/apps/cli_application/modules/{{MODULE_NAME}}/BUILD.bazel.template +11 -0
- package/.bootstrap/apps/cli_application/modules/{{MODULE_NAME}}/src/index.ts +1 -0
- package/.bootstrap/apps/ui_application/.eslint.rc +27 -0
- package/.bootstrap/apps/ui_application/BUILD.bazel.template +19 -0
- package/.bootstrap/apps/ui_application/modules/{{MODULE_NAME}}/BUILD.bazel.template +21 -0
- package/.bootstrap/apps/ui_application/modules/{{MODULE_NAME}}/res/valdi@3x.png +0 -0
- package/.bootstrap/apps/ui_application/modules/{{MODULE_NAME}}/src/App.tsx +133 -0
- package/.bootstrap/apps/ui_application/package.json +24 -0
- package/.bootstrap/modules/polyglot_bridge_module/BUILD.bazel.template +54 -0
- package/.bootstrap/modules/polyglot_bridge_module/android/CalculatorModuleFactory.kt.template +18 -0
- package/.bootstrap/modules/polyglot_bridge_module/ios/SCCCalculatorModuleFactory.m.template +31 -0
- package/.bootstrap/modules/polyglot_bridge_module/src/Calculator.d.ts +4 -0
- package/.bootstrap/modules/polyglot_bridge_module/web/Calculator.ts +11 -0
- package/.bootstrap/modules/polyglot_bridge_module/web/tsconfig.json +16 -0
- package/.bootstrap/modules/polyglot_view_module/BUILD.bazel.template +75 -0
- package/.bootstrap/modules/polyglot_view_module/android/PolyglotNativeView.kt.template +41 -0
- package/.bootstrap/modules/polyglot_view_module/android/PolyglotNativeViewAttributesBinder.kt.template +17 -0
- package/.bootstrap/modules/polyglot_view_module/ios/SCPolyglotView.h +8 -0
- package/.bootstrap/modules/polyglot_view_module/ios/SCPolyglotView.m +23 -0
- package/.bootstrap/modules/polyglot_view_module/macos/SCPolyglotView.h +8 -0
- package/.bootstrap/modules/polyglot_view_module/macos/SCPolyglotView.m +23 -0
- package/.bootstrap/modules/polyglot_view_module/src/PolyglotCustomView.tsx.template +23 -0
- package/.bootstrap/modules/polyglot_view_module/web/PolyglotWeb.ts.template +30 -0
- package/.bootstrap/modules/polyglot_view_module/web/tsconfig.json +16 -0
- package/.bootstrap/modules/ui_component/BUILD.bazel.template +34 -0
- package/.bootstrap/modules/ui_component/src/NewModuleComponent.tsx +45 -0
- package/.metadata/.bazelrc.template +92 -0
- package/.metadata/.bazelversion.template +1 -0
- package/.metadata/.editorconfig.template +37 -0
- package/.metadata/.eslintrc.js.template +27 -0
- package/.metadata/.gitignore.template +4 -0
- package/.metadata/.prettierrc.json.template +7 -0
- package/.metadata/.watchmanconfig.template +8 -0
- package/.metadata/AGENTS.md.template +16 -0
- package/.metadata/MODULE.bazel.template +62 -0
- package/.metadata/README.md.template +31 -0
- package/.metadata/config.yaml.template +1 -0
- package/.metadata/package.json.template +23 -0
- package/.metadata/skill-reference.tsx.template +8 -0
- package/.metadata/skill-tests-BUILD.bazel.template +21 -0
- package/.metadata/skill-tests-README.md.template +17 -0
- package/.metadata/skill.md.template +27 -0
- package/bundled-skills/registry.json +14 -2
- package/bundled-skills/skills/valdi-animations/skill.md +197 -0
- package/bundled-skills/skills/valdi-async/tests/src/reference.tsx +1 -1
- package/bundled-skills/skills/valdi-bazel/skill.md +21 -2
- package/bundled-skills/skills/valdi-component-dedup/skill.md +263 -0
- package/bundled-skills/skills/valdi-component-tests/tests/test/ProfileCardTest.spec.tsx +1 -1
- package/bundled-skills/skills/valdi-custom-view/skill.md +49 -5
- package/bundled-skills/skills/valdi-error-handling/skill.md +238 -0
- package/bundled-skills/skills/valdi-gestures/skill.md +198 -0
- package/bundled-skills/skills/valdi-inspect/skill.md +217 -0
- package/bundled-skills/skills/valdi-localization/skill.md +142 -0
- package/bundled-skills/skills/valdi-mock-breakdown/skill.md +327 -0
- package/bundled-skills/skills/valdi-mock-iterate/skill.md +216 -0
- package/bundled-skills/skills/valdi-mock-to-module/scripts/diff.py +392 -0
- package/bundled-skills/skills/valdi-mock-to-module/scripts/extract_colors.py +277 -0
- package/bundled-skills/skills/valdi-mock-to-module/scripts/find_icon.py +303 -0
- package/bundled-skills/skills/valdi-mock-to-module/scripts/snapshot-and-diff.sh +53 -0
- package/bundled-skills/skills/valdi-mock-to-module/scripts/test_diff.py +207 -0
- package/bundled-skills/skills/valdi-mock-to-module/scripts/test_extract_colors.py +167 -0
- package/bundled-skills/skills/valdi-mock-to-module/scripts/test_find_icon.py +188 -0
- package/bundled-skills/skills/valdi-mock-to-module/scripts/watch-and-diff.sh +181 -0
- package/bundled-skills/skills/valdi-mock-to-module/skill.md +451 -0
- package/bundled-skills/skills/valdi-navigation/skill.md +187 -0
- package/bundled-skills/skills/valdi-overview/skill.md +7 -4
- package/bundled-skills/skills/valdi-perf/skill.md +223 -0
- package/bundled-skills/skills/valdi-polyglot-module/skill.md +131 -12
- package/bundled-skills/skills/valdi-preview/skill.md +303 -0
- package/bundled-skills/skills/valdi-profile/skill.md +126 -0
- package/bundled-skills/skills/valdi-setup/skill.md +55 -5
- package/bundled-skills/skills/valdi-testing/skill.md +23 -7
- package/bundled-skills/skills/valdi-tsx/skill.md +69 -5
- package/bundled-skills/skills/valdi-tsx/tests/src/reference.tsx +29 -5
- package/dist/commands/agentCheck.js +184 -0
- package/dist/commands/analyze.js +16 -0
- package/dist/commands/analyze_commands/duplicates.js +134 -0
- package/dist/commands/bootstrap.js +57 -73
- package/dist/commands/doctor.js +40 -203
- package/dist/commands/hotreload.js +15 -0
- package/dist/commands/inspect.js +16 -0
- package/dist/commands/inspect_commands/contexts.js +55 -0
- package/dist/commands/inspect_commands/devices.js +53 -0
- package/dist/commands/inspect_commands/heap.js +59 -0
- package/dist/commands/inspect_commands/select.js +43 -0
- package/dist/commands/inspect_commands/snapshot.js +129 -0
- package/dist/commands/inspect_commands/snapshot.spec.js +105 -0
- package/dist/commands/inspect_commands/status.js +68 -0
- package/dist/commands/inspect_commands/tree.js +86 -0
- package/dist/commands/preview.js +81 -0
- package/dist/commands/profile.js +16 -0
- package/dist/commands/profile_commands/capture.js +106 -0
- package/dist/commands/projectsync.js +9 -7
- package/dist/commands/skills_commands/install.js +6 -1
- package/dist/commands/skills_commands/update.js +2 -1
- package/dist/core/analyze/clusterer.js +150 -0
- package/dist/core/analyze/fingerprint.js +2 -0
- package/dist/core/analyze/knownPatterns.js +76 -0
- package/dist/core/analyze/parser.js +177 -0
- package/dist/core/analyze/reporter.js +83 -0
- package/dist/core/analyze/scanner.js +172 -0
- package/dist/core/analyze/similarity.js +56 -0
- package/dist/core/constants.js +1 -1
- package/dist/core/packageFiles.spec.js +29 -0
- package/dist/preview/previewGenerator.js +240 -0
- package/dist/preview/previewGenerator.spec.js +203 -0
- package/dist/preview/viewModelParser.js +86 -0
- package/dist/preview/viewModelParser.spec.js +171 -0
- package/dist/setup/DevSetupHelper.js +0 -51
- package/dist/setup/linuxSetup.js +0 -2
- package/dist/setup/macOSSetup.js +1 -4
- package/dist/utils/BazelClient.js +15 -0
- package/dist/utils/daemonClient.js +344 -0
- package/dist/utils/hermesClient.js +252 -0
- package/dist/utils/skillsAdapters.js +86 -5
- package/dist/utils/skillsAdapters.spec.js +60 -0
- package/dist/utils/skillsRegistry.js +8 -0
- package/dist/utils/stringUtils.spec.js +1 -1
- package/package.json +30 -12
- package/dist/setup/versions.js +0 -8
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Valdi Localization
|
|
2
|
+
|
|
3
|
+
Internationalization (i18n) and localized strings in Valdi modules.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
|
|
7
|
+
When adding user-visible text that should be translatable across languages.
|
|
8
|
+
|
|
9
|
+
## Key concepts
|
|
10
|
+
|
|
11
|
+
Valdi localization uses **JSON string files** (`strings-en.json`) compiled into type-safe TypeScript accessors. The compiler generates a `Strings.d.ts` file with typed functions for each key. On iOS, strings compile to `.strings` files; on Android, to XML string resources.
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
### 1. Create the strings file
|
|
16
|
+
|
|
17
|
+
Create `strings/strings-en.json` in your module directory:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"hello_world": {
|
|
22
|
+
"defaultMessage": "Hello, world!"
|
|
23
|
+
},
|
|
24
|
+
"welcome_user": {
|
|
25
|
+
"defaultMessage": "Welcome, {name}!",
|
|
26
|
+
"example": "Welcome, Alex!"
|
|
27
|
+
},
|
|
28
|
+
"items_count": {
|
|
29
|
+
"defaultMessage": "{count%d} items remaining",
|
|
30
|
+
"example": "5 items remaining"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 2. Add strings directory to module config
|
|
36
|
+
|
|
37
|
+
In your `module.yaml`:
|
|
38
|
+
|
|
39
|
+
```yaml
|
|
40
|
+
strings_dir: strings
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 3. Generate typed accessors
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
valdi projectsync
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This generates `Strings.d.ts` in your module with typed functions for each key.
|
|
50
|
+
|
|
51
|
+
### 4. Use in TypeScript
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import Strings from 'mymodule/src/Strings';
|
|
55
|
+
|
|
56
|
+
onRender(): void {
|
|
57
|
+
<view>
|
|
58
|
+
<label value={Strings.helloWorld()} />
|
|
59
|
+
<label value={Strings.welcomeUser('Alex')} />
|
|
60
|
+
<label value={Strings.itemsCount(5)} />
|
|
61
|
+
</view>;
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## String keys and naming
|
|
66
|
+
|
|
67
|
+
Keys in `strings-en.json` are `snake_case`. The generated TypeScript accessors are `camelCase`:
|
|
68
|
+
|
|
69
|
+
| JSON key | TypeScript accessor |
|
|
70
|
+
|----------|-------------------|
|
|
71
|
+
| `hello_world` | `Strings.helloWorld()` |
|
|
72
|
+
| `items_count` | `Strings.itemsCount(n)` |
|
|
73
|
+
| `welcome_user` | `Strings.welcomeUser(name)` |
|
|
74
|
+
|
|
75
|
+
## Template strings with variables
|
|
76
|
+
|
|
77
|
+
Variables use the format `{NAME%FORMAT}`:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"greeting": {
|
|
82
|
+
"defaultMessage": "Hi {name}, you have {count%d} new messages",
|
|
83
|
+
"example": "Hi Alex, you have 3 new messages"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Supported formats:
|
|
89
|
+
- `{name}` or `{name%s}` — string (default)
|
|
90
|
+
- `{count%d}` — integer
|
|
91
|
+
|
|
92
|
+
Multiple variables must have unique names. Argument order in the TypeScript function matches the order they appear in the English string.
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
// ✅ Variables passed in order of appearance in defaultMessage
|
|
96
|
+
Strings.greeting('Alex', 3) // "Hi Alex, you have 3 new messages"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Using strings in Kotlin (Android)
|
|
100
|
+
|
|
101
|
+
Generated strings are accessible as standard Android resources:
|
|
102
|
+
|
|
103
|
+
```kotlin
|
|
104
|
+
val text = getResources().getString(
|
|
105
|
+
com.snap.valdi.modules.my_module.R.string.my_module_hello_world
|
|
106
|
+
)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Common mistakes
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
// ❌ WRONG — Hardcoding user-visible strings
|
|
113
|
+
<label value="Hello, world!" />
|
|
114
|
+
|
|
115
|
+
// ✅ Correct — use localized strings
|
|
116
|
+
<label value={Strings.helloWorld()} />
|
|
117
|
+
|
|
118
|
+
// ❌ WRONG — Concatenating localized strings
|
|
119
|
+
const msg = Strings.hello() + " " + name; // ❌ Word order varies by language
|
|
120
|
+
|
|
121
|
+
// ✅ Correct — use template strings with variables
|
|
122
|
+
const msg = Strings.helloUser(name);
|
|
123
|
+
|
|
124
|
+
// ❌ WRONG — Constructing plurals in code
|
|
125
|
+
const msg = count === 1 ? "1 item" : `${count} items`; // ❌
|
|
126
|
+
|
|
127
|
+
// ✅ Correct — handle plurals in the string definition
|
|
128
|
+
// (Use a single template string; translation handles pluralization)
|
|
129
|
+
|
|
130
|
+
// ❌ WRONG — Importing from the wrong path
|
|
131
|
+
import Strings from 'Strings'; // ❌
|
|
132
|
+
|
|
133
|
+
// ✅ Correct — import from your module's generated path
|
|
134
|
+
import Strings from 'mymodule/src/Strings';
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Workflow
|
|
138
|
+
|
|
139
|
+
1. Add keys to `strings/strings-en.json`
|
|
140
|
+
2. Run `valdi projectsync` to regenerate `Strings.d.ts`
|
|
141
|
+
3. Import `Strings` from your module and use the generated functions
|
|
142
|
+
4. Valdi tooling handles iOS `.strings` and Android `.xml` generation during build
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
# valdi-mock-breakdown
|
|
2
|
+
|
|
3
|
+
Generate a Valdi TSX component from a screenshot or design mock. Analyzes the visual layout, decomposes it into Valdi primitives and widgets, and produces a complete `.tsx` file.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
|
|
7
|
+
- User provides a screenshot, Figma export, or design mock and wants Valdi code
|
|
8
|
+
- You're the "generator" in a mock-to-module pipeline
|
|
9
|
+
- User says "build this", "make this screen", or "turn this into code" with an image
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
1. Analyze the image — identify layout structure, components, spacing, colors, typography
|
|
14
|
+
2. Map to Valdi primitives — `<view>`, `<label>`, `<image>`, `<scroll>`, `<shape>`, widgets
|
|
15
|
+
3. Generate a complete `.tsx` file with correct Valdi patterns
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Step 1: Analyze the layout
|
|
20
|
+
|
|
21
|
+
Look at the image and identify, top-to-bottom:
|
|
22
|
+
|
|
23
|
+
- **Overall structure**: Is it a full screen? A card? A list? A form?
|
|
24
|
+
- **Scroll behavior**: Does the content exceed the viewport? Use `<scroll>`.
|
|
25
|
+
- **Sections**: Group visually distinct areas (header, body, footer, list items).
|
|
26
|
+
- **Components**: Buttons, toggles, text inputs, checkboxes, pickers, etc.
|
|
27
|
+
- **Typography**: Title vs body vs caption — map to font sizes.
|
|
28
|
+
- **Colors**: Background, text, accent, divider — use semantic colors when possible.
|
|
29
|
+
- **Spacing**: Estimate padding and margins in 4pt/8pt increments.
|
|
30
|
+
- **Icons/images**: Note placement and sizing.
|
|
31
|
+
|
|
32
|
+
**Report your analysis** before writing code. Example:
|
|
33
|
+
|
|
34
|
+
> I see a vertical layout with:
|
|
35
|
+
> - A top bar with a back button and title ("Settings")
|
|
36
|
+
> - A scrollable list of 5 toggle rows, each with a label and a switch
|
|
37
|
+
> - A footer button ("Save Changes")
|
|
38
|
+
> - White background, 16px side padding, 12px between rows
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Step 2: Choose Valdi elements and widgets
|
|
43
|
+
|
|
44
|
+
### Primitives (always available, no extra deps)
|
|
45
|
+
|
|
46
|
+
Start with primitives to get a bare-bones skeleton on screen fast:
|
|
47
|
+
|
|
48
|
+
| Element | Use for |
|
|
49
|
+
|---------|---------|
|
|
50
|
+
| `<view>` | Containers, layout groups, spacers |
|
|
51
|
+
| `<label>` | All text (titles, body, captions) |
|
|
52
|
+
| `<image>` | Images, icons (use `src` prop with Asset) |
|
|
53
|
+
| `<scroll>` | Scrollable content areas |
|
|
54
|
+
| `<shape>` | Rounded rects, circles, dividers, decorative shapes |
|
|
55
|
+
| `<button>` | Tappable areas (has `title` and `onPress`) |
|
|
56
|
+
|
|
57
|
+
### Then upgrade to widget library components (if available)
|
|
58
|
+
|
|
59
|
+
Once the skeleton is rendering, check the workspace for a shared widget or component library (e.g. in `valdi_modules/widgets/` or a similar path). Pre-built widget components encode design system conventions (correct spacing, fonts, colors, shadows) and produce more accurate results with less hand-tuning.
|
|
60
|
+
|
|
61
|
+
**How to explore**: Search for exported component classes in the workspace's widget directories. Read the component's `ViewModel` interface to understand available props.
|
|
62
|
+
|
|
63
|
+
**Use icon assets instead of emoji** for better fidelity — search the workspace for an icon library class.
|
|
64
|
+
|
|
65
|
+
### Widgets (require module dep)
|
|
66
|
+
|
|
67
|
+
Before using a widget, search the codebase to confirm it exists and read its ViewModel:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Find available widgets
|
|
71
|
+
grep -r "export class" --include="*.tsx" valdi_modules/widgets/src/components/
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Common widgets in `widgets/`:
|
|
75
|
+
- `Checkbox` — toggle with `on`/`onTap`
|
|
76
|
+
- `Toggle` — switch with `on`/`onChange`
|
|
77
|
+
- `Section` — card-style section with title
|
|
78
|
+
- `SectionSeparator` — divider between sections
|
|
79
|
+
- `DatePicker`, `TimePicker`, `IndexPicker` — picker controls
|
|
80
|
+
- `EmojiLabel` — label with emoji rendering support
|
|
81
|
+
- `WithInsets` — safe area inset wrapper
|
|
82
|
+
|
|
83
|
+
**If the design has a component you're not sure about**, use primitives to approximate it rather than guessing a widget name that may not exist.
|
|
84
|
+
|
|
85
|
+
### Mapping visual patterns to elements
|
|
86
|
+
|
|
87
|
+
| Visual pattern | Primitives approach |
|
|
88
|
+
|---------------|---------------------|
|
|
89
|
+
| List row with icon + text | `<view>` with flexDirection row |
|
|
90
|
+
| Card with shadow/border | `<view>` with borderRadius + boxShadow |
|
|
91
|
+
| Section header with action | `<label>` + `<label>` in a row |
|
|
92
|
+
| Horizontal row | `<view>` with `flexDirection: 'row'` |
|
|
93
|
+
| Vertical stack | `<view>` (default column direction) |
|
|
94
|
+
| Divider line | `<view>` with `height: 1`, `backgroundColor: '#E0E0E0'` |
|
|
95
|
+
| Circular icon background | `<view>` with `borderRadius: size/2`, wrapping `<image>` |
|
|
96
|
+
| Tappable row | `onTap` on `<view>` |
|
|
97
|
+
| Scrollable list | `<scroll>` wrapping children |
|
|
98
|
+
| Fixed header + scrolling body | Outer `<view>` with header + `<scroll flexGrow={1}>` body |
|
|
99
|
+
| Spacer between items | margin on children (no `gap` property) |
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Step 3: Generate the .tsx file
|
|
104
|
+
|
|
105
|
+
### Template
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
import { StatefulComponent } from 'valdi_core/src/Component';
|
|
109
|
+
import { Style } from 'valdi_core/src/Style';
|
|
110
|
+
import { View, Label } from 'valdi_tsx/src/NativeTemplateElements';
|
|
111
|
+
// Import widgets as needed:
|
|
112
|
+
// import { Checkbox } from 'widgets/src/components/button/Checkbox';
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @ViewModel
|
|
116
|
+
* @ExportModel
|
|
117
|
+
*/
|
|
118
|
+
export interface ViewModel {}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @Context
|
|
122
|
+
* @ExportModel
|
|
123
|
+
*/
|
|
124
|
+
export interface ComponentContext {}
|
|
125
|
+
|
|
126
|
+
interface ComponentState {
|
|
127
|
+
// State for interactive elements
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @Component
|
|
132
|
+
* @ExportModel
|
|
133
|
+
*/
|
|
134
|
+
export class GeneratedComponent extends StatefulComponent<ViewModel, ComponentState, ComponentContext> {
|
|
135
|
+
state: ComponentState = {
|
|
136
|
+
// Initial state values
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
onRender(): void {
|
|
140
|
+
<view style={styles.container}>
|
|
141
|
+
{/* Layout here */}
|
|
142
|
+
</view>;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const styles = {
|
|
147
|
+
container: new Style<View>({
|
|
148
|
+
backgroundColor: '#ffffff',
|
|
149
|
+
width: '100%',
|
|
150
|
+
height: '100%',
|
|
151
|
+
}),
|
|
152
|
+
};
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Critical Valdi rules
|
|
156
|
+
|
|
157
|
+
These are **NOT React** — common mistakes that MUST be avoided:
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
// WRONG: React hooks (don't exist in Valdi)
|
|
161
|
+
const [value, setValue] = useState(''); // WRONG
|
|
162
|
+
|
|
163
|
+
// WRONG: Functional components (don't exist)
|
|
164
|
+
const MyThing = () => <view />; // WRONG
|
|
165
|
+
|
|
166
|
+
// WRONG: Return JSX from onRender
|
|
167
|
+
onRender() { return <view />; } // WRONG — onRender returns void
|
|
168
|
+
|
|
169
|
+
// WRONG: this.props (doesn't exist)
|
|
170
|
+
this.props.title // WRONG — use this.viewModel.title
|
|
171
|
+
|
|
172
|
+
// CORRECT: Class component with state
|
|
173
|
+
class MyComponent extends StatefulComponent<VM, State> {
|
|
174
|
+
state = { value: '' };
|
|
175
|
+
onRender(): void {
|
|
176
|
+
<view />; // Statement, not return value
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Styling guidelines
|
|
182
|
+
|
|
183
|
+
- Use `new Style<View>({...})` for view styles, `new Style<Label>({...})` for label styles
|
|
184
|
+
- Font sizes via font string: `font: 'system 16'`, `font: 'system-bold 20'`
|
|
185
|
+
- Use 8pt grid for spacing: 4, 8, 12, 16, 24, 32, 48
|
|
186
|
+
- Prefer `padding` and `margin` shorthand: `padding: '16 20'` (vertical horizontal)
|
|
187
|
+
- Colors: use hex strings `'#RRGGBB'` or `'#RRGGBBAA'`
|
|
188
|
+
- Layout: Yoga flexbox — `flexDirection`, `justifyContent`, `alignItems`, `flexGrow`
|
|
189
|
+
- No `gap` property — use margin on children instead
|
|
190
|
+
- No `fontSize` — use `font` string on labels
|
|
191
|
+
- Overflow: only `'visible'` or `'scroll'` (NOT `'hidden'`)
|
|
192
|
+
- **`opacity` must be a number**, not a string: `opacity: 0.3` (NOT `'0.3'`)
|
|
193
|
+
- **`flexGrow` must be a number**, not a string: `flexGrow: 1` (NOT `'1'`)
|
|
194
|
+
- **Only two font weights**: `system` (regular) and `system-bold` (bold). `system-semibold`, `system-medium`, etc. silently fall back to regular at runtime.
|
|
195
|
+
- **ScrollView has no `flexDirection`** — `<scroll>` always scrolls vertically, do not set flexDirection on it
|
|
196
|
+
- `boxShadow` format: `'xOffset yOffset blur color'` e.g. `'0 2 8 rgba(0,0,0,0.12)'`
|
|
197
|
+
|
|
198
|
+
### Style pitfalls (common build-breaking mistakes)
|
|
199
|
+
|
|
200
|
+
**Read the valdi-tsx skill's "Common Mistakes to Avoid" section before writing styles.** These cause the most build failures:
|
|
201
|
+
|
|
202
|
+
- No `borderRight`, `borderRightWidth`, etc. — only `borderWidth`, `borderColor`, `borderRadius` exist. Use a thin `<view>` as a divider.
|
|
203
|
+
- No `paddingHorizontal` / `paddingVertical` — use `padding: '10 20'` shorthand.
|
|
204
|
+
- No `flex: 1` — use `flexGrow: 1` (number, not string).
|
|
205
|
+
- `flexGrow` must be a number, not a string.
|
|
206
|
+
- `Shape` is not exported — use `ShapeView` from NativeTemplateElements.
|
|
207
|
+
- `font: 'system-semibold'` doesn't work — use `system-bold` or `system`.
|
|
208
|
+
- `overflow: 'hidden'` doesn't exist — only `'visible'` or `'scroll'`.
|
|
209
|
+
- `flexDirection` on `<scroll>` doesn't exist — ScrollView always scrolls vertically.
|
|
210
|
+
|
|
211
|
+
### Font size calibration (IMPORTANT)
|
|
212
|
+
|
|
213
|
+
Font sizes are the **#1 source of visual mismatch**. Initial instinct is almost always 30-50% too small. Use these reference ranges and scale up from your first guess:
|
|
214
|
+
|
|
215
|
+
| Visual role | Typical range | Example |
|
|
216
|
+
|------------|---------------|---------|
|
|
217
|
+
| Hero / display number | 64–80pt bold | Temperature "75°", score display |
|
|
218
|
+
| Section title | 20–24pt bold | "Settings", screen headers |
|
|
219
|
+
| Primary body text | 20–22pt regular | Descriptions, location names |
|
|
220
|
+
| Secondary label | 17–19pt regular/semibold | Tab labels, row titles |
|
|
221
|
+
| Tertiary / caption | 15–17pt regular | Timestamps, footnotes, axis labels |
|
|
222
|
+
| Small metadata | 12–14pt regular | Badges, counters |
|
|
223
|
+
|
|
224
|
+
**Rule of thumb**: If your first estimate is 16pt, it's probably 20-22pt. If your first estimate is 12pt, it's probably 16-17pt.
|
|
225
|
+
|
|
226
|
+
### Text color calibration
|
|
227
|
+
|
|
228
|
+
Avoid pure `#000000` for most text — real designs use lighter values:
|
|
229
|
+
|
|
230
|
+
| Text role | Color range |
|
|
231
|
+
|----------|-------------|
|
|
232
|
+
| Primary / headings | `#000000` – `#111111` |
|
|
233
|
+
| Body / descriptions | `#333333` – `#555555` |
|
|
234
|
+
| Secondary / metadata | `#888888` – `#AAAAAA` |
|
|
235
|
+
| Tertiary / hints | `#999999` – `#BBBBBB` |
|
|
236
|
+
|
|
237
|
+
### Spacing calibration
|
|
238
|
+
|
|
239
|
+
Vertical spacing between major sections (header → content → footer) is **consistently underestimated**. Use generous gaps:
|
|
240
|
+
|
|
241
|
+
- Between major sections: 28–44pt
|
|
242
|
+
- Between sub-items within a section: 12–20pt
|
|
243
|
+
- Card padding: 28–36pt vertical, 28–32pt horizontal
|
|
244
|
+
- Card border radius: 16–20pt for modern rounded appearance
|
|
245
|
+
|
|
246
|
+
### Charts and data visualization with `<shape>`
|
|
247
|
+
|
|
248
|
+
For line charts, area charts, or custom shapes, use `GeometricPathBuilder`:
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
import { GeometricPathBuilder } from 'valdi_core/src/utils/GeometricPathBuilder';
|
|
252
|
+
|
|
253
|
+
// Create a builder with coordinate space dimensions
|
|
254
|
+
const b = new GeometricPathBuilder(width, height);
|
|
255
|
+
b.moveTo(x, y);
|
|
256
|
+
b.lineTo(x, y);
|
|
257
|
+
b.cubicTo(cp1x, cp1y, cp2x, cp2y, x, y);
|
|
258
|
+
b.close();
|
|
259
|
+
const path = b.build();
|
|
260
|
+
|
|
261
|
+
// Use the path in a <shape> element
|
|
262
|
+
<shape path={path} strokeColor="#E87A2E" strokeWidth={5}
|
|
263
|
+
strokeCap="round" strokeJoin="round"
|
|
264
|
+
width={width} height={height} />;
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Key patterns for smooth data curves:**
|
|
268
|
+
|
|
269
|
+
1. **Use monotone cubic Hermite interpolation** — prevents overshoot at local extrema. Simple midpoint control points cause curve artifacts.
|
|
270
|
+
2. **Stroke line**: 4–5pt width for prominent lines, `strokeCap="round"` for smooth endpoints.
|
|
271
|
+
3. **Data dots**: 10–12pt diameter circles using `<view>` with `borderRadius`.
|
|
272
|
+
4. **Fill path construction**: `moveTo(firstX, bottomY)` → `lineTo(firstX, firstY)` → trace curve → `lineTo(lastX, bottomY)` → `close()`.
|
|
273
|
+
5. **Fill color**: Use alpha for subtlety, e.g., `"#F5D0A088"`. Don't try layered fills to simulate gradients — they create visible horizontal bands.
|
|
274
|
+
6. **Data labels**: Position above dots with `position="absolute"`, offset `top: y - 30`, centered with fixed-width container.
|
|
275
|
+
|
|
276
|
+
### Naming
|
|
277
|
+
|
|
278
|
+
- Class name: `PascalCase`, descriptive of the screen/component (e.g., `SettingsScreen`, `ProfileCard`)
|
|
279
|
+
- Component file name: match the class name (e.g., `SettingsScreen.tsx`)
|
|
280
|
+
- Styles object: `const styles = { ... }` at bottom of file
|
|
281
|
+
- State interface: descriptive fields (e.g., `toggleOn`, `selectedIndex`, not `s1`, `v`)
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Step 4: Wire interactive state
|
|
286
|
+
|
|
287
|
+
For any interactive elements (toggles, checkboxes, pickers, text inputs):
|
|
288
|
+
|
|
289
|
+
1. Add state fields in the `ComponentState` interface
|
|
290
|
+
2. Set initial values in `state = { ... }`
|
|
291
|
+
3. Wire callbacks with `this.setState()`
|
|
292
|
+
|
|
293
|
+
```typescript
|
|
294
|
+
interface ComponentState {
|
|
295
|
+
notificationsOn: boolean;
|
|
296
|
+
selectedFruit: number;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// Define handlers as class properties (NOT inline arrows in onRender):
|
|
300
|
+
private toggleNotifications = (val: boolean) => this.setState({ notificationsOn: val });
|
|
301
|
+
private selectFruit = (i: number) => this.setState({ selectedFruit: i });
|
|
302
|
+
|
|
303
|
+
// In onRender:
|
|
304
|
+
<Checkbox
|
|
305
|
+
on={this.state.notificationsOn}
|
|
306
|
+
onTap={this.toggleNotifications}
|
|
307
|
+
/>
|
|
308
|
+
|
|
309
|
+
<IndexPicker
|
|
310
|
+
labels={fruitLabels}
|
|
311
|
+
index={this.state.selectedFruit}
|
|
312
|
+
onChange={this.selectFruit}
|
|
313
|
+
/>
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Output format
|
|
319
|
+
|
|
320
|
+
When generating code for the mock-to-module pipeline, output:
|
|
321
|
+
|
|
322
|
+
1. **Analysis** — your visual breakdown (2-5 sentences)
|
|
323
|
+
2. **Component name** — what to call the generated class
|
|
324
|
+
3. **Full .tsx file** — complete, compilable, with all imports and styles
|
|
325
|
+
4. **Required deps** — list of module deps needed (e.g., `widgets`)
|
|
326
|
+
|
|
327
|
+
When generating code for a preview harness specifically, the component should be a `PreviewRoot` with empty ViewModel/ComponentContext, since it's a standalone root.
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# valdi-mock-iterate
|
|
2
|
+
|
|
3
|
+
Compare a design mock against a rendered Valdi screenshot and produce specific, actionable code fixes. This is the "critic" in the mock-to-module pipeline — it only looks at pixels, never at code.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
|
|
7
|
+
- You have both a design mock/screenshot AND a rendered Valdi screenshot
|
|
8
|
+
- You need to evaluate visual fidelity between a target design and generated output
|
|
9
|
+
- You're the "critic" agent in a generator+critic iteration loop
|
|
10
|
+
- User asks "does this match?" or "what's different?"
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
1. Compare the two images side by side
|
|
15
|
+
2. List every visual difference — be specific and quantitative
|
|
16
|
+
3. Prioritize fixes by visual impact
|
|
17
|
+
4. Output structured feedback the generator can act on
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Step 1: Compare the images
|
|
22
|
+
|
|
23
|
+
You will receive two images:
|
|
24
|
+
|
|
25
|
+
- **Mock** — the target design (screenshot, Figma export, or photo)
|
|
26
|
+
- **Rendered** — the Valdi app screenshot (from `valdi inspect snapshot`)
|
|
27
|
+
|
|
28
|
+
Compare them systematically by scanning these dimensions:
|
|
29
|
+
|
|
30
|
+
### Layout and structure
|
|
31
|
+
- Are all elements present? Any missing or extra elements?
|
|
32
|
+
- Is the overall structure correct? (vertical vs horizontal, scroll vs fixed)
|
|
33
|
+
- Is the element ordering correct?
|
|
34
|
+
|
|
35
|
+
### Spacing and sizing
|
|
36
|
+
- Are margins and padding correct? Compare gaps between elements.
|
|
37
|
+
- Are element sizes correct? (width, height, aspect ratios)
|
|
38
|
+
- Is the overall content centered/aligned as expected?
|
|
39
|
+
|
|
40
|
+
### Typography
|
|
41
|
+
- Are font sizes correct? (compare relative sizes: title vs body vs caption)
|
|
42
|
+
- Are font weights correct? (bold vs regular)
|
|
43
|
+
- Is text color correct?
|
|
44
|
+
- Is text alignment correct? (left, center, right)
|
|
45
|
+
|
|
46
|
+
### Colors and backgrounds
|
|
47
|
+
- Is the background color correct?
|
|
48
|
+
- Are element background colors correct?
|
|
49
|
+
- Are accent/highlight colors correct?
|
|
50
|
+
- Are borders and dividers the right color and thickness?
|
|
51
|
+
|
|
52
|
+
### Components
|
|
53
|
+
- Do interactive components look correct? (buttons, toggles, checkboxes)
|
|
54
|
+
- Are icons/images the right size and position?
|
|
55
|
+
- Are rounded corners the right radius?
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Step 2: Produce structured feedback
|
|
60
|
+
|
|
61
|
+
For each difference found, output a structured entry:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
ISSUE: <what's wrong>
|
|
65
|
+
ELEMENT: <which element in the layout — be specific>
|
|
66
|
+
EXPECTED: <what the mock shows>
|
|
67
|
+
ACTUAL: <what the rendered output shows>
|
|
68
|
+
FIX: <specific code change to make>
|
|
69
|
+
SEVERITY: critical | major | minor
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Severity levels
|
|
73
|
+
|
|
74
|
+
- **critical** — Missing elements, wrong structure, completely wrong layout
|
|
75
|
+
- **major** — Wrong colors, wrong font sizes, significantly wrong spacing
|
|
76
|
+
- **minor** — Slightly off spacing (2-4px), minor color shade differences, minor radius differences
|
|
77
|
+
|
|
78
|
+
### Example output
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
ISSUE: Title font too small
|
|
82
|
+
ELEMENT: Header title label ("Settings")
|
|
83
|
+
EXPECTED: Bold, approximately 24px
|
|
84
|
+
ACTUAL: Regular weight, approximately 16px
|
|
85
|
+
FIX: Change font from 'system 16' to 'system-bold 24'
|
|
86
|
+
SEVERITY: major
|
|
87
|
+
|
|
88
|
+
ISSUE: Missing divider between rows
|
|
89
|
+
ELEMENT: Between row 2 ("Dark Mode") and row 3 ("Notifications")
|
|
90
|
+
EXPECTED: Thin gray horizontal line
|
|
91
|
+
ACTUAL: No divider present
|
|
92
|
+
FIX: Add <view height={1} backgroundColor="#E0E0E0" margin="0 16" /> between rows
|
|
93
|
+
SEVERITY: major
|
|
94
|
+
|
|
95
|
+
ISSUE: Bottom button slightly too narrow
|
|
96
|
+
ELEMENT: "Save Changes" button at bottom
|
|
97
|
+
EXPECTED: Full width with 16px side margins
|
|
98
|
+
ACTUAL: Appears to have 24px side margins
|
|
99
|
+
FIX: Change button container padding from '0 24' to '0 16'
|
|
100
|
+
SEVERITY: minor
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Step 3: Summarize and prioritize
|
|
106
|
+
|
|
107
|
+
After listing all issues, provide:
|
|
108
|
+
|
|
109
|
+
1. **Match score** — rough percentage (e.g., "~70% match")
|
|
110
|
+
2. **Top 3 fixes** — the changes that will have the biggest visual impact
|
|
111
|
+
3. **Verdict** — one of:
|
|
112
|
+
- `MATCH` — close enough, no more iteration needed (>95% match)
|
|
113
|
+
- `ITERATE` — specific fixes needed, list them
|
|
114
|
+
- `RESTRUCTURE` — fundamental layout is wrong, generator should start over with different structure
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Guidelines for the critic
|
|
119
|
+
|
|
120
|
+
### Be specific, not vague
|
|
121
|
+
```
|
|
122
|
+
// BAD: "The text looks different"
|
|
123
|
+
// GOOD: "The title label is regular weight ~16px but should be bold ~24px"
|
|
124
|
+
|
|
125
|
+
// BAD: "Spacing is off"
|
|
126
|
+
// GOOD: "Gap between the header and first row is ~8px but should be ~24px"
|
|
127
|
+
|
|
128
|
+
// BAD: "Colors are wrong"
|
|
129
|
+
// GOOD: "Button background is #007AFF but should be #FFFC00 (yellow)"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Estimate in points, not pixels
|
|
133
|
+
Valdi uses point-based sizing. Screenshots from `valdi inspect snapshot` are in points (1pt = 1 unit in the output). When estimating dimensions:
|
|
134
|
+
- Standard spacing increments: 4, 8, 12, 16, 24, 32, 48
|
|
135
|
+
- Expanded font size reference:
|
|
136
|
+
|
|
137
|
+
| Visual role | Typical range |
|
|
138
|
+
|------------|---------------|
|
|
139
|
+
| Hero / display numbers | 64–80pt bold |
|
|
140
|
+
| Section headings | 20–24pt bold |
|
|
141
|
+
| Primary body text | 20–22pt |
|
|
142
|
+
| Secondary labels | 17–19pt |
|
|
143
|
+
| Captions / axis labels | 15–17pt |
|
|
144
|
+
| Small metadata | 12–14pt |
|
|
145
|
+
|
|
146
|
+
- Round to the nearest standard value
|
|
147
|
+
|
|
148
|
+
### Common first-pass mistakes to watch for
|
|
149
|
+
|
|
150
|
+
These are the most frequent issues on the **first iteration** — catch them early for the biggest visual improvement:
|
|
151
|
+
|
|
152
|
+
1. **Font sizes 30-50% too small** — the #1 error. If all text looks "a size too small" compared to the mock, recommend bumping every font size up by 2-6pt.
|
|
153
|
+
2. **Vertical spacing too tight** — sections feel cramped compared to the mock. Gaps between major sections should typically be 24-44pt, not 8-16pt.
|
|
154
|
+
3. **Text colors too dark** — body text using `#000000` when it should be `#444444-#555555`. Secondary labels using `#666666` when they should be `#999999-#BBBBBB`.
|
|
155
|
+
4. **Card padding too small** — cards typically need 28-36pt padding, not 12-16pt.
|
|
156
|
+
5. **Card border radius too sharp** — modern designs use 16-20pt radius.
|
|
157
|
+
6. **Chart elements too thin/small** — data lines should be 4-5pt width, dots 10-12pt diameter.
|
|
158
|
+
|
|
159
|
+
When these issues appear together (they usually do), recommend **all of them at once** rather than fixing one at a time. This dramatically reduces iteration count.
|
|
160
|
+
|
|
161
|
+
7. **Gradient/area fills look like bar charts** — when using overlapping `<view>` columns to simulate area fill under a curve, you need 60-80+ columns with slight width overlap (`width: ${100/STEPS + 2}%`) and uniform low opacity (~0.10-0.20) for a smooth continuous appearance.
|
|
162
|
+
8. **Selected state not visible enough** — highlight backgrounds need sufficient contrast from the card background. Use at least `#F5E6D0` level warmth for beige/tan selection pills on white backgrounds, not `#F0EAE0` which is barely visible.
|
|
163
|
+
9. **Emoji instead of real icons** — emoji characters look wrong at any size. Recommend replacing with icon assets from the project's icon library if one exists.
|
|
164
|
+
10. **Raw primitives instead of widget components** — hand-built list rows using `<view>` + `<label>` miss standard spacing and styling. Check the workspace for a shared widget library and use those components instead.
|
|
165
|
+
|
|
166
|
+
### Don't nitpick platform differences
|
|
167
|
+
Some things will always look slightly different:
|
|
168
|
+
- System font rendering varies by platform
|
|
169
|
+
- Shadow rendering is approximate
|
|
170
|
+
- Scroll indicator visibility
|
|
171
|
+
- Status bar / window chrome
|
|
172
|
+
|
|
173
|
+
These are NOT issues to report.
|
|
174
|
+
|
|
175
|
+
### Focus on what the generator can fix
|
|
176
|
+
Only report issues that can be fixed by editing the .tsx file:
|
|
177
|
+
- Layout, spacing, sizing, colors, fonts, element ordering, missing elements
|
|
178
|
+
- Do NOT report: animation timing, gesture behavior, dynamic data differences, system UI differences
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Pixel diff (preferred over eyeballing)
|
|
183
|
+
|
|
184
|
+
When available, use the bundled pixel diff scripts for objective comparison:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# ALWAYS use --auto-mask to exclude avatar/thumbnail regions from the match score
|
|
188
|
+
python3 <skill_dir>/scripts/diff.py /path/to/mock.png /path/to/render.png --auto-mask
|
|
189
|
+
|
|
190
|
+
# For iOS simulator screenshots, also mask the status bar:
|
|
191
|
+
python3 <skill_dir>/scripts/diff.py /path/to/mock.png /path/to/render.png --auto-mask --mask "0,0,400,30"
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**ALWAYS use `--auto-mask`** on every diff. This auto-detects avatar/thumbnail/Bitmoji regions and excludes them from the match score — these render as colored placeholder circles that unfairly penalize the score.
|
|
195
|
+
|
|
196
|
+
Output: `/tmp/mock-vs-render-diff.png` — side-by-side: mock | render | amplified diff. Bright spots in the third panel = mismatches. Also prints a match percentage.
|
|
197
|
+
|
|
198
|
+
**Always open the diff image** so humans can see it: `open /tmp/mock-vs-render-diff.png`
|
|
199
|
+
|
|
200
|
+
This catches subtle differences that eyeballing misses: background color mismatches (#F2F2F2 vs #FFFFFF), missing drop shadows, and small spacing differences.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Integration with the pipeline
|
|
205
|
+
|
|
206
|
+
When used as part of `/valdi-mock-to-module`:
|
|
207
|
+
|
|
208
|
+
1. Receive mock image, rendered screenshot, and pixel diff image
|
|
209
|
+
2. Produce the structured feedback above
|
|
210
|
+
3. The diff coordinator applies fixes one at a time via hot-reload
|
|
211
|
+
4. After a batch of fixes, re-diff and compare again
|
|
212
|
+
5. Repeat until `MATCH` or max iterations reached
|
|
213
|
+
|
|
214
|
+
In the two-phase pipeline, this critic role is distributed across three specialist agents (Text, Icons, Widgets) that run in parallel. Each focuses on its domain and reports structured fix recommendations.
|
|
215
|
+
|
|
216
|
+
**Key principle**: You never see code. You only see images. This keeps your feedback honest — you can't be biased by "the code looks right". You evaluate purely on visual output.
|