@koda-sl/baker-cli 0.110.1 → 0.111.0-dev.802867580

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -9,10 +9,10 @@ import {
9
9
  defaultRegistry,
10
10
  generateCatalog,
11
11
  validateCanvasDeep
12
- } from "./chunk-3JVYU72O.js";
12
+ } from "./chunk-26K7V346.js";
13
13
 
14
14
  // src/cli.ts
15
- import { defineCommand as defineCommand154, runMain } from "citty";
15
+ import { defineCommand as defineCommand157, runMain } from "citty";
16
16
 
17
17
  // src/commands/actions/index.ts
18
18
  import { defineCommand as defineCommand18 } from "citty";
@@ -31,6 +31,7 @@ function getEnv() {
31
31
  BAKER_API_KEY: z.string().startsWith("bk_", "API key must start with 'bk_'"),
32
32
  BAKER_API_URL: z.url("BAKER_API_URL must be a valid URL"),
33
33
  BAKER_CHAT_ID: z.string().optional(),
34
+ BAKER_ACTING_USER_ID: z.string().optional(),
34
35
  BAKER_GOOGLE_ADS_CUSTOMER_ID: z.string().regex(/^\d{10}$/).optional(),
35
36
  BAKER_GA4_PROPERTY_ID: z.string().optional(),
36
37
  BAKER_GSC_SITE_URL: z.string().optional(),
@@ -2843,10 +2844,10 @@ Examples:
2843
2844
  });
2844
2845
 
2845
2846
  // src/commands/ads/index.ts
2846
- import { defineCommand as defineCommand80 } from "citty";
2847
+ import { defineCommand as defineCommand82 } from "citty";
2847
2848
 
2848
2849
  // src/commands/ads/google/index.ts
2849
- import { defineCommand as defineCommand29 } from "citty";
2850
+ import { defineCommand as defineCommand31 } from "citty";
2850
2851
 
2851
2852
  // src/commands/ads/google/accounts.ts
2852
2853
  import { defineCommand as defineCommand19 } from "citty";
@@ -3831,11 +3832,866 @@ Examples:
3831
3832
  }
3832
3833
  });
3833
3834
 
3835
+ // src/commands/ads/google/draft.ts
3836
+ import { defineCommand as defineCommand22 } from "citty";
3837
+
3838
+ // src/commands/ads/google/write-shared.ts
3839
+ import { readFileSync as readFileSync3 } from "fs";
3840
+
3841
+ // ../api/src/ads-google/limits.ts
3842
+ var GOOGLE_ADS_LIMITS = {
3843
+ budget: {
3844
+ nameMax: 255,
3845
+ amountMicrosMin: 1
3846
+ },
3847
+ campaign: {
3848
+ nameMax: 255
3849
+ },
3850
+ adGroup: {
3851
+ nameMax: 255
3852
+ },
3853
+ keyword: {
3854
+ textMax: 80,
3855
+ wordsMax: 10
3856
+ },
3857
+ responsiveSearchAd: {
3858
+ headlinesMin: 3,
3859
+ headlinesMax: 15,
3860
+ headlineTextMax: 30,
3861
+ descriptionsMin: 2,
3862
+ descriptionsMax: 4,
3863
+ descriptionTextMax: 90,
3864
+ pathMax: 15
3865
+ },
3866
+ responsiveDisplayAd: {
3867
+ headlinesMin: 1,
3868
+ headlinesMax: 5,
3869
+ headlineTextMax: 30,
3870
+ longHeadlineTextMax: 90,
3871
+ descriptionsMin: 1,
3872
+ descriptionsMax: 5,
3873
+ descriptionTextMax: 90,
3874
+ businessNameMax: 25
3875
+ },
3876
+ sharedSet: {
3877
+ nameMax: 255
3878
+ },
3879
+ asset: {
3880
+ sitelinkLinkTextMax: 25,
3881
+ sitelinkDescriptionMax: 35,
3882
+ calloutTextMax: 25,
3883
+ structuredSnippetHeaderMax: 25,
3884
+ structuredSnippetValuesMin: 3,
3885
+ structuredSnippetValuesMax: 10
3886
+ },
3887
+ conversionAction: {
3888
+ nameMax: 255
3889
+ },
3890
+ audience: {
3891
+ nameMax: 255
3892
+ },
3893
+ biddingStrategy: {
3894
+ nameMax: 255
3895
+ },
3896
+ label: {
3897
+ nameMax: 255
3898
+ }
3899
+ };
3900
+ var KEYWORD_MATCH_TYPES = ["EXACT", "PHRASE", "BROAD"];
3901
+ var ADVERTISING_CHANNEL_TYPES = [
3902
+ "SEARCH",
3903
+ "DISPLAY",
3904
+ "SHOPPING",
3905
+ "VIDEO",
3906
+ "PERFORMANCE_MAX",
3907
+ "DEMAND_GEN",
3908
+ "MULTI_CHANNEL",
3909
+ "LOCAL",
3910
+ "SMART",
3911
+ "TRAVEL",
3912
+ "HOTEL",
3913
+ "DISCOVERY"
3914
+ ];
3915
+ var ADVERTISING_CHANNEL_SUB_TYPES = [
3916
+ "SEARCH_MOBILE_APP",
3917
+ "DISPLAY_MOBILE_APP",
3918
+ "SEARCH_EXPRESS",
3919
+ "DISPLAY_EXPRESS",
3920
+ "SHOPPING_SMART_ADS",
3921
+ "DISPLAY_GMAIL_AD",
3922
+ "DISPLAY_SMART_CAMPAIGN",
3923
+ "VIDEO_OUTSTREAM",
3924
+ "VIDEO_ACTION",
3925
+ "VIDEO_NON_SKIPPABLE",
3926
+ "APP_CAMPAIGN",
3927
+ "APP_CAMPAIGN_FOR_ENGAGEMENT",
3928
+ "LOCAL_CAMPAIGN",
3929
+ "SHOPPING_COMPARISON_LISTING_ADS",
3930
+ "SEARCH_MOBILE_APP_ENGAGEMENT",
3931
+ "TRAVEL_ACTIVITIES"
3932
+ ];
3933
+ var BIDDING_STRATEGY_TYPES = [
3934
+ "MANUAL_CPC",
3935
+ "MAXIMIZE_CONVERSIONS",
3936
+ "MAXIMIZE_CONVERSION_VALUE",
3937
+ "TARGET_SPEND",
3938
+ "TARGET_CPA",
3939
+ "TARGET_ROAS",
3940
+ "TARGET_IMPRESSION_SHARE",
3941
+ "MANUAL_CPM",
3942
+ "MANUAL_CPV",
3943
+ "PERCENT_CPC"
3944
+ ];
3945
+ var BUDGET_DELIVERY_METHODS = ["STANDARD", "ACCELERATED"];
3946
+ var AD_GROUP_TYPES = [
3947
+ "SEARCH_STANDARD",
3948
+ "DISPLAY_STANDARD",
3949
+ "SHOPPING_PRODUCT_ADS",
3950
+ "VIDEO_BUMPER",
3951
+ "VIDEO_TRUE_VIEW_IN_STREAM",
3952
+ "VIDEO_TRUE_VIEW_IN_DISPLAY",
3953
+ "VIDEO_NON_SKIPPABLE_IN_STREAM",
3954
+ "VIDEO_OUTSTREAM",
3955
+ "DEMAND_GEN_AD"
3956
+ ];
3957
+ var SHARED_SET_TYPES = [
3958
+ "NEGATIVE_KEYWORDS",
3959
+ "NEGATIVE_PLACEMENTS",
3960
+ "ACCOUNT_LEVEL_NEGATIVE_KEYWORDS"
3961
+ ];
3962
+ var STAGEABLE_CREATE_STATUSES2 = ["ENABLED", "PAUSED"];
3963
+ var PINNED_FIELDS = ["HEADLINE_1", "HEADLINE_2", "HEADLINE_3", "DESCRIPTION_1", "DESCRIPTION_2"];
3964
+ var CONVERSION_ACTION_CATEGORIES = [
3965
+ "DEFAULT",
3966
+ "PAGE_VIEW",
3967
+ "PURCHASE",
3968
+ "SIGNUP",
3969
+ "LEAD",
3970
+ "DOWNLOAD",
3971
+ "ADD_TO_CART",
3972
+ "BEGIN_CHECKOUT",
3973
+ "SUBSCRIBE_PAID",
3974
+ "PHONE_CALL_LEAD",
3975
+ "SUBMIT_LEAD_FORM",
3976
+ "BOOK_APPOINTMENT",
3977
+ "REQUEST_QUOTE",
3978
+ "CONTACT"
3979
+ ];
3980
+ var CONVERSION_ACTION_TYPES = [
3981
+ "WEBPAGE",
3982
+ "UPLOAD_CLICKS",
3983
+ "UPLOAD_CALLS",
3984
+ "WEBSITE_CALL",
3985
+ "GOOGLE_ANALYTICS_4_CUSTOM"
3986
+ ];
3987
+ var CONVERSION_COUNTING_TYPES = ["ONE_PER_CLICK", "MANY_PER_CLICK"];
3988
+ var USER_LIST_TYPES = ["CRM_BASED", "RULE_BASED", "LOGICAL", "BASIC", "LOOKALIKE"];
3989
+ var ASSET_FIELD_TYPES = [
3990
+ "SITELINK",
3991
+ "CALLOUT",
3992
+ "STRUCTURED_SNIPPET",
3993
+ "CALL",
3994
+ "PRICE",
3995
+ "PROMOTION",
3996
+ "MOBILE_APP",
3997
+ "HEADLINE",
3998
+ "DESCRIPTION",
3999
+ "LOGO",
4000
+ "MARKETING_IMAGE",
4001
+ "BUSINESS_NAME"
4002
+ ];
4003
+ var DEVICE_TYPES = ["MOBILE", "TABLET", "DESKTOP", "CONNECTED_TV", "OTHER"];
4004
+ var DAYS_OF_WEEK = ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"];
4005
+ var CAMPAIGN_OBJECTIVES = [
4006
+ "SALES",
4007
+ "LEADS",
4008
+ "WEBSITE_TRAFFIC",
4009
+ "PRODUCT_BRAND_CONSIDERATION",
4010
+ "BRAND_AWARENESS_REACH",
4011
+ "APP_PROMOTION",
4012
+ "LOCAL_STORE_VISITS"
4013
+ ];
4014
+ var MICROS_PER_UNIT = 1e6;
4015
+ function toMicros(amount) {
4016
+ return Math.round(amount * MICROS_PER_UNIT);
4017
+ }
4018
+ var PLAYBOOK_DAILY_BUDGET_FLOOR_MICROS = 10 * MICROS_PER_UNIT;
4019
+ var TEMP_REF_REGEX2 = /^g_temp_[A-Za-z0-9_-]{2,}$/;
4020
+ var NUMERIC_ID_REGEX2 = /^\d+$/;
4021
+ var RESOURCE_NAME_REGEX = /^customers\/\d+\/[A-Za-z]+\/[-\w~]+$/;
4022
+ var GEO_TARGET_CONSTANT_REGEX = /^geoTargetConstants\/\d+$/;
4023
+ var LANGUAGE_CONSTANT_REGEX = /^languageConstants\/\d+$/;
4024
+
4025
+ // ../api/src/ads-google/ops.ts
4026
+ import { z as z8 } from "zod";
4027
+ var tempRefSchema2 = z8.string().regex(TEMP_REF_REGEX2, "expected a g_temp_* reference");
4028
+ var refSchema = z8.union([
4029
+ z8.string().regex(RESOURCE_NAME_REGEX, "expected a customers/\u2026/\u2026/\u2026 resource name"),
4030
+ z8.string().regex(NUMERIC_ID_REGEX2, "expected a numeric id"),
4031
+ tempRefSchema2
4032
+ ]);
4033
+ var targetRefSchema = refSchema;
4034
+ var microsSchema = z8.number().int().positive("expected a positive micros amount");
4035
+ var httpsUrlSchema2 = z8.string().url().refine((u) => u.startsWith("https://"), "final URLs must be https");
4036
+ var customerIdSchema = z8.string().regex(NUMERIC_ID_REGEX2, "customerId must be the bare numeric customer id");
4037
+ var stageableStatusSchema2 = z8.enum(STAGEABLE_CREATE_STATUSES2);
4038
+ var matchTypeSchema = z8.enum(KEYWORD_MATCH_TYPES);
4039
+ var keywordTextSchema = z8.string().min(1).max(GOOGLE_ADS_LIMITS.keyword.textMax).refine((t) => t.trim().split(/\s+/).length <= GOOGLE_ADS_LIMITS.keyword.wordsMax, "keyword exceeds 10 words");
4040
+ var budgetCreateSchema = z8.object({
4041
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.budget.nameMax),
4042
+ amountMicros: microsSchema,
4043
+ deliveryMethod: z8.enum(BUDGET_DELIVERY_METHODS).default("STANDARD"),
4044
+ explicitlyShared: z8.boolean().default(false)
4045
+ });
4046
+ var budgetUpdateSchema = z8.object({
4047
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.budget.nameMax).optional(),
4048
+ amountMicros: microsSchema.optional(),
4049
+ deliveryMethod: z8.enum(BUDGET_DELIVERY_METHODS).optional()
4050
+ }).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
4051
+ var biddingConfigSchema = z8.object({
4052
+ type: z8.enum(BIDDING_STRATEGY_TYPES),
4053
+ targetCpaMicros: microsSchema.optional(),
4054
+ targetRoas: z8.number().positive().optional(),
4055
+ cpcBidCeilingMicros: microsSchema.optional(),
4056
+ enhancedCpcEnabled: z8.boolean().optional()
4057
+ }).superRefine((p, ctx) => {
4058
+ if (p.type === "TARGET_CPA" && p.targetCpaMicros === void 0) {
4059
+ ctx.addIssue({ code: "custom", path: ["targetCpaMicros"], message: "TARGET_CPA needs targetCpaMicros" });
4060
+ }
4061
+ if (p.type === "TARGET_ROAS" && p.targetRoas === void 0) {
4062
+ ctx.addIssue({ code: "custom", path: ["targetRoas"], message: "TARGET_ROAS needs targetRoas" });
4063
+ }
4064
+ });
4065
+ var networkSettingsSchema = z8.object({
4066
+ targetGoogleSearch: z8.boolean().optional(),
4067
+ targetSearchNetwork: z8.boolean().optional(),
4068
+ targetContentNetwork: z8.boolean().optional(),
4069
+ targetPartnerSearchNetwork: z8.boolean().optional()
4070
+ });
4071
+ var dateSchema = z8.string().regex(/^\d{4}-\d{2}-\d{2}$/, "expected a YYYY-MM-DD date");
4072
+ var campaignCreateSchema2 = z8.object({
4073
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.campaign.nameMax),
4074
+ channelType: z8.enum(ADVERTISING_CHANNEL_TYPES),
4075
+ channelSubType: z8.enum(ADVERTISING_CHANNEL_SUB_TYPES).optional(),
4076
+ budget: refSchema,
4077
+ /** Inline standard bidding, or a portfolio strategy ref via biddingStrategy. */
4078
+ bidding: biddingConfigSchema.optional(),
4079
+ biddingStrategy: refSchema.optional(),
4080
+ networkSettings: networkSettingsSchema.optional(),
4081
+ startDate: dateSchema.optional(),
4082
+ endDate: dateSchema.optional(),
4083
+ /** Advisory Google Ads UI objective — drives warnings, not sent to the API. */
4084
+ objective: z8.enum(CAMPAIGN_OBJECTIVES).optional(),
4085
+ status: stageableStatusSchema2.default("PAUSED")
4086
+ }).superRefine((p, ctx) => {
4087
+ if (!p.bidding && !p.biddingStrategy) {
4088
+ ctx.addIssue({
4089
+ code: "custom",
4090
+ path: ["bidding"],
4091
+ message: "set an inline bidding strategy or reference a portfolio biddingStrategy"
4092
+ });
4093
+ }
4094
+ if (p.bidding && p.biddingStrategy) {
4095
+ ctx.addIssue({
4096
+ code: "custom",
4097
+ path: ["bidding"],
4098
+ message: "use inline bidding OR a portfolio biddingStrategy, not both"
4099
+ });
4100
+ }
4101
+ if (p.channelType === "PERFORMANCE_MAX" && p.bidding && p.bidding.type === "MANUAL_CPC") {
4102
+ ctx.addIssue({ code: "custom", path: ["bidding"], message: "Performance Max does not support Manual CPC" });
4103
+ }
4104
+ if (p.startDate && p.endDate && p.endDate <= p.startDate) {
4105
+ ctx.addIssue({ code: "custom", path: ["endDate"], message: "endDate must be after startDate" });
4106
+ }
4107
+ });
4108
+ var campaignUpdateSchema2 = z8.object({
4109
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.campaign.nameMax).optional(),
4110
+ budget: refSchema.optional(),
4111
+ bidding: biddingConfigSchema.optional(),
4112
+ networkSettings: networkSettingsSchema.optional(),
4113
+ startDate: dateSchema.optional(),
4114
+ endDate: dateSchema.optional(),
4115
+ status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
4116
+ }).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
4117
+ var adGroupCreateSchema = z8.object({
4118
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.adGroup.nameMax),
4119
+ campaign: refSchema,
4120
+ type: z8.enum(AD_GROUP_TYPES).default("SEARCH_STANDARD"),
4121
+ cpcBidMicros: microsSchema.optional(),
4122
+ status: stageableStatusSchema2.default("PAUSED")
4123
+ });
4124
+ var adGroupUpdateSchema = z8.object({
4125
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.adGroup.nameMax).optional(),
4126
+ cpcBidMicros: microsSchema.optional(),
4127
+ status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
4128
+ }).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
4129
+ var keywordAddSchema = z8.object({
4130
+ adGroup: refSchema,
4131
+ text: keywordTextSchema,
4132
+ matchType: matchTypeSchema,
4133
+ cpcBidMicros: microsSchema.optional(),
4134
+ finalUrls: z8.array(httpsUrlSchema2).optional(),
4135
+ status: stageableStatusSchema2.default("ENABLED")
4136
+ });
4137
+ var keywordUpdateSchema = z8.object({
4138
+ cpcBidMicros: microsSchema.optional(),
4139
+ finalUrls: z8.array(httpsUrlSchema2).optional(),
4140
+ status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
4141
+ }).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
4142
+ var negativeKeywordAddSchema = z8.object({
4143
+ level: z8.enum(["adGroup", "campaign"]),
4144
+ parent: refSchema,
4145
+ text: keywordTextSchema,
4146
+ matchType: matchTypeSchema
4147
+ });
4148
+ var sharedSetCreateSchema = z8.object({
4149
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.sharedSet.nameMax),
4150
+ type: z8.enum(SHARED_SET_TYPES).default("NEGATIVE_KEYWORDS")
4151
+ });
4152
+ var sharedSetMemberAddSchema = z8.object({
4153
+ sharedSet: refSchema,
4154
+ text: keywordTextSchema,
4155
+ matchType: matchTypeSchema
4156
+ });
4157
+ var campaignSharedSetAttachSchema = z8.object({
4158
+ campaign: refSchema,
4159
+ sharedSet: refSchema
4160
+ });
4161
+ var adTextAssetSchema = z8.object({
4162
+ text: z8.string().min(1),
4163
+ pinnedField: z8.enum(PINNED_FIELDS).optional()
4164
+ });
4165
+ var responsiveSearchAdSchema = z8.object({
4166
+ format: z8.literal("responsiveSearch"),
4167
+ headlines: z8.array(
4168
+ adTextAssetSchema.refine(
4169
+ (a) => a.text.length <= GOOGLE_ADS_LIMITS.responsiveSearchAd.headlineTextMax,
4170
+ "headline exceeds 30 chars"
4171
+ )
4172
+ ).min(GOOGLE_ADS_LIMITS.responsiveSearchAd.headlinesMin).max(GOOGLE_ADS_LIMITS.responsiveSearchAd.headlinesMax),
4173
+ descriptions: z8.array(
4174
+ adTextAssetSchema.refine(
4175
+ (a) => a.text.length <= GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionTextMax,
4176
+ "description exceeds 90 chars"
4177
+ )
4178
+ ).min(GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionsMin).max(GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionsMax),
4179
+ path1: z8.string().max(GOOGLE_ADS_LIMITS.responsiveSearchAd.pathMax).optional(),
4180
+ path2: z8.string().max(GOOGLE_ADS_LIMITS.responsiveSearchAd.pathMax).optional(),
4181
+ finalUrls: z8.array(httpsUrlSchema2).min(1)
4182
+ });
4183
+ var responsiveDisplayAdSchema = z8.object({
4184
+ format: z8.literal("responsiveDisplay"),
4185
+ headlines: z8.array(z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.headlineTextMax) })).min(1).max(5),
4186
+ longHeadline: z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.longHeadlineTextMax) }),
4187
+ descriptions: z8.array(z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.descriptionTextMax) })).min(1).max(5),
4188
+ businessName: z8.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.businessNameMax),
4189
+ marketingImageAssets: z8.array(refSchema).optional(),
4190
+ logoImageAssets: z8.array(refSchema).optional(),
4191
+ finalUrls: z8.array(httpsUrlSchema2).min(1)
4192
+ });
4193
+ var performanceMaxAssetGroupSchema = z8.object({
4194
+ format: z8.literal("performanceMaxAssetGroup"),
4195
+ name: z8.string().min(1).max(255),
4196
+ headlines: z8.array(z8.object({ text: z8.string().min(1).max(30) })).min(3).max(15),
4197
+ descriptions: z8.array(z8.object({ text: z8.string().min(1).max(90) })).min(2).max(5),
4198
+ finalUrls: z8.array(httpsUrlSchema2).min(1),
4199
+ imageAssets: z8.array(refSchema).optional(),
4200
+ logoAssets: z8.array(refSchema).optional()
4201
+ });
4202
+ var callAdSchema = z8.object({
4203
+ format: z8.literal("call"),
4204
+ countryCode: z8.string().length(2),
4205
+ phoneNumber: z8.string().min(3),
4206
+ headline1: z8.string().min(1).max(30),
4207
+ headline2: z8.string().min(1).max(30),
4208
+ description1: z8.string().min(1).max(90),
4209
+ description2: z8.string().min(1).max(90),
4210
+ businessName: z8.string().min(1).max(25),
4211
+ finalUrls: z8.array(httpsUrlSchema2).min(1)
4212
+ });
4213
+ var appAdSchema = z8.object({
4214
+ format: z8.literal("app"),
4215
+ headlines: z8.array(z8.object({ text: z8.string().min(1).max(30) })).min(1),
4216
+ descriptions: z8.array(z8.object({ text: z8.string().min(1).max(90) })).min(1)
4217
+ });
4218
+ var videoAdSchema = z8.object({
4219
+ format: z8.literal("video"),
4220
+ youtubeVideoId: z8.string().min(1),
4221
+ finalUrls: z8.array(httpsUrlSchema2).min(1)
4222
+ });
4223
+ var demandGenAdSchema = z8.object({
4224
+ format: z8.literal("demandGen"),
4225
+ headlines: z8.array(z8.object({ text: z8.string().min(1).max(40) })).min(1).max(5),
4226
+ descriptions: z8.array(z8.object({ text: z8.string().min(1).max(90) })).min(1).max(5),
4227
+ businessName: z8.string().min(1).max(25),
4228
+ finalUrls: z8.array(httpsUrlSchema2).min(1),
4229
+ imageAssets: z8.array(refSchema).optional()
4230
+ });
4231
+ var adContentSchema = z8.discriminatedUnion("format", [
4232
+ responsiveSearchAdSchema,
4233
+ responsiveDisplayAdSchema,
4234
+ performanceMaxAssetGroupSchema,
4235
+ callAdSchema,
4236
+ appAdSchema,
4237
+ videoAdSchema,
4238
+ demandGenAdSchema
4239
+ ]);
4240
+ var adCreateSchema = z8.object({
4241
+ adGroup: refSchema,
4242
+ status: stageableStatusSchema2.default("PAUSED"),
4243
+ content: adContentSchema
4244
+ });
4245
+ var adUpdateSchema = z8.object({
4246
+ status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional(),
4247
+ /** Whole-content replacement for RSA-like formats; re-validated against adContentSchema. */
4248
+ content: z8.record(z8.string(), z8.unknown()).optional()
4249
+ }).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
4250
+ var textAssetSchema = z8.object({ type: z8.literal("text"), text: z8.string().min(1) });
4251
+ var imageAssetSchema = z8.object({
4252
+ type: z8.literal("image"),
4253
+ imageId: z8.string().min(1),
4254
+ name: z8.string().optional()
4255
+ });
4256
+ var youtubeVideoAssetSchema = z8.object({
4257
+ type: z8.literal("youtubeVideo"),
4258
+ youtubeVideoId: z8.string().min(1),
4259
+ name: z8.string().optional()
4260
+ });
4261
+ var sitelinkAssetSchema = z8.object({
4262
+ type: z8.literal("sitelink"),
4263
+ linkText: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.sitelinkLinkTextMax),
4264
+ description1: z8.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
4265
+ description2: z8.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
4266
+ finalUrls: z8.array(httpsUrlSchema2).min(1)
4267
+ });
4268
+ var calloutAssetSchema = z8.object({
4269
+ type: z8.literal("callout"),
4270
+ calloutText: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.calloutTextMax)
4271
+ });
4272
+ var structuredSnippetAssetSchema = z8.object({
4273
+ type: z8.literal("structuredSnippet"),
4274
+ header: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetHeaderMax),
4275
+ values: z8.array(z8.string().min(1)).min(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMin).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMax)
4276
+ });
4277
+ var callToActionAssetSchema = z8.object({ type: z8.literal("callToAction"), callToAction: z8.string().min(1) });
4278
+ var assetCreateSchema = z8.discriminatedUnion("type", [
4279
+ textAssetSchema,
4280
+ imageAssetSchema,
4281
+ youtubeVideoAssetSchema,
4282
+ sitelinkAssetSchema,
4283
+ calloutAssetSchema,
4284
+ structuredSnippetAssetSchema,
4285
+ callToActionAssetSchema
4286
+ ]);
4287
+ var assetLinkAttachSchema = z8.object({
4288
+ level: z8.enum(["campaign", "adGroup", "customer"]),
4289
+ parent: refSchema.optional(),
4290
+ asset: refSchema,
4291
+ fieldType: z8.enum(ASSET_FIELD_TYPES)
4292
+ });
4293
+ var audienceCreateSchema2 = z8.object({
4294
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.audience.nameMax),
4295
+ type: z8.enum(USER_LIST_TYPES).default("BASIC"),
4296
+ description: z8.string().optional(),
4297
+ /** Customer-match members (crm-based) — file-first for large lists. */
4298
+ members: z8.array(z8.record(z8.string(), z8.string())).optional(),
4299
+ sourceFileRef: z8.string().optional()
4300
+ });
4301
+ var audienceCriterionAttachSchema = z8.object({
4302
+ level: z8.enum(["campaign", "adGroup"]),
4303
+ parent: refSchema,
4304
+ userList: refSchema,
4305
+ negative: z8.boolean().default(false)
4306
+ });
4307
+ var conversionActionCreateSchema = z8.object({
4308
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.conversionAction.nameMax),
4309
+ type: z8.enum(CONVERSION_ACTION_TYPES).default("WEBPAGE"),
4310
+ category: z8.enum(CONVERSION_ACTION_CATEGORIES).default("DEFAULT"),
4311
+ countingType: z8.enum(CONVERSION_COUNTING_TYPES).default("ONE_PER_CLICK"),
4312
+ defaultValueMicros: microsSchema.optional(),
4313
+ defaultCurrencyCode: z8.string().length(3).optional(),
4314
+ clickThroughLookbackWindowDays: z8.number().int().positive().optional(),
4315
+ viewThroughLookbackWindowDays: z8.number().int().positive().optional(),
4316
+ status: z8.enum(["ENABLED", "PAUSED"]).default("ENABLED")
4317
+ });
4318
+ var conversionActionUpdateSchema = z8.object({
4319
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.conversionAction.nameMax).optional(),
4320
+ category: z8.enum(CONVERSION_ACTION_CATEGORIES).optional(),
4321
+ countingType: z8.enum(CONVERSION_COUNTING_TYPES).optional(),
4322
+ defaultValueMicros: microsSchema.optional(),
4323
+ status: z8.enum(["ENABLED", "REMOVED", "HIDDEN"]).optional()
4324
+ }).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
4325
+ var biddingStrategyCreateSchema = z8.object({
4326
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.biddingStrategy.nameMax),
4327
+ config: biddingConfigSchema
4328
+ }).superRefine((p, ctx) => {
4329
+ if (p.config.type === "MANUAL_CPC") {
4330
+ ctx.addIssue({ code: "custom", path: ["config", "type"], message: "portfolio strategies cannot be Manual CPC" });
4331
+ }
4332
+ });
4333
+ var biddingStrategyUpdateSchema = z8.object({
4334
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.biddingStrategy.nameMax).optional(),
4335
+ config: biddingConfigSchema.optional()
4336
+ }).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
4337
+ var labelCreateSchema = z8.object({
4338
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.label.nameMax),
4339
+ backgroundColor: z8.string().regex(/^#[0-9A-Fa-f]{6}$/).optional(),
4340
+ description: z8.string().optional()
4341
+ });
4342
+ var labelAttachSchema = z8.object({
4343
+ level: z8.enum(["campaign", "adGroup", "ad"]),
4344
+ parent: refSchema,
4345
+ label: refSchema
4346
+ });
4347
+ var locationCriterionSchema = z8.object({
4348
+ criterionType: z8.literal("location"),
4349
+ geoTargetConstant: z8.union([z8.string().regex(GEO_TARGET_CONSTANT_REGEX), z8.string().regex(NUMERIC_ID_REGEX2)])
4350
+ });
4351
+ var languageCriterionSchema = z8.object({
4352
+ criterionType: z8.literal("language"),
4353
+ languageConstant: z8.union([z8.string().regex(LANGUAGE_CONSTANT_REGEX), z8.string().regex(NUMERIC_ID_REGEX2)])
4354
+ });
4355
+ var adScheduleCriterionSchema = z8.object({
4356
+ criterionType: z8.literal("adSchedule"),
4357
+ dayOfWeek: z8.enum(DAYS_OF_WEEK),
4358
+ startHour: z8.number().int().min(0).max(23),
4359
+ startMinute: z8.enum(["ZERO", "FIFTEEN", "THIRTY", "FORTY_FIVE"]).default("ZERO"),
4360
+ endHour: z8.number().int().min(0).max(24),
4361
+ endMinute: z8.enum(["ZERO", "FIFTEEN", "THIRTY", "FORTY_FIVE"]).default("ZERO")
4362
+ });
4363
+ var deviceCriterionSchema = z8.object({
4364
+ criterionType: z8.literal("device"),
4365
+ device: z8.enum(DEVICE_TYPES),
4366
+ bidModifier: z8.number().min(0.1).max(10).optional()
4367
+ });
4368
+ var campaignCriterionAddSchema = z8.object({
4369
+ campaign: refSchema,
4370
+ negative: z8.boolean().default(false),
4371
+ criterion: z8.discriminatedUnion("criterionType", [
4372
+ locationCriterionSchema,
4373
+ languageCriterionSchema,
4374
+ adScheduleCriterionSchema,
4375
+ deviceCriterionSchema
4376
+ ])
4377
+ });
4378
+ var GOOGLE_DRAFT_OP_KINDS = [
4379
+ "google.budget.create",
4380
+ "google.budget.update",
4381
+ "google.campaign.create",
4382
+ "google.campaign.update",
4383
+ "google.campaign.pause",
4384
+ "google.campaign.resume",
4385
+ "google.campaign.remove",
4386
+ "google.adGroup.create",
4387
+ "google.adGroup.update",
4388
+ "google.adGroup.pause",
4389
+ "google.adGroup.resume",
4390
+ "google.adGroup.remove",
4391
+ "google.keyword.add",
4392
+ "google.keyword.update",
4393
+ "google.keyword.remove",
4394
+ "google.negativeKeyword.add",
4395
+ "google.negativeKeyword.remove",
4396
+ "google.sharedSet.create",
4397
+ "google.sharedSetMember.add",
4398
+ "google.sharedSetMember.remove",
4399
+ "google.campaignSharedSet.attach",
4400
+ "google.campaignSharedSet.detach",
4401
+ "google.ad.create",
4402
+ "google.ad.update",
4403
+ "google.ad.pause",
4404
+ "google.ad.resume",
4405
+ "google.ad.remove",
4406
+ "google.asset.create",
4407
+ "google.assetLink.attach",
4408
+ "google.assetLink.detach",
4409
+ "google.audience.create",
4410
+ "google.audienceCriterion.attach",
4411
+ "google.audienceCriterion.detach",
4412
+ "google.conversionAction.create",
4413
+ "google.conversionAction.update",
4414
+ "google.biddingStrategy.create",
4415
+ "google.biddingStrategy.update",
4416
+ "google.label.create",
4417
+ "google.label.attach",
4418
+ "google.campaignCriterion.add",
4419
+ "google.campaignCriterion.remove"
4420
+ ];
4421
+ var googleDraftOpKindSchema = z8.enum(GOOGLE_DRAFT_OP_KINDS);
4422
+ function createOp2(kind, payload) {
4423
+ return z8.object({ kind: z8.literal(kind), customerId: customerIdSchema, payload });
4424
+ }
4425
+ function updateOp2(kind, payload) {
4426
+ return z8.object({ kind: z8.literal(kind), customerId: customerIdSchema, target: targetRefSchema, payload });
4427
+ }
4428
+ function targetOp(kind) {
4429
+ return z8.object({ kind: z8.literal(kind), customerId: customerIdSchema, target: targetRefSchema });
4430
+ }
4431
+ var googleDraftOpInputSchema = z8.discriminatedUnion("kind", [
4432
+ createOp2("google.budget.create", budgetCreateSchema),
4433
+ updateOp2("google.budget.update", budgetUpdateSchema),
4434
+ createOp2("google.campaign.create", campaignCreateSchema2),
4435
+ updateOp2("google.campaign.update", campaignUpdateSchema2),
4436
+ targetOp("google.campaign.pause"),
4437
+ targetOp("google.campaign.resume"),
4438
+ targetOp("google.campaign.remove"),
4439
+ createOp2("google.adGroup.create", adGroupCreateSchema),
4440
+ updateOp2("google.adGroup.update", adGroupUpdateSchema),
4441
+ targetOp("google.adGroup.pause"),
4442
+ targetOp("google.adGroup.resume"),
4443
+ targetOp("google.adGroup.remove"),
4444
+ createOp2("google.keyword.add", keywordAddSchema),
4445
+ updateOp2("google.keyword.update", keywordUpdateSchema),
4446
+ targetOp("google.keyword.remove"),
4447
+ createOp2("google.negativeKeyword.add", negativeKeywordAddSchema),
4448
+ targetOp("google.negativeKeyword.remove"),
4449
+ createOp2("google.sharedSet.create", sharedSetCreateSchema),
4450
+ createOp2("google.sharedSetMember.add", sharedSetMemberAddSchema),
4451
+ targetOp("google.sharedSetMember.remove"),
4452
+ createOp2("google.campaignSharedSet.attach", campaignSharedSetAttachSchema),
4453
+ targetOp("google.campaignSharedSet.detach"),
4454
+ createOp2("google.ad.create", adCreateSchema),
4455
+ updateOp2("google.ad.update", adUpdateSchema),
4456
+ targetOp("google.ad.pause"),
4457
+ targetOp("google.ad.resume"),
4458
+ targetOp("google.ad.remove"),
4459
+ createOp2("google.asset.create", assetCreateSchema),
4460
+ createOp2("google.assetLink.attach", assetLinkAttachSchema),
4461
+ targetOp("google.assetLink.detach"),
4462
+ createOp2("google.audience.create", audienceCreateSchema2),
4463
+ createOp2("google.audienceCriterion.attach", audienceCriterionAttachSchema),
4464
+ targetOp("google.audienceCriterion.detach"),
4465
+ createOp2("google.conversionAction.create", conversionActionCreateSchema),
4466
+ updateOp2("google.conversionAction.update", conversionActionUpdateSchema),
4467
+ createOp2("google.biddingStrategy.create", biddingStrategyCreateSchema),
4468
+ updateOp2("google.biddingStrategy.update", biddingStrategyUpdateSchema),
4469
+ createOp2("google.label.create", labelCreateSchema),
4470
+ createOp2("google.label.attach", labelAttachSchema),
4471
+ createOp2("google.campaignCriterion.add", campaignCriterionAddSchema),
4472
+ targetOp("google.campaignCriterion.remove")
4473
+ ]);
4474
+
4475
+ // ../api/src/ads-google/wire.ts
4476
+ import { z as z9 } from "zod";
4477
+ var googleWriteModeSchema = z9.enum(["live", "simulated"]);
4478
+ var googleDraftOpResultSchema = z9.object({
4479
+ status: z9.enum(["applied", "simulated", "failed", "skipped"]),
4480
+ resourceName: z9.string().optional(),
4481
+ error: z9.string().optional(),
4482
+ skippedBecause: z9.string().optional(),
4483
+ executedAt: z9.number().optional()
4484
+ });
4485
+ var googleDraftStageRequestSchema = z9.object({
4486
+ chatId: z9.string(),
4487
+ op: googleDraftOpInputSchema
4488
+ });
4489
+ var googleDraftStageResponseSchema = z9.object({
4490
+ staged: z9.literal(true),
4491
+ ref: z9.string(),
4492
+ kind: googleDraftOpKindSchema,
4493
+ mode: googleWriteModeSchema,
4494
+ dependsOn: z9.array(z9.string()),
4495
+ summary: z9.string(),
4496
+ warnings: z9.array(z9.string()),
4497
+ /** True when the op amended an already-staged op in place instead of appending a new one. */
4498
+ amended: z9.boolean().optional()
4499
+ });
4500
+ var googleDraftOpViewSchema = z9.object({
4501
+ ref: z9.string(),
4502
+ kind: googleDraftOpKindSchema,
4503
+ customerId: z9.string(),
4504
+ target: z9.string().optional(),
4505
+ dependsOn: z9.array(z9.string()),
4506
+ summary: z9.string(),
4507
+ stagedAt: z9.number(),
4508
+ result: googleDraftOpResultSchema.optional()
4509
+ });
4510
+ var googleDraftListRequestSchema = z9.object({
4511
+ chatId: z9.string()
4512
+ });
4513
+ var googleDraftListResponseSchema = z9.object({
4514
+ status: z9.enum(["active", "publishing", "applied", "discarded", "none"]),
4515
+ mode: googleWriteModeSchema,
4516
+ count: z9.number(),
4517
+ ops: z9.array(googleDraftOpViewSchema)
4518
+ });
4519
+ var googleDraftRemoveRequestSchema = z9.object({
4520
+ chatId: z9.string(),
4521
+ ref: z9.string()
4522
+ });
4523
+ var googleDraftRemoveResponseSchema = z9.object({
4524
+ /** The requested ref plus any dependents removed by cascade. */
4525
+ removed: z9.array(z9.string())
4526
+ });
4527
+ var googleDraftClearRequestSchema = z9.object({
4528
+ chatId: z9.string()
4529
+ });
4530
+ var googleDraftClearResponseSchema = z9.object({
4531
+ cleared: z9.number()
4532
+ });
4533
+ var googleFieldErrorSchema = z9.object({
4534
+ path: z9.string(),
4535
+ message: z9.string()
4536
+ });
4537
+ var googleDraftErrorResponseSchema = z9.object({
4538
+ code: z9.string(),
4539
+ error: z9.string(),
4540
+ fields: z9.array(googleFieldErrorSchema).optional()
4541
+ });
4542
+
4543
+ // src/commands/ads/google/write-shared.ts
4544
+ function failWriteValidation(message) {
4545
+ writeJsonEnvelope({ ok: false, error: { code: "VALIDATION_ERROR", message } });
4546
+ process.exit(1);
4547
+ }
4548
+ function requireCustomerId(args) {
4549
+ const raw = args["customer-id"] ?? args.customerId;
4550
+ if (!raw || !/^\d{10}$/.test(raw)) {
4551
+ failWriteValidation("pass --customer-id as the 10-digit Google Ads customer id (no dashes)");
4552
+ }
4553
+ return raw;
4554
+ }
4555
+ function requireTarget(args, entity) {
4556
+ const positional = Array.isArray(args._) ? args._[0] : void 0;
4557
+ const target = args.id ?? args.target ?? positional;
4558
+ if (typeof target !== "string" || target.length === 0) {
4559
+ failWriteValidation(`pass the ${entity} resource name or id as the positional argument`);
4560
+ }
4561
+ return target;
4562
+ }
4563
+ function requireStringFlag(value, flag) {
4564
+ if (typeof value !== "string" || value.length === 0) {
4565
+ failWriteValidation(`${flag} is required`);
4566
+ }
4567
+ return value;
4568
+ }
4569
+ function microsFlag(value, flag) {
4570
+ if (value === void 0 || value === null || value === "") {
4571
+ return void 0;
4572
+ }
4573
+ const num = Number(value);
4574
+ if (Number.isNaN(num) || num <= 0) {
4575
+ failWriteValidation(`${flag} must be a positive amount (major currency units, e.g. 50 or 50.00)`);
4576
+ }
4577
+ return toMicros(num);
4578
+ }
4579
+ function listFlag(value) {
4580
+ if (typeof value !== "string" || value.length === 0) {
4581
+ return void 0;
4582
+ }
4583
+ const items = value.split(",").map((v) => v.trim()).filter(Boolean);
4584
+ return items.length > 0 ? items : void 0;
4585
+ }
4586
+ function loadJsonFileArg(path11) {
4587
+ if (typeof path11 !== "string" || path11.length === 0) {
4588
+ return {};
4589
+ }
4590
+ try {
4591
+ const parsed = JSON.parse(readFileSync3(path11, "utf8"));
4592
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
4593
+ failWriteValidation(`${path11} must contain a JSON object`);
4594
+ }
4595
+ return parsed;
4596
+ } catch (err) {
4597
+ if (err instanceof SyntaxError) {
4598
+ failWriteValidation(`${path11} is not valid JSON: ${err.message}`);
4599
+ }
4600
+ throw err;
4601
+ }
4602
+ }
4603
+ function mergePayload(file, flags) {
4604
+ const merged = { ...file };
4605
+ for (const [key, value] of Object.entries(flags)) {
4606
+ if (value !== void 0) {
4607
+ merged[key] = value;
4608
+ }
4609
+ }
4610
+ return merged;
4611
+ }
4612
+ function handleGoogleError(err) {
4613
+ if (err instanceof ApiError) {
4614
+ writeJsonEnvelope({ ok: false, error: { code: err.code ?? "API_ERROR", message: err.message } });
4615
+ process.exit(1);
4616
+ }
4617
+ writeJsonEnvelope({
4618
+ ok: false,
4619
+ error: { code: "UNKNOWN", message: err instanceof Error ? err.message : String(err) }
4620
+ });
4621
+ process.exit(1);
4622
+ }
4623
+ async function stageGoogleOp(raw) {
4624
+ const preflight = googleDraftOpInputSchema.safeParse(raw);
4625
+ if (!preflight.success) {
4626
+ const fields = preflight.error.issues.map((issue) => ({ path: issue.path.join("."), message: issue.message }));
4627
+ writeJsonEnvelope({
4628
+ ok: false,
4629
+ error: {
4630
+ code: "VALIDATION_ERROR",
4631
+ message: fields.map((f) => f.path ? `${f.path}: ${f.message}` : f.message).join("; "),
4632
+ fields
4633
+ }
4634
+ });
4635
+ process.exit(1);
4636
+ }
4637
+ try {
4638
+ const chatId = requireChatId();
4639
+ const response = await apiPost("/api/ads/google/draft/stage", { chatId, op: preflight.data });
4640
+ writeJsonEnvelope(response);
4641
+ } catch (err) {
4642
+ handleGoogleError(err);
4643
+ }
4644
+ }
4645
+ async function stageCreate(kind, customerId, payload) {
4646
+ await stageGoogleOp({ kind, customerId, payload });
4647
+ }
4648
+ async function stageUpdate(kind, customerId, target, payload) {
4649
+ await stageGoogleOp({ kind, customerId, target, payload });
4650
+ }
4651
+ async function stageTarget(kind, customerId, target) {
4652
+ await stageGoogleOp({ kind, customerId, target });
4653
+ }
4654
+ async function draftAction(path11, body) {
4655
+ try {
4656
+ const chatId = requireChatId();
4657
+ const response = await apiPost(path11, { chatId, ...body });
4658
+ writeJsonEnvelope(response);
4659
+ } catch (err) {
4660
+ handleGoogleError(err);
4661
+ }
4662
+ }
4663
+
4664
+ // src/commands/ads/google/draft.ts
4665
+ var draftCommand2 = defineCommand22({
4666
+ meta: { name: "draft", description: "List, remove, or clear staged Google Ads write ops for this chat" },
4667
+ subCommands: {
4668
+ list: defineCommand22({
4669
+ meta: { name: "list", description: "List staged ops (with lineage, mode, and results)" },
4670
+ run: async () => {
4671
+ await draftAction("/api/ads/google/draft", {});
4672
+ }
4673
+ }),
4674
+ remove: defineCommand22({
4675
+ meta: { name: "remove", description: "Remove one staged op (cascades to dependents)" },
4676
+ args: { ref: { type: "positional", description: "Staged op ref (g_temp_* or target)", required: false } },
4677
+ run: async ({ args }) => {
4678
+ await draftAction("/api/ads/google/draft/remove", { ref: requireTarget(args, "op") });
4679
+ }
4680
+ }),
4681
+ clear: defineCommand22({
4682
+ meta: { name: "clear", description: "Discard all staged ops on this chat" },
4683
+ run: async () => {
4684
+ await draftAction("/api/ads/google/draft/clear", {});
4685
+ }
4686
+ })
4687
+ }
4688
+ });
4689
+
3834
4690
  // src/commands/ads/google/keywords/index.ts
