baldart 3.17.1 → 3.18.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.
- package/CHANGELOG.md +100 -0
- package/README.md +21 -12
- package/VERSION +1 -1
- package/framework/.claude/agents/REGISTRY.md +1 -0
- package/framework/.claude/agents/visual-fidelity-verifier.md +319 -0
- package/framework/.claude/commands/design-review.md +130 -7
- package/framework/.claude/skills/e2e-review/SKILL.md +552 -0
- package/framework/.claude/skills/new/SKILL.md +99 -85
- package/framework/.claude/skills/playwright-skill/SKILL.md +29 -0
- package/framework/.claude/skills/prd/assets/card-template.yml +7 -0
- package/framework/.claude/skills/webapp-testing/SKILL.md +23 -0
- package/framework/AGENTS.md +1 -0
- package/framework/docs/PROJECT-CONFIGURATION.md +20 -1
- package/framework/templates/baldart.config.template.yml +38 -0
- package/package.json +1 -1
- package/src/commands/configure.js +58 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,106 @@ All notable changes to BALDART will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.18.1] - 2026-05-25
|
|
9
|
+
|
|
10
|
+
Chiusura del debito tecnico introdotto da v3.18.0. Il release v3.18.0 ha annunciato che `/design-review` supporta un programmatic JSON output mode invocabile da `/e2e-review` per gating uniforme — ma l'implementazione era una sola nota nel frontmatter ("se invocato con `mode: programmatic` ritorna JSON") senza body command che la concretizzasse, senza schema vincolato, senza mode-detection deterministica, senza taxonomy mapping tra le severity Markdown (Blockers/High/Medium/Nitpicks) e le severity programmatic (critical/major/minor) del `visual-fidelity-verifier`. Il risultato: una feature half-implemented, parsable only in teoria. Questo PATCH la rende reale.
|
|
11
|
+
|
|
12
|
+
L'adversarial review del piano v3.19.0 (multi-viewport + interactive states + Phase 4b design judgment pass) ha esplicitamente identificato il problema: "`/design-review` programmatic JSON è vaporware in v3.18.0 — va prima implementato bene come release a sé". Questa release fa esattamente quello, separando la chiusura del debito dall'aggiunta di nuove feature, in modo che v3.19.0 (quando arriverà, post-dogfooding) possa appoggiarsi a un contratto programmatic stabile invece di costruirsi sopra una stub.
|
|
13
|
+
|
|
14
|
+
### Fixed — `/design-review` dual-mode reale (Markdown ↔ JSON)
|
|
15
|
+
|
|
16
|
+
- **[framework/.claude/commands/design-review.md](framework/.claude/commands/design-review.md) riscritto** (frontmatter invariato, body completamente sostituito). Quattro sezioni nuove + workflow rivisto:
|
|
17
|
+
- **§ Invocation Modes**: documenta esplicitamente Mode A (interactive, Markdown — il comportamento storico) e Mode B (programmatic, JSON-only — il nuovo contratto). L'envelope JSON di input per Mode B è specificato verbatim: `{mode, card_id, route, viewport, dev_server_port, registry_paths: {index, tokens, components_dir}, ui_guidelines_path, features: {has_design_system, multi_tenant_theming}, tolerance}`. Il comando lo riceve passato dall'orchestratore `/e2e-review` quando Phase 4b sarà introdotta.
|
|
18
|
+
- **§ Programmatic output schema**: schema JSON di output vincolato, allineato verbatim a `framework/.claude/agents/visual-fidelity-verifier.md` § "Output Schema" per uniformità di parsing nell'aggregatore orchestratore. Campo `source: "design-review"` distingue le finding di questo command da quelle del verifier in modalità debug; i campi `findings[].severity`/`category`/`description`/`expected`/`actual`/`fix_hint`/`evidence`/`ds_drift_code`/`confidence` sono shape-identici. La deduplicazione cross-source avviene per `(route, category, ds_drift_code)` con precedenza al verifier quando duplicate (più strutturato).
|
|
19
|
+
- **§ Severity normalization (Markdown ↔ programmatic)**: tabella di mapping deterministica Blocker → `critical`, High → `major`, Medium → `minor`, Nitpick → DROP. Il drop dei Nitpick in modalità programmatic è deliberato (troppo noise per gating; restano nel report Markdown per uso interattivo).
|
|
20
|
+
- **§ Programmatic-mode category taxonomy**: enumera le 10 categorie ammesse in Mode B (`primitive-reinvented`, `primitive-missing-spec`, `token-bypass`, `component-stale`, `index-drift`, `authority-violation`, `brand-voice-drift`, `a11y-contrast`, `a11y-focus-visible`, `interactive-state-missing`) — sottoinsieme della tassonomia canonica del verifier adattato allo scope di design judgment di questo command. Categorie non in lista vanno emesse come stringhe libere in `gaps[]`, MAI come nuove categorie inventate (l'orchestratore non sa pesarle).
|
|
21
|
+
- **§ Workflow (both modes)**: passi 0–5 unificati per Mode A e Mode B, con la divergenza solo nel formato di output finale (passi 4 e 5). Mode B usa `dev_server_port` dall'envelope per costruire URL, salva screenshot in `/tmp/design-review/<route-slug>.png` per cross-reference dall'orchestratore.
|
|
22
|
+
- **§ Mode-detection contract**: regola deterministica anti-ambiguità — Mode B è triggered SOLO se l'input contiene la substring esatta `"mode": "programmatic"` (con quote, come appare nell'envelope JSON). Vietato auto-detection da contesto invocazione ("sto girando dentro a una skill") — produce silent Markdown leakage nel parser dell'orchestratore che rompe il gate. Su envelope malformato emette `{status: "error", source: "design-review", reason: "malformed_input_envelope", findings: []}` invece di fallback a Mode A (il fallback silenzioso bloccherebbe la card invece di segnalare).
|
|
23
|
+
|
|
24
|
+
### Notes
|
|
25
|
+
|
|
26
|
+
- **Nessun cambio framework payload oltre al command.** Nessun nuovo agente, nessuna nuova skill, nessuna nuova chiave config, nessuna modifica a `/new` o `/e2e-review`. Solo il command `/design-review` viene reso effettivamente dual-mode come annunciato in v3.18.0. `/e2e-review` non lo invoca ancora — quella connessione (Phase 4b) viene rimandata a una future release post-dogfooding, sulla base di dati reali su quanto valore aggiunge la judgment pass sopra il `visual-fidelity-verifier`.
|
|
27
|
+
- **Backward compatibility totale per uso interattivo**: utenti che invocano `/design-review /merchant/dashboard` continuano a ricevere il Markdown report identico a v3.17.x e prima. Mode A è il default; Mode B è opt-in via envelope JSON esplicito.
|
|
28
|
+
- **Severity taxonomy in lockstep**: il body del command include una nota esplicita "quando aggiorni la taxonomy qui, aggiorna in lockstep `framework/.claude/agents/visual-fidelity-verifier.md` § Severity Taxonomy". Le due fonti restano allineate per evitare drift cross-source nell'aggregatore.
|
|
29
|
+
- **Versioning rationale.** PATCH (3.18.0 → 3.18.1): no new capability. Il contratto Mode B era già annunciato in v3.18.0; questa release rende l'annuncio reale. Decision tree CLAUDE.md: "Doc fix, script bugfix, perf, security patch with no behaviour change → PATCH" — qualifica perché la behavior change è solo per chi sta ancora costruendo l'integrazione (nessun consumer esistente la invoca programmatically oggi).
|
|
30
|
+
- **Verification** (manuale, no test suite): (1) `/design-review /merchant/dashboard` interattivo → Markdown identico al pre-3.18.1 (regression check Mode A); (2) input contenente `"mode": "programmatic"` → JSON-only output, no preamble, parsable da `JSON.parse()`; (3) envelope malformato → emette `{status: "error", reason: "malformed_input_envelope"}` senza fallback a Markdown; (4) campi `route`/`dev_server_port` mancanti dall'envelope → stesso errore; (5) finding di severity Nitpick → presente in Mode A, assente da Mode B `findings[]`.
|
|
31
|
+
- **Path post-3.18.1**: dogfooding di v3.18.0 + 3.18.1 per 1–2 settimane su feature UI reali. Sulla base di falsi positivi/negativi raccolti, decidere data-driven quali estensioni includere in v3.19.0 tra: multi-viewport (mobile/desktop/tablet), interactive states (hover/focus/active/disabled + opt-in loading/empty/error), Phase 4b design judgment pass che invoca `/design-review` in Mode B all'interno di `/e2e-review`. L'adversarial review ha esplicitamente sconsigliato il bundle v3.19.0 senza dati di dogfooding — questa release rispetta quella raccomandazione.
|
|
32
|
+
|
|
33
|
+
## [3.18.0] - 2026-05-25
|
|
34
|
+
|
|
35
|
+
The end-to-end review fase post-implementazione diventa un **gate deterministico e BLOCKING** invece di un assortimento di check advisory. Until v3.17.x, la chiusura di una card via `/new` attraversava tre fasi eterogenee tutte non-bloccanti sul fronte UI: Phase 2.5 (Implementation Completeness Check) validava solo card AC / PRD alignment / code quality / schema / artifacts senza alcun gate visivo o funzionale runtime; Phase 2.6 (E2E Testing) era *condizionale* (solo con `test_plan.e2e_required: true` o QA profile BALANCED/DEEP) e invocava `qa-sentinel` che per charter (`qa-sentinel.md:151-161`) esegue solo gate meccanici (lint/type/test/build/audit) — non test browser-based né design; Phase 2.7 (Visual Design Review) invocava `ui-expert` ma era esplicitamente marcata "advisory, non-blocking" (`new/SKILL.md:897` — "findings logged but do NOT block commit"). Le skill `webapp-testing` e `playwright-skill` esistevano ma non erano mai auto-invocate da `/new`. La routine `ds-drift` (`framework/routines/ds-drift.routine.yml`) girava settimanalmente, catturando il drift visivo 1–7 giorni dopo il merge. **Conseguenza concreta** lamentata dall'utente: doveva rifare manualmente la review schermata-per-schermata di ogni card UI, e i dettagli grafici dei mockup venivano regolarmente ignorati.
|
|
36
|
+
|
|
37
|
+
Questo release risolve il problema con un **HYBRID architecture** validata da advisor: nuova skill orchestratore `/e2e-review` + nuovo agente specializzato `visual-fidelity-verifier`, integrazione BLOCKING in `/new` Phase 2.6 (unificando 2.6 + 2.7 attuali), gating tunabile via `features.e2e_review.*`, con riuso massimo dell'esistente (`coder` per scrivere `.spec.ts`, `playwright-skill` per esecuzione, `webapp-testing` per ispezione runtime in compliance-only, `/design-review` esteso a output JSON, `ui-expert` cascade riusata in compliance-only mode). L'architettura segue il **three-layer harness pattern** documentato da Anthropic in [Effective Harnesses for Long-Running Agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents): implementer (`coder`) e verifier (`visual-fidelity-verifier`) sono distinti, con aggregazione rule-based in mezzo — nessun agente valuta il proprio lavoro. Il pattern **Definition of Done machine-readable** ([Policy Cards, arXiv 2510.24383](https://arxiv.org/abs/2510.24383)) guida la sintesi Gherkin del piano di verifica. La combo **Playwright MCP + Vision** ([Playwright MCP](https://playwright.dev/mcp/introduction), [Giving Claude Code Eyes — round-trip screenshot testing](https://medium.com/@rotbart/giving-claude-code-eyes-round-trip-screenshot-testing-ce52f7dcc563)) è il pattern canonico 2025–2026 per browser+vision in agentic dev.
|
|
38
|
+
|
|
39
|
+
### Added — Nuova skill `/e2e-review` (orchestratore BLOCKING)
|
|
40
|
+
|
|
41
|
+
- **Nuova skill [framework/.claude/skills/e2e-review/SKILL.md](framework/.claude/skills/e2e-review/SKILL.md)** (~530 righe). Sei fasi sequenziali:
|
|
42
|
+
- **Phase 1 — Verification Plan Extraction**: legge `card.acceptance_criteria[]`, `card.test_plan` (quando presente, schema compatibile con quello già scritto da `/prd` Step 6, senza modifiche al PRD), `card.requirements[]`, `card.links.design[]`, `card.scope.routes[]` (con fallback derivato dal diff via `codebase-architect`). Sintetizza scenari Gherkin (Given/When/Then) e li persiste in `.baldart/e2e-review/<CARD-ID>/plan.json` come contratto machine-readable consumato dalle fasi successive.
|
|
43
|
+
- **Phase 2 — Mockup Source Cascade (4 livelli)**: (a) URL Figma + Figma MCP runtime probe → `get_design_context` + `get_screenshot`; (b) path locale referenziato in `card.links.design[]` (PNG/JPG/PDF — PDF estratto con `pdftoppm`, degrada gracefully); (c) no mockup ma `features.has_design_system: true` → modalità **compliance-only** che riusa la cascade BLOCKING del [design-system-protocol.md](framework/agents/design-system-protocol.md) (INDEX.md + tokens-reference.md + components/<Name>.md); (d) nulla → skip visual + warning in `gaps[]`, functional E2E continua comunque. Nessun hard fail per assenza di Figma — la dipendenza è genuinamente opzionale.
|
|
44
|
+
- **Phase 3 — Functional E2E**: spawn `coder` con contratto preciso (file in `${paths.e2e_tests_dir}/<CARD-ID-slug>.spec.ts`, screenshot path fissato a `.baldart/e2e-review/<CARD-ID>/screenshots/<route-slug>.png` per consumo da Phase 4, no chromium.launch, no edit fuori `${paths.e2e_tests_dir}`). Esegue `npx playwright test --reporter=json` headless in modalità programmatica (headed riservato a flussi OTP in invocazione manuale). Mappa scenari falliti in finding funzionali con severity rule-based (auth/payments/data-mutation = Critical; display-only = Major; flaky-passed-on-retry = Minor + `confidence: low`).
|
|
45
|
+
- **Phase 4 — Visual Fidelity**: pre-filter con pixel-diff (`pixel_diff_threshold` configurabile, default `0.02`) prima di invocare Vision — quando la diff è sotto soglia, il route passa senza spendere token Vision (primary latency/cost saver). Sopra soglia o in compliance-only, spawn `visual-fidelity-verifier` con payload strutturato; deduplicazione findings per `(route, category, region)`.
|
|
46
|
+
- **Phase 5 — Aggregation + Strict Severity Gate**: combina functional + visual findings, applica filtro tolerance (`strict` default → Critical+Major+Minor block; Minor con `confidence: low` auto-demote ad advisory — escape hatch documentato contro font-rendering false positive). Self-heal loop bounded (`max_self_heal_iterations`, default `2`): re-spawn `coder` con findings come fix instructions, re-esegui Phase 3+4, re-decidi. Override path: dopo esaurimento iterazioni in modalità manuale chiede reason obbligatoria (`require_override_reason: true`); in modalità programmatica restituisce `verdict: "blocked"` lasciando la decisione a `/new`.
|
|
47
|
+
- **Phase 6 — Return Protocol**: scrive `.baldart/e2e-review/<CARD-ID>/report.json` con schema strutturato `{status, iterations, findings[], ds_drift_codes[], gaps[], override_reason, transcript_paths[]}`. Modalità manuale renderizza anche Markdown summary; programmatica emette solo JSON come messaggio finale (parsato direttamente da `/new`).
|
|
48
|
+
- **Gate di skip pre-flight** per evitare overhead inutile: skill REFUSES quando `features.has_e2e_review: false` (preserva backward compat); auto-skip quando card non ha `links.design` E `git diff` non mostra file UI (`.tsx`/`.css`/`.scss`/`.svelte`/`.vue` sotto `${paths.app_dir}` o `${paths.components_primitives}`); auto-skip su card type `docs`/`chore`/`config`/`backend`/`api`/`db`/`infra`. Lo skip non è failure — `/new` procede a Phase 3 normalmente.
|
|
49
|
+
- **Re-run trigger**: se `/codexreview` (Phase 3.7) modifica file sotto `${paths.app_dir}`/`${paths.components_primitives}` o qualsiasi `*.css`/`*.scss` dopo il primo run, l'orchestratore re-invoca `/e2e-review` PRIMA del commit di Phase 4. Protegge contro code-review changes che reintroducono silenziosamente drift visivo.
|
|
50
|
+
|
|
51
|
+
### Added — Nuovo agente `visual-fidelity-verifier`
|
|
52
|
+
|
|
53
|
+
- **Nuovo agente [framework/.claude/agents/visual-fidelity-verifier.md](framework/.claude/agents/visual-fidelity-verifier.md)** (`model: sonnet`, ~280 righe). Worker stateless multimodale invocato esclusivamente da `/e2e-review` Phase 4. Unico nuovo agente del release — l'advisor ha bocciato la creazione di un secondo `e2e-functional-verifier` perché duplicherebbe il pattern Phase 2.6 attuale (`coder` scrive `.spec.ts`, Playwright esegue).
|
|
54
|
+
- **Hard prohibitions non-negotiable**: NEVER reads application source code (anti assertion-fitting bias — antipattern documentato Meta/Capgemini 2025: LLM-generated assertions che lockano il bug come "expected behavior"), NEVER edits files, NEVER proposes architectural refactors, NEVER declares "done" o "passed" (la decisione di gate è dell'orchestratore).
|
|
55
|
+
- **Input contract strict JSON**: `{card_id, route, viewport, implementation_screenshot_path, mockup_source: {level, mockup_path | figma_node_id | design_system_index_path | tokens_reference_path | components_in_scope}, tolerance, fix_hints_enabled}`.
|
|
56
|
+
- **Severity Taxonomy canonica** (SSOT consumata anche da `/e2e-review` e `/design-review`): **Critical** (`layout-break`, `element-order`, `responsiveness-break`, `component-missing`, `component-duplicated`, `unreachable-action`) blocca in ogni tolerance; **Major** (`spacing-off-scale`, `typography-{family,weight,size,line-height}`, `color-mismatch`, `color-opacity`, `gradient-direction`, `token-bypass`, `interactive-state-missing`, `a11y-contrast`, `a11y-focus-visible`) blocca in strict+balanced, advisory in lenient; **Minor** (`border-radius-off`, `shadow-off`, `micro-misalignment`, `font-rendering-variance`) blocca solo in strict (con auto-demote `confidence: low` ad advisory anche in strict).
|
|
57
|
+
- **Output schema strict JSON**: `{status, route, mockup_source_level, viewport, compliance_score, findings: [{severity, category, description, expected, actual, fix_hint, evidence: {region, screenshot_crop_path}, ds_drift_code, confidence}], ds_drift_codes[], gaps[], transcript_path}`. Citazioni token rigorose (mai paraphrase — `--color-action-primary` non "the primary blue"). Anti-hallucination discipline (no finding emessi senza evidenza visibile; `status: error` invece di guessing quando screenshot insufficiente).
|
|
58
|
+
- **Mockup source cascade behaviour**: in modalità `figma`/`local` il mockup è ground truth visuale; in `compliance-only` riusa la cascade BLOCKING del [design-system-protocol.md](framework/agents/design-system-protocol.md) (INDEX + tokens-reference + per-component specs) e mappa findings ai drift code canonici `DS_TOKENS_DRIFT`/`DS_COMPONENT_STALE`/`DS_INDEX_DRIFT` (definiti nel protocollo, non qui — un solo SSOT).
|
|
59
|
+
|
|
60
|
+
### Added — Schema config propagation (regola interna del repo)
|
|
61
|
+
|
|
62
|
+
- **Template [framework/templates/baldart.config.template.yml](framework/templates/baldart.config.template.yml)**: aggiunto `features.has_e2e_review: false` (default opt-in esplicito — backward compatibility totale) e nuova sezione top-level `e2e_review:` con 4 chiavi commentate. La chiave esistente `paths.e2e_tests_dir` è ora consumata anche da `e2e-review` oltre che da `playwright-skill`.
|
|
63
|
+
- **`features.e2e_review` tuning sub-section**: `fidelity_tolerance` (`strict` default — Critical+Major+Minor block con escape hatch low-confidence; `balanced` blocca Critical+Major; `lenient` solo Critical), `max_self_heal_iterations` (default `2`, allineato a Phase 2.5 retry policy in `new/SKILL.md:699`), `pixel_diff_threshold` (default `0.02`, range 0.0–1.0 — pre-filter pixel-diff per skippare la Vision call quando implementazione e mockup sono pixel-identici), `require_override_reason` (default `true` — la reason loggata in tracker `## Issues & Flags` e in `report.json`).
|
|
64
|
+
- **[src/commands/configure.js](src/commands/configure.js)** prompt + status: aggiunto `has_e2e_review` al loop dei feature prompt (linea ~563 nuovo); nuova sezione "E2E review tuning" prima della sezione LSP (linea ~624 nuovo) che gating su `has_e2e_review: true` chiede via `UI.select` la tolerance e poi le 3 chiavi nested; aggiunta riga "E2E review:" nel box AUTODETECTED. Il detector schema-drift in `update.js` (linee 462–503) cattura automaticamente la nuova chiave `features.has_e2e_review` via template scan generico — nessun cambio dedicato necessario. `doctor.js` `configSchemaDrift()` (linee 70–82) usa lo stesso meccanismo.
|
|
65
|
+
- **[framework/AGENTS.md](framework/AGENTS.md)** tabella MUST aggiornata (linea 18): aggiunta riga `E2E review BLOCKING gate (Phase 2.6 of /new invokes /e2e-review) | features.has_e2e_review: true`.
|
|
66
|
+
|
|
67
|
+
### Changed — `/new` Phase 2.6 unificata e BLOCKING
|
|
68
|
+
|
|
69
|
+
- **[framework/.claude/skills/new/SKILL.md](framework/.claude/skills/new/SKILL.md) linee 814–901**: sostituite integralmente la legacy Phase 2.6 (E2E Testing condizionale invocante `qa-sentinel`) e Phase 2.7 (Visual Design Review advisory invocante `ui-expert`) con una singola Phase 2.6 unificata "End-to-End Review (BLOCKING, since v3.18.0)" che invoca `/e2e-review` in modalità programmatica. Il gate documentato sostituisce il branching condizionale precedente (`test_plan.e2e_required` + QA profile + legacy fallback heuristic): 3 condizioni di skip (feature disabled / backend-only card / docs|chore|config card), payload JSON strutturato all'invocazione, contract di ritorno JSON parsato programmaticamente. Mapping verdict→azione: `passed`/`skipped`/`overridden` → procede; `blocked` STOPpa la card senza procedere a Phase 3 e chiede all'utente override/escalation/abandon; `error` chiede retry/skip/abandon. Re-run trigger dopo Phase 3.7 `/codexreview` se file UI modificati. Tracker output strutturato per audit cross-card.
|
|
70
|
+
|
|
71
|
+
### Changed — `/design-review` command estensione output JSON
|
|
72
|
+
|
|
73
|
+
- **[framework/.claude/commands/design-review.md](framework/.claude/commands/design-review.md)** prologo: aggiunta nota di invocazione che documenta il dual-mode. Interactive (default) produce Markdown report (Blockers/High/Medium/Nitpicks) come oggi; programmatic mode (input contiene `"mode": "programmatic"`) ritorna un singolo JSON object matching lo schema di `visual-fidelity-verifier` per gating dell'orchestratore. Nessuna logica nuova nel command body — solo flag di output format. Permette al `/e2e-review` skill di riusare `/design-review` come tooling alternativo quando appropriato senza duplicare la cascade design-system.
|
|
74
|
+
|
|
75
|
+
### Changed — Documentazione integrazione skill tooling
|
|
76
|
+
|
|
77
|
+
- **[framework/.claude/skills/playwright-skill/SKILL.md](framework/.claude/skills/playwright-skill/SKILL.md)**: nuova sezione "E2E Review Integration (since v3.18.0)" prima di Quick Reference. Documenta il contratto consumer: spec generata da `coder` partendo da `plan.json`, screenshot path fissato per consumo da Phase 4, headless in modalità programmatica, mapping severity di scenari falliti. Nessuna logica nuova nella skill — solo documentazione del nuovo consumer.
|
|
78
|
+
- **[framework/.claude/skills/webapp-testing/SKILL.md](framework/.claude/skills/webapp-testing/SKILL.md)**: nuova sezione "E2E Review Integration (since v3.18.0)" in testa. Documenta l'uso in compliance-only mode (cascade level c) per fetch dei computed style runtime quando manca mockup-as-image; ruolo del server lifecycle helper. Nessuna logica nuova.
|
|
79
|
+
- **[framework/.claude/skills/prd/assets/card-template.yml](framework/.claude/skills/prd/assets/card-template.yml)** linea 134 ca.: aggiunto commento sopra `test_plan:` che documenta il nuovo dual consumer (`/new` legacy fallback + `/e2e-review` Phase 1 — il mapping verso Gherkin scenarios). Nessuna modifica allo schema PRD; le card scritte prima della v3.18.0 sono pienamente compatibili (Phase 1 di `/e2e-review` ha fallback da `acceptance_criteria` quando `test_plan` manca).
|
|
80
|
+
|
|
81
|
+
### Changed — Registry e routing
|
|
82
|
+
|
|
83
|
+
- **[framework/.claude/agents/REGISTRY.md](framework/.claude/agents/REGISTRY.md)**: aggiunta riga per `visual-fidelity-verifier` immediatamente sotto `ui-expert` (sezione Design). Specializzazione: visual diff, severity taxonomy, design-system compliance via registry cascade. Auto-invoke yes via `/e2e-review` — non spawnabile ad-hoc (l'orchestratore è il solo entry point).
|
|
84
|
+
|
|
85
|
+
### Changed — Documentation utente
|
|
86
|
+
|
|
87
|
+
- **[README.md](README.md)**: agent count aggiornato da 24 a 27 (visual-fidelity-verifier + numerazione resa coerente Design&UX→Specialized); skill count da 24 a 25 (e2e-review aggiunto sotto "Code quality"); nuova sezione "End-to-End Review BLOCKING Gate (new in v3.18.0)" prima della sezione "UI Excellence + Post-Intervention Coherence Gate (v3.12.0)" che riassume l'intera architettura, citando le fonti del 2025–2026 e documentando il tuning `e2e_review.*`.
|
|
88
|
+
- **[framework/docs/PROJECT-CONFIGURATION.md](framework/docs/PROJECT-CONFIGURATION.md)**: tabella paths aggiornata (e2e_tests_dir ora cita anche e2e-review); nuova sezione "§ 4.2.1 `e2e_review` — tuning for the BLOCKING end-to-end review gate (v3.18.0+)" che documenta ogni chiave con tipo/default/effetto e citazioni cross-reference al protocollo `design-system-protocol.md` per i drift code.
|
|
89
|
+
|
|
90
|
+
### Notes
|
|
91
|
+
|
|
92
|
+
- **Backward compatibility totale.** Il default `features.has_e2e_review: false` significa che progetti pre-3.18.0 non vedono nessun cambio di comportamento finché non eseguono `npx baldart configure` (che proporrà la nuova feature) o editano manualmente la config. `/new` Phase 2.6 silenziosamente skippa la chiamata a `/e2e-review` quando il flag è false, preservando il workflow legacy con un breve log informativo nel tracker. Le card scritte prima della v3.18.0 (senza `test_plan` block, o con `test_plan.e2e_required: false`) sono pienamente supportate dalla nuova fase: Phase 1 di `/e2e-review` deriva Gherkin scenarios direttamente da `acceptance_criteria` quando `test_plan` è assente, e la mockup cascade degrada gracefully a compliance-only / skip quando `links.design` manca.
|
|
93
|
+
- **Riuso massimo, footprint minimo.** Un solo nuovo agente (`visual-fidelity-verifier`) e una sola nuova skill (`/e2e-review`). Riusati: `coder` (scrittura `.spec.ts` + self-heal loop), `playwright-skill` (esecuzione spec), `webapp-testing` (compliance-only computed styles fetch), `codebase-architect` (mapping route→file fallback), `/design-review` command (esteso a output JSON per gating), `ui-expert` cascade (referenziata da `visual-fidelity-verifier` in compliance-only mode), `design-system-protocol.md` (SSOT della cascade BLOCKING e dei drift code — referenziato, mai duplicato), `ds-drift` routine (resta safety net settimanale per edit umani che bypassano `/new`). Bocciata da advisor la creazione di un secondo agente `e2e-functional-verifier` (avrebbe duplicato il pattern Phase 2.6 attuale) e di un terzo "evaluator" three-agent-harness completo (overkill quando l'aggregazione è rule-based su severity strutturata, da introdurre solo se dogfooding rivela troppi falsi positivi).
|
|
94
|
+
- **Dependency contract.** Il consumer deve avere `@playwright/test` installato e `paths.e2e_tests_dir` valorizzato; lo skill rileva il gap in Phase 3 step 1 e fornisce setup hint actionable (`npm i -D @playwright/test && npx playwright install chromium`). Figma MCP è opzionale — la cascade Phase 2 degrada a level (b)/(c)/(d) senza errori. Vision usage è governata dal `pixel_diff_threshold` pre-filter — la maggior parte dei route passa senza spendere token Vision.
|
|
95
|
+
- **Override path con audit trail.** Quando self-heal esaurisce iterazioni in modalità manuale e l'utente vuole comunque procedere, una reason è obbligatoria (`require_override_reason: true` default). La reason è loggata sia nel `/tmp/batch-tracker-<FIRST-CARD-ID>.md` come `[E2E-OVERRIDE] <reason>` sia in `.baldart/e2e-review/<CARD-ID>/report.json` come campo `override_reason`. Il rationale: il gate deve essere strict per default ma deve avere una via di fuga documentata — gate troppo rigidi senza escape hatch generano user override fatigue e perdita di fiducia (failure mode documentato).
|
|
96
|
+
- **Re-run automatico dopo `/codexreview`.** Se Phase 3.7 modifica file UI, `/e2e-review` re-esegue PRIMA del commit di Phase 4. Lo state directory `.baldart/e2e-review/<CARD-ID>/` viene riusato (no re-fetch mockup, no re-build plan) — solo Phase 3 (functional) + Phase 4 (visual) vengono ri-eseguite. Protezione contro la classe di bug dove il code-review introduce silenziosamente drift visivo per "consistency cleanup".
|
|
97
|
+
- **Verification è manuale (no test suite — `npm test` resta no-op stub).** Dogfood scenarios da girare dopo l'install:
|
|
98
|
+
1. `npx baldart configure` su progetto pre-3.18.0 → la propagazione schema drift detector cattura `features.has_e2e_review` mancante e offre `configure` automaticamente. Il prompt "Enable BLOCKING end-to-end review?" appare; rispondendo `Yes` la sezione "E2E review tuning" chiede tolerance/max-iter/threshold/require-reason.
|
|
99
|
+
2. `/e2e-review CARD-ID` manuale su una card UI esistente con `features.has_e2e_review: true` + `links.design` valorizzato → il piano viene scritto in `.baldart/e2e-review/<CARD-ID>/plan.json`, il `.spec.ts` generato in `tests/e2e/`, screenshot scattate, `visual-fidelity-verifier` invocato per ogni route, report JSON + Markdown summary mostrato all'utente.
|
|
100
|
+
3. `/new <CARD-ID>` su card UI dopo opt-in → Phase 2.6 invoca `/e2e-review` programmatically; verdict `passed` procede a Phase 3 normalmente; verdict `blocked` STOPpa la card e chiede override/escalation/abandon all'utente.
|
|
101
|
+
4. `/new <CARD-ID>` su card backend-only (no `links.design`, no file UI nel diff) → Phase 2.6 auto-skip con log `"e2e-review: SKIP (backend-only card)"`, procede a Phase 3 senza errori.
|
|
102
|
+
5. Test sintetico iniettivo: card con 3 deviazioni note pre-iniettate (colore button hardcoded, padding fuori scala token, border-radius literal) → report contiene esattamente 3 finding con severity (Major, Major, Minor in strict mode) e gate blocca il commit.
|
|
103
|
+
6. Negative path Figma MCP non disponibile → cascade falls through a level (b) (immagine locale) o (c) (compliance-only) senza hard fail; warning loggato in `gaps[]`.
|
|
104
|
+
7. Self-heal loop: card con token bypass fixabile → il loop converge in ≤ 2 iterazioni e il commit procede senza override richiesto.
|
|
105
|
+
8. Override path: card con falso positivo evidente → l'utente fornisce reason, commit procede con `[E2E-OVERRIDE] <reason>` loggato nel tracker e in `report.json`.
|
|
106
|
+
- **Versioning rationale.** Impact MINOR (3.17.1 → 3.18.0): aggiunge una skill (`/e2e-review`), un agente (`visual-fidelity-verifier`), una fase BLOCKING nella skill esistente `/new`, e nuove chiavi di configurazione (`features.has_e2e_review` + sub-section `e2e_review.*`). Non rompe installazioni esistenti — il default `false` mantiene il comportamento legacy fino a opt-in esplicito via `configure`. Non rimuove agenti / cambia layout di directory / cambia comandi CLI (decision tree MAJOR non si applica).
|
|
107
|
+
|
|
8
108
|
## [3.17.1] - 2026-05-23
|
|
9
109
|
|
|
10
110
|
CLI quality-of-life patch shaken loose by a hands-on consumer update simulation (mayo, 3.13.0 → 3.16.0). Four real bugs surfaced when actually driving `baldart update` end-to-end from a scripted context. Two were show-stoppers for any non-interactive use (CI, AI-driven, headless update agent), one was cosmetic but ugly, one was a stale stub that lied to the user. All four are fixed; nothing in this release changes framework payload behaviour for end-users running BALDART interactively in a TTY.
|
package/README.md
CHANGED
|
@@ -85,7 +85,7 @@ No additional activation steps needed — once installed, Claude Code (and Codex
|
|
|
85
85
|
- **agents/**: 17 domain modules (architecture, workflows, testing, security, etc.)
|
|
86
86
|
- **Routing**: If you touch X, read Y - minimize context loading
|
|
87
87
|
|
|
88
|
-
### AI Agents (
|
|
88
|
+
### AI Agents (27 specialized agents)
|
|
89
89
|
|
|
90
90
|
**Core (required for every project)**
|
|
91
91
|
1. **codebase-architect**: MANDATORY before planning/implementation - understands codebase structure
|
|
@@ -107,19 +107,20 @@ No additional activation steps needed — once installed, Claude Code (and Codex
|
|
|
107
107
|
15. **motion-expert**: Animation specs, transitions, micro-interactions
|
|
108
108
|
16. **hyper-gamification-designer**: Game mechanics, retention loops, economy balance
|
|
109
109
|
17. **remotion-animator-orchestrator**: Video/motion graphics with Remotion
|
|
110
|
+
18. **visual-fidelity-verifier** (v3.18.0): Stateless multimodal worker auto-invoked by `/e2e-review` Phase 4 — compares an implemented UI route against its mockup (or design-system spec) and returns a severity-tagged JSON report. Never reads source code (anti assertion-fitting bias), never edits, never declares done
|
|
110
111
|
|
|
111
112
|
**Product & Marketing**
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
19. **onboarding-architect-lead**: User onboarding flow design and experimentation
|
|
114
|
+
20. **marketing-conversion-strategist**: High-converting copy and messaging
|
|
115
|
+
21. **seo-analytics-strategist**: SEO strategy, metadata, GA4/GTM event planning
|
|
116
|
+
22. **email-deliverability-architect**: Transactional/informational email design + SPF/DKIM/DMARC
|
|
117
|
+
23. **website-orchestrator**: Multi-agent website development coordination
|
|
117
118
|
|
|
118
119
|
**Specialized**
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
24. **hybrid-ml-architect**: ML/DL system design (recommenders, ranking, embeddings)
|
|
121
|
+
25. **legal-counsel-gdpr**: GDPR compliance, privacy policies, data governance
|
|
122
|
+
26. **deep-human-insight**: Psychological / sociological analysis for B2C UX and adoption
|
|
123
|
+
27. **skill-improver**: Weekly auto-improvement of skills/agents based on review/QA findings
|
|
123
124
|
|
|
124
125
|
REGISTRY.md is the single source of truth for agent routing and capabilities.
|
|
125
126
|
|
|
@@ -207,13 +208,13 @@ Skills always-ask when required keys are missing — never silently default.
|
|
|
207
208
|
never overwrites your file. Full guide:
|
|
208
209
|
[`framework/docs/PROJECT-CONFIGURATION.md`](framework/docs/PROJECT-CONFIGURATION.md).
|
|
209
210
|
|
|
210
|
-
### Skills (
|
|
211
|
+
### Skills (25 portable skills)
|
|
211
212
|
|
|
212
213
|
Skills live under `.claude/skills/` and are auto-discovered by Claude Code.
|
|
213
214
|
Bundled skills:
|
|
214
215
|
|
|
215
216
|
- **Workflow**: `new`, `prd`, `prd-add`, `bug`, `simplify`, `worktree-manager`, `issue-review`, `context-primer`
|
|
216
|
-
- **Code quality**: `skill-creator`, `find-skills`, `webapp-testing`, `playwright-skill`, `lsp-bootstrap` (v3.10.0)
|
|
217
|
+
- **Code quality**: `skill-creator`, `find-skills`, `webapp-testing`, `playwright-skill`, `lsp-bootstrap` (v3.10.0), `e2e-review` (v3.18.0)
|
|
217
218
|
- **Design**: `frontend-design`, `ui-design`, `motion-design`, `gamification-design`, `design-system-init` (v3.11.0)
|
|
218
219
|
- **Product**: `seo-audit`, `copywriting`, `api-design-principles`
|
|
219
220
|
- **Knowledge**: `doc-writing-for-rag`, `capture` (LLM wiki overlay)
|
|
@@ -223,6 +224,14 @@ Bundled skills:
|
|
|
223
224
|
|
|
224
225
|
When `features.has_design_system: true`, every UI-touching agent/skill/command (`ui-expert`, `ui-design`, `frontend-design`, `code-reviewer`, `/design-review`) follows the same BLOCKING cascade: read `${paths.design_system}/INDEX.md` (Authority Matrix), `tokens-reference.md` (token contract), and `components/<Name>.md` for every primitive in scope — BEFORE producing or reviewing any UI. New components must reuse from the registry or ship their per-component spec in the same change. Hardcoded color/shadow/radius/spacing values are HIGH findings. The textual SSOT for the protocol lives in [`framework/agents/design-system-protocol.md`](framework/agents/design-system-protocol.md). Projects without a registry can bootstrap one with `/design-system-init`, which inventories existing primitives, extracts tokens from global styles + Tailwind config, scaffolds the registry, and flips the flag.
|
|
225
226
|
|
|
227
|
+
### End-to-End Review BLOCKING Gate (new in v3.18.0)
|
|
228
|
+
|
|
229
|
+
When `features.has_e2e_review: true`, the `/new` orchestrator Phase 2.6 invokes the new `/e2e-review` skill on every UI card (auto-skipped on backend-only cards). The skill is a **deterministic, BLOCKING** orchestrator that combines functional E2E (Playwright spec written by `coder`, executed via `playwright-skill`) with visual fidelity diff (`visual-fidelity-verifier` multimodal agent) and aggregates findings under a strict severity gate. This replaces the legacy advisory pair (Phase 2.6 conditional E2E + Phase 2.7 non-blocking design review) that left the user manually re-verifying every screen.
|
|
230
|
+
|
|
231
|
+
The skill walks a **4-level mockup source cascade** (Figma MCP → local PNG/JPG/PDF → design-system compliance-only → skip-with-warning) — Figma is opt-in, the framework remains portable. The aggregation gate uses a **canonical severity taxonomy** (Critical: layout/responsiveness/element-order/component-missing; Major: spacing/typography/color/token-bypass/interactive-state/a11y; Minor: border-radius/shadow/micro-misalignment). The gate enforces three pillars from the 2025–2026 agentic-testing literature: (a) **implementer ≠ verifier** ([Anthropic — Effective Harnesses for Long-Running Agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents)), (b) **Definition of Done machine-readable** ([Policy Cards, arXiv 2510.24383](https://arxiv.org/abs/2510.24383)), (c) **Playwright MCP + Vision** as the canonical browser+vision combo ([Playwright MCP](https://playwright.dev/mcp/introduction)).
|
|
232
|
+
|
|
233
|
+
Tuning lives under `features.e2e_review` in `baldart.config.yml`: `fidelity_tolerance` (`strict` | `balanced` | `lenient`, default `strict`), `max_self_heal_iterations` (default `2`), `pixel_diff_threshold` (default `0.02` — pre-filter to skip Vision when implementation and mockup are pixel-identical, primary cost saver), `require_override_reason` (default `true`). When self-heal exhausts iterations, the gate exposes an **override path with mandatory reason** logged in the tracker's `## Issues & Flags` for auditability. The weekly `ds-drift` routine remains as a complementary safety net for direct human edits that bypass `/new`.
|
|
234
|
+
|
|
226
235
|
### UI Excellence + Post-Intervention Coherence Gate (new in v3.12.0)
|
|
227
236
|
|
|
228
237
|
The `ui-expert` agent is upgraded from a generic baseline to a world-class UI/UX reviewer/designer — UI States Taxonomy (8 states), Performance Gates (Core Web Vitals 2026 — LCP/INP/CLS), modern CSS surface (container queries, `:has()`, View Transitions, subgrid, logical properties), AI-era patterns (streaming UI, hallucination guardrails), and 60+ categorized red flags. Numeric reference tables (type scale, contrast targets WCAG+APCA, spacing scales, density tiers, motion durations/easings) are SSOT'd in [`framework/agents/design-system-protocol.md`](framework/agents/design-system-protocol.md) so agents cite values verbatim instead of inventing them. Crucially, the registry-first discipline now has a **post-intervention coherence gate**: every UI change introduced by `ui-expert` / `ui-design` / `frontend-design` (and verified by `code-reviewer` at merge) must reconcile `INDEX.md` + `components/<Name>.md` + `tokens-reference.md` **in the same change** — drift can no longer wait for the weekly `ds-drift` routine. Three layers now enforce coherence: per-task → per-merge → weekly safety net. Existing projects align their current graphic organization with the new discipline via [`framework/docs/UPGRADE-3.12-UI-COHERENCE.md`](framework/docs/UPGRADE-3.12-UI-COHERENCE.md) (idempotent walkthrough: baseline scan → prioritized backlog → quick wins → gate verification).
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.18.1
|
|
@@ -18,6 +18,7 @@ Quick-reference for all custom agents. Use this to route tasks to the right spec
|
|
|
18
18
|
| **qa-sentinel** | QA | **Mechanical gate runner** — lint, typecheck, test suite, build, security audit, markdownlint. Returns PASS/FAIL verdict only. Does NOT analyze code, verify ACs, or review security/performance (those are Phase 2.5 and code-reviewer responsibilities). | Gate execution, verdicts | No (reports failures, coder fixes) | ESLint, tsc, node --test, npm run build, npm audit, markdownlint |
|
|
19
19
|
| **hybrid-ml-architect** | ML | Design/implement ML systems end-to-end | Recommender, ranking, embeddings | Yes | Model design, evaluation, monitoring |
|
|
20
20
|
| **ui-expert** | Design | Design and review UI/UX | Mobile-first, accessibility, registry-first protocol gate (when `features.has_design_system: true`) — BLOCKING reads on `${paths.design_system}/INDEX.md` + `tokens-reference.md` + `components/<Name>.md` per `framework/agents/design-system-protocol.md`, Component Discovery cascade before any design | No | ui-ux-pro-max, Playwright |
|
|
21
|
+
| **visual-fidelity-verifier** | Design | Compare an implemented UI route against its mockup (or design-system spec) and return a severity-tagged JSON report. Auto-invoked by `/e2e-review` skill (Phase 4) — never spawned ad-hoc. Stateless. Strict severity taxonomy (Critical / Major / Minor) — never reads source code (anti assertion-fitting bias), never edits, never declares done. | Visual diff, severity taxonomy, design-system compliance check via registry cascade | No | Vision (multimodal), Read (screenshots + registry only), Playwright screenshots passed in by orchestrator |
|
|
21
22
|
| **visual-designer** | Design | Generate visual assets via Kie.ai | Illustrations, icons, hero images | Yes | Kie.ai API, WebP optimization |
|
|
22
23
|
| **motion-expert** | Design | Design animations and micro-interactions | Transitions, timing, easing | No | Animation specs, a11y fallbacks |
|
|
23
24
|
| **hyper-gamification-designer** | Design | Analyze game features and retention mechanics | Progression, reward loops | No | MDA analysis, economy balance |
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: visual-fidelity-verifier
|
|
3
|
+
description: "Compare an implemented UI route against its mockup (or design-system spec) and return a severity-tagged JSON report. Stateless multimodal worker invoked by the /e2e-review skill — never edits code, never reads source, never declares done. Single responsibility: visual diff."
|
|
4
|
+
model: sonnet
|
|
5
|
+
color: orange
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are the **Visual Fidelity Verifier**. You exist for one purpose: compare a
|
|
9
|
+
rendered UI screenshot against its intended mockup (or, in compliance-only mode,
|
|
10
|
+
against the project's design-system spec) and return a deterministic,
|
|
11
|
+
severity-tagged JSON report.
|
|
12
|
+
|
|
13
|
+
You are stateless. You do not iterate. You do not fix. You report what you see
|
|
14
|
+
versus what was intended, with a structured severity tag and a fix hint per
|
|
15
|
+
finding. The orchestrating skill (`/e2e-review`) decides what to do with your
|
|
16
|
+
output.
|
|
17
|
+
|
|
18
|
+
## Project Context
|
|
19
|
+
|
|
20
|
+
**Reads from `baldart.config.yml`:**
|
|
21
|
+
`paths.design_system`, `paths.ui_guidelines`, `paths.global_styles`,
|
|
22
|
+
`paths.components_primitives`, `identity.design_philosophy`,
|
|
23
|
+
`features.has_design_system`, `features.e2e_review.fidelity_tolerance`,
|
|
24
|
+
`features.e2e_review.pixel_diff_threshold`.
|
|
25
|
+
|
|
26
|
+
**Gated by features:** `features.has_e2e_review`. The agent refuses to run
|
|
27
|
+
when `false` — it exists only to support the `/e2e-review` skill.
|
|
28
|
+
|
|
29
|
+
**On missing/empty keys:** report the gap in the output JSON and downgrade to
|
|
30
|
+
the most degraded cascade level (skip visual + warning). Do not assume defaults.
|
|
31
|
+
See `framework/agents/project-context.md` § 3.
|
|
32
|
+
|
|
33
|
+
## Hard Prohibitions (non-negotiable)
|
|
34
|
+
|
|
35
|
+
- **NEVER read application source code** (`.tsx`, `.ts`, `.css`, `.scss`,
|
|
36
|
+
`.jsx`, `.js` under `${paths.components_root}` or `${paths.app_dir}`). Reading
|
|
37
|
+
the implementation creates assertion-fitting bias — you would describe what
|
|
38
|
+
the code says, not what the screen shows. Antipattern documented Meta /
|
|
39
|
+
Capgemini 2025: LLM-generated assertions that lock the current bug as
|
|
40
|
+
"expected behavior".
|
|
41
|
+
- **NEVER edit any file.** You produce a JSON report only. The orchestrator
|
|
42
|
+
delegates fixes to a separate `coder` agent in a self-heal loop.
|
|
43
|
+
- **NEVER propose architectural refactors.** Your scope is visual fidelity, not
|
|
44
|
+
component API design (that is `ui-expert`'s job).
|
|
45
|
+
- **NEVER declare a task "done" or "passed".** You return findings. The strict
|
|
46
|
+
gate logic lives in the `/e2e-review` skill — it decides pass/block/override.
|
|
47
|
+
|
|
48
|
+
## Input Contract
|
|
49
|
+
|
|
50
|
+
The orchestrator (`/e2e-review`) invokes you with this JSON payload:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"card_id": "FEAT-XXXX",
|
|
55
|
+
"route": "/merchant/dashboard",
|
|
56
|
+
"viewport": { "width": 1440, "height": 900 },
|
|
57
|
+
"implementation_screenshot_path": "/abs/path/to/impl.png",
|
|
58
|
+
"mockup_source": {
|
|
59
|
+
"level": "figma" | "local" | "compliance-only" | "skip",
|
|
60
|
+
"mockup_path": "/abs/path/to/mockup.png", // present for figma + local
|
|
61
|
+
"figma_node_id": "1:23", // present for figma
|
|
62
|
+
"design_system_index_path": "...", // present for compliance-only
|
|
63
|
+
"tokens_reference_path": "...", // present for compliance-only
|
|
64
|
+
"components_in_scope": ["Button","Card"] // present for compliance-only
|
|
65
|
+
},
|
|
66
|
+
"tolerance": "strict" | "balanced" | "lenient",
|
|
67
|
+
"fix_hints_enabled": true
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
If `mockup_source.level == "skip"`, return immediately with
|
|
72
|
+
`{ "status": "skipped", "reason": "no_mockup_available", "findings": [] }`.
|
|
73
|
+
|
|
74
|
+
## Severity Taxonomy (CANONICAL — cite verbatim)
|
|
75
|
+
|
|
76
|
+
This taxonomy is the SSOT consumed by `/e2e-review` and `/design-review`. Do
|
|
77
|
+
not invent new severity levels. Do not move categories across tiers.
|
|
78
|
+
|
|
79
|
+
### Critical (BLOCKS in any tolerance — strict, balanced, lenient)
|
|
80
|
+
|
|
81
|
+
| Category | Examples |
|
|
82
|
+
|---|---|
|
|
83
|
+
| `layout-break` | Flexbox/grid container collapsed, elements stacked when designed side-by-side, vertical rhythm broken |
|
|
84
|
+
| `element-order` | DOM/visual order differs from mockup (Button placed before Title when designed after) |
|
|
85
|
+
| `responsiveness-break` | Breakpoint missing — desktop layout served on 320–375px viewport, horizontal scroll on mobile |
|
|
86
|
+
| `component-missing` | Designed component absent from rendered output (e.g. mockup has a CTA card, screen does not) |
|
|
87
|
+
| `component-duplicated` | Same primitive rendered twice when designed once (e.g. accidental React key collision) |
|
|
88
|
+
| `unreachable-action` | Primary CTA off-screen / behind fixed overlay / unreachable by thumb on mobile |
|
|
89
|
+
|
|
90
|
+
### Major (BLOCKS in strict + balanced; advisory in lenient)
|
|
91
|
+
|
|
92
|
+
| Category | Examples |
|
|
93
|
+
|---|---|
|
|
94
|
+
| `spacing-off-scale` | Padding/margin outside the token scale (e.g. `padding: 13px` instead of `--space-3 = 12px`) |
|
|
95
|
+
| `typography-family` | Font-family differs from design (e.g. system-ui rendered, Inter designed) |
|
|
96
|
+
| `typography-weight` | Font-weight off (400 rendered, 600 designed) |
|
|
97
|
+
| `typography-size` | Font-size off (16px rendered, 18px designed) AND outside the type-scale tolerance (> 2px diff) |
|
|
98
|
+
| `typography-line-height` | Line-height outside the spec (1.5 rendered, 1.35 designed for heading) |
|
|
99
|
+
| `color-mismatch` | Hex / oklch off by more than the perceptual delta (delta-E > 2 for body, > 1 for brand surface) |
|
|
100
|
+
| `color-opacity` | Alpha channel off (e.g. 100% rendered, 80% designed) |
|
|
101
|
+
| `gradient-direction` | Gradient angle / stops off |
|
|
102
|
+
| `token-bypass` | Implementation uses a hardcoded value where the project's token would apply (detectable in compliance-only mode via tokens-reference cross-check) |
|
|
103
|
+
| `interactive-state-missing` | Hover / focus / active / disabled state absent or visually identical to idle |
|
|
104
|
+
| `a11y-contrast` | Body text contrast < 4.5:1 (WCAG AA) or < APCA Lc 75; focus indicator < 3:1 |
|
|
105
|
+
| `a11y-focus-visible` | Interactive element has `outline: none` without equivalent custom focus indicator |
|
|
106
|
+
|
|
107
|
+
### Minor (BLOCKS only in strict tolerance; logged elsewhere)
|
|
108
|
+
|
|
109
|
+
| Category | Examples |
|
|
110
|
+
|---|---|
|
|
111
|
+
| `border-radius-off` | Radius differs by 1–2px or uses literal instead of token (e.g. `border-radius: 7px` vs `--radius-md = 8px`) |
|
|
112
|
+
| `shadow-off` | Shadow blur/spread off by < 4px or uses literal instead of token |
|
|
113
|
+
| `micro-misalignment` | Element offset by 1–2px from designed position (sub-grid drift) |
|
|
114
|
+
| `font-rendering-variance` | Anti-aliasing / subpixel rendering difference (often a false positive — flag with low confidence) |
|
|
115
|
+
|
|
116
|
+
## Mockup Source Cascade Behavior
|
|
117
|
+
|
|
118
|
+
You receive `mockup_source.level` from the orchestrator. Adapt your protocol:
|
|
119
|
+
|
|
120
|
+
### Level (a) — `figma`
|
|
121
|
+
|
|
122
|
+
Mockup is a Figma frame screenshot fetched via the Figma MCP server.
|
|
123
|
+
`mockup_path` is the local PNG, `figma_node_id` is the Figma node identity for
|
|
124
|
+
audit trail. Treat the Figma frame as the **ground truth** — the implementation
|
|
125
|
+
must match it modulo the tolerance thresholds below.
|
|
126
|
+
|
|
127
|
+
### Level (b) — `local`
|
|
128
|
+
|
|
129
|
+
Mockup is a local image (PNG / JPG / PDF first page) referenced in
|
|
130
|
+
`card.links.design`. Same protocol as Figma — local image is ground truth.
|
|
131
|
+
|
|
132
|
+
### Level (c) — `compliance-only`
|
|
133
|
+
|
|
134
|
+
No image-based mockup is available, but `features.has_design_system: true`. You
|
|
135
|
+
do NOT diff against a picture. Instead, execute the **registry-first cascade**
|
|
136
|
+
defined in [`framework/agents/design-system-protocol.md`](../../agents/design-system-protocol.md)
|
|
137
|
+
§ "BLOCKING pre-work":
|
|
138
|
+
|
|
139
|
+
1. Read `${paths.design_system}/INDEX.md` and extract the Authority Matrix for
|
|
140
|
+
the components in scope.
|
|
141
|
+
2. Read `${paths.design_system}/tokens-reference.md` to know which color /
|
|
142
|
+
spacing / shadow / radius / motion values are canonical.
|
|
143
|
+
3. For each component in `mockup_source.components_in_scope`, read
|
|
144
|
+
`${paths.design_system}/components/<Name>.md`.
|
|
145
|
+
|
|
146
|
+
Then inspect the implementation screenshot and flag:
|
|
147
|
+
|
|
148
|
+
- **token-bypass** — colors / spacings / shadows / radii in the rendered UI
|
|
149
|
+
that do not match any token in `tokens-reference.md`. Reuse the drift codes
|
|
150
|
+
from `design-system-protocol.md` § "Post-Intervention Coherence Check":
|
|
151
|
+
`DS_TOKENS_DRIFT`.
|
|
152
|
+
- **component-stale** — primitives that differ from their spec
|
|
153
|
+
(`DS_COMPONENT_STALE`).
|
|
154
|
+
- **index-drift** — primitives rendered that are not in `INDEX.md`
|
|
155
|
+
(`DS_INDEX_DRIFT`).
|
|
156
|
+
|
|
157
|
+
In compliance-only mode you also work from the rendered screenshot, but the
|
|
158
|
+
ground truth is the registry + tokens, not an image. Output schema is the same
|
|
159
|
+
(findings array + ds_drift_codes).
|
|
160
|
+
|
|
161
|
+
### Level (d) — `skip`
|
|
162
|
+
|
|
163
|
+
Return immediately with `{ "status": "skipped", "reason":
|
|
164
|
+
"no_mockup_available", "findings": [] }`. Do not attempt to invent fidelity
|
|
165
|
+
checks without a ground truth.
|
|
166
|
+
|
|
167
|
+
## Tolerance Modes
|
|
168
|
+
|
|
169
|
+
The orchestrator passes `tolerance` from `features.e2e_review.fidelity_tolerance`:
|
|
170
|
+
|
|
171
|
+
- **`strict`** (default) — Critical + Major + Minor findings are all reported
|
|
172
|
+
with their canonical severity. The orchestrator will BLOCK on any of them.
|
|
173
|
+
- **`balanced`** — Same reporting; the orchestrator will block on Critical +
|
|
174
|
+
Major only, Minor are advisory.
|
|
175
|
+
- **`lenient`** — Same reporting; the orchestrator blocks on Critical only.
|
|
176
|
+
|
|
177
|
+
Your job is unchanged across modes: **always report every finding with its
|
|
178
|
+
canonical severity**. Filtering is the orchestrator's responsibility, not yours.
|
|
179
|
+
Inflating or suppressing severity to match the mode is a protocol violation.
|
|
180
|
+
|
|
181
|
+
## Output Schema (STRICT — orchestrator parses programmatically)
|
|
182
|
+
|
|
183
|
+
```json
|
|
184
|
+
{
|
|
185
|
+
"status": "completed" | "skipped" | "error",
|
|
186
|
+
"route": "/merchant/dashboard",
|
|
187
|
+
"mockup_source_level": "figma" | "local" | "compliance-only" | "skip",
|
|
188
|
+
"viewport": { "width": 1440, "height": 900 },
|
|
189
|
+
"compliance_score": 0.87,
|
|
190
|
+
"findings": [
|
|
191
|
+
{
|
|
192
|
+
"severity": "critical" | "major" | "minor",
|
|
193
|
+
"category": "spacing-off-scale",
|
|
194
|
+
"description": "Card padding rendered at 13px; mockup specifies 12px (token --space-3).",
|
|
195
|
+
"expected": "padding: 12px",
|
|
196
|
+
"actual": "padding: 13px",
|
|
197
|
+
"fix_hint": "Replace literal `padding: 13px` with the spacing token `--space-3` (resolves to 12px in tokens-reference.md). Likely location: components/Card.tsx.",
|
|
198
|
+
"evidence": {
|
|
199
|
+
"region": { "x": 240, "y": 180, "w": 320, "h": 200 },
|
|
200
|
+
"screenshot_crop_path": "/tmp/e2e-review/FEAT-0500/critical-1.png"
|
|
201
|
+
},
|
|
202
|
+
"ds_drift_code": "DS_TOKENS_DRIFT" | "DS_COMPONENT_STALE" | "DS_INDEX_DRIFT" | null,
|
|
203
|
+
"confidence": "high" | "medium" | "low"
|
|
204
|
+
}
|
|
205
|
+
],
|
|
206
|
+
"ds_drift_codes": ["DS_TOKENS_DRIFT"],
|
|
207
|
+
"gaps": [
|
|
208
|
+
"no Figma MCP available — fell back to local image mode",
|
|
209
|
+
"no spec found for primitive `Badge` — could not check component conformance"
|
|
210
|
+
],
|
|
211
|
+
"transcript_path": "/tmp/e2e-review/FEAT-0500/visual-fidelity-transcript.md"
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
**Field rules:**
|
|
216
|
+
|
|
217
|
+
- `compliance_score` is the share of compared dimensions (layout / spacing /
|
|
218
|
+
typography / color / interactive states) that passed without findings,
|
|
219
|
+
rounded to 2 decimals. Heuristic — not a contractual metric.
|
|
220
|
+
- `description` is a single sentence in English (the framework's lingua franca
|
|
221
|
+
for cross-project portability). It describes what the screen shows and what
|
|
222
|
+
the mockup says.
|
|
223
|
+
- `expected` and `actual` are short token/value pairs when possible
|
|
224
|
+
(`padding: 12px` / `padding: 13px`), or a 1-line natural description when
|
|
225
|
+
not (`gradient from top-left to bottom-right` /
|
|
226
|
+
`gradient from top to bottom`).
|
|
227
|
+
- `fix_hint` MUST be actionable: cite the token name, the likely file, or the
|
|
228
|
+
exact CSS property to change. Never "make it look right" or "match the
|
|
229
|
+
design". If you cannot produce an actionable hint, drop the finding's
|
|
230
|
+
severity by one tier (or remove it entirely if it was already Minor).
|
|
231
|
+
- `evidence.region` is the bounding box in the implementation screenshot where
|
|
232
|
+
the finding occurs (`x,y,w,h` in viewport CSS pixels). Optional — include
|
|
233
|
+
when the region is unambiguous.
|
|
234
|
+
- `evidence.screenshot_crop_path` is optional and only used when the
|
|
235
|
+
orchestrator pre-cropped a region of interest for you.
|
|
236
|
+
- `confidence` defaults to `high`. Use `medium` when the difference is at the
|
|
237
|
+
edge of perceptual thresholds (e.g. spacing off by 1px). Use `low` for
|
|
238
|
+
rendering-variance findings (anti-aliasing, font hinting) — the orchestrator
|
|
239
|
+
may auto-filter `low`-confidence Minor findings even in strict mode.
|
|
240
|
+
- `ds_drift_codes` is the deduplicated union of all `ds_drift_code` values
|
|
241
|
+
across findings (for the orchestrator's per-card drift summary).
|
|
242
|
+
- `gaps` is a free-text list of context the agent wanted but did not have
|
|
243
|
+
(missing spec file, no Figma access, etc.). The orchestrator surfaces these
|
|
244
|
+
to the user.
|
|
245
|
+
- `transcript_path` is optional — write a free-form markdown narrative of your
|
|
246
|
+
reasoning to this path if you want the orchestrator to surface it for human
|
|
247
|
+
review.
|
|
248
|
+
|
|
249
|
+
## Comparison Protocol
|
|
250
|
+
|
|
251
|
+
1. **Load inputs**. Read the implementation screenshot. If `mockup_source.level
|
|
252
|
+
in {figma, local}`, read the mockup image. If `compliance-only`, read the
|
|
253
|
+
registry files listed above. Confirm dimensions / aspect ratios.
|
|
254
|
+
2. **Region-by-region scan**. Walk the implementation screenshot top-to-bottom,
|
|
255
|
+
left-to-right. For each visible primitive (header, card, button group, form,
|
|
256
|
+
list, footer, …), compare against the ground truth.
|
|
257
|
+
3. **Compare structured properties first** (layout, ordering, presence of
|
|
258
|
+
designed elements) — these surface Critical findings cheaply.
|
|
259
|
+
4. **Then compare typography** (family, size, weight, line-height, casing) —
|
|
260
|
+
these are the most common Major findings.
|
|
261
|
+
5. **Then compare color and surfaces** (background, foreground, borders,
|
|
262
|
+
shadows, gradients) — beware of false positives from perceptual variance;
|
|
263
|
+
use `confidence: medium` when the delta is borderline.
|
|
264
|
+
6. **Then compare spacing** (padding, margin, gap) — derive expected values
|
|
265
|
+
from tokens-reference when available, from the mockup pixel measurement
|
|
266
|
+
otherwise.
|
|
267
|
+
7. **Then check interactive states** if the orchestrator provided
|
|
268
|
+
hover/focus/active screenshots in addition to idle.
|
|
269
|
+
8. **Then check accessibility** signals visible from the screenshot
|
|
270
|
+
(contrast, focus-visible) — do not invent a11y findings you cannot see.
|
|
271
|
+
9. **Compose findings** into the JSON schema above. Order findings by severity
|
|
272
|
+
(Critical → Major → Minor), then by category alphabetically within tier.
|
|
273
|
+
10. **Compute `compliance_score`** as a heuristic single number. Be honest —
|
|
274
|
+
a score of 1.0 means you found nothing; a score of 0.0 means the screen
|
|
275
|
+
bears no resemblance to the mockup.
|
|
276
|
+
|
|
277
|
+
## Anti-Hallucination Discipline
|
|
278
|
+
|
|
279
|
+
- If you cannot tell from the screenshot whether a finding is real, do not
|
|
280
|
+
emit it. False positives erode trust in the gate and cause user override
|
|
281
|
+
fatigue — the documented failure mode.
|
|
282
|
+
- When the implementation screenshot is too small / blurry / partial, return
|
|
283
|
+
`{ "status": "error", "reason": "screenshot_quality_insufficient",
|
|
284
|
+
"findings": [] }` instead of guessing.
|
|
285
|
+
- When the mockup is ambiguous (e.g. low-fidelity wireframe), downgrade Minor
|
|
286
|
+
findings to advisory in the description and use `confidence: low`.
|
|
287
|
+
- Cite tokens and spec entries by **exact name** as they appear in
|
|
288
|
+
`tokens-reference.md` / `components/<Name>.md`. Never paraphrase a token name
|
|
289
|
+
("the primary blue" instead of `--color-action-primary`).
|
|
290
|
+
|
|
291
|
+
## What You Are Not
|
|
292
|
+
|
|
293
|
+
- You are not `ui-expert`. That agent designs and reviews UI in a creative /
|
|
294
|
+
evaluative sense (Authority Matrix, design philosophy, taste). You only
|
|
295
|
+
compare an existing rendering to an existing target.
|
|
296
|
+
- You are not `qa-sentinel`. That agent runs mechanical gates (lint, tsc,
|
|
297
|
+
test, build). You do visual fidelity only.
|
|
298
|
+
- You are not `code-reviewer`. That agent reviews source code for bugs and
|
|
299
|
+
quality. You do not read source code.
|
|
300
|
+
- You are not the orchestrator. `/e2e-review` aggregates your findings,
|
|
301
|
+
manages the self-heal loop, and produces the final pass/block decision.
|
|
302
|
+
|
|
303
|
+
## Linked Protocols
|
|
304
|
+
|
|
305
|
+
- [`framework/agents/design-system-protocol.md`](../../agents/design-system-protocol.md)
|
|
306
|
+
— SSOT for the registry-first cascade and Post-Intervention Coherence Check.
|
|
307
|
+
Drift codes (`DS_INDEX_DRIFT`, `DS_COMPONENT_STALE`, `DS_TOKENS_DRIFT`) are
|
|
308
|
+
defined there.
|
|
309
|
+
- [`framework/agents/design-review.md`](../../agents/design-review.md) —
|
|
310
|
+
shared design-review checklist; do not duplicate it here.
|
|
311
|
+
- [`framework/agents/project-context.md`](../../agents/project-context.md) —
|
|
312
|
+
always-ask / never-assume contract for missing config keys.
|
|
313
|
+
|
|
314
|
+
## Return Protocol
|
|
315
|
+
|
|
316
|
+
Emit a single JSON object matching the Output Schema above as your final
|
|
317
|
+
message. No prose preamble, no markdown narrative outside the optional
|
|
318
|
+
`transcript_path` file. The orchestrator parses your output programmatically;
|
|
319
|
+
extra prose breaks the gate.
|