@adkit/cli 1.13.9 → 1.13.11
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/dist/cli.js +109 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1233,16 +1233,18 @@ async function disconnectAccount(client, args, _flags) {
|
|
|
1233
1233
|
}
|
|
1234
1234
|
async function updateAccount(client, args, flags) {
|
|
1235
1235
|
const id = requireArg(args, 0, "account-id", 'Run: adkit manage meta accounts <account-id> update --beneficiary "Company Name"');
|
|
1236
|
-
validateFlags(flags, ["beneficiary", "payor", "default-page", "default-pixel"], "manage meta accounts update");
|
|
1236
|
+
validateFlags(flags, ["beneficiary", "payor", "default-page", "default-instagram-user", "default-pixel"], "manage meta accounts update");
|
|
1237
1237
|
const beneficiary = typeof flags.beneficiary === "string" ? flags.beneficiary : void 0;
|
|
1238
1238
|
const payor = typeof flags.payor === "string" ? flags.payor : void 0;
|
|
1239
1239
|
const defaultPageId = typeof flags["default-page"] === "string" ? flags["default-page"] : void 0;
|
|
1240
|
+
const defaultInstagramUserId = typeof flags["default-instagram-user"] === "string" ? flags["default-instagram-user"] : void 0;
|
|
1240
1241
|
const defaultPixelId = typeof flags["default-pixel"] === "string" ? flags["default-pixel"] : void 0;
|
|
1241
1242
|
const body = {};
|
|
1242
1243
|
if (beneficiary) body.dsaDefaults = { beneficiary, payor };
|
|
1243
1244
|
if (defaultPageId) body.defaultPageId = defaultPageId;
|
|
1245
|
+
if (defaultInstagramUserId) body.defaultInstagramUserId = defaultInstagramUserId;
|
|
1244
1246
|
if (defaultPixelId) body.defaultPixelId = defaultPixelId;
|
|
1245
|
-
if (!beneficiary && !defaultPageId && !defaultPixelId) throw new CliError("MISSING_FLAG", "Nothing to update", "Pass --beneficiary, --default-page, or --default-pixel");
|
|
1247
|
+
if (!beneficiary && !defaultPageId && !defaultInstagramUserId && !defaultPixelId) throw new CliError("MISSING_FLAG", "Nothing to update", "Pass --beneficiary, --default-page, --default-instagram-user, or --default-pixel");
|
|
1246
1248
|
return client.patch(`/manage/meta/accounts/${id}`, body);
|
|
1247
1249
|
}
|
|
1248
1250
|
async function listPages(client, args, _flags) {
|
|
@@ -1254,12 +1256,13 @@ async function listPixels(client, args, _flags) {
|
|
|
1254
1256
|
return client.get(`/manage/meta/accounts/${id}/pixels`);
|
|
1255
1257
|
}
|
|
1256
1258
|
async function listMetaLeadForms(client, _args, flags) {
|
|
1257
|
-
validateFlags(flags, ["page", "fields", "raw"], "manage meta lead-forms list");
|
|
1259
|
+
validateFlags(flags, ["account", "page", "fields", "raw"], "manage meta lead-forms list");
|
|
1260
|
+
const accountId = typeof flags.account === "string" ? flags.account : void 0;
|
|
1258
1261
|
const pageId = typeof flags.page === "string" ? flags.page : void 0;
|
|
1259
1262
|
if (!pageId) throw new CliError("MISSING_FLAG", "Missing required flag: `--page`", "Run: adkit manage meta lead-forms list --page <page-id>");
|
|
1260
1263
|
const fields = typeof flags.fields === "string" ? flags.fields : void 0;
|
|
1261
1264
|
const raw = flags.raw === true ? "true" : void 0;
|
|
1262
|
-
const qs = queryString({ pageId, fields, raw });
|
|
1265
|
+
const qs = queryString({ accountId, pageId, fields, raw });
|
|
1263
1266
|
return client.get(`/manage/meta/lead-forms${qs}`);
|
|
1264
1267
|
}
|
|
1265
1268
|
function buildCampaignPayload(flags) {
|
|
@@ -4512,6 +4515,80 @@ function isFeedbackResponse(value) {
|
|
|
4512
4515
|
return value !== null && typeof value === "object";
|
|
4513
4516
|
}
|
|
4514
4517
|
|
|
4518
|
+
// src/commands/help.ts
|
|
4519
|
+
var HELP_SEARCH_USAGE = `Usage: adkit help --search "<query>" [--json]
|
|
4520
|
+
|
|
4521
|
+
Search AdKit help by keyword and return the closest CLI help commands.
|
|
4522
|
+
|
|
4523
|
+
Options:
|
|
4524
|
+
--search <query> Capability or topic to find, such as "keyword planner"
|
|
4525
|
+
--json Output structured results with CLI command paths
|
|
4526
|
+
|
|
4527
|
+
Example:
|
|
4528
|
+
adkit help --search "keyword planner"`;
|
|
4529
|
+
var CLI_HELP_OVERRIDES = {
|
|
4530
|
+
"manage media request_upload_url": {
|
|
4531
|
+
path: "manage meta media upload",
|
|
4532
|
+
description: "The CLI uploads local files directly. Open a platform media command and pass --file, --url, or --adkit-media."
|
|
4533
|
+
},
|
|
4534
|
+
"manage google keywords create": { path: "manage google keywords add", description: "" },
|
|
4535
|
+
"manage google keywords delete": { path: "manage google keywords remove", description: "" },
|
|
4536
|
+
"manage google keywords list-negatives": { path: "manage google keywords negatives list", description: "" },
|
|
4537
|
+
"manage google keywords add-negative": { path: "manage google keywords negatives add", description: "" },
|
|
4538
|
+
"manage google keywords remove-negative": { path: "manage google keywords negatives remove", description: "" },
|
|
4539
|
+
"studio ads generate": { path: "studio generate", description: "" },
|
|
4540
|
+
"studio ads media_list": { path: "studio media list", description: "" },
|
|
4541
|
+
"studio ads share": { path: "studio share", description: "" },
|
|
4542
|
+
"studio media request_upload_url": {
|
|
4543
|
+
path: "studio media upload",
|
|
4544
|
+
description: "The CLI uploads local Studio media directly from a file."
|
|
4545
|
+
}
|
|
4546
|
+
};
|
|
4547
|
+
async function searchHelpTopics(client, query) {
|
|
4548
|
+
return client.get(`/manage/help/search?q=${encodeURIComponent(query)}`);
|
|
4549
|
+
}
|
|
4550
|
+
function helpSearchToCliResponse(data) {
|
|
4551
|
+
if (!isHelpSearchResponse(data)) return data;
|
|
4552
|
+
const results = [];
|
|
4553
|
+
const seenPaths = /* @__PURE__ */ new Set();
|
|
4554
|
+
for (const result of data.results) {
|
|
4555
|
+
const cliResult = serverHelpPointerToCli(result);
|
|
4556
|
+
if (seenPaths.has(cliResult.path)) continue;
|
|
4557
|
+
seenPaths.add(cliResult.path);
|
|
4558
|
+
results.push(cliResult);
|
|
4559
|
+
}
|
|
4560
|
+
return {
|
|
4561
|
+
results,
|
|
4562
|
+
note: "Each result.path is a CLI command path. Run: adkit <path> --help"
|
|
4563
|
+
};
|
|
4564
|
+
}
|
|
4565
|
+
function formatHelpSearch(data) {
|
|
4566
|
+
const cliData = helpSearchToCliResponse(data);
|
|
4567
|
+
if (!isHelpSearchResponse(cliData) || cliData.results.length === 0) return "No help topics matched. Drill down instead: adkit manage --help, adkit library --help, or adkit studio --help.";
|
|
4568
|
+
const lines = [];
|
|
4569
|
+
for (const result of cliData.results) {
|
|
4570
|
+
lines.push(`adkit ${result.path} --help`);
|
|
4571
|
+
if (result.description) lines.push(` ${result.description}`);
|
|
4572
|
+
}
|
|
4573
|
+
lines.push("", "Each command above opens the matching CLI help.");
|
|
4574
|
+
return lines.join("\n");
|
|
4575
|
+
}
|
|
4576
|
+
function serverHelpPointerToCli(result) {
|
|
4577
|
+
const override = CLI_HELP_OVERRIDES[result.path];
|
|
4578
|
+
if (override) return { path: override.path, description: override.description || result.description };
|
|
4579
|
+
const negativeListPrefix = "manage google negative-list ";
|
|
4580
|
+
if (result.path.startsWith(negativeListPrefix)) {
|
|
4581
|
+
const action = result.path.slice(negativeListPrefix.length);
|
|
4582
|
+
return { path: `manage google keywords negative-lists ${action}`, description: result.description };
|
|
4583
|
+
}
|
|
4584
|
+
if (result.path.startsWith("manage platform-api-request ")) return { path: "manage platform-api-requests", description: result.description };
|
|
4585
|
+
return result;
|
|
4586
|
+
}
|
|
4587
|
+
function isHelpSearchResponse(value) {
|
|
4588
|
+
if (!value || typeof value !== "object" || !("results" in value)) return false;
|
|
4589
|
+
return Array.isArray(value.results);
|
|
4590
|
+
}
|
|
4591
|
+
|
|
4515
4592
|
// src/cli.ts
|
|
4516
4593
|
var require2 = createRequire(import.meta.url);
|
|
4517
4594
|
var CLI_VERSION = require2("../package.json").version;
|
|
@@ -4525,6 +4602,7 @@ Usage: adkit <command> [options]
|
|
|
4525
4602
|
|
|
4526
4603
|
Commands:
|
|
4527
4604
|
status Show project context and connected accounts
|
|
4605
|
+
help Search help topics by keyword (--search "<query>")
|
|
4528
4606
|
feedback Report feedback or bugs to AdKit
|
|
4529
4607
|
setup Set up AdKit (opens browser)
|
|
4530
4608
|
library Browse ads and advertisers
|
|
@@ -5074,16 +5152,17 @@ Examples:
|
|
|
5074
5152
|
adkit manage meta creatives delete cr_abc`;
|
|
5075
5153
|
var LEAD_FORM_HELP = `adkit manage meta lead-forms \u2014 Meta Instant Forms
|
|
5076
5154
|
|
|
5077
|
-
list
|
|
5155
|
+
list List existing Instant Forms owned by a Facebook Page
|
|
5078
5156
|
|
|
5079
5157
|
Flags:
|
|
5158
|
+
--account <id> Connected Meta ad account (required when multiple are connected)
|
|
5080
5159
|
--page <id> Facebook Page ID (required)
|
|
5081
|
-
--fields <list>
|
|
5160
|
+
--fields <list> platformId,name,status,createdTime
|
|
5082
5161
|
--raw Return raw Meta API fields
|
|
5083
5162
|
|
|
5084
5163
|
Notes:
|
|
5085
|
-
|
|
5086
|
-
|
|
5164
|
+
Existing Meta logins must reconnect once after this update and accept all permissions.
|
|
5165
|
+
The Facebook Page must accept Meta Lead Generation Terms before lead ads can publish.
|
|
5087
5166
|
In product/help grouping, lead forms are supporting Meta assets; the command entity stays lead-forms.
|
|
5088
5167
|
|
|
5089
5168
|
Examples:
|
|
@@ -5879,7 +5958,7 @@ var HELP = {
|
|
|
5879
5958
|
list List connected ad accounts
|
|
5880
5959
|
connect <id> Connect an ad account
|
|
5881
5960
|
disconnect <id> Disconnect an ad account
|
|
5882
|
-
<id> update Update account settings (DSA defaults
|
|
5961
|
+
<id> update Update account settings (DSA defaults and resource IDs)
|
|
5883
5962
|
<id> pages List Facebook Pages for an account
|
|
5884
5963
|
<id> pixels List Meta Pixels for an account
|
|
5885
5964
|
|
|
@@ -5887,12 +5966,16 @@ Update flags:
|
|
|
5887
5966
|
--beneficiary <name> DSA: person or organization being promoted (required for EU ads)
|
|
5888
5967
|
--payor <name> DSA: person or organization paying (defaults to beneficiary)
|
|
5889
5968
|
--default-page <id> Default Facebook Page for ad creation
|
|
5969
|
+
--default-instagram-user <id> Saved account-level Instagram user ID
|
|
5890
5970
|
--default-pixel <id> Default Meta Pixel for conversion tracking
|
|
5891
5971
|
|
|
5972
|
+
Don't know the Instagram user ID? Read an existing Meta ad that uses the profile and copy creative.instagramUserId from its details.
|
|
5973
|
+
|
|
5892
5974
|
Examples:
|
|
5893
5975
|
adkit manage meta accounts list
|
|
5894
5976
|
adkit manage meta accounts connect act_123456789
|
|
5895
5977
|
adkit manage meta accounts act_123456789 update --beneficiary "Acme Inc"
|
|
5978
|
+
adkit manage meta accounts act_123456789 update --default-instagram-user 17841400000000000
|
|
5896
5979
|
adkit manage meta accounts act_123456789 pages
|
|
5897
5980
|
adkit manage meta accounts disconnect act_123456789`.trim(),
|
|
5898
5981
|
"meta campaigns": CAMPAIGN_HELP,
|
|
@@ -7533,6 +7616,23 @@ async function main() {
|
|
|
7533
7616
|
await submitFeedback({ args: args.slice(1), client, flags, json: wantsJson(flags) });
|
|
7534
7617
|
return;
|
|
7535
7618
|
}
|
|
7619
|
+
if (args[0] === "help") {
|
|
7620
|
+
if (flags.help) {
|
|
7621
|
+
printHelp(HELP_SEARCH_USAGE);
|
|
7622
|
+
return;
|
|
7623
|
+
}
|
|
7624
|
+
const query = typeof flags.search === "string" ? flags.search.trim() : "";
|
|
7625
|
+
if (!query) throw new CliError("MISSING_FLAG", "Missing required flag: `--search`", 'Run: adkit help --search "<query>"');
|
|
7626
|
+
const client = requireClient(flags);
|
|
7627
|
+
const data = await searchHelpTopics(client, query);
|
|
7628
|
+
const cliData = helpSearchToCliResponse(data);
|
|
7629
|
+
if (wantsJson(flags)) printResult(cliData, flags);
|
|
7630
|
+
else {
|
|
7631
|
+
const output = formatHelpSearch(data);
|
|
7632
|
+
console.log(output);
|
|
7633
|
+
}
|
|
7634
|
+
return;
|
|
7635
|
+
}
|
|
7536
7636
|
if (args[0] === "manage") {
|
|
7537
7637
|
const manageTarget = args[1];
|
|
7538
7638
|
if (flags.help && !manageTarget) {
|
package/package.json
CHANGED