@davia/agent 0.1.0
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/LICENSE +21 -0
- package/dist/agent/agent.d.ts +13 -0
- package/dist/agent/agent.d.ts.map +1 -0
- package/dist/agent/agent.js +40 -0
- package/dist/agent/context.d.ts +9 -0
- package/dist/agent/context.d.ts.map +1 -0
- package/dist/agent/context.js +7 -0
- package/dist/agent/helpers/initialization.d.ts +30 -0
- package/dist/agent/helpers/initialization.d.ts.map +1 -0
- package/dist/agent/helpers/initialization.js +247 -0
- package/dist/agent/helpers/messages-caching-handler.d.ts +14 -0
- package/dist/agent/helpers/messages-caching-handler.d.ts.map +1 -0
- package/dist/agent/helpers/messages-caching-handler.js +162 -0
- package/dist/agent/helpers/tools.d.ts +46 -0
- package/dist/agent/helpers/tools.d.ts.map +1 -0
- package/dist/agent/helpers/tools.js +164 -0
- package/dist/agent/helpers/tree.d.ts +15 -0
- package/dist/agent/helpers/tree.d.ts.map +1 -0
- package/dist/agent/helpers/tree.js +146 -0
- package/dist/agent/middlewares/after-model.d.ts +6 -0
- package/dist/agent/middlewares/after-model.d.ts.map +1 -0
- package/dist/agent/middlewares/after-model.js +19 -0
- package/dist/agent/middlewares/initialization.d.ts +17 -0
- package/dist/agent/middlewares/initialization.d.ts.map +1 -0
- package/dist/agent/middlewares/initialization.js +93 -0
- package/dist/agent/prompts/agent.d.ts +9 -0
- package/dist/agent/prompts/agent.d.ts.map +1 -0
- package/dist/agent/prompts/agent.js +151 -0
- package/dist/agent/prompts/blocks/data.d.ts +2 -0
- package/dist/agent/prompts/blocks/data.d.ts.map +1 -0
- package/dist/agent/prompts/blocks/data.js +90 -0
- package/dist/agent/prompts/blocks/excalidraw.d.ts +2 -0
- package/dist/agent/prompts/blocks/excalidraw.d.ts.map +1 -0
- package/dist/agent/prompts/blocks/excalidraw.js +52 -0
- package/dist/agent/prompts/blocks/file_handling.d.ts +2 -0
- package/dist/agent/prompts/blocks/file_handling.d.ts.map +1 -0
- package/dist/agent/prompts/blocks/file_handling.js +29 -0
- package/dist/agent/prompts/blocks/mdx/available_packages.d.ts +2 -0
- package/dist/agent/prompts/blocks/mdx/available_packages.d.ts.map +1 -0
- package/dist/agent/prompts/blocks/mdx/available_packages.js +8 -0
- package/dist/agent/prompts/blocks/mdx/custom_components.d.ts +2 -0
- package/dist/agent/prompts/blocks/mdx/custom_components.d.ts.map +1 -0
- package/dist/agent/prompts/blocks/mdx/custom_components.js +77 -0
- package/dist/agent/prompts/blocks/mdx/davia_specific.d.ts +2 -0
- package/dist/agent/prompts/blocks/mdx/davia_specific.d.ts.map +1 -0
- package/dist/agent/prompts/blocks/mdx/davia_specific.js +116 -0
- package/dist/agent/prompts/blocks/mdx/mdx.d.ts +2 -0
- package/dist/agent/prompts/blocks/mdx/mdx.d.ts.map +1 -0
- package/dist/agent/prompts/blocks/mdx/mdx.js +91 -0
- package/dist/agent/prompts/blocks/mdx/shadcn.d.ts +2 -0
- package/dist/agent/prompts/blocks/mdx/shadcn.d.ts.map +1 -0
- package/dist/agent/prompts/blocks/mdx/shadcn.js +132 -0
- package/dist/agent/prompts/blocks/tiptap.d.ts +2 -0
- package/dist/agent/prompts/blocks/tiptap.d.ts.map +1 -0
- package/dist/agent/prompts/blocks/tiptap.js +100 -0
- package/dist/agent/prompts/index.d.ts +7 -0
- package/dist/agent/prompts/index.d.ts.map +1 -0
- package/dist/agent/prompts/index.js +6 -0
- package/dist/agent/prompts/repo_instructions.d.ts +3 -0
- package/dist/agent/prompts/repo_instructions.d.ts.map +1 -0
- package/dist/agent/prompts/repo_instructions.js +442 -0
- package/dist/agent/prompts/tool_descriptions.d.ts +4 -0
- package/dist/agent/prompts/tool_descriptions.d.ts.map +1 -0
- package/dist/agent/prompts/tool_descriptions.js +80 -0
- package/dist/agent/tools.d.ts +79 -0
- package/dist/agent/tools.d.ts.map +1 -0
- package/dist/agent/tools.js +303 -0
- package/dist/config.d.ts +16 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +108 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +44 -0
- package/package.json +57 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const MDX_GUIDELINES = "<mdx_guidelines>\n\n# Main MDX Guidelines for Component Development\nMDX_GUIDELINES = f\"\"\"<mdx_guidelines>\n## MDX Component Guidelines\n\n### What are MDX Components?\nMDX components are reusable interactive React components that get embedded into HTML pages. They contain only functional, interactive elements - no regular markdown content.\n\n### When to Create MDX Components\n- When users need interactive widgets (forms, calculators, charts)\n- For dynamic data visualization or dashboards\n- When building custom functionality beyond basic HTML\n- For reusable interactive elements within pages\n\n### Component Development Best Practices\n\n**GOOD PRACTICE: START SIMPLE FIRST**\n- **Always begin with basic functionality** - avoid complex features initially\n- **Add complexity gradually** - enhance features incrementally after basic version works\n- **Resist over-engineering** - users can always request additional features later\n\n1. **Component Structure**\n - Create focused, single-purpose interactive components\n - Use only JSX/React components - NO markdown content\n - Export components that can be embedded in HTML pages\n - Ensure component paths match the data-path attribute exactly\n\n2. **Component Design**\n - Keep component logic simple and readable\n - Focus on interactive functionality only\n - Build incrementally - add features one at a time, not all at once unless requested by the user\n\n3. **State Management**\n - Import a JSON data source and bind it: `import sourceData from \"~/data/file.json\"`\n - Use `const { data, updateData } = useData(sourceData);` for persisted, shareable state\n - Use local component state for temporary interactions\n - Data is not scoped to a component or page; sharing is achieved by importing the same JSON file\n\n4. **Styling Approach**\n - Use Tailwind CSS classes from the approved safelist only\n - Leverage shadcn/ui components for consistent design\n - Keep inline styles minimal and purposeful\n - Maintain consistent design patterns across components\n\n### Example MDX Component Structure\n```mdx\nimport sales from \"~/data/sales.json\";\nimport { Button } from \"@/components/ui/button\";\n\nexport function SalesChart() {\n const { data, updateData } = useData(sales);\n \n // data is an array of sales records\n const salesData = data || [];\n \n return (\n <div className=\"p-4 border rounded\">\n <h3>Sales Records</h3>\n {salesData.map(record => (\n <div key={record.id} className=\"p-2 border-b\">\n <p>{record.month}: ${record.revenue}</p>\n </div>\n ))}\n </div>\n );\n}\n\n<SalesChart />\n```\n\n**Usage in HTML Page:**\n```html\n<h1>Dashboard</h1>\n<p>Welcome to our interactive dashboard.</p>\n<mdx-component data-path=\"components/sales-chart.mdx\"></mdx-component>\n<p></p>\n```\n\n<mdx_implementation>\n## Davia-Specific MDX Component Implementation\n\n### Critical Component Requirements\n\n1. **Component File Structure**\n - MDX components are created in the \"components/\" directory\n - File paths must match the data-path attribute exactly\n - Components are embedded in HTML pages via `<mdx-component data-path=\"components/name.mdx\"></mdx-component>`\n - Components can be shared across multiple HTML pages\n - NO markdown content - components contain only interactive functionality\n\n2. **Imports**\n - Data: `import dataSource from \"~/data/name.json\"`\n - UI: Import shadcn components from `@/components/ui/*`\n - Icons: Import icons from `lucide-react` (e.g., `import { ChevronDown, Plus, Search } from \"lucide-react\"`)\n - Utilities: `import { cn } from \"@/lib/utils\"`, `import { useIsMobile } from \"@/hooks/use-mobile\"`\n\n3. **React Usage**\n - React is globally available - use `React.useState`, `React.useEffect`, etc.\n - Always prefix React hooks and methods with `React.`\n\n4. **Component Data Persistence**\n - Bind component state to a specific data source: `const { data, updateData } = useData(dataSource);`\n - `dataSource` is the imported JSON reference (e.g., `import dataSource from \"~/data/name.json\"`)\n - Updates via `updateData(newData)` persist to the underlying JSON file and are shared wherever that file is used\n - **Avoid hardcoding data in component files** \u2014 define initial structure in the JSON file, and use `useData(importedRef)` to read/update it\n - Use the spread operator to preserve existing data when updating\n\n **Component Example:**\n ```mdx\n import counter from \"~/data/counter.json\";\n import { Button } from \"@/components/ui/button\";\n\n export function InteractiveCounter() {\n const { data, updateData } = useData(counter);\n const count = data.count || 0;\n \n const increment = () => {\n updateData({\n ...data,\n count: count + 1\n });\n };\n\n return (\n <div className=\"p-4 border rounded\">\n <p>Count: {count}</p>\n <Button onClick={increment}>Increment</Button>\n </div>\n );\n }\n\n <InteractiveCounter />\n ```\n\n5. **Tailwind CSS v4 (Safelist ONLY)**\n - The project uses Tailwind v4 with a strict safelist. Only the classes below are allowed.\n - Do NOT use any class names not present in this safelist (they will be stripped at build time).\n - Use `className` for styling as much as possible but if you need very specific styling, use inline styles (try to avoid if possible).\n\n **Color Usage Guidelines:**\n - **Text Colors**: Do NOT use text colors unless explicitly requested by users. Text colors are set globally through shadcn and nextjs.\n - **Background Colors**: When using background colors (not predefined globals like primary, muted, accent), always include `dark:` variants for light/dark mode compatibility.\n\n ```css\n /* Layout */\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}{block,inline-block,inline,flex,inline-flex,grid,inline-grid,hidden}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}overflow-{auto,hidden,visible,scroll,x-auto,y-auto}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}position-{static,relative,absolute,fixed,sticky}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}{top,bottom,left,right,inset,inset-x,inset-y}-{0,auto}\");\n\n /* Flexbox & Grid */\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}flex-{row,row-reverse,col,col-reverse}\", \"{,sm:,md:,lg:,xl:,2xl:}flex-wrap\", \"{,sm:,md:,lg:,xl:,2xl:}flex-nowrap\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}items-{start,end,center,baseline,stretch}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}justify-{start,end,center,between,around,evenly}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}gap-{0,1,2,3,4,5,6,8,10,12,16,20,24,32}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}grid-cols-{1,2,3,4,5,6,7,8,9,10,11,12}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}col-span-{1,2,3,4,5,6,7,8,9,10,11,12,full}\");\n\n /* Spacing */\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}{p,m,px,py,pt,pr,pb,pl,mx,my,mt,mr,mb,ml}-{0,1,2,3,4,5,6,8,10,12,16,20,24,32,auto}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}space-{x,y}-{0,1,2,3,4,5,6,8,10,12,16,20,24,32}\");\n\n /* Sizing */\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}{w,h}-{auto,full,screen,fit,min,max,'1/2','1/3','2/3','1/4','3/4','1/5','2/5','3/5','4/5'}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}max-w-{xs,sm,md,lg,xl,2xl,3xl,4xl,5xl,6xl,7xl,prose}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}{w,h}-{4,5,6,7,8,9,10,11,12}\");\n\n /* Typography */\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}text-{xs,sm,base,lg,xl,2xl,3xl,4xl,5xl,6xl}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}font-{light,normal,medium,semibold,bold,extrabold}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}text-{left,center,right,justify}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}leading-{tight,snug,normal,relaxed,loose}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}italic\", \"{,sm:,md:,lg:,xl:,2xl:}not-italic\", \"{,sm:,md:,lg:,xl:,2xl:}underline\", \"{,sm:,md:,lg:,xl:,2xl:}line-through\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}list-{disc,decimal}\", \"{,sm:,md:,lg:,xl:,2xl:}list-inside\");\n\n /* Colors (semantic & grayscale) */\n @source inline(\"{,dark:,hover:,focus:,focus-visible:,active:}{bg,text,border,ring,fill,stroke}-{background,foreground,primary,primary-foreground,secondary,secondary-foreground,muted,muted-foreground,accent,accent-foreground,destructive,card,border,input,ring}\");\n @source inline(\"{,dark:,hover:,focus:,focus-visible:,active:}{bg,text,border,ring,fill,stroke}-{slate,gray,zinc,neutral,stone}-{50,{100..900..100},950}\");\n @source inline(\"{,dark:,hover:,focus:,focus-visible:,active:}{bg,text,border,ring,fill,stroke}-{red,orange,amber,yellow,lime,green,emerald,teal,cyan,sky,blue,indigo,violet,purple,fuchsia,pink,rose}-{50,{100..900..100},950}\");\n @source inline(\"{,dark:,hover:,focus:,focus-visible:,active:}{bg,text,border,ring,fill,stroke}-{transparent,white,black}\");\n @source inline(\"ring-offset-{background,foreground,card,popover,white,black}\");\n\n /* Borders */\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}rounded{,-t,-r,-b,-l,-tl,-tr,-br,-bl}-{sm,md,lg,xl,2xl,3xl,full}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}border{,-x,-y,-t,-r,-b,-l}-{0,1,2,4,8}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}divide-{x,y}-{0,1,2,4,8}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}ring-{0,1,2,4,8}\");\n\n /* Effects & Transitions */\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}shadow-{sm,md,lg,xl,2xl,inner,none}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}opacity-{0,25,50,75,100}\");\n @source inline(\"{,sm:,md:,lg:,xl:,2xl:}transition-all\", \"{,sm:,md:,lg:,xl:,2xl:}duration-{150,200,300,500,700}\");\n ```\n</mdx_implementation>\n\n<mdx_shadcn>\n## Shadcn Component Instructions\n\n### Best Practices\n1. **Composition**: Combine multiple components to create rich interfaces\n2. **Styling**: Use `className` prop for additional Tailwind CSS classes\n3. **State Management**: Manage component state within custom components\n\n### Forms\nUse the following imports for forms and validation. Import shadcn form components from `@/components/ui/form`.\n\n- **useForm** from react-hook-form - For form state management\n- **zodResolver** from @hookform/resolvers/zod - For form validation\n- **z** from zod - For schema validation\n\n```mdx\nimport { useForm } from \"react-hook-form\";\nimport { zodResolver } from \"@hookform/resolvers/zod\";\nimport { z } from \"zod\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { Form, FormField, FormItem, FormLabel, FormControl, FormMessage } from \"@/components/ui/form\";\n\nexport function ContactForm() {\n const formSchema = z.object({\n email: z.string().email(\"Please enter a valid email address\"),\n });\n\n const form = useForm({\n resolver: zodResolver(formSchema),\n defaultValues: {\n email: \"\",\n },\n });\n\n const onSubmit = (values) => {\n console.log(values);\n };\n\n return (\n <Form {...form}>\n <form onSubmit={form.handleSubmit(onSubmit)} className=\"space-y-4\">\n <FormField\n control={form.control}\n name=\"email\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>Email</FormLabel>\n <FormControl>\n <Input placeholder=\"Enter your email\" {...field} />\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <Button type=\"submit\">Submit</Button>\n </form>\n </Form>\n );\n}\n```\n\n### Charts\nRecharts v2 components are available for data visualization. Import them from `recharts` as shown below.\n**Important**: Remember to set a `min-h-[VALUE]` on the ChartContainer component. This is required for the chart to be responsive.\n**Colors**: Use direct hex, hsl, or oklch values in chartConfig instead of CSS variables. Default chart colors available:\n- **Chart 1**: `oklch(0.646 0.222 41.116)` (light) / `oklch(0.488 0.243 264.376)` (dark)\n- **Chart 2**: `oklch(0.6 0.118 184.704)` (light) / `oklch(0.696 0.17 162.48)` (dark)\n- **Chart 3**: `oklch(0.398 0.07 227.392)` (light) / `oklch(0.769 0.188 70.08)` (dark)\n- **Chart 4**: `oklch(0.828 0.189 84.429)` (light) / `oklch(0.627 0.265 303.9)` (dark)\n- **Chart 5**: `oklch(0.769 0.188 70.08)` (light) / `oklch(0.645 0.246 16.439)` (dark)\n\n```mdx\nimport { ChartContainer, ChartTooltip, ChartTooltipContent } from \"@/components/ui/chart\";\nimport { ResponsiveContainer, BarChart, Bar, CartesianGrid, XAxis, YAxis } from \"recharts\";\n\nexport function SalesChart() {\n const chartData = [\n { month: \"Jan\", sales: 4000, profit: 2400 },\n { month: \"Feb\", sales: 3000, profit: 1398 },\n { month: \"Mar\", sales: 2000, profit: 9800 },\n { month: \"Apr\", sales: 2780, profit: 3908 },\n { month: \"May\", sales: 1890, profit: 4800 },\n { month: \"Jun\", sales: 2390, profit: 3800 },\n ];\n\n const chartConfig = {\n sales: {\n label: \"Sales\",\n color: \"oklch(0.646 0.222 41.116)\",\n },\n profit: {\n label: \"Profit\", \n color: \"oklch(0.6 0.118 184.704)\",\n },\n };\n\n return (\n <ChartContainer config={chartConfig} className=\"min-h-[150px] w-full\">\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <BarChart data={chartData}>\n <CartesianGrid strokeDasharray=\"3 3\" />\n <XAxis dataKey=\"month\" />\n <YAxis />\n <ChartTooltip content={<ChartTooltipContent />} />\n <Bar dataKey=\"sales\" fill=\"var(--color-sales)\" />\n <Bar dataKey=\"profit\" fill=\"var(--color-profit)\" />\n </BarChart>\n </ResponsiveContainer>\n </ChartContainer>\n );\n}\n```\n\n### Toasts\nUse Sonner by importing `toast`:\n\n```mdx\nimport { Button } from \"@/components/ui/button\";\nimport { toast } from \"sonner\";\n\nexport function SimpleToast() {\n const handleClick = () => {\n toast('Event has been created');\n };\n\n return (\n <Button onClick={handleClick}>Show Toast</Button>\n );\n}\n```\n</mdx_shadcn>\n\n<mdx_custom_components>\n## Custom Component Instructions\n\n### Rules for Custom Components\n\n1. **Always Use Export**\n - All custom components must use `export function ComponentName()`\n - This makes them available throughout the MDX document\n\n2. **Keep Everything Inside**\n - ALL variables, functions, state, and logic must be declared inside the component\n - Never declare anything outside the component scope\n \n **WRONG:**\n ```mdx\n const initCounter = 4;\n export function CounterComponent() {\n const [count, setCount] = React.useState(initCounter);\n }\n ```\n \n **CORRECT:**\n ```mdx\n export function CounterComponent() {\n const initCounter = 4;\n const [count, setCount] = React.useState(initCounter);\n }\n ```\n\n3. **Component Placement**\n - ALL custom component definitions MUST be placed at the TOP of the document\n - Define components before any content or component usage\n - Never define components at the bottom or mixed within content\n - ALWAYS add a blank line between the last component and the beginning of MDX content\n \n **WRONG:**\n ```mdx\n export function InternEvents() {\n const events = [];\n return (<></>);\n }\n <InternEvents />\n ```\n \n **CORRECT:**\n ```mdx\n export function InternEvents() {\n const events = [];\n return (<></>);\n }\n\n <InternEvents />\n ```\n\n4. **Component Structure**\n - Use descriptive, PascalCase component names\n - Keep components self-contained with all logic inside\n - Components should be focused and single-purpose\n\n5. **String Quotes (IMPORTANT)**\n - Try to use double quotes `\"` for strings as much as possible, but if you need to use single quotes, use single quotes `'`\n - Triple quotes ```text``` will cause syntax errors\n \n **WRONG:**\n ```mdx\n const events = [\n { title: ```Meeting```, description: ```Team sync``` }\n ];\n ```\n \n **CORRECT:**\n ```mdx\n const events = [\n { title: \"Meeting\", description: \"Team sync\" }\n ];\n ```\n</mdx_custom_components>\n\n<available_packages>\nHere are the available secondary packages for you to use to build your components:\n- react-simple-maps@3.0.0 : ideal for lightweight, SVG-based map visualizations (choropleths, small geo overlays).\n(careful to set the geoUrl constant inside the component function)\n\n- usehooks-ts@3.1.1 : React hooks library, written in Typescript and easy to use. It provides a set of hooks that enables you to build your React applications faster.\nDo not hesitate to look at the documentation on the internet (use the web search tool) of the packages to see how to use them.\n</available_packages>\n</mdx_guidelines>";
|
|
2
|
+
//# sourceMappingURL=mdx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../../../../../src/agent/prompts/blocks/mdx/mdx.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,g8gBAsFT,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { MDX_IMPLEMENTATION_INSTRUCTIONS } from "./davia_specific.js";
|
|
2
|
+
import { MDX_SHADCN_INSTRUCTIONS } from "./shadcn.js";
|
|
3
|
+
import { CUSTOM_COMPONENTS } from "./custom_components.js";
|
|
4
|
+
import { AVAILABLE_PACKAGES } from "./available_packages.js";
|
|
5
|
+
export const MDX_GUIDELINES = `<mdx_guidelines>
|
|
6
|
+
|
|
7
|
+
# Main MDX Guidelines for Component Development
|
|
8
|
+
MDX_GUIDELINES = f"""<mdx_guidelines>
|
|
9
|
+
## MDX Component Guidelines
|
|
10
|
+
|
|
11
|
+
### What are MDX Components?
|
|
12
|
+
MDX components are reusable interactive React components that get embedded into HTML pages. They contain only functional, interactive elements - no regular markdown content.
|
|
13
|
+
|
|
14
|
+
### When to Create MDX Components
|
|
15
|
+
- When users need interactive widgets (forms, calculators, charts)
|
|
16
|
+
- For dynamic data visualization or dashboards
|
|
17
|
+
- When building custom functionality beyond basic HTML
|
|
18
|
+
- For reusable interactive elements within pages
|
|
19
|
+
|
|
20
|
+
### Component Development Best Practices
|
|
21
|
+
|
|
22
|
+
**GOOD PRACTICE: START SIMPLE FIRST**
|
|
23
|
+
- **Always begin with basic functionality** - avoid complex features initially
|
|
24
|
+
- **Add complexity gradually** - enhance features incrementally after basic version works
|
|
25
|
+
- **Resist over-engineering** - users can always request additional features later
|
|
26
|
+
|
|
27
|
+
1. **Component Structure**
|
|
28
|
+
- Create focused, single-purpose interactive components
|
|
29
|
+
- Use only JSX/React components - NO markdown content
|
|
30
|
+
- Export components that can be embedded in HTML pages
|
|
31
|
+
- Ensure component paths match the data-path attribute exactly
|
|
32
|
+
|
|
33
|
+
2. **Component Design**
|
|
34
|
+
- Keep component logic simple and readable
|
|
35
|
+
- Focus on interactive functionality only
|
|
36
|
+
- Build incrementally - add features one at a time, not all at once unless requested by the user
|
|
37
|
+
|
|
38
|
+
3. **State Management**
|
|
39
|
+
- Import a JSON data source and bind it: \`import sourceData from "~/data/file.json"\`
|
|
40
|
+
- Use \`const { data, updateData } = useData(sourceData);\` for persisted, shareable state
|
|
41
|
+
- Use local component state for temporary interactions
|
|
42
|
+
- Data is not scoped to a component or page; sharing is achieved by importing the same JSON file
|
|
43
|
+
|
|
44
|
+
4. **Styling Approach**
|
|
45
|
+
- Use Tailwind CSS classes from the approved safelist only
|
|
46
|
+
- Leverage shadcn/ui components for consistent design
|
|
47
|
+
- Keep inline styles minimal and purposeful
|
|
48
|
+
- Maintain consistent design patterns across components
|
|
49
|
+
|
|
50
|
+
### Example MDX Component Structure
|
|
51
|
+
\`\`\`mdx
|
|
52
|
+
import sales from "~/data/sales.json";
|
|
53
|
+
import { Button } from "@/components/ui/button";
|
|
54
|
+
|
|
55
|
+
export function SalesChart() {
|
|
56
|
+
const { data, updateData } = useData(sales);
|
|
57
|
+
|
|
58
|
+
// data is an array of sales records
|
|
59
|
+
const salesData = data || [];
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<div className="p-4 border rounded">
|
|
63
|
+
<h3>Sales Records</h3>
|
|
64
|
+
{salesData.map(record => (
|
|
65
|
+
<div key={record.id} className="p-2 border-b">
|
|
66
|
+
<p>{record.month}: \${record.revenue}</p>
|
|
67
|
+
</div>
|
|
68
|
+
))}
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
<SalesChart />
|
|
74
|
+
\`\`\`
|
|
75
|
+
|
|
76
|
+
**Usage in HTML Page:**
|
|
77
|
+
\`\`\`html
|
|
78
|
+
<h1>Dashboard</h1>
|
|
79
|
+
<p>Welcome to our interactive dashboard.</p>
|
|
80
|
+
<mdx-component data-path="components/sales-chart.mdx"></mdx-component>
|
|
81
|
+
<p></p>
|
|
82
|
+
\`\`\`
|
|
83
|
+
|
|
84
|
+
${MDX_IMPLEMENTATION_INSTRUCTIONS}
|
|
85
|
+
|
|
86
|
+
${MDX_SHADCN_INSTRUCTIONS}
|
|
87
|
+
|
|
88
|
+
${CUSTOM_COMPONENTS}
|
|
89
|
+
|
|
90
|
+
${AVAILABLE_PACKAGES}
|
|
91
|
+
</mdx_guidelines>`;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const MDX_SHADCN_INSTRUCTIONS = "<mdx_shadcn>\n## Shadcn Component Instructions\n\n### Best Practices\n1. **Composition**: Combine multiple components to create rich interfaces\n2. **Styling**: Use `className` prop for additional Tailwind CSS classes\n3. **State Management**: Manage component state within custom components\n\n### Forms\nUse the following imports for forms and validation. Import shadcn form components from `@/components/ui/form`.\n\n- **useForm** from react-hook-form - For form state management\n- **zodResolver** from @hookform/resolvers/zod - For form validation\n- **z** from zod - For schema validation\n\n```mdx\nimport { useForm } from \"react-hook-form\";\nimport { zodResolver } from \"@hookform/resolvers/zod\";\nimport { z } from \"zod\";\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { Form, FormField, FormItem, FormLabel, FormControl, FormMessage } from \"@/components/ui/form\";\n\nexport function ContactForm() {\n const formSchema = z.object({\n email: z.string().email(\"Please enter a valid email address\"),\n });\n\n const form = useForm({\n resolver: zodResolver(formSchema),\n defaultValues: {\n email: \"\",\n },\n });\n\n const onSubmit = (values) => {\n console.log(values);\n };\n\n return (\n <Form {...form}>\n <form onSubmit={form.handleSubmit(onSubmit)} className=\"space-y-4\">\n <FormField\n control={form.control}\n name=\"email\"\n render={({ field }) => (\n <FormItem>\n <FormLabel>Email</FormLabel>\n <FormControl>\n <Input placeholder=\"Enter your email\" {...field} />\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n <Button type=\"submit\">Submit</Button>\n </form>\n </Form>\n );\n}\n```\n\n### Charts\nRecharts v2 components are available for data visualization. Import them from `recharts` as shown below.\n**Important**: Remember to set a `min-h-[VALUE]` on the ChartContainer component. This is required for the chart to be responsive.\n**Colors**: Use direct hex, hsl, or oklch values in chartConfig instead of CSS variables. Default chart colors available:\n- **Chart 1**: `oklch(0.646 0.222 41.116)` (light) / `oklch(0.488 0.243 264.376)` (dark)\n- **Chart 2**: `oklch(0.6 0.118 184.704)` (light) / `oklch(0.696 0.17 162.48)` (dark)\n- **Chart 3**: `oklch(0.398 0.07 227.392)` (light) / `oklch(0.769 0.188 70.08)` (dark)\n- **Chart 4**: `oklch(0.828 0.189 84.429)` (light) / `oklch(0.627 0.265 303.9)` (dark)\n- **Chart 5**: `oklch(0.769 0.188 70.08)` (light) / `oklch(0.645 0.246 16.439)` (dark)\n\n```mdx\nimport { ChartContainer, ChartTooltip, ChartTooltipContent } from \"@/components/ui/chart\";\nimport { ResponsiveContainer, BarChart, Bar, CartesianGrid, XAxis, YAxis } from \"recharts\";\n\nexport function SalesChart() {\n const chartData = [\n { month: \"Jan\", sales: 4000, profit: 2400 },\n { month: \"Feb\", sales: 3000, profit: 1398 },\n { month: \"Mar\", sales: 2000, profit: 9800 },\n { month: \"Apr\", sales: 2780, profit: 3908 },\n { month: \"May\", sales: 1890, profit: 4800 },\n { month: \"Jun\", sales: 2390, profit: 3800 },\n ];\n\n const chartConfig = {\n sales: {\n label: \"Sales\",\n color: \"oklch(0.646 0.222 41.116)\",\n },\n profit: {\n label: \"Profit\", \n color: \"oklch(0.6 0.118 184.704)\",\n },\n };\n\n return (\n <ChartContainer config={chartConfig} className=\"min-h-[150px] w-full\">\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <BarChart data={chartData}>\n <CartesianGrid strokeDasharray=\"3 3\" />\n <XAxis dataKey=\"month\" />\n <YAxis />\n <ChartTooltip content={<ChartTooltipContent />} />\n <Bar dataKey=\"sales\" fill=\"var(--color-sales)\" />\n <Bar dataKey=\"profit\" fill=\"var(--color-profit)\" />\n </BarChart>\n </ResponsiveContainer>\n </ChartContainer>\n );\n}\n```\n\n### Toasts\nUse Sonner by importing `toast`:\n\n```mdx\nimport { Button } from \"@/components/ui/button\";\nimport { toast } from \"sonner\";\n\nexport function SimpleToast() {\n const handleClick = () => {\n toast('Event has been created');\n };\n\n return (\n <Button onClick={handleClick}>Show Toast</Button>\n );\n}\n```\n</mdx_shadcn>";
|
|
2
|
+
//# sourceMappingURL=shadcn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shadcn.d.ts","sourceRoot":"","sources":["../../../../../src/agent/prompts/blocks/mdx/shadcn.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,i1IAmItB,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
export const MDX_SHADCN_INSTRUCTIONS = `<mdx_shadcn>
|
|
2
|
+
## Shadcn Component Instructions
|
|
3
|
+
|
|
4
|
+
### Best Practices
|
|
5
|
+
1. **Composition**: Combine multiple components to create rich interfaces
|
|
6
|
+
2. **Styling**: Use \`className\` prop for additional Tailwind CSS classes
|
|
7
|
+
3. **State Management**: Manage component state within custom components
|
|
8
|
+
|
|
9
|
+
### Forms
|
|
10
|
+
Use the following imports for forms and validation. Import shadcn form components from \`@/components/ui/form\`.
|
|
11
|
+
|
|
12
|
+
- **useForm** from react-hook-form - For form state management
|
|
13
|
+
- **zodResolver** from @hookform/resolvers/zod - For form validation
|
|
14
|
+
- **z** from zod - For schema validation
|
|
15
|
+
|
|
16
|
+
\`\`\`mdx
|
|
17
|
+
import { useForm } from "react-hook-form";
|
|
18
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
19
|
+
import { z } from "zod";
|
|
20
|
+
import { Button } from "@/components/ui/button";
|
|
21
|
+
import { Input } from "@/components/ui/input";
|
|
22
|
+
import { Form, FormField, FormItem, FormLabel, FormControl, FormMessage } from "@/components/ui/form";
|
|
23
|
+
|
|
24
|
+
export function ContactForm() {
|
|
25
|
+
const formSchema = z.object({
|
|
26
|
+
email: z.string().email("Please enter a valid email address"),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const form = useForm({
|
|
30
|
+
resolver: zodResolver(formSchema),
|
|
31
|
+
defaultValues: {
|
|
32
|
+
email: "",
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const onSubmit = (values) => {
|
|
37
|
+
console.log(values);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<Form {...form}>
|
|
42
|
+
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
|
|
43
|
+
<FormField
|
|
44
|
+
control={form.control}
|
|
45
|
+
name="email"
|
|
46
|
+
render={({ field }) => (
|
|
47
|
+
<FormItem>
|
|
48
|
+
<FormLabel>Email</FormLabel>
|
|
49
|
+
<FormControl>
|
|
50
|
+
<Input placeholder="Enter your email" {...field} />
|
|
51
|
+
</FormControl>
|
|
52
|
+
<FormMessage />
|
|
53
|
+
</FormItem>
|
|
54
|
+
)}
|
|
55
|
+
/>
|
|
56
|
+
<Button type="submit">Submit</Button>
|
|
57
|
+
</form>
|
|
58
|
+
</Form>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
\`\`\`
|
|
62
|
+
|
|
63
|
+
### Charts
|
|
64
|
+
Recharts v2 components are available for data visualization. Import them from \`recharts\` as shown below.
|
|
65
|
+
**Important**: Remember to set a \`min-h-[VALUE]\` on the ChartContainer component. This is required for the chart to be responsive.
|
|
66
|
+
**Colors**: Use direct hex, hsl, or oklch values in chartConfig instead of CSS variables. Default chart colors available:
|
|
67
|
+
- **Chart 1**: \`oklch(0.646 0.222 41.116)\` (light) / \`oklch(0.488 0.243 264.376)\` (dark)
|
|
68
|
+
- **Chart 2**: \`oklch(0.6 0.118 184.704)\` (light) / \`oklch(0.696 0.17 162.48)\` (dark)
|
|
69
|
+
- **Chart 3**: \`oklch(0.398 0.07 227.392)\` (light) / \`oklch(0.769 0.188 70.08)\` (dark)
|
|
70
|
+
- **Chart 4**: \`oklch(0.828 0.189 84.429)\` (light) / \`oklch(0.627 0.265 303.9)\` (dark)
|
|
71
|
+
- **Chart 5**: \`oklch(0.769 0.188 70.08)\` (light) / \`oklch(0.645 0.246 16.439)\` (dark)
|
|
72
|
+
|
|
73
|
+
\`\`\`mdx
|
|
74
|
+
import { ChartContainer, ChartTooltip, ChartTooltipContent } from "@/components/ui/chart";
|
|
75
|
+
import { ResponsiveContainer, BarChart, Bar, CartesianGrid, XAxis, YAxis } from "recharts";
|
|
76
|
+
|
|
77
|
+
export function SalesChart() {
|
|
78
|
+
const chartData = [
|
|
79
|
+
{ month: "Jan", sales: 4000, profit: 2400 },
|
|
80
|
+
{ month: "Feb", sales: 3000, profit: 1398 },
|
|
81
|
+
{ month: "Mar", sales: 2000, profit: 9800 },
|
|
82
|
+
{ month: "Apr", sales: 2780, profit: 3908 },
|
|
83
|
+
{ month: "May", sales: 1890, profit: 4800 },
|
|
84
|
+
{ month: "Jun", sales: 2390, profit: 3800 },
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
const chartConfig = {
|
|
88
|
+
sales: {
|
|
89
|
+
label: "Sales",
|
|
90
|
+
color: "oklch(0.646 0.222 41.116)",
|
|
91
|
+
},
|
|
92
|
+
profit: {
|
|
93
|
+
label: "Profit",
|
|
94
|
+
color: "oklch(0.6 0.118 184.704)",
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<ChartContainer config={chartConfig} className="min-h-[150px] w-full">
|
|
100
|
+
<ResponsiveContainer width="100%" height="100%">
|
|
101
|
+
<BarChart data={chartData}>
|
|
102
|
+
<CartesianGrid strokeDasharray="3 3" />
|
|
103
|
+
<XAxis dataKey="month" />
|
|
104
|
+
<YAxis />
|
|
105
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
106
|
+
<Bar dataKey="sales" fill="var(--color-sales)" />
|
|
107
|
+
<Bar dataKey="profit" fill="var(--color-profit)" />
|
|
108
|
+
</BarChart>
|
|
109
|
+
</ResponsiveContainer>
|
|
110
|
+
</ChartContainer>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
\`\`\`
|
|
114
|
+
|
|
115
|
+
### Toasts
|
|
116
|
+
Use Sonner by importing \`toast\`:
|
|
117
|
+
|
|
118
|
+
\`\`\`mdx
|
|
119
|
+
import { Button } from "@/components/ui/button";
|
|
120
|
+
import { toast } from "sonner";
|
|
121
|
+
|
|
122
|
+
export function SimpleToast() {
|
|
123
|
+
const handleClick = () => {
|
|
124
|
+
toast('Event has been created');
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<Button onClick={handleClick}>Show Toast</Button>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
\`\`\`
|
|
132
|
+
</mdx_shadcn>`;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const TIPTAP_HTML_GUIDELINES = "<tiptap_html_guidelines>\n## Tiptap HTML Input Guidelines\n\n1. **Use only supported elements**\n Tiptap follows a strict ProseMirror schema. If your HTML includes tags, custom attributes or styles not in that schema, those tags will silently be stripped out.\n - **Block-level**: `<p>`, `<h1>\u2026<h6>`, `<blockquote>`, `<ul>`, `<ol>`, `<li>`, `<pre><code>`, `<hr>`\n - **Task Lists**: `<ul data-type=\"taskList\">` with `<li data-type=\"taskItem\" data-checked=\"false\"||\"true\">` containing `<input type=\"checkbox\">` and `<p>` for todo items\n - **Inline/text-level**: `<strong>`, `<em>`, `<code>`, `<a>`, `<br>`\n - **MDX Components**: `<mdx-component data-path=\"components/component-name.mdx\"></mdx-component>` for embedding interactive components\n - **Data Views**: `<database-view data-path=\"data/path.json\"></database-view>` for displaying top-level array JSON directly in HTML\n - **Excalidraw Whiteboards**: `<excalidraw data-path=\"data/diagram.json\"></excalidraw>` for embedding interactive whiteboards\n Anything outside this list (like `<div>`, `<span>`, `<img>`) will be dropped unless the corresponding extension is added.\n\n2. **Well-formed HTML only**\n - Every tag must be properly opened and closed.\n - Lists must be correctly nested: e.g. `<ul><li>Item text</li></ul>`\n - Inline tags must be inside blocks: e.g. `<p>This is <strong>bold</strong> text.</p>`\n\n3. **No stray inline elements**\n Avoid standalone inline tags or text outside blocks.\n WRONG: `<strong>bold!</strong><p>Paragraph</p>`\n CORRECT: `<p><strong>bold!</strong></p><p>Paragraph</p>`\n\n4. **Creating Task Lists (Todo Lists)**\n To create interactive todo lists, use the task list structure:\n \n ```html\n <ul data-type=\"taskList\">\n <li data-checked=\"false\" data-type=\"taskItem\">\n <input type=\"checkbox\">\n <p>Task description here</p>\n </li>\n <li data-checked=\"true\" data-type=\"taskItem\">\n <input type=\"checkbox\" checked>\n <p>Completed task</p>\n </li>\n </ul>\n ```\n \n - Use `data-checked=\"false\"` for unchecked items\n - Use `data-checked=\"true\"` and `checked` attribute for completed items\n - Each task item contains an `<input type=\"checkbox\">` and a `<p>` with the task content\n\n5. **Embedding MDX Components**\n To embed interactive components in HTML pages, use the mdx-component element:\n \n ```html\n <mdx-component data-path=\"components/component-name.mdx\"></mdx-component>\n ```\n \n * HTML pages are for content structure only - no custom app logic\n * Interactive functionality and complex data handling should live within MDX components\n\n5a. **Embedding Data Views (Top-Level Arrays Only)**\n To directly display JSON data in HTML pages (without an MDX component), use the database-view element:\n \n ```html\n <database-view data-path=\"data/path.json\"></database-view>\n ```\n \n - Works only when the JSON file's root is a top-level array (table/list-like datasets)\n - For configs, single-value objects, or nested structures, use an MDX component instead\n\n6. **Spacing Multiple Components**\n When adding multiple `<mdx-component>`, `<database-view>`, or `<excalidraw>` blocks one after another, you MUST separate them with empty paragraphs to ensure proper editor behavior:\n \n ```html\n <mdx-component data-path=\"components/component1.mdx\"></mdx-component>\n <p></p>\n <database-view data-path=\"data/list-a.json\"></database-view>\n <p></p>\n <excalidraw data-path=\"data/diagram.json\"></excalidraw>\n ```\n \n This creates editable zones where users can position their cursor and add content\n\n7. **Commenting on the document**\n When the user asks for a comment on the document, you should use one of the valid blockquote tags to wrap the comment. \n You shouldn't place them inside HTML comments for they would be stripped out.\n\n### Sample Valid HTML\n```html\n<h1>Hello World</h1>\n<p>This is a <strong>bold</strong> paragraph.</p>\n<ul>\n <li>First item</li>\n <li>Second <em>item</em></li>\n</ul>\n<blockquote>A nice quote.</blockquote>\n<pre><code>console.log('hi');</code></pre>\n<hr />\n```\n\n### Example of Invalid HTML\n```html\n<div>A div tag</div>\n<span style=\"color:red;\">Red text</span>\n<p>Some <unknown>weird</unknown> tag.</p>\n```\n</tiptap_html_guidelines>";
|
|
2
|
+
//# sourceMappingURL=tiptap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tiptap.d.ts","sourceRoot":"","sources":["../../../../src/agent/prompts/blocks/tiptap.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,u0IAmGT,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export const TIPTAP_HTML_GUIDELINES = `<tiptap_html_guidelines>
|
|
2
|
+
## Tiptap HTML Input Guidelines
|
|
3
|
+
|
|
4
|
+
1. **Use only supported elements**
|
|
5
|
+
Tiptap follows a strict ProseMirror schema. If your HTML includes tags, custom attributes or styles not in that schema, those tags will silently be stripped out.
|
|
6
|
+
- **Block-level**: \`<p>\`, \`<h1>…<h6>\`, \`<blockquote>\`, \`<ul>\`, \`<ol>\`, \`<li>\`, \`<pre><code>\`, \`<hr>\`
|
|
7
|
+
- **Task Lists**: \`<ul data-type="taskList">\` with \`<li data-type="taskItem" data-checked="false"||"true">\` containing \`<input type="checkbox">\` and \`<p>\` for todo items
|
|
8
|
+
- **Inline/text-level**: \`<strong>\`, \`<em>\`, \`<code>\`, \`<a>\`, \`<br>\`
|
|
9
|
+
- **MDX Components**: \`<mdx-component data-path="components/component-name.mdx"></mdx-component>\` for embedding interactive components
|
|
10
|
+
- **Data Views**: \`<database-view data-path="data/path.json"></database-view>\` for displaying top-level array JSON directly in HTML
|
|
11
|
+
- **Excalidraw Whiteboards**: \`<excalidraw data-path="data/diagram.json"></excalidraw>\` for embedding interactive whiteboards
|
|
12
|
+
Anything outside this list (like \`<div>\`, \`<span>\`, \`<img>\`) will be dropped unless the corresponding extension is added.
|
|
13
|
+
|
|
14
|
+
2. **Well-formed HTML only**
|
|
15
|
+
- Every tag must be properly opened and closed.
|
|
16
|
+
- Lists must be correctly nested: e.g. \`<ul><li>Item text</li></ul>\`
|
|
17
|
+
- Inline tags must be inside blocks: e.g. \`<p>This is <strong>bold</strong> text.</p>\`
|
|
18
|
+
|
|
19
|
+
3. **No stray inline elements**
|
|
20
|
+
Avoid standalone inline tags or text outside blocks.
|
|
21
|
+
WRONG: \`<strong>bold!</strong><p>Paragraph</p>\`
|
|
22
|
+
CORRECT: \`<p><strong>bold!</strong></p><p>Paragraph</p>\`
|
|
23
|
+
|
|
24
|
+
4. **Creating Task Lists (Todo Lists)**
|
|
25
|
+
To create interactive todo lists, use the task list structure:
|
|
26
|
+
|
|
27
|
+
\`\`\`html
|
|
28
|
+
<ul data-type="taskList">
|
|
29
|
+
<li data-checked="false" data-type="taskItem">
|
|
30
|
+
<input type="checkbox">
|
|
31
|
+
<p>Task description here</p>
|
|
32
|
+
</li>
|
|
33
|
+
<li data-checked="true" data-type="taskItem">
|
|
34
|
+
<input type="checkbox" checked>
|
|
35
|
+
<p>Completed task</p>
|
|
36
|
+
</li>
|
|
37
|
+
</ul>
|
|
38
|
+
\`\`\`
|
|
39
|
+
|
|
40
|
+
- Use \`data-checked="false"\` for unchecked items
|
|
41
|
+
- Use \`data-checked="true"\` and \`checked\` attribute for completed items
|
|
42
|
+
- Each task item contains an \`<input type="checkbox">\` and a \`<p>\` with the task content
|
|
43
|
+
|
|
44
|
+
5. **Embedding MDX Components**
|
|
45
|
+
To embed interactive components in HTML pages, use the mdx-component element:
|
|
46
|
+
|
|
47
|
+
\`\`\`html
|
|
48
|
+
<mdx-component data-path="components/component-name.mdx"></mdx-component>
|
|
49
|
+
\`\`\`
|
|
50
|
+
|
|
51
|
+
* HTML pages are for content structure only - no custom app logic
|
|
52
|
+
* Interactive functionality and complex data handling should live within MDX components
|
|
53
|
+
|
|
54
|
+
5a. **Embedding Data Views (Top-Level Arrays Only)**
|
|
55
|
+
To directly display JSON data in HTML pages (without an MDX component), use the database-view element:
|
|
56
|
+
|
|
57
|
+
\`\`\`html
|
|
58
|
+
<database-view data-path="data/path.json"></database-view>
|
|
59
|
+
\`\`\`
|
|
60
|
+
|
|
61
|
+
- Works only when the JSON file's root is a top-level array (table/list-like datasets)
|
|
62
|
+
- For configs, single-value objects, or nested structures, use an MDX component instead
|
|
63
|
+
|
|
64
|
+
6. **Spacing Multiple Components**
|
|
65
|
+
When adding multiple \`<mdx-component>\`, \`<database-view>\`, or \`<excalidraw>\` blocks one after another, you MUST separate them with empty paragraphs to ensure proper editor behavior:
|
|
66
|
+
|
|
67
|
+
\`\`\`html
|
|
68
|
+
<mdx-component data-path="components/component1.mdx"></mdx-component>
|
|
69
|
+
<p></p>
|
|
70
|
+
<database-view data-path="data/list-a.json"></database-view>
|
|
71
|
+
<p></p>
|
|
72
|
+
<excalidraw data-path="data/diagram.json"></excalidraw>
|
|
73
|
+
\`\`\`
|
|
74
|
+
|
|
75
|
+
This creates editable zones where users can position their cursor and add content
|
|
76
|
+
|
|
77
|
+
7. **Commenting on the document**
|
|
78
|
+
When the user asks for a comment on the document, you should use one of the valid blockquote tags to wrap the comment.
|
|
79
|
+
You shouldn't place them inside HTML comments for they would be stripped out.
|
|
80
|
+
|
|
81
|
+
### Sample Valid HTML
|
|
82
|
+
\`\`\`html
|
|
83
|
+
<h1>Hello World</h1>
|
|
84
|
+
<p>This is a <strong>bold</strong> paragraph.</p>
|
|
85
|
+
<ul>
|
|
86
|
+
<li>First item</li>
|
|
87
|
+
<li>Second <em>item</em></li>
|
|
88
|
+
</ul>
|
|
89
|
+
<blockquote>A nice quote.</blockquote>
|
|
90
|
+
<pre><code>console.log('hi');</code></pre>
|
|
91
|
+
<hr />
|
|
92
|
+
\`\`\`
|
|
93
|
+
|
|
94
|
+
### Example of Invalid HTML
|
|
95
|
+
\`\`\`html
|
|
96
|
+
<div>A div tag</div>
|
|
97
|
+
<span style="color:red;">Red text</span>
|
|
98
|
+
<p>Some <unknown>weird</unknown> tag.</p>
|
|
99
|
+
\`\`\`
|
|
100
|
+
</tiptap_html_guidelines>`;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { TIPTAP_HTML_GUIDELINES } from "./blocks/tiptap.js";
|
|
2
|
+
export { DATA_GUIDELINES } from "./blocks/data.js";
|
|
3
|
+
export { EXCALIDRAW_GUIDELINES } from "./blocks/excalidraw.js";
|
|
4
|
+
export { FILE_HANDLING_INSTRUCTIONS } from "./blocks/file_handling.js";
|
|
5
|
+
export { MDX_GUIDELINES } from "./blocks/mdx/mdx.js";
|
|
6
|
+
export { STATIC_AGENT_INSTRUCT, DYNAMIC_AGENT_INSTRUCT } from "./agent.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agent/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { TIPTAP_HTML_GUIDELINES } from "./blocks/tiptap.js";
|
|
2
|
+
export { DATA_GUIDELINES } from "./blocks/data.js";
|
|
3
|
+
export { EXCALIDRAW_GUIDELINES } from "./blocks/excalidraw.js";
|
|
4
|
+
export { FILE_HANDLING_INSTRUCTIONS } from "./blocks/file_handling.js";
|
|
5
|
+
export { MDX_GUIDELINES } from "./blocks/mdx/mdx.js";
|
|
6
|
+
export { STATIC_AGENT_INSTRUCT, DYNAMIC_AGENT_INSTRUCT } from "./agent.js";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const GIT_EXPLO_INSTRUCTIONS: (repositoryContent: string, isUpdate?: boolean) => string;
|
|
2
|
+
export declare const HUMAN_MESSAGE = "A repository has been analyzed. Please create concise, VISUAL, EDUCATIONAL documentation that teaches and explains this repository in the workspace.\n \n Follow the github_exploration_instructions carefully.";
|
|
3
|
+
//# sourceMappingURL=repo_instructions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo_instructions.d.ts","sourceRoot":"","sources":["../../../src/agent/prompts/repo_instructions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,GACjC,mBAAmB,MAAM,EACzB,WAAU,OAAe,WAub1B,CAAC;AAEF,eAAO,MAAM,aAAa,oNAE6B,CAAC"}
|