@optima-chat/optima-agent 0.5.0 → 0.5.2

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.
Files changed (179) hide show
  1. package/.claude/settings.local.json +83 -0
  2. package/.claude/skills/ads/SKILL.md +0 -0
  3. package/.claude/skills/bi/SKILL.md +71 -42
  4. package/.claude/skills/collection/SKILL.md +88 -0
  5. package/.claude/skills/comfy/SKILL.md +138 -122
  6. package/.claude/skills/ffmpeg/SKILL.md +164 -0
  7. package/.claude/skills/homepage/SKILL.md +324 -0
  8. package/.claude/skills/i18n/SKILL.md +0 -0
  9. package/.claude/skills/inventory/SKILL.md +90 -79
  10. package/.claude/skills/markdown-pdf/SKILL.md +72 -0
  11. package/.claude/skills/merchant/SKILL.md +71 -68
  12. package/.claude/skills/order/SKILL.md +193 -21
  13. package/.claude/skills/product/SKILL.md +51 -6
  14. package/.claude/skills/product-page/SKILL.md +200 -0
  15. package/.claude/skills/review/SKILL.md +234 -0
  16. package/.claude/skills/scout/SKILL.md +116 -1
  17. package/.claude/skills/shipping/SKILL.md +193 -0
  18. package/README.md +5 -1
  19. package/dist/bin/bi-cli.d.ts +0 -0
  20. package/dist/bin/bi-cli.d.ts.map +0 -0
  21. package/dist/bin/bi-cli.js.map +0 -0
  22. package/dist/bin/comfy.d.ts +0 -0
  23. package/dist/bin/comfy.d.ts.map +0 -0
  24. package/dist/bin/comfy.js.map +0 -0
  25. package/dist/bin/commerce.d.ts +0 -0
  26. package/dist/bin/commerce.d.ts.map +0 -0
  27. package/dist/bin/commerce.js.map +0 -0
  28. package/dist/bin/google-ads.d.ts +0 -0
  29. package/dist/bin/google-ads.d.ts.map +0 -0
  30. package/dist/bin/google-ads.js.map +0 -0
  31. package/dist/bin/optima.d.ts +0 -0
  32. package/dist/bin/optima.d.ts.map +0 -0
  33. package/dist/bin/optima.js +3 -3
  34. package/dist/bin/optima.js.map +1 -1
  35. package/dist/bin/scout.d.ts +0 -0
  36. package/dist/bin/scout.d.ts.map +0 -0
  37. package/dist/bin/scout.js.map +0 -0
  38. package/dist/bin/serve.d.ts +0 -0
  39. package/dist/bin/serve.d.ts.map +0 -0
  40. package/dist/bin/serve.js +0 -0
  41. package/dist/bin/serve.js.map +0 -0
  42. package/dist/src/agent.d.ts +0 -48
  43. package/dist/src/agent.d.ts.map +1 -1
  44. package/dist/src/agent.js +3 -98
  45. package/dist/src/agent.js.map +1 -1
  46. package/dist/src/auth/device-flow.d.ts +0 -0
  47. package/dist/src/auth/device-flow.d.ts.map +0 -0
  48. package/dist/src/auth/device-flow.js +0 -0
  49. package/dist/src/auth/device-flow.js.map +0 -0
  50. package/dist/src/auth/index.d.ts +0 -0
  51. package/dist/src/auth/index.d.ts.map +0 -0
  52. package/dist/src/auth/index.js +0 -0
  53. package/dist/src/auth/index.js.map +0 -0
  54. package/dist/src/auth/token.d.ts +0 -0
  55. package/dist/src/auth/token.d.ts.map +0 -0
  56. package/dist/src/auth/token.js +0 -0
  57. package/dist/src/auth/token.js.map +0 -0
  58. package/dist/src/auth/types.d.ts +0 -0
  59. package/dist/src/auth/types.d.ts.map +0 -0
  60. package/dist/src/auth/types.js +0 -0
  61. package/dist/src/auth/types.js.map +0 -0
  62. package/dist/src/config.d.ts +0 -0
  63. package/dist/src/config.d.ts.map +0 -0
  64. package/dist/src/config.js +0 -0
  65. package/dist/src/config.js.map +0 -0
  66. package/dist/src/hooks-loader.d.ts +6 -0
  67. package/dist/src/hooks-loader.d.ts.map +1 -0
  68. package/dist/src/hooks-loader.js +215 -0
  69. package/dist/src/hooks-loader.js.map +1 -0
  70. package/dist/src/index.d.ts +3 -3
  71. package/dist/src/index.d.ts.map +1 -1
  72. package/dist/src/index.js +1 -1
  73. package/dist/src/index.js.map +1 -1
  74. package/dist/src/server/index.d.ts +0 -0
  75. package/dist/src/server/index.d.ts.map +1 -1
  76. package/dist/src/server/index.js +23 -6
  77. package/dist/src/server/index.js.map +1 -1
  78. package/dist/src/server/types.d.ts +15 -0
  79. package/dist/src/server/types.d.ts.map +1 -1
  80. package/dist/src/server/types.js +0 -0
  81. package/dist/src/server/types.js.map +0 -0
  82. package/dist/src/system-prompt.d.ts +0 -0
  83. package/dist/src/system-prompt.d.ts.map +1 -1
  84. package/dist/src/system-prompt.js +10 -3
  85. package/dist/src/system-prompt.js.map +1 -1
  86. package/dist/src/tools/memory.d.ts +0 -0
  87. package/dist/src/tools/memory.d.ts.map +0 -0
  88. package/dist/src/tools/memory.js +0 -0
  89. package/dist/src/tools/memory.js.map +0 -0
  90. package/dist/src/types.d.ts +1 -11
  91. package/dist/src/types.d.ts.map +1 -1
  92. package/dist/src/types.js +0 -0
  93. package/dist/src/types.js.map +0 -0
  94. package/dist/src/ui/App.d.ts +6 -0
  95. package/dist/src/ui/App.d.ts.map +1 -0
  96. package/dist/src/ui/App.js +164 -0
  97. package/dist/src/ui/App.js.map +1 -0
  98. package/dist/src/ui/components/Composer.d.ts +10 -0
  99. package/dist/src/ui/components/Composer.d.ts.map +1 -0
  100. package/dist/src/ui/components/Composer.js +13 -0
  101. package/dist/src/ui/components/Composer.js.map +1 -0
  102. package/dist/src/ui/components/Header.d.ts +7 -0
  103. package/dist/src/ui/components/Header.d.ts.map +1 -0
  104. package/dist/src/ui/components/Header.js +7 -0
  105. package/dist/src/ui/components/Header.js.map +1 -0
  106. package/dist/src/ui/components/Message.d.ts +12 -0
  107. package/dist/src/ui/components/Message.d.ts.map +1 -0
  108. package/dist/src/ui/components/Message.js +21 -0
  109. package/dist/src/ui/components/Message.js.map +1 -0
  110. package/dist/src/ui/components/MessageList.d.ts +9 -0
  111. package/dist/src/ui/components/MessageList.d.ts.map +1 -0
  112. package/dist/src/ui/components/MessageList.js +18 -0
  113. package/dist/src/ui/components/MessageList.js.map +1 -0
  114. package/dist/src/ui/components/Spinner.d.ts +6 -0
  115. package/dist/src/ui/components/Spinner.d.ts.map +1 -0
  116. package/dist/src/ui/components/Spinner.js +7 -0
  117. package/dist/src/ui/components/Spinner.js.map +1 -0
  118. package/dist/src/ui/components/StatusBar.d.ts +11 -0
  119. package/dist/src/ui/components/StatusBar.d.ts.map +1 -0
  120. package/dist/src/ui/components/StatusBar.js +7 -0
  121. package/dist/src/ui/components/StatusBar.js.map +1 -0
  122. package/dist/src/ui/components/index.d.ts +7 -0
  123. package/dist/src/ui/components/index.d.ts.map +1 -0
  124. package/dist/src/ui/components/index.js +7 -0
  125. package/dist/src/ui/components/index.js.map +1 -0
  126. package/dist/src/ui/conversation-manager.d.ts +10 -9
  127. package/dist/src/ui/conversation-manager.d.ts.map +1 -1
  128. package/dist/src/ui/conversation-manager.js +35 -2
  129. package/dist/src/ui/conversation-manager.js.map +1 -1
  130. package/dist/src/ui/headless-types.d.ts +85 -4
  131. package/dist/src/ui/headless-types.d.ts.map +1 -1
  132. package/dist/src/ui/headless-types.js +0 -0
  133. package/dist/src/ui/headless-types.js.map +0 -0
  134. package/dist/src/ui/headless.d.ts +14 -4
  135. package/dist/src/ui/headless.d.ts.map +1 -1
  136. package/dist/src/ui/headless.js +311 -139
  137. package/dist/src/ui/headless.js.map +1 -1
  138. package/dist/src/ui/index.d.ts +0 -0
  139. package/dist/src/ui/index.d.ts.map +0 -0
  140. package/dist/src/ui/index.js +0 -0
  141. package/dist/src/ui/index.js.map +0 -0
  142. package/dist/src/ui/stream.d.ts +0 -0
  143. package/dist/src/ui/stream.d.ts.map +1 -1
  144. package/dist/src/ui/stream.js +27 -5
  145. package/dist/src/ui/stream.js.map +1 -1
  146. package/dist/src/validation/error-formatter.d.ts +21 -0
  147. package/dist/src/validation/error-formatter.d.ts.map +1 -0
  148. package/dist/src/validation/error-formatter.js +98 -0
  149. package/dist/src/validation/error-formatter.js.map +1 -0
  150. package/dist/src/validation/index.d.ts +10 -0
  151. package/dist/src/validation/index.d.ts.map +1 -0
  152. package/dist/src/validation/index.js +10 -0
  153. package/dist/src/validation/index.js.map +1 -0
  154. package/dist/src/validation/json-validator.d.ts +25 -0
  155. package/dist/src/validation/json-validator.d.ts.map +1 -0
  156. package/dist/src/validation/json-validator.js +173 -0
  157. package/dist/src/validation/json-validator.js.map +1 -0
  158. package/dist/src/validation/schema.d.ts +353 -0
  159. package/dist/src/validation/schema.d.ts.map +1 -0
  160. package/dist/src/validation/schema.js +57 -0
  161. package/dist/src/validation/schema.js.map +1 -0
  162. package/dist/src/validation/suggestions.d.ts +25 -0
  163. package/dist/src/validation/suggestions.d.ts.map +1 -0
  164. package/dist/src/validation/suggestions.js +144 -0
  165. package/dist/src/validation/suggestions.js.map +1 -0
  166. package/dist/src/validation/types.d.ts +40 -0
  167. package/dist/src/validation/types.d.ts.map +1 -0
  168. package/dist/src/validation/types.js +5 -0
  169. package/dist/src/validation/types.js.map +1 -0
  170. package/dist/src/validation/yaml-validator.d.ts +25 -0
  171. package/dist/src/validation/yaml-validator.d.ts.map +1 -0
  172. package/dist/src/validation/yaml-validator.js +177 -0
  173. package/dist/src/validation/yaml-validator.js.map +1 -0
  174. package/dist/src/version.d.ts +0 -0
  175. package/dist/src/version.d.ts.map +0 -0
  176. package/dist/src/version.js +0 -0
  177. package/dist/src/version.js.map +0 -0
  178. package/package.json +1 -1
  179. package/.claude/skills/storefront/SKILL.md +0 -532
