@optima-chat/optima-agent 0.4.18 → 0.4.19

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.
@@ -48,7 +48,20 @@
48
48
  "Bash(commerce collection list --help:*)",
49
49
  "Bash(commerce collection create --help:*)",
50
50
  "Bash(commerce collection remove-products:*)",
51
- "Bash(commerce collection list-products:*)"
51
+ "Bash(commerce collection list-products:*)",
52
+ "Bash(commerce --version:*)",
53
+ "Bash(bi-cli --version:*)",
54
+ "Bash(commerce homepage create --help:*)",
55
+ "Bash(commerce homepage reorder --help:*)",
56
+ "Bash(commerce homepage delete --help:*)",
57
+ "Bash(commerce homepage update-images:*)",
58
+ "Bash(commerce homepage update-collections:*)",
59
+ "Bash(commerce homepage update-target:*)",
60
+ "Bash(commerce homepage switch-template:*)",
61
+ "Bash(commerce inventory:*)",
62
+ "Bash(commerce merchant:*)",
63
+ "Bash(commerce review:*)",
64
+ "Bash(commerce product-page:*)"
52
65
  ],
53
66
  "deny": [],
54
67
  "ask": []
@@ -167,7 +167,7 @@ Homepage
167
167
  - "添加轮播图区块" → `commerce homepage create --type banner --title "主 Banner"`
168
168
  - "更新轮播图图片" → `commerce homepage update-images --id xx --images '[...]'`
169
169
  - "设置集合列表" → `commerce homepage update-collections --id xx --slugs "a,b,c"`
170
- - "调整区块顺序" → `commerce homepage reorder --ids "id1,id2,id3"`
170
+ - "调整区块顺序" → `commerce homepage reorder --moves '[{"section_id":"id1","new_position":0}]'`
171
171
  - "使用模板" → `commerce homepage switch-template --template-key minimal`
172
172
  - "删除区块" → `commerce homepage delete --id xx --yes`
173
173
 
@@ -185,7 +185,7 @@ Homepage
185
185
  - `commerce homepage get --id <id>` - 查看区块详情
186
186
  - `commerce homepage update --id <id>` - 更新区块
187
187
  - `commerce homepage delete --id <id> --yes` - 删除区块
188
- - `commerce homepage reorder --ids <id1,id2,...>` - 重新排序
188
+ - `commerce homepage reorder --moves <json>` - 重新排序(JSON 格式:`[{"section_id":"xx","new_position":0}]`)
189
189
 
190
190
  ### 区块设置
191
191
  - `commerce homepage update-images --id <id> --images <json>` - 更新 banner 图片
@@ -14,11 +14,10 @@ description: Inventory management and stock monitoring. Track stock levels, upda
14
14
  | 用户需求 | 推荐命令 | 关键注意点 |
15
15
  |---------|---------|-----------|
16
16
  | 查看低库存 | `inventory low-stock --threshold 10` | 阈值根据品类和销售速度设定 |
17
- | 补货操作 | `inventory update --quantity XX --reason` | 必须填写原因,便于追踪 |
18
- | 预留库存 | `inventory reserve --order-id XX` | 订单创建时立即预留,避免超卖 |
19
- | 释放预留 | `inventory release --order-id XX` | 订单取消或支付超时时释放 |
20
- | 查看历史 | `inventory history --product-id XX` | 分析库存变化趋势,优化补货策略 |
21
- | 盘点调整 | `inventory update --reason "盘点调整"` | 账实不符时手动调整,记录差异原因 |
17
+ | 补货操作 | `inventory update --id XX --quantity YY` | 使用 product list 获取商品 ID |
18
+ | 预留库存 | `inventory reserve --id XX --quantity YY` | 订单创建时立即预留,避免超卖 |
19
+ | 查看历史 | `inventory history --id XX` | 分析库存变化趋势,优化补货策略 |
20
+ | 盘点调整 | `inventory update --id XX --quantity YY` | 账实不符时手动调整 |
22
21
 
23
22
  ### 1. 查看低库存预警
24
23
 
@@ -35,15 +34,12 @@ commerce inventory low-stock --threshold 5
35
34
 
