Skip to content

feat(core): add include/exclude options to catalog.prompt()#278

Open
ericjypark wants to merge 1 commit intovercel-labs:mainfrom
ericjypark:feat/prompt-include-exclude-271
Open

feat(core): add include/exclude options to catalog.prompt()#278
ericjypark wants to merge 1 commit intovercel-labs:mainfrom
ericjypark:feat/prompt-include-exclude-271

Conversation

@ericjypark
Copy link
Copy Markdown

PromptOptions doesn't currently expose a way to scope which components get documented in the generated prompt — the workaround in the issue is maintaining multiple sub-catalogs and swapping at the call site.

This adds include and exclude to PromptOptions. The filter applies to the streaming example, the AVAILABLE COMPONENTS list, and the componentNames passed to custom promptTemplates, so the resulting prompt stays internally consistent.

Changes

  • include?: string[] and exclude?: string[] on PromptOptions
  • include wins when both are set
  • Unknown names log a console.warn and are ignored (no hard error)
  • Catalog declaration order is preserved
  • Custom promptTemplate receives the filtered componentNames
  • No behavior change when neither option is set

Example

catalog.prompt({ include: ["Card", "Metric", "BarChart"] });

Only Card, Metric, and BarChart appear in the AVAILABLE COMPONENTS list and the streaming example.

Test plan

  • pnpm vitest run packages/core/src/schema.test.ts (51/51, 8 new)
  • pnpm test (930/930)
  • pnpm lint

Fixes #271

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 28, 2026

Someone is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

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.

feat: Filter components in catalog.prompt() via PromptOptions

1 participant