@onexapis/cli 1.1.38 → 1.1.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/cli.js +384 -380
  2. package/dist/cli.js.map +1 -1
  3. package/dist/cli.mjs +381 -376
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/index.js +258 -293
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +255 -289
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/preview/preview-app.tsx +13 -5
  10. package/package.json +1 -3
  11. package/templates/default/AUTH_AND_PROFILE.md +167 -0
  12. package/templates/default/CLAUDE.md +435 -6
  13. package/templates/default/LAYOUT.md +195 -0
  14. package/templates/default/bundle-entry.ts +5 -0
  15. package/templates/default/esbuild.config.js +20 -0
  16. package/templates/default/hooks/index.ts +26 -0
  17. package/templates/default/hooks/use-forgot-password-form.ts +90 -0
  18. package/templates/default/hooks/use-login-form.ts +102 -0
  19. package/templates/default/hooks/use-profile-form.ts +255 -0
  20. package/templates/default/hooks/use-register-form.ts +154 -0
  21. package/templates/default/hooks/use-verify-code-form.ts +224 -0
  22. package/templates/default/index.ts +21 -1
  23. package/templates/default/pages/about.ts +2 -2
  24. package/templates/default/pages/forgot-password.ts +39 -0
  25. package/templates/default/pages/home.ts +4 -4
  26. package/templates/default/pages/login.ts +39 -0
  27. package/templates/default/pages/profile.ts +39 -0
  28. package/templates/default/pages/register.ts +39 -0
  29. package/templates/default/pages/showcase.ts +7 -7
  30. package/templates/default/pages/verify-code.ts +39 -0
  31. package/templates/default/sections/about/about.schema.ts +1 -1
  32. package/templates/default/sections/auth-forgot-password/auth-forgot-password-default.tsx +192 -0
  33. package/templates/default/sections/auth-forgot-password/auth-forgot-password.schema.ts +150 -0
  34. package/templates/default/sections/auth-forgot-password/index.ts +14 -0
  35. package/templates/default/sections/auth-login/auth-login-default.tsx +238 -0
  36. package/templates/default/sections/auth-login/auth-login.schema.ts +171 -0
  37. package/templates/default/sections/auth-login/index.ts +14 -0
  38. package/templates/default/sections/auth-register/auth-register-default.tsx +327 -0
  39. package/templates/default/sections/auth-register/auth-register.schema.ts +188 -0
  40. package/templates/default/sections/auth-register/index.ts +14 -0
  41. package/templates/default/sections/auth-verify-code/auth-verify-code-default.tsx +209 -0
  42. package/templates/default/sections/auth-verify-code/auth-verify-code.schema.ts +150 -0
  43. package/templates/default/sections/auth-verify-code/index.ts +14 -0
  44. package/templates/default/sections/cta/cta.schema.ts +1 -1
  45. package/templates/default/sections/features/features.schema.ts +1 -1
  46. package/templates/default/sections/footer/footer-default.tsx +214 -0
  47. package/templates/default/sections/footer/footer.schema.ts +170 -0
  48. package/templates/default/sections/footer/index.ts +14 -0
  49. package/templates/default/sections/gallery/gallery.schema.ts +1 -1
  50. package/templates/default/sections/header/header-default.tsx +322 -0
  51. package/templates/default/sections/header/header.schema.ts +168 -0
  52. package/templates/default/sections/header/index.ts +14 -0
  53. package/templates/default/sections/hero/hero.schema.ts +1 -1
  54. package/templates/default/sections/profile/index.ts +14 -0
  55. package/templates/default/sections/profile/profile-default.tsx +522 -0
  56. package/templates/default/sections/profile/profile.schema.ts +228 -0
  57. package/templates/default/sections/stats/stats.schema.ts +1 -1
  58. package/templates/default/sections/testimonials/testimonials.schema.ts +1 -1
  59. package/templates/default/sections-registry.ts +28 -0
  60. package/templates/default/theme.layout.ts +71 -2
@@ -2,6 +2,59 @@
2
2
 
3
3
  This file provides context to AI assistants (Claude, Cursor, Copilot) for developing OneX themes.
4
4
 
