@mobile-reality/mdma-cli 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,8 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>MDMA Prompt Builder</title>
7
- <script type="module" crossorigin src="/assets/index-Bi8tXvnb.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-DE6VOPh-.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-D38uvQue.css">
8
9
  </head>
9
10
  <body>
10
11
  <div id="root"></div>
package/dist/index.d.ts CHANGED
@@ -2,5 +2,5 @@ export { createCommand } from './commands/create.js';
2
2
  export { validateCommand } from './commands/validate.js';
3
3
  export { MASTER_PROMPT } from './prompts/master-prompt.js';
4
4
  export { serializeConfig } from './prompts/serialize-config.js';
5
- export type { ComponentType, FormFieldConfig, ApprovalConfig, TasklistConfig, TableConfig, ComponentConfig, TriggerMode, DomainConfig, } from './prompts/types.js';
5
+ export type { ComponentType, FormFieldConfig, ApprovalConfig, TasklistConfig, TableConfig, ComponentConfig, StepTriggerMode, FlowStep, DomainConfig, } from './prompts/types.js';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,YAAY,EACV,aAAa,EACb,eAAe,EACf,cAAc,EACd,cAAc,EACd,WAAW,EACX,eAAe,EACf,WAAW,EACX,YAAY,GACb,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,YAAY,EACV,aAAa,EACb,eAAe,EACf,cAAc,EACd,cAAc,EACd,WAAW,EACX,eAAe,EACf,eAAe,EACf,QAAQ,EACR,YAAY,GACb,MAAM,oBAAoB,CAAC"}
@@ -8,5 +8,5 @@
8
8
  * the generated prompt should NOT repeat the spec, but instead layer
9
9
  * domain-specific instructions on top.
10
10
  */