@@ -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
@@ -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,85 @@ 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
235
+ commerce inventory history --id prod_123
276
236
  ```
277
237
 
278
- ### 批量查看库存
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
+
279
266
  ```bash
280
- # 用户说:"查看所有商品的库存情况"
281
- commerce inventory list --limit 100
267
+ # 错误:直接更新有变体产品的产品级库存
268
+ commerce inventory update --id prod_123 --quantity 30
269
+ # 这样做不会影响变体的可购买状态!
282
270
  ```
283
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
+
284
296
  ## 重要提示
285
297
 
286
298
  - 库存变更会自动记录历史
287
299
  - 预留库存不会减少可用库存数量
288
- - 更新库存时建议添加 `--reason` 说明原因
289
- - 低库存阈值可以自定义
290
- - 支持批量库存更新(通过脚本循环调用)
300
+ - 低库存阈值可自定义(默认5)
291
301
  - 使用 `--help` 查看命令详细参数
302
+ - **有变体的产品必须更新变体库存,不能直接更新产品库存**
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: markdown-pdf
3
+ description: "Markdown to PDF conversion. Use when user needs to: export documents (导出成PDF/生成PDF/转换成PDF), create reports (保存为PDF), save as PDF (Export to PDF)."
4
+ ---
5
+
6
+ # Markdown → PDF 转换
7
+
8
+ ## 标准命令格式
9
+
10
+ ```bash
11
+ md-to-pdf <input.md> \
12
+ --launch-options '{"args":["--no-sandbox","--disable-setuid-sandbox","--disable-dev-shm-usage"]}' \
13
+ --pdf-options '{"format":"A4","margin":"20mm","printBackground":true}'
14
+ ```
15
+
16
+ **关键点**:
17
+ - 输出文件默认生成为 `<input>.pdf`(与输入同名,在同一目录)
18
+ - 支持 glob 模式批量处理:`md-to-pdf ./**/*.md`
19
+ - `--launch-options` 中的参数**必须包含**(Docker 容器要求)
20
+
21
+ ## 常见场景
22
+
23
+ ### 单个文档转换
24
+
25
+ ```bash
26
+ md-to-pdf report.md \
27
+ --launch-options '{"args":["--no-sandbox","--disable-setuid-sandbox","--disable-dev-shm-usage"]}' \
28
+ --pdf-options '{"format":"A4","margin":"20mm","printBackground":true}'
29
+
30
+ # 输出:report.pdf(同目录)
31
+ ```
32
+
33
+ ### 指定输出路径(使用 stdin/stdout)
34
+
35
+ ```bash
36
+ cat document.md | md-to-pdf \
37
+ --launch-options '{"args":["--no-sandbox","--disable-setuid-sandbox","--disable-dev-shm-usage"]}' \
38
+ --pdf-options '{"format":"A4","margin":"20mm","printBackground":true}' \
39
+ > /home/aiuser/project/final.pdf
40
+ ```
41
+
42
+ ### 批量转换(使用 glob)
43
+
44
+ ```bash
45
+ # 转换当前目录所有 Markdown 文件
46
+ md-to-pdf *.md \
47
+ --launch-options '{"args":["--no-sandbox","--disable-setuid-sandbox","--disable-dev-shm-usage"]}' \
48
+ --pdf-options '{"format":"A4","margin":"20mm","printBackground":true}'
49
+
50
+ # 递归转换所有子目录的 Markdown 文件
51
+ md-to-pdf ./**/*.md \
52
+ --launch-options '{"args":["--no-sandbox","--disable-setuid-sandbox","--disable-dev-shm-usage"]}' \
53
+ --pdf-options '{"format":"A4","margin":"20mm","printBackground":true}'
54
+ ```
55
+
56
+ ## 参数选项
57
+
58
+ ### --pdf-options 常用配置
59
+
60
+ | 参数 | 可选值 | 说明 |
61
+ |------|--------|------|
62
+ | format | A4, Letter, A3, Legal | 纸张大小 |
63
+ | margin | "20mm" 或 {"top":"20mm",...} | 页边距(支持 CSS 简写或对象) |
64
+ | printBackground | true/false | 打印背景色(推荐 true) |
65
+ | landscape | true/false | 横向/纵向 |
66
+
67
+ ## 重要提示
68
+
69
+ - ⚠️ **必须使用** `--no-sandbox` 等参数(Docker 环境要求)
70
+ - ✅ 已安装中文字体(fonts-noto-cjk),支持完美渲染中文
71
+ - ✅ 已安装 Emoji 字体(fonts-noto-color-emoji)
72
+ - 📝 支持完整 Markdown 语法(表格、代码块、Emoji)
@@ -1,101 +1,104 @@
1
1
  ---
2
2
  name: merchant
3
- description: "店铺管理和信息查询。使用场景:查看店铺信息(merchant info/店铺信息/商户信息)、更新店铺配置(update merchant/更新店铺)、查看店铺设置。使用 commerce merchant 命令。"
3
+ description: "店铺基础信息管理。使用场景:查看店铺信息、更新店铺名称/描述/联系方式/发货地址。注意:运费设置用 shipping skill。"
4
4
  ---
5
5
 
6
6
  # 店铺管理
7
7
 
8
- ## 标准操作
8
+ ## 典型场景
9
9
 
10
- ### 查看店铺信息
11
- ```bash
12
- commerce merchant info
13
- ```
14
- 返回店铺的完整信息:
15
- - 店铺名称、标识、描述
16
- - 默认货币、状态
17
- - 联系信息、发货地址
18
- - 创建和更新时间
10
+ | 用户说 | 命令 |
11
+ |--------|------|
12
+ | "查看店铺信息" / "我的店铺" | `commerce merchant info` |
13
+ | "修改店铺名称" / "更新店铺描述" | `commerce merchant update --name/--description` |
14
+ | "设置联系方式" | `commerce merchant update --contact-*` |
15
+ | "更新发货地址" | `commerce merchant update --origin-*` |
19
16
 
20
- ### 更新店铺信息
21
- ```bash
22
- commerce merchant update --name "新店铺名" --description "描述" --currency USD
23
- ```
17
+ ## 不在此模块(重要)
18
+
19
+ | 用户说 | 正确位置 |
20
+ |--------|----------|
21
+ | "运费设置" / "运费模式" / "运费区域" | **shipping skill**:`commerce shipping get-mode` |
22
+ | "Easyship" / "快递公司" | **shipping skill**:`commerce easyship couriers` |
23
+ | "Stripe/支付设置" | `commerce stripe status` |
24
+ | "首页设置" | **homepage skill** |
24
25
 
25
- 可更新的字段:
26
- - `--name`: 店铺名称
27
- - `--slug`: 店铺标识(URL 友好)
28
- - `--description`: 店铺描述
29
- - `--currency`: 默认货币(USD, CNY, EUR 等)
30
- - `--contact-name`: 联系人姓名
31
- - `--contact-phone`: 联系电话
32
- - `--contact-email`: 联系邮箱
33
- - `--company`: 公司名称
34
- - `--address-*`: 发货地址字段
26
+ ---
35
27
 
36
- ## 完整命令列表
28
+ ## 查看店铺信息
37
29
 
38
30
  ```bash
