@adkit/cli 1.13.22 → 1.13.24

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 +92 -26
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,5 +1,68 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // ../shared/dist/errors.js
4
+ function describeRetryDelay(retryAfterSeconds) {
5
+ if (!retryAfterSeconds || retryAfterSeconds <= 300)
6
+ return "in a few minutes";
7
+ if (retryAfterSeconds <= 3600)
8
+ return "within the hour";
9
+ return "in a few hours";
10
+ }
11
+
12
+ // ../shared/dist/utils/type-guards.js
13
+ function isPlainObject(value) {
14
+ return typeof value === "object" && value !== null && !Array.isArray(value);
15
+ }
16
+ function readProperty(value, key) {
17
+ return value[key];
18
+ }
19
+ function readStringProperty(value, key) {
20
+ const raw = value[key];
21
+ return typeof raw === "string" ? raw : void 0;
22
+ }
23
+
24
+ // ../shared/dist/manage/google/constants.js
25
+ var GOOGLE_LIMITED_AD_APPROVAL_STATUSES = ["APPROVED_LIMITED", "AREA_OF_INTEREST_ONLY"];
26
+ var GOOGLE_PROBLEM_AD_APPROVAL_STATUSES = ["DISAPPROVED", ...GOOGLE_LIMITED_AD_APPROVAL_STATUSES];
27
+
28
+ // ../shared/dist/manage/google/campaign-validation.js
29
+ var VALID_GOOGLE_BID_STRATEGIES = ["manual_cpc", "manual_cpm", "maximize_clicks", "maximize_conversions", "maximize_conversion_value", "target_spend", "target_impression_share"];
30
+ var SUPPORTED_GOOGLE_CAMPAIGN_TYPES = ["search", "display"];
31
+ var validGoogleBidStrategySet = new Set(VALID_GOOGLE_BID_STRATEGIES);
32
+ var validGoogleBidStrategyList = VALID_GOOGLE_BID_STRATEGIES.join(", ");
33
+ var supportedGoogleCampaignTypeSet = new Set(SUPPORTED_GOOGLE_CAMPAIGN_TYPES);
34
+ var supportedGoogleCampaignTypeList = SUPPORTED_GOOGLE_CAMPAIGN_TYPES.join(", ");
35
+
36
+ // ../shared/dist/manage/google/validators/conversion-goals.js
37
+ var GOOGLE_CAMPAIGN_CONVERSION_GOAL_CATEGORIES = [
38
+ "add_to_cart",
39
+ "begin_checkout",
40
+ "book_appointment",
41
+ "contact",
42
+ "converted_lead",
43
+ "default",
44
+ "download",
45
+ "engagement",
46
+ "get_directions",
47
+ "imported_lead",
48
+ "outbound_click",
49
+ "page_view",
50
+ "phone_call_lead",
51
+ "purchase",
52
+ "qualified_lead",
53
+ "request_quote",
54
+ "signup",
55
+ "store_sale",
56
+ "store_visit",
57
+ "submit_lead_form",
58
+ "subscribe_paid",
59
+ "youtube_follow_on_views"
60
+ ];
61
+ var googleCampaignConversionGoalCategorySet = new Set(GOOGLE_CAMPAIGN_CONVERSION_GOAL_CATEGORIES);
62
+
63
+ // ../shared/dist/manage/google/types/google-adkit.js
64
+ var GOOGLE_GEO_LOCATION_SEARCH_TYPES = ["country", "region", "city", "postal_code", "metro"];
65
+
3
66
  // src/config.ts
4
67
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs";
5
68
  import { join } from "node:path";
@@ -65,15 +128,6 @@ function readLegacyProjectApiKey(config, selectedProject) {
65
128
  return config.projects?.[selectedProject]?.apiKey ?? null;
66
129
  }
67
130
 
68
- // ../shared/dist/errors.js
69
- function describeRetryDelay(retryAfterSeconds) {
70
- if (!retryAfterSeconds || retryAfterSeconds <= 300)
71
- return "in a few minutes";
72
- if (retryAfterSeconds <= 3600)
73
- return "within the hour";
74
- return "in a few hours";
75
- }
76
-
77
131
  // src/errors.ts