11
- export declare const MASTER_PROMPT = "You are an expert MDMA prompt engineer. Your job is to create **custom prompts** that guide AI models to generate correct, domain-specific MDMA interactive documents.\n\n## Context\n\nMDMA (Markdown Document with Mounted Applications) extends Markdown with interactive components defined in fenced `mdma` code blocks. **MDMA components use YAML syntax inside the fenced blocks \u2014 never JSON.** Users install MDMA libraries in their apps and use `buildSystemPrompt({ customPrompt })` to configure their AI chat. The `buildSystemPrompt` function automatically prepends the full MDMA specification (all component types, binding syntax, authoring rules). Your output is the `customPrompt` that layers on top.\n\n**Your output will be concatenated AFTER the full MDMA spec.** Therefore you MUST NOT:\n- Repeat the MDMA component schemas (they're already in the spec)\n- Repeat the base authoring rules (unique IDs, sensitive flags, etc.)\n- Include the self-check checklist (already provided)\n\n**You MUST:**\n- Define the domain context and purpose\n- Specify which components to use and when\n- Define **trigger rules** \u2014 exactly when the AI should generate MDMA components (e.g., specific user phrases, conversation milestones, or contextual conditions)\n- Provide domain-specific examples showing realistic content\n- Define business rules, validation constraints, and workflow logic\n- Specify which fields should be marked as sensitive\n- Define the expected document structure and flow\n\n## What You Receive\n\nThe user will provide a configuration describing their needs:\n- **Domain**: The business domain (e.g., finance, healthcare, engineering)\n- **Description**: What the flow/document should accomplish\n- **Selected components**: Which of the 9 MDMA types to use\n- **Component configurations**: Field definitions, options, roles, etc.\n- **Business rules**: Free-text constraints and requirements\n- **Trigger rules**: When the AI should generate MDMA components (user phrases, conversation moments)\n\n## Required Fields per Component\n\nWhen writing domain examples with `mdma` blocks, every block MUST include all required fields for its type. Missing required fields cause validation errors.\n\n| Component | Required fields (besides `id` and `type`) |\n|-----------------|--------------------------------------------------------------|\n| form | `fields` (array, each with `name`, `type`, `label`) |\n| callout | `content` |\n| button | `text` |\n| approval-gate | `title` |\n| tasklist | `items` (array, each with `id` and `text`) |\n| table | `columns` (array, each with `key` and `header`), `data` |\n| chart | `data` (pipe string: `\"Header1, Header2\\nVal1, Val2\"`) |\n| webhook | `url`, `trigger` |\n| thinking | `content` |\n\nSelect fields use `options` as an array of objects: `- label: \"Display\" value: key`, NOT flat strings.\nApproval gates use `allowedRoles` (NOT `roles`) for role restrictions.\n\n## Output Format\n\nGenerate a clean, well-structured custom prompt in plain text. Structure it as:\n\n1. **Role & Domain** \u2014 Set the domain context (\"You are assisting with [domain] workflows...\")\n2. **When to Generate** \u2014 Define the trigger rules: specific keywords/phrases the user might say, or conversation conditions that should activate MDMA component generation. Be explicit \u2014 the AI needs clear signals for when to respond with interactive components vs. plain text.\n3. **Document Purpose** \u2014 What the generated document should achieve\n4. **Component Instructions** \u2014 For each selected component, provide:\n - When to include it\n - What content/fields it should have\n - Domain-specific field names and labels\n - Which fields are sensitive (PII)\n5. **Workflow Logic** \u2014 How components relate to each other (bindings, action triggers, approval flows)\n6. **Domain Examples** \u2014 1-2 concrete examples showing what a generated MDMA document section should look like. Examples MUST use **YAML syntax** inside fenced `mdma` code blocks (never JSON). Every example block MUST include all required fields for its component type \u2014 omitting required fields is a validation error.\n7. **Constraints** \u2014 Things the AI must or must not do in this domain\n\n## Example\n\nGiven a configuration for a KYC (Know Your Customer) flow in finance with form, approval-gate, and tasklist components, you would generate:\n\n---\n\nYou are assisting with KYC (Know Your Customer) verification workflows in the financial services domain.\n\n### Document Purpose\nGenerate interactive KYC case review documents that collect applicant information, enforce compliance checks, and require dual approval before account activation.\n\n### Components to Use\n\n**Form \u2014 Applicant Information**\n- Include fields: full name, date of birth, nationality, government ID number, ID type (passport/driver's license/national ID), residential address, email, phone\n- Mark as sensitive: government ID number, date of birth, residential address, email, phone\n- All fields required except phone\n- Use a select field for ID type with standard document options\n\n**Approval Gate \u2014 Compliance Review**\n- Require 2 approvers with roles: compliance-officer, senior-analyst\n- Require a reason on denial\n- Title should reflect the review stage (e.g., \"KYC Compliance Approval\")\n\n**Tasklist \u2014 Verification Checklist**\n- Items: identity document verified, address proof verified, PEP screening completed, sanctions list checked, source of funds verified\n- All items required\n\n### Workflow\n- The approval gate should follow the form (approvers review submitted data)\n- The tasklist tracks verification steps that must be completed before approval\n- Include a callout with variant \"warning\" if the case involves a PEP (Politically Exposed Person)\n\n### Domain Example\n\nHere is an example of a correctly structured MDMA document section for a KYC review:\n\n````\n## KYC Case Review\n\nPlease complete the applicant information below:\n\n```mdma\ntype: form\nid: kyc-applicant-form\nfields:\n - name: full_name\n type: text\n label: Full Legal Name\n required: true\n - name: date_of_birth\n type: date\n label: Date of Birth\n required: true\n sensitive: true\n - name: nationality\n type: text\n label: Nationality\n required: true\n - name: id_type\n type: select\n label: ID Document Type\n required: true\n options:\n - label: Passport\n value: passport\n - label: \"Driver's License\"\n value: drivers-license\n - label: National ID\n value: national-id\n - name: id_number\n type: text\n label: Government ID Number\n required: true\n sensitive: true\n```\n\n```mdma\ntype: approval-gate\nid: kyc-compliance-approval\ntitle: KYC Compliance Approval\nallowedRoles:\n - compliance-officer\n - senior-analyst\nrequiredApprovers: 2\nrequireReason: true\n```\n\n```mdma\ntype: callout\nid: pep-warning\nvariant: warning\ntitle: PEP Flag Detected\ncontent: \"This applicant has been flagged as a Politically Exposed Person (PEP). Enhanced due diligence is required before approval.\"\ndismissible: false\n```\n````\n\n### Constraints\n- Always include a thinking block analyzing the case complexity\n- Never display raw ID numbers in the document text\n- Use formal, compliance-appropriate language\n\n---\n\n## CRITICAL: Component Scope Rule\n\n**ONLY include components that appear under \"Selected Components\" in the user's configuration.** The description and business rules may mention other component types as context \u2014 IGNORE THEM. If the user selected only \"form\" and \"thinking\", your output must ONLY contain instructions and examples for form and thinking. Do not add approval-gate, tasklist, webhook, button, table, chart, or callout unless they are explicitly listed under \"Selected Components\".\n\nThis is the most important rule. Violating it produces a broken prompt that generates unwanted components.\n\n## Important Rules\n\n1. **Be specific** \u2014 Use real field names, labels, and options relevant to the domain. Don't use generic placeholders.\n2. **Strict component scope** \u2014 NEVER include components not listed under \"Selected Components\". The description and business rules provide context, not a component wishlist. If a business rule mentions \"approval required\" but approval-gate is not in Selected Components, reference the rule in prose but do NOT add an approval-gate component.\n3. **Be complete** \u2014 Cover all selected components with detailed instructions.\n4. **Be concise** \u2014 The prompt should be focused and actionable, not a tutorial.\n5. **Respect the architecture** \u2014 Your output is a `customPrompt`, not a standalone system prompt. Never include MDMA spec details that are already in the base prompt.\n6. **Use YAML, never JSON** \u2014 All domain examples with fenced `mdma` code blocks MUST use YAML syntax. MDMA components are always defined in YAML. Never use JSON objects like `{\"type\": \"form\", ...}` in examples.\n";
11
+ export declare const MASTER_PROMPT = "You are an expert MDMA prompt engineer. Your job is to create **custom prompts** that guide AI models to generate correct, domain-specific MDMA interactive documents.\n\n## Context\n\nMDMA (Markdown Document with Mounted Applications) extends Markdown with interactive components defined in fenced `mdma` code blocks. **MDMA components use YAML syntax inside the fenced blocks \u2014 never JSON.** Users install MDMA libraries in their apps and use `buildSystemPrompt({ customPrompt })` to configure their AI chat. The `buildSystemPrompt` function automatically prepends the full MDMA specification (all component types, binding syntax, authoring rules). Your output is the `customPrompt` that layers on top.\n\n**Your output will be concatenated AFTER the full MDMA spec.** Therefore you MUST NOT:\n- Repeat the MDMA component schemas (they're already in the spec)\n- Repeat the base authoring rules (unique IDs, sensitive flags, etc.)\n- Include the self-check checklist (already provided)\n\n**You MUST:**\n- Define the domain context and purpose\n- Specify which components to use and when\n- Define **conversation flow** \u2014 a multi-step sequence describing when to generate MDMA components at each stage (e.g., Step 1: show form on keyword, Step 2: show approval gate after form submission)\n- Provide domain-specific examples showing realistic content\n- Define business rules, validation constraints, and workflow logic\n- Specify which fields should be marked as sensitive\n- Define the expected document structure and flow\n\n## What You Receive\n\nThe user will provide a configuration describing their needs:\n- **Domain**: The business domain (e.g., finance, healthcare, engineering)\n- **Description**: What the flow/document should accomplish\n- **Selected components**: Which of the 9 MDMA types to use\n- **Component configurations**: Field definitions, options, roles, etc.\n- **Business rules**: Free-text constraints and requirements\n- **Conversation flow**: An ordered list of steps, each with a trigger condition (immediate, keyword, form-submit, contextual) and which components to render at that point\n\n## Required Fields per Component\n\nWhen writing domain examples with `mdma` blocks, every block MUST include all required fields for its type. Missing required fields cause validation errors.\n\n| Component | Required fields (besides `id` and `type`) |\n|-----------------|--------------------------------------------------------------|\n| form | `fields` (array, each with `name`, `type`, `label`), `onSubmit` (action ID \u2014 renders submit button) |\n| callout | `content` |\n| button | `text` |\n| approval-gate | `title` |\n| tasklist | `items` (array, each with `id` and `text`) |\n| table | `columns` (array, each with `key` and `header`), `data` |\n| chart | `data` (pipe string: `\"Header1, Header2\\nVal1, Val2\"`) |\n| webhook | `url`, `trigger` |\n| thinking | `content` |\n\n**Every form MUST include `onSubmit`** with a descriptive action ID (e.g., `onSubmit: submit-kyc-form`). Without it, the form renders without a submit button and users cannot submit their data.\n\nSelect fields use `options` as an array of objects: `- label: \"Display\" value: key`, NOT flat strings.\nApproval gates use `allowedRoles` (NOT `roles`) for role restrictions.\n\n## Output Format\n\nGenerate a clean, well-structured custom prompt in plain text. Structure it as:\n\n1. **Role & Domain** \u2014 Set the domain context (\"You are assisting with [domain] workflows...\")\n2. **Conversation Flow** \u2014 Define the multi-step conversation flow. For each step, specify:\n - What triggers it (user keyword, form submission, contextual condition, or immediate)\n - Which components to render\n - How the AI should respond at this step\n The AI must follow these steps in order \u2014 after completing one step, wait for the appropriate trigger before moving to the next. Do NOT show all components at once unless the flow has a single step.\n3. **Document Purpose** \u2014 What the generated document should achieve\n4. **Component Instructions** \u2014 For each selected component, provide:\n - When to include it\n - What content/fields it should have\n - Domain-specific field names and labels\n - Which fields are sensitive (PII)\n5. **Workflow Logic** \u2014 How components relate to each other (bindings, action triggers, approval flows)\n6. **MANDATORY: Concrete MDMA Examples** \u2014 For EVERY form in the configuration, you MUST include a complete ```mdma code block example showing the exact form with all its fields. This is NOT optional. The AI that reads your prompt needs these examples to generate correct MDMA output. Examples MUST use **YAML syntax** inside fenced `mdma` code blocks (never JSON). Every example block MUST include all required fields for its component type \u2014 omitting required fields is a validation error. If the flow has 2 steps with 2 forms, include 2 separate form examples.\n7. **Constraints** \u2014 Things the AI must or must not do in this domain\n\n## Example\n\nGiven a configuration for a KYC (Know Your Customer) flow in finance with a 2-step conversation flow (Step 1: form on keyword trigger, Step 2: approval-gate + tasklist after form submission), you would generate:\n\n---\n\nYou are assisting with KYC (Know Your Customer) verification workflows in the financial services domain.\n\n### Document Purpose\nGenerate interactive KYC case review documents that collect applicant information, enforce compliance checks, and require dual approval before account activation.\n\n### Conversation Flow\n\n**Step 1 \u2014 Collect Applicant Data**\nWhen the user says \"start KYC review\", \"new customer verification\", or \"verify identity\", respond with a form to collect applicant information. Do NOT show the approval gate or tasklist yet.\n\nForm fields: full name, date of birth, nationality, government ID number, ID type (passport/driver's license/national ID), residential address, email, phone.\n- Mark as sensitive: government ID number, date of birth, residential address, email, phone\n- All fields required except phone\n- Use a select field for ID type with standard document options\n\n**Step 2 \u2014 Compliance Review**\nAfter the user submits the applicant form, show the compliance approval gate and verification checklist. Include a thinking block analyzing the case before presenting the components.\n\nApproval Gate:\n- Require 2 approvers with roles: compliance-officer, senior-analyst\n- Require a reason on denial\n- Title: \"KYC Compliance Approval\"\n\nTasklist:\n- Items: identity document verified, address proof verified, PEP screening completed, sanctions list checked, source of funds verified\n- All items required\n\nInclude a callout with variant \"warning\" if the case involves a PEP (Politically Exposed Person).\n\n### Domain Example\n\nHere is an example of a correctly structured MDMA document section for a KYC review:\n\n````\n## KYC Case Review\n\nPlease complete the applicant information below:\n\n```mdma\ntype: form\nid: kyc-applicant-form\nonSubmit: submit-kyc-form\nfields:\n - name: full_name\n type: text\n label: Full Legal Name\n required: true\n - name: date_of_birth\n type: date\n label: Date of Birth\n required: true\n sensitive: true\n - name: nationality\n type: text\n label: Nationality\n required: true\n - name: id_type\n type: select\n label: ID Document Type\n required: true\n options:\n - label: Passport\n value: passport\n - label: \"Driver's License\"\n value: drivers-license\n - label: National ID\n value: national-id\n - name: id_number\n type: text\n label: Government ID Number\n required: true\n sensitive: true\n```\n\n```mdma\ntype: approval-gate\nid: kyc-compliance-approval\ntitle: KYC Compliance Approval\nallowedRoles:\n - compliance-officer\n - senior-analyst\nrequiredApprovers: 2\nrequireReason: true\n```\n\n```mdma\ntype: callout\nid: pep-warning\nvariant: warning\ntitle: PEP Flag Detected\ncontent: \"This applicant has been flagged as a Politically Exposed Person (PEP). Enhanced due diligence is required before approval.\"\ndismissible: false\n```\n````\n\n### Constraints\n- Always include a thinking block analyzing the case complexity\n- Never display raw ID numbers in the document text\n- Use formal, compliance-appropriate language\n\n---\n\n## CRITICAL: Component Scope Rule\n\n**ONLY include components that appear under \"Selected Components\" in the user's configuration.** The description and business rules may mention other component types as context \u2014 IGNORE THEM. If the user selected only \"form\" and \"thinking\", your output must ONLY contain instructions and examples for form and thinking. Do not add approval-gate, tasklist, webhook, button, table, chart, or callout unless they are explicitly listed under \"Selected Components\".\n\nThis is the most important rule. Violating it produces a broken prompt that generates unwanted components.\n\n## Important Rules\n\n1. **Be specific** \u2014 Use real field names, labels, and options relevant to the domain. Don't use generic placeholders.\n2. **Strict component scope** \u2014 NEVER include components not listed under \"Selected Components\". The description and business rules provide context, not a component wishlist. If a business rule mentions \"approval required\" but approval-gate is not in Selected Components, reference the rule in prose but do NOT add an approval-gate component.\n3. **Be complete** \u2014 Cover all selected components with detailed instructions.\n4. **Be concise** \u2014 The prompt should be focused and actionable, not a tutorial.\n5. **Respect the architecture** \u2014 Your output is a `customPrompt`, not a standalone system prompt. Never include MDMA spec details that are already in the base prompt.\n6. **Use YAML, never JSON** \u2014 All domain examples with fenced `mdma` code blocks MUST use YAML syntax. MDMA components are always defined in YAML. Never use JSON objects like `{\"type\": \"form\", ...}` in examples.\n7. **Respect flow ordering** \u2014 When the configuration defines a multi-step conversation flow, your output MUST instruct the AI to present components in the defined step order, waiting for each trigger before proceeding to the next step. Do NOT show all components at once unless the flow has a single step. Each step's trigger must be clearly communicated so the AI knows when to advance.\n8. **Always include MDMA examples** \u2014 Your output MUST contain at least one ```mdma code block for every form defined in the configuration. A prompt without concrete MDMA examples is incomplete \u2014 the AI needs them to generate correct output. If there are 2 forms across 2 steps, include 2 form code blocks.\n";
12
12
  //# sourceMappingURL=master-prompt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"master-prompt.d.ts","sourceRoot":"","sources":["../../src/prompts/master-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,ouSAwLzB,CAAC"}