39
- # 查看店铺信息
40
31
  commerce merchant info
32
+ ```
41
33
 
42
- # 更新基本信息
43
- commerce merchant update --name "我的店铺" --description "这是一个很棒的店铺"
44
-
45
- # 更新联系信息
46
- commerce merchant update --contact-name "张三" --contact-phone "1234567890" --contact-email "contact@example.com"
47
-
48
- # 更新发货地址
49
- commerce merchant update --address-country "CN" --address-city "深圳" --address-postal-code "518000"
34
+ 返回:店铺名称、描述、Logo、货币、联系信息、发货地址
50
35
 
51
- # 更新多个字段
52
- commerce merchant update --name "新店铺" --currency "CNY" --company "我的公司"
53
- ```
36
+ **注意**:此命令不返回运费设置,运费相关请用 `commerce shipping get-mode`
54
37
 
55
- ## 工作流示例
38
+ ---
56
39
 
57
- ### 示例 1:查看店铺基本信息
58
- 用户:"查看我的店铺信息"
40
+ ## 更新店铺信息
59
41
 
60
42
  ```bash
61
- commerce merchant info
43
+ commerce merchant update [选项]
62
44
  ```
63
45
 
64
- 展示表格格式的店铺信息,包括:
65
- - 店铺名称、标识、描述
66
- - 货币、状态、创建时间
67
- - 联系信息(如有)
68
- - 发货地址(如有)
46
+ ### 基础信息
47
+ | 选项 | 说明 |
48
+ |------|------|
49
+ | `--name` | 店铺名称 |
50
+ | `--slug` | 店铺标识(影响 URL) |
51
+ | `--description` | 店铺描述 |
52
+ | `--default-currency` | 默认货币(USD, CNY 等) |
53
+
54
+ ### 联系方式
55
+ | 选项 | 说明 |
56
+ |------|------|
57
+ | `--contact-name` | 联系人 |
58
+ | `--contact-phone` | 联系电话 |
59
+ | `--contact-email` | 联系邮箱 |
60
+ | `--company-name` | 公司名称 |
61
+
62
+ ### 发货地址
63
+ | 选项 | 说明 |
64
+ |------|------|
65
+ | `--origin-country-alpha2` | 国家代码(CN, US 等) |
66
+ | `--origin-city` | 城市 |
67
+ | `--origin-postal-code` | 邮编 |
68
+ | `--origin-line-1` | 地址行1 |
69
+ | `--origin-line-2` | 地址行2 |
70
+ | `--origin-state` | 省/州 |
71
+
72
+ ---
69
73
 