36
35
  ```bash
37
36
  # 用户说:"商品prod_123补货100个"
38
- commerce inventory update \
39
- --id prod_123 \
40
- --quantity 100 \
41
- --reason "定期补货"
37
+ commerce inventory update --id prod_123 --quantity 100
42
38
 
43
39
  # 根据销售数据决定补货量
44
- commerce inventory update --id prod_hot --quantity 500 --reason "畅销品大量补货"
45
- commerce inventory update --id prod_normal --quantity 100 --reason "常规补货"
46
- commerce inventory update --id prod_slow --quantity 20 --reason "滞销品少量补货"
40
+ commerce inventory update --id prod_hot --quantity 500
41
+ commerce inventory update --id prod_normal --quantity 100
42
+ commerce inventory update --id prod_slow --quantity 20
47
43
  ```
48
44
 
49
45
  ### 3. 预留库存
@@ -52,16 +48,11 @@ commerce inventory update --id prod_slow --quantity 20 --reason "滞销品少量
52
48
 
53
49
  ```bash
54
50
  # 用户说:"为订单预留5个商品"
55
- commerce inventory reserve \
56
- --product-id prod_123 \
57
- --quantity 5 \
58
- --order-id order_456
51
+ commerce inventory reserve --id prod_123 --quantity 5
59
52
  ```
60
53
 
61
54
  **库存预留机制**:
62
55
  - **订单创建时预留** - 避免超卖,保证订单可履行
63
- - **支付超时释放** - 未支付订单15分钟后自动释放预留
64
- - **取消订单释放** - 订单取消后立即释放预留
65
56
  - **发货后扣减** - 商品发货后从可用库存扣减
66
57
 
67
58
  ### 4. 盘点调整
@@ -70,13 +61,7 @@ commerce inventory reserve \
70
61
 
71
62
  ```bash
72
63
  # 实际库存95,账面库存100,差异5个
73
- commerce inventory update \
74
- --id prod_123 \
75
- --quantity 95 \
76
- --reason "盘点调整:实际库存95,账面100,差异-5(仓库损耗)"
77
-
78
- # 验证更新
79
- commerce inventory get --id prod_123
64
+ commerce inventory update --id prod_123 --quantity 95
80
65
  ```
81
66
 
82
67
  ### 5. 处理超卖
@@ -103,9 +88,7 @@ commerce inventory get --id prod_123
103
88
 
104
89
  ```bash
105
90
  # 用户说:"查看商品prod_123的库存变更记录"
106
- commerce inventory history \
107
- --product-id prod_123 \
108
- --limit 20
91
+ commerce inventory history --id prod_123
109
92
  ```
110
93
 
111
94
  ## 卓越标准
@@ -128,8 +111,8 @@ commerce inventory history \
128
111
  1. **查看低库存** - 每日 `commerce inventory low-stock --threshold 10`
129
112
  2. **分析销售趋势** - 结合订单数据判断补货优先级
130
113
  3. **制定补货计划** - 畅销品加大补货量,滞销品谨慎补货
131
- 4. **执行补货** - `commerce inventory update --id XX --quantity YY --reason "补货"`
132
- 5. **验证更新** - `commerce inventory get --id XX` 确认库存正确
114
+ 4. **执行补货** - `commerce inventory update --id XX --quantity YY`
115
+ 5. **验证更新** - `commerce product get --id XX` 确认库存正确
133
116
  6. **定期盘点** - 每月实地盘点,调整账面库存
134
117
 
135
118
  ## 常见问题
@@ -140,7 +123,7 @@ commerce inventory history \
140
123
  ```bash
141
124
  # 不分析就盲目补货,可能造成库存积压
142
125
  for product_id in $(commerce inventory low-stock --json | jq -r '.[].id'); do
143
- commerce inventory update --id $product_id --quantity 100 --reason "批量补货"
126
+ commerce inventory update --id $product_id --quantity 100
144
127
  done
145
128
  ```
146
129
 
@@ -150,9 +133,9 @@ done
150
133
  commerce inventory low-stock --threshold 10
151
134
 
152
135
  # 根据销售数据决定补货量
