@koda-sl/baker-cli 0.527.0 → 0.529.0
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 +3 -0
- package/dist/{ads-F2PURRHL.js → ads-6ESCXPHK.js} +2 -2
- package/dist/cli.js +46 -2
- package/dist/cli.js.map +1 -1
- package/dist/{performance-L3Q57H4H.js → performance-6XFKDJGY.js} +11 -2
- package/dist/performance-6XFKDJGY.js.map +1 -0
- package/package.json +1 -1
- package/dist/performance-L3Q57H4H.js.map +0 -1
- /package/dist/{ads-F2PURRHL.js.map → ads-6ESCXPHK.js.map} +0 -0
package/README.md
CHANGED
|
@@ -218,6 +218,7 @@ baker ads performance currency # the reporting currency, why
|
|
|
218
218
|
baker ads performance currency set USD # staged: the default currency for everyone (--clear to go back)
|
|
219
219
|
baker ads performance entities --level ad --sort cost_per_result
|
|
220
220
|
baker ads performance entities --level ad --entity-ids <id,id> # only these rows
|
|
221
|
+
baker ads performance entities --level campaign --include-idle # serving: whether each really delivers (a paused parent, nothing on below); below: its children, on and live
|
|
221
222
|
baker ads performance entities --platforms google --compare # each row against the settled days before; what stopped, and who stopped it
|
|
222
223
|
baker ads performance entity <id> --platform meta --level ad_group # one entity + verdict before changing it
|
|
223
224
|
baker ads performance changes --days 14
|
|
@@ -7673,6 +7674,8 @@ baker ads google --help # All Google Ads subcommands
|
|
|
7673
7674
|
baker ads google query --help # All flags for the query command
|
|
7674
7675
|
```
|
|
7675
7676
|
|
|
7677
|
+
A command list names each subcommand with the first sentence of its description; the whole description is in that subcommand's own `--help`. No help line is padded with trailing spaces.
|
|
7678
|
+
|
|
7676
7679
|
For machine-readable introspection, use `baker schema` (see below).
|
|
7677
7680
|
|
|
7678
7681
|
## For AI Agents
|
|
@@ -38,11 +38,11 @@ Full guides: __tooling__/docs/tools/baker/ads-<platform>.md (google|meta|linkedi
|
|
|
38
38
|
linkedin: () => import("./linkedin-5PYG5HEM.js").then((m) => m.linkedinCommand),
|
|
39
39
|
x: () => import("./x-EMLFCHSG.js").then((m) => m.xCommand),
|
|
40
40
|
chatgpt: () => import("./chatgpt-S5EVEKYV.js").then((m) => m.chatgptCommand),
|
|
41
|
-
performance: () => import("./performance-
|
|
41
|
+
performance: () => import("./performance-6XFKDJGY.js").then((m) => m.performanceCommand),
|
|
42
42
|
terms: () => import("./terms-X4OJWTQH.js").then((m) => m.termsCommand)
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
export {
|
|
46
46
|
adsCommand
|
|
47
47
|
};
|
|
48
|
-
//# sourceMappingURL=ads-
|
|
48
|
+
//# sourceMappingURL=ads-6ESCXPHK.js.map
|
package/dist/cli.js
CHANGED
|
@@ -131,6 +131,50 @@ function installFullNote(commandPath) {
|
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
// src/help-output.ts
|
|
135
|
+
import { renderUsage } from "citty";
|
|
136
|
+
var sentences = new Intl.Segmenter("en", { granularity: "sentence" });
|
|
137
|
+
var abbreviation = /\b(?:e\.g|i\.e|vs|etc)\.$/i;
|
|
138
|
+
function resolved(value) {
|
|
139
|
+
return Promise.resolve(typeof value === "function" ? value() : value);
|
|
140
|
+
}
|
|
141
|
+
function firstSentence(description) {
|
|
142
|
+
const [first = "", ...rest] = description.trim().split("\n");
|
|
143
|
+
let prose = first.trim();
|
|
144
|
+
for (const line of rest) {
|
|
145
|
+
if (/[.:!?]$/.test(prose) || line.trim() === "" || /^(\s|[-*•])/.test(line)) break;
|
|
146
|
+
prose += ` ${line.trim()}`;
|
|
147
|
+
}
|
|
148
|
+
let sentence = "";
|
|
149
|
+
for (const { segment } of sentences.segment(prose)) {
|
|
150
|
+
sentence += segment;
|
|
151
|
+
if (!abbreviation.test(sentence.trim())) break;
|
|
152
|
+
}
|
|
153
|
+
return (sentence || prose).trim();
|
|
154
|
+
}
|
|
155
|
+
async function summarized(cmd) {
|
|
156
|
+
if (!cmd.subCommands) return cmd;
|
|
157
|
+
const subCommands = await resolved(cmd.subCommands);
|
|
158
|
+
const listed = {};
|
|
159
|
+
for (const [name, sub] of Object.entries(subCommands)) {
|
|
160
|
+
const command = await resolved(sub);
|
|
161
|
+
const meta = (command.meta ? await resolved(command.meta) : void 0) ?? {};
|
|
162
|
+
listed[name] = { meta: meta.description ? { ...meta, description: firstSentence(meta.description) } : meta };
|
|
163
|
+
}
|
|
164
|
+
return { ...cmd, subCommands: listed };
|
|
165
|
+
}
|
|
166
|
+
async function renderHelp(cmd, parent) {
|
|
167
|
+
const usage = await renderUsage(await summarized(cmd), parent);
|
|
168
|
+
return usage.split("\n").map((line) => line.trimEnd()).join("\n");
|
|
169
|
+
}
|
|
170
|
+
function printHelpTo(stdout) {
|
|
171
|
+
return async (cmd, parent) => {
|
|
172
|
+
const help = await renderHelp(cmd, parent);
|
|
173
|
+
await new Promise((done) => stdout.write(`${help}
|
|
174
|
+
`, done));
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
134
178
|
// src/root-command.ts
|
|
135
179
|
import { defineCommand } from "citty";
|
|
136
180
|
|
|
@@ -170,7 +214,7 @@ Introspection: Run 'baker schema <command>' to inspect argument schemas.`
|
|
|
170
214
|
capabilities: () => import("./capabilities-BEZXR2FZ.js").then((m) => m.capabilitiesCommand),
|
|
171
215
|
actions: () => import("./actions-33IZOT5C.js").then((m) => m.actionsCommand),
|
|
172
216
|
"scheduled-agents": () => import("./scheduled-agents-EPPP4SCZ.js").then((m) => m.scheduledAgentsCommand),
|
|
173
|
-
ads: () => import("./ads-
|
|
217
|
+
ads: () => import("./ads-6ESCXPHK.js").then((m) => m.adsCommand),
|
|
174
218
|
brand: () => import("./brand-GBP4OEJI.js").then((m) => m.brandCommand),
|
|
175
219
|
analytics: () => import("./analytics-OUNKG2FW.js").then((m) => m.analyticsCommand),
|
|
176
220
|
experiment: () => import("./experiment-MO6MT6OJ.js").then((m) => m.experimentCommand),
|
|
@@ -248,7 +292,7 @@ refuseStrayPositionals(main, process.argv.slice(2));
|
|
|
248
292
|
process.argv = [...process.argv.slice(0, 2), ...cacheFlagForParser(process.argv.slice(2))];
|
|
249
293
|
var rawArgs = process.argv.slice(2);
|
|
250
294
|
if (rawArgs.some((arg) => arg === "--help" || arg === "-h") || rawArgs.length === 1 && /^(--version|-v)$/.test(rawArgs[0] ?? "")) {
|
|
251
|
-
runMain(main);
|
|
295
|
+
runMain(main, { showUsage: printHelpTo(process.stdout) });
|
|
252
296
|
} else {
|
|
253
297
|
try {
|
|
254
298
|
await runCommand(main, { rawArgs });
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts","../src/closed-pipe.ts","../src/company-flag.ts","../src/full-flag.ts","../src/root-command.ts","../src/version.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { runCommand, runMain } from \"citty\";\nimport { agentProfile, applyAgentProfile } from \"./agent-profile.ts\";\nimport { cacheFlagForCommand, cacheFlagForParser, normalizeCacheFlag } from \"./cache-flag.ts\";\nimport { exitQuietlyOnClosedPipe } from \"./closed-pipe.ts\";\nimport { loadCommands } from \"./command-loading.ts\";\nimport { takeCompanyFlag } from \"./company-flag.ts\";\nimport { installExitRecord, installStreamTaps, logInvocation } from \"./debugLog.ts\";\nimport { setTargetCompany } from \"./env.ts\";\nimport { installFieldMask, takeFieldsFlag } from \"./field-mask.ts\";\nimport { installFullNote, takeFullFlag } from \"./full-flag.ts\";\nimport { writeJson } from \"./output.ts\";\nimport { asksForEnvelopeAlone, envelopeAloneOnStdout, outputFlagForCommand } from \"./output-flag.ts\";\nimport { rootCommand } from \"./root-command.ts\";\nimport { registerCommandTree } from \"./schemas.ts\";\nimport { commandPathOf, parseRefusalEnvelope, refuseStrayPositionals, refuseUnknownFlags } from \"./unknown-flags.ts\";\n\nconst main = rootCommand;\n// The call as typed, before the rewrites below: a refusal's corrected call is built from it.\nconst typedArgv = process.argv.slice(2);\n\nawait loadCommands(main, process.argv.slice(2));\nregisterCommandTree(main);\n\nexitQuietlyOnClosedPipe(process.stdout, (code) => process.exit(code));\n\n// The legacy `--skip-cache` spelling becomes `--no-cache` before anything reads\n// argv — citty parses `process.argv` itself, so the rewrite has to land there.\nprocess.argv = [...process.argv.slice(0, 2), ...normalizeCacheFlag(process.argv.slice(2))];\n\n// When BAKER_DEBUG_LOG is set, mirror all output and record the invocation\n// before any command runs. No-op otherwise.\ninstallStreamTaps();\nlogInvocation(process.argv.slice(2));\ninstallExitRecord();\n\n// `--output json` asks for the envelope, which almost every command prints\n// without declaring the option — translated here so the guard below does not\n// refuse a flag that asked for what the command was about to print.\n// `canvas run` prints progress before its envelope: asked for the envelope, it\n// prints that alone on stdout and the progress on stderr.\nif (asksForEnvelopeAlone(main, process.argv.slice(2))) {\n envelopeAloneOnStdout(process.stdout, process.stderr);\n}\nprocess.argv = [...process.argv.slice(0, 2), ...outputFlagForCommand(main, process.argv.slice(2))];\n\n// `--fields` narrows the envelope on every command that prints one; where the\n// command does not declare it, it is applied to what the command prints.\nconst fieldsFlag = takeFieldsFlag(main, process.argv.slice(2));\nif (fieldsFlag.fields) {\n process.argv = [...process.argv.slice(0, 2), ...fieldsFlag.argv];\n installFieldMask(fieldsFlag.fields, commandPathOf(main, fieldsFlag.argv));\n}\n\n// `--full` on a command with no shorter view asks for what it already prints:\n// taken off here, and said back in the envelope's hints.\nconst fullFlag = takeFullFlag(main, process.argv.slice(2));\nif (fullFlag.taken) {\n process.argv = [...process.argv.slice(0, 2), ...fullFlag.argv];\n installFullNote(commandPathOf(main, fullFlag.argv));\n}\n\n// `--company <id>` names the company a read is about (the organization\n// workspace's Reports read every company of its organization). It travels as a\n// header on every request, so it is taken off here, before the guard.\nconst companyFlag = takeCompanyFlag(main, process.argv.slice(2));\nif (companyFlag.company) {\n process.argv = [...process.argv.slice(0, 2), ...companyFlag.argv];\n setTargetCompany(companyFlag.company);\n}\n\n// What this agent is offered: the organization workspace's agent only reads\n// (`agent-profile.ts`). Here, after `--company` is taken off, so the command it\n// judges is the one typed.\nconst profileRefusal = await applyAgentProfile(main, agentProfile(), process.argv.slice(2));\nif (profileRefusal) {\n writeJson({ ok: false, error: { code: \"FORBIDDEN\", message: profileRefusal } });\n process.exit(1);\n}\n\n// A report's Refresh appends `--no-cache` to every read; a command with no cache\n// already reads fresh, so it is dropped there rather than refused.\nprocess.argv = [...process.argv.slice(0, 2), ...cacheFlagForCommand(main, process.argv.slice(2))];\n\nrefuseUnknownFlags(main, process.argv.slice(2), typedArgv);\nrefuseStrayPositionals(main, process.argv.slice(2));\n\n// Last, so the guard above quotes back the spelling the caller typed: citty\n// resolves a bare `--no-cache` to `cache: false` instead of filling the declared\n// `no-cache` arg, and only the camelCase spelling survives its parser intact.\nprocess.argv = [...process.argv.slice(0, 2), ...cacheFlagForParser(process.argv.slice(2))];\n\n// `--help` and `--version` stay citty's own. Everything else runs here rather\n// than through `runMain`, whose refusal of a missing argument or an unknown\n// subcommand is usage text on stderr and nothing on stdout: that becomes the\n// envelope every other failure prints.\nconst rawArgs = process.argv.slice(2);\nif (\n rawArgs.some((arg) => arg === \"--help\" || arg === \"-h\") ||\n (rawArgs.length === 1 && /^(--version|-v)$/.test(rawArgs[0] ?? \"\"))\n) {\n runMain(main);\n} else {\n try {\n await runCommand(main, { rawArgs });\n } catch (error) {\n const refusal = parseRefusalEnvelope(error, main, rawArgs);\n if (refusal) {\n writeJson(refusal);\n } else {\n console.error(error, \"\\n\");\n }\n process.exit(1);\n }\n}\n","interface ErrorSource {\n on(event: \"error\", listener: (err: NodeJS.ErrnoException) => void): unknown;\n}\n\n/**\n * `baker … | head` closes the pipe once it has its lines. Node reports the next\n * write as an unhandled EPIPE and prints a stack trace, which reads as a crash of\n * a command that did its job. A closed reader wants nothing more, so exit cleanly,\n * as Unix tools do; any other write error still surfaces.\n */\nexport function exitQuietlyOnClosedPipe(stream: ErrorSource, exit: (code: number) => void): void {\n stream.on(\"error\", (err) => {\n if (err.code === \"EPIPE\") {\n exit(0);\n return;\n }\n throw err;\n });\n}\n","/**\n * `--company <id>` on every command: the company the call reads, for the\n * organization workspace, whose Reports read every company of its organization.\n *\n * It is a header, not an argument of each command (`x-baker-company`, sent by\n * `client.ts`), so every read the CLI has works across companies unchanged, and\n * the backend alone decides what it opens: reads of a company of the same\n * organization, for the organization workspace's credential, and nothing else.\n *\n * A command that declares `--company` itself keeps its own meaning — on\n * `avatars research` it is the person's employer. A positional named `company`\n * (`accounts company acme.com`) is not a flag, so the flag stays the header.\n */\n\nimport { declaredArg } from \"./output-flag.ts\";\nimport { commandFor, type IntrospectableCommand } from \"./unknown-flags.ts\";\n\nconst FLAG = \"--company\";\n\n/** The command reads `--company` itself; a positional of that name is no flag, so it is not. */\nfunction ownsCompanyFlag(command: IntrospectableCommand): boolean {\n const own = declaredArg(command, \"company\");\n return own !== null && own.type !== \"positional\";\n}\n\n/**\n * `argv` without `--company`, and the company it named, when the addressed\n * command does not declare the option itself. Otherwise `argv` is returned\n * untouched with `company: null`, for the command or the guard to judge.\n */\nexport function takeCompanyFlag(\n root: IntrospectableCommand,\n argv: string[],\n): { argv: string[]; company: string | null } {\n const end = argv.indexOf(\"--\");\n const limit = end === -1 ? argv.length : end;\n for (let index = 0; index < limit; index++) {\n const token = argv[index] ?? \"\";\n let company: string | undefined;\n let width = 1;\n if (token.startsWith(`${FLAG}=`)) {\n company = token.slice(FLAG.length + 1).trim();\n } else if (token === FLAG) {\n const value = argv[index + 1];\n if (value === undefined || index + 1 >= limit || value.startsWith(\"-\")) {\n return { argv, company: null };\n }\n company = value.trim();\n width = 2;\n } else {\n continue;\n }\n const command = commandFor(root, argv);\n if (!company || !command || ownsCompanyFlag(command)) {\n return { argv, company: null };\n }\n return { argv: [...argv.slice(0, index), ...argv.slice(index + width)], company };\n }\n return { argv, company: null };\n}\n","/**\n * `--full` on every command that prints the JSON envelope.\n *\n * The conventions doc tells the agent that reads are compact and `--full` gives\n * the complete record, and the families that have a compact view declare it\n * (`ads meta ads|adsets|campaigns`, `images`, `winning-ads`, …). Everywhere\n * else the unknown-option guard (`unknown-flags.ts`) refused it, although those\n * commands already print everything they return: `ads meta creatives` loops,\n * `actions get`, `posts list` and `tags list` each lost calls and a retry to a\n * flag that asked for what the command was about to print (BAKER-1412, -182).\n *\n * So a command that does not declare `--full` has it taken off the command line\n * here, and every envelope it prints says so in `hints` — a dropped flag the\n * caller cannot see would read as \"this is the full record\" on a list whose\n * rows are summaries. A command that declares `--full` keeps its own meaning;\n * one that prints no envelope is left to the guard, as with `--output json`.\n */\n\nimport { declaredArg, printsDataEnvelope } from \"./output-flag.ts\";\nimport { parsePrintedEnvelope, reprint, rewriteWrites, withHint } from \"./printed-envelope.ts\";\nimport { commandFor, commandPathOf, type IntrospectableCommand } from \"./unknown-flags.ts\";\n\nconst FLAG = \"--full\";\n\n/**\n * The command a call to `command` runs: a group with a `default` hands the call,\n * flags and all, to that subcommand (`creatives rules` runs `list`).\n */\nfunction commandThatRuns(command: IntrospectableCommand): IntrospectableCommand {\n const name = (command as { default?: unknown }).default;\n const subCommands = command.subCommands;\n const next =\n typeof name === \"string\" && subCommands && typeof subCommands === \"object\"\n ? (subCommands as Record<string, unknown>)[name]\n : undefined;\n return next && typeof next === \"object\" ? commandThatRuns(next as IntrospectableCommand) : command;\n}\n\n/**\n * `argv` without `--full`, and whether it was there, when the addressed command\n * prints the envelope and does not declare the option itself. Otherwise `argv`\n * is returned untouched, for the command or the guard to judge.\n */\nexport function takeFullFlag(root: IntrospectableCommand, argv: string[]): { argv: string[]; taken: boolean } {\n const end = argv.indexOf(\"--\");\n const limit = end === -1 ? argv.length : end;\n const taken = argv.flatMap((token, index) => (index < limit && token === FLAG ? [index] : []));\n if (taken.length === 0) {\n return { argv, taken: false };\n }\n const command = commandFor(root, argv);\n if (!command || declaredArg(commandThatRuns(command), \"full\") || !printsDataEnvelope(commandPathOf(root, argv))) {\n return { argv, taken: false };\n }\n return { argv: argv.filter((_, index) => !taken.includes(index)), taken: true };\n}\n\nfunction fullHint(commandPath: string): string {\n return (\n `--full changes nothing on \\`baker ${commandPath}\\`: it has no shorter view, so this is everything it returns. ` +\n \"Where its rows are summaries, read one record whole with the family's get or show command. Drop --full here.\"\n );\n}\n\n/**\n * The text a command printed, with a success envelope's `hints` saying `--full`\n * was taken and changed nothing; an error or a dry run comes back as printed,\n * and anything that is not an envelope (a readable view) is null.\n */\nexport function noteFullOnPrinted(text: string, commandPath: string): string | null {\n const envelope = parsePrintedEnvelope(text);\n if (envelope === null) {\n return null;\n }\n if (envelope.ok !== true || \"dryRun\" in envelope) {\n return text;\n }\n return reprint(text, withHint(envelope, fullHint(commandPath)));\n}\n\n/**\n * The note on the CLI's own stdout, and on stderr when the command printed no\n * envelope to carry it — a readable view such as `tags list` without `--json`.\n */\nexport function installFullNote(commandPath: string): void {\n const note = rewriteWrites(process.stdout, (text) => noteFullOnPrinted(text, commandPath));\n process.on(\"exit\", () => {\n if (!note.sawEnvelope()) {\n process.stderr.write(`${fullHint(commandPath)}\\n`);\n }\n });\n}\n","import { defineCommand } from \"citty\";\nimport { getCliVersion } from \"./version.ts\";\n\n// Every command is declared lazily and only the one being run is loaded\n// (`command-loading.ts`): loading all of them made each `baker` process hold\n// ~135 MB of heap while it waited on one request.\nexport const rootCommand = defineCommand({\n meta: {\n name: \"baker\",\n version: getCliVersion(),\n description: `AI-agent CLI for finding and managing images, videos, social posts, avatars, testimonials, action items, scheduled agents, marketing tags, Tag Manager containers, account history, credentials, and ad platform data in Baker.\n\nAuth: Set BAKER_API_KEY (starts with bk_) and BAKER_API_URL environment variables.\nChat: Set BAKER_CHAT_ID for action and scheduled-agent commands that stage changes against a chat.\nOutput: All commands return JSON envelopes: { ok: true, data: ... } or { ok: false, error: { code, message } }.\nFields: --fields a,b,c keeps only those keys of each record in data, on every command that prints the envelope.\nFull: --full returns the complete record where a command has a compact view; elsewhere it is accepted and changes nothing (a hint says so), except on 'canvas run' and 'canvas rerun', which refuse it.\nCompany: --company <id> runs a read against another company of the organization (organization workspace only; ids from 'baker organization companies').\nFormats: --output json works on every command that prints the envelope. --output md|files only where 'baker schema <command>' lists output. (The research commands additionally accept csv and jsonl.)\nIntrospection: Run 'baker schema <command>' to inspect argument schemas.`,\n },\n subCommands: {\n capabilities: () => import(\"./commands/capabilities/index.ts\").then((m) => m.capabilitiesCommand),\n actions: () => import(\"./commands/actions/index.ts\").then((m) => m.actionsCommand),\n \"scheduled-agents\": () => import(\"./commands/scheduled-agents/index.ts\").then((m) => m.scheduledAgentsCommand),\n ads: () => import(\"./commands/ads/index.ts\").then((m) => m.adsCommand),\n brand: () => import(\"./commands/brand/index.ts\").then((m) => m.brandCommand),\n analytics: () => import(\"./commands/analytics/index.ts\").then((m) => m.analyticsCommand),\n experiment: () => import(\"./commands/experiment/index.ts\").then((m) => m.experimentCommand),\n ga4: () => import(\"./commands/ga4/index.ts\").then((m) => m.ga4Command),\n gsc: () => import(\"./commands/gsc/index.ts\").then((m) => m.gscCommand),\n research: () => import(\"./commands/research/index.ts\").then((m) => m.researchCommand),\n decide: () => import(\"./commands/decide/index.ts\").then((m) => m.decideCommand),\n creatives: () => import(\"./commands/creatives/index.ts\").then((m) => m.creativesCommand),\n flows: () => import(\"./commands/flows/index.ts\").then((m) => m.flowsCommand),\n funnel: () => import(\"./commands/funnel/index.ts\").then((m) => m.funnelCommand),\n images: () => import(\"./commands/images/index.ts\").then((m) => m.imagesCommand),\n studio: () => import(\"./commands/studio/index.ts\").then((m) => m.studioCommand),\n avatars: () => import(\"./commands/avatars/index.ts\").then((m) => m.avatarsCommand),\n landing: () => import(\"./commands/landing/index.ts\").then((m) => m.landingCommand),\n videos: () => import(\"./commands/videos/index.ts\").then((m) => m.videosCommand),\n testimonials: () => import(\"./commands/testimonials/index.ts\").then((m) => m.testimonialsCommand),\n canvas: () => import(\"./commands/canvas/index.ts\").then((m) => m.canvasCommand),\n tags: () => import(\"./commands/tags/index.ts\").then((m) => m.tagsCommand),\n \"tag-manager\": () => import(\"./commands/tag-manager/index.ts\").then((m) => m.tagManagerCommand),\n chats: () => import(\"./commands/chats/index.ts\").then((m) => m.chatsCommand),\n history: () => import(\"./commands/history/index.ts\").then((m) => m.historyCommand),\n credentials: () => import(\"./commands/credentials/index.ts\").then((m) => m.credentialsCommand),\n hubspot: () => import(\"./commands/hubspot/index.ts\").then((m) => m.hubspotCommand),\n activecampaign: () => import(\"./commands/activecampaign/index.ts\").then((m) => m.activecampaignCommand),\n accounts: () => import(\"./commands/accounts/index.ts\").then((m) => m.accountsCommand),\n shopify: () => import(\"./commands/shopify/index.ts\").then((m) => m.shopifyCommand),\n \"winning-ads\": () => import(\"./commands/winning-ads/index.ts\").then((m) => m.winningAdsCommand),\n \"media-sources\": () => import(\"./commands/media-sources/index.ts\").then((m) => m.mediaSourcesCommand),\n posts: () => import(\"./commands/posts/index.ts\").then((m) => m.postsCommand),\n site: () => import(\"./commands/site/index.ts\").then((m) => m.siteCommand),\n mcp: () => import(\"./commands/mcp/index.ts\").then((m) => m.mcpCommand),\n \"setup-links\": () => import(\"./commands/setup-links/index.ts\").then((m) => m.setupLinksCommand),\n organization: () => import(\"./commands/organization/index.ts\").then((m) => m.organizationCommand),\n schema: () => import(\"./commands/schema.ts\").then((m) => m.schemaCommand),\n },\n});\n","import { readFileSync } from \"node:fs\";\n\nfunction packageJsonUrl(): URL {\n return new URL(\"../package.json\", import.meta.url);\n}\n\nfunction parsePackageVersion(raw: string): string {\n const parsed: unknown = JSON.parse(raw);\n if (\n typeof parsed === \"object\" &&\n parsed !== null &&\n \"version\" in parsed &&\n typeof parsed.version === \"string\" &&\n parsed.version.length > 0\n ) {\n return parsed.version;\n }\n throw new Error(\"Invalid CLI package.json: missing version\");\n}\n\nexport function getCliVersion(): string {\n return parsePackageVersion(readFileSync(packageJsonUrl(), \"utf8\"));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,YAAY,eAAe;;;ACS7B,SAAS,wBAAwB,QAAqB,MAAoC;AAC/F,SAAO,GAAG,SAAS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AY,IAAI;AAChE,mBAAiB,YAAY,OAAO;AACtC;AAKA,IAAM,iBAAiB,MAAM,kBAAkB,MAAM,aAAa,GAAG,QAAQ,KAAK,MAAM,CAAC,CAAC;AAC1F,IAAI,gBAAgB;AAClB,YAAU,EAAE,IAAI,OAAO,OAAO,EAAE,MAAM,aAAa,SAAS,eAAe,EAAE,CAAC;AAC9E,UAAQ,KAAK,CAAC;AAChB;AAIA,QAAQ,OAAO,CAAC,GAAG,QAAQ,KAAK,MAAM,GAAG,CAAC,GAAG,GAAG,oBAAoB,MAAM,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC;AAEhG,mBAAmB,MAAM,QAAQ,KAAK,MAAM,CAAC,GAAG,SAAS;AACzD,uBAAuB,MAAM,QAAQ,KAAK,MAAM,CAAC,CAAC;AAKlD,QAAQ,OAAO,CAAC,GAAG,QAAQ,KAAK,MAAM,GAAG,CAAC,GAAG,GAAG,mBAAmB,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC;AAMzF,IAAM,UAAU,QAAQ,KAAK,MAAM,CAAC;AACpC,IACE,QAAQ,KAAK,CAAC,QAAQ,QAAQ,YAAY,QAAQ,IAAI,KACrD,QAAQ,WAAW,KAAK,mBAAmB,KAAK,QAAQ,CAAC,KAAK,EAAE,GACjE;AACA,UAAQ,IAAI;AACd,OAAO;AACL,MAAI;AACF,UAAM,WAAW,MAAM,EAAE,QAAQ,CAAC;AAAA,EACpC,SAAS,OAAO;AACd,UAAM,UAAU,qBAAqB,OAAO,MAAM,OAAO;AACzD,QAAI,SAAS;AACX,gBAAU,OAAO;AAAA,IACnB,OAAO;AACL,cAAQ,MAAM,OAAO,IAAI;AAAA,IAC3B;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":["FLAG"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../src/closed-pipe.ts","../src/company-flag.ts","../src/full-flag.ts","../src/help-output.ts","../src/root-command.ts","../src/version.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { runCommand, runMain } from \"citty\";\nimport { agentProfile, applyAgentProfile } from \"./agent-profile.ts\";\nimport { cacheFlagForCommand, cacheFlagForParser, normalizeCacheFlag } from \"./cache-flag.ts\";\nimport { exitQuietlyOnClosedPipe } from \"./closed-pipe.ts\";\nimport { loadCommands } from \"./command-loading.ts\";\nimport { takeCompanyFlag } from \"./company-flag.ts\";\nimport { installExitRecord, installStreamTaps, logInvocation } from \"./debugLog.ts\";\nimport { setTargetCompany } from \"./env.ts\";\nimport { installFieldMask, takeFieldsFlag } from \"./field-mask.ts\";\nimport { installFullNote, takeFullFlag } from \"./full-flag.ts\";\nimport { printHelpTo } from \"./help-output.ts\";\nimport { writeJson } from \"./output.ts\";\nimport { asksForEnvelopeAlone, envelopeAloneOnStdout, outputFlagForCommand } from \"./output-flag.ts\";\nimport { rootCommand } from \"./root-command.ts\";\nimport { registerCommandTree } from \"./schemas.ts\";\nimport { commandPathOf, parseRefusalEnvelope, refuseStrayPositionals, refuseUnknownFlags } from \"./unknown-flags.ts\";\n\nconst main = rootCommand;\n// The call as typed, before the rewrites below: a refusal's corrected call is built from it.\nconst typedArgv = process.argv.slice(2);\n\nawait loadCommands(main, process.argv.slice(2));\nregisterCommandTree(main);\n\nexitQuietlyOnClosedPipe(process.stdout, (code) => process.exit(code));\n\n// The legacy `--skip-cache` spelling becomes `--no-cache` before anything reads\n// argv — citty parses `process.argv` itself, so the rewrite has to land there.\nprocess.argv = [...process.argv.slice(0, 2), ...normalizeCacheFlag(process.argv.slice(2))];\n\n// When BAKER_DEBUG_LOG is set, mirror all output and record the invocation\n// before any command runs. No-op otherwise.\ninstallStreamTaps();\nlogInvocation(process.argv.slice(2));\ninstallExitRecord();\n\n// `--output json` asks for the envelope, which almost every command prints\n// without declaring the option — translated here so the guard below does not\n// refuse a flag that asked for what the command was about to print.\n// `canvas run` prints progress before its envelope: asked for the envelope, it\n// prints that alone on stdout and the progress on stderr.\nif (asksForEnvelopeAlone(main, process.argv.slice(2))) {\n envelopeAloneOnStdout(process.stdout, process.stderr);\n}\nprocess.argv = [...process.argv.slice(0, 2), ...outputFlagForCommand(main, process.argv.slice(2))];\n\n// `--fields` narrows the envelope on every command that prints one; where the\n// command does not declare it, it is applied to what the command prints.\nconst fieldsFlag = takeFieldsFlag(main, process.argv.slice(2));\nif (fieldsFlag.fields) {\n process.argv = [...process.argv.slice(0, 2), ...fieldsFlag.argv];\n installFieldMask(fieldsFlag.fields, commandPathOf(main, fieldsFlag.argv));\n}\n\n// `--full` on a command with no shorter view asks for what it already prints:\n// taken off here, and said back in the envelope's hints.\nconst fullFlag = takeFullFlag(main, process.argv.slice(2));\nif (fullFlag.taken) {\n process.argv = [...process.argv.slice(0, 2), ...fullFlag.argv];\n installFullNote(commandPathOf(main, fullFlag.argv));\n}\n\n// `--company <id>` names the company a read is about (the organization\n// workspace's Reports read every company of its organization). It travels as a\n// header on every request, so it is taken off here, before the guard.\nconst companyFlag = takeCompanyFlag(main, process.argv.slice(2));\nif (companyFlag.company) {\n process.argv = [...process.argv.slice(0, 2), ...companyFlag.argv];\n setTargetCompany(companyFlag.company);\n}\n\n// What this agent is offered: the organization workspace's agent only reads\n// (`agent-profile.ts`). Here, after `--company` is taken off, so the command it\n// judges is the one typed.\nconst profileRefusal = await applyAgentProfile(main, agentProfile(), process.argv.slice(2));\nif (profileRefusal) {\n writeJson({ ok: false, error: { code: \"FORBIDDEN\", message: profileRefusal } });\n process.exit(1);\n}\n\n// A report's Refresh appends `--no-cache` to every read; a command with no cache\n// already reads fresh, so it is dropped there rather than refused.\nprocess.argv = [...process.argv.slice(0, 2), ...cacheFlagForCommand(main, process.argv.slice(2))];\n\nrefuseUnknownFlags(main, process.argv.slice(2), typedArgv);\nrefuseStrayPositionals(main, process.argv.slice(2));\n\n// Last, so the guard above quotes back the spelling the caller typed: citty\n// resolves a bare `--no-cache` to `cache: false` instead of filling the declared\n// `no-cache` arg, and only the camelCase spelling survives its parser intact.\nprocess.argv = [...process.argv.slice(0, 2), ...cacheFlagForParser(process.argv.slice(2))];\n\n// `--help` and `--version` stay citty's own, the help rendered for an agent\n// reading it (`help-output.ts`). Everything else runs here rather\n// than through `runMain`, whose refusal of a missing argument or an unknown\n// subcommand is usage text on stderr and nothing on stdout: that becomes the\n// envelope every other failure prints.\nconst rawArgs = process.argv.slice(2);\nif (\n rawArgs.some((arg) => arg === \"--help\" || arg === \"-h\") ||\n (rawArgs.length === 1 && /^(--version|-v)$/.test(rawArgs[0] ?? \"\"))\n) {\n runMain(main, { showUsage: printHelpTo(process.stdout) });\n} else {\n try {\n await runCommand(main, { rawArgs });\n } catch (error) {\n const refusal = parseRefusalEnvelope(error, main, rawArgs);\n if (refusal) {\n writeJson(refusal);\n } else {\n console.error(error, \"\\n\");\n }\n process.exit(1);\n }\n}\n","interface ErrorSource {\n on(event: \"error\", listener: (err: NodeJS.ErrnoException) => void): unknown;\n}\n\n/**\n * `baker … | head` closes the pipe once it has its lines. Node reports the next\n * write as an unhandled EPIPE and prints a stack trace, which reads as a crash of\n * a command that did its job. A closed reader wants nothing more, so exit cleanly,\n * as Unix tools do; any other write error still surfaces.\n */\nexport function exitQuietlyOnClosedPipe(stream: ErrorSource, exit: (code: number) => void): void {\n stream.on(\"error\", (err) => {\n if (err.code === \"EPIPE\") {\n exit(0);\n return;\n }\n throw err;\n });\n}\n","/**\n * `--company <id>` on every command: the company the call reads, for the\n * organization workspace, whose Reports read every company of its organization.\n *\n * It is a header, not an argument of each command (`x-baker-company`, sent by\n * `client.ts`), so every read the CLI has works across companies unchanged, and\n * the backend alone decides what it opens: reads of a company of the same\n * organization, for the organization workspace's credential, and nothing else.\n *\n * A command that declares `--company` itself keeps its own meaning — on\n * `avatars research` it is the person's employer. A positional named `company`\n * (`accounts company acme.com`) is not a flag, so the flag stays the header.\n */\n\nimport { declaredArg } from \"./output-flag.ts\";\nimport { commandFor, type IntrospectableCommand } from \"./unknown-flags.ts\";\n\nconst FLAG = \"--company\";\n\n/** The command reads `--company` itself; a positional of that name is no flag, so it is not. */\nfunction ownsCompanyFlag(command: IntrospectableCommand): boolean {\n const own = declaredArg(command, \"company\");\n return own !== null && own.type !== \"positional\";\n}\n\n/**\n * `argv` without `--company`, and the company it named, when the addressed\n * command does not declare the option itself. Otherwise `argv` is returned\n * untouched with `company: null`, for the command or the guard to judge.\n */\nexport function takeCompanyFlag(\n root: IntrospectableCommand,\n argv: string[],\n): { argv: string[]; company: string | null } {\n const end = argv.indexOf(\"--\");\n const limit = end === -1 ? argv.length : end;\n for (let index = 0; index < limit; index++) {\n const token = argv[index] ?? \"\";\n let company: string | undefined;\n let width = 1;\n if (token.startsWith(`${FLAG}=`)) {\n company = token.slice(FLAG.length + 1).trim();\n } else if (token === FLAG) {\n const value = argv[index + 1];\n if (value === undefined || index + 1 >= limit || value.startsWith(\"-\")) {\n return { argv, company: null };\n }\n company = value.trim();\n width = 2;\n } else {\n continue;\n }\n const command = commandFor(root, argv);\n if (!company || !command || ownsCompanyFlag(command)) {\n return { argv, company: null };\n }\n return { argv: [...argv.slice(0, index), ...argv.slice(index + width)], company };\n }\n return { argv, company: null };\n}\n","/**\n * `--full` on every command that prints the JSON envelope.\n *\n * The conventions doc tells the agent that reads are compact and `--full` gives\n * the complete record, and the families that have a compact view declare it\n * (`ads meta ads|adsets|campaigns`, `images`, `winning-ads`, …). Everywhere\n * else the unknown-option guard (`unknown-flags.ts`) refused it, although those\n * commands already print everything they return: `ads meta creatives` loops,\n * `actions get`, `posts list` and `tags list` each lost calls and a retry to a\n * flag that asked for what the command was about to print (BAKER-1412, -182).\n *\n * So a command that does not declare `--full` has it taken off the command line\n * here, and every envelope it prints says so in `hints` — a dropped flag the\n * caller cannot see would read as \"this is the full record\" on a list whose\n * rows are summaries. A command that declares `--full` keeps its own meaning;\n * one that prints no envelope is left to the guard, as with `--output json`.\n */\n\nimport { declaredArg, printsDataEnvelope } from \"./output-flag.ts\";\nimport { parsePrintedEnvelope, reprint, rewriteWrites, withHint } from \"./printed-envelope.ts\";\nimport { commandFor, commandPathOf, type IntrospectableCommand } from \"./unknown-flags.ts\";\n\nconst FLAG = \"--full\";\n\n/**\n * The command a call to `command` runs: a group with a `default` hands the call,\n * flags and all, to that subcommand (`creatives rules` runs `list`).\n */\nfunction commandThatRuns(command: IntrospectableCommand): IntrospectableCommand {\n const name = (command as { default?: unknown }).default;\n const subCommands = command.subCommands;\n const next =\n typeof name === \"string\" && subCommands && typeof subCommands === \"object\"\n ? (subCommands as Record<string, unknown>)[name]\n : undefined;\n return next && typeof next === \"object\" ? commandThatRuns(next as IntrospectableCommand) : command;\n}\n\n/**\n * `argv` without `--full`, and whether it was there, when the addressed command\n * prints the envelope and does not declare the option itself. Otherwise `argv`\n * is returned untouched, for the command or the guard to judge.\n */\nexport function takeFullFlag(root: IntrospectableCommand, argv: string[]): { argv: string[]; taken: boolean } {\n const end = argv.indexOf(\"--\");\n const limit = end === -1 ? argv.length : end;\n const taken = argv.flatMap((token, index) => (index < limit && token === FLAG ? [index] : []));\n if (taken.length === 0) {\n return { argv, taken: false };\n }\n const command = commandFor(root, argv);\n if (!command || declaredArg(commandThatRuns(command), \"full\") || !printsDataEnvelope(commandPathOf(root, argv))) {\n return { argv, taken: false };\n }\n return { argv: argv.filter((_, index) => !taken.includes(index)), taken: true };\n}\n\nfunction fullHint(commandPath: string): string {\n return (\n `--full changes nothing on \\`baker ${commandPath}\\`: it has no shorter view, so this is everything it returns. ` +\n \"Where its rows are summaries, read one record whole with the family's get or show command. Drop --full here.\"\n );\n}\n\n/**\n * The text a command printed, with a success envelope's `hints` saying `--full`\n * was taken and changed nothing; an error or a dry run comes back as printed,\n * and anything that is not an envelope (a readable view) is null.\n */\nexport function noteFullOnPrinted(text: string, commandPath: string): string | null {\n const envelope = parsePrintedEnvelope(text);\n if (envelope === null) {\n return null;\n }\n if (envelope.ok !== true || \"dryRun\" in envelope) {\n return text;\n }\n return reprint(text, withHint(envelope, fullHint(commandPath)));\n}\n\n/**\n * The note on the CLI's own stdout, and on stderr when the command printed no\n * envelope to carry it — a readable view such as `tags list` without `--json`.\n */\nexport function installFullNote(commandPath: string): void {\n const note = rewriteWrites(process.stdout, (text) => noteFullOnPrinted(text, commandPath));\n process.on(\"exit\", () => {\n if (!note.sawEnvelope()) {\n process.stderr.write(`${fullHint(commandPath)}\\n`);\n }\n });\n}\n","/**\n * What `--help` prints, for an agent that reads every byte of it.\n *\n * citty's renderer pads each table column to its widest cell, so one\n * paragraph-long description pads every other row of its table with thousands\n * of spaces (`baker analytics --help` printed 163 KB, 80% of it padding). And it\n * lists each subcommand with its whole description, so a family's help repeats\n * every command's own help. Here a COMMANDS row carries the first sentence (the\n * rest is one `--help` away), and no line ends in padding.\n */\n\nimport { type ArgsDef, type CommandDef, type CommandMeta, type Resolvable, renderUsage } from \"citty\";\n\nconst sentences = new Intl.Segmenter(\"en\", { granularity: \"sentence\" });\n/** ICU's sentence rules end a sentence at these; none of them ends one here. */\nconst abbreviation = /\\b(?:e\\.g|i\\.e|vs|etc)\\.$/i;\n\nfunction resolved<T>(value: Resolvable<T>): Promise<T> {\n return Promise.resolve(typeof value === \"function\" ? (value as () => T | Promise<T>)() : value);\n}\n\n/**\n * The description's first sentence. A line wrapped by hand continues on the\n * next one; a blank line, an indented example or a list item ends the prose.\n */\nfunction firstSentence(description: string): string {\n const [first = \"\", ...rest] = description.trim().split(\"\\n\");\n let prose = first.trim();\n for (const line of rest) {\n if (/[.:!?]$/.test(prose) || line.trim() === \"\" || /^(\\s|[-*•])/.test(line)) break;\n prose += ` ${line.trim()}`;\n }\n let sentence = \"\";\n for (const { segment } of sentences.segment(prose)) {\n sentence += segment;\n if (!abbreviation.test(sentence.trim())) break;\n }\n return (sentence || prose).trim();\n}\n\nasync function summarized(cmd: CommandDef<ArgsDef>): Promise<CommandDef<ArgsDef>> {\n if (!cmd.subCommands) return cmd;\n const subCommands = await resolved(cmd.subCommands);\n const listed: Record<string, CommandDef<ArgsDef>> = {};\n for (const [name, sub] of Object.entries(subCommands)) {\n const command: CommandDef<ArgsDef> = await resolved(sub);\n const meta: CommandMeta = (command.meta ? await resolved(command.meta) : undefined) ?? {};\n listed[name] = { meta: meta.description ? { ...meta, description: firstSentence(meta.description) } : meta };\n }\n return { ...cmd, subCommands: listed };\n}\n\nexport async function renderHelp<T extends ArgsDef>(cmd: CommandDef<T>, parent?: CommandDef<T>): Promise<string> {\n const usage = await renderUsage(await summarized(cmd as CommandDef<ArgsDef>), parent as CommandDef<ArgsDef>);\n return usage\n .split(\"\\n\")\n .map((line) => line.trimEnd())\n .join(\"\\n\");\n}\n\ntype HelpSink = { write(chunk: string, done: () => void): unknown };\n\n/**\n * citty's `runMain` exits as soon as the help is printed. Piped, stdout writes\n * asynchronously, so an exit then cut the help at whatever had been flushed\n * (`baker --help | wc -c` read 65,536). This resolves once the write is done.\n */\nexport function printHelpTo(stdout: HelpSink) {\n return async <T extends ArgsDef>(cmd: CommandDef<T>, parent?: CommandDef<T>): Promise<void> => {\n const help = await renderHelp(cmd, parent);\n await new Promise<void>((done) => stdout.write(`${help}\\n`, done));\n };\n}\n","import { defineCommand } from \"citty\";\nimport { getCliVersion } from \"./version.ts\";\n\n// Every command is declared lazily and only the one being run is loaded\n// (`command-loading.ts`): loading all of them made each `baker` process hold\n// ~135 MB of heap while it waited on one request.\nexport const rootCommand = defineCommand({\n meta: {\n name: \"baker\",\n version: getCliVersion(),\n description: `AI-agent CLI for finding and managing images, videos, social posts, avatars, testimonials, action items, scheduled agents, marketing tags, Tag Manager containers, account history, credentials, and ad platform data in Baker.\n\nAuth: Set BAKER_API_KEY (starts with bk_) and BAKER_API_URL environment variables.\nChat: Set BAKER_CHAT_ID for action and scheduled-agent commands that stage changes against a chat.\nOutput: All commands return JSON envelopes: { ok: true, data: ... } or { ok: false, error: { code, message } }.\nFields: --fields a,b,c keeps only those keys of each record in data, on every command that prints the envelope.\nFull: --full returns the complete record where a command has a compact view; elsewhere it is accepted and changes nothing (a hint says so), except on 'canvas run' and 'canvas rerun', which refuse it.\nCompany: --company <id> runs a read against another company of the organization (organization workspace only; ids from 'baker organization companies').\nFormats: --output json works on every command that prints the envelope. --output md|files only where 'baker schema <command>' lists output. (The research commands additionally accept csv and jsonl.)\nIntrospection: Run 'baker schema <command>' to inspect argument schemas.`,\n },\n subCommands: {\n capabilities: () => import(\"./commands/capabilities/index.ts\").then((m) => m.capabilitiesCommand),\n actions: () => import(\"./commands/actions/index.ts\").then((m) => m.actionsCommand),\n \"scheduled-agents\": () => import(\"./commands/scheduled-agents/index.ts\").then((m) => m.scheduledAgentsCommand),\n ads: () => import(\"./commands/ads/index.ts\").then((m) => m.adsCommand),\n brand: () => import(\"./commands/brand/index.ts\").then((m) => m.brandCommand),\n analytics: () => import(\"./commands/analytics/index.ts\").then((m) => m.analyticsCommand),\n experiment: () => import(\"./commands/experiment/index.ts\").then((m) => m.experimentCommand),\n ga4: () => import(\"./commands/ga4/index.ts\").then((m) => m.ga4Command),\n gsc: () => import(\"./commands/gsc/index.ts\").then((m) => m.gscCommand),\n research: () => import(\"./commands/research/index.ts\").then((m) => m.researchCommand),\n decide: () => import(\"./commands/decide/index.ts\").then((m) => m.decideCommand),\n creatives: () => import(\"./commands/creatives/index.ts\").then((m) => m.creativesCommand),\n flows: () => import(\"./commands/flows/index.ts\").then((m) => m.flowsCommand),\n funnel: () => import(\"./commands/funnel/index.ts\").then((m) => m.funnelCommand),\n images: () => import(\"./commands/images/index.ts\").then((m) => m.imagesCommand),\n studio: () => import(\"./commands/studio/index.ts\").then((m) => m.studioCommand),\n avatars: () => import(\"./commands/avatars/index.ts\").then((m) => m.avatarsCommand),\n landing: () => import(\"./commands/landing/index.ts\").then((m) => m.landingCommand),\n videos: () => import(\"./commands/videos/index.ts\").then((m) => m.videosCommand),\n testimonials: () => import(\"./commands/testimonials/index.ts\").then((m) => m.testimonialsCommand),\n canvas: () => import(\"./commands/canvas/index.ts\").then((m) => m.canvasCommand),\n tags: () => import(\"./commands/tags/index.ts\").then((m) => m.tagsCommand),\n \"tag-manager\": () => import(\"./commands/tag-manager/index.ts\").then((m) => m.tagManagerCommand),\n chats: () => import(\"./commands/chats/index.ts\").then((m) => m.chatsCommand),\n history: () => import(\"./commands/history/index.ts\").then((m) => m.historyCommand),\n credentials: () => import(\"./commands/credentials/index.ts\").then((m) => m.credentialsCommand),\n hubspot: () => import(\"./commands/hubspot/index.ts\").then((m) => m.hubspotCommand),\n activecampaign: () => import(\"./commands/activecampaign/index.ts\").then((m) => m.activecampaignCommand),\n accounts: () => import(\"./commands/accounts/index.ts\").then((m) => m.accountsCommand),\n shopify: () => import(\"./commands/shopify/index.ts\").then((m) => m.shopifyCommand),\n \"winning-ads\": () => import(\"./commands/winning-ads/index.ts\").then((m) => m.winningAdsCommand),\n \"media-sources\": () => import(\"./commands/media-sources/index.ts\").then((m) => m.mediaSourcesCommand),\n posts: () => import(\"./commands/posts/index.ts\").then((m) => m.postsCommand),\n site: () => import(\"./commands/site/index.ts\").then((m) => m.siteCommand),\n mcp: () => import(\"./commands/mcp/index.ts\").then((m) => m.mcpCommand),\n \"setup-links\": () => import(\"./commands/setup-links/index.ts\").then((m) => m.setupLinksCommand),\n organization: () => import(\"./commands/organization/index.ts\").then((m) => m.organizationCommand),\n schema: () => import(\"./commands/schema.ts\").then((m) => m.schemaCommand),\n },\n});\n","import { readFileSync } from \"node:fs\";\n\nfunction packageJsonUrl(): URL {\n return new URL(\"../package.json\", import.meta.url);\n}\n\nfunction parsePackageVersion(raw: string): string {\n const parsed: unknown = JSON.parse(raw);\n if (\n typeof parsed === \"object\" &&\n parsed !== null &&\n \"version\" in parsed &&\n typeof parsed.version === \"string\" &&\n parsed.version.length > 0\n ) {\n return parsed.version;\n }\n throw new Error(\"Invalid CLI package.json: missing version\");\n}\n\nexport function getCliVersion(): string {\n return parsePackageVersion(readFileSync(packageJsonUrl(), \"utf8\"));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,YAAY,eAAe;;;ACS7B,SAAS,wBAA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AAC1D,OAAO;AACL,MAAI;AACF,UAAM,WAAW,MAAM,EAAE,QAAQ,CAAC;AAAA,EACpC,SAAS,OAAO;AACd,UAAM,UAAU,qBAAqB,OAAO,MAAM,OAAO;AACzD,QAAI,SAAS;AACX,gBAAU,OAAO;AAAA,IACnB,OAAO;AACL,cAAQ,MAAM,OAAO,IAAI;AAAA,IAC3B;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":["FLAG"]}
|
|
@@ -2257,6 +2257,7 @@ function compactEntityRow(row) {
|
|
|
2257
2257
|
budgetDaily: row.budgetDaily === null ? null : roundNumber(row.budgetDaily),
|
|
2258
2258
|
budgetLifetime: row.budgetLifetime === null ? null : roundNumber(row.budgetLifetime)
|
|
2259
2259
|
}),
|
|
2260
|
+
...compactServing(row.serving),
|
|
2260
2261
|
metrics: compactMetrics(row.metrics),
|
|
2261
2262
|
ratios: compactRatios(row.ratios),
|
|
2262
2263
|
...entityPath(row) ? { path: entityPath(row) } : {},
|
|
@@ -2267,6 +2268,14 @@ function compactEntityRow(row) {
|
|
|
2267
2268
|
...compactSearchParts(row)
|
|
2268
2269
|
};
|
|
2269
2270
|
}
|
|
2271
|
+
function compactServing(serving) {
|
|
2272
|
+
if (!serving) return {};
|
|
2273
|
+
const { children } = serving;
|
|
2274
|
+
return {
|
|
2275
|
+
serving: serving.state,
|
|
2276
|
+
...children ? { below: { level: children.level, total: children.total, on: children.active, live: children.live } } : {}
|
|
2277
|
+
};
|
|
2278
|
+
}
|
|
2270
2279
|
function compactSearchParts(row) {
|
|
2271
2280
|
return {
|
|
2272
2281
|
...dropEmpty({ campaignKind: row.campaignKind, segment: row.segment }),
|
|
@@ -5302,7 +5311,7 @@ var overviewCommand = report({
|
|
|
5302
5311
|
var entitiesCommand = report({
|
|
5303
5312
|
name: "entities",
|
|
5304
5313
|
schemaName: "entities",
|
|
5305
|
-
schemaDescription: `Campaigns, ad groups / ad sets, ads or keywords across platforms, ranked (default by spend), with metrics, budget, first delivery (beforeHistory: it ran before the stored history starts) and peer shares against its parent. Paged with --limit/--offset; totalRows counts every match. ${STORE_NOTE}`,
|
|
5314
|
+
schemaDescription: `Campaigns, ad groups / ad sets, ads or keywords across platforms, ranked (default by spend), with metrics, budget, first delivery (beforeHistory: it ran before the stored history starts) and peer shares against its parent. status is its own switch; serving says whether it really delivers given its parents and children (campaign_off, ad_group_off, off, no_children, children_off) and below counts a campaign's or ad set's children (on, live). Paged with --limit/--offset; totalRows counts every match. ${STORE_NOTE}`,
|
|
5306
5315
|
help: "Campaigns, ad groups, ads or keywords ranked. Example: baker ads performance entities --level ad --sort cost_per_result --order asc",
|
|
5307
5316
|
path: "entities",
|
|
5308
5317
|
args: ENTITIES_ARGS,
|
|
@@ -5553,4 +5562,4 @@ Full guide: __tooling__/docs/tools/baker/ads-performance.md`
|
|
|
5553
5562
|
export {
|
|
5554
5563
|
performanceCommand
|
|
5555
5564
|
};
|
|
5556
|
-
//# sourceMappingURL=performance-
|
|
5565
|
+
//# sourceMappingURL=performance-6XFKDJGY.js.map
|