siluzan-tso-cli 1.1.72-beta.1 → 1.1.73-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.72-beta.1),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
54
+ > **注意**:当前为测试版(1.1.73-beta.1),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
55
55
 
56
56
  | 助手 | 建议 `--ai` |
57
57
  | ----------------------- | ------------------------------------ |
package/dist/index.js CHANGED
@@ -9018,10 +9018,15 @@ var init_report_period = __esm({
9018
9018
  });
9019
9019
 
9020
9020
  // src/commands/google-analysis/sections.ts
9021
- var SECTIONS;
9021
+ var BY_DATE_SECTIONS, SECTIONS;
9022
9022
  var init_sections = __esm({
9023
9023
  "src/commands/google-analysis/sections.ts"() {
9024
9024
  "use strict";
9025
+ BY_DATE_SECTIONS = /* @__PURE__ */ new Set([
9026
+ "campaigns",
9027
+ "keywords",
9028
+ "search-terms"
9029
+ ]);
9025
9030
  SECTIONS = [
9026
9031
  {
9027
9032
  name: "overview",
@@ -104762,7 +104767,7 @@ function resolveDateRange(start, end) {
104762
104767
  );
104763
104768
  process.exit(1);
104764
104769
  }
104765
- function buildSearchParams(def, start, end, extras) {
104770
+ function buildGoogleAnalysisSearchParams(def, start, end, extras) {
104766
104771
  const params = new URLSearchParams();
104767
104772
  if (def.dateMode === "range") {
104768
104773
  const { startDate, endDate } = resolveDateRange(start, end);
@@ -104932,6 +104937,9 @@ async function fetchSectionPayload(def, opts, config, id, http2) {
104932
104937
  extras.orderByCost = false;
104933
104938
  }
104934
104939
  }
104940
+ if (opts.byDate && BY_DATE_SECTIONS.has(def.name)) {
104941
+ extras.byDate = true;
104942
+ }
104935
104943
  if (def.extensionLevelOption && opts.level) {
104936
104944
  extras.level = opts.level;
104937
104945
  }
@@ -104966,7 +104974,7 @@ async function fetchSectionPayload(def, opts, config, id, http2) {
104966
104974
  }
104967
104975
  if (def.name === "campaign-device") {
104968
104976
  const sectionPath2 = def.path(id);
104969
- const query2 = buildSearchParams(def, opts.start, opts.end, extras);
104977
+ const query2 = buildGoogleAnalysisSearchParams(def, opts.start, opts.end, extras);
104970
104978
  const verbose = !!opts.verbose;
104971
104979
  const [report, modifiers] = await Promise.all([
104972
104980
  fetchJson(
@@ -105023,7 +105031,7 @@ async function fetchSectionPayload(def, opts, config, id, http2) {
105023
105031
  );
105024
105032
  }
105025
105033
  const sectionPath = def.path(id);
105026
- const query = buildSearchParams(def, opts.start, opts.end, extras);
105034
+ const query = buildGoogleAnalysisSearchParams(def, opts.start, opts.end, extras);
105027
105035
  const data = await fetchGoogleAnalysisSectionJson(
105028
105036
  config,
105029
105037
  `${sectionPath}${query}`,
@@ -105060,6 +105068,7 @@ async function fetchOneGoogleSection(opts) {
105060
105068
  verbose: opts.verbose,
105061
105069
  limit: opts.limit,
105062
105070
  noOrderByCost: opts.noOrderByCost,
105071
+ byDate: opts.byDate,
105063
105072
  level: opts.level,
105064
105073
  audienceType: opts.audienceType,
105065
105074
  costGreater: opts.costGreater,
@@ -107306,6 +107315,7 @@ async function runBatch(opts) {
107306
107315
  start: opts.start,
107307
107316
  end: opts.end,
107308
107317
  limit: opts.keywordLimit,
107318
+ byDate: opts.byDate,
107309
107319
  costGreater: opts.campaignGeoCostGreater,
107310
107320
  clickGreater: opts.campaignGeoClickGreater,
107311
107321
  conversionsGreater: opts.campaignGeoConversionsGreater,
@@ -107449,6 +107459,7 @@ async function persistRunMetadata(input) {
107449
107459
  },
107450
107460
  minSpend: input.minSpend,
107451
107461
  keywordLimit: input.keywordLimit,
107462
+ byDate: input.byDate,
107452
107463
  campaignGeoCostGreater: input.campaignGeoCostGreater,
107453
107464
  campaignGeoClickGreater: input.campaignGeoClickGreater,
107454
107465
  campaignGeoConversionsGreater: input.campaignGeoConversionsGreater,
@@ -107750,6 +107761,7 @@ async function executeBatchRun(input) {
107750
107761
  start: input.start,
107751
107762
  end: input.end,
107752
107763
  keywordLimit: input.keywordLimit,
107764
+ byDate: input.byDate,
107753
107765
  campaignGeoCostGreater: input.campaignGeoCostGreater,
107754
107766
  campaignGeoClickGreater: input.campaignGeoClickGreater,
107755
107767
  campaignGeoConversionsGreater: input.campaignGeoConversionsGreater,
@@ -107807,6 +107819,7 @@ async function executeBatchRun(input) {
107807
107819
  start: input.start,
107808
107820
  end: input.end,
107809
107821
  keywordLimit: input.keywordLimit,
107822
+ byDate: input.byDate,
107810
107823
  campaignGeoCostGreater: input.campaignGeoCostGreater,
107811
107824
  campaignGeoClickGreater: input.campaignGeoClickGreater,
107812
107825
  campaignGeoConversionsGreater: input.campaignGeoConversionsGreater,
@@ -107886,6 +107899,7 @@ async function cmdRun(opts) {
107886
107899
  accountConcurrency,
107887
107900
  sectionConcurrency,
107888
107901
  keywordLimit: opts.keywordLimit,
107902
+ byDate: opts.byDate,
107889
107903
  campaignGeoCostGreater: finiteBatchOpt(opts.campaignGeoCostGreater),
107890
107904
  campaignGeoClickGreater: finiteBatchOpt(opts.campaignGeoClickGreater),
107891
107905
  campaignGeoConversionsGreater: finiteBatchOpt(opts.campaignGeoConversionsGreater),
@@ -107975,6 +107989,7 @@ async function cmdResume(opts) {
107975
107989
  start: manifest.dateRange.start,
107976
107990
  end: manifest.dateRange.end,
107977
107991
  keywordLimit: manifest.keywordLimit,
107992
+ byDate: manifest.byDate,
107978
107993
  campaignGeoCostGreater: finiteBatchOpt(manifest.campaignGeoCostGreater),
107979
107994
  campaignGeoClickGreater: finiteBatchOpt(manifest.campaignGeoClickGreater),
107980
107995
  campaignGeoConversionsGreater: finiteBatchOpt(manifest.campaignGeoConversionsGreater),
@@ -108083,6 +108098,10 @@ function registerGoogleAnalysisBatchCommands(program2) {
108083
108098
  "--keyword-limit <n>",
108084
108099
  "\u900F\u4F20\u7ED9 keywords / search-terms \u7684\u6761\u6570\u4E0A\u9650\uFF08\u63A7\u5236\u5927\u8D26\u6237\u54CD\u5E94\u4F53\u79EF\uFF09",
108085
108100
  (v) => parseInt(v, 10)
108101
+ ).option(
108102
+ "--by-date",
108103
+ "campaigns / keywords / search-terms \u6309\u65E5\u8FD4\u56DE\uFF08\u4E00\u884C\u4E00\u5929\uFF09\u3002\u9ED8\u8BA4\u4E0D\u4F20\uFF0C\u4ECD\u662F\u533A\u95F4\u5408\u8BA1",
108104
+ false
108086
108105
  ).option(
108087
108106
  "--campaign-geo-cost-greater <n>",
108088
108107
  "\u4EC5 campaign-geo\uFF1A\u7F51\u5173 costGreater \u8FC7\u6EE4\uFF08\u6574\u6570\uFF09",
@@ -108201,6 +108220,7 @@ async function fetchAndWriteSection(def, opts, config, id, cliVersion) {
108201
108220
  verbose: opts.verbose,
108202
108221
  limit: opts.limit,
108203
108222
  noOrderByCost: opts.noOrderByCost,
108223
+ byDate: opts.byDate,
108204
108224
  level: opts.level,
108205
108225
  audienceType: opts.audienceType,
108206
108226
  costGreater: opts.costGreater,
@@ -108370,6 +108390,7 @@ async function runMultiAccountViaBatch(accountIds, opts) {
108370
108390
  accountConcurrency,
108371
108391
  sectionConcurrency: concurrency,
108372
108392
  keywordLimit: opts.limit,
108393
+ byDate: opts.byDate,
108373
108394
  campaignGeoCostGreater: finiteOpt(opts.costGreater),
108374
108395
  campaignGeoClickGreater: finiteOpt(opts.clickGreater),
108375
108396
  campaignGeoConversionsGreater: finiteOpt(opts.conversionsGreater),
@@ -108441,7 +108462,11 @@ function registerRunCommand() {
108441
108462
  "--limit <n>",
108442
108463
  "\u900F\u4F20\u7ED9 keywords / search-terms \u7684\u6761\u6570\u4E0A\u9650\uFF08\u9ED8\u8BA4 0=\u4E0D\u5C01\u9876\uFF1Bkeywords \u9ED8\u8BA4\u53E6\u5E26 costGreater=0 \u4EC5\u6709\u6D88\u8017\uFF09",
108443
108464
  (v) => parseInt(v, 10)
108444
- ).option("--no-order-by-cost", "\u900F\u4F20\uFF1Akeywords / search-terms \u4E0D\u6309\u6D88\u8017\u6392\u5E8F", false).option("--level <level>", "\u900F\u4F20\u7ED9 extensions \u7EF4\u5EA6\u7684 level \u8FC7\u6EE4\uFF1AAccount | Campaign | Ad Group").option(
108465
+ ).option("--no-order-by-cost", "\u900F\u4F20\uFF1Akeywords / search-terms \u4E0D\u6309\u6D88\u8017\u6392\u5E8F", false).option(
108466
+ "--by-date",
108467
+ "campaigns / keywords / search-terms \u6309\u65E5\u8FD4\u56DE\uFF08\u4E00\u884C\u4E00\u5929\uFF0C\u542B\u7CFB\u5217\u5C55\u793A\u4EFD\u989D\uFF09\u3002\u9ED8\u8BA4\u4E0D\u4F20\uFF0C\u4ECD\u662F\u533A\u95F4\u5408\u8BA1",
108468
+ false
108469
+ ).option("--level <level>", "\u900F\u4F20\u7ED9 extensions \u7EF4\u5EA6\u7684 level \u8FC7\u6EE4\uFF1AAccount | Campaign | Ad Group").option(
108445
108470
  "--audience-type <type>",
108446
108471
  "\u900F\u4F20\u7ED9 audience \u7EF4\u5EA6\u7684 audienceTypeFilter\uFF1ASystemDefined | UserDefined"
108447
108472
  ).option(
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "slug": "siluzan-tso",
3
- "version": "1.1.72-beta.1",
4
- "publishedAt": 1794911110261
3
+ "version": "1.1.73-beta.1",
4
+ "publishedAt": 1794972655405
5
5
  }
@@ -254,7 +254,21 @@ const data = d.record ?? d.items; // record 非空=汇总维度;否则=列表
254
254
 
255
255
  ### campaign-hour 字段
256
256
 
257
- `items[]` 每行:`campaignId`、`campaignName`、`date`、`hour`、`spend`、`impressions`、`clicks`、`conversions`(`schemaVersion 3` 起行统一在 `items[]`,不再是裸数组根)。
257
+ `items[]` 每行:`campaignId`、`campaignName`、`date`、`hour`、`spend`、`impressions`、`clicks`、`conversions`(`schemaVersion 3` 起行统一在 `items[]`,不再是裸数组根)。`campaign-hour` 没有页首 / 绝对页首展示份额,也不能代替按日的关键词或搜索词。
258
+
259
+ ### 按日的系列、关键词、搜索词(`--by-date`)
260
+
261
+ 默认 `campaigns` / `keywords` / `search-terms` 是 `--start`~`--end` 的合计,行上 `date` 为空。用户要日报里的「天 × 系列」(含搜索展示份额、页首、绝对页首)、「天 × 关键词」或「天 × 搜索词」时,加 `--by-date`,一次拉整个区间。禁止按天循环这三维。
262
+
263
+ ```bash
264
+ siluzan-tso google-analysis -a <mediaCustomerId> --sections campaigns,keywords,search-terms --by-date --start YYYY-MM-DD --end YYYY-MM-DD --json-out ./snap
265
+ ```
266
+
267
+ - 行上 `date` 为 `YYYY-MM-DD`。同一 `campaignId` / 关键词 / 搜索词会有多行,写合计前先按对象把 `spend`、`clicks`、`impressions`、`conversions` 加总。
268
+ - `campaigns` 的 `competitiveMetrics` 仍在(`searchImpressionShare`、`searchTopImpressionShare`、`searchAbsoluteTopImpressionShare`)。份额是当天该系列的值,不要把多天的份额相加。
269
+ - `keywords` 在 `--by-date` 下没有 `qualityScore`。要质量得分就不要加 `--by-date`。
270
+ - 搜索词没有展示份额。账户每天一行用 `daily-metrics`,不要用 `--by-date`。
271
+ - 其他维度忽略这个旗标。省略它时行为与以前相同。
258
272
 
259
273
  ---
260
274
 
@@ -372,7 +372,15 @@ siluzan-tso google-analysis -a <accountId> --sections daily-metrics --start YYYY
372
372
  siluzan-tso google-analysis -a <accountId> --sections campaign-hour --start YYYY-MM-DD --end YYYY-MM-DD --json-out ./snap
373
373
  ```
374
374
 
375
- `keywords` 行上的 `qualityScore` 是质量得分。按日看 `daily-metrics`,按小时看 `campaign-hour`。字段含义见 `references/analytics/account-analytics.md`。谁改了预算用 `ad changes`(最多 30 天),见 `google-ads-exclusions.md`。
375
+ `keywords` 行上的 `qualityScore` 是质量得分。账户按日看 `daily-metrics`,按小时看 `campaign-hour`。字段含义见 `references/analytics/account-analytics.md`。谁改了预算用 `ad changes`(最多 30 天),见 `google-ads-exclusions.md`。
376
+
377
+ 要「每一天 × 广告系列 / 关键词 / 搜索词」时,同一次加上 `--by-date`,不要按天循环:
378
+
379
+ ```bash
380
+ siluzan-tso google-analysis -a <accountId> --sections campaigns,keywords,search-terms --by-date --start YYYY-MM-DD --end YYYY-MM-DD --json-out ./snap
381
+ ```
382
+
383
+ `--by-date` 只作用在 `campaigns`、`keywords`、`search-terms`。行上的 `date` 是 `YYYY-MM-DD`,同一系列或同一个词会有多行。系列行仍带 `competitiveMetrics`(搜索展示份额、页首、绝对页首)。不加 `--by-date` 时这三维仍是整段合计,`date` 为空。`--by-date` 的关键词行没有 `qualityScore`。账户每天一行仍用 `daily-metrics`,不要用 `--by-date` 代替。
376
384
 
377
385
  ---
378
386
 
@@ -9,7 +9,7 @@ $ErrorActionPreference = 'Stop'
9
9
  # -- Package info (injected at build time) ------------------------------------
10
10
  $PKG_NAME = 'siluzan-tso-cli'
11
11
  # PKG_VERSION 锁定到与本脚本同批构建产物一致的版本,避免与 dist/skill 错位
12
- $PKG_VERSION = '1.1.72-beta.1'
12
+ $PKG_VERSION = '1.1.73-beta.1'
13
13
  $CLI_BIN = 'siluzan-tso'
14
14
  $SKILL_LABEL = 'Siluzan TSO'
15
15
  $INSTALL_CMD = 'npm install -g siluzan-tso-cli@beta'
@@ -9,7 +9,7 @@ set -euo pipefail
9
9
  # -- Package info (injected at build time) ------------------------------------
10
10
  readonly PKG_NAME="siluzan-tso-cli"
11
11
  # PKG_VERSION 锁定到与本脚本同批构建产物一致的版本,避免与 dist/skill 错位
12
- readonly PKG_VERSION="1.1.72-beta.1"
12
+ readonly PKG_VERSION="1.1.73-beta.1"
13
13
  readonly CLI_BIN="siluzan-tso"
14
14
  readonly SKILL_LABEL="Siluzan TSO"
15
15
  readonly INSTALL_CMD="npm install -g siluzan-tso-cli@beta"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siluzan-tso-cli",
3
- "version": "1.1.72-beta.1",
3
+ "version": "1.1.73-beta.1",
4
4
  "description": "Siluzan 广告账户管理 CLI — 查询账户、余额、消耗数据,管理绑定关系与充值。",
5
5
  "keywords": [
6
6
  "ad-account",