@adkit/cli 1.12.13 → 1.12.14

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 (2) hide show
  1. package/dist/cli.js +28 -8
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1830,8 +1830,8 @@ var NEGATIVE_LIST_LIST_FLAGS = ["status", "limit", "offset"];
1830
1830
  var NEGATIVE_LIST_ATTACH_FLAGS = ["campaign"];
1831
1831
  var SEARCH_TERMS_FLAGS = ["campaign", "ad-group", "keyword", "keyword-match-type", "period", "from", "to", "min-impressions", "sort", "limit", "raw"];
1832
1832
  var PLACEMENT_REPORT_FLAGS = ["campaign", "ad-group", "period", "from", "to", "sort", "limit", "raw"];
1833
- var GOOGLE_RESULTS_FLAGS = ["campaign", "ad-group", "period", "from", "to", "sort", "limit", "status", "breakdown", "raw"];
1834
- var GOOGLE_KEYWORD_RESULTS_FLAGS = ["campaign", "ad-group", "period", "from", "to", "sort", "limit", "status", "raw"];
1833
+ var GOOGLE_RESULTS_FLAGS = ["campaign", "ad-group", "period", "from", "to", "sort", "limit", "status", "breakdown", "fields", "raw"];
1834
+ var GOOGLE_KEYWORD_RESULTS_FLAGS = ["campaign", "ad-group", "period", "from", "to", "sort", "limit", "status", "fields", "raw"];
1835
1835
  var KEYWORD_RESEARCH_FLAGS = ["url", "location", "language", "limit", "min-volume"];
1836
1836
  var TARGETING_RESEARCH_FLAGS = ["limit"];