3835
- import { defineCommand as defineCommand26 } from "citty";
4691
+ import { defineCommand as defineCommand27 } from "citty";
3836
4692
 
3837
4693
  // src/commands/ads/google/keywords/discover.ts
3838
- import { defineCommand as defineCommand22 } from "citty";
4694
+ import { defineCommand as defineCommand23 } from "citty";
3839
4695
 
3840
4696
  // src/geo-context.ts
3841
4697
  var GOOGLE_ADS_LOCATIONS = [
@@ -4110,7 +4966,7 @@ function handleKeywordError(err) {
4110
4966
  writeAdsJson({ ok: false, error: { code: "NETWORK_ERROR", message: "Unexpected error" } });
4111
4967
  process.exit(1);
4112
4968
  }
4113
- var discoverCommand = defineCommand22({
4969
+ var discoverCommand = defineCommand23({
4114
4970
  meta: {
4115
4971
  name: "discover",
4116
4972
  description: `Discover new keyword ideas from seed keywords or competitor URLs.
@@ -4172,7 +5028,7 @@ Examples:
4172
5028
  });
4173
5029
 
4174
5030
  // src/commands/ads/google/keywords/languages.ts
4175
- import { defineCommand as defineCommand23 } from "citty";
5031
+ import { defineCommand as defineCommand24 } from "citty";
4176
5032
  registerSchema({
4177
5033
  command: "ads.google.keywords.languages",
4178
5034
  description: "List all supported language IDs for --language flag in Google Ads keyword commands.",
@@ -4182,7 +5038,7 @@ var FIELDS = {
4182
5038
  id: "Language ID to pass as --language",
4183
5039
  name: "Language name"
4184
5040
  };
4185
- var languagesCommand = defineCommand23({
5041
+ var languagesCommand = defineCommand24({
4186
5042
  meta: {
4187
5043
  name: "languages",
4188
5044
  description: "List all supported language IDs for --language flag."
@@ -4193,7 +5049,7 @@ var languagesCommand = defineCommand23({
4193
5049
  });
4194
5050
 
4195
5051
  // src/commands/ads/google/keywords/locations.ts
4196
- import { defineCommand as defineCommand24 } from "citty";
5052
+ import { defineCommand as defineCommand25 } from "citty";
4197
5053
  registerSchema({
4198
5054
  command: "ads.google.keywords.locations",
4199
5055
  description: "List all supported geo target IDs for --location flag in Google Ads keyword commands.",
@@ -4203,7 +5059,7 @@ var FIELDS2 = {
4203
5059
  id: "Geo target ID to pass as --location",
4204
5060
  name: "Country/region name"
4205
5061
  };
4206
- var locationsCommand = defineCommand24({
5062
+ var locationsCommand = defineCommand25({
4207
5063
  meta: {
4208
5064
  name: "locations",
4209
5065
  description: "List all supported geo target IDs for --location flag."
@@ -4214,7 +5070,7 @@ var locationsCommand = defineCommand24({
4214
5070
  });
4215
5071
 
4216
5072
  // src/commands/ads/google/keywords/metrics.ts
4217
- import { defineCommand as defineCommand25 } from "citty";
5073
+ import { defineCommand as defineCommand26 } from "citty";
4218
5074
  registerSchema({
4219
5075
  command: "ads.google.keywords.metrics",
4220
5076
  description: "Get historical metrics for specific keywords. Returns { historical_metrics: [...] } with snake_case fields matching the Google Ads API. IMPORTANT: If --location and --language are omitted, defaults to United States (2840) and English (1000). The response includes a query_context object showing which location/language were used.",
@@ -4238,7 +5094,7 @@ registerSchema({
4238
5094
  output: { type: "string", description: "Format: json|csv|jsonl|md", required: false, default: "json" }
4239
5095
  }
4240
5096
  });
4241
- var metricsCommand = defineCommand25({
5097
+ var metricsCommand = defineCommand26({
4242
5098
  meta: {
4243
5099
  name: "metrics",
4244
5100
  description: `Get historical search metrics for specific keywords.
@@ -4325,7 +5181,7 @@ Examples:
4325
5181
  });
4326
5182
 
4327
5183
  // src/commands/ads/google/keywords/index.ts
4328
- var keywordsCommand = defineCommand26({
5184
+ var keywordsCommand = defineCommand27({
4329
5185
  meta: {
4330
5186
  name: "keywords",
4331
5187
  description: `Keyword research tools. Subcommands: discover, metrics, locations, languages.
@@ -4345,8 +5201,8 @@ Examples:
4345
5201
  });
4346
5202
 
4347
5203
  // src/commands/ads/google/library/index.ts
4348
- import { defineCommand as defineCommand27 } from "citty";
4349
- var listAdvertisers = defineCommand27({
5204
+ import { defineCommand as defineCommand28 } from "citty";
5205
+ var listAdvertisers = defineCommand28({
4350
5206
  meta: {
4351
5207
  name: "list-advertisers",
4352
5208
  description: "List tracked Google advertisers and their accounts"
@@ -4363,7 +5219,7 @@ var listAdvertisers = defineCommand27({
4363
5219
  }
4364
5220
  }
4365
5221
  });
4366
- var syncStatus = defineCommand27({
5222
+ var syncStatus = defineCommand28({
4367
5223
  meta: {
4368
5224
  name: "sync-status",
4369
5225
  description: "Check the sync status and ad counts of a Google account"
@@ -4383,7 +5239,7 @@ var syncStatus = defineCommand27({
4383
5239
  writeAdsJson({ ok: true, data });
4384
5240
  }
4385
5241
  });
4386
- var searchAds = defineCommand27({
5242
+ var searchAds = defineCommand28({
4387
5243
  meta: {
4388
5244
  name: "search-ads",
4389
5245
  description: "Search and filter Google ads for an account"
@@ -4440,7 +5296,7 @@ var searchAds = defineCommand27({
4440
5296
  }
4441
5297
  }
4442
5298
  });
4443
- var searchAdvertiser = defineCommand27({
5299
+ var searchAdvertiser = defineCommand28({
4444
5300
  meta: {
4445
5301
  name: "search-advertiser",
4446
5302
  description: "Search for an advertiser on the Google Ads Transparency Center"
@@ -4475,7 +5331,7 @@ var searchAdvertiser = defineCommand27({
4475
5331
  function sleep(ms) {
4476
5332
  return new Promise((resolve5) => setTimeout(resolve5, ms));
4477
5333
  }
4478
- var track = defineCommand27({
5334
+ var track = defineCommand28({
4479
5335
  meta: {
4480
5336
  name: "track",
4481
5337
  description: "Track a new Google advertiser (from search results). Waits for initial sync to complete before returning."
@@ -4533,7 +5389,7 @@ var track = defineCommand27({
4533
5389
  process.exit(1);
4534
5390
  }
4535
5391
  });
4536
- var sync = defineCommand27({
5392
+ var sync = defineCommand28({
4537
5393
  meta: {
4538
5394
  name: "sync",
4539
5395
  description: "Trigger an immediate sync for a Google account. Waits for completion before returning."
@@ -4577,7 +5433,7 @@ var sync = defineCommand27({
4577
5433
  process.exit(1);
4578
5434
  }
4579
5435
  });
4580
- var searchCompetitors = defineCommand27({
5436
+ var searchCompetitors = defineCommand28({
4581
5437
  meta: {
4582
5438
  name: "search-competitors",
4583
5439
  description: "Search for competitors running Google ads for a keyword (DataForSEO)"
@@ -4609,7 +5465,7 @@ var searchCompetitors = defineCommand27({
4609
5465
  }
4610
5466
  }
4611
5467
  });
4612
- var library = defineCommand27({
5468
+ var library = defineCommand28({
4613
5469
  meta: {
4614
5470
  name: "library",
4615
5471
  description: "Manage and search the Google Ads Library"
@@ -4626,9 +5482,9 @@ var library = defineCommand27({
4626
5482
  });
4627
5483
 
4628
5484
  // src/commands/ads/google/query.ts
4629
- import { appendFileSync, existsSync as existsSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
5485
+ import { appendFileSync, existsSync as existsSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
4630
5486
  import { resolve } from "path";
4631
- import { defineCommand as defineCommand28 } from "citty";
5487
+ import { defineCommand as defineCommand29 } from "citty";
4632
5488
 
4633
5489
  // src/commands/ads/google/preflight.ts
4634
5490
  function buildCommand2(query, customerId) {
@@ -4920,7 +5776,7 @@ function writeRowsToFile(filePath, rows, fields, append) {
4920
5776
  `, "utf-8");
4921
5777
  }
4922
5778
  } else if (append && existsSync3(filePath)) {
4923
- const existing = JSON.parse(readFileSync3(filePath, "utf-8"));
5779
+ const existing = JSON.parse(readFileSync4(filePath, "utf-8"));
4924
5780
  writeFileSync2(filePath, JSON.stringify([...existing, ...rows], null, 2), "utf-8");
4925
5781
  } else {
4926
5782
  writeFileSync2(filePath, JSON.stringify(rows, null, 2), "utf-8");
@@ -5084,7 +5940,7 @@ function handleQueryError(err, finalQuery, customerId) {
5084
5940
  });
5085
5941
  process.exit(1);
5086
5942
  }
5087
- var queryCommand = defineCommand28({
5943
+ var queryCommand = defineCommand29({
5088
5944
  meta: {
5089
5945
  name: "query",
5090
5946
  description: `Run GAQL queries against Google Ads. Supports raw GAQL, presets, pagination, file export, and caching.
@@ -5141,8 +5997,516 @@ Examples:
5141
5997
  }
5142
5998
  });
5143
5999
 
6000
+ // src/commands/ads/google/write-commands.ts
6001
+ import { defineCommand as defineCommand30 } from "citty";
6002
+ var customerIdArg = { "customer-id": { type: "string", description: "10-digit Google Ads customer id" } };
6003
+ var fileArg = {
6004
+ file: { type: "string", description: "JSON file with the full op payload (flags override)" }
6005
+ };
6006
+ var budgetsCommand = defineCommand30({
6007
+ meta: { name: "budgets", description: "Stage campaign budget create/update" },
6008
+ subCommands: {
6009
+ create: defineCommand30({
6010
+ meta: { name: "create", description: "Stage a campaign budget" },
6011
+ args: {
6012
+ ...customerIdArg,
6013
+ ...fileArg,
6014
+ name: { type: "string", description: "Budget name" },
6015
+ amount: { type: "string", description: "Daily amount in major currency units (e.g. 50)" },
6016
+ delivery: { type: "string", description: "STANDARD | ACCELERATED" },
6017
+ shared: { type: "boolean", description: "Explicitly shared budget" }
6018
+ },
6019
+ run: async ({ args }) => {
6020
+ const customerId = requireCustomerId(args);
6021
+ const payload = mergePayload(loadJsonFileArg(args.file), {
6022
+ name: args.name,
6023
+ amountMicros: microsFlag(args.amount, "--amount"),
6024
+ deliveryMethod: args.delivery,
6025
+ explicitlyShared: args.shared || void 0
6026
+ });
6027
+ await stageCreate("google.budget.create", customerId, payload);
6028
+ }
6029
+ }),
6030
+ update: defineCommand30({
6031
+ meta: { name: "update", description: "Stage a budget update" },
6032
+ args: {
6033
+ ...customerIdArg,
6034
+ ...fileArg,
6035
+ name: { type: "string" },
6036
+ amount: { type: "string", description: "New daily amount in major currency units" },
6037
+ delivery: { type: "string" }
6038
+ },
6039
+ run: async ({ args }) => {
6040
+ const customerId = requireCustomerId(args);
6041
+ const target = requireTarget(args, "budget");
6042
+ const payload = mergePayload(loadJsonFileArg(args.file), {
6043
+ name: args.name,
6044
+ amountMicros: microsFlag(args.amount, "--amount"),
6045
+ deliveryMethod: args.delivery
6046
+ });
6047
+ await stageUpdate("google.budget.update", customerId, target, payload);
6048
+ }
6049
+ })
6050
+ }
6051
+ });
6052
+ function biddingFromFlags(args) {
6053
+ const type = args["bidding-strategy"];
6054
+ if (!type) {
6055
+ return void 0;
6056
+ }
6057
+ return {
6058
+ type,
6059
+ targetCpaMicros: microsFlag(args["target-cpa"], "--target-cpa"),
6060
+ targetRoas: args["target-roas"] !== void 0 ? Number(args["target-roas"]) : void 0
6061
+ };
6062
+ }
6063
+ var campaignsCommand = defineCommand30({
6064
+ meta: { name: "campaigns", description: "Stage campaign create/update/pause/resume/remove" },
6065
+ subCommands: {
6066
+ create: defineCommand30({
6067
+ meta: { name: "create", description: "Stage a campaign" },
6068
+ args: {
6069
+ ...customerIdArg,
6070
+ ...fileArg,
6071
+ name: { type: "string" },
6072
+ "channel-type": {
6073
+ type: "string",
6074
+ description: "SEARCH | DISPLAY | SHOPPING | VIDEO | PERFORMANCE_MAX | DEMAND_GEN | \u2026"
6075
+ },
6076
+ "sub-type": { type: "string", description: "Advertising channel sub-type" },
6077
+ "budget-ref": { type: "string", description: "Budget ref (g_temp_*, id, or resource name)" },
6078
+ "bidding-strategy": {
6079
+ type: "string",
6080
+ description: "MANUAL_CPC | MAXIMIZE_CONVERSIONS | TARGET_CPA | TARGET_ROAS | \u2026"
6081
+ },
6082
+ "target-cpa": { type: "string", description: "Target CPA (major units) for TARGET_CPA" },
6083
+ "target-roas": { type: "string", description: "Target ROAS (e.g. 4.0) for TARGET_ROAS" },
6084
+ objective: { type: "string", description: "Advisory UI objective (SALES, LEADS, \u2026)" },
6085
+ "start-date": { type: "string", description: "YYYY-MM-DD" },
6086
+ "end-date": { type: "string", description: "YYYY-MM-DD" },
6087
+ status: { type: "string", description: "ENABLED | PAUSED (default PAUSED)" }
6088
+ },
6089
+ run: async ({ args }) => {
6090
+ const customerId = requireCustomerId(args);
6091
+ const payload = mergePayload(loadJsonFileArg(args.file), {
6092
+ name: args.name,
6093
+ channelType: args["channel-type"],
6094
+ channelSubType: args["sub-type"],
6095
+ budget: args["budget-ref"],
6096
+ bidding: biddingFromFlags(args),
6097
+ objective: args.objective,
6098
+ startDate: args["start-date"],
6099
+ endDate: args["end-date"],
6100
+ status: args.status
6101
+ });
6102
+ await stageCreate("google.campaign.create", customerId, payload);
6103
+ }
6104
+ }),
6105
+ update: defineCommand30({
6106
+ meta: { name: "update", description: "Stage a campaign update" },
6107
+ args: {
6108
+ ...customerIdArg,
6109
+ ...fileArg,
6110
+ name: { type: "string" },
6111
+ "budget-ref": { type: "string" },
6112
+ "bidding-strategy": { type: "string" },
6113
+ "target-cpa": { type: "string" },
6114
+ "target-roas": { type: "string" },
6115
+ status: { type: "string" }
6116
+ },
6117
+ run: async ({ args }) => {
6118
+ const customerId = requireCustomerId(args);
6119
+ const target = requireTarget(args, "campaign");
6120
+ const payload = mergePayload(loadJsonFileArg(args.file), {
6121
+ name: args.name,
6122
+ budget: args["budget-ref"],
6123
+ bidding: biddingFromFlags(args),
6124
+ status: args.status
6125
+ });
6126
+ await stageUpdate("google.campaign.update", customerId, target, payload);
6127
+ }
6128
+ }),
6129
+ pause: statusCommand2("google.campaign.pause", "campaign"),
6130
+ resume: statusCommand2("google.campaign.resume", "campaign"),
6131
+ remove: statusCommand2("google.campaign.remove", "campaign")
6132
+ }
6133
+ });
6134
+ function statusCommand2(kind, entity) {
6135
+ return defineCommand30({
6136
+ meta: { name: kind.split(".")[2], description: `Stage a ${entity} ${kind.split(".")[2]}` },
6137
+ args: {
6138
+ ...customerIdArg,
6139
+ id: { type: "positional", description: `${entity} resource name or id`, required: false }
6140
+ },
6141
+ run: async ({ args }) => {
6142
+ const customerId = requireCustomerId(args);
6143
+ await stageTarget(kind, customerId, requireTarget(args, entity));
6144
+ }
6145
+ });
6146
+ }
6147
+ var adGroupsCommand = defineCommand30({
6148
+ meta: { name: "ad-groups", description: "Stage ad group create/update/pause/resume/remove" },
6149
+ subCommands: {
6150
+ create: defineCommand30({
6151
+ meta: { name: "create", description: "Stage an ad group" },
6152
+ args: {
6153
+ ...customerIdArg,
6154
+ ...fileArg,
6155
+ name: { type: "string" },
6156
+ "campaign-ref": { type: "string", description: "Campaign ref (g_temp_*, id, or resource name)" },
6157
+ type: { type: "string", description: "Ad group type (default SEARCH_STANDARD)" },
6158
+ "cpc-bid": { type: "string", description: "Default CPC bid in major units" },
6159
+ status: { type: "string" }
6160
+ },
6161
+ run: async ({ args }) => {
6162
+ const customerId = requireCustomerId(args);
6163
+ const payload = mergePayload(loadJsonFileArg(args.file), {
6164
+ name: args.name,
6165
+ campaign: args["campaign-ref"],
6166
+ type: args.type,
6167
+ cpcBidMicros: microsFlag(args["cpc-bid"], "--cpc-bid"),
6168
+ status: args.status
6169
+ });
6170
+ await stageCreate("google.adGroup.create", customerId, payload);
6171
+ }
6172
+ }),
6173
+ update: defineCommand30({
6174
+ meta: { name: "update", description: "Stage an ad group update" },
6175
+ args: {
6176
+ ...customerIdArg,
6177
+ ...fileArg,
6178
+ name: { type: "string" },
6179
+ "cpc-bid": { type: "string" },
6180
+ status: { type: "string" }
6181
+ },
6182
+ run: async ({ args }) => {
6183
+ const customerId = requireCustomerId(args);
6184
+ const target = requireTarget(args, "ad group");
6185
+ const payload = mergePayload(loadJsonFileArg(args.file), {
6186
+ name: args.name,
6187
+ cpcBidMicros: microsFlag(args["cpc-bid"], "--cpc-bid"),
6188
+ status: args.status
6189
+ });
6190
+ await stageUpdate("google.adGroup.update", customerId, target, payload);
6191
+ }
6192
+ }),
6193
+ pause: statusCommand2("google.adGroup.pause", "ad group"),
6194
+ resume: statusCommand2("google.adGroup.resume", "ad group"),
6195
+ remove: statusCommand2("google.adGroup.remove", "ad group")
6196
+ }
6197
+ });
6198
+ var keywordWriteSubcommands = {
6199
+ add: defineCommand30({
6200
+ meta: { name: "add", description: "Add a keyword to an ad group" },
6201
+ args: {
6202
+ ...customerIdArg,
6203
+ "ad-group-ref": { type: "string", description: "Ad group ref (g_temp_*, id, or resource name)" },
6204
+ text: { type: "string", description: "Keyword text" },
6205
+ "match-type": { type: "string", description: "EXACT | PHRASE | BROAD" },
6206
+ "cpc-bid": { type: "string", description: "Keyword CPC bid in major units" },
6207
+ "final-url": { type: "string", description: "Keyword-level final URL" }
6208
+ },
6209
+ run: async ({ args }) => {
6210
+ const customerId = requireCustomerId(args);
6211
+ await stageCreate("google.keyword.add", customerId, {
6212
+ adGroup: requireStringFlag(args["ad-group-ref"], "--ad-group-ref"),
6213
+ text: requireStringFlag(args.text, "--text"),
6214
+ matchType: requireStringFlag(args["match-type"], "--match-type"),
6215
+ cpcBidMicros: microsFlag(args["cpc-bid"], "--cpc-bid"),
6216
+ finalUrls: args["final-url"] ? [args["final-url"]] : void 0
6217
+ });
6218
+ }
6219
+ }),
6220
+ update: defineCommand30({
6221
+ meta: { name: "update", description: "Update a keyword" },
6222
+ args: { ...customerIdArg, "cpc-bid": { type: "string" }, status: { type: "string" } },
6223
+ run: async ({ args }) => {
6224
+ const customerId = requireCustomerId(args);
6225
+ await stageUpdate("google.keyword.update", customerId, requireTarget(args, "keyword"), {
6226
+ cpcBidMicros: microsFlag(args["cpc-bid"], "--cpc-bid"),
6227
+ status: args.status
6228
+ });
6229
+ }
6230
+ }),
6231
+ remove: statusCommand2("google.keyword.remove", "keyword")
6232
+ };
6233
+ var negativeKeywordsCommand = defineCommand30({
6234
+ meta: { name: "negative-keywords", description: "Stage negative keyword add/remove (ad-group or campaign level)" },
6235
+ subCommands: {
6236
+ add: defineCommand30({
6237
+ meta: { name: "add", description: "Add a negative keyword" },
6238
+ args: {
6239
+ ...customerIdArg,
6240
+ level: { type: "string", description: "adGroup | campaign" },
6241
+ "parent-ref": { type: "string", description: "Ad group or campaign ref" },
6242
+ text: { type: "string" },
6243
+ "match-type": { type: "string", description: "EXACT | PHRASE | BROAD" }
6244
+ },
6245
+ run: async ({ args }) => {
6246
+ const customerId = requireCustomerId(args);
6247
+ await stageCreate("google.negativeKeyword.add", customerId, {
6248
+ level: requireStringFlag(args.level, "--level"),
6249
+ parent: requireStringFlag(args["parent-ref"], "--parent-ref"),
6250
+ text: requireStringFlag(args.text, "--text"),
6251
+ matchType: requireStringFlag(args["match-type"], "--match-type")
6252
+ });
6253
+ }
6254
+ }),
6255
+ remove: statusCommand2("google.negativeKeyword.remove", "negative keyword")
6256
+ }
6257
+ });
6258
+ var keywordListsCommand = defineCommand30({
6259
+ meta: { name: "keyword-lists", description: "Stage shared negative keyword lists (create/add/attach/detach)" },
6260
+ subCommands: {
6261
+ create: defineCommand30({
6262
+ meta: { name: "create", description: "Create a shared negative keyword list" },
6263
+ args: {
6264
+ ...customerIdArg,
6265
+ name: { type: "string" },
6266
+ type: {
6267
+ type: "string",
6268
+ description: "NEGATIVE_KEYWORDS (default) | NEGATIVE_PLACEMENTS | ACCOUNT_LEVEL_NEGATIVE_KEYWORDS"
6269
+ }
6270
+ },
6271
+ run: async ({ args }) => {
6272
+ const customerId = requireCustomerId(args);
6273
+ await stageCreate("google.sharedSet.create", customerId, {
6274
+ name: requireStringFlag(args.name, "--name"),
6275
+ type: args.type
6276
+ });
6277
+ }
6278
+ }),
6279
+ add: defineCommand30({
6280
+ meta: { name: "add", description: "Add a keyword to a shared list" },
6281
+ args: {
6282
+ ...customerIdArg,
6283
+ "list-ref": { type: "string", description: "Shared set ref" },
6284
+ text: { type: "string" },
6285
+ "match-type": { type: "string" }
6286
+ },
6287
+ run: async ({ args }) => {
6288
+ const customerId = requireCustomerId(args);
6289
+ await stageCreate("google.sharedSetMember.add", customerId, {
6290
+ sharedSet: requireStringFlag(args["list-ref"], "--list-ref"),
6291
+ text: requireStringFlag(args.text, "--text"),
6292
+ matchType: requireStringFlag(args["match-type"], "--match-type")
6293
+ });
6294
+ }
6295
+ }),
6296
+ attach: defineCommand30({
6297
+ meta: { name: "attach", description: "Attach a keyword list to a campaign" },
6298
+ args: { ...customerIdArg, "campaign-ref": { type: "string" }, "list-ref": { type: "string" } },
6299
+ run: async ({ args }) => {
6300
+ const customerId = requireCustomerId(args);
6301
+ await stageCreate("google.campaignSharedSet.attach", customerId, {
6302
+ campaign: requireStringFlag(args["campaign-ref"], "--campaign-ref"),
6303
+ sharedSet: requireStringFlag(args["list-ref"], "--list-ref")
6304
+ });
6305
+ }
6306
+ }),
6307
+ detach: statusCommand2("google.campaignSharedSet.detach", "campaign shared set")
6308
+ }
6309
+ });
6310
+ function rsaContentFromFlags(args) {
6311
+ const headlines = listFlag(args.headlines);
6312
+ const descriptions = listFlag(args.descriptions);
6313
+ if (!headlines || !descriptions) {
6314
+ failWriteValidation("responsive search ads need --headlines and --descriptions (comma-separated), or use --file");
6315
+ }
6316
+ const finalUrls = listFlag(args["final-url"]);
6317
+ if (!finalUrls) {
6318
+ failWriteValidation("--final-url is required for a responsive search ad");
6319
+ }
6320
+ return {
6321
+ format: "responsiveSearch",
6322
+ headlines: headlines.map((text) => ({ text })),
6323
+ descriptions: descriptions.map((text) => ({ text })),
6324
+ path1: args.path1,
6325
+ path2: args.path2,
6326
+ finalUrls
6327
+ };
6328
+ }
6329
+ var adsCommand = defineCommand30({
6330
+ meta: { name: "ads", description: "Stage ad create/update/pause/resume/remove" },
6331
+ subCommands: {
6332
+ create: defineCommand30({
6333
+ meta: { name: "create", description: "Stage an ad (responsive search via flags; other formats via --file)" },
6334
+ args: {
6335
+ ...customerIdArg,
6336
+ ...fileArg,
6337
+ "ad-group-ref": { type: "string", description: "Ad group ref" },
6338
+ format: {
6339
+ type: "string",
6340
+ description: "responsiveSearch (default) | responsiveDisplay | performanceMaxAssetGroup | call | app | video | demandGen"
6341
+ },
6342
+ headlines: { type: "string", description: "Comma-separated headlines (RSA)" },
6343
+ descriptions: { type: "string", description: "Comma-separated descriptions (RSA)" },
6344
+ path1: { type: "string" },
6345
+ path2: { type: "string" },
6346
+ "final-url": { type: "string", description: "Comma-separated final URLs" },
6347
+ status: { type: "string" }
6348
+ },
6349
+ run: async ({ args }) => {
6350
+ const customerId = requireCustomerId(args);
6351
+ const file = loadJsonFileArg(args.file);
6352
+ const format = args.format ?? "responsiveSearch";
6353
+ const content = file.content ?? (format === "responsiveSearch" ? rsaContentFromFlags(args) : failWriteValidation(`--format ${format} needs --file with the ad content`));
6354
+ await stageCreate("google.ad.create", customerId, {
6355
+ adGroup: requireStringFlag(args["ad-group-ref"] ?? file.adGroup, "--ad-group-ref"),
6356
+ status: args.status ?? file.status,
6357
+ content
6358
+ });
6359
+ }
6360
+ }),
6361
+ update: defineCommand30({
6362
+ meta: { name: "update", description: "Stage an ad update" },
6363
+ args: { ...customerIdArg, ...fileArg, status: { type: "string" } },
6364
+ run: async ({ args }) => {
6365
+ const customerId = requireCustomerId(args);
6366
+ const file = loadJsonFileArg(args.file);
6367
+ await stageUpdate(
6368
+ "google.ad.update",
6369
+ customerId,
6370
+ requireTarget(args, "ad"),
6371
+ mergePayload(file, { status: args.status })
6372
+ );
6373
+ }
6374
+ }),
6375
+ pause: statusCommand2("google.ad.pause", "ad"),
6376
+ resume: statusCommand2("google.ad.resume", "ad"),
6377
+ remove: statusCommand2("google.ad.remove", "ad")
6378
+ }
6379
+ });
6380
+ function fileCreateCommand(name, kind, description) {
6381
+ return defineCommand30({
6382
+ meta: { name, description },
6383
+ args: { ...customerIdArg, ...fileArg },
6384
+ run: async ({ args }) => {
6385
+ const customerId = requireCustomerId(args);
6386
+ const payload = loadJsonFileArg(args.file);
6387
+ if (Object.keys(payload).length === 0) {
6388
+ failWriteValidation(`${kind} needs --file with the op payload`);
6389
+ }
6390
+ await stageGoogleOp({ kind, customerId, payload });
6391
+ }
6392
+ });
6393
+ }
6394
+ var assetsCommand = defineCommand30({
6395
+ meta: { name: "assets", description: "Stage asset create + asset-link attach/detach (via --file)" },
6396
+ subCommands: {
6397
+ create: fileCreateCommand(
6398
+ "create",
6399
+ "google.asset.create",
6400
+ "Stage an asset (text/image/sitelink/callout/structuredSnippet/\u2026)"
6401
+ ),
6402
+ attach: fileCreateCommand("attach", "google.assetLink.attach", "Attach an asset to a campaign/adGroup/customer"),
6403
+ detach: statusCommand2("google.assetLink.detach", "asset link")
6404
+ }
6405
+ });
6406
+ var audiencesCommand = defineCommand30({
6407
+ meta: { name: "audiences", description: "Stage audience (user list) create + criterion attach/detach (via --file)" },
6408
+ subCommands: {
6409
+ create: fileCreateCommand("create", "google.audience.create", "Stage a user-list audience"),
6410
+ attach: fileCreateCommand(
6411
+ "attach",
6412
+ "google.audienceCriterion.attach",
6413
+ "Target/exclude an audience on a campaign/adGroup"
6414
+ ),
6415
+ detach: statusCommand2("google.audienceCriterion.detach", "audience criterion")
6416
+ }
6417
+ });
6418
+ var conversionsCommand = defineCommand30({
6419
+ meta: { name: "conversions", description: "Stage conversion action create/update (via --file)" },
6420
+ subCommands: {
6421
+ create: fileCreateCommand("create", "google.conversionAction.create", "Stage a conversion action"),
6422
+ update: defineCommand30({
6423
+ meta: { name: "update", description: "Stage a conversion action update" },
6424
+ args: { ...customerIdArg, ...fileArg },
6425
+ run: async ({ args }) => {
6426
+ const customerId = requireCustomerId(args);
6427
+ await stageUpdate(
6428
+ "google.conversionAction.update",
6429
+ customerId,
6430
+ requireTarget(args, "conversion action"),
6431
+ loadJsonFileArg(args.file)
6432
+ );
6433
+ }
6434
+ })
6435
+ }
6436
+ });
6437
+ var biddingStrategiesCommand = defineCommand30({
6438
+ meta: { name: "bidding-strategies", description: "Stage portfolio bidding strategy create/update (via --file)" },
6439
+ subCommands: {
6440
+ create: fileCreateCommand("create", "google.biddingStrategy.create", "Stage a portfolio bidding strategy"),
6441
+ update: defineCommand30({
6442
+ meta: { name: "update", description: "Stage a portfolio bidding strategy update" },
6443
+ args: { ...customerIdArg, ...fileArg },
6444
+ run: async ({ args }) => {
6445
+ const customerId = requireCustomerId(args);
6446
+ await stageUpdate(
6447
+ "google.biddingStrategy.update",
6448
+ customerId,
6449
+ requireTarget(args, "bidding strategy"),
6450
+ loadJsonFileArg(args.file)
6451
+ );
6452
+ }
6453
+ })
6454
+ }
6455
+ });
6456
+ var labelsCommand = defineCommand30({
6457
+ meta: { name: "labels", description: "Stage label create + attach (via --file)" },
6458
+ subCommands: {
6459
+ create: defineCommand30({
6460
+ meta: { name: "create", description: "Create a label" },
6461
+ args: {
6462
+ ...customerIdArg,
6463
+ name: { type: "string" },
6464
+ "background-color": { type: "string" },
6465
+ description: { type: "string" }
6466
+ },
6467
+ run: async ({ args }) => {
6468
+ const customerId = requireCustomerId(args);
6469
+ await stageCreate("google.label.create", customerId, {
6470
+ name: requireStringFlag(args.name, "--name"),
6471
+ backgroundColor: args["background-color"],
6472
+ description: args.description
6473
+ });
6474
+ }
6475
+ }),
6476
+ attach: fileCreateCommand("attach", "google.label.attach", "Attach a label to a campaign/adGroup/ad")
6477
+ }
6478
+ });
6479
+ var campaignCriteriaCommand = defineCommand30({
6480
+ meta: {
6481
+ name: "campaign-criteria",
6482
+ description: "Stage campaign criteria (location/language/adSchedule/device) add/remove (via --file)"
6483
+ },
6484
+ subCommands: {
6485
+ add: fileCreateCommand("add", "google.campaignCriterion.add", "Add a campaign criterion"),
6486
+ remove: statusCommand2("google.campaignCriterion.remove", "campaign criterion")
6487
+ }
6488
+ });
6489
+ var googleWriteCommands = {
6490
+ budgets: budgetsCommand,
6491
+ campaigns: campaignsCommand,
6492
+ "ad-groups": adGroupsCommand,
6493
+ "negative-keywords": negativeKeywordsCommand,
6494
+ "keyword-lists": keywordListsCommand,
6495
+ ads: adsCommand,
6496
+ assets: assetsCommand,
6497
+ audiences: audiencesCommand,
6498
+ conversions: conversionsCommand,
6499
+ "bidding-strategies": biddingStrategiesCommand,
6500
+ labels: labelsCommand,
6501
+ "campaign-criteria": campaignCriteriaCommand
6502
+ };
6503
+
5144
6504
  // src/commands/ads/google/index.ts
5145
- var googleCommand = defineCommand29({
6505
+ var keywordsWithWrites = defineCommand31({
6506
+ meta: keywordsCommand.meta,
6507
+ subCommands: { ...keywordsCommand.subCommands, ...keywordWriteSubcommands }
6508
+ });
6509
+ var googleCommand = defineCommand31({
5146
6510
  meta: {
5147
6511
  name: "google",
5148
6512
  description: `Google Ads commands. Query campaigns, keywords, search terms, and more via GAQL.
@@ -5157,20 +6521,28 @@ Examples:
5157
6521
  baker ads google query --preset campaign-performance --customer-id 1234567890
5158
6522
  baker ads google currency --customer-id 1234567890
5159
6523
  baker ads google keywords discover --customer-id 1234567890 --seeds "running shoes"
5160
- baker ads google library list-advertisers \u2014 list tracked Google advertisers`
6524
+ baker ads google library list-advertisers \u2014 list tracked Google advertisers
6525
+
6526
+ Staged writes (never touch Google until the chat is published):
6527
+ baker ads google budgets create --customer-id 1234567890 --name "Search" --amount 50
6528
+ baker ads google campaigns create --customer-id 1234567890 --name "Brand" --channel-type SEARCH --budget-ref g_temp_\u2026 --bidding-strategy MANUAL_CPC
6529
+ baker ads google keyword-lists create --customer-id 1234567890 --name "Brand exclusions"
6530
+ baker ads google draft list \u2014 review staged Google Ads changes`
5161
6531
  },
5162
6532
  subCommands: {
5163
6533
  accounts: accountsCommand,
5164
6534
  currency: currencyCommand,
5165
6535
  changes: changesCommand,
5166
6536
  query: queryCommand,
5167
- keywords: keywordsCommand,
5168
- library
6537
+ keywords: keywordsWithWrites,
6538
+ library,
6539
+ ...googleWriteCommands,
6540
+ draft: draftCommand2
5169
6541
  }
5170
6542
  });
5171
6543
 
5172
6544
  // src/commands/ads/linkedin/index.ts
5173
- import { defineCommand as defineCommand49 } from "citty";
6545
+ import { defineCommand as defineCommand51 } from "citty";
5174
6546
 
5175
6547
  // src/commands/ads/linkedin/schemas.ts
5176
6548
  registerSchema({
@@ -5831,7 +7203,7 @@ registerSchema({
5831
7203
  });
5832
7204
 
5833
7205
  // src/commands/ads/linkedin/account.ts
5834
- import { defineCommand as defineCommand30 } from "citty";
7206
+ import { defineCommand as defineCommand32 } from "citty";
5835
7207
 
5836
7208
  // src/commands/ads/linkedin/shared.ts
5837
7209
  var DAY_MS2 = 864e5;
@@ -5934,7 +7306,7 @@ function resolveStatusFilter(args) {
5934
7306
  }
5935
7307
 
5936
7308
  // src/commands/ads/linkedin/account.ts
5937
- var accountCommand = defineCommand30({
7309
+ var accountCommand = defineCommand32({
5938
7310
  meta: {
5939
7311
  name: "account",
5940
7312
  description: `Single LinkedIn ad account detail (currency, status, type).
@@ -5968,9 +7340,9 @@ Examples:
5968
7340
  });
5969
7341
 
5970
7342
  // src/commands/ads/linkedin/accounts.ts
5971
- import { defineCommand as defineCommand31 } from "citty";
7343
+ import { defineCommand as defineCommand33 } from "citty";
5972
7344
  var ACCOUNTS_TTL_MS = 60 * 60 * 1e3;
5973
- var accountsCommand2 = defineCommand31({
7345
+ var accountsCommand2 = defineCommand33({
5974
7346
  meta: {
5975
7347
  name: "accounts",
5976
7348
  description: `List LinkedIn ad accounts in this company's connected scope.
@@ -6018,7 +7390,7 @@ Examples:
6018
7390
  });
6019
7391
 
6020
7392
  // src/commands/ads/linkedin/analytics.ts
6021
- import { defineCommand as defineCommand32 } from "citty";
7393
+ import { defineCommand as defineCommand34 } from "citty";
6022
7394
 
6023
7395
  // src/commands/ads/linkedin/presets.ts
6024
7396
  var INTENTS = {
@@ -6290,7 +7662,7 @@ function numberOf(v) {
6290
7662
  }
6291
7663
  return 0;
6292
7664
  }
6293
- var analyticsCommand = defineCommand32({
7665
+ var analyticsCommand = defineCommand34({
6294
7666
  meta: {
6295
7667
  name: "analytics",
6296
7668
  description: `Performance reporting \u2014 the workhorse for AI agents.
@@ -6417,8 +7789,8 @@ Examples \u2014 common AI questions:
6417
7789
  });
6418
7790
 
6419
7791
  // src/commands/ads/linkedin/audience-size.ts
6420
- import { readFileSync as readFileSync4 } from "fs";
6421
- import { defineCommand as defineCommand33 } from "citty";
7792
+ import { readFileSync as readFileSync5 } from "fs";
7793
+ import { defineCommand as defineCommand35 } from "citty";
6422
7794
  function loadTargeting(args) {
6423
7795
  const inline = args.targeting;
6424
7796
  if (inline) {
@@ -6431,7 +7803,7 @@ function loadTargeting(args) {
6431
7803
  const file = args["targeting-file"];
6432
7804
  if (file) {
6433
7805
  try {
6434
- return JSON.parse(readFileSync4(file, "utf-8"));
7806
+ return JSON.parse(readFileSync5(file, "utf-8"));
6435
7807
  } catch (e) {
6436
7808
  handleLinkedinError(
6437
7809
  new Error(`Failed to read --targeting-file: ${e instanceof Error ? e.message : "I/O error"}`)
@@ -6440,7 +7812,7 @@ function loadTargeting(args) {
6440
7812
  }
6441
7813
  handleLinkedinError(new Error("Pass --targeting-file <path> or --targeting '{...JSON...}'"));
6442
7814
  }
6443
- var audienceSizeCommand = defineCommand33({
7815
+ var audienceSizeCommand = defineCommand35({
6444
7816
  meta: {
6445
7817
  name: "audience-size",
6446
7818
  description: `Estimate audience size for a targeting payload \u2014 pre-launch sanity check.
@@ -6485,7 +7857,7 @@ Examples:
6485
7857
  });
6486
7858
 
6487
7859
  // src/commands/ads/linkedin/audit.ts
6488
- import { defineCommand as defineCommand34 } from "citty";
7860
+ import { defineCommand as defineCommand36 } from "citty";
6489
7861
  var SEVERITY_RANK = {
6490
7862
  critical: 0,
6491
7863
  high: 1,
@@ -6544,7 +7916,7 @@ function noteOf(f) {
6544
7916
  const fix = f.fix?.explanation ?? "";
6545
7917
  return [fix, ev].filter(Boolean).join(" \u2014 ");
6546
7918
  }
6547
- var auditCommand = defineCommand34({
7919
+ var auditCommand = defineCommand36({
6548
7920
  meta: {
6549
7921
  name: "audit",
6550
7922
  description: `Run a LinkedIn Ads playbook audit \u2014 30+ checks across Settings, Tracking,
@@ -6610,8 +7982,8 @@ Examples:
6610
7982
  });
6611
7983
 
6612
7984
  // src/commands/ads/linkedin/bid-pricing.ts
6613
- import { readFileSync as readFileSync5 } from "fs";
6614
- import { defineCommand as defineCommand35 } from "citty";
7985
+ import { readFileSync as readFileSync6 } from "fs";
7986
+ import { defineCommand as defineCommand37 } from "citty";
6615
7987
  function loadTargeting2(args) {
6616
7988
  const inline = args.targeting;
6617
7989
  if (inline) {
@@ -6624,7 +7996,7 @@ function loadTargeting2(args) {
6624
7996
  const file = args["targeting-file"];
6625
7997
  if (file) {
6626
7998
  try {
6627
- return JSON.parse(readFileSync5(file, "utf-8"));
7999
+ return JSON.parse(readFileSync6(file, "utf-8"));
6628
8000
  } catch (e) {
6629
8001
  handleLinkedinError(
6630
8002
  new Error(`Failed to read --targeting-file: ${e instanceof Error ? e.message : "I/O error"}`)
@@ -6633,7 +8005,7 @@ function loadTargeting2(args) {
6633
8005
  }
6634
8006
  handleLinkedinError(new Error("Pass --targeting-file <path> or --targeting '{...JSON...}'"));
6635
8007
  }
6636
- var bidPricingCommand = defineCommand35({
8008
+ var bidPricingCommand = defineCommand37({
6637
8009
  meta: {
6638
8010
  name: "bid-pricing",
6639
8011
  description: `Get LinkedIn's suggested bid range for a targeting + objective + cost type.
@@ -6683,40 +8055,40 @@ Examples:
6683
8055
  });
6684
8056
 
6685
8057
  // src/commands/ads/linkedin/campaign-groups.ts
6686
- import { defineCommand as defineCommand37 } from "citty";
8058
+ import { defineCommand as defineCommand39 } from "citty";
6687
8059
 
6688
8060
  // src/commands/ads/linkedin/write-commands.ts
6689
- import { defineCommand as defineCommand36 } from "citty";
8061
+ import { defineCommand as defineCommand38 } from "citty";
6690
8062
 
6691
8063
  // src/commands/ads/linkedin/write-shared.ts
6692
8064
  import { createHash as createHash2 } from "crypto";
6693
- import { readFileSync as readFileSync6 } from "fs";
8065
+ import { readFileSync as readFileSync7 } from "fs";
6694
8066
  function bareAccountId(args) {
6695
8067
  const raw = resolveAccountIdArg(args);
6696
8068
  return raw.replace(/^urn:li:sponsoredAccount:/, "").replace(/^sponsoredAccount:/, "");
6697
8069
  }
6698
- function failWriteValidation(message) {
8070
+ function failWriteValidation2(message) {
6699
8071
  writeJsonEnvelope({ ok: false, error: { code: "VALIDATION_ERROR", message } });
6700
8072
  process.exit(1);
6701
8073
  }
6702
- function loadJsonFileArg(path11) {
8074
+ function loadJsonFileArg2(path11) {
6703
8075
  if (typeof path11 !== "string" || path11.length === 0) {
6704
8076
  return {};
6705
8077
  }
6706
8078
  try {
6707
- const parsed = JSON.parse(readFileSync6(path11, "utf8"));
8079
+ const parsed = JSON.parse(readFileSync7(path11, "utf8"));
6708
8080
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
6709
- failWriteValidation(`${path11} must contain a JSON object`);
8081
+ failWriteValidation2(`${path11} must contain a JSON object`);
6710
8082
  }
6711
8083
  return parsed;
6712
8084
  } catch (err) {
6713
8085
  if (err instanceof SyntaxError) {
6714
- failWriteValidation(`${path11} is not valid JSON: ${err.message}`);
8086
+ failWriteValidation2(`${path11} is not valid JSON: ${err.message}`);
6715
8087
  }
6716
8088
  throw err;
6717
8089
  }
6718
8090
  }
6719
- function mergePayload(file, flags) {
8091
+ function mergePayload2(file, flags) {
6720
8092
  const merged = { ...file };
6721
8093
  for (const [key, value] of Object.entries(flags)) {
6722
8094
  if (value !== void 0) {
@@ -6733,7 +8105,7 @@ function parseMoneyFlag(amount, currency, flag) {
6733
8105
  return { amount: String(amount) };
6734
8106
  }
6735
8107
  if (typeof currency !== "string" || currency.length !== 3) {
6736
- failWriteValidation(`${flag} got an invalid --currency (expected a 3-letter code like EUR)`);
8108
+ failWriteValidation2(`${flag} got an invalid --currency (expected a 3-letter code like EUR)`);
6737
8109
  }
6738
8110
  return { amount: String(amount), currencyCode: currency.toUpperCase() };
6739
8111
  }
@@ -6747,7 +8119,7 @@ function parseDateFlag(value, flag) {
6747
8119
  }
6748
8120
  const parsed = Date.parse(raw);
6749
8121
  if (Number.isNaN(parsed)) {
6750
- failWriteValidation(`${flag} must be an ISO date (2026-07-10) or epoch milliseconds`);
8122
+ failWriteValidation2(`${flag} must be an ISO date (2026-07-10) or epoch milliseconds`);
6751
8123
  }
6752
8124
  return parsed;
6753
8125
  }
@@ -6762,7 +8134,7 @@ function parseOnOffFlag(value, flag) {
6762
8134
  if (raw === "off" || raw === "false") {
6763
8135
  return false;
6764
8136
  }
6765
- failWriteValidation(`${flag} must be on|off`);
8137
+ failWriteValidation2(`${flag} must be on|off`);
6766
8138
  }
6767
8139
  function parseLocaleFlag(value) {
6768
8140
  if (value === void 0 || value === null || value === "") {
@@ -6770,7 +8142,7 @@ function parseLocaleFlag(value) {
6770
8142
  }
6771
8143
  const match = /^([a-z]{2})[_-]([A-Za-z]{2})$/.exec(String(value));
6772
8144
  if (!match) {
6773
- failWriteValidation("--locale must look like en_US (language_COUNTRY)");
8145
+ failWriteValidation2("--locale must look like en_US (language_COUNTRY)");
6774
8146
  }
6775
8147
  return { language: match[1], country: match[2].toUpperCase() };
6776
8148
  }
@@ -6778,10 +8150,10 @@ function loadTargetingFileArg(path11) {
6778
8150
  if (typeof path11 !== "string" || path11.length === 0) {
6779
8151
  return void 0;
6780
8152
  }
6781
- const parsed = loadJsonFileArg(path11);
8153
+ const parsed = loadJsonFileArg2(path11);
6782
8154
  const criteria = parsed.targetingCriteria ?? parsed;
6783
8155
  if (!criteria.include) {
6784
- failWriteValidation(
8156
+ failWriteValidation2(
6785
8157
  `${path11} must contain targeting criteria with an "include" block (see baker schema ads.linkedin.campaigns.create)`
6786
8158
  );
6787
8159
  }
@@ -6821,10 +8193,10 @@ function parseListFileArg(path11, maxRows) {
6821
8193
  if (typeof path11 !== "string" || path11.length === 0) {
6822
8194
  return void 0;
6823
8195
  }
6824
- const raw = readFileSync6(path11, "utf8");
8196
+ const raw = readFileSync7(path11, "utf8");
6825
8197
  const lines = raw.split(/\r?\n/).filter((line) => line.trim().length > 0);
6826
8198
  if (lines.length < 2) {
6827
- failWriteValidation(`${path11} needs a header row and at least one data row`);
8199
+ failWriteValidation2(`${path11} needs a header row and at least one data row`);
6828
8200
  }
6829
8201
  const columns = parseCsvLine(lines[0]).map((column) => column.trim());
6830
8202
  const rows = [];
@@ -6843,7 +8215,7 @@ function parseListFileArg(path11, maxRows) {
6843
8215
  }
6844
8216
  }
6845
8217
  if (rows.length > maxRows) {
6846
- failWriteValidation(`${path11} has ${rows.length} rows \u2014 the inline limit is ${maxRows}. Split the list.`);
8218
+ failWriteValidation2(`${path11} has ${rows.length} rows \u2014 the inline limit is ${maxRows}. Split the list.`);
6847
8219
  }
6848
8220
  return { columns, rows };
6849
8221
  }
@@ -6879,10 +8251,10 @@ async function stageStatusChange(input) {
6879
8251
  const payload = input.kind === "creative.update" ? { intendedStatus: input.status } : { status: input.status };
6880
8252
  await stageOp({ kind: input.kind, accountId: input.accountId, target: input.target, payload });
6881
8253
  }
6882
- function requireTarget(args, entity) {
8254
+ function requireTarget2(args, entity) {
6883
8255
  const target = args.id ?? args.target;
6884
8256
  if (typeof target !== "string" || target.length === 0) {
6885
- failWriteValidation(`pass the ${entity} id or URN as the positional argument`);
8257
+ failWriteValidation2(`pass the ${entity} id or URN as the positional argument`);
6886
8258
  }
6887
8259
  return target;
6888
8260
  }
@@ -6901,7 +8273,7 @@ function runScheduleFromFlags(args) {
6901
8273
  }
6902
8274
  return { ...start !== void 0 ? { start } : {}, ...end !== void 0 ? { end } : {} };
6903
8275
  }
6904
- var campaignGroupsCreateCommand = defineCommand36({
8276
+ var campaignGroupsCreateCommand = defineCommand38({
6905
8277
  meta: {
6906
8278
  name: "create",
6907
8279
  description: `Stage a new campaign group. ${STAGED_NOTE}
@@ -6919,7 +8291,7 @@ Example: baker ads linkedin campaign-groups create --name "Q3 ABM" --start 2026-
6919
8291
  },
6920
8292
  run: async ({ args }) => {
6921
8293
  const accountId = bareAccountId(args);
6922
- const payload = mergePayload(loadJsonFileArg(args.file), {
8294
+ const payload = mergePayload2(loadJsonFileArg2(args.file), {
6923
8295
  name: args.name,
6924
8296
  runSchedule: runScheduleFromFlags(args),
6925
8297
  totalBudget: parseMoneyFlag(args["total-budget"], args.currency, "--total-budget"),
@@ -6928,7 +8300,7 @@ Example: baker ads linkedin campaign-groups create --name "Q3 ABM" --start 2026-
6928
8300
  await stageOp({ kind: "campaignGroup.create", accountId, payload });
6929
8301
  }
6930
8302
  });
6931
- var campaignGroupsUpdateCommand = defineCommand36({
8303
+ var campaignGroupsUpdateCommand = defineCommand38({
6932
8304
  meta: {
6933
8305
  name: "update",
6934
8306
  description: `Stage changes to an existing campaign group. ${STAGED_NOTE}
@@ -6948,7 +8320,7 @@ Example: baker ads linkedin campaign-groups update 635137195 --total-budget 8000
6948
8320
  },
6949
8321
  run: async ({ args }) => {
6950
8322
  const accountId = bareAccountId(args);
6951
- const payload = mergePayload(loadJsonFileArg(args.file), {
8323
+ const payload = mergePayload2(loadJsonFileArg2(args.file), {
6952
8324
  name: args.name,
6953
8325
  runSchedule: runScheduleFromFlags(args),
6954
8326
  totalBudget: parseMoneyFlag(args["total-budget"], args.currency, "--total-budget"),
@@ -6957,7 +8329,7 @@ Example: baker ads linkedin campaign-groups update 635137195 --total-budget 8000
6957
8329
  await stageOp({
6958
8330
  kind: "campaignGroup.update",
6959
8331
  accountId,
6960
- target: requireTarget(args, "campaign group"),
8332
+ target: requireTarget2(args, "campaign group"),
6961
8333
  payload
6962
8334
  });
6963
8335
  }
@@ -7006,7 +8378,7 @@ var campaignFlagArgs = {
7006
8378
  status: { type: "string", description: "DRAFT|ACTIVE|PAUSED" },
7007
8379
  file: { type: "string", description: "JSON file with the full payload; flags override file keys" }
7008
8380
  };
7009
- var campaignsCreateCommand = defineCommand36({
8381
+ var campaignsCreateCommand = defineCommand38({
7010
8382
  meta: {
7011
8383
  name: "create",
7012
8384
  description: `Stage a new campaign. ${STAGED_NOTE}
@@ -7016,14 +8388,14 @@ Example: baker ads linkedin campaigns create --name "ABM Tier-1" --group li_temp
7016
8388
  args: campaignFlagArgs,
7017
8389
  run: async ({ args }) => {
7018
8390
  const accountId = bareAccountId(args);
7019
- const payload = mergePayload(loadJsonFileArg(args.file), campaignPayloadFromFlags(args));
8391
+ const payload = mergePayload2(loadJsonFileArg2(args.file), campaignPayloadFromFlags(args));
7020
8392
  if (payload.locale === void 0) {
7021
8393
  payload.locale = { country: "US", language: "en" };
7022
8394
  }
7023
8395
  await stageOp({ kind: "campaign.create", accountId, payload });
7024
8396
  }
7025
8397
  });
7026
- var campaignsUpdateCommand = defineCommand36({
8398
+ var campaignsUpdateCommand = defineCommand38({
7027
8399
  meta: {
7028
8400
  name: "update",
7029
8401
  description: `Stage changes to an existing campaign (budget, bid, targeting, flags, schedule, status). ${STAGED_NOTE}
@@ -7041,18 +8413,18 @@ Example: baker ads linkedin campaigns update 123456 --daily-budget 100 --currenc
7041
8413
  flags.type = void 0;
7042
8414
  flags.locale = void 0;
7043
8415
  flags.associatedEntity = void 0;
7044
- const payload = mergePayload(loadJsonFileArg(args.file), flags);
8416
+ const payload = mergePayload2(loadJsonFileArg2(args.file), flags);
7045
8417
  await stageOp({
7046
8418
  kind: "campaign.update",
7047
8419
  accountId,
7048
- target: requireTarget(args, "campaign"),
8420
+ target: requireTarget2(args, "campaign"),
7049
8421
  payload
7050
8422
  });
7051
8423
  }
7052
8424
  });
7053
8425
  function statusSugarCommand(entity, kind, name) {
7054
8426
  const status = name === "pause" ? "PAUSED" : name === "resume" ? "ACTIVE" : "ARCHIVED";
7055
- return defineCommand36({
8427
+ return defineCommand38({
7056
8428
  meta: {
7057
8429
  name,
7058
8430
  description: `Stage a status change to ${status}. ${STAGED_NOTE}
@@ -7066,7 +8438,7 @@ Example: baker ads linkedin ${entity} ${name} 123456`
7066
8438
  await stageStatusChange({
7067
8439
  kind,
7068
8440
  accountId: bareAccountId(args),
7069
- target: requireTarget(args, entity.replace(/-/g, " ").replace(/s$/, "")),
8441
+ target: requireTarget2(args, entity.replace(/-/g, " ").replace(/s$/, "")),
7070
8442
  status
7071
8443
  });
7072
8444
  }
@@ -7080,7 +8452,7 @@ var campaignGroupsResumeCommand = statusSugarCommand("campaign-groups", "campaig
7080
8452
  var creativesPauseCommand = statusSugarCommand("creatives", "creative.update", "pause");
7081
8453
  var creativesResumeCommand = statusSugarCommand("creatives", "creative.update", "resume");
7082
8454
  function duplicateCommand(entity, cliGroup) {
7083
- return defineCommand36({
8455
+ return defineCommand38({
7084
8456
  meta: {
7085
8457
  name: "duplicate",
7086
8458
  description: `Stage a copy of an existing ${entity} as a new DRAFT create (playbook: duplicate, never link-to-original). ${STAGED_NOTE}
@@ -7095,14 +8467,14 @@ Example: baker ads linkedin ${cliGroup} duplicate 123456 --name "New variant"`
7095
8467
  run: async ({ args }) => {
7096
8468
  try {
7097
8469
  const chatId = requireChatId();
7098
- const overrides = mergePayload(loadJsonFileArg(args.file), { name: args.name });
8470
+ const overrides = mergePayload2(loadJsonFileArg2(args.file), { name: args.name });
7099
8471
  const response = await apiPost(
7100
8472
  "/api/ads/linkedin/draft/duplicate",
7101
8473
  {
7102
8474
  chatId,
7103
8475
  accountId: bareAccountId(args),
7104
8476
  entity,
7105
- sourceId: requireTarget(args, entity),
8477
+ sourceId: requireTarget2(args, entity),
7106
8478
  ...Object.keys(overrides).length > 0 ? { overrides } : {}
7107
8479
  }
7108
8480
  );
@@ -7115,7 +8487,7 @@ Example: baker ads linkedin ${cliGroup} duplicate 123456 --name "New variant"`
7115
8487
  }
7116
8488
  var campaignsDuplicateCommand = duplicateCommand("campaign", "campaigns");
7117
8489
  var campaignGroupsDuplicateCommand = duplicateCommand("campaignGroup", "campaign-groups");
7118
- var creativesDuplicateCommand = defineCommand36({
8490
+ var creativesDuplicateCommand = defineCommand38({
7119
8491
  meta: {
7120
8492
  name: "duplicate",
7121
8493
  description: `Stage a copy of an existing ad, optionally with new content \u2014 the ONLY way to change copy/media/URL on a live ad (LinkedIn makes ad content immutable). ${STAGED_NOTE}
@@ -7153,10 +8525,10 @@ Examples:
7153
8525
  run: async ({ args }) => {
7154
8526
  try {
7155
8527
  const chatId = requireChatId();
7156
- const file = loadJsonFileArg(args.file);
8528
+ const file = loadJsonFileArg2(args.file);
7157
8529
  const fileContent = file.content !== null && typeof file.content === "object" && !Array.isArray(file.content) ? file.content : {};
7158
8530
  const content = { ...fileContent, ...creativeContentPatch(args) };
7159
- const overrides = mergePayload(file, {
8531
+ const overrides = mergePayload2(file, {
7160
8532
  campaign: args.campaign,
7161
8533
  intendedStatus: args["intended-status"] ? String(args["intended-status"]).toUpperCase() : void 0,
7162
8534
  content: Object.keys(content).length > 0 ? content : void 0
@@ -7167,7 +8539,7 @@ Examples:
7167
8539
  chatId,
7168
8540
  accountId: bareAccountId(args),
7169
8541
  entity: "creative",
7170
- sourceId: requireTarget(args, "creative"),
8542
+ sourceId: requireTarget2(args, "creative"),
7171
8543
  ...Object.keys(overrides).length > 0 ? { overrides } : {},
7172
8544
  ...args.replace ? { replace: true } : {}
7173
8545
  }
@@ -7192,7 +8564,7 @@ var CREATIVE_FORMATS = [
7192
8564
  "event",
7193
8565
  "article"
7194
8566
  ];
7195
- var creativesCreateCommand = defineCommand36({
8567
+ var creativesCreateCommand = defineCommand38({
7196
8568
  meta: {
7197
8569
  name: "create",
7198
8570
  description: `Stage a new creative (ad). ${STAGED_NOTE}
@@ -7228,13 +8600,13 @@ Examples:
7228
8600
  run: async ({ args }) => {
7229
8601
  const accountId = bareAccountId(args);
7230
8602
  if (!args.campaign) {
7231
- failWriteValidation("--campaign is required (id, URN, or li_temp_* ref)");
8603
+ failWriteValidation2("--campaign is required (id, URN, or li_temp_* ref)");
7232
8604
  }
7233
8605
  const format = args.format ? String(args.format) : void 0;
7234
8606
  if (!format || !CREATIVE_FORMATS.includes(format)) {
7235
- failWriteValidation(`--format must be one of ${CREATIVE_FORMATS.join("|")}`);
8607
+ failWriteValidation2(`--format must be one of ${CREATIVE_FORMATS.join("|")}`);
7236
8608
  }
7237
- const content = mergePayload(loadJsonFileArg(args.file), {
8609
+ const content = mergePayload2(loadJsonFileArg2(args.file), {
7238
8610
  format,
7239
8611
  commentary: args.intro,
7240
8612
  imageId: args["image-id"],
@@ -7293,7 +8665,7 @@ function creativeContentPatch(args) {
7293
8665
  }
7294
8666
  return patch;
7295
8667
  }
7296
- var creativesUpdateCommand = defineCommand36({
8668
+ var creativesUpdateCommand = defineCommand38({
7297
8669
  meta: {
7298
8670
  name: "update",
7299
8671
  description: `Stage changes to an existing creative, or amend a creative staged in this chat by passing its li_temp_* ref. ${STAGED_NOTE}
@@ -7325,13 +8697,13 @@ Examples:
7325
8697
  },
7326
8698
  run: async ({ args }) => {
7327
8699
  const accountId = bareAccountId(args);
7328
- const target = requireTarget(args, "creative");
7329
- const file = loadJsonFileArg(args.file);
8700
+ const target = requireTarget2(args, "creative");
8701
+ const file = loadJsonFileArg2(args.file);
7330
8702
  const contentPatch = creativeContentPatch(args);
7331
8703
  const intendedStatus = args["intended-status"] ? String(args["intended-status"]).toUpperCase() : void 0;
7332
8704
  const fileContent = file.content !== null && typeof file.content === "object" && !Array.isArray(file.content) ? file.content : {};
7333
8705
  const content = { ...fileContent, ...contentPatch };
7334
- const payload = mergePayload(file, {
8706
+ const payload = mergePayload2(file, {
7335
8707
  intendedStatus,
7336
8708
  name: args.name,
7337
8709
  content: Object.keys(content).length > 0 ? content : void 0
@@ -7341,7 +8713,7 @@ Examples:
7341
8713
  });
7342
8714
  var AUDIENCE_TYPES2 = ["company-list", "user-list", "retargeting", "engagement"];
7343
8715
  var INLINE_ROWS_MAX = 1e4;
7344
- var audiencesCreateCommand = defineCommand36({
8716
+ var audiencesCreateCommand = defineCommand38({
7345
8717
  meta: {
7346
8718
  name: "create",
7347
8719
  description: `Stage a new matched audience. ${STAGED_NOTE}
@@ -7358,7 +8730,7 @@ Example: baker ads linkedin audiences create --name "ABM Tier-1" --type company-
7358
8730
  run: async ({ args }) => {
7359
8731
  const accountId = bareAccountId(args);
7360
8732
  const list = parseListFileArg(args["list-file"], INLINE_ROWS_MAX);
7361
- const raw = args.file ? loadJsonFileArg(args.file) : void 0;
8733
+ const raw = args.file ? loadJsonFileArg2(args.file) : void 0;
7362
8734
  await stageOp({
7363
8735
  kind: "audience.create",
7364
8736
  accountId,
@@ -7371,7 +8743,7 @@ Example: baker ads linkedin audiences create --name "ABM Tier-1" --type company-
7371
8743
  });
7372
8744
  }
7373
8745
  });
7374
- var audiencesUploadCommand = defineCommand36({
8746
+ var audiencesUploadCommand = defineCommand38({
7375
8747
  meta: {
7376
8748
  name: "upload",
7377
8749
  description: `Stage a list upload into an existing audience segment. ${STAGED_NOTE}
@@ -7386,20 +8758,20 @@ Example: baker ads linkedin audiences upload urn:li:dmpSegment:42 --list-file mo
7386
8758
  const accountId = bareAccountId(args);
7387
8759
  const list = parseListFileArg(args["list-file"], INLINE_ROWS_MAX);
7388
8760
  if (!list) {
7389
- failWriteValidation("--list-file is required");
8761
+ failWriteValidation2("--list-file is required");
7390
8762
  }
7391
8763
  await stageOp({
7392
8764
  kind: "audience.uploadList",
7393
8765
  accountId,
7394
8766
  payload: {
7395
- segment: requireTarget(args, "audience segment"),
8767
+ segment: requireTarget2(args, "audience segment"),
7396
8768
  listColumns: list.columns,
7397
8769
  listRows: list.rows
7398
8770
  }
7399
8771
  });
7400
8772
  }
7401
8773
  });
7402
- var audiencesCommand = defineCommand36({
8774
+ var audiencesCommand2 = defineCommand38({
7403
8775
  meta: {
7404
8776
  name: "audiences",
7405
8777
  description: "Stage LinkedIn matched-audience changes (create lists, upload rows). Staged until publish \u2014 never hits the API directly."
@@ -7409,7 +8781,7 @@ var audiencesCommand = defineCommand36({
7409
8781
  upload: audiencesUploadCommand
7410
8782
  }
7411
8783
  });
7412
- var conversionsCreateCommand = defineCommand36({
8784
+ var conversionsCreateCommand = defineCommand38({
7413
8785
  meta: {
7414
8786
  name: "create",
7415
8787
  description: `Stage a new conversion rule. ${STAGED_NOTE}
@@ -7428,7 +8800,7 @@ Example: baker ads linkedin conversions create --name "Demo booked" --type LEAD
7428
8800
  },
7429
8801
  run: async ({ args }) => {
7430
8802
  const accountId = bareAccountId(args);
7431
- const payload = mergePayload(loadJsonFileArg(args.file), {
8803
+ const payload = mergePayload2(loadJsonFileArg2(args.file), {
7432
8804
  name: args.name,
7433
8805
  type: args.type ? String(args.type).toUpperCase() : void 0,
7434
8806
  conversionMethod: args.method ? String(args.method).toUpperCase() : void 0,
@@ -7440,7 +8812,7 @@ Example: baker ads linkedin conversions create --name "Demo booked" --type LEAD
7440
8812
  await stageOp({ kind: "conversion.create", accountId, payload });
7441
8813
  }
7442
8814
  });
7443
- var conversionsUpdateCommand = defineCommand36({
8815
+ var conversionsUpdateCommand = defineCommand38({
7444
8816
  meta: {
7445
8817
  name: "update",
7446
8818
  description: `Stage changes to a conversion rule (windows, name, enabled). ${STAGED_NOTE}
@@ -7458,7 +8830,7 @@ Example: baker ads linkedin conversions update 104988516 --post-click-window 30
7458
8830
  },
7459
8831
  run: async ({ args }) => {
7460
8832
  const accountId = bareAccountId(args);
7461
- const payload = mergePayload(loadJsonFileArg(args.file), {
8833
+ const payload = mergePayload2(loadJsonFileArg2(args.file), {
7462
8834
  name: args.name,
7463
8835
  postClickAttributionWindowSize: args["post-click-window"] ? Number(args["post-click-window"]) : void 0,
7464
8836
  viewThroughAttributionWindowSize: args["view-window"] ? Number(args["view-window"]) : void 0,
@@ -7468,12 +8840,12 @@ Example: baker ads linkedin conversions update 104988516 --post-click-window 30
7468
8840
  await stageOp({
7469
8841
  kind: "conversion.update",
7470
8842
  accountId,
7471
- target: requireTarget(args, "conversion rule"),
8843
+ target: requireTarget2(args, "conversion rule"),
7472
8844
  payload
7473
8845
  });
7474
8846
  }
7475
8847
  });
7476
- var leadFormsCreateCommand = defineCommand36({
8848
+ var leadFormsCreateCommand = defineCommand38({
7477
8849
  meta: {
7478
8850
  name: "create",
7479
8851
  description: `Stage a new Lead Gen Form from a JSON file. ${STAGED_NOTE}
@@ -7486,11 +8858,11 @@ The file needs: name, headline (\u226460), privacyPolicyUrl, questions[] (\u2264
7486
8858
  },
7487
8859
  run: async ({ args }) => {
7488
8860
  const accountId = bareAccountId(args);
7489
- const payload = mergePayload(loadJsonFileArg(args.file), { name: args.name });
8861
+ const payload = mergePayload2(loadJsonFileArg2(args.file), { name: args.name });
7490
8862
  await stageOp({ kind: "leadForm.create", accountId, payload });
7491
8863
  }
7492
8864
  });
7493
- var leadFormsUpdateCommand = defineCommand36({
8865
+ var leadFormsUpdateCommand = defineCommand38({
7494
8866
  meta: {
7495
8867
  name: "update",
7496
8868
  description: `Stage changes to a Lead Gen Form from a JSON file. ${STAGED_NOTE}`
@@ -7503,16 +8875,16 @@ var leadFormsUpdateCommand = defineCommand36({
7503
8875
  },
7504
8876
  run: async ({ args }) => {
7505
8877
  const accountId = bareAccountId(args);
7506
- const payload = mergePayload({ raw: loadJsonFileArg(args.file) }, { name: args.name });
8878
+ const payload = mergePayload2({ raw: loadJsonFileArg2(args.file) }, { name: args.name });
7507
8879
  await stageOp({
7508
8880
  kind: "leadForm.update",
7509
8881
  accountId,
7510
- target: requireTarget(args, "lead form"),
8882
+ target: requireTarget2(args, "lead form"),
7511
8883
  payload
7512
8884
  });
7513
8885
  }
7514
8886
  });
7515
- var leadFormsCommand = defineCommand36({
8887
+ var leadFormsCommand = defineCommand38({
7516
8888
  meta: {
7517
8889
  name: "lead-forms",
7518
8890
  description: "Stage LinkedIn Lead Gen Form changes (file-first). Staged until publish \u2014 never hits the API directly."
@@ -7524,7 +8896,7 @@ var leadFormsCommand = defineCommand36({
7524
8896
  });
7525
8897
 
7526
8898
  // src/commands/ads/linkedin/campaign-groups.ts
7527
- var campaignGroupsCommand = defineCommand37({
8899
+ var campaignGroupsCommand = defineCommand39({
7528
8900
  meta: {
7529
8901
  name: "campaign-groups",
7530
8902
  description: `List LinkedIn campaign groups, or stage writes (create/update/pause/resume/duplicate).
@@ -7575,8 +8947,8 @@ Examples:
7575
8947
  });
7576
8948
 
7577
8949
  // src/commands/ads/linkedin/campaigns.ts
7578
- import { defineCommand as defineCommand38 } from "citty";
7579
- var campaignsCommand = defineCommand38({
8950
+ import { defineCommand as defineCommand40 } from "citty";
8951
+ var campaignsCommand2 = defineCommand40({
7580
8952
  meta: {
7581
8953
  name: "campaigns",
7582
8954
  description: `List LinkedIn campaigns, or stage writes (create/update/pause/resume/archive/duplicate).
@@ -7637,8 +9009,8 @@ Examples:
7637
9009
  });
7638
9010
 
7639
9011
  // src/commands/ads/linkedin/conversation.ts
7640
- import { defineCommand as defineCommand39 } from "citty";
7641
- var conversationCommand = defineCommand39({
9012
+ import { defineCommand as defineCommand41 } from "citty";
9013
+ var conversationCommand = defineCommand41({
7642
9014
  meta: {
7643
9015
  name: "conversation",
7644
9016
  description: `Per-button click rates inside Sponsored Messaging / Conversation Ads.
@@ -7701,7 +9073,7 @@ Examples:
7701
9073
  });
7702
9074
 
7703
9075
  // src/commands/ads/linkedin/conversions.ts
7704
- import { defineCommand as defineCommand40 } from "citty";
9076
+ import { defineCommand as defineCommand42 } from "citty";
7705
9077
  var DAY_MS3 = 864e5;
7706
9078
  function healthOf(rules) {
7707
9079
  const enabled = rules.filter((r) => r.enabled !== false);
@@ -7727,7 +9099,7 @@ function healthOf(rules) {
7727
9099
  wrongLeadDedup: wrongDedup
7728
9100
  };
7729
9101
  }
7730
- var listCmd = defineCommand40({
9102
+ var listCmd = defineCommand42({
7731
9103
  meta: {
7732
9104
  name: "list",
7733
9105
  description: `List conversion rules on the account.`
@@ -7755,7 +9127,7 @@ var listCmd = defineCommand40({
7755
9127
  }
7756
9128
  }
7757
9129
  });
7758
- var healthCmd = defineCommand40({
9130
+ var healthCmd = defineCommand42({
7759
9131
  meta: {
7760
9132
  name: "health",
7761
9133
  description: `5-point Insight Tag / CAPI health check (playbook \xA707).
@@ -7785,7 +9157,7 @@ Surfaces:
7785
9157
  }
7786
9158
  }
7787
9159
  });
7788
- var conversionsCommand = defineCommand40({
9160
+ var conversionsCommand2 = defineCommand42({
7789
9161
  meta: {
7790
9162
  name: "conversions",
7791
9163
  description: `Conversion rules \u2014 Insight Tag and Conversions API.
@@ -7804,8 +9176,8 @@ Subcommands:
7804
9176
  });
7805
9177
 
7806
9178
  // src/commands/ads/linkedin/creatives.ts
7807
- import { defineCommand as defineCommand41 } from "citty";
7808
- var creativesCommand = defineCommand41({
9179
+ import { defineCommand as defineCommand43 } from "citty";
9180
+ var creativesCommand = defineCommand43({
7809
9181
  meta: {
7810
9182
  name: "creatives",
7811
9183
  description: `List LinkedIn creatives (ads), or stage writes (create/update/pause/resume/duplicate).
@@ -7864,7 +9236,7 @@ Examples:
7864
9236
  });
7865
9237
 
7866
9238
  // src/commands/ads/linkedin/demographics.ts
7867
- import { defineCommand as defineCommand42 } from "citty";
9239
+ import { defineCommand as defineCommand44 } from "citty";
7868
9240
  var DEFAULT_PIVOTS = ["job-title", "company", "industry", "seniority", "job-function", "company-size"];
7869
9241
  function numberOf2(v) {
7870
9242
  if (typeof v === "number") return Number.isFinite(v) ? v : 0;
@@ -7877,7 +9249,7 @@ function numberOf2(v) {
7877
9249
  function topByImpressions(rows, limit) {
7878
9250
  return [...rows].sort((a, b) => numberOf2(b.impressions) - numberOf2(a.impressions)).slice(0, limit);
7879
9251
  }
7880
- var demographicsCommand = defineCommand42({
9252
+ var demographicsCommand = defineCommand44({
7881
9253
  meta: {
7882
9254
  name: "demographics",
7883
9255
  description: `Sweep all firmographic pivots in one command \u2014 LinkedIn's superpower.
@@ -7974,7 +9346,7 @@ function resolveRange(args) {
7974
9346
  }
7975
9347
 
7976
9348
  // src/commands/ads/linkedin/draft.ts
7977
- import { defineCommand as defineCommand43 } from "citty";
9349
+ import { defineCommand as defineCommand45 } from "citty";
7978
9350
  async function listDraft() {
7979
9351
  try {
7980
9352
  const chatId = requireChatId();
@@ -7986,14 +9358,14 @@ async function listDraft() {
7986
9358
  handleLinkedinError(err);
7987
9359
  }
7988
9360
  }
7989
- var listCommand3 = defineCommand43({
9361
+ var listCommand3 = defineCommand45({
7990
9362
  meta: {
7991
9363
  name: "list",
7992
9364
  description: "Show every LinkedIn write op staged in this chat, its mode (simulated = publish will NOT hit LinkedIn), dependencies, and post-publish results. Example: baker ads linkedin draft"
7993
9365
  },
7994
9366
  run: listDraft
7995
9367
  });
7996
- var removeCommand2 = defineCommand43({
9368
+ var removeCommand2 = defineCommand45({
7997
9369
  meta: {
7998
9370
  name: "remove",
7999
9371
  description: "Drop one staged LinkedIn op. Removing a create cascades to everything that depends on it. Example: baker ads linkedin draft remove li_temp_abc123"
@@ -8018,7 +9390,7 @@ var removeCommand2 = defineCommand43({
8018
9390
  }
8019
9391
  }
8020
9392
  });
8021
- var clearCommand2 = defineCommand43({
9393
+ var clearCommand2 = defineCommand45({
8022
9394
  meta: {
8023
9395
  name: "clear",
8024
9396
  description: "Discard ALL staged LinkedIn ops in this chat's draft \u2014 nothing will apply on publish. Example: baker ads linkedin draft clear"
@@ -8035,7 +9407,7 @@ var clearCommand2 = defineCommand43({
8035
9407
  }
8036
9408
  }
8037
9409
  });
8038
- var linkedinDraftCommand = defineCommand43({
9410
+ var linkedinDraftCommand = defineCommand45({
8039
9411
  meta: {
8040
9412
  name: "draft",
8041
9413
  description: "Review and edit the LinkedIn write ops staged in this chat BEFORE publish. Subcommands: list (default), remove, clear. Ops never hit LinkedIn until the chat is published."
@@ -8049,8 +9421,8 @@ var linkedinDraftCommand = defineCommand43({
8049
9421
  });
8050
9422
 
8051
9423
  // src/commands/ads/linkedin/facets.ts
8052
- import { defineCommand as defineCommand44 } from "citty";
8053
- var listCmd2 = defineCommand44({
9424
+ import { defineCommand as defineCommand46 } from "citty";
9425
+ var listCmd2 = defineCommand46({
8054
9426
  meta: {
8055
9427
  name: "list",
8056
9428
  description: `List every targeting facet LinkedIn supports.
@@ -8078,7 +9450,7 @@ seniorities, titles, employers, growthRate, companyCategory, skills, etc.).`
8078
9450
  }
8079
9451
  }
8080
9452
  });
8081
- var valuesCmd = defineCommand44({
9453
+ var valuesCmd = defineCommand46({
8082
9454
  meta: {
8083
9455
  name: "values",
8084
9456
  description: `Look up entity values for a single facet \u2014 full list or typeahead search.
@@ -8119,7 +9491,7 @@ or the full URN (urn:li:adTargetingFacet:industries).`
8119
9491
  }
8120
9492
  }
8121
9493
  });
8122
- var facetsCommand = defineCommand44({
9494
+ var facetsCommand = defineCommand46({
8123
9495
  meta: {
8124
9496
  name: "facets",
8125
9497
  description: `LinkedIn targeting facets and entity lookup.
@@ -8136,8 +9508,8 @@ Subcommands:
8136
9508
  });
8137
9509
 
8138
9510
  // src/commands/ads/linkedin/forecast.ts
8139
- import { readFileSync as readFileSync7 } from "fs";
8140
- import { defineCommand as defineCommand45 } from "citty";
9511
+ import { readFileSync as readFileSync8 } from "fs";
9512
+ import { defineCommand as defineCommand47 } from "citty";
8141
9513
  function loadTargeting3(args) {
8142
9514
  const inline = args.targeting;
8143
9515
  if (inline) {
@@ -8150,7 +9522,7 @@ function loadTargeting3(args) {
8150
9522
  const file = args["targeting-file"];
8151
9523
  if (file) {
8152
9524
  try {
8153
- return JSON.parse(readFileSync7(file, "utf-8"));
9525
+ return JSON.parse(readFileSync8(file, "utf-8"));
8154
9526
  } catch (e) {
8155
9527
  handleLinkedinError(
8156
9528
  new Error(`Failed to read --targeting-file: ${e instanceof Error ? e.message : "I/O error"}`)
@@ -8167,7 +9539,7 @@ function parseMoney(raw) {
8167
9539
  }
8168
9540
  return { amount: m[1] ?? "0", currencyCode: m[2] ?? "USD" };
8169
9541
  }
8170
- var forecastCommand = defineCommand45({
9542
+ var forecastCommand = defineCommand47({
8171
9543
  meta: {
8172
9544
  name: "forecast",
8173
9545
  description: `Forecast reach + impressions + clicks + spend for a hypothetical campaign.
@@ -8214,9 +9586,9 @@ Examples:
8214
9586
  });
8215
9587
 
8216
9588
  // src/commands/ads/linkedin/leads.ts
8217
- import { defineCommand as defineCommand46 } from "citty";
9589
+ import { defineCommand as defineCommand48 } from "citty";
8218
9590
  var DAY_MS4 = 864e5;
8219
- var leadsCommand = defineCommand46({
9591
+ var leadsCommand = defineCommand48({
8220
9592
  meta: {
8221
9593
  name: "leads",
8222
9594
  description: `List Lead Gen Form responses (playbook \xA707).
@@ -8276,7 +9648,7 @@ Examples:
8276
9648
  });
8277
9649
 
8278
9650
  // src/commands/ads/linkedin/resolve.ts
8279
- import { defineCommand as defineCommand47 } from "citty";
9651
+ import { defineCommand as defineCommand49 } from "citty";
8280
9652
  function toOrgUrn(raw) {
8281
9653
  const trimmed = raw.trim();
8282
9654
  if (trimmed.length === 0) {
@@ -8287,7 +9659,7 @@ function toOrgUrn(raw) {
8287
9659
  }
8288
9660
  return /^\d+$/.test(trimmed) ? `urn:li:organization:${trimmed}` : null;
8289
9661
  }
8290
- var resolveCommand = defineCommand47({
9662
+ var resolveCommand = defineCommand49({
8291
9663
  meta: {
8292
9664
  name: "resolve",
8293
9665
  description: `Resolve organization URNs to company names.
@@ -8329,8 +9701,8 @@ couldn't be resolved \u2014 typically an org outside LinkedIn's targetable set.`
8329
9701
  });
8330
9702
 
8331
9703
  // src/commands/ads/linkedin/top-companies.ts
8332
- import { defineCommand as defineCommand48 } from "citty";
8333
- var topCompaniesCommand = defineCommand48({
9704
+ import { defineCommand as defineCommand50 } from "citty";
9705
+ var topCompaniesCommand = defineCommand50({
8334
9706
  meta: {
8335
9707
  name: "top-companies",
8336
9708
  description: `Top companies whose employees saw / clicked / converted on a campaign.
@@ -8401,7 +9773,7 @@ Examples:
8401
9773
  });
8402
9774
 
8403
9775
  // src/commands/ads/linkedin/index.ts
8404
- var linkedinCommand = defineCommand49({
9776
+ var linkedinCommand = defineCommand51({
8405
9777
  meta: {
8406
9778
  name: "linkedin",
8407
9779
  description: `LinkedIn Marketing API \u2014 AI-first command surface for B2B ad insights.
@@ -8446,9 +9818,9 @@ Account ID format:
8446
9818
  accounts: accountsCommand2,
8447
9819
  account: accountCommand,
8448
9820
  "campaign-groups": campaignGroupsCommand,
8449
- campaigns: campaignsCommand,
9821
+ campaigns: campaignsCommand2,
8450
9822
  creatives: creativesCommand,
8451
- audiences: audiencesCommand,
9823
+ audiences: audiencesCommand2,
8452
9824
  "lead-forms": leadFormsCommand,
8453
9825
  draft: linkedinDraftCommand,
8454
9826
  analytics: analyticsCommand,
@@ -8460,17 +9832,17 @@ Account ID format:
8460
9832
  "bid-pricing": bidPricingCommand,
8461
9833
  forecast: forecastCommand,
8462
9834
  leads: leadsCommand,
8463
- conversions: conversionsCommand,
9835
+ conversions: conversionsCommand2,
8464
9836
  conversation: conversationCommand,
8465
9837
  audit: auditCommand
8466
9838
  }
8467
9839
  });
8468
9840
 
8469
9841
  // src/commands/ads/meta/index.ts
8470
- import { defineCommand as defineCommand62 } from "citty";
9842
+ import { defineCommand as defineCommand64 } from "citty";
8471
9843
 
8472
9844
  // src/commands/ads/meta/account.ts
8473
- import { defineCommand as defineCommand50 } from "citty";
9845
+ import { defineCommand as defineCommand52 } from "citty";
8474
9846
 
8475
9847
  // src/commands/ads/meta/shared.ts
8476
9848
  var DAY_MS5 = 864e5;
@@ -8549,7 +9921,7 @@ function resolveEffectiveStatus(args) {
8549
9921
  }
8550
9922
 
8551
9923
  // src/commands/ads/meta/account.ts
8552
- var accountCommand2 = defineCommand50({
9924
+ var accountCommand2 = defineCommand52({
8553
9925
  meta: {
8554
9926
  name: "account",
8555
9927
  description: `Show single Meta ad account detail (currency, timezone, balance, business).
@@ -8576,8 +9948,8 @@ Examples:
8576
9948
  });
8577
9949
 
8578
9950
  // src/commands/ads/meta/accounts.ts
8579
- import { defineCommand as defineCommand51 } from "citty";
8580
- var accountsCommand3 = defineCommand51({
9951
+ import { defineCommand as defineCommand53 } from "citty";
9952
+ var accountsCommand3 = defineCommand53({
8581
9953
  meta: {
8582
9954
  name: "accounts",
8583
9955
  description: `List Meta ad accounts in this company's connected scope.
@@ -8625,8 +9997,8 @@ Examples:
8625
9997
  });
8626
9998
 
8627
9999
  // src/commands/ads/meta/activities.ts
8628
- import { defineCommand as defineCommand52 } from "citty";
8629
- var activitiesCommand = defineCommand52({
10000
+ import { defineCommand as defineCommand54 } from "citty";
10001
+ var activitiesCommand = defineCommand54({
8630
10002
  meta: {
8631
10003
  name: "activities",
8632
10004
  description: `Audit log of recent ad-account changes (created, paused, edited). Default lookback 7 days,
@@ -8663,8 +10035,8 @@ Examples:
8663
10035
  });
8664
10036
 
8665
10037
  // src/commands/ads/meta/ads.ts
8666
- import { defineCommand as defineCommand53 } from "citty";
8667
- var adsListCommand = defineCommand53({
10038
+ import { defineCommand as defineCommand55 } from "citty";
10039
+ var adsListCommand = defineCommand55({
8668
10040
  meta: {
8669
10041
  name: "ads",
8670
10042
  description: `List ads in a Meta ad account. Defaults to ACTIVE only \u2014 pass --all-statuses to widen.
@@ -8712,8 +10084,8 @@ Examples:
8712
10084
  });
8713
10085
 
8714
10086
  // src/commands/ads/meta/adsets.ts
8715
- import { defineCommand as defineCommand54 } from "citty";
8716
- var adsetsCommand = defineCommand54({
10087
+ import { defineCommand as defineCommand56 } from "citty";
10088
+ var adsetsCommand = defineCommand56({
8717
10089
  meta: {
8718
10090
  name: "adsets",
8719
10091
  description: `List ad sets in a Meta ad account, optionally scoped to one campaign. Defaults to ACTIVE only.
@@ -8755,8 +10127,8 @@ Examples:
8755
10127
  });
8756
10128
 
8757
10129
  // src/commands/ads/meta/audiences.ts
8758
- import { defineCommand as defineCommand55 } from "citty";
8759
- var audiencesCommand2 = defineCommand55({
10130
+ import { defineCommand as defineCommand57 } from "citty";
10131
+ var audiencesCommand3 = defineCommand57({
8760
10132
  meta: {
8761
10133
  name: "audiences",
8762
10134
  description: `List custom audiences for a Meta ad account. Includes lookalikes, website-pixel audiences,
@@ -8791,8 +10163,8 @@ Examples:
8791
10163
  });
8792
10164
 
8793
10165
  // src/commands/ads/meta/businesses.ts
8794
- import { defineCommand as defineCommand56 } from "citty";
8795
- var businessesCommand = defineCommand56({
10166
+ import { defineCommand as defineCommand58 } from "citty";
10167
+ var businessesCommand = defineCommand58({
8796
10168
  meta: {
8797
10169
  name: "businesses",
8798
10170
  description: `List Meta Business Manager accounts the connected user has access to. Required for ad-studies and product-catalogs commands.
@@ -8822,8 +10194,8 @@ Examples:
8822
10194
  });
8823
10195
 
8824
10196
  // src/commands/ads/meta/campaigns.ts
8825
- import { defineCommand as defineCommand57 } from "citty";
8826
- var campaignsCommand2 = defineCommand57({
10197
+ import { defineCommand as defineCommand59 } from "citty";
10198
+ var campaignsCommand3 = defineCommand59({
8827
10199
  meta: {
8828
10200
  name: "campaigns",
8829
10201
  description: `List campaigns for a Meta ad account. Defaults to ACTIVE only \u2014 pass --all-statuses to widen.
@@ -8867,8 +10239,8 @@ Examples:
8867
10239
  });
8868
10240
 
8869
10241
  // src/commands/ads/meta/creatives.ts
8870
- import { defineCommand as defineCommand58 } from "citty";
8871
- var creativesCommand2 = defineCommand58({
10242
+ import { defineCommand as defineCommand60 } from "citty";
10243
+ var creativesCommand2 = defineCommand60({
8872
10244
  meta: {
8873
10245
  name: "creatives",
8874
10246
  description: `List ad creatives in an account, or fetch a single creative by ID.
@@ -8912,7 +10284,7 @@ Examples:
8912
10284
  });
8913
10285
 
8914
10286
  // src/commands/ads/meta/insights.ts
8915
- import { defineCommand as defineCommand59 } from "citty";
10287
+ import { defineCommand as defineCommand61 } from "citty";
8916
10288
 
8917
10289
  // src/commands/ads/meta/presets.ts
8918
10290
  var INSIGHTS_INTENTS = {
@@ -9117,7 +10489,7 @@ function sortRowsBySpendDesc(rows) {
9117
10489
  return sb - sa;
9118
10490
  });
9119
10491
  }
9120
- var insightsCommand = defineCommand59({
10492
+ var insightsCommand = defineCommand61({
9121
10493
  meta: {
9122
10494
  name: "insights",
9123
10495
  description: `Performance reporting \u2014 the main Meta tool for AI agents.
@@ -9218,8 +10590,8 @@ Async is automatic for heavy queries; pass --async to force it, or --no-async to
9218
10590
  });
9219
10591
 
9220
10592
  // src/commands/ads/meta/pixels.ts
9221
- import { defineCommand as defineCommand60 } from "citty";
9222
- var pixelsCommand = defineCommand60({
10593
+ import { defineCommand as defineCommand62 } from "citty";
10594
+ var pixelsCommand = defineCommand62({
9223
10595
  meta: {
9224
10596
  name: "pixels",
9225
10597
  description: `List Meta Pixels for an ad account, or fetch firing stats for one pixel.
@@ -9290,7 +10662,7 @@ function emit(data, args) {
9290
10662
 
9291
10663
  // src/commands/ads/meta/preview.ts
9292
10664
  import { writeFileSync as writeFileSync3 } from "fs";
9293
- import { defineCommand as defineCommand61 } from "citty";
10665
+ import { defineCommand as defineCommand63 } from "citty";
9294
10666
  var VALID_AD_FORMATS = [
9295
10667
  "DESKTOP_FEED_STANDARD",
9296
10668
  "MOBILE_FEED_STANDARD",
@@ -9324,7 +10696,7 @@ var VALID_AD_FORMATS = [
9324
10696
  "MARKETPLACE_MOBILE",
9325
10697
  "BIZ_DISCO_FEED_MOBILE"
9326
10698
  ];
9327
- var previewCommand = defineCommand61({
10699
+ var previewCommand = defineCommand63({
9328
10700
  meta: {
9329
10701
  name: "preview",
9330
10702
  description: `Generate a Meta-hosted preview iframe for a creative or ad. Returns iframe HTML which you
@@ -9371,7 +10743,7 @@ Examples:
9371
10743
  });
9372
10744
 
9373
10745
  // src/commands/ads/meta/index.ts
9374
- var metaCommand = defineCommand62({
10746
+ var metaCommand = defineCommand64({
9375
10747
  meta: {
9376
10748
  name: "meta",
9377
10749
  description: `Meta Marketing API \u2014 AI-first command surface (Facebook + Instagram ads).
@@ -9410,11 +10782,11 @@ Audit & review:
9410
10782
  accounts: accountsCommand3,
9411
10783
  account: accountCommand2,
9412
10784
  businesses: businessesCommand,
9413
- campaigns: campaignsCommand2,
10785
+ campaigns: campaignsCommand3,
9414
10786
  adsets: adsetsCommand,
9415
10787
  ads: adsListCommand,
9416
10788
  creatives: creativesCommand2,
9417
- audiences: audiencesCommand2,
10789
+ audiences: audiencesCommand3,
9418
10790
  pixels: pixelsCommand,
9419
10791
  activities: activitiesCommand,
9420
10792
  insights: insightsCommand,
@@ -9423,10 +10795,10 @@ Audit & review:
9423
10795
  });
9424
10796
 
9425
10797
  // src/commands/ads/x/index.ts
9426
- import { defineCommand as defineCommand79 } from "citty";
10798
+ import { defineCommand as defineCommand81 } from "citty";
9427
10799
 
9428
10800
  // src/commands/ads/x/accounts.ts
9429
- import { defineCommand as defineCommand63 } from "citty";
10801
+ import { defineCommand as defineCommand65 } from "citty";
9430
10802
  registerSchema({
9431
10803
  command: "ads.x.accounts",
9432
10804
  description: "List all accessible X Ads accounts. Returns accounts with id (base36), name, approval_status, timezone, currency. Run this first to find account IDs for other commands.",
@@ -9454,7 +10826,7 @@ function handleAccountsError2(err) {
9454
10826
  writeAdsJson({ ok: false, error: { code: "NETWORK_ERROR", message: "Unexpected error" } });
9455
10827
  process.exit(1);
9456
10828
  }
9457
- var accountsCommand4 = defineCommand63({
10829
+ var accountsCommand4 = defineCommand65({
9458
10830
  meta: {
9459
10831
  name: "accounts",
9460
10832
  description: `List accessible X Ads accounts. Returns account IDs needed for all other commands.
@@ -9494,7 +10866,7 @@ Examples:
9494
10866
  });
9495
10867
 
9496
10868
  // src/commands/ads/x/active-entities.ts
9497
- import { defineCommand as defineCommand64 } from "citty";
10869
+ import { defineCommand as defineCommand66 } from "citty";
9498
10870
 
9499
10871
  // src/commands/ads/x/error-parser.ts
9500
10872
  function mapXErrorCode(message) {
@@ -9645,7 +11017,7 @@ function parseCsv(v) {
9645
11017
  const parts = v.split(",").map((s) => s.trim()).filter(Boolean);
9646
11018
  return parts.length > 0 ? parts : void 0;
9647
11019
  }
9648
- var activeEntitiesCommand = defineCommand64({
11020
+ var activeEntitiesCommand = defineCommand66({
9649
11021
  meta: {
9650
11022
  name: "active-entities",
9651
11023
  description: `List entities with metric activity in a time range.
@@ -9703,7 +11075,7 @@ Examples:
9703
11075
  });
9704
11076
 
9705
11077
  // src/commands/ads/x/audiences.ts
9706
- import { defineCommand as defineCommand65 } from "citty";
11078
+ import { defineCommand as defineCommand67 } from "citty";
9707
11079
  registerSchema({
9708
11080
  command: "ads.x.audiences",
9709
11081
  description: "List custom audiences for an X Ads account. Returns id, name, audience_size, audience_type, targetable status. Audiences need 100+ active users in the past 90 days to be targetable.",
@@ -9712,7 +11084,7 @@ registerSchema({
9712
11084
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
9713
11085
  }
9714
11086
  });
9715
- var audiencesCommand3 = defineCommand65({
11087
+ var audiencesCommand4 = defineCommand67({
9716
11088
  meta: {
9717
11089
  name: "audiences",
9718
11090
  description: `List X Ads custom audiences.
@@ -9761,7 +11133,7 @@ Examples:
9761
11133
  });
9762
11134
 
9763
11135
  // src/commands/ads/x/campaigns.ts
9764
- import { defineCommand as defineCommand66 } from "citty";
11136
+ import { defineCommand as defineCommand68 } from "citty";
9765
11137
 
9766
11138
  // src/commands/ads/x/run-list.ts
9767
11139
  function buildCleanParams(opts) {
@@ -9824,7 +11196,7 @@ registerSchema({
9824
11196
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
9825
11197
  }
9826
11198
  });
9827
- var campaignsCommand3 = defineCommand66({
11199
+ var campaignsCommand4 = defineCommand68({
9828
11200
  meta: {
9829
11201
  name: "campaigns",
9830
11202
  description: `List X Ads campaigns. Returns budget, schedule, funding instrument, status.
@@ -9866,7 +11238,7 @@ Examples:
9866
11238
  });
9867
11239
 
9868
11240
  // src/commands/ads/x/cards.ts
9869
- import { defineCommand as defineCommand67 } from "citty";
11241
+ import { defineCommand as defineCommand69 } from "citty";
9870
11242
  registerSchema({
9871
11243
  command: "ads.x.cards",
9872
11244
  description: "List website cards, video cards, and carousels for an X Ads account.",
@@ -9875,7 +11247,7 @@ registerSchema({
9875
11247
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
9876
11248
  }
9877
11249
  });
9878
- var cardsCommand = defineCommand67({
11250
+ var cardsCommand = defineCommand69({
9879
11251
  meta: {
9880
11252
  name: "cards",
9881
11253
  description: `List X Ads cards (rich creatives).
@@ -9924,7 +11296,7 @@ Examples:
9924
11296
  });
9925
11297
 
9926
11298
  // src/commands/ads/x/funding.ts
9927
- import { defineCommand as defineCommand68 } from "citty";
11299
+ import { defineCommand as defineCommand70 } from "citty";
9928
11300
  registerSchema({
9929
11301
  command: "ads.x.funding",
9930
11302
  description: "List funding instruments for an X Ads account. Returns id, type, currency, credit_limit_local_micro, funded_amount_local_micro, status. Falls back to BAKER_X_ADS_ACCOUNT_ID env var.",
@@ -9933,7 +11305,7 @@ registerSchema({
9933
11305
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
9934
11306
  }
9935
11307
  });
9936
- var fundingCommand = defineCommand68({
11308
+ var fundingCommand = defineCommand70({
9937
11309
  meta: {
9938
11310
  name: "funding",
9939
11311
  description: `List funding instruments for an X Ads account.
@@ -9982,7 +11354,7 @@ Examples:
9982
11354
  });
9983
11355
 
9984
11356
  // src/commands/ads/x/line-items.ts
9985
- import { defineCommand as defineCommand69 } from "citty";
11357
+ import { defineCommand as defineCommand71 } from "citty";
9986
11358
  registerSchema({
9987
11359
  command: "ads.x.lineItems",
9988
11360
  description: "List line items (ad groups) for an X Ads account. Returns bid, product_type, objective, placements, schedule. Filter by campaign-ids or line-item-ids (CSV).",
@@ -9994,7 +11366,7 @@ registerSchema({
9994
11366
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
9995
11367
  }
9996
11368
  });
9997
- var lineItemsCommand = defineCommand69({
11369
+ var lineItemsCommand = defineCommand71({
9998
11370
  meta: {
9999
11371
  name: "line-items",
10000
11372
  description: `List X Ads line items (ad groups).
@@ -10035,7 +11407,7 @@ Examples:
10035
11407
  });
10036
11408
 
10037
11409
  // src/commands/ads/x/media.ts
10038
- import { defineCommand as defineCommand70 } from "citty";
11410
+ import { defineCommand as defineCommand72 } from "citty";
10039
11411
  registerSchema({
10040
11412
  command: "ads.x.media",
10041
11413
  description: "List media assets in the X Ads media library (images, GIFs, videos). Filter by media-type (IMAGE, GIF, VIDEO).",
@@ -10045,7 +11417,7 @@ registerSchema({
10045
11417
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
10046
11418
  }
10047
11419
  });
10048
- var mediaCommand = defineCommand70({
11420
+ var mediaCommand = defineCommand72({
10049
11421
  meta: {
10050
11422
  name: "media",
10051
11423
  description: `List media assets in the X Ads media library.
@@ -10097,7 +11469,7 @@ Examples:
10097
11469
  });
10098
11470
 
10099
11471
  // src/commands/ads/x/promoted-tweets.ts
10100
- import { defineCommand as defineCommand71 } from "citty";
11472
+ import { defineCommand as defineCommand73 } from "citty";
10101
11473
  registerSchema({
10102
11474
  command: "ads.x.promotedTweets",
10103
11475
  description: "List promoted tweets for an X Ads account. Returns id, line_item_id, tweet_id, approval_status. Filter by line-item-ids (CSV).",
@@ -10108,7 +11480,7 @@ registerSchema({
10108
11480
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
10109
11481
  }
10110
11482
  });
10111
- var promotedTweetsCommand = defineCommand71({
11483
+ var promotedTweetsCommand = defineCommand73({
10112
11484
  meta: {
10113
11485
  name: "promoted-tweets",
10114
11486
  description: `List X Ads promoted tweets.
@@ -10162,11 +11534,11 @@ Examples:
10162
11534
  });
10163
11535
 
10164
11536
  // src/commands/ads/x/stats/index.ts
10165
- import { defineCommand as defineCommand76 } from "citty";
11537
+ import { defineCommand as defineCommand78 } from "citty";
10166
11538
 
10167
11539
  // src/commands/ads/x/stats/job.ts
10168
11540
  import { gunzipSync } from "zlib";
10169
- import { defineCommand as defineCommand72 } from "citty";
11541
+ import { defineCommand as defineCommand74 } from "citty";
10170
11542
  var POLL_INTERVAL_MS2 = 1e4;
10171
11543
  var DEADLINE_MS = 12 * 60 * 1e3;
10172
11544
  var RESULT_CACHE_TTL_MS = 6 * 60 * 60 * 1e3;
@@ -10236,7 +11608,7 @@ async function pollUntilDone(accountId, jobId) {
10236
11608
  function buildCacheKey(body) {
10237
11609
  return `stats-job:${JSON.stringify(body)}`;
10238
11610
  }
10239
- var statsJobCommand = defineCommand72({
11611
+ var statsJobCommand = defineCommand74({
10240
11612
  meta: {
10241
11613
  name: "job",
10242
11614
  description: `Async X Ads stats job, sync from the CLI's perspective. Creates \u2192 polls \u2192 downloads \u2192 returns.
@@ -10341,7 +11713,7 @@ For fine-grained control (don't wait, poll yourself), use:
10341
11713
  });
10342
11714
 
10343
11715
  // src/commands/ads/x/stats/job-create.ts
10344
- import { defineCommand as defineCommand73 } from "citty";
11716
+ import { defineCommand as defineCommand75 } from "citty";
10345
11717
  registerSchema({
10346
11718
  command: "ads.x.statsJobCreate",
10347
11719
  description: "Create an asynchronous X Ads stats job (range up to 90 days non-segmented, 45 days segmented). Returns a job id; poll with `stats job-status`. Times must be ISO 8601 hour-aligned.",
@@ -10364,7 +11736,7 @@ function parseCsv3(v) {
10364
11736
  const parts = v.split(",").map((s) => s.trim()).filter(Boolean);
10365
11737
  return parts.length > 0 ? parts : void 0;
10366
11738
  }
10367
- var statsJobCreateCommand = defineCommand73({
11739
+ var statsJobCreateCommand = defineCommand75({
10368
11740
  meta: {
10369
11741
  name: "job-create",
10370
11742
  description: `Create an async X Ads stats job (up to 90 days, supports segmentation).
@@ -10427,7 +11799,7 @@ Examples:
10427
11799
  });
10428
11800
 
10429
11801
  // src/commands/ads/x/stats/job-status.ts
10430
- import { defineCommand as defineCommand74 } from "citty";
11802
+ import { defineCommand as defineCommand76 } from "citty";
10431
11803
  registerSchema({
10432
11804
  command: "ads.x.statsJobStatus",
10433
11805
  description: "Check the status of one or more X Ads stats jobs. Returns status (PROCESSING|SUCCESS|FAILED) and a downloadable url when SUCCESS. Pass --job-id or --job-ids (CSV).",
@@ -10437,7 +11809,7 @@ registerSchema({
10437
11809
  "job-ids": { type: "string", description: "CSV of job IDs", required: false }
10438
11810
  }
10439
11811
  });
10440
- var statsJobStatusCommand = defineCommand74({
11812
+ var statsJobStatusCommand = defineCommand76({
10441
11813
  meta: {
10442
11814
  name: "job-status",
10443
11815
  description: `Poll the status of an async X Ads stats job.
@@ -10478,7 +11850,7 @@ Examples:
10478
11850
  });
10479
11851
 
10480
11852
  // src/commands/ads/x/stats/sync.ts
10481
- import { defineCommand as defineCommand75 } from "citty";
11853
+ import { defineCommand as defineCommand77 } from "citty";
10482
11854
 
10483
11855
  // src/commands/ads/x/presets.ts
10484
11856
  var X_STATS_PRESETS = [
@@ -10637,7 +12009,7 @@ async function runSync(args, q) {
10637
12009
  process.exit(1);
10638
12010
  }
10639
12011
  }
10640
- var statsSyncCommand = defineCommand75({
12012
+ var statsSyncCommand = defineCommand77({
10641
12013
  meta: {
10642
12014
  name: "sync",
10643
12015
  description: `Synchronous X Ads analytics (max 7-day window).
@@ -10680,7 +12052,7 @@ Examples:
10680
12052
  });
10681
12053
 
10682
12054
  // src/commands/ads/x/stats/index.ts
10683
- var statsCommand = defineCommand76({
12055
+ var statsCommand = defineCommand78({
10684
12056
  meta: {
10685
12057
  name: "stats",
10686
12058
  description: `X Ads analytics. Sync (\u22647 days, no segmentation) or async jobs (\u226490 days, segmentable).
@@ -10708,7 +12080,7 @@ Examples:
10708
12080
  });
10709
12081
 
10710
12082
  // src/commands/ads/x/targeting-constants.ts
10711
- import { defineCommand as defineCommand77 } from "citty";
12083
+ import { defineCommand as defineCommand79 } from "citty";
10712
12084
  var ALLOWED_CONSTANTS = [
10713
12085
  "locations",
10714
12086
  "interests",
@@ -10736,7 +12108,7 @@ registerSchema({
10736
12108
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
10737
12109
  }
10738
12110
  });
10739
- var targetingConstantsCommand = defineCommand77({
12111
+ var targetingConstantsCommand = defineCommand79({
10740
12112
  meta: {
10741
12113
  name: "targeting-constants",
10742
12114
  description: `Lookup X Ads targeting constants.
@@ -10786,7 +12158,7 @@ Examples:
10786
12158
  });
10787
12159
 
10788
12160
  // src/commands/ads/x/targeting-criteria.ts
10789
- import { defineCommand as defineCommand78 } from "citty";
12161
+ import { defineCommand as defineCommand80 } from "citty";
10790
12162
  registerSchema({
10791
12163
  command: "ads.x.targetingCriteria",
10792
12164
  description: "List targeting criteria attached to line items in an X Ads account. Returns targeting_type, targeting_value, name, operator_type per criterion. Filter by line-item-ids.",
@@ -10796,7 +12168,7 @@ registerSchema({
10796
12168
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
10797
12169
  }
10798
12170
  });
10799
- var targetingCriteriaCommand = defineCommand78({
12171
+ var targetingCriteriaCommand = defineCommand80({
10800
12172
  meta: {
10801
12173
  name: "targeting-criteria",
10802
12174
  description: `List targeting criteria attached to line items.
@@ -10847,7 +12219,7 @@ Examples:
10847
12219
  });
10848
12220
 
10849
12221
  // src/commands/ads/x/index.ts
10850
- var xCommand = defineCommand79({
12222
+ var xCommand = defineCommand81({
10851
12223
  meta: {
10852
12224
  name: "x",
10853
12225
  description: `X (Twitter) Ads commands. Read campaigns, line items, promoted tweets, creatives, audiences, and analytics.
@@ -10871,12 +12243,12 @@ The CLI auto-detects --account-id when exactly one X Ads account is connected, o
10871
12243
  subCommands: {
10872
12244
  accounts: accountsCommand4,
10873
12245
  funding: fundingCommand,
10874
- campaigns: campaignsCommand3,
12246
+ campaigns: campaignsCommand4,
10875
12247
  "line-items": lineItemsCommand,
10876
12248
  "promoted-tweets": promotedTweetsCommand,
10877
12249
  cards: cardsCommand,
10878
12250
  media: mediaCommand,
10879
- audiences: audiencesCommand3,
12251
+ audiences: audiencesCommand4,
10880
12252
  "targeting-criteria": targetingCriteriaCommand,
10881
12253
  "targeting-constants": targetingConstantsCommand,
10882
12254
  "active-entities": activeEntitiesCommand,
@@ -10885,7 +12257,7 @@ The CLI auto-detects --account-id when exactly one X Ads account is connected, o
10885
12257
  });
10886
12258
 
10887
12259
  // src/commands/ads/index.ts
10888
- var adsCommand = defineCommand80({
12260
+ var adsCommand2 = defineCommand82({
10889
12261
  meta: {
10890
12262
  name: "ads",
10891
12263
  description: `Ad platform commands. Each platform exposes its own native command surface \u2014 no forced parity.
@@ -10915,11 +12287,11 @@ Examples:
10915
12287
  });
10916
12288
 
10917
12289
  // src/commands/canvas/index.ts
10918
- import { defineCommand as defineCommand88 } from "citty";
12290
+ import { defineCommand as defineCommand90 } from "citty";
10919
12291
 
10920
12292
  // src/commands/canvas/catalog.ts
10921
- import { defineCommand as defineCommand81 } from "citty";
10922
- var catalogCommand = defineCommand81({
12293
+ import { defineCommand as defineCommand83 } from "citty";
12294
+ var catalogCommand = defineCommand83({
10923
12295
  meta: {
10924
12296
  name: "catalog",
10925
12297
  description: "Print the agent-facing node catalog (JSON Schema). Includes every registered node grouped by category."
@@ -10936,9 +12308,9 @@ import { execFile } from "child_process";
10936
12308
  import { readdir, readFile, stat } from "fs/promises";
10937
12309
  import path from "path";
10938
12310
  import { promisify } from "util";
10939
- import { defineCommand as defineCommand82 } from "citty";
12311
+ import { defineCommand as defineCommand84 } from "citty";
10940
12312
  var execFileAsync = promisify(execFile);
10941
- var inspectCommand = defineCommand82({
12313
+ var inspectCommand = defineCommand84({
10942
12314
  meta: {
10943
12315
  name: "inspect",
10944
12316
  description: "Dump a one-page summary of a canvas run: per-node duration + cache status, list of output files in the run dir, and optionally three thumbnail frames per video output. Pass either a run_id (resolved against --outputs-dir) or an absolute run directory."
@@ -11047,7 +12419,7 @@ async function probeDuration(filePath) {
11047
12419
  // src/commands/canvas/run.ts
11048
12420
  import { readFile as readFile2 } from "fs/promises";
11049
12421
  import path4 from "path";
11050
- import { defineCommand as defineCommand83 } from "citty";
12422
+ import { defineCommand as defineCommand85 } from "citty";
11051
12423
 
11052
12424
  // src/commands/canvas/placeholders.ts
11053
12425
  function unsuppliedPlaceholderAssets(canvas) {
@@ -11117,7 +12489,7 @@ async function pruneOldRuns(outputsDir, keep, currentRunId, log) {
11117
12489
  }
11118
12490
 
11119
12491
  // src/commands/canvas/run.ts
11120
- var runCommand = defineCommand83({
12492
+ var runCommand = defineCommand85({
11121
12493
  meta: { name: "run", description: "Validate and execute a canvas JSON file." },
11122
12494
  args: {
11123
12495
  file: { type: "positional", required: true, description: "Path to canvas JSON" },
@@ -11213,30 +12585,30 @@ var runCommand = defineCommand83({
11213
12585
  // src/commands/canvas/scaffold-static-ad.ts
11214
12586
  import { readFile as readFile3, writeFile } from "fs/promises";
11215
12587
  import path5 from "path";
11216
- import { defineCommand as defineCommand84 } from "citty";
12588
+ import { defineCommand as defineCommand86 } from "citty";
11217
12589
 
11218
12590
  // src/engine/scaffold/staticAd.ts
11219
- import { z as z8 } from "zod";
12591
+ import { z as z10 } from "zod";
11220
12592
  var GEN_ASPECT_RATIOS = /* @__PURE__ */ new Set(["1:1", "4:5", "9:16", "16:9", "4:3", "3:4", "2:3", "3:2", "21:9"]);
11221
12593
  var DEFAULT_ASPECT_RATIO = "9:16";
11222
- var Blueprint = z8.object({
11223
- meta: z8.object({ estimated_aspect_ratio: z8.string().optional() }).loose().optional(),
11224
- text_content: z8.array(z8.object({ text: z8.string().optional() }).loose()).optional()
12594
+ var Blueprint = z10.object({
12595
+ meta: z10.object({ estimated_aspect_ratio: z10.string().optional() }).loose().optional(),
12596
+ text_content: z10.array(z10.object({ text: z10.string().optional() }).loose()).optional()
11225
12597
  }).loose();
11226
- var ElementLocator = z8.object({
11227
- collection: z8.enum(["subjects", "people", "brands_logos"]),
11228
- index: z8.number().int().nonnegative()
12598
+ var ElementLocator = z10.object({
12599
+ collection: z10.enum(["subjects", "people", "brands_logos"]),
12600
+ index: z10.number().int().nonnegative()
11229
12601
  }).loose();
11230
- var MainElement = z8.object({
12602
+ var MainElement = z10.object({
11231
12603
  // logo | product | person | animal | badge | other
11232
- type: z8.string(),
11233
- label: z8.string().optional(),
11234
- description: z8.string().optional(),
11235
- expression: z8.string().nullable().optional(),
11236
- reason: z8.string().optional(),
12604
+ type: z10.string(),
12605
+ label: z10.string().optional(),
12606
+ description: z10.string().optional(),
12607
+ expression: z10.string().nullable().optional(),
12608
+ reason: z10.string().optional(),
11237
12609
  locator: ElementLocator.optional()
11238
12610
  }).loose();
11239
- var MainElements = z8.array(MainElement);
12611
+ var MainElements = z10.array(MainElement);
11240
12612
  function sanitizeId(raw, fallback) {
11241
12613
  const id = raw.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
11242
12614
  return /^[a-z]/.test(id) ? id : `${fallback}_${id}`.replace(/_+$/g, "") || fallback;
@@ -11278,7 +12650,7 @@ function roleForType(type) {
11278
12650
  return "the showcased product; keep this exact product identity. Ignore any caption text printed on this reference.";
11279
12651
  case "person":
11280
12652
  case "animal":
11281
- return "the hero subject; keep this identity AND the expression the blueprint specifies. Ignore any caption text printed on this reference.";
12653
+ return "the emotional hero \u2014 the face/muzzle/eyes the viewer locks onto and exactly where AI artifacts (malformed mouths, teeth, foam, extra fingers) betray a fake. It MUST be grounded in this real reference, never invented from prose. Keep this identity AND the expression the blueprint specifies. Ignore any caption text printed on this reference.";
11282
12654
  default:
11283
12655
  return "an identity-bearing element; reproduce it faithfully from this reference. Ignore any caption text printed on it.";
11284
12656
  }
@@ -11286,7 +12658,9 @@ function roleForType(type) {
11286
12658
  function todoPath(el, label) {
11287
12659
  const desc = el.description ? ` \u2014 ${el.description}` : "";
11288
12660
  const expr = el.expression ? `, with a ${el.expression} expression` : "";
11289
- return `[TODO: drop a real image for ${label} (${el.type})${desc}${expr}]`;
12661
+ const t = el.type.toLowerCase();
12662
+ const lock = t === "person" || t === "animal" ? " \u2014 REQUIRED: this is the emotional hero; ground it in a real reference (image-library / video-library / Pinterest), do not delete this slot and free-generate" : "";
12663
+ return `[TODO: drop a real image for ${label} (${el.type})${desc}${expr}${lock}]`;
11290
12664
  }
11291
12665
  function aspectRatio(blueprint, opts) {
11292
12666
  const requested = opts.aspectRatio ?? blueprint.meta?.estimated_aspect_ratio;
@@ -11401,7 +12775,7 @@ function resolveModel(kind, preferred) {
11401
12775
  const ids = Object.keys(MODEL_REGISTRY[kind]);
11402
12776
  return ids.includes(preferred) ? preferred : ids[0] ?? preferred;
11403
12777
  }
11404
- var DESCRIBE_FOCUS = "the GLOBAL LAYOUT GEOMETRY above all \u2014 the column/row grid, each region's approximate bounds as a percentage of frame width and height, any panel SPLITS and their proportions (e.g. a left column split into a ~60% top photo and a ~20% bottom price box), what occupies every region, and for EVERY text block its string verbatim, relative size (x_large | large | medium | small), weight, case, color, and alignment \u2014 including small bottom-corner fine print. Also: the EXPRESSION and emotion of every person/animal (capture exaggerated or AI-edited faces), the ad_intent (what feeling it engineers and how), per-color brand_ownership (which colors are the advertiser's brand vs borrowed-functional like a red comparison column), logos by brand, and all visible text verbatim";
12778
+ var DESCRIBE_FOCUS = `the GLOBAL LAYOUT GEOMETRY above all \u2014 the column/row grid, each region's approximate bounds as a percentage of frame width and height, any panel SPLITS and their proportions (e.g. a left column split into a ~60% top photo and a ~20% bottom price box), what occupies every region, and for EVERY text block its string verbatim, relative size (x_large | large | medium | small), weight, case, color, and alignment \u2014 including small bottom-corner fine print. Also: the EXPRESSION and emotion of every person/animal (capture exaggerated or AI-edited faces), the ad_intent (what feeling it engineers and how), per-color brand_ownership (which colors are the advertiser's brand vs borrowed-functional like a red comparison column), logos by brand, and all visible text verbatim. CRITICAL \u2014 name the WINNING MECHANISM(S): the special sauce, the specific thing that makes THIS ad a candidate winner rather than a generic ad. A great ad is rarely great by accident, and the mechanism is invisible unless named, so a faithful rewrite quietly discards it. It may be VERBAL (a rhyme, pun, alliteration, rhythm/meter, repetition, antithesis, double meaning), VISUAL (an unexpected crop or scale, a visual gag or pun, a striking juxtaposition, a pattern interrupt, an exaggerated/AI-edited expression, a before/after or comparison, bold negative space, a surprising focal point), or STRUCTURAL (an unusual hook, order, or reveal). Record each as a \`winning_mechanisms\` array of { kind: verbal|visual|structural, device, why_it_works } (e.g. { kind: verbal, device: "rhyme \u2014 'today' / 'go away'", why_it_works: "memorable, playful, reframes cost as relief" }) so a rewrite can rebuild the SAUCE for our brand instead of adapting only the surface and losing what made it convert`;
11405
12779
  var LAYOUT_SYSTEM = "You convert an advertisement's JSON blueprint into a precise, structured LAYOUT MAP of the frame \u2014 the spatial grid a designer would rebuild it from. Be exhaustive and quantitative: every region, its bounds as a percentage of the frame, and every text block with its relative size. Output ONLY a JSON object, no prose.";
11406
12780
  var LAYOUT_PROMPT = `AD BLUEPRINT (from image_describe):
11407
12781
  {{blueprint}}
@@ -11423,7 +12797,20 @@ Return a JSON object describing the GLOBAL LAYOUT of the frame precisely enough
11423
12797
 
11424
12798
  Use the blueprint's positions, sizes, text_content, and colors. Estimate the percentages and split proportions as accurately as you can (e.g. a column split 60/20 with a 20% gap). Cover EVERY visible element \u2014 photos, text boxes, badges, background shapes, and small corner text \u2014 top-to-bottom, left-to-right. Output ONLY the JSON object.`;
11425
12799
  var SELECT_SYSTEM = 'You identify the MAIN, identity-critical visual elements of an advertisement from its JSON blueprint \u2014 the things a faithful reproduction must supply as REAL reference images instead of letting a model invent them. Output ONLY a JSON object of the form { "elements": [ ... ] }, no prose.';
11426
- var SELECT_PROMPT = 'AD BLUEPRINT (from image_describe):\n{{blueprint}}\n\nFrom this blueprint, list ONLY the elements that are prominent, important, and identity-bearing \u2014 the ones a reproduction must ground in a real asset:\n- the brand logo/wordmark (from brands_logos with function_in_image = advertiser_brand) -> type "logo"\n- trust/rating/certification/app-store/review badges (brands_logos with function_in_image = trust_badge | review_platform | certification_or_seal | app_store_badge | payment_method) -> type "badge"\n- a showcased/hero product or package (a foreground entry in subjects that the ad is selling) -> type "product"\n- a foreground person whose identity matters (from people) -> type "person"\n- a foreground animal/character with a specific expression (from subjects) -> type "animal"\n\nDROP background extras, decorative props, generic scenery, and anything small or incidental. Keep at most ~6. If there are none, return an empty list.\n\nFor each kept element return: { "type": one of logo|product|person|animal|badge, "label": a short UPPER_SNAKE_CASE name (e.g. LOGO, PRODUCT, HERO_DOG, TRUSTPILOT), "description": a concrete reusable description to source/shoot the real asset (include the exact expression for a living subject), "expression": the facial expression for a living subject or null, "reason": why it is identity-critical, "locator": the blueprint entry this element came from as { "collection": one of "subjects" | "people" | "brands_logos", "index": its 0-based position in that array } (people -> people; logos/badges -> brands_logos; products/animals/objects -> subjects). Output ONLY the JSON object.';
12800
+ var SELECT_PROMPT = `AD BLUEPRINT (from image_describe):
12801
+ {{blueprint}}
12802
+
12803
+ From this blueprint, list ONLY the elements that are prominent, important, and identity-bearing \u2014 the ones a reproduction must ground in a real asset:
12804
+ - the brand logo/wordmark (from brands_logos with function_in_image = advertiser_brand) -> type "logo"
12805
+ - trust/rating/certification/app-store/review badges (brands_logos with function_in_image = trust_badge | review_platform | certification_or_seal | app_store_badge | payment_method) -> type "badge"
12806
+ - a showcased/hero product or package (a foreground entry in subjects that the ad is selling) -> type "product"
12807
+ - a foreground person (from people) \u2014 keep it when its identity matters OR it is the emotional/hero focal point of the ad, even a generic one with no brand identity -> type "person"
12808
+ - a foreground animal/character (from subjects) \u2014 keep it when it carries a specific expression OR it is the emotional/hero focal point, even a generic one -> type "animal"
12809
+ (For both: a free-generated face, muzzle, hands, or teeth reads as AI and grows artifacts \u2014 malformed mouths, extra fingers, foam \u2014 so the emotional hero needs the STRONGEST real grounding, not the weakest; "it's just a generic dog/person" is never a reason to drop it.)
12810
+
12811
+ DROP background extras, decorative props, generic scenery, and anything small or incidental. Keep at most ~6. If there are none, return an empty list.
12812
+
12813
+ For each kept element return: { "type": one of logo|product|person|animal|badge, "label": a short UPPER_SNAKE_CASE name (e.g. LOGO, PRODUCT, HERO_DOG, TRUSTPILOT), "description": a concrete reusable description to source/shoot the real asset (include the exact expression for a living subject, and its castable attributes \u2014 breed/species for an animal, apparent age band, apparent origin/ethnicity, and wardrobe/setting for a person \u2014 so it can be recast to fit OUR audience/market), "expression": the facial expression for a living subject or null, "reason": why it is identity-critical, "locator": the blueprint entry this element came from as { "collection": one of "subjects" | "people" | "brands_logos", "index": its 0-based position in that array } (people -> people; logos/badges -> brands_logos; products/animals/objects -> subjects). Output ONLY the JSON object.`;
11427
12814
  async function loadAssetText(ref, label) {
11428
12815
  const r = ref;
11429
12816
  if (typeof r?.path === "string") return readFile3(r.path, "utf8");
@@ -11532,7 +12919,7 @@ async function runVisionPasses(canvas) {
11532
12919
  return fail("read_outputs", e instanceof Error ? e.message : String(e));
11533
12920
  }
11534
12921
  }
11535
- var scaffoldStaticAdCommand = defineCommand84({
12922
+ var scaffoldStaticAdCommand = defineCommand86({
11536
12923
  meta: {
11537
12924
  name: "scaffold-static-ad",
11538
12925
  description: "Turn a source/inspiration image into a runnable static-ad canvas. Runs billed passes \u2014 image_describe (the blueprint, baked to prompt.json as the editable 'prompt'), an AI selection of the image's MAIN identity elements, and a structured global-layout pass (the column/row grid with per-region bounds and text sizes) \u2014 then scaffolds a canvas that wires one [TODO] ingest slot per element (logo/product/subject/badge + brand font) into image_generate. Edit prompt.json and drop the real assets, then `baker canvas run` it."
@@ -11626,7 +13013,7 @@ var scaffoldStaticAdCommand = defineCommand84({
11626
13013
  // src/commands/canvas/scaffold-video.ts
11627
13014
  import { cp, mkdir, readFile as readFile6, writeFile as writeFile2 } from "fs/promises";
11628
13015
  import path8 from "path";
11629
- import { defineCommand as defineCommand85 } from "citty";
13016
+ import { defineCommand as defineCommand87 } from "citty";
11630
13017
 
11631
13018
  // src/engine/nodes/local/lib/sceneDetect.ts
11632
13019
  import { execFile as execFile2 } from "child_process";
@@ -11731,7 +13118,7 @@ import { toCardinal as nwKo } from "n2words/ko-KR";
11731
13118
  import { toCardinal as nwNl } from "n2words/nl-NL";
11732
13119
  import { toCardinal as nwPl } from "n2words/pl-PL";
11733
13120
  import { toCardinal as nwPt } from "n2words/pt-PT";
11734
- import { z as z9 } from "zod";
13121
+ import { z as z11 } from "zod";
11735
13122
 
11736
13123
  // src/engine/scaffold/lib/shoot-modes.ts
11737
13124
  var SHOOT_MODES = [
@@ -11988,49 +13375,49 @@ function trimArgs(durationS, offsetS = 0) {
11988
13375
  "{{out.video}}"
11989
13376
  ];
11990
13377
  }
11991
- var FrameAsset = z9.object({ url: z9.string().optional() }).loose().optional();
11992
- var DialogueLine = z9.object({
11993
- speaker: z9.string().optional(),
11994
- line: z9.string().optional(),
13378
+ var FrameAsset = z11.object({ url: z11.string().optional() }).loose().optional();
13379
+ var DialogueLine = z11.object({
13380
+ speaker: z11.string().optional(),
13381
+ line: z11.string().optional(),
11995
13382
  // Absolute seconds on the source timeline (the deconstruct emits both).
11996
- start_s: z9.number().optional(),
11997
- end_s: z9.number().optional(),
11998
- delivery: z9.string().optional(),
11999
- voice_description: z9.string().optional()
13383
+ start_s: z11.number().optional(),
13384
+ end_s: z11.number().optional(),
13385
+ delivery: z11.string().optional(),
13386
+ voice_description: z11.string().optional()
12000
13387
  }).loose();
12001
- var Sfx = z9.object({
12002
- at_s: z9.number().optional(),
12003
- duration_s: z9.number().optional(),
12004
- sound_effect_prompt: z9.string().optional(),
12005
- description: z9.string().optional()
13388
+ var Sfx = z11.object({
13389
+ at_s: z11.number().optional(),
13390
+ duration_s: z11.number().optional(),
13391
+ sound_effect_prompt: z11.string().optional(),
13392
+ description: z11.string().optional()
12006
13393
  }).loose();
12007
- var CompositionRegion = z9.object({
13394
+ var CompositionRegion = z11.object({
12008
13395
  // full | top | bottom | left | right | inset
12009
- panel: z9.string().optional(),
13396
+ panel: z11.string().optional(),
12010
13397
  // 9-grid anchor for an `inset` presenter box.
12011
- position: z9.string().optional(),
12012
- is_presenter: z9.boolean().optional(),
13398
+ position: z11.string().optional(),
13399
+ is_presenter: z11.boolean().optional(),
12013
13400
  // The cast id shown/speaking in this region (routes lip-sync + element refs).
12014
- cast_ref: z9.string().optional(),
12015
- summary: z9.string().optional(),
12016
- frame_prompt: z9.string().optional(),
12017
- motion_prompt: z9.string().optional()
13401
+ cast_ref: z11.string().optional(),
13402
+ summary: z11.string().optional(),
13403
+ frame_prompt: z11.string().optional(),
13404
+ motion_prompt: z11.string().optional()
12018
13405
  }).loose();
12019
- var SceneComposition = z9.object({
13406
+ var SceneComposition = z11.object({
12020
13407
  // full_frame (default) | split_screen | pip | keyed_overlay
12021
- layout: z9.string().optional(),
13408
+ layout: z11.string().optional(),
12022
13409
  // split_screen only: vertical (top/bottom) | horizontal (left/right).
12023
- split_axis: z9.string().optional(),
12024
- regions: z9.array(CompositionRegion).optional()
13410
+ split_axis: z11.string().optional(),
13411
+ regions: z11.array(CompositionRegion).optional()
12025
13412
  }).loose();
12026
- var CameraMotion = z9.object({ movement: z9.string().optional(), detail: z9.string().optional() }).loose();
12027
- var TranscriptWord = z9.object({ text: z9.string().optional() }).loose();
12028
- var Scene = z9.object({
12029
- start_s: z9.number().optional(),
12030
- end_s: z9.number().optional(),
12031
- duration_s: z9.number().optional(),
12032
- summary: z9.string().optional(),
12033
- action_detail: z9.string().optional(),
13413
+ var CameraMotion = z11.object({ movement: z11.string().optional(), detail: z11.string().optional() }).loose();
13414
+ var TranscriptWord = z11.object({ text: z11.string().optional() }).loose();
13415
+ var Scene = z11.object({
13416
+ start_s: z11.number().optional(),
13417
+ end_s: z11.number().optional(),
13418
+ duration_s: z11.number().optional(),
13419
+ summary: z11.string().optional(),
13420
+ action_detail: z11.string().optional(),
12034
13421
  // The scene's spatial layout. Absent/full_frame ⇒ one uncut shot (default path).
12035
13422
  // A layered layout (split_screen/pip/keyed_overlay) with regions ⇒ the scaffold
12036
13423
  // builds one clip per region and stacks/overlays them into the scene picture.
@@ -12038,77 +13425,77 @@ var Scene = z9.object({
12038
13425
  // The capture "look" for this scene — selected from the ad-native shoot-mode
12039
13426
  // grammar (see lib/shoot-modes.ts). When absent the scaffold auto-derives a
12040
13427
  // UGC/product mode; a human can override per scene by setting this.
12041
- shoot_mode: z9.string().optional(),
13428
+ shoot_mode: z11.string().optional(),
12042
13429
  // Diegetic ambient the clip's native audio should carry (no music). When
12043
13430
  // absent the scene falls back to its shoot mode's default ambience.
12044
- ambient: z9.string().optional(),
13431
+ ambient: z11.string().optional(),
12045
13432
  camera_motion: CameraMotion.optional(),
12046
- start_frame_prompt: z9.string().optional(),
12047
- end_frame_prompt: z9.string().optional(),
12048
- motion_prompt: z9.string().optional(),
13433
+ start_frame_prompt: z11.string().optional(),
13434
+ end_frame_prompt: z11.string().optional(),
13435
+ motion_prompt: z11.string().optional(),
12049
13436
  // The scene's role in the ad's persuasion arc (DECON-supplied); drives the
12050
13437
  // script re-craft checklist. Inferred from position when absent.
12051
- narrative_role: z9.string().optional(),
13438
+ narrative_role: z11.string().optional(),
12052
13439
  // DECON-supplied on the HOOK scene: the engineered physical/emotional state that
12053
13440
  // makes the first frame stop the scroll (sweaty/breathless/urgent …). Injected
12054
13441
  // into the hook's start-frame description so the generator renders that state,
12055
13442
  // not a calm influencer (CCA-11).
12056
- hook_mechanic: z9.object({ mechanic: z9.string().optional(), why_it_stops_scroll: z9.string().optional() }).loose().optional(),
13443
+ hook_mechanic: z11.object({ mechanic: z11.string().optional(), why_it_stops_scroll: z11.string().optional() }).loose().optional(),
12057
13444
  // DECON-supplied per-scene location (so a gym hook isn't flattened to "home").
12058
- scene_setting: z9.string().optional(),
13445
+ scene_setting: z11.string().optional(),
12059
13446
  // How this scene cuts to the next (DECON-supplied). A recognized non-cut type
12060
13447
  // (fade/whip/zoom/dissolve/swipe) is reproduced as an ffmpeg xfade at the
12061
13448
  // boundary; cut/match_cut/none/other stay hard cuts. The last scene's value is
12062
13449
  // ignored (nothing follows it).
12063
- transition_out: z9.object({ type: z9.string().optional(), description: z9.string().optional() }).loose().optional(),
12064
- dialogue: z9.array(DialogueLine).optional(),
12065
- sfx: z9.array(Sfx).optional(),
12066
- overlays: z9.array(z9.unknown()).optional(),
12067
- floating_elements: z9.array(z9.unknown()).optional(),
12068
- transcript_slice: z9.array(TranscriptWord).optional(),
13450
+ transition_out: z11.object({ type: z11.string().optional(), description: z11.string().optional() }).loose().optional(),
13451
+ dialogue: z11.array(DialogueLine).optional(),
13452
+ sfx: z11.array(Sfx).optional(),
13453
+ overlays: z11.array(z11.unknown()).optional(),
13454
+ floating_elements: z11.array(z11.unknown()).optional(),
13455
+ transcript_slice: z11.array(TranscriptWord).optional(),
12069
13456
  start_frame_asset: FrameAsset,
12070
13457
  end_frame_asset: FrameAsset,
12071
13458
  // DECON-supplied: true when this scene is a length-split CONTINUATION of the
12072
13459
  // previous one (the SAME physical shot, broken up only because it exceeded the
12073
13460
  // clip ceiling). The scaffold then shares the splice keyframe — this scene's
12074
13461
  // start frame IS the previous scene's end frame — so the join is seamless.
12075
- continues_previous: z9.boolean().optional()
13462
+ continues_previous: z11.boolean().optional()
12076
13463
  }).loose();
12077
- var VideoBlueprint = z9.object({
12078
- source: z9.object({ aspect_ratio: z9.string().optional(), duration_s: z9.number().optional() }).loose().optional(),
12079
- global: z9.object({
12080
- music: z9.object({
12081
- present: z9.boolean().optional(),
12082
- music_prompt: z9.string().optional(),
13464
+ var VideoBlueprint = z11.object({
13465
+ source: z11.object({ aspect_ratio: z11.string().optional(), duration_s: z11.number().optional() }).loose().optional(),
13466
+ global: z11.object({
13467
+ music: z11.object({
13468
+ present: z11.boolean().optional(),
13469
+ music_prompt: z11.string().optional(),
12083
13470
  // Absolute second the music enters in the reference (the bed often
12084
13471
  // kicks in mid-ad, after the hook). We start the regenerated track here
12085
13472
  // instead of at 0 so the timing matches.
12086
- starts_at_s: z9.number().optional(),
13473
+ starts_at_s: z11.number().optional(),
12087
13474
  // Populated by the deconstruct when AudD (Shazam-style) recognizes the
12088
13475
  // reference track. We never reuse it — only style the regenerated bed.
12089
- identified_track: z9.object({ title: z9.string().optional(), artist: z9.string().optional() }).loose().nullish()
13476
+ identified_track: z11.object({ title: z11.string().optional(), artist: z11.string().optional() }).loose().nullish()
12090
13477
  }).loose().optional(),
12091
- cast: z9.array(
12092
- z9.object({
12093
- id: z9.string().optional(),
12094
- description: z9.string().optional(),
13478
+ cast: z11.array(
13479
+ z11.object({
13480
+ id: z11.string().optional(),
13481
+ description: z11.string().optional(),
12095
13482
  // The deconstruct's note on the target-market localization (e.g. "native
12096
13483
  // French speaker") — read to derive the spoken-track language code.
12097
- market_localization_note: z9.string().optional()
13484
+ market_localization_note: z11.string().optional()
12098
13485
  }).loose()
12099
13486
  ).optional(),
12100
- voiceover: z9.object({
13487
+ voiceover: z11.object({
12101
13488
  // on_camera | mixed → mouths are on screen (lip-sync candidates);
12102
13489
  // voiceover | none → narration over the picture (no lip-sync).
12103
- mode: z9.string().optional(),
12104
- voice_description: z9.string().optional(),
12105
- persona: z9.string().optional()
13490
+ mode: z11.string().optional(),
13491
+ voice_description: z11.string().optional(),
13492
+ persona: z11.string().optional()
12106
13493
  }).loose().optional(),
12107
13494
  // Visual palette — read only to colour a clean brand-card/CTA plate (the
12108
13495
  // first hex is the dominant brand colour); never to drive frame generation.
12109
- style: z9.object({ palette: z9.array(z9.object({ hex: z9.string().optional() }).loose()).optional() }).loose().optional()
13496
+ style: z11.object({ palette: z11.array(z11.object({ hex: z11.string().optional() }).loose()).optional() }).loose().optional()
12110
13497
  }).loose().optional(),
12111
- scenes: z9.array(Scene).min(1)
13498
+ scenes: z11.array(Scene).min(1)
12112
13499
  }).loose();
12113
13500
  function injectHookPhysicality(blueprint) {
12114
13501
  for (const scene of blueprint.scenes) {
@@ -12118,26 +13505,26 @@ function injectHookPhysicality(blueprint) {
12118
13505
  scene.start_frame_prompt = `${prompt} The subject's physical state IS the scroll-stopper \u2014 render it explicitly, not a calm pose: ${why}.`;
12119
13506
  }
12120
13507
  }
12121
- var AppearsItem = z9.union([z9.number(), z9.object({ scene: z9.number(), edge: z9.string().optional() }).loose()]);
12122
- var RecurringElement = z9.object({
13508
+ var AppearsItem = z11.union([z11.number(), z11.object({ scene: z11.number(), edge: z11.string().optional() }).loose()]);
13509
+ var RecurringElement = z11.object({
12123
13510
  // person | animal | product | logo | badge | other
12124
- type: z9.string(),
12125
- label: z9.string().optional(),
12126
- description: z9.string().optional(),
12127
- expression: z9.string().nullable().optional(),
13511
+ type: z11.string(),
13512
+ label: z11.string().optional(),
13513
+ description: z11.string().optional(),
13514
+ expression: z11.string().nullable().optional(),
12128
13515
  // When the element maps to a global cast entry, its stable id (for annotation).
12129
- cast_id: z9.string().nullable().optional(),
13516
+ cast_id: z11.string().nullable().optional(),
12130
13517
  // The label of another element that is the SAME individual as this one, shown
12131
13518
  // in a DIFFERENT wardrobe/persona/state (e.g. one creator playing skeptic in a
12132
13519
  // pink shirt and believer in a white shirt). Each look gets its own reference
12133
13520
  // slot, but the face/identity must stay identical across them.
12134
- same_as: z9.string().nullable().optional(),
13521
+ same_as: z11.string().nullable().optional(),
12135
13522
  // Scenes the element appears in. Either a bare list of scene indices (both
12136
13523
  // edges) or per-{scene,edge} entries. Both forms are accepted and merged.
12137
- scenes: z9.array(z9.number()).optional(),
12138
- appears_in: z9.array(AppearsItem).optional()
13524
+ scenes: z11.array(z11.number()).optional(),
13525
+ appears_in: z11.array(AppearsItem).optional()
12139
13526
  }).loose();
12140
- var RecurringElements = z9.array(RecurringElement);
13527
+ var RecurringElements = z11.array(RecurringElement);
12141
13528
  function sanitizeId2(raw, fallback) {
12142
13529
  const id = raw.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
12143
13530
  return /^[a-z]/.test(id) ? id : `${fallback}_${id}`.replace(/_+$/g, "") || fallback;
@@ -13600,25 +14987,25 @@ function buildSfxMusic(blueprint, nodes) {
13600
14987
  }
13601
14988
  return tracks;
13602
14989
  }
13603
- var OverlayStyle = z9.object({ color_hex: z9.string().optional(), background: z9.string().optional(), size: z9.string().optional() }).loose();
13604
- var Overlay = z9.object({
13605
- text: z9.string().optional(),
13606
- appears_at_s: z9.number().optional(),
13607
- duration_s: z9.number().optional(),
13608
- position: z9.string().optional(),
13609
- role: z9.string().optional(),
13610
- animation: z9.string().optional(),
13611
- animation_detail: z9.string().optional(),
14990
+ var OverlayStyle = z11.object({ color_hex: z11.string().optional(), background: z11.string().optional(), size: z11.string().optional() }).loose();
14991
+ var Overlay = z11.object({
14992
+ text: z11.string().optional(),
14993
+ appears_at_s: z11.number().optional(),
14994
+ duration_s: z11.number().optional(),
14995
+ position: z11.string().optional(),
14996
+ role: z11.string().optional(),
14997
+ animation: z11.string().optional(),
14998
+ animation_detail: z11.string().optional(),
13612
14999
  style: OverlayStyle.optional()
13613
15000
  }).loose();
13614
- var FloatingElement = z9.object({
13615
- kind: z9.string().optional(),
13616
- description: z9.string().optional(),
13617
- brand_name: z9.string().nullish(),
13618
- what_it_represents: z9.string().optional(),
13619
- appears_at_s: z9.number().optional(),
13620
- duration_s: z9.number().optional(),
13621
- position: z9.string().optional()
15001
+ var FloatingElement = z11.object({
15002
+ kind: z11.string().optional(),
15003
+ description: z11.string().optional(),
15004
+ brand_name: z11.string().nullish(),
15005
+ what_it_represents: z11.string().optional(),
15006
+ appears_at_s: z11.number().optional(),
15007
+ duration_s: z11.number().optional(),
15008
+ position: z11.string().optional()
13622
15009
  }).loose();
13623
15010
  function escapeHtml(s) {
13624
15011
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
@@ -13650,7 +15037,7 @@ function positionClass(position) {
13650
15037
  function collectCaptions(blueprint) {
13651
15038
  return blueprint.scenes.flatMap((scene) => {
13652
15039
  const sceneStart = scene.start_s ?? 0;
13653
- const overlays = z9.array(Overlay).safeParse(scene.overlays ?? []);
15040
+ const overlays = z11.array(Overlay).safeParse(scene.overlays ?? []);
13654
15041
  return overlays.success ? overlays.data.filter((ov) => Boolean(ov.text?.trim())).map((ov) => {
13655
15042
  const at = ov.appears_at_s ?? sceneStart;
13656
15043
  return { text: ov.text.trim(), at, end: at + (ov.duration_s ?? 2.5), ov };
@@ -13759,7 +15146,7 @@ function buildOverlayHtml(input) {
13759
15146
  if (ovParts.length > 0) blocks.push(ovParts.join("\n"));
13760
15147
  for (const scene of blueprint.scenes) {
13761
15148
  const sceneStart = scene.start_s ?? 0;
13762
- const floats = z9.array(FloatingElement).safeParse(scene.floating_elements ?? []);
15149
+ const floats = z11.array(FloatingElement).safeParse(scene.floating_elements ?? []);
13763
15150
  const parts = (floats.success ? floats.data.map((fe) => floatingStub(fe, sceneStart)) : []).filter(Boolean);
13764
15151
  const pip = uiPipStub(scene);
13765
15152
  if (pip) parts.push(pip);
@@ -14016,8 +15403,8 @@ function buildMotionBoard(blueprint) {
14016
15403
  const end_s = scene.end_s ?? start_s + sceneDurationS(scene);
14017
15404
  cursor = end_s;
14018
15405
  const spoken = sceneSpokenText(scene);
14019
- const overlays = z9.array(Overlay).safeParse(scene.overlays ?? []);
14020
- const floats = z9.array(FloatingElement).safeParse(scene.floating_elements ?? []);
15406
+ const overlays = z11.array(Overlay).safeParse(scene.overlays ?? []);
15407
+ const floats = z11.array(FloatingElement).safeParse(scene.floating_elements ?? []);
14021
15408
  const graphics = [
14022
15409
  ...(overlays.success ? overlays.data : []).filter((ov) => ov.text?.trim()).map((ov) => ({
14023
15410
  kind: "text",
@@ -14458,7 +15845,7 @@ async function runAnalysisPasses(deconstructCanvas, selectModel) {
14458
15845
  return fail2("deconstruct", e instanceof Error ? e.message : String(e));
14459
15846
  }
14460
15847
  }
14461
- var scaffoldVideoCommand = defineCommand85({
15848
+ var scaffoldVideoCommand = defineCommand87({
14462
15849
  meta: {
14463
15850
  name: "scaffold-video",
14464
15851
  description: "Turn a reference video into a runnable reproduction canvas in one command. Runs billed passes \u2014 video_deconstruct (the full scene-by-scene blueprint + transcript, baked to prompt.json as the editable 'prompt') and an AI selection of the video's RECURRING identity elements (person/animal/product/logo) \u2014 then scaffolds a pipeline where every scene boundary is a static-ad-grade frame (the blueprint as target_blueprint, a reference legend, the real frame as anchor) and each recurring element gets ONE shared [TODO] ingest slot wired into every frame it appears in. The clips feed Seedance an ultra-detailed motion brief (action, camera, dialogue, transcript). Edit prompt.json, drop the real source images, then `baker canvas run`."
@@ -14603,7 +15990,7 @@ var scaffoldVideoCommand = defineCommand85({
14603
15990
  // src/commands/canvas/set-prompt.ts
14604
15991
  import { readFile as readFile7, writeFile as writeFile3 } from "fs/promises";
14605
15992
  import path9 from "path";
14606
- import { defineCommand as defineCommand86 } from "citty";
15993
+ import { defineCommand as defineCommand88 } from "citty";
14607
15994
  function setNodePrompt(canvas, nodeId, text) {
14608
15995
  const nodes = canvas?.nodes;
14609
15996
  if (!Array.isArray(nodes)) throw new Error("canvas has no nodes array");
@@ -14618,7 +16005,7 @@ function setNodePrompt(canvas, nodeId, text) {
14618
16005
  newNodes[idx] = newNode;
14619
16006
  return { ...canvas, nodes: newNodes };
14620
16007
  }
14621
- var setPromptCommand = defineCommand86({
16008
+ var setPromptCommand = defineCommand88({
14622
16009
  meta: {
14623
16010
  name: "set-prompt",
14624
16011
  description: "Safely set a node's params.prompt (a frame description, motion prompt, etc.) without hand-editing the JSON. Prefer --text-file for multi-line/accented copy \u2014 it preserves UTF-8 exactly, unlike shell-quoted jq."
@@ -14678,8 +16065,8 @@ var setPromptCommand = defineCommand86({
14678
16065
  // src/commands/canvas/validate.ts
14679
16066
  import { readFile as readFile8 } from "fs/promises";
14680
16067
  import path10 from "path";
14681
- import { defineCommand as defineCommand87 } from "citty";
14682
- var validateCommand = defineCommand87({
16068
+ import { defineCommand as defineCommand89 } from "citty";
16069
+ var validateCommand = defineCommand89({
14683
16070
  meta: {
14684
16071
  name: "validate",
14685
16072
  description: "Validate a canvas JSON file (no execution). Includes a per-node cost preview and runs each node's deep validators (composition meta checks for hyperframe_render/_snapshot)."
@@ -14722,7 +16109,7 @@ var validateCommand = defineCommand87({
14722
16109
  });
14723
16110
 
14724
16111
  // src/commands/canvas/index.ts
14725
- var canvasCommand = defineCommand88({
16112
+ var canvasCommand = defineCommand90({
14726
16113
  meta: {
14727
16114
  name: "canvas",
14728
16115
  description: `Run Baker creative canvas JSON files locally. Local nodes execute in-process; remote nodes POST to the Convex backend gateway.
@@ -14749,10 +16136,10 @@ Subcommands:
14749
16136
  });
14750
16137
 
14751
16138
  // src/commands/creatives/index.ts
14752
- import { defineCommand as defineCommand90 } from "citty";
16139
+ import { defineCommand as defineCommand92 } from "citty";
14753
16140
 
14754
16141
  // src/commands/creatives/publish.ts
14755
- import { defineCommand as defineCommand89 } from "citty";
16142
+ import { defineCommand as defineCommand91 } from "citty";
14756
16143
 
14757
16144
  // src/commands/images/api.ts
14758
16145
  import { readFile as readFile9 } from "fs/promises";
@@ -14875,7 +16262,7 @@ async function publishCreative(args, deps = defaultImageApiDeps) {
14875
16262
  sourceReferenceUrl
14876
16263
  });
14877
16264
  }
14878
- var publishCommand = defineCommand89({
16265
+ var publishCommand = defineCommand91({
14879
16266
  meta: {
14880
16267
  name: "publish",
14881
16268
  description: "Publish a final static creative image to Baker Creatives and print the creative reference JSON."
@@ -14921,7 +16308,7 @@ var publishCommand = defineCommand89({
14921
16308
  });
14922
16309
 
14923
16310
  // src/commands/creatives/index.ts
14924
- var creativesCommand3 = defineCommand90({
16311
+ var creativesCommand3 = defineCommand92({
14925
16312
  meta: {
14926
16313
  name: "creatives",
14927
16314
  description: `Publish static ad creatives as first-class Baker outputs.
@@ -14937,10 +16324,10 @@ Publishing uploads the image to the Company image library, applies the official
14937
16324
  });
14938
16325
 
14939
16326
  // src/commands/ga4/index.ts
14940
- import { defineCommand as defineCommand94 } from "citty";
16327
+ import { defineCommand as defineCommand96 } from "citty";
14941
16328
 
14942
16329
  // src/commands/ga4/audit.ts
14943
- import { defineCommand as defineCommand91 } from "citty";
16330
+ import { defineCommand as defineCommand93 } from "citty";
14944
16331
 
14945
16332
  // src/commands/ga4/resolve.ts
14946
16333
  async function fetchProperties(useCache = true) {
@@ -15003,7 +16390,7 @@ registerSchema({
15003
16390
  "no-cache": { type: "boolean", description: "Skip cache, hit API directly", required: false }
15004
16391
  }
15005
16392
  });
15006
- var auditCommand2 = defineCommand91({
16393
+ var auditCommand2 = defineCommand93({
15007
16394
  meta: {
15008
16395
  name: "audit",
15009
16396
  description: `Run all GA4 admin health checks. Returns property config with playbook warnings.
@@ -15055,7 +16442,7 @@ Examples:
15055
16442
  });
15056
16443
 
15057
16444
  // src/commands/ga4/properties.ts
15058
- import { defineCommand as defineCommand92 } from "citty";
16445
+ import { defineCommand as defineCommand94 } from "citty";
15059
16446
  registerSchema({
15060
16447
  command: "ga4.properties",
15061
16448
  description: "List all accessible GA4 properties. Returns property IDs needed for query and audit commands. Run this first to find property IDs.",
@@ -15063,7 +16450,7 @@ registerSchema({
15063
16450
  "no-cache": { type: "boolean", description: "Skip cache, hit API directly", required: false }
15064
16451
  }
15065
16452
  });
15066
- var propertiesCommand = defineCommand92({
16453
+ var propertiesCommand = defineCommand94({
15067
16454
  meta: {
15068
16455
  name: "properties",
15069
16456
  description: `List accessible GA4 properties.
@@ -15111,9 +16498,9 @@ Examples:
15111
16498
  });
15112
16499
 
15113
16500
  // src/commands/ga4/query.ts
15114
- import { appendFileSync as appendFileSync2, existsSync as existsSync5, readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "fs";
16501
+ import { appendFileSync as appendFileSync2, existsSync as existsSync5, readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "fs";
15115
16502
  import { resolve as resolve2 } from "path";
15116
- import { defineCommand as defineCommand93 } from "citty";
16503
+ import { defineCommand as defineCommand95 } from "citty";
15117
16504
 
15118
16505
  // src/commands/ga4/presets.ts
15119
16506
  var GA4_PRESETS = [
@@ -15202,7 +16589,7 @@ function writeRowsToFile2(filePath, rows, append) {
15202
16589
  writeFileSync4(filePath, content, "utf-8");
15203
16590
  }
15204
16591
  } else if (append && existsSync5(filePath)) {
15205
- const existing = JSON.parse(readFileSync8(filePath, "utf-8"));
16592
+ const existing = JSON.parse(readFileSync9(filePath, "utf-8"));
15206
16593
  writeFileSync4(filePath, JSON.stringify([...existing, ...rows], null, 2), "utf-8");
15207
16594
  } else {
15208
16595
  writeFileSync4(filePath, JSON.stringify(rows, null, 2), "utf-8");
@@ -15245,7 +16632,7 @@ function handleError(err) {
15245
16632
  });
15246
16633
  process.exit(1);
15247
16634
  }
15248
- var queryCommand2 = defineCommand93({
16635
+ var queryCommand2 = defineCommand95({
15249
16636
  meta: {
15250
16637
  name: "query",
15251
16638
  description: `Run GA4 Data API reports. Preset-first with free-form escape hatch.
@@ -15316,7 +16703,7 @@ Free-form (escape hatch):
15316
16703
  });
15317
16704
 
15318
16705
  // src/commands/ga4/index.ts
15319
- var ga4Command = defineCommand94({
16706
+ var ga4Command = defineCommand96({
15320
16707
  meta: {
15321
16708
  name: "ga4",
15322
16709
  description: `Google Analytics 4 commands. Audit property config, run playbook-aligned reports.
@@ -15339,12 +16726,12 @@ Examples:
15339
16726
  });
15340
16727
 
15341
16728
  // src/commands/gsc/index.ts
15342
- import { defineCommand as defineCommand98 } from "citty";
16729
+ import { defineCommand as defineCommand100 } from "citty";
15343
16730
 
15344
16731
  // src/commands/gsc/query.ts
15345
- import { appendFileSync as appendFileSync3, existsSync as existsSync6, readFileSync as readFileSync9, writeFileSync as writeFileSync5 } from "fs";
16732
+ import { appendFileSync as appendFileSync3, existsSync as existsSync6, readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "fs";
15346
16733
  import { resolve as resolve3 } from "path";
15347
- import { defineCommand as defineCommand95 } from "citty";
16734
+ import { defineCommand as defineCommand97 } from "citty";
15348
16735
 
15349
16736
  // src/commands/gsc/presets.ts
15350
16737
  var GSC_PRESETS = [
@@ -15487,7 +16874,7 @@ function writeRowsToFile3(filePath, rows, append) {
15487
16874
  writeFileSync5(filePath, content, "utf-8");
15488
16875
  }
15489
16876
  } else if (append && existsSync6(filePath)) {
15490
- const existing = JSON.parse(readFileSync9(filePath, "utf-8"));
16877
+ const existing = JSON.parse(readFileSync10(filePath, "utf-8"));
15491
16878
  writeFileSync5(filePath, JSON.stringify([...existing, ...rows], null, 2), "utf-8");
15492
16879
  } else {
15493
16880
  writeFileSync5(filePath, JSON.stringify(rows, null, 2), "utf-8");
@@ -15532,7 +16919,7 @@ function handleError2(err) {
15532
16919
  });
15533
16920
  process.exit(1);
15534
16921
  }
15535
- var queryCommand3 = defineCommand95({
16922
+ var queryCommand3 = defineCommand97({
15536
16923
  meta: {
15537
16924
  name: "query",
15538
16925
  description: `Run GSC Search Analytics queries. Preset-first with free-form escape hatch.
@@ -15610,7 +16997,7 @@ Free-form (escape hatch):
15610
16997
  });
15611
16998
 
15612
16999
  // src/commands/gsc/sitemaps.ts
15613
- import { defineCommand as defineCommand96 } from "citty";
17000
+ import { defineCommand as defineCommand98 } from "citty";
15614
17001
  registerSchema({
15615
17002
  command: "gsc.sitemaps",
15616
17003
  description: "List sitemaps for a Search Console site. Check sitemap health and errors.",
@@ -15619,7 +17006,7 @@ registerSchema({
15619
17006
  "no-cache": { type: "boolean", description: "Skip cache, hit API directly", required: false }
15620
17007
  }
15621
17008
  });
15622
- var sitemapsCommand = defineCommand96({
17009
+ var sitemapsCommand = defineCommand98({
15623
17010
  meta: {
15624
17011
  name: "sitemaps",
15625
17012
  description: `List sitemaps for a site. Check health and errors.
@@ -15669,7 +17056,7 @@ Examples:
15669
17056
  });
15670
17057
 
15671
17058
  // src/commands/gsc/sites.ts
15672
- import { defineCommand as defineCommand97 } from "citty";
17059
+ import { defineCommand as defineCommand99 } from "citty";
15673
17060
  registerSchema({
15674
17061
  command: "gsc.sites",
15675
17062
  description: "List all verified Google Search Console sites. Returns site URLs needed for query and sitemaps commands.",
@@ -15677,7 +17064,7 @@ registerSchema({
15677
17064
  "no-cache": { type: "boolean", description: "Skip cache, hit API directly", required: false }
15678
17065
  }
15679
17066
  });
15680
- var sitesCommand = defineCommand97({
17067
+ var sitesCommand = defineCommand99({
15681
17068
  meta: {
15682
17069
  name: "sites",
15683
17070
  description: `List verified Search Console sites.
@@ -15725,7 +17112,7 @@ Examples:
15725
17112
  });
15726
17113
 
15727
17114
  // src/commands/gsc/index.ts
15728
- var gscCommand = defineCommand98({
17115
+ var gscCommand = defineCommand100({
15729
17116
  meta: {
15730
17117
  name: "gsc",
15731
17118
  description: `Google Search Console commands. PPC-SEO arbitrage, brand halo analysis, negative keyword discovery.
@@ -15748,10 +17135,10 @@ Examples:
15748
17135
  });
15749
17136
 
15750
17137
  // src/commands/images/index.ts
15751
- import { defineCommand as defineCommand122 } from "citty";
17138
+ import { defineCommand as defineCommand124 } from "citty";
15752
17139
 
15753
17140
  // src/commands/images/crop.ts
15754
- import { defineCommand as defineCommand99 } from "citty";
17141
+ import { defineCommand as defineCommand101 } from "citty";
15755
17142
 
15756
17143
  // src/lib/image/crop-sprite.ts
15757
17144
  import sharp from "sharp";
@@ -15876,7 +17263,7 @@ function emitError2(err) {
15876
17263
  }
15877
17264
  process.exit(1);
15878
17265
  }
15879
- var cropCommand = defineCommand99({
17266
+ var cropCommand = defineCommand101({
15880
17267
  meta: {
15881
17268
  name: "crop",
15882
17269
  description: "Crop a rectangular region from an image.\n\nExample: baker images crop sprite.png --x 0 --y 0 --width 64 --height 64 --output icon.png"
@@ -15912,7 +17299,7 @@ var cropCommand = defineCommand99({
15912
17299
  });
15913
17300
 
15914
17301
  // src/commands/images/delete.ts
15915
- import { defineCommand as defineCommand100 } from "citty";
17302
+ import { defineCommand as defineCommand102 } from "citty";
15916
17303
  registerSchema({
15917
17304
  command: "images.delete",
15918
17305
  description: "Delete an image by ID",
@@ -15926,7 +17313,7 @@ registerSchema({
15926
17313
  }
15927
17314
  }
15928
17315
  });
15929
- var deleteCommand = defineCommand100({
17316
+ var deleteCommand = defineCommand102({
15930
17317
  meta: {
15931
17318
  name: "delete",
15932
17319
  description: "Delete an image by ID. Use --dry-run to preview. Example: baker images delete j571abc123 --dry-run"
@@ -15967,7 +17354,7 @@ var deleteCommand = defineCommand100({
15967
17354
  });
15968
17355
 
15969
17356
  // src/commands/images/dimensions.ts
15970
- import { defineCommand as defineCommand101 } from "citty";
17357
+ import { defineCommand as defineCommand103 } from "citty";
15971
17358
 
15972
17359
  // src/lib/image/dimensions.ts
15973
17360
  import { imageSize } from "image-size";
@@ -15990,7 +17377,7 @@ registerSchema({
15990
17377
  target: { type: "string", description: "Local file path or remote http(s) URL", required: true }
15991
17378
  }
15992
17379
  });
15993
- var dimensionsCommand = defineCommand101({
17380
+ var dimensionsCommand = defineCommand103({
15994
17381
  meta: {
15995
17382
  name: "dimensions",
15996
17383
  description: "Read image dimensions without decoding the full file.\n\nExample: baker images dimensions ./logo.png\nExample: baker images dimensions https://acme.com/hero.png"
@@ -16034,7 +17421,7 @@ var dimensionsCommand = defineCommand101({
16034
17421
  });
16035
17422
 
16036
17423
  // src/commands/images/extract.ts
16037
- import { defineCommand as defineCommand102 } from "citty";
17424
+ import { defineCommand as defineCommand104 } from "citty";
16038
17425
  registerSchema({
16039
17426
  command: "images.extract",
16040
17427
  description: "Extract images from a URL via Firecrawl (formats: images).",
@@ -16050,7 +17437,7 @@ registerSchema({
16050
17437
  }
16051
17438
  }
16052
17439
  });
16053
- var extractCommand = defineCommand102({
17440
+ var extractCommand = defineCommand104({
16054
17441
  meta: {
16055
17442
  name: "extract",
16056
17443
  description: "Pull every image from a single URL via Firecrawl. ~$0.001/scrape. Cap auto-ingest at 20.\n\nExample: baker images extract https://stripe.com --auto-ingest 5"
@@ -16088,7 +17475,7 @@ var extractCommand = defineCommand102({
16088
17475
  });
16089
17476
 
16090
17477
  // src/commands/images/find.ts
16091
- import { defineCommand as defineCommand103 } from "citty";
17478
+ import { defineCommand as defineCommand105 } from "citty";
16092
17479
  registerSchema({
16093
17480
  command: "images.find",
16094
17481
  description: "Fanout image search: library first, then opted-in external providers.",
@@ -16120,7 +17507,7 @@ registerSchema({
16120
17507
  }
16121
17508
  }
16122
17509
  });
16123
- var findCommand = defineCommand103({
17510
+ var findCommand = defineCommand105({
16124
17511
  meta: {
16125
17512
  name: "find",
16126
17513
  description: "Library-first fanout image search. Opt in to providers with --sources. `--fallback` short-circuits to externals only when library is thin. With --auto-ingest, ingested external hits return Baker-owned URLs.\n\nExample: baker images find 'office' --sources library,magnific --limit 20"
@@ -16169,7 +17556,7 @@ var findCommand = defineCommand103({
16169
17556
 
16170
17557
  // src/commands/images/generate.ts
16171
17558
  import { readFile as readFile11 } from "fs/promises";
16172
- import { defineCommand as defineCommand104 } from "citty";
17559
+ import { defineCommand as defineCommand106 } from "citty";
16173
17560
  import sharp2 from "sharp";
16174
17561
  var GENERATE_TIMEOUT_MS = 18e4;
16175
17562
  var REFERENCE_MAX_EDGE = 1536;
@@ -16272,7 +17659,7 @@ async function resolveReferences(spec) {
16272
17659
  }
16273
17660
  return out;
16274
17661
  }
16275
- var generateCommand = defineCommand104({
17662
+ var generateCommand = defineCommand106({
16276
17663
  meta: {
16277
17664
  name: "generate",
16278
17665
  description: "Generate an image with AI and store it in the library (cost-tracked per request via OpenRouter usage). Models mirror the canvas: openai/gpt-5.4-image-2 (default \u2014 photoreal, cleanest text, best for ad/landing reproduction), google/gemini-3-pro-image-preview (Nano Banana Pro), google/gemini-3.5-flash & google/gemini-3.1-flash-image-preview (fast, extreme aspect ratios), recraft/recraft-v4.1-pro-vector (vector/SVG-style with palette control). The result is auto-ingested (describe + embed), so the next `baker images library` query finds it. Pass --reference with image URLs and/or local file paths (Pinterest, stock, brand assets, sandbox files) to ground generation in reality.\n\nExamples:\n baker images generate 'a friendly golden retriever sitting in a bright modern living room' --aspect-ratio 16:9\n baker images generate 'hero shot of a matte black water bottle on marble' --model google/gemini-3-pro-image-preview --image-size 2K\n baker images generate 'lifestyle photo matching this mood' --reference 'https://\u2026/ref1.jpg,https://\u2026/ref2.jpg'\n baker images generate 'put this product on a marble countertop, soft daylight' --reference './src/brand/logos/product.png,./refs/kitchen-mood.jpg'\n baker images generate 'flat geometric mascot, brand palette' --model recraft/recraft-v4.1-pro-vector --rgb-colors '[[10,10,10],[255,80,0]]'"
@@ -16324,7 +17711,7 @@ var generateCommand = defineCommand104({
16324
17711
  });
16325
17712
 
16326
17713
  // src/commands/images/get.ts
16327
- import { defineCommand as defineCommand105 } from "citty";
17714
+ import { defineCommand as defineCommand107 } from "citty";
16328
17715
  registerSchema({
16329
17716
  command: "images.get",
16330
17717
  description: "Get a single image by ID",
@@ -16332,7 +17719,7 @@ registerSchema({
16332
17719
  id: { type: "string", description: "Image ID", required: true }
16333
17720
  }
16334
17721
  });
16335
- var getCommand2 = defineCommand105({
17722
+ var getCommand2 = defineCommand107({
16336
17723
  meta: { name: "get", description: "Get a single image by ID. Example: baker images get j571abc123" },
16337
17724
  args: {
16338
17725
  id: { type: "positional", description: "Image ID", required: false },
@@ -16368,7 +17755,7 @@ var getCommand2 = defineCommand105({
16368
17755
  });
16369
17756
 
16370
17757
  // src/commands/images/gif.ts
16371
- import { defineCommand as defineCommand106 } from "citty";
17758
+ import { defineCommand as defineCommand108 } from "citty";
16372
17759
  registerSchema({
16373
17760
  command: "images.gif",
16374
17761
  description: "Search Giphy for GIFs / reaction memes (paid social creative).",
@@ -16400,7 +17787,7 @@ registerSchema({
16400
17787
  }
16401
17788
  }
16402
17789
  });
16403
- var gifCommand = defineCommand106({
17790
+ var gifCommand = defineCommand108({
16404
17791
  meta: {
16405
17792
  name: "gif",
16406
17793
  description: "Search Giphy for GIFs / reaction memes \u2014 built for paid-social creative (Meta, TikTok, LinkedIn, X). Free API. Each hit carries WebP + GIF + MP4 URLs in providerMeta so you can pick the right format per platform.\n\nExample: baker images gif 'this is fine' --limit 10\nExample: baker images gif 'office reaction' --rating pg --auto-ingest 2\nExample: baker images gif --trending --limit 25"
@@ -16447,7 +17834,7 @@ var gifCommand = defineCommand106({
16447
17834
  });
16448
17835
 
16449
17836
  // src/commands/images/google.ts
16450
- import { defineCommand as defineCommand107 } from "citty";
17837
+ import { defineCommand as defineCommand109 } from "citty";
16451
17838
  registerSchema({
16452
17839
  command: "images.google",
16453
17840
  description: "Google Images search via the official Custom Search JSON API. Unverified source \u2014 inspect before placing.",
@@ -16483,7 +17870,7 @@ registerSchema({
16483
17870
  }
16484
17871
  }
16485
17872
  });
16486
- var googleCommand2 = defineCommand107({
17873
+ var googleCommand2 = defineCommand109({
16487
17874
  meta: {
16488
17875
  name: "google",
16489
17876
  description: "Google Images via the official Custom Search JSON API ($0.005/query, free 100/day). \u26A0 Source unverified \u2014 watermarks, low-res, mislabeled results are common. Use as last resort. With --auto-ingest, ingested hits return Baker-owned URLs.\n\nExample: baker images google 'industrial workshop' --type photo --size large --limit 20"
@@ -16531,7 +17918,7 @@ var googleCommand2 = defineCommand107({
16531
17918
  });
16532
17919
 
16533
17920
  // src/commands/images/icon.ts
16534
- import { defineCommand as defineCommand108 } from "citty";
17921
+ import { defineCommand as defineCommand110 } from "citty";
16535
17922
  registerSchema({
16536
17923
  command: "images.icon",
16537
17924
  description: "Icon lookup via Iconify (200+ icon sets, free CDN).",
@@ -16557,7 +17944,7 @@ registerSchema({
16557
17944
  }
16558
17945
  }
16559
17946
  });
16560
- var iconCommand = defineCommand108({
17947
+ var iconCommand = defineCommand110({
16561
17948
  meta: {
16562
17949
  name: "icon",
16563
17950
  description: "Icon via Iconify (simple-icons, logos, lucide, devicon, heroicons, tabler, phosphor, material-symbols, \u2026). Free CDN, no API key.\n\nExample: baker images icon react --set devicon\nExample: baker images icon lucide:check --color '#0a0a0a'"
@@ -16597,7 +17984,7 @@ var iconCommand = defineCommand108({
16597
17984
  });
16598
17985
 
16599
17986
  // src/commands/images/ingest.ts
16600
- import { defineCommand as defineCommand109 } from "citty";
17987
+ import { defineCommand as defineCommand111 } from "citty";
16601
17988
  registerSchema({
16602
17989
  command: "images.ingest",
16603
17990
  description: "Ingest a remote image URL into the library (full describe + embed).",
@@ -16609,7 +17996,7 @@ registerSchema({
16609
17996
  context: { type: "string", description: "Description context hint", required: false }
16610
17997
  }
16611
17998
  });
16612
- var ingestCommand = defineCommand109({
17999
+ var ingestCommand = defineCommand111({
16613
18000
  meta: {
16614
18001
  name: "ingest",
16615
18002
  description: "Download a remote URL and store it in the library. Hash-deduped on bytes + externalId.\n\nExample: baker images ingest https://img.freepik.com/free-photo/xyz.jpg --source magnific --external-id 12345"
@@ -16651,7 +18038,7 @@ var ingestCommand = defineCommand109({
16651
18038
  });
16652
18039
 
16653
18040
  // src/commands/images/library.ts
16654
- import { defineCommand as defineCommand110 } from "citty";
18041
+ import { defineCommand as defineCommand112 } from "citty";
16655
18042
  registerSchema({
16656
18043
  command: "images.library",
16657
18044
  description: "Search the company image library. Returns only ready images.",
@@ -16677,7 +18064,7 @@ registerSchema({
16677
18064
  }
16678
18065
  }
16679
18066
  });
16680
- var libraryCommand = defineCommand110({
18067
+ var libraryCommand = defineCommand112({
16681
18068
  meta: {
16682
18069
  name: "library",
16683
18070
  description: "Search the company image library (hybrid BM25 + vector + Cohere rerank). Use this BEFORE any external provider.\n\nExample: baker images library 'hero banner' --aspect-ratio 16:9 --source magnific"
@@ -16734,7 +18121,7 @@ var libraryCommand = defineCommand110({
16734
18121
  });
16735
18122
 
16736
18123
  // src/commands/images/logo.ts
16737
- import { defineCommand as defineCommand111 } from "citty";
18124
+ import { defineCommand as defineCommand113 } from "citty";
16738
18125
  registerSchema({
16739
18126
  command: "images.logo",
16740
18127
  description: "Brand logo lookup via Brandfetch CDN (fallback/404). Auto-ingests by default.",
@@ -16759,7 +18146,7 @@ registerSchema({
16759
18146
  }
16760
18147
  }
16761
18148
  });
16762
- var logoCommand = defineCommand111({
18149
+ var logoCommand = defineCommand113({
16763
18150
  meta: {
16764
18151
  name: "logo",
16765
18152
  description: "Brand logo via Brandfetch CDN. Returns up to 5 variants (icon, light/dark logo, light/dark symbol). Auto-ingests the first variant.\n\nExample: baker images logo stripe.com --variant logo"
@@ -16797,7 +18184,7 @@ var logoCommand = defineCommand111({
16797
18184
  });
16798
18185
 
16799
18186
  // src/commands/images/normalize.ts
16800
- import { defineCommand as defineCommand112 } from "citty";
18187
+ import { defineCommand as defineCommand114 } from "citty";
16801
18188
 
16802
18189
  // src/lib/image/color-changer.ts
16803
18190
  import quantize from "quantize";
@@ -17529,7 +18916,7 @@ function coerceRawArgs(args) {
17529
18916
  "dry-run": bool(args["dry-run"])
17530
18917
  };
17531
18918
  }
17532
- var normalizeCommand = defineCommand112({
18919
+ var normalizeCommand = defineCommand114({
17533
18920
  meta: {
17534
18921
  name: "normalize",
17535
18922
  description: `Normalize logos / images: declarative recolor + bg removal + trim + resize. Operates on local files; writes in-place by default.
@@ -17584,7 +18971,7 @@ Examples:
17584
18971
  });
17585
18972
 
17586
18973
  // src/commands/images/pinterest.ts
17587
- import { defineCommand as defineCommand113 } from "citty";
18974
+ import { defineCommand as defineCommand115 } from "citty";
17588
18975
  registerSchema({
17589
18976
  command: "images.pinterest",
17590
18977
  description: "Pinterest image search via ScrapeCreators. Reference-grade real-world photography, product styling, interiors, fashion, food, and aesthetic mood boards. Inspect before placing \u2014 Pinterest is unverified, trademark-bearing web content.",
@@ -17604,7 +18991,7 @@ registerSchema({
17604
18991
  }
17605
18992
  }
17606
18993
  });
17607
- var pinterestCommand = defineCommand113({
18994
+ var pinterestCommand = defineCommand115({
17608
18995
  meta: {
17609
18996
  name: "pinterest",
17610
18997
  description: "Pinterest image search via ScrapeCreators ($0.00188/request). Best for photo-realistic reference imagery \u2014 lifestyle, interiors, fashion, food, product styling, and mood boards to brief AI generation against. \u26A0 Unverified, trademark-bearing web content \u2014 inspect and respect rights before placing on a customer page. Browse first; auto-ingest only the pins you commit to.\n\nExamples:\n baker images pinterest 'scandinavian living room'\n baker images pinterest 'minimalist skincare product photography' --limit 20\n baker images pinterest 'cozy coffee shop interior' --auto-ingest 2 --context 'Mood reference for hero photography'"
@@ -17644,7 +19031,7 @@ var pinterestCommand = defineCommand113({
17644
19031
  });
17645
19032
 
17646
19033
  // src/commands/images/screenshot.ts
17647
- import { defineCommand as defineCommand114 } from "citty";
19034
+ import { defineCommand as defineCommand116 } from "citty";
17648
19035
  registerSchema({
17649
19036
  command: "images.screenshot",
17650
19037
  description: "Capture a website screenshot via ScreenshotOne. Auto-ingests on success.",
@@ -17660,7 +19047,7 @@ registerSchema({
17660
19047
  }
17661
19048
  }
17662
19049
  });
17663
- var screenshotCommand = defineCommand114({
19050
+ var screenshotCommand = defineCommand116({
17664
19051
  meta: {
17665
19052
  name: "screenshot",
17666
19053
  description: "Screenshot a URL via ScreenshotOne. $0.009/capture. Auto-ingests to library.\n\nExample: baker images screenshot https://stripe.com --full-page"
@@ -17710,7 +19097,7 @@ var screenshotCommand = defineCommand114({
17710
19097
  });
17711
19098
 
17712
19099
  // src/commands/images/search.ts
17713
- import { defineCommand as defineCommand115 } from "citty";
19100
+ import { defineCommand as defineCommand117 } from "citty";
17714
19101
  registerSchema({
17715
19102
  command: "images.search",
17716
19103
  description: "Search images by text query. Only returns ready images.",
@@ -17726,7 +19113,7 @@ registerSchema({
17726
19113
  tags: { type: "string", description: "Comma-separated tags to filter by", required: false }
17727
19114
  }
17728
19115
  });
17729
- var searchCommand = defineCommand115({
19116
+ var searchCommand = defineCommand117({
17730
19117
  meta: {
17731
19118
  name: "search",
17732
19119
  description: "Semantic search images by text query. Uses hybrid BM25 + vector + reranking. Example: baker images search 'hero banner' --aspect-ratio 16:9 --tags logo"
@@ -17786,7 +19173,7 @@ var searchCommand = defineCommand115({
17786
19173
  });
17787
19174
 
17788
19175
  // src/commands/images/sticker.ts
17789
- import { defineCommand as defineCommand116 } from "citty";
19176
+ import { defineCommand as defineCommand118 } from "citty";
17790
19177
  registerSchema({
17791
19178
  command: "images.sticker",
17792
19179
  description: "Search Giphy stickers \u2014 transparent-background overlays for ad creative.",
@@ -17818,7 +19205,7 @@ registerSchema({
17818
19205
  }
17819
19206
  }
17820
19207
  });
17821
- var stickerCommand = defineCommand116({
19208
+ var stickerCommand = defineCommand118({
17822
19209
  meta: {
17823
19210
  name: "sticker",
17824
19211
  description: "Search Giphy's sticker corpus \u2014 transparent-background WebPs / GIFs ideal for overlaying on ad creative (Meta, TikTok, Stories). Same Giphy free API as `baker images gif`; results carry WebP + GIF + MP4 URLs in providerMeta.\n\nExample: baker images sticker 'thumbs up' --limit 10\nExample: baker images sticker celebration --rating g --auto-ingest 3\nExample: baker images sticker --trending --limit 25"
@@ -17865,7 +19252,7 @@ var stickerCommand = defineCommand116({
17865
19252
  });
17866
19253
 
17867
19254
  // src/commands/images/stock.ts
17868
- import { defineCommand as defineCommand117 } from "citty";
19255
+ import { defineCommand as defineCommand119 } from "citty";
17869
19256
  registerSchema({
17870
19257
  command: "images.stock",
17871
19258
  description: "Stock photo, vector illustration, icon-set, and PSD search via Magnific (Freepik's developer API).",
@@ -17923,7 +19310,7 @@ registerSchema({
17923
19310
  }
17924
19311
  }
17925
19312
  });
17926
- var stockCommand = defineCommand117({
19313
+ var stockCommand = defineCommand119({
17927
19314
  meta: {
17928
19315
  name: "stock",
17929
19316
  description: "Stock search via Magnific \u2014 Freepik's developer API (~250M assets: photos, vectors, illustrations, icons, PSDs). $0.002/req. With --auto-ingest, ingested hits return Baker-owned URLs.\n\nExamples:\n baker images stock 'minimalist office'\n baker images stock 'flat office workers' --type vector\n baker images stock 'hero photo of a kitchen' --type photo --orientation landscape --ai exclude\n baker images stock 'brand pattern' --color '#0a0a0a' --license freemium --auto-ingest 2"
@@ -17979,7 +19366,7 @@ var stockCommand = defineCommand117({
17979
19366
  });
17980
19367
 
17981
19368
  // src/lib/tags-command.ts
17982
- import { defineCommand as defineCommand118 } from "citty";
19369
+ import { defineCommand as defineCommand120 } from "citty";
17983
19370
  function makeTagsCommand(command, label, endpoint) {
17984
19371
  registerSchema({
17985
19372
  command: `${command}.tags`,
@@ -17988,7 +19375,7 @@ function makeTagsCommand(command, label, endpoint) {
17988
19375
  output: { type: "string", description: "Output format: md|json", required: false, default: "md" }
17989
19376
  }
17990
19377
  });
17991
- return defineCommand118({
19378
+ return defineCommand120({
17992
19379
  meta: {
17993
19380
  name: "tags",
17994
19381
  description: `List the available ${label} tag names (defaults + company custom tags). Use before filtering with --tags. Example: baker ${command} tags`
@@ -18024,7 +19411,7 @@ function makeTagsCommand(command, label, endpoint) {
18024
19411
  var tagsCommand2 = makeTagsCommand("images", "image", "/api/images/tags");
18025
19412
 
18026
19413
  // src/commands/images/upload.ts
18027
- import { defineCommand as defineCommand119 } from "citty";
19414
+ import { defineCommand as defineCommand121 } from "citty";
18028
19415
  registerSchema({
18029
19416
  command: "images.upload",
18030
19417
  description: "Upload an image to the library \u2014 local file path or remote http(s) URL.",
@@ -18062,7 +19449,7 @@ registerSchema({
18062
19449
  function isRemoteUrl2(value) {
18063
19450
  return /^https?:\/\//i.test(value);
18064
19451
  }
18065
- var uploadCommand = defineCommand119({
19452
+ var uploadCommand = defineCommand121({
18066
19453
  meta: {
18067
19454
  name: "upload",
18068
19455
  description: "Upload an image to the library \u2014 accepts a local file path OR a remote http(s) URL.\n\nLocal: reads bytes, sends to /api/images/upload, content-type auto-detected from extension.\nRemote: dispatches to /api/images/ingest with hash-dedup on bytes + externalId.\n\nExamples:\n baker images upload ./logo.png --source uploaded\n baker images upload ./cert.png --context 'ISO 27001 badge \u2014 enterprise tier'\n baker images upload https://acme.com/hero.png --source firecrawl --context 'Acme competitor pricing hero'"
@@ -18155,7 +19542,7 @@ async function uploadLocal(target, args) {
18155
19542
  }
18156
19543
 
18157
19544
  // src/commands/images/upscale.ts
18158
- import { defineCommand as defineCommand120 } from "citty";
19545
+ import { defineCommand as defineCommand122 } from "citty";
18159
19546
  registerSchema({
18160
19547
  command: "images.upscale",
18161
19548
  description: "Upscale a library image via the backend (Replicate, cost-tracked). Waits for completion by default. The image must be status 'ready' and raster (not SVG/AVIF).",
@@ -18170,7 +19557,7 @@ registerSchema({
18170
19557
  }
18171
19558
  });
18172
19559
  var POLL_INTERVAL_MS3 = 1500;
18173
- var upscaleCommand = defineCommand120({
19560
+ var upscaleCommand = defineCommand122({
18174
19561
  meta: {
18175
19562
  name: "upscale",
18176
19563
  description: "Upscale a library image via the Convex backend (Replicate, cost-tracked at $0.05/image). Waits for completion by default.\n\nExample: baker images upscale j571abc123def\nExample: baker images upscale j571abc123def --max-wait 0 # fire-and-forget"
@@ -18225,7 +19612,7 @@ var upscaleCommand = defineCommand120({
18225
19612
  });
18226
19613
 
18227
19614
  // src/commands/images/use.ts
18228
- import { defineCommand as defineCommand121 } from "citty";
19615
+ import { defineCommand as defineCommand123 } from "citty";
18229
19616
  registerSchema({
18230
19617
  command: "images.use",
18231
19618
  description: "Ingest a URL and wait for the library record to be ready.",
@@ -18241,7 +19628,7 @@ registerSchema({
18241
19628
  }
18242
19629
  });
18243
19630
  var POLL_INTERVAL_MS4 = 1500;
18244
- var useCommand = defineCommand121({
19631
+ var useCommand = defineCommand123({
18245
19632
  meta: {
18246
19633
  name: "use",
18247
19634
  description: "Sugar over `ingest`: download \u2192 store \u2192 wait until describe + embed complete \u2192 return ready library record.\n\nExample: baker images use https://cdn.example.com/hero.png --source uploaded"
@@ -18287,7 +19674,7 @@ var useCommand = defineCommand121({
18287
19674
  });
18288
19675
 
18289
19676
  // src/commands/images/index.ts
18290
- var imagesCommand = defineCommand122({
19677
+ var imagesCommand = defineCommand124({
18291
19678
  meta: {
18292
19679
  name: "images",
18293
19680
  description: `Find, source, and normalize images. Subcommands route by provider so cost + license are explicit.
@@ -18356,11 +19743,162 @@ Paid transforms (run on the Convex backend, cost-tracked):
18356
19743
  }
18357
19744
  });
18358
19745
 
19746
+ // src/commands/mcp/index.ts
19747
+ import { defineCommand as defineCommand125 } from "citty";
19748
+ var SCOPES = ["user", "company", "org"];
19749
+ function parseScope(raw) {
19750
+ const scope = raw === void 0 ? "company" : String(raw);
19751
+ if (!SCOPES.includes(scope)) {
19752
+ throw new ApiError("VALIDATION_ERROR", `Invalid --scope "${scope}". Use user | company | org.`);
19753
+ }
19754
+ return scope;
19755
+ }
19756
+ function actingUserId() {
19757
+ return getEnv().BAKER_ACTING_USER_ID;
19758
+ }
19759
+ function parseHeaders(raw) {
19760
+ const list = raw === void 0 ? [] : Array.isArray(raw) ? raw : [raw];
19761
+ const headers = {};
19762
+ for (const entry of list) {
19763
+ const text = String(entry);
19764
+ const sep = text.indexOf(":") >= 0 && (text.indexOf(":") < text.indexOf("=") || text.indexOf("=") < 0) ? ":" : "=";
19765
+ const at = text.indexOf(sep);
19766
+ if (at <= 0) {
19767
+ throw new ApiError("VALIDATION_ERROR", `Invalid header "${text}". Use "Key: Value".`);
19768
+ }
19769
+ headers[text.slice(0, at).trim()] = text.slice(at + 1).trim();
19770
+ }
19771
+ return Object.keys(headers).length > 0 ? headers : void 0;
19772
+ }
19773
+ function fail3(err) {
19774
+ if (err instanceof ApiError) {
19775
+ writeJson({ ok: false, error: { code: err.code, message: err.message } });
19776
+ process.exit(1);
19777
+ }
19778
+ writeJson({ ok: false, error: { code: "NETWORK_ERROR", message: "Unexpected error" } });
19779
+ process.exit(1);
19780
+ }
19781
+ registerSchema({
19782
+ command: "mcp.list",
19783
+ description: "List the custom MCP servers this company's chats see (org + company + your own user scope).",
19784
+ args: {}
19785
+ });
19786
+ var listCommand4 = defineCommand125({
19787
+ meta: { name: "list", description: "List custom MCP servers visible to this company's chats." },
19788
+ run: async () => {
19789
+ try {
19790
+ const user = actingUserId();
19791
+ const data = await apiGet(
19792
+ "/api/mcp/custom",
19793
+ user ? { actingUserId: user } : void 0
19794
+ );
19795
+ writeJson({ ok: true, data: data.servers });
19796
+ } catch (err) {
19797
+ fail3(err);
19798
+ }
19799
+ }
19800
+ });
19801
+ registerSchema({
19802
+ command: "mcp.add",
19803
+ description: "Register a custom MCP server. Tools appear as mcp__<name>__* on the next message. URL must be HTTPS. Scope: company (default, all chats) | org (org admin key) | user (only the current sender).",
19804
+ args: {
19805
+ name: { type: "string", description: "Server name \u2192 tools appear as mcp__<name>__*", required: true },
19806
+ url: { type: "string", description: "HTTPS MCP endpoint", required: true },
19807
+ scope: { type: "string", description: "user | company | org (default company)", required: false },
19808
+ header: { type: "string", description: 'Auth header "Key: Value" (repeatable)', required: false }
19809
+ }
19810
+ });
19811
+ var addCommand = defineCommand125({
19812
+ meta: {
19813
+ name: "add",
19814
+ description: `Register a custom MCP server. Tools appear as mcp__<name>__* on the NEXT message.
19815
+
19816
+ Scope: company (default \u2014 every chat in the company) | org (all companies in the org; needs an admin key) | user (only the current message sender).
19817
+
19818
+ Examples:
19819
+ baker mcp add --name weather --url https://mcp.example.com/mcp
19820
+ baker mcp add --name acme --url https://acme.dev/mcp --header "Authorization: Bearer sk-\u2026"
19821
+ baker mcp add --name mine --url https://my.dev/mcp --scope user`
19822
+ },
19823
+ args: {
19824
+ name: { type: "string", description: "Server name (mcp__<name>__*)", required: true },
19825
+ url: { type: "string", description: "HTTPS MCP endpoint", required: true },
19826
+ scope: { type: "string", description: "user | company | org (default company)", required: false },
19827
+ header: { type: "string", description: 'Auth header "Key: Value" (repeatable)', required: false }
19828
+ },
19829
+ run: async ({ args }) => {
19830
+ try {
19831
+ const scope = parseScope(args.scope);
19832
+ const user = actingUserId();
19833
+ const headers = parseHeaders(args.header);
19834
+ const data = await apiPost("/api/mcp/custom", {
19835
+ name: args.name,
19836
+ url: args.url,
19837
+ scope,
19838
+ ...user ? { actingUserId: user } : {},
19839
+ ...headers ? { headers } : {}
19840
+ });
19841
+ writeJson({ ok: true, data });
19842
+ } catch (err) {
19843
+ fail3(err);
19844
+ }
19845
+ }
19846
+ });
19847
+ registerSchema({
19848
+ command: "mcp.remove",
19849
+ description: "Remove a company custom MCP server by name.",
19850
+ args: { name: { type: "string", description: "Server name to remove", required: true } }
19851
+ });
19852
+ var removeCommand3 = defineCommand125({
19853
+ meta: {
19854
+ name: "remove",
19855
+ description: `Remove a company custom MCP server by name.
19856
+
19857
+ Example:
19858
+ baker mcp remove --name weather`
19859
+ },
19860
+ args: { name: { type: "string", description: "Server name to remove", required: true } },
19861
+ run: async ({ args }) => {
19862
+ try {
19863
+ const user = actingUserId();
19864
+ const data = await apiPost("/api/mcp/custom/remove", {
19865
+ name: args.name,
19866
+ ...user ? { actingUserId: user } : {}
19867
+ });
19868
+ writeJson({ ok: true, data });
19869
+ } catch (err) {
19870
+ fail3(err);
19871
+ }
19872
+ }
19873
+ });
19874
+ var mcpCommand = defineCommand125({
19875
+ meta: {
19876
+ name: "mcp",
19877
+ description: `Custom MCP servers for this company \u2014 point the agent at any HTTPS MCP endpoint.
19878
+
19879
+ Tools from a registered server appear as mcp__<name>__* on the next message.
19880
+ Managed here are **company-scoped** servers; user- and org-scoped servers are managed in the dashboard.
19881
+
19882
+ Start here:
19883
+ baker mcp list
19884
+
19885
+ Examples:
19886
+ baker mcp add --name weather --url https://mcp.example.com/mcp
19887
+ baker mcp add --name acme --url https://acme.dev/mcp --header "Authorization: Bearer sk-\u2026"
19888
+ baker mcp remove --name weather`
19889
+ },
19890
+ subCommands: {
19891
+ list: listCommand4,
19892
+ add: addCommand,
19893
+ remove: removeCommand3
19894
+ }
19895
+ });
19896
+
18359
19897
  // src/commands/research/index.ts
18360
- import { defineCommand as defineCommand133 } from "citty";
19898
+ import { defineCommand as defineCommand136 } from "citty";
18361
19899
 
18362
19900
  // src/commands/research/advertisers.ts
18363
- import { defineCommand as defineCommand123 } from "citty";
19901
+ import { defineCommand as defineCommand126 } from "citty";
18364
19902
 
18365
19903
  // src/commands/research/output.ts
18366
19904
  var RESEARCH_DATA_NOTE = "Estimates based on third-party SERP data \u2014 not exact figures. Use for directional insights, not precise measurement.";
@@ -18473,7 +20011,7 @@ var FIELDS3 = {
18473
20011
  etv: "Estimated traffic value (USD)",
18474
20012
  visibility: "SERP visibility score (0-1)"
18475
20013
  };
18476
- var advertisersCommand = defineCommand123({
20014
+ var advertisersCommand = defineCommand126({
18477
20015
  meta: {
18478
20016
  name: "advertisers",
18479
20017
  description: `Find domains competing for a keyword in Google SERPs.
@@ -18520,7 +20058,7 @@ Examples:
18520
20058
  });
18521
20059
 
18522
20060
  // src/commands/research/autocomplete.ts
18523
- import { defineCommand as defineCommand124 } from "citty";
20061
+ import { defineCommand as defineCommand127 } from "citty";
18524
20062
  registerSchema({
18525
20063
  command: "research.autocomplete",
18526
20064
  description: "Get Google Autocomplete suggestions for a seed keyword. Useful for keyword expansion and discovering what people actually search for. IMPORTANT: If --location and --language are omitted, defaults to United States (us) and English (en).",
@@ -18543,7 +20081,7 @@ registerSchema({
18543
20081
  var FIELDS4 = {
18544
20082
  suggestion: "Autocomplete suggestion from Google"
18545
20083
  };
18546
- var autocompleteCommand = defineCommand124({
20084
+ var autocompleteCommand = defineCommand127({
18547
20085
  meta: {
18548
20086
  name: "autocomplete",
18549
20087
  description: `Get Google Autocomplete suggestions for keyword expansion.
@@ -18589,7 +20127,7 @@ Examples:
18589
20127
  });
18590
20128
 
18591
20129
  // src/commands/research/countries.ts
18592
- import { defineCommand as defineCommand125 } from "citty";
20130
+ import { defineCommand as defineCommand128 } from "citty";
18593
20131
  registerSchema({
18594
20132
  command: "research.countries",
18595
20133
  description: "List all supported country codes for --location flag in research commands.",
@@ -18646,7 +20184,7 @@ var FIELDS5 = {
18646
20184
  code: "Country code to pass as --location",
18647
20185
  name: "Country name"
18648
20186
  };
18649
- var countriesCommand = defineCommand125({
20187
+ var countriesCommand = defineCommand128({
18650
20188
  meta: {
18651
20189
  name: "countries",
18652
20190
  description: "List all supported country codes for --location flag."
@@ -18657,7 +20195,7 @@ var countriesCommand = defineCommand125({
18657
20195
  });
18658
20196
 
18659
20197
  // src/commands/research/intent.ts
18660
- import { defineCommand as defineCommand126 } from "citty";
20198
+ import { defineCommand as defineCommand129 } from "citty";
18661
20199
  registerSchema({
18662
20200
  command: "research.intent",
18663
20201
  description: "Classify Google Search intent for keywords. Determines if someone searching is looking to buy, research, or navigate. IMPORTANT: If --language is omitted, defaults to English (en). The response includes a query_context object showing which language was used.",
@@ -18680,7 +20218,7 @@ var FIELDS6 = {
18680
20218
  intent: "Primary Google Search intent: informational, navigational, commercial, transactional",
18681
20219
  probability: "Confidence score 0.0-1.0"
18682
20220
  };
18683
- var intentCommand = defineCommand126({
20221
+ var intentCommand = defineCommand129({
18684
20222
  meta: {
18685
20223
  name: "intent",
18686
20224
  description: `Classify Google Search intent for keywords. Returns intent type and confidence.
@@ -18728,7 +20266,7 @@ Examples:
18728
20266
  });
18729
20267
 
18730
20268
  // src/commands/research/keyword-gap.ts
18731
- import { defineCommand as defineCommand127 } from "citty";
20269
+ import { defineCommand as defineCommand130 } from "citty";
18732
20270
  registerSchema({
18733
20271
  command: "research.keyword-gap",
18734
20272
  description: "Find keywords a competitor ranks for (organic or paid) that you don't. Discovers expansion opportunities. IMPORTANT: If --location and --language are omitted, defaults to United States (us) and English (en). The response includes a query_context object showing which location/language were used.",
@@ -18757,7 +20295,7 @@ var FIELDS7 = {
18757
20295
  cpc: "Cost per click USD",
18758
20296
  their_position: "Competitor's ranking position"
18759
20297
  };
18760
- var keywordGapCommand = defineCommand127({
20298
+ var keywordGapCommand = defineCommand130({
18761
20299
  meta: {
18762
20300
  name: "keyword-gap",
18763
20301
  description: `Find keywords a competitor has that you don't. Supports pagination via --offset.
@@ -18831,7 +20369,7 @@ Examples:
18831
20369
  });
18832
20370
 
18833
20371
  // src/commands/research/keywords-for-site.ts
18834
- import { defineCommand as defineCommand128 } from "citty";
20372
+ import { defineCommand as defineCommand131 } from "citty";
18835
20373
  registerSchema({
18836
20374
  command: "research.keywords-for-site",
18837
20375
  description: "Get keywords a competitor targets in Google. Use --type paid to see only paid keywords, --type organic for organic only. IMPORTANT: If --location and --language are omitted, defaults to United States (us) and English (en). The response includes a query_context object showing which location/language were used.",
@@ -18864,7 +20402,7 @@ var FIELDS8 = {
18864
20402
  competition: "LOW, MEDIUM, or HIGH",
18865
20403
  competition_index: "Competition score 0-100"
18866
20404
  };
18867
- var keywordsForSiteCommand = defineCommand128({
20405
+ var keywordsForSiteCommand = defineCommand131({
18868
20406
  meta: {
18869
20407
  name: "keywords-for-site",
18870
20408
  description: `Get keywords a competitor targets in Google. Use --type to filter paid/organic.
@@ -18917,7 +20455,7 @@ Examples:
18917
20455
  });
18918
20456
 
18919
20457
  // src/commands/research/languages.ts
18920
- import { defineCommand as defineCommand129 } from "citty";
20458
+ import { defineCommand as defineCommand132 } from "citty";
18921
20459
  registerSchema({
18922
20460
  command: "research.languages",
18923
20461
  description: "List all supported language codes for --language flag in research commands.",
@@ -18947,7 +20485,7 @@ var FIELDS9 = {
18947
20485
  code: "Language code to pass as --language",
18948
20486
  name: "Language name (also accepted by --language)"
18949
20487
  };
18950
- var languagesCommand2 = defineCommand129({
20488
+ var languagesCommand2 = defineCommand132({
18951
20489
  meta: {
18952
20490
  name: "languages",
18953
20491
  description: "List all supported language codes for --language flag."
@@ -18958,7 +20496,7 @@ var languagesCommand2 = defineCommand129({
18958
20496
  });
18959
20497
 
18960
20498
  // src/commands/research/lighthouse.ts
18961
- import { defineCommand as defineCommand130 } from "citty";
20499
+ import { defineCommand as defineCommand133 } from "citty";
18962
20500
  registerSchema({
18963
20501
  command: "research.lighthouse",
18964
20502
  description: "Landing page performance audit. Returns metrics that affect Google Ads Quality Score and CPC.",
@@ -18977,7 +20515,7 @@ var FIELDS10 = {
18977
20515
  speed_index_ms: "Speed Index in ms (good: < 3400)",
18978
20516
  interactive_ms: "Time to Interactive in ms (good: < 3800)"
18979
20517
  };
18980
- var lighthouseCommand = defineCommand130({
20518
+ var lighthouseCommand = defineCommand133({
18981
20519
  meta: {
18982
20520
  name: "lighthouse",
18983
20521
  description: `Landing page performance audit. Metrics affecting Google Ads Quality Score.
@@ -19015,7 +20553,7 @@ Examples:
19015
20553
  });
19016
20554
 
19017
20555
  // src/commands/research/relevant-pages.ts
19018
- import { defineCommand as defineCommand131 } from "citty";
20556
+ import { defineCommand as defineCommand134 } from "citty";
19019
20557
  registerSchema({
19020
20558
  command: "research.relevant-pages",
19021
20559
  description: "Get the top pages of a competitor domain with organic traffic and ranking data. Shows which pages drive the most traffic. IMPORTANT: If --location and --language are omitted, defaults to United States (us) and English (en).",
@@ -19041,7 +20579,7 @@ var FIELDS11 = {
19041
20579
  keywords: "Total organic keywords the page ranks for",
19042
20580
  top_10: "Keywords in positions 1-10"
19043
20581
  };
19044
- var relevantPagesCommand = defineCommand131({
20582
+ var relevantPagesCommand = defineCommand134({
19045
20583
  meta: {
19046
20584
  name: "relevant-pages",
19047
20585
  description: `Get the top pages of a competitor domain with traffic data.
@@ -19087,7 +20625,7 @@ Examples:
19087
20625
  });
19088
20626
 
19089
20627
  // src/commands/research/web.ts
19090
- import { defineCommand as defineCommand132 } from "citty";
20628
+ import { defineCommand as defineCommand135 } from "citty";
19091
20629
  registerSchema({
19092
20630
  command: "research.web",
19093
20631
  description: "Search the web with AI to answer marketing questions \u2014 competitors, ICP, pricing, pain points, market trends. Three depth levels: medium (quick, default), high (thorough), xhigh (exhaustive deep research).",
@@ -19138,7 +20676,7 @@ async function runDeepResearch(question) {
19138
20676
  }
19139
20677
  throw new Error("Deep research timed out");
19140
20678
  }
19141
- var webCommand = defineCommand132({
20679
+ var webCommand = defineCommand135({
19142
20680
  meta: {
19143
20681
  name: "web",
19144
20682
  description: `Search the web with AI to answer any open-ended marketing question. Uses live internet data via Google Search.
@@ -19198,7 +20736,7 @@ Examples:
19198
20736
  });
19199
20737
 
19200
20738
  // src/commands/research/index.ts
19201
- var researchCommand = defineCommand133({
20739
+ var researchCommand = defineCommand136({
19202
20740
  meta: {
19203
20741
  name: "research",
19204
20742
  description: `Competitive intelligence and AI-powered research commands.
@@ -19238,10 +20776,10 @@ Examples:
19238
20776
  });
19239
20777
 
19240
20778
  // src/commands/scheduled-actions/index.ts
19241
- import { defineCommand as defineCommand140 } from "citty";
20779
+ import { defineCommand as defineCommand143 } from "citty";
19242
20780
 
19243
20781
  // src/commands/scheduled-actions/create.ts
19244
- import { defineCommand as defineCommand134 } from "citty";
20782
+ import { defineCommand as defineCommand137 } from "citty";
19245
20783
 
19246
20784
  // src/commands/scheduled-actions/shared.ts
19247
20785
  var TEMP_SCHEDULED_ACTION_PREFIX = "temp_sched_";
@@ -19356,7 +20894,7 @@ registerSchema({
19356
20894
  prompt: { type: "string", description: "Additional prompt instructions for the spawned agent", required: false }
19357
20895
  }
19358
20896
  });
19359
- var createCommand2 = defineCommand134({
20897
+ var createCommand2 = defineCommand137({
19360
20898
  meta: {
19361
20899
  name: "create",
19362
20900
  description: 'Stage a scheduled action. Example: baker scheduled-actions create --name "Weekly report" --description "..." --cron "0 9 * * MON"'
@@ -19405,7 +20943,7 @@ var createCommand2 = defineCommand134({
19405
20943
  });
19406
20944
 
19407
20945
  // src/commands/scheduled-actions/delete.ts
19408
- import { defineCommand as defineCommand135 } from "citty";
20946
+ import { defineCommand as defineCommand138 } from "citty";
19409
20947
  registerSchema({
19410
20948
  command: "scheduled-actions.delete",
19411
20949
  description: "Stage deletion of a published scheduled action or cancellation of a temp_sched_* draft creation.",
@@ -19413,7 +20951,7 @@ registerSchema({
19413
20951
  id: { type: "string", description: "Published scheduled action ID or temp_sched_* draft ID", required: true }
19414
20952
  }
19415
20953
  });
19416
- var deleteCommand2 = defineCommand135({
20954
+ var deleteCommand2 = defineCommand138({
19417
20955
  meta: {
19418
20956
  name: "delete",
19419
20957
  description: "Stage scheduled action deletion. Example: baker scheduled-actions delete <id-or-temp_sched_id>"
@@ -19442,7 +20980,7 @@ var deleteCommand2 = defineCommand135({
19442
20980
  });
19443
20981
 
19444
20982
  // src/commands/scheduled-actions/get.ts
19445
- import { defineCommand as defineCommand136 } from "citty";
20983
+ import { defineCommand as defineCommand139 } from "citty";
19446
20984
  registerSchema({
19447
20985
  command: "scheduled-actions.get",
19448
20986
  description: "Get a published scheduled action or a temp_sched_* draft-created scheduled action.",
@@ -19450,7 +20988,7 @@ registerSchema({
19450
20988
  id: { type: "string", description: "Published scheduled action ID or temp_sched_* draft ID", required: true }
19451
20989
  }
19452
20990
  });
19453
- var getCommand3 = defineCommand136({
20991
+ var getCommand3 = defineCommand139({
19454
20992
  meta: {
19455
20993
  name: "get",
19456
20994
  description: "Get a scheduled action. Example: baker scheduled-actions get <id-or-temp_sched_id>"
@@ -19487,13 +21025,13 @@ var getCommand3 = defineCommand136({
19487
21025
  });
19488
21026
 
19489
21027
  // src/commands/scheduled-actions/list.ts
19490
- import { defineCommand as defineCommand137 } from "citty";
21028
+ import { defineCommand as defineCommand140 } from "citty";
19491
21029
  registerSchema({
19492
21030
  command: "scheduled-actions.list",
19493
21031
  description: "List published scheduled actions. Includes draft state when BAKER_CHAT_ID is set.",
19494
21032
  args: {}
19495
21033
  });
19496
- var listCommand4 = defineCommand137({
21034
+ var listCommand5 = defineCommand140({
19497
21035
  meta: {
19498
21036
  name: "list",
19499
21037
  description: "List scheduled actions. Includes staged draft ops when BAKER_CHAT_ID is set."
@@ -19514,7 +21052,7 @@ var listCommand4 = defineCommand137({
19514
21052
  });
19515
21053
 
19516
21054
  // src/commands/scheduled-actions/trigger.ts
19517
- import { defineCommand as defineCommand138 } from "citty";
21055
+ import { defineCommand as defineCommand141 } from "citty";
19518
21056
  registerSchema({
19519
21057
  command: "scheduled-actions.trigger",
19520
21058
  description: "Immediately trigger a published scheduled action. Does not require BAKER_CHAT_ID and rejects temp_sched_* IDs.",
@@ -19522,7 +21060,7 @@ registerSchema({
19522
21060
  id: { type: "string", description: "Published scheduled action ID", required: true }
19523
21061
  }
19524
21062
  });
19525
- var triggerCommand = defineCommand138({
21063
+ var triggerCommand = defineCommand141({
19526
21064
  meta: {
19527
21065
  name: "trigger",
19528
21066
  description: "Immediately trigger a published scheduled action. Example: baker scheduled-actions trigger <id>"
@@ -19559,7 +21097,7 @@ var triggerCommand = defineCommand138({
19559
21097
  });
19560
21098
 
19561
21099
  // src/commands/scheduled-actions/update.ts
19562
- import { defineCommand as defineCommand139 } from "citty";
21100
+ import { defineCommand as defineCommand142 } from "citty";
19563
21101
  registerSchema({
19564
21102
  command: "scheduled-actions.update",
19565
21103
  description: "Stage an update to a published scheduled action or temp_sched_* draft-created scheduled action.",
@@ -19584,7 +21122,7 @@ registerSchema({
19584
21122
  prompt: { type: "string", description: "Replacement additional spawned-agent instructions", required: false }
19585
21123
  }
19586
21124
  });
19587
- var updateCommand2 = defineCommand139({
21125
+ var updateCommand2 = defineCommand142({
19588
21126
  meta: {
19589
21127
  name: "update",
19590
21128
  description: "Stage a scheduled action update. Example: baker scheduled-actions update <id> --enabled false"
@@ -19655,7 +21193,7 @@ var updateCommand2 = defineCommand139({
19655
21193
  });
19656
21194
 
19657
21195
  // src/commands/scheduled-actions/index.ts
19658
- var scheduledActionsCommand = defineCommand140({
21196
+ var scheduledActionsCommand = defineCommand143({
19659
21197
  meta: {
19660
21198
  name: "scheduled-actions",
19661
21199
  description: `Manage Scheduled Actions. Subcommands: list, get, create, update, delete, trigger.
@@ -19671,7 +21209,7 @@ Examples:
19671
21209
  baker scheduled-actions trigger <id>`
19672
21210
  },
19673
21211
  subCommands: {
19674
- list: listCommand4,
21212
+ list: listCommand5,
19675
21213
  get: getCommand3,
19676
21214
  create: createCommand2,
19677
21215
  update: updateCommand2,
@@ -19681,8 +21219,8 @@ Examples:
19681
21219
  });
19682
21220
 
19683
21221
  // src/commands/schema.ts
19684
- import { defineCommand as defineCommand141 } from "citty";
19685
- var schemaCommand = defineCommand141({
21222
+ import { defineCommand as defineCommand144 } from "citty";
21223
+ var schemaCommand = defineCommand144({
19686
21224
  meta: {
19687
21225
  name: "schema",
19688
21226
  description: "Inspect command argument schemas (for AI agent introspection). Lists all commands if no argument given. Example: baker schema images.search"
@@ -19718,10 +21256,10 @@ var schemaCommand = defineCommand141({
19718
21256
  });
19719
21257
 
19720
21258
  // src/commands/testimonials/index.ts
19721
- import { defineCommand as defineCommand145 } from "citty";
21259
+ import { defineCommand as defineCommand148 } from "citty";
19722
21260
 
19723
21261
  // src/commands/testimonials/get.ts
19724
- import { defineCommand as defineCommand142 } from "citty";
21262
+ import { defineCommand as defineCommand145 } from "citty";
19725
21263
  registerSchema({
19726
21264
  command: "testimonials.get",
19727
21265
  description: "Get a single testimonial by ID",
@@ -19729,7 +21267,7 @@ registerSchema({
19729
21267
  id: { type: "string", description: "Testimonial ID", required: true }
19730
21268
  }
19731
21269
  });
19732
- var getCommand4 = defineCommand142({
21270
+ var getCommand4 = defineCommand145({
19733
21271
  meta: { name: "get", description: "Get a single testimonial by ID. Example: baker testimonials get j571abc123" },
19734
21272
  args: {
19735
21273
  id: { type: "positional", description: "Testimonial ID", required: false },
@@ -19766,7 +21304,7 @@ var getCommand4 = defineCommand142({
19766
21304
  });
19767
21305
 
19768
21306
  // src/commands/testimonials/list.ts
19769
- import { defineCommand as defineCommand143 } from "citty";
21307
+ import { defineCommand as defineCommand146 } from "citty";
19770
21308
  registerSchema({
19771
21309
  command: "testimonials.list",
19772
21310
  description: "List testimonials with optional filters.",
@@ -19796,7 +21334,7 @@ registerSchema({
19796
21334
  limit: { type: "number", description: "Max results (default 50)", required: false, default: 50 }
19797
21335
  }
19798
21336
  });
19799
- var listCommand5 = defineCommand143({
21337
+ var listCommand6 = defineCommand146({
19800
21338
  meta: {
19801
21339
  name: "list",
19802
21340
  description: "List testimonials with optional filters. Example: baker testimonials list --source google --sentiment positive"
@@ -19845,7 +21383,7 @@ var listCommand5 = defineCommand143({
19845
21383
  });
19846
21384
 
19847
21385
  // src/commands/testimonials/search.ts
19848
- import { defineCommand as defineCommand144 } from "citty";
21386
+ import { defineCommand as defineCommand147 } from "citty";
19849
21387
  registerSchema({
19850
21388
  command: "testimonials.search",
19851
21389
  description: "Search testimonials by text query. Uses hybrid BM25 + vector + reranking.",
@@ -19876,7 +21414,7 @@ registerSchema({
19876
21414
  tags: { type: "string", description: "Comma-separated tags to filter by", required: false }
19877
21415
  }
19878
21416
  });
19879
- var searchCommand2 = defineCommand144({
21417
+ var searchCommand2 = defineCommand147({
19880
21418
  meta: {
19881
21419
  name: "search",
19882
21420
  description: "Semantic search testimonials by text query. Uses hybrid BM25 + vector + reranking. Example: baker testimonials search 'great service' --rating-min 4"
@@ -19950,7 +21488,7 @@ var searchCommand2 = defineCommand144({
19950
21488
  var tagsCommand3 = makeTagsCommand("testimonials", "testimonial", "/api/testimonials/tags");
19951
21489
 
19952
21490
  // src/commands/testimonials/index.ts
19953
- var testimonialsCommand = defineCommand145({
21491
+ var testimonialsCommand = defineCommand148({
19954
21492
  meta: {
19955
21493
  name: "testimonials",
19956
21494
  description: `Find and browse testimonials in Baker. Subcommands: search, get, list, tags.
@@ -19965,16 +21503,16 @@ Examples:
19965
21503
  subCommands: {
19966
21504
  get: getCommand4,
19967
21505
  search: searchCommand2,
19968
- list: listCommand5,
21506
+ list: listCommand6,
19969
21507
  tags: tagsCommand3
19970
21508
  }
19971
21509
  });
19972
21510
 
19973
21511
  // src/commands/videos/index.ts
19974
- import { defineCommand as defineCommand150 } from "citty";
21512
+ import { defineCommand as defineCommand153 } from "citty";
19975
21513
 
19976
21514
  // src/commands/videos/delete.ts
19977
- import { defineCommand as defineCommand146 } from "citty";
21515
+ import { defineCommand as defineCommand149 } from "citty";
19978
21516
  registerSchema({
19979
21517
  command: "videos.delete",
19980
21518
  description: "Delete a video by ID",
@@ -19988,7 +21526,7 @@ registerSchema({
19988
21526
  }
19989
21527
  }
19990
21528
  });
19991
- var deleteCommand3 = defineCommand146({
21529
+ var deleteCommand3 = defineCommand149({
19992
21530
  meta: {
19993
21531
  name: "delete",
19994
21532
  description: "Delete a video by ID. Use --dry-run to preview. Example: baker videos delete j571abc123 --dry-run"
@@ -20029,7 +21567,7 @@ var deleteCommand3 = defineCommand146({
20029
21567
  });
20030
21568
 
20031
21569
  // src/commands/videos/get.ts
20032
- import { defineCommand as defineCommand147 } from "citty";
21570
+ import { defineCommand as defineCommand150 } from "citty";
20033
21571
  registerSchema({
20034
21572
  command: "videos.get",
20035
21573
  description: "Get a single video by ID",
@@ -20037,7 +21575,7 @@ registerSchema({
20037
21575
  id: { type: "string", description: "Video ID", required: true }
20038
21576
  }
20039
21577
  });
20040
- var getCommand5 = defineCommand147({
21578
+ var getCommand5 = defineCommand150({
20041
21579
  meta: { name: "get", description: "Get a single video by ID. Example: baker videos get j571abc123" },
20042
21580
  args: {
20043
21581
  id: { type: "positional", description: "Video ID", required: false },
@@ -20074,7 +21612,7 @@ var getCommand5 = defineCommand147({
20074
21612
  });
20075
21613
 
20076
21614
  // src/commands/videos/search.ts
20077
- import { defineCommand as defineCommand148 } from "citty";
21615
+ import { defineCommand as defineCommand151 } from "citty";
20078
21616
  registerSchema({
20079
21617
  command: "videos.search",
20080
21618
  description: "Search videos by text query. Only returns ready videos.",
@@ -20084,7 +21622,7 @@ registerSchema({
20084
21622
  tags: { type: "string", description: "Comma-separated tags to filter by", required: false }
20085
21623
  }
20086
21624
  });
20087
- var searchCommand3 = defineCommand148({
21625
+ var searchCommand3 = defineCommand151({
20088
21626
  meta: {
20089
21627
  name: "search",
20090
21628
  description: "Semantic search videos by text query. Uses hybrid BM25 + vector + reranking. Example: baker videos search 'product demo' --tags tutorial"
@@ -20136,7 +21674,7 @@ var tagsCommand4 = makeTagsCommand("videos", "video", "/api/videos/tags");
20136
21674
  // src/commands/videos/upload.ts
20137
21675
  import { readFile as readFile12, stat as stat3 } from "fs/promises";
20138
21676
  import { extname as extname3 } from "path";
20139
- import { defineCommand as defineCommand149 } from "citty";
21677
+ import { defineCommand as defineCommand152 } from "citty";
20140
21678
  var MIME_MAP = {
20141
21679
  ".mp4": "video/mp4",
20142
21680
  ".mov": "video/quicktime",
@@ -20170,7 +21708,7 @@ function detectContentType(filePath) {
20170
21708
  }
20171
21709
  return mime;
20172
21710
  }
20173
- var uploadCommand2 = defineCommand149({
21711
+ var uploadCommand2 = defineCommand152({
20174
21712
  meta: {
20175
21713
  name: "upload",
20176
21714
  description: "Upload a video file to Baker via Mux direct upload. Auto-detects content type. Example: baker videos upload ./demo.mp4"
@@ -20224,7 +21762,7 @@ var uploadCommand2 = defineCommand149({
20224
21762
  });
20225
21763
 
20226
21764
  // src/commands/videos/index.ts
20227
- var videosCommand = defineCommand150({
21765
+ var videosCommand = defineCommand153({
20228
21766
  meta: {
20229
21767
  name: "videos",
20230
21768
  description: `Find and manage videos in Baker. Subcommands: search, get, upload, delete, tags.
@@ -20247,10 +21785,10 @@ Examples:
20247
21785
  });
20248
21786
 
20249
21787
  // src/commands/winning-ads/index.ts
20250
- import { defineCommand as defineCommand153 } from "citty";
21788
+ import { defineCommand as defineCommand156 } from "citty";
20251
21789
 
20252
21790
  // src/commands/winning-ads/advertisers.ts
20253
- import { defineCommand as defineCommand151 } from "citty";
21791
+ import { defineCommand as defineCommand154 } from "citty";
20254
21792
  registerSchema({
20255
21793
  command: "winning-ads.advertisers",
20256
21794
  description: "Resolve a brand name to advertiser_id(s) in the ad-dna corpus \u2014 to find your OWN advertiser (to --exclude-advertiser) or a competitor (to --advertiser-id).",
@@ -20263,7 +21801,7 @@ registerSchema({
20263
21801
  function identity(record) {
20264
21802
  return record;
20265
21803
  }
20266
- var advertisersCommand2 = defineCommand151({
21804
+ var advertisersCommand2 = defineCommand154({
20267
21805
  meta: {
20268
21806
  name: "advertisers",
20269
21807
  description: 'Resolve a brand name to advertiser_id(s). Use it to find your own advertiser for --exclude-advertiser, or a competitor for --advertiser-id. Example: baker winning-ads advertisers "Deel" --output md'
@@ -20314,7 +21852,7 @@ var advertisersCommand2 = defineCommand151({
20314
21852
  });
20315
21853
 
20316
21854
  // src/commands/winning-ads/search.ts
20317
- import { defineCommand as defineCommand152 } from "citty";
21855
+ import { defineCommand as defineCommand155 } from "citty";
20318
21856
  registerSchema({
20319
21857
  command: "winning-ads.search",
20320
21858
  description: "Search the ad-dna corpus of scored winning ads. Returns a lean shortlist (advertiser, summary, scores, media_url) to pick a reference to reproduce.",
@@ -20422,7 +21960,7 @@ function buildSearchBody(args) {
20422
21960
  }
20423
21961
  return body;
20424
21962
  }
20425
- var searchCommand4 = defineCommand152({
21963
+ var searchCommand4 = defineCommand155({
20426
21964
  meta: {
20427
21965
  name: "search",
20428
21966
  description: "Search winning reference ads. Example: baker winning-ads search 'B2B SaaS before/after AI automation' --platform meta --format static --winner-category winner --exclude-advertiser adv_123 --output md"
@@ -20534,7 +22072,7 @@ var searchCommand4 = defineCommand152({
20534
22072
  });
20535
22073
 
20536
22074
  // src/commands/winning-ads/index.ts
20537
- var winningAdsCommand = defineCommand153({
22075
+ var winningAdsCommand = defineCommand156({
20538
22076
  meta: {
20539
22077
  name: "winning-ads",
20540
22078
  description: `Search the ad-dna corpus of scored "winning" ads for reference creatives to reproduce. Proxied through the Baker backend (BAKER_API_KEY) \u2014 no separate token needed.
@@ -20558,7 +22096,7 @@ Examples:
20558
22096
  });
20559
22097
 
20560
22098
  // src/version.ts
20561
- import { readFileSync as readFileSync10 } from "fs";
22099
+ import { readFileSync as readFileSync11 } from "fs";
20562
22100
  function packageJsonUrl() {
20563
22101
  return new URL("../package.json", import.meta.url);
20564
22102
  }
@@ -20570,11 +22108,11 @@ function parsePackageVersion(raw) {
20570
22108
  throw new Error("Invalid CLI package.json: missing version");
20571
22109
  }
20572
22110
  function getCliVersion() {
20573
- return parsePackageVersion(readFileSync10(packageJsonUrl(), "utf8"));
22111
+ return parsePackageVersion(readFileSync11(packageJsonUrl(), "utf8"));
20574
22112
  }
20575
22113
 
20576
22114
  // src/cli.ts
20577
- var main = defineCommand154({
22115
+ var main = defineCommand157({
20578
22116
  meta: {
20579
22117
  name: "baker",
20580
22118
  version: getCliVersion(),
@@ -20589,7 +22127,7 @@ Introspection: Run 'baker schema <command>' to inspect argument schemas.`
20589
22127
  subCommands: {
20590
22128
  actions: actionsCommand,
20591
22129
  "scheduled-actions": scheduledActionsCommand,
20592
- ads: adsCommand,
22130
+ ads: adsCommand2,
20593
22131
  ga4: ga4Command,
20594
22132
  gsc: gscCommand,
20595
22133
  research: researchCommand,
@@ -20599,6 +22137,7 @@ Introspection: Run 'baker schema <command>' to inspect argument schemas.`
20599
22137
  testimonials: testimonialsCommand,
20600
22138
  canvas: canvasCommand,
20601
22139
  "winning-ads": winningAdsCommand,
22140
+ mcp: mcpCommand,
20602
22141
  schema: schemaCommand
20603
22142
  }
20604
22143
  });