@dowel-ui/registry 0.5.0 → 0.8.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/dist/build.d.ts +32 -4
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +2680 -343
- package/dist/build.js.map +1 -1
- package/dist/generate.d.ts +71 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +550 -0
- package/dist/generate.js.map +1 -0
- package/dist/index.d.ts +184 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +651 -2
- package/dist/index.js.map +1 -0
- package/dist/{schema-ByqIpT47.js → schema-BbyNjH6Q.js} +25 -5
- package/dist/schema-BbyNjH6Q.js.map +1 -0
- package/dist/{schema-Cc32v3R-.d.ts → schema-BmYeKe9e.d.ts} +36 -2
- package/dist/schema-BmYeKe9e.d.ts.map +1 -0
- package/package.json +12 -4
- package/src/agent-docs.ts +547 -0
- package/src/build.ts +66 -4
- package/src/custom.ts +312 -0
- package/src/generate.ts +609 -0
- package/src/index.ts +41 -0
- package/src/schema.ts +23 -0
- package/dist/schema-ByqIpT47.js.map +0 -1
- package/dist/schema-Cc32v3R-.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","names":[],"sources":["../src/generate.ts"],"sourcesContent":["import type { RegistryIndex, RegistryIndexEntry } from \"./schema\";\n\nexport type { RegistryIndex, RegistryIndexEntry } from \"./schema\";\n\n/**\n * Turning a description of a screen into a plan made of components that exist.\n *\n * The hard part of generating UI is not writing JSX. It is not inventing: a\n * model asked for a billing page will cheerfully produce `<PricingTable>` and\n * `<InvoiceList>` and a `variant=\"subtle\"` that was never implemented, and the\n * result reads perfectly and compiles nowhere.\n *\n * So this resolves a prompt against the registry first, and everything it\n * emits afterwards is drawn from what came back. It cannot name a component\n * that is not installable, because it only ever repeats names the registry\n * gave it.\n *\n * It does not guess at props. The registry publishes what a component *is* and\n * what it depends on, not the shape of its arguments, so the output stops at\n * the composition and points at the page where the props are documented.\n * Emitting a plausible prop is worse than emitting none — one is a gap, the\n * other is a bug that looks like working code.\n */\n\n/** Words that carry no signal about which component is wanted. */\nconst STOPWORDS = new Set([\n \"a\",\n \"an\",\n \"the\",\n \"and\",\n \"or\",\n \"of\",\n \"for\",\n \"with\",\n \"to\",\n \"in\",\n \"on\",\n \"at\",\n \"by\",\n \"is\",\n \"are\",\n \"be\",\n \"make\",\n \"build\",\n \"create\",\n \"want\",\n \"need\",\n \"add\",\n \"show\",\n \"page\",\n \"screen\",\n \"app\",\n \"application\",\n \"ui\",\n \"interface\",\n \"component\",\n \"components\",\n \"me\",\n \"my\",\n \"our\",\n \"i\",\n \"it\",\n \"that\",\n \"this\",\n \"some\",\n \"using\",\n \"use\",\n \"like\",\n]);\n\n/**\n * Words a reader would use that are not the words the registry uses.\n *\n * Hand-written, and deliberately so. \"Sign in\" is what someone types and\n * `login` is what the item is called; no amount of string similarity bridges\n * that, and pretending otherwise produces a matcher that works on the examples\n * it was tuned against and nothing else.\n */\nconst SYNONYMS: Record<string, string[]> = {\n \"sign in\": [\"login\"],\n signin: [\"login\"],\n \"log in\": [\"login\"],\n \"sign up\": [\"signup\"],\n register: [\"signup\"],\n registration: [\"signup\"],\n \"forgot password\": [\"forgot-password\"],\n \"reset password\": [\"forgot-password\"],\n chat: [\"ai-chat\", \"ai-conversation\", \"ai-prompt-input\"],\n conversation: [\"ai-chat\"],\n assistant: [\"ai-chat\"],\n copilot: [\"ai-chat\"],\n agent: [\"agent-console\", \"ai-agent-status\", \"ai-agent-plan\"],\n agents: [\"agent-console\"],\n tool: [\"ai-tool\"],\n approval: [\"ai-approval-request\"],\n approve: [\"ai-approval-request\"],\n undo: [\"ai-action-ledger\"],\n audit: [\"ai-action-ledger\", \"activity-feed\"],\n tokens: [\"ai-token-usage\"],\n spend: [\"ai-dashboard\", \"billing\"],\n cost: [\"ai-dashboard\", \"billing\"],\n usage: [\"ai-dashboard\", \"billing\"],\n subscription: [\"billing\", \"pricing\"],\n invoice: [\"billing\"],\n invoices: [\"billing\"],\n payment: [\"billing\"],\n plan: [\"pricing\", \"billing\"],\n plans: [\"pricing\", \"pricing-three-tier\", \"pricing-two-tier\", \"pricing-single-plan\"],\n metrics: [\"analytics\", \"dashboard\", \"metric-delta\"],\n chart: [\"analytics\", \"dither-bar\", \"dither-line\", \"dither-area\", \"dither-donut\"],\n charts: [\n \"analytics\",\n \"dither-canvas\",\n \"dither-bar\",\n \"dither-line\",\n \"dither-area\",\n \"dither-donut\",\n \"dither-heatmap\",\n ],\n graph: [\"analytics\", \"dither-line\", \"dither-area\", \"contribution-graph\"],\n stats: [\"dashboard\", \"analytics\", \"stats-grid\", \"stats-trend-cards\"],\n overview: [\"dashboard\"],\n grid: [\"data-table\", \"table\"],\n spreadsheet: [\"data-table\"],\n list: [\"table\", \"data-table\"],\n search: [\"command\", \"combobox\", \"expanding-search\", \"faq-searchable\"],\n palette: [\"command\", \"palette-generator\"],\n shortcut: [\"command\", \"shortcut-recorder\"],\n modal: [\"dialog\"],\n popup: [\"dialog\", \"popover\"],\n dropdown: [\"dropdown-menu\", \"select\"],\n toast: [\"toast\"],\n notification: [\"toast\", \"activity-feed\", \"notification-badge\", \"notify-button\"],\n notifications: [\"toast\", \"settings\"],\n upload: [\"file-upload\"],\n file: [\"file-upload\"],\n date: [\"date-picker\", \"calendar\"],\n time: [\"time-range-picker\"],\n schedule: [\"cron-editor\"],\n cron: [\"cron-editor\"],\n team: [\"admin-users\", \"settings\", \"team-grid\", \"team-carousel\"],\n members: [\"admin-users\"],\n users: [\"admin-users\"],\n admin: [\"admin-users\"],\n permissions: [\"permission-matrix\"],\n roles: [\"permission-matrix\"],\n profile: [\"settings\"],\n preferences: [\"settings\"],\n account: [\"settings\", \"billing\"],\n setup: [\"onboarding\"],\n checklist: [\"onboarding\", \"animated-checklist\", \"todo-tower\"],\n wizard: [\"onboarding\", \"stepper\"],\n logs: [\"log-viewer\"],\n log: [\"log-viewer\"],\n diff: [\"diff-viewer\", \"record-diff\"],\n secret: [\"secret-field\"],\n \"api key\": [\"secret-field\"],\n key: [\"secret-field\"],\n dns: [\"dns-record\"],\n loader: [\n \"spinner\",\n \"dots-loader\",\n \"ring-loader\",\n \"bar-loader\",\n \"shape-loader\",\n \"text-loader\",\n \"grid-loader\",\n \"ai-loader\",\n ],\n loaders: [\n \"dots-loader\",\n \"ring-loader\",\n \"bar-loader\",\n \"shape-loader\",\n \"text-loader\",\n \"grid-loader\",\n ],\n loading: [\"spinner\", \"dots-loader\", \"ring-loader\", \"bar-loader\", \"skeleton\", \"text-loader\"],\n spinner: [\"spinner\", \"ring-loader\"],\n animation: [\"text-effect\", \"text-swap\", \"shader-transition\"],\n animated: [\"text-effect\", \"morph-button\", \"effect-button\", \"number-flow\"],\n \"text animation\": [\n \"text-effect\",\n \"text-swap\",\n \"shimmer-text\",\n \"scramble-text\",\n \"typewriter-text\",\n ],\n typewriter: [\"typewriter-text\"],\n shimmer: [\"shimmer-text\", \"skeleton\"],\n counter: [\"number-flow\", \"drag-stepper\"],\n price: [\"number-flow\", \"pricing\"],\n carousel: [\n \"carousel-3d\",\n \"swipe-carousel\",\n \"reviews-carousel\",\n \"invite-carousel\",\n \"time-stack\",\n ],\n slider: [\"slider\", \"exposure-slider\", \"slosh-slider\", \"scrubber\", \"range-dial\"],\n slideshow: [\"carousel-3d\", \"swipe-carousel\", \"photo-stack\"],\n marquee: [\"marquee\", \"logo-marquee\"],\n ticker: [\"marquee\"],\n cards: [\"card\", \"card-spread\", \"card-stack\", \"glow-card\", \"tilt-card\", \"expandable-cards\"],\n hero: [\n \"hero-grid\",\n \"hero-product\",\n \"hero-split-image\",\n \"hero-perspective-grid\",\n \"hero-spotlight\",\n \"hero-minimal\",\n ],\n landing: [\"hero-grid\", \"features-bento\", \"cta-centered\", \"footer-newsletter\"],\n cta: [\"cta-centered\", \"cta-split-image\", \"cta-banner\"],\n \"call to action\": [\"cta-centered\", \"cta-split-image\", \"cta-banner\"],\n features: [\"features-icon-grid\", \"features-bento\", \"features-alternating\"],\n logos: [\"logo-cloud-simple\", \"logo-marquee\", \"logo-links-marquee\", \"logo-grid-tooltips\"],\n testimonials: [\n \"testimonial-rotator\",\n \"testimonial-spotlight\",\n \"testimonial-star-grid\",\n \"reviews-carousel\",\n ],\n reviews: [\"reviews-carousel\", \"testimonial-star-grid\"],\n faq: [\"faq-accordion\", \"faq-searchable\", \"faq-categorized\", \"faq-tabbed-grid\"],\n footer: [\"footer-simple\", \"footer-newsletter\", \"footer-mega\", \"footer-minimal\"],\n newsletter: [\"footer-newsletter\", \"footer-mega\"],\n heatmap: [\"dither-heatmap\", \"contribution-graph\"],\n donut: [\"dither-donut\"],\n pie: [\"dither-donut\"],\n gauge: [\"dither-gauge\", \"meter\"],\n funnel: [\"dither-funnel\"],\n uptime: [\"uptime-matrix\"],\n \"status page\": [\"uptime-matrix\"],\n otp: [\"otp-input\"],\n \"one-time code\": [\"otp-input\"],\n \"verification code\": [\"otp-input\"],\n steps: [\"stepper\"],\n \"context menu\": [\"context-menu\"],\n \"right click\": [\"context-menu\"],\n reorder: [\"reorder-list\", \"browser-tabs\"],\n sortable: [\"reorder-list\"],\n drag: [\"reorder-list\", \"goo-ball\", \"swipe-carousel\"],\n dock: [\"magnify-dock\"],\n toolbar: [\"canvas-toolbar\", \"magnify-dock\"],\n confirm: [\"slide-to-confirm\", \"inline-confirm\", \"confirm-typed\"],\n delete: [\"inline-confirm\", \"confirm-typed\"],\n toggle: [\"switch\", \"liquid-toggle\"],\n copy: [\"copy-button\"],\n clipboard: [\"copy-button\"],\n refresh: [\"pull-to-refresh\"],\n music: [\"now-playing\"],\n player: [\"now-playing\"],\n orb: [\"gradient-orb\", \"orb-face\"],\n transition: [\"shader-transition\", \"text-swap\"],\n badge: [\"badge\", \"notification-badge\"],\n avatar: [\"avatar\", \"avatar-group\", \"pixel-avatar\"],\n tweet: [\"tweet-card\"],\n dial: [\"dial\", \"range-dial\"],\n knob: [\"dial\"],\n};\n\nexport interface PlanEntry {\n entry: RegistryIndexEntry;\n /** Why this was chosen, in words, so a wrong pick is arguable. */\n because: string;\n}\n\nexport interface UiPlan {\n /** The prompt, as given. */\n prompt: string;\n /** Whole sections, which bring their own components. */\n blocks: PlanEntry[];\n /** Individual components, none of which a chosen block already installs. */\n components: PlanEntry[];\n /** Everything to install, in one list. */\n install: string[];\n /** True when nothing matched, so callers can say so rather than emit nothing. */\n empty: boolean;\n}\n\nfunction normalise(prompt: string): string {\n return prompt.toLowerCase().replace(/[^a-z0-9\\s-]/g, \" \");\n}\n\nfunction words(prompt: string): string[] {\n return normalise(prompt)\n .split(/\\s+/)\n .filter((word) => word.length > 2 && !STOPWORDS.has(word));\n}\n\ninterface SynonymMatch {\n /** Item name to the phrase that selected it. */\n hits: Map<string, string>;\n /**\n * Words the table has already spoken for.\n *\n * Excluded from generic term matching afterwards. The table exists to say\n * that \"plan\" means pricing or billing; letting the generic matcher also\n * score every item with \"plan\" in its name puts `ai-agent-plan` on a billing\n * page and re-introduces exactly the ambiguity the table resolves.\n */\n consumed: Set<string>;\n}\n\nfunction synonymHits(prompt: string): SynonymMatch {\n const text = normalise(prompt);\n const hits = new Map<string, string>();\n const consumed = new Set<string>();\n\n for (const [phrase, names] of Object.entries(SYNONYMS)) {\n // Word-boundary matched, so \"keyboard\" does not trigger \"key\".\n const pattern = new RegExp(`(^|\\\\s)${phrase.replace(/\\s+/g, \"\\\\s+\")}(\\\\s|$)`);\n if (!pattern.test(text)) continue;\n\n for (const word of phrase.split(/\\s+/)) consumed.add(word);\n for (const name of names) {\n if (!hits.has(name)) hits.set(name, phrase);\n }\n }\n\n return { hits, consumed };\n}\n\n/** Below this a match is coincidence rather than intent. */\nconst MINIMUM_SCORE = 20;\n\ninterface Scored {\n entry: RegistryIndexEntry;\n /** What the prompt actually matched. Decides whether it qualifies at all. */\n score: number;\n /** Score plus the block preference. Decides order only. */\n rank: number;\n because: string;\n}\n\nfunction scoreEntry(\n entry: RegistryIndexEntry,\n terms: string[],\n synonyms: Map<string, string>,\n): Scored | undefined {\n const name = entry.name.toLowerCase();\n const title = entry.title.toLowerCase();\n const description = entry.description.toLowerCase();\n\n let score = 0;\n const reasons: string[] = [];\n\n const synonym = synonyms.get(entry.name);\n if (synonym) {\n score += 60;\n reasons.push(`\"${synonym}\"`);\n }\n\n for (const term of terms) {\n if (name === term) {\n score += 50;\n reasons.push(`named \"${term}\"`);\n } else if (name.split(\"-\").includes(term)) {\n score += 30;\n reasons.push(`\"${term}\" in its name`);\n } else if (title.includes(term)) {\n score += 20;\n reasons.push(`\"${term}\" in its title`);\n } else if (entry.category === term) {\n score += 12;\n reasons.push(`the ${term} category`);\n } else if (description.includes(term)) {\n score += 8;\n reasons.push(`\"${term}\" in its description`);\n }\n }\n\n if (score === 0) return undefined;\n\n // A block covers more of an intent than a component does, and installing one\n // brings the components anyway — so where both match, the block is the better\n // answer rather than merely an equal one.\n //\n // Kept out of `score` on purpose. Added there it would lift a block over the\n // qualifying floor on a description-only brush, which is how `ai-dashboard`\n // ended up recommended for an agent console because its prose contains the\n // word \"run\". A preference should order real matches, not manufacture one.\n const rank = score + (entry.type === \"registry:block\" ? 25 : 0);\n\n return { entry, score, rank, because: [...new Set(reasons)].slice(0, 3).join(\", \") };\n}\n\nexport interface PlanOptions {\n /** How many components to suggest beyond the blocks. */\n maxComponents?: number;\n /** How many blocks to suggest. */\n maxBlocks?: number;\n}\n\nexport function planUi(\n prompt: string,\n index: RegistryIndex,\n options: PlanOptions = {},\n): UiPlan {\n const { maxBlocks = 3, maxComponents = 6 } = options;\n\n const { hits: synonyms, consumed } = synonymHits(prompt);\n const terms = words(prompt).filter((term) => !consumed.has(term));\n\n const scored = index.items\n .filter((entry) => entry.type === \"registry:ui\" || entry.type === \"registry:block\")\n .map((entry) => scoreEntry(entry, terms, synonyms))\n .filter((candidate): candidate is Scored => candidate !== undefined)\n // A description-only brush (8) or a bare category hit (12) is not enough on\n // its own. Suggesting six components because the prompt shares a common\n // word with their prose makes the plan look like more work than it is, and\n // buries the ones that actually matched.\n .filter((candidate) => candidate.score >= MINIMUM_SCORE)\n .sort((a, b) => b.rank - a.rank || a.entry.name.localeCompare(b.entry.name));\n\n const blocks = scored\n .filter((candidate) => candidate.entry.type === \"registry:block\")\n .slice(0, maxBlocks);\n\n // Anything a chosen block already installs is not a separate suggestion:\n // listing Button beside a Dashboard that brings it is noise that makes the\n // plan look longer than the work.\n const covered = new Set(\n blocks.flatMap((candidate) => [\n candidate.entry.name,\n ...candidate.entry.registryDependencies,\n ]),\n );\n\n const components = scored\n .filter(\n (candidate) =>\n candidate.entry.type === \"registry:ui\" && !covered.has(candidate.entry.name),\n )\n .slice(0, maxComponents);\n\n const toEntry = (candidate: Scored): PlanEntry => ({\n entry: candidate.entry,\n because: candidate.because,\n });\n\n return {\n prompt,\n blocks: blocks.map(toEntry),\n components: components.map(toEntry),\n install: [...blocks, ...components].map((candidate) => candidate.entry.name),\n empty: blocks.length === 0 && components.length === 0,\n };\n}\n\n/** PascalCase export name for a registry name, e.g. \"ai-tool\" -> \"AiTool\". */\nfunction tag(name: string): string {\n return name\n .split(\"-\")\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\"\");\n}\n\n/** Blocks export a `…Block` component; components export their own name. */\nfunction componentName(entry: RegistryIndexEntry): string {\n const base = tag(entry.name);\n return entry.type === \"registry:block\" ? `${base}Block` : base;\n}\n\nexport interface RenderOptions {\n /** Where components are imported from in the target project. */\n importFrom?: string;\n /**\n * Where blocks are imported from.\n *\n * Separate because blocks are not exported from the component package at\n * all — they are only ever installed as source — so deriving their path from\n * a package specifier produces an import that does not exist. Derived from\n * `importFrom` when it is a project alias, and otherwise the conventional\n * install location.\n */\n blocksImportFrom?: string;\n cliPackage?: string;\n docsUrl?: string;\n}\n\n/**\n * Where an installed block lives.\n *\n * A project alias like `@/components/ui` has a sibling `@/components/blocks`. A\n * bare package specifier has no block path at all, so the conventional install\n * location is used instead of inventing one under the package.\n */\nexport function blocksPathFor(importFrom: string): string {\n if (importFrom.endsWith(\"/ui\")) return `${importFrom.slice(0, -3)}/blocks`;\n if (importFrom.startsWith(\"@/\") || importFrom.startsWith(\"~/\")) {\n return `${importFrom}/blocks`;\n }\n return \"@/components/blocks\";\n}\n\n/**\n * The plan as a starting file.\n *\n * Imports and composition only. Every element carries the page its props are\n * documented on, because the registry does not publish prop shapes and a\n * plausible invented prop is worse than an obvious gap — one is a TODO, the\n * other is a bug wearing the costume of working code.\n */\nexport function renderPlan(plan: UiPlan, options: RenderOptions = {}): string {\n const {\n importFrom = \"@/components/ui\",\n docsUrl = \"https://dowel-eight.vercel.app\",\n blocksImportFrom = blocksPathFor(importFrom),\n } = options;\n\n if (plan.empty) {\n return `// Nothing in the registry matched \"${plan.prompt}\".\\n`;\n }\n\n const chosen = [...plan.blocks, ...plan.components];\n\n const imports = chosen\n .map((item) => {\n const from =\n item.entry.type === \"registry:block\"\n ? `${blocksImportFrom}/${item.entry.name}`\n : `${importFrom}/${item.entry.name}`;\n return `import { ${componentName(item.entry)} } from \"${from}\";`;\n })\n .sort();\n\n const body = chosen\n .map((item) => {\n const name = componentName(item.entry);\n return [\n ` {/* ${item.entry.title} — props: ${docsUrl}/docs/${\n item.entry.type === \"registry:block\" ? \"blocks\" : \"components\"\n }/${item.entry.name} */}`,\n ` <${name} />`,\n ].join(\"\\n\");\n })\n .join(\"\\n\\n\");\n\n return `${imports.join(\"\\n\")}\n\nexport default function Page() {\n return (\n <div className=\"flex flex-col gap-6\">\n${body}\n </div>\n );\n}\n`;\n}\n\n/**\n * The plan as a brief for a coding agent.\n *\n * The most useful thing this can produce. The agent has the project, the\n * editor and the ability to write the props; what it lacks is the knowledge\n * that these components exist and that it must not invent others. That is\n * exactly what a grounded plan supplies.\n */\nexport function renderBrief(plan: UiPlan, options: RenderOptions = {}): string {\n const {\n cliPackage = \"@dowel-ui/cli\",\n docsUrl = \"https://dowel-eight.vercel.app\",\n importFrom = \"@/components/ui\",\n } = options;\n\n if (plan.empty) {\n return `Nothing in the registry matched \"${plan.prompt}\". Search the catalogue at ${docsUrl}/docs/components before building anything by hand.`;\n }\n\n const lines = [\n `Build: ${plan.prompt}`,\n \"\",\n \"Use these, which are already in the registry. Do not write your own versions,\",\n \"and do not use any component not listed here without checking the catalogue first.\",\n \"\",\n ];\n\n if (plan.blocks.length > 0) {\n lines.push(\"Blocks (whole sections — each installs its own components):\");\n for (const item of plan.blocks) {\n lines.push(`- ${item.entry.name} — ${item.entry.description}`);\n }\n lines.push(\"\");\n }\n\n if (plan.components.length > 0) {\n lines.push(\"Components:\");\n for (const item of plan.components) {\n lines.push(`- ${item.entry.name} — ${item.entry.description}`);\n }\n lines.push(\"\");\n }\n\n lines.push(\n \"Install first:\",\n \"\",\n ` npx ${cliPackage} add ${plan.install.join(\" \")}`,\n \"\",\n `Import from \\`${importFrom}\\`. Each component's props are on its page under`,\n `${docsUrl}/docs/components — read the page rather than guessing a prop name.`,\n \"\",\n \"Style with semantic tokens only (bg-background, text-muted-foreground). Never raw\",\n \"hex, never Tailwind's own palette — those do not follow the theme.\",\n );\n\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyBA,MAAM,4BAAY,IAAI,IAAI;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;;;;;AAUD,MAAM,WAAqC;CACzC,WAAW,CAAC,OAAO;CACnB,QAAQ,CAAC,OAAO;CAChB,UAAU,CAAC,OAAO;CAClB,WAAW,CAAC,QAAQ;CACpB,UAAU,CAAC,QAAQ;CACnB,cAAc,CAAC,QAAQ;CACvB,mBAAmB,CAAC,iBAAiB;CACrC,kBAAkB,CAAC,iBAAiB;CACpC,MAAM;EA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AAK,QACtB,MAAM,KAAK,KAAK,KAAK,MAAM,KAAK,KAAK,KAAK,MAAM,aAAa;EAE/D,MAAM,KAAK,EAAE;CACf;CAEA,IAAI,KAAK,WAAW,SAAS,GAAG;EAC9B,MAAM,KAAK,aAAa;EACxB,KAAK,MAAM,QAAQ,KAAK,YACtB,MAAM,KAAK,KAAK,KAAK,MAAM,KAAK,KAAK,KAAK,MAAM,aAAa;EAE/D,MAAM,KAAK,EAAE;CACf;CAEA,MAAM,KACJ,kBACA,IACA,WAAW,WAAW,OAAO,KAAK,QAAQ,KAAK,GAAG,KAClD,IACA,iBAAiB,WAAW,mDAC5B,GAAG,QAAQ,qEACX,IACA,qFACA,oEACF;CAEA,OAAO,MAAM,KAAK,IAAI;AACxB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,186 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as RegistryIndex, c as RegistryItemType, d as registryFileTypeSchema, f as registryIndexEntrySchema, h as registryItemTypeSchema, i as RegistryFileType, l as registryAccessSchema, m as registryItemSchema, n as RegistryAccess, o as RegistryIndexEntry, p as registryIndexSchema, r as RegistryFile, s as RegistryItem, t as REGISTRY_VERSION, u as registryFileSchema } from "./schema-BmYeKe9e.js";
|
|
2
|
+
import { PlanEntry, PlanOptions, RenderOptions, UiPlan, blocksPathFor, planUi, renderBrief, renderPlan } from "./generate.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/custom.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Building a registry of your own components.
|
|
7
|
+
*
|
|
8
|
+
* The CLI has always been able to install from any registry — `--registry`
|
|
9
|
+
* takes a URL or a directory — but producing one meant reimplementing this
|
|
10
|
+
* package. So an organisation that wanted its own components installed the same
|
|
11
|
+
* way had the consumer half and none of the producer half.
|
|
12
|
+
*
|
|
13
|
+
* The authoring shape is declared here rather than imported from the component
|
|
14
|
+
* package, because the registry *is* the contract. A team publishing their own
|
|
15
|
+
* components should not have to depend on somebody else's component library to
|
|
16
|
+
* describe their own.
|
|
17
|
+
*/
|
|
18
|
+
/** Where an item's files are written in the consuming project. */
|
|
19
|
+
declare const itemGroupSchema: z.ZodEnum<{
|
|
20
|
+
ui: "ui";
|
|
21
|
+
blocks: "blocks";
|
|
22
|
+
lib: "lib";
|
|
23
|
+
hooks: "hooks";
|
|
24
|
+
}>;
|
|
25
|
+
type ItemGroup = z.infer<typeof itemGroupSchema>;
|
|
26
|
+
declare const itemSourceSchema: z.ZodObject<{
|
|
27
|
+
name: z.ZodString;
|
|
28
|
+
title: z.ZodString;
|
|
29
|
+
description: z.ZodString;
|
|
30
|
+
category: z.ZodString;
|
|
31
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
32
|
+
stable: "stable";
|
|
33
|
+
beta: "beta";
|
|
34
|
+
experimental: "experimental";
|
|
35
|
+
}>>;
|
|
36
|
+
group: z.ZodDefault<z.ZodEnum<{
|
|
37
|
+
ui: "ui";
|
|
38
|
+
blocks: "blocks";
|
|
39
|
+
lib: "lib";
|
|
40
|
+
hooks: "hooks";
|
|
41
|
+
}>>;
|
|
42
|
+
dependencies: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
43
|
+
registryDependencies: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
44
|
+
files: z.ZodArray<z.ZodString>;
|
|
45
|
+
a11y: z.ZodOptional<z.ZodString>;
|
|
46
|
+
access: z.ZodDefault<z.ZodEnum<{
|
|
47
|
+
free: "free";
|
|
48
|
+
pro: "pro";
|
|
49
|
+
}>>;
|
|
50
|
+
directory: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
type ItemSource = z.input<typeof itemSourceSchema>;
|
|
53
|
+
declare const registryConfigSchema: z.ZodObject<{
|
|
54
|
+
root: z.ZodString;
|
|
55
|
+
items: z.ZodArray<z.ZodObject<{
|
|
56
|
+
name: z.ZodString;
|
|
57
|
+
title: z.ZodString;
|
|
58
|
+
description: z.ZodString;
|
|
59
|
+
category: z.ZodString;
|
|
60
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
61
|
+
stable: "stable";
|
|
62
|
+
beta: "beta";
|
|
63
|
+
experimental: "experimental";
|
|
64
|
+
}>>;
|
|
65
|
+
group: z.ZodDefault<z.ZodEnum<{
|
|
66
|
+
ui: "ui";
|
|
67
|
+
blocks: "blocks";
|
|
68
|
+
lib: "lib";
|
|
69
|
+
hooks: "hooks";
|
|
70
|
+
}>>;
|
|
71
|
+
dependencies: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
72
|
+
registryDependencies: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
73
|
+
files: z.ZodArray<z.ZodString>;
|
|
74
|
+
a11y: z.ZodOptional<z.ZodString>;
|
|
75
|
+
access: z.ZodDefault<z.ZodEnum<{
|
|
76
|
+
free: "free";
|
|
77
|
+
pro: "pro";
|
|
78
|
+
}>>;
|
|
79
|
+
directory: z.ZodOptional<z.ZodString>;
|
|
80
|
+
}, z.core.$strip>>;
|
|
81
|
+
extends: z.ZodOptional<z.ZodString>;
|
|
82
|
+
generatedFrom: z.ZodDefault<z.ZodString>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
type RegistryConfig = z.input<typeof registryConfigSchema>;
|
|
85
|
+
/** Identity helper, for editor autocomplete inside a config file. */
|
|
86
|
+
declare function defineRegistryConfig(config: RegistryConfig): RegistryConfig;
|
|
87
|
+
interface BuildResult {
|
|
88
|
+
items: RegistryItem[];
|
|
89
|
+
/**
|
|
90
|
+
* Names that exist upstream and were replaced by a local item.
|
|
91
|
+
*
|
|
92
|
+
* Reported rather than applied silently. Overriding upstream's Button is a
|
|
93
|
+
* legitimate thing to want and a catastrophic thing to do by accident, and
|
|
94
|
+
* the difference is entirely whether anyone was told.
|
|
95
|
+
*/
|
|
96
|
+
overridden: string[];
|
|
97
|
+
/** How many items came from upstream unchanged. */
|
|
98
|
+
inherited: number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Every `registryDependencies` name must exist in the finished registry.
|
|
102
|
+
*
|
|
103
|
+
* Checked here, once, rather than discovered by a consumer whose `add` walks
|
|
104
|
+
* into a name nothing serves. This is the single most common way a
|
|
105
|
+
* hand-assembled registry is broken, and it is invisible until someone installs.
|
|
106
|
+
*/
|
|
107
|
+
declare function assertResolvable(items: RegistryItem[]): void;
|
|
108
|
+
declare function buildCustomRegistry(config: RegistryConfig): Promise<BuildResult>;
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/agent-docs.d.ts
|
|
111
|
+
/**
|
|
112
|
+
* Documentation written for coding agents rather than for people.
|
|
113
|
+
*
|
|
114
|
+
* This lives beside the registry rather than in the CLI or the docs site
|
|
115
|
+
* because all three need to emit the same text: the CLI writes it into a
|
|
116
|
+
* consumer's repository, the site serves it at /llms.txt, and the MCP server
|
|
117
|
+
* answers with it. Three hand-maintained copies would disagree within a
|
|
118
|
+
* release, and an agent acting on a stale catalogue writes code that does not
|
|
119
|
+
* compile.
|
|
120
|
+
*
|
|
121
|
+
* Everything here is derived from the registry index. Nothing is a hardcoded
|
|
122
|
+
* list of component names — that is the failure mode this replaces.
|
|
123
|
+
*/
|
|
124
|
+
interface AgentDocsContext {
|
|
125
|
+
index: RegistryIndex;
|
|
126
|
+
/**
|
|
127
|
+
* Full registry items, when the caller has them.
|
|
128
|
+
*
|
|
129
|
+
* The index carries no accessibility notes, so callers that can afford to
|
|
130
|
+
* fetch every item (the docs build, the MCP server) get richer output than
|
|
131
|
+
* ones that cannot (the CLI, which would otherwise make 81 requests).
|
|
132
|
+
*/
|
|
133
|
+
items?: RegistryItem[];
|
|
134
|
+
/** Base URL the CLI installs from. */
|
|
135
|
+
registryUrl: string;
|
|
136
|
+
/** Base URL of the documentation site, no trailing slash. */
|
|
137
|
+
docsUrl: string;
|
|
138
|
+
/** npm package name of the CLI, e.g. `@dowel-ui/cli`. */
|
|
139
|
+
cliPackage: string;
|
|
140
|
+
libraryName: string;
|
|
141
|
+
/** Registry names already present in the project, if known. */
|
|
142
|
+
installed?: string[];
|
|
143
|
+
/**
|
|
144
|
+
* What components are imported from in this project.
|
|
145
|
+
*
|
|
146
|
+
* Source-first installs resolve to the project's own alias; the published
|
|
147
|
+
* package is a separate, supported way to consume the same components. An
|
|
148
|
+
* agent told the wrong one writes imports that do not resolve.
|
|
149
|
+
*/
|
|
150
|
+
importFrom: string;
|
|
151
|
+
}
|
|
152
|
+
declare function conventionsDoc(context: AgentDocsContext): string;
|
|
153
|
+
declare function componentsDoc(context: AgentDocsContext): string;
|
|
154
|
+
declare function aiDoc(context: AgentDocsContext): string;
|
|
155
|
+
declare function themesDoc(context: AgentDocsContext): string;
|
|
156
|
+
/** Frontmatter-carrying skill file for Claude Code. */
|
|
157
|
+
declare function skillDoc(context: AgentDocsContext): string;
|
|
158
|
+
/** Cursor project rule (`.cursor/rules/*.mdc`). */
|
|
159
|
+
declare function cursorRule(context: AgentDocsContext): string;
|
|
160
|
+
declare const AGENTS_MARKER_START = "<!-- dowel:start -->";
|
|
161
|
+
declare const AGENTS_MARKER_END = "<!-- dowel:end -->";
|
|
162
|
+
/**
|
|
163
|
+
* The block written into a project's AGENTS.md.
|
|
164
|
+
*
|
|
165
|
+
* Marker-wrapped rather than written as a whole file: AGENTS.md belongs to the
|
|
166
|
+
* project and usually already says things about the project. Replacing it would
|
|
167
|
+
* destroy that; appending without markers would duplicate the section on every
|
|
168
|
+
* regeneration.
|
|
169
|
+
*/
|
|
170
|
+
declare function agentsSection(context: AgentDocsContext): string;
|
|
171
|
+
/** Replaces the marked block, or appends it if there is none. */
|
|
172
|
+
declare function upsertAgentsSection(existing: string, section: string): string;
|
|
173
|
+
/**
|
|
174
|
+
* The llms.txt index.
|
|
175
|
+
*
|
|
176
|
+
* Deliberately a map rather than a dump: it names every component and points at
|
|
177
|
+
* the one URL that carries everything, so a model with a small budget can find
|
|
178
|
+
* the right page and one with a large budget can take the lot.
|
|
179
|
+
*/
|
|
180
|
+
declare function llmsTxt(context: AgentDocsContext): string;
|
|
181
|
+
/** Everything an agent needs, in one request. */
|
|
182
|
+
declare function llmsFullTxt(context: AgentDocsContext): string;
|
|
183
|
+
//#endregion
|
|
2
184
|
//#region src/hash.d.ts
|
|
3
185
|
/**
|
|
4
186
|
* Content hash used to detect local edits to an installed file.
|
|
@@ -8,5 +190,5 @@ import { a as RegistryIndexEntry, c as registryFileSchema, d as registryIndexSch
|
|
|
8
190
|
*/
|
|
9
191
|
declare function hashContent(content: string): string;
|
|
10
192
|
//#endregion
|
|
11
|
-
export { REGISTRY_VERSION, type RegistryFile, type RegistryFileType, type RegistryIndex, type RegistryIndexEntry, type RegistryItem, type RegistryItemType, hashContent, registryFileSchema, registryFileTypeSchema, registryIndexEntrySchema, registryIndexSchema, registryItemSchema, registryItemTypeSchema };
|
|
193
|
+
export { AGENTS_MARKER_END, AGENTS_MARKER_START, type AgentDocsContext, type BuildResult, type ItemGroup, type ItemSource, type PlanEntry, type PlanOptions, REGISTRY_VERSION, type RegistryAccess, type RegistryConfig, type RegistryFile, type RegistryFileType, type RegistryIndex, type RegistryIndexEntry, type RegistryItem, type RegistryItemType, type RenderOptions, type UiPlan, agentsSection, aiDoc, assertResolvable, blocksPathFor, buildCustomRegistry, componentsDoc, conventionsDoc, cursorRule, defineRegistryConfig, hashContent, itemGroupSchema, itemSourceSchema, llmsFullTxt, llmsTxt, planUi, registryAccessSchema, registryConfigSchema, registryFileSchema, registryFileTypeSchema, registryIndexEntrySchema, registryIndexSchema, registryItemSchema, registryItemTypeSchema, renderBrief, renderPlan, skillDoc, themesDoc, upsertAgentsSection };
|
|
12
194
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/hash.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/custom.ts","../src/agent-docs.ts","../src/hash.ts"],"mappings":";;;;;;;;;;;;;;;;;;cAgCa,iBAAe,EAAA;;;;;;KAEhB,YAAY,EAAE,aAAa;cAS1B,kBAAgB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAqB3B,EAAA,KAAA;KAEU,aAAa,EAAE,aAAa;cAE3B,sBAAoB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAc/B,EAAA,KAAA;KAEU,iBAAiB,EAAE,aAAa;;iBAG5B,qBAAqB,QAAQ,iBAAiB;UAI7C;EACf,OAAO;;;;;;;;EAQP;;EAEA;;;;;;;;;iBAgKc,iBAAiB,OAAO;iBAkBlB,oBAAoB,QAAQ,iBAAiB,QAAQ;;;;;;;;;;;;;;;;UCxQ1D;EACf,OAAO;;;;;;;;EAQP,QAAQ;;EAER;;EAEA;;EAEA;EACA;;EAEA;;;;;;;;EAQA;;iBA8Ec,eAAe,SAAS;iBA6DxB,cAAc,SAAS;iBAmDvB,MAAM,SAAS;iBAqCf,UAAU,SAAS;;iBA2CnB,SAAS,SAAS;;iBAgElB,WAAW,SAAS;cAyBvB;cACA;;;;;;;;;iBAUG,cAAc,SAAS;;iBAuBvB,oBAAoB,kBAAkB;;;;;;;;iBAmBtC,QAAQ,SAAS;;iBA+CjB,YAAY,SAAS;;;;;;;;;iBC7erB,YAAY"}
|