@optima-chat/optima-agent 0.8.40 → 0.8.43

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 (77) hide show
  1. package/.claude/skills/homepage/SKILL.md +102 -330
  2. package/dist/bin/bi-cli.js +0 -0
  3. package/dist/bin/commerce.js +0 -0
  4. package/dist/bin/google-ads.js +0 -0
  5. package/dist/bin/optima.js +0 -0
  6. package/dist/bin/scout.js +0 -0
  7. package/dist/src/agent.d.ts +1 -1
  8. package/package.json +1 -1
  9. package/.claude/settings.local.json +0 -154
  10. package/dist/bin/comfy.d.ts +0 -3
  11. package/dist/bin/comfy.d.ts.map +0 -1
  12. package/dist/bin/comfy.js +0 -3
  13. package/dist/bin/comfy.js.map +0 -1
  14. package/dist/src/hooks-loader.d.ts +0 -6
  15. package/dist/src/hooks-loader.d.ts.map +0 -1
  16. package/dist/src/hooks-loader.js +0 -215
  17. package/dist/src/hooks-loader.js.map +0 -1
  18. package/dist/src/ui/App.d.ts +0 -6
  19. package/dist/src/ui/App.d.ts.map +0 -1
  20. package/dist/src/ui/App.js +0 -164
  21. package/dist/src/ui/App.js.map +0 -1
  22. package/dist/src/ui/components/Composer.d.ts +0 -10
  23. package/dist/src/ui/components/Composer.d.ts.map +0 -1
  24. package/dist/src/ui/components/Composer.js +0 -13
  25. package/dist/src/ui/components/Composer.js.map +0 -1
  26. package/dist/src/ui/components/Header.d.ts +0 -7
  27. package/dist/src/ui/components/Header.d.ts.map +0 -1
  28. package/dist/src/ui/components/Header.js +0 -7
  29. package/dist/src/ui/components/Header.js.map +0 -1
  30. package/dist/src/ui/components/Message.d.ts +0 -12
  31. package/dist/src/ui/components/Message.d.ts.map +0 -1
  32. package/dist/src/ui/components/Message.js +0 -21
  33. package/dist/src/ui/components/Message.js.map +0 -1
  34. package/dist/src/ui/components/MessageList.d.ts +0 -9
  35. package/dist/src/ui/components/MessageList.d.ts.map +0 -1
  36. package/dist/src/ui/components/MessageList.js +0 -18
  37. package/dist/src/ui/components/MessageList.js.map +0 -1
  38. package/dist/src/ui/components/Spinner.d.ts +0 -6
  39. package/dist/src/ui/components/Spinner.d.ts.map +0 -1
  40. package/dist/src/ui/components/Spinner.js +0 -7
  41. package/dist/src/ui/components/Spinner.js.map +0 -1
  42. package/dist/src/ui/components/StatusBar.d.ts +0 -11
  43. package/dist/src/ui/components/StatusBar.d.ts.map +0 -1
  44. package/dist/src/ui/components/StatusBar.js +0 -7
  45. package/dist/src/ui/components/StatusBar.js.map +0 -1
  46. package/dist/src/ui/components/index.d.ts +0 -7
  47. package/dist/src/ui/components/index.d.ts.map +0 -1
  48. package/dist/src/ui/components/index.js +0 -7
  49. package/dist/src/ui/components/index.js.map +0 -1
  50. package/dist/src/validation/error-formatter.d.ts +0 -21
  51. package/dist/src/validation/error-formatter.d.ts.map +0 -1
  52. package/dist/src/validation/error-formatter.js +0 -98
  53. package/dist/src/validation/error-formatter.js.map +0 -1
  54. package/dist/src/validation/index.d.ts +0 -10
  55. package/dist/src/validation/index.d.ts.map +0 -1
  56. package/dist/src/validation/index.js +0 -10
  57. package/dist/src/validation/index.js.map +0 -1
  58. package/dist/src/validation/json-validator.d.ts +0 -25
  59. package/dist/src/validation/json-validator.d.ts.map +0 -1
  60. package/dist/src/validation/json-validator.js +0 -173
  61. package/dist/src/validation/json-validator.js.map +0 -1
  62. package/dist/src/validation/schema.d.ts +0 -353
  63. package/dist/src/validation/schema.d.ts.map +0 -1
  64. package/dist/src/validation/schema.js +0 -57
  65. package/dist/src/validation/schema.js.map +0 -1
  66. package/dist/src/validation/suggestions.d.ts +0 -25
  67. package/dist/src/validation/suggestions.d.ts.map +0 -1
  68. package/dist/src/validation/suggestions.js +0 -144
  69. package/dist/src/validation/suggestions.js.map +0 -1
  70. package/dist/src/validation/types.d.ts +0 -40
  71. package/dist/src/validation/types.d.ts.map +0 -1
  72. package/dist/src/validation/types.js +0 -5
  73. package/dist/src/validation/types.js.map +0 -1
  74. package/dist/src/validation/yaml-validator.d.ts +0 -25
  75. package/dist/src/validation/yaml-validator.d.ts.map +0 -1
  76. package/dist/src/validation/yaml-validator.js +0 -177
  77. package/dist/src/validation/yaml-validator.js.map +0 -1
