@adkit/cli 1.13.10 → 1.13.12
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 +102 -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,81 @@ 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
|
+
if (result.snippet) lines.push(` \u21B3 ${result.snippet}`);
|
|
4573
|
+
}
|
|
4574
|
+
lines.push("", "Each command above opens the matching CLI help.");
|
|
4575
|
+
return lines.join("\n");
|
|
4576
|
+
}
|
|
4577
|
+
function serverHelpPointerToCli(result) {
|
|
4578
|
+
const override = CLI_HELP_OVERRIDES[result.path];
|
|
4579
|
+
if (override) return { path: override.path, description: override.description || result.description, snippet: result.snippet };
|
|
4580
|
+
const negativeListPrefix = "manage google negative-list ";
|
|
4581
|
+
if (result.path.startsWith(negativeListPrefix)) {
|
|
4582
|
+
const action = result.path.slice(negativeListPrefix.length);
|
|
4583
|
+
return { path: `manage google keywords negative-lists ${action}`, description: result.description, snippet: result.snippet };
|
|
4584
|
+
}
|
|
4585
|
+
if (result.path.startsWith("manage platform-api-request ")) return { path: "manage platform-api-requests", description: result.description, snippet: result.snippet };
|
|
4586
|
+
return result;
|
|
4587
|
+
}
|
|
4588
|
+
function isHelpSearchResponse(value) {
|
|
4589
|
+
if (!value || typeof value !== "object" || !("results" in value)) return false;
|
|
4590
|
+
return Array.isArray(value.results);
|
|
4591
|
+
}
|
|
4592
|
+
|
|
4516
4593
|
// src/cli.ts
|
|
4517
4594
|
var require2 = createRequire(import.meta.url);
|
|
4518
4595
|
var CLI_VERSION = require2("../package.json").version;
|
|
@@ -4526,6 +4603,7 @@ Usage: adkit <command> [options]
|
|
|
4526
4603
|
|
|
4527
4604
|
Commands:
|
|
4528
4605
|
status Show project context and connected accounts
|
|
4606
|
+
help Search help topics by keyword (--search "<query>")
|
|
4529
4607
|
feedback Report feedback or bugs to AdKit
|
|
4530
4608
|
setup Set up AdKit (opens browser)
|
|
4531
4609
|
library Browse ads and advertisers
|
|
@@ -5881,7 +5959,7 @@ var HELP = {
|
|
|
5881
5959
|
list List connected ad accounts
|
|
5882
5960
|
connect <id> Connect an ad account
|
|
5883
5961
|
disconnect <id> Disconnect an ad account
|
|
5884
|
-
<id> update Update account settings (DSA defaults
|
|
5962
|
+
<id> update Update account settings (DSA defaults and resource IDs)
|
|
5885
5963
|
<id> pages List Facebook Pages for an account
|
|
5886
5964
|
<id> pixels List Meta Pixels for an account
|
|
5887
5965
|
|
|
@@ -5889,12 +5967,16 @@ Update flags:
|
|
|
5889
5967
|
--beneficiary <name> DSA: person or organization being promoted (required for EU ads)
|
|
5890
5968
|
--payor <name> DSA: person or organization paying (defaults to beneficiary)
|
|
5891
5969
|
--default-page <id> Default Facebook Page for ad creation
|
|
5970
|
+
--default-instagram-user <id> Saved account-level Instagram user ID
|
|
5892
5971
|
--default-pixel <id> Default Meta Pixel for conversion tracking
|
|
5893
5972
|
|
|
5973
|
+
Don't know the Instagram user ID? Read an existing Meta ad that uses the profile and copy creative.instagramUserId from its details.
|
|
5974
|
+
|
|
5894
5975
|
Examples:
|
|
5895
5976
|
adkit manage meta accounts list
|
|
5896
5977
|
adkit manage meta accounts connect act_123456789
|
|
5897
5978
|
adkit manage meta accounts act_123456789 update --beneficiary "Acme Inc"
|
|
5979
|
+
adkit manage meta accounts act_123456789 update --default-instagram-user 17841400000000000
|
|
5898
5980
|
adkit manage meta accounts act_123456789 pages
|
|
5899
5981
|
adkit manage meta accounts disconnect act_123456789`.trim(),
|
|
5900
5982
|
"meta campaigns": CAMPAIGN_HELP,
|
|
@@ -7535,6 +7617,23 @@ async function main() {
|
|
|
7535
7617
|
await submitFeedback({ args: args.slice(1), client, flags, json: wantsJson(flags) });
|
|
7536
7618
|
return;
|
|
7537
7619
|
}
|
|
7620
|
+
if (args[0] === "help") {
|
|
7621
|
+
if (flags.help) {
|
|
7622
|
+
printHelp(HELP_SEARCH_USAGE);
|
|
7623
|
+
return;
|
|
7624
|
+
}
|
|
7625
|
+
const query = typeof flags.search === "string" ? flags.search.trim() : "";
|
|
7626
|
+
if (!query) throw new CliError("MISSING_FLAG", "Missing required flag: `--search`", 'Run: adkit help --search "<query>"');
|
|
7627
|
+
const client = requireClient(flags);
|
|
7628
|
+
const data = await searchHelpTopics(client, query);
|
|
7629
|
+
const cliData = helpSearchToCliResponse(data);
|
|
7630
|
+
if (wantsJson(flags)) printResult(cliData, flags);
|
|
7631
|
+
else {
|
|
7632
|
+
const output = formatHelpSearch(data);
|
|
7633
|
+
console.log(output);
|
|
7634
|
+
}
|
|
7635
|
+
return;
|
|
7636
|
+
}
|
|
7538
7637
|
if (args[0] === "manage") {
|
|
7539
7638
|
const manageTarget = args[1];
|
|
7540
7639
|
if (flags.help && !manageTarget) {
|
package/package.json
CHANGED