From bc8063c56350acddb40ff65c8e9174642e26c72a Mon Sep 17 00:00:00 2001 From: vishnu <68802992+vishnumallela@users.noreply.github.com> Date: Sat, 17 Jan 2026 22:53:19 -0600 Subject: [PATCH 1/2] Add JSONL output format instructions function - added output format instructions for the base catalog prompt. --- packages/core/src/catalog.ts | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/packages/core/src/catalog.ts b/packages/core/src/catalog.ts index 5212a85..c35ae10 100644 --- a/packages/core/src/catalog.ts +++ b/packages/core/src/catalog.ts @@ -222,6 +222,37 @@ export function createCatalog< }; } + + +/** + * Generate JSONL output format instructions + */ +export function generateOutputFormatInstructions(): string { + return `## Output Format + +Wrap your JSONL output in a code block: +\`\`\`jsonl +{"op":"set","path":"/root","value":"root-key"} +{"op":"add","path":"/elements/key","value":{"key":"...","type":"...","props":{...},"children":[...]}} +\`\`\` + +No text before or after - ONLY the wrapped JSONL. + +### Rules +1. First line sets /root to root element key +2. Add elements with /elements/{key} +3. Children array contains string keys, not objects +4. Parent first, then children +5. Each element needs: key, type, props + +### Example +\`\`\`jsonl +{"op":"set","path":"/root","value":"main"} +{"op":"add","path":"/elements/main","value":{"key":"main","type":"Card","props":{"title":"Hello"},"children":[]}} +\`\`\` +`; +} + /** * Generate a prompt for AI that describes the catalog */ @@ -284,7 +315,7 @@ export function generateCatalogPrompt< } lines.push(""); - return lines.join("\n"); + return lines.join("\n") + generateOuputFormatInstructions(); } /** @@ -295,3 +326,4 @@ export type InferCatalogComponentProps< > = { [K in keyof C["components"]]: z.infer; }; + From def8b52990edcb24cc9233d509f70d6f8eb1083a Mon Sep 17 00:00:00 2001 From: vishnu <68802992+vishnumallela@users.noreply.github.com> Date: Sat, 17 Jan 2026 22:56:27 -0600 Subject: [PATCH 2/2] Fix typo in function name for output instructions --- packages/core/src/catalog.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/catalog.ts b/packages/core/src/catalog.ts index c35ae10..0124ecf 100644 --- a/packages/core/src/catalog.ts +++ b/packages/core/src/catalog.ts @@ -315,7 +315,7 @@ export function generateCatalogPrompt< } lines.push(""); - return lines.join("\n") + generateOuputFormatInstructions(); + return lines.join("\n") + generateOutputFormatInstructions(); } /**