siluzan-tso-cli 1.1.13 → 1.1.14-beta.10

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 (114) hide show
  1. package/README.md +2 -3
  2. package/assets/siluzan-ads/references/hosted-automation-user-catalog.md +40 -0
  3. package/dist/index.js +371 -55
  4. package/dist/skill/SKILL.md +78 -37
  5. package/dist/skill/_meta.json +2 -2
  6. package/dist/skill/references/account-analytics.md +69 -2
  7. package/dist/skill/references/accounts.md +8 -5
  8. package/dist/skill/references/clue.md +5 -0
  9. package/dist/skill/references/finance.md +9 -5
  10. package/dist/skill/references/forewarning.md +7 -0
  11. package/dist/skill/references/google-ads-rules/google-ads-campaign-optimization.md +3 -2
  12. package/dist/skill/references/google-ads.md +123 -101
  13. package/dist/skill/references/hosted-automation-monitoring-json.md +94 -0
  14. package/dist/skill/references/hosted-automation-optimize-ab-winner.md +69 -0
  15. package/dist/skill/references/hosted-automation-optimize-index.md +32 -0
  16. package/dist/skill/references/hosted-automation-optimize-scale.md +99 -0
  17. package/dist/skill/references/hosted-automation-optimize-weak-downbid.md +94 -0
  18. package/dist/skill/references/hosted-automation-scenarios.md +23 -0
  19. package/dist/skill/references/hosted-automation-self-control.md +216 -0
  20. package/dist/skill/references/hosted-automation-user-catalog.md +40 -0
  21. package/dist/skill/references/open-account-google-ui.md +0 -6
  22. package/dist/skill/references/reporting.md +4 -2
  23. package/dist/skill/references/setup.md +5 -5
  24. package/dist/skill/references/tips.md +6 -0
  25. package/dist/skill/references/tso-home.md +1 -1
  26. package/dist/skill/references/workflows.md +14 -1
  27. package/dist/skill/report-templates/google-account-diagnosis-report.md +1 -1
  28. package/dist/skill/report-templates/google-period-report.md +1 -0
  29. package/dist/skill/scripts/install.ps1 +2 -2
  30. package/dist/skill/scripts/install.sh +2 -2
  31. package/eval/cases/accounts-entityid-vs-mediaccustomerid.scenario.json +23 -0
  32. package/eval/cases/accounts-mcc-bind-inquiry.scenario.json +12 -0
  33. package/eval/cases/accounts-single-balance-not-bulk.scenario.json +23 -0
  34. package/eval/cases/budget-display-not-raw-micros.scenario.json +17 -0
  35. package/eval/cases/clue-meta-leads-json.scenario.json +23 -0
  36. package/eval/cases/clue-tiktok-leads-json.scenario.json +20 -0
  37. package/eval/cases/destructive-account-delink-needs-confirm.scenario.json +15 -0
  38. package/eval/cases/destructive-forewarning-delete-needs-confirm.scenario.json +15 -0
  39. package/eval/cases/destructive-invoice-apply-needs-confirm.scenario.json +15 -0
  40. package/eval/cases/destructive-unshare-needs-confirm.scenario.json +9 -0
  41. package/eval/cases/finance-invoice-info-list.scenario.json +17 -0
  42. package/eval/cases/forewarning-list-google.scenario.json +20 -0
  43. package/eval/cases/google-ads-no-structural-without-confirm.scenario.json +12 -0
  44. package/eval/cases/google-analysis-keywords-route.scenario.json +23 -0
  45. package/eval/cases/hosted-sop-cpa-spike-downbid.scenario.json +14 -0
  46. package/eval/cases/hosted-sop-daily-budget-circuit-breaker.scenario.json +13 -0
  47. package/eval/cases/hosted-sop-empty-spend-pause-p1.scenario.json +14 -0
  48. package/eval/cases/human-p1-multiturn.scenario.json +17 -0
  49. package/eval/cases/meta-single-balance-not-bulk.scenario.json +26 -0
  50. package/eval/cases/open-account-bing-noninteractive.scenario.json +13 -0
  51. package/eval/cases/open-account-google-noninteractive.scenario.json +12 -0
  52. package/eval/cases/open-account-tiktok-license-file.scenario.json +12 -0
  53. package/eval/cases/optimize-list-by-account.scenario.json +17 -0
  54. package/eval/cases/p1-single-account-profile.scenario.json +20 -0
  55. package/eval/cases/p2-balance-scan-bulk.scenario.json +18 -0
  56. package/eval/cases/p3-accounts-digest.scenario.json +20 -0
  57. package/eval/cases/p4-period-report-window.scenario.json +17 -0
  58. package/eval/cases/report-list-google.scenario.json +20 -0
  59. package/eval/cases/report-push-list-google.scenario.json +20 -0
  60. package/eval/cases/reporting-vs-account-analytics-routing.scenario.json +13 -0
  61. package/eval/cases/setup-login-or-env.scenario.json +12 -0
  62. package/eval/cases/setup-siluzan-data-permission-env.scenario.json +19 -0
  63. package/eval/cases/skill-async-poll-guidance.scenario.json +9 -0
  64. package/eval/cases/skill-optimize-vs-google-ads-distinction.scenario.json +13 -0
  65. package/eval/cases/tiktok-bc-bind-inquiry.scenario.json +12 -0
  66. package/eval/cases/time-range-must-ask.scenario.json +16 -0
  67. package/eval/cases/time-range-user-delegates-default.scenario.json +17 -0
  68. package/eval/cases/tips-json-filtering.scenario.json +12 -0
  69. package/eval/cases/tips-large-json-pagination.scenario.json +19 -0
  70. package/eval/cases/uj-ad-bluetooth-keywords-exclude-cheap-free.scenario.json +9 -0
  71. package/eval/cases/uj-ad-keywords-camping-tent-outdoor-plan.scenario.json +9 -0
  72. package/eval/cases/uj-ad-outdoor-campgear-search-plan.scenario.json +12 -0
  73. package/eval/cases/uj-analytics-30d-pdf-campaign-device-geo.scenario.json +29 -0
  74. package/eval/cases/uj-analytics-compare-google-tiktok-last-month-roi.scenario.json +17 -0
  75. package/eval/cases/uj-analytics-google-weekly-trends-campaigns-keywords.scenario.json +20 -0
  76. package/eval/cases/uj-analytics-report-push-weekly-email.scenario.json +12 -0
  77. package/eval/cases/uj-finance-invoice-records-this-month.scenario.json +20 -0
  78. package/eval/cases/uj-life-newbie-siluzan-google-end-to-end.scenario.json +13 -0
  79. package/eval/cases/uj-ops-google-accounts-list-normal.scenario.json +23 -0
  80. package/eval/cases/uj-ops-google-yesterday-spend-conversions.scenario.json +23 -0
  81. package/eval/cases/uj-ops-open-google-b2c-usd-shenzhen.scenario.json +13 -0
  82. package/eval/cases/uj-ops-pause-worst-adgroup-confirm.scenario.json +12 -0
  83. package/eval/cases/uj-ops-tiktok-leads-last-week.scenario.json +23 -0
  84. package/eval/cases/uj-patrol-all-media-balance-stats-forewarning.scenario.json +9 -0
  85. package/eval/cases/uj-patrol-cpc-spike-adgroups-over-15.scenario.json +18 -0
  86. package/eval/cases/uj-patrol-forewarning-create-daily-cap-3000.scenario.json +12 -0
  87. package/eval/cases/uj-patrol-forewarning-trigger-records.scenario.json +23 -0
  88. package/eval/cases/uj-patrol-google-balances-low.scenario.json +20 -0
  89. package/eval/cases/uj-roi-full-google-account-diagnosis.scenario.json +9 -0
  90. package/eval/cases/uj-roi-keywords-high-cpa-low-cvr-triage.scenario.json +9 -0
  91. package/eval/cases/uj-roi-optimize-records-then-execute-cautiously.scenario.json +20 -0
  92. package/eval/cases/uj-roi-search-terms-add-negative-keywords.scenario.json +23 -0
  93. package/eval/stub-fixtures/accounts-digest.json +33 -0
  94. package/eval/stub-fixtures/ad-campaigns.json +14 -0
  95. package/eval/stub-fixtures/balance-meta.json +6 -0
  96. package/eval/stub-fixtures/balance-scan.json +21 -0
  97. package/eval/stub-fixtures/balance.json +6 -0
  98. package/eval/stub-fixtures/clue-meta.json +7 -0
  99. package/eval/stub-fixtures/clue-tiktok.json +7 -0
  100. package/eval/stub-fixtures/forewarning-create-ok.json +1 -0
  101. package/eval/stub-fixtures/forewarning-records.json +7 -0
  102. package/eval/stub-fixtures/generic-ok.json +1 -0
  103. package/eval/stub-fixtures/google-analysis-search-terms.json +10 -0
  104. package/eval/stub-fixtures/google-analysis.json +7 -0
  105. package/eval/stub-fixtures/invoice-billable.json +7 -0
  106. package/eval/stub-fixtures/invoice-info-list.json +13 -0
  107. package/eval/stub-fixtures/invoice-list.json +10 -0
  108. package/eval/stub-fixtures/list-accounts.json +13 -0
  109. package/eval/stub-fixtures/optimize-list.json +7 -0
  110. package/eval/stub-fixtures/report-push-list.json +7 -0
  111. package/eval/stub-fixtures/stats.json +9 -0
  112. package/package.json +7 -2
  113. package/scripts/postinstall.mjs +27 -2
  114. package/dist/skill/references/open-account-by-media.md +0 -61