5
+ ## MANDATORY WORKFLOW — USE MCP TOOLS FIRST
6
+
7
+ **You MUST use the `onexthm` MCP tools as your PRIMARY workflow for all theme development tasks. Do NOT write section files manually when a tool can generate them.**
8
+
9
+ ### Required tool usage
10
+
11
+ | Task | MUST use | Why |
12
+ | ---------------------------------- | ------------------------------------- | ------------------------------------------------------------------- |
13
+ | Create a new section | `onexthm_create_section` | Guarantees correct file structure, schema, data attributes, imports |
14
+ | Convert HTML/React code to section | `onexthm_from_html` | Parses HTML elements and maps to OneX components automatically |
15
+ | Convert Figma design to section | `onexthm_from_figma` + `figma` tools | Extracts layout, colors, typography from design |
16
+ | Generate schema from description | `onexthm_generate_schema` | Infers category, fields, blocks, data requirements |
17
+ | Validate theme | `onexthm_validate` | Catches missing data attributes, wrong imports, structural errors |
18
+ | Look up hooks | `onexthm_list_hooks` | Shows all 44 hooks with params, returns, and examples |
19
+ | Look up components | Read `onexthm://components` resource | Shows all component types, fields, slots |
20
+ | Look up field types | Read `onexthm://field-types` resource | Shows all 25 field types with options |
21
+ | Look up rules | Read `onexthm://rules` resource | Shows DOs/DON'Ts and patterns |
22
+
23
+ ### Workflow for creating sections
24
+
25
+ 1. **From a description**: Use `onexthm_generate_schema` or `onexthm_create_section`
26
+ 2. **From HTML/React code**: Use `onexthm_from_html` — it parses headings, paragraphs, buttons, images, lists, etc. and maps them to OneX components
27
+ 3. **From Figma design**: Use `figma:get_metadata` → `onexthm_from_figma`
28
+ 4. **Always validate after**: Use `onexthm_validate`
29
+ 5. **Then customize**: Edit the generated files to refine layout and styling
30
+
31
+ ### When you have HTML/React code to convert
32
+
33
+ If the user provides HTML, JSX, or a React component, ALWAYS use `onexthm_from_html` first:
34
+
35
+ ```
36
+ onexthm_from_html({
37
+ htmlCode: "<the HTML/JSX code>",
38
+ sectionName: "section-name",
39
+ category: "hero" // optional
40
+ })
41
+ ```
42
+
43
+ This automatically:
44
+
45
+ - Maps `<h1>`-`<h6>` → heading components
46
+ - Maps `<p>`, `<span>` → paragraph components
47
+ - Maps `<button>`, `<a class="btn">` → button components
48
+ - Maps `<img>` → image components
49
+ - Maps `<svg>`, icons → icon components
50
+ - Maps `<ul>/<ol>` → list components
51
+ - Maps `<hr>` → divider components
52
+ - Detects repeating patterns → block definitions
53
+ - Extracts Tailwind classes → layout settings
54
+ - Generates schema + component + index files
55
+
56
+ ---
57
+
5
58
  ## CRITICAL RULES — READ FIRST
6
59
 
7
60
  **IMPORTANT: When creating new sections, blocks, or modifying theme code, you MUST follow these rules. Violations will cause the editor and storefront to break.**
@@ -10,7 +63,7 @@ This file provides context to AI assistants (Claude, Cursor, Copilot) for develo
10
63
 
11
64
  Every section MUST use `ComponentRenderer` and `BlockRenderer` from `@onexapis/core` to render content. Sections define LAYOUT only — all content (text, images, buttons) is rendered through Blocks and Components.
12
65
 
13
- You can use `onexthm_create_section` MCP tool or `onexthm create:section` CLI to scaffold, but if writing manually, every section MUST have:
66
+ Use `onexthm_create_section` MCP tool or `onexthm create:section` CLI to scaffold. If writing manually, every section MUST have:
14
67
 
15
68
  1. **`"use client"` directive** at the top
16
69
  2. **Import from `@onexapis/core/renderers`** — use `ComponentRenderer` and `BlockRenderer`
