@onexapis/cli 1.1.39 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onexapis/cli",
3
- "version": "1.1.39",
3
+ "version": "1.1.40",
4
4
  "description": "CLI tool for OneX theme development - scaffolds themes using @onexapis/core",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -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`
@@ -1537,22 +1590,26 @@ This project has THREE MCP servers. Do NOT confuse them:
1537
1590
  Registered in `.mcp.json` in this project. Provides theme-specific tools:
1538
1591
 
1539
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
1540
1596
  - `onexthm_validate` — Validate theme structure (7 checks: entry file, config, sections, blocks, code quality, registry)
1541
1597
  - `onexthm_list_hooks` — List available hooks with usage examples
1542
- - `onexthm_generate_schema` — Generate schema from natural language description
1543
- - `onexthm_from_figma` — **Convert Figma design to OneX section** (see Figma Integration below)
1544
1598
 
1545
1599
  Resources (auto-loaded context):
1546
1600
 
1547
1601
  - `onexthm://rules` — Theme development rules (DOs/DON'Ts)
1548
1602
  - `onexthm://field-types` — All available field types and categories
1549
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
1550
1606
 
1551
1607
  Prompts (guided workflows):
1552
1608
 
1553
1609
  - `create_section` — Guided section creation workflow
1554
- - `review_theme` — Review theme for issues
1610
+ - `html_to_section` — Convert HTML/React code to OneX section
1555
1611
  - `figma_to_section` — Full Figma-to-OneX conversion pipeline
1612
+ - `review_theme` — Review theme for issues
1556
1613
 
1557
1614
  ### `figma` MCP (Figma Design) — USE WITH `onexthm`
1558
1615
 
@@ -1590,10 +1647,11 @@ This is for managing microservices on the OneXEOS platform. Its tools are:
1590
1647
  | Task | MCP to use |
1591
1648
  | -------------------------------- | ------------------------------------ |
1592
1649
  | Create a new section | `onexthm_create_section` |
1650
+ | Convert HTML/React to section | `onexthm_from_html` |
1593
1651
  | Convert Figma design to section | `onexthm_from_figma` + `figma` tools |
1652
+ | Generate schema from description | `onexthm_generate_schema` |
1594
1653
  | Validate theme structure | `onexthm_validate` |
1595
1654
  | Look up available hooks | `onexthm_list_hooks` |
1596
- | Generate schema from description | `onexthm_generate_schema` |
1597
1655
  | Read Figma design layers | `figma:get_metadata` |
1598
1656
  | Get Figma design tokens | `figma:get_variable_defs` |
1599
1657
  | Deploy a backend service | `onex_deploy` (platform MCP) |
@@ -1659,6 +1717,44 @@ Auto Layout gap → gap-N (Tailwind)
1659
1717
 
1660
1718
  Returns generated files: `{name}.schema.ts`, `{name}-default.tsx`, `index.ts`, plus registry entry.
1661
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
+
1662
1758
  ### Pixel → Tailwind Reference
1663
1759
 
1664
1760
  ```