@optima-chat/optima-agent 0.1.0

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 (84) hide show
  1. package/.claude/settings.local.json +13 -0
  2. package/.claude/skills/bi-cli/SKILL.md +87 -0
  3. package/.claude/skills/comfy-cli/SKILL.md +234 -0
  4. package/.claude/skills/commerce-i18n/SKILL.md +460 -0
  5. package/.claude/skills/commerce-inventory/SKILL.md +291 -0
  6. package/.claude/skills/commerce-order/SKILL.md +201 -0
  7. package/.claude/skills/commerce-product/SKILL.md +307 -0
  8. package/.claude/skills/commerce-storefront/SKILL.md +560 -0
  9. package/.claude/skills/google-ads-cli/SKILL.md +101 -0
  10. package/.claude/skills/optima-scout/SKILL.md +480 -0
  11. package/README.md +66 -0
  12. package/dist/bin/optima.d.ts +3 -0
  13. package/dist/bin/optima.d.ts.map +1 -0
  14. package/dist/bin/optima.js +115 -0
  15. package/dist/bin/optima.js.map +1 -0
  16. package/dist/bin/serve.d.ts +3 -0
  17. package/dist/bin/serve.d.ts.map +1 -0
  18. package/dist/bin/serve.js +53 -0
  19. package/dist/bin/serve.js.map +1 -0
  20. package/dist/src/agent.d.ts +24 -0
  21. package/dist/src/agent.d.ts.map +1 -0
  22. package/dist/src/agent.js +97 -0
  23. package/dist/src/agent.js.map +1 -0
  24. package/dist/src/config.d.ts +22 -0
  25. package/dist/src/config.d.ts.map +1 -0
  26. package/dist/src/config.js +60 -0
  27. package/dist/src/config.js.map +1 -0
  28. package/dist/src/index.d.ts +3 -0
  29. package/dist/src/index.d.ts.map +1 -0
  30. package/dist/src/index.js +2 -0
  31. package/dist/src/index.js.map +1 -0
  32. package/dist/src/server/index.d.ts +4 -0
  33. package/dist/src/server/index.d.ts.map +1 -0
  34. package/dist/src/server/index.js +150 -0
  35. package/dist/src/server/index.js.map +1 -0
  36. package/dist/src/server/types.d.ts +60 -0
  37. package/dist/src/server/types.d.ts.map +1 -0
  38. package/dist/src/server/types.js +2 -0
  39. package/dist/src/server/types.js.map +1 -0
  40. package/dist/src/system-prompt.d.ts +2 -0
  41. package/dist/src/system-prompt.d.ts.map +1 -0
  42. package/dist/src/system-prompt.js +71 -0
  43. package/dist/src/system-prompt.js.map +1 -0
  44. package/dist/src/types.d.ts +37 -0
  45. package/dist/src/types.d.ts.map +1 -0
  46. package/dist/src/types.js +2 -0
  47. package/dist/src/types.js.map +1 -0
  48. package/dist/src/ui/App.d.ts +6 -0
  49. package/dist/src/ui/App.d.ts.map +1 -0
  50. package/dist/src/ui/App.js +139 -0
  51. package/dist/src/ui/App.js.map +1 -0
  52. package/dist/src/ui/components/Composer.d.ts +9 -0
  53. package/dist/src/ui/components/Composer.d.ts.map +1 -0
  54. package/dist/src/ui/components/Composer.js +12 -0
  55. package/dist/src/ui/components/Composer.js.map +1 -0
  56. package/dist/src/ui/components/Header.d.ts +6 -0
  57. package/dist/src/ui/components/Header.d.ts.map +1 -0
  58. package/dist/src/ui/components/Header.js +6 -0
  59. package/dist/src/ui/components/Header.js.map +1 -0
  60. package/dist/src/ui/components/Message.d.ts +11 -0
  61. package/dist/src/ui/components/Message.d.ts.map +1 -0
  62. package/dist/src/ui/components/Message.js +17 -0
  63. package/dist/src/ui/components/Message.js.map +1 -0
  64. package/dist/src/ui/components/MessageList.d.ts +7 -0
  65. package/dist/src/ui/components/MessageList.d.ts.map +1 -0
  66. package/dist/src/ui/components/MessageList.js +7 -0
  67. package/dist/src/ui/components/MessageList.js.map +1 -0
  68. package/dist/src/ui/components/Spinner.d.ts +6 -0
  69. package/dist/src/ui/components/Spinner.d.ts.map +1 -0
  70. package/dist/src/ui/components/Spinner.js +7 -0
  71. package/dist/src/ui/components/Spinner.js.map +1 -0
  72. package/dist/src/ui/components/StatusBar.d.ts +10 -0
  73. package/dist/src/ui/components/StatusBar.d.ts.map +1 -0
  74. package/dist/src/ui/components/StatusBar.js +6 -0
  75. package/dist/src/ui/components/StatusBar.js.map +1 -0
  76. package/dist/src/ui/components/index.d.ts +7 -0
  77. package/dist/src/ui/components/index.d.ts.map +1 -0
  78. package/dist/src/ui/components/index.js +7 -0
  79. package/dist/src/ui/components/index.js.map +1 -0
  80. package/dist/src/ui/index.d.ts +2 -0
  81. package/dist/src/ui/index.d.ts.map +1 -0
  82. package/dist/src/ui/index.js +7 -0
  83. package/dist/src/ui/index.js.map +1 -0
  84. package/package.json +59 -0