1837
1837
  function generateCampaignName2() {
@@ -2560,17 +2560,27 @@ async function detachNegativeList(client, args, flags) {
2560
2560
  const path3 = `/manage/google/keywords/negative-lists/detach${qs}`;
2561
2561
  return client.post(path3, body);
2562
2562
  }
2563
- function inferGoogleResultsLevel(campaignId, adGroupId) {
2563
+ function parseGoogleResultsLevelArg(args) {
2564
+ const [rawLevel, ...unexpectedArgs] = args;
2565
+ if (!rawLevel) return void 0;
2566
+ const level = rawLevel.trim().toLowerCase();
2567
+ if (level !== "campaigns" && level !== "ad-groups" && level !== "ads") throw new CliError("UNKNOWN_COMMAND", `Unknown action: google results ${rawLevel}`, "Available: campaigns, ad-groups, ads, keywords, placements, search-terms");
2568
+ if (unexpectedArgs.length > 0) throw new CliError("UNKNOWN_COMMAND", `Unknown argument after google results ${rawLevel}: ${unexpectedArgs.join(" ")}`, `Run: adkit manage google results ${level} --help`);
2569
+ return level;
2570
+ }
2571
+ function inferGoogleResultsLevel(campaignId, adGroupId, explicitLevel) {
2572
+ if (explicitLevel) return explicitLevel;
2564
2573
  if (adGroupId) return "ad-groups";
2565
2574
  if (campaignId) return "campaigns";
2566
2575
  return void 0;
2567
2576
  }
2568
- async function listGoogleResults(client, _args, flags) {
2577
+ async function listGoogleResults(client, args, flags) {
2569
2578
  validateFlags(flags, GOOGLE_RESULTS_FLAGS, "manage google results");
2570
2579
  const accountId = typeof flags.account === "string" ? flags.account : void 0;
2571
2580
  const campaignId = typeof flags.campaign === "string" ? flags.campaign : void 0;
2572
2581
  const adGroupId = typeof flags["ad-group"] === "string" ? flags["ad-group"] : void 0;
2573
- const level = inferGoogleResultsLevel(campaignId, adGroupId);
2582
+ const explicitLevel = parseGoogleResultsLevelArg(args);
2583
+ const level = inferGoogleResultsLevel(campaignId, adGroupId, explicitLevel);
2574
2584
  const period = typeof flags.period === "string" ? flags.period : void 0;
2575
2585
  const from = typeof flags.from === "string" ? flags.from : void 0;
2576
2586
  const to = typeof flags.to === "string" ? flags.to : void 0;
@@ -3952,6 +3962,7 @@ var require2 = createRequire(import.meta.url);
3952
3962
  var CLI_VERSION = require2("../package.json").version;
3953
3963
  var DEFAULT_BASE_URL = "https://app.adkit.so/api/v1";
3954
3964
  var GOOGLE_NUMERIC_ID_PATTERN = /^\d+$/;
3965
+ var GOOGLE_RESULTS_LEVEL_ACTIONS = /* @__PURE__ */ new Set(["campaigns", "ad-groups", "ads"]);
3955
3966
  var TIKTOK_NUMERIC_ID_PATTERN = /^\d+$/;
3956
3967
  var USAGE = `
3957
3968
  Usage: adkit <command> [options]
@@ -5016,6 +5027,9 @@ var GOOGLE_NEGATIVE_LIST_HELP_FULL = GOOGLE_NEGATIVE_LIST_HELP;
5016
5027
  var GOOGLE_RESULTS_HELP = `adkit manage google results \u2014 Google Ads performance analytics
5017
5028
 
5018
5029
  [default] Account-wide or filtered performance metrics
5030
+ campaigns One row per campaign
5031
+ ad-groups One row per ad group
5032
+ ads One row per ad
5019
5033
  keywords Keyword-level spend, clicks, impressions per keyword
5020
5034
  placements Placement report: websites, apps, and YouTube
5021
5035
  search-terms Search terms that triggered your ads
@@ -5029,8 +5043,8 @@ Flags:
5029
5043
  --sort <field> Sort by: cost, clicks, impressions, conversions (default: cost)
5030
5044
  --limit <n> Max results
5031
5045
  --status <s> Filter: enabled, paused, all
5032
- --breakdown <b> Split rows by: day, device, network (For placements, use "results placements")
5033
- --fields <list> Response fields, e.g. cost,clicks,searchImpressionShare. Omit for default advertiser metrics; use all for every supported field.
5046
+ --breakdown <b> Split rows by: day, device, network. For campaign/ad-group/ad rows, use the level subcommands above.
5047
+ --fields <list> Response fields, e.g. cost,clicks,searchImpressionShare. Omit for default advertiser metrics; use all for every supported field.
5034
5048
  --raw Return raw Google API response
5035
5049
  --account <id> Optional if one Google Ads account is connected
5036
5050
 
@@ -5046,6 +5060,9 @@ Visibility fields:
5046
5060
 
5047
5061
  Examples:
5048
5062
  adkit manage google results
5063
+ adkit manage google results campaigns --account 1234567890 --period 30d
5064
+ adkit manage google results ad-groups --campaign 123 --period 30d
5065
+ adkit manage google results ads --campaign 123 --period 30d
5049
5066
  adkit manage google results keywords --account 1234567890 --period 7d
5050
5067
  adkit manage google results --campaign 123 --period 7d
5051
5068
  adkit manage google results --campaign 123 --period 7d --breakdown day
@@ -7085,7 +7102,10 @@ async function main() {
7085
7102
  } else if (action === "keywords") {
7086
7103
  data = await listGoogleKeywordResults(client, restArgs, flags);
7087
7104
  emptyHint = "No keyword results found. Try a wider date range or check --status.";
7088
- } else if (action) throw new CliError("UNKNOWN_COMMAND", `Unknown action: google results ${action}`, "Available: keywords, placements, search-terms");
7105
+ } else if (action && GOOGLE_RESULTS_LEVEL_ACTIONS.has(action.toLowerCase())) {
7106
+ data = await listGoogleResults(client, [action, ...restArgs], flags);
7107
+ emptyHint = "No Google results found for the given level. Try a wider date range or remove filters.";
7108
+ } else if (action) throw new CliError("UNKNOWN_COMMAND", `Unknown action: google results ${action}`, "Available: campaigns, ad-groups, ads, keywords, placements, search-terms");
7089
7109
  else data = await listGoogleResults(client, restArgs, flags);
7090
7110
  break;
7091
7111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adkit/cli",
3
- "version": "1.12.13",
3
+ "version": "1.12.14",
4
4
  "description": "The Ads CLI for AI agents — manage Meta & Google ad campaigns, browse the ad library, and generate creatives from your terminal.",
5
5
  "keywords": [
6
6
  "ads cli",