@koda-sl/baker-cli 0.169.0 → 0.169.2
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 +30 -10
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7229,6 +7229,15 @@ function handleGoogleError(err) {
|
|
|
7229
7229
|
function noopHints(data) {
|
|
7230
7230
|
return data.staged ? [] : [`NOT STAGED \u2014 ${data.reason}. Nothing to publish for this change; say so rather than reporting it as done.`];
|
|
7231
7231
|
}
|
|
7232
|
+
function skippedHints(skipped, total) {
|
|
7233
|
+
if (skipped.length === 0) {
|
|
7234
|
+
return [];
|
|
7235
|
+
}
|
|
7236
|
+
const detail = skipped.map((s) => `${s.summary} \u2014 ${s.reason}`).join("; ");
|
|
7237
|
+
return [
|
|
7238
|
+
`${skipped.length} of ${total} op(s) NOT STAGED: ${detail}. Don't re-stage them; tell the user which changes couldn't be made and why, then carry on with the rest.`
|
|
7239
|
+
];
|
|
7240
|
+
}
|
|
7232
7241
|
async function stageGoogleOp(raw, hints) {
|
|
7233
7242
|
const preflight = googleDraftOpInputSchema.safeParse(raw);
|
|
7234
7243
|
if (!preflight.success) {
|
|
@@ -7285,14 +7294,7 @@ async function stageGoogleOps(rawOps, hints) {
|
|
|
7285
7294
|
try {
|
|
7286
7295
|
const chatId = requireChatId();
|
|
7287
7296
|
const response = await apiPost("/api/ads/google/draft/stage-batch", { chatId, ops });
|
|
7288
|
-
const
|
|
7289
|
-
const allHints = [
|
|
7290
|
-
...skipped.length > 0 ? [
|
|
7291
|
-
`${skipped.length} of ${ops.length} op(s) NOT STAGED \u2014 already in the requested state: ${skipped.map((s) => s.reason).join("; ")}`
|
|
7292
|
-
] : [],
|
|
7293
|
-
...hints ?? [],
|
|
7294
|
-
...adCopyHints(ops)
|
|
7295
|
-
];
|
|
7297
|
+
const allHints = [...skippedHints(response.data.skipped ?? [], ops.length), ...hints ?? [], ...adCopyHints(ops)];
|
|
7296
7298
|
writeJsonEnvelope(allHints.length > 0 ? { ...response, hints: allHints } : response);
|
|
7297
7299
|
} catch (err) {
|
|
7298
7300
|
handleGoogleError(err);
|
|
@@ -15954,10 +15956,27 @@ var metaMediaCommand = defineCommand64({
|
|
|
15954
15956
|
|
|
15955
15957
|
// src/commands/ads/meta/pages.ts
|
|
15956
15958
|
import { defineCommand as defineCommand65 } from "citty";
|
|
15959
|
+
function advertisablePages(data) {
|
|
15960
|
+
return data.filter((p) => Array.isArray(p.tasks) && p.tasks.includes("ADVERTISE"));
|
|
15961
|
+
}
|
|
15962
|
+
function pageSelectionHints(data) {
|
|
15963
|
+
const advertisable = advertisablePages(data);
|
|
15964
|
+
if (advertisable.length > 1) {
|
|
15965
|
+
return [
|
|
15966
|
+
"MULTIPLE Pages can run ads \u2014 do NOT guess. Confirm with the user which Page an ad should run from before passing --page to `creatives create`; a wrong Page publishes the ad under the wrong brand identity and staging will not catch it."
|
|
15967
|
+
];
|
|
15968
|
+
}
|
|
15969
|
+
if (data.length > 0 && advertisable.length === 0) {
|
|
15970
|
+
return [
|
|
15971
|
+
"NO Page can run ads \u2014 none of the connected user's Pages carry the ADVERTISE task. Ask the user to grant Advertise access to the right Page before creating an ad; a readable-but-non-advertising Page still passes staging and would fail or run under the wrong identity."
|
|
15972
|
+
];
|
|
15973
|
+
}
|
|
15974
|
+
return [];
|
|
15975
|
+
}
|
|
15957
15976
|
var pagesCommand = defineCommand65({
|
|
15958
15977
|
meta: {
|
|
15959
15978
|
name: "pages",
|
|
15960
|
-
description: `List the Facebook Pages the connected user manages. Every Meta ad publishes from a Page, so use this to
|
|
15979
|
+
description: `List the Facebook Pages the connected user manages. Every Meta ad publishes from a Page, so use this to identify the Page an ad should run from. The 'tasks' field shows what the user can do on each Page (ADVERTISE means it can back ads). If exactly one Page can ADVERTISE, use it; if more than one can, confirm with the user which Page to use; if none can, ask the user to grant Advertise access \u2014 a wrong or non-advertising Page publishes under the wrong brand identity.
|
|
15961
15980
|
|
|
15962
15981
|
Examples:
|
|
15963
15982
|
baker ads meta pages`
|
|
@@ -15976,7 +15995,8 @@ Examples:
|
|
|
15976
15995
|
writeAdsOutput(data, fmt);
|
|
15977
15996
|
return;
|
|
15978
15997
|
}
|
|
15979
|
-
|
|
15998
|
+
const hints = pageSelectionHints(data);
|
|
15999
|
+
writeJsonEnvelope(hints.length > 0 ? { ok: true, data, hints } : { ok: true, data });
|
|
15980
16000
|
} catch (err) {
|
|
15981
16001
|
handleMetaError(err);
|
|
15982
16002
|
}
|