From 1c989f91551bbc819af8ce432edadfff95bb5bf9 Mon Sep 17 00:00:00 2001 From: shadcn Date: Sat, 17 Jan 2026 18:40:11 +0400 Subject: [PATCH] feat: inline component list on components page (#9368) Co-authored-by: Claude Opus 4.5 --- apps/v4/lib/llm.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/apps/v4/lib/llm.ts b/apps/v4/lib/llm.ts index 28ce4fe5a1..4d3a382b42 100644 --- a/apps/v4/lib/llm.ts +++ b/apps/v4/lib/llm.ts @@ -1,9 +1,32 @@ import fs from "fs" +import { source } from "@/lib/source" import { Index } from "@/registry/__index__" import { type Style } from "@/registry/_legacy-styles" +function getComponentsList() { + const components = source.pageTree.children.find( + (page) => page.$id === "components" + ) + + if (components?.type !== "folder") { + return "" + } + + const list = components.children.filter( + (component) => component.type === "page" + ) + + return list + .map((component) => `- [${component.name}](${component.url})`) + .join("\n") +} + export function processMdxForLLMs(content: string, style: Style["name"]) { + // Replace with a markdown list of components. + const componentsListRegex = //g + content = content.replace(componentsListRegex, getComponentsList()) + const componentPreviewRegex = //g