siluzan-tso-cli 1.1.36 → 1.1.37-beta.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.
- package/README.md +2 -1
- package/dist/index.js +2860 -746
- package/dist/skill/_meta.json +2 -2
- package/dist/skill/assets/google-period-report.schema.json +226 -0
- package/dist/skill/assets/pmax-create-template.md +7 -1
- package/dist/skill/references/accounts/accounts.md +3 -3
- package/dist/skill/references/accounts/finance.md +1 -1
- package/dist/skill/references/accounts/open-account-by-media.md +1 -1
- package/dist/skill/references/accounts/open-account-google-ui.md +1 -1
- package/dist/skill/references/analytics/rag.md +1 -1
- package/dist/skill/references/analytics/reporting.md +5 -5
- package/dist/skill/references/core/setup.md +5 -5
- package/dist/skill/references/misc/tso-home.md +2 -2
- package/dist/skill/references/report-templates/README.md +14 -14
- package/dist/skill/references/report-templates/REPORT-WORKFLOW.md +23 -15
- package/dist/skill/references/report-templates/bing-period-report.md +89 -23
- package/dist/skill/references/report-templates/google-period-report.md +55 -5
- package/dist/skill/references/report-templates/meta-account-diagnosis-report.md +144 -16
- package/dist/skill/references/report-templates/tiktok-period-report.md +112 -7
- package/dist/skill/report-templates/README.md +14 -14
- package/dist/skill/report-templates/REPORT-WORKFLOW.md +23 -15
- package/dist/skill/report-templates/bing-period-report.html +1343 -0
- package/dist/skill/report-templates/bing-period-report.md +89 -23
- package/dist/skill/report-templates/google-period-report.html +1314 -0
- package/dist/skill/report-templates/google-period-report.md +55 -5
- package/dist/skill/report-templates/meta-account-diagnosis-report.html +1124 -0
- package/dist/skill/report-templates/meta-account-diagnosis-report.md +144 -16
- package/dist/skill/report-templates/tiktok-period-report.html +1111 -0
- package/dist/skill/report-templates/tiktok-period-report.md +112 -7
- package/dist/skill/scripts/install.ps1 +3 -3
- package/dist/skill/scripts/install.sh +3 -3
- package/package.json +1 -1
|
@@ -2,9 +2,75 @@
|
|
|
2
2
|
|
|
3
3
|
> 统计区间:`{startDate}` ~ `{endDate}`(**不可包含今天或昨天**,见下文)
|
|
4
4
|
> 账户:`{mediaCustomerId}`(`{mediaCustomerName}`)
|
|
5
|
-
>
|
|
5
|
+
> **默认交付物**:一份可打开的、带 ECharts 图表的 **HTML 文件**(`bing-period-report.html`)。
|
|
6
|
+
> 用户**未指定格式**时一律走下方 **标准四步流程**;**禁止** Agent 手写/拼接 HTML(语法错误会导致报告无法显示)。
|
|
7
|
+
> **用户明确要求 Excel / xlsx** 时:拉数步骤不变,改为 Agent 脚本写 `.xlsx`;**不要**调用 `bing-analysis render`;禁止假设存在内置 excel 子命令。
|
|
8
|
+
|
|
9
|
+
数据块(Bing 实际支持的 9 类业务维度 + 总览):总览、设备、地域、受众(年龄/性别)、系列、广告组、广告、关键词、搜索字词。
|
|
10
|
+
|
|
11
|
+
| CLI `--sections` | 落盘形状(生产实测) | 报告 `tables.*` / KPI |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| `overview` | 对象:`currentPeriod` / `previousPeriod` / `balance` / `averageDailyCost` … | → `meta` + `kpis`(环比、余额、日均) |
|
|
14
|
+
| `device` | `{ devices: Row[] }` | → `tables.devices[]` |
|
|
15
|
+
| `geographic` | `{ countries: Row[] }` | → `tables.geographic[]` |
|
|
16
|
+
| `audience-merged`(或 `age-audience`/`gender-audience`) | `{ data: { ageAudience.audience[], genderAudience.audience[] } }` | → `tables.audienceAge[]` / `audienceGender[]` |
|
|
17
|
+
| `campaigns` | **根节点数组** | → `tables.campaigns[]`;**本期 KPI 优先由此累加** |
|
|
18
|
+
| `ad-groups` | **根节点数组** | → `tables.adGroups[]`(含 `qualityScore`) |
|
|
19
|
+
| `ads` | **根节点数组** | → `tables.ads[]` |
|
|
20
|
+
| `keywords` | **根节点数组**(默认 limit=100) | → `tables.keywords[]` |
|
|
21
|
+
| `search-terms` | **根节点数组**(默认 limit=100) | → `tables.searchTerms[]` |
|
|
22
|
+
|
|
23
|
+
> Bing **没有** Google 的 `daily-metrics` / `dimension-summary`;报告模板也不渲染这两章。
|
|
6
24
|
|
|
7
|
-
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 标准四步流程(默认 · 交付 HTML)
|
|
28
|
+
|
|
29
|
+
| 步骤 | 执行者 | 动作 |
|
|
30
|
+
| ---------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
31
|
+
| **1. 拉数** | Agent 调 CLI | `bing-analysis -a <id> --start <s> --end <e> --json-out ./snap-bing`(见下方「日期规则」,全 11 维或 `--sections` 指定子集) |
|
|
32
|
+
| **2. 分析** | Agent | 用 **node/python 脚本**读落盘 JSON(勿用 Read 打开业务 `*.json`),把网关原始字段映射为下方 `tables.*` 契约,完成聚合与洞察 |
|
|
33
|
+
| **3. 写 JSON** | Agent | 撰写 `bing-period-report.json`:仅 `meta.accountId` + `narrative`(9 个分析小节)为必填;`kpis`/`tables` 可省略由 `--snapshot-dir` 自动合并 |
|
|
34
|
+
| **4. 渲染 HTML** | CLI | `bing-analysis render` — **校验 narrative 9 个分析小节必含字段**,缺项报错不生成 HTML;**禁止** Agent 手写/拼接 HTML |
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# 步骤 1
|
|
38
|
+
siluzan-tso bing-analysis -a <id> --start <s> --end <e> --json-out ./snap-bing
|
|
39
|
+
|
|
40
|
+
# 步骤 4(步骤 2~3 完成后)
|
|
41
|
+
siluzan-tso bing-analysis render \
|
|
42
|
+
--data ./bing-period-report.json \
|
|
43
|
+
--snapshot-dir ./snap-bing \
|
|
44
|
+
--out ./bing-period-report.html
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### `bing-period-report.json` 顶层结构
|
|
48
|
+
|
|
49
|
+
- `meta`:`accountId`(必填)/ `accountName` / `currency` / `startDate` / `endDate`;可省略由 `--snapshot-dir` 从 `overview` 快照自动合并。
|
|
50
|
+
- `kpis`:账户级 KPI —— `spend`/`impressions`/`clicks`/`conversions`/`ctr`/`averageCpc`/`costPerConversion`/`averageDailyCost`/`balance`/`remainingAccountBudget`,含可选 `previousPeriod` 环比对象;可省略。**本期 KPI 优先对 `campaigns` 全系列累加并重算比率**;无 campaigns 时回退 `overview.currentPeriod`。余额/日均仍来自 overview。
|
|
51
|
+
- `tables`(可省略,由 `--snapshot-dir` 按上表形状自动映射):
|
|
52
|
+
- `devices[]`:`{deviceType, spend, impressions, clicks, ctr, averageCpc, conversions, costPerConversion}`
|
|
53
|
+
- `geographic[]`:`{countryOrRegion, spend, impressions, clicks, ctr, averageCpc, conversions, costPerConversion}`
|
|
54
|
+
- `audienceAge[]`:`{ageRange, spend, impressions, clicks, ctr, averageCpc, conversions}`
|
|
55
|
+
- `audienceGender[]`:`{gender, spend, impressions, clicks, ctr, averageCpc, conversions}`
|
|
56
|
+
- `campaigns[]`:`{campaignName, campaignStatus, campaignStatusDisplay, spend, impressions, clicks, ctr, conversions, costPerConversion}`
|
|
57
|
+
- `adGroups[]`:`{adGroupName, campaignName, qualityScore, spend, clicks, ctr, conversions, costPerConversion}`
|
|
58
|
+
- `ads[]`:`{adTitle, adGroupName, adType, spend, clicks, ctr, conversions}`
|
|
59
|
+
- `keywords[]`:`{keyword, matchType, qualityScore, spend, ctr, averageCpc, conversions, costPerConversion}`
|
|
60
|
+
- `searchTerms[]`:`{searchQuery, keyword, deliveredMatchType, spend, ctr, conversions, costPerConversion}`
|
|
61
|
+
- `narrative`(**Agent 必填,唯一由 Agent 撰写的叙事内容**):
|
|
62
|
+
- `executiveSummary[]`:≥1 段执行摘要
|
|
63
|
+
- `sections.{overview,devices,geographic,audience,campaigns,adGroups,ads,keywords,searchTerms}`:每个维度各 `{analysis[](≥1 条,含数字依据), suggestions[](≥1 条)}`
|
|
64
|
+
- `recommendations[]`:≥3 条跨维度优化建议汇总
|
|
65
|
+
|
|
66
|
+
### 快照合并范围(`--snapshot-dir`)
|
|
67
|
+
|
|
68
|
+
`render` 传 `--snapshot-dir` 时,CLI 自动补全:
|
|
69
|
+
|
|
70
|
+
1. `meta` / `kpis`(含余额、日均、环比;本期 KPI 优先 campaigns 累加)
|
|
71
|
+
2. `tables.*`(按上表落盘形状映射;Agent 已填字段不覆盖)
|
|
72
|
+
|
|
73
|
+
Agent 只需撰写 `narrative`;**禁止手写 HTML**。`ctr` / `conversionRate` 落盘已为 0~1 小数。
|
|
8
74
|
|
|
9
75
|
---
|
|
10
76
|
|
|
@@ -18,11 +84,11 @@
|
|
|
18
84
|
|
|
19
85
|
用户指定某一月份(如「6月份报告」「6月 Bing 月报」)且该月**已结束**时:
|
|
20
86
|
|
|
21
|
-
| 项
|
|
22
|
-
|
|
|
23
|
-
| `--start` | 当月 **1 日**(如 `2026-06-01`)
|
|
24
|
-
| `--end`
|
|
25
|
-
| 报告首行
|
|
87
|
+
| 项 | 规则 |
|
|
88
|
+
| --------- | ---------------------------------------------------------------- |
|
|
89
|
+
| `--start` | 当月 **1 日**(如 `2026-06-01`) |
|
|
90
|
+
| `--end` | 当月**最后一天**(如 6 月 → `2026-06-30`,**禁止**写成 `06-29`) |
|
|
91
|
+
| 报告首行 | `统计区间:YYYY-MM-01 ~ YYYY-MM-<末>` |
|
|
26
92
|
|
|
27
93
|
示例(7 月 8 日要 6 月报告):
|
|
28
94
|
|
|
@@ -103,9 +169,9 @@ CLI 落盘时会:overview 余额为 0 → 调 `GetMediaAccountInfo` → 写回
|
|
|
103
169
|
|
|
104
170
|
Bing 网关常不返回 `averageDailyCost`、`activeDays`(或为 0)。CLI 落盘前会:① 缺 `totalCost` 时用 `currentPeriod.spend`;② 缺 `activeDays` 时用 `--start`~`--end` 含首尾日历天数;③ `averageDailyCost = totalCost / activeDays`(保留 2 位小数)。
|
|
105
171
|
|
|
106
|
-
**数据呈现**:区间消耗、展示、点击、转化、CTR、CPC、CPA、日均消耗、**实时余额**(`balance`)、优化分;**有效** `previousPeriod`
|
|
172
|
+
**数据呈现**:区间消耗、展示、点击、转化、CTR、CPC、CPA、日均消耗、**实时余额**(`balance`)、优化分;**有效** `previousPeriod` 时展示环比。写入 JSON `kpis`(可由 `--snapshot-dir` 自动合并)。
|
|
107
173
|
|
|
108
|
-
|
|
174
|
+
**分析(必写)** → 写入 `narrative.sections.overview.{analysis,suggestions}`:
|
|
109
175
|
|
|
110
176
|
- **总结**:本期 vs 上期消耗/点击/转化/CTR/CPC/CPA 变化(**仅当 previousPeriod 有数据**);展示份额(`searchImpressionShare`)及预算/排名丢失份额;余额与日均消耗可支撑天数(用 **`balance` / `remainingAccountBudget`**,非 overview 快照 0)。
|
|
111
177
|
- **建议**:账户级预算或投放节奏(引用具体百分比或金额);若展示份额丢失高 → 预算或出价方向;1~3 条。
|
|
@@ -116,9 +182,9 @@ Bing 网关常不返回 `averageDailyCost`、`activeDays`(或为 0)。CLI
|
|
|
116
182
|
|
|
117
183
|
- **CLI**:`bing-analysis --sections device` → `DeviceSectionData`(行在 `devices[]`)
|
|
118
184
|
|
|
119
|
-
**数据呈现**:各 `deviceType` 的展示、点击、消耗、CTR、CPC、转化、CPA
|
|
185
|
+
**数据呈现**:各 `deviceType` 的展示、点击、消耗、CTR、CPC、转化、CPA;建议附消耗占比。写入 JSON `tables.devices[]`。
|
|
120
186
|
|
|
121
|
-
|
|
187
|
+
**分析(必写)** → 写入 `narrative.sections.devices.{analysis,suggestions}`:
|
|
122
188
|
|
|
123
189
|
- **总结**:主消耗设备、各设备 CPA/CPC 差异、高消耗低转化设备。
|
|
124
190
|
- **建议**:设备出价调整或预算向高转化设备倾斜(写设备名 + 表中数字),1~3 条。
|
|
@@ -129,9 +195,9 @@ Bing 网关常不返回 `averageDailyCost`、`activeDays`(或为 0)。CLI
|
|
|
129
195
|
|
|
130
196
|
- **CLI**:`bing-analysis --sections geographic` → `GeographicSectionData`(常见 `countries[]`,**以 outline 为准**)
|
|
131
197
|
|
|
132
|
-
**数据呈现**:Top 国家/地区(建议 Top 10)消耗、点击、转化、CTR、CPC、CPA
|
|
198
|
+
**数据呈现**:Top 国家/地区(建议 Top 10)消耗、点击、转化、CTR、CPC、CPA。写入 JSON `tables.geographic[]`。
|
|
133
199
|
|
|
134
|
-
|
|
200
|
+
**分析(必写)** → 写入 `narrative.sections.geographic.{analysis,suggestions}`:
|
|
135
201
|
|
|
136
202
|
- **总结**:地域消耗集中度、高转化 vs 高消耗低转化国家/地区。
|
|
137
203
|
- **建议**:地域加价/降价/排除或单独系列(写 `countryOrRegion` + 数据),1~3 条。
|
|
@@ -142,9 +208,9 @@ Bing 网关常不返回 `averageDailyCost`、`activeDays`(或为 0)。CLI
|
|
|
142
208
|
|
|
143
209
|
- **CLI**:推荐 `bing-analysis --sections audience-merged`(年龄+性别合并 JSON);或分别 `--sections age-audience` / `--sections gender-audience`
|
|
144
210
|
|
|
145
|
-
**数据呈现**:年龄段、性别的展示、点击、消耗、CTR、CPC(按 `data.ageAudience.audience` / `data.genderAudience.audience
|
|
211
|
+
**数据呈现**:年龄段、性别的展示、点击、消耗、CTR、CPC(按 `data.ageAudience.audience` / `data.genderAudience.audience`)。写入 JSON `tables.audienceAge[]` / `tables.audienceGender[]`。
|
|
146
212
|
|
|
147
|
-
|
|
213
|
+
**分析(必写)** → 写入 `narrative.sections.audience.{analysis,suggestions}`:
|
|
148
214
|
|
|
149
215
|
- **总结**:主力年龄段/性别、转化或 CPA 更优的受众段、无效花费受众。
|
|
150
216
|
- **建议**:受众出价\_modifier 或排除(引用 `audience` 字段 + 指标),1~3 条。
|
|
@@ -159,13 +225,13 @@ Bing 网关常不返回 `averageDailyCost`、`activeDays`(或为 0)。CLI
|
|
|
159
225
|
| 广告组 | `bing-analysis --sections ad-groups` | `ad-groups-*.json` |
|
|
160
226
|
| 广告 | `bing-analysis --sections ads` | `ads-*.json` |
|
|
161
227
|
|
|
162
|
-
**数据呈现**:各表按消耗降序;系列含 `campaignStatus`;广告组可含质量分相关字段(以 outline
|
|
228
|
+
**数据呈现**:各表按消耗降序;系列含 `campaignStatus`;广告组可含质量分相关字段(以 outline 为准)。写入 JSON `tables.campaigns[]` / `tables.adGroups[]` / `tables.ads[]`。
|
|
163
229
|
|
|
164
230
|
**分析(必写,三个子块各写一段,不可合并为一句带过)**:
|
|
165
231
|
|
|
166
|
-
1. **系列分析 — 总结**:Top 系列及费用占比、暂停/活跃系列效果差异、合计 CTR/CPC/CPA。**建议**:预算增减、暂停或放量具体 `campaignName`,1~3
|
|
167
|
-
2. **广告组分析 — 总结**:高消耗广告组、质量分或 CPA 异常组。**建议**:出价、暂停或结构优化(写 `adGroupName` + 数据),1~3
|
|
168
|
-
3. **广告分析 — 总结**:Top 消耗创意、CTR/转化表现分化。**建议**:暂停低效广告、复制高效创意方向,1~3
|
|
232
|
+
1. **系列分析 — 总结**:Top 系列及费用占比、暂停/活跃系列效果差异、合计 CTR/CPC/CPA。**建议**:预算增减、暂停或放量具体 `campaignName`,1~3 条。→ 写入 `narrative.sections.campaigns.{analysis,suggestions}`
|
|
233
|
+
2. **广告组分析 — 总结**:高消耗广告组、质量分或 CPA 异常组。**建议**:出价、暂停或结构优化(写 `adGroupName` + 数据),1~3 条。→ 写入 `narrative.sections.adGroups.{analysis,suggestions}`
|
|
234
|
+
3. **广告分析 — 总结**:Top 消耗创意、CTR/转化表现分化。**建议**:暂停低效广告、复制高效创意方向,1~3 条。→ 写入 `narrative.sections.ads.{analysis,suggestions}`
|
|
169
235
|
|
|
170
236
|
---
|
|
171
237
|
|
|
@@ -176,18 +242,18 @@ Bing 网关常不返回 `averageDailyCost`、`activeDays`(或为 0)。CLI
|
|
|
176
242
|
| 关键词 | `bing-analysis --sections keywords` | 默认 `limit=100`、`orderByCost=true` |
|
|
177
243
|
| 搜索字词 | `bing-analysis --sections search-terms` | 同上 |
|
|
178
244
|
|
|
179
|
-
**数据呈现**:Top 关键词/搜索词表(消耗、CTR、CPC、转化、CPA、质量分/匹配类型等,以 outline
|
|
245
|
+
**数据呈现**:Top 关键词/搜索词表(消耗、CTR、CPC、转化、CPA、质量分/匹配类型等,以 outline 为准)。写入 JSON `tables.keywords[]` / `tables.searchTerms[]`。
|
|
180
246
|
|
|
181
247
|
**分析(必写,两块各写一段)**:
|
|
182
248
|
|
|
183
|
-
1. **关键词 — 总结**:高转化词、高消耗低转化或零转化词、匹配类型分布。**建议**:暂停/降价/提价/改匹配(写 `keyword` + 数据),1~3
|
|
184
|
-
2. **搜索字词 — 总结**:高意向词、应加为关键词的词、应否定的无关词(对比触发 `keyword`)。**建议**:加词、否词(写 `searchQuery` + 数据),1~3
|
|
249
|
+
1. **关键词 — 总结**:高转化词、高消耗低转化或零转化词、匹配类型分布。**建议**:暂停/降价/提价/改匹配(写 `keyword` + 数据),1~3 条。→ 写入 `narrative.sections.keywords.{analysis,suggestions}`
|
|
250
|
+
2. **搜索字词 — 总结**:高意向词、应加为关键词的词、应否定的无关词(对比触发 `keyword`)。**建议**:加词、否词(写 `searchQuery` + 数据),1~3 条。→ 写入 `narrative.sections.searchTerms.{analysis,suggestions}`
|
|
185
251
|
|
|
186
252
|
---
|
|
187
253
|
|
|
188
254
|
## 7. 报告收尾(全账户)
|
|
189
255
|
|
|
190
|
-
在以上各 section
|
|
256
|
+
在以上各 section 分析之后,须撰写 **「优化建议汇总」**(3~5 条,写入 JSON `narrative.recommendations[]`),跨 section 归纳优先级,**须与前面各 section 分析一致、不得矛盾**;可呼应对外客户话术(若用户需要)。
|
|
191
257
|
|
|
192
258
|
---
|
|
193
259
|
|