@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.
- package/.claude/skills/homepage/SKILL.md +102 -330
- package/dist/bin/bi-cli.js +0 -0
- package/dist/bin/commerce.js +0 -0
- package/dist/bin/google-ads.js +0 -0
- package/dist/bin/optima.js +0 -0
- package/dist/bin/scout.js +0 -0
- package/dist/src/agent.d.ts +1 -1
- package/package.json +1 -1
- package/.claude/settings.local.json +0 -154
- package/dist/bin/comfy.d.ts +0 -3
- package/dist/bin/comfy.d.ts.map +0 -1
- package/dist/bin/comfy.js +0 -3
- package/dist/bin/comfy.js.map +0 -1
- package/dist/src/hooks-loader.d.ts +0 -6
- package/dist/src/hooks-loader.d.ts.map +0 -1
- package/dist/src/hooks-loader.js +0 -215
- package/dist/src/hooks-loader.js.map +0 -1
- package/dist/src/ui/App.d.ts +0 -6
- package/dist/src/ui/App.d.ts.map +0 -1
- package/dist/src/ui/App.js +0 -164
- package/dist/src/ui/App.js.map +0 -1
- package/dist/src/ui/components/Composer.d.ts +0 -10
- package/dist/src/ui/components/Composer.d.ts.map +0 -1
- package/dist/src/ui/components/Composer.js +0 -13
- package/dist/src/ui/components/Composer.js.map +0 -1
- package/dist/src/ui/components/Header.d.ts +0 -7
- package/dist/src/ui/components/Header.d.ts.map +0 -1
- package/dist/src/ui/components/Header.js +0 -7
- package/dist/src/ui/components/Header.js.map +0 -1
- package/dist/src/ui/components/Message.d.ts +0 -12
- package/dist/src/ui/components/Message.d.ts.map +0 -1
- package/dist/src/ui/components/Message.js +0 -21
- package/dist/src/ui/components/Message.js.map +0 -1
- package/dist/src/ui/components/MessageList.d.ts +0 -9
- package/dist/src/ui/components/MessageList.d.ts.map +0 -1
- package/dist/src/ui/components/MessageList.js +0 -18
- package/dist/src/ui/components/MessageList.js.map +0 -1
- package/dist/src/ui/components/Spinner.d.ts +0 -6
- package/dist/src/ui/components/Spinner.d.ts.map +0 -1
- package/dist/src/ui/components/Spinner.js +0 -7
- package/dist/src/ui/components/Spinner.js.map +0 -1
- package/dist/src/ui/components/StatusBar.d.ts +0 -11
- package/dist/src/ui/components/StatusBar.d.ts.map +0 -1
- package/dist/src/ui/components/StatusBar.js +0 -7
- package/dist/src/ui/components/StatusBar.js.map +0 -1
- package/dist/src/ui/components/index.d.ts +0 -7
- package/dist/src/ui/components/index.d.ts.map +0 -1
- package/dist/src/ui/components/index.js +0 -7
- package/dist/src/ui/components/index.js.map +0 -1
- package/dist/src/validation/error-formatter.d.ts +0 -21
- package/dist/src/validation/error-formatter.d.ts.map +0 -1
- package/dist/src/validation/error-formatter.js +0 -98
- package/dist/src/validation/error-formatter.js.map +0 -1
- package/dist/src/validation/index.d.ts +0 -10
- package/dist/src/validation/index.d.ts.map +0 -1
- package/dist/src/validation/index.js +0 -10
- package/dist/src/validation/index.js.map +0 -1
- package/dist/src/validation/json-validator.d.ts +0 -25
- package/dist/src/validation/json-validator.d.ts.map +0 -1
- package/dist/src/validation/json-validator.js +0 -173
- package/dist/src/validation/json-validator.js.map +0 -1
- package/dist/src/validation/schema.d.ts +0 -353
- package/dist/src/validation/schema.d.ts.map +0 -1
- package/dist/src/validation/schema.js +0 -57
- package/dist/src/validation/schema.js.map +0 -1
- package/dist/src/validation/suggestions.d.ts +0 -25
- package/dist/src/validation/suggestions.d.ts.map +0 -1
- package/dist/src/validation/suggestions.js +0 -144
- package/dist/src/validation/suggestions.js.map +0 -1
- package/dist/src/validation/types.d.ts +0 -40
- package/dist/src/validation/types.d.ts.map +0 -1
- package/dist/src/validation/types.js +0 -5
- package/dist/src/validation/types.js.map +0 -1
- package/dist/src/validation/yaml-validator.d.ts +0 -25
- package/dist/src/validation/yaml-validator.d.ts.map +0 -1
- package/dist/src/validation/yaml-validator.js +0 -177
- 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
|
-
|
|
8
|
+
1. 不确定参数时,先运行 `<command> --help` 查看完整参数说明
|
|
9
|
+
2. 修改 settings 字段时,必须使用下方「Settings 合法字段」中列出的字段名,不要猜测
|
|
10
|
+
3. 操作已有区块前,先 `commerce homepage list` 获取区块 ID
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
- 每个区块有唯一的 handle,用于 URL 锚点定位
|
|
12
|
-
- 区块通过 settings 存储类型特定的配置
|
|
12
|
+
## 用户意图 → 命令
|
|
13
13
|
|
|
14
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
|
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
|
-
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
{
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
|
|
60
|
+
## Settings 合法字段
|
|
103
61
|
|
|
104
|
-
|
|
62
|
+
使用 `patch-settings` 修改设置时,只能使用以下字段名。**使用未列出的字段会被后端拒绝(extra="forbid")。**
|
|
63
|
+
|
|
64
|
+
### banner
|
|
105
65
|
|
|
106
|
-
**Settings 字段**:
|
|
107
66
|
| 字段 | 类型 | 说明 |
|
|
108
67
|
|------|------|------|
|
|
109
|
-
|
|
|
110
|
-
|
|
|
111
|
-
|
|
|
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
|
-
|
|
|
130
|
-
|
|
|
131
|
-
|
|
|
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
|
-
|
|
81
|
+
### collection_products
|
|
150
82
|
|
|
151
|
-
**Settings 字段**:
|
|
152
83
|
| 字段 | 类型 | 说明 |
|
|
153
84
|
|------|------|------|
|
|
154
|
-
|
|
|
155
|
-
|
|
|
156
|
-
|
|
|
157
|
-
|
|
|
158
|
-
|
|
|
159
|
-
|
|
|
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
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
325
|
-
|
|
326
|
-
|
|
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
|
-
|
|
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
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
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
|
-
|
|
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
|
-
|
|
136
|
+
| 场景 | 用哪个 |
|
|
137
|
+
|------|--------|
|
|
138
|
+
| 改单张图的属性(alt、mobile_url 等) | `patch-banner-image --index N` |
|
|
139
|
+
| 添加/删除图片、重新排序 | `update-images`(全量替换) |
|
|
369
140
|
|
|
370
141
|
## 注意事项
|
|
371
142
|
|
|
372
|
-
-
|
|
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
|
-
-
|
|
375
|
-
- **手机端图片**:可选提供 mobile_url(3:4 竖向),有 mobile_url 时手机端显示竖向大图,无则保持 16:9 横向
|
|
376
|
-
- **集合引用**:确保引用的 collection slug 存在,否则前端可能显示空
|
|
377
|
-
- **删除确认**:删除操作需要 `--yes` 参数
|
|
149
|
+
- **删除确认**:删除操作需要 `--yes`
|
package/dist/bin/bi-cli.js
CHANGED
|
File without changes
|
package/dist/bin/commerce.js
CHANGED
|
File without changes
|
package/dist/bin/google-ads.js
CHANGED
|
File without changes
|
package/dist/bin/optima.js
CHANGED
|
File without changes
|
package/dist/bin/scout.js
CHANGED
|
File without changes
|
package/dist/src/agent.d.ts
CHANGED
|
@@ -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").
|
|
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;
|