siluzan-tso-cli 1.1.26-beta.3 → 1.1.27-beta.1

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 CHANGED
@@ -51,7 +51,7 @@ siluzan-tso init -d /path/to/skills # 写入自定义目录
51
51
  siluzan-tso init --force # 强制覆盖已存在文件
52
52
  ```
53
53
 
54
- > **注意**:当前为测试版(1.1.26-beta.3),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
54
+ > **注意**:当前为测试版(1.1.27-beta.1),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
55
55
 
56
56
  | 助手 | 建议 `--ai` |
57
57
  | ----------------------- | ------------------------------------ |
package/dist/index.js CHANGED
@@ -121637,15 +121637,34 @@ async function runWebsiteDiagnosisCollect(opts) {
121637
121637
  }
121638
121638
 
121639
121639
  // src/commands/website-diagnosis/render-report.ts
121640
- import fs12 from "fs/promises";
121640
+ import fs12 from "fs";
121641
+ import fsPromises from "fs/promises";
121641
121642
  import path17 from "path";
121642
121643
  import { fileURLToPath as fileURLToPath4 } from "url";
121643
- function websiteDiagnosisReportTemplatePath() {
121644
+ var TEMPLATE_BASENAMES = {
121645
+ html: "website-diagnosis-report.html",
121646
+ runtime: "website-diagnosis-report.runtime.js"
121647
+ };
121648
+ function resolveSkillTemplatePath(basename11) {
121644
121649
  const dir = path17.dirname(fileURLToPath4(import.meta.url));
121645
- return path17.join(dir, "skill", "siluzan-ads", "report-templates", "website-diagnosis-report.html");
121650
+ const candidates = [
121651
+ path17.join(dir, "skill", "report-templates", basename11),
121652
+ path17.join(dir, "skill", "siluzan-ads", "report-templates", basename11),
121653
+ path17.join(dir, "..", "..", "assets", "siluzan-ads", "report-templates", basename11)
121654
+ ];
121655
+ for (const p of candidates) {
121656
+ if (fs12.existsSync(p)) return p;
121657
+ }
121658
+ return candidates[0];
121659
+ }
121660
+ function websiteDiagnosisReportTemplatePath() {
121661
+ return resolveSkillTemplatePath(TEMPLATE_BASENAMES.html);
121662
+ }
121663
+ function websiteDiagnosisRuntimePath() {
121664
+ return resolveSkillTemplatePath(TEMPLATE_BASENAMES.runtime);
121646
121665
  }
121647
121666
  function readJsonFile(filePath) {
121648
- const raw = fs12.readFile(filePath, "utf8");
121667
+ const raw = fsPromises.readFile(filePath, "utf8");
121649
121668
  return raw.then((text) => {
121650
121669
  try {
121651
121670
  return JSON.parse(text);
@@ -121688,7 +121707,7 @@ async function runWebsiteDiagnosisRender(opts) {
121688
121707
  const templatePath = websiteDiagnosisReportTemplatePath();
121689
121708
  let html;
121690
121709
  try {
121691
- html = await fs12.readFile(templatePath, "utf8");
121710
+ html = await fsPromises.readFile(templatePath, "utf8");
121692
121711
  } catch {
121693
121712
  console.error(`
121694
121713
  \u274C \u672A\u627E\u5230\u62A5\u544A\u6A21\u677F\uFF1A${templatePath}