@@ -1,377 +1,149 @@
1
1
  ---
2
2
  name: homepage
3
- description: 店铺首页配置。管理首页区块(Banner、集合列表、集合商品、特色推荐)。当用户需要配置店铺首页布局、添加轮播图、展示集合时使用。
3
+ description: 店铺首页配置。管理首页区块(Banner、集合列表、集合商品、特色推荐)。当用户需要配置店铺首页布局、添加轮播图、展示集合、设置 Banner 不裁切/完整显示时使用。
4
4
  ---
5
5
 
6
- ## 概念
6
+ ## 重要:先查后做
7
7
 
8
- Homepage(首页)是店铺的入口页面,由多个 Section(区块)组成。每个商户有一个激活的首页配置。
8
+ 1. 不确定参数时,先运行 `<command> --help` 查看完整参数说明
9
+ 2. 修改 settings 字段时,必须使用下方「Settings 合法字段」中列出的字段名,不要猜测
10
+ 3. 操作已有区块前,先 `commerce homepage list` 获取区块 ID
9
11
 
10
- - 区块按 position 排序,从上到下显示
11
- - 每个区块有唯一的 handle,用于 URL 锚点定位
12
- - 区块通过 settings 存储类型特定的配置
12
+ ## 用户意图 命令
13
13
 
14
- **与 Collection 的关系**:多个区块类型引用 Collection:
15
- - `collections` 区块:展示多个集合入口(引用 collection slugs)
16
- - `collection_products` 区块:展示某个集合的商品(引用单个 collection slug)
17
- - `featured` 区块:可推荐某个集合(target_type=collection)
14
+ ### 查看
18
15
 
19
- ## 结构
16
+ | 用户说 | 命令 |
17
+ |-------|------|
18
+ | 查看首页配置 | `commerce homepage get-config` |
19
+ | 查看首页区块列表 | `commerce homepage list` |
20
+ | 查看区块详情 | `commerce homepage get --id <id>` |
21
+ | 查看可用模板 | `commerce homepage list-templates` |
20
22
 
21
- ```
22
- Homepage
23
- ├── HomepageConfig(商户唯一)
24
- │ ├── id: 配置 ID
25
- │ ├── is_active: 是否激活
26
- │ └── sections: 区块列表
27
-
28
- └── HomepageSection(区块)
29
- ├── 基本信息
30
- │ ├── id: 区块 ID
31
- │ ├── type: 类型(见下方)
32
- │ ├── handle: URL 标识
33
- │ └── position: 显示顺序(0 开始)
34
-
35
- ├── settings: 类型特定配置(JSONB)
36
-
37
- └── translations: 多语言标题/描述(JSONB)
38
- └── { "zh-CN": { "title": "...", "description": "..." }, ... }
39
- ```
23
+ ### Banner(轮播图)
40
24
 
41
- **注意**:区块的 title description 存储在 `translations` 字段中,需要指定语言代码。
25
+ | 用户说 | 命令 |
26
+ |-------|------|
27
+ | 添加/创建轮播图 | `commerce homepage create-banner --title <title> --lang <lang> --images '<json>'` |
28
+ | Banner 不裁切 / 完整显示 / 按原始比例 | 新建时加 `--image-fit contain`;已有 banner 用 `patch-settings --id <id> --settings '{"image_fit":"contain"}'` |
29
+ | 更换所有图片 | `commerce homepage update-images --id <id> --images '<json>'`(全量替换,见下方说明) |
30
+ | 给第 N 张图加/换手机版 | `commerce homepage patch-banner-image --id <id> --index N --mobile-url "https://..."` |
31
+ | 改第 N 张图的描述/动作 | `commerce homepage patch-banner-image --id <id> --index N --alt "..." --action-type collection --action-value slug` |
32
+ | 移除第 N 张图的手机版 | `commerce homepage patch-banner-image --id <id> --index N --remove-mobile-url` |
33
+ | 关闭自动播放 | `commerce homepage patch-settings --id <id> --settings '{"autoplay":false}'` |
34
+ | 修改轮播间隔 | `commerce homepage patch-settings --id <id> --settings '{"interval":3000}'` |
42
35
 