@@ -0,0 +1,7 @@
1
+ {
2
+ "ok": true,
3
+ "data": {
4
+ "keywords": [{ "text": "brand shoes", "cost": 12.34, "clicks": 40 }],
5
+ "meta": { "stub": true, "section": "KeywordSectionData" }
6
+ }
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "ok": true,
3
+ "data": {
4
+ "items": [{ "entityId": "bill-entity-1", "amount": 500.0, "currency": "USD", "media": "Google" }]
5
+ },
6
+ "meta": { "stub": true }
7
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "ok": true,
3
+ "data": {
4
+ "items": [
5
+ {
6
+ "id": "inv-1",
7
+ "invoiceType": "VATI",
8
+ "companyName": "Demo Tech Co., Ltd."
9
+ }
10
+ ]
11
+ },
12
+ "meta": { "stub": true }
13
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "ok": true,
3
+ "data": {
4
+ "items": [
5
+ { "invoiceNo": "INV202604001", "status": "Issued", "amount": 1200.0, "currency": "CNY", "media": "Google" },
6
+ { "invoiceNo": "INV202604002", "status": "Pending", "amount": 800.0, "currency": "CNY", "media": "TikTok" }
7
+ ]
8
+ },
9
+ "meta": { "stub": true }
10
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "ok": true,
3
+ "data": {
4
+ "items": [
5
+ {
6
+ "entityId": "f2a5ca16-cff9-4a9e-9aea-f7429c3e2696",
7
+ "mediaCustomerId": "4256317784",
8
+ "mag": { "advertiserName": "ACME Demo Brand" },
9
+ "currencyCode": "USD"
10
+ }
11
+ ]
12
+ }
13
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "ok": true,
3
+ "data": {
4
+ "items": [{ "id": "opt-1", "status": "Completed", "summary": "提高系列预算 10%" }]
5
+ },
6
+ "meta": { "stub": true }
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "ok": true,
3
+ "data": {
4
+ "configs": [{ "id": "pc-1", "reportType": "Google", "enabled": true, "recipients": ["ops@example.com"] }]
5
+ },
6
+ "meta": { "stub": true }
7
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "ok": true,
3
+ "data": {
4
+ "accountsoverview": {
5
+ "costMicrosDisplay": 500.12,
6
+ "currencyCode": "USD"
7
+ }
8
+ }
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siluzan-tso-cli",
3
- "version": "1.1.13",
3
+ "version": "1.1.14-beta.10",
4
4
  "description": "Siluzan 广告账户管理 CLI — 查询账户、余额、消耗数据,管理绑定关系与充值。",
5
5
  "keywords": [
6
6
  "ad-account",
@@ -18,8 +18,11 @@
18
18
  },
19
19
  "files": [
20
20
  "dist",
21
+ "eval/cases",
22
+ "eval/stub-fixtures",
21
23
  "README.md",
22
- "scripts/postinstall.mjs"
24
+ "scripts/postinstall.mjs",
25
+ "assets/siluzan-ads/references/hosted-automation-user-catalog.md"
23
26
  ],
24
27
  "type": "module",
25
28
  "publishConfig": {
@@ -36,6 +39,7 @@
36
39
  "@types/node": "^22.10.0",
37
40
  "@types/qrcode": "^1.5.6",
38
41
  "tsup": "^8.3.0",
42
+ "tsx": "^4.19.0",
39
43
  "typescript": "^5.7.2",
40
44
  "siluzan-cli-common": "1.0.0"
41
45
  },
@@ -71,6 +75,7 @@
71
75
  "build": "node scripts/write-defaults.mjs --env production && tsup && node scripts/copy-skill-assets.mjs --env production",
72
76
  "build:prod": "node scripts/write-defaults.mjs --env production && tsup && node scripts/copy-skill-assets.mjs --env production",
73
77
  "build:test": "node scripts/write-defaults.mjs --env test && tsup && node scripts/copy-skill-assets.mjs --env test",
78
+ "eval:export-cases": "tsx eval/scripts/export-scenarios.mts",
74
79
  "test:ad-read": "node scripts/test-ad-api-read.mjs",
75
80
  "start": "node dist/index.js"
76
81
  }
