@optima-chat/optima-agent 0.4.23 → 0.4.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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: inventory
3
- description: Inventory management and stock monitoring. Track stock levels, update inventory, check low stock alerts, view inventory history, reserve stock. Use when user needs to check stock, replenish inventory, monitor low stock warnings, or manage stock reservations.
3
+ description: Inventory management and stock monitoring. Track stock levels, update inventory, check low stock alerts, view inventory history, reserve stock. Use when user needs to check stock, replenish inventory, monitor low stock warnings, manage stock reservations, or set variant stock quantities. IMPORTANT - Always load this skill when user wants to update/set stock or inventory for products or variants.
4
4
  ---
5
5
 
6
6
  # Commerce CLI - Inventory Management
@@ -235,9 +235,68 @@ commerce inventory reserve \
235
235
  commerce inventory history --id prod_123
236
236
  ```
237
237
 
238
+ ## 变体库存管理(重要)
239
+
240
+ **这是最常见的库存管理错误,务必理解!**
241
+
242
+ ### 核心规则
243
+
244
+ | 产品类型 | 库存设置方式 | 说明 |
245
+ |---------|-------------|------|
246
+ | **有变体的产品** | 必须设置**变体库存** | 产品库存 = 所有变体库存之和(自动计算) |
247
+ | **无变体的产品** | 直接设置**产品库存** | 正常更新即可 |
248
+
249
+ ### 正确的库存更新流程
250
+
251
+ ```bash
252
+ # 1. 先查看产品是否有变体
253
+ commerce product get --id prod_123
254
+
255
+ # 2. 如果 variants 数组不为空,需要逐个更新变体库存
256
+ commerce inventory update --id var_abc --quantity 10 # 变体1
257
+ commerce inventory update --id var_def --quantity 10 # 变体2
258
+ commerce inventory update --id var_ghi --quantity 10 # 变体3
259
+
260
+ # 3. 如果没有变体,直接更新产品库存
261
+ commerce inventory update --id prod_123 --quantity 30
262
+ ```
263
+
264
+ ### ❌ 常见错误
265
+
266
+ ```bash
267
+ # 错误:直接更新有变体产品的产品级库存
268
+ commerce inventory update --id prod_123 --quantity 30
269
+ # 这样做不会影响变体的可购买状态!
270
+ ```
271
+
272
+ ### ✅ 正确做法
273
+
274
+ ```bash
275
+ # 用户说:"把所有变体库存都设置为10"
276
+
277
+ # 1. 先获取产品和变体信息
278
+ commerce product get --id prod_123
279
+
280
+ # 2. 逐个更新变体库存(假设返回了3个变体)
281
+ commerce inventory update --id var_abc --quantity 10
282
+ commerce inventory update --id var_def --quantity 10
283
+ commerce inventory update --id var_ghi --quantity 10
284
+
285
+ # 产品总库存会自动变为 30(10+10+10)
286
+ ```
287
+
288
+ ### 批量设置变体库存
289
+
290
+ 当用户说"所有变体库存设置为 N"时:
291
+
292
+ 1. 先用 `commerce product get --id XX` 获取变体列表
293
+ 2. 遍历每个变体,用 `commerce inventory update --id <variant_id> --quantity N` 更新
294
+ 3. 确认更新成功后,产品总库存会自动计算
295
+
238
296
  ## 重要提示
239
297
 
240
298
  - 库存变更会自动记录历史
241
299
  - 预留库存不会减少可用库存数量
242
300
  - 低库存阈值可自定义(默认5)
243
301
  - 使用 `--help` 查看命令详细参数
302
+ - **有变体的产品必须更新变体库存,不能直接更新产品库存**
@@ -1,6 +1,6 @@
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. Use when user needs to add new products, update pricing, manage product inventory, upload photos, or organize product catalog.
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, upload photos, or organize product catalog. NOTE - For inventory/stock management, use the inventory skill instead.
4
4
  ---
5
5
 
6
6
  # Commerce CLI - Product Management
@@ -216,11 +216,18 @@ commerce product create --title "T恤" --price 99 --stock 50 # 确保真实有5
216
216
  ### 示例1:创建单个商品
217
217
  ```bash
218
218
  # 用户说:"创建T恤商品,99美元,库存20"
219
+ # 描述支持 Markdown 格式
219
220
  commerce product create \
220
221
  --title "T恤" \
221
222
  --price 99 \
222
223
  --stock 20 \
223
- --description "100% 纯棉T恤"
224
+ --description "## 产品特点
225
+
226
+ - **材质**:100% 纯棉
227
+ - **特性**:透气舒适,不易起球
228
+ - **适合人群**:日常休闲、运动
229
+
230
+ > 机洗建议:30°C 以下冷水洗涤"
224
231
  ```
225
232
 
226
233
  ### 示例2:上传商品图片
@@ -298,6 +305,8 @@ commerce product get --id prod_123
298
305
 
299
306
  ## 重要提示
300
307
 
308
+ - **库存管理请使用 inventory skill** - 如果用户要求更新库存、设置库存数量、补货等,请加载 `/inventory` skill。特别是有变体的产品,必须通过 inventory skill 更新变体库存,不能直接更新产品库存。
309
+ - **商品描述支持 Markdown 格式**,可以使用标题、列表、加粗、链接等排版
301
310
  - 所有命令默认 JSON 输出,便于 AI 解析
302
311
  - 图片需要先上传获取 `media_id`,再关联到商品
303
312
  - 变体的 `attributes` 使用 JSON 格式
@@ -26,9 +26,9 @@ export function getSystemPrompt() {
26
26
  可用的 Skills:
27
27
 
28
28
  - **merchant** - 店铺信息查询和管理
29
- - **product** - 商品管理(创建、编辑、删除商品)
29
+ - **product** - 商品管理(创建、编辑、删除商品、变体管理)
30
30
  - **order** - 订单处理(发货、退款、查询)
31
- - **inventory** - 库存管理(监控、调整库存)
31
+ - **inventory** - 库存管理(**设置/更新库存必须用这个**,特别是变体库存)
32
32
  - **i18n** - 国际化翻译管理
33
33
  - **collection** - 商品集合管理(分组、促销专区)
34
34
  - **homepage** - 店铺首页配置(Banner、集合展示)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optima-chat/optima-agent",
3
- "version": "0.4.23",
3
+ "version": "0.4.25",
4
4
  "description": "基于 Claude Agent SDK 的电商运营 AI 助手",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",