43
- ## 区块类型详解
36
+ ### 集合
44
37
 
45
- ### 1. banner(图片轮播)
38
+ | 用户说 | 命令 |
39
+ |-------|------|
40
+ | 添加集合入口区块 | `commerce homepage create-collections --title <title> --lang <lang> --slugs "a,b,c"` |
41
+ | 更新集合列表 | `commerce homepage update-collections --id <id> --slugs "a,b,c"` |
42
+ | 添加集合商品区块 | `commerce homepage create-collection-products --title <title> --lang <lang> --slug <slug>` |
46
43
 
47
- 首页顶部的轮播广告图,支持多张图片自动轮播,每张图可设置点击跳转。
44
+ ### 特色推荐
48
45
 
49
- **Settings 字段**:
50
- | 字段 | 类型 | 说明 |
51
- |------|------|------|
52
- | images | array | 图片数组(见下方) |
53
- | autoplay | boolean | 是否自动播放,默认 true |
54
- | interval | number | 轮播间隔(毫秒),默认 5000 |
46
+ | 用户说 | 命令 |
47
+ |-------|------|
48
+ | 添加特色推荐 | `commerce homepage create-featured --title <title> --lang <lang> --target-type collection --target-handle <handle> --cta "查看" --image-url "https://..."` |
49
+ | 更新推荐目标 | `commerce homepage update-target --id <id> --type <type> --handle <handle>` |
55
50
 
56
- **images 数组元素**:
57
- | 字段 | 必填 | 说明 |
58
- |------|------|------|
59
- | url | △ | 桌面端图片 URL(url 或 media_id 至少一个) |
60
- | media_id | △ | 桌面端已有图片 ID(从 homepage get 获取,用于 update-images 全量替换) |
61
- | mobile_url | | 手机端专用图片 URL(3:4 竖向,可选) |
62
- | mobile_media_id | | 手机端已有图片 ID(从 homepage get 获取,用于 update-images 全量替换) |
63
- | alt | ✓ | 图片描述(SEO + 可访问性) |
64
- | action_type | ✓ | 点击动作类型(见下方) |
65
- | action_value | | 动作目标值 |
66
-
67
- > △ = url 和 media_id 至少提供一个。新上传的图使用 url,已有的图使用 media_id。
68
-
69
- **action_type 取值**:
70
- | 值 | 说明 | action_value |
71
- |----|------|--------------|
72
- | `none` | 无跳转 | null |
73
- | `collection` | 跳转到集合页 | collection slug |
74
- | `product` | 跳转到商品页 | product handle |
75
- | `url` | 跳转到 URL | 完整 URL 或相对路径 |
76
- | `section` | 滚动到页面区块 | section handle |
77
-
78
- **创建时的示例**(使用 url):
79
- ```json
80
- {
81
- "images": [
82
- {"url": "https://cdn.../summer.jpg", "mobile_url": "https://cdn.../summer-mobile.jpg", "alt": "夏日促销", "action_type": "collection", "action_value": "summer-sale"},
83
- {"url": "https://cdn.../promo.jpg", "alt": "活动页面", "action_type": "url", "action_value": "https://promo.example.com/event"}
84
- ],
85
- "autoplay": true,
86
- "interval": 5000
87
- }
88
- ```
51
+ ### 通用操作
89
52
 
90
- **`homepage get` 返回的真实格式**(url 已被后端自动转为 media_id):
91
- ```json
92
- {
93
- "images": [
94
- {"media_id": "med_abc123", "mobile_media_id": "med_def456", "alt": "夏日促销", "action_type": "collection", "action_value": "summer-sale"},
95
- {"media_id": "med_ghi789", "alt": "活动页面", "action_type": "url", "action_value": "https://promo.example.com/event"}
96
- ],
97
- "autoplay": true,
98
- "interval": 5000
99
- }
100
- ```
53
+ | 用户说 | 命令 |
54
+ |-------|------|
55
+ | 调整区块顺序 | `commerce homepage reorder --moves '[{"section_id":"<id>","new_position":0}]'` |
56
+ | 修改区块标题/描述 | `commerce i18n homepage set --section-id <id> --lang <lang> --title "新标题"` |
57
+ | 删除区块 | `commerce homepage delete --id <id> --yes` |
58
+ | 切换模板 | `commerce homepage switch-template --template-key <minimal\|standard> --yes` |
101
59
 