@@ -1,7 +1,32 @@
1
1
  /**
2
2
  * 安装本包后提示:升级 CLI 后请同步 Skill(见 siluzan-tso update)。
3
3
  * monorepo / 本地 link 时每次 install 也会执行,属预期。
4
+ *
5
+ * 自动化场景说明从 `assets/.../hosted-automation-user-catalog.md` 读取,避免在脚本内嵌含反引号的模板字符串导致语法错误。
4
6
  */
5
- console.log(
6
- "[siluzan-tso]: 安装成功,请执行 siluzan-tso init -d /path/to/skills 复制项目中最新的skill文件来更新你的skill",
7
+ import fs from "node:fs";
8
+ import path from "node:path";
9
+ import { fileURLToPath } from "node:url";
10
+
11
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
12
+ const catalogPath = path.join(
13
+ __dirname,
14
+ "..",
15
+ "assets",
16
+ "siluzan-ads",
17
+ "references",
18
+ "hosted-automation-user-catalog.md",
7
19
  );
20
+
21
+ const header =
22
+ "[siluzan-tso]: 安装成功,请执行 siluzan-tso init -d /path/to/skills 复制项目中最新的 skill 文件来更新你的 skill";
23
+
24
+ let body = "";
25
+ try {
26
+ body = "\n\n" + fs.readFileSync(catalogPath, "utf8").trimEnd();
27
+ } catch {
28
+ body =
29
+ "\n\n";
30
+ }
31
+
32
+ console.log(header + body);
@@ -1,61 +0,0 @@
1
- # 各媒体开户:接口与参数技术细节
2
-
3
- > 业务流程(步骤、所需资料、审核处理)见 `references/workflows.md` 流程一。
4
- > 本文件仅记录各媒体的底层接口路径与请求体结构,供排查问题或深度定制时参考。
5
-
6
- ---
7
-
8
- ## 路由对照
9
-
10
- | 媒体 | 前端路由(path) | 说明 |
11
- | ---------- | --------------------------------- | ------------------------------------------------------------------------------------------------ |
12
- | **Google** | `/openAnAccount?mediaType=Google` | 与 TikTok 共用 `openAnAccount.vue`;从开户记录进入 Google 时往往先弹 **GGwarn** 合规提示再进表单 |
13
- | **TikTok** | `/openAnAccount?mediaType=TikTok` | 同上组件,`mediaType` 区分字段与提交流程 |
14
- | **Yandex** | `/YandexOpenAnAccount` | 独立页面 `YandexOpenAnAccount_v2.vue` |
15
- | **BingV2** | `/bingOpenAnAccount` | 独立页面 `bingOpenAnAccount.vue` |
16
- | **Kwai** | `/KwaiOpenAnAccount` | 独立页面 `KwaiOpenAnAccount.vue` |
17
-
18
- ---
19
-
20
- ## 广告主组(magKey)接口
21
-
22
- 所有媒体在提交开户前都需要一个广告主组,并取得 `magKey`(MediaAccountGroupId):
23
-
24
- - **查询列表**:`GET {apiBaseUrl}/query/profile/steward-individual` → `profile.mediaAccountGroups[]`,项上 `key` 即 magKey
25
- - **创建**:`PUT {apiBaseUrl}/command/profile/steward-individual`,Header `s-command-type: AddMediaAccountGroup`
26
- - **更新**:`PUT {apiBaseUrl}/command/profile/steward-individual/{id}`,Header `s-command-type: UpdateMediaAccountGroup`
27
-
28
- **所有媒体均无需手动查询 magKey**:CLI 对每个媒体都会按 `--company`(或 `--advertiser-name` / `--company-name`)自动查找同名广告主组——存在则更新,不存在则创建——再用拿到的 magKey 提交开户。`--advertiser-id` 在所有开户命令中均为可选,仅供调试时手动指定。
29
-
30
- ---
31
-
32
- ## 各媒体提交接口
33
-
34
- | CLI 子命令 | 提交接口 | Method | 关键 Header / 特点 |
35
- | --------------------- | ------------------------------------------ | ------ | ---------------------------------------------------------------------------------------------------------------------- |
36
- | `open-account google` | `/command/media-account/google` | POST | `s-command-type: AddExistingMediaAccountList`;前置自动创建广告主组 |
37
- | `open-account tiktok` | `/command/media-account`(不是 `/google`) | POST | 同上;前置 `POST .../tiktok/Upload` 上传执照图片;可选 `POST .../command/attachment` 存档、`GET .../CheckUnionpayInfo` |
38
- | `open-account yandex` | `/command/media-account/AddAgencyClient` | POST | Body:`MediaAccountGroupId` + `AgencyClientInfo`(登录名、税号、电话等) |
39
- | `open-account bing` | `/command/media-account/AddBingV2Account` | POST | Body:`BingCustomerInfo` / `BingV2AccountInfo` + 执照 `FileId`;前置 `POST .../command/attachment` |
40
- | `open-account kwai` | `/command/media-account/AddKwaiAccount` | POST | Body:Kwai 专用主体/行业/执照结构 + `blobstoreKey`;前置 `POST .../KwaiAccount/Management/Upload` |
41
-
42
- ---
43
-
44
- ## 辅助接口
45
-
46
- | 用途 | 接口 | CLI 命令 |
47
- | ----------------- | ------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
48
- | Google 时区列表 | `GET {apiBaseUrl}/query/media-account/Google/TimeZoneInfo/ReadFile` | `open-account google-timezones` |
49
- | TikTok 时区列表 | `GET {apiBaseUrl}/query/media-account/tiktok/TikTokTimeZoneInfo/Read` | `open-account tiktok-timezones` |
50
- | TikTok 行业列表 | `GET {apiBaseUrl}/query/media-account/tiktok/TikTokIndustryInfo/Read` | `open-account tiktok-industries` |
51
- | TikTok 注册地列表 | `GET {apiBaseUrl}/query/media-account/tiktok/TikTokAreacode/Read` | `open-account tiktok-areas` |
52
- | Bing 行业列表 | `GET {apiBaseUrl}/query/media-account/bing/BingTradeList/Read`(返回中文行业名,`name` 字段即为 `--trade-id` 的值) | `open-account bing-industries` |
53
- | 修改 Google 申请 | `PUT .../command/media-account/google/{entityId}`,`s-command-type: UpdateMediaAccount` | — |
54
- | 修改 TikTok 申请 | `PUT .../command/media-account/{entityId}`,`s-command-type: UpdateMediaAccount` | — |
55
- | 修改 Yandex 申请 | `POST .../command/media-account/UpdateAgencyClient/{id}` | — |
56
-
57
- ## 公司名称(广告主组)联想说明
58
-
59
- 网页上「公司名称」下拉的数据来自 `GET {apiBaseUrl}/query/profile/steward-individual`(与 `open-account list-groups` 同一接口),**无搜索接口,为本地过滤**。
60
-
61
- 选中已有广告主后,网页会自动回填推广链接、行业、推广类型等字段。CLI 的 `open-account google` 同样按 `--company` 名称自动匹配或创建广告主组,行为与网页一致。