@adkit/cli 1.13.10 → 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 +101 -3
- 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) {
|
|
@@ -4513,6 +4515,80 @@ function isFeedbackResponse(value) {
|
|
|
4513
4515
|
return value !== null && typeof value === "object";
|
|
4514
4516
|
}
|
|
4515
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
|
+
|
|
4516
4592
|
// src/cli.ts
|
|
4517
4593
|
var require2 = createRequire(import.meta.url);
|
|
4518
4594
|
var CLI_VERSION = require2("../package.json").version;
|
|
@@ -4526,6 +4602,7 @@ Usage: adkit <command> [options]
|
|
|
4526
4602
|
|
|
4527
4603
|
Commands:
|
|
4528
4604
|
status Show project context and connected accounts
|
|
4605
|
+
help Search help topics by keyword (--search "<query>")
|
|
4529
4606
|
feedback Report feedback or bugs to AdKit
|
|
4530
4607
|
setup Set up AdKit (opens browser)
|
|
4531
4608
|
library Browse ads and advertisers
|
|
@@ -5881,7 +5958,7 @@ var HELP = {
|
|
|
5881
5958
|
list List connected ad accounts
|
|
5882
5959
|
connect <id> Connect an ad account
|
|
5883
5960
|
disconnect <id> Disconnect an ad account
|
|
5884
|
-
<id> update Update account settings (DSA defaults
|
|
5961
|
+
<id> update Update account settings (DSA defaults and resource IDs)
|
|
5885
5962
|
<id> pages List Facebook Pages for an account
|
|
5886
5963
|
<id> pixels List Meta Pixels for an account
|
|
5887
5964
|
|
|
@@ -5889,12 +5966,16 @@ Update flags:
|
|
|
5889
5966
|
--beneficiary <name> DSA: person or organization being promoted (required for EU ads)
|
|
5890
5967
|
--payor <name> DSA: person or organization paying (defaults to beneficiary)
|
|
5891
5968
|
--default-page <id> Default Facebook Page for ad creation
|
|
5969
|
+
--default-instagram-user <id> Saved account-level Instagram user ID
|
|
5892
5970
|
--default-pixel <id> Default Meta Pixel for conversion tracking
|
|
5893
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
|
+
|
|
5894
5974
|
Examples:
|
|
5895
5975
|
adkit manage meta accounts list
|
|
5896
5976
|
adkit manage meta accounts connect act_123456789
|
|
5897
5977
|
adkit manage meta accounts act_123456789 update --beneficiary "Acme Inc"
|
|
5978
|
+
adkit manage meta accounts act_123456789 update --default-instagram-user 17841400000000000
|
|
5898
5979
|
adkit manage meta accounts act_123456789 pages
|
|
5899
5980
|
adkit manage meta accounts disconnect act_123456789`.trim(),
|
|
5900
5981
|
"meta campaigns": CAMPAIGN_HELP,
|
|
@@ -7535,6 +7616,23 @@ async function main() {
|
|
|
7535
7616
|
await submitFeedback({ args: args.slice(1), client, flags, json: wantsJson(flags) });
|
|
7536
7617
|
return;
|
|
7537
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
|
+
}
|
|
7538
7636
|
if (args[0] === "manage") {
|
|
7539
7637
|
const manageTarget = args[1];
|
|
7540
7638
|
if (flags.help && !manageTarget) {
|
package/package.json
CHANGED