@@ -121699,12 +121718,26 @@ async function runWebsiteDiagnosisRender(opts) {
121699
121718
  const outPath = path17.resolve(
121700
121719
  opts.out ?? path17.join(path17.dirname(dataPath), "website-diagnosis-report.html")
121701
121720
  );
121702
- await fs12.mkdir(path17.dirname(outPath), { recursive: true });
121703
- await fs12.writeFile(outPath, injectReportData(html, data), "utf8");
121721
+ const outDir = path17.dirname(outPath);
121722
+ await fsPromises.mkdir(outDir, { recursive: true });
121723
+ await fsPromises.writeFile(outPath, injectReportData(html, data), "utf8");
121724
+ const runtimeSrc = websiteDiagnosisRuntimePath();
121725
+ const runtimeOut = path17.join(outDir, TEMPLATE_BASENAMES.runtime);
121726
+ try {
121727
+ await fsPromises.copyFile(runtimeSrc, runtimeOut);
121728
+ } catch {
121729
+ console.error(`
121730
+ \u274C \u672A\u627E\u5230\u62A5\u544A\u8FD0\u884C\u65F6\uFF1A${runtimeSrc}
121731
+ \u8BF7\u5148\u6267\u884C npm run build
121732
+ `);
121733
+ process.exit(1);
121734
+ }
121704
121735
  console.log(`
121705
121736
  \u2705 \u7F51\u7AD9\u8BCA\u65AD HTML \u62A5\u544A\u5DF2\u751F\u6210\uFF1A${outPath}
121706
121737
  `);
121707
- console.log("\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00\u8BE5\u6587\u4EF6\u5373\u53EF\u67E5\u770B\u56FE\u8868\u4E0E\u5B8C\u6574\u7AE0\u8282\u3002\n");
121738
+ console.log(` \u8FD0\u884C\u65F6\u811A\u672C\uFF1A${runtimeOut}
121739
+ `);
121740
+ console.log("\u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00 HTML \u6587\u4EF6\u5373\u53EF\u67E5\u770B\u56FE\u8868\u4E0E\u5B8C\u6574\u7AE0\u8282\uFF08\u9700\u8054\u7F51\u52A0\u8F7D ECharts CDN\uFF09\u3002\n");
121708
121741
  }
121709
121742
 
121710
121743
  // src/commands/website-diagnosis/register.ts
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: siluzan-tso
3
- description: Operates Siluzan TSO ad accounts via siluzan-tso-cli Google/Bing/Yandex/TikTok/Kwai/Meta account management, Google Ads CRUD and PMax, analytics, optimization reports, forewarning, leads, invoicing, and RAG knowledge lookup. Use when the user mentions ad accounts, balance, spend, campaigns, keywords, open account, MCC/BC binding, or TSO reporting. On each new user task or topic switch, re-read routed references per references/core/agent-conventions.md do not reuse prior task memory.
3
+ description: Operates Siluzan TSO ad accounts via siluzan-tso-cli (Google/Bing/Yandex/TikTok/Kwai/MetaAd). Tasks: (accounts) list, balance, stats, spend, active-bills, history, balance-scan P2, accounts-digest P3, share/unshare, delink, OAuth, MCC/BC/BM bind-unbind, email invite, TikTok close, suspend withdraw; (open-account) apply on 6 media; (Google Ads) campaign/adgroup/ad/keyword CRUD, extensions, geo, PMax, search campaign-plan validate/create, batch async create; (analytics) google-analysis, google-analysis-batch P5, facebook-analysis P4-FB, website-diagnosis P8, ads diagnosis; (reports) P1 profile, P4 period, P6 OKKI weekly, P7 inquiry; (tools) keyword suggest, RAG query, TSO report list/create/push, AI optimize records, forewarning rules, TikTok/Meta leads, transfer/invoice/invoice-info, audit restore. Use when user mentions ad accounts, balance, spend, campaigns, keywords, open account, MCC/BC, reports, diagnosis, invoicing, or TSO. Re-read references/core/agent-conventions.md each new task.
4
4
  license: MIT
5
5
  compatibility: Requires Node.js 18+, siluzan-tso-cli installed, authenticated via send-login-code + login or config set
6
6
  metadata:
