@ghostvue/mcp 0.0.0-stage → 0.2.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/LICENSE +22 -0
- package/README.md +97 -2
- package/dist/assets/bundle.json +6 -0
- package/dist/assets/component-exports.json +1 -0
- package/dist/assets/docs/pages.json +1 -0
- package/dist/assets/examples/catalog.json +1 -0
- package/dist/assets/examples/sources/accordion/basic.vue +42 -0
- package/dist/assets/examples/sources/accordion/billing-faq.vue +123 -0
- package/dist/assets/examples/sources/accordion/deployment-faq.vue +169 -0
- package/dist/assets/examples/sources/accordion/navigation.vue +55 -0
- package/dist/assets/examples/sources/accordion/themed.vue +47 -0
- package/dist/assets/examples/sources/avatar/basic.vue +7 -0
- package/dist/assets/examples/sources/avatar/composable.vue +11 -0
- package/dist/assets/examples/sources/avatar/fallback.vue +11 -0
- package/dist/assets/examples/sources/avatar/image.vue +13 -0
- package/dist/assets/examples/sources/avatar/team-roster.vue +190 -0
- package/dist/assets/examples/sources/avatar/themed.vue +20 -0
- package/dist/assets/examples/sources/badge/basic.vue +7 -0
- package/dist/assets/examples/sources/badge/composable.vue +9 -0
- package/dist/assets/examples/sources/badge/icon.vue +18 -0
- package/dist/assets/examples/sources/badge/release-channels.vue +120 -0
- package/dist/assets/examples/sources/badge/table.vue +36 -0
- package/dist/assets/examples/sources/badge/themed.vue +7 -0
- package/dist/assets/examples/sources/breadcrumb/basic.vue +73 -0
- package/dist/assets/examples/sources/breadcrumb/collapsed.vue +37 -0
- package/dist/assets/examples/sources/breadcrumb/workspace-trail.vue +90 -0
- package/dist/assets/examples/sources/button/action-bar.vue +124 -0
- package/dist/assets/examples/sources/button/basic.vue +15 -0
- package/dist/assets/examples/sources/button/composable.vue +24 -0
- package/dist/assets/examples/sources/button/configured.vue +36 -0
- package/dist/assets/examples/sources/button/icon-only.vue +22 -0
- package/dist/assets/examples/sources/button/loading.vue +26 -0
- package/dist/assets/examples/sources/button/marked-parts.vue +56 -0
- package/dist/assets/examples/sources/button/ref.vue +16 -0
- package/dist/assets/examples/sources/button/refresh-status.vue +95 -0
- package/dist/assets/examples/sources/button/themed.vue +30 -0
- package/dist/assets/examples/sources/calendar/availability.vue +235 -0
- package/dist/assets/examples/sources/calendar/basic.vue +238 -0
- package/dist/assets/examples/sources/calendar/controlled.vue +246 -0
- package/dist/assets/examples/sources/calendar/locale.vue +239 -0
- package/dist/assets/examples/sources/calendar/office-locale.vue +197 -0
- package/dist/assets/examples/sources/calendar/range.vue +241 -0
- package/dist/assets/examples/sources/calendar/themed.vue +88 -0
- package/dist/assets/examples/sources/calendar/unselected.vue +229 -0
- package/dist/assets/examples/sources/card/actions.vue +15 -0
- package/dist/assets/examples/sources/card/basic.vue +17 -0
- package/dist/assets/examples/sources/card/composable.vue +12 -0
- package/dist/assets/examples/sources/card/interactive.vue +23 -0
- package/dist/assets/examples/sources/card/link.vue +19 -0
- package/dist/assets/examples/sources/card/project-summary.vue +168 -0
- package/dist/assets/examples/sources/card/themed.vue +48 -0
- package/dist/assets/examples/sources/checkbox/basic.vue +22 -0
- package/dist/assets/examples/sources/checkbox/composable.vue +28 -0
- package/dist/assets/examples/sources/checkbox/indeterminate.vue +52 -0
- package/dist/assets/examples/sources/checkbox/notification-preferences.vue +360 -0
- package/dist/assets/examples/sources/checkbox/ref.vue +35 -0
- package/dist/assets/examples/sources/checkbox/themed.vue +111 -0
- package/dist/assets/examples/sources/checkbox-group/basic.vue +56 -0
- package/dist/assets/examples/sources/checkbox-group/field.vue +73 -0
- package/dist/assets/examples/sources/checkbox-group/form.vue +100 -0
- package/dist/assets/examples/sources/checkbox-group/headless.vue +68 -0
- package/dist/assets/examples/sources/checkbox-group/notification-preferences.vue +380 -0
- package/dist/assets/examples/sources/collapsible/basic.vue +18 -0
- package/dist/assets/examples/sources/collapsible/release-notes.vue +136 -0
- package/dist/assets/examples/sources/collapsible/shipment-history.vue +135 -0
- package/dist/assets/examples/sources/collapsible/themed.vue +34 -0
- package/dist/assets/examples/sources/combobox/assignee-search.vue +544 -0
- package/dist/assets/examples/sources/combobox/async.vue +161 -0
- package/dist/assets/examples/sources/combobox/basic.vue +130 -0
- package/dist/assets/examples/sources/combobox/field.vue +137 -0
- package/dist/assets/examples/sources/combobox/form.vue +127 -0
- package/dist/assets/examples/sources/combobox/multi.vue +130 -0
- package/dist/assets/examples/sources/combobox/review-request-form.vue +415 -0
- package/dist/assets/examples/sources/combobox/themed.vue +34 -0
- package/dist/assets/examples/sources/command-palette/async.vue +152 -0
- package/dist/assets/examples/sources/command-palette/basic.vue +229 -0
- package/dist/assets/examples/sources/command-palette/shortcut.vue +214 -0
- package/dist/assets/examples/sources/command-palette/themed.vue +192 -0
- package/dist/assets/examples/sources/command-palette/virtualized.vue +196 -0
- package/dist/assets/examples/sources/context-menu/basic.vue +231 -0
- package/dist/assets/examples/sources/context-menu/themed.vue +299 -0
- package/dist/assets/examples/sources/data-table/basic-invoices.vue +52 -0
- package/dist/assets/examples/sources/data-table/full-invoices.vue +178 -0
- package/dist/assets/examples/sources/data-table/paginated-invoices.vue +172 -0
- package/dist/assets/examples/sources/data-table/preset-invoices.vue +90 -0
- package/dist/assets/examples/sources/data-table/server-invoices-router.vue +504 -0
- package/dist/assets/examples/sources/data-table/themed-invoices.vue +298 -0
- package/dist/assets/examples/sources/date-picker/basic.vue +330 -0
- package/dist/assets/examples/sources/date-picker/controlled.vue +61 -0
- package/dist/assets/examples/sources/date-picker/custom-format.vue +78 -0
- package/dist/assets/examples/sources/date-picker/nested-dialog.vue +63 -0
- package/dist/assets/examples/sources/date-picker/range.vue +345 -0
- package/dist/assets/examples/sources/date-picker/rtl.vue +46 -0
- package/dist/assets/examples/sources/date-picker/themed.vue +70 -0
- package/dist/assets/examples/sources/date-picker/validation.vue +118 -0
- package/dist/assets/examples/sources/dialog/alert.vue +74 -0
- package/dist/assets/examples/sources/dialog/basic.vue +25 -0
- package/dist/assets/examples/sources/dialog/edit-profile.vue +347 -0
- package/dist/assets/examples/sources/dialog/nested.vue +98 -0
- package/dist/assets/examples/sources/dialog/themed.vue +98 -0
- package/dist/assets/examples/sources/drawer/basic.vue +25 -0
- package/dist/assets/examples/sources/drawer/nested.vue +71 -0
- package/dist/assets/examples/sources/drawer/non-modal.vue +44 -0
- package/dist/assets/examples/sources/drawer/sides.vue +61 -0
- package/dist/assets/examples/sources/drawer/themed.vue +162 -0
- package/dist/assets/examples/sources/dropdown-menu/basic.vue +205 -0
- package/dist/assets/examples/sources/dropdown-menu/nested-export.vue +56 -0
- package/dist/assets/examples/sources/dropdown-menu/record-actions.vue +506 -0
- package/dist/assets/examples/sources/dropdown-menu/themed.vue +161 -0
- package/dist/assets/examples/sources/empty-state/basic.vue +12 -0
- package/dist/assets/examples/sources/empty-state/composable.vue +18 -0
- package/dist/assets/examples/sources/empty-state/filtered.vue +16 -0
- package/dist/assets/examples/sources/empty-state/search-results.vue +149 -0
- package/dist/assets/examples/sources/empty-state/table-cell.vue +29 -0
- package/dist/assets/examples/sources/empty-state/themed.vue +33 -0
- package/dist/assets/examples/sources/field/basic.vue +25 -0
- package/dist/assets/examples/sources/field/billing-address-headless.vue +93 -0
- package/dist/assets/examples/sources/field/billing-address.vue +192 -0
- package/dist/assets/examples/sources/field/checkbox.vue +31 -0
- package/dist/assets/examples/sources/field/invalid.vue +27 -0
- package/dist/assets/examples/sources/field/profile-settings.vue +227 -0
- package/dist/assets/examples/sources/field/textarea.vue +25 -0
- package/dist/assets/examples/sources/field/themed.vue +28 -0
- package/dist/assets/examples/sources/file-upload/asset-submission.vue +261 -0
- package/dist/assets/examples/sources/file-upload/basic.vue +30 -0
- package/dist/assets/examples/sources/file-upload/button-only.vue +33 -0
- package/dist/assets/examples/sources/file-upload/controlled.vue +49 -0
- package/dist/assets/examples/sources/file-upload/duplicates.vue +46 -0
- package/dist/assets/examples/sources/file-upload/field.vue +67 -0
- package/dist/assets/examples/sources/file-upload/form.vue +60 -0
- package/dist/assets/examples/sources/file-upload/themed.vue +50 -0
- package/dist/assets/examples/sources/file-upload/validation.vue +47 -0
- package/dist/assets/examples/sources/form/async-validation.vue +180 -0
- package/dist/assets/examples/sources/form/composable.vue +146 -0
- package/dist/assets/examples/sources/form/nested-webhooks.vue +233 -0
- package/dist/assets/examples/sources/form/profile-schema.vue +376 -0
- package/dist/assets/examples/sources/hover-card/basic.vue +121 -0
- package/dist/assets/examples/sources/hover-card/themed.vue +152 -0
- package/dist/assets/examples/sources/inline-alert/basic.vue +10 -0
- package/dist/assets/examples/sources/inline-alert/billing-notices.vue +162 -0
- package/dist/assets/examples/sources/inline-alert/composable.vue +19 -0
- package/dist/assets/examples/sources/inline-alert/feed-status.vue +229 -0
- package/dist/assets/examples/sources/inline-alert/live.vue +25 -0
- package/dist/assets/examples/sources/inline-alert/table-error.vue +21 -0
- package/dist/assets/examples/sources/inline-alert/themed.vue +13 -0
- package/dist/assets/examples/sources/input/account-details.vue +229 -0
- package/dist/assets/examples/sources/input/basic.vue +10 -0
- package/dist/assets/examples/sources/input/clearable-search-headless.vue +162 -0
- package/dist/assets/examples/sources/input/clearable-search.vue +225 -0
- package/dist/assets/examples/sources/input/composable.vue +12 -0
- package/dist/assets/examples/sources/input/ref.vue +34 -0
- package/dist/assets/examples/sources/input/search.vue +101 -0
- package/dist/assets/examples/sources/input/states.vue +96 -0
- package/dist/assets/examples/sources/input/themed.vue +55 -0
- package/dist/assets/examples/sources/input/unit-suffix.vue +109 -0
- package/dist/assets/examples/sources/interactive-surface/basic.vue +52 -0
- package/dist/assets/examples/sources/interactive-surface/button.vue +7 -0
- package/dist/assets/examples/sources/interactive-surface/composable.vue +34 -0
- package/dist/assets/examples/sources/interactive-surface/feature-tiles.vue +111 -0
- package/dist/assets/examples/sources/kbd/basic.vue +5 -0
- package/dist/assets/examples/sources/kbd/combination.vue +8 -0
- package/dist/assets/examples/sources/kbd/command-shortcuts.vue +97 -0
- package/dist/assets/examples/sources/kbd/composable.vue +17 -0
- package/dist/assets/examples/sources/kbd/platform.vue +14 -0
- package/dist/assets/examples/sources/kbd/themed.vue +25 -0
- package/dist/assets/examples/sources/link/basic.vue +7 -0
- package/dist/assets/examples/sources/link/button.vue +62 -0
- package/dist/assets/examples/sources/link/composable.vue +15 -0
- package/dist/assets/examples/sources/link/disabled.vue +9 -0
- package/dist/assets/examples/sources/link/documentation-footer.vue +103 -0
- package/dist/assets/examples/sources/link/external.vue +12 -0
- package/dist/assets/examples/sources/link/router.vue +26 -0
- package/dist/assets/examples/sources/link/themed.vue +21 -0
- package/dist/assets/examples/sources/menubar/basic.vue +208 -0
- package/dist/assets/examples/sources/menubar/themed.vue +231 -0
- package/dist/assets/examples/sources/number-input/basic.vue +20 -0
- package/dist/assets/examples/sources/number-input/bounds.vue +18 -0
- package/dist/assets/examples/sources/number-input/field.vue +34 -0
- package/dist/assets/examples/sources/number-input/form-locale.vue +29 -0
- package/dist/assets/examples/sources/number-input/order-limits.vue +226 -0
- package/dist/assets/examples/sources/number-input/ref.vue +26 -0
- package/dist/assets/examples/sources/number-input/themed.vue +26 -0
- package/dist/assets/examples/sources/number-input/workshop-booking.vue +207 -0
- package/dist/assets/examples/sources/pagination/basic.vue +54 -0
- package/dist/assets/examples/sources/pagination/controlled.vue +96 -0
- package/dist/assets/examples/sources/pagination/ellipsis.vue +59 -0
- package/dist/assets/examples/sources/pagination/themed.vue +192 -0
- package/dist/assets/examples/sources/popover/basic.vue +54 -0
- package/dist/assets/examples/sources/popover/controlled.vue +79 -0
- package/dist/assets/examples/sources/popover/share-settings.vue +457 -0
- package/dist/assets/examples/sources/popover/themed.vue +50 -0
- package/dist/assets/examples/sources/presence/basic.vue +81 -0
- package/dist/assets/examples/sources/presence/portal.vue +92 -0
- package/dist/assets/examples/sources/progress/basic.vue +25 -0
- package/dist/assets/examples/sources/progress/composable.vue +30 -0
- package/dist/assets/examples/sources/progress/indeterminate.vue +26 -0
- package/dist/assets/examples/sources/progress/report-export.vue +160 -0
- package/dist/assets/examples/sources/progress/themed.vue +30 -0
- package/dist/assets/examples/sources/progress/upload-queue.vue +173 -0
- package/dist/assets/examples/sources/progress/value-text.vue +29 -0
- package/dist/assets/examples/sources/radio-group/basic.vue +33 -0
- package/dist/assets/examples/sources/radio-group/deployment-tier.vue +258 -0
- package/dist/assets/examples/sources/radio-group/field.vue +49 -0
- package/dist/assets/examples/sources/radio-group/form.vue +45 -0
- package/dist/assets/examples/sources/radio-group/themed.vue +35 -0
- package/dist/assets/examples/sources/scroll-area/activity-feed.vue +182 -0
- package/dist/assets/examples/sources/scroll-area/basic.vue +24 -0
- package/dist/assets/examples/sources/scroll-area/composable.vue +24 -0
- package/dist/assets/examples/sources/scroll-area/horizontal.vue +180 -0
- package/dist/assets/examples/sources/scroll-area/themed.vue +77 -0
- package/dist/assets/examples/sources/scroll-spy/basic.vue +101 -0
- package/dist/assets/examples/sources/scroll-spy/composable.vue +63 -0
- package/dist/assets/examples/sources/scroll-spy/themed.vue +208 -0
- package/dist/assets/examples/sources/segmented-control/analytics-period.vue +187 -0
- package/dist/assets/examples/sources/segmented-control/basic.vue +50 -0
- package/dist/assets/examples/sources/segmented-control/themed.vue +14 -0
- package/dist/assets/examples/sources/select/alert-routing-form.vue +356 -0
- package/dist/assets/examples/sources/select/basic.vue +173 -0
- package/dist/assets/examples/sources/select/billing-preferences.vue +386 -0
- package/dist/assets/examples/sources/select/field.vue +173 -0
- package/dist/assets/examples/sources/select/form.vue +166 -0
- package/dist/assets/examples/sources/select/multiple-form.vue +201 -0
- package/dist/assets/examples/sources/select/multiple-labels.vue +142 -0
- package/dist/assets/examples/sources/select/themed.vue +74 -0
- package/dist/assets/examples/sources/separator/basic.vue +11 -0
- package/dist/assets/examples/sources/separator/composable.vue +13 -0
- package/dist/assets/examples/sources/separator/decorative.vue +11 -0
- package/dist/assets/examples/sources/separator/list.vue +12 -0
- package/dist/assets/examples/sources/separator/release-header.vue +116 -0
- package/dist/assets/examples/sources/separator/themed.vue +21 -0
- package/dist/assets/examples/sources/separator/vertical.vue +25 -0
- package/dist/assets/examples/sources/skeleton/basic.vue +9 -0
- package/dist/assets/examples/sources/skeleton/composable.vue +12 -0
- package/dist/assets/examples/sources/skeleton/profile-loading.vue +185 -0
- package/dist/assets/examples/sources/skeleton/table.vue +27 -0
- package/dist/assets/examples/sources/skeleton/themed.vue +25 -0
- package/dist/assets/examples/sources/slider/audio-mixer.vue +199 -0
- package/dist/assets/examples/sources/slider/basic.vue +51 -0
- package/dist/assets/examples/sources/slider/price-filter.vue +162 -0
- package/dist/assets/examples/sources/slider/range.vue +52 -0
- package/dist/assets/examples/sources/slider/value-text.vue +50 -0
- package/dist/assets/examples/sources/slider/vertical.vue +22 -0
- package/dist/assets/examples/sources/spinner/basic.vue +37 -0
- package/dist/assets/examples/sources/spinner/composable.vue +41 -0
- package/dist/assets/examples/sources/spinner/sync-status.vue +108 -0
- package/dist/assets/examples/sources/spinner/table-refresh.vue +24 -0
- package/dist/assets/examples/sources/spinner/themed.vue +21 -0
- package/dist/assets/examples/sources/switch/basic.vue +55 -0
- package/dist/assets/examples/sources/switch/composable.vue +61 -0
- package/dist/assets/examples/sources/switch/form.vue +56 -0
- package/dist/assets/examples/sources/switch/ref.vue +64 -0
- package/dist/assets/examples/sources/switch/states.vue +23 -0
- package/dist/assets/examples/sources/switch/themed.vue +21 -0
- package/dist/assets/examples/sources/switch/workspace-security.vue +221 -0
- package/dist/assets/examples/sources/table/basic.vue +36 -0
- package/dist/assets/examples/sources/table/composable.vue +39 -0
- package/dist/assets/examples/sources/table/contain-horizontal.vue +85 -0
- package/dist/assets/examples/sources/table/row-headers.vue +130 -0
- package/dist/assets/examples/sources/table/team-directory.vue +445 -0
- package/dist/assets/examples/sources/table/themed.vue +70 -0
- package/dist/assets/examples/sources/tabs/basic.vue +41 -0
- package/dist/assets/examples/sources/tabs/manual.vue +37 -0
- package/dist/assets/examples/sources/tabs/review-sections.vue +43 -0
- package/dist/assets/examples/sources/tabs/themed.vue +45 -0
- package/dist/assets/examples/sources/tabs/vertical.vue +51 -0
- package/dist/assets/examples/sources/tabs/workspace.vue +517 -0
- package/dist/assets/examples/sources/tags-input/headless-field.vue +31 -0
- package/dist/assets/examples/sources/tags-input/project-labels.vue +64 -0
- package/dist/assets/examples/sources/tags-input/read-only.vue +12 -0
- package/dist/assets/examples/sources/textarea/auto-resize.vue +20 -0
- package/dist/assets/examples/sources/textarea/basic.vue +14 -0
- package/dist/assets/examples/sources/textarea/composable.vue +12 -0
- package/dist/assets/examples/sources/textarea/form.vue +23 -0
- package/dist/assets/examples/sources/textarea/ref.vue +25 -0
- package/dist/assets/examples/sources/textarea/release-notes.vue +191 -0
- package/dist/assets/examples/sources/textarea/states.vue +32 -0
- package/dist/assets/examples/sources/textarea/themed.vue +19 -0
- package/dist/assets/examples/sources/toast/basic.vue +54 -0
- package/dist/assets/examples/sources/toast/persist-error.vue +94 -0
- package/dist/assets/examples/sources/toast/queue-overflow.vue +90 -0
- package/dist/assets/examples/sources/toast/themed.vue +101 -0
- package/dist/assets/examples/sources/toggle-group/basic.vue +15 -0
- package/dist/assets/examples/sources/toggle-group/editor-toolbar.vue +126 -0
- package/dist/assets/examples/sources/toggle-group/multiple.vue +19 -0
- package/dist/assets/examples/sources/toggle-group/themed.vue +11 -0
- package/dist/assets/examples/sources/toolbar/basic.vue +11 -0
- package/dist/assets/examples/sources/toolbar/composable.vue +21 -0
- package/dist/assets/examples/sources/toolbar/editor-actions.vue +115 -0
- package/dist/assets/examples/sources/toolbar/separators.vue +32 -0
- package/dist/assets/examples/sources/toolbar/themed.vue +37 -0
- package/dist/assets/examples/sources/toolbar/vertical.vue +11 -0
- package/dist/assets/examples/sources/tooltip/basic.vue +47 -0
- package/dist/assets/examples/sources/tooltip/themed.vue +167 -0
- package/dist/assets/examples/sources/tooltip-provider/skip-delay.vue +69 -0
- package/dist/assets/examples/sources/tree/basic.vue +77 -0
- package/dist/assets/examples/sources/tree/multi-select.vue +88 -0
- package/dist/assets/examples/sources/tree/rtl.vue +34 -0
- package/dist/assets/examples/sources/tree/split-trigger.vue +47 -0
- package/dist/assets/examples/sources/tree/themed.vue +183 -0
- package/dist/assets/examples/sources/visually-hidden/action-bar.vue +100 -0
- package/dist/assets/examples/sources/visually-hidden/basic.vue +17 -0
- package/dist/assets/examples/sources/visually-hidden/composable.vue +19 -0
- package/dist/assets/examples/sources/visually-hidden/icon-name.vue +28 -0
- package/dist/assets/examples/sources/visually-hidden/live-region.vue +18 -0
- package/dist/assets/examples/sources/visually-hidden/skip-link.vue +12 -0
- package/dist/assets/examples/sources/visually-hidden/table-header.vue +27 -0
- package/dist/assets/manifest.schema.json +742 -0
- package/dist/assets/manifests/themes/ghost-accordion.manifest.json +53 -0
- package/dist/assets/manifests/themes/ghost-avatar.manifest.json +131 -0
- package/dist/assets/manifests/themes/ghost-badge.manifest.json +180 -0
- package/dist/assets/manifests/themes/ghost-breadcrumb.manifest.json +53 -0
- package/dist/assets/manifests/themes/ghost-button.manifest.json +397 -0
- package/dist/assets/manifests/themes/ghost-calendar.manifest.json +52 -0
- package/dist/assets/manifests/themes/ghost-card.manifest.json +104 -0
- package/dist/assets/manifests/themes/ghost-checkbox-group.manifest.json +90 -0
- package/dist/assets/manifests/themes/ghost-checkbox.manifest.json +241 -0
- package/dist/assets/manifests/themes/ghost-collapsible.manifest.json +114 -0
- package/dist/assets/manifests/themes/ghost-combobox.manifest.json +81 -0
- package/dist/assets/manifests/themes/ghost-command-palette.manifest.json +81 -0
- package/dist/assets/manifests/themes/ghost-context-menu.manifest.json +50 -0
- package/dist/assets/manifests/themes/ghost-data-table-preset.manifest.json +58 -0
- package/dist/assets/manifests/themes/ghost-data-table-table.manifest.json +30 -0
- package/dist/assets/manifests/themes/ghost-data-table.manifest.json +64 -0
- package/dist/assets/manifests/themes/ghost-date-picker.manifest.json +69 -0
- package/dist/assets/manifests/themes/ghost-dialog.manifest.json +184 -0
- package/dist/assets/manifests/themes/ghost-drawer.manifest.json +224 -0
- package/dist/assets/manifests/themes/ghost-dropdown-menu.manifest.json +140 -0
- package/dist/assets/manifests/themes/ghost-empty-state.manifest.json +96 -0
- package/dist/assets/manifests/themes/ghost-field.manifest.json +107 -0
- package/dist/assets/manifests/themes/ghost-file-upload.manifest.json +289 -0
- package/dist/assets/manifests/themes/ghost-hover-card.manifest.json +33 -0
- package/dist/assets/manifests/themes/ghost-inline-alert.manifest.json +71 -0
- package/dist/assets/manifests/themes/ghost-input.manifest.json +240 -0
- package/dist/assets/manifests/themes/ghost-interactive-surface.manifest.json +110 -0
- package/dist/assets/manifests/themes/ghost-kbd.manifest.json +148 -0
- package/dist/assets/manifests/themes/ghost-link.manifest.json +197 -0
- package/dist/assets/manifests/themes/ghost-menubar.manifest.json +51 -0
- package/dist/assets/manifests/themes/ghost-number-input.manifest.json +208 -0
- package/dist/assets/manifests/themes/ghost-pagination.manifest.json +80 -0
- package/dist/assets/manifests/themes/ghost-popover.manifest.json +147 -0
- package/dist/assets/manifests/themes/ghost-progress.manifest.json +141 -0
- package/dist/assets/manifests/themes/ghost-radio-group-item.manifest.json +63 -0
- package/dist/assets/manifests/themes/ghost-radio-group.manifest.json +60 -0
- package/dist/assets/manifests/themes/ghost-scroll-area.manifest.json +76 -0
- package/dist/assets/manifests/themes/ghost-scroll-spy.manifest.json +44 -0
- package/dist/assets/manifests/themes/ghost-segmented-control-item.manifest.json +64 -0
- package/dist/assets/manifests/themes/ghost-segmented-control.manifest.json +71 -0
- package/dist/assets/manifests/themes/ghost-select.manifest.json +69 -0
- package/dist/assets/manifests/themes/ghost-separator.manifest.json +66 -0
- package/dist/assets/manifests/themes/ghost-skeleton.manifest.json +98 -0
- package/dist/assets/manifests/themes/ghost-slider.manifest.json +120 -0
- package/dist/assets/manifests/themes/ghost-spinner.manifest.json +104 -0
- package/dist/assets/manifests/themes/ghost-switch.manifest.json +288 -0
- package/dist/assets/manifests/themes/ghost-table.manifest.json +61 -0
- package/dist/assets/manifests/themes/ghost-tabs.manifest.json +51 -0
- package/dist/assets/manifests/themes/ghost-tags-input.manifest.json +255 -0
- package/dist/assets/manifests/themes/ghost-textarea.manifest.json +238 -0
- package/dist/assets/manifests/themes/ghost-toast.manifest.json +121 -0
- package/dist/assets/manifests/themes/ghost-toggle-group-item.manifest.json +65 -0
- package/dist/assets/manifests/themes/ghost-toggle-group.manifest.json +67 -0
- package/dist/assets/manifests/themes/ghost-toolbar.manifest.json +111 -0
- package/dist/assets/manifests/themes/ghost-tooltip.manifest.json +113 -0
- package/dist/assets/manifests/themes/ghost-tree.manifest.json +295 -0
- package/dist/assets/manifests/vue/ghost-accordion-content.manifest.json +67 -0
- package/dist/assets/manifests/vue/ghost-accordion-item.manifest.json +47 -0
- package/dist/assets/manifests/vue/ghost-accordion-trigger.manifest.json +59 -0
- package/dist/assets/manifests/vue/ghost-accordion.manifest.json +171 -0
- package/dist/assets/manifests/vue/ghost-avatar.manifest.json +102 -0
- package/dist/assets/manifests/vue/ghost-badge.manifest.json +53 -0
- package/dist/assets/manifests/vue/ghost-breadcrumb-ellipsis.manifest.json +80 -0
- package/dist/assets/manifests/vue/ghost-breadcrumb-item.manifest.json +57 -0
- package/dist/assets/manifests/vue/ghost-breadcrumb-link.manifest.json +71 -0
- package/dist/assets/manifests/vue/ghost-breadcrumb-list.manifest.json +69 -0
- package/dist/assets/manifests/vue/ghost-breadcrumb-page.manifest.json +59 -0
- package/dist/assets/manifests/vue/ghost-breadcrumb-separator.manifest.json +59 -0
- package/dist/assets/manifests/vue/ghost-breadcrumb.manifest.json +82 -0
- package/dist/assets/manifests/vue/ghost-button.manifest.json +109 -0
- package/dist/assets/manifests/vue/ghost-calendar-cell.manifest.json +107 -0
- package/dist/assets/manifests/vue/ghost-calendar-grid.manifest.json +105 -0
- package/dist/assets/manifests/vue/ghost-calendar-header.manifest.json +59 -0
- package/dist/assets/manifests/vue/ghost-calendar-heading.manifest.json +70 -0
- package/dist/assets/manifests/vue/ghost-calendar-next-button.manifest.json +59 -0
- package/dist/assets/manifests/vue/ghost-calendar-prev-button.manifest.json +59 -0
- package/dist/assets/manifests/vue/ghost-calendar.manifest.json +173 -0
- package/dist/assets/manifests/vue/ghost-card.manifest.json +107 -0
- package/dist/assets/manifests/vue/ghost-checkbox-group.manifest.json +173 -0
- package/dist/assets/manifests/vue/ghost-checkbox.manifest.json +134 -0
- package/dist/assets/manifests/vue/ghost-collapsible-content.manifest.json +81 -0
- package/dist/assets/manifests/vue/ghost-collapsible-trigger.manifest.json +81 -0
- package/dist/assets/manifests/vue/ghost-collapsible.manifest.json +99 -0
- package/dist/assets/manifests/vue/ghost-combobox-content.manifest.json +114 -0
- package/dist/assets/manifests/vue/ghost-combobox-empty.manifest.json +40 -0
- package/dist/assets/manifests/vue/ghost-combobox-group.manifest.json +40 -0
- package/dist/assets/manifests/vue/ghost-combobox-input.manifest.json +61 -0
- package/dist/assets/manifests/vue/ghost-combobox-label.manifest.json +40 -0
- package/dist/assets/manifests/vue/ghost-combobox-option.manifest.json +80 -0
- package/dist/assets/manifests/vue/ghost-combobox-trigger.manifest.json +67 -0
- package/dist/assets/manifests/vue/ghost-combobox.manifest.json +323 -0
- package/dist/assets/manifests/vue/ghost-command-palette-content.manifest.json +142 -0
- package/dist/assets/manifests/vue/ghost-command-palette-empty.manifest.json +69 -0
- package/dist/assets/manifests/vue/ghost-command-palette-group.manifest.json +71 -0
- package/dist/assets/manifests/vue/ghost-command-palette-input.manifest.json +88 -0
- package/dist/assets/manifests/vue/ghost-command-palette-item.manifest.json +102 -0
- package/dist/assets/manifests/vue/ghost-command-palette-label.manifest.json +69 -0
- package/dist/assets/manifests/vue/ghost-command-palette-list.manifest.json +72 -0
- package/dist/assets/manifests/vue/ghost-command-palette-overlay.manifest.json +96 -0
- package/dist/assets/manifests/vue/ghost-command-palette-separator.manifest.json +63 -0
- package/dist/assets/manifests/vue/ghost-command-palette-title.manifest.json +69 -0
- package/dist/assets/manifests/vue/ghost-command-palette-trigger.manifest.json +89 -0
- package/dist/assets/manifests/vue/ghost-command-palette.manifest.json +358 -0
- package/dist/assets/manifests/vue/ghost-context-menu-checkbox-item.manifest.json +110 -0
- package/dist/assets/manifests/vue/ghost-context-menu-content.manifest.json +114 -0
- package/dist/assets/manifests/vue/ghost-context-menu-group.manifest.json +40 -0
- package/dist/assets/manifests/vue/ghost-context-menu-item.manifest.json +85 -0
- package/dist/assets/manifests/vue/ghost-context-menu-label.manifest.json +40 -0
- package/dist/assets/manifests/vue/ghost-context-menu-radio-group.manifest.json +69 -0
- package/dist/assets/manifests/vue/ghost-context-menu-radio-item.manifest.json +97 -0
- package/dist/assets/manifests/vue/ghost-context-menu-separator.manifest.json +42 -0
- package/dist/assets/manifests/vue/ghost-context-menu-trigger.manifest.json +75 -0
- package/dist/assets/manifests/vue/ghost-context-menu.manifest.json +73 -0
- package/dist/assets/manifests/vue/ghost-data-table-preset.manifest.json +171 -0
- package/dist/assets/manifests/vue/ghost-data-table-table.manifest.json +56 -0
- package/dist/assets/manifests/vue/ghost-data-table.manifest.json +384 -0
- package/dist/assets/manifests/vue/ghost-date-picker-calendar.manifest.json +38 -0
- package/dist/assets/manifests/vue/ghost-date-picker-content.manifest.json +140 -0
- package/dist/assets/manifests/vue/ghost-date-picker-input.manifest.json +85 -0
- package/dist/assets/manifests/vue/ghost-date-picker-trigger.manifest.json +59 -0
- package/dist/assets/manifests/vue/ghost-date-picker.manifest.json +347 -0
- package/dist/assets/manifests/vue/ghost-dialog-close.manifest.json +80 -0
- package/dist/assets/manifests/vue/ghost-dialog-content.manifest.json +145 -0
- package/dist/assets/manifests/vue/ghost-dialog-description.manifest.json +69 -0
- package/dist/assets/manifests/vue/ghost-dialog-overlay.manifest.json +94 -0
- package/dist/assets/manifests/vue/ghost-dialog-title.manifest.json +69 -0
- package/dist/assets/manifests/vue/ghost-dialog-trigger.manifest.json +93 -0
- package/dist/assets/manifests/vue/ghost-dialog.manifest.json +125 -0
- package/dist/assets/manifests/vue/ghost-drawer-close.manifest.json +80 -0
- package/dist/assets/manifests/vue/ghost-drawer-content.manifest.json +141 -0
- package/dist/assets/manifests/vue/ghost-drawer-description.manifest.json +69 -0
- package/dist/assets/manifests/vue/ghost-drawer-overlay.manifest.json +94 -0
- package/dist/assets/manifests/vue/ghost-drawer-title.manifest.json +69 -0
- package/dist/assets/manifests/vue/ghost-drawer-trigger.manifest.json +93 -0
- package/dist/assets/manifests/vue/ghost-drawer.manifest.json +149 -0
- package/dist/assets/manifests/vue/ghost-dropdown-menu-checkbox-item.manifest.json +110 -0
- package/dist/assets/manifests/vue/ghost-dropdown-menu-content.manifest.json +114 -0
- package/dist/assets/manifests/vue/ghost-dropdown-menu-group.manifest.json +40 -0
- package/dist/assets/manifests/vue/ghost-dropdown-menu-item.manifest.json +85 -0
- package/dist/assets/manifests/vue/ghost-dropdown-menu-label.manifest.json +40 -0
- package/dist/assets/manifests/vue/ghost-dropdown-menu-radio-group.manifest.json +69 -0
- package/dist/assets/manifests/vue/ghost-dropdown-menu-radio-item.manifest.json +97 -0
- package/dist/assets/manifests/vue/ghost-dropdown-menu-separator.manifest.json +42 -0
- package/dist/assets/manifests/vue/ghost-dropdown-menu-trigger.manifest.json +67 -0
- package/dist/assets/manifests/vue/ghost-dropdown-menu.manifest.json +67 -0
- package/dist/assets/manifests/vue/ghost-empty-state.manifest.json +98 -0
- package/dist/assets/manifests/vue/ghost-field-control.manifest.json +59 -0
- package/dist/assets/manifests/vue/ghost-field-description.manifest.json +59 -0
- package/dist/assets/manifests/vue/ghost-field-error.manifest.json +70 -0
- package/dist/assets/manifests/vue/ghost-field-label.manifest.json +83 -0
- package/dist/assets/manifests/vue/ghost-field.manifest.json +141 -0
- package/dist/assets/manifests/vue/ghost-file-upload-dropzone.manifest.json +67 -0
- package/dist/assets/manifests/vue/ghost-file-upload-item-remove.manifest.json +65 -0
- package/dist/assets/manifests/vue/ghost-file-upload-item.manifest.json +56 -0
- package/dist/assets/manifests/vue/ghost-file-upload-list.manifest.json +50 -0
- package/dist/assets/manifests/vue/ghost-file-upload-trigger.manifest.json +82 -0
- package/dist/assets/manifests/vue/ghost-file-upload.manifest.json +247 -0
- package/dist/assets/manifests/vue/ghost-form.manifest.json +221 -0
- package/dist/assets/manifests/vue/ghost-hover-card-content.manifest.json +130 -0
- package/dist/assets/manifests/vue/ghost-hover-card-trigger.manifest.json +76 -0
- package/dist/assets/manifests/vue/ghost-hover-card.manifest.json +99 -0
- package/dist/assets/manifests/vue/ghost-inline-alert.manifest.json +98 -0
- package/dist/assets/manifests/vue/ghost-input.manifest.json +133 -0
- package/dist/assets/manifests/vue/ghost-interactive-surface.manifest.json +101 -0
- package/dist/assets/manifests/vue/ghost-kbd.manifest.json +66 -0
- package/dist/assets/manifests/vue/ghost-link.manifest.json +111 -0
- package/dist/assets/manifests/vue/ghost-menubar-checkbox-item.manifest.json +110 -0
- package/dist/assets/manifests/vue/ghost-menubar-content.manifest.json +114 -0
- package/dist/assets/manifests/vue/ghost-menubar-group.manifest.json +40 -0
- package/dist/assets/manifests/vue/ghost-menubar-item.manifest.json +85 -0
- package/dist/assets/manifests/vue/ghost-menubar-label.manifest.json +40 -0
- package/dist/assets/manifests/vue/ghost-menubar-menu.manifest.json +65 -0
- package/dist/assets/manifests/vue/ghost-menubar-radio-group.manifest.json +69 -0
- package/dist/assets/manifests/vue/ghost-menubar-radio-item.manifest.json +97 -0
- package/dist/assets/manifests/vue/ghost-menubar-separator.manifest.json +42 -0
- package/dist/assets/manifests/vue/ghost-menubar-trigger.manifest.json +67 -0
- package/dist/assets/manifests/vue/ghost-menubar.manifest.json +62 -0
- package/dist/assets/manifests/vue/ghost-number-input.manifest.json +205 -0
- package/dist/assets/manifests/vue/ghost-pagination.manifest.json +247 -0
- package/dist/assets/manifests/vue/ghost-popover-close.manifest.json +80 -0
- package/dist/assets/manifests/vue/ghost-popover-content.manifest.json +138 -0
- package/dist/assets/manifests/vue/ghost-popover-trigger.manifest.json +93 -0
- package/dist/assets/manifests/vue/ghost-popover.manifest.json +103 -0
- package/dist/assets/manifests/vue/ghost-portal.manifest.json +56 -0
- package/dist/assets/manifests/vue/ghost-presence.manifest.json +96 -0
- package/dist/assets/manifests/vue/ghost-progress.manifest.json +77 -0
- package/dist/assets/manifests/vue/ghost-radio-group-item.manifest.json +73 -0
- package/dist/assets/manifests/vue/ghost-radio-group.manifest.json +148 -0
- package/dist/assets/manifests/vue/ghost-scroll-area.manifest.json +92 -0
- package/dist/assets/manifests/vue/ghost-scroll-spy-item.manifest.json +60 -0
- package/dist/assets/manifests/vue/ghost-scroll-spy-link.manifest.json +98 -0
- package/dist/assets/manifests/vue/ghost-scroll-spy-list.manifest.json +52 -0
- package/dist/assets/manifests/vue/ghost-scroll-spy.manifest.json +244 -0
- package/dist/assets/manifests/vue/ghost-segmented-control-indicator.manifest.json +25 -0
- package/dist/assets/manifests/vue/ghost-segmented-control-item.manifest.json +91 -0
- package/dist/assets/manifests/vue/ghost-segmented-control.manifest.json +147 -0
- package/dist/assets/manifests/vue/ghost-select-content.manifest.json +119 -0
- package/dist/assets/manifests/vue/ghost-select-group.manifest.json +45 -0
- package/dist/assets/manifests/vue/ghost-select-label.manifest.json +45 -0
- package/dist/assets/manifests/vue/ghost-select-option.manifest.json +85 -0
- package/dist/assets/manifests/vue/ghost-select-trigger.manifest.json +72 -0
- package/dist/assets/manifests/vue/ghost-select-value.manifest.json +52 -0
- package/dist/assets/manifests/vue/ghost-select.manifest.json +200 -0
- package/dist/assets/manifests/vue/ghost-separator.manifest.json +70 -0
- package/dist/assets/manifests/vue/ghost-skeleton.manifest.json +52 -0
- package/dist/assets/manifests/vue/ghost-slider.manifest.json +297 -0
- package/dist/assets/manifests/vue/ghost-spinner.manifest.json +42 -0
- package/dist/assets/manifests/vue/ghost-submenu-content.manifest.json +168 -0
- package/dist/assets/manifests/vue/ghost-submenu-trigger.manifest.json +102 -0
- package/dist/assets/manifests/vue/ghost-submenu.manifest.json +59 -0
- package/dist/assets/manifests/vue/ghost-switch.manifest.json +183 -0
- package/dist/assets/manifests/vue/ghost-table-body.manifest.json +38 -0
- package/dist/assets/manifests/vue/ghost-table-caption.manifest.json +38 -0
- package/dist/assets/manifests/vue/ghost-table-cell.manifest.json +38 -0
- package/dist/assets/manifests/vue/ghost-table-foot.manifest.json +38 -0
- package/dist/assets/manifests/vue/ghost-table-head.manifest.json +38 -0
- package/dist/assets/manifests/vue/ghost-table-header-cell.manifest.json +51 -0
- package/dist/assets/manifests/vue/ghost-table-row.manifest.json +38 -0
- package/dist/assets/manifests/vue/ghost-table.manifest.json +67 -0
- package/dist/assets/manifests/vue/ghost-tabs-content.manifest.json +66 -0
- package/dist/assets/manifests/vue/ghost-tabs-list.manifest.json +59 -0
- package/dist/assets/manifests/vue/ghost-tabs-trigger.manifest.json +74 -0
- package/dist/assets/manifests/vue/ghost-tabs.manifest.json +100 -0
- package/dist/assets/manifests/vue/ghost-tags-input.manifest.json +260 -0
- package/dist/assets/manifests/vue/ghost-textarea.manifest.json +147 -0
- package/dist/assets/manifests/vue/ghost-toast-action.manifest.json +69 -0
- package/dist/assets/manifests/vue/ghost-toast-close.manifest.json +69 -0
- package/dist/assets/manifests/vue/ghost-toast-description.manifest.json +48 -0
- package/dist/assets/manifests/vue/ghost-toast-provider.manifest.json +61 -0
- package/dist/assets/manifests/vue/ghost-toast-title.manifest.json +48 -0
- package/dist/assets/manifests/vue/ghost-toast-viewport.manifest.json +102 -0
- package/dist/assets/manifests/vue/ghost-toast.manifest.json +73 -0
- package/dist/assets/manifests/vue/ghost-toggle-group-item.manifest.json +93 -0
- package/dist/assets/manifests/vue/ghost-toggle-group.manifest.json +135 -0
- package/dist/assets/manifests/vue/ghost-toolbar.manifest.json +118 -0
- package/dist/assets/manifests/vue/ghost-tooltip-content.manifest.json +131 -0
- package/dist/assets/manifests/vue/ghost-tooltip-provider.manifest.json +55 -0
- package/dist/assets/manifests/vue/ghost-tooltip-trigger.manifest.json +90 -0
- package/dist/assets/manifests/vue/ghost-tooltip.manifest.json +93 -0
- package/dist/assets/manifests/vue/ghost-tree-group.manifest.json +119 -0
- package/dist/assets/manifests/vue/ghost-tree-item.manifest.json +286 -0
- package/dist/assets/manifests/vue/ghost-tree-trigger.manifest.json +148 -0
- package/dist/assets/manifests/vue/ghost-tree.manifest.json +341 -0
- package/dist/assets/manifests/vue/ghost-visually-hidden.manifest.json +73 -0
- package/dist/assets/tokens.json +6152 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +11 -0
- package/dist/cli.d.ts +30 -0
- package/dist/cli.js +54 -0
- package/dist/components.d.ts +20 -0
- package/dist/components.js +471 -0
- package/dist/contract.d.ts +28 -0
- package/dist/contract.js +15 -0
- package/dist/docs-index.d.ts +84 -0
- package/dist/docs-index.js +230 -0
- package/dist/errors.d.ts +54 -0
- package/dist/errors.js +66 -0
- package/dist/get-examples.d.ts +30 -0
- package/dist/get-examples.js +269 -0
- package/dist/get-tokens.d.ts +27 -0
- package/dist/get-tokens.js +217 -0
- package/dist/identity.d.ts +42 -0
- package/dist/identity.js +99 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +16 -0
- package/dist/search-docs.d.ts +24 -0
- package/dist/search-docs.js +132 -0
- package/dist/server.d.ts +81 -0
- package/dist/server.js +75 -0
- package/dist/tool.d.ts +66 -0
- package/dist/tool.js +130 -0
- package/package.json +50 -4
|
@@ -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;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import * as z from 'zod';
|
|
3
|
+
import { GhostvueToolError } from './errors.js';
|
|
4
|
+
import { packageStampSources } from './identity.js';
|
|
5
|
+
import { defineTool } from './tool.js';
|
|
6
|
+
/**
|
|
7
|
+
* Bundled token catalog: a byte-for-byte copy of the `@ghostvue/themes`
|
|
8
|
+
* `./tokens.json` export (GHO-17 plan §3.5), written by the asset bundler.
|
|
9
|
+
*/
|
|
10
|
+
export const tokenCatalogFile = 'tokens.json';
|
|
11
|
+
/** Default and maximum page size for prefix queries (GHO-17 plan §8 M5). */
|
|
12
|
+
const defaultLimit = 100;
|
|
13
|
+
const maxLimit = 2000;
|
|
14
|
+
const tokenTierSchema = z.enum(['primitive', 'semantic']);
|
|
15
|
+
/**
|
|
16
|
+
* Shape the tool relies on in the bundled catalog. Loose objects let the
|
|
17
|
+
* themes pipeline add fields (`aliases`, `density`, `reducedMotion`, …)
|
|
18
|
+
* without breaking the server; only the fields the tool serves are checked.
|
|
19
|
+
* `value` maps every mode (`light`, `dark`) to a resolved CSS literal.
|
|
20
|
+
* `cssVar` is optional because the themes build emits custom properties for
|
|
21
|
+
* semantic tokens only; primitives are inlined into them and have no variable.
|
|
22
|
+
*/
|
|
23
|
+
const catalogFileSchema = z.looseObject({
|
|
24
|
+
schemaVersion: z.string().min(1),
|
|
25
|
+
theme: z.string().min(1),
|
|
26
|
+
modes: z.array(z.string().min(1)),
|
|
27
|
+
densities: z.array(z.string().min(1)),
|
|
28
|
+
attributes: z.record(z.string(), z.string()),
|
|
29
|
+
tokens: z.array(z.looseObject({
|
|
30
|
+
name: z.string().min(1),
|
|
31
|
+
type: z.string().min(1),
|
|
32
|
+
tier: tokenTierSchema,
|
|
33
|
+
cssVar: z.string().min(1).optional(),
|
|
34
|
+
value: z.record(z.string(), z.string()),
|
|
35
|
+
})),
|
|
36
|
+
});
|
|
37
|
+
const catalogHeaderSchema = z.strictObject({
|
|
38
|
+
schemaVersion: z.string(),
|
|
39
|
+
theme: z.string(),
|
|
40
|
+
modes: z.array(z.string()),
|
|
41
|
+
densities: z.array(z.string()),
|
|
42
|
+
attributes: z.record(z.string(), z.string()),
|
|
43
|
+
tokenCount: z
|
|
44
|
+
.number()
|
|
45
|
+
.int()
|
|
46
|
+
.nonnegative()
|
|
47
|
+
.describe('Number of tokens in the whole catalog.'),
|
|
48
|
+
});
|
|
49
|
+
const tokenEntrySchema = z.strictObject({
|
|
50
|
+
name: z.string(),
|
|
51
|
+
type: z.string(),
|
|
52
|
+
tier: tokenTierSchema,
|
|
53
|
+
cssVar: z
|
|
54
|
+
.string()
|
|
55
|
+
.optional()
|
|
56
|
+
.describe('CSS custom property, e.g. --ghost-action-primary-bg. Omitted for tokens the themes build does not emit as a variable (primitives).'),
|
|
57
|
+
value: z
|
|
58
|
+
.record(z.string(), z.string())
|
|
59
|
+
.optional()
|
|
60
|
+
.describe('Resolved value per mode. Omitted when includeValues is false.'),
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Loads the catalog at most once per process. A rejected load is not cached,
|
|
64
|
+
* so a transient read failure does not poison every later call.
|
|
65
|
+
*/
|
|
66
|
+
function catalogLoader(assetsDirectory) {
|
|
67
|
+
let pending;
|
|
68
|
+
return () => {
|
|
69
|
+
pending ??= readCatalog(new URL(tokenCatalogFile, assetsDirectory)).catch((error) => {
|
|
70
|
+
pending = undefined;
|
|
71
|
+
throw error;
|
|
72
|
+
});
|
|
73
|
+
return pending;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
async function readCatalog(file) {
|
|
77
|
+
// A missing or unreadable file propagates as a plain error, which the tool
|
|
78
|
+
// wrapper logs in full and reports as a sanitized INTERNAL error.
|
|
79
|
+
const json = JSON.parse(await readFile(file, 'utf8'));
|
|
80
|
+
const parsed = catalogFileSchema.safeParse(json);
|
|
81
|
+
if (!parsed.success) {
|
|
82
|
+
// Bundled JSON that fails its shape is a release bug (§10). The message
|
|
83
|
+
// reaches the client, so it names the bundled file, never a host path.
|
|
84
|
+
throw new GhostvueToolError('MANIFEST_INVALID', `Bundled ${tokenCatalogFile} does not match the token catalog shape: ${z.prettifyError(parsed.error)}`);
|
|
85
|
+
}
|
|
86
|
+
return parsed.data;
|
|
87
|
+
}
|
|
88
|
+
function toEntry(token, includeValues) {
|
|
89
|
+
const { name, type, tier, cssVar } = token;
|
|
90
|
+
return {
|
|
91
|
+
name,
|
|
92
|
+
type,
|
|
93
|
+
tier,
|
|
94
|
+
...(cssVar === undefined ? {} : { cssVar }),
|
|
95
|
+
...(includeValues ? { value: token.value } : {}),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Builds the `get_tokens` tool (GHO-17 plan §5.5) over the token catalog in
|
|
100
|
+
* `assetsDirectory`.
|
|
101
|
+
*
|
|
102
|
+
* Query modes:
|
|
103
|
+
* - `name`: the one token with that exact name, or `NOT_FOUND`.
|
|
104
|
+
* - `prefix`: tokens whose name starts with `prefix.`, in catalog order,
|
|
105
|
+
* capped at `limit`; `matchCount` reports how many matched before the cap.
|
|
106
|
+
* - neither: the catalog header only, so a client can learn modes, densities,
|
|
107
|
+
* and size without pulling every token (~160 KB).
|
|
108
|
+
*
|
|
109
|
+
* `name` and `prefix` are mutually exclusive.
|
|
110
|
+
*/
|
|
111
|
+
export function createGetTokensTool(options) {
|
|
112
|
+
const loadCatalog = catalogLoader(options.assetsDirectory);
|
|
113
|
+
return defineTool({
|
|
114
|
+
name: 'get_tokens',
|
|
115
|
+
title: 'Get design tokens',
|
|
116
|
+
description: 'Read the resolved GhostVue design-token catalog (@ghostvue/themes tokens.json). Pass `name` for one exact token or `prefix` for every token under `prefix.`; omit both for the catalog header (modes, densities, attributes, token count) only.',
|
|
117
|
+
input: {
|
|
118
|
+
name: z
|
|
119
|
+
.string()
|
|
120
|
+
.min(1)
|
|
121
|
+
.optional()
|
|
122
|
+
.describe('Exact token name, e.g. action.primary.bg.'),
|
|
123
|
+
prefix: z
|
|
124
|
+
.string()
|
|
125
|
+
.min(1)
|
|
126
|
+
// `prefix` is a dotted path; the server appends the separator, so a
|
|
127
|
+
// trailing dot would otherwise silently match nothing.
|
|
128
|
+
.regex(/[^.]$/, 'Must not end with "."')
|
|
129
|
+
.optional()
|
|
130
|
+
.describe('Return tokens whose name starts with `prefix.`, e.g. action.primary.'),
|
|
131
|
+
tier: tokenTierSchema
|
|
132
|
+
.optional()
|
|
133
|
+
.describe('Only tokens of this tier. Default: all tiers.'),
|
|
134
|
+
includeValues: z
|
|
135
|
+
.boolean()
|
|
136
|
+
.default(true)
|
|
137
|
+
.describe('When false, omit per-mode values and return names, types, tiers, and CSS variables only.'),
|
|
138
|
+
limit: z
|
|
139
|
+
.number()
|
|
140
|
+
.int()
|
|
141
|
+
.min(1)
|
|
142
|
+
.max(maxLimit)
|
|
143
|
+
.default(defaultLimit)
|
|
144
|
+
.describe(`Maximum tokens returned for a prefix query (1–${String(maxLimit)}). Default ${String(defaultLimit)}.`),
|
|
145
|
+
},
|
|
146
|
+
output: {
|
|
147
|
+
catalog: catalogHeaderSchema,
|
|
148
|
+
tokens: z
|
|
149
|
+
.array(tokenEntrySchema)
|
|
150
|
+
.optional()
|
|
151
|
+
.describe('Matching tokens. Omitted for a header-only request.'),
|
|
152
|
+
matchCount: z
|
|
153
|
+
.number()
|
|
154
|
+
.int()
|
|
155
|
+
.nonnegative()
|
|
156
|
+
.optional()
|
|
157
|
+
.describe('Prefix queries only: tokens that matched before `limit` was applied.'),
|
|
158
|
+
},
|
|
159
|
+
handler: async ({ name, prefix, tier, includeValues, limit }) => {
|
|
160
|
+
if (name !== undefined && prefix !== undefined) {
|
|
161
|
+
throw new GhostvueToolError('INVALID_INPUT', 'Invalid arguments: pass either name or prefix, not both.');
|
|
162
|
+
}
|
|
163
|
+
const catalog = await loadCatalog();
|
|
164
|
+
const header = {
|
|
165
|
+
schemaVersion: catalog.schemaVersion,
|
|
166
|
+
theme: catalog.theme,
|
|
167
|
+
modes: catalog.modes,
|
|
168
|
+
densities: catalog.densities,
|
|
169
|
+
attributes: catalog.attributes,
|
|
170
|
+
tokenCount: catalog.tokens.length,
|
|
171
|
+
};
|
|
172
|
+
if (name !== undefined) {
|
|
173
|
+
const token = catalog.tokens.find((entry) => entry.name === name);
|
|
174
|
+
if (token === undefined) {
|
|
175
|
+
throw new GhostvueToolError('NOT_FOUND', `No token named ${name}.`);
|
|
176
|
+
}
|
|
177
|
+
// A tier filter on an exact name is an assertion about that token, so
|
|
178
|
+
// a mismatch is reported like an unknown name rather than as an empty
|
|
179
|
+
// list the client could mistake for success.
|
|
180
|
+
if (tier !== undefined && token.tier !== tier) {
|
|
181
|
+
throw new GhostvueToolError('NOT_FOUND', `No ${tier} token named ${name}; it is a ${token.tier} token.`);
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
structuredContent: {
|
|
185
|
+
catalog: header,
|
|
186
|
+
tokens: [toEntry(token, includeValues)],
|
|
187
|
+
},
|
|
188
|
+
summary: `Token ${name} (${token.tier} ${token.type}${token.cssVar === undefined ? '' : `, ${token.cssVar}`}).`,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
if (prefix !== undefined) {
|
|
192
|
+
const start = `${prefix}.`;
|
|
193
|
+
const matches = catalog.tokens.filter((entry) => entry.name.startsWith(start) &&
|
|
194
|
+
(tier === undefined || entry.tier === tier));
|
|
195
|
+
const tokens = matches
|
|
196
|
+
.slice(0, limit)
|
|
197
|
+
.map((entry) => toEntry(entry, includeValues));
|
|
198
|
+
return {
|
|
199
|
+
structuredContent: {
|
|
200
|
+
catalog: header,
|
|
201
|
+
tokens,
|
|
202
|
+
matchCount: matches.length,
|
|
203
|
+
},
|
|
204
|
+
summary: `${String(tokens.length)} of ${String(matches.length)} tokens under ${start}`,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
structuredContent: { catalog: header },
|
|
209
|
+
summary: `Token catalog ${catalog.theme}: ${String(header.tokenCount)} tokens. Pass name or prefix to read entries.`,
|
|
210
|
+
};
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
/** `get_tokens` over the package's own bundled `dist/assets/tokens.json`. */
|
|
215
|
+
export const getTokensTool = createGetTokensTool({
|
|
216
|
+
assetsDirectory: packageStampSources().assetsDirectory,
|
|
217
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type GhostvueStamp } from './contract.js';
|
|
2
|
+
/**
|
|
3
|
+
* Bundle identity file, written by the offline asset bundler (GHO-226) next
|
|
4
|
+
* to the other bundled assets. It holds the `assetBundleId` hash the bundler
|
|
5
|
+
* computes over every bundled byte; the server only reads it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const assetBundleIdentityFile = "bundle.json";
|
|
8
|
+
/** Bundled copy of `@ghostvue/core/manifest.schema.json` (GHO-17 plan §4). */
|
|
9
|
+
export declare const manifestSchemaFile = "manifest.schema.json";
|
|
10
|
+
/**
|
|
11
|
+
* `$id` of the component manifest schema this server speaks (ADR 0006). It is
|
|
12
|
+
* hosted at this URL on the docs site because `@ghostvue/core`, which carries
|
|
13
|
+
* the source copy, is never published. The bundled schema must carry exactly
|
|
14
|
+
* this `$id`, so the `manifestSchemaId` stamp cannot drift from the URL that
|
|
15
|
+
* clients resolve.
|
|
16
|
+
*/
|
|
17
|
+
export declare const manifestSchemaId = "https://ghostvue.dev/schemas/v1/manifest.schema.json";
|
|
18
|
+
/** Where the identity of a server process comes from. */
|
|
19
|
+
export interface StampSources {
|
|
20
|
+
/** Directory holding the bundled assets, with a trailing slash. */
|
|
21
|
+
readonly assetsDirectory: URL;
|
|
22
|
+
/** The `@ghostvue/mcp` `package.json` that names the served version. */
|
|
23
|
+
readonly packageJson: URL;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The package's own asset bundle and `package.json`.
|
|
27
|
+
*
|
|
28
|
+
* Both resolve relative to this module, so the published server reads only
|
|
29
|
+
* from its install directory (`dist/assets/` and the package root) and never
|
|
30
|
+
* from the working directory, the environment, or arguments (GHO-17 plan §2).
|
|
31
|
+
*/
|
|
32
|
+
export declare function packageStampSources(): StampSources;
|
|
33
|
+
/** The bundle or package metadata is missing or malformed. */
|
|
34
|
+
export declare class AssetBundleError extends Error {
|
|
35
|
+
constructor(message: string, options?: ErrorOptions);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Reads the {@link GhostvueStamp} once at startup. A server that cannot
|
|
39
|
+
* identify its bundle must not answer tool calls, so any failure is an
|
|
40
|
+
* {@link AssetBundleError} the caller reports before serving.
|
|
41
|
+
*/
|
|
42
|
+
export declare function loadGhostvueStamp(sources: StampSources): Promise<GhostvueStamp>;
|
package/dist/identity.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import * as z from 'zod';
|
|
3
|
+
import {} from './contract.js';
|
|
4
|
+
/**
|
|
5
|
+
* Bundle identity file, written by the offline asset bundler (GHO-226) next
|
|
6
|
+
* to the other bundled assets. It holds the `assetBundleId` hash the bundler
|
|
7
|
+
* computes over every bundled byte; the server only reads it.
|
|
8
|
+
*/
|
|
9
|
+
export const assetBundleIdentityFile = 'bundle.json';
|
|
10
|
+
/** Bundled copy of `@ghostvue/core/manifest.schema.json` (GHO-17 plan §4). */
|
|
11
|
+
export const manifestSchemaFile = 'manifest.schema.json';
|
|
12
|
+
/**
|
|
13
|
+
* `$id` of the component manifest schema this server speaks (ADR 0006). It is
|
|
14
|
+
* hosted at this URL on the docs site because `@ghostvue/core`, which carries
|
|
15
|
+
* the source copy, is never published. The bundled schema must carry exactly
|
|
16
|
+
* this `$id`, so the `manifestSchemaId` stamp cannot drift from the URL that
|
|
17
|
+
* clients resolve.
|
|
18
|
+
*/
|
|
19
|
+
export const manifestSchemaId = 'https://ghostvue.dev/schemas/v1/manifest.schema.json';
|
|
20
|
+
/**
|
|
21
|
+
* The package's own asset bundle and `package.json`.
|
|
22
|
+
*
|
|
23
|
+
* Both resolve relative to this module, so the published server reads only
|
|
24
|
+
* from its install directory (`dist/assets/` and the package root) and never
|
|
25
|
+
* from the working directory, the environment, or arguments (GHO-17 plan §2).
|
|
26
|
+
*/
|
|
27
|
+
export function packageStampSources() {
|
|
28
|
+
return {
|
|
29
|
+
assetsDirectory: new URL('./assets/', import.meta.url),
|
|
30
|
+
packageJson: new URL('../package.json', import.meta.url),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** The bundle or package metadata is missing or malformed. */
|
|
34
|
+
export class AssetBundleError extends Error {
|
|
35
|
+
constructor(message, options) {
|
|
36
|
+
super(message, options);
|
|
37
|
+
this.name = 'AssetBundleError';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const packageJsonSchema = z.looseObject({ version: z.string().min(1) });
|
|
41
|
+
const bundleIdentitySchema = z.looseObject({
|
|
42
|
+
assetBundleId: z.string().regex(/^sha256:[0-9a-f]{64}$/),
|
|
43
|
+
});
|
|
44
|
+
const manifestSchemaIdSchema = z.looseObject({
|
|
45
|
+
$id: z.literal(manifestSchemaId),
|
|
46
|
+
});
|
|
47
|
+
async function readJson(file, schema, label) {
|
|
48
|
+
let text;
|
|
49
|
+
try {
|
|
50
|
+
text = await readFile(file, 'utf8');
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
throw new AssetBundleError(`Cannot read ${label} at ${file.pathname}. Build @ghostvue/mcp so its asset bundle exists.`, { cause: error });
|
|
54
|
+
}
|
|
55
|
+
let json;
|
|
56
|
+
try {
|
|
57
|
+
json = JSON.parse(text);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
throw new AssetBundleError(`${label} at ${file.pathname} is not JSON.`, {
|
|
61
|
+
cause: error,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
const parsed = schema.safeParse(json);
|
|
65
|
+
if (!parsed.success) {
|
|
66
|
+
throw new AssetBundleError(`${label} at ${file.pathname} is invalid: ${z.prettifyError(parsed.error)}`);
|
|
67
|
+
}
|
|
68
|
+
return parsed.data;
|
|
69
|
+
}
|
|
70
|
+
function fulfilled(result) {
|
|
71
|
+
if (result.status === 'rejected')
|
|
72
|
+
throw result.reason;
|
|
73
|
+
return result.value;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Reads the {@link GhostvueStamp} once at startup. A server that cannot
|
|
77
|
+
* identify its bundle must not answer tool calls, so any failure is an
|
|
78
|
+
* {@link AssetBundleError} the caller reports before serving.
|
|
79
|
+
*/
|
|
80
|
+
export async function loadGhostvueStamp(sources) {
|
|
81
|
+
// allSettled + declared-order rejection keeps the diagnostic stable when
|
|
82
|
+
// several files are missing; Promise.all would surface whichever read
|
|
83
|
+
// happened to fail first.
|
|
84
|
+
const results = await Promise.allSettled([
|
|
85
|
+
readJson(sources.packageJson, packageJsonSchema, '@ghostvue/mcp package.json'),
|
|
86
|
+
readJson(new URL(assetBundleIdentityFile, sources.assetsDirectory), bundleIdentitySchema, 'Asset bundle identity'),
|
|
87
|
+
readJson(new URL(manifestSchemaFile, sources.assetsDirectory), manifestSchemaIdSchema, 'Bundled manifest schema'),
|
|
88
|
+
]);
|
|
89
|
+
const [packageJson, bundle, manifestSchema] = [
|
|
90
|
+
fulfilled(results[0]),
|
|
91
|
+
fulfilled(results[1]),
|
|
92
|
+
fulfilled(results[2]),
|
|
93
|
+
];
|
|
94
|
+
return {
|
|
95
|
+
version: packageJson.version,
|
|
96
|
+
assetBundleId: bundle.assetBundleId,
|
|
97
|
+
manifestSchemaId: manifestSchema.$id,
|
|
98
|
+
};
|
|
99
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public entry point for `@ghostvue/mcp`.
|
|
3
|
+
*
|
|
4
|
+
* The package is consumed through its `ghostvue-mcp` stdio bin; these exports
|
|
5
|
+
* are the server plumbing the discovery tools (GHO-228 to GHO-231) build on.
|
|
6
|
+
* The full contract is docs/plans/gho-17-mcp-first-release.md.
|
|
7
|
+
*/
|
|
8
|
+
export { binName, builtInTools, runCli, type CliOptions } from './cli.js';
|
|
9
|
+
export { ghostvueStampSchema, toolContractSchemaVersion, type GhostvueStamp, } from './contract.js';
|
|
10
|
+
export { GhostvueToolError, toolErrorCodes, type ToolErrorCode, type ToolErrorEnvelope, } from './errors.js';
|
|
11
|
+
export { createGetExamplesTool, exampleCatalogFile, getExamplesTool, type GetExamplesToolOptions, } from './get-examples.js';
|
|
12
|
+
export { createGetTokensTool, getTokensTool, tokenCatalogFile, type GetTokensToolOptions, } from './get-tokens.js';
|
|
13
|
+
export { AssetBundleError, assetBundleIdentityFile, loadGhostvueStamp, manifestSchemaFile, manifestSchemaId, packageStampSources, type StampSources, } from './identity.js';
|
|
14
|
+
export { createSearchDocsTool, docsPagesFile, searchDocsTool, type SearchDocsToolOptions, } from './search-docs.js';
|
|
15
|
+
export { createGhostvueServer, serverName, serveStdio, type GhostvueServerOptions, type StdioServeOptions, } from './server.js';
|
|
16
|
+
export { defineTool, type DiagnosticLog, type GhostvueTool, type ToolContext, type ToolDefinition, type ToolSuccess, } from './tool.js';
|