@mdocui/cli
v0.6.6
Published
CLI for mdocUI — scaffold, generate system prompts, preview
Downloads
1,145
Readme
@mdocui/cli
CLI for mdocUI — scaffold projects, generate system prompts, and preview output.
Install
npx @mdocui/cli initOr install globally:
pnpm add -g @mdocui/cliCommands
init
Scaffold a complete mdocUI integration. Detects your framework (Next.js, Vite, Remix) and generates all required files.
npx @mdocui/cli initCreates:
mdocui.config.ts— config with all 24 component definitionssrc/lib/mdoc-registry.ts— component registry setupsrc/components/mdoc-message.tsx— streaming message component usinguseRenderer.env.example— API key placeholderssrc/app/api/chat/route.ts— streaming API route (Next.js only)
generate
Generate a system prompt from your component registry and write it to a file.
npx @mdocui/cli generateReads mdocui.config.ts and writes the prompt to the configured output path (default: system-prompt.txt).
preview
Start a local dev server with a split-pane editor for live markup rendering and parse validation.
npx @mdocui/cli preview
npx @mdocui/cli preview --port 3000Opens a browser UI where you type mdocUI markup on the left and see it rendered on the right in real-time. Great for prompt iteration without burning API calls.
Config File
// mdocui.config.ts
import { defineComponent } from '@mdocui/core'
import { z } from 'zod'
const button = defineComponent({
name: 'button',
description: 'Clickable action button',
props: z.object({
action: z.string().describe('Action to perform'),
label: z.string().describe('Button text'),
}),
children: 'none',
})
export default {
components: [button],
output: './generated/system-prompt.txt',
preamble: 'You are a helpful assistant.',
additionalRules: ['End responses with follow-up buttons'],
groups: [{ name: 'Interactive', components: ['button'] }],
}