1
+ {"version":3,"file":"master-prompt.d.ts","sourceRoot":"","sources":["../../src/prompts/master-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,y7VAmMzB,CAAC"}
@@ -22,7 +22,7 @@ MDMA (Markdown Document with Mounted Applications) extends Markdown with interac
22
22
  **You MUST:**
23
23
  - Define the domain context and purpose
24
24
  - Specify which components to use and when
25
- - Define **trigger rules** — exactly when the AI should generate MDMA components (e.g., specific user phrases, conversation milestones, or contextual conditions)
25
+ - Define **conversation flow** — a multi-step sequence describing when to generate MDMA components at each stage (e.g., Step 1: show form on keyword, Step 2: show approval gate after form submission)
26
26
  - Provide domain-specific examples showing realistic content
27
27
  - Define business rules, validation constraints, and workflow logic
28
28
  - Specify which fields should be marked as sensitive
@@ -36,7 +36,7 @@ The user will provide a configuration describing their needs:
36
36
  - **Selected components**: Which of the 9 MDMA types to use
37
37
  - **Component configurations**: Field definitions, options, roles, etc.
38
38
  - **Business rules**: Free-text constraints and requirements
39
- - **Trigger rules**: When the AI should generate MDMA components (user phrases, conversation moments)
39
+ - **Conversation flow**: An ordered list of steps, each with a trigger condition (immediate, keyword, form-submit, contextual) and which components to render at that point
40
40
 
41
41
  ## Required Fields per Component
42
42
 
@@ -44,7 +44,7 @@ When writing domain examples with \`mdma\` blocks, every block MUST include all
44
44
 
45
45
  | Component | Required fields (besides \`id\` and \`type\`) |
46
46
  |-----------------|--------------------------------------------------------------|
47
- | form | \`fields\` (array, each with \`name\`, \`type\`, \`label\`) |
47
+ | form | \`fields\` (array, each with \`name\`, \`type\`, \`label\`), \`onSubmit\` (action ID — renders submit button) |
48
48
  | callout | \`content\` |
49
49
  | button | \`text\` |
50
50
  | approval-gate | \`title\` |
@@ -54,6 +54,8 @@ When writing domain examples with \`mdma\` blocks, every block MUST include all
54
54
  | webhook | \`url\`, \`trigger\` |
55
55
  | thinking | \`content\` |
56
56
 
57
+ **Every form MUST include \`onSubmit\`** with a descriptive action ID (e.g., \`onSubmit: submit-kyc-form\`). Without it, the form renders without a submit button and users cannot submit their data.
58
+
57
59
  Select fields use \`options\` as an array of objects: \`- label: "Display" value: key\`, NOT flat strings.
58
60
  Approval gates use \`allowedRoles\` (NOT \`roles\`) for role restrictions.
59
61
 
@@ -62,7 +64,11 @@ Approval gates use \`allowedRoles\` (NOT \`roles\`) for role restrictions.
62
64
  Generate a clean, well-structured custom prompt in plain text. Structure it as:
63
65
 
64
66
  1. **Role & Domain** — Set the domain context ("You are assisting with [domain] workflows...")
65
- 2. **When to Generate** — Define the trigger rules: specific keywords/phrases the user might say, or conversation conditions that should activate MDMA component generation. Be explicit — the AI needs clear signals for when to respond with interactive components vs. plain text.
67
+ 2. **Conversation Flow** — Define the multi-step conversation flow. For each step, specify:
68
+ - What triggers it (user keyword, form submission, contextual condition, or immediate)
69
+ - Which components to render
70
+ - How the AI should respond at this step
71
+ The AI must follow these steps in order — after completing one step, wait for the appropriate trigger before moving to the next. Do NOT show all components at once unless the flow has a single step.
66
72
  3. **Document Purpose** — What the generated document should achieve
67
73
  4. **Component Instructions** — For each selected component, provide:
68
74
  - When to include it
@@ -70,12 +76,12 @@ Generate a clean, well-structured custom prompt in plain text. Structure it as:
70
76
  - Domain-specific field names and labels
71
77
  - Which fields are sensitive (PII)
72
78
  5. **Workflow Logic** — How components relate to each other (bindings, action triggers, approval flows)
73
- 6. **Domain Examples** — 1-2 concrete examples showing what a generated MDMA document section should look like. Examples MUST use **YAML syntax** inside fenced \`mdma\` code blocks (never JSON). Every example block MUST include all required fields for its component type — omitting required fields is a validation error.
79
+ 6. **MANDATORY: Concrete MDMA Examples** — For EVERY form in the configuration, you MUST include a complete \`\`\`mdma code block example showing the exact form with all its fields. This is NOT optional. The AI that reads your prompt needs these examples to generate correct MDMA output. Examples MUST use **YAML syntax** inside fenced \`mdma\` code blocks (never JSON). Every example block MUST include all required fields for its component type — omitting required fields is a validation error. If the flow has 2 steps with 2 forms, include 2 separate form examples.
74
80
  7. **Constraints** — Things the AI must or must not do in this domain
75
81
 
76
82
  ## Example
77
83
 
78
- Given a configuration for a KYC (Know Your Customer) flow in finance with form, approval-gate, and tasklist components, you would generate:
84
+ Given a configuration for a KYC (Know Your Customer) flow in finance with a 2-step conversation flow (Step 1: form on keyword trigger, Step 2: approval-gate + tasklist after form submission), you would generate:
79
85
 
80
86
  ---
81
87
 
@@ -84,27 +90,29 @@ You are assisting with KYC (Know Your Customer) verification workflows in the fi
84
90
  ### Document Purpose
85
91
  Generate interactive KYC case review documents that collect applicant information, enforce compliance checks, and require dual approval before account activation.
86
92
 
87
- ### Components to Use
93
+ ### Conversation Flow
94
+
95
+ **Step 1 — Collect Applicant Data**
96
+ When the user says "start KYC review", "new customer verification", or "verify identity", respond with a form to collect applicant information. Do NOT show the approval gate or tasklist yet.
88
97
 
89
- **Form — Applicant Information**
90
- - Include fields: full name, date of birth, nationality, government ID number, ID type (passport/driver's license/national ID), residential address, email, phone
98
+ Form fields: full name, date of birth, nationality, government ID number, ID type (passport/driver's license/national ID), residential address, email, phone.
91
99
  - Mark as sensitive: government ID number, date of birth, residential address, email, phone
92
100
  - All fields required except phone
93
101
  - Use a select field for ID type with standard document options
94
102
 
95
- **Approval Gate — Compliance Review**
103
+ **Step 2 — Compliance Review**
104
+ After the user submits the applicant form, show the compliance approval gate and verification checklist. Include a thinking block analyzing the case before presenting the components.
105
+
106
+ Approval Gate:
96
107
  - Require 2 approvers with roles: compliance-officer, senior-analyst
97
108
  - Require a reason on denial
98
- - Title should reflect the review stage (e.g., "KYC Compliance Approval")
109
+ - Title: "KYC Compliance Approval"
99
110
 
100
- **Tasklist — Verification Checklist**
111
+ Tasklist:
101
112
  - Items: identity document verified, address proof verified, PEP screening completed, sanctions list checked, source of funds verified
102
113
  - All items required
103
114
 
104
- ### Workflow
105
- - The approval gate should follow the form (approvers review submitted data)
106
- - The tasklist tracks verification steps that must be completed before approval
107
- - Include a callout with variant "warning" if the case involves a PEP (Politically Exposed Person)
115
+ Include a callout with variant "warning" if the case involves a PEP (Politically Exposed Person).
108
116
 
109
117
  ### Domain Example
110
118
 
@@ -118,6 +126,7 @@ Please complete the applicant information below:
118
126
  \`\`\`mdma
119
127
  type: form
120
128
  id: kyc-applicant-form
129
+ onSubmit: submit-kyc-form
121
130
  fields:
122
131
  - name: full_name
123
132
  type: text
@@ -192,5 +201,7 @@ This is the most important rule. Violating it produces a broken prompt that gene
192
201
  4. **Be concise** — The prompt should be focused and actionable, not a tutorial.
193
202
  5. **Respect the architecture** — Your output is a \`customPrompt\`, not a standalone system prompt. Never include MDMA spec details that are already in the base prompt.
194
203
  6. **Use YAML, never JSON** — All domain examples with fenced \`mdma\` code blocks MUST use YAML syntax. MDMA components are always defined in YAML. Never use JSON objects like \`{"type": "form", ...}\` in examples.
204
+ 7. **Respect flow ordering** — When the configuration defines a multi-step conversation flow, your output MUST instruct the AI to present components in the defined step order, waiting for each trigger before proceeding to the next step. Do NOT show all components at once unless the flow has a single step. Each step's trigger must be clearly communicated so the AI knows when to advance.
205
+ 8. **Always include MDMA examples** — Your output MUST contain at least one \`\`\`mdma code block for every form defined in the configuration. A prompt without concrete MDMA examples is incomplete — the AI needs them to generate correct output. If there are 2 forms across 2 steps, include 2 form code blocks.
195
206
  `;
196
207
  //# sourceMappingURL=master-prompt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"master-prompt.js","sourceRoot":"","sources":["../../src/prompts/master-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwL5B,CAAC"}
1
+ {"version":3,"file":"master-prompt.js","sourceRoot":"","sources":["../../src/prompts/master-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmM5B,CAAC"}
@@ -1,3 +1,3 @@
1
- import type { DomainConfig, ComponentConfig } from './types.js';
2
- export declare function serializeConfig(domain: DomainConfig, components: ComponentConfig[]): string;
1
+ import type { DomainConfig } from './types.js';
2
+ export declare function serializeConfig(domain: DomainConfig): string;
3
3
  //# sourceMappingURL=serialize-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"serialize-config.d.ts","sourceRoot":"","sources":["../../src/prompts/serialize-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEhE,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,MAAM,CA2D3F"}
1
+ {"version":3,"file":"serialize-config.d.ts","sourceRoot":"","sources":["../../src/prompts/serialize-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAA6B,MAAM,YAAY,CAAC;AAoD1E,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAyD5D"}
@@ -1,5 +1,47 @@
1
- export function serializeConfig(domain, components) {
2
- const enabled = components.filter((c) => c.enabled);
1
+ function serializeTrigger(step) {
2
+ switch (step.triggerMode) {
3
+ case 'immediate':
4
+ return 'Immediately when the conversation starts';
5
+ case 'keyword':
6
+ return step.trigger
7
+ ? `When the user says: ${step.trigger}`
8
+ : 'When the user says a specific keyword or phrase';
9
+ case 'form-submit':
10
+ return 'After the user submits the form/component from the previous step';
11
+ case 'contextual':
12
+ return step.trigger || 'Based on conversation context';
13
+ }
14
+ }
15
+ function serializeStepComponent(comp) {
16
+ const lines = [];
17
+ lines.push(` - **${comp.type}**`);
18
+ if (comp.type === 'form' && comp.form?.fields.length) {
19
+ lines.push(' Fields:');
20
+ for (const f of comp.form.fields) {
21
+ lines.push(` - ${f.name} (${f.type}, label: "${f.label}", required: ${f.required}, sensitive: ${f.sensitive})`);
22
+ }
23
+ }
24
+ if (comp.type === 'approval-gate' && comp.approvalGate) {
25
+ const ag = comp.approvalGate;
26
+ lines.push(` Roles: ${ag.roles.join(', ') || '(none)'}`);
27
+ lines.push(` Required approvers: ${ag.requiredApprovers}`);
28
+ lines.push(` Require reason on denial: ${ag.requireReason}`);
29
+ }
30
+ if (comp.type === 'tasklist' && comp.tasklist?.items.length) {
31
+ lines.push(' Items:');
32
+ for (const item of comp.tasklist.items) {
33
+ lines.push(` - ${item}`);
34
+ }
35
+ }
36
+ if (comp.type === 'table' && comp.table?.columns.length) {
37
+ lines.push(' Columns:');
38
+ for (const col of comp.table.columns) {
39
+ lines.push(` - ${col.key}: "${col.header}"`);
40
+ }
41
+ }
42
+ return lines;
43
+ }
44
+ export function serializeConfig(domain) {
3
45
  const lines = [
4
46
  '## User Configuration',
5
47
  '',
@@ -10,43 +52,44 @@ export function serializeConfig(domain, components) {
10
52
  if (domain.businessRules) {
11
53
  lines.push(`**Business Rules:** ${domain.businessRules}`);
12
54
  }
13
- if (domain.triggerMode === 'immediate') {
14
- lines.push('**When to Display Components:** Immediately when the conversation starts — always respond with MDMA components in the first message.');
15
- }
16
- else if (domain.triggerMode === 'keyword' && domain.trigger) {
17
- lines.push(`**When to Display Components:** When the user says one of these keywords or phrases: ${domain.trigger}. Only generate MDMA components when triggered by these phrases, otherwise respond with plain text.`);
18
- }
19
- else if (domain.triggerMode === 'contextual' && domain.trigger) {
20
- lines.push(`**When to Display Components:** ${domain.trigger}`);
21
- }
22
- lines.push('', '**Selected Components:**', '');
23
- for (const comp of enabled) {
24
- lines.push(`### ${comp.type}`);
25
- if (comp.type === 'form' && comp.form?.fields.length) {
26
- lines.push('Fields:');
27
- for (const f of comp.form.fields) {
28
- lines.push(`- ${f.name} (${f.type}, label: "${f.label}", required: ${f.required}, sensitive: ${f.sensitive})`);
55
+ // Conversation flow with per-step components
56
+ if (domain.flowSteps.length > 0) {
57
+ lines.push('', '**Conversation Flow:**', '');
58
+ for (let i = 0; i < domain.flowSteps.length; i++) {
59
+ const step = domain.flowSteps[i];
60
+ lines.push(`Step ${i + 1} — ${step.label || `Step ${i + 1}`}`);
61
+ lines.push(` Trigger: ${serializeTrigger(step)}`);
62
+ const enabled = step.components.filter((c) => c.enabled);
63
+ if (enabled.length > 0) {
64
+ lines.push(' Components:');
65
+ for (const comp of enabled) {
66
+ lines.push(...serializeStepComponent(comp));
67
+ }
29
68
  }
30
- }
31
- if (comp.type === 'approval-gate' && comp.approvalGate) {
32
- const ag = comp.approvalGate;
33
- lines.push(`Roles: ${ag.roles.join(', ') || '(none)'}`);
34
- lines.push(`Required approvers: ${ag.requiredApprovers}`);
35
- lines.push(`Require reason on denial: ${ag.requireReason}`);
36
- }
37
- if (comp.type === 'tasklist' && comp.tasklist?.items.length) {
38
- lines.push('Items:');
39
- for (const item of comp.tasklist.items) {
40
- lines.push(`- ${item}`);
69
+ if (step.description) {
70
+ lines.push(` ${step.description}`);
41
71
  }
72
+ lines.push('');
42
73
  }
43
- if (comp.type === 'table' && comp.table?.columns.length) {
44
- lines.push('Columns:');
45
- for (const col of comp.table.columns) {
46
- lines.push(`- ${col.key}: "${col.header}"`);
74
+ // Derive global component type summary
75
+ const allTypes = new Set();
76
+ for (const step of domain.flowSteps) {
77
+ for (const comp of step.components) {
78
+ if (comp.enabled)
79
+ allTypes.add(comp.type);
47
80
  }
48
81
  }
49
- lines.push('');
82
+ if (allTypes.size > 0) {
83
+ lines.push(`**All Component Types Used:** ${[...allTypes].join(', ')}`, '');
84
+ }
85
+ // Count forms across all steps
86
+ let formCount = 0;
87
+ for (const step of domain.flowSteps) {
88
+ formCount += step.components.filter((c) => c.enabled && c.type === 'form').length;
89
+ }
90
+ if (formCount > 0) {
91
+ lines.push(`**IMPORTANT:** Your output MUST include concrete \`\`\`mdma code block examples for all ${formCount} form(s) defined above. Each form must include onSubmit and all specified fields.`, '');
92
+ }
50
93
  }
51
94
  return lines.join('\n');
52
95
  }
@@ -1 +1 @@
1
- {"version":3,"file":"serialize-config.js","sourceRoot":"","sources":["../../src/prompts/serialize-config.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,eAAe,CAAC,MAAoB,EAAE,UAA6B;IACjF,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACpD,MAAM,KAAK,GAAa;QACtB,u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EAAE,CAAC,CAAC;QACjB,CAAC;QAED,uCAAuC;QACvC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;QACnC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACpC,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACnC,IAAI,IAAI,CAAC,OAAO;oBAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;QACD,IAAI,QAAQ,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YACtB,KAAK,CAAC,IAAI,CAAC,iCAAiC,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAC9E,CAAC;QAED,+BAA+B;QAC/B,IAAI,SAAS,GAAG,CAAC,CAAC;QAClB,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACpC,SAAS,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC;QACpF,CAAC;QACD,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;YAClB,KAAK,CAAC,IAAI,CAAC,2FAA2F,SAAS,mFAAmF,EAAE,EAAE,CAAC,CAAC;QAC1M,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -30,13 +30,19 @@ export interface ComponentConfig {
30
30
  tasklist?: TasklistConfig;
31
31
  table?: TableConfig;
32
32
  }
33
- export type TriggerMode = 'keyword' | 'immediate' | 'contextual';
33
+ export type StepTriggerMode = 'immediate' | 'keyword' | 'form-submit' | 'contextual';
34
+ export interface FlowStep {
35
+ label: string;
36
+ triggerMode: StepTriggerMode;
37
+ trigger: string;
38
+ components: ComponentConfig[];
39
+ description: string;
40
+ }
34
41
  export interface DomainConfig {
35
42
  name: string;
36
43
  domain: string;
37
44
  description: string;
38
45
  businessRules: string;
39
- triggerMode: TriggerMode;
40
- trigger: string;
46
+ flowSteps: FlowStep[];
41
47
  }
42
48
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/prompts/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,QAAQ,GACR,UAAU,GACV,OAAO,GACP,SAAS,GACT,eAAe,GACf,SAAS,GACT,OAAO,GACP,UAAU,CAAC;AAEf,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE;QAAE,MAAM,EAAE,eAAe,EAAE,CAAA;KAAE,CAAC;IACrC,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,QAAQ,CA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AAE,MAAM,EAAE,eAAe,EAAE,CAAA;KAAE,CAAC;IACrC,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,YAAY,CAAC;AAErF,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,eAAe,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB"}
@@ -23,7 +23,7 @@ export async function startDevServer(port) {
23
23
  urlPath = '/index.html';
24
24
  const filePath = path.join(appRoot, urlPath);
25
25
  // Prevent path traversal
26
- if (!filePath.startsWith(appRoot)) {
26
+ if (!filePath.startsWith(appRoot + path.sep)) {
27
27
  res.writeHead(403);
28
28
  res.end('Forbidden');
29
29
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server.js","sourceRoot":"","sources":["../../src/server/dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI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C;YACP,qDAAqD;YACrD,IAAI,CAAC;gBACH,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;gBAC/D,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,WAAW,EAAE,CAAC,CAAC;gBACpD,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC;YAAC,MAAM,CAAC;gBACP,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;gBACnB,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QAClC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;YACvB,IAAI,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC;YACjC,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobile-reality/mdma-cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mdma": "./dist/bin/mdma.js"
@@ -18,30 +18,33 @@
18
18
  }
19
19
  },
20
20
  "dependencies": {
21
- "commander": "^12.0.0",
22
21
  "chalk": "^5.3.0",
22
+ "commander": "^12.0.0",
23
+ "get-port": "^7.0.0",
23
24
  "globby": "^14.0.0",
24
25
  "open": "^10.0.0",
25
- "get-port": "^7.0.0",
26
26
  "yaml": "^2.6.0",
27
27
  "@mobile-reality/mdma-prompt-pack": "0.1.0",
28
28
  "@mobile-reality/mdma-spec": "0.1.0",
29
29
  "@mobile-reality/mdma-validator": "0.1.0"
30
30
  },
31
31
  "devDependencies": {
32
- "typescript": "^5.7.0",
33
- "vitest": "^3.2.0",
34
- "vite": "^6.0.0",
32
+ "@tailwindcss/vite": "^4.2.1",
33
+ "@types/react": "^19.0.0",
34
+ "@types/react-dom": "^19.0.0",
35
35
  "@vitejs/plugin-react": "^4.3.0",
36
36
  "react": "^19.0.0",
37
37
  "react-dom": "^19.0.0",
38
- "@types/react": "^19.0.0",
39
- "@types/react-dom": "^19.0.0",
40
- "unified": "^11.0.0",
41
38
  "remark-parse": "^11.0.0",
39
+ "tailwindcss": "^4.2.1",
40
+ "typescript": "^5.7.0",
41
+ "unified": "^11.0.0",
42
+ "vite": "^6.0.0",
43
+ "vitest": "^3.2.0",
44
+ "@mobile-reality/mdma-attachables-core": "^0.1.0",
45
+ "@mobile-reality/mdma-parser": "0.1.0",
42
46
  "@mobile-reality/mdma-runtime": "0.1.0",
43
- "@mobile-reality/mdma-renderer-react": "0.1.0",
44
- "@mobile-reality/mdma-parser": "0.1.0"
47
+ "@mobile-reality/mdma-renderer-react": "0.1.0"
45
48
  },
46
49
  "files": [
47
50
  "dist",