@optima-chat/optima-agent 0.4.14 → 0.4.15
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/.claude/skills/collection/SKILL.md +81 -0
- package/.claude/skills/comfy/SKILL.md +6 -1
- package/.claude/skills/homepage/SKILL.md +277 -0
- package/.claude/skills/product-page/SKILL.md +200 -0
- package/README.md +3 -1
- package/dist/src/system-prompt.d.ts.map +1 -1
- package/dist/src/system-prompt.js +3 -1
- package/dist/src/system-prompt.js.map +1 -1
- package/package.json +1 -1
- package/.claude/skills/storefront/SKILL.md +0 -426
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: collection
|
|
3
|
+
description: 商品集合管理。创建、编辑集合,管理集合中的商品。当用户需要对商品进行分组、创建促销专区、管理商品分类时使用。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## 概念
|
|
7
|
+
|
|
8
|
+
Collection(集合)是商品的逻辑分组,用于在店铺中组织和展示商品。类似 Shopify 的 Collections。
|
|
9
|
+
|
|
10
|
+
- 一个商品可以属于多个集合(多对多关系)
|
|
11
|
+
- 集合支持层级结构(parent_id)
|
|
12
|
+
- 集合通过 slug 在 URL 中标识,如 `/collections/summer-sale`
|
|
13
|
+
|
|
14
|
+
## 结构
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
Collection
|
|
18
|
+
├── 基本信息
|
|
19
|
+
│ ├── name: 集合名称
|
|
20
|
+
│ ├── slug: URL 标识(商户内唯一)
|
|
21
|
+
│ └── description: 描述
|
|
22
|
+
├── 显示设置
|
|
23
|
+
│ ├── display_order: 显示顺序
|
|
24
|
+
│ ├── is_active: 是否激活
|
|
25
|
+
│ └── cover_media_id: 封面图
|
|
26
|
+
├── 层级
|
|
27
|
+
│ └── parent_id: 父集合(可选)
|
|
28
|
+
├── SEO
|
|
29
|
+
│ ├── meta_title: SEO 标题
|
|
30
|
+
│ └── meta_description: SEO 描述
|
|
31
|
+
└── 商品(多对多)
|
|
32
|
+
└── products: 集合中的商品列表
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 典型场景
|
|
36
|
+
|
|
37
|
+
当用户说:
|
|
38
|
+
- "查看所有集合" / "集合列表" → `commerce collection list`
|
|
39
|
+
- "创建集合 XX" → `commerce collection create --name "XX" --slug xx`
|
|
40
|
+
- "查看集合详情" → `commerce collection get --slug xx`
|
|
41
|
+
- "删除集合 XX" → `commerce collection delete --slug xx --yes`
|
|
42
|
+
- "把商品加到集合" → `commerce collection add-products --slug xx --product-ids p1,p2`
|
|
43
|
+
- "从集合移除商品" → `commerce collection remove-products --slug xx --product-ids p1`
|
|
44
|
+
- "查看集合里有哪些商品" → `commerce collection list-products --slug xx`
|
|
45
|
+
|
|
46
|
+
## 命令参考
|
|
47
|
+
|
|
48
|
+
### 集合 CRUD
|
|
49
|
+
- `commerce collection list` - 列出所有集合
|
|
50
|
+
- `commerce collection create` - 创建集合
|
|
51
|
+
- `commerce collection get --slug <slug>` - 查看集合详情
|
|
52
|
+
- `commerce collection update --slug <slug>` - 更新集合
|
|
53
|
+
- `commerce collection delete --slug <slug> --yes` - 删除集合
|
|
54
|
+
- `commerce collection set-cover --slug <slug> --media-id <id>` - 设置封面图
|
|
55
|
+
|
|
56
|
+
### 商品管理
|
|
57
|
+
- `commerce collection add-products --slug <slug> --product-ids <ids>` - 添加商品
|
|
58
|
+
- `commerce collection remove-products --slug <slug> --product-ids <ids>` - 移除商品
|
|
59
|
+
- `commerce collection list-products --slug <slug>` - 列出集合中的商品
|
|
60
|
+
|
|
61
|
+
## 创建集合示例
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# 创建促销集合
|
|
65
|
+
commerce collection create \
|
|
66
|
+
--name "Summer Sale 2024" \
|
|
67
|
+
--slug summer-sale-2024 \
|
|
68
|
+
--description "Hot deals for summer"
|
|
69
|
+
|
|
70
|
+
# 添加商品到集合
|
|
71
|
+
commerce collection add-products \
|
|
72
|
+
--slug summer-sale-2024 \
|
|
73
|
+
--product-ids prod_123,prod_456,prod_789
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 注意事项
|
|
77
|
+
|
|
78
|
+
- **slug 规范**:使用英文、数字、连字符,避免中文和特殊字符(影响 SEO 和 URL)
|
|
79
|
+
- **删除确认**:删除操作需要 `--yes` 参数确认
|
|
80
|
+
- **商品数量**:建议每个集合包含 5-30 个商品,过少显得空,过多难以浏览
|
|
81
|
+
- **层级深度**:支持父子集合,但建议层级不超过 2 层
|
|
@@ -168,7 +168,7 @@ comfy video <图片路径> [options]
|
|
|
168
168
|
| `-d, --duration` | 5 \| 10 \| 15 秒 | 5 |
|
|
169
169
|
| `--shot-type` | single \| multi(多镜头叙事) | single |
|
|
170
170
|
| `--no-audio` | 禁用自动配音 | - |
|
|
171
|
-
| `--audio-url <url>` |
|
|
171
|
+
| `--audio-url <url>` | 自定义音频 URL(需先用 `commerce upload` 上传) | - |
|
|
172
172
|
| `--no-prompt-extend` | 禁用智能改写 prompt | - |
|
|
173
173
|
| `--watermark` | 添加 AI 生成水印 | - |
|
|
174
174
|
| `--seed <number>` | 随机种子(可复现) | - |
|
|
@@ -188,6 +188,11 @@ comfy video story.png --shot-type multi -d 15 --prompt "a day in the life"
|
|
|
188
188
|
# 静音视频
|
|
189
189
|
comfy video product.png --no-audio --prompt "360 degree rotation"
|
|
190
190
|
|
|
191
|
+
# 自定义音频(需先上传获取 URL)
|
|
192
|
+
commerce upload /home/aiuser/music.mp3
|
|
193
|
+
# 返回 URL 后使用
|
|
194
|
+
comfy video scene.png --audio-url "https://..." -o /home/aiuser/project/with-audio.mp4
|
|
195
|
+
|
|
191
196
|
# 指定输出路径
|
|
192
197
|
comfy video scene.png -o /home/aiuser/project/result.mp4 --prompt "camera zoom"
|
|
193
198
|
Read /home/aiuser/project/result.mp4
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: homepage
|
|
3
|
+
description: 店铺首页配置。管理首页区块(Banner、集合列表、集合商品、特色推荐)。当用户需要配置店铺首页布局、添加轮播图、展示集合时使用。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## 概念
|
|
7
|
+
|
|
8
|
+
Homepage(首页)是店铺的入口页面,由多个 Section(区块)组成。每个商户有一个激活的首页配置。
|
|
9
|
+
|
|
10
|
+
- 区块按 position 排序,从上到下显示
|
|
11
|
+
- 每个区块有唯一的 handle,用于 URL 锚点定位
|
|
12
|
+
- 区块通过 settings 存储类型特定的配置
|
|
13
|
+
|
|
14
|
+
**与 Collection 的关系**:多个区块类型引用 Collection:
|
|
15
|
+
- `collections` 区块:展示多个集合入口(引用 collection slugs)
|
|
16
|
+
- `collection_products` 区块:展示某个集合的商品(引用单个 collection slug)
|
|
17
|
+
- `featured` 区块:可推荐某个集合(target_type=collection)
|
|
18
|
+
|
|
19
|
+
→ 参考 [Collection Skill](../collection/SKILL.md) 了解集合管理
|
|
20
|
+
|
|
21
|
+
## 结构
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
Homepage
|
|
25
|
+
├── HomepageConfig(商户唯一)
|
|
26
|
+
│ ├── id: 配置 ID
|
|
27
|
+
│ ├── is_active: 是否激活
|
|
28
|
+
│ └── sections: 区块列表
|
|
29
|
+
│
|
|
30
|
+
└── HomepageSection(区块)
|
|
31
|
+
├── 基本信息
|
|
32
|
+
│ ├── id: 区块 ID
|
|
33
|
+
│ ├── type: 类型(见下方)
|
|
34
|
+
│ ├── title: 标题
|
|
35
|
+
│ ├── handle: URL 标识
|
|
36
|
+
│ └── position: 显示顺序(0 开始)
|
|
37
|
+
│
|
|
38
|
+
└── settings: 类型特定配置(JSONB)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 区块类型详解
|
|
42
|
+
|
|
43
|
+
### 1. banner(图片轮播)
|
|
44
|
+
|
|
45
|
+
首页顶部的轮播广告图,支持多张图片自动轮播,每张图可设置点击跳转。
|
|
46
|
+
|
|
47
|
+
**Settings 字段**:
|
|
48
|
+
| 字段 | 类型 | 说明 |
|
|
49
|
+
|------|------|------|
|
|
50
|
+
| images | array | 图片数组(见下方) |
|
|
51
|
+
| autoplay | boolean | 是否自动播放,默认 true |
|
|
52
|
+
| interval | number | 轮播间隔(毫秒),默认 5000 |
|
|
53
|
+
|
|
54
|
+
**images 数组元素**:
|
|
55
|
+
| 字段 | 必填 | 说明 |
|
|
56
|
+
|------|------|------|
|
|
57
|
+
| url | ✓ | 图片 URL |
|
|
58
|
+
| alt | ✓ | 图片描述(SEO + 可访问性) |
|
|
59
|
+
| action_type | ✓ | 点击动作类型(见下方) |
|
|
60
|
+
| action_value | | 动作目标值 |
|
|
61
|
+
|
|
62
|
+
**action_type 取值**:
|
|
63
|
+
| 值 | 说明 | action_value |
|
|
64
|
+
|----|------|--------------|
|
|
65
|
+
| `none` | 无跳转 | null |
|
|
66
|
+
| `collection` | 跳转到集合页 | collection slug |
|
|
67
|
+
| `product` | 跳转到商品页 | product handle |
|
|
68
|
+
| `url` | 跳转到 URL | 完整 URL 或相对路径 |
|
|
69
|
+
| `section` | 滚动到页面区块 | section handle |
|
|
70
|
+
|
|
71
|
+
**示例**:
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"images": [
|
|
75
|
+
{"url": "https://cdn.../summer.jpg", "alt": "夏日促销", "action_type": "collection", "action_value": "summer-sale"},
|
|
76
|
+
{"url": "https://cdn.../promo.jpg", "alt": "活动页面", "action_type": "url", "action_value": "https://promo.example.com/event"},
|
|
77
|
+
{"url": "https://cdn.../hero.jpg", "alt": "品牌形象", "action_type": "none", "action_value": null}
|
|
78
|
+
],
|
|
79
|
+
"autoplay": true,
|
|
80
|
+
"interval": 5000
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 2. collections(集合入口列表)
|
|
85
|
+
|
|
86
|
+
展示多个集合的入口卡片,用户点击可进入对应集合页。
|
|
87
|
+
|
|
88
|
+
**Settings 字段**:
|
|
89
|
+
| 字段 | 类型 | 说明 |
|
|
90
|
+
|------|------|------|
|
|
91
|
+
| collection_slugs | array | 集合 slug 数组,按顺序展示 |
|
|
92
|
+
| layout | string | 布局方式:`grid`(网格)/ `carousel`(轮播) |
|
|
93
|
+
| show_product_count | boolean | 是否显示集合商品数量 |
|
|
94
|
+
|
|
95
|
+
**示例**:
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"collection_slugs": ["summer-sale", "new-arrivals", "best-sellers"],
|
|
99
|
+
"layout": "grid",
|
|
100
|
+
"show_product_count": true
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 3. collection_products(集合商品展示)
|
|
105
|
+
|
|
106
|
+
展示某个集合内的商品列表,支持自动获取或手动指定。
|
|
107
|
+
|
|
108
|
+
**Settings 字段**:
|
|
109
|
+
| 字段 | 类型 | 说明 |
|
|
110
|
+
|------|------|------|
|
|
111
|
+
| collection_slug | string | 集合 slug(必需) |
|
|
112
|
+
| mode | string | `auto`(自动获取)/ `manual`(手动指定) |
|
|
113
|
+
| product_handles | array | mode=manual 时,手动指定的商品 handle 列表 |
|
|
114
|
+
| limit | number | mode=auto 时,最多展示数量,默认 8 |
|
|
115
|
+
| sort_by | string | 排序字段:`created_at` / `price` / `title` |
|
|
116
|
+
| sort_order | string | 排序方向:`asc` / `desc` |
|
|
117
|
+
|
|
118
|
+
**示例**:
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"collection_slug": "new-arrivals",
|
|
122
|
+
"mode": "auto",
|
|
123
|
+
"limit": 8,
|
|
124
|
+
"sort_by": "created_at",
|
|
125
|
+
"sort_order": "desc"
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 4. featured(特色推荐)
|
|
130
|
+
|
|
131
|
+
突出展示某个集合或商品,通常带有大图和 CTA 按钮。
|
|
132
|
+
|
|
133
|
+
**Settings 字段**:
|
|
134
|
+
| 字段 | 类型 | 说明 |
|
|
135
|
+
|------|------|------|
|
|
136
|
+
| target_type | string | `collection`(推荐集合)/ `product`(推荐商品) |
|
|
137
|
+
| target_handle | string | 目标的 slug/handle |
|
|
138
|
+
| media_id | string | 封面图片的 media ID |
|
|
139
|
+
| media_url | string | 或直接提供封面图片 URL |
|
|
140
|
+
| cta_text | string | CTA 按钮文字,如 "立即查看" |
|
|
141
|
+
| background_color | string | 背景颜色,如 "#f5f5f5" |
|
|
142
|
+
|
|
143
|
+
**示例(推荐集合)**:
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"target_type": "collection",
|
|
147
|
+
"target_handle": "summer-sale",
|
|
148
|
+
"media_url": "https://cdn.../featured.jpg",
|
|
149
|
+
"cta_text": "查看夏日精选",
|
|
150
|
+
"background_color": "#fff8e1"
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**示例(推荐商品)**:
|
|
155
|
+
```json
|
|
156
|
+
{
|
|
157
|
+
"target_type": "product",
|
|
158
|
+
"target_handle": "ceramic-cup-white",
|
|
159
|
+
"media_url": "https://cdn.../product-hero.jpg",
|
|
160
|
+
"cta_text": "立即购买"
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## 典型场景
|
|
165
|
+
|
|
166
|
+
当用户说:
|
|
167
|
+
- "查看首页配置" → `commerce homepage get-config`
|
|
168
|
+
- "查看首页区块" → `commerce homepage list`
|
|
169
|
+
- "添加轮播图区块" → `commerce homepage create --type banner --title "主 Banner"`
|
|
170
|
+
- "更新轮播图图片" → `commerce homepage update-images --id xx --images '[...]'`
|
|
171
|
+
- "设置集合列表" → `commerce homepage update-collections --id xx --slugs "a,b,c"`
|
|
172
|
+
- "调整区块顺序" → `commerce homepage reorder --ids "id1,id2,id3"`
|
|
173
|
+
- "使用模板" → `commerce homepage switch-template --template-key minimal`
|
|
174
|
+
- "删除区块" → `commerce homepage delete --id xx --yes`
|
|
175
|
+
|
|
176
|
+
## 命令参考
|
|
177
|
+
|
|
178
|
+
### 配置管理
|
|
179
|
+
- `commerce homepage get-config` - 查看首页配置
|
|
180
|
+
- `commerce homepage list-templates` - 列出可用模板
|
|
181
|
+
- `commerce homepage switch-template --template-key <key>` - 切换模板(minimal|standard)
|
|
182
|
+
- `commerce homepage delete-config --yes` - 删除首页配置
|
|
183
|
+
|
|
184
|
+
### 区块 CRUD
|
|
185
|
+
- `commerce homepage list` - 列出所有区块
|
|
186
|
+
- `commerce homepage create --type <type> --title <title>` - 创建区块
|
|
187
|
+
- `commerce homepage get --id <id>` - 查看区块详情
|
|
188
|
+
- `commerce homepage update --id <id>` - 更新区块
|
|
189
|
+
- `commerce homepage delete --id <id> --yes` - 删除区块
|
|
190
|
+
- `commerce homepage reorder --ids <id1,id2,...>` - 重新排序
|
|
191
|
+
|
|
192
|
+
### 区块设置
|
|
193
|
+
- `commerce homepage update-images --id <id> --images <json>` - 更新 banner 图片
|
|
194
|
+
- `commerce homepage update-collections --id <id> --slugs <slugs>` - 更新 collections 集合
|
|
195
|
+
- `commerce homepage update-target --id <id> --type <type> --handle <handle>` - 更新 featured 目标
|
|
196
|
+
- `commerce homepage patch-settings --id <id> --settings <json>` - 通用设置更新
|
|
197
|
+
|
|
198
|
+
## 典型操作示例
|
|
199
|
+
|
|
200
|
+
### 快速开始:使用模板
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# 查看可用模板
|
|
204
|
+
commerce homepage list-templates
|
|
205
|
+
|
|
206
|
+
# 切换到标准模板(会创建预设区块)
|
|
207
|
+
commerce homepage switch-template --template-key standard --yes
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### 配置轮播图
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# 1. 创建 banner 区块
|
|
214
|
+
commerce homepage create --type banner --title "首页轮播"
|
|
215
|
+
|
|
216
|
+
# 2. 更新 banner 图片(需要先上传图片获取 URL)
|
|
217
|
+
commerce homepage update-images \
|
|
218
|
+
--id section_xxx \
|
|
219
|
+
--images '[{"url":"https://cdn.../img1.jpg","alt":"夏日促销","action_type":"collection","action_value":"summer-sale"}]'
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### 展示集合入口
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
# 1. 先确保有集合(参考 collection skill)
|
|
226
|
+
commerce collection list
|
|
227
|
+
|
|
228
|
+
# 2. 创建 collections 区块
|
|
229
|
+
commerce homepage create --type collections --title "精选系列"
|
|
230
|
+
|
|
231
|
+
# 3. 设置要展示的集合(逗号分隔,无空格)
|
|
232
|
+
commerce homepage update-collections \
|
|
233
|
+
--id section_xxx \
|
|
234
|
+
--slugs "new-arrivals,best-sellers,summer-sale"
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### 展示某集合的商品
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
# 创建 collection_products 区块并配置
|
|
241
|
+
commerce homepage create \
|
|
242
|
+
--type collection_products \
|
|
243
|
+
--title "新品上市" \
|
|
244
|
+
--settings '{"collection_slug":"new-arrivals","limit":8,"sort_by":"created_at","sort_order":"desc"}'
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### 特色推荐集合
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
# 1. 创建 featured 区块
|
|
251
|
+
commerce homepage create --type featured --title "本周推荐"
|
|
252
|
+
|
|
253
|
+
# 2. 设置推荐目标为集合
|
|
254
|
+
commerce homepage update-target \
|
|
255
|
+
--id section_xxx \
|
|
256
|
+
--type collection \
|
|
257
|
+
--handle "weekly-picks"
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### 特色推荐商品
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# 设置推荐目标为某个商品
|
|
264
|
+
commerce homepage update-target \
|
|
265
|
+
--id section_xxx \
|
|
266
|
+
--type product \
|
|
267
|
+
--handle "ceramic-cup-white"
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## 注意事项
|
|
271
|
+
|
|
272
|
+
- **区块顺序**:使用 `reorder` 调整,position 从 0 开始
|
|
273
|
+
- **模板切换**:会创建新区块并停用旧区块,谨慎操作
|
|
274
|
+
- **图片格式**:banner images 需要完整的 JSON 数组,每个元素必须有 url 和 alt
|
|
275
|
+
- **集合引用**:确保引用的 collection slug 存在,否则前端可能显示空
|
|
276
|
+
- **删除确认**:删除操作需要 `--yes` 参数
|
|
277
|
+
- **slugs 参数**:逗号分隔,不要有空格
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: product-page
|
|
3
|
+
description: 商品详情页配置。自定义商品详情页的可折叠区块内容(如护理说明、退货政策)。当用户需要编辑商品页信息区块、隐藏某些区块、或添加自定义区块时使用。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## 概念
|
|
7
|
+
|
|
8
|
+
Product Page Section(商品页区块)是商品详情页上的信息模块,采用三层继承机制:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
System(系统默认)
|
|
12
|
+
↓ 可被覆盖
|
|
13
|
+
Merchant(商户级自定义)
|
|
14
|
+
↓ 可被覆盖
|
|
15
|
+
Product(商品级覆盖)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- **System**:系统预设的区块(如退货政策、发货说明)
|
|
19
|
+
- **Merchant**:商户对系统区块的自定义(适用于所有商品)
|
|
20
|
+
- **Product**:单个商品对上层区块的覆盖(仅影响该商品)
|
|
21
|
+
|
|
22
|
+
每层都可以执行三种操作:
|
|
23
|
+
- `override`:覆盖上层的内容
|
|
24
|
+
- `new`:创建全新的区块
|
|
25
|
+
- `hidden`:隐藏某个区块
|
|
26
|
+
|
|
27
|
+
## 结构
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
ProductPageSection
|
|
31
|
+
├── 基本信息
|
|
32
|
+
│ ├── handle: 区块标识符(唯一)
|
|
33
|
+
│ ├── operation_type: override | new | hidden
|
|
34
|
+
│ ├── type: collapsible(可折叠)| static(静态)
|
|
35
|
+
│ └── position: 显示位置(1-10)
|
|
36
|
+
│
|
|
37
|
+
├── 内容
|
|
38
|
+
│ ├── content: Markdown 内容(支持模板变量)
|
|
39
|
+
│ └── tab_group: Tab 分组(可选)
|
|
40
|
+
│
|
|
41
|
+
└── 翻译
|
|
42
|
+
└── translations: 多语言翻译
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 系统默认区块
|
|
46
|
+
|
|
47
|
+
| handle | 说明 | 默认类型 |
|
|
48
|
+
|--------|------|----------|
|
|
49
|
+
| `highlights` | 产品亮点 | static |
|
|
50
|
+
| `details` | 产品详情 | collapsible |
|
|
51
|
+
| `guarantee` | 品质保证 | collapsible |
|
|
52
|
+
| `care` | 护理说明 | collapsible |
|
|
53
|
+
| `shipping-policies` | 发货政策 | collapsible |
|
|
54
|
+
| `return` | 退换政策 | collapsible |
|
|
55
|
+
| `eco-friendly` | 环保说明 | collapsible |
|
|
56
|
+
|
|
57
|
+
### 模板变量
|
|
58
|
+
|
|
59
|
+
content 支持模板变量,在前端渲染时自动替换:
|
|
60
|
+
|
|
61
|
+
| 变量 | 说明 |
|
|
62
|
+
|------|------|
|
|
63
|
+
| `{{product.name}}` | 商品名称 |
|
|
64
|
+
| `{{product.description}}` | 商品描述 |
|
|
65
|
+
| `{{variant.sku}}` | 当前变体 SKU |
|
|
66
|
+
| `{{merchant.name}}` | 店铺名称 |
|
|
67
|
+
|
|
68
|
+
## 典型场景
|
|
69
|
+
|
|
70
|
+
当用户说:
|
|
71
|
+
- "查看所有区块" → `commerce product-page list --resolved`
|
|
72
|
+
- "覆盖护理说明" → `commerce product-page create --handle care --operation-type override ...`
|
|
73
|
+
- "隐藏环保说明" → `commerce product-page hide --handle eco-friendly`
|
|
74
|
+
- "添加品牌故事区块" → `commerce product-page create --handle brand-story --operation-type new ...`
|
|
75
|
+
- "调整区块顺序" → `commerce product-page reorder --handles "h1,h2,h3"`
|
|
76
|
+
- "给某商品单独设置" → `commerce product-page product create --product-handle xxx ...`
|
|
77
|
+
|
|
78
|
+
## 命令参考
|
|
79
|
+
|
|
80
|
+
### 商户级命令(影响所有商品)
|
|
81
|
+
|
|
82
|
+
- `commerce product-page list` - 列出商户自定义
|
|
83
|
+
- `commerce product-page list --resolved` - 列出合并后的完整视图(推荐)
|
|
84
|
+
- `commerce product-page create` - 创建/覆盖区块
|
|
85
|
+
- `commerce product-page update --handle <handle>` - 更新区块
|
|
86
|
+
- `commerce product-page delete --handle <handle> --yes` - 删除自定义
|
|
87
|
+
- `commerce product-page hide --handle <handle>` - 隐藏区块(快捷方式)
|
|
88
|
+
- `commerce product-page reorder --handles <h1,h2,...>` - 重新排序
|
|
89
|
+
|
|
90
|
+
### 商品级命令(仅影响单个商品)
|
|
91
|
+
|
|
92
|
+
- `commerce product-page product list --product-handle <handle>` - 列出商品级覆盖
|
|
93
|
+
- `commerce product-page product list --product-handle <handle> --resolved` - 列出合并视图
|
|
94
|
+
- `commerce product-page product create --product-handle <handle> ...` - 创建商品级覆盖
|
|
95
|
+
- `commerce product-page product update --product-handle <handle> --handle <section> ...` - 更新
|
|
96
|
+
- `commerce product-page product delete --product-handle <handle> --handle <section> --yes` - 删除
|
|
97
|
+
- `commerce product-page product hide --product-handle <handle> --handle <section>` - 隐藏
|
|
98
|
+
|
|
99
|
+
### 翻译命令
|
|
100
|
+
|
|
101
|
+
- `commerce product-page translation list --handle <handle>` - 查看区块翻译
|
|
102
|
+
- `commerce product-page translation set --handle <handle> --lang <code>` - 设置翻译
|
|
103
|
+
- `commerce product-page translation delete --handle <handle> --lang <code> --yes` - 删除翻译
|
|
104
|
+
|
|
105
|
+
## 典型操作示例
|
|
106
|
+
|
|
107
|
+
### 查看所有区块
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# 查看合并后的完整视图(System + Merchant)
|
|
111
|
+
commerce product-page list --resolved
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 覆盖系统默认区块
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# 覆盖护理说明内容
|
|
118
|
+
commerce product-page create \
|
|
119
|
+
--handle care \
|
|
120
|
+
--operation-type override \
|
|
121
|
+
--type collapsible \
|
|
122
|
+
--position 4 \
|
|
123
|
+
--content "## 洗涤说明\n\n- 可机洗,30°C\n- 请勿漂白\n- 低温烘干"
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 隐藏某个区块
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# 快捷方式:隐藏环保说明区块
|
|
130
|
+
commerce product-page hide --handle eco-friendly
|
|
131
|
+
|
|
132
|
+
# 完整方式
|
|
133
|
+
commerce product-page create --handle eco-friendly --operation-type hidden
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### 创建自定义区块
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# 添加品牌故事区块
|
|
140
|
+
commerce product-page create \
|
|
141
|
+
--handle brand-story \
|
|
142
|
+
--operation-type new \
|
|
143
|
+
--type collapsible \
|
|
144
|
+
--position 8 \
|
|
145
|
+
--content "## 关于 {{merchant.name}}\n\n创立于2020年..."
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### 使用 Tab 分组
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# 创建属于同一 Tab 组的多个区块
|
|
152
|
+
commerce product-page create \
|
|
153
|
+
--handle ingredients \
|
|
154
|
+
--operation-type new \
|
|
155
|
+
--type collapsible \
|
|
156
|
+
--position 5 \
|
|
157
|
+
--content "## 成分\n\n100% 有机棉" \
|
|
158
|
+
--tab-group product-info
|
|
159
|
+
|
|
160
|
+
commerce product-page create \
|
|
161
|
+
--handle materials \
|
|
162
|
+
--operation-type new \
|
|
163
|
+
--type collapsible \
|
|
164
|
+
--position 6 \
|
|
165
|
+
--content "## 材质\n\n天然环保材料" \
|
|
166
|
+
--tab-group product-info
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### 为单个商品设置不同内容
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# 给某商品的护理说明设置特殊内容
|
|
173
|
+
commerce product-page product create \
|
|
174
|
+
--product-handle ceramic-cup-white \
|
|
175
|
+
--handle care \
|
|
176
|
+
--operation-type override \
|
|
177
|
+
--type collapsible \
|
|
178
|
+
--position 4 \
|
|
179
|
+
--content "## 陶瓷护理\n\n- 可用洗碗机\n- 避免剧烈温度变化"
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 添加翻译
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# 为护理说明添加英文翻译
|
|
186
|
+
commerce product-page translation set \
|
|
187
|
+
--handle care \
|
|
188
|
+
--lang en-US \
|
|
189
|
+
--title "Care Instructions" \
|
|
190
|
+
--content "## Washing Instructions\n\n- Machine wash, 30°C\n- Do not bleach"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## 注意事项
|
|
194
|
+
|
|
195
|
+
- **--resolved 参数**:查看列表时建议使用 `--resolved`,显示完整的合并视图
|
|
196
|
+
- **handle 唯一性**:同一层级内 handle 必须唯一
|
|
197
|
+
- **隐藏 vs 删除**:`hide` 是标记隐藏,`delete` 是删除自定义(恢复为上层默认)
|
|
198
|
+
- **position 冲突**:不同区块可以有相同 position,显示时按 position 排序
|
|
199
|
+
- **内容格式**:content 支持 Markdown,可使用模板变量
|
|
200
|
+
- **Tab 分组**:tab_group 相同的区块会在前端合并为标签页显示
|
package/README.md
CHANGED
|
@@ -72,7 +72,9 @@ optima -p "查看商品列表"
|
|
|
72
72
|
| order | 订单处理 |
|
|
73
73
|
| inventory | 库存管理 |
|
|
74
74
|
| i18n | 国际化翻译 |
|
|
75
|
-
|
|
|
75
|
+
| collection | 商品集合管理 |
|
|
76
|
+
| homepage | 店铺首页配置 |
|
|
77
|
+
| product-page | 商品详情页配置 |
|
|
76
78
|
| comfy | 图像/视频生成 |
|
|
77
79
|
| ads | Google Ads 广告 |
|
|
78
80
|
| scout | Amazon 选品调研 |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/system-prompt.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/system-prompt.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,IAAI,MAAM,CAqFxC"}
|
|
@@ -30,7 +30,9 @@ export function getSystemPrompt() {
|
|
|
30
30
|
- **order** - 订单处理(发货、退款、查询)
|
|
31
31
|
- **inventory** - 库存管理(监控、调整库存)
|
|
32
32
|
- **i18n** - 国际化翻译管理
|
|
33
|
-
- **
|
|
33
|
+
- **collection** - 商品集合管理(分组、促销专区)
|
|
34
|
+
- **homepage** - 店铺首页配置(Banner、集合展示)
|
|
35
|
+
- **product-page** - 商品详情页配置
|
|
34
36
|
- **comfy** - 图像/视频生成
|
|
35
37
|
- **ads** - Google Ads 广告投放
|
|
36
38
|
- **scout** - Amazon 选品调研
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/system-prompt.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe;IAC7B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAC,OAAO,EAAE;QAC9C,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,MAAM;QACb,GAAG,EAAE,SAAS;QACd,OAAO,EAAE,MAAM;KAChB,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAC,OAAO,EAAE;QAC9C,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IAEH,OAAO;;;;;;;aAOI,OAAO,IAAI,OAAO
|
|
1
|
+
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/system-prompt.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe;IAC7B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAC,OAAO,EAAE;QAC9C,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,MAAM;QACb,GAAG,EAAE,SAAS;QACd,OAAO,EAAE,MAAM;KAChB,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAC,OAAO,EAAE;QAC9C,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IAEH,OAAO;;;;;;;aAOI,OAAO,IAAI,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgE9B,CAAC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,426 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: storefront
|
|
3
|
-
description: "店铺前台配置管理。使用场景:配置首页(homepage/首页)、商品详情页区块(sections/区块)、调整模块顺序和布局。使用 commerce homepage/section 命令。"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Commerce CLI - Storefront Configuration
|
|
7
|
-
|
|
8
|
-
店铺前台配置模块,用于首页设置和商品详情页区块配置。
|
|
9
|
-
|
|
10
|
-
## 典型场景
|
|
11
|
-
|
|
12
|
-
### 场景决策表
|
|
13
|
-
|
|
14
|
-
| 用户需求 | 推荐命令 | 关键注意点 |
|
|
15
|
-
|---------|---------|-----------|
|
|
16
|
-
| 创建轮播图 | `commerce homepage module create --type banner` | 图片尺寸1920x600px,≤5张,配置跳转链接 |
|
|
17
|
-
| 显示精选商品 | `commerce homepage module create --type featured` | 选择高转化商品,数量8-12个 |
|
|
18
|
-
| 调整模块顺序 | `commerce homepage module reorder --position X` | 重要模块靠前(轮播图position=1) |
|
|
19
|
-
|
|
20
|
-
### 场景 1:首页配置
|
|
21
|
-
|
|
22
|
-
**标准首页布局**(position顺序):
|
|
23
|
-
1. **轮播图** (position=1) - 展示促销、新品、品牌故事
|
|
24
|
-
2. **分类导航** (position=2) - 快速引导到商品分类
|
|
25
|
-
3. **精选商品** (position=3) - 展示高转化或高利润商品
|
|
26
|
-
4. **热门集合** (position=4) - 展示2-3个核心集合
|
|
27
|
-
5. **品牌故事** (position=5) - 建立信任和品牌认知
|
|
28
|
-
|
|
29
|
-
**标准流程**:
|
|
30
|
-
1. **规划布局** - 确定首页模块顺序(轮播图 → 分类 → 精选商品 → 集合)
|
|
31
|
-
2. **创建模块** - 依次 `commerce homepage module create` 创建各模块
|
|
32
|
-
3. **配置顺序** - 使用 position 1, 2, 3... 排序
|
|
33
|
-
4. **设置参数** - `commerce homepage settings update` 配置搜索、精选数量
|
|
34
|
-
5. **验证效果** - `commerce homepage module list` 检查配置
|
|
35
|
-
6. **定期优化** - 根据数据调整模块顺序和内容
|
|
36
|
-
|
|
37
|
-
### 场景 2:创建轮播图
|
|
38
|
-
|
|
39
|
-
**配置要点**:
|
|
40
|
-
- 图片尺寸:1920x600px(桌面端)
|
|
41
|
-
- 数量限制:≤ 5张(避免影响加载速度)
|
|
42
|
-
- 格式支持:WebP(优先)、JPG、PNG
|
|
43
|
-
- 跳转链接:配置促销页面或集合页面
|
|
44
|
-
- 懒加载:启用图片懒加载优化性能
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
commerce homepage module create \
|
|
48
|
-
--slug hero-banner \
|
|
49
|
-
--type banner \
|
|
50
|
-
--position 1 \
|
|
51
|
-
--enabled true \
|
|
52
|
-
--config '{"images":[{"url":"https://example.com/banner1.jpg","link":"/collections/summer-sale"}]}'
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### 场景 3:调整模块顺序
|
|
56
|
-
|
|
57
|
-
**重新排序原则**:
|
|
58
|
-
- 重要模块靠前(轮播图 position=1)
|
|
59
|
-
- 高转化模块优先级高
|
|
60
|
-
- 移动端体验优先
|
|
61
|
-
- 定期根据数据优化
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
# 调整精选商品模块到第2位
|
|
65
|
-
commerce homepage module reorder \
|
|
66
|
-
--module-id module_123 \
|
|
67
|
-
--position 2
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### 场景 4:优化转化率
|
|
71
|
-
|
|
72
|
-
**数据驱动优化**:
|
|
73
|
-
- 分析首页点击热图,调整模块顺序
|
|
74
|
-
- A/B测试不同轮播图和精选商品
|
|
75
|
-
- 精选商品选择高利润或高评分商品
|
|
76
|
-
|
|
77
|
-
**性能优化建议**:
|
|
78
|
-
- 轮播图:懒加载,压缩图片,支持WebP格式
|
|
79
|
-
- 精选商品:限制8-12个,缓存1小时
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
## 卓越标准
|
|
83
|
-
|
|
84
|
-
### 店铺配置质量指标
|
|
85
|
-
- **页面加载速度**: 首页加载 < 3秒,移动端 < 5秒
|
|
86
|
-
- **视觉设计**: 轮播图尺寸统一(1920x600px),图片清晰无水印
|
|
87
|
-
- **导航体验**: 分类层级 ≤ 3层,模块数量适中
|
|
88
|
-
- **内容更新频率**: 轮播图每周更新,精选商品每3天更新
|
|
89
|
-
- **转化率**: 首页访客转化率 > 3%
|
|
90
|
-
|
|
91
|
-
### 店铺配置原则
|
|
92
|
-
- **移动优先**: 所有配置考虑移动端体验,图片支持响应式
|
|
93
|
-
- **性能优化**: 轮播图 ≤ 5张,精选商品 ≤ 12个,减少加载负担
|
|
94
|
-
- **SEO友好**: 模块标题包含关键词
|
|
95
|
-
- **一致性**: 风格统一(色彩、字体、间距),提升品牌辨识度
|
|
96
|
-
- **数据驱动**: 根据点击率和转化率优化首页布局
|
|
97
|
-
|
|
98
|
-
### 首页配置检查清单
|
|
99
|
-
|
|
100
|
-
**上线前必查**:
|
|
101
|
-
- [ ] 轮播图尺寸统一,图片清晰
|
|
102
|
-
- [ ] 所有链接可点击,无404
|
|
103
|
-
- [ ] 移动端显示正常
|
|
104
|
-
- [ ] 加载速度 < 3秒
|
|
105
|
-
- [ ] SEO信息完整(标题、描述、关键词)
|
|
106
|
-
- [ ] 精选商品有库存
|
|
107
|
-
- [ ] 首页模块顺序合理
|
|
108
|
-
|
|
109
|
-
## 常见问题
|
|
110
|
-
|
|
111
|
-
### ❌ 问题 1:轮播图过多影响性能
|
|
112
|
-
|
|
113
|
-
**错误做法**:
|
|
114
|
-
```bash
|
|
115
|
-
# 创建10张轮播图,导致首页加载缓慢
|
|
116
|
-
commerce homepage module create --type banner --config '{"images":[...10张图片...]}'
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
**✅ 正确做法**:
|
|
120
|
-
```bash
|
|
121
|
-
# 限制≤5张,压缩图片,启用懒加载
|
|
122
|
-
commerce homepage module create --type banner --config '{"images":[...3-5张图片...]}'
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### ❌ 问题 2:精选商品数量过多
|
|
126
|
-
|
|
127
|
-
**错误做法**:
|
|
128
|
-
```bash
|
|
129
|
-
# 显示30个精选商品,影响用户决策
|
|
130
|
-
commerce homepage settings update --featured-limit 30
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
**✅ 正确做法**:
|
|
134
|
-
```bash
|
|
135
|
-
# 限制8-12个,选择高转化商品
|
|
136
|
-
commerce homepage settings update --featured-limit 10
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### ❌ 问题 3:首页模块顺序混乱
|
|
140
|
-
|
|
141
|
-
**错误做法**:
|
|
142
|
-
```bash
|
|
143
|
-
# position 随意设置,导致布局混乱
|
|
144
|
-
commerce homepage module create --type banner --position 10
|
|
145
|
-
commerce homepage module create --type featured --position 2
|
|
146
|
-
commerce homepage module create --type categories --position 50
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
**✅ 正确做法**:
|
|
150
|
-
```bash
|
|
151
|
-
# 按重要性依次设置 position 1, 2, 3...
|
|
152
|
-
commerce homepage module create --type banner --position 1
|
|
153
|
-
commerce homepage module create --type categories --position 2
|
|
154
|
-
commerce homepage module create --type featured --position 3
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
## 命令参考
|
|
158
|
-
|
|
159
|
-
### 自然语言映射
|
|
160
|
-
|
|
161
|
-
当用户说:
|
|
162
|
-
- "创建首页轮播图" → `commerce homepage module create --type banner ...`
|
|
163
|
-
- "更新首页设置" → `commerce homepage settings update --show-search true`
|
|
164
|
-
|
|
165
|
-
### 核心功能
|
|
166
|
-
|
|
167
|
-
**首页模块管理**:
|
|
168
|
-
- `commerce homepage module create` - 创建首页模块
|
|
169
|
-
- `commerce homepage module list` - 查看所有模块
|
|
170
|
-
- `commerce homepage module update` - 更新模块
|
|
171
|
-
- `commerce homepage module delete` - 删除模块
|
|
172
|
-
- `commerce homepage module reorder` - 重新排序
|
|
173
|
-
|
|
174
|
-
**首页设置**:
|
|
175
|
-
- `commerce homepage settings get` - 查看首页设置
|
|
176
|
-
- `commerce homepage settings update` - 更新首页设置
|
|
177
|
-
|
|
178
|
-
## 详细示例
|
|
179
|
-
|
|
180
|
-
### 创建首页轮播图
|
|
181
|
-
```bash
|
|
182
|
-
# 用户说:"创建首页轮播图模块"
|
|
183
|
-
commerce homepage module create \
|
|
184
|
-
--slug hero-banner \
|
|
185
|
-
--type banner \
|
|
186
|
-
--position 1 \
|
|
187
|
-
--enabled true \
|
|
188
|
-
--config '{"images":[{"url":"https://example.com/banner1.jpg"}]}'
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### 更新首页设置
|
|
192
|
-
```bash
|
|
193
|
-
# 用户说:"启用首页搜索功能,显示8个精选商品"
|
|
194
|
-
commerce homepage settings update \
|
|
195
|
-
--show-search true \
|
|
196
|
-
--featured-limit 8
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
### 重新排序首页模块
|
|
200
|
-
```bash
|
|
201
|
-
# 用户说:"调整首页模块顺序"
|
|
202
|
-
commerce homepage module reorder \
|
|
203
|
-
--module-id module_123 \
|
|
204
|
-
--position 2
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
### 完整首页配置示例
|
|
208
|
-
```bash
|
|
209
|
-
# 1. 创建轮播图模块
|
|
210
|
-
commerce homepage module create \
|
|
211
|
-
--slug hero-banner \
|
|
212
|
-
--type banner \
|
|
213
|
-
--position 1 \
|
|
214
|
-
--config '{"images":[{"url":"https://example.com/banner1.jpg","link":"/collections/summer-sale"},{"url":"https://example.com/banner2.jpg","link":"/collections/new-arrivals"}]}'
|
|
215
|
-
|
|
216
|
-
# 2. 创建分类导航模块
|
|
217
|
-
commerce homepage module create \
|
|
218
|
-
--slug category-nav \
|
|
219
|
-
--type categories \
|
|
220
|
-
--position 2 \
|
|
221
|
-
--config '{"columns":4}'
|
|
222
|
-
|
|
223
|
-
# 3. 创建精选商品模块
|
|
224
|
-
commerce homepage module create \
|
|
225
|
-
--slug featured-products \
|
|
226
|
-
--type featured \
|
|
227
|
-
--position 3 \
|
|
228
|
-
--config '{"limit":10}'
|
|
229
|
-
|
|
230
|
-
# 4. 更新首页设置
|
|
231
|
-
commerce homepage settings update \
|
|
232
|
-
--show-search true \
|
|
233
|
-
--featured-limit 10
|
|
234
|
-
|
|
235
|
-
# 5. 验证配置
|
|
236
|
-
commerce homepage module list
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
## 场景 5:商品详情页区块管理
|
|
240
|
-
|
|
241
|
-
### 三层继承模型
|
|
242
|
-
|
|
243
|
-
商品详情页区块采用三层继承架构,实现灵活的内容定制:
|
|
244
|
-
|
|
245
|
-
```
|
|
246
|
-
┌─────────────────────────────────────────────────────────┐
|
|
247
|
-
│ System Layer (系统默认) │
|
|
248
|
-
│ - 7个预设区块: highlights, details, guarantee, │
|
|
249
|
-
│ care, shipping-policies, return, eco-friendly │
|
|
250
|
-
│ - 支持7种语言的默认翻译 │
|
|
251
|
-
│ - 不可删除,只能覆盖或隐藏 │
|
|
252
|
-
└─────────────────────────────────────────────────────────┘
|
|
253
|
-
↓ 继承
|
|
254
|
-
┌─────────────────────────────────────────────────────────┐
|
|
255
|
-
│ Merchant Layer (商户定制) │
|
|
256
|
-
│ - 覆盖系统默认区块内容 │
|
|
257
|
-
│ - 创建商户专属新区块 │
|
|
258
|
-
│ - 隐藏不需要的系统区块 │
|
|
259
|
-
│ - 适用于所有商品(除非商品级覆盖) │
|
|
260
|
-
└─────────────────────────────────────────────────────────┘
|
|
261
|
-
↓ 继承
|
|
262
|
-
┌─────────────────────────────────────────────────────────┐
|
|
263
|
-
│ Product Layer (商品定制) │
|
|
264
|
-
│ - 覆盖商户/系统区块内容 │
|
|
265
|
-
│ - 创建商品专属区块 │
|
|
266
|
-
│ - 隐藏特定商品不需要的区块 │
|
|
267
|
-
│ - 最高优先级,仅影响单个商品 │
|
|
268
|
-
└─────────────────────────────────────────────────────────┘
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
### 查看区块配置
|
|
272
|
-
|
|
273
|
-
```bash
|
|
274
|
-
# 查看商户级配置(推荐使用 --resolved 查看完整视图)
|
|
275
|
-
commerce section list --resolved
|
|
276
|
-
|
|
277
|
-
# 查看特定商品的区块配置
|
|
278
|
-
commerce section product list prod-123 --resolved
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
**关键字段说明**:
|
|
282
|
-
- `source`: 区块来源 (system/merchant/product)
|
|
283
|
-
- `is_hidden`: 是否被隐藏
|
|
284
|
-
- `translations`: 各语言的标题和内容
|
|
285
|
-
|
|
286
|
-
### 覆盖系统默认区块
|
|
287
|
-
|
|
288
|
-
```bash
|
|
289
|
-
# 商户级:覆盖所有商品的"护理说明"
|
|
290
|
-
commerce section create \
|
|
291
|
-
--handle care \
|
|
292
|
-
--operation-type override \
|
|
293
|
-
--type collapsible \
|
|
294
|
-
--position 4 \
|
|
295
|
-
--content "我们的产品均可机洗,30度冷水。"
|
|
296
|
-
|
|
297
|
-
# 商品级:为特定商品定制"护理说明"
|
|
298
|
-
commerce section product create prod-123 \
|
|
299
|
-
--handle care \
|
|
300
|
-
--operation-type override \
|
|
301
|
-
--type collapsible \
|
|
302
|
-
--position 4 \
|
|
303
|
-
--content "此款真丝产品需要干洗。"
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
### 创建自定义区块
|
|
307
|
-
|
|
308
|
-
```bash
|
|
309
|
-
# 商户级:创建"品牌故事"区块(所有商品显示)
|
|
310
|
-
commerce section create \
|
|
311
|
-
--handle brand-story \
|
|
312
|
-
--operation-type new \
|
|
313
|
-
--type collapsible \
|
|
314
|
-
--position 8 \
|
|
315
|
-
--content "## 我们的故事\n\n创立于2020年..."
|
|
316
|
-
|
|
317
|
-
# 商品级:创建"成分说明"区块(仅此商品显示)
|
|
318
|
-
commerce section product create prod-123 \
|
|
319
|
-
--handle ingredients \
|
|
320
|
-
--operation-type new \
|
|
321
|
-
--type collapsible \
|
|
322
|
-
--position 5 \
|
|
323
|
-
--content "主要成分:有机棉100%"
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
### 隐藏不需要的区块
|
|
327
|
-
|
|
328
|
-
```bash
|
|
329
|
-
# 商户级:隐藏"环保包装"区块(所有商品不显示)
|
|
330
|
-
commerce section hide eco-friendly
|
|
331
|
-
|
|
332
|
-
# 商品级:隐藏特定商品的"退货政策"
|
|
333
|
-
commerce section product hide prod-123 return
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
### 添加多语言翻译
|
|
337
|
-
|
|
338
|
-
```bash
|
|
339
|
-
# 为商户级区块添加中文翻译
|
|
340
|
-
commerce section translation set care \
|
|
341
|
-
--lang zh-CN \
|
|
342
|
-
--title "护理说明" \
|
|
343
|
-
--content "机洗,30度冷水。"
|
|
344
|
-
|
|
345
|
-
# 为商品级区块添加日文翻译
|
|
346
|
-
commerce section translation set care \
|
|
347
|
-
--product-id prod-123 \
|
|
348
|
-
--lang ja-JP \
|
|
349
|
-
--title "お手入れ方法" \
|
|
350
|
-
--content "洗濯機で洗えます。水温30度。"
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
### 调整区块顺序
|
|
354
|
-
|
|
355
|
-
```bash
|
|
356
|
-
# 商户级排序
|
|
357
|
-
commerce section reorder --sections '[
|
|
358
|
-
{"handle":"highlights","position":1},
|
|
359
|
-
{"handle":"details","position":2},
|
|
360
|
-
{"handle":"care","position":3}
|
|
361
|
-
]'
|
|
362
|
-
|
|
363
|
-
# 商品级排序
|
|
364
|
-
commerce section product reorder prod-123 --sections '[...]'
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
### Section 常见问题
|
|
368
|
-
|
|
369
|
-
#### ❌ 问题:不理解三层继承,直接在商品级创建
|
|
370
|
-
|
|
371
|
-
**错误做法**:
|
|
372
|
-
```bash
|
|
373
|
-
# 想要所有商品都显示"品牌故事",却在商品级创建
|
|
374
|
-
commerce section product create prod-123 --handle brand-story ...
|
|
375
|
-
commerce section product create prod-456 --handle brand-story ... # 重复操作
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
**✅ 正确做法**:
|
|
379
|
-
```bash
|
|
380
|
-
# 在商户级创建,自动应用到所有商品
|
|
381
|
-
commerce section create --handle brand-story --operation-type new ...
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
#### ❌ 问题:不使用 --resolved 查看配置
|
|
385
|
-
|
|
386
|
-
**错误做法**:
|
|
387
|
-
```bash
|
|
388
|
-
# 只看商户自定义,看不到系统默认
|
|
389
|
-
commerce section list
|
|
390
|
-
# 返回空列表(新商户通常没有自定义)
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
**✅ 正确做法**:
|
|
394
|
-
```bash
|
|
395
|
-
# 使用 --resolved 查看完整的合并后视图
|
|
396
|
-
commerce section list --resolved
|
|
397
|
-
# 返回 System + Merchant 合并后的所有区块
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
### Section 自然语言映射
|
|
401
|
-
|
|
402
|
-
当用户说:
|
|
403
|
-
- "查看商品详情页区块" → `commerce section list --resolved`
|
|
404
|
-
- "查看商品X的区块配置" → `commerce section product list <id> --resolved`
|
|
405
|
-
- "修改护理说明" → `commerce section create --handle care --operation-type override ...`
|
|
406
|
-
- "隐藏退货政策区块" → `commerce section hide return`
|
|
407
|
-
- "为商品添加自定义区块" → `commerce section product create <id> --handle XX --operation-type new ...`
|
|
408
|
-
- "添加区块的中文翻译" → `commerce section translation set <handle> --lang zh-CN ...`
|
|
409
|
-
|
|
410
|
-
## 重要提示
|
|
411
|
-
|
|
412
|
-
### 首页配置
|
|
413
|
-
- 首页模块支持类型:banner(轮播图)、featured(精选商品)、categories(分类)
|
|
414
|
-
- 模块的 position 决定显示顺序(从小到大)
|
|
415
|
-
- config 字段使用 JSON 格式
|
|
416
|
-
|
|
417
|
-
### 商品页区块
|
|
418
|
-
- 系统默认区块:highlights, details, guarantee, care, shipping-policies, return, eco-friendly
|
|
419
|
-
- `--resolved` 查看完整合并视图(推荐)
|
|
420
|
-
- `source` 字段标识来源:system | merchant | product
|
|
421
|
-
- 想改所有商品用 `section create`,只改一个商品用 `section product create`
|
|
422
|
-
|
|
423
|
-
### 通用
|
|
424
|
-
- 使用 `--help` 查看命令详细参数
|
|
425
|
-
- 所有配置创建后需要验证是否正确
|
|
426
|
-
- 定期根据数据分析优化布局和内容
|