70
- ### 示例 2:完善店铺信息
71
- 用户:"帮我设置店铺的联系方式和地址"
74
+ ## 示例
72
75
 
73
76
  ```bash
77
+ # 更新名称和描述
78
+ commerce merchant update --name "我的小店" --description "精选好物"
79
+
80
+ # 更新联系方式
74
81
  commerce merchant update \
75
82
  --contact-name "张三" \
76
83
  --contact-phone "13800138000" \
77
- --contact-email "shop@example.com" \
78
- --address-country "CN" \
79
- --address-city "深圳" \
80
- --address-postal-code "518000"
81
- ```
84
+ --contact-email "shop@example.com"
82
85
 
83
- ### 示例 3:修改店铺名称
84
- 用户:"把店铺名改成'全球精品小店'"
85
-
86
- ```bash
87
- commerce merchant update --name "全球精品小店"
86
+ # 更新发货地址
87
+ commerce merchant update \
88
+ --origin-country-alpha2 CN \
89
+ --origin-city 深圳 \
90
+ --origin-postal-code 518000 \
91
+ --origin-line-1 "科技园路1号" \
92
+ --origin-state 广东
88
93
  ```
89
94
 
90
- ## 注意事项
95
+ ---
96
+
97
+ ## 命令参考
91
98
 
92
- - 店铺标识(slug)修改后会影响店铺 URL
93
- - 货币修改不会影响已创建的商品价格
94
- - 联系信息和发货地址建议完整填写
95
- - 更新后建议用 `commerce merchant info` 验证
99
+ - `commerce merchant info` - 查看店铺信息
100
+ - `commerce merchant update` - 更新店铺信息
96
101
 
97
- ## 相关命令
102
+ ## 不确定用什么命令?
98
103
 
99
- - 查看商品:`commerce product list`
100
- - 查看订单:`commerce order list`
101
- - 查看集合:`commerce collection list`
104
+ 运行 `commerce --help` 查看所有模块,或 `commerce merchant --help` 查看子命令。