@onexapis/cli 1.1.44 → 1.1.46
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 +409 -473
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +409 -473
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +44 -15
- package/dist/index.d.ts +44 -15
- package/dist/index.js +285 -443
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +285 -443
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -3
- package/templates/default/.cursorrules +126 -0
- package/templates/default/AGENTS.md +126 -0
- package/templates/default/CLAUDE.md +88 -1726
- package/templates/default/THEME_REFERENCE.md +1764 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onexapis/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.46",
|
|
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",
|
|
@@ -49,8 +49,7 @@
|
|
|
49
49
|
"registry": "https://registry.npmjs.org/"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"@onexapis/core": "^1.0.9",
|
|
52
|
+
"@onexapis/core": "^1.0.12",
|
|
54
53
|
"@tanstack/react-query": "^5.90.16",
|
|
55
54
|
"adm-zip": "^0.5.16",
|
|
56
55
|
"archiver": "^7.0.1",
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# CLAUDE.md — Routing rules for AI agents
|
|
2
|
+
|
|
3
|
+
This is an **OneX theme project**. It ships with the `onexthm` MCP server,
|
|
4
|
+
which provides tools that **write section files for you**. You must use those
|
|
5
|
+
tools as your first move on every theme task.
|
|
6
|
+
|
|
7
|
+
For deep reference (component types, hooks, animation tokens, color system,
|
|
8
|
+
dark mode, locale, full architecture), read **`THEME_REFERENCE.md`** in this
|
|
9
|
+
directory or call the relevant `onexthm_*` tool.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Before you start
|
|
14
|
+
|
|
15
|
+
At the start of every session, confirm the `onexthm_*` tools are available
|
|
16
|
+
in your tool list. If they are not, STOP and tell the user:
|
|
17
|
+
|
|
18
|
+
> "The onexthm MCP server is not loaded. Restart your AI client after
|
|
19
|
+
> verifying `.mcp.json` registers `@onexapis/theme-mcp`."
|
|
20
|
+
|
|
21
|
+
Do not silently fall back to writing files by hand.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Routing rules — what tool to call when
|
|
26
|
+
|
|
27
|
+
| When the user says… | Call this tool | Notes |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| "add / create / scaffold a section" (hero, header, footer, pricing, FAQ, testimonials, gallery, CTA, features, contact, newsletter, product grid, blog list, anything) | **`onexthm_create_section`** | Pass `projectDir` (this directory). Writes 3 files + patches `sections-registry.ts` in one call. |
|
|
30
|
+
| "add / create a page" (home, about, product detail, blog detail, checkout, order lookup, custom) | **`onexthm_create_page`** | Pass `projectDir`. Writes page config + patches `bundle-entry.ts`. |
|
|
31
|
+
| "convert / port / turn this HTML into a section", user pastes markup | **`onexthm_from_html`** | Pass `projectDir` + the source markup. |
|
|
32
|
+
| "convert Figma to a section", user references a Figma design | **`figma:get_metadata`** + **`figma:get_variable_defs`** → **`onexthm_from_figma`** | Call the figma tools first, then pass output to `onexthm_from_figma`. |
|
|
33
|
+
| "validate / lint / check my theme" | **`onexthm_validate`** | Run automatically after every write. |
|
|
34
|
+
| "fix / auto-fix / repair errors" | **`onexthm_fix`** | Auto-fixes: missing "use client", unregistered sections, schema mismatches, invalid page refs. Call `onexthm_validate` after to confirm. |
|
|
35
|
+
| "build / compile / bundle my theme" | **`onexthm_build`** | Returns structured errors with file:line. Run after code changes. |
|
|
36
|
+
| "what hooks can I use?" | **`onexthm_list_hooks`** | Filter by category. 44 hooks across 8 categories. |
|
|
37
|
+
| Anything else (architecture, animation, dark mode, locale, blocks, components) | Read `THEME_REFERENCE.md` first | Do not improvise. |
|
|
38
|
+
|
|
39
|
+
`projectDir` is **the directory containing `theme.config.ts` and `sections-registry.ts`**. In a fresh session opened in this folder, that's the current working directory.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Forbidden behaviors
|
|
44
|
+
|
|
45
|
+
These break the editor and storefront. Never do them.
|
|
46
|
+
|
|
47
|
+
1. **Never hand-write a section's `.tsx`, `.schema.ts`, or `index.ts`** when adding a new section. Call `onexthm_create_section`. The tool already produces correct file structure, schema shape, data attributes, imports, and registry entry. Hand-writing one-offs causes drift.
|
|
48
|
+
2. **Never edit `sections-registry.ts` by hand** to add a new section. The tools patch it for you.
|
|
49
|
+
3. **Never use raw `<h1>`, `<p>`, `<button>`** for *content* inside a section. Content goes through `ComponentRenderer` from `@onexapis/core/renderers`. Section components define **layout only**.
|
|
50
|
+
4. **Never skip `data-section-id`, `data-section-type`, `data-block-id`, `data-block-type`** on wrapper elements. Without them, the visual editor cannot select or edit the section.
|
|
51
|
+
5. **Never use `useEffect` for data fetching, never hardcode API URLs, never import from `@onexapis/core/internal`**. Use the documented hooks (`useProducts`, `useBlogs`, `useCart`, `useAuth`, `useCheckout`).
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Calling the tools — minimal examples
|
|
56
|
+
|
|
57
|
+
```jsonc
|
|
58
|
+
// Create a new section
|
|
59
|
+
onexthm_create_section({
|
|
60
|
+
projectDir: "<absolute path to this directory>",
|
|
61
|
+
name: "pricing-table",
|
|
62
|
+
description: "Three-tier pricing table with featured tier"
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
// Convert pasted HTML/JSX to a section
|
|
66
|
+
onexthm_from_html({
|
|
67
|
+
projectDir: "<absolute path to this directory>",
|
|
68
|
+
sectionName: "hero-banner",
|
|
69
|
+
htmlCode: "<div>...the user's markup...</div>"
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
// Convert a Figma frame (after calling figma:get_metadata first)
|
|
73
|
+
onexthm_from_figma({
|
|
74
|
+
projectDir: "<absolute path to this directory>",
|
|
75
|
+
sectionName: "feature-grid",
|
|
76
|
+
figmaMetadata: "<output of figma:get_metadata>",
|
|
77
|
+
figmaVariables: "<output of figma:get_variable_defs>"
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
// Create a page
|
|
81
|
+
onexthm_create_page({
|
|
82
|
+
projectDir: "<absolute path to this directory>",
|
|
83
|
+
handle: "product-detail",
|
|
84
|
+
path: "/products/[slug]",
|
|
85
|
+
isDynamic: true,
|
|
86
|
+
dynamicSegments: ["slug"]
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
// Validate after any write
|
|
90
|
+
onexthm_validate({ projectDir: "<absolute path to this directory>" })
|
|
91
|
+
|
|
92
|
+
// Auto-fix validation errors
|
|
93
|
+
onexthm_fix({ projectDir: "<absolute path to this directory>" })
|
|
94
|
+
|
|
95
|
+
// Build the theme
|
|
96
|
+
onexthm_build({ projectDir: "<absolute path to this directory>" })
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
All tools default to writing files on disk. Pass `dryRun: true` if the user
|
|
100
|
+
explicitly asks to preview without writing. Pass `force: true` to overwrite
|
|
101
|
+
existing files.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## After a tool call
|
|
106
|
+
|
|
107
|
+
1. Read the tool's response — it lists what was written and warns about anything skipped.
|
|
108
|
+
2. Run `onexthm_validate` if the tool didn't already.
|
|
109
|
+
3. Show the user the new file paths so they know where to edit further.
|
|
110
|
+
4. Only edit the generated files **after** they exist on disk — never re-generate by hand.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## When the answer isn't here
|
|
115
|
+
|
|
116
|
+
If the user's question is about hooks, components, blocks, animation, dark
|
|
117
|
+
mode, locale, dynamic pages, payments, the cart, or any deep API question,
|
|
118
|
+
either:
|
|
119
|
+
|
|
120
|
+
- Read `THEME_REFERENCE.md` (lives next to this file), or
|
|
121
|
+
- Call `onexthm_list_hooks` for hook signatures, or
|
|
122
|
+
- Read the `onexthm://components`, `onexthm://blocks`, `onexthm://field-types`,
|
|
123
|
+
`onexthm://hooks`, or `onexthm://rules` MCP resources.
|
|
124
|
+
|
|
125
|
+
`THEME_REFERENCE.md` is the canonical reference document for everything not
|
|
126
|
+
covered by these routing rules.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# CLAUDE.md — Routing rules for AI agents
|
|
2
|
+
|
|
3
|
+
This is an **OneX theme project**. It ships with the `onexthm` MCP server,
|
|
4
|
+
which provides tools that **write section files for you**. You must use those
|
|
5
|
+
tools as your first move on every theme task.
|
|
6
|
+
|
|
7
|
+
For deep reference (component types, hooks, animation tokens, color system,
|
|
8
|
+
dark mode, locale, full architecture), read **`THEME_REFERENCE.md`** in this
|
|
9
|
+
directory or call the relevant `onexthm_*` tool.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Before you start
|
|
14
|
+
|
|
15
|
+
At the start of every session, confirm the `onexthm_*` tools are available
|
|
16
|
+
in your tool list. If they are not, STOP and tell the user:
|
|
17
|
+
|
|
18
|
+
> "The onexthm MCP server is not loaded. Restart your AI client after
|
|
19
|
+
> verifying `.mcp.json` registers `@onexapis/theme-mcp`."
|
|
20
|
+
|
|
21
|
+
Do not silently fall back to writing files by hand.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Routing rules — what tool to call when
|
|
26
|
+
|
|
27
|
+
| When the user says… | Call this tool | Notes |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| "add / create / scaffold a section" (hero, header, footer, pricing, FAQ, testimonials, gallery, CTA, features, contact, newsletter, product grid, blog list, anything) | **`onexthm_create_section`** | Pass `projectDir` (this directory). Writes 3 files + patches `sections-registry.ts` in one call. |
|
|
30
|
+
| "add / create a page" (home, about, product detail, blog detail, checkout, order lookup, custom) | **`onexthm_create_page`** | Pass `projectDir`. Writes page config + patches `bundle-entry.ts`. |
|
|
31
|
+
| "convert / port / turn this HTML into a section", user pastes markup | **`onexthm_from_html`** | Pass `projectDir` + the source markup. |
|
|
32
|
+
| "convert Figma to a section", user references a Figma design | **`figma:get_metadata`** + **`figma:get_variable_defs`** → **`onexthm_from_figma`** | Call the figma tools first, then pass output to `onexthm_from_figma`. |
|
|
33
|
+
| "validate / lint / check my theme" | **`onexthm_validate`** | Run automatically after every write. |
|
|
34
|
+
| "fix / auto-fix / repair errors" | **`onexthm_fix`** | Auto-fixes: missing "use client", unregistered sections, schema mismatches, invalid page refs. Call `onexthm_validate` after to confirm. |
|
|
35
|
+
| "build / compile / bundle my theme" | **`onexthm_build`** | Returns structured errors with file:line. Run after code changes. |
|
|
36
|
+
| "what hooks can I use?" | **`onexthm_list_hooks`** | Filter by category. 44 hooks across 8 categories. |
|
|
37
|
+
| Anything else (architecture, animation, dark mode, locale, blocks, components) | Read `THEME_REFERENCE.md` first | Do not improvise. |
|
|
38
|
+
|
|
39
|
+
`projectDir` is **the directory containing `theme.config.ts` and `sections-registry.ts`**. In a fresh session opened in this folder, that's the current working directory.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Forbidden behaviors
|
|
44
|
+
|
|
45
|
+
These break the editor and storefront. Never do them.
|
|
46
|
+
|
|
47
|
+
1. **Never hand-write a section's `.tsx`, `.schema.ts`, or `index.ts`** when adding a new section. Call `onexthm_create_section`. The tool already produces correct file structure, schema shape, data attributes, imports, and registry entry. Hand-writing one-offs causes drift.
|
|
48
|
+
2. **Never edit `sections-registry.ts` by hand** to add a new section. The tools patch it for you.
|
|
49
|
+
3. **Never use raw `<h1>`, `<p>`, `<button>`** for *content* inside a section. Content goes through `ComponentRenderer` from `@onexapis/core/renderers`. Section components define **layout only**.
|
|
50
|
+
4. **Never skip `data-section-id`, `data-section-type`, `data-block-id`, `data-block-type`** on wrapper elements. Without them, the visual editor cannot select or edit the section.
|
|
51
|
+
5. **Never use `useEffect` for data fetching, never hardcode API URLs, never import from `@onexapis/core/internal`**. Use the documented hooks (`useProducts`, `useBlogs`, `useCart`, `useAuth`, `useCheckout`).
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Calling the tools — minimal examples
|
|
56
|
+
|
|
57
|
+
```jsonc
|
|
58
|
+
// Create a new section
|
|
59
|
+
onexthm_create_section({
|
|
60
|
+
projectDir: "<absolute path to this directory>",
|
|
61
|
+
name: "pricing-table",
|
|
62
|
+
description: "Three-tier pricing table with featured tier"
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
// Convert pasted HTML/JSX to a section
|
|
66
|
+
onexthm_from_html({
|
|
67
|
+
projectDir: "<absolute path to this directory>",
|
|
68
|
+
sectionName: "hero-banner",
|
|
69
|
+
htmlCode: "<div>...the user's markup...</div>"
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
// Convert a Figma frame (after calling figma:get_metadata first)
|
|
73
|
+
onexthm_from_figma({
|
|
74
|
+
projectDir: "<absolute path to this directory>",
|
|
75
|
+
sectionName: "feature-grid",
|
|
76
|
+
figmaMetadata: "<output of figma:get_metadata>",
|
|
77
|
+
figmaVariables: "<output of figma:get_variable_defs>"
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
// Create a page
|
|
81
|
+
onexthm_create_page({
|
|
82
|
+
projectDir: "<absolute path to this directory>",
|
|
83
|
+
handle: "product-detail",
|
|
84
|
+
path: "/products/[slug]",
|
|
85
|
+
isDynamic: true,
|
|
86
|
+
dynamicSegments: ["slug"]
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
// Validate after any write
|
|
90
|
+
onexthm_validate({ projectDir: "<absolute path to this directory>" })
|
|
91
|
+
|
|
92
|
+
// Auto-fix validation errors
|
|
93
|
+
onexthm_fix({ projectDir: "<absolute path to this directory>" })
|
|
94
|
+
|
|
95
|
+
// Build the theme
|
|
96
|
+
onexthm_build({ projectDir: "<absolute path to this directory>" })
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
All tools default to writing files on disk. Pass `dryRun: true` if the user
|
|
100
|
+
explicitly asks to preview without writing. Pass `force: true` to overwrite
|
|
101
|
+
existing files.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## After a tool call
|
|
106
|
+
|
|
107
|
+
1. Read the tool's response — it lists what was written and warns about anything skipped.
|
|
108
|
+
2. Run `onexthm_validate` if the tool didn't already.
|
|
109
|
+
3. Show the user the new file paths so they know where to edit further.
|
|
110
|
+
4. Only edit the generated files **after** they exist on disk — never re-generate by hand.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## When the answer isn't here
|
|
115
|
+
|
|
116
|
+
If the user's question is about hooks, components, blocks, animation, dark
|
|
117
|
+
mode, locale, dynamic pages, payments, the cart, or any deep API question,
|
|
118
|
+
either:
|
|
119
|
+
|
|
120
|
+
- Read `THEME_REFERENCE.md` (lives next to this file), or
|
|
121
|
+
- Call `onexthm_list_hooks` for hook signatures, or
|
|
122
|
+
- Read the `onexthm://components`, `onexthm://blocks`, `onexthm://field-types`,
|
|
123
|
+
`onexthm://hooks`, or `onexthm://rules` MCP resources.
|
|
124
|
+
|
|
125
|
+
`THEME_REFERENCE.md` is the canonical reference document for everything not
|
|
126
|
+
covered by these routing rules.
|