153
- commerce inventory update --id prod_hot --quantity 500 --reason "畅销品大量补货"
154
- commerce inventory update --id prod_normal --quantity 100 --reason "常规补货"
155
- commerce inventory update --id prod_slow --quantity 20 --reason "滞销品少量补货"
136
+ commerce inventory update --id prod_hot --quantity 500 # 畅销品大量补货
137
+ commerce inventory update --id prod_normal --quantity 100 # 常规补货
138
+ commerce inventory update --id prod_slow --quantity 20 # 滞销品少量补货
156
139
  ```
157
140
 
158
141
  ### ❌ 问题2:库存差异超过5%未深入调查
@@ -165,11 +148,8 @@ commerce inventory update --id prod_slow --quantity 20 --reason "滞销品少量
165
148
  3. 差异率 > 5%需要深入调查根本原因
166
149
 
167
150
  ```bash
168
- # 调整库存并详细记录原因
169
- commerce inventory update \
170
- --id prod_123 \
171
- --quantity 95 \
172
- --reason "盘点调整:实际95,账面100,差异-5(仓库损耗,需检查存储条件)"
151
+ # 调整库存(记录差异原因:实际95,账面100,差异-5,仓库损耗)
152
+ commerce inventory update --id prod_123 --quantity 95
173
153
  ```
174
154
 
175
155
  ### ❌ 问题3:滞销商品长期占用库存
@@ -184,24 +164,17 @@ commerce inventory update \
184
164
 
185
165
  ```bash
186
166
  # 查看库存历史判断是否滞销
187
- commerce inventory history --product-id prod_slow --limit 50
167
+ commerce inventory history --id prod_slow
188
168
  ```
189
169
 
190
- ### ❌ 问题4:不记录库存变更原因
170
+ ### ❌ 问题4:不分析销售数据就补货
191
171
 
192
- **错误做法**:
193
- ```bash
194
- # 缺少原因,无法追溯
195
- commerce inventory update --id prod_123 --quantity 100
196
- ```
172
+ **错误做法**:直接设置固定数量,不考虑销售速度
197
173
 
198
174
  **✅ 正确做法**:
199
175
  ```bash
200
- # 必须记录原因
201
- commerce inventory update \
202
- --id prod_123 \
203
- --quantity 100 \
204
- --reason "定期补货:上周销量50,预计2周销量"
176
+ # 根据销售数据决定补货量(如上周销量50,预计2周销量)
177
+ commerce inventory update --id prod_123 --quantity 100
205
178
  ```
206
179
 
207
180
  ### ❌ 问题5:超卖后处理不当
@@ -223,23 +196,16 @@ commerce inventory update \
223
196
 
224
197
  当用户说:
225
198
  - "查看库存低于10的商品" → `commerce inventory low-stock --threshold 10`
226
- - "商品XX补货50个" → `commerce inventory update --id XX --quantity 50 --reason "补货"`
227
- - "预留库存" → `commerce inventory reserve --product-id XX --quantity YY`
228
- - "查看库存历史" → `commerce inventory history --product-id XX`
229
- - "查看所有商品库存" → `commerce inventory list`
199
+ - "商品XX补货50个" → `commerce inventory update --id XX --quantity 50`
200
+ - "预留库存" → `commerce inventory reserve --id XX --quantity YY`
201
+ - "查看库存历史" → `commerce inventory history --id XX`
230
202
 
231
203
  ### 核心功能
232
204
 
233
- **库存查询**:
234
- - `commerce inventory list` - 查看所有商品库存
235
- - `commerce inventory get` - 查看单个商品库存
236
205
  - `commerce inventory low-stock` - 查看低库存商品
237
- - `commerce inventory history` - 查看库存变更历史
238
-
239
- **库存更新**:
240
206
  - `commerce inventory update` - 更新库存数量
207
+ - `commerce inventory history` - 查看库存变更历史
241
208
  - `commerce inventory reserve` - 预留库存
242
- - `commerce inventory release` - 释放预留库存
243
209
 
244
210
  ## 详细示例
245
211
 
@@ -252,40 +218,26 @@ commerce inventory low-stock --threshold 5
252
218
  ### 补货操作
253
219
  ```bash
254
220
  # 用户说:"商品prod_123补货100个"
255
- commerce inventory update \
256
- --id prod_123 \
257
- --quantity 100 \
258
- --reason "定期补货"
221
+ commerce inventory update --id prod_123 --quantity 100
259
222
  ```
260
223
 
261
224
  ### 预留库存
262
225
  ```bash
263
226
  # 用户说:"为订单预留5个商品"
264
227
  commerce inventory reserve \