102
- ### 2. collections(集合入口列表)
60
+ ## Settings 合法字段
103
61
 
104
- 展示多个集合的入口卡片,用户点击可进入对应集合页。
62
+ 使用 `patch-settings` 修改设置时,只能使用以下字段名。**使用未列出的字段会被后端拒绝(extra="forbid")。**
63
+
64
+ ### banner
105
65
 
106
- **Settings 字段**:
107
66
  | 字段 | 类型 | 说明 |
108
67
  |------|------|------|
109
- | collection_slugs | array | 集合 slug 数组,按顺序展示 |
110
- | layout | string | 布局方式:`grid`(网格)/ `carousel`(轮播) |
111
- | show_product_count | boolean | 是否显示集合商品数量 |
112
-
113
- **示例**:
114
- ```json
115
- {
116
- "collection_slugs": ["summer-sale", "new-arrivals", "best-sellers"],
117
- "layout": "grid",
118
- "show_product_count": true
119
- }
120
- ```
121
-
122
- ### 3. collection_products(集合商品展示)
68
+ | images | array | 图片数组(通过 `update-images` `patch-banner-image` 修改,不要用 patch-settings) |
69
+ | autoplay | boolean | 是否自动播放,默认 true |
70
+ | interval | number | 轮播间隔(毫秒),1000-30000,默认 5000 |
71
+ | image_fit | string | `cover`(默认,裁切填充)/ `contain`(完整显示,高度自适应,无裁切) |
123
72
 
124
- 展示某个集合内的商品列表,支持自动获取或手动指定。
73
+ ### collections
125
74
 
126
- **Settings 字段**:
127
75
  | 字段 | 类型 | 说明 |
128
76
  |------|------|------|
129
- | collection_slug | string | 集合 slug(必需) |
130
- | mode | string | `auto`(自动获取)/ `manual`(手动指定) |
131
- | product_handles | array | mode=manual 时,手动指定的商品 handle 列表 |
132
- | limit | number | mode=auto 时,最多展示数量,默认 8 |
133
- | sort_by | string | 排序字段:`created_at` / `price` / `title` |
134
- | sort_order | string | 排序方向:`asc` / `desc` |
135
-
136
- **示例**:
137
- ```json
138
- {
139
- "collection_slug": "new-arrivals",
140
- "mode": "auto",
141
- "limit": 8,
142
- "sort_by": "created_at",
143
- "sort_order": "desc"
144
- }
145
- ```
146
-
147
- ### 4. featured(特色推荐)
77
+ | collection_slugs | array | 集合 slug 数组(通过 `update-collections` 修改更方便) |
78
+ | layout | string | `grid` / `carousel` |
79
+ | show_product_count | boolean | 是否显示商品数量 |
148
80
 
149
- 突出展示某个集合或商品,通常带有大图和 CTA 按钮。
81
+ ### collection_products
150
82
 
151
- **Settings 字段**:
152
83
  | 字段 | 类型 | 说明 |
153
84
  |------|------|------|
154
- | target_type | string | `collection`(推荐集合)/ `product`(推荐商品) |
155
- | target_handle | string | 目标的 slug/handle |
156
- | media_id | string | 封面图片的 media ID |
157
- | media_url | string | 或直接提供封面图片 URL |
158
- | cta_text | string | CTA 按钮文字,如 "立即查看" |
159
- | background_color | string | 背景颜色,如 "#f5f5f5" |
160
-
161
- **示例(推荐集合)**:
162
- ```json
163
- {
164
- "target_type": "collection",
165
- "target_handle": "summer-sale",
166
- "media_url": "https://cdn.../featured.jpg",
167
- "cta_text": "查看夏日精选",
168
- "background_color": "#fff8e1"
169
- }
170
- ```
171
-
172
- **示例(推荐商品)**:
173
- ```json
174
- {
175
- "target_type": "product",
176
- "target_handle": "ceramic-cup-white",
177
- "media_url": "https://cdn.../product-hero.jpg",
178
- "cta_text": "立即购买"
179
- }
180
- ```
85
+ | collection_slug | string | 集合 slug |
86
+ | mode | string | `auto` / `manual` |
87
+ | product_handles | array | manual 模式下的商品 handle 列表 |
88
+ | limit | number | auto 模式最多展示数量,默认 8 |
89
+ | sort_by | string | `created_at` / `price` / `title` |
90
+ | sort_order | string | `asc` / `desc` |
181
91
 