@@ -87,7 +87,7 @@ Windows:部分 Agent 通过 PowerShell 代执行时可能失败,改在 [Git
87
87
  | 账户列表 / 余额 / 消耗 / 分享 / MCC / 多账户汇总 | `accounts/accounts.md`;金额加 `accounts/currency.md` |
88
88
  | 拉数 / 报告 / 周报 / `google-analysis` | `analytics/account-analytics.md` + `core/tips.md` + **`core/deliverable-preflight.md`**;多账户加 `analytics/google-analysis-batch.md` |
89
89
  | Meta/Facebook 周期或诊断报告 / `facebook-analysis` | `analytics/facebook-analysis-guide.md` + `report-templates/meta-period-report.md`(或 `meta-account-diagnosis-report.md`)+ `core/playbooks.md` P4-FB |
90
- | 网站诊断 / 落地页评分 / `website-diagnosis` | `analytics/website-diagnosis-guide.md` + `assets/website-diagnosis-rules.md` + `report-templates/website-diagnosis-report.md`(**终稿 HTML**)+ `core/playbooks.md` P8 |
90
+ | 网站诊断 / 落地页评分 / `website-diagnosis` | `analytics/website-diagnosis-guide.md` + `assets/website-diagnosis-rules.md` + `core/playbooks.md` P8;Agent 只写 JSON,`website-diagnosis render` 出 HTML |
91
91
  | Google 新建搜索系列 | `google-ads/google-ads-campaign-plan.md` |
92
92
  | Google 广告 CRUD / 拒审 | `google-ads/google-ads.md` |
93
93
  | PMax | `assets/pmax-create-template.md` + `google-ads/pmax-api.md` |
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "slug": "siluzan-tso",
3
- "version": "1.1.26-beta.3",
4
- "publishedAt": 1780540125141
3
+ "version": "1.1.27-beta.1",
4
+ "publishedAt": 1780630877715
5
5
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  > 对齐 Aiagent-Server `agent/tso_agent`:`getWebsiteDiagnosisData`(`website_diagnosis_tools.py` + `data/website_guide.py`)。
4
4
  > **CLI 负责拉数**;**6 模块 × 29 子项评分**由 Agent 按规则 + 采集数据生成 JSON。
5
- > **最终交付**:与线上一致,为**一份可浏览器打开、含 ECharts 图表的单文件 HTML 报告**(雷达图、模块得分条形图、Lighthouse 对比图等)。TSO 网页由 Vue `WebsiteAnalysisReport/v3` 渲染;Skill/CLI 场景用 `website-diagnosis render` 或按 `report-templates/website-diagnosis-report.html` 注入 JSON。
5
+ > **最终交付**:与线上一致,为**一份可浏览器打开、含 ECharts 图表的单文件 HTML 报告**(雷达图、模块得分条形图、Lighthouse 对比图等)。TSO 网页由 Vue `WebsiteAnalysisReport/v3` 渲染;Skill/CLI 场景 **Agent 只写诊断 JSON,HTML 一律由 `website-diagnosis render` 生成**(禁止 Agent 手写 HTML)。
6
6
 
7
7
  ---
8
8
 
@@ -55,11 +55,11 @@ siluzan-tso website-diagnosis render --data ./diagnosis.json --collect ./snap-we
55
55
  2. `website-diagnosis collect --url <url> --json-out ./snap-web`(**必须** `--json-out`)。
56
56
  3. Read `assets/website-diagnosis-rules.md`(评分规则与 JSON Schema)。
57
57
  4. 用脚本读 `writtenFiles[0]` 的 `lighthouse`、`htmlPreview`(或 `--include-html` 时的 `htmlContent`)生成结构化 `data`(见下节输出契约)。
58
- 5. 生成诊断 JSON 后执行:
58
+ 5. 将诊断 JSON 落盘为 `diagnosis.json`(脚本写文件,勿在对话里贴全文),再执行:
59
59
  ```bash
60
60
  siluzan-tso website-diagnosis render --data ./diagnosis.json --collect ./snap-web/<collect>.json --out ./snap-web/website-diagnosis-report.html
61
61
  ```
62
- 或按 `report-templates/website-diagnosis-report.html` JSON 写入 `window.__WEBSITE_DIAGNOSIS__`。**禁止**只给 Markdown/纯 JSON 充当终稿。
62
+ **禁止** Agent 手写/拼接 HTML;**禁止**只给 Markdown 或纯 JSON 充当终稿。
63
63
  6. **禁止编造**未在采集 HTML/Lighthouse 中出现的指标。Lighthouse 缺失时须在 HTML 中醒目说明。
64
64
 
65
65
  **在 TSO Copilot 网页内**:工具返回 `rendered: true` 时,前端已渲染卡片 +「查看详情」全页 HTML,Agent 只需简短确认,**勿重复贴报告正文**(见 tso_agent `prompt.py`)。
@@ -0,0 +1,140 @@
1
+ <!-- 本文件由 `pnpm --filter siluzan-tso-cli run gen:cli-enums` 自动生成,勿手改。源码:src/cli-enums/registry.ts -->
2
+
3
+ # CLI 枚举速查
4
+
5
+ > **Agent**:不确定 `--sections`、`-m`、`--operator` 等合法值时,**Read 本文件**(按章节)或执行:
6
+ > `siluzan-tso reference enums`(Markdown) / `siluzan-tso reference enums --json`(机器可读)。
7
+ > 各功能 reference 只保留业务说明;枚举与 CLI 校验**以此文件为准**(与源码同源)。
8
+
9
+ ### 媒体类型 `-m` / `--media`(多数命令)
10
+
11
+ | 命令 | 选项 | 合法值 |
12
+ | ---- | ---- | ------ |
13
+ | list-accounts, stats, balance, account-history, open-account, transfer, … | -m, --media | Google \| TikTok \| Yandex \| MetaAd \| BingV2 \| Kwai |
14
+
15
+
16
+ > 区分大小写;Meta 广告账户用 MetaAd,不是 Facebook。
17
+
18
+ ### 媒体类型(仅 forewarning)
19
+
20
+ | 命令 | 选项 | 合法值 |
21
+ | ---- | ---- | ------ |
22
+ | forewarning list, create, records, … | -m, --media | Google \| TikTok |
23
+
24
+
25
+ ### `google-analysis --sections` 维度(25)
26
+
27
+ | 命令 | 选项 | 合法值 |
28
+ | ---- | ---- | ------ |
29
+ | google-analysis, google-analysis-batch run | --sections | overview \| keywords \| search-terms \| campaigns \| campaign-hour \| ads \| extensions \| devices \| geographic \| geo-matched \| campaign-geo \| campaign-geo-matched \| campaign-device \| audience \| asset-images \| videos \| materials \| resource-counts \| conversion-actions \| daily-metrics \| gold-account \| ads-index \| final-urls \| dimension-summary \| campaign-types |
30
+
31
+
32
+ > 逗号分隔;省略=全部。`final-urls`、`campaign-types` 不传日期。
33
+
34
+ ### `google-analysis --level`(extensions 维度)
35
+
36
+ | 命令 | 选项 | 合法值 |
37
+ | ---- | ---- | ------ |
38
+ | google-analysis --sections extensions | --level | Account \| Campaign \| Ad Group |
39
+
40
+
41
+ ### `google-analysis --audience-type`(audience 维度)
42
+
43
+ | 命令 | 选项 | 合法值 |
44
+ | ---- | ---- | ------ |
45
+ | google-analysis --sections audience | --audience-type | SystemDefined \| UserDefined |
46
+
47
+
48
+ ### `facebook-analysis --sections` 维度(7)
49
+
50
+ | 命令 | 选项 | 合法值 |
51
+ | ---- | ---- | ------ |
52
+ | facebook-analysis | --sections | overview \| ad-sets \| platform \| country \| audience \| creative \| material |
53
+
54
+
55
+ > 默认周期报告:overview,ad-sets,platform,country,audience,creative。
56
+
57
+ ### `facebook-analysis --sections` Google 别名
58
+
59
+ | 命令 | 选项 | 合法值 |
60
+ | ---- | ---- | ------ |
61
+ | facebook-analysis | --sections(别名) | — |
62
+
63
+
64
+ > 解析后映射到左侧 canonical 名。
65
+
66
+ **别名**:`campaigns` → `ad-sets`;`ad-groups` → `ad-sets`;`geographic` → `country`;`geo` → `country`;`devices` → `platform`;`network` → `platform`;`networks` → `platform`;`ads` → `creative`;`materials` → `material`;`asset-images` → `material`;`videos` → `material`
67
+
68
+ ### `ad extension * --level`
69
+
70
+ | 命令 | 选项 | 合法值 |
71
+ | ---- | ---- | ------ |
72
+ | ad extension sitelink, callout, snippet, … | --level | Account \| Campaign \| AdGroup |
73
+
74
+
75
+ ### 搜索系列 `BiddingStrategyTypeV2`
76
+
77
+ | 命令 | 选项 | 合法值 |
78
+ | ---- | ---- | ------ |
79
+ | ad campaign-create, campaign-validate(config JSON) | campaign.BiddingStrategyTypeV2 | TARGET_SPEND \| MANUAL_CPC \| TARGET_CPA \| TARGET_ROAS \| MAXIMIZE_CONVERSIONS \| MAXIMIZE_CONVERSION_VALUE |
80
+
81
+
82
+ ### 系列 `ChannelTypeV2`
83
+
84
+ | 命令 | 选项 | 合法值 |
85
+ | ---- | ---- | ------ |
86
+ | ad campaign-create, campaign-validate | campaign.ChannelTypeV2 | SEARCH \| DISPLAY \| VIDEO \| SHOPPING \| MULTI_CHANNEL |
87
+
88
+
89
+ ### 系列 `StatusV2`
90
+
91
+ | 命令 | 选项 | 合法值 |
92
+ | ---- | ---- | ------ |
93
+ | ad campaign-create, campaign-validate | campaign.StatusV2 | Enabled \| Paused |
94
+
95
+
96
+ ### 预算投放 `BudgetBudgetDeliveryMethodV2`
97
+
98
+ | 命令 | 选项 | 合法值 |
99
+ | ---- | ---- | ------ |
100
+ | ad campaign-create, campaign-validate | campaign.BudgetBudgetDeliveryMethodV2 | STANDARD \| ACCELERATED \| UNSPECIFIED \| UNKNOWN |
101
+
102
+
103
+ ### PMax `BiddingStrategyTypeV2`
104
+
105
+ | 命令 | 选项 | 合法值 |
106
+ | ---- | ---- | ------ |
107
+ | ad pmax-create, pmax-validate | campaign.BiddingStrategyTypeV2 | MAXIMIZE_CONVERSIONS \| MAXIMIZE_CONVERSION_VALUE \| TARGET_CPA \| TARGET_ROAS |
108
+
109
+
110
+ ### 预警比较运算符
111
+
112
+ | 命令 | 选项 | 合法值 |
113
+ | ---- | ---- | ------ |
114
+ | forewarning create | --operator | GREATER_EQUALS \| GREATER \| LESS_EQUALS \| LESS \| EQUALS |
115
+
116
+
117
+ ### 开户历史状态筛选
118
+
119
+ | 命令 | 选项 | 合法值 |
120
+ | ---- | ---- | ------ |
121
+ | account-history | --status(mediaAccountState) | Created \| Approved \| Denied \| Inactive |
122
+
123
+
124
+ > Google 默认含 Inactive;其他媒体默认 Created,Approved,Denied。
125
+
126
+ ### 线索表单媒体
127
+
128
+ | 命令 | 选项 | 合法值 |
129
+ | ---- | ---- | ------ |
130
+ | clue | -m, --media | TikTok \| Meta |
131
+
132
+
133
+ ### 网站诊断模块 status
134
+
135
+ | 命令 | 选项 | 合法值 |
136
+ | ---- | ---- | ------ |
137
+ | website-diagnosis collect(响应字段) | modules[].status | Excellent \| Good \| Normal \| Poor \| Full \| NeedImprove \| Absent |
138
+
139
+
140
+ > 撰写报告时转中文展示;细则见 assets/website-diagnosis-rules.md。
@@ -184,7 +184,11 @@ siluzan-tso accounts-digest -m Google -a id1,id2,... --start <S> --end <D> --jso
184
184
  ```
185
185
 
186
186
  3. Read `assets/website-diagnosis-rules.md`;按 outline → JSON 读 `lighthouse` / `htmlPreview`。
187
- 4. 生成与 tso_agent `getWebsiteDiagnosisData` 同结构的 `data`(6 模块、29 子项、`ratingId`、`coreIssuesIds`)。
188
- 5. 执行 `website-diagnosis render --data <diagnosis.json> --collect <collect.json>` 生成 **带图表的** `website-diagnosis-report.html`(模板见 `report-templates/website-diagnosis-report.html`);勿只交付 Markdown。
187
+ 4. 用脚本将诊断结果落盘为 `diagnosis.json`(与 tso_agent `getWebsiteDiagnosisData` 同结构:6 模块、29 子项、`ratingId`、`coreIssuesIds`;可含 `lighthouseResult`、`analyzedAt`)。
188
+ 5. **只调 CLI HTML**(禁止 Agent 手写 HTML):
189
+ ```bash
190
+ siluzan-tso website-diagnosis render --data ./diagnosis.json --collect ./snap-web/<collect>.json --out ./snap-web/website-diagnosis-report.html
191
+ ```
192
+ 向用户交付该 HTML 路径;勿只交付 Markdown 或 JSON。
189
193
  6. Lighthouse 缺失时在 HTML 中说明;Copilot 网页场景若已 `rendered: true` 则勿重复输出报告正文。
190
194
  7. 若用户仅需历史 ARIT 分:`list-accounts` 或 `website-diagnosis search --ids <websiteDiagnoseId>`。