@koda-sl/baker-cli 0.868.0-dev.dd070597a → 0.868.0-dev.ebaaca9d0

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.
Files changed (78) hide show
  1. package/README.md +3 -0
  2. package/dist/{account-assets-L6BX4YUQ.js → account-assets-4EFV6A2D.js} +6 -6
  3. package/dist/{account-level-OX34JQ7C.js → account-level-7UOXIAB7.js} +3 -3
  4. package/dist/{account-reads-3LP4F3L4.js → account-reads-SUWXGTGW.js} +2 -2
  5. package/dist/{ads-O76TVWHX.js → ads-B4HSLQMP.js} +3 -3
  6. package/dist/{ads-ZR5D7BZT.js → ads-FQKWQBVZ.js} +10 -10
  7. package/dist/{adsets-3NIYL2GQ.js → adsets-BG3KZ53Y.js} +9 -9
  8. package/dist/{asset-writes-5ZKZDPQ4.js → asset-writes-55AP6IJM.js} +3 -3
  9. package/dist/{audience-writes-NL6NRLLY.js → audience-writes-USX37PPI.js} +2 -2
  10. package/dist/{audiences-DL267GNQ.js → audiences-G4GJZUIT.js} +6 -6
  11. package/dist/{campaigns-RXDC5FSQ.js → campaigns-DNA7TN2T.js} +9 -9
  12. package/dist/{catalogs-QAZ7ZZ5R.js → catalogs-7AG7YVMI.js} +2 -2
  13. package/dist/{chunk-OMJ7DVFJ.js → chunk-ATVUGOXL.js} +5 -4
  14. package/dist/{chunk-OMJ7DVFJ.js.map → chunk-ATVUGOXL.js.map} +1 -1
  15. package/dist/{chunk-UE5ZFTDL.js → chunk-J43KP5NE.js} +2 -2
  16. package/dist/{chunk-N366L5EF.js → chunk-LZ5DS4UB.js} +4 -32
  17. package/dist/chunk-LZ5DS4UB.js.map +1 -0
  18. package/dist/{chunk-EGM42UKF.js → chunk-SXKBGTX2.js} +2 -2
  19. package/dist/cli.js +1 -1
  20. package/dist/{conversion-upload-command-HJOVSWZD.js → conversion-upload-command-Y4ABNNAT.js} +2 -2
  21. package/dist/{copy-writes-QYN6PBU2.js → copy-writes-NJSSVTGB.js} +3 -3
  22. package/dist/{creatives-CPLH3KHQ.js → creatives-4AD65R3V.js} +4 -4
  23. package/dist/{custom-conversions-CTJVAZKC.js → custom-conversions-BDXRIYJW.js} +4 -4
  24. package/dist/{draft-OLSFLDME.js → draft-CLNMIQXV.js} +2 -2
  25. package/dist/{draft-UU3F2VMJ.js → draft-ZUM2WKWP.js} +203 -8
  26. package/dist/draft-ZUM2WKWP.js.map +1 -0
  27. package/dist/{forecast-AQDB4LLG.js → forecast-JAPRYH4F.js} +2 -2
  28. package/dist/{google-HLE7YIYM.js → google-HHKFDH7I.js} +40 -57
  29. package/dist/google-HHKFDH7I.js.map +1 -0
  30. package/dist/{instant-experiences-EJWYFWDT.js → instant-experiences-JBN26DUT.js} +2 -2
  31. package/dist/{leads-FEEWX7OO.js → leads-YWURF6YR.js} +2 -2
  32. package/dist/{media-PUOLJUN3.js → media-BITGRDCO.js} +3 -3
  33. package/dist/{meta-SPPSYRMC.js → meta-MY2CIGLA.js} +30 -30
  34. package/dist/{page-photos-ZBMJLL5V.js → page-photos-ZP7APYIE.js} +2 -2
  35. package/dist/{rule-writes-6XP7G35U.js → rule-writes-GE5URXYA.js} +2 -2
  36. package/dist/{rules-BRULCGRV.js → rules-6O5ALFJD.js} +7 -7
  37. package/dist/{search-terms-WKEPRHN2.js → search-terms-WLOW2FPP.js} +2 -2
  38. package/dist/{studies-357M2C2K.js → studies-LZ4RWESW.js} +5 -5
  39. package/dist/{study-writes-HXUQRPIK.js → study-writes-3WXJDSDU.js} +2 -2
  40. package/dist/{targeting-7T7XHBIX.js → targeting-DEM7YHWM.js} +2 -2
  41. package/dist/{themes-2T5BOIZU.js → themes-Q5CSF6TJ.js} +2 -2
  42. package/dist/{write-commands-4KI6T2NF.js → write-commands-EQU4U746.js} +4 -4
  43. package/package.json +1 -1
  44. package/dist/chunk-N366L5EF.js.map +0 -1
  45. package/dist/draft-UU3F2VMJ.js.map +0 -1
  46. package/dist/google-HLE7YIYM.js.map +0 -1
  47. /package/dist/{account-assets-L6BX4YUQ.js.map → account-assets-4EFV6A2D.js.map} +0 -0
  48. /package/dist/{account-level-OX34JQ7C.js.map → account-level-7UOXIAB7.js.map} +0 -0
  49. /package/dist/{account-reads-3LP4F3L4.js.map → account-reads-SUWXGTGW.js.map} +0 -0
  50. /package/dist/{ads-O76TVWHX.js.map → ads-B4HSLQMP.js.map} +0 -0
  51. /package/dist/{ads-ZR5D7BZT.js.map → ads-FQKWQBVZ.js.map} +0 -0
  52. /package/dist/{adsets-3NIYL2GQ.js.map → adsets-BG3KZ53Y.js.map} +0 -0
  53. /package/dist/{asset-writes-5ZKZDPQ4.js.map → asset-writes-55AP6IJM.js.map} +0 -0
  54. /package/dist/{audience-writes-NL6NRLLY.js.map → audience-writes-USX37PPI.js.map} +0 -0
  55. /package/dist/{audiences-DL267GNQ.js.map → audiences-G4GJZUIT.js.map} +0 -0
  56. /package/dist/{campaigns-RXDC5FSQ.js.map → campaigns-DNA7TN2T.js.map} +0 -0
  57. /package/dist/{catalogs-QAZ7ZZ5R.js.map → catalogs-7AG7YVMI.js.map} +0 -0
  58. /package/dist/{chunk-UE5ZFTDL.js.map → chunk-J43KP5NE.js.map} +0 -0
  59. /package/dist/{chunk-EGM42UKF.js.map → chunk-SXKBGTX2.js.map} +0 -0
  60. /package/dist/{conversion-upload-command-HJOVSWZD.js.map → conversion-upload-command-Y4ABNNAT.js.map} +0 -0
  61. /package/dist/{copy-writes-QYN6PBU2.js.map → copy-writes-NJSSVTGB.js.map} +0 -0
  62. /package/dist/{creatives-CPLH3KHQ.js.map → creatives-4AD65R3V.js.map} +0 -0
  63. /package/dist/{custom-conversions-CTJVAZKC.js.map → custom-conversions-BDXRIYJW.js.map} +0 -0
  64. /package/dist/{draft-OLSFLDME.js.map → draft-CLNMIQXV.js.map} +0 -0
  65. /package/dist/{forecast-AQDB4LLG.js.map → forecast-JAPRYH4F.js.map} +0 -0
  66. /package/dist/{instant-experiences-EJWYFWDT.js.map → instant-experiences-JBN26DUT.js.map} +0 -0
  67. /package/dist/{leads-FEEWX7OO.js.map → leads-YWURF6YR.js.map} +0 -0
  68. /package/dist/{media-PUOLJUN3.js.map → media-BITGRDCO.js.map} +0 -0
  69. /package/dist/{meta-SPPSYRMC.js.map → meta-MY2CIGLA.js.map} +0 -0
  70. /package/dist/{page-photos-ZBMJLL5V.js.map → page-photos-ZP7APYIE.js.map} +0 -0
  71. /package/dist/{rule-writes-6XP7G35U.js.map → rule-writes-GE5URXYA.js.map} +0 -0
  72. /package/dist/{rules-BRULCGRV.js.map → rules-6O5ALFJD.js.map} +0 -0
  73. /package/dist/{search-terms-WKEPRHN2.js.map → search-terms-WLOW2FPP.js.map} +0 -0
  74. /package/dist/{studies-357M2C2K.js.map → studies-LZ4RWESW.js.map} +0 -0
  75. /package/dist/{study-writes-HXUQRPIK.js.map → study-writes-3WXJDSDU.js.map} +0 -0
  76. /package/dist/{targeting-7T7XHBIX.js.map → targeting-DEM7YHWM.js.map} +0 -0
  77. /package/dist/{themes-2T5BOIZU.js.map → themes-Q5CSF6TJ.js.map} +0 -0
  78. /package/dist/{write-commands-4KI6T2NF.js.map → write-commands-EQU4U746.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/ads/meta/draft.ts","../src/commands/ads/meta/draft-stage.ts","../src/commands/ads/meta/draft-status.ts"],"sourcesContent":["import type {\n MetaDraftClearResponse,\n MetaDraftListResponse,\n MetaDraftRemoveResponse,\n MetaDraftShowResponse,\n} from \"@baker/api/ads-meta\";\nimport { defineCommand } from \"citty\";\nimport { apiPost } from \"../../../client.ts\";\nimport { requireChatId, resolveChatId } from \"../../../env.ts\";\nimport { registerSchema, withEffect } from \"../../../schemas.ts\";\nimport { CHAT_READ_ARG, DRAFT_FULL_ARG } from \"../../chat-arg.ts\";\nimport { draftRefs, removeDraftRefs } from \"../../draft-refs.ts\";\nimport { draftListWhere, LIST_WHERE_ARG, requireDraftWhere, wholeDraftHints } from \"../../draft-where.ts\";\nimport { SHOW_FULL_ARG, showEnvelope } from \"../draft-show.ts\";\nimport { hintLines, withHints } from \"../hints.ts\";\nimport { writeJsonEnvelope } from \"../output.ts\";\nimport { draftStageCommand } from \"./draft-stage.ts\";\nimport { renderDraftStatus } from \"./draft-status.ts\";\nimport { handleMetaError } from \"./shared.ts\";\n\nregisterSchema({\n command: \"ads.meta.draft\",\n routes: [\"POST /api/ads/meta/draft\"],\n effect: \"read\",\n description:\n \"Review every Meta op staged on this chat, one line each: ref · kind · summary · the ad set (or campaign) a staged ad (or ad set) goes into with the status it publishes under · what it waits on · ✗ blocked: <why> when publish would now refuse it, and after a publish ✓ applied → id or ✗ failed: <error>. `draft show <ref>` prints one op's payload (--full for lists over 50 items).\",\n args: {\n json: { type: \"boolean\", description: \"Raw JSON envelope instead of the readable list\", required: false },\n full: { type: \"boolean\", description: DRAFT_FULL_ARG.description, required: false },\n chat: { type: \"string\", description: \"Read another chat's draft instead of this one\", required: false },\n where: LIST_WHERE_ARG,\n },\n});\n\n/**\n * The readable one-line-per-op view is the default, like the Google, LinkedIn and X drafts;\n * `--json` (or `--output json`) returns the raw envelope for tools.\n */\nasync function listDraft(json: boolean, chat?: unknown, full = false, selector?: string): Promise<void> {\n const where = selector === undefined ? undefined : requireDraftWhere(selector);\n try {\n const chatId = resolveChatId(chat);\n const response = await apiPost<{ ok: boolean; data?: MetaDraftListResponse }>(\"/api/ads/meta/draft\", {\n chatId,\n ...(full || where ? { full: true } : {}),\n });\n if (where && selector !== undefined && response.ok && response.data) {\n const narrowed = draftListWhere(response.data, where, selector);\n writeJsonEnvelope(withHints({ ...response, data: narrowed.data }, narrowed.hints));\n return;\n }\n if (json || full || !response.ok || !response.data) {\n const whole = response.ok && response.data ? wholeDraftHints(response.data.ops, \"baker ads meta draft list\") : [];\n writeJsonEnvelope(withHints(response, whole));\n return;\n }\n process.stdout.write(`${renderDraftStatus(response.data)}${hintLines(response)}\\n`);\n } catch (err) {\n handleMetaError(err);\n }\n}\n\nconst listCommand = defineCommand({\n meta: {\n name: \"list\",\n description:\n \"Show every Meta write op staged in this chat, one line each (ref · kind · summary · parent ad set or campaign and its status · dependencies · post-publish result), with staged ads counted by their ad set's status; --json for the raw envelope, --full for every op's payload too. Publishing reaches the real ad account, so review this before you finish. Example: baker ads meta draft\",\n },\n args: {\n json: { type: \"boolean\", description: \"Print the raw JSON envelope instead of the readable list\" },\n full: DRAFT_FULL_ARG,\n chat: CHAT_READ_ARG,\n where: LIST_WHERE_ARG,\n },\n run: async ({ args }) => {\n await listDraft(\n args.json === true,\n args.chat,\n args.full === true,\n typeof args.where === \"string\" ? args.where : undefined,\n );\n },\n});\n\nconst showCommand = defineCommand({\n meta: {\n name: \"show\",\n description:\n \"Print the staged payload for one op — the receipt to verify a change looks right before publish. A list longer than 50 items (a customer list's members) prints as its count; --full prints every item. Example: baker ads meta draft show meta_temp_abc123\",\n },\n args: {\n ref: { type: \"positional\", description: \"Op ref (meta_temp_* for creates, target id for updates)\", required: true },\n // `show` always prints the envelope; `--json` is the spelling `list` taught, so it is accepted here too.\n json: { type: \"boolean\", description: \"Accepted for symmetry with list; show always prints the JSON envelope\" },\n chat: CHAT_READ_ARG,\n full: SHOW_FULL_ARG,\n },\n run: async ({ args }) => {\n try {\n const chatId = resolveChatId(args.chat);\n const response = await apiPost<{ ok: true; data: MetaDraftShowResponse }>(\"/api/ads/meta/draft/show\", {\n chatId,\n ref: args.ref,\n });\n writeJsonEnvelope(showEnvelope(response, args.full === true));\n } catch (err) {\n handleMetaError(err);\n }\n },\n});\n\nconst removeCommand = defineCommand({\n meta: {\n name: \"remove\",\n description:\n \"Drop staged Meta ops — one, or many in one call. Removing a create cascades to everything that depends on it. Example: baker ads meta draft remove meta_temp_abc123 meta_temp_def456\",\n },\n args: {\n ref: {\n type: \"positional\",\n description: \"Op ref(s) (meta_temp_* for creates, target id for updates) — several, space- or comma-separated\",\n required: true,\n },\n },\n run: async ({ args }) => {\n const refs = draftRefs(args._);\n if (refs.length > 1) {\n await removeDraftRefs(\"/api/ads/meta/draft/remove\", refs);\n return;\n }\n try {\n const chatId = requireChatId();\n const response = await apiPost<{ ok: true; data: MetaDraftRemoveResponse }>(\"/api/ads/meta/draft/remove\", {\n chatId,\n ref: args.ref,\n });\n writeJsonEnvelope(response);\n } catch (err) {\n handleMetaError(err);\n }\n },\n});\n\nconst clearCommand = defineCommand({\n meta: {\n name: \"clear\",\n description:\n \"Discard ALL staged Meta ops in this chat's draft — nothing will apply on publish. Example: baker ads meta draft clear\",\n },\n run: async () => {\n try {\n const chatId = requireChatId();\n const response = await apiPost<{ ok: true; data: MetaDraftClearResponse }>(\"/api/ads/meta/draft/clear\", {\n chatId,\n });\n writeJsonEnvelope(response);\n } catch (err) {\n handleMetaError(err);\n }\n },\n});\n\nwithEffect({ effect: \"read\", routes: [\"POST /api/ads/meta/draft\"] }, listCommand);\nwithEffect({ effect: \"read\", routes: [\"POST /api/ads/meta/draft/show\"] }, showCommand);\nwithEffect({ effect: \"unstage\", routes: [\"POST /api/ads/meta/draft/remove\"] }, removeCommand);\nwithEffect({ effect: \"unstage\", routes: [\"POST /api/ads/meta/draft/clear\"] }, clearCommand);\n\nexport const metaDraftCommand = defineCommand({\n meta: {\n name: \"draft\",\n description:\n \"Review and edit the Meta write ops staged in this chat BEFORE publish. Subcommands: list (default), show, remove, clear, and stage --file (many ops from one file in one call, names chaining creates). Ops never hit Meta until the chat is published. `list` and `show` take --chat <id> to read an earlier chat's changes instead.\",\n },\n // Declared on the parent too: `default: \"list\"` dispatches the bare `draft --chat <id>` form, and\n // citty prints help for a flag the parent does not know instead of forwarding it.\n args: {\n json: { type: \"boolean\", description: \"Print the raw JSON envelope instead of the readable list\" },\n full: DRAFT_FULL_ARG,\n chat: CHAT_READ_ARG,\n where: LIST_WHERE_ARG,\n },\n subCommands: {\n list: listCommand,\n show: showCommand,\n remove: removeCommand,\n clear: clearCommand,\n stage: draftStageCommand,\n },\n // `default` (not `run`) dispatches the bare invocation: citty falls through to `run`\n // after dispatching a subcommand, so a `run` here would list the draft a second time\n // on every `draft list` / `draft remove` / `draft clear`.\n default: \"list\",\n});\n","import type { MetaDraftOpInput, MetaDraftStageResponse } from \"@baker/api/ads-meta\";\nimport { defineCommand } from \"citty\";\nimport { ApiError, apiPost } from \"../../../client.ts\";\nimport { requireChatId } from \"../../../env.ts\";\nimport { registerSchema, withEffect } from \"../../../schemas.ts\";\nimport { adCopyHints } from \"../copy-hints.ts\";\nimport { loadJsonPayloads } from \"../google/write-shared.ts\";\nimport { writeJsonEnvelope } from \"../output.ts\";\nimport { handleMetaError } from \"./shared.ts\";\nimport { bareAccountId, failWriteValidation, preflightOp } from \"./write-shared.ts\";\n\n/**\n * `draft stage --file`: many Meta ops from one file, in one command. Pictures into ad sets is three\n * ops per ad (upload, creative, ad), each needing the ref the one before it returned, so without this\n * the agent wrote a script looping the CLI and parsing every envelope. Each op still goes through the\n * one-op stage route — Meta staging dry-runs each change, so a whole tree in one request would\n * outlast the request — but the names are resolved here, and a refusal takes back what the file\n * staged before it.\n */\n\nconst BATCH_MAX = 100;\n\n/** A name the file gives a create. Any length: it is replaced before anything is sent. */\nconst NAME = /^meta_temp_[A-Za-z0-9_-]+$/;\n\nconst STAGE_DESCRIPTION = `Stage many Meta changes from ONE file, in one call — any mix of kinds, up to ${BATCH_MAX} ops.\n\nStart here whenever a job is more than a few staged changes: N library pictures into M ad sets, a\nset of ads, a campaign tree. Never loop the single commands from a script.\n baker ads meta draft stage --file ops.json --account-id act_123\n\nThe file is a JSON array (or JSON Lines, one op per line). Each op is what the single commands\nbuild — kind, accountId (or --account-id for all), target for a change to something that exists,\npayload. A create can take a name in \"as\" (meta_temp_<anything>); later ops in the same file use\nthat name wherever a ref goes, and it becomes the real ref. Upload each picture once and reuse it:\n {\"kind\":\"media.upload\",\"as\":\"meta_temp_img1\",\"payload\":{\"kind\":\"image\",\"bakerImageId\":\"<id>\"}}\n {\"kind\":\"adCreative.create\",\"as\":\"meta_temp_cr1\",\"payload\":{\"creativeType\":\"single\",\"page_id\":\"555\",\n \"message\":\"…\",\"headline\":\"…\",\"link\":\"https://example.com\",\"imageRef\":\"meta_temp_img1\",\n \"call_to_action\":{\"type\":\"LEARN_MORE\"}}}\n {\"kind\":\"ad.create\",\"payload\":{\"name\":\"Ad 1\",\"adset_id\":\"6123\",\"creative\":{\"creative_id\":\"meta_temp_cr1\"},\"status\":\"PAUSED\"}}\n {\"kind\":\"ad.create\",\"payload\":{\"name\":\"Ad 1\",\"adset_id\":\"6124\",\"creative\":{\"creative_id\":\"meta_temp_cr1\"},\"status\":\"PAUSED\"}}\nEach kind's payload: \\`baker schema ads meta <group> create\\` (creatives create --variant placement for a\nplacement creative). Ops stage in file order, parents first.\nReturns count, refs (each \"as\" → its real ref; later calls use the real ref) and only the ops that\ncarry a warning; --full lists every op.\nAll-or-nothing: an op refused at staging takes back the ops this file staged before it, and the\nerror names the op. Fix it and run the whole file again.\nThen: baker ads meta draft`;\n\nconst FILE_ARG = {\n type: \"string\",\n description: \"JSON array or JSON Lines of ops ({kind, accountId?, target?, payload?, as?}), path or inline\",\n} as const;\nconst ACCOUNT_ARG = {\n type: \"string\",\n description: \"Ad account (act_123) for every op that does not name its own\",\n} as const;\nconst FULL_ARG = { type: \"boolean\", description: \"List every staged op, not only those with a warning\" } as const;\n\nregisterSchema({\n command: \"ads.meta.draft.stage\",\n routes: [\"POST /api/ads/meta/draft/stage\", \"POST /api/ads/meta/draft/remove\"],\n effect: \"stage\",\n description: STAGE_DESCRIPTION,\n args: {\n file: { ...FILE_ARG, required: true },\n \"account-id\": { ...ACCOUNT_ARG, required: false },\n full: { ...FULL_ARG, required: false },\n },\n});\n\ninterface FileOp {\n name?: string;\n op: Record<string, unknown>;\n}\n\n/** Every string in `value` equal to a key of `names`, swapped for its value: same shape otherwise. */\nfunction withNames(value: unknown, names: ReadonlyMap<string, string>): unknown {\n if (typeof value === \"string\") return names.get(value) ?? value;\n if (Array.isArray(value)) return value.map((item) => withNames(item, names));\n if (value !== null && typeof value === \"object\") {\n return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, withNames(child, names)]));\n }\n return value;\n}\n\n/** The strings in `value` that a later op in the file names: refused, since that op is not staged yet. */\nfunction namesUsed(value: unknown, names: ReadonlySet<string>): string[] {\n if (typeof value === \"string\") return names.has(value) ? [value] : [];\n if (Array.isArray(value)) return value.flatMap((item) => namesUsed(item, names));\n if (value !== null && typeof value === \"object\") return Object.values(value).flatMap((v) => namesUsed(v, names));\n return [];\n}\n\n/** The file's ops, each with its name split off and the account filled in; the names checked before anything stages. */\nexport function fileOps(items: ReadonlyArray<Record<string, unknown>>, accountId: string | undefined): FileOp[] {\n if (items.length === 0) {\n failWriteValidation(\n 'pass --file with the ops to stage: a JSON array (or JSON Lines) of {\"kind\",\"accountId\"?,\"target\"?,\"payload\"?,\"as\"?}',\n );\n }\n if (items.length > BATCH_MAX) {\n failWriteValidation(`${items.length} ops exceeds the limit of ${BATCH_MAX} — split the file and run each part`);\n }\n const declared = new Map<string, number>();\n for (const [index, item] of items.entries()) {\n const { as: name } = item;\n if (name === undefined) continue;\n if (typeof name !== \"string\" || !NAME.test(name)) {\n failWriteValidation(`ops[${index}]: \"as\" must be meta_temp_<letters or digits>, e.g. meta_temp_img1`);\n }\n if (\"target\" in item) {\n failWriteValidation(`ops[${index}]: \"as\" names a create — a change to something that exists already has a ref`);\n }\n const earlier = declared.get(name);\n if (earlier !== undefined) {\n failWriteValidation(`ops[${index}]: ${name} already names ops[${earlier}] — give each create its own name`);\n }\n declared.set(name, index);\n }\n const standIns = new Map([...declared.keys()].map((name, at) => [name, `meta_temp_file${at}`]));\n return items.map(({ as: name, ...rest }, index) => {\n const later = new Set([...declared].filter(([, at]) => at >= index).map(([n]) => n));\n const [early] = namesUsed(rest, later);\n if (early !== undefined) {\n failWriteValidation(\n `ops[${index}] names ${early}, which ops[${declared.get(early)}] creates — put each create before the ops that name it`,\n );\n }\n const op = rest.accountId === undefined && accountId ? { ...rest, accountId } : rest;\n // Checked with each name standing in as a ref the contract takes; the real ref replaces it at staging.\n preflightOp(withNames(op, standIns) as Record<string, unknown>, `ops[${index}] (${String(op.kind)}): `);\n return { name: typeof name === \"string\" ? name : undefined, op };\n });\n}\n\ninterface StageEnvelope {\n ok: true;\n data: MetaDraftStageResponse;\n hints?: string[];\n}\n\n/** Drops what this file staged, newest first. A ref a cascade already took is not an error. */\nasync function takeBack(chatId: string, refs: readonly string[]): Promise<void> {\n for (const ref of [...refs].reverse()) {\n await apiPost(\"/api/ads/meta/draft/remove\", { chatId, ref }).catch(() => undefined);\n }\n}\n\n/**\n * A refused op ends the file: what it staged before is taken back, unless one of those ops amended an\n * op staged before this file ran, which removing cannot undo. The refusal names the op either way.\n */\nasync function refuseFile(\n chatId: string,\n staged: readonly MetaDraftStageResponse[],\n at: string,\n err: unknown,\n): Promise<never> {\n const created = new Set(staged.filter((entry) => !entry.amended).map((entry) => entry.ref));\n const keeps = staged.some((entry) => entry.amended && !created.has(entry.ref));\n if (!keeps) await takeBack(chatId, [...created]);\n if (!(err instanceof ApiError)) handleMetaError(err);\n const after = keeps\n ? `the ${staged.length} op(s) before it stay staged (${staged.map((entry) => entry.ref).join(\", \")}) because one changed an op staged earlier — review with \\`baker ads meta draft\\``\n : \"nothing from this file stayed staged — fix that op and run the whole file again\";\n handleMetaError(new ApiError(err.code, `${at}: ${err.message} — ${after}`, err.fix));\n}\n\nasync function stageFile(ops: readonly FileOp[], full: boolean): Promise<void> {\n const chatId = requireChatId();\n const names = new Map<string, string>();\n const staged: MetaDraftStageResponse[] = [];\n const hints: string[] = [];\n for (const [index, { name, op }] of ops.entries()) {\n const resolved = withNames(op, names) as MetaDraftOpInput;\n try {\n const response = await apiPost<StageEnvelope>(\"/api/ads/meta/draft/stage\", { chatId, op: resolved });\n staged.push(response.data);\n hints.push(...(response.hints ?? []));\n if (name !== undefined) names.set(name, response.data.ref);\n } catch (err) {\n await refuseFile(chatId, staged, `ops[${index}] (${String(op.kind)})`, err);\n }\n }\n const copy = await adCopyHints(ops.map(({ op }) => op.payload));\n const shown = full ? staged : staged.filter((entry) => entry.warnings.length > 0);\n const allHints = [...new Set([...hints, ...copy])];\n writeJsonEnvelope({\n ok: true,\n data: {\n staged: true,\n count: staged.length,\n refs: Object.fromEntries(names),\n ops: shown.map(({ ref, kind, summary, warnings }) => ({ ref, kind, summary, warnings })),\n },\n ...(allHints.length > 0 ? { hints: allHints } : {}),\n });\n}\n\nexport const draftStageCommand = withEffect(\n { effect: \"stage\", routes: [\"POST /api/ads/meta/draft/stage\", \"POST /api/ads/meta/draft/remove\"] },\n defineCommand({\n meta: { name: \"stage\", description: STAGE_DESCRIPTION },\n args: { file: FILE_ARG, \"account-id\": ACCOUNT_ARG, full: FULL_ARG },\n run: async ({ args }) => {\n const items = loadJsonPayloads(args.file);\n const needsAccount = items.some((item) => item.accountId === undefined);\n const accountId = needsAccount ? await bareAccountId(args as Record<string, unknown>) : undefined;\n await stageFile(fileOps(items, accountId), args.full === true);\n },\n }),\n);\n","import type { MetaDraftListResponse, MetaDraftOpView } from \"@baker/api/ads-meta\";\n\n/**\n * Render the staged Meta draft as one line per op — ref, kind, summary, what it\n * waits on and, after a publish, what happened to it. The Google, LinkedIn and\n * X drafts already print a readable view by default; Meta printed the pretty\n * JSON envelope, and agents piped every read through python to get these same\n * columns back. Pure: takes the draft-list response, returns text.\n */\n\nconst STATUS_HEADINGS: Record<MetaDraftListResponse[\"status\"], string> = {\n active: \"staged\",\n publishing: \"publishing\",\n applied: \"published\",\n partial: \"published with failures\",\n discarded: \"discarded\",\n none: \"none\",\n};\n\nfunction plural(count: number, word: string): string {\n return `${count} ${word}${count === 1 ? \"\" : \"s\"}`;\n}\n\nfunction headingLine(draft: MetaDraftListResponse): string {\n const heading = STATUS_HEADINGS[draft.status];\n if (draft.status === \"active\" || draft.status === \"discarded\") {\n return `Meta Ads — ${plural(draft.count, \"change\")} ${heading} · ${draft.mode}`;\n }\n const counts = new Map<string, number>();\n for (const op of draft.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 return `Meta Ads — ${heading} · ${summary} · ${draft.mode}`;\n}\n\n/** A failed op: why, and what of it already reached Meta. */\nfunction failedPart(result: NonNullable<MetaDraftOpView[\"result\"]>): string {\n const landed = result.landed ? ` (${result.landed})` : \"\";\n return `✗ failed: ${result.error ?? \"no reason recorded\"}${landed}`;\n}\n\nfunction resultPart(op: MetaDraftOpView): string | undefined {\n const result = op.result;\n if (!result) {\n return undefined;\n }\n if (result.status === \"failed\") {\n return failedPart(result);\n }\n if (result.status === \"skipped\") {\n // Publish records either the dependency ref that did not apply or a plain reason; either way the op is finished.\n const because = result.skippedBecause;\n if (because && op.dependsOn.includes(because)) {\n return `✗ skipped: ${because} did not apply`;\n }\n return `✗ skipped: ${because ?? \"a change it needs did not apply\"}`;\n }\n const id = result.id ?? result.hash;\n const applied = `✓ ${result.status}${id ? ` → ${id}` : \"\"}`;\n const verification = result.verification;\n if (verification && verification.status !== \"confirmed\") {\n return `${applied} (read-back ${verification.status}${verification.note ? `: ${verification.note}` : \"\"})`;\n }\n return applied;\n}\n\nconst PARENT_WORD: Record<string, string> = {\n \"ad.create\": \"ad set\",\n \"ad.copy\": \"ad set\",\n \"adSet.create\": \"campaign\",\n \"adSet.copy\": \"campaign\",\n};\n\nconst STAGED_AD_KINDS: ReadonlySet<string> = new Set([\"ad.create\", \"ad.copy\"]);\n\n/** Where a staged ad (or ad set) goes, and the status that parent publishes with. */\nfunction parentPart(op: MetaDraftOpView): string | undefined {\n const parent = op.parent;\n if (!parent) {\n return undefined;\n }\n const word = PARENT_WORD[op.kind] ?? \"parent\";\n const named = parent.name ? `\"${parent.name}\" (${parent.ref})` : parent.ref;\n const staged = parent.staged ? \", staged here\" : \"\";\n const status = parent.status\n ? `${parent.statusBefore ? `${parent.statusBefore} → ` : \"\"}${parent.status}`\n : \"status not recorded\";\n return `in ${word} ${named}${staged} ${status}`;\n}\n\n/** \"Which staged ads will run\" in one line: ads counted by the status of the ad set they go into. */\nfunction adParentStatusLine(ops: readonly MetaDraftOpView[]): string | undefined {\n const counts = new Map<string, number>();\n for (const op of ops) {\n if (STAGED_AD_KINDS.has(op.kind) && op.parent) {\n const status = op.parent.status ?? \"not recorded\";\n counts.set(status, (counts.get(status) ?? 0) + 1);\n }\n }\n if (counts.size === 0) {\n return undefined;\n }\n return `Staged ads by ad set status: ${[...counts].map(([status, count]) => `${count} ${status}`).join(\", \")}`;\n}\n\nfunction readinessLine(ops: readonly MetaDraftOpView[]): string {\n const blocked = ops.filter((op) => op.blocked);\n if (blocked.length === 0) {\n return \"Every change passed its checks when staged — no need to re-check them.\";\n }\n // A first publish holds every change beside a refused one; only the refused ones need fixing.\n const heldBack = blocked.filter((op) => op.heldBack).length;\n const refused = blocked.length - heldBack;\n const held =\n heldBack === 0\n ? \"\"\n : `; the other ${plural(heldBack, \"change\")} ${heldBack === 1 ? \"is\" : \"are\"} held back with ${refused === 1 ? \"it\" : \"them\"} and need${heldBack === 1 ? \"s\" : \"\"} nothing`;\n return `${plural(refused, \"change\")} passed its checks when staged but would be refused now (✗ blocked below) — fix or remove ${refused === 1 ? \"it\" : \"them\"} before publishing${held}.`;\n}\n\nfunction opLine(op: MetaDraftOpView, showAccount: boolean): string {\n const parts = [op.ref, op.kind, op.summary];\n if (op.target && op.target !== op.ref) {\n parts.push(`target ${op.target}`);\n }\n if (showAccount) {\n parts.push(`account ${op.accountId}`);\n }\n const parent = parentPart(op);\n if (parent) {\n parts.push(parent);\n }\n if (op.dependsOn.length > 0) {\n parts.push(`after ${op.dependsOn.join(\", \")}`);\n }\n if (op.blocked) {\n parts.push(`✗ blocked: ${op.blocked}`);\n }\n const result = resultPart(op);\n if (result) {\n parts.push(result);\n }\n // Creative copy and provider errors can carry line breaks; one op stays one line.\n return ` ${parts.join(\" · \").replace(/[\\r\\n]+/g, \" \")}`;\n}\n\nexport function renderDraftStatus(draft: MetaDraftListResponse): string {\n if (draft.status === \"none\" || draft.count === 0) {\n return \"No staged Meta changes on this chat.\";\n }\n const lines = [headingLine(draft)];\n if (draft.status === \"active\") {\n lines.push(\"Publishing makes every change real on the ad account.\", readinessLine(draft.ops));\n }\n const adParents = adParentStatusLine(draft.ops);\n if (adParents) {\n lines.push(adParents);\n }\n lines.push(\"\");\n // A draft may span several ad accounts; the account is only noise when there is one.\n const showAccount = new Set(draft.ops.map((op) => op.accountId)).size > 1;\n for (const op of draft.ops) {\n lines.push(opLine(op, showAccount));\n }\n if (draft.advisories.length > 0) {\n lines.push(\"\", \"Advisories\");\n for (const advisory of draft.advisories) {\n lines.push(` ! ${advisory.ref}: ${advisory.message}`);\n }\n }\n lines.push(\n \"\",\n \"Staged payload for one op: baker ads meta draft show <ref> (--full for lists over 50 items) · raw envelope: --json\",\n );\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAAS,iBAAAA,sBAAqB;;;ACL9B,SAAS,qBAAqB;AAmB9B,IAAM,YAAY;AAGlB,IAAM,OAAO;AAEb,IAAM,oBAAoB,qFAAgF,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBnH,IAAM,WAAW;AAAA,EACf,MAAM;AAAA,EACN,aAAa;AACf;AACA,IAAM,cAAc;AAAA,EAClB,MAAM;AAAA,EACN,aAAa;AACf;AACA,IAAM,WAAW,EAAE,MAAM,WAAW,aAAa,sDAAsD;AAEvG,eAAe;AAAA,EACb,SAAS;AAAA,EACT,QAAQ,CAAC,kCAAkC,iCAAiC;AAAA,EAC5E,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,MAAM;AAAA,IACJ,MAAM,EAAE,GAAG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,SAAS,cAAc;AAC7B,YAAM,WAAW,MAAM,QAAoD,6BAA6B;AAAA,QACtG;AAAA,MACF,CAAC;AACD,wBAAkB,QAAQ;AAAA,IAC5B,SAAS,KAAK;AACZ,sBAAgB,GAAG;AAAA,IACrB;AAAA,EACF;AACF,CAAC;AAED,WAAW,EAAE,QAAQ,QAAQ,QAAQ,CAAC,0BAA0B,EAAE,GAAG,WAAW;AAChF,WAAW,EAAE,QAAQ,QAAQ,QAAQ,CAAC,+BAA+B,EAAE,GAAG,WAAW;AACrF,WAAW,EAAE,QAAQ,WAAW,QAAQ,CAAC,iCAAiC,EAAE,GAAG,aAAa;AAC5F,WAAW,EAAE,QAAQ,WAAW,QAAQ,CAAC,gCAAgC,EAAE,GAAG,YAAY;AAEnF,IAAM,mBAAmBA,eAAc;AAAA,EAC5C,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,aACE;AAAA,EACJ;AAAA;AAAA;AAAA,EAGA,MAAM;AAAA,IACJ,MAAM,EAAE,MAAM,WAAW,aAAa,2DAA2D;AAAA,IACjG,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,EACT;AAAA,EACA,aAAa;AAAA,IACX,MAAM;AAAA,IACN,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAIA,SAAS;AACX,CAAC;","names":["defineCommand","defineCommand"]}
@@ -12,7 +12,7 @@ import {
12
12
  keywordEntries,
13
13
  microsFlag,
14
14
  requireCustomerId
15
- } from "./chunk-N366L5EF.js";
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-AQDB4LLG.js.map
189
+ //# sourceMappingURL=forecast-JAPRYH4F.js.map
@@ -20,7 +20,6 @@ import {
20
20
  fileLines,
21
21
  googleStaged,
22
22
  googleStagedBatch,
23
- guidance,
24
23
  handleGoogleError,
25
24
  keywordEntries,
26
25
  listFlag,
@@ -39,7 +38,7 @@ import {
39
38
  targetArg,
40
39
  targetEntries,
41
40
  updateTargets
42
- } from "./chunk-N366L5EF.js";
41
+ } from "./chunk-LZ5DS4UB.js";
43
42
  import "./chunk-RHN5FEWA.js";
44
43
  import {
45
44
  booleanWordPositionalError
@@ -110,8 +109,8 @@ Examples:
110
109
  subCommands: {
111
110
  discover: () => import("./discover-F4TO7A3K.js").then((m) => m.discoverCommand),
112
111
  metrics: () => import("./metrics-S5G6W36J.js").then((m) => m.metricsCommand),
113
- forecast: () => import("./forecast-AQDB4LLG.js").then((m) => m.forecastCommand),
114
- themes: () => import("./themes-2T5BOIZU.js").then((m) => m.themesCommand),
112
+ forecast: () => import("./forecast-JAPRYH4F.js").then((m) => m.forecastCommand),
113
+ themes: () => import("./themes-Q5CSF6TJ.js").then((m) => m.themesCommand),
115
114
  locations: () => import("./locations-OPMVTKHK.js").then((m) => m.locationsCommand),
116
115
  languages: () => import("./languages-AFTPOHIV.js").then((m) => m.languagesCommand)
117
116
  }
@@ -733,9 +732,9 @@ function enableBrandGuidelinesFromFlags(args) {
733
732
  // src/commands/ads/google/criteria-commands.ts
734
733
  import { defineCommand as defineCommand3 } from "citty";
735
734
  var CRITERION_FILE_HELP = 'The `criterion` object is one `criterionType` with its fields, e.g. {"criterionType":"placement","url":"example.com"}, {"criterionType":"ageRange","ageRange":"AGE_RANGE_18_24"}, {"criterionType":"topic","topicConstant":"5"} \u2014 every type with an example: __tooling__/docs/tools/baker/ads-google.md \xA7 Targeting and exclusions.';
736
- var CRITERION_HINTS = guidance(
735
+ var CRITERION_HINTS = [
737
736
  "Run `baker ads google draft validate` once the targeting is staged: Google's dry run is the only thing that proves a criterion is accepted on this campaign before the user publishes."
738
- );
737
+ ];
739
738
  var campaignCriteriaCommand = defineCommand3({
740
739
  meta: {
741
740
  name: "campaign-criteria",
@@ -1229,10 +1228,10 @@ async function readListMembers(customerId, listId) {
1229
1228
 
1230
1229
  // src/commands/ads/google/write-commands.ts
1231
1230
  var STAGED_WRITE = "Stages only \u2014 applies to the live account when the chat is published. Field contract: `baker capabilities google-ads --op <entity>`.";
1232
- var BUDGET_DEMAND_HINTS = guidance(
1231
+ var BUDGET_DEMAND_HINTS = [
1233
1232
  "Check this daily budget against the search volume you measured for these keywords, not against the plan you had before you measured it. A budget many times larger than the traffic the target pool can absorb never spends, and reads to the client as a number nobody costed.",
1234
1233
  "No volume measured yet? Pull it first \u2014 `baker ads google query --preset search-terms` for what the account already captures, `baker ads google keywords metrics` for the market estimate (those are planner figures, never account performance)."
1235
- );
1234
+ ];
1236
1235
  function budgetAmountsFromFlags(args) {
1237
1236
  if (args.amount !== void 0 && args.total !== void 0) {
1238
1237
  failWriteValidation(
@@ -1252,9 +1251,9 @@ var totalArg = {
1252
1251
  description: "A TOTAL budget instead of a daily one: one amount in major units spent across the campaign's start and end dates (e.g. 300). Search, Performance Max and Demand Gen only; the campaign needs --end-date; never shared. A budget stays daily or total for life."
1253
1252
  }
1254
1253
  };
1255
- var BUDGET_REMOVE_HINTS = guidance(
1254
+ var BUDGET_REMOVE_HINTS = [
1256
1255
  "A budget can be removed only once no campaign uses it: staging refuses it while one does, unless this draft removes those campaigns or moves them to another budget (publish sends the campaign changes first)."
1257
- );
1256
+ ];
1258
1257
  var budgetsCommand = defineCommand4({
1259
1258
  meta: { name: "budgets", description: "Stage campaign budget create/update/remove" },
1260
1259
  subCommands: {
@@ -1935,7 +1934,6 @@ var campaignsCommand = defineCommand4({
1935
1934
  }
1936
1935
  });
1937
1936
  function statusCommand(kind, entity, hints) {
1938
- const said = hints && guidance(...hints);
1939
1937
  return withEffect(
1940
1938
  googleStaged(kind),
1941
1939
  defineCommand4({
@@ -1949,7 +1947,7 @@ function statusCommand(kind, entity, hints) {
1949
1947
  },
1950
1948
  run: async ({ args }) => {
1951
1949
  const customerId = requireCustomerId(args);
1952
- await stageTarget(kind, customerId, requireTarget(args, entity), said);
1950
+ await stageTarget(kind, customerId, requireTarget(args, entity), hints);
1953
1951
  }
1954
1952
  })
1955
1953
  );
@@ -2092,10 +2090,10 @@ var adGroupsCommand = defineCommand4({
2092
2090
  remove: statusCommand("google.adGroup.remove", "ad group")
2093
2091
  }
2094
2092
  });
2095
- var KEYWORD_KILL_HINTS = guidance(
2093
+ var KEYWORD_KILL_HINTS = [
2096
2094
  "Keyword metrics are per ad group. Decide this from keyword_view rows carrying ad_group.id + ad_group_criterion.criterion_id (`--preset keyword-analysis` returns both) \u2014 never from campaign totals or metrics summed across ad groups.",
2097
2095
  "The same keyword text in several ad groups shares ONE criterion id, so an aggregate blends the copy that holds the history with the copies that never served. Compare the copies row by row and keep the one with the impressions/conversions; if the keyword is duplicated and only one copy performs, pause the others, not it."
2098
- );
2096
+ ];
2099
2097
  function keywordKillHints(status) {
2100
2098
  const kills = typeof status === "string" && ["PAUSED", "REMOVED"].includes(status.toUpperCase());
2101
2099
  return kills ? KEYWORD_KILL_HINTS : [];
@@ -3134,9 +3132,7 @@ var assetGroupsCommand = defineCommand4({
3134
3132
  });
3135
3133
  await stageCreate("google.assetGroup.create", customerId, payload, [
3136
3134
  ...copyListSplitHints(args),
3137
- ...guidance(
3138
- "Performance Max has no keywords: give this group its search themes (and its audience signal, when the account has one) with `baker ads google asset-group-signals add --asset-group <its ref>` in this same draft."
3139
- )
3135
+ "Performance Max has no keywords: give this group its search themes (and its audience signal, when the account has one) with `baker ads google asset-group-signals add --asset-group <its ref>` in this same draft."
3140
3136
  ]);
3141
3137
  }
3142
3138
  })
@@ -3189,16 +3185,11 @@ var assetGroupsCommand = defineCommand4({
3189
3185
  asset: args["asset-ref"],
3190
3186
  fieldType: args["field-type"]
3191
3187
  });
3192
- await stageCreate(
3193
- "google.assetGroupAsset.attach",
3194
- customerId,
3195
- payload,
3196
- guidance(
3197
- "Swapping a creative? Stage the matching `asset-groups detach` for the image this one replaces \u2014 an attach alone grows the group instead of refreshing it.",
3198
- "The field type must match the image's real ratio (1.91:1 \u2192 MARKETING_IMAGE, 1:1 \u2192 SQUARE_MARKETING_IMAGE, 4:5 \u2192 PORTRAIT_MARKETING_IMAGE); Google rejects a mismatch at publish.",
3199
- "Slots have ceilings as well as minimums: BUSINESS_NAME and CALL_TO_ACTION_SELECTION hold 1, LOGO 5, LONG_HEADLINE and DESCRIPTION 5, HEADLINE 15, YOUTUBE_VIDEO 15, images 20. Staging counts what the group holds plus this chat's attaches and detaches, and refuses an attach to a full slot \u2014 stage the detach alongside it; removals are sent after additions. Replacing the business name (exactly 1): stage its detach first, then this attach."
3200
- )
3201
- );
3188
+ await stageCreate("google.assetGroupAsset.attach", customerId, payload, [
3189
+ "Swapping a creative? Stage the matching `asset-groups detach` for the image this one replaces \u2014 an attach alone grows the group instead of refreshing it.",
3190
+ "The field type must match the image's real ratio (1.91:1 \u2192 MARKETING_IMAGE, 1:1 \u2192 SQUARE_MARKETING_IMAGE, 4:5 \u2192 PORTRAIT_MARKETING_IMAGE); Google rejects a mismatch at publish.",
3191
+ "Slots have ceilings as well as minimums: BUSINESS_NAME and CALL_TO_ACTION_SELECTION hold 1, LOGO 5, LONG_HEADLINE and DESCRIPTION 5, HEADLINE 15, YOUTUBE_VIDEO 15, images 20. Staging counts what the group holds plus this chat's attaches and detaches, and refuses an attach to a full slot \u2014 stage the detach alongside it; removals are sent after additions. Replacing the business name (exactly 1): stage its detach first, then this attach."
3192
+ ]);
3202
3193
  }
3203
3194
  })
3204
3195
  ),
@@ -3212,10 +3203,10 @@ function imageAssetHints(payload) {
3212
3203
  if (payload.type !== "image") {
3213
3204
  return [];
3214
3205
  }
3215
- return guidance(
3206
+ return [
3216
3207
  "This image publishes into the advertiser's Google Ads asset library. Stage the `assets attach` too, with field type AD_IMAGE on the campaign (or ad group) it belongs on: Google opens Search image links per account, so Baker asks Google as you stage \u2014 where the account takes them the link is staged and applies at publish, and where it does not the link is skipped and names the campaign in the handover Task.",
3217
3208
  "Until a link to it is staged, Baker keeps a Task for this image in this chat's changes \u2014 the user adding it to the campaign under Assets \u2014 and withdraws it when an accepted link names the image; do not stage a second one with `baker actions`. If that Task is still there after the attach, tell the user the images are already in their Google Ads account and only need adding to the campaign under Assets, and name them. Never tell them to upload images they already have. (A Performance Max asset group is different \u2014 images link there with `asset-groups attach`.)"
3218
- );
3209
+ ];
3219
3210
  }
3220
3211
  var assetsUpdateCommand = withEffect(
3221
3212
  googleStaged("google.asset.update"),
@@ -3261,11 +3252,6 @@ var assetsUpdateCommand = withEffect(
3261
3252
  }
3262
3253
  })
3263
3254
  );
3264
- function imageLinkHints(payload) {
3265
- return typeof payload.fieldType === "string" && /IMAGE|LOGO/i.test(payload.fieldType) ? guidance(
3266
- 'Search image extensions link as AD_IMAGE, at campaign or ad group level: `{"level":"campaign","parent":"<campaign id>","asset":"<image asset id or g_temp_ ref>","fieldType":"AD_IMAGE"}`. Google opens these per advertiser account, so Baker asks Google (a check that changes nothing) as you stage. The image must be 1.91:1 or 1:1 \u2014 any other shape is sent back to crop. Accepted \u2192 the link is staged and applies at publish. Refused or not confirmed \u2192 it is skipped rather than stored, the rest of a batch is unaffected, and Baker stages the handover Task naming those images and that campaign; then tell the user they are already in their Google Ads account and only need adding to the campaign under Assets, and do not stage a second Task with `baker actions`. MARKETING_IMAGE / SQUARE_MARKETING_IMAGE are Performance Max asset-group slots (`asset-groups attach`), never a Search link. The advertiser\'s logo links as `BUSINESS_LOGO` (campaign or customer level, on a verified account).'
3267
- ) : [];
3268
- }
3269
3255
  var assetsCommand = defineCommand4({
3270
3256
  meta: {
3271
3257
  name: "assets",
@@ -3279,12 +3265,9 @@ var assetsCommand = defineCommand4({
3279
3265
  imageAssetHints
3280
3266
  ),
3281
3267
  update: assetsUpdateCommand,
3282
- attach: fileCreateCommand(
3283
- "attach",
3284
- "google.assetLink.attach",
3285
- "Attach an asset to a campaign/adGroup/customer",
3286
- imageLinkHints
3287
- ),
3268
+ attach: fileCreateCommand("attach", "google.assetLink.attach", "Attach an asset to a campaign/adGroup/customer", [
3269
+ 'Search image extensions link as AD_IMAGE, at campaign or ad group level: `{"level":"campaign","parent":"<campaign id>","asset":"<image asset id or g_temp_ ref>","fieldType":"AD_IMAGE"}`. Google opens these per advertiser account, so Baker asks Google (a check that changes nothing) as you stage. The image must be 1.91:1 or 1:1 \u2014 any other shape is sent back to crop. Accepted \u2192 the link is staged and applies at publish. Refused or not confirmed \u2192 it is skipped rather than stored, the rest of a batch is unaffected, and Baker stages the handover Task naming those images and that campaign; then tell the user they are already in their Google Ads account and only need adding to the campaign under Assets, and do not stage a second Task with `baker actions`. MARKETING_IMAGE / SQUARE_MARKETING_IMAGE are Performance Max asset-group slots (`asset-groups attach`), never a Search link. The advertiser\'s logo links as `BUSINESS_LOGO` (campaign or customer level, on a verified account).'
3270
+ ]),
3288
3271
  detach: statusCommand("google.assetLink.detach", "asset link", [
3289
3272
  "Pass the resource name Google gave you \u2014 `SELECT campaign_asset.resource_name \u2026 FROM campaign_asset WHERE campaign_asset.status != 'REMOVED'` (or `ad_group_asset` / `customer_asset`) \u2014 never one composed out of an owner id and an asset id. A link's own status is not its campaign's and not its ad group's, so an inventory read scoped only to those lists extensions that are already detached, and a link between an asset and an owner that never held it parses fine and exists nowhere. Either way the target is read back before it is staged, and a detach of a link that is not there is refused here rather than at publish."
3290
3273
  ])
@@ -3312,10 +3295,10 @@ function requireAudienceLevel(value) {
3312
3295
  }
3313
3296
  return level;
3314
3297
  }
3315
- var AUDIENCE_ATTACH_HINTS = guidance(
3298
+ var AUDIENCE_ATTACH_HINTS = [
3316
3299
  'Read back what the parent ended up with before you report: `baker ads google query "SELECT campaign.id, campaign.targeting_setting.target_restrictions FROM campaign"` (or the ad_group equivalent). A missing AUDIENCE row means TARGETING \u2014 Google does not serialize an empty setting, so absence is a value, not a gap.',
3317
3300
  "Staging checks the list is big enough to serve on this campaign's network (100 active users on search, display and YouTube) and refuses a targeting attach that is not. It does NOT check delivery afterwards, and Google reports no error when an audience stops a campaign serving \u2014 after publishing, read the campaign's impressions for the hour that follows and say what you saw."
3318
- );
3301
+ ];
3319
3302
  var audiencesAttachCommand = withEffect(
3320
3303
  googleStagedBatch("google.audienceCriterion.attach"),
3321
3304
  defineCommand4({
@@ -3425,12 +3408,12 @@ var audiencesCommand = defineCommand4({
3425
3408
  }
3426
3409
  });
3427
3410
  var PRIMARY_FOR_GOAL_QUERY = 'baker ads google query "SELECT conversion_action.name, conversion_action.primary_for_goal, conversion_action.status FROM conversion_action"';
3428
- var CONVERSION_CREATE_HINTS = guidance(
3411
+ var CONVERSION_CREATE_HINTS = [
3429
3412
  `A new conversion action is staged as SECONDARY (reported, not bid toward) unless the payload says \`"primaryForGoal": true\` \u2014 Google otherwise decides for you, and an accidentally-primary action redirects the spend of every Maximize Conversions / Target CPA campaign. Ask the user which they want rather than guessing.`
3430
- );
3431
- var CONVERSION_ROLE_HINTS = guidance(
3413
+ ];
3414
+ var CONVERSION_ROLE_HINTS = [
3432
3415
  `Primary actions are what Maximize Conversions / Target CPA campaigns bid toward. Before publishing, list what the account will be left with: ${PRIMARY_FOR_GOAL_QUERY} \u2014 and say so if this leaves no primary action, because bidding then has nothing to optimize toward.`
3433
- );
3416
+ ];
3434
3417
  function conversionGoalFromFlags(args) {
3435
3418
  const booleanWord = booleanWordPositionalError(args, "conversion goal");
3436
3419
  if (booleanWord) {
@@ -3452,16 +3435,16 @@ function conversionGoalFromFlags(args) {
3452
3435
  return { category, origin, biddable: args.biddable };
3453
3436
  }
3454
3437
  var CONVERSION_GOAL_QUERY = 'baker ads google query "SELECT customer_conversion_goal.category, customer_conversion_goal.origin, customer_conversion_goal.biddable FROM customer_conversion_goal"';
3455
- var CONVERSION_GOAL_HINTS = guidance(
3438
+ var CONVERSION_GOAL_HINTS = [
3456
3439
  `A conversion drives automated bidding only when BOTH halves are on: the action is primary (\`conversions update --primary\`) AND its category's account-level goal is included (this command). Before publishing, read back what the account will bid toward: ${CONVERSION_GOAL_QUERY} \u2014 and say plainly which conversions this leaves driving spend.`
3457
- );
3440
+ ];
3458
3441
  var conversionsCommand = defineCommand4({
3459
3442
  meta: {
3460
3443
  name: "conversions",
3461
3444
  description: "Stage conversion action create/update (via --file), the account-level goal, and manual conversion uploads for a period where tracking was broken"
3462
3445
  },
3463
3446
  subCommands: {
3464
- upload: () => import("./conversion-upload-command-HJOVSWZD.js").then((m) => m.conversionsUploadCommand),
3447
+ upload: () => import("./conversion-upload-command-Y4ABNNAT.js").then((m) => m.conversionsUploadCommand),
3465
3448
  create: fileCreateCommand(
3466
3449
  "create",
3467
3450
  "google.conversionAction.create",
@@ -3713,7 +3696,7 @@ var keywordsWithWrites = defineCommand5({
3713
3696
  }
3714
3697
  });
3715
3698
  var GROUP_READS = {
3716
- "negative-keywords": { check: () => import("./search-terms-WKEPRHN2.js").then((m) => m.negativeCheckCommand) }
3699
+ "negative-keywords": { check: () => import("./search-terms-WLOW2FPP.js").then((m) => m.negativeCheckCommand) }
3717
3700
  };
3718
3701
  function withList(thing, command) {
3719
3702
  const list2 = LIST_COMMANDS[thing];
@@ -3764,19 +3747,19 @@ Full guide: __tooling__/docs/tools/baker/ads-google.md`
3764
3747
  currency: () => import("./currency-NRI2TLP3.js").then((m) => m.currencyCommand),
3765
3748
  "url-options": () => import("./url-options-BANFHIHH.js").then((m) => m.urlOptionsCommand),
3766
3749
  changes: () => import("./changes-CNGAKH52.js").then((m) => m.changesCommand),
3767
- invoices: () => import("./account-reads-3LP4F3L4.js").then((m) => m.invoicesCommand),
3768
- "identity-verification": () => import("./account-reads-3LP4F3L4.js").then((m) => m.identityVerificationCommand),
3769
- previews: () => import("./account-reads-3LP4F3L4.js").then((m) => m.previewsCommand),
3770
- brands: () => import("./account-reads-3LP4F3L4.js").then((m) => m.brandsCommand),
3750
+ invoices: () => import("./account-reads-SUWXGTGW.js").then((m) => m.invoicesCommand),
3751
+ "identity-verification": () => import("./account-reads-SUWXGTGW.js").then((m) => m.identityVerificationCommand),
3752
+ previews: () => import("./account-reads-SUWXGTGW.js").then((m) => m.previewsCommand),
3753
+ brands: () => import("./account-reads-SUWXGTGW.js").then((m) => m.brandsCommand),
3771
3754
  query: () => import("./query-5XB5OP4B.js").then((m) => m.queryCommand),
3772
- "search-terms": () => import("./search-terms-WKEPRHN2.js").then((m) => m.searchTermsCommand),
3755
+ "search-terms": () => import("./search-terms-WLOW2FPP.js").then((m) => m.searchTermsCommand),
3773
3756
  keywords: keywordsWithWrites,
3774
3757
  ...googleWriteCommandsWithLists,
3775
3758
  "merchant-center": merchantCenterCommand,
3776
- draft: () => import("./draft-OLSFLDME.js").then((m) => m.draftCommand)
3759
+ draft: () => import("./draft-CLNMIQXV.js").then((m) => m.draftCommand)
3777
3760
  }
3778
3761
  });
3779
3762
  export {
3780
3763
  googleCommand
3781
3764
  };
3782
- //# sourceMappingURL=google-HLE7YIYM.js.map
3765
+ //# sourceMappingURL=google-HHKFDH7I.js.map