182
- ## 典型场景
183
-
184
- 当用户说:
185
- - "查看首页配置" → `commerce homepage get-config`
186
- - "查看首页区块" → `commerce homepage list`
187
- - "添加轮播图" → `commerce homepage create-banner --title "主Banner" --lang <识别语言> --images '[{"url":"..."}]'`
188
- - "添加集合入口" → `commerce homepage create-collections --title "精选系列" --lang <识别语言> --slugs "a,b,c"`
189
- - "添加集合商品" → `commerce homepage create-collection-products --title "新品" --lang <识别语言> --slug new-arrivals`
190
- - "添加特色推荐" → `commerce homepage create-featured --title "推荐" --lang <识别语言> --target-type collection --target-handle xx --cta "查看" --image-url "..."`
191
- - "更新轮播图图片" → `commerce homepage update-images --id xx --images '[...]'`
192
- - "给第N张 banner 加手机图" → `commerce homepage patch-banner-image --id xx --index N --mobile-url "https://..."`
193
- - "改第N张图的描述" → `commerce homepage patch-banner-image --id xx --index N --alt "新描述"`
194
- - "移除第N张图的手机版" → `commerce homepage patch-banner-image --id xx --index N --remove-mobile-url`
195
- - "修改区块标题" → `commerce i18n homepage set --section-id xx --lang <识别语言> --title "新标题"`
196
- - "给区块添加描述" → `commerce i18n homepage set --section-id xx --lang <识别语言> --description "描述"`
197
- - "调整区块顺序" → `commerce homepage reorder --moves '[{"section_id":"id1","new_position":0}]'`
198
- - "使用模板" → `commerce homepage switch-template --template-key minimal`
199
- - "删除区块" → `commerce homepage delete --id xx --yes`
200
-
201
- ## 命令参考
202
-
203
- ### 配置管理
204
- - `commerce homepage get-config` - 查看首页配置
205
- - `commerce homepage list-templates` - 列出可用模板
206
- - `commerce homepage switch-template --template-key <key>` - 切换模板(minimal|standard)
207
- - `commerce homepage delete-config --yes` - 删除首页配置
208
-
209
- ### 创建区块(支持 --title --description --lang)
210
- - `commerce homepage create-banner --title <title> --lang <code> --images <json>` - 创建轮播图
211
- - `commerce homepage create-collections --title <title> --lang <code> --slugs <slugs>` - 创建集合入口
212
- - `commerce homepage create-collection-products --title <title> --lang <code> --slug <slug>` - 创建集合商品
213
- - `commerce homepage create-featured --title <title> --lang <code> --target-type <type> --target-handle <handle> --cta <text> --image-url <url>` - 创建特色推荐
214
-
215
- ### 区块管理
216
- - `commerce homepage list` - 列出所有区块
217
- - `commerce homepage get --id <id>` - 查看区块详情
218
- - `commerce homepage update --id <id>` - 更新区块
219
- - `commerce homepage delete --id <id> --yes` - 删除区块
220
- - `commerce homepage reorder --moves <json>` - 重新排序(JSON 格式:`[{"section_id":"xx","new_position":0}]`)
221
-
222
- ### 区块设置
223
- - `commerce homepage update-images --id <id> --images <json>` - 全量替换 banner 图片(支持 url 或 media_id)
224
- - `commerce homepage patch-banner-image --id <id> --index <N> [--url <url>] [--mobile-url <url>] [--remove-mobile-url] [--alt <text>] [--action-type <type>] [--action-value <value>]` - 更新单张 banner 图片(index 从 1 开始)
225
- - `commerce homepage update-collections --id <id> --slugs <slugs>` - 更新 collections 集合
226
- - `commerce homepage update-target --id <id> --type <type> --handle <handle>` - 更新 featured 目标
227
- - `commerce homepage patch-settings --id <id> --settings <json>` - 通用设置更新
228
-
229
- ### 多语言翻译
230
- - `commerce i18n homepage list --section-id <id>` - 查看区块所有翻译
231
- - `commerce i18n homepage set --section-id <id> --lang <code> --title <title> --description <desc>` - 设置翻译
232
- - `commerce i18n homepage delete --section-id <id> --lang <code> --yes` - 删除翻译
233
- - `commerce i18n languages` - 查看支持的语言列表
234
-
235
- ## 语言代码
236
-
237
- 设置标题和描述时必须指定 `--lang`。
238
-
239
- 支持的语言:`zh-CN`、`en-US`、`ja-JP`、`es-ES`、`vi-VN`
240
-
241
- 根据用户提供的文字内容识别语言。如果无法确定,询问用户。
242
-
243
- ## 典型操作示例
244
-
245
- ### 快速开始:使用模板
92
+ ### featured
246
93
 
