@optima-chat/optima-agent 0.4.16 → 0.4.18
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.
|
@@ -40,7 +40,15 @@
|
|
|
40
40
|
"Bash(git -C /Users/verypro/optima-agent log --oneline --all -- \".claude/\")",
|
|
41
41
|
"Bash(wc:*)",
|
|
42
42
|
"Bash(grep:*)",
|
|
43
|
-
"Bash(find:*)"
|
|
43
|
+
"Bash(find:*)",
|
|
44
|
+
"Bash(commerce collection --help:*)",
|
|
45
|
+
"Bash(commerce collection update --help:*)",
|
|
46
|
+
"Bash(commerce collection set-cover:*)",
|
|
47
|
+
"Bash(commerce collection get --help:*)",
|
|
48
|
+
"Bash(commerce collection list --help:*)",
|
|
49
|
+
"Bash(commerce collection create --help:*)",
|
|
50
|
+
"Bash(commerce collection remove-products:*)",
|
|
51
|
+
"Bash(commerce collection list-products:*)"
|
|
44
52
|
],
|
|
45
53
|
"deny": [],
|
|
46
54
|
"ask": []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: collection
|
|
3
|
-
description:
|
|
3
|
+
description: 商品集合管理。创建、编辑集合,设置封面图,管理集合中的商品。当用户需要对商品进行分组、创建促销专区、管理商品分类、设置集合封面时使用。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## 概念
|
|
@@ -37,40 +37,47 @@ Collection
|
|
|
37
37
|
当用户说:
|
|
38
38
|
- "查看所有集合" / "集合列表" → `commerce collection list`
|
|
39
39
|
- "创建集合 XX" → `commerce collection create --name "XX" --slug xx`
|
|
40
|
-
- "查看集合详情" → `commerce collection get --
|
|
41
|
-
- "删除集合 XX" → `commerce collection delete --
|
|
42
|
-
- "把商品加到集合" → `commerce collection add-products --
|
|
43
|
-
- "从集合移除商品" → `commerce collection remove-products --
|
|
44
|
-
- "查看集合里有哪些商品" → `commerce collection list-products --
|
|
40
|
+
- "查看集合详情" → `commerce collection get --id xx`
|
|
41
|
+
- "删除集合 XX" → `commerce collection delete --id xx --yes`
|
|
42
|
+
- "把商品加到集合" → `commerce collection add-products --id xx --product-ids p1,p2`
|
|
43
|
+
- "从集合移除商品" → `commerce collection remove-products --id xx --product-ids p1`
|
|
44
|
+
- "查看集合里有哪些商品" → `commerce collection list-products --id xx`
|
|
45
|
+
- "设置集合封面" / "给集合加封面图" → `commerce collection set-cover --id xx --path ./cover.jpg`
|
|
45
46
|
|
|
46
47
|
## 命令参考
|
|
47
48
|
|
|
48
49
|
### 集合 CRUD
|
|
49
50
|
- `commerce collection list` - 列出所有集合
|
|
50
|
-
- `commerce collection create
|
|
51
|
-
- `commerce collection get --
|
|
52
|
-
- `commerce collection update --
|
|
53
|
-
- `commerce collection delete --
|
|
54
|
-
- `commerce collection set-cover --
|
|
51
|
+
- `commerce collection create --name <name> --slug <slug>` - 创建集合
|
|
52
|
+
- `commerce collection get --id <id>` - 查看集合详情
|
|
53
|
+
- `commerce collection update --id <id>` - 更新集合(支持 --name, --slug, --description 等)
|
|
54
|
+
- `commerce collection delete --id <id> --yes` - 删除集合
|
|
55
|
+
- `commerce collection set-cover --id <id>` - 设置封面图(支持 --media-id, --url, --path)
|
|
55
56
|
|
|
56
57
|
### 商品管理
|
|
57
|
-
- `commerce collection add-products --
|
|
58
|
-
- `commerce collection remove-products --
|
|
59
|
-
- `commerce collection list-products --
|
|
58
|
+
- `commerce collection add-products --id <id> --product-ids <ids>` - 添加商品
|
|
59
|
+
- `commerce collection remove-products --id <id> --product-ids <ids>` - 移除商品
|
|
60
|
+
- `commerce collection list-products --id <id>` - 列出集合中的商品
|
|
60
61
|
|
|
61
62
|
## 创建集合示例
|
|
62
63
|
|
|
63
64
|
```bash
|
|
64
|
-
#
|
|
65
|
+
# 创建促销集合(返回 id,用于后续操作)
|
|
65
66
|
commerce collection create \
|
|
66
67
|
--name "Summer Sale 2024" \
|
|
67
68
|
--slug summer-sale-2024 \
|
|
68
69
|
--description "Hot deals for summer"
|
|
70
|
+
# 输出: { "id": "coll_xxx", ... }
|
|
69
71
|
|
|
70
|
-
#
|
|
72
|
+
# 添加商品到集合(使用返回的 id)
|
|
71
73
|
commerce collection add-products \
|
|
72
|
-
--
|
|
74
|
+
--id coll_xxx \
|
|
73
75
|
--product-ids prod_123,prod_456,prod_789
|
|
76
|
+
|
|
77
|
+
# 设置封面图
|
|
78
|
+
commerce collection set-cover \
|
|
79
|
+
--id coll_xxx \
|
|
80
|
+
--path ./summer-sale-cover.jpg
|
|
74
81
|
```
|
|
75
82
|
|
|
76
83
|
## 注意事项
|
|
@@ -11,7 +11,7 @@ description: Order fulfillment and shipping management. Process orders, ship pac
|
|
|
11
11
|
|
|
12
12
|
当用户说:
|
|
13
13
|
- "查看待发货订单" → `commerce order list --status paid`
|
|
14
|
-
- "订单XX发货" →
|
|
14
|
+
- "订单XX发货" → 先查订单详情,根据 shipping_mode_used 决定发货方式(见下方流程)
|
|
15
15
|
- "取消订单XX" → `commerce order cancel --id XX --yes`
|
|
16
16
|
- "标记订单已送达" → `commerce order mark-delivered --id XX`
|
|
17
17
|
- "查询运费" → `commerce shipping calculate --country XX --weight YY`
|
|
@@ -36,6 +36,144 @@ description: Order fulfillment and shipping management. Process orders, ship pac
|
|
|
36
36
|
5. **物流跟踪** - 定期 `commerce shipping track` 监控异常
|
|
37
37
|
6. **确认送达** - 签收后 `commerce order mark-delivered --id XX`
|
|
38
38
|
|
|
39
|
+
### 发货流程详解(重要)
|
|
40
|
+
|
|
41
|
+
订单发货需要根据 `shipping_mode_used` 字段选择正确的发货方式。
|
|
42
|
+
|
|
43
|
+
#### 运费模式说明
|
|
44
|
+
|
|
45
|
+
| shipping_mode_used | 含义 | 发货方式 |
|
|
46
|
+
|--------------------|------|----------|
|
|
47
|
+
| `easyship` | 买家选择了 Easyship 快递 | 可选 Easyship 自动发货 或 手动发货 |
|
|
48
|
+
| `fixed` | 买家使用固定运费 | 只能手动发货 |
|
|
49
|
+
| 空/null | 历史订单 | 只能手动发货 |
|
|
50
|
+
|
|
51
|
+
#### 发货决策规则(必须严格遵守)
|
|
52
|
+
|
|
53
|
+
当用户说"订单XXX发货"时,按以下步骤执行:
|
|
54
|
+
|
|
55
|
+
**步骤1**:执行 `commerce order get --id XXX` 获取订单详情
|
|
56
|
+
|
|
57
|
+
**步骤2**:在返回结果中找到 `shipping_mode_used` 字段的值
|
|
58
|
+
|
|
59
|
+
**步骤3**:根据字段值决定下一步操作:
|
|
60
|
+
|
|
61
|
+
- **如果 `shipping_mode_used = "easyship"`**:
|
|
62
|
+
1. **必须**使用 AskUserQuestion 工具询问用户
|
|
63
|
+
2. 提供两个选项让用户选择
|
|
64
|
+
3. **禁止**直接询问运单号
|
|
65
|
+
4. 等待用户选择后再执行对应命令
|
|
66
|
+
|
|
67
|
+
- **如果 `shipping_mode_used = "fixed"` 或字段为空**:
|
|
68
|
+
1. 直接询问用户提供运单号和快递公司名称
|
|
69
|
+
2. 收集信息后执行手动发货命令
|
|
70
|
+
|
|
71
|
+
#### Easyship 自动发货
|
|
72
|
+
|
|
73
|
+
**适用场景**:`shipping_mode_used = "easyship"` 且用户选择使用 Easyship
|
|
74
|
+
|
|
75
|
+
**命令**:
|
|
76
|
+
```bash
|
|
77
|
+
# 使用买家选择的快递(推荐)
|
|
78
|
+
commerce order ship --id <order-id> --easyship
|
|
79
|
+
|
|
80
|
+
# 或指定其他 Easyship 支持的快递
|
|
81
|
+
commerce order ship --id <order-id> --easyship --courier-id <courier-id>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**返回结果包含**:
|
|
85
|
+
- `tracking_number`: 自动生成的运单号
|
|
86
|
+
- `tracking_url`: 快递跟踪链接
|
|
87
|
+
- `label_url`: 运单标签下载链接(可打印)
|
|
88
|
+
- `carrier`: 快递公司名称
|
|
89
|
+
|
|
90
|
+
**查看可用快递**:
|
|
91
|
+
```bash
|
|
92
|
+
commerce easyship couriers
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### 手动发货
|
|
96
|
+
|
|
97
|
+
**适用场景**:
|
|
98
|
+
- `shipping_mode_used = "fixed"` 或为空
|
|
99
|
+
- 或用户选择不使用 Easyship
|
|
100
|
+
|
|
101
|
+
**命令**:
|
|
102
|
+
```bash
|
|
103
|
+
commerce order ship --id <order-id> \
|
|
104
|
+
--tracking <运单号> \
|
|
105
|
+
--carrier <快递公司名称> \
|
|
106
|
+
--tracking-url <跟踪链接> # 可选
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**示例**:
|
|
110
|
+
```bash
|
|
111
|
+
# 顺丰快递
|
|
112
|
+
commerce order ship --id order_123 \
|
|
113
|
+
--tracking SF1234567890 \
|
|
114
|
+
--carrier "顺丰速运"
|
|
115
|
+
|
|
116
|
+
# DHL(带跟踪链接)
|
|
117
|
+
commerce order ship --id order_123 \
|
|
118
|
+
--tracking DHL9876543210 \
|
|
119
|
+
--carrier "DHL Express" \
|
|
120
|
+
--tracking-url "https://www.dhl.com/track?num=DHL9876543210"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### 物流状态更新(手动发货后)
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# 更新为运输中
|
|
127
|
+
commerce order update-shipping-status --id <order-id> --status in_transit
|
|
128
|
+
|
|
129
|
+
# 更新为派送中
|
|
130
|
+
commerce order update-shipping-status --id <order-id> --status out_for_delivery
|
|
131
|
+
|
|
132
|
+
# 标记已送达
|
|
133
|
+
commerce order mark-delivered --id <order-id>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### 发货场景示例对话
|
|
137
|
+
|
|
138
|
+
**场景1:Easyship 订单**
|
|
139
|
+
```
|
|
140
|
+
用户:订单 order_abc 发货
|
|
141
|
+
|
|
142
|
+
助手:[执行 Bash: commerce order get --id order_abc]
|
|
143
|
+
[发现 shipping_mode_used = "easyship"]
|
|
144
|
+
[使用 AskUserQuestion 工具]
|
|
145
|
+
|
|
146
|
+
AskUserQuestion:
|
|
147
|
+
question: "该订单使用 Easyship 运费模式,请选择发货方式"
|
|
148
|
+
options:
|
|
149
|
+
- label: "Easyship 自动发货(推荐)"
|
|
150
|
+
description: "自动生成运单号和标签,使用买家选择的快递"
|
|
151
|
+
- label: "手动填写运单号"
|
|
152
|
+
description: "使用其他快递公司,需要提供运单号"
|
|
153
|
+
|
|
154
|
+
用户:[选择 Easyship 自动发货]
|
|
155
|
+
|
|
156
|
+
助手:[执行 Bash: commerce order ship --id order_abc --easyship]
|
|
157
|
+
发货成功!
|
|
158
|
+
- 运单号:ES123456789
|
|
159
|
+
- 快递公司:FedEx
|
|
160
|
+
- 标签下载:https://...
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**场景2:固定运费订单**
|
|
164
|
+
```
|
|
165
|
+
用户:订单 order_xyz 发货
|
|
166
|
+
|
|
167
|
+
助手:[执行 Bash: commerce order get --id order_xyz]
|
|
168
|
+
[发现 shipping_mode_used = "fixed"]
|
|
169
|
+
该订单使用固定运费,请提供运单号和快递公司名称。
|
|
170
|
+
|
|
171
|
+
用户:顺丰,单号 SF123456
|
|
172
|
+
|
|
173
|
+
助手:[执行 Bash: commerce order ship --id order_xyz --tracking SF123456 --carrier 顺丰速运]
|
|
174
|
+
发货成功!
|
|
175
|
+
```
|
|
176
|
+
|
|
39
177
|
### 退款处理流程
|
|
40
178
|
1. **创建退款** - `commerce refund create` 填写详细原因
|
|
41
179
|
2. **审核评估** - 检查商品状态、退货凭证、历史记录
|
|
@@ -132,6 +270,11 @@ commerce order ship --id order_789 --tracking DHL123458 --carrier DHL
|
|
|
132
270
|
- `commerce shipping track` - 物流追踪
|
|
133
271
|
- `commerce shipping update-status` - 更新物流状态
|
|
134
272
|
|
|
273
|
+
### Easyship 集成
|
|
274
|
+
- `commerce easyship couriers` - 查看可用快递公司
|
|
275
|
+
- `commerce easyship rates --order-id <id>` - 获取订单运费报价
|
|
276
|
+
- `commerce easyship track --order-id <id>` - 跟踪 Easyship 运单
|
|
277
|
+
|
|
135
278
|
## 详细示例
|
|
136
279
|
|
|
137
280
|
### 查看待处理订单
|
|
@@ -142,7 +285,14 @@ commerce order list --status paid --limit 50
|
|
|
142
285
|
|
|
143
286
|
### 订单发货
|
|
144
287
|
```bash
|
|
145
|
-
#
|
|
288
|
+
# 步骤1:先获取订单信息,检查 shipping_mode_used
|
|
289
|
+
commerce order get --id order_123
|
|
290
|
+
|
|
291
|
+
# 步骤2a:如果 shipping_mode_used = "easyship",询问用户选择后
|
|
292
|
+
# 用户选择 Easyship 自动发货
|
|
293
|
+
commerce order ship --id order_123 --easyship
|
|
294
|
+
|
|
295
|
+
# 步骤2b:如果用户选择手动发货,或 shipping_mode_used = "fixed"
|
|
146
296
|
commerce order ship \
|
|
147
297
|
--id order_123 \
|
|
148
298
|
--tracking DHL123456 \
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: product
|
|
3
|
-
description: Product catalog management for e-commerce stores. Create and update products, manage variants/SKUs, upload product images, organize tags
|
|
3
|
+
description: Product catalog management for e-commerce stores. Create and update products, manage variants/SKUs, upload product images, organize tags. Use when user needs to add new products, update pricing, manage product inventory, upload photos, or organize product catalog.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Commerce CLI - Product Management
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
商品管理模块,用于电商商品目录的创建、编辑和组织。
|
|
9
9
|
|
|
10
10
|
## 典型场景
|
|
11
11
|
|
|
@@ -73,45 +73,6 @@ commerce upload image --path ./new-photo.jpg # 获得 media_new
|
|
|
73
73
|
commerce product add-images --id prod_123 --media-id media_new
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
### 场景6:创建商品集合
|
|
77
|
-
|
|
78
|
-
**推荐集合类型**:
|
|
79
|
-
- **时令集合** - 春夏秋冬、节日促销(如"Christmas Sale")
|
|
80
|
-
- **品类集合** - 按商品类型分组(如"T-Shirts", "Dresses")
|
|
81
|
-
- **主题集合** - 按场景分组(如"Office Wear", "Casual Style")
|
|
82
|
-
- **促销集合** - 新品、热卖、折扣(如"New Arrivals", "Best Sellers")
|
|
83
|
-
|
|
84
|
-
**创建流程**:
|
|
85
|
-
```bash
|
|
86
|
-
# 1. 创建集合
|
|
87
|
-
commerce collection create \
|
|
88
|
-
--name "Summer Sale 2024" \
|
|
89
|
-
--slug "summer-sale-2024" \
|
|
90
|
-
--description "Hot deals for summer"
|
|
91
|
-
|
|
92
|
-
# 2. 添加商品到集合
|
|
93
|
-
commerce collection add-products \
|
|
94
|
-
--slug summer-sale-2024 \
|
|
95
|
-
--product-ids prod_123,prod_456,prod_789
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### 场景7:设置集合封面图
|
|
99
|
-
|
|
100
|
-
**三种方式**:
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
# 方式 1:使用 Media ID(推荐,可复用已上传图片)
|
|
104
|
-
commerce upload image --path ./cover.jpg
|
|
105
|
-
# 获取 media_id: media_456
|
|
106
|
-
commerce collection set-cover --id coll-123 --media-id media_456
|
|
107
|
-
|
|
108
|
-
# 方式 2:使用 URL
|
|
109
|
-
commerce collection set-cover --id coll-123 --url "https://example.com/cover.jpg"
|
|
110
|
-
|
|
111
|
-
# 方式 3:上传本地文件
|
|
112
|
-
commerce collection set-cover --id coll-123 --path ./cover.jpg
|
|
113
|
-
```
|
|
114
|
-
|
|
115
76
|
### 场景决策表
|
|
116
77
|
|
|
117
78
|
| 用户需求 | 推荐命令 | 关键注意点 |
|
|
@@ -122,8 +83,6 @@ commerce collection set-cover --id coll-123 --path ./cover.jpg
|
|
|
122
83
|
| 更新价格 | `product update --price` | 如有变体,需逐个更新变体价格 |
|
|
123
84
|
| 促销标签 | `product update --tags` | 用逗号分隔,保留原有标签 |
|
|
124
85
|
| 图片更新 | `upload` + `add-images` | 先上传再关联,不要直接删除旧图 |
|
|
125
|
-
| 创建促销集合 | `collection create --slug sale` | slug 简短有意义,添加10-30个商品 |
|
|
126
|
-
| 设置集合封面 | `collection set-cover --id XX` | 支持 media-id/url/path 三种方式 |
|
|
127
86
|
|
|
128
87
|
## 卓越标准
|
|
129
88
|
|
|
@@ -219,54 +178,6 @@ commerce product update --id prod_123 --tags "featured,new,sale"
|
|
|
219
178
|
commerce product create --title "T恤" --price 99 --stock 50 # 确保真实有50件
|
|
220
179
|
```
|
|
221
180
|
|
|
222
|
-
### ❌ 问题6:集合命名随意,无规划
|
|
223
|
-
|
|
224
|
-
**错误做法**:
|
|
225
|
-
```bash
|
|
226
|
-
# 命名不规范,slug 无意义
|
|
227
|
-
commerce collection create --name "aaa" --slug "test123"
|
|
228
|
-
commerce collection create --name "商品111" --slug "product-collection"
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
**正确做法**:
|
|
232
|
-
```bash
|
|
233
|
-
# 命名清晰,slug 符合 SEO 规范
|
|
234
|
-
commerce collection create --name "Summer Sale 2024" --slug "summer-sale-2024"
|
|
235
|
-
commerce collection create --name "Men's T-Shirts" --slug "mens-tshirts"
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
### ❌ 问题7:集合缺少商品
|
|
239
|
-
|
|
240
|
-
**错误做法**:
|
|
241
|
-
```bash
|
|
242
|
-
# 创建集合后忘记添加商品
|
|
243
|
-
commerce collection create --name "New Arrivals" --slug "new-arrivals"
|
|
244
|
-
# 集合页面显示空白
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
**正确做法**:
|
|
248
|
-
```bash
|
|
249
|
-
# 创建集合后立即添加商品(至少5个)
|
|
250
|
-
commerce collection create --name "New Arrivals" --slug "new-arrivals"
|
|
251
|
-
commerce collection add-products --slug new-arrivals --product-ids prod_1,prod_2,prod_3,prod_4,prod_5
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
### ❌ 问题8:slug 使用中文或特殊字符
|
|
255
|
-
|
|
256
|
-
**错误做法**:
|
|
257
|
-
```bash
|
|
258
|
-
# slug 包含中文或特殊字符,影响 SEO 和 URL 可读性
|
|
259
|
-
commerce collection create --name "夏季促销" --slug "夏季促销"
|
|
260
|
-
commerce collection create --name "Sale!!!" --slug "sale!!!"
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
**正确做法**:
|
|
264
|
-
```bash
|
|
265
|
-
# slug 使用英文、数字、连字符
|
|
266
|
-
commerce collection create --name "夏季促销" --slug "summer-sale"
|
|
267
|
-
commerce collection create --name "Sale!!!" --slug "sale"
|
|
268
|
-
```
|
|
269
|
-
|
|
270
181
|
## 命令参考
|
|
271
182
|
|
|
272
183
|
### 自然语言映射
|
|
@@ -278,11 +189,6 @@ commerce collection create --name "Sale!!!" --slug "sale"
|
|
|
278
189
|
- "更新商品价格" → `commerce product update --id XX --price YY`
|
|
279
190
|
- "给商品打标签" → `commerce product update --id XX --tags "featured,new"`
|
|
280
191
|
- "查看所有商品" → `commerce product list`
|
|
281
|
-
- "创建商品集合" → `commerce collection create --name XX --slug YY`
|
|
282
|
-
- "把商品添加到集合" → `commerce collection add-products --slug XX --product-ids YY`
|
|
283
|
-
- "设置集合封面图" → `commerce collection set-cover --id XX --media-id YY`
|
|
284
|
-
- "上传集合封面" → `commerce collection set-cover --id XX --path ./cover.jpg`
|
|
285
|
-
- "集合封面图 URL 是 https://..." → `commerce collection set-cover --id XX --url "https://..."`
|
|
286
192
|
|
|
287
193
|
### 核心功能
|
|
288
194
|
|
|
@@ -304,15 +210,6 @@ commerce collection create --name "Sale!!!" --slug "sale"
|
|
|
304
210
|
- `commerce product add-images` - 关联图片到商品
|
|
305
211
|
- `commerce product remove-images` - 移除商品图片
|
|
306
212
|
|
|
307
|
-
**商品集合**:
|
|
308
|
-
- `commerce collection create` - 创建集合
|
|
309
|
-
- `commerce collection list` - 查看集合列表
|
|
310
|
-
- `commerce collection update` - 更新集合
|
|
311
|
-
- `commerce collection delete` - 删除集合
|
|
312
|
-
- `commerce collection add-products` - 添加商品到集合
|
|
313
|
-
- `commerce collection remove-products` - 从集合移除商品
|
|
314
|
-
- `commerce collection set-cover` - 设置集合封面图(支持 media-id/url/path)
|
|
315
|
-
|
|
316
213
|
## 详细示例
|
|
317
214
|
|
|
318
215
|
### 示例1:创建单个商品
|
|
@@ -398,38 +295,6 @@ commerce product add-images --id prod_123 --media-id media_red,media_blue
|
|
|
398
295
|
commerce product get --id prod_123
|
|
399
296
|
```
|
|
400
297
|
|
|
401
|
-
### 示例7:创建商品集合
|
|
402
|
-
```bash
|
|
403
|
-
# 用户说:"创建夏季促销集合"
|
|
404
|
-
commerce collection create \
|
|
405
|
-
--name "Summer Sale" \
|
|
406
|
-
--slug summer-sale \
|
|
407
|
-
--description "Hot deals for summer"
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
### 示例8:添加商品到集合
|
|
411
|
-
```bash
|
|
412
|
-
# 用户说:"把商品prod_123和prod_456添加到summer-sale集合"
|
|
413
|
-
commerce collection add-products \
|
|
414
|
-
--slug summer-sale \
|
|
415
|
-
--product-ids prod_123,prod_456
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
### 示例9:设置集合封面图
|
|
419
|
-
```bash
|
|
420
|
-
# 用户说:"给集合设置封面图"
|
|
421
|
-
|
|
422
|
-
# 方式 1:使用 Media ID(推荐)
|
|
423
|
-
commerce upload image --path ./cover.jpg # 获得 media_456
|
|
424
|
-
commerce collection set-cover --id coll-123 --media-id media_456
|
|
425
|
-
|
|
426
|
-
# 方式 2:使用 URL
|
|
427
|
-
commerce collection set-cover --id coll-123 --url "https://example.com/cover.jpg"
|
|
428
|
-
|
|
429
|
-
# 方式 3:上传本地文件
|
|
430
|
-
commerce collection set-cover --id coll-123 --path ./cover.jpg
|
|
431
|
-
```
|
|
432
|
-
|
|
433
298
|
## 重要提示
|
|
434
299
|
|
|
435
300
|
- 所有命令默认 JSON 输出,便于 AI 解析
|
|
@@ -440,5 +305,3 @@ commerce collection set-cover --id coll-123 --path ./cover.jpg
|
|
|
440
305
|
- 使用 `--help` 查看命令详细参数
|
|
441
306
|
- 删除商品会同时删除所有变体和图片关联
|
|
442
307
|
- 价格单位默认为美元(USD),可通过后台配置修改
|
|
443
|
-
- 集合 slug 必须唯一,用于 URL,使用英文和连字符
|
|
444
|
-
- 集合封面支持三种方式:`--media-id`(推荐)、`--url`、`--path`
|