265
- --product-id prod_123 \
266
- --quantity 5 \
267
- --order-id order_456
228
+ --id prod_123 \
229
+ --quantity 5
268
230
  ```
269
231
 
270
232
  ### 查看库存历史
271
233
  ```bash
272
234
  # 用户说:"查看商品prod_123的库存变更记录"
273
- commerce inventory history \
274
- --product-id prod_123 \
275
- --limit 20
276
- ```
277
-
278
- ### 批量查看库存
279
- ```bash
280
- # 用户说:"查看所有商品的库存情况"
281
- commerce inventory list --limit 100
235
+ commerce inventory history --id prod_123
282
236
  ```
283
237
 
284
238
  ## 重要提示
285
239
 
286
240
  - 库存变更会自动记录历史
287
241
  - 预留库存不会减少可用库存数量
288
- - 更新库存时建议添加 `--reason` 说明原因
289
- - 低库存阈值可以自定义
290
- - 支持批量库存更新(通过脚本循环调用)
242
+ - 低库存阈值可自定义(默认5)
291
243
  - 使用 `--help` 查看命令详细参数
@@ -19,19 +19,19 @@ commerce merchant info
19
19
 
20
20
  ### 更新店铺信息
21
21
  ```bash
22
- commerce merchant update --name "新店铺名" --description "描述" --currency USD
22
+ commerce merchant update --name "新店铺名" --description "描述" --default-currency USD
23
23
  ```
24
24
 
25
25
  可更新的字段:
26
26
  - `--name`: 店铺名称
27
27
  - `--slug`: 店铺标识(URL 友好)
28
28
  - `--description`: 店铺描述
29
- - `--currency`: 默认货币(USD, CNY, EUR 等)
29
+ - `--default-currency`: 默认货币(USD, CNY, EUR 等)
30
30
  - `--contact-name`: 联系人姓名
31
31
  - `--contact-phone`: 联系电话
32
32
  - `--contact-email`: 联系邮箱
33
- - `--company`: 公司名称
34
- - `--address-*`: 发货地址字段
33
+ - `--company-name`: 公司名称
34
+ - `--origin-*`: 发货地址字段(origin-country-alpha2, origin-city, origin-postal-code 等)
35
35
 
36
36
  ## 完整命令列表
37
37
 
@@ -46,10 +46,10 @@ commerce merchant update --name "我的店铺" --description "这是一个很棒
46
46
  commerce merchant update --contact-name "张三" --contact-phone "1234567890" --contact-email "contact@example.com"
47
47
 
48
48
  # 更新发货地址
49
- commerce merchant update --address-country "CN" --address-city "深圳" --address-postal-code "518000"
49
+ commerce merchant update --origin-country-alpha2 "CN" --origin-city "深圳" --origin-postal-code "518000"
50
50
 
51
51
  # 更新多个字段
52
- commerce merchant update --name "新店铺" --currency "CNY" --company "我的公司"
52
+ commerce merchant update --name "新店铺" --default-currency "CNY" --company-name "我的公司"
53
53
  ```
54
54
 
55
55
  ## 工作流示例
@@ -75,9 +75,9 @@ commerce merchant update \
75
75
  --contact-name "张三" \
76
76
  --contact-phone "13800138000" \
77
77
  --contact-email "shop@example.com" \