247
- ```bash
248
- # 查看可用模板
249
- commerce homepage list-templates
250
-
251
- # 切换到标准模板(会创建预设区块)
252
- commerce homepage switch-template --template-key standard --yes
253
- ```
254
-
255
- ### 创建轮播图
256
-
257
- ```bash
258
- # 创建 banner 并设置图片
259
- commerce homepage create-banner \
260
- --title "首页轮播" \
261
- --lang zh-CN \
262
- --images '[{"url":"https://cdn.../img1.jpg","link":"/sale"}]'
263
-
264
- # 后续更新图片
265
- commerce homepage update-images \
266
- --id section_xxx \
267
- --images '[{"url":"https://cdn.../img2.jpg","alt":"夏日促销","link":"/summer"}]'
268
- ```
269
-
270
- ### 创建集合入口
271
-
272
- ```bash
273
- # 创建 collections 区块
274
- commerce homepage create-collections \
275
- --title "精选系列" \
276
- --lang zh-CN \
277
- --slugs "new-arrivals,best-sellers,summer-sale"
278
-
279
- # 后续更新集合列表
280
- commerce homepage update-collections --id section_xxx --slugs "a,b,c"
281
- ```
282
-
283
- ### 创建集合商品展示
94
+ | 字段 | 类型 | 说明 |
95
+ |------|------|------|
96
+ | target_type | string | `collection` / `product` |
97
+ | target_handle | string | 目标 slug/handle |
98
+ | media_id | string | 封面图片 ID |
99
+ | url | string | 封面图片 URL(新上传用 url,后端自动转 media_id) |
100
+ | cta_text | string | CTA 按钮文字 |
101
+ | background_color | string | 背景颜色,如 `#f5f5f5` |
284
102
 
285
- ```bash
286
- # 创建 collection_products 区块
287
- commerce homepage create-collection-products \
288
- --title "新品上市" \
289
- --lang zh-CN \
290
- --slug new-arrivals \
291
- --limit 8
292
- ```
103
+ ## 复杂操作说明
293
104
 
294
- ### 创建特色推荐
105
+ ### update-images 全量替换
295
106
 
296
- ```bash
297
- # 推荐集合
298
- commerce homepage create-featured \
299
- --title "本周推荐" \
300
- --description "精选好物,限时优惠" \
301
- --lang zh-CN \
302
- --target-type collection \
303
- --target-handle weekly-picks \
304
- --cta "立即查看" \
305
- --image-url "https://cdn.../featured.jpg"
306
-
307
- # 推荐商品
308
- commerce homepage create-featured \
309
- --title "爆款单品" \
310
- --lang zh-CN \
311
- --target-type product \
312
- --target-handle ceramic-cup-white \
313
- --cta "立即购买" \
314
- --image-url "https://cdn.../product.jpg"
315
-
316
- # 后续更新目标
317
- commerce homepage update-target --id section_xxx --type collection --handle "new-picks"
318
- ```
107
+ `update-images` 会覆盖整个 images 数组。操作步骤:
319
108
 
320
- ### 更新标题和描述
109
+ 1. `commerce homepage get --id <id>` 获取现有图片(含 media_id)
110
+ 2. 构建完整数组:已有图原样透传 media_id,新图用 url
111
+ 3. 执行替换
321
112
 
322
113
  ```bash
323
- # 更新中文
324
- commerce i18n homepage set \
325
- --section-id section_xxx \
326
- --lang zh-CN \
327
- --title "新标题" \
328
- --description "新描述"
329
-
330
- # 添加英文翻译
331
- commerce i18n homepage set \
332
- --section-id section_xxx \
333
- --lang en-US \
334
- --title "New Title" \
335
- --description "New description"
114
+ commerce homepage update-images --id section_xxx --images '[
115
+ {"media_id":"med_abc","mobile_media_id":"med_def","alt":"图1","action_type":"collection","action_value":"sale"},
116
+ {"url":"https://new-image.jpg","alt":"新图","action_type":"none"}
117
+ ]'
336
118
  ```
337
119
 
