@onexapis/cli 1.1.22 → 1.1.25
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/dist/cli.js +49 -0
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +49 -0
- package/dist/cli.mjs.map +1 -1
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -0
- package/dist/index.mjs.map +1 -1
- package/dist/preview/preview-app.tsx +3 -0
- package/package.json +4 -3
- package/templates/default/.mcp.json +5 -1
- package/templates/default/CLAUDE.md +115 -12
|
@@ -13,6 +13,7 @@ import * as coreContexts from "@onexapis/core/contexts";
|
|
|
13
13
|
import * as coreComponents from "@onexapis/core/components";
|
|
14
14
|
import * as coreRegistry from "@onexapis/core/registry";
|
|
15
15
|
import * as coreCommerce from "@onexapis/core/commerce";
|
|
16
|
+
import * as coreHooks from "@onexapis/core/hooks";
|
|
16
17
|
import * as coreCommerceHooks from "@onexapis/core/commerce/hooks";
|
|
17
18
|
import * as coreAuth from "@onexapis/core/auth";
|
|
18
19
|
import * as coreCart from "@onexapis/core/cart";
|
|
@@ -44,6 +45,7 @@ import { LocaleProvider } from "@onexapis/core/contexts";
|
|
|
44
45
|
...coreComponents,
|
|
45
46
|
...coreRegistry,
|
|
46
47
|
...coreCommerce,
|
|
48
|
+
...coreHooks,
|
|
47
49
|
...coreCommerceHooks,
|
|
48
50
|
...coreAuth,
|
|
49
51
|
...coreCart,
|
|
@@ -59,6 +61,7 @@ import { LocaleProvider } from "@onexapis/core/contexts";
|
|
|
59
61
|
components: coreComponents,
|
|
60
62
|
registry: coreRegistry,
|
|
61
63
|
commerce: coreCommerce,
|
|
64
|
+
hooks: coreHooks,
|
|
62
65
|
"commerce/hooks": coreCommerceHooks,
|
|
63
66
|
auth: coreAuth,
|
|
64
67
|
cart: coreCart,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onexapis/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.25",
|
|
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",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"dev": "tsup --watch",
|
|
21
21
|
"type-check": "tsc --noEmit",
|
|
22
22
|
"lint": "eslint src --ext .ts",
|
|
23
|
-
"prepublishOnly": "pnpm run type-check && pnpm run build"
|
|
23
|
+
"prepublishOnly": "pnpm run type-check && pnpm run build",
|
|
24
|
+
"release": "npm version patch --no-git-tag-version && node -e \"const p=require('./package.json');const fs=require('fs');const cv=require('../core/package.json').version;p.dependencies['@onexapis/core']='^'+cv;fs.writeFileSync('package.json',JSON.stringify(p,null,2)+'\\n')\" && npm publish --access public && node -e \"const p=require('./package.json');const fs=require('fs');p.dependencies['@onexapis/core']='workspace:*';fs.writeFileSync('package.json',JSON.stringify(p,null,2)+'\\n')\""
|
|
24
25
|
},
|
|
25
26
|
"keywords": [
|
|
26
27
|
"onex",
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|
|
51
52
|
"@aws-sdk/client-s3": "^3.470.0",
|
|
52
|
-
"@onexapis/core": "
|
|
53
|
+
"@onexapis/core": "workspace:*",
|
|
53
54
|
"@tanstack/react-query": "^5.90.16",
|
|
54
55
|
"adm-zip": "^0.5.16",
|
|
55
56
|
"archiver": "^7.0.1",
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
"mcpServers": {
|
|
3
3
|
"onexthm": {
|
|
4
4
|
"command": "npx",
|
|
5
|
-
"args": ["@onexapis/theme-mcp"]
|
|
5
|
+
"args": ["-y", "@onexapis/theme-mcp"]
|
|
6
|
+
},
|
|
7
|
+
"figma": {
|
|
8
|
+
"command": "npx",
|
|
9
|
+
"args": ["-y", "figma-developer-mcp", "--figma-api-key=__FIGMA_API_KEY__", "--stdio"]
|
|
6
10
|
}
|
|
7
11
|
}
|
|
8
12
|
}
|
|
@@ -911,16 +911,48 @@ export default ProductGrid;
|
|
|
911
911
|
|
|
912
912
|
## MCP Servers
|
|
913
913
|
|
|
914
|
-
This project has
|
|
914
|
+
This project has THREE MCP servers. Do NOT confuse them:
|
|
915
915
|
|
|
916
916
|
### `onexthm` MCP (Theme Development) — USE THIS
|
|
917
917
|
|
|
918
918
|
Registered in `.mcp.json` in this project. Provides theme-specific tools:
|
|
919
919
|
|
|
920
|
-
- `onexthm_create_section` — Generate section files (component + schema + index)
|
|
921
|
-
- `onexthm_validate` — Validate theme structure
|
|
922
|
-
- `onexthm_list_hooks` — List available hooks with examples
|
|
923
|
-
- `onexthm_generate_schema` — Generate schema from natural language
|
|
920
|
+
- `onexthm_create_section` — Generate section files (component + schema + index) from structured input
|
|
921
|
+
- `onexthm_validate` — Validate theme structure (7 checks: entry file, config, sections, blocks, code quality, registry)
|
|
922
|
+
- `onexthm_list_hooks` — List available hooks with usage examples
|
|
923
|
+
- `onexthm_generate_schema` — Generate schema from natural language description
|
|
924
|
+
- `onexthm_from_figma` — **Convert Figma design to OneX section** (see Figma Integration below)
|
|
925
|
+
|
|
926
|
+
Resources (auto-loaded context):
|
|
927
|
+
- `onexthm://rules` — Theme development rules (DOs/DON'Ts)
|
|
928
|
+
- `onexthm://field-types` — All available field types and categories
|
|
929
|
+
- `onexthm://hooks` — Hooks reference with examples
|
|
930
|
+
|
|
931
|
+
Prompts (guided workflows):
|
|
932
|
+
- `create_section` — Guided section creation workflow
|
|
933
|
+
- `review_theme` — Review theme for issues
|
|
934
|
+
- `figma_to_section` — Full Figma-to-OneX conversion pipeline
|
|
935
|
+
|
|
936
|
+
### `figma` MCP (Figma Design) — USE WITH `onexthm`
|
|
937
|
+
|
|
938
|
+
Registered in `.mcp.json`. Reads Figma designs for design-to-code conversion:
|
|
939
|
+
|
|
940
|
+
- `get_metadata` — Layer hierarchy (IDs, names, types, positions, sizes)
|
|
941
|
+
- `get_design_context` — React + Tailwind code suggestion for selected layers
|
|
942
|
+
- `get_variable_defs` — Design tokens (colors, typography, spacing variables)
|
|
943
|
+
- `get_screenshot` — Visual screenshot of selected elements
|
|
944
|
+
- `search_design_system` — Search components, variables, styles from libraries
|
|
945
|
+
|
|
946
|
+
**Setup**: Requires Figma API key in `.mcp.json`:
|
|
947
|
+
```json
|
|
948
|
+
{
|
|
949
|
+
"figma": {
|
|
950
|
+
"command": "npx",
|
|
951
|
+
"args": ["-y", "figma-developer-mcp", "--figma-api-key=YOUR_KEY", "--stdio"]
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
```
|
|
955
|
+
Get your key: Figma → Settings → Account → Personal access tokens.
|
|
924
956
|
|
|
925
957
|
### `onex-platform` MCP (Backend Services) — DO NOT USE FOR THEMES
|
|
926
958
|
|
|
@@ -932,10 +964,81 @@ This is for managing microservices on the OneXEOS platform. Its tools are:
|
|
|
932
964
|
|
|
933
965
|
### When to use which
|
|
934
966
|
|
|
935
|
-
| Task
|
|
936
|
-
|
|
|
937
|
-
| Create a new section
|
|
938
|
-
|
|
|
939
|
-
|
|
|
940
|
-
|
|
|
941
|
-
|
|
|
967
|
+
| Task | MCP to use |
|
|
968
|
+
| --------------------------------- | ----------------------------------------- |
|
|
969
|
+
| Create a new section | `onexthm_create_section` |
|
|
970
|
+
| Convert Figma design to section | `onexthm_from_figma` + `figma` tools |
|
|
971
|
+
| Validate theme structure | `onexthm_validate` |
|
|
972
|
+
| Look up available hooks | `onexthm_list_hooks` |
|
|
973
|
+
| Generate schema from description | `onexthm_generate_schema` |
|
|
974
|
+
| Read Figma design layers | `figma:get_metadata` |
|
|
975
|
+
| Get Figma design tokens | `figma:get_variable_defs` |
|
|
976
|
+
| Deploy a backend service | `onex_deploy` (platform MCP) |
|
|
977
|
+
| Check service health | `onex_status` (platform MCP) |
|
|
978
|
+
|
|
979
|
+
## Figma → OneX Conversion
|
|
980
|
+
|
|
981
|
+
Convert Figma designs directly to OneX theme sections using the combined Figma + OneX MCP pipeline.
|
|
982
|
+
|
|
983
|
+
### Quick Start
|
|
984
|
+
|
|
985
|
+
Use the `figma_to_section` prompt for a guided workflow:
|
|
986
|
+
```
|
|
987
|
+
"Convert the selected Figma frame to a section called 'hero'"
|
|
988
|
+
```
|
|
989
|
+
|
|
990
|
+
Or manually orchestrate the steps:
|
|
991
|
+
|
|
992
|
+
```
|
|
993
|
+
1. figma:get_metadata → Get layer hierarchy
|
|
994
|
+
2. figma:get_variable_defs → Get design tokens
|
|
995
|
+
3. figma:get_design_context → Get React+Tailwind code
|
|
996
|
+
4. onexthm:onexthm_from_figma → Convert to OneX section files
|
|
997
|
+
5. Write files to sections/ directory
|
|
998
|
+
6. onexthm:onexthm_validate → Validate
|
|
999
|
+
7. Register in sections-registry.ts
|
|
1000
|
+
```
|
|
1001
|
+
|
|
1002
|
+
### How Figma Layers Map to OneX
|
|
1003
|
+
|
|
1004
|
+
```
|
|
1005
|
+
Figma Layer → OneX Concept
|
|
1006
|
+
────────────────────────────────────────────────
|
|
1007
|
+
Top-level Frame → Section
|
|
1008
|
+
Nested Frame/Group → Block
|
|
1009
|
+
TEXT (large >=24px, bold >=600) → heading (h1-h6)
|
|
1010
|
+
TEXT (body <24px) → paragraph
|
|
1011
|
+
Button instance → button component
|
|
1012
|
+
Image node → image component
|
|
1013
|
+
Icon instance → icon component
|
|
1014
|
+
Badge/Label → badge component
|
|
1015
|
+
Repeating children (same shape) → Block definition
|
|
1016
|
+
Background color fill → backgroundColor setting
|
|
1017
|
+
Background image fill → backgroundImage setting
|
|
1018
|
+
Auto Layout horizontal → flex flex-row (Tailwind)
|
|
1019
|
+
Auto Layout vertical → flex flex-col (Tailwind)
|
|
1020
|
+
Auto Layout gap → gap-N (Tailwind)
|
|
1021
|
+
```
|
|
1022
|
+
|
|
1023
|
+
### `onexthm_from_figma` Tool Parameters
|
|
1024
|
+
|
|
1025
|
+
```typescript
|
|
1026
|
+
{
|
|
1027
|
+
figmaMetadata: string, // Required: XML/JSON from figma:get_metadata
|
|
1028
|
+
figmaVariables?: string, // Optional: JSON from figma:get_variable_defs
|
|
1029
|
+
figmaCode?: string, // Optional: code from figma:get_design_context (fallback)
|
|
1030
|
+
sectionName: string, // Required: kebab-case name (e.g., "hero")
|
|
1031
|
+
category?: string, // Optional: section category
|
|
1032
|
+
themePrefix?: string, // Optional: type prefix (e.g., "my-simple")
|
|
1033
|
+
}
|
|
1034
|
+
```
|
|
1035
|
+
|
|
1036
|
+
Returns generated files: `{name}.schema.ts`, `{name}-default.tsx`, `index.ts`, plus registry entry.
|
|
1037
|
+
|
|
1038
|
+
### Pixel → Tailwind Reference
|
|
1039
|
+
|
|
1040
|
+
```
|
|
1041
|
+
Font Size: 12→xs 14→sm 16→base 18→lg 20→xl 24→2xl 30→3xl 36→4xl 48→5xl 60→6xl
|
|
1042
|
+
Spacing: 4→1 8→2 12→3 16→4 20→5 24→6 32→8 40→10 48→12 64→16 80→20 96→24
|
|
1043
|
+
Weight: 100-400→normal 500→medium 600→semibold 700+→bold
|
|
1044
|
+
```
|