@@ -369,7 +422,7 @@ import {
369
422
  | **State** (3) | `useCart`, `useAuth`, `useOrders` |
370
423
  | **Checkout** (8) | `useCheckout`, `usePayment`, `useOrderLookup`, `useOrderStatus`, `useOrderSuccess`, `useOrderSummary`, `useFinance`, `saveBuyNowItem` |
371
424
  | **Products** (3) | `useSearchProducts`, `useAddToCart`, `useProductDetail` |
372
- | **Theme** (8) | `useDesignSystem`, `useCommerceData`, `useThemeMode`, `useLocale`, `useViewport`, `usePageData`, `useWebsiteSettings`, `useMotion` |
425
+ | **Theme** (9) | `useDesignSystem`, `usePageBackground`, `useCommerceData`, `useThemeMode`, `useLocale`, `useViewport`, `usePageData`, `useWebsiteSettings`, `useMotion` |
373
426
  | **Utilities** (7) | `useDebounce`, `useMediaQuery`, `useIsMobile`, `useIsTablet`, `useIsDesktop`, `useContactForm`, `useCopyToClipboard`, `useFormatPrice`, `formatVndPrice` |
374
427
  | **Animation** (1) | `useFlyToCart` |
375
428
  | **Server** (4) | `fetchProducts`, `fetchBlogs`, `fetchSettings`, `prefetchSectionData` |
@@ -408,6 +461,198 @@ const { formatPrice } = useFormatPrice();
408
461
  formatPrice(1250000); // "1.250.000đ"
409
462
  ```
410
463
 
464
+ ### Orders & Payment Hooks
465
+
466
+ These hooks cover the full order lifecycle: creating orders, looking up orders, processing payments, and displaying order history.
467
+
468
+ #### `useOrders` — Order state management (Zustand)
469
+
470
+ ```tsx
471
+ import { useOrders } from "@onexapis/core/hooks";
472
+
473
+ const {
474
+ orders, // Order[] — list of orders
475
+ currentOrder, // Order | null — single order detail
476
+ isLoading,
477
+ error,
478
+ total,
479
+ totalPages,
480
+ currentPage,
481
+
482
+ // Actions
483
+ createOrder, // (data: CreateOrderData) => Promise<Order>
484
+ createPrivateOrder, // (data: CreateOrderData) => Promise<Order> — requires auth
485
+ fetchOrders, // (params?) => Promise<void> — public order list
486
+ fetchOrderHistory, // (params?) => Promise<void> — authenticated user's orders
487
+ fetchOrderById, // (orderId: string) => Promise<void>
488
+ fetchOrderByNumber, // (orderNumber: string) => Promise<void>
489
+ updateOrderStatus, // (orderId, status) => Promise<void>
490
+ cancelOrder, // (orderId) => Promise<void>
491
+ payOrder, // (orderId, paymentData?) => Promise<Order> — returns updated order
492
+ clearError,
493
+ clearCurrentOrder,
494
+ } = useOrders();
495
+ ```
496
+
497
+ **`payOrder` returns the updated `Order`** — always check `order.status` and `order.payment_status` before navigating to success. Do NOT blindly redirect after calling `payOrder`.
498
+
499
+ #### `useOrderLookup` — Search/track order by number or ID
500
+
501
+ ```tsx
502
+ import { useOrderLookup } from "@onexapis/core/hooks";
503
+
504
+ // Basic — manual search via input
505
+ const lookup = useOrderLookup();
506
+
507
+ // With auto-fetch from URL route param (for dynamic pages like /order-lookup/[orderId])
508
+ const routeParams = (data?.routeParams || {}) as Record<string, string>;
509
+ const lookup = useOrderLookup({
510
+ initialOrderId: routeParams.orderId, // auto-fetches on mount
511
+ });
512
+
513
+ // lookup.orderNumber — input value (string)
514
+ // lookup.setOrderNumber — update input
515
+ // lookup.handleTrackOrder — search (auto-detects UUID vs order number)
516
+ // lookup.handleClear — reset search
517
+ // lookup.order — Order | null (result)
518
+ // lookup.isSearching — boolean
519
+ // lookup.errorMessage — string | null
520
+ // lookup.getStatusLabel — (status: string) => Vietnamese label
521
+ // lookup.formatCurrency — (amount: number) => "1.250.000đ"
522
+ ```
523
+
524
+ **Dynamic page setup** for `/order-lookup/[orderId]`:
525
+
526
+ ```typescript
527
+ // pages/order-lookup.ts
528
+ export const orderLookupPageConfig = {
529
+ handle: "order-lookup",
530
+ path: "/order-lookup/[orderId]",
531
+ isDynamic: true,
532
+ dynamicSegments: ["orderId"],
533
+ type: "custom",
534
+ // ...sections
535
+ };
536
+ ```
537
+
538
+ #### `usePayment` — QR code payment with bank transfer
539
+
540
+ ```tsx
541
+ import { usePayment } from "@onexapis/core/hooks";
542
+
543
+ const payment = usePayment({
544
+ successRedirectUrl: "/order-success", // default
545
+ checkoutRedirectUrl: "/checkout", // default — redirect if no order info
546
+ isEditing: false,
547
+ });
548
+
549
+ // payment.orderId, payment.orderNumber, payment.total
550
+ // payment.qrCodeImage — data URI for QR code
551
+ // payment.qrNote — transfer note (e.g. "DH4X7K2M")
552
+ // payment.bankTransferData — { accountNumber, accountName, bankName }
553
+ // payment.isLoading, payment.isProcessing, payment.error
554
+ // payment.handleConfirmPayment — calls payOrder API, checks response, then redirects
555
+ // payment.handleCancel — clears order info, redirects to checkout
556
+ ```
557
+
558
+ **`handleConfirmPayment` validates the API response:**
559
+
560
+ - Checks `order.status` — blocks redirect if `failed`, `cancelled`, or `refunded`
561
+ - Checks `order.payment_status` — blocks redirect if `failed`
562
+ - Only navigates to success page when payment is valid
563
+ - Shows error message from API on failure
564
+
565
+ #### `useOrderSuccess` — Post-purchase success page
566
+
567
+ ```tsx
568
+ import { useOrderSuccess } from "@onexapis/core/hooks";
569
+
570
+ const success = useOrderSuccess();
571
+ // success.orderId, success.orderNumber, success.displayOrderNumber
572
+ // success.trackOrderUrl — link to order lookup page
573
+ // success.hasOrder — boolean (false if no order in URL params)
574
+ ```
575
+
576
+ #### `useOrderSummary` — Calculate order totals
577
+
578
+ ```tsx
579
+ import { useOrderSummary, calculateOrderTotal } from "@onexapis/core/hooks";
580
+
581
+ const summary = useOrderSummary({
582
+ vatRate: 0.1,
583
+ shippingFee: 30000,
584
+ discount: 0,
585
+ freeShippingThreshold: 500000,
586
+ });
587
+ // summary.subtotal, summary.discount, summary.shipping, summary.vat, summary.total
588
+ // summary.formatPrice(amount)
589
+
590
+ // Standalone helper (no hook needed)
591
+ const total = calculateOrderTotal(items, { vatRate: 0.1, shippingFee: 30000 });
592
+ ```
593
+
594
+ #### `useOrderStatus` — Status label translation
595
+
596
+ ```tsx
597
+ import { useOrderStatus, getOrderStatusLabel } from "@onexapis/core/hooks";
598
+
599
+ const { getLabel, getPaymentLabel } = useOrderStatus();
600
+ getLabel("shipping"); // "Đang giao hàng"
601
+ getLabel("completed"); // "Hoàn thành"
602
+ getPaymentLabel("paid"); // "Đã thanh toán"
603
+
604
+ // Or use the standalone function
605
+ getOrderStatusLabel("pending"); // "Chờ xử lý"
606
+ ```
607
+
608
+ #### `useOrderListPage` — Order history page
609
+
610
+ ```tsx
611
+ import { useOrderListPage } from "@onexapis/core/hooks";
612
+
613
+ const orderList = useOrderListPage({ autoFetch: true, collapsedItemCount: 2 });
614
+ // orderList.orders — Order[]
615
+ // orderList.isLoading, orderList.error
616
+ // orderList.toggleOrder — expand/collapse order items
617
+ // orderList.refresh — re-fetch orders
618
+ // orderList.getDisplayItems — get visible items (respects collapsed state)
619
+ // orderList.hasMoreItems — check if order has hidden items
620
+ // orderList.formatCurrency, orderList.formatDate
621
+ ```
622
+
623
+ #### Order Type Reference
624
+
625
+ ```typescript
626
+ interface Order {
627
+ id: string;
628
+ order_number: string;
629
+ status: string; // pending | confirmed | processing | packing | shipping | completed | cancelled | failed | refunded
630
+ payment_status?: string; // paid | unpaid | failed
631
+ payment_method?: string;
632
+ total: number;
633
+ sub_total?: number;
634
+ tax?: number;
635
+ shipping_fee?: number;
636
+ discount?: number;
637
+ order_line_items?: OrderLineItem[];
638
+ shipping_address?: OrderAddress;
639
+ note?: string;
640
+ created_at: string;
641
+ updated_at?: string;
642
+ }
643
+
644
+ interface OrderLineItem {
645
+ name: string;
646
+ unit_price: number;
647
+ quantity: number;
648
+ product_id: string;
649
+ variant_name?: string;
650
+ image_url?: string;
651
+ sku?: string;
652
+ location?: { id: string; name: string };
653
+ }
654
+ ```
655
+
411
656
  ## Color System
412
657
 
413
658
  Colors in OneX themes work with **two approaches** (both are valid):
@@ -836,6 +1081,147 @@ export function MySection({ section, isEditing }: SectionComponentProps) {
836
1081
  }
837
1082
  ```
838
1083
 
1084
+ ## Page Background System
1085
+
1086
+ Every page has a background that comes from the theme by default, overridable per-page. This is a **page-level** feature (not section-level) — it wraps all sections on the page.
1087
+
1088
+ ### How it works
1089
+
1090
+ Background is resolved with priority:
1091
+
1092
+ 1. **Per-page override** (`PageConfig.background`) — set via editor or page config
1093
+ 2. **Theme default** (`ThemeDesignSystem.pageBackground`) — set in `theme.layout.ts`
1094
+ 3. **Fallback** — solid white `#FFFFFF`
1095
+
1096
+ ### Setting the theme default
1097
+
1098
+ In `theme.layout.ts`, add `pageBackground` inside `designSystem`:
1099
+
1100
+ ```typescript
1101
+ export const layoutConfig: ThemeLayoutConfig = {
1102
+ // ...headerSections, footerSections...
1103
+ designSystem: {
1104
+ colors: {
1105
+ primaryColor: "#3B82F6",
1106
+ secondaryColor: "#8B5CF6",
1107
+ colorMode: "light",
1108
+ },
1109
+ typography: { headingFont: "system-ui", bodyFont: "system-ui" },
1110
+ layout: { spacing: "comfortable" },
1111
+ pageBackground: {
1112
+ type: "solid", // "solid" | "gradient" | "image" | "pattern" | "none"
1113
+ color: "#FFFFFF", // Base background color
1114
+ },
1115
+ },
1116
+ };
1117
+ ```
1118
+
1119
+ ### Background types
1120
+
1121
+ | Type | Fields | Example |
1122
+ | ---------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
1123
+ | `solid` | `color` | `{ type: "solid", color: "#FFF8F0" }` |
1124
+ | `gradient` | `gradient`, `color` (fallback) | `{ type: "gradient", gradient: "linear-gradient(135deg, #667eea, #764ba2)" }` |
1125
+ | `image` | `image`, `imageSize`, `imagePosition`, `imageFixed`, `color` (fallback) | `{ type: "image", image: "/bg.jpg", imageSize: "cover", imageFixed: true }` |
1126
+ | `pattern` | `pattern`, `color`, `opacity`, `overlayColor` | `{ type: "pattern", pattern: "dots", color: "#FAFAFA", opacity: 0.05 }` |
1127
+ | `none` | — | `{ type: "none" }` (transparent, no wrapper) |
1128
+
1129
+ ### Built-in CSS patterns
1130
+
1131
+ These work out of the box with `type: "pattern"`:
1132
+
1133
+ - `dots` — dot grid
1134
+ - `grid` — line grid
1135
+ - `diagonal-lines` — 45-degree stripes
1136
+ - `cross-dots` — offset dot grid
1137
+ - `noise` — fractal noise texture
1138
+
1139
+ ### Custom animated patterns
1140
+
1141
+ Themes can provide custom pattern renderers (e.g., SVG-based animated backgrounds). Export the component from `bundle-entry.ts`:
1142
+
1143
+ ```typescript
1144
+ // In bundle-entry.ts
1145
+ export { SenBackground } from "./assets/sen-background";
1146
+ ```
1147
+
1148
+ The storefront will pick up exported `*Background` components and match them to pattern names. For example, `SenBackground` maps to `pattern: "sen"`.
1149
+
1150
+ Custom pattern components receive these props:
1151
+
1152
+ ```typescript
1153
+ interface PatternProps {
1154
+ opacity?: number; // Pattern opacity (default: 0.05)
1155
+ color?: string; // Overlay color
1156
+ className?: string; // Additional CSS classes
1157
+ }
1158
+ ```
1159
+
1160
+ ### Per-page override
1161
+
1162
+ In a page config (e.g., `pages/about.ts`), set `background`:
1163
+
1164
+ ```typescript
1165
+ export const aboutPageConfig = {
1166
+ title: "About",
1167
+ handle: "about",
1168
+ // ...other config...
1169
+ background: {
1170
+ type: "gradient",
1171
+ gradient: "linear-gradient(180deg, #EEF2FF 0%, #FFFFFF 50%)",
1172
+ },
1173
+ };
1174
+ ```
1175
+
1176
+ ### Accessing in sections via hook
1177
+
1178
+ Use `usePageBackground()` to read the resolved background in section components:
1179
+
1180
+ ```tsx
1181
+ import { usePageBackground } from "@onexapis/core/hooks";
1182
+
1183
+ export function MySection({ section }: SectionComponentProps) {
1184
+ const { config, styles, hasPattern, pattern, patternOpacity } =
1185
+ usePageBackground();
1186
+ // config.type — "solid" | "gradient" | "image" | "pattern" | "none"
1187
+ // config.color — base color
1188
+ // styles — React.CSSProperties derived from config
1189
+ // hasPattern — boolean, true if type === "pattern" && pattern is set
1190
+ // pattern — pattern name (e.g., "sen", "dots")
1191
+ // patternOpacity — number (0-1)
1192
+ }
1193
+ ```
1194
+
1195
+ ### PageBackgroundConfig type reference
1196
+
1197
+ ```typescript
1198
+ interface PageBackgroundConfig {
1199
+ type: "solid" | "gradient" | "image" | "pattern" | "none";
1200
+ color?: string; // Base background color (hex/CSS)
1201
+ gradient?: string; // CSS gradient value
1202
+ image?: string; // Background image URL
1203
+ imageSize?: "cover" | "contain" | "auto";
1204
+ imagePosition?: string; // CSS background-position (default: "center")
1205
+ imageFixed?: boolean; // Fixed background attachment
1206
+ pattern?: string; // Pattern identifier
1207
+ opacity?: number; // Pattern/overlay opacity (0-1, default: 0.05)
1208
+ overlayColor?: string; // Pattern overlay color
1209
+ className?: string; // Additional CSS classes
1210
+ }
1211
+ ```
1212
+
1213
+ ### CSS variables
1214
+
1215
+ The storefront injects these CSS variables when a page background is configured:
1216
+
1217
+ - `--page-bg-color` — base color
1218
+ - `--page-bg-gradient` — gradient value
1219
+ - `--page-bg-pattern` — pattern name
1220
+ - `--page-bg-pattern-opacity` — opacity value
1221
+ - `--page-bg-overlay-color` — overlay color
1222
+
1223
+ Use these in custom CSS if needed: `background-color: var(--page-bg-color);`
1224
+
839
1225
  ## Dark/Light Mode
840
1226
 
841
1227
  Themes support light, dark, and system color modes via `useThemeMode()`:
@@ -1204,22 +1590,26 @@ This project has THREE MCP servers. Do NOT confuse them:
1204
1590
  Registered in `.mcp.json` in this project. Provides theme-specific tools:
1205
1591
 
1206
1592
  - `onexthm_create_section` — Generate section files (component + schema + index) from structured input
1593
+ - `onexthm_from_html` — **Convert HTML/React/JSX code to OneX section** (parses elements, maps to components, detects blocks)
1594
+ - `onexthm_from_figma` — **Convert Figma design to OneX section** (see Figma Integration below)
1595
+ - `onexthm_generate_schema` — Generate schema from natural language description
1207
1596
  - `onexthm_validate` — Validate theme structure (7 checks: entry file, config, sections, blocks, code quality, registry)
1208
1597
  - `onexthm_list_hooks` — List available hooks with usage examples
1209
- - `onexthm_generate_schema` — Generate schema from natural language description
1210
- - `onexthm_from_figma` — **Convert Figma design to OneX section** (see Figma Integration below)
1211
1598
 
1212
1599
  Resources (auto-loaded context):
1213
1600
 
1214
1601
  - `onexthm://rules` — Theme development rules (DOs/DON'Ts)
1215
1602
  - `onexthm://field-types` — All available field types and categories
1216
1603
  - `onexthm://hooks` — Hooks reference with examples
1604
+ - `onexthm://components` — All component types with fields, slots, examples
1605
+ - `onexthm://blocks` — Block system patterns and data attributes
1217
1606
 
1218
1607
  Prompts (guided workflows):
1219
1608
 
1220
1609
  - `create_section` — Guided section creation workflow
1221
- - `review_theme` — Review theme for issues
1610
+ - `html_to_section` — Convert HTML/React code to OneX section
1222
1611
  - `figma_to_section` — Full Figma-to-OneX conversion pipeline
1612
+ - `review_theme` — Review theme for issues
1223
1613
 
1224
1614
  ### `figma` MCP (Figma Design) — USE WITH `onexthm`
1225
1615
 
@@ -1257,10 +1647,11 @@ This is for managing microservices on the OneXEOS platform. Its tools are:
1257
1647
  | Task | MCP to use |
1258
1648
  | -------------------------------- | ------------------------------------ |
1259
1649
  | Create a new section | `onexthm_create_section` |
1650
+ | Convert HTML/React to section | `onexthm_from_html` |
1260
1651
  | Convert Figma design to section | `onexthm_from_figma` + `figma` tools |
1652
+ | Generate schema from description | `onexthm_generate_schema` |
1261
1653
  | Validate theme structure | `onexthm_validate` |
1262
1654
  | Look up available hooks | `onexthm_list_hooks` |
1263
- | Generate schema from description | `onexthm_generate_schema` |
1264
1655
  | Read Figma design layers | `figma:get_metadata` |
1265
1656
  | Get Figma design tokens | `figma:get_variable_defs` |
1266
1657
  | Deploy a backend service | `onex_deploy` (platform MCP) |
@@ -1326,6 +1717,44 @@ Auto Layout gap → gap-N (Tailwind)
1326
1717
 
1327
1718
  Returns generated files: `{name}.schema.ts`, `{name}-default.tsx`, `index.ts`, plus registry entry.
1328
1719
 
1720
+ ### `onexthm_from_html` Tool Parameters
1721
+
1722
+ ```typescript
1723
+ {
1724
+ htmlCode: string, // Required: Raw HTML or React/JSX code
1725
+ sectionName: string, // Required: kebab-case name (e.g., "hero-banner")
1726
+ category?: string, // Optional: section category
1727
+ themePrefix?: string, // Optional: type prefix (e.g., "my-simple")
1728
+ }
1729
+ ```
1730
+
1731
+ Returns generated files: `{name}.schema.ts`, `{name}-default.tsx`, `index.ts`, plus registry entry.
1732
+
1733
+ ### How HTML Elements Map to OneX
1734
+
1735
+ ```
1736
+ HTML Element → OneX Component
1737
+ ────────────────────────────────────────────────────
1738
+ <h1>-<h6> → heading (with tag h1-h6)
1739
+ <p>, <span> → paragraph
1740
+ <button>, <a class="btn/cta"> → button
1741
+ <a> → link
1742
+ <img> → image
1743
+ <svg>, icon components → icon
1744
+ <ul>/<ol> → list
1745
+ <hr> → divider
1746
+ <blockquote> → quote
1747
+ <input>, <textarea>, <select> → input/textarea/select
1748
+ <video> → video
1749
+ <table> → table
1750
+ <div>, <section>, <article> → layout containers (recurse)
1751
+ Repeating sibling structures → block definitions
1752
+ Tailwind flex/grid classes → layout settings
1753
+ Tailwind bg-* classes → backgroundColor setting
1754
+ Tailwind text-* classes → fontSize/textAlign
1755
+ React <Button>, <Card>, etc. → resolved to HTML equivalents
1756
+ ```
1757
+
1329
1758
  ### Pixel → Tailwind Reference
1330
1759
 
1331
1760
  ```