338
- ## Banner 图片更新:命令选择指南
339
-
340
- | 我要做什么 | 用哪个命令 | 说明 |
341
- |-----------|-----------|------|
342
- | 给第 N 张图加/换手机版 | `patch-banner-image --index N --mobile-url "https://..."` | 最简单,无需读取现有数据 |
343
- | 改第 N 张图的 alt/action | `patch-banner-image --index N --alt "..."` | 同上 |
344
- | 换第 N 张桌面图(新 URL) | `patch-banner-image --index N --url "https://..."` | 后端自动转 media_id |
345
- | 移除第 N 张图的手机版 | `patch-banner-image --index N --remove-mobile-url` | 设为 null |
346
- | 添加/删除图片 | `update-images --images '[完整数组]'` | 全量替换,需透传所有现有字段 |
347
- | 重新排列图片顺序 | `update-images --images '[新顺序数组]'` | 同上 |
120
+ **注意:漏传的字段(如 `mobile_media_id`)会导致手机图丢失。务必完整复制现有图片的所有字段。**
348
121
 
349
- **关键区别**:
350
- - `patch-banner-image` 只接受 URL(`--url`, `--mobile-url`),不接受 `media_id`。后端自动将 URL 转为 media_id
351
- - `update-images` 接受 `url` 和 `media_id`。已有的图用 `media_id` 透传,新图用 `url`
122
+ ### Banner 图片字段说明
352
123
 
353
- ### update-images 全量替换示例(含 media_id 透传)
354
-
355
- **场景**:给已有的 2 banner 增加第 3 张图
356
-
357
- 1. `commerce homepage get --id section_xxx` 获取现有图片(含 media_id)
358
- 2. 构建完整数组,已有图原样透传 media_id,新图用 url:
124
+ | 字段 | 必填 | 说明 |
125
+ |------|------|------|
126
+ | url | | 桌面端图片 URL(url 或 media_id 至少一个) |
127
+ | media_id | △ | 已有图片 ID(从 `homepage get` 获取) |
128
+ | mobile_url | | 手机端图片 URL(3:4 竖向,可选) |
129
+ | mobile_media_id | | 手机端已有图片 ID |
130
+ | alt | ✓ | 图片描述 |
131
+ | action_type | ✓ | `none` / `collection` / `product` / `url` / `section` |
132
+ | action_value | | 动作目标(slug / URL / section handle) |
359
133
 
360
- ```bash
361
- commerce homepage update-images --id section_xxx --images '[
362
- {"media_id":"med_abc123","mobile_media_id":"med_def456","alt":"夏日促销","action_type":"collection","action_value":"summer-sale"},
363
- {"media_id":"med_ghi789","alt":"活动页面","action_type":"url","action_value":"https://promo.example.com/event"},
364
- {"url":"https://new-upload-url.../img3.jpg","alt":"新图片","action_type":"none"}
365
- ]'
366
- ```
134
+ ### patch-banner-image vs update-images
367
135
 
368
- **注意:全量替换会覆盖整个 images 数组。漏传的字段(如 `mobile_media_id`)会导致手机图丢失。务必从 `homepage get` 完整复制现有图片的所有字段。**
136
+ | 场景 | 用哪个 |
137
+ |------|--------|
138
+ | 改单张图的属性(alt、mobile_url 等) | `patch-banner-image --index N` |
139
+ | 添加/删除图片、重新排序 | `update-images`(全量替换) |
369
140
 
370
141
  ## 注意事项
371
142
 
372
- - **区块顺序**:使用 `reorder` 调整,position 从 0 开始
143
+ - **语言代码**:设置标题/描述时必须指定 `--lang`(zh-CN、en-US、ja-JP、es-ES、vi-VN),根据用户文字识别语言
144
+ - **区块顺序**:position 从 0 开始
145
+ - **media_id 生命周期**:URL → 传给 API → 后端自动转为 media_id → 后续 `homepage get` 返回 media_id
146
+ - **手机端图片**:mobile_url 为 3:4 竖向,有时手机端显示竖版大图,无则保持横向
147
+ - **image_fit**:默认 `cover`(裁切),设 `contain` 可按原始比例完整显示,适合纯切图首页
373
148
  - **模板切换**:会创建新区块并停用旧区块,谨慎操作