78
- --address-country "CN" \
79
- --address-city "深圳" \
80
- --address-postal-code "518000"
78
+ --origin-country-alpha2 "CN" \
79
+ --origin-city "深圳" \
80
+ --origin-postal-code "518000"
81
81
  ```
82
82
 
83
83
  ### 示例 3:修改店铺名称
@@ -72,7 +72,7 @@ content 支持模板变量,在前端渲染时自动替换:
72
72
  - "覆盖护理说明" → `commerce product-page create --handle care --operation-type override ...`
73
73
  - "隐藏环保说明" → `commerce product-page hide --handle eco-friendly`
74
74
  - "添加品牌故事区块" → `commerce product-page create --handle brand-story --operation-type new ...`
75
- - "调整区块顺序" → `commerce product-page reorder --handles "h1,h2,h3"`
75
+ - "调整区块顺序" → `commerce product-page reorder --sections '[{"handle":"h1","position":1},{"handle":"h2","position":2}]'`
76
76
  - "给某商品单独设置" → `commerce product-page product create --product-handle xxx ...`
77
77
 
78
78
  ## 命令参考
@@ -85,7 +85,7 @@ content 支持模板变量,在前端渲染时自动替换:
85
85
  - `commerce product-page update --handle <handle>` - 更新区块
86
86
  - `commerce product-page delete --handle <handle> --yes` - 删除自定义
87
87
  - `commerce product-page hide --handle <handle>` - 隐藏区块(快捷方式)
88
- - `commerce product-page reorder --handles <h1,h2,...>` - 重新排序
88
+ - `commerce product-page reorder --sections <json>` - 重新排序(JSON 格式:`[{"handle":"xx","position":1}]`)
89
89
 
90
90
  ### 商品级命令(仅影响单个商品)
91
91
 
@@ -17,7 +17,7 @@ description: Review management and moderation. View, approve, reject, and respon
17
17
  - "设为精选" → `commerce review feature --id XX --enable`
18
18
  - "查看举报" → `commerce review reports --status pending`
19
19
  - "查看评价设置" → `commerce review get-settings`
20
- - "开启自动审核" → `commerce review update-settings --auto-approve --min-rating 4`
20
+ - "开启自动审核" → `commerce review update-settings --auto-approve`
21
21
 
22
22
  ### 场景决策表
23
23
 
@@ -30,7 +30,7 @@ description: Review management and moderation. View, approve, reject, and respon
30
30
  | 处理举报 | `review handle-report` | 核实后决定删除或驳回 |
31
31
  | 查看统计 | `review stats` | 监控平均分和评分分布趋势 |
32
32
  | 查看设置 | `review get-settings` | 了解当前自动审核等配置 |
33
- | 开启自动审核 | `review update-settings --auto-approve` | 建议设置最低评分 4 星 |
33
+ | 开启自动审核 | `review update-settings --auto-approve` | 所有评价自动通过 |
34
34
 
35
35
  ### 标准评价管理流程
36
36
  1. **每日审核** - `commerce review list --status pending` 查看待审核
@@ -202,31 +202,27 @@ commerce review get-settings
202
202
 
203
203
  ### 更新评价设置
204
204
  ```bash
205
- # 用户说:"开启自动审核,4星以上自动通过"
206
- commerce review update-settings \
207
- --auto-approve \
208
- --min-rating 4
209
-
210
- # 设置评价请求时间(订单送达后7天发送)
211
- commerce review update-settings --request-days 7
212
-
213
- # 允许用户上传图片和视频
214
- commerce review update-settings \
215
- --allow-media \
216
- --max-images 5 \
217
- --max-videos 1
205
+ # 用户说:"开启自动审核"
206
+ commerce review update-settings --auto-approve
207
+
208
+ # 设置评价时间窗口(订单后30天内可评价)
209
+ commerce review update-settings --review-window-days 30
210
+
211
+ # 允许用户上传图片,设置最大5张
212
+ commerce review update-settings --allow-images --max-images 5
218
213
  ```
219
214
 
220
215
  ## 评价设置配置项
221
216
 
222
- | 配置 | 说明 | 默认值 |
223
- |------|------|--------|
224
- | `auto_approve` | 新评价是否自动通过 | false |
225
- | `auto_approve_min_rating` | 自动通过的最低评分 | 4 |
226
- | `request_days` | 订单送达后几天发送评价请求 | 7 |
227
- | `allow_media` | 是否允许上传图片/视频 | true |
228
- | `max_images` | 最大图片数 | 5 |
229
- | `max_videos` | 最大视频数 | 1 |
217
+ | 配置 | 说明 |
218
+ |------|------|
219
+ | `--auto-approve` | 新评价自动通过 |
220
+ | `--require-purchase` | 需要验证购买才能评价 |
221
+ | `--allow-anonymous` | 允许匿名评价 |
222
+ | `--review-window-days` | 评价时间窗口(1-365天)|
223
+ | `--allow-images` | 允许上传图片 |
224
+ | `--max-images` | 最大图片数(0-10)|
225
+ | `--allow-edit` | 允许编辑评价 |
230
226
 
231
227
  ## 重要提示
232
228
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optima-chat/optima-agent",
3
- "version": "0.4.18",
3
+ "version": "0.4.19",
4
4
  "description": "基于 Claude Agent SDK 的电商运营 AI 助手",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",