@koda-sl/baker-cli 0.868.0-dev.dd070597a → 0.869.0-dev.0631d8a3c
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/README.md +2 -0
- package/dist/{account-reads-3LP4F3L4.js → account-reads-SUWXGTGW.js} +2 -2
- package/dist/{ads-O76TVWHX.js → ads-VSU53JN3.js} +4 -4
- package/dist/{chunk-N366L5EF.js → chunk-LZ5DS4UB.js} +4 -32
- package/dist/chunk-LZ5DS4UB.js.map +1 -0
- package/dist/{chunk-BPIHAIWB.js → chunk-XFTN3ARP.js} +22 -13
- package/dist/chunk-XFTN3ARP.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/{conversion-upload-command-HJOVSWZD.js → conversion-upload-command-Y4ABNNAT.js} +2 -2
- package/dist/{draft-OLSFLDME.js → draft-CLNMIQXV.js} +2 -2
- package/dist/{forecast-AQDB4LLG.js → forecast-JAPRYH4F.js} +2 -2
- package/dist/{google-HLE7YIYM.js → google-HHKFDH7I.js} +40 -57
- package/dist/google-HHKFDH7I.js.map +1 -0
- package/dist/{linkedin-EBOTX37R.js → linkedin-RMZMQ2ZA.js} +8 -4
- package/dist/{linkedin-EBOTX37R.js.map → linkedin-RMZMQ2ZA.js.map} +1 -1
- package/dist/{meta-SPPSYRMC.js → meta-HOFABFAK.js} +2 -2
- package/dist/preview-4DDR337D.js +151 -0
- package/dist/preview-4DDR337D.js.map +1 -0
- package/dist/{preview-4GUQGDBD.js → preview-XXQ5AHXP.js} +134 -42
- package/dist/preview-XXQ5AHXP.js.map +1 -0
- package/dist/{search-terms-WKEPRHN2.js → search-terms-WLOW2FPP.js} +2 -2
- package/dist/{themes-2T5BOIZU.js → themes-Q5CSF6TJ.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-BPIHAIWB.js.map +0 -1
- package/dist/chunk-N366L5EF.js.map +0 -1
- package/dist/google-HLE7YIYM.js.map +0 -1
- package/dist/preview-4GUQGDBD.js.map +0 -1
- package/dist/preview-HD3QAR53.js +0 -104
- package/dist/preview-HD3QAR53.js.map +0 -1
- /package/dist/{account-reads-3LP4F3L4.js.map → account-reads-SUWXGTGW.js.map} +0 -0
- /package/dist/{ads-O76TVWHX.js.map → ads-VSU53JN3.js.map} +0 -0
- /package/dist/{conversion-upload-command-HJOVSWZD.js.map → conversion-upload-command-Y4ABNNAT.js.map} +0 -0
- /package/dist/{draft-OLSFLDME.js.map → draft-CLNMIQXV.js.map} +0 -0
- /package/dist/{forecast-AQDB4LLG.js.map → forecast-JAPRYH4F.js.map} +0 -0
- /package/dist/{meta-SPPSYRMC.js.map → meta-HOFABFAK.js.map} +0 -0
- /package/dist/{search-terms-WKEPRHN2.js.map → search-terms-WLOW2FPP.js.map} +0 -0
- /package/dist/{themes-2T5BOIZU.js.map → themes-Q5CSF6TJ.js.map} +0 -0
package/README.md
CHANGED
|
@@ -1491,6 +1491,7 @@ baker ads meta insights --object 9988 --level ad --intent video \
|
|
|
1491
1491
|
--breakdowns publisher_platform,platform_position --date-preset last_30d # one ad only: hints flag placements playing far below the ad's own rate
|
|
1492
1492
|
baker ads meta preview --creative-id 9988 --placement facebook_reels_overlay --platform facebook
|
|
1493
1493
|
baker ads meta preview --list-formats # ad_format values + placement mappings
|
|
1494
|
+
baker ads meta preview --creative-id 9988,9989 --ad-format MOBILE_FEED_STANDARD,INSTAGRAM_REELS # every creative × format pair in one call, drawn in parallel (at most 24)
|
|
1494
1495
|
baker ads meta videos --ad-id 9988,9989 # download the ads' video files (MP4) to /tmp/meta-ad-videos; --url-only for the addresses
|
|
1495
1496
|
|
|
1496
1497
|
# "What audience is this targeting?"
|
|
@@ -1816,6 +1817,7 @@ baker ads linkedin campaigns --account-id 503001492 --targeting
|
|
|
1816
1817
|
# "What does this ad actually show?" — LinkedIn's own feed rendering, desktop + mobile:
|
|
1817
1818
|
# data.previews[].shownText (the text displayed, in order) and .image (a picture)
|
|
1818
1819
|
baker ads linkedin preview 1611562694 --account-id 503001492
|
|
1820
|
+
baker ads linkedin preview 1611562694 1611562695 --placement mobile # several ads in one call, drawn in parallel
|
|
1819
1821
|
|
|
1820
1822
|
# "Top companies seeing this campaign" (ABM feedback loop) — org names auto-resolved
|
|
1821
1823
|
baker ads linkedin top-companies --campaign-id 1234 --last-days 30
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
failWriteValidation,
|
|
6
6
|
listFlag,
|
|
7
7
|
requireCustomerId
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-LZ5DS4UB.js";
|
|
9
9
|
import "./chunk-RHN5FEWA.js";
|
|
10
10
|
import "./chunk-XD7C5OE7.js";
|
|
11
11
|
import "./chunk-UKENQSZ2.js";
|
|
@@ -227,4 +227,4 @@ export {
|
|
|
227
227
|
invoicesCommand,
|
|
228
228
|
previewsCommand
|
|
229
229
|
};
|
|
230
|
-
//# sourceMappingURL=account-reads-
|
|
230
|
+
//# sourceMappingURL=account-reads-SUWXGTGW.js.map
|
|
@@ -33,9 +33,9 @@ Examples:
|
|
|
33
33
|
Full guides: __tooling__/docs/tools/baker/ads-<platform>.md (google|meta|linkedin|x|chatgpt|performance|terms)`
|
|
34
34
|
},
|
|
35
35
|
subCommands: {
|
|
36
|
-
google: () => import("./google-
|
|
37
|
-
meta: () => import("./meta-
|
|
38
|
-
linkedin: () => import("./linkedin-
|
|
36
|
+
google: () => import("./google-HHKFDH7I.js").then((m) => m.googleCommand),
|
|
37
|
+
meta: () => import("./meta-HOFABFAK.js").then((m) => m.metaCommand),
|
|
38
|
+
linkedin: () => import("./linkedin-RMZMQ2ZA.js").then((m) => m.linkedinCommand),
|
|
39
39
|
x: () => import("./x-JU6LF2MM.js").then((m) => m.xCommand),
|
|
40
40
|
chatgpt: () => import("./chatgpt-FV4PVN4W.js").then((m) => m.chatgptCommand),
|
|
41
41
|
performance: () => import("./performance-Y2S5FDGI.js").then((m) => m.performanceCommand),
|
|
@@ -45,4 +45,4 @@ Full guides: __tooling__/docs/tools/baker/ads-<platform>.md (google|meta|linkedi
|
|
|
45
45
|
export {
|
|
46
46
|
adsCommand
|
|
47
47
|
};
|
|
48
|
-
//# sourceMappingURL=ads-
|
|
48
|
+
//# sourceMappingURL=ads-VSU53JN3.js.map
|
|
@@ -365,31 +365,6 @@ function recordTreeStage(chatId, staged) {
|
|
|
365
365
|
return [];
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
var GUIDANCE = /* @__PURE__ */ new Set();
|
|
369
|
-
function guidance(...hints) {
|
|
370
|
-
for (const hint of hints) GUIDANCE.add(hint);
|
|
371
|
-
return hints;
|
|
372
|
-
}
|
|
373
|
-
var GUIDANCE_CACHE = "stage-guidance";
|
|
374
|
-
var GUIDANCE_WINDOW_MS = 30 * 6e4;
|
|
375
|
-
function unsaidGuidance(chatId, hints) {
|
|
376
|
-
return hints.filter((hint) => {
|
|
377
|
-
if (!GUIDANCE.has(hint)) {
|
|
378
|
-
return true;
|
|
379
|
-
}
|
|
380
|
-
try {
|
|
381
|
-
const key = `${chatId}
|
|
382
|
-
${hint}`;
|
|
383
|
-
if (cacheGet(GUIDANCE_CACHE, key)?.data) {
|
|
384
|
-
return false;
|
|
385
|
-
}
|
|
386
|
-
cacheSet(GUIDANCE_CACHE, key, true, GUIDANCE_WINDOW_MS);
|
|
387
|
-
return true;
|
|
388
|
-
} catch {
|
|
389
|
-
return true;
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
368
|
|
|
394
369
|
// src/commands/ads/google/write-shared.ts
|
|
395
370
|
function googleStaged(...kinds) {
|
|
@@ -628,9 +603,7 @@ function handleGoogleError(err) {
|
|
|
628
603
|
process.exit(1);
|
|
629
604
|
}
|
|
630
605
|
function noopHints(data) {
|
|
631
|
-
return data.staged ? [] : [
|
|
632
|
-
"NOT STAGED \u2014 `data.reason` says why. Nothing to publish for this change; say so rather than reporting it as done."
|
|
633
|
-
];
|
|
606
|
+
return data.staged ? [] : [`NOT STAGED \u2014 ${data.reason}. Nothing to publish for this change; say so rather than reporting it as done.`];
|
|
634
607
|
}
|
|
635
608
|
function skippedHints(skipped, total) {
|
|
636
609
|
if (skipped.length === 0) {
|
|
@@ -663,7 +636,7 @@ async function stageGoogleOp(raw, hints) {
|
|
|
663
636
|
...noopHints(response.data),
|
|
664
637
|
...recordSingleStage(chatId, preflight.data.kind),
|
|
665
638
|
...recordTreeStage(chatId, response.data),
|
|
666
|
-
...
|
|
639
|
+
...hints ?? [],
|
|
667
640
|
...await adCopyHints(preflight.data)
|
|
668
641
|
];
|
|
669
642
|
writeJsonEnvelope(withHints(response, allHints));
|
|
@@ -737,7 +710,7 @@ async function stageGoogleOps(rawOps, hints, full = false) {
|
|
|
737
710
|
...omitted > 0 ? [
|
|
738
711
|
`${omitted} staged ops without a warning are left out. They are already staged \u2014 do not stage them again; read their refs with \`baker ads google draft list --json\` (pass --full on a later stage to print every op).`
|
|
739
712
|
] : [],
|
|
740
|
-
...
|
|
713
|
+
...hints ?? [],
|
|
741
714
|
...await adCopyHints(ops)
|
|
742
715
|
];
|
|
743
716
|
writeJsonEnvelope(withHints({ ...response, data: view }, allHints));
|
|
@@ -869,7 +842,6 @@ export {
|
|
|
869
842
|
AD_COPY_LIST_USAGE,
|
|
870
843
|
validateAccountHint,
|
|
871
844
|
showAccountHint,
|
|
872
|
-
guidance,
|
|
873
845
|
googleStaged,
|
|
874
846
|
googleStagedBatch,
|
|
875
847
|
failWriteValidation,
|
|
@@ -902,4 +874,4 @@ export {
|
|
|
902
874
|
fileCreateCommand,
|
|
903
875
|
bidModifierFlag
|
|
904
876
|
};
|
|
905
|
-
//# sourceMappingURL=chunk-
|
|
877
|
+
//# sourceMappingURL=chunk-LZ5DS4UB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/ads/google/draft-account.ts","../src/commands/ads/google/write-shared.ts","../src/commands/ads/google/copy-list-usage.ts","../src/commands/ads/google/draft-status.ts","../src/commands/ads/google/stage-streak.ts"],"sourcesContent":["import type { GoogleDraftListResponse } from \"@baker/api/ads-google\";\n\n/**\n * `--customer-id` on the draft reads. A draft belongs to the chat, not to an account, and may span\n * several; every other Google Ads command takes the flag, so agents carry it here (BAKER-497).\n * `list` narrows to that account and says what the others still hold; `validate` and `show` keep\n * their whole answer, because publish sends every account together and a ref names one op.\n */\n\nfunction changes(n: number, staged: boolean): string {\n const noun = staged ? \"staged change\" : \"change\";\n return n === 1 ? `1 ${noun}` : `${n} ${noun}s`;\n}\n\n/**\n * The draft as one account holds it, with what the rest of the chat's draft holds. `empty` is the\n * readable line for an account holding none of it, where the whole-chat \"nothing staged\" would be false.\n * Only an active draft's other changes are still to publish; a published one's are already done.\n */\nexport function draftInAccount(\n data: GoogleDraftListResponse,\n customerId: string,\n): { data: GoogleDraftListResponse; hints: string[]; empty?: string } {\n const ops = data.ops.filter((op) => op.customerId === customerId);\n const narrowed = {\n ...data,\n count: ops.length,\n ops,\n ...(data.tree ? { tree: data.tree.filter((node) => node.customerId === customerId) } : {}),\n };\n const others = data.ops.filter((op) => op.customerId !== customerId);\n if (others.length === 0) return { data: narrowed, hints: [] };\n const staged = data.status === \"active\";\n const accounts = [...new Set(others.map((op) => op.customerId))];\n const where = `account${accounts.length === 1 ? \"\" : \"s\"} ${accounts.join(\", \")}`;\n const one = others.length === 1;\n if (ops.length === 0) {\n return {\n data: narrowed,\n empty: `No Google Ads changes in account ${customerId} on this chat.`,\n hints: [`This chat's ${changes(others.length, staged)} ${one ? \"is\" : \"are\"} in ${where}, not ${customerId}.`],\n };\n }\n const more = `${others.length} more ${staged ? \"staged \" : \"\"}change${one ? \"\" : \"s\"}`;\n const verb = staged ? (one ? \"publishes\" : \"publish\") : one ? \"is\" : \"are\";\n return {\n data: narrowed,\n hints: [\n `Showing account ${customerId} only. ${more} in ${where} ${verb} ${staged ? \"with this chat too\" : \"on this chat too\"}; \\`baker ads google draft list\\` without --customer-id shows ${one ? \"it\" : \"them\"}.`,\n ],\n };\n}\n\n/** `draft validate --customer-id`: said back, since the verdicts still cover every account. */\nexport function validateAccountHint(customerId: string): string {\n return `Validated this chat's whole draft, not only account ${customerId}: publish sends every account's changes together, so each verdict above counts.`;\n}\n\n/** `draft show --customer-id` naming another account than the op's own. */\nexport function showAccountHint(customerId: string, opCustomerId: string): string | undefined {\n return opCustomerId === customerId ? undefined : `This op is staged in account ${opCustomerId}, not ${customerId}.`;\n}\n","import { readFileSync } from \"node:fs\";\nimport {\n GOOGLE_DRAFT_BATCH_MAX,\n type GoogleDraftListResponse,\n type GoogleDraftOpKind,\n type GoogleDraftStageBatchResponse,\n type GoogleDraftStageResponse,\n googleDraftBatchOpSchema,\n googleDraftOpInputSchema,\n OP_TOO_LARGE_FIX,\n OP_TOO_LARGE_MESSAGE_START,\n toMicros,\n} from \"@baker/api/ads-google\";\nimport { defineCommand } from \"citty\";\nimport { ApiError, apiPost } from \"../../../client.ts\";\nimport { requireChatId, resolveChatId } from \"../../../env.ts\";\nimport { handleConnectionError, isNotConnectedError } from \"../../../error-handler.ts\";\nimport { repeatedValues } from \"../../../lib/repeatedFlags.ts\";\nimport { type CommandEffectDeclaration, type PayloadSource, payloadArg, withEffect } from \"../../../schemas.ts\";\nimport { payloadFix } from \"../../capabilities/fix.ts\";\nimport { type DraftWhere, draftListWhere, wholeDraftHints } from \"../../draft-where.ts\";\nimport { booleanWordPositionalError } from \"../boolean-word-positional.ts\";\nimport { adCopyHints } from \"../copy-hints.ts\";\nimport { hintLines, withHints } from \"../hints.ts\";\nimport { bareCustomerId, writeJsonEnvelope } from \"../output.ts\";\nimport { termsRefusalFix } from \"../terms-output.ts\";\nimport { copyListCountFix } from \"./copy-list-usage.ts\";\nimport { draftInAccount } from \"./draft-account.ts\";\nimport { renderDraftStatus } from \"./draft-status.ts\";\nimport { recordSingleStage, recordTreeStage } from \"./stage-streak.ts\";\n\n/**\n * Shared plumbing for the staged Google Ads write commands. Writes NEVER hit\n * the Google Ads API directly: every command stages an op against this chat's\n * draft (`/api/ads/google/draft/stage`), the dashboard shows it as a pending\n * Google Ads change, and the draft applies as one `GoogleAdsService.Mutate`\n * request per advertiser account when the chat is published. `--customer-id` is\n * required on every write — a draft may span several accounts, so nothing is\n * picked for you.\n */\n\n/** What a staged Google Ads write command does: one op of these kinds onto this chat's draft. */\nexport function googleStaged(...kinds: GoogleDraftOpKind[]): CommandEffectDeclaration {\n return { effect: \"stage\", routes: [\"POST /api/ads/google/draft/stage\"], stages: kinds };\n}\n\n/** A staged write that takes one op or many: several go as one batch (`stageGoogleOps`). */\nexport function googleStagedBatch(...kinds: GoogleDraftOpKind[]): CommandEffectDeclaration {\n return {\n effect: \"stage\",\n routes: [\"POST /api/ads/google/draft/stage\", \"POST /api/ads/google/draft/stage-batch\"],\n stages: kinds,\n };\n}\n\nexport function failWriteValidation(message: string): never {\n writeJsonEnvelope({ ok: false, error: { code: \"VALIDATION_ERROR\", message } });\n process.exit(1);\n}\n\nexport function requireCustomerId(args: Record<string, unknown>): string {\n const given = (args[\"customer-id\"] ?? args.customerId) as string | undefined;\n const raw = given === undefined ? undefined : bareCustomerId(String(given));\n if (!raw || !/^\\d{10}$/.test(raw)) {\n failWriteValidation(\"pass --customer-id as the 10-digit Google Ads customer id (386-508-3115 or 3865083115)\");\n }\n return raw;\n}\n\nexport function requireTarget(args: Record<string, unknown>, entity: string): string {\n // `--flag false` is refused, not documented: citty parses it as the flag set to TRUE plus a stray\n // positional nobody consumes, so on `conversions update --primary` it silently PROMOTES an action\n // into what every Maximize Conversions campaign bids toward. Caught here because this is the only\n // place on this surface that reads positionals, and every target-taking command goes through it.\n const booleanWord = booleanWordPositionalError(args, entity);\n if (booleanWord) {\n failWriteValidation(booleanWord);\n }\n const positional = Array.isArray(args._) ? args._[0] : undefined;\n const target = args.id ?? args.target ?? args.ref ?? positional;\n if (typeof target !== \"string\" || target.length === 0) {\n failWriteValidation(`pass the ${entity} resource name or id as the positional argument`);\n }\n return target;\n}\n\n/**\n * The targets a bulk status command was given: every positional (comma-separated ones split), plus\n * `--file` with one target per line (blank lines and `#` comments skipped), deduped in order. One\n * call then stages them all as one batch instead of one command per row.\n */\nexport function targetEntries(args: Record<string, unknown>, entity: string): string[] {\n const booleanWord = booleanWordPositionalError(args, entity);\n if (booleanWord) {\n failWriteValidation(booleanWord);\n }\n const positionals = Array.isArray(args._) ? args._.filter((v): v is string => typeof v === \"string\") : [];\n const raw = [...positionals.flatMap((v) => v.split(\",\")), ...rawFileEntries(args.file)]\n .map((v) => v.trim())\n .filter(Boolean);\n const targets = [...new Set(raw)];\n if (targets.length === 0) {\n failWriteValidation(`pass the ${entity} resource name(s) as positional arguments and/or --file (one per line)`);\n }\n if (targets.length > GOOGLE_DRAFT_BATCH_MAX) {\n failWriteValidation(`${targets.length} targets exceeds the batch limit of ${GOOGLE_DRAFT_BATCH_MAX} — split them`);\n }\n return targets;\n}\n\n/**\n * The targets an update command was given: one, or several (space- or comma-separated) that each get\n * the same payload, staged as one batch. `--file` here is the payload, never a list of targets.\n */\nexport function updateTargets(args: Record<string, unknown>, entity: string): string[] {\n return Array.isArray(args._) && args._.length > 0\n ? targetEntries({ ...args, file: undefined }, entity)\n : [requireTarget(args, entity)];\n}\n\nexport function requireStringFlag(value: unknown, flag: string): string {\n if (typeof value !== \"string\" || value.length === 0) {\n failWriteValidation(`${flag} is required`);\n }\n return value;\n}\n\n/** Money flag in major currency units → micros. */\nexport function microsFlag(value: unknown, flag: string): number | undefined {\n if (value === undefined || value === null || value === \"\") {\n return undefined;\n }\n const num = Number(value);\n if (Number.isNaN(num) || num <= 0) {\n failWriteValidation(`${flag} must be a positive amount (major currency units, e.g. 50 or 50.00)`);\n }\n return toMicros(num);\n}\n\n/** Split a comma-separated flag into trimmed non-empty values. */\nexport function listFlag(value: unknown): string[] | undefined {\n if (typeof value !== \"string\" || value.length === 0) {\n return undefined;\n }\n const items = value\n .split(\",\")\n .map((v) => v.trim())\n .filter(Boolean);\n return items.length > 0 ? items : undefined;\n}\n\nexport interface KeywordEntry {\n text: string;\n matchType: string;\n}\n\nconst MATCH_TYPES = new Set([\"EXACT\", \"PHRASE\", \"BROAD\"]);\n\n/**\n * One raw keyword entry → { text, matchType }. A trailing `:EXACT|:PHRASE|:BROAD`\n * suffix overrides the default match type; colons and commas aren't legal in Google\n * keyword text, so the syntax is unambiguous.\n */\nfunction parseKeywordEntry(raw: string, defaultMatch: string | undefined): KeywordEntry {\n const colon = raw.lastIndexOf(\":\");\n if (colon > 0) {\n const suffix = raw\n .slice(colon + 1)\n .trim()\n .toUpperCase();\n if (MATCH_TYPES.has(suffix)) {\n return { text: raw.slice(0, colon).trim(), matchType: suffix };\n }\n failWriteValidation(`\"${raw}\": \":${raw.slice(colon + 1)}\" is not a match type (EXACT | PHRASE | BROAD)`);\n }\n if (!defaultMatch) {\n failWriteValidation(`\"${raw}\" has no match type — add a :EXACT/:PHRASE/:BROAD suffix or pass --match-type`);\n }\n return { text: raw, matchType: defaultMatch };\n}\n\n/**\n * Raw --text value(s) → individual entries: repeated flags and comma-separated\n * both work. The repeats have to come off `rawArgs`, because citty parses a\n * repeated flag down to its last value alone.\n */\nfunction rawTextEntries(value: unknown, rawArgs: readonly string[] | undefined): string[] {\n return repeatedValues(rawArgs, \"text\", value)\n .flatMap((v) => v.split(\",\"))\n .map((v) => v.trim())\n .filter(Boolean);\n}\n\n/** Newline-separated keyword file: one `text[:MATCH_TYPE]` per line; blank lines and `#` comments skipped. */\nfunction rawFileEntries(path: unknown): string[] {\n return typeof path === \"string\" && path.length > 0 ? fileLines(path) : [];\n}\n\n/** A text file's entries: one per line, trimmed; blank lines and `#` comments skipped. */\nexport function fileLines(path: string): string[] {\n return readFileSync(path, \"utf8\")\n .split(/\\r?\\n/)\n .map((line) => line.trim())\n .filter((line) => line.length > 0 && !line.startsWith(\"#\"));\n}\n\n/**\n * The keyword batch a command was invoked with: comma-separated `--text` entries\n * (optional `:MATCH_TYPE` suffix each) plus `--file` lines, deduped, each falling\n * back to `--match-type`. One entry stages exactly like before; many stage as one batch.\n */\nexport function keywordEntries(args: Record<string, unknown>, rawArgs?: readonly string[]): KeywordEntry[] {\n const defaultMatch = typeof args[\"match-type\"] === \"string\" ? args[\"match-type\"].toUpperCase() : undefined;\n const raw = [...rawTextEntries(args.text, rawArgs), ...rawFileEntries(args.file)];\n if (raw.length === 0) {\n failWriteValidation(\"pass keywords via --text (comma-separated) and/or --file (one per line)\");\n }\n if (raw.length > GOOGLE_DRAFT_BATCH_MAX) {\n failWriteValidation(`${raw.length} keywords exceeds the batch limit of ${GOOGLE_DRAFT_BATCH_MAX}`);\n }\n const entries: KeywordEntry[] = [];\n const seen = new Set<string>();\n for (const item of raw) {\n const entry = parseKeywordEntry(item, defaultMatch);\n const key = JSON.stringify([entry.text, entry.matchType]);\n if (!seen.has(key)) {\n seen.add(key);\n entries.push(entry);\n }\n }\n return entries;\n}\n\n/**\n * The payloads behind `--file`: a path to a JSON file, or the JSON written inline. The file holds one\n * payload object, a JSON array of them, or JSON Lines (one object per line) — many payloads stage as\n * one batch, which is how a bulk change lands in one call instead of hundreds.\n *\n * Inline is here because every doc example already writes it that way — `packages/cli/README.md`\n * and the scaffold's `ads-google.md` both show `--file '{\"type\":\"image\",…}'` — while the arg only\n * ever read a path, so following the documentation answered with a raw ENOENT stack trace. Reading\n * a leading `{` or `[` as the payload makes those examples true rather than making the agent re-learn\n * the one shape that works.\n */\nexport function loadJsonPayloads(path: unknown): Array<Record<string, unknown>> {\n if (typeof path !== \"string\" || path.length === 0) {\n return [];\n }\n const inline = /^\\s*[[{]/.test(path);\n const source = inline ? \"inline JSON\" : path;\n const text = inline ? path : readFileSync(path, \"utf8\");\n return parsedPayloads(text, source).map((item, index, all) => {\n if (item === null || typeof item !== \"object\" || Array.isArray(item)) {\n failWriteValidation(\n all.length === 1 ? `${source} must contain a JSON object` : `${source}: item ${index} must be a JSON object`,\n );\n }\n return item as Record<string, unknown>;\n });\n}\n\n/** One JSON value (an array spreads into its items), else JSON Lines; the JSON error when neither parses. */\nfunction parsedPayloads(text: string, source: string): unknown[] {\n try {\n const parsed = JSON.parse(text) as unknown;\n return Array.isArray(parsed) ? parsed : [parsed];\n } catch (err) {\n if (!(err instanceof SyntaxError)) {\n throw err;\n }\n const lines = text.split(/\\r?\\n/).filter((line) => line.trim().length > 0);\n if (lines.length > 1) {\n return lines.map((line, index) => parseJsonLine(line, index, source));\n }\n failWriteValidation(`${source} is not valid JSON: ${err.message}`);\n }\n}\n\n/** One JSON Lines entry, or the line's own error naming where it is. */\nfunction parseJsonLine(line: string, index: number, source: string): unknown {\n try {\n return JSON.parse(line) as unknown;\n } catch (err) {\n return failWriteValidation(\n `${source} line ${index + 1} is not valid JSON: ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n}\n\n/** The ONE op payload behind `--file`, for commands that change a single entity. */\nexport function loadJsonFileArg(path: unknown): Record<string, unknown> {\n const payloads = loadJsonPayloads(path);\n if (payloads.length > 1) {\n failWriteValidation(\n `this command changes one entity, and --file holds ${payloads.length} payloads — stage many changes from one file with \\`baker ads google draft stage --file\\` (one op per item: {\"kind\",\"customerId\",\"target\"?,\"payload\"?})`,\n );\n }\n return payloads[0] ?? {};\n}\n\n/** Flags override file keys — the file is the base, flags are the overrides. */\nexport function mergePayload(file: Record<string, unknown>, flags: Record<string, unknown>): Record<string, unknown> {\n const merged: Record<string, unknown> = { ...file };\n for (const [key, value] of Object.entries(flags)) {\n if (value !== undefined) {\n merged[key] = value;\n }\n }\n return merged;\n}\n\n/**\n * The `draft amend` patch: exactly one of `--file <path>` (JSON file) or `--patch '<json>'`\n * (inline string), and it must parse to a JSON object — RFC-7386 merge-patch needs an object to\n * merge, and a stray array/scalar would silently no-op or replace the whole payload.\n */\nexport function loadPatchArg(args: Record<string, unknown>): Record<string, unknown> {\n const file = typeof args.file === \"string\" && args.file.length > 0 ? args.file : undefined;\n const inline = typeof args.patch === \"string\" && args.patch.length > 0 ? args.patch : undefined;\n if (Boolean(file) === Boolean(inline)) {\n failWriteValidation(\"pass exactly one of --file <patch.json> or --patch '<json>'\");\n }\n if (file) {\n return loadJsonFileArg(file);\n }\n try {\n const parsed = JSON.parse(inline as string) as unknown;\n if (parsed === null || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n failWriteValidation(\"--patch must be a JSON object\");\n }\n return parsed as Record<string, unknown>;\n } catch (err) {\n if (err instanceof SyntaxError) {\n failWriteValidation(`--patch is not valid JSON: ${err.message}`);\n }\n throw err;\n }\n}\n\nexport function handleGoogleError(err: unknown): never {\n if (err instanceof ApiError) {\n // Covers both \"no connection\" and staging's 403 for an account this company\n // never connected — same remedy either way: connect, and pick the account.\n if (isNotConnectedError(err.code, err.message)) {\n handleConnectionError(\"google_ads\", err.message);\n }\n const terms = termsRefusalFix(err.code, err.message);\n if (terms) {\n writeJsonEnvelope({\n ok: false,\n error: { code: terms.code, message: err.message, retryable: false, fix: terms.fix },\n });\n process.exit(1);\n }\n if (err.message.includes(OP_TOO_LARGE_MESSAGE_START)) {\n writeJsonEnvelope({\n ok: false,\n error: {\n code: \"OP_TOO_LARGE\",\n message: err.message,\n retryable: false,\n fix: { action: \"split_the_change\", explanation: OP_TOO_LARGE_FIX },\n },\n });\n process.exit(1);\n }\n writeJsonEnvelope({ ok: false, error: { code: err.code ?? \"API_ERROR\", message: err.message } });\n process.exit(1);\n }\n writeJsonEnvelope({\n ok: false,\n error: { code: \"UNKNOWN\", message: err instanceof Error ? err.message : String(err) },\n });\n process.exit(1);\n}\n\ninterface StageEnvelope extends Record<string, unknown> {\n ok: true;\n data: GoogleDraftStageResponse;\n}\n\n/**\n * A no-op response isn't a failure — the change was already in place, so nothing was\n * staged. Say so explicitly, otherwise the agent re-stages it or reports work it\n * didn't do.\n */\nfunction noopHints(data: GoogleDraftStageResponse): string[] {\n return data.staged\n ? []\n : [`NOT STAGED — ${data.reason}. Nothing to publish for this change; say so rather than reporting it as done.`];\n}\n\n/**\n * What to tell the agent about the ops a batch didn't stage.\n *\n * Two different things land in `skipped`: a change already in place, and a change Google refuses\n * outright (editing an experiment campaign's status, dates or budget). This hint used to assert the\n * first — \"already in the requested state\" — which read as \"done\" for a refusal the user never heard\n * about. So it leads with each op's own reason and asks for the refusals to be passed on.\n */\nexport function skippedHints(skipped: Array<{ summary: string; reason: string }>, total: number): string[] {\n if (skipped.length === 0) {\n return [];\n }\n const detail = skipped.map((s) => `${s.summary} — ${s.reason}`).join(\"; \");\n return [\n `${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.`,\n ];\n}\n\n/**\n * Preflight-validates the op against the shared `@baker/api/ads-google`\n * contract (the same schema the backend enforces), then stages it. Prints the\n * staged envelope — ref, mode (always `live`: publishing reaches the real\n * account), summary, warnings.\n */\nexport async function stageGoogleOp(raw: Record<string, unknown>, hints?: string[]): Promise<void> {\n const preflight = googleDraftOpInputSchema.safeParse(raw);\n if (!preflight.success) {\n const fields = preflight.error.issues.map((issue) => ({ path: issue.path.join(\".\"), message: issue.message }));\n writeJsonEnvelope({\n ok: false,\n error: {\n code: \"VALIDATION_ERROR\",\n message: fields.map((f) => (f.path ? `${f.path}: ${f.message}` : f.message)).join(\"; \"),\n fields,\n fix: copyListCountFix(raw, preflight.error.issues) ?? payloadFix(\"google-ads\", googleDraftOpInputSchema, raw),\n },\n });\n process.exit(1);\n }\n try {\n const chatId = requireChatId();\n const response = await apiPost<StageEnvelope>(\"/api/ads/google/draft/stage\", { chatId, op: preflight.data });\n const allHints = [\n ...noopHints(response.data),\n ...recordSingleStage(chatId, preflight.data.kind),\n ...recordTreeStage(chatId, response.data),\n ...(hints ?? []),\n ...(await adCopyHints(preflight.data)),\n ];\n writeJsonEnvelope(withHints(response, allHints));\n } catch (err) {\n handleGoogleError(err);\n }\n}\n\n/** Stage a create op: `{ kind, customerId, payload }`. */\nexport async function stageCreate(\n kind: string,\n customerId: string,\n payload: Record<string, unknown>,\n hints?: string[],\n): Promise<void> {\n await stageGoogleOp({ kind, customerId, payload }, hints);\n}\n\ninterface StageBatchEnvelope extends Record<string, unknown> {\n ok: true;\n data: GoogleDraftStageBatchResponse;\n}\n\n/**\n * A batch reads every target's before-state and checks each op against the account, which for a few\n * hundred removals outlasts the default 60 s. Timing out early reported a batch as failed that went on\n * to stage, so a retry then collided with the ops it had already staged.\n */\nconst STAGE_BATCH_TIMEOUT_MS = 5 * 60_000;\n\n/** `--full` on every command that stages a batch: the compact result lists only the ops that need a look. */\nexport const STAGE_FULL_ARG = {\n type: \"boolean\",\n description:\n \"List every staged op with its ref and summary (default: counts, the `as` → ref names, and only the ops with warnings)\",\n} as const;\n\n/**\n * What a batch stage prints by default: counts by kind, the ref each `\"as\"` name became (later calls\n * name the ref), and only the ops that carry a warning. A batch of 384 negatives printed one object\n * per op — 85 KB of the agent's own input echoed back with `\"warnings\": []` — so agents cut it with\n * `head`, which also cuts a late op's warning and the hints (BAKER-4005, BAKER-3464).\n */\nfunction stageBatchView(\n data: GoogleDraftStageBatchResponse,\n full: boolean,\n): GoogleDraftStageBatchResponse & { byKind?: Record<string, number>; refs?: Record<string, string> } {\n if (full) {\n return data;\n }\n const { ops, ...rest } = data;\n const byKind: Record<string, number> = {};\n const refs: Record<string, string> = {};\n for (const op of ops) {\n byKind[op.kind] = (byKind[op.kind] ?? 0) + 1;\n if (op.as) refs[op.as] = op.ref;\n }\n return {\n ...rest,\n byKind,\n ...(Object.keys(refs).length > 0 ? { refs } : {}),\n ops: ops.filter((op) => op.warnings.length > 0),\n };\n}\n\n/**\n * Stage several ops as ONE request (`/stage-batch`) — all-or-nothing on the backend,\n * one rate-limit hit instead of one per keyword. A single op falls through to the\n * plain stage path so its envelope (and amend behavior) stays exactly as before.\n * Prints `stageBatchView`: compact unless `full`.\n */\nexport async function stageGoogleOps(\n rawOps: Array<Record<string, unknown>>,\n hints?: string[],\n full = false,\n): Promise<void> {\n if (rawOps.length === 1 && rawOps[0]) {\n await stageGoogleOp(rawOps[0], hints);\n return;\n }\n const ops: unknown[] = [];\n for (const [index, raw] of rawOps.entries()) {\n const preflight = googleDraftBatchOpSchema.safeParse(raw);\n if (!preflight.success) {\n const fields = preflight.error.issues.map((issue) => ({\n path: `ops[${index}].${issue.path.join(\".\")}`,\n message: issue.message,\n }));\n writeJsonEnvelope({\n ok: false,\n error: {\n code: \"VALIDATION_ERROR\",\n message: fields.map((f) => `${f.path}: ${f.message}`).join(\"; \"),\n fields,\n fix: copyListCountFix(raw, preflight.error.issues) ?? payloadFix(\"google-ads\", googleDraftOpInputSchema, raw),\n },\n });\n process.exit(1);\n }\n ops.push(preflight.data);\n }\n try {\n const chatId = requireChatId();\n const response = await apiPost<StageBatchEnvelope>(\n \"/api/ads/google/draft/stage-batch\",\n { chatId, ops },\n { timeoutMs: STAGE_BATCH_TIMEOUT_MS },\n );\n const view = stageBatchView(response.data, full);\n const omitted = response.data.ops.length - view.ops.length;\n const allHints = [\n ...skippedHints(response.data.skipped ?? [], ops.length),\n ...(omitted > 0\n ? [\n `${omitted} staged ops without a warning are left out. They are already staged — do not stage them again; read their refs with \\`baker ads google draft list --json\\` (pass --full on a later stage to print every op).`,\n ]\n : []),\n ...(hints ?? []),\n ...(await adCopyHints(ops)),\n ];\n writeJsonEnvelope(withHints({ ...response, data: view }, allHints));\n } catch (err) {\n handleGoogleError(err);\n }\n}\n\n/** Stage an update op: `{ kind, customerId, target, payload }`. */\nexport async function stageUpdate(\n kind: string,\n customerId: string,\n target: string,\n payload: Record<string, unknown>,\n hints?: string[],\n): Promise<void> {\n await stageGoogleOp({ kind, customerId, target, payload }, hints);\n}\n\n/** Stage a target-only op (pause/resume/remove/detach): `{ kind, customerId, target }`. */\nexport async function stageTarget(kind: string, customerId: string, target: string, hints?: string[]): Promise<void> {\n await stageGoogleOp({ kind, customerId, target }, hints);\n}\n\nexport async function draftAction(path: string, body: Record<string, unknown>, chat?: unknown): Promise<void> {\n try {\n const chatId = resolveChatId(chat);\n const response = await apiPost<Record<string, unknown>>(path, { chatId, ...body });\n writeJsonEnvelope(response);\n } catch (err) {\n handleGoogleError(err);\n }\n}\n\ninterface DraftListEnvelope extends Record<string, unknown> {\n ok: boolean;\n data?: GoogleDraftListResponse;\n}\n\n/**\n * List the staged draft. By default renders a readable campaign ▸ ad group ▸ ad status tree so the\n * agent can review everything it has staged at a glance; `--json` returns the raw envelope for tools,\n * and `--full` that envelope with every op's payload.\n */\nexport async function draftListAction(\n json: boolean,\n chat?: unknown,\n full = false,\n customerId?: string,\n selected?: { where: DraftWhere; selector: string },\n): Promise<void> {\n try {\n const chatId = resolveChatId(chat);\n const listed = await apiPost<DraftListEnvelope>(\"/api/ads/google/draft\", {\n chatId,\n ...(full || selected ? { full: true } : {}),\n });\n const inAccount =\n customerId !== undefined && listed.ok && listed.data ? draftInAccount(listed.data, customerId) : undefined;\n const response = inAccount ? withHints({ ...listed, data: inAccount.data }, inAccount.hints) : listed;\n if (selected && response.ok && response.data) {\n const narrowed = draftListWhere(response.data, selected.where, selected.selector);\n writeJsonEnvelope(withHints({ ...response, data: narrowed.data }, narrowed.hints));\n return;\n }\n if (json || full || !response.ok || !response.data) {\n const whole =\n response.ok && response.data\n ? wholeDraftHints(response.data.ops, \"baker ads google draft list\", \"google.\")\n : [];\n writeJsonEnvelope(withHints(response, whole));\n return;\n }\n process.stdout.write(`${inAccount?.empty ?? renderDraftStatus(response.data)}${hintLines(response)}\\n`);\n } catch (err) {\n handleGoogleError(err);\n }\n}\n\nexport const customerIdArg = {\n \"customer-id\": { type: \"string\" as const, description: \"10-digit Google Ads customer id\" },\n};\n/** The entity a command changes, read by position the way `requireTarget` reads it — declared so --help shows it. */\nexport function targetArg(entity: string) {\n return {\n id: {\n type: \"positional\" as const,\n description: `The ${entity} to change: its id or resource name (customers/…)`,\n required: false,\n },\n };\n}\n\nconst PAYLOAD_FIELDS = \"run `baker schema` on this command for every field the payload takes\";\n\nfunction payloadShape(kind: string): () => PayloadSource {\n return () => ({ union: googleDraftOpInputSchema, kind });\n}\n\n/** `--file` for a command that stages one `kind` op; `baker schema` prints that op's payload shape. */\nexport function fileArg(kind: string) {\n return {\n file: payloadArg(\n {\n type: \"string\" as const,\n description: `The op payload: a JSON file path, or the JSON object inline (flags override it) — ${PAYLOAD_FIELDS}`,\n },\n payloadShape(kind),\n ),\n };\n}\n\n/** `--file` that stages one or many `kind` ops; `baker schema` prints that op's payload shape. */\nexport function fileBatchArg(kind: string) {\n return {\n file: payloadArg(\n {\n type: \"string\" as const,\n description: `The op payload: a JSON file path or inline JSON — one object, or a JSON array / JSON Lines of objects to stage many in one call (up to 500) — ${PAYLOAD_FIELDS}`,\n },\n payloadShape(kind),\n ),\n };\n}\n\n/** A create command whose payload is a JSON file or inline JSON — one object or an array staged as one batch. */\nexport function fileCreateCommand(\n name: string,\n kind: GoogleDraftOpKind,\n description: string,\n hints?: string[] | ((payload: Record<string, unknown>) => string[]),\n) {\n return withEffect(\n googleStagedBatch(kind),\n defineCommand({\n meta: { name, description },\n args: { ...customerIdArg, ...fileBatchArg(kind), full: STAGE_FULL_ARG },\n run: async ({ args }) => {\n const customerId = requireCustomerId(args);\n const payloads = loadJsonPayloads(args.file);\n if (payloads.length === 0 || payloads.some((payload) => Object.keys(payload).length === 0)) {\n failWriteValidation(`${kind} needs --file with the op payload (one object, or a JSON array to stage many)`);\n }\n if (payloads.length > GOOGLE_DRAFT_BATCH_MAX) {\n failWriteValidation(\n `${payloads.length} payloads exceeds the batch limit of ${GOOGLE_DRAFT_BATCH_MAX} — split the file`,\n );\n }\n const payloadHints = [\n ...new Set(payloads.flatMap((payload) => (typeof hints === \"function\" ? hints(payload) : (hints ?? [])))),\n ];\n await stageGoogleOps(\n payloads.map((payload) => ({ kind, customerId, payload })),\n payloadHints,\n args.full === true,\n );\n },\n }),\n );\n}\n\n/**\n * `--bid-modifier` as a number, validated against the range Google actually accepts.\n *\n * Rejecting the (0, 0.1) gap here rather than at the backend is the point: 0 and 0.1 are a hundredth\n * apart in value and mean \"never serve\" versus \"bid a tenth\", so a typo between them is a real spend\n * decision, and the error should arrive before anything is staged.\n */\nexport function bidModifierFlag(value: unknown): number {\n if (value === undefined || value === null || value === \"\") {\n failWriteValidation(\n \"--bid-modifier is required: 1 for no adjustment, 1.25 to bid 25% more, 0.9 to bid 10% less, 0 to stop serving on a device\",\n );\n }\n const num = Number(value);\n if (Number.isNaN(num) || num < 0 || num > 10 || (num > 0 && num < 0.1)) {\n failWriteValidation(\"--bid-modifier must be 0 (stop serving on it) or between 0.1 and 10.0\");\n }\n return num;\n}\n","import type { z } from \"zod\";\n\n/** Appended to each copy flag's help, so `--help` and `baker schema` say how to pass a comma. */\nexport const AD_COPY_LIST_USAGE =\n \"repeat the flag once per item, or pass one comma-separated list and wrap an item that contains a comma in double quotes: '\\\"Fast, free quotes\\\",Book today'. A flag given once is read as a list, so a lone item with a comma needs its double quotes too: '\\\"Fast, free quotes\\\"'\";\n\n/** The op's copy-list fields, by the flag an agent passes them with. */\nconst COPY_LIST_FLAG: Readonly<Record<string, string>> = {\n headlines: \"--headlines\",\n descriptions: \"--descriptions\",\n longHeadlines: \"--long-headlines\",\n};\n\ninterface CountRefusal {\n flag: string;\n count: number | undefined;\n bound: string;\n tooMany: boolean;\n}\n\nfunction valueAt(root: unknown, path: readonly PropertyKey[]): unknown {\n let node = root;\n for (const key of path) {\n if (node === null || typeof node !== \"object\") return undefined;\n node = (node as Record<PropertyKey, unknown>)[key];\n }\n return node;\n}\n\nfunction countRefusal(op: unknown, issue: z.core.$ZodIssue): CountRefusal | undefined {\n if ((issue.code !== \"too_big\" && issue.code !== \"too_small\") || issue.origin !== \"array\") return undefined;\n const flag = COPY_LIST_FLAG[String(issue.path.at(-1))];\n if (!flag) return undefined;\n const value = valueAt(op, issue.path);\n const count = Array.isArray(value) ? value.length : undefined;\n return issue.code === \"too_big\"\n ? { flag, count, bound: `at most ${issue.maximum}`, tooMany: true }\n : { flag, count, bound: `at least ${issue.minimum}`, tooMany: false };\n}\n\n/**\n * The fix for a stage refused only for how many headlines, descriptions or long headlines it has.\n *\n * That is a limit on a field the agent named correctly, so the generic \"read `baker capabilities`,\n * do not guess another field name\" sent it through draft list, schema and --help before it saw the\n * cause. Too many items is usually copy cut at its commas — a flag given once is a comma-separated\n * list, so \"Rated 4,5/5\" becomes two items — which is why that case names the forms that keep a\n * comma. Undefined when anything else was refused too, so the capabilities pointer still covers it.\n */\nexport function copyListCountFix(\n op: unknown,\n issues: readonly z.core.$ZodIssue[],\n): { action: string; explanation: string } | undefined {\n const refusals = issues.map((issue) => countRefusal(op, issue));\n if (refusals.length === 0 || refusals.some((refusal) => refusal === undefined)) return undefined;\n const counted = refusals.filter((refusal): refusal is CountRefusal => refusal !== undefined);\n const limits = counted\n .map(({ flag, count, bound }) => `${flag} has ${count ?? \"the wrong number of\"} items; this ad takes ${bound}.`)\n .join(\" \");\n const commaCause = counted.some((refusal) => refusal.tooMany)\n ? ' If you meant fewer items, the copy was cut at its commas: a flag given once is read as a comma-separated list, so an item with a comma in it (\"Fast, free quotes\", a decimal like \"4,5/5\") becomes two. To keep a comma, ' +\n `${AD_COPY_LIST_USAGE} — or put the content in --file as JSON.`\n : \"\";\n return {\n action: \"fix_copy_list_count\",\n explanation: `${limits}${commaCause} ${commaCause ? \"Otherwise add\" : \"Add\"} or drop items to fit the limit, then stage again; the field names are right.`,\n };\n}\n","import type {\n GoogleDraftListResponse,\n GoogleDraftStatusCollection,\n GoogleDraftStatusNode,\n} from \"@baker/api/ads-google\";\n\n/**\n * Render the staged Google Ads draft as a readable campaign ▸ ad group ▸ ad tree — the CLI\n * counterpart to the dashboard's Google Ads tab, so an agent can review everything it has staged\n * with one command instead of reading raw JSON. Pure: takes the draft-list response, returns text.\n */\n\nconst OPERATION_LABELS: Record<string, string> = {\n create: \"Creating\",\n update: \"Updating\",\n pause: \"Pausing\",\n resume: \"Resuming\",\n remove: \"Removing\",\n upload: \"Uploading\",\n};\n\n/** The same verbs once the publish has run: a published draft reports what happened, not what is staged. */\nconst APPLIED_LABELS: Record<string, string> = {\n create: \"Created\",\n update: \"Updated\",\n pause: \"Paused\",\n resume: \"Resumed\",\n remove: \"Removed\",\n upload: \"Uploaded\",\n};\n\n/** Folded changes that did not land (\"1 change failed\", \"2 changes skipped\"), named beside the node's own outcome. */\nfunction notAppliedText(node: GoogleDraftStatusNode): string | undefined {\n const { failed = 0, skipped = 0 } = node.foldedNotApplied ?? {};\n const changes = (n: number) => `${n} change${n === 1 ? \"\" : \"s\"}`;\n const parts = [\n ...(failed > 0 ? [`${changes(failed)} failed`] : []),\n ...(skipped > 0 ? [`${changes(skipped)} skipped`] : []),\n ];\n return parts.length > 0 ? parts.join(\", \") : undefined;\n}\n\nfunction outcomeBadge(node: GoogleDraftStatusNode, result: NonNullable<GoogleDraftStatusNode[\"result\"]>): string {\n const verb = node.operation ?? \"update\";\n if (result === \"applied\") {\n return node.operation ? (APPLIED_LABELS[verb] ?? \"Applied\") : \"Changes applied\";\n }\n if (result === \"simulated\") {\n return `Simulated (${verb})`;\n }\n if (result === \"failed\") {\n return node.operation ? `Failed to ${verb}` : \"Failed\";\n }\n return \"Skipped\";\n}\n\nfunction badge(node: GoogleDraftStatusNode): string {\n const label = node.result\n ? outcomeBadge(node, node.result)\n : ((node.operation ? OPERATION_LABELS[node.operation] : undefined) ?? (node.existing ? \"on Google Ads\" : \"staged\"));\n const parts = [label, ...(node.status && node.status !== label ? [node.status] : [])];\n const notApplied = notAppliedText(node);\n return [...parts, ...(notApplied ? [notApplied] : [])].join(\" · \");\n}\n\nfunction collectionLine(collection: GoogleDraftStatusCollection): string | undefined {\n const parts: string[] = [];\n if (collection.added > 0) {\n parts.push(`+${collection.added}`);\n }\n if (collection.existing > 0) {\n parts.push(`${collection.existing} existing`);\n }\n if (collection.removed > 0) {\n parts.push(`-${collection.removed}`);\n }\n // Neither an add nor a remove — a member that stays in the set with a changed value (a device's\n // bid adjustment). Left out, a draft whose only criterion change is one printed no line at all.\n if ((collection.updated ?? 0) > 0) {\n parts.push(`~${collection.updated}`);\n }\n return parts.length > 0 ? `${collection.label}: ${parts.join(\", \")}` : undefined;\n}\n\n/**\n * Every advertiser account the tree touches. A draft may legitimately span\n * several, and a criterion id is derived from the keyword's text and match type\n * — so the same keyword carries the same id in every account. The account is\n * printed on each node once there is more than one, and left off when there is not.\n */\nfunction accountsInTree(nodes: readonly GoogleDraftStatusNode[]): Set<string> {\n const accounts = new Set<string>();\n const walk = (node: GoogleDraftStatusNode): void => {\n accounts.add(node.customerId);\n for (const child of node.children) {\n walk(child);\n }\n };\n for (const node of nodes) {\n walk(node);\n }\n return accounts;\n}\n\nfunction renderNode(node: GoogleDraftStatusNode, depth: number, lines: string[], showAccount: boolean): void {\n const indent = \" \".repeat(depth);\n const account = showAccount ? ` · account ${node.customerId}` : \"\";\n const ref = node.ref ? ` · ${node.ref}` : \"\";\n lines.push(`${indent}• ${node.name} · ${badge(node)}${account}${ref}`);\n for (const warning of node.warnings ?? []) {\n lines.push(`${indent} ⚠ ${warning}`);\n }\n for (const folded of node.folded ?? []) {\n lines.push(`${indent} ${folded.summary} · ${folded.ref}`);\n }\n for (const collection of node.collections) {\n const line = collectionLine(collection);\n if (line) {\n lines.push(`${indent} ${line}`);\n }\n }\n for (const child of node.children) {\n renderNode(child, depth + 1, lines, showAccount);\n }\n}\n\nconst RESOURCE_ENTITIES = new Set([\n \"sharedSet\",\n \"biddingStrategy\",\n \"audience\",\n \"conversionAction\",\n \"label\",\n \"budget\",\n \"asset\",\n]);\n\nfunction renderSection(title: string, nodes: GoogleDraftStatusNode[], lines: string[], showAccount: boolean): void {\n if (nodes.length === 0) {\n return;\n }\n lines.push(\"\");\n lines.push(title);\n for (const node of nodes) {\n renderNode(node, 1, lines, showAccount);\n }\n}\n\nfunction renderAdvisories(data: GoogleDraftListResponse, lines: string[]): void {\n const advisories = data.advisories ?? [];\n // Every advisory is phrased as something to settle BEFORE publishing. On a published draft there\n // is nothing left to settle here, and printing them reads as work still outstanding on this chat.\n if (advisories.length === 0 || data.status === \"applied\") {\n return;\n }\n lines.push(\"\");\n // Two kinds of finding share this block: build-out nudges (\"this ad group has one ad\") and\n // whole-draft coherence findings (\"this campaign will report zero conversions\", \"two of your\n // campaigns bid on the same keyword\"). The coherence ones come first and cost money, so the\n // heading no longer frames the block as optional polish.\n lines.push(\"Advisories (non-blocking, checked across the whole draft — settle these before you publish)\");\n for (const advisory of advisories) {\n lines.push(` • ${advisory.message}`);\n }\n}\n\n/**\n * What the publish did, once there is a publish to report.\n *\n * A published Google Ads draft rendered exactly like a staged one — same count, every op still\n * reading \"Creating\" — so the surface `.claude/rules/cli-env.md` sends an agent to for the outcome\n * could not answer, and a failed op was invisible in the human output while sitting in the JSON\n * envelope the whole time. Found by publishing a BUSINESS_LOGO link that Google refused with\n * \"Customer is not verified\": the draft still read \"4 staged changes\". LinkedIn fixed the same\n * shape first; this is its counterpart.\n */\nfunction renderOutcome(data: GoogleDraftListResponse, lines: string[]): void {\n const counts = new Map<string, number>();\n for (const op of data.ops) {\n const status = op.result?.status ?? \"pending\";\n counts.set(status, (counts.get(status) ?? 0) + 1);\n }\n const summary = [...counts].map(([status, count]) => `${count} ${status}`).join(\", \");\n lines.push(`Google Ads — published · ${summary || `${data.count} op(s)`} · ${data.mode}`);\n // A failure is the reason to read this at all, so it is named with its error rather than left as\n // a number to go and look up.\n for (const op of data.ops) {\n const status = op.result?.status;\n if (status !== \"failed\" && status !== \"skipped\") {\n continue;\n }\n const reason = op.result?.error ?? op.result?.skippedBecause ?? \"no reason recorded\";\n lines.push(` ✗ ${op.summary} — ${status}: ${reason}`);\n }\n // Google answers \"applied\" to a field it accepted and never stored (a portfolio's bid ceiling),\n // so the read-back after publish is the only thing that knows the change did not land as sent.\n for (const op of data.ops) {\n const verification = op.result?.verification;\n if (op.result?.status === \"applied\" && verification?.status === \"drifted\") {\n lines.push(` ⚠ ${op.summary} — not as sent: ${verification.note ?? \"Google Ads shows something else\"}`);\n }\n }\n}\n\nexport function renderDraftStatus(data: GoogleDraftListResponse): string {\n if (data.status === \"none\" || data.count === 0) {\n return \"No staged Google Ads changes on this chat.\";\n }\n const modeNote =\n data.mode === \"live\"\n ? \"Live — publishing writes directly to Google Ads.\"\n : \"Simulated — publishing completes the whole draft without calling Google Ads.\";\n const lines: string[] = [];\n if (data.status === \"applied\") {\n renderOutcome(data, lines);\n } else if (data.status === \"publishing\") {\n lines.push(`Google Ads — publishing ${data.count} change${data.count === 1 ? \"\" : \"s\"} · ${data.mode}`);\n } else {\n lines.push(`Google Ads — ${data.count} staged change${data.count === 1 ? \"\" : \"s\"} · ${data.mode}`);\n }\n lines.push(modeNote);\n\n const tree = data.tree ?? [];\n const showAccount = accountsInTree(tree).size > 1;\n renderSection(\n \"Shared resources\",\n tree.filter((node) => RESOURCE_ENTITIES.has(node.entity)),\n lines,\n showAccount,\n );\n renderSection(\n \"Campaigns\",\n tree.filter((node) => node.entity === \"campaign\"),\n lines,\n showAccount,\n );\n const rest = tree.filter((node) => !RESOURCE_ENTITIES.has(node.entity) && node.entity !== \"campaign\");\n renderSection(\"Other\", rest, lines, showAccount);\n renderAdvisories(data, lines);\n\n return lines.join(\"\\n\");\n}\n","import { type GoogleDraftStageResponse, isCreateKind } from \"@baker/api/ads-google\";\nimport { cacheGet, cacheSet } from \"../cache.ts\";\nimport { loopWarnings } from \"../output.ts\";\n\n/**\n * Bulk work done as a loop of single commands — one `keywords update` per keyword, one\n * `negative-keywords remove` per term — is one request, one rate-limit hit and one tool call per row;\n * production saw 1,284 of them. The CLI cannot see the loop from inside one call, so it remembers the\n * last few single stages per chat and, once the same kind repeats, says how to do the rest in one call.\n */\n\nexport interface StageStreak {\n kind: string;\n count: number;\n lastAt: number;\n}\n\n/** Singles further apart than this are separate decisions, not a loop. */\nconst STREAK_WINDOW_MS = 5 * 60_000;\n/** The streak length that reads as a loop. */\nconst STREAK_THRESHOLD = 5;\n\nexport function nextStageStreak(previous: StageStreak | undefined, kind: string, now: number): StageStreak {\n const continues = previous && previous.kind === kind && now - previous.lastAt <= STREAK_WINDOW_MS;\n return { kind, count: continues ? previous.count + 1 : 1, lastAt: now };\n}\n\n/** The one-call form of a kind, where a command has one beside `draft stage --file`. */\nconst BATCH_FORMS: Record<string, string> = {\n \"google.keyword.add\": \"`keywords add --file keywords.txt` (one term[:MATCH_TYPE] per line)\",\n \"google.keyword.update\":\n \"`keywords pause|resume <resource name> <resource name>…` (or --file, one per line) for status\",\n \"google.keyword.remove\": \"`draft stage --file` with one google.keyword.remove per target\",\n \"google.negativeKeyword.add\":\n \"`negative-keywords add --ad-group-id <id>,<id> --file terms.txt` (every term on every ad group)\",\n \"google.sharedSetMember.add\": \"`keyword-lists add --file terms.txt`\",\n \"google.sharedSetMember.remove\": '`keyword-lists remove --list-ref <id> --text \"a,b,c\"`',\n};\n\nexport function stageStreakHints(streak: StageStreak): string[] {\n if (streak.count < STREAK_THRESHOLD) {\n return [];\n }\n const form = BATCH_FORMS[streak.kind];\n return [\n `LOOP: that is ${streak.count} ${streak.kind} ops staged one command at a time. Stop looping — put every remaining change in one file and stage them in ONE call: \\`baker ads google draft stage --file ops.json --customer-id <id>\\` (a JSON array of {\"kind\",\"target\"?,\"payload\"?}, up to 500, any mix of kinds)${form ? `, or ${form}` : \"\"}. Fix staged ops together with \\`draft amend --file\\`.`,\n ];\n}\n\nconst STREAK_CACHE = \"stage-streak\";\n\n/** Record one single stage on this chat and return the nudge it earns, if any. Never throws. */\nexport function recordSingleStage(chatId: string, kind: string): string[] {\n try {\n const streak = nextStageStreak(cacheGet<StageStreak>(STREAK_CACHE, chatId)?.data, kind, Date.now());\n cacheSet(STREAK_CACHE, chatId, streak, STREAK_WINDOW_MS);\n const hints = stageStreakHints(streak);\n // Also on stderr: agents pipe each stage through a filter that keeps only `ok`, which drops the\n // hint from the JSON — 26 times in one Session. stderr reaches the agent past any such filter.\n for (const hint of hints) process.stderr.write(`${hint}\\n`);\n return hints;\n } catch {\n return [];\n }\n}\n\nconst TREE_CACHE = \"stage-tree\";\n\n/**\n * A single create (not an update merged into a staged one) that depends on a create staged earlier in this chat is a new campaign tree being\n * built one level at a time. Each level changes kind, so the LOOP streak never fires; this says once\n * per chat (per window) how to stage the rest in one call. Never throws.\n */\nexport function recordTreeStage(chatId: string, staged: GoogleDraftStageResponse): string[] {\n try {\n if (!staged.staged || staged.amended || !isCreateKind(staged.kind) || staged.dependsOn.length === 0) {\n return [];\n }\n if (cacheGet<boolean>(TREE_CACHE, chatId)?.data) {\n return [];\n }\n cacheSet(TREE_CACHE, chatId, true, STREAK_WINDOW_MS);\n return loopWarnings([\n `TREE: this ${staged.kind} hangs off a create staged earlier in this chat — a new campaign tree built one command per entity. Stage everything still to build (ad groups, keywords, ads, assets and their links) in ONE call: \\`baker ads google draft stage --file ops.json --customer-id <id>\\`, giving each create a name with \"as\": \"g_temp_<name>\" so later ops in the same file can point at it (refs staged earlier still work).`,\n ]);\n } catch {\n return [];\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,SAAS,QAAQ,GAAW,QAAyB;AACnD,QAAM,OAAO,SAAS,kBAAkB;AACxC,SAAO,MAAM,IAAI,KAAK,IAAI,KAAK,GAAG,CAAC,IAAI,IAAI;AAC7C;AAOO,SAAS,eACd,MACA,YACoE;AACpE,QAAM,MAAM,KAAK,IAAI,OAAO,CAAC,OAAO,GAAG,eAAe,UAAU;AAChE,QAAM,WAAW;AAAA,IACf,GAAG;AAAA,IACH,OAAO,IAAI;AAAA,IACX;AAAA,IACA,GAAI,KAAK,OAAO,EAAE,MAAM,KAAK,KAAK,OAAO,CAAC,SAAS,KAAK,eAAe,UAAU,EAAE,IAAI,CAAC;AAAA,EAC1F;AACA,QAAM,SAAS,KAAK,IAAI,OAAO,CAAC,OAAO,GAAG,eAAe,UAAU;AACnE,MAAI,OAAO,WAAW,EAAG,QAAO,EAAE,MAAM,UAAU,OAAO,CAAC,EAAE;AAC5D,QAAM,SAAS,KAAK,WAAW;AAC/B,QAAM,WAAW,CAAC,GAAG,IAAI,IAAI,OAAO,IAAI,CAAC,OAAO,GAAG,UAAU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AAA,MAC1B,MAAM,EAAE,GAAG,eAAe,GAAG,aAAa,IAAI,GAAG,MAAM,eAAe;AAAA,MACtE,KAAK,OAAO,EAAE,KAAK,MAAM;AACvB,cAAM,aAAa,kBAAkB,IAAI;AACzC,cAAM,WAAW,iBAAiB,KAAK,IAAI;AAC3C,YAAI,SAAS,WAAW,KAAK,SAAS,KAAK,CAAC,YAAY,OAAO,KAAK,OAAO,EAAE,WAAW,CAAC,GAAG;AAC1F,8BAAoB,GAAG,IAAI,+EAA+E;AAAA,QAC5G;AACA,YAAI,SAAS,SAAS,wBAAwB;AAC5C;AAAA,YACE,GAAG,SAAS,MAAM,wCAAwC,sBAAsB;AAAA,UAClF;AAAA,QACF;AACA,cAAM,eAAe;AAAA,UACnB,GAAG,IAAI,IAAI,SAAS,QAAQ,CAAC,YAAa,OAAO,UAAU,aAAa,MAAM,OAAO,IAAK,SAAS,CAAC,CAAG,CAAC;AAAA,QAC1G;AACA,cAAM;AAAA,UACJ,SAAS,IAAI,CAAC,aAAa,EAAE,MAAM,YAAY,QAAQ,EAAE;AAAA,UACzD;AAAA,UACA,KAAK,SAAS;AAAA,QAChB;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;AASO,SAAS,gBAAgB,OAAwB;AACtD,MAAI,UAAU,UAAa,UAAU,QAAQ,UAAU,IAAI;AACzD;AAAA,MACE;AAAA,IACF;AAAA,EACF;AACA,QAAM,MAAM,OAAO,KAAK;AACxB,MAAI,OAAO,MAAM,GAAG,KAAK,MAAM,KAAK,MAAM,MAAO,MAAM,KAAK,MAAM,KAAM;AACtE,wBAAoB,uEAAuE;AAAA,EAC7F;AACA,SAAO;AACT;","names":["changes"]}
|
|
@@ -8,23 +8,32 @@ import { tmpdir } from "os";
|
|
|
8
8
|
import { join } from "path";
|
|
9
9
|
var AD_PREVIEW_DIR = join(tmpdir(), "baker-ad-previews");
|
|
10
10
|
var AD_PREVIEW_DIR_LABEL = "your system temp folder, under baker-ad-previews";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
var DRAW_CONCURRENCY = 4;
|
|
12
|
+
async function renderAdPreviews(inputs, dir, draw = drawPreviewInChromium) {
|
|
13
|
+
mkdirSync(dir, { recursive: true });
|
|
14
14
|
const taken = /* @__PURE__ */ new Map();
|
|
15
|
-
|
|
15
|
+
const jobs = inputs.map((input) => {
|
|
16
16
|
const where = input.surface ? { placement: input.placement, surface: input.surface } : { placement: input.placement };
|
|
17
|
-
const base = [
|
|
17
|
+
const base = [input.name, input.placement, input.surface?.toLowerCase()].filter(Boolean).join("-");
|
|
18
18
|
const seen = (taken.get(base) ?? 0) + 1;
|
|
19
19
|
taken.set(base, seen);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
return { where, html: input.html, file: join(dir, `${seen > 1 ? `${base}-${seen}` : base}.png`) };
|
|
21
|
+
});
|
|
22
|
+
const previews = new Array(jobs.length);
|
|
23
|
+
let next = 0;
|
|
24
|
+
const worker = async () => {
|
|
25
|
+
while (next < jobs.length) {
|
|
26
|
+
const index = next++;
|
|
27
|
+
const { where, html, file } = jobs[index];
|
|
28
|
+
try {
|
|
29
|
+
const { text } = await draw(html, file);
|
|
30
|
+
previews[index] = { ...where, shownText: shownLines(text), image: file };
|
|
31
|
+
} catch (err) {
|
|
32
|
+
previews[index] = { ...where, error: err instanceof Error ? err.message : String(err) };
|
|
33
|
+
}
|
|
26
34
|
}
|
|
27
|
-
}
|
|
35
|
+
};
|
|
36
|
+
await Promise.all(Array.from({ length: Math.min(DRAW_CONCURRENCY, jobs.length) }, worker));
|
|
28
37
|
return { previews, hints: previewHints(previews) };
|
|
29
38
|
}
|
|
30
39
|
function shownLines(text) {
|
|
@@ -82,4 +91,4 @@ export {
|
|
|
82
91
|
AD_PREVIEW_DIR_LABEL,
|
|
83
92
|
renderAdPreviews
|
|
84
93
|
};
|
|
85
|
-
//# sourceMappingURL=chunk-
|
|
94
|
+
//# sourceMappingURL=chunk-XFTN3ARP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/ads/ad-preview-images.ts"],"sourcesContent":["import { mkdirSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { launchBrowser } from \"../../engine/landing-library/browser.ts\";\n\n/**\n * Opens a platform's preview iframe and returns what it displays: the text\n * people read (`shownText`) and a picture for questions text cannot answer.\n *\n * The API's fields say what is stored, not what shows. A Session paused seven\n * live ads because a stored headline read like an internal code, with no way to\n * check whether the feed showed it. The rendered text settles that; the picture\n * covers what is not text — words drawn into the artwork, cropping, layout.\n */\n\nexport interface AdPreviewInput {\n placement: string;\n /** Where the platform shows it (LinkedIn FEED, …) when one placement renders on several surfaces. */\n surface?: string;\n html: string;\n /** The picture's file-name prefix: the ad it shows (`meta-6123`, `linkedin-5`). */\n name: string;\n}\n\ntype AdPreviewWhere = { placement: string; surface?: string };\nexport type AdPreviewResult =\n | (AdPreviewWhere & { shownText: string[]; image: string })\n | (AdPreviewWhere & { error: string });\n\n/** Render `html` (a platform iframe): save a PNG at `file`, return the text it displays. */\nexport type DrawPreview = (html: string, file: string) => Promise<{ text: string }>;\n\nexport const AD_PREVIEW_DIR = join(tmpdir(), \"baker-ad-previews\");\n\n/**\n * The same folder as a sentence, for an arg description.\n *\n * `AD_PREVIEW_DIR` itself must never reach one: it is `tmpdir()` RESOLVED, which is\n * `/tmp/baker-ad-previews` on Linux and `/var/folders/<random>/T/baker-ad-previews` on a Mac — so\n * `catalog:export` wrote whichever machine ran it into `cli-catalog/families/ads-meta.json`, and\n * `catalog.test.ts` then failed for everyone else. The catalog is committed, so a description in it\n * has to be the same on every machine.\n */\nexport const AD_PREVIEW_DIR_LABEL = \"your system temp folder, under baker-ad-previews\";\n\n/** Pictures drawn at once. Each opens its own Chromium, so a long list must not open one per preview. */\nconst DRAW_CONCURRENCY = 4;\n\nexport async function renderAdPreviews(\n inputs: readonly AdPreviewInput[],\n dir: string,\n draw: DrawPreview = drawPreviewInChromium,\n): Promise<{ previews: AdPreviewResult[]; hints: string[] }> {\n mkdirSync(dir, { recursive: true });\n const taken = new Map<string, number>();\n const jobs = inputs.map((input) => {\n const where: AdPreviewWhere = input.surface\n ? { placement: input.placement, surface: input.surface }\n : { placement: input.placement };\n // One file per rendering: a shared name would leave two results pointing at the last picture drawn.\n const base = [input.name, input.placement, input.surface?.toLowerCase()].filter(Boolean).join(\"-\");\n const seen = (taken.get(base) ?? 0) + 1;\n taken.set(base, seen);\n return { where, html: input.html, file: join(dir, `${seen > 1 ? `${base}-${seen}` : base}.png`) };\n });\n const previews: AdPreviewResult[] = new Array(jobs.length);\n let next = 0;\n const worker = async (): Promise<void> => {\n while (next < jobs.length) {\n const index = next++;\n const { where, html, file } = jobs[index] as (typeof jobs)[number];\n try {\n const { text } = await draw(html, file);\n previews[index] = { ...where, shownText: shownLines(text), image: file };\n } catch (err) {\n previews[index] = { ...where, error: err instanceof Error ? err.message : String(err) };\n }\n }\n };\n await Promise.all(Array.from({ length: Math.min(DRAW_CONCURRENCY, jobs.length) }, worker));\n return { previews, hints: previewHints(previews) };\n}\n\nfunction shownLines(text: string): string[] {\n return text\n .split(\"\\n\")\n .map((line) => line.replace(/\\s+/g, \" \").trim())\n .filter(Boolean);\n}\n\nfunction previewHints(previews: readonly AdPreviewResult[]): string[] {\n const hints: string[] = [];\n if (previews.some((p) => \"image\" in p)) {\n hints.push(\n \"shownText is what people see on the ad, in order — rendered by the platform itself, so it settles which text is displayed (headline under the image, button, cut-off intro). The API fields only say what is stored. Words drawn into the artwork are not in shownText: Read the image for those, and for cropping or how the ad looks.\",\n );\n }\n if (previews.some((p) => \"error\" in p)) {\n hints.push(\n \"Some previews could not be drawn. Do not describe how those look — say they could not be checked, and carry on with the rest.\",\n );\n }\n return hints;\n}\n\n/**\n * The platforms' iframes have a fixed window (Meta's 335×450) and scroll the rest,\n * which cuts the headline and button off a picture. The frame is grown to its\n * content's height first, so the picture holds the whole ad.\n */\nexport async function drawPreviewInChromium(html: string, file: string): Promise<{ text: string }> {\n const browser = await launchBrowser();\n try {\n const context = await browser.newContext({ viewport: { width: 900, height: 1200 }, deviceScaleFactor: 2 });\n const page = await context.newPage();\n await page.setContent(`<!doctype html><body style=\"margin:0;background:#fff\">${html}</body>`, {\n waitUntil: \"load\",\n timeout: 30_000,\n });\n await page.waitForLoadState(\"networkidle\", { timeout: 15_000 }).catch(() => undefined);\n const iframe = await page.$(\"iframe\");\n if (!iframe) throw new Error(\"the platform returned no preview frame\");\n const frame = await iframe.contentFrame();\n if (frame) {\n const height = await frame.evaluate(() =>\n Math.max(document.documentElement.scrollHeight, document.body?.scrollHeight ?? 0),\n );\n if (height > 0) {\n await iframe.evaluate((node, h) => {\n node.removeAttribute(\"height\");\n (node as HTMLElement).style.height = `${h}px`;\n }, height);\n await frame.waitForLoadState(\"networkidle\", { timeout: 10_000 }).catch(() => undefined);\n }\n }\n await iframe.screenshot({ path: file });\n // innerText follows the layout: hidden elements drop out, line breaks stay.\n const text = frame ? await frame.evaluate(() => document.body?.innerText ?? \"\") : \"\";\n return { text };\n } finally {\n await browser.close();\n }\n}\n"],"mappings":";;;;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AACvB,SAAS,YAAY;AA8Bd,IAAM,iBAAiB,KAAK,OAAO,GAAG,mBAAmB;AAWzD,IAAM,uBAAuB;AAGpC,IAAM,mBAAmB;AAEzB,eAAsB,iBACpB,QACA,KACA,OAAoB,uBACuC;AAC3D,YAAU,KAAK,EAAE,WAAW,KAAK,CAAC;AAClC,QAAM,QAAQ,oBAAI,IAAoB;AACtC,QAAM,OAAO,OAAO,IAAI,CAAC,UAAU;AACjC,UAAM,QAAwB,MAAM,UAChC,EAAE,WAAW,MAAM,WAAW,SAAS,MAAM,QAAQ,IACrD,EAAE,WAAW,MAAM,UAAU;AAEjC,UAAM,OAAO,CAAC,MAAM,MAAM,MAAM,WAAW,MAAM,SA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ACtB;AACF;","names":[]}
|
package/dist/cli.js
CHANGED
|
@@ -625,7 +625,7 @@ Introspection: Run 'baker schema <command>' to inspect argument schemas.`
|
|
|
625
625
|
capabilities: () => import("./capabilities-FJAYWDY6.js").then((m) => m.capabilitiesCommand),
|
|
626
626
|
actions: () => import("./actions-PO35WQVS.js").then((m) => m.actionsCommand),
|
|
627
627
|
"scheduled-agents": () => import("./scheduled-agents-4UNG26CX.js").then((m) => m.scheduledAgentsCommand),
|
|
628
|
-
ads: () => import("./ads-
|
|
628
|
+
ads: () => import("./ads-VSU53JN3.js").then((m) => m.adsCommand),
|
|
629
629
|
brand: () => import("./brand-ARJMSWJA.js").then((m) => m.brandCommand),
|
|
630
630
|
analytics: () => import("./analytics-EM4NNEG5.js").then((m) => m.analyticsCommand),
|
|
631
631
|
experiment: () => import("./experiment-KOCG7PPI.js").then((m) => m.experimentCommand),
|
package/dist/{conversion-upload-command-HJOVSWZD.js → conversion-upload-command-Y4ABNNAT.js}
RENAMED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
googleStagedBatch,
|
|
5
5
|
requireCustomerId,
|
|
6
6
|
stageGoogleOps
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LZ5DS4UB.js";
|
|
8
8
|
import "./chunk-RHN5FEWA.js";
|
|
9
9
|
import "./chunk-XD7C5OE7.js";
|
|
10
10
|
import "./chunk-UKENQSZ2.js";
|
|
@@ -453,4 +453,4 @@ var conversionsUploadCommand = withEffect(
|
|
|
453
453
|
export {
|
|
454
454
|
conversionsUploadCommand
|
|
455
455
|
};
|
|
456
|
-
//# sourceMappingURL=conversion-upload-command-
|
|
456
|
+
//# sourceMappingURL=conversion-upload-command-Y4ABNNAT.js.map
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
showAccountHint,
|
|
20
20
|
stageGoogleOps,
|
|
21
21
|
validateAccountHint
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-LZ5DS4UB.js";
|
|
23
23
|
import {
|
|
24
24
|
LIST_WHERE_ARG,
|
|
25
25
|
WHERE_DESCRIPTION,
|
|
@@ -637,4 +637,4 @@ export {
|
|
|
637
637
|
draftCommand,
|
|
638
638
|
importHints
|
|
639
639
|
};
|
|
640
|
-
//# sourceMappingURL=draft-
|
|
640
|
+
//# sourceMappingURL=draft-CLNMIQXV.js.map
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
keywordEntries,
|
|
13
13
|
microsFlag,
|
|
14
14
|
requireCustomerId
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-LZ5DS4UB.js";
|
|
16
16
|
import "./chunk-RHN5FEWA.js";
|
|
17
17
|
import "./chunk-XD7C5OE7.js";
|
|
18
18
|
import "./chunk-UKENQSZ2.js";
|
|
@@ -186,4 +186,4 @@ export {
|
|
|
186
186
|
forecastBidding,
|
|
187
187
|
forecastCommand
|
|
188
188
|
};
|
|
189
|
-
//# sourceMappingURL=forecast-
|
|
189
|
+
//# sourceMappingURL=forecast-JAPRYH4F.js.map
|