374
- - **media_id 生命周期**:上传图片(`upload file`)→ 返回临时 URL(无 media_id)→ 传给 banner API → 后端自动转为 media_id → 后续 `homepage get` 返回 media_id
375
- - **手机端图片**:可选提供 mobile_url(3:4 竖向),有 mobile_url 时手机端显示竖向大图,无则保持 16:9 横向
376
- - **集合引用**:确保引用的 collection slug 存在,否则前端可能显示空
377
- - **删除确认**:删除操作需要 `--yes` 参数
149
+ - **删除确认**:删除操作需要 `--yes`
File without changes
File without changes
File without changes
File without changes
package/dist/bin/scout.js CHANGED
File without changes
@@ -11,7 +11,7 @@ export declare class OptimaAgent {
11
11
  * @param prompt 用户输入
12
12
  * @param chatOptions 选项,包括 streamFormat: 'delta' | 'content'
13
13
  */
14
- chat(prompt: string, chatOptions?: ChatOptions): AsyncGenerator<import("@anthropic-ai/claude-agent-sdk").SDKUserMessage | import("@anthropic-ai/claude-agent-sdk").SDKAssistantMessage | import("@anthropic-ai/claude-agent-sdk").SDKResultSuccess | import("@anthropic-ai/claude-agent-sdk").SDKResultError | import("@anthropic-ai/claude-agent-sdk").SDKSystemMessage | import("@anthropic-ai/claude-agent-sdk").SDKPartialAssistantMessage | import("@anthropic-ai/claude-agent-sdk").SDKCompactBoundaryMessage | import("@anthropic-ai/claude-agent-sdk").SDKStatusMessage | import("@anthropic-ai/claude-agent-sdk").SDKAPIRetryMessage | import("@anthropic-ai/claude-agent-sdk").SDKLocalCommandOutputMessage | import("@anthropic-ai/claude-agent-sdk").SDKHookStartedMessage | import("@anthropic-ai/claude-agent-sdk").SDKHookProgressMessage | import("@anthropic-ai/claude-agent-sdk").SDKHookResponseMessage | import("@anthropic-ai/claude-agent-sdk").SDKToolProgressMessage | import("@anthropic-ai/claude-agent-sdk").SDKAuthStatusMessage | import("@anthropic-ai/claude-agent-sdk").SDKTaskNotificationMessage | import("@anthropic-ai/claude-agent-sdk").SDKTaskStartedMessage | import("@anthropic-ai/claude-agent-sdk").SDKTaskProgressMessage | import("@anthropic-ai/claude-agent-sdk").SDKFilesPersistedEvent | import("@anthropic-ai/claude-agent-sdk").SDKToolUseSummaryMessage | import("@anthropic-ai/claude-agent-sdk").SDKRateLimitEvent | import("@anthropic-ai/claude-agent-sdk").SDKElicitationCompleteMessage | import("@anthropic-ai/claude-agent-sdk").SDKPromptSuggestionMessage | {
14
+ chat(prompt: string, chatOptions?: ChatOptions): AsyncGenerator<import("@anthropic-ai/claude-agent-sdk").SDKUserMessage | import("@anthropic-ai/claude-agent-sdk").SDKAssistantMessage | import("@anthropic-ai/claude-agent-sdk").SDKResultSuccess | import("@anthropic-ai/claude-agent-sdk").SDKResultError | import("@anthropic-ai/claude-agent-sdk").SDKSystemMessage | import("@anthropic-ai/claude-agent-sdk").SDKPartialAssistantMessage | import("@anthropic-ai/claude-agent-sdk").SDKCompactBoundaryMessage | import("@anthropic-ai/claude-agent-sdk").SDKStatusMessage | import("@anthropic-ai/claude-agent-sdk").SDKLocalCommandOutputMessage | import("@anthropic-ai/claude-agent-sdk").SDKHookStartedMessage | import("@anthropic-ai/claude-agent-sdk").SDKHookProgressMessage | import("@anthropic-ai/claude-agent-sdk").SDKHookResponseMessage | import("@anthropic-ai/claude-agent-sdk").SDKToolProgressMessage | import("@anthropic-ai/claude-agent-sdk").SDKAuthStatusMessage | import("@anthropic-ai/claude-agent-sdk").SDKTaskNotificationMessage | import("@anthropic-ai/claude-agent-sdk").SDKTaskStartedMessage | import("@anthropic-ai/claude-agent-sdk").SDKTaskProgressMessage | import("@anthropic-ai/claude-agent-sdk").SDKFilesPersistedEvent | import("@anthropic-ai/claude-agent-sdk").SDKToolUseSummaryMessage | import("@anthropic-ai/claude-agent-sdk").SDKRateLimitEvent | import("@anthropic-ai/claude-agent-sdk").SDKElicitationCompleteMessage | import("@anthropic-ai/claude-agent-sdk").SDKPromptSuggestionMessage | {
15
15
  type: "text_delta";
16
16
  delta: {
17
17
  text: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optima-chat/optima-agent",
3
- "version": "0.8.40",
3
+ "version": "0.8.43",
4
4
  "description": "基于 Claude Agent SDK 的电商运营 AI 助手",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",