@@ -0,0 +1,560 @@
1
+ ---
2
+ name: commerce-storefront
3
+ description: Storefront and product page configuration. Manage homepage sections, product collections, merchant profile, product detail page sections with 3-layer inheritance (System → Merchant → Product). Use when user needs to configure homepage, create collections, customize product page sections, or organize storefront layout.
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
+ | 创建促销集合 | `collection create --slug sale` | slug 简短有意义,添加10-30个商品 |
19
+ | 调整模块顺序 | `homepage module reorder --position X` | 重要模块靠前(轮播图position=1) |
20
+ | 更新店铺信息 | `merchant update --name/description` | 名称简洁,描述突出差异化优势 |
21
+
22
+ ### 场景 1:首页配置
23
+
24
+ **标准首页布局**(position顺序):
25
+ 1. **轮播图** (position=1) - 展示促销、新品、品牌故事
26
+ 2. **分类导航** (position=2) - 快速引导到商品分类
27
+ 3. **精选商品** (position=3) - 展示高转化或高利润商品
28
+ 4. **热门集合** (position=4) - 展示2-3个核心集合
29
+ 5. **品牌故事** (position=5) - 建立信任和品牌认知
30
+
31
+ **标准流程**:
32
+ 1. **规划布局** - 确定首页模块顺序(轮播图 → 分类 → 精选商品 → 集合)
33
+ 2. **创建模块** - 依次 `commerce homepage module create` 创建各模块
34
+ 3. **配置顺序** - 使用 position 1, 2, 3... 排序
35
+ 4. **设置参数** - `commerce homepage settings update` 配置搜索、精选数量
36
+ 5. **验证效果** - `commerce homepage module list` 检查配置
37
+ 6. **定期优化** - 根据数据调整模块顺序和内容
38
+
39
+ ### 场景 2:创建轮播图
40
+
41
+ **配置要点**:
42
+ - 图片尺寸:1920x600px(桌面端)
43
+ - 数量限制:≤ 5张(避免影响加载速度)
44
+ - 格式支持:WebP(优先)、JPG、PNG
45
+ - 跳转链接:配置促销页面或集合页面
46
+ - 懒加载:启用图片懒加载优化性能
47
+
48
+ ```bash
49
+ commerce homepage module create \
50
+ --slug hero-banner \
51
+ --type banner \
52
+ --position 1 \
53
+ --enabled true \
54
+ --config '{"images":[{"url":"https://example.com/banner1.jpg","link":"/collections/summer-sale"}]}'
55
+ ```
56
+
57
+ ### 场景 3:创建商品集合
58
+
59
+ **推荐集合类型**:
60
+ - **时令集合** - 春夏秋冬、节日促销(如"Christmas Sale")
61
+ - **品类集合** - 按商品类型分组(如"T-Shirts", "Dresses")
62
+ - **主题集合** - 按场景分组(如"Office Wear", "Casual Style")
63
+ - **促销集合** - 新品、热卖、折扣(如"New Arrivals", "Best Sellers")
64
+
65
+ **创建流程**:
66
+ ```bash
67
+ # 1. 创建集合
68
+ commerce collection create \
69
+ --name "Summer Sale 2024" \
70
+ --slug "summer-sale-2024" \
71
+ --description "Hot deals for summer"
72
+
73
+ # 2. 添加商品到集合
74
+ commerce collection add-products \
75
+ --slug summer-sale-2024 \
76
+ --product-ids prod_123,prod_456,prod_789
77
+ ```
78
+
79
+ ### 场景 4:调整模块顺序
80
+
81
+ **重新排序原则**:
82
+ - 重要模块靠前(轮播图 position=1)
83
+ - 高转化模块优先级高
84
+ - 移动端体验优先
85
+ - 定期根据数据优化
86
+
87
+ ```bash
88
+ # 调整精选商品模块到第2位
89
+ commerce homepage module reorder \
90
+ --module-id module_123 \
91
+ --position 2
92
+ ```
93
+
94
+ ### 场景 5:优化转化率
95
+
96
+ **数据驱动优化**:
97
+ - 分析首页点击热图,调整模块顺序
98
+ - A/B测试不同轮播图和精选商品
99
+ - 根据转化率隐藏低效集合
100
+ - 精选商品选择高利润或高评分商品
101
+
102
+ **性能优化建议**:
103
+ - 轮播图:懒加载,压缩图片,支持WebP格式
104
+ - 精选商品:限制8-12个,缓存1小时
105
+ - 集合:按点击率排序,隐藏低转化集合
106
+
107
+ ### 场景 6:店铺信息维护
108
+
109
+ **更新要点**:
110
+ - 店铺名称:简洁有辨识度
111
+ - 描述:突出差异化优势和核心品类
112
+ - Logo:清晰、支持透明背景
113
+ - 联系方式:完整准确
114
+
115
+ ```bash
116
+ commerce merchant update \
117
+ --name "My Fashion Store" \
118
+ --description "Premium fashion for everyone" \
119
+ --logo-url "https://example.com/logo.png"
120
+ ```
121
+
122
+ ## 卓越标准
123
+
124
+ ### 店铺配置质量指标
125
+ - **页面加载速度**: 首页加载 < 3秒,移动端 < 5秒
126
+ - **视觉设计**: 轮播图尺寸统一(1920x600px),图片清晰无水印
127
+ - **导航体验**: 分类层级 ≤ 3层,集合数量 5-15个最佳
128
+ - **内容更新频率**: 轮播图每周更新,精选商品每3天更新
129
+ - **转化率**: 首页访客转化率 > 3%,集合页转化率 > 5%
130
+
131
+ ### 店铺配置原则
132
+ - **移动优先**: 所有配置考虑移动端体验,图片支持响应式
133
+ - **性能优化**: 轮播图 ≤ 5张,精选商品 ≤ 12个,减少加载负担
134
+ - **SEO友好**: 集合slug使用英文,标题包含关键词
135
+ - **一致性**: 风格统一(色彩、字体、间距),提升品牌辨识度
136
+ - **数据驱动**: 根据点击率和转化率优化首页布局和集合内容
137
+
138
+ ### 首页配置检查清单
139
+
140
+ **上线前必查**:
141
+ - [ ] 轮播图尺寸统一,图片清晰
142
+ - [ ] 所有链接可点击,无404
143
+ - [ ] 移动端显示正常
144
+ - [ ] 加载速度 < 3秒
145
+ - [ ] SEO信息完整(标题、描述、关键词)
146
+ - [ ] 精选商品有库存
147
+ - [ ] 集合至少包含5个商品
148
+ - [ ] 店铺信息准确(名称、Logo、联系方式)
149
+
150
+ ## 常见问题
151
+
152
+ ### ❌ 问题 1:集合命名随意,无规划
153
+
154
+ **错误做法**:
155
+ ```bash
156
+ # 命名不规范,slug 无意义
157
+ commerce collection create --name "aaa" --slug "test123"
158
+ commerce collection create --name "商品111" --slug "product-collection"
159
+ commerce collection create --name "Sale!!!" --slug "promotion"
160
+ ```
161
+
162
+ **✅ 正确做法**:
163
+ ```bash
164
+ # 命名清晰,slug 符合 SEO 规范
165
+ commerce collection create --name "Summer Sale 2024" --slug "summer-sale-2024"
166
+ commerce collection create --name "Men's T-Shirts" --slug "mens-tshirts"
167
+ commerce collection create --name "New Arrivals" --slug "new-arrivals"
168
+ ```
169
+
170
+ ### ❌ 问题 2:轮播图过多影响性能
171
+
172
+ **错误做法**:
173
+ ```bash
174
+ # 创建10张轮播图,导致首页加载缓慢
175
+ commerce homepage module create --type banner --config '{"images":[...10张图片...]}'
176
+ ```
177
+
178
+ **✅ 正确做法**:
179
+ ```bash
180
+ # 限制≤5张,压缩图片,启用懒加载
181
+ commerce homepage module create --type banner --config '{"images":[...3-5张图片...]}'
182
+ ```
183
+
184
+ ### ❌ 问题 3:精选商品数量过多
185
+
186
+ **错误做法**:
187
+ ```bash
188
+ # 显示30个精选商品,影响用户决策
189
+ commerce homepage settings update --featured-limit 30
190
+ ```
191
+
192
+ **✅ 正确做法**:
193
+ ```bash
194
+ # 限制8-12个,选择高转化商品
195
+ commerce homepage settings update --featured-limit 10
196
+ ```
197
+
198
+ ### ❌ 问题 4:集合缺少商品
199
+
200
+ **错误做法**:
201
+ ```bash
202
+ # 创建集合后忘记添加商品
203
+ commerce collection create --name "New Arrivals" --slug "new-arrivals"
204
+ # 集合页面显示空白
205
+ ```
206
+
207
+ **✅ 正确做法**:
208
+ ```bash
209
+ # 创建集合后立即添加商品(至少5个)
210
+ commerce collection create --name "New Arrivals" --slug "new-arrivals"
211
+ commerce collection add-products --slug new-arrivals --product-ids prod_1,prod_2,prod_3,prod_4,prod_5
212
+ ```
213
+
214
+ ### ❌ 问题 5:首页模块顺序混乱
215
+
216
+ **错误做法**:
217
+ ```bash
218
+ # position 随意设置,导致布局混乱
219
+ commerce homepage module create --type banner --position 10
220
+ commerce homepage module create --type featured --position 2
221
+ commerce homepage module create --type categories --position 50
222
+ ```
223
+
224
+ **✅ 正确做法**:
225
+ ```bash
226
+ # 按重要性依次设置 position 1, 2, 3...
227
+ commerce homepage module create --type banner --position 1
228
+ commerce homepage module create --type categories --position 2
229
+ commerce homepage module create --type featured --position 3
230
+ ```
231
+
232
+ ### ❌ 问题 6:slug 使用中文或特殊字符
233
+
234
+ **错误做法**:
235
+ ```bash
236
+ # slug 包含中文或特殊字符,影响 SEO 和 URL 可读性
237
+ commerce collection create --name "夏季促销" --slug "夏季促销"
238
+ commerce collection create --name "Sale!!!" --slug "sale!!!"
239
+ ```
240
+
241
+ **✅ 正确做法**:
242
+ ```bash
243
+ # slug 使用英文、数字、连字符
244
+ commerce collection create --name "夏季促销" --slug "summer-sale"
245
+ commerce collection create --name "Sale!!!" --slug "sale"
246
+ ```
247
+
248
+ ## 命令参考
249
+
250
+ ### 自然语言映射
251
+
252
+ 当用户说:
253
+ - "创建首页轮播图" → `commerce homepage module create --type banner ...`
254
+ - "更新首页设置" → `commerce homepage settings update --show-search true`
255
+ - "创建商品集合" → `commerce collection create --name XX --slug YY`
256
+ - "把商品添加到集合" → `commerce collection add-products --id XX --product-ids YY`
257
+ - "更新店铺信息" → `commerce merchant update --name XX`
258
+
259
+ ### 核心功能
260
+
261
+ **首页模块管理**:
262
+ - `commerce homepage module create` - 创建首页模块
263
+ - `commerce homepage module list` - 查看所有模块
264
+ - `commerce homepage module update` - 更新模块
265
+ - `commerce homepage module delete` - 删除模块
266
+ - `commerce homepage module reorder` - 重新排序
267
+
268
+ **首页设置**:
269
+ - `commerce homepage settings get` - 查看首页设置
270
+ - `commerce homepage settings update` - 更新首页设置
271
+
272
+ **商品集合**:
273
+ - `commerce collection create` - 创建集合
274
+ - `commerce collection list` - 查看集合列表
275
+ - `commerce collection update` - 更新集合
276
+ - `commerce collection delete` - 删除集合
277
+ - `commerce collection add-products` - 添加商品到集合
278
+ - `commerce collection remove-products` - 从集合移除商品
279
+
280
+ **商户信息**:
281
+ - `commerce merchant info` - 查看商户信息
282
+ - `commerce merchant update` - 更新商户信息
283
+ - `commerce merchant init` - 初始化商户设置
284
+
285
+ ## 详细示例
286
+
287
+ ### 创建首页轮播图
288
+ ```bash
289
+ # 用户说:"创建首页轮播图模块"
290
+ commerce homepage module create \
291
+ --slug hero-banner \
292
+ --type banner \
293
+ --position 1 \
294
+ --enabled true \
295
+ --config '{"images":[{"url":"https://example.com/banner1.jpg"}]}'
296
+ ```
297
+
298
+ ### 更新首页设置
299
+ ```bash
300
+ # 用户说:"启用首页搜索功能,显示8个精选商品"
301
+ commerce homepage settings update \
302
+ --show-search true \
303
+ --featured-limit 8
304
+ ```
305
+
306
+ ### 创建商品集合
307
+ ```bash
308
+ # 用户说:"创建夏季促销集合"
309
+ commerce collection create \
310
+ --name "Summer Sale" \
311
+ --slug summer-sale \
312
+ --description "Hot deals for summer"
313
+ ```
314
+
315
+ ### 添加商品到集合
316
+ ```bash
317
+ # 用户说:"把商品prod_123和prod_456添加到summer-sale集合"
318
+ commerce collection add-products \
319
+ --slug summer-sale \
320
+ --product-ids prod_123,prod_456
321
+ ```
322
+
323
+ ### 更新商户信息
324
+ ```bash
325
+ # 用户说:"更新店铺名称和描述"
326
+ commerce merchant update \
327
+ --name "My Fashion Store" \
328
+ --description "Premium fashion for everyone"
329
+ ```
330
+
331
+ ### 重新排序首页模块
332
+ ```bash
333
+ # 用户说:"调整首页模块顺序"
334
+ commerce homepage module reorder \
335
+ --module-id module_123 \
336
+ --position 2
337
+ ```
338
+
339
+ ### 完整首页配置示例
340
+ ```bash
341
+ # 1. 创建轮播图模块
342
+ commerce homepage module create \
343
+ --slug hero-banner \
344
+ --type banner \
345
+ --position 1 \
346
+ --config '{"images":[{"url":"https://example.com/banner1.jpg","link":"/collections/summer-sale"},{"url":"https://example.com/banner2.jpg","link":"/collections/new-arrivals"}]}'
347
+
348
+ # 2. 创建分类导航模块
349
+ commerce homepage module create \
350
+ --slug category-nav \
351
+ --type categories \
352
+ --position 2 \
353
+ --config '{"columns":4}'
354
+
355
+ # 3. 创建精选商品模块
356
+ commerce homepage module create \
357
+ --slug featured-products \
358
+ --type featured \
359
+ --position 3 \
360
+ --config '{"limit":10}'
361
+
362
+ # 4. 更新首页设置
363
+ commerce homepage settings update \
364
+ --show-search true \
365
+ --featured-limit 10
366
+
367
+ # 5. 验证配置
368
+ commerce homepage module list
369
+ ```
370
+
371
+ ## 场景 7:商品详情页区块管理
372
+
373
+ ### 三层继承模型
374
+
375
+ 商品详情页区块采用三层继承架构,实现灵活的内容定制:
376
+
377
+ ```
378
+ ┌─────────────────────────────────────────────────────────┐
379
+ │ System Layer (系统默认) │
380
+ │ - 7个预设区块: highlights, details, guarantee, │
381
+ │ care, shipping-policies, return, eco-friendly │
382
+ │ - 支持7种语言的默认翻译 │
383
+ │ - 不可删除,只能覆盖或隐藏 │
384
+ └─────────────────────────────────────────────────────────┘
385
+ ↓ 继承
386
+ ┌─────────────────────────────────────────────────────────┐
387
+ │ Merchant Layer (商户定制) │
388
+ │ - 覆盖系统默认区块内容 │
389
+ │ - 创建商户专属新区块 │
390
+ │ - 隐藏不需要的系统区块 │
391
+ │ - 适用于所有商品(除非商品级覆盖) │
392
+ └─────────────────────────────────────────────────────────┘
393
+ ↓ 继承
394
+ ┌─────────────────────────────────────────────────────────┐
395
+ │ Product Layer (商品定制) │
396
+ │ - 覆盖商户/系统区块内容 │
397
+ │ - 创建商品专属区块 │
398
+ │ - 隐藏特定商品不需要的区块 │
399
+ │ - 最高优先级,仅影响单个商品 │
400
+ └─────────────────────────────────────────────────────────┘
401
+ ```
402
+
403
+ ### 查看区块配置
404
+
405
+ ```bash
406
+ # 查看商户级配置(推荐使用 --resolved 查看完整视图)
407
+ commerce section list --resolved
408
+
409
+ # 查看特定商品的区块配置
410
+ commerce section product list prod-123 --resolved
411
+ ```
412
+
413
+ **关键字段说明**:
414
+ - `source`: 区块来源 (system/merchant/product)
415
+ - `is_hidden`: 是否被隐藏
416
+ - `translations`: 各语言的标题和内容
417
+
418
+ ### 覆盖系统默认区块
419
+
420
+ ```bash
421
+ # 商户级:覆盖所有商品的"护理说明"
422
+ commerce section create \
423
+ --handle care \
424
+ --operation-type override \
425
+ --type collapsible \
426
+ --position 4 \
427
+ --content "我们的产品均可机洗,30度冷水。"
428
+
429
+ # 商品级:为特定商品定制"护理说明"
430
+ commerce section product create prod-123 \
431
+ --handle care \
432
+ --operation-type override \
433
+ --type collapsible \
434
+ --position 4 \
435
+ --content "此款真丝产品需要干洗。"
436
+ ```
437
+
438
+ ### 创建自定义区块
439
+
440
+ ```bash
441
+ # 商户级:创建"品牌故事"区块(所有商品显示)
442
+ commerce section create \
443
+ --handle brand-story \
444
+ --operation-type new \
445
+ --type collapsible \
446
+ --position 8 \
447
+ --content "## 我们的故事\n\n创立于2020年..."
448
+
449
+ # 商品级:创建"成分说明"区块(仅此商品显示)
450
+ commerce section product create prod-123 \
451
+ --handle ingredients \
452
+ --operation-type new \
453
+ --type collapsible \
454
+ --position 5 \
455
+ --content "主要成分:有机棉100%"
456
+ ```
457
+
458
+ ### 隐藏不需要的区块
459
+
460
+ ```bash
461
+ # 商户级:隐藏"环保包装"区块(所有商品不显示)
462
+ commerce section hide eco-friendly
463
+
464
+ # 商品级:隐藏特定商品的"退货政策"
465
+ commerce section product hide prod-123 return
466
+ ```
467
+
468
+ ### 添加多语言翻译
469
+
470
+ ```bash
471
+ # 为商户级区块添加中文翻译
472
+ commerce section translation set care \
473
+ --lang zh-CN \
474
+ --title "护理说明" \
475
+ --content "机洗,30度冷水。"
476
+
477
+ # 为商品级区块添加日文翻译
478
+ commerce section translation set care \
479
+ --product-id prod-123 \
480
+ --lang ja-JP \
481
+ --title "お手入れ方法" \
482
+ --content "洗濯機で洗えます。水温30度。"
483
+ ```
484
+
485
+ ### 调整区块顺序
486
+
487
+ ```bash
488
+ # 商户级排序
489
+ commerce section reorder --sections '[
490
+ {"handle":"highlights","position":1},
491
+ {"handle":"details","position":2},
492
+ {"handle":"care","position":3}
493
+ ]'
494
+
495
+ # 商品级排序
496
+ commerce section product reorder prod-123 --sections '[...]'
497
+ ```
498
+
499
+ ### Section 常见问题
500
+
501
+ #### ❌ 问题:不理解三层继承,直接在商品级创建
502
+
503
+ **错误做法**:
504
+ ```bash
505
+ # 想要所有商品都显示"品牌故事",却在商品级创建
506
+ commerce section product create prod-123 --handle brand-story ...
507
+ commerce section product create prod-456 --handle brand-story ... # 重复操作
508
+ ```
509
+
510
+ **✅ 正确做法**:
511
+ ```bash
512
+ # 在商户级创建,自动应用到所有商品
513
+ commerce section create --handle brand-story --operation-type new ...
514
+ ```
515
+
516
+ #### ❌ 问题:不使用 --resolved 查看配置
517
+
518
+ **错误做法**:
519
+ ```bash
520
+ # 只看商户自定义,看不到系统默认
521
+ commerce section list
522
+ # 返回空列表(新商户通常没有自定义)
523
+ ```
524
+
525
+ **✅ 正确做法**:
526
+ ```bash
527
+ # 使用 --resolved 查看完整的合并后视图
528
+ commerce section list --resolved
529
+ # 返回 System + Merchant 合并后的所有区块
530
+ ```
531
+
532
+ ### Section 自然语言映射
533
+
534
+ 当用户说:
535
+ - "查看商品详情页区块" → `commerce section list --resolved`
536
+ - "查看商品X的区块配置" → `commerce section product list <id> --resolved`
537
+ - "修改护理说明" → `commerce section create --handle care --operation-type override ...`
538
+ - "隐藏退货政策区块" → `commerce section hide return`
539
+ - "为商品添加自定义区块" → `commerce section product create <id> --handle XX --operation-type new ...`
540
+ - "添加区块的中文翻译" → `commerce section translation set <handle> --lang zh-CN ...`
541
+
542
+ ## 重要提示
543
+
544
+ ### 首页配置
545
+ - 首页模块支持类型:banner(轮播图)、featured(精选商品)、categories(分类)
546
+ - 集合 slug 必须唯一,用于 URL
547
+ - 模块的 position 决定显示顺序(从小到大)
548
+ - config 字段使用 JSON 格式
549
+ - 集合可以手动管理商品,也可以设置自动规则
550
+
551
+ ### 商品页区块
552
+ - 系统默认区块:highlights, details, guarantee, care, shipping-policies, return, eco-friendly
553
+ - `--resolved` 查看完整合并视图(推荐)
554
+ - `source` 字段标识来源:system | merchant | product
555
+ - 想改所有商品用 `section create`,只改一个商品用 `section product create`
556
+
557
+ ### 通用
558
+ - 使用 `--help` 查看命令详细参数
559
+ - 所有配置创建后需要验证是否正确
560
+ - 定期根据数据分析优化布局和内容
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: google-ads-cli
3
+ description: Google Ads 广告投放管理。创建广告系列、广告组、关键词,查看广告效果数据。当用户需要投放广告、管理 Google Ads、分析广告效果时使用此技能。
4
+ ---
5
+
6
+ # Google Ads CLI 使用指南
7
+
8
+ ## 前置条件
9
+
10
+ ```bash
11
+ npm install -g @optima-chat/google-ads-cli@latest
12
+ google-ads auth login
13
+ ```
14
+
15
+ ## 核心命令
16
+
17
+ ### 账号管理
18
+
19
+ ```bash
20
+ # 创建账号
21
+ google-ads account create --email your@gmail.com --name "公司名称"
22
+
23
+ # 验证账号
24
+ google-ads account check
25
+
26
+ # 查看配置
27
+ google-ads config show
28
+ ```
29
+
30
+ ### 广告系列
31
+
32
+ ```bash
33
+ # 列出广告系列
34
+ google-ads campaign list
35
+
36
+ # 创建广告系列
37
+ google-ads campaign create -n "广告系列名称" -b 50
38
+
39
+ # 查看广告系列详情
40
+ google-ads campaign get <campaign-id>
41
+
42
+ # 暂停/启用广告系列
43
+ google-ads campaign pause <campaign-id>
44
+ google-ads campaign enable <campaign-id>
45
+ ```
46
+
47
+ ### 广告组
48
+
49
+ ```bash
50
+ # 列出广告组
51
+ google-ads adgroup list --campaign-id <campaign-id>
52
+
53
+ # 创建广告组
54
+ google-ads adgroup create --campaign-id <campaign-id> -n "广告组名称"
55
+ ```
56
+
57
+ ### 关键词
58
+
59
+ ```bash
60
+ # 列出关键词
61
+ google-ads keyword list
62
+
63
+ # 添加关键词
64
+ google-ads keyword add --adgroup-id <adgroup-id> -k "关键词1,关键词2"
65
+ ```
66
+
67
+ ### 效果分析
68
+
69
+ ```bash
70
+ # GAQL 查询
71
+ google-ads query -q "SELECT campaign.id, campaign.name, metrics.impressions FROM campaign" --pretty
72
+
73
+ # 查看效果报告
74
+ google-ads report --campaign-id <campaign-id> --days 7
75
+ ```
76
+
77
+ ## 典型流程
78
+
79
+ ### 创建新广告
80
+
81
+ ```bash
82
+ # 1. 创建广告系列
83
+ google-ads campaign create -n "产品推广" -b 100
84
+ # 获得 campaign_id
85
+
86
+ # 2. 创建广告组
87
+ google-ads adgroup create --campaign-id <campaign-id> -n "核心关键词组"
88
+ # 获得 adgroup_id
89
+
90
+ # 3. 添加关键词
91
+ google-ads keyword add --adgroup-id <adgroup-id> -k "产品名称,品牌词,行业词"
92
+
93
+ # 4. 验证
94
+ google-ads campaign list
95
+ ```
96
+
97
+ ## 注意事项
98
+
99
+ - 所有命令默认 JSON 输出
100
+ - 预算单位为美元
101
+ - 新账号需要先设置账单信息才能投放广告