78
132
  var CliError = class extends Error {
79
133
  code;
@@ -1753,9 +1807,6 @@ function getAd(client, args, flags) {
1753
1807
  return getMetaEntity(client, args, flags, { path: "ads", usageHint: "Run: adkit manage meta ads <ad-id>" });
1754
1808
  }
1755
1809
 
1756
- // ../shared/dist/manage/google/types/google-adkit.js
1757
- var GOOGLE_GEO_LOCATION_SEARCH_TYPES = ["country", "region", "city", "postal_code", "metro"];
1758
-
1759
1810
  // ../shared/dist/manage/google/asset-utils.js
1760
1811
  var SUPPORTED_GOOGLE_STRUCTURED_SNIPPET_HEADERS = ["Amenities", "Brands", "Courses", "Degree programs", "Destinations", "Featured hotels", "Insurance coverage", "Models", "Neighborhoods", "Service catalog", "Shows", "Styles", "Types"];
1761
1812
  var STRUCTURED_SNIPPET_HEADER_LOOKUP = new Map(SUPPORTED_GOOGLE_STRUCTURED_SNIPPET_HEADERS.map((header) => [header.toLowerCase(), header]));
@@ -1924,18 +1975,6 @@ function parseGoogleSitelinkShorthand(value) {
1924
1975
  return normalizeSitelinkAsset({ type: "sitelink", linkText, finalUrls: [finalUrl] });
1925
1976
  }
1926
1977
 
1927
- // ../shared/dist/utils/type-guards.js
1928
- function isPlainObject(value) {
1929
- return typeof value === "object" && value !== null && !Array.isArray(value);
1930
- }
1931
- function readProperty(value, key) {
1932
- return value[key];
1933
- }
1934
- function readStringProperty(value, key) {
1935
- const raw = value[key];
1936
- return typeof raw === "string" ? raw : void 0;
1937
- }
1938
-
1939
1978
  // src/commands/google.ts
1940
1979
  import { readFileSync as readFileSync2 } from "node:fs";
1941
1980
  import { basename, extname, resolve } from "node:path";
@@ -1945,8 +1984,8 @@ var ASSET_CREATE_FLAGS = ["type", "text", "sitelink", "header", "value", "descri
1945
1984
  var ASSET_LINK_FLAGS = ["type", "scope", "scope-id", "status"];
1946
1985
  var MEDIA_UPLOAD_FLAGS = ["file", "url", "base64", "adkit-media", "video-id", "filename", "content-type", "name"];
1947
1986
  var CAMPAIGN_LIST_FLAGS = ["status", "limit", "offset"];
1948
- var CAMPAIGN_CREATE_FLAGS = ["name", "status", "budget-daily", "campaign-type", "bid-strategy", "target-cpa", "target-roas", "search-partners", "display-network", "tracking-url-suffix", "countries"];
1949
- var CAMPAIGN_UPDATE_FLAGS = ["name", "status", "budget-daily", "bid-strategy", "target-cpa", "target-roas", "search-partners", "display-network", "tracking-url-suffix", "countries"];
1987
+ var CAMPAIGN_CREATE_FLAGS = ["name", "status", "budget-daily", "campaign-type", "bid-strategy", "target-cpa", "target-roas", "search-partners", "display-network", "tracking-url-suffix", "conversion-goals", "countries"];
1988
+ var CAMPAIGN_UPDATE_FLAGS = ["name", "status", "budget-daily", "bid-strategy", "target-cpa", "target-roas", "search-partners", "display-network", "tracking-url-suffix", "conversion-goals", "countries"];
1950
1989
  var ASSET_GROUP_LIST_FLAGS = ["campaign", "limit", "offset"];
1951
1990
  var ASSET_GROUP_CREATE_FLAGS = ["campaign", "name", "status", "final-url"];
1952
1991
  var ASSET_GROUP_UPDATE_FLAGS = ["name", "status", "final-url"];
@@ -2211,6 +2250,7 @@ function buildCampaignPayload2(flags) {
2211
2250
  if (flags["search-partners"] === true) payload.searchPartners = true;
2212
2251
  if (flags["display-network"] === true) payload.displayNetwork = true;
2213
2252
  if (typeof flags["tracking-url-suffix"] === "string") payload.trackingUrlSuffix = flags["tracking-url-suffix"];
2253
+ if (typeof flags["conversion-goals"] === "string") payload.conversionGoals = parseCampaignConversionGoals(flags["conversion-goals"]);
2214
2254
  if (typeof flags.countries === "string") payload.countries = parseCampaignCountries(flags.countries);
2215
2255
  return payload;
2216
2256
  }
@@ -2219,6 +2259,12 @@ function parseCampaignCountries(value) {
2219
2259
  const normalizedCountries = countryParts.map((country) => country.trim().toUpperCase());
2220
2260
  return normalizedCountries.filter(Boolean);
2221
2261
  }
2262
+ function parseCampaignConversionGoals(value) {
2263
+ if (value.trim().toLowerCase() === "null") return null;
2264
+ const goalParts = value.split(",");
2265
+ const normalizedGoals = goalParts.map((goal) => goal.trim());
2266
+ return normalizedGoals.filter(Boolean);
2267
+ }
2222
2268
  function buildCampaignUpdatePayloadFromFlags(flags) {
2223
2269
  const payload = {};
2224
2270
  if (typeof flags.name === "string") payload.name = flags.name;
@@ -2230,6 +2276,7 @@ function buildCampaignUpdatePayloadFromFlags(flags) {
2230
2276
  if (flags["search-partners"] === true) payload.searchPartners = true;
2231
2277
  if (flags["display-network"] === true) payload.displayNetwork = true;
2232
2278
  if (typeof flags["tracking-url-suffix"] === "string") payload.trackingUrlSuffix = flags["tracking-url-suffix"];
2279
+ if (typeof flags["conversion-goals"] === "string") payload.conversionGoals = parseCampaignConversionGoals(flags["conversion-goals"]);
2233
2280
  if (typeof flags.countries === "string") {
2234
2281
  const countries = parseCampaignCountries(flags.countries);
2235
2282
  payload.targeting = {
@@ -4760,6 +4807,7 @@ var require2 = createRequire(import.meta.url);
4760
4807
  var CLI_VERSION = require2("../package.json").version;
4761
4808
  var DEFAULT_BASE_URL = "https://app.adkit.so/api/v1";
4762
4809
  var GOOGLE_NUMERIC_ID_PATTERN2 = /^\d+$/;
4810
+ var GOOGLE_CAMPAIGN_CONVERSION_GOAL_CATEGORY_LIST = GOOGLE_CAMPAIGN_CONVERSION_GOAL_CATEGORIES.join(", ");
4763
4811
  var GOOGLE_RESULTS_LEVEL_ACTIONS = /* @__PURE__ */ new Set(["campaigns", "ad-groups", "ads"]);
4764
4812
  var TIKTOK_NUMERIC_ID_PATTERN = /^\d+$/;
4765
4813
  var LINKEDIN_ID_PATTERN = /[\d:_]/;
@@ -5077,6 +5125,7 @@ Note:
5077
5125
  list returns ad configuration only (creative, status, adset).
5078
5126
  AdKit hides deleted and archived ads by default. Use --status to include them.
5079
5127
  Single-image/video ads use --media. Carousel ads use --data with carouselCards.
5128
+ Copy flags are repeatable \u2014 pass every headline/primary-text/link-description the user supplies; Meta rotates them on one ad. If it is unclear whether they want one ad with variants or separate ads, ask before creating. Only when writing copy yourself, default to one per field unless the user asks for variants.
5080
5129
 
5081
5130
  Examples:
5082
5131
  # Create an ad with a local video file
@@ -5139,6 +5188,7 @@ Note:
5139
5188
  list returns ad configuration only (creative, status, adset).
5140
5189
  AdKit hides deleted and archived ads by default. Use --status to include them.
5141
5190
  Single-image/video ads use --media. Carousel ads use --data with carouselCards.
5191
+ Copy flags are repeatable \u2014 pass every headline/primary-text/link-description the user supplies; Meta rotates them on one ad. If it is unclear whether they want one ad with variants or separate ads, ask before creating. Only when writing copy yourself, default to one per field unless the user asks for variants.
5142
5192
 
5143
5193
  --data JSON fields:
5144
5194
  adsetId (required) Parent ad set ID
@@ -5440,6 +5490,7 @@ Flags (create):
5440
5490
  --bid-strategy <s> manual_cpc, manual_cpm, maximize_clicks, maximize_conversions, maximize_conversion_value, target_spend, target_impression_share
5441
5491
  --target-cpa <n> Target CPA in account currency (with --bid-strategy maximize_conversions)
5442
5492
  --target-roas <n> Target ROAS ratio, e.g. 3.5 = 350% (with --bid-strategy maximize_conversion_value)
5493
+ --conversion-goals <list> Comma-separated goal categories or conversion-action IDs; never mix them
5443
5494
 
5444
5495
  Flags (update):
5445
5496
  --name <name> Campaign name
@@ -5448,6 +5499,7 @@ Flags (update):
5448
5499
  --bid-strategy <s> Change bidding strategy
5449
5500
  --target-cpa <n> Target CPA in account currency. Send alone to retune the existing maximize_conversions target
5450
5501
  --target-roas <n> Target ROAS ratio (3.5 = 350%). Send alone to retune the existing target, incl. Performance Max
5502
+ --conversion-goals <list> Replace goals; pass null to restore account defaults
5451
5503
  --countries <codes> Replace included countries, e.g. US,CA
5452
5504
 
5453
5505
  Flags (list):
@@ -5463,15 +5515,20 @@ Note:
5463
5515
  Advanced geo examples: adkit manage google campaigns --help full
5464
5516
  Display creation starts here: campaigns create --campaign-type display, then create Display ad groups and responsive_display ads.
5465
5517
  Performance Max: campaignType "performance_max" with asset groups \u2014 build it with --data. See --help full.
5518
+ conversion-goals chooses what to optimize toward; bid-strategy controls bidding. It works on Search, Display, and Performance Max.
5519
+ On create, omit conversion-goals to inherit account defaults. On update, omit it to leave goals unchanged or pass null to restore defaults.
5520
+ Run --help full for valid goal categories and conversion-action ID discovery.
5466
5521
  View a Performance Max campaign by ID to read back its assetGroups; manage existing groups with google asset-groups.
5467
5522
  For spend/clicks/conversions: adkit manage google results
5468
5523
 
5469
5524
  Examples:
5470
5525
  adkit manage google campaigns list --account 1234567890
5471
5526
  adkit manage google campaigns create --name "Display Prospecting" --campaign-type display --budget-daily 50 --account 1234567890
5527
+ adkit manage google campaigns create --name "Purchase Search" --campaign-type search --budget-daily 40 --bid-strategy maximize_conversion_value --conversion-goals purchase --account 1234567890
5472
5528
  adkit manage google campaigns create --data '{"campaigns":[{"name":"Display US","campaignType":"display","budget":{"daily":50},"targeting":{"geoLocations":{"include":[{"type":"country","country":"US"}]}}}]}' --account 1234567890
5473
5529
  adkit manage google campaigns update 987654321 --data '{"targeting":{"geoLocations":{"match":"presence_or_interest"}}}' --account 1234567890
5474
5530
  adkit manage google campaigns update 987654321 --status paused --account 1234567890
5531
+ adkit manage google campaigns update 987654321 --conversion-goals null --account 1234567890
5475
5532
  adkit manage google campaigns delete 987654321 --account 1234567890
5476
5533
 
5477
5534
  Run --help full for all fields and advanced options.`;
@@ -5489,6 +5546,7 @@ Flags (create):
5489
5546
  --budget-daily <n> Daily budget in account currency
5490
5547
  --campaign-type <type> search, display, performance_max (performance_max needs --data for asset groups)
5491
5548
  --bid-strategy <s> manual_cpc, manual_cpm, maximize_clicks, maximize_conversions, maximize_conversion_value, target_spend, target_impression_share
5549
+ --conversion-goals <list> Comma-separated goal categories or conversion-action IDs; never mix them
5492
5550
  ${FLAG.account}
5493
5551
  ${FLAG.publish}
5494
5552
  ${FLAG.data}
@@ -5498,6 +5556,7 @@ Flags (update):
5498
5556
  --status <s> enabled, paused
5499
5557
  --budget-daily <n> Daily budget in account currency
5500
5558
  --bid-strategy <s> Change bidding strategy
5559
+ --conversion-goals <list> Replace goals; pass null to restore account defaults
5501
5560
  --countries <codes> Replace included countries, e.g. US,CA
5502
5561
  ${FLAG.account}
5503
5562
  ${FLAG.publish}
@@ -5517,17 +5576,24 @@ Notes:
5517
5576
  Google exclusions support named locations. Proximity circles belong in include.
5518
5577
  Display campaign creation uses campaignType:"display" or --campaign-type display. Videos are not supported for Display media in v1.
5519
5578
  Performance Max: campaignType "performance_max" requires at least one assetGroups[] entry and supports multiple groups. Text assets are inline ({role,text}); upload images with google media first, then reference their id/resourceName. Needs an enabled conversion (publish is blocked without one). Non-retail only. Build it with --data.
5579
+ conversion-goals works on Search, Display, and Performance Max. It chooses what to optimize toward; bid-strategy controls bidding.
5580
+ Valid goal categories: ${GOOGLE_CAMPAIGN_CONVERSION_GOAL_CATEGORY_LIST}
5581
+ For exact IDs, run google conversions list and pass conversion.platformId. Do not pass conversion.category; it uses a different vocabulary.
5582
+ On create, omit conversion-goals to inherit account defaults. On update, omit it to leave goals unchanged or pass null to restore defaults.
5520
5583
  View a Performance Max campaign by ID to read back its assetGroups. After creation, manage groups with google asset-groups.
5521
5584
  For spend/clicks/conversions: adkit manage google results
5522
5585
 
5523
5586
  Examples:
5524
5587
  adkit manage google campaigns list --account 1234567890
5525
5588
  adkit manage google campaigns create --name "Display Prospecting" --campaign-type display --budget-daily 50 --account 1234567890
5589
+ adkit manage google campaigns create --name "Purchase Search" --campaign-type search --budget-daily 40 --bid-strategy maximize_conversion_value --conversion-goals purchase --account 1234567890
5526
5590
  adkit manage google campaigns create --data '{"campaigns":[{"name":"Display US","campaignType":"display","budget":{"daily":50},"targeting":{"geoLocations":{"include":[{"type":"country","country":"US"}]}}}]}' --account 1234567890
5527
5591
  adkit manage google campaigns create --data '{"campaigns":[{"name":"Austin Search","campaignType":"search","budget":{"daily":5},"targeting":{"geoLocations":{"include":[{"type":"city","code":"1026201"}]}}}]}' --account 1234567890
5528
5592
  adkit manage google campaigns create --data '{"campaigns":[{"name":"SF Radius","campaignType":"search","budget":{"daily":5},"targeting":{"geoLocations":{"include":[{"type":"platformLocation","platform":"google","value":{"proximity":{"geo_point":{"latitude_in_micro_degrees":37774900,"longitude_in_micro_degrees":-122419400},"radius":5,"radius_units":"MILES"}}}]}}}]}' --account 1234567890
5529
5593
  adkit manage google campaigns create --data '{"campaigns":[{"name":"PMAX Launch","campaignType":"performance_max","budget":{"daily":50},"bidStrategy":"maximize_conversions","assetGroups":[{"name":"Asset Group 1","finalUrls":["https://example.com"],"assets":[{"role":"headline","text":"Ship faster"},{"role":"headline","text":"Save hours every week"},{"role":"headline","text":"Start free today"},{"role":"long_headline","text":"Automate your ad workflow and launch in minutes"},{"role":"description","text":"Automate your workflow in minutes"},{"role":"description","text":"No credit card required"},{"role":"business_name","text":"Acme"},{"role":"logo","id":"<uploaded-asset-id>"},{"role":"marketing_image","id":"<uploaded-asset-id>"},{"role":"square_marketing_image","id":"<uploaded-asset-id>"}],"signals":[{"type":"search_theme","text":"project management software"}]}]}]}' --account 1234567890
5530
5594
  adkit manage google campaigns update 987654321 --status paused --account 1234567890
5595
+ adkit manage google campaigns update 987654321 --conversion-goals 23854890221234567 --account 1234567890
5596
+ adkit manage google campaigns update 987654321 --conversion-goals null --account 1234567890
5531
5597
  adkit manage google campaigns update 987654321 --data '{"targeting":{"geoLocations":{"match":"presence_or_interest"}}}' --account 1234567890
5532
5598
  adkit manage google campaigns delete 987654321 --account 1234567890 --publish`;
5533
5599
  var GOOGLE_ASSET_GROUP_HELP = `adkit manage google asset-groups \u2014 Performance Max asset groups
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adkit/cli",
3
- "version": "1.13.22",
3
+ "version": "1.13.24",
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",