You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+94-2Lines changed: 94 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -229,7 +229,7 @@ function App({ ast, store }) {
229
229
|`@mobile-reality/mdma-attachables-core`| Handlers for 7 of the 9 component types — the ones that manage state (form, button, tasklist, table, callout, approval-gate, webhook). Chart and thinking are display-only and rendered directly without state handlers. |
230
230
|`@mobile-reality/mdma-renderer-react`| React rendering layer with components for all 9 MDMA types and hooks for state access. Provides `MdmaDocument` for full-document rendering and `useComponentState`/`useBinding` for fine-grained reactivity. |
231
231
|`@mobile-reality/mdma-prompt-pack`| System prompts that teach LLMs how to author valid MDMA documents. Exports `buildSystemPrompt()` to combine the full spec reference with optional custom instructions for domain-specific generation. |
232
-
|`@mobile-reality/mdma-validator`| Static analysis engine with 10 lint rules covering YAML correctness, schema conformance, ID uniqueness, binding resolution, and PII sensitivity. Powers programmatic validation in CI pipelines and custom tooling. |
232
+
|`@mobile-reality/mdma-validator`| Static analysis engine with 17 lint rules covering YAML correctness, schema conformance, ID uniqueness, binding syntax, action references, PII sensitivity, expected component verification, and flow ordering. Includes 6 auto-fix strategies and fuzzy type/ID suggestions. Powers programmatic validation in CI pipelines and custom tooling. |
233
233
|`@mobile-reality/mdma-cli`| Interactive CLI tool for creating custom MDMA prompts. Opens a local web app where you visually select components, configure fields, set domain rules and trigger conditions, then an LLM generates a tailored `customPrompt` for use with `buildSystemPrompt()`. Also includes a `validate` command for static document analysis. |
234
234
|`@mobile-reality/mdma-mcp`| MCP (Model Context Protocol) server that exposes MDMA spec, prompts, and tooling to AI assistants. Tools: `get-spec`, `get-prompt`, `build-system-prompt`, `validate-prompt`, `list-packages`. Works with Claude Desktop, VS Code, Cursor, and any MCP-compatible client. |
235
235
|`@mobile-reality/mdma-evals`| LLM evaluation suite built on promptfoo with 4 test suites: base generation quality (25 tests), custom prompt compliance (10 tests), multi-turn conversation handling (11 conversations, 25 turns), and prompt builder verification (25 tests). Validates that AI-generated MDMA documents are structurally correct and semantically appropriate. |
|`field-name-typos`| warning | -- | Common field name mistakes: `roles` -> `allowedRoles`, `onClick` -> `onAction`, `submit` -> `onSubmit`. |
317
+
|`schema-conformance`| error | yes | Component type exists and data conforms to its Zod schema. Suggests closest type via fuzzy matching (e.g. `"frm"` -> `did you mean "form"?`) and lists all valid types. |
318
+
|`duplicate-ids`| error | yes | All component IDs are unique. Auto-fix appends `-1`, `-2` suffixes. |
319
+
|`id-format`| warning | yes | IDs follow kebab-case (`my-component-id`). Auto-fix converts camelCase, snake_case, PascalCase and updates all references. |
320
+
|`binding-syntax`| error/warning | yes |`{{binding}}` expressions are well-formed. Catches empty `{{ }}`, extra whitespace `{{ path }}`, and single-brace `{path}`. |
|`sensitive-flags`| warning | yes | Form fields and table columns with PII-like names (email, phone, ssn, address, etc.) have `sensitive: true`. Supports custom PII patterns. |
323
+
|`required-markers`| info | -- | Suggests `required: true` for fields named `name`, `email`, `title`, `summary`. |
324
+
|`thinking-block`| warning/info | -- | If a thinking block is present, it should be the first component and only one should exist. |
325
+
|`table-data-keys`| warning | -- | Data row keys match defined column keys. Flags extra keys and columns with no matching data. |
326
+
|`select-options`| warning | -- |`type: select` fields have `options` defined as `[{label, value}]` objects. |
327
+
|`chart-validation`| warning | -- | Chart CSV data has headers + data rows. `xAxis`/`yAxis` reference actual CSV column headers. |
328
+
|`placeholder-content`| info | -- | Catches `TODO`, `TBD`, `FIXME`, `...`, `lorem ipsum` in content fields. |
329
+
|`flow-ordering`| error/info | -- | Forward-only action references, no circular refs, one interactive component type per message. Detects regenerated components from prior conversation turns. |
330
+
|`expected-components`| error | -- | Verifies that components present in the message match their expected types, form fields, and table columns. Components not in the message are silently skipped — useful for multi-turn flows where you pass all expected components upfront. |
331
+
332
+
### Auto-fix Pipeline
333
+
334
+
When `autoFix: true` (default), 6 fix strategies run in strict dependency order:
335
+
336
+
1.**id-format** — normalize IDs to kebab-case, update all cross-references
337
+
2.**duplicate-ids** — deduplicate after normalization
6.**schema-conformance** — patch missing labels/headers/content, infer field types, wrap bare bindings, re-validate with Zod
342
+
343
+
### Expected Components
344
+
345
+
When you need to guarantee that the LLM generates specific critical components for the user (e.g. a form with required fields, a table with specific columns), pass their expected shapes to the validator. The rule only validates components that are actually present in the current message — components not found are silently skipped. This makes it safe to pass the full set of expected components across a multi-turn flow:
346
+
347
+
```typescript
348
+
// Define all expected components once (e.g. from a blueprint or flow definition)
349
+
const expectedComponents = {
350
+
'contact-form': {
351
+
type: 'form',
352
+
fields: ['email', 'phone', 'full-name'],
353
+
},
354
+
'approval-gate': { type: 'approval-gate' },
355
+
'submit-btn': { type: 'button' },
356
+
};
357
+
358
+
// Pass the same set to every message — the rule checks only what's present
359
+
const result =validate(message1, { expectedComponents });
360
+
// Message 1 contains contact-form → validates type + fields
361
+
// approval-gate and submit-btn not in this message → skipped
0 commit comments