@wix/agent-skills 1.15.1 → 1.16.1
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/README.md +3 -7
- package/package.json +1 -1
- package/skills/wix-app/SKILL.md +4 -1
- package/skills/wix-app/references/APP_TOOLS.md +134 -0
- package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +1 -1
- package/skills/wix-app/references/DASHBOARD_PAGE.md +0 -10
- package/skills/wix-app/references/DATA_COLLECTION.md +1 -1
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +42 -8
- package/skills/wix-app/references/SERVICE_PLUGIN.md +12 -10
- package/skills/wix-app/references/app-tools/TOOLS.md +75 -0
- package/skills/wix-app/references/dashboard-page/DASHBOARD_API.md +2 -2
- package/skills/wix-app/references/editor-react-component/A11Y-REVIEW-REFERENCE.md +172 -0
- package/skills/wix-app/references/editor-react-component/A11Y-REVIEW.md +143 -0
- package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +23 -2
- package/skills/wix-app/references/editor-react-component/BRANDED-COMPONENTS.md +29 -0
- package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +1 -1
- package/skills/wix-app/references/editor-react-component/COMPONENT-CONFIGURATION.md +60 -0
- package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +27 -2
- package/skills/wix-app/references/editor-react-component/DESIGN-STATES.md +5 -3
- package/skills/wix-app/references/editor-react-component/DIRECTIONALITY.md +24 -7
- package/skills/wix-app/references/editor-react-component/PARTS.md +15 -2
- package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +2 -3
- package/skills/wix-app/references/editor-react-component/SITE-CONTEXT-HOOKS.md +187 -0
- package/skills/wix-app/references/service-plugin/BOOKINGS-STAFF-SORTING.md +13 -9
- package/skills/wix-app/references/service-plugin/DISCOUNT-TRIGGERS.md +4 -0
- package/skills/wix-app/references/service-plugin/GIFT-CARDS.md +4 -0
- package/skills/wix-app/references/service-plugin/PAYMENT-SETTINGS.md +3 -1
- package/skills/wix-app/references/service-plugin/SHIPPING-RATES.md +4 -0
- package/skills/wix-app/references/service-plugin/TOOLS_PROVIDER.md +54 -0
- package/skills/wix-app/references/stores/QUERY.md +32 -0
- package/skills/wix-app/scripts/scan-a11y-code.cjs +777 -0
- package/skills/wix-app/scripts/scan-a11y-eslint.cjs +201 -0
- package/skills/wix-docs/SKILL.md +35 -3
- package/skills/wix-headless/SKILL.md +3 -1
- package/skills/wix-headless/references/CAPABILITIES.md +16 -3
- package/skills/wix-headless/references/CONTENT.md +36 -0
- package/skills/wix-headless/references/DESIGN.md +54 -0
- package/skills/wix-headless/references/DISCOVERY.md +24 -0
- package/skills/wix-headless/references/IMAGE_GENERATION.md +10 -0
- package/skills/wix-headless/references/SDK_HANDOFF.md +1 -1
- package/skills/wix-headless/references/SEED.md +1 -1
- package/skills/wix-headless/references/inline-recipes/how-to-code-a-store.md +3 -2
- package/skills/wix-headless/references/inline-recipes/how-to-code-forms.md +560 -102
- package/skills/wix-headless/references/inline-recipes/setup-forms.md +210 -143
- package/skills/wix-headless/references/inline-recipes/setup-online-store.md +32 -23
- package/skills/wix-headless/references/managed/CONNECT.md +1 -1
- package/skills/wix-headless/references/managed/CREATE.md +14 -0
- package/skills/wix-headless/references/managed/DEPLOYMENT.md +25 -0
- package/skills/wix-manage/SKILL.md +130 -7
- package/skills/wix-manage/references/accessibility/scan-site-accessibility.md +98 -0
- package/skills/wix-manage/references/analytics/analytics-dashboard-navigation.md +40 -0
- package/skills/wix-manage/references/app-installation/app-installation-dashboard-navigation.md +28 -0
- package/skills/wix-manage/references/blog/blog-dashboard-navigation.md +56 -0
- package/skills/wix-manage/references/blog/how-to-create-blog-posts.md +31 -6
- package/skills/wix-manage/references/bookings/booking-service-policy-setup.md +3 -1
- package/skills/wix-manage/references/bookings/bookings-dashboard-navigation.md +63 -0
- package/skills/wix-manage/references/bookings/diagnose-availability-issues.md +10 -1
- package/skills/wix-manage/references/cms/cms-dashboard-navigation.md +44 -0
- package/skills/wix-manage/references/cms/cms-data-items-crud.md +31 -3
- package/skills/wix-manage/references/cms/cms-publishing-flow.md +287 -0
- package/skills/wix-manage/references/cms/cms-schema-management.md +27 -1
- package/skills/wix-manage/references/contacts/contacts-dashboard-navigation.md +46 -0
- package/skills/wix-manage/references/contacts/create-a-contact.md +82 -0
- package/skills/wix-manage/references/contacts/update-a-contact.md +119 -0
- package/skills/wix-manage/references/dashboard-navigation/dashboard-navigation.md +82 -0
- package/skills/wix-manage/references/dashboard-navigation/routes.json +1733 -0
- package/skills/wix-manage/references/domains/domains-dashboard-navigation.md +32 -0
- package/skills/wix-manage/references/ecommerce/ecom-pricing.md +4 -4
- package/skills/wix-manage/references/ecommerce/ecom-shipping.md +1 -1
- package/skills/wix-manage/references/ecommerce/gift-cards/ecom-gift-cards-goal-sell-gift-cards.md +338 -0
- package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-create-discount-rule.md +42 -78
- package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-flow-bundle-and-save.md +1 -1
- package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-flow-stock-mover.md +1 -1
- package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-flow-upsell-boost.md +1 -1
- package/skills/wix-manage/references/ecommerce/recommend-ecommerce-strategy.md +90 -92
- package/skills/wix-manage/references/events/create-wix-event.md +176 -0
- package/skills/wix-manage/references/events/manage-wix-events.md +174 -0
- package/skills/wix-manage/references/forms/forms-dashboard-navigation.md +44 -0
- package/skills/wix-manage/references/get-paid/get-paid-dashboard-navigation.md +52 -0
- package/skills/wix-manage/references/google-ads/billing-and-payment.md +80 -0
- package/skills/wix-manage/references/google-ads/create-performance-max-campaign.md +212 -0
- package/skills/wix-manage/references/google-ads/get-campaign-suggestions.md +110 -0
- package/skills/wix-manage/references/google-ads/google-ads-dashboard-navigation.md +25 -0
- package/skills/wix-manage/references/google-ads/install-and-create-account.md +155 -0
- package/skills/wix-manage/references/google-ads/manage-campaign-lifecycle.md +63 -0
- package/skills/wix-manage/references/google-ads/query-campaign-analytics.md +155 -0
- package/skills/wix-manage/references/marketing/marketing-dashboard-navigation.md +52 -0
- package/skills/wix-manage/references/pricing-plans/create-and-update-pricing-plans.md +99 -1
- package/skills/wix-manage/references/pricing-plans/pricing-plans-dashboard-navigation.md +45 -0
- package/skills/wix-manage/references/restaurants/restaurants-dashboard-navigation.md +68 -0
- package/skills/wix-manage/references/restaurants/wix-restaurants-setup.md +94 -125
- package/skills/wix-manage/references/site-properties/change-payment-currency-site-properties.md +48 -9
- package/skills/wix-manage/references/site-properties/site-properties-dashboard-navigation.md +31 -0
- package/skills/wix-manage/references/sites/create-headless-site.md +52 -0
- package/skills/wix-manage/references/sites/create-site-from-template.md +2 -25
- package/skills/wix-manage/references/sites/site-import.md +217 -192
- package/skills/wix-manage/references/sites/sites-dashboard-navigation.md +29 -0
- package/skills/wix-manage/references/stores/add-store-pages-to-site.md +17 -1
- package/skills/wix-manage/references/stores/find-products-query-and-search-catalog-v3.md +26 -8
- package/skills/wix-manage/references/stores/stores-dashboard-navigation.md +65 -0
- package/skills/wix-manage/references/stores/update-product-with-options.md +39 -7
- package/skills/wix-replatform/.publish-manifest.json +8 -0
- package/skills/wix-replatform/SKILL.md +693 -0
- package/skills/wix-replatform/lib/artifact-freshness.js +215 -0
- package/skills/wix-replatform/lib/completion-report.js +200 -0
- package/skills/wix-replatform/lib/config-env.js +59 -0
- package/skills/wix-replatform/lib/execution-manifest.js +185 -0
- package/skills/wix-replatform/lib/execution-state.js +173 -0
- package/skills/wix-replatform/lib/import-recovery.js +313 -0
- package/skills/wix-replatform/lib/local-state.js +642 -0
- package/skills/wix-replatform/lib/orchestration-preflight.js +143 -0
- package/skills/wix-replatform/lib/orchestration-router.js +122 -0
- package/skills/wix-replatform/lib/orchestration-state.js +455 -0
- package/skills/wix-replatform/lib/progress-log.js +224 -0
- package/skills/wix-replatform/lib/progress-log.sh +140 -0
- package/skills/wix-replatform/lib/url-preservation-state.js +391 -0
- package/skills/wix-replatform/resources/rp-discovery/SKILL.md +184 -0
- package/skills/wix-replatform/resources/rp-execute-import/SKILL.md +529 -0
- package/skills/wix-replatform/resources/rp-execute-setup/SKILL.md +316 -0
- package/skills/wix-replatform/resources/rp-execute-setup/scripts/mint-token.sh +64 -0
- package/skills/wix-replatform/resources/rp-import-codegen/SKILL.md +1114 -0
- package/skills/wix-replatform/resources/rp-mapper/SKILL.md +430 -0
- package/skills/wix-replatform/resources/rp-mapper/lib/mapping-resolve.js +217 -0
- package/skills/wix-replatform/resources/rp-mapper/scripts/resolve-mapping.js +148 -0
- package/skills/wix-replatform/resources/rp-mapper/wix-business-solutions-taxonomy.md +378 -0
- package/skills/wix-replatform/resources/rp-setup-discovery/SKILL.md +183 -0
- package/skills/wix-replatform/resources/rp-source-csv/SKILL.md +478 -0
- package/skills/wix-replatform/resources/rp-source-csv/lib/canonical-record.js +136 -0
- package/skills/wix-replatform/resources/rp-source-csv/lib/csv-fileset.js +0 -0
- package/skills/wix-replatform/resources/rp-source-csv/lib/csv-fingerprint.js +310 -0
- package/skills/wix-replatform/resources/rp-source-csv/lib/csv-layout.js +1081 -0
- package/skills/wix-replatform/resources/rp-source-csv/lib/csv-parse.js +618 -0
- package/skills/wix-replatform/resources/rp-source-csv/scripts/csv-discovery.js +949 -0
- package/skills/wix-replatform/resources/rp-source-csv/source-schema.example.json +196 -0
- package/skills/wix-replatform/resources/rp-source-csv/vendors/bigcommerce.json +66 -0
- package/skills/wix-replatform/resources/rp-source-csv/vendors/magento.json +60 -0
- package/skills/wix-replatform/resources/rp-source-csv/vendors/shopify.json +95 -0
- package/skills/wix-replatform/resources/rp-source-csv/vendors/woocommerce.json +82 -0
- package/skills/wix-replatform/resources/rp-source-wordpress/SKILL.md +256 -0
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-http.js +249 -0
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-route-classifier.js +444 -0
- package/skills/wix-replatform/resources/rp-source-wordpress/scripts/wp-discovery.js +774 -0
- package/skills/wix-replatform/resources/rp-source-wordpress/source-schema.example.json +71 -0
- package/skills/wix-replatform/resources/rp-target-wix/SKILL.md +632 -0
- package/skills/wix-replatform/resources/rp-target-wix/SPEC-product-reviews-and-blog-authorship.md +330 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/README.md +21 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/domain.json +19 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/category.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/comment.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/post.json +39 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/tag.json +35 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/cms/domain.json +14 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/collection.json +35 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/data-item.json +36 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/reference.json +35 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/crm/domain.json +14 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/contact.json +131 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/email-subscription.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/label.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/domain.json +21 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-line-item.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-refund.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order.json +97 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/index.json +528 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/media/domain.json +14 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/media/entities/media-file.json +38 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/media/entities/media-folder.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/members/domain.json +13 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/members/entities/badge.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/members/entities/member.json +53 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/schema.json +84 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/domain.json +25 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/category.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/coupon.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/inventory-item.json +38 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/product-tag.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/product.json +90 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/audit-summary.js +64 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/contract-ledger.js +141 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/domain-knowledge.js +384 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/ndjson.js +260 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/stores-verification.js +238 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/wix-build.js +237 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/wix-target-spec.js +238 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/wix-writers.js +2219 -0
- package/skills/wix-replatform/resources/rp-target-wix/scripts/domain-knowledge-validate.js +31 -0
- package/skills/wix-replatform/resources/rp-target-wix/scripts/domain-knowledge.js +100 -0
- package/skills/wix-replatform/resources/rp-target-wix/scripts/verify-stores.js +107 -0
- package/skills/wix-replatform/resources/rp-telemetry/SKILL.md +344 -0
- package/skills/wix-replatform/resources/rp-telemetry/lib/bi-sink.js +250 -0
- package/skills/wix-replatform/resources/rp-telemetry/lib/telemetry-recorder.js +1927 -0
- package/skills/wix-replatform/resources/rp-telemetry/scripts/meter-from-audit.js +83 -0
- package/skills/wix-replatform/resources/rp-telemetry/scripts/rp-telemetry.js +141 -0
- package/skills/wix-replatform/scripts/artifact-freshness.js +76 -0
- package/skills/wix-replatform/scripts/execution-manifest-validate.js +43 -0
- package/skills/wix-replatform/scripts/execution-state-prepare.js +128 -0
- package/skills/wix-replatform/scripts/orchestration-preflight.js +48 -0
- package/skills/wix-replatform/scripts/orchestration-route.js +46 -0
- package/skills/wix-replatform/scripts/orchestration-state.js +245 -0
- package/skills/wix-vibe-headless/SKILL.md +49 -25
- package/skills/wix-vibe-headless/install/deploy.cjs +156 -0
- package/skills/wix-vibe-headless/install/pin-agents-md.cjs +34 -0
- package/skills/wix-vibe-headless/platforms/README.md +8 -4
- package/skills/wix-vibe-headless/platforms/base44.md +111 -101
- package/skills/wix-vibe-headless/platforms/generic.md +99 -64
- package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +226 -119
- package/skills/wix-vibe-headless/references/blog/app/components/PostCard.jsx +43 -0
- package/skills/wix-vibe-headless/references/blog/app/components/PostChips.jsx +25 -0
- package/skills/wix-vibe-headless/references/blog/app/components/PostGrid.jsx +15 -0
- package/skills/wix-vibe-headless/references/blog/app/context/TaxonomyContext.jsx +35 -0
- package/skills/wix-vibe-headless/references/blog/app/hooks/usePostDetail.js +38 -0
- package/skills/wix-vibe-headless/references/blog/app/pages/Blog.jsx +40 -0
- package/skills/wix-vibe-headless/references/blog/app/pages/CategoryPage.jsx +54 -0
- package/skills/wix-vibe-headless/references/blog/app/pages/PostDetail.jsx +65 -0
- package/skills/wix-vibe-headless/references/blog/app/pages/TagPage.jsx +50 -0
- package/skills/wix-vibe-headless/references/blog/seed/SEED.md +103 -0
- package/skills/wix-vibe-headless/references/blog/seed/seed-blog.js +270 -0
- package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +256 -149
- package/skills/wix-vibe-headless/references/bookings/app/components/BookingForm.jsx +65 -0
- package/skills/wix-vibe-headless/references/bookings/app/components/ServiceCard.jsx +47 -0
- package/skills/wix-vibe-headless/references/bookings/app/components/ServiceGrid.jsx +13 -0
- package/skills/wix-vibe-headless/references/bookings/app/components/SlotPicker.jsx +126 -0
- package/skills/wix-vibe-headless/references/bookings/app/hooks/useServiceDetail.js +108 -0
- package/skills/wix-vibe-headless/references/bookings/app/hooks/useServices.js +58 -0
- package/skills/wix-vibe-headless/references/bookings/app/lib/serviceFacts.js +95 -0
- package/skills/wix-vibe-headless/references/bookings/app/pages/ServiceDetail.jsx +94 -0
- package/skills/wix-vibe-headless/references/bookings/app/pages/Services.jsx +89 -0
- package/skills/wix-vibe-headless/references/bookings/{wix-bookings-checkout.js → app/rest/wix-bookings-checkout.js} +1 -1
- package/skills/wix-vibe-headless/references/bookings/{wix-bookings-services.js → app/rest/wix-bookings-services.js} +87 -11
- package/skills/wix-vibe-headless/references/bookings/seed/SEED.md +117 -0
- package/skills/wix-vibe-headless/references/bookings/seed/seed-bookings.js +333 -0
- package/skills/wix-vibe-headless/references/cms/INSTRUCTIONS.md +168 -147
- package/skills/wix-vibe-headless/references/cms/app/collection.config.js +31 -0
- package/skills/wix-vibe-headless/references/cms/app/lib/wixImage.js +18 -0
- package/skills/wix-vibe-headless/references/cms/{wix-cms.js → app/rest/wix-cms.js} +47 -2
- package/skills/wix-vibe-headless/references/cms/seed/SEED.md +145 -0
- package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +223 -131
- package/skills/wix-vibe-headless/references/events/app/components/CategoryFilter.jsx +23 -0
- package/skills/wix-vibe-headless/references/events/app/components/EventCard.jsx +43 -0
- package/skills/wix-vibe-headless/references/events/app/components/EventGrid.jsx +13 -0
- package/skills/wix-vibe-headless/references/events/app/components/EventRegistration.jsx +29 -0
- package/skills/wix-vibe-headless/references/events/app/components/RsvpForm.jsx +57 -0
- package/skills/wix-vibe-headless/references/events/app/components/TicketPicker.jsx +78 -0
- package/skills/wix-vibe-headless/references/events/app/hooks/useEventDetail.js +27 -0
- package/skills/wix-vibe-headless/references/events/app/hooks/useEventsList.js +54 -0
- package/skills/wix-vibe-headless/references/events/app/hooks/useRsvpForm.js +40 -0
- package/skills/wix-vibe-headless/references/events/app/hooks/useTicketing.js +81 -0
- package/skills/wix-vibe-headless/references/events/app/pages/EventDetail.jsx +48 -0
- package/skills/wix-vibe-headless/references/events/app/pages/Events.jsx +36 -0
- package/skills/wix-vibe-headless/references/events/{wix-events-browse.js → app/rest/wix-events-browse.js} +1 -1
- package/skills/wix-vibe-headless/references/events/seed/SEED.md +107 -0
- package/skills/wix-vibe-headless/references/events/seed/seed-events.js +251 -0
- package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +272 -188
- package/skills/wix-vibe-headless/references/members/app/components/LoginForm.jsx +101 -0
- package/skills/wix-vibe-headless/references/members/app/components/MemberMenu.jsx +33 -0
- package/skills/wix-vibe-headless/references/members/app/components/RequireAuth.jsx +21 -0
- package/skills/wix-vibe-headless/references/members/app/components/SocialButtons.jsx +29 -0
- package/skills/wix-vibe-headless/references/members/app/context/MemberContext.jsx +54 -0
- package/skills/wix-vibe-headless/references/members/app/hooks/useLoginForm.js +77 -0
- package/skills/wix-vibe-headless/references/members/app/pages/Account.jsx +36 -0
- package/skills/wix-vibe-headless/references/members/app/pages/Callback.jsx +32 -0
- package/skills/wix-vibe-headless/references/members/app/pages/Login.jsx +35 -0
- package/skills/wix-vibe-headless/references/members/{wix-members-auth.js → app/rest/wix-members-auth.js} +6 -3
- package/skills/wix-vibe-headless/references/members/install/Register.jsx +22 -0
- package/skills/wix-vibe-headless/references/members/seed/SEED.md +22 -0
- package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +229 -104
- package/skills/wix-vibe-headless/references/portfolio/app/components/CollectionCard.jsx +31 -0
- package/skills/wix-vibe-headless/references/portfolio/app/components/CollectionGrid.jsx +15 -0
- package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectCard.jsx +39 -0
- package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectGrid.jsx +15 -0
- package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectMedia.jsx +29 -0
- package/skills/wix-vibe-headless/references/portfolio/app/hooks/useCollectionProjects.js +35 -0
- package/skills/wix-vibe-headless/references/portfolio/app/hooks/usePortfolioGallery.js +27 -0
- package/skills/wix-vibe-headless/references/portfolio/app/hooks/useProjectDetail.js +25 -0
- package/skills/wix-vibe-headless/references/portfolio/app/pages/CollectionPage.jsx +39 -0
- package/skills/wix-vibe-headless/references/portfolio/app/pages/Portfolio.jsx +27 -0
- package/skills/wix-vibe-headless/references/portfolio/app/pages/ProjectDetail.jsx +60 -0
- package/skills/wix-vibe-headless/references/portfolio/seed/SEED.md +94 -0
- package/skills/wix-vibe-headless/references/portfolio/seed/seed-portfolio.js +236 -0
- package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +236 -117
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/OrderCard.jsx +35 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/PlanCard.jsx +48 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/PlanGrid.jsx +16 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/PlanPrice.jsx +35 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/hooks/useMyPlans.js +25 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/hooks/usePlanDetail.js +28 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/hooks/usePlans.js +30 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/pages/MyPlans.jsx +30 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/pages/PlanDetail.jsx +53 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/pages/Plans.jsx +28 -0
- package/skills/wix-vibe-headless/references/pricing-plans/seed/SEED.md +86 -0
- package/skills/wix-vibe-headless/references/pricing-plans/seed/seed-pricing-plans.js +251 -0
- package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +244 -124
- package/skills/wix-vibe-headless/references/restaurants/app/components/ItemDialog.jsx +81 -0
- package/skills/wix-vibe-headless/references/restaurants/app/components/MenuItemCard.jsx +71 -0
- package/skills/wix-vibe-headless/references/restaurants/app/components/MenuList.jsx +43 -0
- package/skills/wix-vibe-headless/references/restaurants/app/components/OrderCartButton.jsx +21 -0
- package/skills/wix-vibe-headless/references/restaurants/app/components/OrderCartDrawer.jsx +60 -0
- package/skills/wix-vibe-headless/references/restaurants/app/context/OrderCartContext.jsx +63 -0
- package/skills/wix-vibe-headless/references/restaurants/app/hooks/useItemOrder.js +32 -0
- package/skills/wix-vibe-headless/references/restaurants/app/hooks/useReservation.js +73 -0
- package/skills/wix-vibe-headless/references/restaurants/app/pages/Menu.jsx +28 -0
- package/skills/wix-vibe-headless/references/restaurants/app/pages/Reservations.jsx +102 -0
- package/skills/wix-vibe-headless/references/restaurants/seed/SEED.md +180 -0
- package/skills/wix-vibe-headless/references/restaurants/seed/seed-restaurants.js +452 -0
- package/skills/wix-vibe-headless/references/shared/app/components/WixManageBanner.jsx +56 -0
- package/skills/wix-vibe-headless/references/shared/{wix-client.js → app/rest/wix-client.js} +6 -8
- package/skills/wix-vibe-headless/references/shared/app/rest/wix-config.js +8 -0
- package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +259 -157
- package/skills/wix-vibe-headless/references/storefront/app/components/CartButton.jsx +20 -0
- package/skills/wix-vibe-headless/references/storefront/app/components/CartDrawer.jsx +150 -0
- package/skills/wix-vibe-headless/references/storefront/app/components/ProductCard.jsx +167 -0
- package/skills/wix-vibe-headless/references/storefront/app/components/ProductGallery.jsx +51 -0
- package/skills/wix-vibe-headless/references/storefront/app/components/ProductGrid.jsx +54 -0
- package/skills/wix-vibe-headless/references/storefront/app/components/VariantPicker.jsx +119 -0
- package/skills/wix-vibe-headless/references/storefront/app/context/CartContext.jsx +71 -0
- package/skills/wix-vibe-headless/references/storefront/app/hooks/useProductDetail.js +109 -0
- package/skills/wix-vibe-headless/references/storefront/app/hooks/useShop.js +98 -0
- package/skills/wix-vibe-headless/references/storefront/app/lib/storeImage.js +27 -0
- package/skills/wix-vibe-headless/references/storefront/app/pages/ProductDetail.jsx +139 -0
- package/skills/wix-vibe-headless/references/storefront/app/pages/Shop.jsx +75 -0
- package/skills/wix-vibe-headless/references/storefront/{wix-store-cart.js → app/rest/wix-store-cart.js} +1 -1
- package/skills/wix-vibe-headless/references/storefront/{wix-store-catalog.js → app/rest/wix-store-catalog.js} +20 -1
- package/skills/wix-vibe-headless/references/storefront/seed/SEED.md +111 -0
- package/skills/wix-vibe-headless/references/storefront/seed/seed-store.js +338 -0
- /package/skills/wix-vibe-headless/references/blog/{wix-blog.js → app/rest/wix-blog.js} +0 -0
- /package/skills/wix-vibe-headless/references/events/{wix-events-registration.js → app/rest/wix-events-registration.js} +0 -0
- /package/skills/wix-vibe-headless/references/portfolio/{wix-portfolio.js → app/rest/wix-portfolio.js} +0 -0
- /package/skills/wix-vibe-headless/references/pricing-plans/{wix-pricing-plans.js → app/rest/wix-pricing-plans.js} +0 -0
- /package/skills/wix-vibe-headless/references/restaurants/{wix-restaurants-menu.js → app/rest/wix-restaurants-menu.js} +0 -0
- /package/skills/wix-vibe-headless/references/restaurants/{wix-restaurants-ordering.js → app/rest/wix-restaurants-ordering.js} +0 -0
- /package/skills/wix-vibe-headless/references/restaurants/{wix-restaurants-reservations.js → app/rest/wix-restaurants-reservations.js} +0 -0
|
@@ -0,0 +1,777 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// oxlint-disable no-console no-shadow preserve-caught-error
|
|
5
|
+
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const { createRequire } = require('module');
|
|
9
|
+
|
|
10
|
+
const ROOT = process.cwd();
|
|
11
|
+
const LOCAL_REQUIRE = createRequire(__filename);
|
|
12
|
+
const ROOT_REQUIRE = createRequire(path.join(ROOT, 'package.json'));
|
|
13
|
+
const parser = loadModule('@babel/parser');
|
|
14
|
+
const traverse = loadModule('@babel/traverse').default;
|
|
15
|
+
const t = loadModule('@babel/types');
|
|
16
|
+
|
|
17
|
+
const MAX_RESOLUTION_DEPTH = 4;
|
|
18
|
+
const VALID_ARIA_PROPS = new Set([
|
|
19
|
+
'aria-activedescendant',
|
|
20
|
+
'aria-atomic',
|
|
21
|
+
'aria-autocomplete',
|
|
22
|
+
'aria-braillelabel',
|
|
23
|
+
'aria-brailleroledescription',
|
|
24
|
+
'aria-busy',
|
|
25
|
+
'aria-checked',
|
|
26
|
+
'aria-colcount',
|
|
27
|
+
'aria-colindex',
|
|
28
|
+
'aria-colindextext',
|
|
29
|
+
'aria-colspan',
|
|
30
|
+
'aria-controls',
|
|
31
|
+
'aria-current',
|
|
32
|
+
'aria-describedby',
|
|
33
|
+
'aria-description',
|
|
34
|
+
'aria-details',
|
|
35
|
+
'aria-disabled',
|
|
36
|
+
'aria-dropeffect',
|
|
37
|
+
'aria-errormessage',
|
|
38
|
+
'aria-expanded',
|
|
39
|
+
'aria-flowto',
|
|
40
|
+
'aria-grabbed',
|
|
41
|
+
'aria-haspopup',
|
|
42
|
+
'aria-hidden',
|
|
43
|
+
'aria-invalid',
|
|
44
|
+
'aria-keyshortcuts',
|
|
45
|
+
'aria-label',
|
|
46
|
+
'aria-labelledby',
|
|
47
|
+
'aria-level',
|
|
48
|
+
'aria-live',
|
|
49
|
+
'aria-modal',
|
|
50
|
+
'aria-multiline',
|
|
51
|
+
'aria-multiselectable',
|
|
52
|
+
'aria-orientation',
|
|
53
|
+
'aria-owns',
|
|
54
|
+
'aria-placeholder',
|
|
55
|
+
'aria-posinset',
|
|
56
|
+
'aria-pressed',
|
|
57
|
+
'aria-readonly',
|
|
58
|
+
'aria-relevant',
|
|
59
|
+
'aria-required',
|
|
60
|
+
'aria-roledescription',
|
|
61
|
+
'aria-rowcount',
|
|
62
|
+
'aria-rowindex',
|
|
63
|
+
'aria-rowindextext',
|
|
64
|
+
'aria-rowspan',
|
|
65
|
+
'aria-selected',
|
|
66
|
+
'aria-setsize',
|
|
67
|
+
'aria-sort',
|
|
68
|
+
'aria-valuemax',
|
|
69
|
+
'aria-valuemin',
|
|
70
|
+
'aria-valuenow',
|
|
71
|
+
'aria-valuetext',
|
|
72
|
+
]);
|
|
73
|
+
const VALID_ROLES = new Set([
|
|
74
|
+
'alert',
|
|
75
|
+
'alertdialog',
|
|
76
|
+
'application',
|
|
77
|
+
'article',
|
|
78
|
+
'banner',
|
|
79
|
+
'button',
|
|
80
|
+
'cell',
|
|
81
|
+
'checkbox',
|
|
82
|
+
'columnheader',
|
|
83
|
+
'combobox',
|
|
84
|
+
'complementary',
|
|
85
|
+
'contentinfo',
|
|
86
|
+
'definition',
|
|
87
|
+
'dialog',
|
|
88
|
+
'directory',
|
|
89
|
+
'document',
|
|
90
|
+
'feed',
|
|
91
|
+
'figure',
|
|
92
|
+
'form',
|
|
93
|
+
'grid',
|
|
94
|
+
'gridcell',
|
|
95
|
+
'group',
|
|
96
|
+
'heading',
|
|
97
|
+
'img',
|
|
98
|
+
'link',
|
|
99
|
+
'list',
|
|
100
|
+
'listbox',
|
|
101
|
+
'listitem',
|
|
102
|
+
'log',
|
|
103
|
+
'main',
|
|
104
|
+
'marquee',
|
|
105
|
+
'math',
|
|
106
|
+
'menu',
|
|
107
|
+
'menubar',
|
|
108
|
+
'menuitem',
|
|
109
|
+
'menuitemcheckbox',
|
|
110
|
+
'menuitemradio',
|
|
111
|
+
'navigation',
|
|
112
|
+
'none',
|
|
113
|
+
'note',
|
|
114
|
+
'option',
|
|
115
|
+
'presentation',
|
|
116
|
+
'progressbar',
|
|
117
|
+
'radio',
|
|
118
|
+
'radiogroup',
|
|
119
|
+
'region',
|
|
120
|
+
'row',
|
|
121
|
+
'rowgroup',
|
|
122
|
+
'rowheader',
|
|
123
|
+
'scrollbar',
|
|
124
|
+
'search',
|
|
125
|
+
'searchbox',
|
|
126
|
+
'separator',
|
|
127
|
+
'slider',
|
|
128
|
+
'spinbutton',
|
|
129
|
+
'status',
|
|
130
|
+
'switch',
|
|
131
|
+
'tab',
|
|
132
|
+
'table',
|
|
133
|
+
'tablist',
|
|
134
|
+
'tabpanel',
|
|
135
|
+
'term',
|
|
136
|
+
'textbox',
|
|
137
|
+
'timer',
|
|
138
|
+
'toolbar',
|
|
139
|
+
'tooltip',
|
|
140
|
+
'tree',
|
|
141
|
+
'treegrid',
|
|
142
|
+
'treeitem',
|
|
143
|
+
]);
|
|
144
|
+
const UNSUPPORTED_ARIA_ELEMENTS = new Set([
|
|
145
|
+
'meta',
|
|
146
|
+
'script',
|
|
147
|
+
'style',
|
|
148
|
+
'head',
|
|
149
|
+
'html',
|
|
150
|
+
'base',
|
|
151
|
+
'link',
|
|
152
|
+
'param',
|
|
153
|
+
'source',
|
|
154
|
+
'track',
|
|
155
|
+
'col',
|
|
156
|
+
'colgroup',
|
|
157
|
+
]);
|
|
158
|
+
|
|
159
|
+
const FILE_EXTENSIONS = ['.tsx', '.ts', '.jsx', '.js', '.mjs', '.cjs'];
|
|
160
|
+
const parseCache = new Map();
|
|
161
|
+
const resolutionWarnings = [];
|
|
162
|
+
|
|
163
|
+
function loadModule(name) {
|
|
164
|
+
try {
|
|
165
|
+
return LOCAL_REQUIRE(name);
|
|
166
|
+
} catch (localError) {
|
|
167
|
+
try {
|
|
168
|
+
return ROOT_REQUIRE(name);
|
|
169
|
+
} catch (rootError) {
|
|
170
|
+
throw new Error(
|
|
171
|
+
`Missing dependency "${name}". Local resolution failed: ${localError.message}. Root resolution failed: ${rootError.message}`,
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function parseFile(filePath) {
|
|
178
|
+
if (parseCache.has(filePath)) return parseCache.get(filePath);
|
|
179
|
+
|
|
180
|
+
try {
|
|
181
|
+
const code = fs.readFileSync(filePath, 'utf8');
|
|
182
|
+
const ast = parser.parse(code, {
|
|
183
|
+
sourceType: 'unambiguous',
|
|
184
|
+
plugins: [
|
|
185
|
+
'jsx',
|
|
186
|
+
'typescript',
|
|
187
|
+
'classProperties',
|
|
188
|
+
'objectRestSpread',
|
|
189
|
+
'optionalChaining',
|
|
190
|
+
'nullishCoalescingOperator',
|
|
191
|
+
],
|
|
192
|
+
errorRecovery: true,
|
|
193
|
+
});
|
|
194
|
+
const recoverableErrors = Array.isArray(ast.errors)
|
|
195
|
+
? ast.errors.map((error) => error.message)
|
|
196
|
+
: [];
|
|
197
|
+
const parsed = { ok: true, ast, code, recoverableErrors };
|
|
198
|
+
parseCache.set(filePath, parsed);
|
|
199
|
+
return parsed;
|
|
200
|
+
} catch (error) {
|
|
201
|
+
const parsed = { ok: false, error };
|
|
202
|
+
parseCache.set(filePath, parsed);
|
|
203
|
+
return parsed;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function getJsxName(node) {
|
|
208
|
+
if (t.isJSXIdentifier(node)) return node.name;
|
|
209
|
+
if (t.isJSXMemberExpression(node))
|
|
210
|
+
return `${getJsxName(node.object)}.${getJsxName(node.property)}`;
|
|
211
|
+
if (t.isJSXNamespacedName(node)) return `${node.namespace.name}:${node.name.name}`;
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function getAttribute(node, name) {
|
|
216
|
+
return (
|
|
217
|
+
node.attributes.find((attr) => t.isJSXAttribute(attr) && getJsxName(attr.name) === name) || null
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function getLiteralAttributeValue(attr) {
|
|
222
|
+
if (!attr) return undefined;
|
|
223
|
+
if (!attr.value) return true;
|
|
224
|
+
if (t.isStringLiteral(attr.value)) return attr.value.value;
|
|
225
|
+
if (t.isJSXExpressionContainer(attr.value)) {
|
|
226
|
+
const expr = attr.value.expression;
|
|
227
|
+
if (t.isStringLiteral(expr)) return expr.value;
|
|
228
|
+
if (t.isBooleanLiteral(expr)) return expr.value;
|
|
229
|
+
if (t.isNumericLiteral(expr)) return expr.value;
|
|
230
|
+
if (t.isTemplateLiteral(expr) && expr.expressions.length === 0) {
|
|
231
|
+
return expr.quasis.map((q) => q.value.cooked || '').join('');
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return undefined;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function hasTruthyAttribute(node, name) {
|
|
238
|
+
const attr = getAttribute(node, name);
|
|
239
|
+
return Boolean(attr);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function isNativeTag(name) {
|
|
243
|
+
return Boolean(name && /^[a-z]/.test(name));
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function getImportMap(ast) {
|
|
247
|
+
const imports = new Map();
|
|
248
|
+
|
|
249
|
+
traverse(ast, {
|
|
250
|
+
ImportDeclaration(path) {
|
|
251
|
+
const source = path.node.source.value;
|
|
252
|
+
for (const specifier of path.node.specifiers) {
|
|
253
|
+
if (t.isImportDefaultSpecifier(specifier)) {
|
|
254
|
+
imports.set(specifier.local.name, { source, imported: 'default' });
|
|
255
|
+
} else if (t.isImportSpecifier(specifier)) {
|
|
256
|
+
imports.set(specifier.local.name, { source, imported: specifier.imported.name });
|
|
257
|
+
} else if (t.isImportNamespaceSpecifier(specifier)) {
|
|
258
|
+
imports.set(specifier.local.name, { source, imported: '*' });
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
return imports;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function findRootJsx(pathLike) {
|
|
268
|
+
if (!pathLike) return null;
|
|
269
|
+
if (
|
|
270
|
+
pathLike.isFunctionDeclaration() ||
|
|
271
|
+
pathLike.isFunctionExpression() ||
|
|
272
|
+
pathLike.isArrowFunctionExpression()
|
|
273
|
+
) {
|
|
274
|
+
if (t.isJSXElement(pathLike.node.body) || t.isJSXFragment(pathLike.node.body))
|
|
275
|
+
return pathLike.node.body;
|
|
276
|
+
if (!t.isBlockStatement(pathLike.node.body)) return null;
|
|
277
|
+
|
|
278
|
+
for (const statement of pathLike.node.body.body) {
|
|
279
|
+
if (!t.isReturnStatement(statement)) continue;
|
|
280
|
+
const arg = statement.argument;
|
|
281
|
+
if (t.isJSXElement(arg) || t.isJSXFragment(arg)) return arg;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function resolveSourceFile(fromFile, source) {
|
|
288
|
+
const basedir = path.dirname(fromFile);
|
|
289
|
+
const tryFile = (candidate) => {
|
|
290
|
+
if (candidate && fs.existsSync(candidate) && fs.statSync(candidate).isFile()) return candidate;
|
|
291
|
+
return null;
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
if (source.startsWith('.')) {
|
|
295
|
+
const base = path.resolve(basedir, source);
|
|
296
|
+
for (const ext of FILE_EXTENSIONS) {
|
|
297
|
+
const direct = tryFile(base + ext);
|
|
298
|
+
if (direct) return direct;
|
|
299
|
+
}
|
|
300
|
+
for (const ext of FILE_EXTENSIONS) {
|
|
301
|
+
const indexFile = tryFile(path.join(base, `index${ext}`));
|
|
302
|
+
if (indexFile) return indexFile;
|
|
303
|
+
}
|
|
304
|
+
return tryFile(base);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
try {
|
|
308
|
+
return require.resolve(source, { paths: [basedir, ROOT] });
|
|
309
|
+
} catch (error) {
|
|
310
|
+
resolutionWarnings.push({
|
|
311
|
+
source,
|
|
312
|
+
fromFile,
|
|
313
|
+
method: 'require.resolve',
|
|
314
|
+
message: error.message,
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
try {
|
|
319
|
+
return ROOT_REQUIRE.resolve(source);
|
|
320
|
+
} catch (error) {
|
|
321
|
+
resolutionWarnings.push({
|
|
322
|
+
source,
|
|
323
|
+
fromFile,
|
|
324
|
+
method: 'rootRequire.resolve',
|
|
325
|
+
message: error.message,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return null;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function findExportedComponent(ast, exportName) {
|
|
333
|
+
let found = null;
|
|
334
|
+
|
|
335
|
+
traverse(ast, {
|
|
336
|
+
FunctionDeclaration(path) {
|
|
337
|
+
if (found) return;
|
|
338
|
+
if (path.node.id && path.node.id.name === exportName) found = findRootJsx(path);
|
|
339
|
+
},
|
|
340
|
+
VariableDeclarator(path) {
|
|
341
|
+
if (found) return;
|
|
342
|
+
if (!t.isIdentifier(path.node.id, { name: exportName })) return;
|
|
343
|
+
const initPath = path.get('init');
|
|
344
|
+
found = findRootJsx(initPath);
|
|
345
|
+
},
|
|
346
|
+
ExportDefaultDeclaration(path) {
|
|
347
|
+
if (found || exportName !== 'default') return;
|
|
348
|
+
const declPath = path.get('declaration');
|
|
349
|
+
if (declPath.isIdentifier()) {
|
|
350
|
+
found = findNamedBindingJsx(ast, declPath.node.name);
|
|
351
|
+
} else {
|
|
352
|
+
found = findRootJsx(declPath);
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
return found;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function findNamedBindingJsx(ast, name) {
|
|
361
|
+
let found = null;
|
|
362
|
+
traverse(ast, {
|
|
363
|
+
FunctionDeclaration(path) {
|
|
364
|
+
if (found) return;
|
|
365
|
+
if (path.node.id && path.node.id.name === name) found = findRootJsx(path);
|
|
366
|
+
},
|
|
367
|
+
VariableDeclarator(path) {
|
|
368
|
+
if (found) return;
|
|
369
|
+
if (!t.isIdentifier(path.node.id, { name })) return;
|
|
370
|
+
found = findRootJsx(path.get('init'));
|
|
371
|
+
},
|
|
372
|
+
});
|
|
373
|
+
return found;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
function inferByName(name) {
|
|
377
|
+
const lower = String(name || '').toLowerCase();
|
|
378
|
+
if (!lower) return null;
|
|
379
|
+
if (
|
|
380
|
+
/(^|\.)(img|image|avatar|thumbnail|photo|picture)$/.test(lower) ||
|
|
381
|
+
/(image|avatar|thumbnail|photo|picture)/.test(lower)
|
|
382
|
+
) {
|
|
383
|
+
return {
|
|
384
|
+
semanticType: 'img',
|
|
385
|
+
confidence: 'low',
|
|
386
|
+
sourceKind: 'heuristic',
|
|
387
|
+
evidence: `Component name "${name}" looks image-like.`,
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
if (/(^|\.)(link|anchor|navlink)$/.test(lower) || /(link|anchor)/.test(lower)) {
|
|
391
|
+
return {
|
|
392
|
+
semanticType: 'a',
|
|
393
|
+
confidence: 'low',
|
|
394
|
+
sourceKind: 'heuristic',
|
|
395
|
+
evidence: `Component name "${name}" looks link-like.`,
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
if (/(button|btn|iconbutton|textbutton|closebutton)/.test(lower)) {
|
|
399
|
+
return {
|
|
400
|
+
semanticType: 'button',
|
|
401
|
+
confidence: 'low',
|
|
402
|
+
sourceKind: 'heuristic',
|
|
403
|
+
evidence: `Component name "${name}" looks button-like.`,
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
if (/(textarea|editor)/.test(lower)) {
|
|
407
|
+
return {
|
|
408
|
+
semanticType: 'textarea',
|
|
409
|
+
confidence: 'low',
|
|
410
|
+
sourceKind: 'heuristic',
|
|
411
|
+
evidence: `Component name "${name}" looks textarea-like.`,
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
if (/(input|textfield|search|select|checkbox|radio|switch|toggle)/.test(lower)) {
|
|
415
|
+
return {
|
|
416
|
+
semanticType: 'input',
|
|
417
|
+
confidence: 'low',
|
|
418
|
+
sourceKind: 'heuristic',
|
|
419
|
+
evidence: `Component name "${name}" looks input-like.`,
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
return null;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function inferFromProps(openingElement) {
|
|
426
|
+
const asValue = getLiteralAttributeValue(getAttribute(openingElement, 'as'));
|
|
427
|
+
if (typeof asValue === 'string' && isNativeTag(asValue)) {
|
|
428
|
+
return {
|
|
429
|
+
semanticType: asValue,
|
|
430
|
+
confidence: 'high',
|
|
431
|
+
sourceKind: 'polymorphic-prop',
|
|
432
|
+
evidence: `The component explicitly sets as="${asValue}".`,
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
const componentValue = getLiteralAttributeValue(getAttribute(openingElement, 'component'));
|
|
437
|
+
if (typeof componentValue === 'string' && isNativeTag(componentValue)) {
|
|
438
|
+
return {
|
|
439
|
+
semanticType: componentValue,
|
|
440
|
+
confidence: 'high',
|
|
441
|
+
sourceKind: 'polymorphic-prop',
|
|
442
|
+
evidence: `The component explicitly sets component="${componentValue}".`,
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
if (hasTruthyAttribute(openingElement, 'src')) {
|
|
447
|
+
return {
|
|
448
|
+
semanticType: 'img',
|
|
449
|
+
confidence: hasTruthyAttribute(openingElement, 'alt') ? 'low' : 'medium',
|
|
450
|
+
sourceKind: 'prop-evidence',
|
|
451
|
+
evidence: 'The component receives src-related props that suggest image semantics.',
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
if (hasTruthyAttribute(openingElement, 'href') || hasTruthyAttribute(openingElement, 'to')) {
|
|
456
|
+
return {
|
|
457
|
+
semanticType: 'a',
|
|
458
|
+
confidence: 'medium',
|
|
459
|
+
sourceKind: 'prop-evidence',
|
|
460
|
+
evidence: 'The component receives href/to props that suggest link semantics.',
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
if (hasTruthyAttribute(openingElement, 'onClick')) {
|
|
465
|
+
return {
|
|
466
|
+
semanticType: 'button',
|
|
467
|
+
confidence: 'low',
|
|
468
|
+
sourceKind: 'prop-evidence',
|
|
469
|
+
evidence: 'The component receives onClick, which may indicate button-like behavior.',
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
return null;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
function chooseResolution(current, next) {
|
|
477
|
+
if (!next) return current;
|
|
478
|
+
if (!current) return next;
|
|
479
|
+
const rank = { high: 3, medium: 2, low: 1, unknown: 0 };
|
|
480
|
+
return rank[next.confidence] > rank[current.confidence] ? next : current;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
function resolveComponentSemantic(filePath, openingElement, context, depth = 0) {
|
|
484
|
+
const name = getJsxName(openingElement.name);
|
|
485
|
+
if (!name)
|
|
486
|
+
return {
|
|
487
|
+
semanticType: 'unknown',
|
|
488
|
+
confidence: 'unknown',
|
|
489
|
+
sourceKind: 'unknown',
|
|
490
|
+
evidence: 'Unable to resolve JSX element name.',
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
if (isNativeTag(name)) {
|
|
494
|
+
return {
|
|
495
|
+
semanticType: name,
|
|
496
|
+
confidence: 'high',
|
|
497
|
+
sourceKind: 'native',
|
|
498
|
+
evidence: `The JSX element is the native tag <${name}>.`,
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
let resolved = chooseResolution(null, inferFromProps(openingElement));
|
|
503
|
+
resolved = chooseResolution(resolved, inferByName(name));
|
|
504
|
+
|
|
505
|
+
if (depth >= MAX_RESOLUTION_DEPTH) {
|
|
506
|
+
return (
|
|
507
|
+
resolved || {
|
|
508
|
+
semanticType: 'unknown',
|
|
509
|
+
confidence: 'unknown',
|
|
510
|
+
sourceKind: 'unknown',
|
|
511
|
+
evidence: `Resolution depth exceeded for ${name}.`,
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
const importInfo = context.imports.get(name);
|
|
517
|
+
if (importInfo) {
|
|
518
|
+
const resolvedSource = resolveSourceFile(filePath, importInfo.source);
|
|
519
|
+
if (resolvedSource) {
|
|
520
|
+
const parsed = parseFile(resolvedSource);
|
|
521
|
+
if (parsed.ok) {
|
|
522
|
+
const rootJsx = findExportedComponent(parsed.ast, importInfo.imported);
|
|
523
|
+
if (rootJsx && t.isJSXElement(rootJsx)) {
|
|
524
|
+
const innerImports = getImportMap(parsed.ast);
|
|
525
|
+
const nested = resolveComponentSemantic(
|
|
526
|
+
resolvedSource,
|
|
527
|
+
rootJsx.openingElement,
|
|
528
|
+
{ imports: innerImports },
|
|
529
|
+
depth + 1,
|
|
530
|
+
);
|
|
531
|
+
if (nested.semanticType !== 'unknown') {
|
|
532
|
+
const sourceKind = importInfo.source.startsWith('.')
|
|
533
|
+
? 'local-wrapper'
|
|
534
|
+
: 'package-component';
|
|
535
|
+
resolved = chooseResolution(resolved, {
|
|
536
|
+
semanticType: nested.semanticType,
|
|
537
|
+
confidence: nested.confidence === 'low' ? 'medium' : nested.confidence,
|
|
538
|
+
sourceKind,
|
|
539
|
+
evidence: `${name} resolves through ${path.relative(ROOT, resolvedSource)} to ${nested.semanticType} semantics.`,
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
const finalResolution = resolved || {
|
|
548
|
+
semanticType: 'unknown',
|
|
549
|
+
confidence: 'unknown',
|
|
550
|
+
sourceKind: 'unknown',
|
|
551
|
+
evidence: `Could not infer reliable semantics for ${name}.`,
|
|
552
|
+
};
|
|
553
|
+
return finalResolution;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
function toRelative(filePath) {
|
|
557
|
+
return path.relative(ROOT, filePath) || filePath;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
function findingFromNode(filePath, node, data) {
|
|
561
|
+
return {
|
|
562
|
+
file: toRelative(filePath),
|
|
563
|
+
line: node.loc ? node.loc.start.line : null,
|
|
564
|
+
column: node.loc ? node.loc.start.column + 1 : null,
|
|
565
|
+
rule: data.rule,
|
|
566
|
+
confidence: data.confidence,
|
|
567
|
+
message: data.message,
|
|
568
|
+
componentName: data.componentName,
|
|
569
|
+
semanticType: data.semanticType,
|
|
570
|
+
evidence: data.evidence,
|
|
571
|
+
sourceKind: data.sourceKind,
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
function scanFile(filePath) {
|
|
576
|
+
const parsed = parseFile(filePath);
|
|
577
|
+
if (!parsed.ok) {
|
|
578
|
+
return {
|
|
579
|
+
parseError: {
|
|
580
|
+
file: toRelative(filePath),
|
|
581
|
+
message: parsed.error.message,
|
|
582
|
+
},
|
|
583
|
+
findings: [],
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
const imports = getImportMap(parsed.ast);
|
|
588
|
+
const findings = [];
|
|
589
|
+
const parseWarnings = parsed.recoverableErrors || [];
|
|
590
|
+
|
|
591
|
+
traverse(parsed.ast, {
|
|
592
|
+
JSXOpeningElement(path) {
|
|
593
|
+
const node = path.node;
|
|
594
|
+
const name = getJsxName(node.name);
|
|
595
|
+
if (!name) return;
|
|
596
|
+
|
|
597
|
+
const semantic = resolveComponentSemantic(filePath, node, { imports });
|
|
598
|
+
const ariaAttrs = node.attributes.filter(
|
|
599
|
+
(attr) => t.isJSXAttribute(attr) && getJsxName(attr.name)?.startsWith('aria-'),
|
|
600
|
+
);
|
|
601
|
+
const roleAttr = getAttribute(node, 'role');
|
|
602
|
+
|
|
603
|
+
if (semantic.semanticType === 'img' && semantic.confidence !== 'low') {
|
|
604
|
+
const altAttr = getAttribute(node, 'alt');
|
|
605
|
+
if (!altAttr) {
|
|
606
|
+
findings.push(
|
|
607
|
+
findingFromNode(filePath, node, {
|
|
608
|
+
rule: 'alt-text',
|
|
609
|
+
confidence: semantic.confidence,
|
|
610
|
+
message: `${name} is treated as image-like but is missing an alt prop.`,
|
|
611
|
+
componentName: name,
|
|
612
|
+
semanticType: semantic.semanticType,
|
|
613
|
+
evidence: semantic.evidence,
|
|
614
|
+
sourceKind: semantic.sourceKind,
|
|
615
|
+
}),
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
} else if (semantic.semanticType === 'img' && semantic.confidence === 'low') {
|
|
619
|
+
const altAttr = getAttribute(node, 'alt');
|
|
620
|
+
if (!altAttr) {
|
|
621
|
+
findings.push(
|
|
622
|
+
findingFromNode(filePath, node, {
|
|
623
|
+
rule: 'alt-text',
|
|
624
|
+
confidence: semantic.confidence,
|
|
625
|
+
message: `${name} may be image-like and appears to be missing an alt prop.`,
|
|
626
|
+
componentName: name,
|
|
627
|
+
semanticType: semantic.semanticType,
|
|
628
|
+
evidence: semantic.evidence,
|
|
629
|
+
sourceKind: semantic.sourceKind,
|
|
630
|
+
}),
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
if (semantic.semanticType === 'a') {
|
|
636
|
+
const hrefAttr = getAttribute(node, 'href');
|
|
637
|
+
const toAttr = getAttribute(node, 'to');
|
|
638
|
+
const hrefValue = getLiteralAttributeValue(hrefAttr);
|
|
639
|
+
const toValue = getLiteralAttributeValue(toAttr);
|
|
640
|
+
const invalidLinkTarget =
|
|
641
|
+
(!hrefAttr && !toAttr) ||
|
|
642
|
+
hrefValue === '' ||
|
|
643
|
+
hrefValue === '#' ||
|
|
644
|
+
hrefValue === 'javascript:void(0)' ||
|
|
645
|
+
toValue === '' ||
|
|
646
|
+
toValue === '#' ||
|
|
647
|
+
toValue === 'javascript:void(0)';
|
|
648
|
+
if (invalidLinkTarget) {
|
|
649
|
+
findings.push(
|
|
650
|
+
findingFromNode(filePath, node, {
|
|
651
|
+
rule: 'anchor-is-valid',
|
|
652
|
+
confidence: semantic.confidence,
|
|
653
|
+
message:
|
|
654
|
+
semantic.confidence === 'low'
|
|
655
|
+
? `${name} may be link-like but does not appear to provide a valid navigation target.`
|
|
656
|
+
: `${name} is treated as link-like but does not provide a valid navigation target.`,
|
|
657
|
+
componentName: name,
|
|
658
|
+
semanticType: semantic.semanticType,
|
|
659
|
+
evidence: semantic.evidence,
|
|
660
|
+
sourceKind: semantic.sourceKind,
|
|
661
|
+
}),
|
|
662
|
+
);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
for (const attr of ariaAttrs) {
|
|
667
|
+
const attrName = getJsxName(attr.name);
|
|
668
|
+
if (!VALID_ARIA_PROPS.has(attrName)) {
|
|
669
|
+
findings.push(
|
|
670
|
+
findingFromNode(filePath, attr, {
|
|
671
|
+
rule: 'aria-props',
|
|
672
|
+
confidence: 'high',
|
|
673
|
+
message: `${attrName} is not a valid ARIA attribute name.`,
|
|
674
|
+
componentName: name,
|
|
675
|
+
semanticType: semantic.semanticType,
|
|
676
|
+
evidence: `The attribute name "${attrName}" is not in the allowed ARIA prop set.`,
|
|
677
|
+
sourceKind: semantic.sourceKind,
|
|
678
|
+
}),
|
|
679
|
+
);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
const roleValue = getLiteralAttributeValue(roleAttr);
|
|
684
|
+
if (typeof roleValue === 'string' && !VALID_ROLES.has(roleValue)) {
|
|
685
|
+
findings.push(
|
|
686
|
+
findingFromNode(filePath, roleAttr, {
|
|
687
|
+
rule: 'aria-role',
|
|
688
|
+
confidence: 'high',
|
|
689
|
+
message: `"${roleValue}" is not a valid ARIA role value.`,
|
|
690
|
+
componentName: name,
|
|
691
|
+
semanticType: semantic.semanticType,
|
|
692
|
+
evidence: `The role value "${roleValue}" is not in the supported ARIA roles set.`,
|
|
693
|
+
sourceKind: semantic.sourceKind,
|
|
694
|
+
}),
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
if ((ariaAttrs.length > 0 || roleAttr) && semantic.confidence !== 'low') {
|
|
699
|
+
const semanticTag = semantic.semanticType;
|
|
700
|
+
if (UNSUPPORTED_ARIA_ELEMENTS.has(semanticTag)) {
|
|
701
|
+
findings.push(
|
|
702
|
+
findingFromNode(filePath, node, {
|
|
703
|
+
rule: 'aria-unsupported-elements',
|
|
704
|
+
confidence: semantic.confidence,
|
|
705
|
+
message: `${name} resolves to unsupported element <${semanticTag}> but carries ARIA attributes or role.`,
|
|
706
|
+
componentName: name,
|
|
707
|
+
semanticType: semantic.semanticType,
|
|
708
|
+
evidence: semantic.evidence,
|
|
709
|
+
sourceKind: semantic.sourceKind,
|
|
710
|
+
}),
|
|
711
|
+
);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
},
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
return { parseError: null, findings, parseWarnings };
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
function main() {
|
|
721
|
+
const files = process.argv.slice(2);
|
|
722
|
+
if (files.length === 0) {
|
|
723
|
+
console.log(
|
|
724
|
+
JSON.stringify(
|
|
725
|
+
{
|
|
726
|
+
error: 'No files specified.',
|
|
727
|
+
usage: 'node <SKILL_ROOT>/scripts/scan-a11y-code.cjs <file1> [file2] ...',
|
|
728
|
+
},
|
|
729
|
+
null,
|
|
730
|
+
2,
|
|
731
|
+
),
|
|
732
|
+
);
|
|
733
|
+
process.exit(1);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
const meta = {
|
|
737
|
+
filesScanned: files.length,
|
|
738
|
+
parser: '@babel/parser',
|
|
739
|
+
supportedRules: [
|
|
740
|
+
'alt-text',
|
|
741
|
+
'anchor-is-valid',
|
|
742
|
+
'aria-props',
|
|
743
|
+
'aria-role',
|
|
744
|
+
'aria-unsupported-elements',
|
|
745
|
+
],
|
|
746
|
+
confidenceModel: ['high', 'medium', 'low', 'unknown'],
|
|
747
|
+
parseErrors: [],
|
|
748
|
+
resolutionWarnings,
|
|
749
|
+
};
|
|
750
|
+
|
|
751
|
+
const findings = [];
|
|
752
|
+
|
|
753
|
+
for (const file of files.map((file) => path.resolve(file))) {
|
|
754
|
+
const result = scanFile(file);
|
|
755
|
+
if (result.parseError) meta.parseErrors.push(result.parseError);
|
|
756
|
+
for (const warning of result.parseWarnings || []) {
|
|
757
|
+
meta.parseErrors.push({
|
|
758
|
+
file: toRelative(file),
|
|
759
|
+
message: warning,
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
findings.push(...result.findings);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
const summary = {
|
|
766
|
+
findings: findings.length,
|
|
767
|
+
highConfidence: findings.filter((item) => item.confidence === 'high').length,
|
|
768
|
+
mediumConfidence: findings.filter((item) => item.confidence === 'medium').length,
|
|
769
|
+
lowConfidence: findings.filter((item) => item.confidence === 'low').length,
|
|
770
|
+
filesWithFindings: new Set(findings.map((item) => item.file)).size,
|
|
771
|
+
cleanFiles: files.length - new Set(findings.map((item) => item.file)).size,
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
console.log(JSON.stringify({ meta, findings, summary }, null, 2));
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
main();
|