Skip to content

generateCatalogPrompt isn't working properly #37

@finom

Description

@finom

Having the catalog copied from README

import { createCatalog } from '@json-render/core';
import { z } from 'zod';

export const catalog = createCatalog({
  components: {
    Card: {
      props: z.object({ title: z.string() }),
      hasChildren: true,
    },
    Metric: {
      props: z.object({
        label: z.string(),
        valuePath: z.string(),      // Binds to your data
        format: z.enum(['currency', 'percent', 'number']),
      }),
    },
    Button: {
      props: z.object({
        label: z.string(),
        // action: ActionSchema,        // AI declares intent, you handle it
      }),
    },
  },
  actions: {
    export_report: { description: 'Export dashboard to PDF' },
    refresh_data: { description: 'Refresh all metrics' },
  },
});

And running

const systemPrompt = generateCatalogPrompt(catalog);

console.log('systemPrompt:', systemPrompt);

I get the following prompt:

## Available Components

### Card

### Metric

### Button

## Available Actions

- `export_report`: Export dashboard to PDF
- `refresh_data`: Refresh all metrics

## Visibility Conditions

Components can have a `visible` property:
- `true` / `false` - Always visible/hidden
- `{ "path": "/data/path" }` - Visible when path is truthy
- `{ "auth": "signedIn" }` - Visible when user is signed in
- `{ "and": [...] }` - All conditions must be true
- `{ "or": [...] }` - Any condition must be true
- `{ "not": {...} }` - Negates a condition
- `{ "eq": [a, b] }` - Equality check

## Validation Functions

Built-in: `required`, `email`, `minLength`, `maxLength`, `pattern`, `min`, `max`, `url`

P. S. I've noticed that the dashboard example from this repository has hard-coded system prompt, the website documentation doesn't match the implementation and README details, examples aren't TypeScript ready, etc. What's the status of this project and what's the roadmap?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions