@ghostvue/mcp 0.0.0-stage → 0.1.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.
Files changed (534) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +97 -2
  3. package/dist/assets/bundle.json +6 -0
  4. package/dist/assets/docs/pages.json +1 -0
  5. package/dist/assets/examples/catalog.json +1 -0
  6. package/dist/assets/examples/sources/accordion/basic.vue +42 -0
  7. package/dist/assets/examples/sources/accordion/deployment-faq.vue +169 -0
  8. package/dist/assets/examples/sources/accordion/navigation.vue +55 -0
  9. package/dist/assets/examples/sources/accordion/themed.vue +47 -0
  10. package/dist/assets/examples/sources/avatar/basic.vue +7 -0
  11. package/dist/assets/examples/sources/avatar/composable.vue +11 -0
  12. package/dist/assets/examples/sources/avatar/fallback.vue +11 -0
  13. package/dist/assets/examples/sources/avatar/image.vue +13 -0
  14. package/dist/assets/examples/sources/avatar/team-roster.vue +126 -0
  15. package/dist/assets/examples/sources/avatar/themed.vue +20 -0
  16. package/dist/assets/examples/sources/badge/basic.vue +7 -0
  17. package/dist/assets/examples/sources/badge/composable.vue +9 -0
  18. package/dist/assets/examples/sources/badge/icon.vue +18 -0
  19. package/dist/assets/examples/sources/badge/release-channels.vue +120 -0
  20. package/dist/assets/examples/sources/badge/table.vue +36 -0
  21. package/dist/assets/examples/sources/badge/themed.vue +7 -0
  22. package/dist/assets/examples/sources/breadcrumb/basic.vue +28 -0
  23. package/dist/assets/examples/sources/breadcrumb/collapsed.vue +37 -0
  24. package/dist/assets/examples/sources/breadcrumb/workspace-trail.vue +90 -0
  25. package/dist/assets/examples/sources/button/action-bar.vue +124 -0
  26. package/dist/assets/examples/sources/button/basic.vue +15 -0
  27. package/dist/assets/examples/sources/button/composable.vue +24 -0
  28. package/dist/assets/examples/sources/button/configured.vue +36 -0
  29. package/dist/assets/examples/sources/button/icon-only.vue +22 -0
  30. package/dist/assets/examples/sources/button/loading.vue +26 -0
  31. package/dist/assets/examples/sources/button/marked-parts.vue +56 -0
  32. package/dist/assets/examples/sources/button/ref.vue +16 -0
  33. package/dist/assets/examples/sources/button/themed.vue +30 -0
  34. package/dist/assets/examples/sources/calendar/basic.vue +238 -0
  35. package/dist/assets/examples/sources/calendar/controlled.vue +246 -0
  36. package/dist/assets/examples/sources/calendar/locale.vue +239 -0
  37. package/dist/assets/examples/sources/calendar/range.vue +241 -0
  38. package/dist/assets/examples/sources/calendar/themed.vue +88 -0
  39. package/dist/assets/examples/sources/calendar/unselected.vue +229 -0
  40. package/dist/assets/examples/sources/card/actions.vue +15 -0
  41. package/dist/assets/examples/sources/card/basic.vue +17 -0
  42. package/dist/assets/examples/sources/card/composable.vue +12 -0
  43. package/dist/assets/examples/sources/card/interactive.vue +23 -0
  44. package/dist/assets/examples/sources/card/link.vue +19 -0
  45. package/dist/assets/examples/sources/card/project-summary.vue +133 -0
  46. package/dist/assets/examples/sources/card/themed.vue +48 -0
  47. package/dist/assets/examples/sources/checkbox/basic.vue +22 -0
  48. package/dist/assets/examples/sources/checkbox/composable.vue +28 -0
  49. package/dist/assets/examples/sources/checkbox/indeterminate.vue +52 -0
  50. package/dist/assets/examples/sources/checkbox/notification-preferences.vue +360 -0
  51. package/dist/assets/examples/sources/checkbox/ref.vue +35 -0
  52. package/dist/assets/examples/sources/checkbox/themed.vue +111 -0
  53. package/dist/assets/examples/sources/collapsible/basic.vue +18 -0
  54. package/dist/assets/examples/sources/collapsible/release-notes.vue +136 -0
  55. package/dist/assets/examples/sources/collapsible/themed.vue +34 -0
  56. package/dist/assets/examples/sources/combobox/assignee-search.vue +544 -0
  57. package/dist/assets/examples/sources/combobox/async.vue +161 -0
  58. package/dist/assets/examples/sources/combobox/basic.vue +130 -0
  59. package/dist/assets/examples/sources/combobox/field.vue +137 -0
  60. package/dist/assets/examples/sources/combobox/form.vue +127 -0
  61. package/dist/assets/examples/sources/combobox/multi.vue +130 -0
  62. package/dist/assets/examples/sources/combobox/themed.vue +34 -0
  63. package/dist/assets/examples/sources/command-palette/async.vue +104 -0
  64. package/dist/assets/examples/sources/command-palette/basic.vue +108 -0
  65. package/dist/assets/examples/sources/command-palette/shortcut.vue +87 -0
  66. package/dist/assets/examples/sources/command-palette/themed.vue +152 -0
  67. package/dist/assets/examples/sources/command-palette/virtualized.vue +75 -0
  68. package/dist/assets/examples/sources/context-menu/basic.vue +231 -0
  69. package/dist/assets/examples/sources/context-menu/themed.vue +244 -0
  70. package/dist/assets/examples/sources/data-table/basic-invoices.vue +52 -0
  71. package/dist/assets/examples/sources/data-table/full-invoices.vue +178 -0
  72. package/dist/assets/examples/sources/data-table/paginated-invoices.vue +172 -0
  73. package/dist/assets/examples/sources/data-table/preset-invoices.vue +90 -0
  74. package/dist/assets/examples/sources/data-table/server-invoices-router.vue +504 -0
  75. package/dist/assets/examples/sources/data-table/themed-invoices.vue +123 -0
  76. package/dist/assets/examples/sources/date-picker/basic.vue +330 -0
  77. package/dist/assets/examples/sources/date-picker/controlled.vue +346 -0
  78. package/dist/assets/examples/sources/date-picker/custom-format.vue +367 -0
  79. package/dist/assets/examples/sources/date-picker/nested-dialog.vue +385 -0
  80. package/dist/assets/examples/sources/date-picker/range.vue +345 -0
  81. package/dist/assets/examples/sources/date-picker/rtl.vue +335 -0
  82. package/dist/assets/examples/sources/date-picker/themed.vue +70 -0
  83. package/dist/assets/examples/sources/date-picker/validation.vue +404 -0
  84. package/dist/assets/examples/sources/dialog/alert.vue +74 -0
  85. package/dist/assets/examples/sources/dialog/basic.vue +25 -0
  86. package/dist/assets/examples/sources/dialog/edit-profile.vue +347 -0
  87. package/dist/assets/examples/sources/dialog/nested.vue +98 -0
  88. package/dist/assets/examples/sources/dialog/themed.vue +98 -0
  89. package/dist/assets/examples/sources/drawer/basic.vue +25 -0
  90. package/dist/assets/examples/sources/drawer/nested.vue +71 -0
  91. package/dist/assets/examples/sources/drawer/non-modal.vue +44 -0
  92. package/dist/assets/examples/sources/drawer/sides.vue +61 -0
  93. package/dist/assets/examples/sources/drawer/themed.vue +162 -0
  94. package/dist/assets/examples/sources/dropdown-menu/basic.vue +205 -0
  95. package/dist/assets/examples/sources/dropdown-menu/record-actions.vue +506 -0
  96. package/dist/assets/examples/sources/dropdown-menu/themed.vue +161 -0
  97. package/dist/assets/examples/sources/empty-state/basic.vue +12 -0
  98. package/dist/assets/examples/sources/empty-state/composable.vue +18 -0
  99. package/dist/assets/examples/sources/empty-state/filtered.vue +16 -0
  100. package/dist/assets/examples/sources/empty-state/search-results.vue +124 -0
  101. package/dist/assets/examples/sources/empty-state/table-cell.vue +29 -0
  102. package/dist/assets/examples/sources/empty-state/themed.vue +33 -0
  103. package/dist/assets/examples/sources/field/basic.vue +25 -0
  104. package/dist/assets/examples/sources/field/checkbox.vue +23 -0
  105. package/dist/assets/examples/sources/field/invalid.vue +27 -0
  106. package/dist/assets/examples/sources/field/profile-settings.vue +227 -0
  107. package/dist/assets/examples/sources/field/textarea.vue +25 -0
  108. package/dist/assets/examples/sources/field/themed.vue +27 -0
  109. package/dist/assets/examples/sources/file-upload/asset-submission.vue +201 -0
  110. package/dist/assets/examples/sources/file-upload/basic.vue +30 -0
  111. package/dist/assets/examples/sources/file-upload/button-only.vue +33 -0
  112. package/dist/assets/examples/sources/file-upload/controlled.vue +49 -0
  113. package/dist/assets/examples/sources/file-upload/duplicates.vue +46 -0
  114. package/dist/assets/examples/sources/file-upload/field.vue +67 -0
  115. package/dist/assets/examples/sources/file-upload/form.vue +60 -0
  116. package/dist/assets/examples/sources/file-upload/themed.vue +50 -0
  117. package/dist/assets/examples/sources/file-upload/validation.vue +47 -0
  118. package/dist/assets/examples/sources/hover-card/basic.vue +121 -0
  119. package/dist/assets/examples/sources/hover-card/themed.vue +152 -0
  120. package/dist/assets/examples/sources/inline-alert/basic.vue +10 -0
  121. package/dist/assets/examples/sources/inline-alert/billing-notices.vue +141 -0
  122. package/dist/assets/examples/sources/inline-alert/composable.vue +19 -0
  123. package/dist/assets/examples/sources/inline-alert/live.vue +25 -0
  124. package/dist/assets/examples/sources/inline-alert/table-error.vue +21 -0
  125. package/dist/assets/examples/sources/inline-alert/themed.vue +13 -0
  126. package/dist/assets/examples/sources/input/account-details.vue +229 -0
  127. package/dist/assets/examples/sources/input/basic.vue +10 -0
  128. package/dist/assets/examples/sources/input/composable.vue +12 -0
  129. package/dist/assets/examples/sources/input/ref.vue +34 -0
  130. package/dist/assets/examples/sources/input/search.vue +101 -0
  131. package/dist/assets/examples/sources/input/states.vue +96 -0
  132. package/dist/assets/examples/sources/input/themed.vue +55 -0
  133. package/dist/assets/examples/sources/interactive-surface/basic.vue +40 -0
  134. package/dist/assets/examples/sources/interactive-surface/button.vue +7 -0
  135. package/dist/assets/examples/sources/interactive-surface/composable.vue +34 -0
  136. package/dist/assets/examples/sources/interactive-surface/feature-tiles.vue +77 -0
  137. package/dist/assets/examples/sources/kbd/basic.vue +5 -0
  138. package/dist/assets/examples/sources/kbd/combination.vue +8 -0
  139. package/dist/assets/examples/sources/kbd/command-shortcuts.vue +98 -0
  140. package/dist/assets/examples/sources/kbd/composable.vue +17 -0
  141. package/dist/assets/examples/sources/kbd/platform.vue +14 -0
  142. package/dist/assets/examples/sources/kbd/themed.vue +25 -0
  143. package/dist/assets/examples/sources/link/basic.vue +7 -0
  144. package/dist/assets/examples/sources/link/button.vue +62 -0
  145. package/dist/assets/examples/sources/link/composable.vue +15 -0
  146. package/dist/assets/examples/sources/link/disabled.vue +9 -0
  147. package/dist/assets/examples/sources/link/documentation-footer.vue +96 -0
  148. package/dist/assets/examples/sources/link/external.vue +12 -0
  149. package/dist/assets/examples/sources/link/router.vue +22 -0
  150. package/dist/assets/examples/sources/link/themed.vue +21 -0
  151. package/dist/assets/examples/sources/menubar/basic.vue +208 -0
  152. package/dist/assets/examples/sources/menubar/themed.vue +195 -0
  153. package/dist/assets/examples/sources/number-input/basic.vue +20 -0
  154. package/dist/assets/examples/sources/number-input/bounds.vue +18 -0
  155. package/dist/assets/examples/sources/number-input/field.vue +34 -0
  156. package/dist/assets/examples/sources/number-input/form-locale.vue +29 -0
  157. package/dist/assets/examples/sources/number-input/order-limits.vue +221 -0
  158. package/dist/assets/examples/sources/number-input/ref.vue +26 -0
  159. package/dist/assets/examples/sources/number-input/themed.vue +20 -0
  160. package/dist/assets/examples/sources/pagination/basic.vue +54 -0
  161. package/dist/assets/examples/sources/pagination/controlled.vue +31 -0
  162. package/dist/assets/examples/sources/pagination/ellipsis.vue +29 -0
  163. package/dist/assets/examples/sources/pagination/themed.vue +52 -0
  164. package/dist/assets/examples/sources/popover/basic.vue +54 -0
  165. package/dist/assets/examples/sources/popover/controlled.vue +79 -0
  166. package/dist/assets/examples/sources/popover/share-settings.vue +457 -0
  167. package/dist/assets/examples/sources/popover/themed.vue +50 -0
  168. package/dist/assets/examples/sources/progress/basic.vue +25 -0
  169. package/dist/assets/examples/sources/progress/composable.vue +30 -0
  170. package/dist/assets/examples/sources/progress/indeterminate.vue +26 -0
  171. package/dist/assets/examples/sources/progress/themed.vue +30 -0
  172. package/dist/assets/examples/sources/progress/upload-queue.vue +173 -0
  173. package/dist/assets/examples/sources/progress/value-text.vue +29 -0
  174. package/dist/assets/examples/sources/radio-group/basic.vue +33 -0
  175. package/dist/assets/examples/sources/radio-group/deployment-tier.vue +258 -0
  176. package/dist/assets/examples/sources/radio-group/field.vue +49 -0
  177. package/dist/assets/examples/sources/radio-group/form.vue +45 -0
  178. package/dist/assets/examples/sources/radio-group/themed.vue +35 -0
  179. package/dist/assets/examples/sources/scroll-area/activity-feed.vue +183 -0
  180. package/dist/assets/examples/sources/scroll-area/basic.vue +24 -0
  181. package/dist/assets/examples/sources/scroll-area/composable.vue +24 -0
  182. package/dist/assets/examples/sources/scroll-area/horizontal.vue +25 -0
  183. package/dist/assets/examples/sources/scroll-area/themed.vue +38 -0
  184. package/dist/assets/examples/sources/scroll-spy/basic.vue +101 -0
  185. package/dist/assets/examples/sources/scroll-spy/composable.vue +63 -0
  186. package/dist/assets/examples/sources/scroll-spy/themed.vue +59 -0
  187. package/dist/assets/examples/sources/segmented-control/analytics-period.vue +187 -0
  188. package/dist/assets/examples/sources/segmented-control/basic.vue +50 -0
  189. package/dist/assets/examples/sources/segmented-control/themed.vue +14 -0
  190. package/dist/assets/examples/sources/select/basic.vue +173 -0
  191. package/dist/assets/examples/sources/select/billing-preferences.vue +386 -0
  192. package/dist/assets/examples/sources/select/field.vue +173 -0
  193. package/dist/assets/examples/sources/select/form.vue +166 -0
  194. package/dist/assets/examples/sources/select/themed.vue +74 -0
  195. package/dist/assets/examples/sources/separator/basic.vue +11 -0
  196. package/dist/assets/examples/sources/separator/composable.vue +13 -0
  197. package/dist/assets/examples/sources/separator/decorative.vue +11 -0
  198. package/dist/assets/examples/sources/separator/list.vue +12 -0
  199. package/dist/assets/examples/sources/separator/release-header.vue +116 -0
  200. package/dist/assets/examples/sources/separator/themed.vue +21 -0
  201. package/dist/assets/examples/sources/separator/vertical.vue +25 -0
  202. package/dist/assets/examples/sources/skeleton/basic.vue +9 -0
  203. package/dist/assets/examples/sources/skeleton/composable.vue +12 -0
  204. package/dist/assets/examples/sources/skeleton/profile-loading.vue +161 -0
  205. package/dist/assets/examples/sources/skeleton/table.vue +27 -0
  206. package/dist/assets/examples/sources/skeleton/themed.vue +25 -0
  207. package/dist/assets/examples/sources/slider/audio-mixer.vue +193 -0
  208. package/dist/assets/examples/sources/slider/basic.vue +51 -0
  209. package/dist/assets/examples/sources/slider/range.vue +52 -0
  210. package/dist/assets/examples/sources/slider/value-text.vue +50 -0
  211. package/dist/assets/examples/sources/slider/vertical.vue +21 -0
  212. package/dist/assets/examples/sources/spinner/basic.vue +37 -0
  213. package/dist/assets/examples/sources/spinner/composable.vue +41 -0
  214. package/dist/assets/examples/sources/spinner/sync-status.vue +105 -0
  215. package/dist/assets/examples/sources/spinner/table-refresh.vue +24 -0
  216. package/dist/assets/examples/sources/spinner/themed.vue +21 -0
  217. package/dist/assets/examples/sources/switch/basic.vue +55 -0
  218. package/dist/assets/examples/sources/switch/composable.vue +61 -0
  219. package/dist/assets/examples/sources/switch/form.vue +24 -0
  220. package/dist/assets/examples/sources/switch/ref.vue +64 -0
  221. package/dist/assets/examples/sources/switch/states.vue +23 -0
  222. package/dist/assets/examples/sources/switch/themed.vue +21 -0
  223. package/dist/assets/examples/sources/switch/workspace-security.vue +221 -0
  224. package/dist/assets/examples/sources/table/basic.vue +36 -0
  225. package/dist/assets/examples/sources/table/composable.vue +39 -0
  226. package/dist/assets/examples/sources/table/contain-horizontal.vue +73 -0
  227. package/dist/assets/examples/sources/table/row-headers.vue +31 -0
  228. package/dist/assets/examples/sources/table/team-directory.vue +445 -0
  229. package/dist/assets/examples/sources/table/themed.vue +70 -0
  230. package/dist/assets/examples/sources/tabs/basic.vue +41 -0
  231. package/dist/assets/examples/sources/tabs/manual.vue +37 -0
  232. package/dist/assets/examples/sources/tabs/themed.vue +45 -0
  233. package/dist/assets/examples/sources/tabs/vertical.vue +51 -0
  234. package/dist/assets/examples/sources/tabs/workspace.vue +517 -0
  235. package/dist/assets/examples/sources/textarea/auto-resize.vue +20 -0
  236. package/dist/assets/examples/sources/textarea/basic.vue +14 -0
  237. package/dist/assets/examples/sources/textarea/composable.vue +12 -0
  238. package/dist/assets/examples/sources/textarea/form.vue +23 -0
  239. package/dist/assets/examples/sources/textarea/ref.vue +25 -0
  240. package/dist/assets/examples/sources/textarea/release-notes.vue +191 -0
  241. package/dist/assets/examples/sources/textarea/states.vue +32 -0
  242. package/dist/assets/examples/sources/textarea/themed.vue +19 -0
  243. package/dist/assets/examples/sources/toast/basic.vue +54 -0
  244. package/dist/assets/examples/sources/toast/persist-error.vue +94 -0
  245. package/dist/assets/examples/sources/toast/queue-overflow.vue +90 -0
  246. package/dist/assets/examples/sources/toast/themed.vue +78 -0
  247. package/dist/assets/examples/sources/toggle-group/basic.vue +15 -0
  248. package/dist/assets/examples/sources/toggle-group/editor-toolbar.vue +126 -0
  249. package/dist/assets/examples/sources/toggle-group/multiple.vue +19 -0
  250. package/dist/assets/examples/sources/toggle-group/themed.vue +11 -0
  251. package/dist/assets/examples/sources/toolbar/basic.vue +11 -0
  252. package/dist/assets/examples/sources/toolbar/composable.vue +21 -0
  253. package/dist/assets/examples/sources/toolbar/editor-actions.vue +115 -0
  254. package/dist/assets/examples/sources/toolbar/separators.vue +32 -0
  255. package/dist/assets/examples/sources/toolbar/themed.vue +19 -0
  256. package/dist/assets/examples/sources/toolbar/vertical.vue +11 -0
  257. package/dist/assets/examples/sources/tooltip/basic.vue +47 -0
  258. package/dist/assets/examples/sources/tooltip/themed.vue +156 -0
  259. package/dist/assets/examples/sources/tooltip-provider/skip-delay.vue +69 -0
  260. package/dist/assets/examples/sources/tree/basic.vue +77 -0
  261. package/dist/assets/examples/sources/tree/multi-select.vue +88 -0
  262. package/dist/assets/examples/sources/tree/rtl.vue +34 -0
  263. package/dist/assets/examples/sources/tree/split-trigger.vue +47 -0
  264. package/dist/assets/examples/sources/tree/themed.vue +130 -0
  265. package/dist/assets/examples/sources/visually-hidden/action-bar.vue +100 -0
  266. package/dist/assets/examples/sources/visually-hidden/basic.vue +17 -0
  267. package/dist/assets/examples/sources/visually-hidden/composable.vue +19 -0
  268. package/dist/assets/examples/sources/visually-hidden/icon-name.vue +28 -0
  269. package/dist/assets/examples/sources/visually-hidden/live-region.vue +18 -0
  270. package/dist/assets/examples/sources/visually-hidden/skip-link.vue +12 -0
  271. package/dist/assets/examples/sources/visually-hidden/table-header.vue +27 -0
  272. package/dist/assets/manifest.schema.json +742 -0
  273. package/dist/assets/manifests/themes/ghost-accordion.manifest.json +52 -0
  274. package/dist/assets/manifests/themes/ghost-avatar.manifest.json +131 -0
  275. package/dist/assets/manifests/themes/ghost-badge.manifest.json +180 -0
  276. package/dist/assets/manifests/themes/ghost-breadcrumb.manifest.json +53 -0
  277. package/dist/assets/manifests/themes/ghost-button.manifest.json +396 -0
  278. package/dist/assets/manifests/themes/ghost-calendar.manifest.json +50 -0
  279. package/dist/assets/manifests/themes/ghost-card.manifest.json +104 -0
  280. package/dist/assets/manifests/themes/ghost-checkbox.manifest.json +241 -0
  281. package/dist/assets/manifests/themes/ghost-collapsible.manifest.json +113 -0
  282. package/dist/assets/manifests/themes/ghost-combobox.manifest.json +80 -0
  283. package/dist/assets/manifests/themes/ghost-command-palette.manifest.json +80 -0
  284. package/dist/assets/manifests/themes/ghost-context-menu.manifest.json +50 -0
  285. package/dist/assets/manifests/themes/ghost-data-table-preset.manifest.json +58 -0
  286. package/dist/assets/manifests/themes/ghost-data-table-table.manifest.json +30 -0
  287. package/dist/assets/manifests/themes/ghost-data-table.manifest.json +64 -0
  288. package/dist/assets/manifests/themes/ghost-date-picker.manifest.json +64 -0
  289. package/dist/assets/manifests/themes/ghost-dialog.manifest.json +184 -0
  290. package/dist/assets/manifests/themes/ghost-drawer.manifest.json +224 -0
  291. package/dist/assets/manifests/themes/ghost-dropdown-menu.manifest.json +131 -0
  292. package/dist/assets/manifests/themes/ghost-empty-state.manifest.json +96 -0
  293. package/dist/assets/manifests/themes/ghost-field.manifest.json +99 -0
  294. package/dist/assets/manifests/themes/ghost-file-upload.manifest.json +289 -0
  295. package/dist/assets/manifests/themes/ghost-hover-card.manifest.json +33 -0
  296. package/dist/assets/manifests/themes/ghost-inline-alert.manifest.json +70 -0
  297. package/dist/assets/manifests/themes/ghost-input.manifest.json +238 -0
  298. package/dist/assets/manifests/themes/ghost-interactive-surface.manifest.json +110 -0
  299. package/dist/assets/manifests/themes/ghost-kbd.manifest.json +148 -0
  300. package/dist/assets/manifests/themes/ghost-link.manifest.json +196 -0
  301. package/dist/assets/manifests/themes/ghost-menubar.manifest.json +51 -0
  302. package/dist/assets/manifests/themes/ghost-number-input.manifest.json +207 -0
  303. package/dist/assets/manifests/themes/ghost-pagination.manifest.json +76 -0
  304. package/dist/assets/manifests/themes/ghost-popover.manifest.json +147 -0
  305. package/dist/assets/manifests/themes/ghost-progress.manifest.json +140 -0
  306. package/dist/assets/manifests/themes/ghost-radio-group.manifest.json +60 -0
  307. package/dist/assets/manifests/themes/ghost-scroll-area.manifest.json +66 -0
  308. package/dist/assets/manifests/themes/ghost-scroll-spy.manifest.json +44 -0
  309. package/dist/assets/manifests/themes/ghost-segmented-control-item.manifest.json +64 -0
  310. package/dist/assets/manifests/themes/ghost-segmented-control.manifest.json +71 -0
  311. package/dist/assets/manifests/themes/ghost-select.manifest.json +66 -0
  312. package/dist/assets/manifests/themes/ghost-separator.manifest.json +66 -0
  313. package/dist/assets/manifests/themes/ghost-skeleton.manifest.json +98 -0
  314. package/dist/assets/manifests/themes/ghost-slider.manifest.json +119 -0
  315. package/dist/assets/manifests/themes/ghost-spinner.manifest.json +104 -0
  316. package/dist/assets/manifests/themes/ghost-switch.manifest.json +288 -0
  317. package/dist/assets/manifests/themes/ghost-table.manifest.json +60 -0
  318. package/dist/assets/manifests/themes/ghost-tabs.manifest.json +51 -0
  319. package/dist/assets/manifests/themes/ghost-textarea.manifest.json +238 -0
  320. package/dist/assets/manifests/themes/ghost-toast.manifest.json +121 -0
  321. package/dist/assets/manifests/themes/ghost-toggle-group-item.manifest.json +65 -0
  322. package/dist/assets/manifests/themes/ghost-toggle-group.manifest.json +67 -0
  323. package/dist/assets/manifests/themes/ghost-toolbar.manifest.json +111 -0
  324. package/dist/assets/manifests/themes/ghost-tooltip.manifest.json +113 -0
  325. package/dist/assets/manifests/themes/ghost-tree.manifest.json +295 -0
  326. package/dist/assets/manifests/vue/ghost-accordion-content.manifest.json +67 -0
  327. package/dist/assets/manifests/vue/ghost-accordion-item.manifest.json +47 -0
  328. package/dist/assets/manifests/vue/ghost-accordion-trigger.manifest.json +59 -0
  329. package/dist/assets/manifests/vue/ghost-accordion.manifest.json +171 -0
  330. package/dist/assets/manifests/vue/ghost-avatar.manifest.json +102 -0
  331. package/dist/assets/manifests/vue/ghost-badge.manifest.json +53 -0
  332. package/dist/assets/manifests/vue/ghost-breadcrumb-ellipsis.manifest.json +80 -0
  333. package/dist/assets/manifests/vue/ghost-breadcrumb-item.manifest.json +57 -0
  334. package/dist/assets/manifests/vue/ghost-breadcrumb-link.manifest.json +71 -0
  335. package/dist/assets/manifests/vue/ghost-breadcrumb-list.manifest.json +69 -0
  336. package/dist/assets/manifests/vue/ghost-breadcrumb-page.manifest.json +59 -0
  337. package/dist/assets/manifests/vue/ghost-breadcrumb-separator.manifest.json +59 -0
  338. package/dist/assets/manifests/vue/ghost-breadcrumb.manifest.json +82 -0
  339. package/dist/assets/manifests/vue/ghost-button.manifest.json +109 -0
  340. package/dist/assets/manifests/vue/ghost-calendar-cell.manifest.json +107 -0
  341. package/dist/assets/manifests/vue/ghost-calendar-grid.manifest.json +105 -0
  342. package/dist/assets/manifests/vue/ghost-calendar-header.manifest.json +59 -0
  343. package/dist/assets/manifests/vue/ghost-calendar-heading.manifest.json +70 -0
  344. package/dist/assets/manifests/vue/ghost-calendar-next-button.manifest.json +59 -0
  345. package/dist/assets/manifests/vue/ghost-calendar-prev-button.manifest.json +59 -0
  346. package/dist/assets/manifests/vue/ghost-calendar.manifest.json +173 -0
  347. package/dist/assets/manifests/vue/ghost-card.manifest.json +107 -0
  348. package/dist/assets/manifests/vue/ghost-checkbox.manifest.json +134 -0
  349. package/dist/assets/manifests/vue/ghost-collapsible-content.manifest.json +81 -0
  350. package/dist/assets/manifests/vue/ghost-collapsible-trigger.manifest.json +81 -0
  351. package/dist/assets/manifests/vue/ghost-collapsible.manifest.json +99 -0
  352. package/dist/assets/manifests/vue/ghost-combobox-content.manifest.json +114 -0
  353. package/dist/assets/manifests/vue/ghost-combobox-empty.manifest.json +40 -0
  354. package/dist/assets/manifests/vue/ghost-combobox-group.manifest.json +40 -0
  355. package/dist/assets/manifests/vue/ghost-combobox-input.manifest.json +61 -0
  356. package/dist/assets/manifests/vue/ghost-combobox-label.manifest.json +40 -0
  357. package/dist/assets/manifests/vue/ghost-combobox-option.manifest.json +80 -0
  358. package/dist/assets/manifests/vue/ghost-combobox-trigger.manifest.json +67 -0
  359. package/dist/assets/manifests/vue/ghost-combobox.manifest.json +323 -0
  360. package/dist/assets/manifests/vue/ghost-command-palette-content.manifest.json +138 -0
  361. package/dist/assets/manifests/vue/ghost-command-palette-empty.manifest.json +69 -0
  362. package/dist/assets/manifests/vue/ghost-command-palette-group.manifest.json +71 -0
  363. package/dist/assets/manifests/vue/ghost-command-palette-input.manifest.json +88 -0
  364. package/dist/assets/manifests/vue/ghost-command-palette-item.manifest.json +102 -0
  365. package/dist/assets/manifests/vue/ghost-command-palette-label.manifest.json +69 -0
  366. package/dist/assets/manifests/vue/ghost-command-palette-list.manifest.json +72 -0
  367. package/dist/assets/manifests/vue/ghost-command-palette-overlay.manifest.json +92 -0
  368. package/dist/assets/manifests/vue/ghost-command-palette-separator.manifest.json +63 -0
  369. package/dist/assets/manifests/vue/ghost-command-palette-title.manifest.json +69 -0
  370. package/dist/assets/manifests/vue/ghost-command-palette-trigger.manifest.json +89 -0
  371. package/dist/assets/manifests/vue/ghost-command-palette.manifest.json +359 -0
  372. package/dist/assets/manifests/vue/ghost-context-menu-checkbox-item.manifest.json +110 -0
  373. package/dist/assets/manifests/vue/ghost-context-menu-content.manifest.json +114 -0
  374. package/dist/assets/manifests/vue/ghost-context-menu-group.manifest.json +40 -0
  375. package/dist/assets/manifests/vue/ghost-context-menu-item.manifest.json +85 -0
  376. package/dist/assets/manifests/vue/ghost-context-menu-label.manifest.json +40 -0
  377. package/dist/assets/manifests/vue/ghost-context-menu-radio-group.manifest.json +69 -0
  378. package/dist/assets/manifests/vue/ghost-context-menu-radio-item.manifest.json +97 -0
  379. package/dist/assets/manifests/vue/ghost-context-menu-separator.manifest.json +42 -0
  380. package/dist/assets/manifests/vue/ghost-context-menu-trigger.manifest.json +75 -0
  381. package/dist/assets/manifests/vue/ghost-context-menu.manifest.json +73 -0
  382. package/dist/assets/manifests/vue/ghost-data-table-preset.manifest.json +171 -0
  383. package/dist/assets/manifests/vue/ghost-data-table-table.manifest.json +56 -0
  384. package/dist/assets/manifests/vue/ghost-data-table.manifest.json +287 -0
  385. package/dist/assets/manifests/vue/ghost-date-picker-calendar.manifest.json +38 -0
  386. package/dist/assets/manifests/vue/ghost-date-picker-content.manifest.json +131 -0
  387. package/dist/assets/manifests/vue/ghost-date-picker-input.manifest.json +85 -0
  388. package/dist/assets/manifests/vue/ghost-date-picker-trigger.manifest.json +59 -0
  389. package/dist/assets/manifests/vue/ghost-date-picker.manifest.json +352 -0
  390. package/dist/assets/manifests/vue/ghost-dialog-close.manifest.json +80 -0
  391. package/dist/assets/manifests/vue/ghost-dialog-content.manifest.json +141 -0
  392. package/dist/assets/manifests/vue/ghost-dialog-description.manifest.json +69 -0
  393. package/dist/assets/manifests/vue/ghost-dialog-overlay.manifest.json +90 -0
  394. package/dist/assets/manifests/vue/ghost-dialog-title.manifest.json +69 -0
  395. package/dist/assets/manifests/vue/ghost-dialog-trigger.manifest.json +93 -0
  396. package/dist/assets/manifests/vue/ghost-dialog.manifest.json +125 -0
  397. package/dist/assets/manifests/vue/ghost-drawer-close.manifest.json +80 -0
  398. package/dist/assets/manifests/vue/ghost-drawer-content.manifest.json +137 -0
  399. package/dist/assets/manifests/vue/ghost-drawer-description.manifest.json +69 -0
  400. package/dist/assets/manifests/vue/ghost-drawer-overlay.manifest.json +90 -0
  401. package/dist/assets/manifests/vue/ghost-drawer-title.manifest.json +69 -0
  402. package/dist/assets/manifests/vue/ghost-drawer-trigger.manifest.json +93 -0
  403. package/dist/assets/manifests/vue/ghost-drawer.manifest.json +149 -0
  404. package/dist/assets/manifests/vue/ghost-dropdown-menu-checkbox-item.manifest.json +110 -0
  405. package/dist/assets/manifests/vue/ghost-dropdown-menu-content.manifest.json +114 -0
  406. package/dist/assets/manifests/vue/ghost-dropdown-menu-group.manifest.json +40 -0
  407. package/dist/assets/manifests/vue/ghost-dropdown-menu-item.manifest.json +85 -0
  408. package/dist/assets/manifests/vue/ghost-dropdown-menu-label.manifest.json +40 -0
  409. package/dist/assets/manifests/vue/ghost-dropdown-menu-radio-group.manifest.json +69 -0
  410. package/dist/assets/manifests/vue/ghost-dropdown-menu-radio-item.manifest.json +97 -0
  411. package/dist/assets/manifests/vue/ghost-dropdown-menu-separator.manifest.json +42 -0
  412. package/dist/assets/manifests/vue/ghost-dropdown-menu-trigger.manifest.json +67 -0
  413. package/dist/assets/manifests/vue/ghost-dropdown-menu.manifest.json +67 -0
  414. package/dist/assets/manifests/vue/ghost-empty-state.manifest.json +98 -0
  415. package/dist/assets/manifests/vue/ghost-field-control.manifest.json +59 -0
  416. package/dist/assets/manifests/vue/ghost-field-description.manifest.json +59 -0
  417. package/dist/assets/manifests/vue/ghost-field-error.manifest.json +59 -0
  418. package/dist/assets/manifests/vue/ghost-field-label.manifest.json +83 -0
  419. package/dist/assets/manifests/vue/ghost-field.manifest.json +109 -0
  420. package/dist/assets/manifests/vue/ghost-file-upload-dropzone.manifest.json +67 -0
  421. package/dist/assets/manifests/vue/ghost-file-upload-item-remove.manifest.json +65 -0
  422. package/dist/assets/manifests/vue/ghost-file-upload-item.manifest.json +56 -0
  423. package/dist/assets/manifests/vue/ghost-file-upload-list.manifest.json +50 -0
  424. package/dist/assets/manifests/vue/ghost-file-upload-trigger.manifest.json +82 -0
  425. package/dist/assets/manifests/vue/ghost-file-upload.manifest.json +247 -0
  426. package/dist/assets/manifests/vue/ghost-hover-card-content.manifest.json +121 -0
  427. package/dist/assets/manifests/vue/ghost-hover-card-trigger.manifest.json +76 -0
  428. package/dist/assets/manifests/vue/ghost-hover-card.manifest.json +99 -0
  429. package/dist/assets/manifests/vue/ghost-inline-alert.manifest.json +98 -0
  430. package/dist/assets/manifests/vue/ghost-input.manifest.json +132 -0
  431. package/dist/assets/manifests/vue/ghost-interactive-surface.manifest.json +101 -0
  432. package/dist/assets/manifests/vue/ghost-kbd.manifest.json +66 -0
  433. package/dist/assets/manifests/vue/ghost-link.manifest.json +112 -0
  434. package/dist/assets/manifests/vue/ghost-menubar-checkbox-item.manifest.json +110 -0
  435. package/dist/assets/manifests/vue/ghost-menubar-content.manifest.json +114 -0
  436. package/dist/assets/manifests/vue/ghost-menubar-group.manifest.json +40 -0
  437. package/dist/assets/manifests/vue/ghost-menubar-item.manifest.json +85 -0
  438. package/dist/assets/manifests/vue/ghost-menubar-label.manifest.json +40 -0
  439. package/dist/assets/manifests/vue/ghost-menubar-menu.manifest.json +65 -0
  440. package/dist/assets/manifests/vue/ghost-menubar-radio-group.manifest.json +69 -0
  441. package/dist/assets/manifests/vue/ghost-menubar-radio-item.manifest.json +97 -0
  442. package/dist/assets/manifests/vue/ghost-menubar-separator.manifest.json +42 -0
  443. package/dist/assets/manifests/vue/ghost-menubar-trigger.manifest.json +67 -0
  444. package/dist/assets/manifests/vue/ghost-menubar.manifest.json +62 -0
  445. package/dist/assets/manifests/vue/ghost-number-input.manifest.json +205 -0
  446. package/dist/assets/manifests/vue/ghost-pagination.manifest.json +249 -0
  447. package/dist/assets/manifests/vue/ghost-popover-close.manifest.json +80 -0
  448. package/dist/assets/manifests/vue/ghost-popover-content.manifest.json +134 -0
  449. package/dist/assets/manifests/vue/ghost-popover-trigger.manifest.json +93 -0
  450. package/dist/assets/manifests/vue/ghost-popover.manifest.json +103 -0
  451. package/dist/assets/manifests/vue/ghost-portal.manifest.json +56 -0
  452. package/dist/assets/manifests/vue/ghost-progress.manifest.json +77 -0
  453. package/dist/assets/manifests/vue/ghost-radio-group-item.manifest.json +73 -0
  454. package/dist/assets/manifests/vue/ghost-radio-group.manifest.json +148 -0
  455. package/dist/assets/manifests/vue/ghost-scroll-area.manifest.json +93 -0
  456. package/dist/assets/manifests/vue/ghost-scroll-spy-item.manifest.json +60 -0
  457. package/dist/assets/manifests/vue/ghost-scroll-spy-link.manifest.json +98 -0
  458. package/dist/assets/manifests/vue/ghost-scroll-spy-list.manifest.json +52 -0
  459. package/dist/assets/manifests/vue/ghost-scroll-spy.manifest.json +244 -0
  460. package/dist/assets/manifests/vue/ghost-segmented-control-indicator.manifest.json +25 -0
  461. package/dist/assets/manifests/vue/ghost-segmented-control-item.manifest.json +91 -0
  462. package/dist/assets/manifests/vue/ghost-segmented-control.manifest.json +147 -0
  463. package/dist/assets/manifests/vue/ghost-select-content.manifest.json +114 -0
  464. package/dist/assets/manifests/vue/ghost-select-group.manifest.json +40 -0
  465. package/dist/assets/manifests/vue/ghost-select-label.manifest.json +40 -0
  466. package/dist/assets/manifests/vue/ghost-select-option.manifest.json +80 -0
  467. package/dist/assets/manifests/vue/ghost-select-trigger.manifest.json +67 -0
  468. package/dist/assets/manifests/vue/ghost-select-value.manifest.json +36 -0
  469. package/dist/assets/manifests/vue/ghost-select.manifest.json +188 -0
  470. package/dist/assets/manifests/vue/ghost-separator.manifest.json +70 -0
  471. package/dist/assets/manifests/vue/ghost-skeleton.manifest.json +52 -0
  472. package/dist/assets/manifests/vue/ghost-slider.manifest.json +297 -0
  473. package/dist/assets/manifests/vue/ghost-spinner.manifest.json +42 -0
  474. package/dist/assets/manifests/vue/ghost-switch.manifest.json +183 -0
  475. package/dist/assets/manifests/vue/ghost-table-body.manifest.json +38 -0
  476. package/dist/assets/manifests/vue/ghost-table-caption.manifest.json +38 -0
  477. package/dist/assets/manifests/vue/ghost-table-cell.manifest.json +38 -0
  478. package/dist/assets/manifests/vue/ghost-table-foot.manifest.json +38 -0
  479. package/dist/assets/manifests/vue/ghost-table-head.manifest.json +38 -0
  480. package/dist/assets/manifests/vue/ghost-table-header-cell.manifest.json +51 -0
  481. package/dist/assets/manifests/vue/ghost-table-row.manifest.json +38 -0
  482. package/dist/assets/manifests/vue/ghost-table.manifest.json +69 -0
  483. package/dist/assets/manifests/vue/ghost-tabs-content.manifest.json +66 -0
  484. package/dist/assets/manifests/vue/ghost-tabs-list.manifest.json +59 -0
  485. package/dist/assets/manifests/vue/ghost-tabs-trigger.manifest.json +74 -0
  486. package/dist/assets/manifests/vue/ghost-tabs.manifest.json +99 -0
  487. package/dist/assets/manifests/vue/ghost-textarea.manifest.json +147 -0
  488. package/dist/assets/manifests/vue/ghost-toast-action.manifest.json +69 -0
  489. package/dist/assets/manifests/vue/ghost-toast-close.manifest.json +69 -0
  490. package/dist/assets/manifests/vue/ghost-toast-description.manifest.json +48 -0
  491. package/dist/assets/manifests/vue/ghost-toast-provider.manifest.json +61 -0
  492. package/dist/assets/manifests/vue/ghost-toast-title.manifest.json +48 -0
  493. package/dist/assets/manifests/vue/ghost-toast-viewport.manifest.json +102 -0
  494. package/dist/assets/manifests/vue/ghost-toast.manifest.json +73 -0
  495. package/dist/assets/manifests/vue/ghost-toggle-group-item.manifest.json +93 -0
  496. package/dist/assets/manifests/vue/ghost-toggle-group.manifest.json +135 -0
  497. package/dist/assets/manifests/vue/ghost-toolbar.manifest.json +118 -0
  498. package/dist/assets/manifests/vue/ghost-tooltip-content.manifest.json +131 -0
  499. package/dist/assets/manifests/vue/ghost-tooltip-provider.manifest.json +55 -0
  500. package/dist/assets/manifests/vue/ghost-tooltip-trigger.manifest.json +90 -0
  501. package/dist/assets/manifests/vue/ghost-tooltip.manifest.json +93 -0
  502. package/dist/assets/manifests/vue/ghost-tree-group.manifest.json +119 -0
  503. package/dist/assets/manifests/vue/ghost-tree-item.manifest.json +286 -0
  504. package/dist/assets/manifests/vue/ghost-tree-trigger.manifest.json +148 -0
  505. package/dist/assets/manifests/vue/ghost-tree.manifest.json +341 -0
  506. package/dist/assets/manifests/vue/ghost-visually-hidden.manifest.json +73 -0
  507. package/dist/assets/tokens.json +6137 -0
  508. package/dist/bin.d.ts +2 -0
  509. package/dist/bin.js +11 -0
  510. package/dist/cli.d.ts +30 -0
  511. package/dist/cli.js +54 -0
  512. package/dist/components.d.ts +15 -0
  513. package/dist/components.js +402 -0
  514. package/dist/contract.d.ts +28 -0
  515. package/dist/contract.js +15 -0
  516. package/dist/docs-index.d.ts +84 -0
  517. package/dist/docs-index.js +230 -0
  518. package/dist/errors.d.ts +54 -0
  519. package/dist/errors.js +66 -0
  520. package/dist/get-examples.d.ts +30 -0
  521. package/dist/get-examples.js +269 -0
  522. package/dist/get-tokens.d.ts +27 -0
  523. package/dist/get-tokens.js +217 -0
  524. package/dist/identity.d.ts +42 -0
  525. package/dist/identity.js +99 -0
  526. package/dist/index.d.ts +16 -0
  527. package/dist/index.js +16 -0
  528. package/dist/search-docs.d.ts +24 -0
  529. package/dist/search-docs.js +132 -0
  530. package/dist/server.d.ts +81 -0
  531. package/dist/server.js +75 -0
  532. package/dist/tool.d.ts +66 -0
  533. package/dist/tool.js +130 -0
  534. package/package.json +50 -4
@@ -0,0 +1,230 @@
1
+ /**
2
+ * In-memory search index over the bundled docs corpus (GHO-17 plan §5.4,
3
+ * decision M4): whitespace query tokens, a small field-weighted BM25, and
4
+ * plain-text snippets. Pure functions only, so ranking is testable without a
5
+ * server or asset files.
6
+ */
7
+ /**
8
+ * Field weights from decision M4. A title occurrence counts as three body
9
+ * occurrences and a description occurrence as two; lengths are weighted the
10
+ * same way, and all fields share one set of corpus statistics (the body's).
11
+ * Per-field length normalization (full BM25F) was tried and rejected: the
12
+ * one-line title and description fields have tiny averages, so a single
13
+ * extra word swung scores more than the weights did.
14
+ */
15
+ const fieldWeights = { title: 3, description: 2, body: 1 };
16
+ /** Standard BM25 parameters (Lucene defaults). */
17
+ const k1 = 1.2;
18
+ const b = 0.75;
19
+ /** Plan §5.4 step 1: query tokens shorter than this are dropped. */
20
+ const minTokenLength = 2;
21
+ /** Plan §5.4 step 5: snippet length cap, ellipses included. */
22
+ export const snippetMaxLength = 280;
23
+ /** Characters of context kept before the first match in a snippet. */
24
+ const leadingContext = 60;
25
+ const ellipsis = '…';
26
+ /**
27
+ * A term is a run of letters and digits, optionally joined by `-`, `_`, or
28
+ * `.`, so identifiers such as `v-model`, `aria-label`, and
29
+ * `action.primary.bg` stay whole while markdown punctuation (`**`, `[`,
30
+ * `](`, backticks) separates words. Query tokens go through the same
31
+ * extraction, so a query matches the text as an exact term only (no
32
+ * stemming or typo tolerance in v1).
33
+ */
34
+ const termPattern = /[\p{L}\p{N}]+(?:[-_.][\p{L}\p{N}]+)*/gu;
35
+ function normalize(text) {
36
+ return text.normalize('NFKC').toLowerCase();
37
+ }
38
+ /**
39
+ * Terms are found in the original text and normalized one by one, so match
40
+ * offsets always index the original text (normalizing the whole text first
41
+ * can change its length, e.g. for ligatures).
42
+ */
43
+ function extractTerms(text) {
44
+ return Array.from(text.matchAll(termPattern), (match) => normalize(match[0]));
45
+ }
46
+ /**
47
+ * Plan §5.4 step 1: split on whitespace and drop tokens shorter than two
48
+ * characters. Each kept token is then reduced to its terms (so `button,`
49
+ * searches `button`), terms shorter than two characters are dropped too, and
50
+ * duplicates are removed so repeating a word does not double its weight.
51
+ * May return an empty list, which matches nothing.
52
+ */
53
+ export function tokenizeQuery(query) {
54
+ const terms = new Set();
55
+ for (const token of query.split(/\s+/u)) {
56
+ if (token.length < minTokenLength)
57
+ continue;
58
+ for (const term of extractTerms(token)) {
59
+ if (term.length >= minTokenLength)
60
+ terms.add(term);
61
+ }
62
+ }
63
+ return [...terms];
64
+ }
65
+ /**
66
+ * One-line plain text for snippets: HTML comments (generated-file banners)
67
+ * and heading markers are removed and whitespace is collapsed, so a window
68
+ * reads as prose rather than raw markdown layout.
69
+ */
70
+ function toSnippetText(markdown) {
71
+ return markdown
72
+ .replace(/<!--[\s\S]*?-->/gu, ' ')
73
+ .replace(/^#{1,6}\s+/gmu, '')
74
+ .replace(/\s+/gu, ' ')
75
+ .trim();
76
+ }
77
+ function addWeighted(frequency, terms, weight) {
78
+ for (const term of terms) {
79
+ frequency.set(term, (frequency.get(term) ?? 0) + weight);
80
+ }
81
+ }
82
+ /**
83
+ * Indexes `pages`, which must be in sidebar order: that order defines the
84
+ * section order used to break score ties.
85
+ */
86
+ export function buildDocsIndex(pages) {
87
+ const sections = [];
88
+ const documentFrequency = new Map();
89
+ let totalLength = 0;
90
+ const indexed = pages.map((page, order) => {
91
+ if (!sections.includes(page.section))
92
+ sections.push(page.section);
93
+ const title = extractTerms(page.title);
94
+ const description = extractTerms(page.description);
95
+ const body = extractTerms(page.body);
96
+ const termFrequency = new Map();
97
+ addWeighted(termFrequency, title, fieldWeights.title);
98
+ addWeighted(termFrequency, description, fieldWeights.description);
99
+ addWeighted(termFrequency, body, fieldWeights.body);
100
+ for (const term of termFrequency.keys()) {
101
+ documentFrequency.set(term, (documentFrequency.get(term) ?? 0) + 1);
102
+ }
103
+ const length = title.length * fieldWeights.title +
104
+ description.length * fieldWeights.description +
105
+ body.length * fieldWeights.body;
106
+ totalLength += length;
107
+ return {
108
+ page,
109
+ order,
110
+ sectionOrder: sections.indexOf(page.section),
111
+ termFrequency,
112
+ length,
113
+ };
114
+ });
115
+ return {
116
+ sections,
117
+ pages: indexed,
118
+ documentFrequency,
119
+ averageLength: indexed.length === 0 ? 0 : totalLength / indexed.length,
120
+ };
121
+ }
122
+ /**
123
+ * BM25 inverse document frequency in the Lucene form, which stays positive
124
+ * even for a term on every page, so a match never lowers a score.
125
+ */
126
+ function inverseDocumentFrequency(index, term) {
127
+ const pageCount = index.pages.length;
128
+ const frequency = index.documentFrequency.get(term) ?? 0;
129
+ return Math.log(1 + (pageCount - frequency + 0.5) / (frequency + 0.5));
130
+ }
131
+ function scorePage(index, page, terms) {
132
+ const relativeLength = index.averageLength === 0 ? 1 : page.length / index.averageLength;
133
+ let score = 0;
134
+ for (const term of terms) {
135
+ const frequency = page.termFrequency.get(term);
136
+ if (frequency === undefined)
137
+ continue;
138
+ score +=
139
+ (inverseDocumentFrequency(index, term) * frequency * (k1 + 1)) /
140
+ (frequency + k1 * (1 - b + b * relativeLength));
141
+ }
142
+ return score;
143
+ }
144
+ /** Index of the first whole-term match of any of `terms` in `text`. */
145
+ function firstMatch(text, terms) {
146
+ for (const match of text.matchAll(termPattern)) {
147
+ if (terms.has(normalize(match[0])))
148
+ return match.index;
149
+ }
150
+ return -1;
151
+ }
152
+ /**
153
+ * Cuts a window of at most {@link snippetMaxLength} characters (ellipses
154
+ * included) that starts a little before `matchIndex`, snapping both ends to
155
+ * word boundaries where that keeps the match inside the window.
156
+ */
157
+ function windowAround(text, matchIndex) {
158
+ if (text.length <= snippetMaxLength)
159
+ return text;
160
+ // Start early enough that a match near the end still fills the window.
161
+ let start = Math.max(0, Math.min(matchIndex - leadingContext, text.length - (snippetMaxLength - ellipsis.length)));
162
+ if (start > 0 && text[start - 1] !== ' ') {
163
+ const space = text.indexOf(' ', start);
164
+ if (space !== -1 && space < matchIndex)
165
+ start = space + 1;
166
+ }
167
+ const head = start > 0 ? ellipsis : '';
168
+ const room = snippetMaxLength - head.length;
169
+ if (text.length - start <= room)
170
+ return head + text.slice(start);
171
+ let end = start + room - ellipsis.length;
172
+ if (text[end] !== ' ') {
173
+ // Backing up to a space must neither drop the match nor give away more
174
+ // than half the window (a long URL or code token is cut mid-word instead).
175
+ const space = text.lastIndexOf(' ', end);
176
+ if (space > Math.max(matchIndex, start + room / 2))
177
+ end = space;
178
+ }
179
+ return `${head}${text.slice(start, end).trimEnd()}${ellipsis}`;
180
+ }
181
+ /**
182
+ * Plan §5.4 step 5: the first window of the body that contains a query term.
183
+ * A page can match on its title or description alone; it then shows the
184
+ * description when that matches, else the opening of the body.
185
+ */
186
+ export function snippetFor(page, terms) {
187
+ const wanted = new Set(terms);
188
+ const body = toSnippetText(page.body);
189
+ const bodyMatch = firstMatch(body, wanted);
190
+ if (bodyMatch !== -1)
191
+ return windowAround(body, bodyMatch);
192
+ const description = toSnippetText(page.description);
193
+ const descriptionMatch = firstMatch(description, wanted);
194
+ if (descriptionMatch !== -1) {
195
+ return windowAround(description, descriptionMatch);
196
+ }
197
+ return windowAround(body, 0);
198
+ }
199
+ /**
200
+ * Plan §5.4 steps 2–5. Pages are scored against whole-corpus statistics, so a
201
+ * `section` filter narrows the results without changing any page's score.
202
+ * Ties sort by sidebar section order, then link path (code-unit order), then
203
+ * corpus order, so equal inputs always give the same list.
204
+ */
205
+ export function searchDocsIndex(index, options) {
206
+ if (options.terms.length === 0)
207
+ return [];
208
+ return index.pages
209
+ .filter((page) => options.section === undefined || page.page.section === options.section)
210
+ .map((page) => ({ page, score: scorePage(index, page, options.terms) }))
211
+ .filter(({ score }) => score > 0)
212
+ .sort((left, right) => right.score - left.score ||
213
+ left.page.sectionOrder - right.page.sectionOrder ||
214
+ compareCodeUnits(left.page.page.link, right.page.page.link) ||
215
+ left.page.order - right.page.order)
216
+ .slice(0, options.limit)
217
+ .map(({ page: { page }, score }) => ({
218
+ title: page.title,
219
+ link: page.link,
220
+ section: page.section,
221
+ score: Math.round(score * 1000) / 1000,
222
+ snippet: snippetFor(page, options.terms),
223
+ }));
224
+ }
225
+ /** Locale-independent string order, unlike `localeCompare`. */
226
+ function compareCodeUnits(left, right) {
227
+ if (left === right)
228
+ return 0;
229
+ return left < right ? -1 : 1;
230
+ }
@@ -0,0 +1,54 @@
1
+ import { type CallToolResult } from '@modelcontextprotocol/sdk/types.js';
2
+ import { type ZodError } from 'zod';
3
+ import { toolContractSchemaVersion } from './contract.js';
4
+ /** Error codes a GhostVue MCP tool can return (GHO-17 plan §10). */
5
+ export declare const toolErrorCodes: readonly ["INVALID_INPUT", "NOT_FOUND", "VERSION_MISMATCH", "MANIFEST_INVALID", "INTERNAL"];
6
+ /** One of {@link toolErrorCodes}. */
7
+ export type ToolErrorCode = (typeof toolErrorCodes)[number];
8
+ /**
9
+ * The §10 error envelope. It is serialized as JSON into the text content of an
10
+ * `isError: true` tool result.
11
+ */
12
+ export interface ToolErrorEnvelope {
13
+ readonly code: ToolErrorCode;
14
+ readonly message: string;
15
+ readonly data: {
16
+ /** Name of the tool that failed. */
17
+ readonly tool: string;
18
+ /** `@ghostvue/mcp` version that produced the error. */
19
+ readonly ghostvueVersion: string;
20
+ /** Tool contract version, so clients can parse `data` safely. */
21
+ readonly schemaVersion: typeof toolContractSchemaVersion;
22
+ };
23
+ }
24
+ /**
25
+ * A failure a tool handler reports deliberately.
26
+ *
27
+ * Its message is part of the public contract and reaches the client verbatim,
28
+ * so it must not contain filesystem paths, stack traces, or other host
29
+ * details. Any other thrown value becomes a sanitized `INTERNAL` error.
30
+ */
31
+ export declare class GhostvueToolError extends Error {
32
+ readonly code: ToolErrorCode;
33
+ constructor(code: ToolErrorCode, message: string);
34
+ }
35
+ /** Fixed `INTERNAL` message: unexpected errors may carry paths or stacks. */
36
+ export declare function internalErrorMessage(tool: string): string;
37
+ /**
38
+ * Summarizes Zod issues as `path: message` pairs. Zod 4 issue messages
39
+ * describe the expected shape rather than echo the received value, so client
40
+ * input is not reflected back verbatim. `pathPrefix` names the field when the
41
+ * schema that failed validated a single property.
42
+ */
43
+ export declare function formatZodIssues(error: ZodError, pathPrefix?: readonly string[]): string;
44
+ /** Builds the §10 envelope for an error that is already classified. */
45
+ export declare function createErrorEnvelope(code: ToolErrorCode, message: string, tool: string, ghostvueVersion: string): ToolErrorEnvelope;
46
+ /**
47
+ * Wraps an envelope as an MCP tool error result.
48
+ *
49
+ * The envelope travels as JSON text, not `structuredContent`: MCP clients
50
+ * validate any `structuredContent` against the tool's `outputSchema` (the SDK
51
+ * client does so even when `isError` is set), and the envelope is not a
52
+ * success payload.
53
+ */
54
+ export declare function toErrorResult(envelope: ToolErrorEnvelope): CallToolResult;
package/dist/errors.js ADDED
@@ -0,0 +1,66 @@
1
+ import {} from '@modelcontextprotocol/sdk/types.js';
2
+ import {} from 'zod';
3
+ import { toolContractSchemaVersion } from './contract.js';
4
+ /** Error codes a GhostVue MCP tool can return (GHO-17 plan §10). */
5
+ export const toolErrorCodes = [
6
+ 'INVALID_INPUT',
7
+ 'NOT_FOUND',
8
+ 'VERSION_MISMATCH',
9
+ 'MANIFEST_INVALID',
10
+ 'INTERNAL',
11
+ ];
12
+ /**
13
+ * A failure a tool handler reports deliberately.
14
+ *
15
+ * Its message is part of the public contract and reaches the client verbatim,
16
+ * so it must not contain filesystem paths, stack traces, or other host
17
+ * details. Any other thrown value becomes a sanitized `INTERNAL` error.
18
+ */
19
+ export class GhostvueToolError extends Error {
20
+ code;
21
+ constructor(code, message) {
22
+ super(message);
23
+ this.name = 'GhostvueToolError';
24
+ this.code = code;
25
+ }
26
+ }
27
+ /** Fixed `INTERNAL` message: unexpected errors may carry paths or stacks. */
28
+ export function internalErrorMessage(tool) {
29
+ return `Unexpected internal error in ${tool}. See the server's stderr log for details.`;
30
+ }
31
+ /**
32
+ * Summarizes Zod issues as `path: message` pairs. Zod 4 issue messages
33
+ * describe the expected shape rather than echo the received value, so client
34
+ * input is not reflected back verbatim. `pathPrefix` names the field when the
35
+ * schema that failed validated a single property.
36
+ */
37
+ export function formatZodIssues(error, pathPrefix = []) {
38
+ return error.issues
39
+ .map((issue) => {
40
+ const path = [...pathPrefix, ...issue.path.map(String)].join('.');
41
+ return path === '' ? issue.message : `${path}: ${issue.message}`;
42
+ })
43
+ .join('; ');
44
+ }
45
+ /** Builds the §10 envelope for an error that is already classified. */
46
+ export function createErrorEnvelope(code, message, tool, ghostvueVersion) {
47
+ return {
48
+ code,
49
+ message,
50
+ data: { tool, ghostvueVersion, schemaVersion: toolContractSchemaVersion },
51
+ };
52
+ }
53
+ /**
54
+ * Wraps an envelope as an MCP tool error result.
55
+ *
56
+ * The envelope travels as JSON text, not `structuredContent`: MCP clients
57
+ * validate any `structuredContent` against the tool's `outputSchema` (the SDK
58
+ * client does so even when `isError` is set), and the envelope is not a
59
+ * success payload.
60
+ */
61
+ export function toErrorResult(envelope) {
62
+ return {
63
+ isError: true,
64
+ content: [{ type: 'text', text: JSON.stringify(envelope) }],
65
+ };
66
+ }
@@ -0,0 +1,30 @@
1
+ import { type GhostvueTool } from './tool.js';
2
+ /**
3
+ * Bundled example catalog (GHO-17 plan §4): `examples/registry.ts` metadata as
4
+ * `{ "examples": [{ id, title, description, layer, sourcePath }] }`, written
5
+ * by the asset bundler in registry order.
6
+ */
7
+ export declare const exampleCatalogFile = "examples/catalog.json";
8
+ /** Options for {@link createGetExamplesTool}. */
9
+ export interface GetExamplesToolOptions {
10
+ /** Directory holding `examples/catalog.json`, with a trailing slash. */
11
+ readonly assetsDirectory: URL;
12
+ }
13
+ /**
14
+ * Builds the `get_examples` tool (GHO-17 plan §5.3, decision M2) over the
15
+ * example catalog and sources in `assetsDirectory`.
16
+ *
17
+ * Query modes:
18
+ * - `id`: the one example with that id, or `NOT_FOUND`.
19
+ * - `component`: every example whose id starts with `component/`, in catalog
20
+ * order. No match is an empty page, not an error.
21
+ * - neither: a metadata-only catalog page; `source` is never included, so a
22
+ * client cannot pull every `.vue` file in one call.
23
+ *
24
+ * `id` and `component` are mutually exclusive. `layer` filters every mode.
25
+ * Results are paged with `limit` and `cursor` / `nextCursor`. Example SFCs
26
+ * are read as text and never executed.
27
+ */
28
+ export declare function createGetExamplesTool(options: GetExamplesToolOptions): GhostvueTool;
29
+ /** `get_examples` over the package's own bundled `dist/assets/examples/`. */
30
+ export declare const getExamplesTool: GhostvueTool;
@@ -0,0 +1,269 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { readFile } from 'node:fs/promises';
3
+ import * as z from 'zod';
4
+ import { GhostvueToolError } from './errors.js';
5
+ import { packageStampSources } from './identity.js';
6
+ import { defineTool } from './tool.js';
7
+ /**
8
+ * Bundled example catalog (GHO-17 plan §4): `examples/registry.ts` metadata as
9
+ * `{ "examples": [{ id, title, description, layer, sourcePath }] }`, written
10
+ * by the asset bundler in registry order.
11
+ */
12
+ export const exampleCatalogFile = 'examples/catalog.json';
13
+ /**
14
+ * Bundled copies of `examples/<id>.vue`. The bundler guarantees one source
15
+ * per catalog id and one catalog id per source.
16
+ */
17
+ const exampleSourcesDirectory = 'examples/sources/';
18
+ /** Default and maximum page size (GHO-17 plan §5.3). */
19
+ const defaultLimit = 50;
20
+ const maxLimit = 100;
21
+ const exampleLayerSchema = z.enum(['headless', 'themed']);
22
+ /**
23
+ * Catalog ids become file paths under `examples/sources/`, so every segment
24
+ * must start with a letter or digit. That rules out `..`, empty segments, and
25
+ * absolute paths even if a corrupted bundle carried them. Client input is
26
+ * never turned into a path: ids are only looked up in the parsed catalog.
27
+ */
28
+ const bundledIdPattern = /^[A-Za-z0-9][\w.-]*(?:\/[A-Za-z0-9][\w.-]*)+$/;
29
+ /**
30
+ * Shape the tool relies on in the bundled catalog. Loose objects let the
31
+ * bundler add fields later without breaking older servers.
32
+ */
33
+ const catalogFileSchema = z.looseObject({
34
+ examples: z.array(z.looseObject({
35
+ id: z.string().regex(bundledIdPattern),
36
+ title: z.string(),
37
+ description: z.string(),
38
+ layer: exampleLayerSchema,
39
+ sourcePath: z.string(),
40
+ })),
41
+ });
42
+ const exampleEntrySchema = z.strictObject({
43
+ id: z.string().describe('Example id, e.g. button/basic.'),
44
+ title: z.string(),
45
+ description: z.string(),
46
+ layer: exampleLayerSchema,
47
+ sourcePath: z
48
+ .string()
49
+ .describe('Repository path of the example, examples/<id>.vue.'),
50
+ source: z
51
+ .string()
52
+ .optional()
53
+ .describe('Full .vue single-file component source. Omitted when includeSource is false and on catalog pages listed without id or component.'),
54
+ });
55
+ /**
56
+ * Loads and checks the catalog at most once per process. A rejected load is
57
+ * not cached, so a transient read failure does not poison every later call.
58
+ */
59
+ function catalogLoader(assetsDirectory) {
60
+ let pending;
61
+ return () => {
62
+ pending ??= readCatalog(new URL(exampleCatalogFile, assetsDirectory)).catch((error) => {
63
+ pending = undefined;
64
+ throw error;
65
+ });
66
+ return pending;
67
+ };
68
+ }
69
+ async function readCatalog(file) {
70
+ // A missing or unreadable file propagates as a plain error, which the tool
71
+ // wrapper logs in full and reports as a sanitized INTERNAL error.
72
+ const json = JSON.parse(await readFile(file, 'utf8'));
73
+ const parsed = catalogFileSchema.safeParse(json);
74
+ // Bundled JSON that fails its shape is a release bug (§10). Messages reach
75
+ // the client, so they name the bundled file, never a host path.
76
+ if (!parsed.success) {
77
+ throw invalidCatalog(z.prettifyError(parsed.error));
78
+ }
79
+ const seen = new Set();
80
+ for (const example of parsed.data.examples) {
81
+ if (seen.has(example.id)) {
82
+ throw invalidCatalog(`example ${example.id} is listed more than once.`);
83
+ }
84
+ seen.add(example.id);
85
+ // `sourcePath` is the §3.3 identity clients see; it must name the same
86
+ // file the server reads, or a client would be told the wrong path.
87
+ if (example.sourcePath !== sourcePathOf(example.id)) {
88
+ throw invalidCatalog(`example ${example.id} has sourcePath ${example.sourcePath}, expected ${sourcePathOf(example.id)}.`);
89
+ }
90
+ }
91
+ return parsed.data.examples;
92
+ }
93
+ function invalidCatalog(detail) {
94
+ return new GhostvueToolError('MANIFEST_INVALID', `Bundled ${exampleCatalogFile} does not match the example catalog shape: ${detail}`);
95
+ }
96
+ /** §3.3: the repository path an example id names. */
97
+ function sourcePathOf(id) {
98
+ return `examples/${id}.vue`;
99
+ }
100
+ /**
101
+ * Cursors are opaque to clients (§5.3, "like `list_components`") but carry
102
+ * an offset plus a fingerprint of the filters and bundle that produced them.
103
+ * A cursor replayed with other filters, or against another bundle, would
104
+ * silently skip or repeat rows, so it is rejected as `INVALID_INPUT` instead.
105
+ * `includeSource` and `limit` are not part of the fingerprint: changing them
106
+ * between pages does not change which rows exist or their order.
107
+ */
108
+ const cursorSchema = z.strictObject({
109
+ offset: z.int().min(1),
110
+ key: z.string(),
111
+ });
112
+ function cursorKey(filters, assetBundleId) {
113
+ return createHash('sha256')
114
+ .update(JSON.stringify([assetBundleId, filters]))
115
+ .digest('base64url')
116
+ .slice(0, 22);
117
+ }
118
+ function encodeCursor(offset, key) {
119
+ return Buffer.from(JSON.stringify({ offset, key }), 'utf8').toString('base64url');
120
+ }
121
+ function decodeCursor(cursor, key, total) {
122
+ const reject = () => {
123
+ throw new GhostvueToolError('INVALID_INPUT', 'Invalid arguments: cursor: not a nextCursor from a get_examples call with the same id, component, and layer against this server. Omit cursor to start from the first page.');
124
+ };
125
+ let json;
126
+ try {
127
+ json = JSON.parse(Buffer.from(cursor, 'base64url').toString('utf8'));
128
+ }
129
+ catch {
130
+ return reject();
131
+ }
132
+ const parsed = cursorSchema.safeParse(json);
133
+ if (!parsed.success || parsed.data.key !== key)
134
+ return reject();
135
+ if (parsed.data.offset >= total)
136
+ return reject();
137
+ return parsed.data.offset;
138
+ }
139
+ /**
140
+ * Builds the `get_examples` tool (GHO-17 plan §5.3, decision M2) over the
141
+ * example catalog and sources in `assetsDirectory`.
142
+ *
143
+ * Query modes:
144
+ * - `id`: the one example with that id, or `NOT_FOUND`.
145
+ * - `component`: every example whose id starts with `component/`, in catalog
146
+ * order. No match is an empty page, not an error.
147
+ * - neither: a metadata-only catalog page; `source` is never included, so a
148
+ * client cannot pull every `.vue` file in one call.
149
+ *
150
+ * `id` and `component` are mutually exclusive. `layer` filters every mode.
151
+ * Results are paged with `limit` and `cursor` / `nextCursor`. Example SFCs
152
+ * are read as text and never executed.
153
+ */
154
+ export function createGetExamplesTool(options) {
155
+ const { assetsDirectory } = options;
156
+ const loadCatalog = catalogLoader(assetsDirectory);
157
+ async function readSource(example) {
158
+ // The id passed the bundled-id pattern, so this URL stays inside the
159
+ // sources directory.
160
+ return readFile(new URL(`${exampleSourcesDirectory}${example.id}.vue`, assetsDirectory), 'utf8');
161
+ }
162
+ return defineTool({
163
+ name: 'get_examples',
164
+ title: 'Get examples',
165
+ description: 'Read GhostVue executable examples (examples/registry.ts). Pass `id` (e.g. button/basic) for one example or `component` (e.g. button) for every example under `component/`, with .vue source unless includeSource is false. With neither, list catalog metadata only (no source), paged with cursor/nextCursor.',
166
+ input: {
167
+ id: z
168
+ .string()
169
+ .min(1)
170
+ .optional()
171
+ .describe('Single example id, e.g. button/basic.'),
172
+ component: z
173
+ .string()
174
+ // A bare kebab segment: the server appends `/`, so `button/` or a
175
+ // full id would otherwise silently match nothing.
176
+ .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, 'Must be a kebab-case example directory, e.g. button')
177
+ .optional()
178
+ .describe('Kebab-case example family, e.g. button for every id starting button/. This is the examples/ directory name, not the manifest family (ghost-button).'),
179
+ layer: exampleLayerSchema
180
+ .optional()
181
+ .describe('Only examples of this registry layer. Default: both.'),
182
+ includeSource: z
183
+ .boolean()
184
+ .default(true)
185
+ .describe('When false, omit source. Ignored without id or component: catalog pages never include source.'),
186
+ limit: z
187
+ .number()
188
+ .int()
189
+ .min(1)
190
+ .max(maxLimit)
191
+ .default(defaultLimit)
192
+ .describe(`Maximum examples per page (1–${String(maxLimit)}). Default ${String(defaultLimit)}.`),
193
+ cursor: z
194
+ .string()
195
+ .min(1)
196
+ .optional()
197
+ .describe('Opaque nextCursor from a previous response.'),
198
+ },
199
+ output: {
200
+ examples: z.array(exampleEntrySchema),
201
+ nextCursor: z
202
+ .string()
203
+ .nullable()
204
+ .describe('Pass as cursor for the next page; null on the last page.'),
205
+ },
206
+ handler: async (input, context) => {
207
+ const { id, component, layer } = input;
208
+ if (id !== undefined && component !== undefined) {
209
+ throw new GhostvueToolError('INVALID_INPUT', 'Invalid arguments: pass either id or component, not both.');
210
+ }
211
+ const catalog = await loadCatalog();
212
+ let matches;
213
+ if (id !== undefined) {
214
+ const example = catalog.find((entry) => entry.id === id);
215
+ if (example === undefined) {
216
+ throw new GhostvueToolError('NOT_FOUND', `No example with id ${id}.`);
217
+ }
218
+ // A layer filter on an exact id is an assertion about that example,
219
+ // so a mismatch is reported like an unknown id rather than as an
220
+ // empty page the client could mistake for success (as get_tokens
221
+ // does for `name` + `tier`).
222
+ if (layer !== undefined && example.layer !== layer) {
223
+ throw new GhostvueToolError('NOT_FOUND', `No ${layer} example with id ${id}; it is a ${example.layer} example.`);
224
+ }
225
+ matches = [example];
226
+ }
227
+ else {
228
+ const start = component === undefined ? undefined : `${component}/`;
229
+ matches = catalog.filter((entry) => (start === undefined || entry.id.startsWith(start)) &&
230
+ (layer === undefined || entry.layer === layer));
231
+ }
232
+ const key = cursorKey([id ?? null, component ?? null, layer ?? null], context.stamp.assetBundleId);
233
+ const offset = input.cursor === undefined
234
+ ? 0
235
+ : decodeCursor(input.cursor, key, matches.length);
236
+ const page = matches.slice(offset, offset + input.limit);
237
+ const end = offset + page.length;
238
+ // M2: source is fetched by id or component only; catalog pages stay
239
+ // small whatever includeSource says.
240
+ const withSource = input.includeSource && (id !== undefined || component !== undefined);
241
+ // At most `maxLimit` small text files per call; reading them fresh
242
+ // keeps memory flat instead of caching every source for the process.
243
+ const examples = await Promise.all(page.map(async (example) => ({
244
+ id: example.id,
245
+ title: example.title,
246
+ description: example.description,
247
+ layer: example.layer,
248
+ sourcePath: example.sourcePath,
249
+ ...(withSource ? { source: await readSource(example) } : {}),
250
+ })));
251
+ const scope = id !== undefined
252
+ ? `example ${id}`
253
+ : component !== undefined
254
+ ? `examples under ${component}/`
255
+ : 'catalog examples (metadata only)';
256
+ return {
257
+ structuredContent: {
258
+ examples,
259
+ nextCursor: end < matches.length ? encodeCursor(end, key) : null,
260
+ },
261
+ summary: `${String(page.length)} of ${String(matches.length)} ${scope}${withSource ? ' with source' : ''}.`,
262
+ };
263
+ },
264
+ });
265
+ }
266
+ /** `get_examples` over the package's own bundled `dist/assets/examples/`. */
267
+ export const getExamplesTool = createGetExamplesTool({
268
+ assetsDirectory: packageStampSources().assetsDirectory,
269
+ });
@@ -0,0 +1,27 @@
1
+ import { type GhostvueTool } from './tool.js';
2
+ /**
3
+ * Bundled token catalog: a byte-for-byte copy of the `@ghostvue/themes`
4
+ * `./tokens.json` export (GHO-17 plan §3.5), written by the asset bundler.
5
+ */
6
+ export declare const tokenCatalogFile = "tokens.json";
7
+ /** Options for {@link createGetTokensTool}. */
8
+ export interface GetTokensToolOptions {
9
+ /** Directory holding `tokens.json`, with a trailing slash. */
10
+ readonly assetsDirectory: URL;
11
+ }
12
+ /**
13
+ * Builds the `get_tokens` tool (GHO-17 plan §5.5) over the token catalog in
14
+ * `assetsDirectory`.
15
+ *
16
+ * Query modes:
17
+ * - `name`: the one token with that exact name, or `NOT_FOUND`.
18
+ * - `prefix`: tokens whose name starts with `prefix.`, in catalog order,
19
+ * capped at `limit`; `matchCount` reports how many matched before the cap.
20
+ * - neither: the catalog header only, so a client can learn modes, densities,
21
+ * and size without pulling every token (~160 KB).
22
+ *
23
+ * `name` and `prefix` are mutually exclusive.
24
+ */
25
+ export declare function createGetTokensTool(options: GetTokensToolOptions): GhostvueTool;
26
+ /** `get_tokens` over the package's own bundled `dist/assets/tokens.json`. */
27
+ export declare const getTokensTool: GhostvueTool;