Skip to content

feat: added cli for creating custom prompts#1

Merged
gitsad merged 3 commits intomainfrom
feat/cli
Mar 13, 2026
Merged

feat: added cli for creating custom prompts#1
gitsad merged 3 commits intomainfrom
feat/cli

Conversation

@gitsad
Copy link
Contributor

@gitsad gitsad commented Mar 13, 2026

What does this PR do?

Added CLI for creating custom prompt with MDMA components

Type of Change

  • New feature (non-breaking change that adds functionality)
  • Documentation
  • CI / tooling

Packages Affected

  • @mobile-reality/mdma-cli

How to Test

Unit Tests (no API key needed)

Run all CLI tests: pnpm --filter @mobile-reality/mdma-cli test
Covers 84 tests across 4 files:
Validate command — verifies document validation logic
Master Prompt — checks prompt structure, YAML enforcement, required sections, and component scope rules
Serialize config — ensures user configurations are correctly serialized for the LLM
Sample presets — validates that built-in presets (KYC, patient intake, incident triage, etc.) produce correct output within size limits

LLM Evals (requires OpenAI API key)

Setup: add OPENAI_API_KEY=sk-... to evals/.env
Run: pnpm eval:prompt-builder
Sends 25 real configurations to GPT-4.1 and validates the generated prompts against:
YAML format correctness (no JSON in mdma blocks)
MDMA schema validation (embedded examples must be valid)
Field and trigger rule coverage
Component scope compliance (no hallucinated components)
Prompt length and structure checks

From the monorepo root — build first, then launch

pnpm build
pnpm --filter @mobile-reality/mdma-cli dev
This starts the web app (defaults to http://localhost:4200) and opens it in your browser.

How to use it:

Pick your LLM provider — top of the chat panel, select OpenAI/Anthropic/Groq/Ollama/etc. and paste your API key
Set domain info — fill in the flow name, domain (e.g. "finance"), description, and business rules
Select components — check the MDMA types you need (form, table, approval-gate, etc.)
Configure each component — expand to set fields, labels, required/sensitive flags, roles, items, etc.
Set trigger rules — define when the AI should generate MDMA components (keywords, contextual conditions)
Click Generate — the LLM creates a tailored customPrompt via streaming
Refine — chat to iterate ("make email required", "add a webhook for Slack")
Copy/Save — grab the final prompt and use it in your app:

import { buildSystemPrompt } from '@mobile-reality/mdma-prompt-pack';

const systemPrompt = buildSystemPrompt({
customPrompt: '',
});


Note

Low Risk
Low risk: changes are limited to documentation and developer tooling/evals; no runtime parsing/rendering/business logic is modified.

Overview
Adds first-class documentation for the new @mobile-reality/mdma-cli, including install/run instructions, validate usage, and updates to the package/architecture tables and roadmap.

Extends @mobile-reality/mdma-evals with a new prompt builder verification suite (pnpm eval:prompt-builder): introduces promptfoo config + prompt function that feeds the CLI MASTER_PROMPT, plus new JavaScript assertions to check YAML (not JSON), validate embedded mdma examples, enforce prompt structure/length, and ensure triggers/fields/spec repetition constraints. Root scripts are updated to expose the new eval target.

Written by Cursor Bugbot for commit c87da0f. This will update automatically on new commits. Configure here.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Redundant assertion duplicated across defaultTest and every test
    • Removed yaml-not-json.mjs from defaultTest.assert so each test now runs that assertion only once via its own assert list.

Create PR

Or push these changes by commenting:

@cursor push afbfea611b
Preview (afbfea611b)
diff --git a/evals/promptfooconfig.prompt-builder.yaml b/evals/promptfooconfig.prompt-builder.yaml
--- a/evals/promptfooconfig.prompt-builder.yaml
+++ b/evals/promptfooconfig.prompt-builder.yaml
@@ -20,9 +20,6 @@
 
 defaultTest:
   assert:
-    # Every generated customPrompt must use YAML, not JSON
-    - type: javascript
-      value: file://assertions/yaml-not-json.mjs
     # Validate any embedded mdma blocks are structurally correct MDMA
     - type: javascript
       value: file://assertions/validate-mdma-examples.mjs

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

@gitsad gitsad merged commit 937344a into main Mar 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants