@koda-sl/baker-cli 0.25.0-dev.f89d9a60 → 0.26.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.
Files changed (74) hide show
  1. package/README.md +96 -0
  2. package/dist/cli.js +1 -1
  3. package/dist/commands/ads/index.d.ts.map +1 -1
  4. package/dist/commands/ads/index.js +7 -1
  5. package/dist/commands/ads/index.js.map +1 -1
  6. package/dist/commands/ads/meta/account.d.ts +11 -0
  7. package/dist/commands/ads/meta/account.d.ts.map +1 -0
  8. package/dist/commands/ads/meta/account.js +32 -0
  9. package/dist/commands/ads/meta/account.js.map +1 -0
  10. package/dist/commands/ads/meta/accounts.d.ts +20 -0
  11. package/dist/commands/ads/meta/accounts.d.ts.map +1 -0
  12. package/dist/commands/ads/meta/accounts.js +55 -0
  13. package/dist/commands/ads/meta/accounts.js.map +1 -0
  14. package/dist/commands/ads/meta/activities.d.ts +24 -0
  15. package/dist/commands/ads/meta/activities.d.ts.map +1 -0
  16. package/dist/commands/ads/meta/activities.js +44 -0
  17. package/dist/commands/ads/meta/activities.js.map +1 -0
  18. package/dist/commands/ads/meta/ads.d.ts +36 -0
  19. package/dist/commands/ads/meta/ads.d.ts.map +1 -0
  20. package/dist/commands/ads/meta/ads.js +57 -0
  21. package/dist/commands/ads/meta/ads.js.map +1 -0
  22. package/dist/commands/ads/meta/adsets.d.ts +32 -0
  23. package/dist/commands/ads/meta/adsets.d.ts.map +1 -0
  24. package/dist/commands/ads/meta/adsets.js +50 -0
  25. package/dist/commands/ads/meta/adsets.js.map +1 -0
  26. package/dist/commands/ads/meta/audiences.d.ts +20 -0
  27. package/dist/commands/ads/meta/audiences.d.ts.map +1 -0
  28. package/dist/commands/ads/meta/audiences.js +41 -0
  29. package/dist/commands/ads/meta/audiences.js.map +1 -0
  30. package/dist/commands/ads/meta/businesses.d.ts +12 -0
  31. package/dist/commands/ads/meta/businesses.d.ts.map +1 -0
  32. package/dist/commands/ads/meta/businesses.js +35 -0
  33. package/dist/commands/ads/meta/businesses.js.map +1 -0
  34. package/dist/commands/ads/meta/campaigns.d.ts +28 -0
  35. package/dist/commands/ads/meta/campaigns.d.ts.map +1 -0
  36. package/dist/commands/ads/meta/campaigns.js +51 -0
  37. package/dist/commands/ads/meta/campaigns.js.map +1 -0
  38. package/dist/commands/ads/meta/creatives.d.ts +24 -0
  39. package/dist/commands/ads/meta/creatives.d.ts.map +1 -0
  40. package/dist/commands/ads/meta/creatives.js +51 -0
  41. package/dist/commands/ads/meta/creatives.js.map +1 -0
  42. package/dist/commands/ads/meta/index.d.ts +17 -0
  43. package/dist/commands/ads/meta/index.d.ts.map +1 -0
  44. package/dist/commands/ads/meta/index.js +79 -0
  45. package/dist/commands/ads/meta/index.js.map +1 -0
  46. package/dist/commands/ads/meta/insights.d.ts +92 -0
  47. package/dist/commands/ads/meta/insights.d.ts.map +1 -0
  48. package/dist/commands/ads/meta/insights.js +260 -0
  49. package/dist/commands/ads/meta/insights.js.map +1 -0
  50. package/dist/commands/ads/meta/pixels.d.ts +33 -0
  51. package/dist/commands/ads/meta/pixels.d.ts.map +1 -0
  52. package/dist/commands/ads/meta/pixels.js +76 -0
  53. package/dist/commands/ads/meta/pixels.js.map +1 -0
  54. package/dist/commands/ads/meta/presets.d.ts +30 -0
  55. package/dist/commands/ads/meta/presets.d.ts.map +1 -0
  56. package/dist/commands/ads/meta/presets.js +86 -0
  57. package/dist/commands/ads/meta/presets.js.map +1 -0
  58. package/dist/commands/ads/meta/preview.d.ts +32 -0
  59. package/dist/commands/ads/meta/preview.d.ts.map +1 -0
  60. package/dist/commands/ads/meta/preview.js +90 -0
  61. package/dist/commands/ads/meta/preview.js.map +1 -0
  62. package/dist/commands/ads/meta/shared.d.ts +18 -0
  63. package/dist/commands/ads/meta/shared.d.ts.map +1 -0
  64. package/dist/commands/ads/meta/shared.js +86 -0
  65. package/dist/commands/ads/meta/shared.js.map +1 -0
  66. package/dist/env.d.ts +1 -0
  67. package/dist/env.d.ts.map +1 -1
  68. package/dist/env.js +1 -0
  69. package/dist/env.js.map +1 -1
  70. package/dist/error-handler.d.ts +1 -1
  71. package/dist/error-handler.d.ts.map +1 -1
  72. package/dist/error-handler.js +3 -0
  73. package/dist/error-handler.js.map +1 -1
  74. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audiences.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/audiences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC;IAC5C,IAAI,EAAE;QACJ,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE;;;;gDAI+B;KAC7C;IACD,IAAI,EAAE;QACJ,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE;QACnE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE;QAClD,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,0BAA0B,EAAE;QAC1E,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE;KAC1E;IACD,GAAG,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACtB,MAAM,SAAS,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC;YACH,MAAM,MAAM,GAA2B,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;YACnE,IAAI,IAAI,CAAC,KAAK;gBAAE,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAe,CAAC;YACpD,IAAI,IAAI,CAAC,YAAY,CAAC;gBAAE,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC;YACtD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAiC,yBAAyB,EAAE,MAAM,CAAC,CAAC;YAC7F,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;gBACnB,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBAC1B,OAAO;YACT,CAAC;YACD,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,eAAe,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const businessesCommand: import("citty").CommandDef<{
2
+ readonly "skip-cache": {
3
+ readonly type: "boolean";
4
+ readonly description: "Bypass server-side cache";
5
+ };
6
+ readonly output: {
7
+ readonly type: "string";
8
+ readonly description: "Output format";
9
+ readonly default: "json";
10
+ };
11
+ }>;
12
+ //# sourceMappingURL=businesses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"businesses.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/businesses.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,iBAAiB;;;;;;;;;;EA2B5B,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { defineCommand } from "citty";
2
+ import { apiGet } from "../../../client.js";
3
+ import { writeAdsJson, writeAdsOutput } from "../output.js";
4
+ import { csvOrJson, handleMetaError } from "./shared.js";
5
+ export const businessesCommand = defineCommand({
6
+ meta: {
7
+ name: "businesses",
8
+ description: `List Meta Business Manager accounts the connected user has access to. Required for ad-studies and product-catalogs commands.
9
+
10
+ Examples:
11
+ baker ads meta businesses`,
12
+ },
13
+ args: {
14
+ "skip-cache": { type: "boolean", description: "Bypass server-side cache" },
15
+ output: { type: "string", description: "Output format", default: "json" },
16
+ },
17
+ run: async ({ args }) => {
18
+ try {
19
+ const params = {};
20
+ if (args["skip-cache"])
21
+ params["skip-cache"] = "true";
22
+ const data = await apiGet("/api/ads/meta/businesses", params);
23
+ const fmt = csvOrJson(args);
24
+ if (fmt !== "json") {
25
+ writeAdsOutput(data, fmt);
26
+ return;
27
+ }
28
+ writeAdsJson({ ok: true, data });
29
+ }
30
+ catch (err) {
31
+ handleMetaError(err);
32
+ }
33
+ },
34
+ });
35
+ //# sourceMappingURL=businesses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"businesses.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/businesses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;IAC7C,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE;;;4BAGW;KACzB;IACD,IAAI,EAAE;QACJ,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,0BAA0B,EAAE;QAC1E,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE;KAC1E;IACD,GAAG,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACtB,IAAI,CAAC;YACH,MAAM,MAAM,GAA2B,EAAE,CAAC;YAC1C,IAAI,IAAI,CAAC,YAAY,CAAC;gBAAE,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC;YACtD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAiC,0BAA0B,EAAE,MAAM,CAAC,CAAC;YAC9F,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;gBACnB,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBAC1B,OAAO;YACT,CAAC;YACD,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,eAAe,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ export declare const campaignsCommand: import("citty").CommandDef<{
2
+ readonly "account-id": {
3
+ readonly type: "string";
4
+ readonly description: "Meta ad account ID";
5
+ };
6
+ readonly "effective-status": {
7
+ readonly type: "string";
8
+ readonly description: "Comma-separated effective_status filter (overrides default)";
9
+ };
10
+ readonly "all-statuses": {
11
+ readonly type: "boolean";
12
+ readonly description: "Drop the default ACTIVE filter and return everything";
13
+ };
14
+ readonly limit: {
15
+ readonly type: "string";
16
+ readonly description: "Max rows (default 1000)";
17
+ };
18
+ readonly "skip-cache": {
19
+ readonly type: "boolean";
20
+ readonly description: "Bypass server-side cache";
21
+ };
22
+ readonly output: {
23
+ readonly type: "string";
24
+ readonly description: "Output format";
25
+ readonly default: "json";
26
+ };
27
+ }>;
28
+ //# sourceMappingURL=campaigns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"campaigns.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/campaigns.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;EAyC3B,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { defineCommand } from "citty";
2
+ import { apiGet } from "../../../client.js";
3
+ import { writeAdsJson, writeAdsOutput } from "../output.js";
4
+ import { csvOrJson, handleMetaError, resolveAccountIdArg, resolveEffectiveStatus } from "./shared.js";
5
+ export const campaignsCommand = defineCommand({
6
+ meta: {
7
+ name: "campaigns",
8
+ description: `List campaigns for a Meta ad account. Defaults to ACTIVE only — pass --all-statuses to widen.
9
+
10
+ In Meta's API "campaign" is the top-of-tree object (what marketers usually call a campaign group).
11
+ The dashboard shows effective_status: ACTIVE, PAUSED, DELETED, ARCHIVED, IN_PROCESS, WITH_ISSUES, etc.
12
+
13
+ Examples:
14
+ baker ads meta campaigns --account-id act_123 # ACTIVE only
15
+ baker ads meta campaigns --account-id act_123 --all-statuses # everything
16
+ baker ads meta campaigns --account-id act_123 --effective-status ACTIVE,PAUSED # custom set
17
+ baker ads meta campaigns --account-id act_123 --output csv`,
18
+ },
19
+ args: {
20
+ "account-id": { type: "string", description: "Meta ad account ID" },
21
+ "effective-status": { type: "string", description: "Comma-separated effective_status filter (overrides default)" },
22
+ "all-statuses": { type: "boolean", description: "Drop the default ACTIVE filter and return everything" },
23
+ limit: { type: "string", description: "Max rows (default 1000)" },
24
+ "skip-cache": { type: "boolean", description: "Bypass server-side cache" },
25
+ output: { type: "string", description: "Output format", default: "json" },
26
+ },
27
+ run: async ({ args }) => {
28
+ const accountId = resolveAccountIdArg(args);
29
+ const effectiveStatus = resolveEffectiveStatus(args);
30
+ try {
31
+ const params = { "account-id": accountId };
32
+ if (effectiveStatus)
33
+ params["effective-status"] = effectiveStatus;
34
+ if (args.limit)
35
+ params.limit = args.limit;
36
+ if (args["skip-cache"])
37
+ params["skip-cache"] = "true";
38
+ const data = await apiGet("/api/ads/meta/campaigns", params);
39
+ const fmt = csvOrJson(args);
40
+ if (fmt !== "json") {
41
+ writeAdsOutput(data, fmt);
42
+ return;
43
+ }
44
+ writeAdsJson({ ok: true, data });
45
+ }
46
+ catch (err) {
47
+ handleMetaError(err);
48
+ }
49
+ },
50
+ });
51
+ //# sourceMappingURL=campaigns.js.map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AAE,CAAC;YACnE,IAAI,eAAe;gBAAE,MAAM,CAAC,kBAAkB,CAAC,GAAG,eAAe,CAAC;YAClE,IAAI,IAAI,CAAC,KAAK;gBAAE,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAe,CAAC;YACpD,IAAI,IAAI,CAAC,YAAY,CAAC;gBAAE,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC;YACtD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAiC,yBAAyB,EAAE,MAAM,CAAC,CAAC;YAC7F,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;gBACnB,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBAC1B,OAAO;YACT,CAAC;YACD,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,eAAe,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ export declare const creativesCommand: import("citty").CommandDef<{
2
+ readonly "account-id": {
3
+ readonly type: "string";
4
+ readonly description: "Meta ad account ID (required if no --creative-id)";
5
+ };
6
+ readonly "creative-id": {
7
+ readonly type: "string";
8
+ readonly description: "Single creative ID";
9
+ };
10
+ readonly limit: {
11
+ readonly type: "string";
12
+ readonly description: "Max rows (default 500)";
13
+ };
14
+ readonly "skip-cache": {
15
+ readonly type: "boolean";
16
+ readonly description: "Bypass server-side cache";
17
+ };
18
+ readonly output: {
19
+ readonly type: "string";
20
+ readonly description: "Output format";
21
+ readonly default: "json";
22
+ };
23
+ }>;
24
+ //# sourceMappingURL=creatives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"creatives.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/creatives.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;EAyC3B,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { defineCommand } from "citty";
2
+ import { apiGet } from "../../../client.js";
3
+ import { writeAdsJson, writeAdsOutput } from "../output.js";
4
+ import { csvOrJson, handleMetaError, resolveAccountIdArg } from "./shared.js";
5
+ export const creativesCommand = defineCommand({
6
+ meta: {
7
+ name: "creatives",
8
+ description: `List ad creatives in an account, or fetch a single creative by ID.
9
+
10
+ Important: Meta creatives are effectively immutable once attached to an ad. Editing copy/image/CTA = create
11
+ a new creative + reattach. Bake this into any agentic edit workflow.
12
+
13
+ Examples:
14
+ baker ads meta creatives --account-id act_123
15
+ baker ads meta creatives --creative-id 23842... # fetch one`,
16
+ },
17
+ args: {
18
+ "account-id": { type: "string", description: "Meta ad account ID (required if no --creative-id)" },
19
+ "creative-id": { type: "string", description: "Single creative ID" },
20
+ limit: { type: "string", description: "Max rows (default 500)" },
21
+ "skip-cache": { type: "boolean", description: "Bypass server-side cache" },
22
+ output: { type: "string", description: "Output format", default: "json" },
23
+ },
24
+ run: async ({ args }) => {
25
+ try {
26
+ const params = {};
27
+ if (args["creative-id"]) {
28
+ params["creative-id"] = args["creative-id"];
29
+ }
30
+ else {
31
+ const accountId = resolveAccountIdArg(args);
32
+ params["account-id"] = accountId;
33
+ }
34
+ if (args.limit)
35
+ params.limit = args.limit;
36
+ if (args["skip-cache"])
37
+ params["skip-cache"] = "true";
38
+ const data = await apiGet("/api/ads/meta/creatives", params);
39
+ const fmt = csvOrJson(args);
40
+ if (Array.isArray(data) && fmt !== "json") {
41
+ writeAdsOutput(data, fmt);
42
+ return;
43
+ }
44
+ writeAdsJson({ ok: true, data });
45
+ }
46
+ catch (err) {
47
+ handleMetaError(err);
48
+ }
49
+ },
50
+ });
51
+ //# sourceMappingURL=creatives.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"creatives.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/creatives.ts"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,KAAK,GAAG,IAAI,CAAC,KAAe,CAAC;YACpD,IAAI,IAAI,CAAC,YAAY,CAAC;gBAAE,MAAM,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC;YACtD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAU,yBAAyB,EAAE,MAAM,CAAC,CAAC;YACtE,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;gBAC1C,cAAc,CAAC,IAAsC,EAAE,GAAG,CAAC,CAAC;gBAC5D,OAAO;YACT,CAAC;YACD,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,eAAe,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Meta Ads command surface — curated for AI agents, not 1:1 with the Marketing API.
3
+ *
4
+ * The HTTP backend exposes more endpoints (catalogs, studies, ad-images, labels,
5
+ * high-demand-periods, currency lookup). They're intentionally not surfaced as
6
+ * CLI commands because AI agents rarely need them in isolation. Hit them via
7
+ * curl against the API if you need them.
8
+ *
9
+ * Default behaviors that matter:
10
+ * - Listings (campaigns/adsets/ads) filter to ACTIVE — pass --all-statuses to widen.
11
+ * - Insights filter out non-delivered rows (impressions=0) and sort by spend desc.
12
+ * - Insights pick a smart field bundle via --intent (baseline|revenue|funnel|ranking|video|identity).
13
+ * - Heavy insights queries auto-fall to async (poll loop hidden).
14
+ * - Attribution defaults to 7d_click,1d_view — the only windows still working as of Jan 2026.
15
+ */
16
+ export declare const metaCommand: import("citty").CommandDef<import("citty").ArgsDef>;
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/index.ts"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,qDAiDtB,CAAC"}
@@ -0,0 +1,79 @@
1
+ import { defineCommand } from "citty";
2
+ import { accountCommand } from "./account.js";
3
+ import { accountsCommand } from "./accounts.js";
4
+ import { activitiesCommand } from "./activities.js";
5
+ import { adsListCommand } from "./ads.js";
6
+ import { adsetsCommand } from "./adsets.js";
7
+ import { audiencesCommand } from "./audiences.js";
8
+ import { businessesCommand } from "./businesses.js";
9
+ import { campaignsCommand } from "./campaigns.js";
10
+ import { creativesCommand } from "./creatives.js";
11
+ import { insightsCommand } from "./insights.js";
12
+ import { pixelsCommand } from "./pixels.js";
13
+ import { previewCommand } from "./preview.js";
14
+ /**
15
+ * Meta Ads command surface — curated for AI agents, not 1:1 with the Marketing API.
16
+ *
17
+ * The HTTP backend exposes more endpoints (catalogs, studies, ad-images, labels,
18
+ * high-demand-periods, currency lookup). They're intentionally not surfaced as
19
+ * CLI commands because AI agents rarely need them in isolation. Hit them via
20
+ * curl against the API if you need them.
21
+ *
22
+ * Default behaviors that matter:
23
+ * - Listings (campaigns/adsets/ads) filter to ACTIVE — pass --all-statuses to widen.
24
+ * - Insights filter out non-delivered rows (impressions=0) and sort by spend desc.
25
+ * - Insights pick a smart field bundle via --intent (baseline|revenue|funnel|ranking|video|identity).
26
+ * - Heavy insights queries auto-fall to async (poll loop hidden).
27
+ * - Attribution defaults to 7d_click,1d_view — the only windows still working as of Jan 2026.
28
+ */
29
+ export const metaCommand = defineCommand({
30
+ meta: {
31
+ name: "meta",
32
+ description: `Meta Marketing API — AI-first command surface (Facebook + Instagram ads).
33
+
34
+ Discovery:
35
+ baker ads meta accounts — accounts in this company's connected scope
36
+ baker ads meta accounts --include-all — every account the token can see
37
+ baker ads meta businesses — Business Manager IDs
38
+
39
+ Snapshot a running account (default = ACTIVE only):
40
+ baker ads meta campaigns --account-id act_123
41
+ baker ads meta adsets --campaign-id 6123
42
+ baker ads meta ads --adset-id 6123
43
+ baker ads meta campaigns --account-id act_123 --all-statuses — include paused, archived
44
+
45
+ Drill in:
46
+ baker ads meta account --account-id act_123 — currency, balance, business
47
+ baker ads meta creatives --creative-id 9988 — single creative detail
48
+ baker ads meta audiences --account-id act_123
49
+ baker ads meta pixels --account-id act_123 — pixel list
50
+ baker ads meta pixels --pixel-id 9988 --stats --days 7 — firing health
51
+
52
+ Performance (the workhorse):
53
+ baker ads meta insights --object act_123 — defaults: level=account, intent=baseline, last_7d
54
+ baker ads meta insights --object act_123 --intent revenue --date-preset last_28d
55
+ baker ads meta insights --object act_123 --level ad --intent ranking — flag creatives to refresh
56
+ baker ads meta insights --object act_123 --level adset --breakdowns publisher_platform,age — placement × age
57
+ baker ads meta insights --object act_123 --level ad --since 2026-01-01 --until 2026-03-31 — auto-async
58
+ baker ads meta insights --list-presets
59
+
60
+ Audit & review:
61
+ baker ads meta activities --account-id act_123 --days 14
62
+ baker ads meta preview --creative-id 9988 --ad-format MOBILE_FEED_STANDARD --out-file /tmp/p.html`,
63
+ },
64
+ subCommands: {
65
+ accounts: accountsCommand,
66
+ account: accountCommand,
67
+ businesses: businessesCommand,
68
+ campaigns: campaignsCommand,
69
+ adsets: adsetsCommand,
70
+ ads: adsListCommand,
71
+ creatives: creativesCommand,
72
+ audiences: audiencesCommand,
73
+ pixels: pixelsCommand,
74
+ activities: activitiesCommand,
75
+ insights: insightsCommand,
76
+ preview: previewCommand,
77
+ },
78
+ });
79
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/ads/meta/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;IACvC,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oGA8BmF;KACjG;IACD,WAAW,EAAE;QACX,QAAQ,EAAE,eAAe;QACzB,OAAO,EAAE,cAAc;QACvB,UAAU,EAAE,iBAAiB;QAC7B,SAAS,EAAE,gBAAgB;QAC3B,MAAM,EAAE,aAAa;QACrB,GAAG,EAAE,cAAc;QACnB,SAAS,EAAE,gBAAgB;QAC3B,SAAS,EAAE,gBAAgB;QAC3B,MAAM,EAAE,aAAa;QACrB,UAAU,EAAE,iBAAiB;QAC7B,QAAQ,EAAE,eAAe;QACzB,OAAO,EAAE,cAAc;KACxB;CACF,CAAC,CAAC"}
@@ -0,0 +1,92 @@
1
+ export declare const insightsCommand: import("citty").CommandDef<{
2
+ readonly object: {
3
+ readonly type: "string";
4
+ readonly description: "Object ID — act_<id> for account, or a campaign/adset/ad ID";
5
+ };
6
+ readonly level: {
7
+ readonly type: "string";
8
+ readonly description: "account|campaign|adset|ad (default: account)";
9
+ };
10
+ readonly intent: {
11
+ readonly type: "string";
12
+ readonly description: "baseline|revenue|funnel|ranking|video|identity (default: baseline)";
13
+ };
14
+ readonly fields: {
15
+ readonly type: "string";
16
+ readonly description: "Comma-separated field list (overrides --intent bundle)";
17
+ };
18
+ readonly "list-intents": {
19
+ readonly type: "boolean";
20
+ readonly description: "Print available intents and exit";
21
+ };
22
+ readonly "date-preset": {
23
+ readonly type: "string";
24
+ readonly description: "Meta date preset (last_7d, last_28d, today, ...)";
25
+ };
26
+ readonly since: {
27
+ readonly type: "string";
28
+ readonly description: "Custom start date YYYY-MM-DD";
29
+ };
30
+ readonly until: {
31
+ readonly type: "string";
32
+ readonly description: "Custom end date YYYY-MM-DD";
33
+ };
34
+ readonly "time-increment": {
35
+ readonly type: "string";
36
+ readonly description: "1 (day) | monthly | all_days";
37
+ };
38
+ readonly breakdowns: {
39
+ readonly type: "string";
40
+ readonly description: "Comma-separated breakdowns (e.g. publisher_platform,age)";
41
+ };
42
+ readonly "action-breakdowns": {
43
+ readonly type: "string";
44
+ readonly description: "Slice the actions[] array (default: action_type for revenue/funnel)";
45
+ };
46
+ readonly filtering: {
47
+ readonly type: "string";
48
+ readonly description: "Override default filter — JSON array of {field,operator,value}";
49
+ };
50
+ readonly "include-undelivered": {
51
+ readonly type: "boolean";
52
+ readonly description: "Keep rows where impressions=0 (off by default)";
53
+ };
54
+ readonly "attribution-windows": {
55
+ readonly type: "string";
56
+ readonly description: "Override default 7d_click,1d_view (only 1d_view, 1d_click, 7d_click, 28d_click work post Jan 2026)";
57
+ };
58
+ readonly "use-account-attribution": {
59
+ readonly type: "boolean";
60
+ readonly description: "Use account-saved attribution setting";
61
+ };
62
+ readonly "use-unified-attribution": {
63
+ readonly type: "boolean";
64
+ readonly description: "Use ad-set unified attribution setting";
65
+ };
66
+ readonly limit: {
67
+ readonly type: "string";
68
+ readonly description: "Max rows (default 1000)";
69
+ };
70
+ readonly async: {
71
+ readonly type: "boolean";
72
+ readonly description: "Force async submit-and-poll path";
73
+ };
74
+ readonly "no-async": {
75
+ readonly type: "boolean";
76
+ readonly description: "Refuse the auto-async fallback for heavy queries";
77
+ };
78
+ readonly "no-sort": {
79
+ readonly type: "boolean";
80
+ readonly description: "Skip default spend-desc sort";
81
+ };
82
+ readonly "skip-cache": {
83
+ readonly type: "boolean";
84
+ readonly description: "Bypass server-side cache";
85
+ };
86
+ readonly output: {
87
+ readonly type: "string";
88
+ readonly description: "Output format";
89
+ readonly default: "json";
90
+ };
91
+ }>;
92
+ //# sourceMappingURL=insights.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insights.d.ts","sourceRoot":"","sources":["../../../../src/commands/ads/meta/insights.ts"],"names":[],"mappings":"AAwLA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwG1B,CAAC"}