@koda-sl/baker-cli 0.111.0-dev.4a58faec8 → 0.111.0-dev.94fd3a2a1

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
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-26K7V346.js";
13
13
 
14
14
  // src/cli.ts
15
- import { defineCommand as defineCommand155, runMain } from "citty";
15
+ import { defineCommand as defineCommand156, runMain } from "citty";
16
16
 
17
17
  // src/commands/actions/index.ts
18
18
  import { defineCommand as defineCommand18 } from "citty";
@@ -31,7 +31,6 @@ 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(),
35
34
  BAKER_GOOGLE_ADS_CUSTOMER_ID: z.string().regex(/^\d{10}$/).optional(),
36
35
  BAKER_GA4_PROPERTY_ID: z.string().optional(),
37
36
  BAKER_GSC_SITE_URL: z.string().optional(),
@@ -2844,10 +2843,10 @@ Examples:
2844
2843
  });
2845
2844
 
2846
2845
  // src/commands/ads/index.ts
2847
- import { defineCommand as defineCommand80 } from "citty";
2846
+ import { defineCommand as defineCommand82 } from "citty";
2848
2847
 
2849
2848
  // src/commands/ads/google/index.ts
2850
- import { defineCommand as defineCommand29 } from "citty";
2849
+ import { defineCommand as defineCommand31 } from "citty";
2851
2850
 
2852
2851
  // src/commands/ads/google/accounts.ts
2853
2852
  import { defineCommand as defineCommand19 } from "citty";
@@ -3832,11 +3831,866 @@ Examples:
3832
3831
  }
3833
3832
  });
3834
3833
 
3834
+ // src/commands/ads/google/draft.ts
3835
+ import { defineCommand as defineCommand22 } from "citty";
3836
+
3837
+ // src/commands/ads/google/write-shared.ts
3838
+ import { readFileSync as readFileSync3 } from "fs";
3839
+
3840
+ // ../api/src/ads-google/limits.ts
3841
+ var GOOGLE_ADS_LIMITS = {
3842
+ budget: {
3843
+ nameMax: 255,
3844
+ amountMicrosMin: 1
3845
+ },
3846
+ campaign: {
3847
+ nameMax: 255
3848
+ },
3849
+ adGroup: {
3850
+ nameMax: 255
3851
+ },
3852
+ keyword: {
3853
+ textMax: 80,
3854
+ wordsMax: 10
3855
+ },
3856
+ responsiveSearchAd: {
3857
+ headlinesMin: 3,
3858
+ headlinesMax: 15,
3859
+ headlineTextMax: 30,
3860
+ descriptionsMin: 2,
3861
+ descriptionsMax: 4,
3862
+ descriptionTextMax: 90,
3863
+ pathMax: 15
3864
+ },
3865
+ responsiveDisplayAd: {
3866
+ headlinesMin: 1,
3867
+ headlinesMax: 5,
3868
+ headlineTextMax: 30,
3869
+ longHeadlineTextMax: 90,
3870
+ descriptionsMin: 1,
3871
+ descriptionsMax: 5,
3872
+ descriptionTextMax: 90,
3873
+ businessNameMax: 25
3874
+ },
3875
+ sharedSet: {
3876
+ nameMax: 255
3877
+ },
3878
+ asset: {
3879
+ sitelinkLinkTextMax: 25,
3880
+ sitelinkDescriptionMax: 35,
3881
+ calloutTextMax: 25,
3882
+ structuredSnippetHeaderMax: 25,
3883
+ structuredSnippetValuesMin: 3,
3884
+ structuredSnippetValuesMax: 10
3885
+ },
3886
+ conversionAction: {
3887
+ nameMax: 255
3888
+ },
3889
+ audience: {
3890
+ nameMax: 255
3891
+ },
3892
+ biddingStrategy: {
3893
+ nameMax: 255
3894
+ },
3895
+ label: {
3896
+ nameMax: 255
3897
+ }
3898
+ };
3899
+ var KEYWORD_MATCH_TYPES = ["EXACT", "PHRASE", "BROAD"];
3900
+ var ADVERTISING_CHANNEL_TYPES = [
3901
+ "SEARCH",
3902
+ "DISPLAY",
3903
+ "SHOPPING",
3904
+ "VIDEO",
3905
+ "PERFORMANCE_MAX",
3906
+ "DEMAND_GEN",
3907
+ "MULTI_CHANNEL",
3908
+ "LOCAL",
3909
+ "SMART",
3910
+ "TRAVEL",
3911
+ "HOTEL",
3912
+ "DISCOVERY"
3913
+ ];
3914
+ var ADVERTISING_CHANNEL_SUB_TYPES = [
3915
+ "SEARCH_MOBILE_APP",
3916
+ "DISPLAY_MOBILE_APP",
3917
+ "SEARCH_EXPRESS",
3918
+ "DISPLAY_EXPRESS",
3919
+ "SHOPPING_SMART_ADS",
3920
+ "DISPLAY_GMAIL_AD",
3921
+ "DISPLAY_SMART_CAMPAIGN",
3922
+ "VIDEO_OUTSTREAM",
3923
+ "VIDEO_ACTION",
3924
+ "VIDEO_NON_SKIPPABLE",
3925
+ "APP_CAMPAIGN",
3926
+ "APP_CAMPAIGN_FOR_ENGAGEMENT",
3927
+ "LOCAL_CAMPAIGN",
3928
+ "SHOPPING_COMPARISON_LISTING_ADS",
3929
+ "SEARCH_MOBILE_APP_ENGAGEMENT",
3930
+ "TRAVEL_ACTIVITIES"
3931
+ ];
3932
+ var BIDDING_STRATEGY_TYPES = [
3933
+ "MANUAL_CPC",
3934
+ "MAXIMIZE_CONVERSIONS",
3935
+ "MAXIMIZE_CONVERSION_VALUE",
3936
+ "TARGET_SPEND",
3937
+ "TARGET_CPA",
3938
+ "TARGET_ROAS",
3939
+ "TARGET_IMPRESSION_SHARE",
3940
+ "MANUAL_CPM",
3941
+ "MANUAL_CPV",
3942
+ "PERCENT_CPC"
3943
+ ];
3944
+ var BUDGET_DELIVERY_METHODS = ["STANDARD", "ACCELERATED"];
3945
+ var AD_GROUP_TYPES = [
3946
+ "SEARCH_STANDARD",
3947
+ "DISPLAY_STANDARD",
3948
+ "SHOPPING_PRODUCT_ADS",
3949
+ "VIDEO_BUMPER",
3950
+ "VIDEO_TRUE_VIEW_IN_STREAM",
3951
+ "VIDEO_TRUE_VIEW_IN_DISPLAY",
3952
+ "VIDEO_NON_SKIPPABLE_IN_STREAM",
3953
+ "VIDEO_OUTSTREAM",
3954
+ "DEMAND_GEN_AD"
3955
+ ];
3956
+ var SHARED_SET_TYPES = [
3957
+ "NEGATIVE_KEYWORDS",
3958
+ "NEGATIVE_PLACEMENTS",
3959
+ "ACCOUNT_LEVEL_NEGATIVE_KEYWORDS"
3960
+ ];
3961
+ var STAGEABLE_CREATE_STATUSES2 = ["ENABLED", "PAUSED"];
3962
+ var PINNED_FIELDS = ["HEADLINE_1", "HEADLINE_2", "HEADLINE_3", "DESCRIPTION_1", "DESCRIPTION_2"];
3963
+ var CONVERSION_ACTION_CATEGORIES = [
3964
+ "DEFAULT",
3965
+ "PAGE_VIEW",
3966
+ "PURCHASE",
3967
+ "SIGNUP",
3968
+ "LEAD",
3969
+ "DOWNLOAD",
3970
+ "ADD_TO_CART",
3971
+ "BEGIN_CHECKOUT",
3972
+ "SUBSCRIBE_PAID",
3973
+ "PHONE_CALL_LEAD",
3974
+ "SUBMIT_LEAD_FORM",
3975
+ "BOOK_APPOINTMENT",
3976
+ "REQUEST_QUOTE",
3977
+ "CONTACT"
3978
+ ];
3979
+ var CONVERSION_ACTION_TYPES = [
3980
+ "WEBPAGE",
3981
+ "UPLOAD_CLICKS",
3982
+ "UPLOAD_CALLS",
3983
+ "WEBSITE_CALL",
3984
+ "GOOGLE_ANALYTICS_4_CUSTOM"
3985
+ ];
3986
+ var CONVERSION_COUNTING_TYPES = ["ONE_PER_CLICK", "MANY_PER_CLICK"];
3987
+ var USER_LIST_TYPES = ["CRM_BASED", "RULE_BASED", "LOGICAL", "BASIC", "LOOKALIKE"];
3988
+ var ASSET_FIELD_TYPES = [
3989
+ "SITELINK",
3990
+ "CALLOUT",
3991
+ "STRUCTURED_SNIPPET",
3992
+ "CALL",
3993
+ "PRICE",
3994
+ "PROMOTION",
3995
+ "MOBILE_APP",
3996
+ "HEADLINE",
3997
+ "DESCRIPTION",
3998
+ "LOGO",
3999
+ "MARKETING_IMAGE",
4000
+ "BUSINESS_NAME"
4001
+ ];
4002
+ var DEVICE_TYPES = ["MOBILE", "TABLET", "DESKTOP", "CONNECTED_TV", "OTHER"];
4003
+ var DAYS_OF_WEEK = ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"];
4004
+ var CAMPAIGN_OBJECTIVES = [
4005
+ "SALES",
4006
+ "LEADS",
4007
+ "WEBSITE_TRAFFIC",
4008
+ "PRODUCT_BRAND_CONSIDERATION",
4009
+ "BRAND_AWARENESS_REACH",
4010
+ "APP_PROMOTION",
4011
+ "LOCAL_STORE_VISITS"
4012
+ ];
4013
+ var MICROS_PER_UNIT = 1e6;
4014
+ function toMicros(amount) {
4015
+ return Math.round(amount * MICROS_PER_UNIT);
4016
+ }
4017
+ var PLAYBOOK_DAILY_BUDGET_FLOOR_MICROS = 10 * MICROS_PER_UNIT;
4018
+ var TEMP_REF_REGEX2 = /^g_temp_[A-Za-z0-9_-]{2,}$/;
4019
+ var NUMERIC_ID_REGEX2 = /^\d+$/;
4020
+ var RESOURCE_NAME_REGEX = /^customers\/\d+\/[A-Za-z]+\/[-\w~]+$/;
4021
+ var GEO_TARGET_CONSTANT_REGEX = /^geoTargetConstants\/\d+$/;
4022
+ var LANGUAGE_CONSTANT_REGEX = /^languageConstants\/\d+$/;
4023
+
4024
+ // ../api/src/ads-google/ops.ts
4025
+ import { z as z8 } from "zod";
4026
+ var tempRefSchema2 = z8.string().regex(TEMP_REF_REGEX2, "expected a g_temp_* reference");
4027
+ var refSchema = z8.union([
4028
+ z8.string().regex(RESOURCE_NAME_REGEX, "expected a customers/\u2026/\u2026/\u2026 resource name"),
4029
+ z8.string().regex(NUMERIC_ID_REGEX2, "expected a numeric id"),
4030
+ tempRefSchema2
4031
+ ]);
4032
+ var targetRefSchema = refSchema;
4033
+ var microsSchema = z8.number().int().positive("expected a positive micros amount");
4034
+ var httpsUrlSchema2 = z8.string().url().refine((u) => u.startsWith("https://"), "final URLs must be https");
4035
+ var customerIdSchema = z8.string().regex(NUMERIC_ID_REGEX2, "customerId must be the bare numeric customer id");
4036
+ var stageableStatusSchema2 = z8.enum(STAGEABLE_CREATE_STATUSES2);
4037
+ var matchTypeSchema = z8.enum(KEYWORD_MATCH_TYPES);
4038
+ 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");
4039
+ var budgetCreateSchema = z8.object({
4040
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.budget.nameMax),
4041
+ amountMicros: microsSchema,
4042
+ deliveryMethod: z8.enum(BUDGET_DELIVERY_METHODS).default("STANDARD"),
4043
+ explicitlyShared: z8.boolean().default(false)
4044
+ });
4045
+ var budgetUpdateSchema = z8.object({
4046
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.budget.nameMax).optional(),
4047
+ amountMicros: microsSchema.optional(),
4048
+ deliveryMethod: z8.enum(BUDGET_DELIVERY_METHODS).optional()
4049
+ }).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
4050
+ var biddingConfigSchema = z8.object({
4051
+ type: z8.enum(BIDDING_STRATEGY_TYPES),
4052
+ targetCpaMicros: microsSchema.optional(),
4053
+ targetRoas: z8.number().positive().optional(),
4054
+ cpcBidCeilingMicros: microsSchema.optional(),
4055
+ enhancedCpcEnabled: z8.boolean().optional()
4056
+ }).superRefine((p, ctx) => {
4057
+ if (p.type === "TARGET_CPA" && p.targetCpaMicros === void 0) {
4058
+ ctx.addIssue({ code: "custom", path: ["targetCpaMicros"], message: "TARGET_CPA needs targetCpaMicros" });
4059
+ }
4060
+ if (p.type === "TARGET_ROAS" && p.targetRoas === void 0) {
4061
+ ctx.addIssue({ code: "custom", path: ["targetRoas"], message: "TARGET_ROAS needs targetRoas" });
4062
+ }
4063
+ });
4064
+ var networkSettingsSchema = z8.object({
4065
+ targetGoogleSearch: z8.boolean().optional(),
4066
+ targetSearchNetwork: z8.boolean().optional(),
4067
+ targetContentNetwork: z8.boolean().optional(),
4068
+ targetPartnerSearchNetwork: z8.boolean().optional()
4069
+ });
4070
+ var dateSchema = z8.string().regex(/^\d{4}-\d{2}-\d{2}$/, "expected a YYYY-MM-DD date");
4071
+ var campaignCreateSchema2 = z8.object({
4072
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.campaign.nameMax),
4073
+ channelType: z8.enum(ADVERTISING_CHANNEL_TYPES),
4074
+ channelSubType: z8.enum(ADVERTISING_CHANNEL_SUB_TYPES).optional(),
4075
+ budget: refSchema,
4076
+ /** Inline standard bidding, or a portfolio strategy ref via biddingStrategy. */
4077
+ bidding: biddingConfigSchema.optional(),
4078
+ biddingStrategy: refSchema.optional(),
4079
+ networkSettings: networkSettingsSchema.optional(),
4080
+ startDate: dateSchema.optional(),
4081
+ endDate: dateSchema.optional(),
4082
+ /** Advisory Google Ads UI objective — drives warnings, not sent to the API. */
4083
+ objective: z8.enum(CAMPAIGN_OBJECTIVES).optional(),
4084
+ status: stageableStatusSchema2.default("PAUSED")
4085
+ }).superRefine((p, ctx) => {
4086
+ if (!p.bidding && !p.biddingStrategy) {
4087
+ ctx.addIssue({
4088
+ code: "custom",
4089
+ path: ["bidding"],
4090
+ message: "set an inline bidding strategy or reference a portfolio biddingStrategy"
4091
+ });
4092
+ }
4093
+ if (p.bidding && p.biddingStrategy) {
4094
+ ctx.addIssue({
4095
+ code: "custom",
4096
+ path: ["bidding"],
4097
+ message: "use inline bidding OR a portfolio biddingStrategy, not both"
4098
+ });
4099
+ }
4100
+ if (p.channelType === "PERFORMANCE_MAX" && p.bidding && p.bidding.type === "MANUAL_CPC") {
4101
+ ctx.addIssue({ code: "custom", path: ["bidding"], message: "Performance Max does not support Manual CPC" });
4102
+ }
4103
+ if (p.startDate && p.endDate && p.endDate <= p.startDate) {
4104
+ ctx.addIssue({ code: "custom", path: ["endDate"], message: "endDate must be after startDate" });
4105
+ }
4106
+ });
4107
+ var campaignUpdateSchema2 = z8.object({
4108
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.campaign.nameMax).optional(),
4109
+ budget: refSchema.optional(),
4110
+ bidding: biddingConfigSchema.optional(),
4111
+ networkSettings: networkSettingsSchema.optional(),
4112
+ startDate: dateSchema.optional(),
4113
+ endDate: dateSchema.optional(),
4114
+ status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
4115
+ }).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
4116
+ var adGroupCreateSchema = z8.object({
4117
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.adGroup.nameMax),
4118
+ campaign: refSchema,
4119
+ type: z8.enum(AD_GROUP_TYPES).default("SEARCH_STANDARD"),
4120
+ cpcBidMicros: microsSchema.optional(),
4121
+ status: stageableStatusSchema2.default("PAUSED")
4122
+ });
4123
+ var adGroupUpdateSchema = z8.object({
4124
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.adGroup.nameMax).optional(),
4125
+ cpcBidMicros: microsSchema.optional(),
4126
+ status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
4127
+ }).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
4128
+ var keywordAddSchema = z8.object({
4129
+ adGroup: refSchema,
4130
+ text: keywordTextSchema,
4131
+ matchType: matchTypeSchema,
4132
+ cpcBidMicros: microsSchema.optional(),
4133
+ finalUrls: z8.array(httpsUrlSchema2).optional(),
4134
+ status: stageableStatusSchema2.default("ENABLED")
4135
+ });
4136
+ var keywordUpdateSchema = z8.object({
4137
+ cpcBidMicros: microsSchema.optional(),
4138
+ finalUrls: z8.array(httpsUrlSchema2).optional(),
4139
+ status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional()
4140
+ }).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
4141
+ var negativeKeywordAddSchema = z8.object({
4142
+ level: z8.enum(["adGroup", "campaign"]),
4143
+ parent: refSchema,
4144
+ text: keywordTextSchema,
4145
+ matchType: matchTypeSchema
4146
+ });
4147
+ var sharedSetCreateSchema = z8.object({
4148
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.sharedSet.nameMax),
4149
+ type: z8.enum(SHARED_SET_TYPES).default("NEGATIVE_KEYWORDS")
4150
+ });
4151
+ var sharedSetMemberAddSchema = z8.object({
4152
+ sharedSet: refSchema,
4153
+ text: keywordTextSchema,
4154
+ matchType: matchTypeSchema
4155
+ });
4156
+ var campaignSharedSetAttachSchema = z8.object({
4157
+ campaign: refSchema,
4158
+ sharedSet: refSchema
4159
+ });
4160
+ var adTextAssetSchema = z8.object({
4161
+ text: z8.string().min(1),
4162
+ pinnedField: z8.enum(PINNED_FIELDS).optional()
4163
+ });
4164
+ var responsiveSearchAdSchema = z8.object({
4165
+ format: z8.literal("responsiveSearch"),
4166
+ headlines: z8.array(
4167
+ adTextAssetSchema.refine(
4168
+ (a) => a.text.length <= GOOGLE_ADS_LIMITS.responsiveSearchAd.headlineTextMax,
4169
+ "headline exceeds 30 chars"
4170
+ )
4171
+ ).min(GOOGLE_ADS_LIMITS.responsiveSearchAd.headlinesMin).max(GOOGLE_ADS_LIMITS.responsiveSearchAd.headlinesMax),
4172
+ descriptions: z8.array(
4173
+ adTextAssetSchema.refine(
4174
+ (a) => a.text.length <= GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionTextMax,
4175
+ "description exceeds 90 chars"
4176
+ )
4177
+ ).min(GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionsMin).max(GOOGLE_ADS_LIMITS.responsiveSearchAd.descriptionsMax),
4178
+ path1: z8.string().max(GOOGLE_ADS_LIMITS.responsiveSearchAd.pathMax).optional(),
4179
+ path2: z8.string().max(GOOGLE_ADS_LIMITS.responsiveSearchAd.pathMax).optional(),
4180
+ finalUrls: z8.array(httpsUrlSchema2).min(1)
4181
+ });
4182
+ var responsiveDisplayAdSchema = z8.object({
4183
+ format: z8.literal("responsiveDisplay"),
4184
+ headlines: z8.array(z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.headlineTextMax) })).min(1).max(5),
4185
+ longHeadline: z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.longHeadlineTextMax) }),
4186
+ descriptions: z8.array(z8.object({ text: z8.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.descriptionTextMax) })).min(1).max(5),
4187
+ businessName: z8.string().min(1).max(GOOGLE_ADS_LIMITS.responsiveDisplayAd.businessNameMax),
4188
+ marketingImageAssets: z8.array(refSchema).optional(),
4189
+ logoImageAssets: z8.array(refSchema).optional(),
4190
+ finalUrls: z8.array(httpsUrlSchema2).min(1)
4191
+ });
4192
+ var performanceMaxAssetGroupSchema = z8.object({
4193
+ format: z8.literal("performanceMaxAssetGroup"),
4194
+ name: z8.string().min(1).max(255),
4195
+ headlines: z8.array(z8.object({ text: z8.string().min(1).max(30) })).min(3).max(15),
4196
+ descriptions: z8.array(z8.object({ text: z8.string().min(1).max(90) })).min(2).max(5),
4197
+ finalUrls: z8.array(httpsUrlSchema2).min(1),
4198
+ imageAssets: z8.array(refSchema).optional(),
4199
+ logoAssets: z8.array(refSchema).optional()
4200
+ });
4201
+ var callAdSchema = z8.object({
4202
+ format: z8.literal("call"),
4203
+ countryCode: z8.string().length(2),
4204
+ phoneNumber: z8.string().min(3),
4205
+ headline1: z8.string().min(1).max(30),
4206
+ headline2: z8.string().min(1).max(30),
4207
+ description1: z8.string().min(1).max(90),
4208
+ description2: z8.string().min(1).max(90),
4209
+ businessName: z8.string().min(1).max(25),
4210
+ finalUrls: z8.array(httpsUrlSchema2).min(1)
4211
+ });
4212
+ var appAdSchema = z8.object({
4213
+ format: z8.literal("app"),
4214
+ headlines: z8.array(z8.object({ text: z8.string().min(1).max(30) })).min(1),
4215
+ descriptions: z8.array(z8.object({ text: z8.string().min(1).max(90) })).min(1)
4216
+ });
4217
+ var videoAdSchema = z8.object({
4218
+ format: z8.literal("video"),
4219
+ youtubeVideoId: z8.string().min(1),
4220
+ finalUrls: z8.array(httpsUrlSchema2).min(1)
4221
+ });
4222
+ var demandGenAdSchema = z8.object({
4223
+ format: z8.literal("demandGen"),
4224
+ headlines: z8.array(z8.object({ text: z8.string().min(1).max(40) })).min(1).max(5),
4225
+ descriptions: z8.array(z8.object({ text: z8.string().min(1).max(90) })).min(1).max(5),
4226
+ businessName: z8.string().min(1).max(25),
4227
+ finalUrls: z8.array(httpsUrlSchema2).min(1),
4228
+ imageAssets: z8.array(refSchema).optional()
4229
+ });
4230
+ var adContentSchema = z8.discriminatedUnion("format", [
4231
+ responsiveSearchAdSchema,
4232
+ responsiveDisplayAdSchema,
4233
+ performanceMaxAssetGroupSchema,
4234
+ callAdSchema,
4235
+ appAdSchema,
4236
+ videoAdSchema,
4237
+ demandGenAdSchema
4238
+ ]);
4239
+ var adCreateSchema = z8.object({
4240
+ adGroup: refSchema,
4241
+ status: stageableStatusSchema2.default("PAUSED"),
4242
+ content: adContentSchema
4243
+ });
4244
+ var adUpdateSchema = z8.object({
4245
+ status: z8.enum(["ENABLED", "PAUSED", "REMOVED"]).optional(),
4246
+ /** Whole-content replacement for RSA-like formats; re-validated against adContentSchema. */
4247
+ content: z8.record(z8.string(), z8.unknown()).optional()
4248
+ }).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
4249
+ var textAssetSchema = z8.object({ type: z8.literal("text"), text: z8.string().min(1) });
4250
+ var imageAssetSchema = z8.object({
4251
+ type: z8.literal("image"),
4252
+ imageId: z8.string().min(1),
4253
+ name: z8.string().optional()
4254
+ });
4255
+ var youtubeVideoAssetSchema = z8.object({
4256
+ type: z8.literal("youtubeVideo"),
4257
+ youtubeVideoId: z8.string().min(1),
4258
+ name: z8.string().optional()
4259
+ });
4260
+ var sitelinkAssetSchema = z8.object({
4261
+ type: z8.literal("sitelink"),
4262
+ linkText: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.sitelinkLinkTextMax),
4263
+ description1: z8.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
4264
+ description2: z8.string().max(GOOGLE_ADS_LIMITS.asset.sitelinkDescriptionMax).optional(),
4265
+ finalUrls: z8.array(httpsUrlSchema2).min(1)
4266
+ });
4267
+ var calloutAssetSchema = z8.object({
4268
+ type: z8.literal("callout"),
4269
+ calloutText: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.calloutTextMax)
4270
+ });
4271
+ var structuredSnippetAssetSchema = z8.object({
4272
+ type: z8.literal("structuredSnippet"),
4273
+ header: z8.string().min(1).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetHeaderMax),
4274
+ values: z8.array(z8.string().min(1)).min(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMin).max(GOOGLE_ADS_LIMITS.asset.structuredSnippetValuesMax)
4275
+ });
4276
+ var callToActionAssetSchema = z8.object({ type: z8.literal("callToAction"), callToAction: z8.string().min(1) });
4277
+ var assetCreateSchema = z8.discriminatedUnion("type", [
4278
+ textAssetSchema,
4279
+ imageAssetSchema,
4280
+ youtubeVideoAssetSchema,
4281
+ sitelinkAssetSchema,
4282
+ calloutAssetSchema,
4283
+ structuredSnippetAssetSchema,
4284
+ callToActionAssetSchema
4285
+ ]);
4286
+ var assetLinkAttachSchema = z8.object({
4287
+ level: z8.enum(["campaign", "adGroup", "customer"]),
4288
+ parent: refSchema.optional(),
4289
+ asset: refSchema,
4290
+ fieldType: z8.enum(ASSET_FIELD_TYPES)
4291
+ });
4292
+ var audienceCreateSchema2 = z8.object({
4293
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.audience.nameMax),
4294
+ type: z8.enum(USER_LIST_TYPES).default("BASIC"),
4295
+ description: z8.string().optional(),
4296
+ /** Customer-match members (crm-based) — file-first for large lists. */
4297
+ members: z8.array(z8.record(z8.string(), z8.string())).optional(),
4298
+ sourceFileRef: z8.string().optional()
4299
+ });
4300
+ var audienceCriterionAttachSchema = z8.object({
4301
+ level: z8.enum(["campaign", "adGroup"]),
4302
+ parent: refSchema,
4303
+ userList: refSchema,
4304
+ negative: z8.boolean().default(false)
4305
+ });
4306
+ var conversionActionCreateSchema = z8.object({
4307
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.conversionAction.nameMax),
4308
+ type: z8.enum(CONVERSION_ACTION_TYPES).default("WEBPAGE"),
4309
+ category: z8.enum(CONVERSION_ACTION_CATEGORIES).default("DEFAULT"),
4310
+ countingType: z8.enum(CONVERSION_COUNTING_TYPES).default("ONE_PER_CLICK"),
4311
+ defaultValueMicros: microsSchema.optional(),
4312
+ defaultCurrencyCode: z8.string().length(3).optional(),
4313
+ clickThroughLookbackWindowDays: z8.number().int().positive().optional(),
4314
+ viewThroughLookbackWindowDays: z8.number().int().positive().optional(),
4315
+ status: z8.enum(["ENABLED", "PAUSED"]).default("ENABLED")
4316
+ });
4317
+ var conversionActionUpdateSchema = z8.object({
4318
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.conversionAction.nameMax).optional(),
4319
+ category: z8.enum(CONVERSION_ACTION_CATEGORIES).optional(),
4320
+ countingType: z8.enum(CONVERSION_COUNTING_TYPES).optional(),
4321
+ defaultValueMicros: microsSchema.optional(),
4322
+ status: z8.enum(["ENABLED", "REMOVED", "HIDDEN"]).optional()
4323
+ }).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
4324
+ var biddingStrategyCreateSchema = z8.object({
4325
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.biddingStrategy.nameMax),
4326
+ config: biddingConfigSchema
4327
+ }).superRefine((p, ctx) => {
4328
+ if (p.config.type === "MANUAL_CPC") {
4329
+ ctx.addIssue({ code: "custom", path: ["config", "type"], message: "portfolio strategies cannot be Manual CPC" });
4330
+ }
4331
+ });
4332
+ var biddingStrategyUpdateSchema = z8.object({
4333
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.biddingStrategy.nameMax).optional(),
4334
+ config: biddingConfigSchema.optional()
4335
+ }).refine((p) => Object.values(p).some((v) => v !== void 0), "update needs at least one field");
4336
+ var labelCreateSchema = z8.object({
4337
+ name: z8.string().min(1).max(GOOGLE_ADS_LIMITS.label.nameMax),
4338
+ backgroundColor: z8.string().regex(/^#[0-9A-Fa-f]{6}$/).optional(),
4339
+ description: z8.string().optional()
4340
+ });
4341
+ var labelAttachSchema = z8.object({
4342
+ level: z8.enum(["campaign", "adGroup", "ad"]),
4343
+ parent: refSchema,
4344
+ label: refSchema
4345
+ });
4346
+ var locationCriterionSchema = z8.object({
4347
+ criterionType: z8.literal("location"),
4348
+ geoTargetConstant: z8.union([z8.string().regex(GEO_TARGET_CONSTANT_REGEX), z8.string().regex(NUMERIC_ID_REGEX2)])
4349
+ });
4350
+ var languageCriterionSchema = z8.object({
4351
+ criterionType: z8.literal("language"),
4352
+ languageConstant: z8.union([z8.string().regex(LANGUAGE_CONSTANT_REGEX), z8.string().regex(NUMERIC_ID_REGEX2)])
4353
+ });
4354
+ var adScheduleCriterionSchema = z8.object({
4355
+ criterionType: z8.literal("adSchedule"),
4356
+ dayOfWeek: z8.enum(DAYS_OF_WEEK),
4357
+ startHour: z8.number().int().min(0).max(23),
4358
+ startMinute: z8.enum(["ZERO", "FIFTEEN", "THIRTY", "FORTY_FIVE"]).default("ZERO"),
4359
+ endHour: z8.number().int().min(0).max(24),
4360
+ endMinute: z8.enum(["ZERO", "FIFTEEN", "THIRTY", "FORTY_FIVE"]).default("ZERO")
4361
+ });
4362
+ var deviceCriterionSchema = z8.object({
4363
+ criterionType: z8.literal("device"),
4364
+ device: z8.enum(DEVICE_TYPES),
4365
+ bidModifier: z8.number().min(0.1).max(10).optional()
4366
+ });
4367
+ var campaignCriterionAddSchema = z8.object({
4368
+ campaign: refSchema,
4369
+ negative: z8.boolean().default(false),
4370
+ criterion: z8.discriminatedUnion("criterionType", [
4371
+ locationCriterionSchema,
4372
+ languageCriterionSchema,
4373
+ adScheduleCriterionSchema,
4374
+ deviceCriterionSchema
4375
+ ])
4376
+ });
4377
+ var GOOGLE_DRAFT_OP_KINDS = [
4378
+ "google.budget.create",
4379
+ "google.budget.update",
4380
+ "google.campaign.create",
4381
+ "google.campaign.update",
4382
+ "google.campaign.pause",
4383
+ "google.campaign.resume",
4384
+ "google.campaign.remove",
4385
+ "google.adGroup.create",
4386
+ "google.adGroup.update",
4387
+ "google.adGroup.pause",
4388
+ "google.adGroup.resume",
4389
+ "google.adGroup.remove",
4390
+ "google.keyword.add",
4391
+ "google.keyword.update",
4392
+ "google.keyword.remove",
4393
+ "google.negativeKeyword.add",
4394
+ "google.negativeKeyword.remove",
4395
+ "google.sharedSet.create",
4396
+ "google.sharedSetMember.add",
4397
+ "google.sharedSetMember.remove",
4398
+ "google.campaignSharedSet.attach",
4399
+ "google.campaignSharedSet.detach",
4400
+ "google.ad.create",
4401
+ "google.ad.update",
4402
+ "google.ad.pause",
4403
+ "google.ad.resume",
4404
+ "google.ad.remove",
4405
+ "google.asset.create",
4406
+ "google.assetLink.attach",
4407
+ "google.assetLink.detach",
4408
+ "google.audience.create",
4409
+ "google.audienceCriterion.attach",
4410
+ "google.audienceCriterion.detach",
4411
+ "google.conversionAction.create",
4412
+ "google.conversionAction.update",
4413
+ "google.biddingStrategy.create",
4414
+ "google.biddingStrategy.update",
4415
+ "google.label.create",
4416
+ "google.label.attach",
4417
+ "google.campaignCriterion.add",
4418
+ "google.campaignCriterion.remove"
4419
+ ];
4420
+ var googleDraftOpKindSchema = z8.enum(GOOGLE_DRAFT_OP_KINDS);
4421
+ function createOp2(kind, payload) {
4422
+ return z8.object({ kind: z8.literal(kind), customerId: customerIdSchema, payload });
4423
+ }
4424
+ function updateOp2(kind, payload) {
4425
+ return z8.object({ kind: z8.literal(kind), customerId: customerIdSchema, target: targetRefSchema, payload });
4426
+ }
4427
+ function targetOp(kind) {
4428
+ return z8.object({ kind: z8.literal(kind), customerId: customerIdSchema, target: targetRefSchema });
4429
+ }
4430
+ var googleDraftOpInputSchema = z8.discriminatedUnion("kind", [
4431
+ createOp2("google.budget.create", budgetCreateSchema),
4432
+ updateOp2("google.budget.update", budgetUpdateSchema),
4433
+ createOp2("google.campaign.create", campaignCreateSchema2),
4434
+ updateOp2("google.campaign.update", campaignUpdateSchema2),
4435
+ targetOp("google.campaign.pause"),
4436
+ targetOp("google.campaign.resume"),
4437
+ targetOp("google.campaign.remove"),
4438
+ createOp2("google.adGroup.create", adGroupCreateSchema),
4439
+ updateOp2("google.adGroup.update", adGroupUpdateSchema),
4440
+ targetOp("google.adGroup.pause"),
4441
+ targetOp("google.adGroup.resume"),
4442
+ targetOp("google.adGroup.remove"),
4443
+ createOp2("google.keyword.add", keywordAddSchema),
4444
+ updateOp2("google.keyword.update", keywordUpdateSchema),
4445
+ targetOp("google.keyword.remove"),
4446
+ createOp2("google.negativeKeyword.add", negativeKeywordAddSchema),
4447
+ targetOp("google.negativeKeyword.remove"),
4448
+ createOp2("google.sharedSet.create", sharedSetCreateSchema),
4449
+ createOp2("google.sharedSetMember.add", sharedSetMemberAddSchema),
4450
+ targetOp("google.sharedSetMember.remove"),
4451
+ createOp2("google.campaignSharedSet.attach", campaignSharedSetAttachSchema),
4452
+ targetOp("google.campaignSharedSet.detach"),
4453
+ createOp2("google.ad.create", adCreateSchema),
4454
+ updateOp2("google.ad.update", adUpdateSchema),
4455
+ targetOp("google.ad.pause"),
4456
+ targetOp("google.ad.resume"),
4457
+ targetOp("google.ad.remove"),
4458
+ createOp2("google.asset.create", assetCreateSchema),
4459
+ createOp2("google.assetLink.attach", assetLinkAttachSchema),
4460
+ targetOp("google.assetLink.detach"),
4461
+ createOp2("google.audience.create", audienceCreateSchema2),
4462
+ createOp2("google.audienceCriterion.attach", audienceCriterionAttachSchema),
4463
+ targetOp("google.audienceCriterion.detach"),
4464
+ createOp2("google.conversionAction.create", conversionActionCreateSchema),
4465
+ updateOp2("google.conversionAction.update", conversionActionUpdateSchema),
4466
+ createOp2("google.biddingStrategy.create", biddingStrategyCreateSchema),
4467
+ updateOp2("google.biddingStrategy.update", biddingStrategyUpdateSchema),
4468
+ createOp2("google.label.create", labelCreateSchema),
4469
+ createOp2("google.label.attach", labelAttachSchema),
4470
+ createOp2("google.campaignCriterion.add", campaignCriterionAddSchema),
4471
+ targetOp("google.campaignCriterion.remove")
4472
+ ]);
4473
+
4474
+ // ../api/src/ads-google/wire.ts
4475
+ import { z as z9 } from "zod";
4476
+ var googleWriteModeSchema = z9.enum(["live", "simulated"]);
4477
+ var googleDraftOpResultSchema = z9.object({
4478
+ status: z9.enum(["applied", "simulated", "failed", "skipped"]),
4479
+ resourceName: z9.string().optional(),
4480
+ error: z9.string().optional(),
4481
+ skippedBecause: z9.string().optional(),
4482
+ executedAt: z9.number().optional()
4483
+ });
4484
+ var googleDraftStageRequestSchema = z9.object({
4485
+ chatId: z9.string(),
4486
+ op: googleDraftOpInputSchema
4487
+ });
4488
+ var googleDraftStageResponseSchema = z9.object({
4489
+ staged: z9.literal(true),
4490
+ ref: z9.string(),
4491
+ kind: googleDraftOpKindSchema,
4492
+ mode: googleWriteModeSchema,
4493
+ dependsOn: z9.array(z9.string()),
4494
+ summary: z9.string(),
4495
+ warnings: z9.array(z9.string()),
4496
+ /** True when the op amended an already-staged op in place instead of appending a new one. */
4497
+ amended: z9.boolean().optional()
4498
+ });
4499
+ var googleDraftOpViewSchema = z9.object({
4500
+ ref: z9.string(),
4501
+ kind: googleDraftOpKindSchema,
4502
+ customerId: z9.string(),
4503
+ target: z9.string().optional(),
4504
+ dependsOn: z9.array(z9.string()),
4505
+ summary: z9.string(),
4506
+ stagedAt: z9.number(),
4507
+ result: googleDraftOpResultSchema.optional()
4508
+ });
4509
+ var googleDraftListRequestSchema = z9.object({
4510
+ chatId: z9.string()
4511
+ });
4512
+ var googleDraftListResponseSchema = z9.object({
4513
+ status: z9.enum(["active", "publishing", "applied", "discarded", "none"]),
4514
+ mode: googleWriteModeSchema,
4515
+ count: z9.number(),
4516
+ ops: z9.array(googleDraftOpViewSchema)
4517
+ });
4518
+ var googleDraftRemoveRequestSchema = z9.object({
4519
+ chatId: z9.string(),
4520
+ ref: z9.string()
4521
+ });
4522
+ var googleDraftRemoveResponseSchema = z9.object({
4523
+ /** The requested ref plus any dependents removed by cascade. */
4524
+ removed: z9.array(z9.string())
4525
+ });
4526
+ var googleDraftClearRequestSchema = z9.object({
4527
+ chatId: z9.string()
4528
+ });
4529
+ var googleDraftClearResponseSchema = z9.object({
4530
+ cleared: z9.number()
4531
+ });
4532
+ var googleFieldErrorSchema = z9.object({
4533
+ path: z9.string(),
4534
+ message: z9.string()
4535
+ });
4536
+ var googleDraftErrorResponseSchema = z9.object({
4537
+ code: z9.string(),
4538
+ error: z9.string(),
4539
+ fields: z9.array(googleFieldErrorSchema).optional()
4540
+ });
4541
+
4542
+ // src/commands/ads/google/write-shared.ts
4543
+ function failWriteValidation(message) {
4544
+ writeJsonEnvelope({ ok: false, error: { code: "VALIDATION_ERROR", message } });
4545
+ process.exit(1);
4546
+ }
4547
+ function requireCustomerId(args) {
4548
+ const raw = args["customer-id"] ?? args.customerId;
4549
+ if (!raw || !/^\d{10}$/.test(raw)) {
4550
+ failWriteValidation("pass --customer-id as the 10-digit Google Ads customer id (no dashes)");
4551
+ }
4552
+ return raw;
4553
+ }
4554
+ function requireTarget(args, entity) {
4555
+ const positional = Array.isArray(args._) ? args._[0] : void 0;
4556
+ const target = args.id ?? args.target ?? positional;
4557
+ if (typeof target !== "string" || target.length === 0) {
4558
+ failWriteValidation(`pass the ${entity} resource name or id as the positional argument`);
4559
+ }
4560
+ return target;
4561
+ }
4562
+ function requireStringFlag(value, flag) {
4563
+ if (typeof value !== "string" || value.length === 0) {
4564
+ failWriteValidation(`${flag} is required`);
4565
+ }
4566
+ return value;
4567
+ }
4568
+ function microsFlag(value, flag) {
4569
+ if (value === void 0 || value === null || value === "") {
4570
+ return void 0;
4571
+ }
4572
+ const num = Number(value);
4573
+ if (Number.isNaN(num) || num <= 0) {
4574
+ failWriteValidation(`${flag} must be a positive amount (major currency units, e.g. 50 or 50.00)`);
4575
+ }
4576
+ return toMicros(num);
4577
+ }
4578
+ function listFlag(value) {
4579
+ if (typeof value !== "string" || value.length === 0) {
4580
+ return void 0;
4581
+ }
4582
+ const items = value.split(",").map((v) => v.trim()).filter(Boolean);
4583
+ return items.length > 0 ? items : void 0;
4584
+ }
4585
+ function loadJsonFileArg(path11) {
4586
+ if (typeof path11 !== "string" || path11.length === 0) {
4587
+ return {};
4588
+ }
4589
+ try {
4590
+ const parsed = JSON.parse(readFileSync3(path11, "utf8"));
4591
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
4592
+ failWriteValidation(`${path11} must contain a JSON object`);
4593
+ }
4594
+ return parsed;
4595
+ } catch (err) {
4596
+ if (err instanceof SyntaxError) {
4597
+ failWriteValidation(`${path11} is not valid JSON: ${err.message}`);
4598
+ }
4599
+ throw err;
4600
+ }
4601
+ }
4602
+ function mergePayload(file, flags) {
4603
+ const merged = { ...file };
4604
+ for (const [key, value] of Object.entries(flags)) {
4605
+ if (value !== void 0) {
4606
+ merged[key] = value;
4607
+ }
4608
+ }
4609
+ return merged;
4610
+ }
4611
+ function handleGoogleError(err) {
4612
+ if (err instanceof ApiError) {
4613
+ writeJsonEnvelope({ ok: false, error: { code: err.code ?? "API_ERROR", message: err.message } });
4614
+ process.exit(1);
4615
+ }
4616
+ writeJsonEnvelope({
4617
+ ok: false,
4618
+ error: { code: "UNKNOWN", message: err instanceof Error ? err.message : String(err) }
4619
+ });
4620
+ process.exit(1);
4621
+ }
4622
+ async function stageGoogleOp(raw) {
4623
+ const preflight = googleDraftOpInputSchema.safeParse(raw);
4624
+ if (!preflight.success) {
4625
+ const fields = preflight.error.issues.map((issue) => ({ path: issue.path.join("."), message: issue.message }));
4626
+ writeJsonEnvelope({
4627
+ ok: false,
4628
+ error: {
4629
+ code: "VALIDATION_ERROR",
4630
+ message: fields.map((f) => f.path ? `${f.path}: ${f.message}` : f.message).join("; "),
4631
+ fields
4632
+ }
4633
+ });
4634
+ process.exit(1);
4635
+ }
4636
+ try {
4637
+ const chatId = requireChatId();
4638
+ const response = await apiPost("/api/ads/google/draft/stage", { chatId, op: preflight.data });
4639
+ writeJsonEnvelope(response);
4640
+ } catch (err) {
4641
+ handleGoogleError(err);
4642
+ }
4643
+ }
4644
+ async function stageCreate(kind, customerId, payload) {
4645
+ await stageGoogleOp({ kind, customerId, payload });
4646
+ }
4647
+ async function stageUpdate(kind, customerId, target, payload) {
4648
+ await stageGoogleOp({ kind, customerId, target, payload });
4649
+ }
4650
+ async function stageTarget(kind, customerId, target) {
4651
+ await stageGoogleOp({ kind, customerId, target });
4652
+ }
4653
+ async function draftAction(path11, body) {
4654
+ try {
4655
+ const chatId = requireChatId();
4656
+ const response = await apiPost(path11, { chatId, ...body });
4657
+ writeJsonEnvelope(response);
4658
+ } catch (err) {
4659
+ handleGoogleError(err);
4660
+ }
4661
+ }
4662
+
4663
+ // src/commands/ads/google/draft.ts
4664
+ var draftCommand2 = defineCommand22({
4665
+ meta: { name: "draft", description: "List, remove, or clear staged Google Ads write ops for this chat" },
4666
+ subCommands: {
4667
+ list: defineCommand22({
4668
+ meta: { name: "list", description: "List staged ops (with lineage, mode, and results)" },
4669
+ run: async () => {
4670
+ await draftAction("/api/ads/google/draft", {});
4671
+ }
4672
+ }),
4673
+ remove: defineCommand22({
4674
+ meta: { name: "remove", description: "Remove one staged op (cascades to dependents)" },
4675
+ args: { ref: { type: "positional", description: "Staged op ref (g_temp_* or target)", required: false } },
4676
+ run: async ({ args }) => {
4677
+ await draftAction("/api/ads/google/draft/remove", { ref: requireTarget(args, "op") });
4678
+ }
4679
+ }),
4680
+ clear: defineCommand22({
4681
+ meta: { name: "clear", description: "Discard all staged ops on this chat" },
4682
+ run: async () => {
4683
+ await draftAction("/api/ads/google/draft/clear", {});
4684
+ }
4685
+ })
4686
+ }
4687
+ });
4688
+
3835
4689
  // src/commands/ads/google/keywords/index.ts
3836
- import { defineCommand as defineCommand26 } from "citty";
4690
+ import { defineCommand as defineCommand27 } from "citty";
3837
4691
 
3838
4692
  // src/commands/ads/google/keywords/discover.ts
3839
- import { defineCommand as defineCommand22 } from "citty";
4693
+ import { defineCommand as defineCommand23 } from "citty";
3840
4694
 
3841
4695
  // src/geo-context.ts
3842
4696
  var GOOGLE_ADS_LOCATIONS = [
@@ -4111,7 +4965,7 @@ function handleKeywordError(err) {
4111
4965
  writeAdsJson({ ok: false, error: { code: "NETWORK_ERROR", message: "Unexpected error" } });
4112
4966
  process.exit(1);
4113
4967
  }
4114
- var discoverCommand = defineCommand22({
4968
+ var discoverCommand = defineCommand23({
4115
4969
  meta: {
4116
4970
  name: "discover",
4117
4971
  description: `Discover new keyword ideas from seed keywords or competitor URLs.
@@ -4173,7 +5027,7 @@ Examples:
4173
5027
  });
4174
5028
 
4175
5029
  // src/commands/ads/google/keywords/languages.ts
4176
- import { defineCommand as defineCommand23 } from "citty";
5030
+ import { defineCommand as defineCommand24 } from "citty";
4177
5031
  registerSchema({
4178
5032
  command: "ads.google.keywords.languages",
4179
5033
  description: "List all supported language IDs for --language flag in Google Ads keyword commands.",
@@ -4183,7 +5037,7 @@ var FIELDS = {
4183
5037
  id: "Language ID to pass as --language",
4184
5038
  name: "Language name"
4185
5039
  };
4186
- var languagesCommand = defineCommand23({
5040
+ var languagesCommand = defineCommand24({
4187
5041
  meta: {
4188
5042
  name: "languages",
4189
5043
  description: "List all supported language IDs for --language flag."
@@ -4194,7 +5048,7 @@ var languagesCommand = defineCommand23({
4194
5048
  });
4195
5049
 
4196
5050
  // src/commands/ads/google/keywords/locations.ts
4197
- import { defineCommand as defineCommand24 } from "citty";
5051
+ import { defineCommand as defineCommand25 } from "citty";
4198
5052
  registerSchema({
4199
5053
  command: "ads.google.keywords.locations",
4200
5054
  description: "List all supported geo target IDs for --location flag in Google Ads keyword commands.",
@@ -4204,7 +5058,7 @@ var FIELDS2 = {
4204
5058
  id: "Geo target ID to pass as --location",
4205
5059
  name: "Country/region name"
4206
5060
  };
4207
- var locationsCommand = defineCommand24({
5061
+ var locationsCommand = defineCommand25({
4208
5062
  meta: {
4209
5063
  name: "locations",
4210
5064
  description: "List all supported geo target IDs for --location flag."
@@ -4215,7 +5069,7 @@ var locationsCommand = defineCommand24({
4215
5069
  });
4216
5070
 
4217
5071
  // src/commands/ads/google/keywords/metrics.ts
4218
- import { defineCommand as defineCommand25 } from "citty";
5072
+ import { defineCommand as defineCommand26 } from "citty";
4219
5073
  registerSchema({
4220
5074
  command: "ads.google.keywords.metrics",
4221
5075
  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.",
@@ -4239,7 +5093,7 @@ registerSchema({
4239
5093
  output: { type: "string", description: "Format: json|csv|jsonl|md", required: false, default: "json" }
4240
5094
  }
4241
5095
  });
4242
- var metricsCommand = defineCommand25({
5096
+ var metricsCommand = defineCommand26({
4243
5097
  meta: {
4244
5098
  name: "metrics",
4245
5099
  description: `Get historical search metrics for specific keywords.
@@ -4326,7 +5180,7 @@ Examples:
4326
5180
  });
4327
5181
 
4328
5182
  // src/commands/ads/google/keywords/index.ts
4329
- var keywordsCommand = defineCommand26({
5183
+ var keywordsCommand = defineCommand27({
4330
5184
  meta: {
4331
5185
  name: "keywords",
4332
5186
  description: `Keyword research tools. Subcommands: discover, metrics, locations, languages.
@@ -4346,8 +5200,8 @@ Examples:
4346
5200
  });
4347
5201
 
4348
5202
  // src/commands/ads/google/library/index.ts
4349
- import { defineCommand as defineCommand27 } from "citty";
4350
- var listAdvertisers = defineCommand27({
5203
+ import { defineCommand as defineCommand28 } from "citty";
5204
+ var listAdvertisers = defineCommand28({
4351
5205
  meta: {
4352
5206
  name: "list-advertisers",
4353
5207
  description: "List tracked Google advertisers and their accounts"
@@ -4364,7 +5218,7 @@ var listAdvertisers = defineCommand27({
4364
5218
  }
4365
5219
  }
4366
5220
  });
4367
- var syncStatus = defineCommand27({
5221
+ var syncStatus = defineCommand28({
4368
5222
  meta: {
4369
5223
  name: "sync-status",
4370
5224
  description: "Check the sync status and ad counts of a Google account"
@@ -4384,7 +5238,7 @@ var syncStatus = defineCommand27({
4384
5238
  writeAdsJson({ ok: true, data });
4385
5239
  }
4386
5240
  });
4387
- var searchAds = defineCommand27({
5241
+ var searchAds = defineCommand28({
4388
5242
  meta: {
4389
5243
  name: "search-ads",
4390
5244
  description: "Search and filter Google ads for an account"
@@ -4441,7 +5295,7 @@ var searchAds = defineCommand27({
4441
5295
  }
4442
5296
  }
4443
5297
  });
4444
- var searchAdvertiser = defineCommand27({
5298
+ var searchAdvertiser = defineCommand28({
4445
5299
  meta: {
4446
5300
  name: "search-advertiser",
4447
5301
  description: "Search for an advertiser on the Google Ads Transparency Center"
@@ -4476,7 +5330,7 @@ var searchAdvertiser = defineCommand27({
4476
5330
  function sleep(ms) {
4477
5331
  return new Promise((resolve5) => setTimeout(resolve5, ms));
4478
5332
  }
4479
- var track = defineCommand27({
5333
+ var track = defineCommand28({
4480
5334
  meta: {
4481
5335
  name: "track",
4482
5336
  description: "Track a new Google advertiser (from search results). Waits for initial sync to complete before returning."
@@ -4534,7 +5388,7 @@ var track = defineCommand27({
4534
5388
  process.exit(1);
4535
5389
  }
4536
5390
  });
4537
- var sync = defineCommand27({
5391
+ var sync = defineCommand28({
4538
5392
  meta: {
4539
5393
  name: "sync",
4540
5394
  description: "Trigger an immediate sync for a Google account. Waits for completion before returning."
@@ -4578,7 +5432,7 @@ var sync = defineCommand27({
4578
5432
  process.exit(1);
4579
5433
  }
4580
5434
  });
4581
- var searchCompetitors = defineCommand27({
5435
+ var searchCompetitors = defineCommand28({
4582
5436
  meta: {
4583
5437
  name: "search-competitors",
4584
5438
  description: "Search for competitors running Google ads for a keyword (DataForSEO)"
@@ -4610,7 +5464,7 @@ var searchCompetitors = defineCommand27({
4610
5464
  }
4611
5465
  }
4612
5466
  });
4613
- var library = defineCommand27({
5467
+ var library = defineCommand28({
4614
5468
  meta: {
4615
5469
  name: "library",
4616
5470
  description: "Manage and search the Google Ads Library"
@@ -4627,9 +5481,9 @@ var library = defineCommand27({
4627
5481
  });
4628
5482
 
4629
5483
  // src/commands/ads/google/query.ts
4630
- import { appendFileSync, existsSync as existsSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
5484
+ import { appendFileSync, existsSync as existsSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
4631
5485
  import { resolve } from "path";
4632
- import { defineCommand as defineCommand28 } from "citty";
5486
+ import { defineCommand as defineCommand29 } from "citty";
4633
5487
 
4634
5488
  // src/commands/ads/google/preflight.ts
4635
5489
  function buildCommand2(query, customerId) {
@@ -4921,7 +5775,7 @@ function writeRowsToFile(filePath, rows, fields, append) {
4921
5775
  `, "utf-8");
4922
5776
  }
4923
5777
  } else if (append && existsSync3(filePath)) {
4924
- const existing = JSON.parse(readFileSync3(filePath, "utf-8"));
5778
+ const existing = JSON.parse(readFileSync4(filePath, "utf-8"));
4925
5779
  writeFileSync2(filePath, JSON.stringify([...existing, ...rows], null, 2), "utf-8");
4926
5780
  } else {
4927
5781
  writeFileSync2(filePath, JSON.stringify(rows, null, 2), "utf-8");
@@ -5085,7 +5939,7 @@ function handleQueryError(err, finalQuery, customerId) {
5085
5939
  });
5086
5940
  process.exit(1);
5087
5941
  }
5088
- var queryCommand = defineCommand28({
5942
+ var queryCommand = defineCommand29({
5089
5943
  meta: {
5090
5944
  name: "query",
5091
5945
  description: `Run GAQL queries against Google Ads. Supports raw GAQL, presets, pagination, file export, and caching.
@@ -5142,8 +5996,516 @@ Examples:
5142
5996
  }
5143
5997
  });
5144
5998
 
5999
+ // src/commands/ads/google/write-commands.ts
6000
+ import { defineCommand as defineCommand30 } from "citty";
6001
+ var customerIdArg = { "customer-id": { type: "string", description: "10-digit Google Ads customer id" } };
6002
+ var fileArg = {
6003
+ file: { type: "string", description: "JSON file with the full op payload (flags override)" }
6004
+ };
6005
+ var budgetsCommand = defineCommand30({
6006
+ meta: { name: "budgets", description: "Stage campaign budget create/update" },
6007
+ subCommands: {
6008
+ create: defineCommand30({
6009
+ meta: { name: "create", description: "Stage a campaign budget" },
6010
+ args: {
6011
+ ...customerIdArg,
6012
+ ...fileArg,
6013
+ name: { type: "string", description: "Budget name" },
6014
+ amount: { type: "string", description: "Daily amount in major currency units (e.g. 50)" },
6015
+ delivery: { type: "string", description: "STANDARD | ACCELERATED" },
6016
+ shared: { type: "boolean", description: "Explicitly shared budget" }
6017
+ },
6018
+ run: async ({ args }) => {
6019
+ const customerId = requireCustomerId(args);
6020
+ const payload = mergePayload(loadJsonFileArg(args.file), {
6021
+ name: args.name,
6022
+ amountMicros: microsFlag(args.amount, "--amount"),
6023
+ deliveryMethod: args.delivery,
6024
+ explicitlyShared: args.shared || void 0
6025
+ });
6026
+ await stageCreate("google.budget.create", customerId, payload);
6027
+ }
6028
+ }),
6029
+ update: defineCommand30({
6030
+ meta: { name: "update", description: "Stage a budget update" },
6031
+ args: {
6032
+ ...customerIdArg,
6033
+ ...fileArg,
6034
+ name: { type: "string" },
6035
+ amount: { type: "string", description: "New daily amount in major currency units" },
6036
+ delivery: { type: "string" }
6037
+ },
6038
+ run: async ({ args }) => {
6039
+ const customerId = requireCustomerId(args);
6040
+ const target = requireTarget(args, "budget");
6041
+ const payload = mergePayload(loadJsonFileArg(args.file), {
6042
+ name: args.name,
6043
+ amountMicros: microsFlag(args.amount, "--amount"),
6044
+ deliveryMethod: args.delivery
6045
+ });
6046
+ await stageUpdate("google.budget.update", customerId, target, payload);
6047
+ }
6048
+ })
6049
+ }
6050
+ });
6051
+ function biddingFromFlags(args) {
6052
+ const type = args["bidding-strategy"];
6053
+ if (!type) {
6054
+ return void 0;
6055
+ }
6056
+ return {
6057
+ type,
6058
+ targetCpaMicros: microsFlag(args["target-cpa"], "--target-cpa"),
6059
+ targetRoas: args["target-roas"] !== void 0 ? Number(args["target-roas"]) : void 0
6060
+ };
6061
+ }
6062
+ var campaignsCommand = defineCommand30({
6063
+ meta: { name: "campaigns", description: "Stage campaign create/update/pause/resume/remove" },
6064
+ subCommands: {
6065
+ create: defineCommand30({
6066
+ meta: { name: "create", description: "Stage a campaign" },
6067
+ args: {
6068
+ ...customerIdArg,
6069
+ ...fileArg,
6070
+ name: { type: "string" },
6071
+ "channel-type": {
6072
+ type: "string",
6073
+ description: "SEARCH | DISPLAY | SHOPPING | VIDEO | PERFORMANCE_MAX | DEMAND_GEN | \u2026"
6074
+ },
6075
+ "sub-type": { type: "string", description: "Advertising channel sub-type" },
6076
+ "budget-ref": { type: "string", description: "Budget ref (g_temp_*, id, or resource name)" },
6077
+ "bidding-strategy": {
6078
+ type: "string",
6079
+ description: "MANUAL_CPC | MAXIMIZE_CONVERSIONS | TARGET_CPA | TARGET_ROAS | \u2026"
6080
+ },
6081
+ "target-cpa": { type: "string", description: "Target CPA (major units) for TARGET_CPA" },
6082
+ "target-roas": { type: "string", description: "Target ROAS (e.g. 4.0) for TARGET_ROAS" },
6083
+ objective: { type: "string", description: "Advisory UI objective (SALES, LEADS, \u2026)" },
6084
+ "start-date": { type: "string", description: "YYYY-MM-DD" },
6085
+ "end-date": { type: "string", description: "YYYY-MM-DD" },
6086
+ status: { type: "string", description: "ENABLED | PAUSED (default PAUSED)" }
6087
+ },
6088
+ run: async ({ args }) => {
6089
+ const customerId = requireCustomerId(args);
6090
+ const payload = mergePayload(loadJsonFileArg(args.file), {
6091
+ name: args.name,
6092
+ channelType: args["channel-type"],
6093
+ channelSubType: args["sub-type"],
6094
+ budget: args["budget-ref"],
6095
+ bidding: biddingFromFlags(args),
6096
+ objective: args.objective,
6097
+ startDate: args["start-date"],
6098
+ endDate: args["end-date"],
6099
+ status: args.status
6100
+ });
6101
+ await stageCreate("google.campaign.create", customerId, payload);
6102
+ }
6103
+ }),
6104
+ update: defineCommand30({
6105
+ meta: { name: "update", description: "Stage a campaign update" },
6106
+ args: {
6107
+ ...customerIdArg,
6108
+ ...fileArg,
6109
+ name: { type: "string" },
6110
+ "budget-ref": { type: "string" },
6111
+ "bidding-strategy": { type: "string" },
6112
+ "target-cpa": { type: "string" },
6113
+ "target-roas": { type: "string" },
6114
+ status: { type: "string" }
6115
+ },
6116
+ run: async ({ args }) => {
6117
+ const customerId = requireCustomerId(args);
6118
+ const target = requireTarget(args, "campaign");
6119
+ const payload = mergePayload(loadJsonFileArg(args.file), {
6120
+ name: args.name,
6121
+ budget: args["budget-ref"],
6122
+ bidding: biddingFromFlags(args),
6123
+ status: args.status
6124
+ });
6125
+ await stageUpdate("google.campaign.update", customerId, target, payload);
6126
+ }
6127
+ }),
6128
+ pause: statusCommand2("google.campaign.pause", "campaign"),
6129
+ resume: statusCommand2("google.campaign.resume", "campaign"),
6130
+ remove: statusCommand2("google.campaign.remove", "campaign")
6131
+ }
6132
+ });
6133
+ function statusCommand2(kind, entity) {
6134
+ return defineCommand30({
6135
+ meta: { name: kind.split(".")[2], description: `Stage a ${entity} ${kind.split(".")[2]}` },
6136
+ args: {
6137
+ ...customerIdArg,
6138
+ id: { type: "positional", description: `${entity} resource name or id`, required: false }
6139
+ },
6140
+ run: async ({ args }) => {
6141
+ const customerId = requireCustomerId(args);
6142
+ await stageTarget(kind, customerId, requireTarget(args, entity));
6143
+ }
6144
+ });
6145
+ }
6146
+ var adGroupsCommand = defineCommand30({
6147
+ meta: { name: "ad-groups", description: "Stage ad group create/update/pause/resume/remove" },
6148
+ subCommands: {
6149
+ create: defineCommand30({
6150
+ meta: { name: "create", description: "Stage an ad group" },
6151
+ args: {
6152
+ ...customerIdArg,
6153
+ ...fileArg,
6154
+ name: { type: "string" },
6155
+ "campaign-ref": { type: "string", description: "Campaign ref (g_temp_*, id, or resource name)" },
6156
+ type: { type: "string", description: "Ad group type (default SEARCH_STANDARD)" },
6157
+ "cpc-bid": { type: "string", description: "Default CPC bid in major units" },
6158
+ status: { type: "string" }
6159
+ },
6160
+ run: async ({ args }) => {
6161
+ const customerId = requireCustomerId(args);
6162
+ const payload = mergePayload(loadJsonFileArg(args.file), {
6163
+ name: args.name,
6164
+ campaign: args["campaign-ref"],
6165
+ type: args.type,
6166
+ cpcBidMicros: microsFlag(args["cpc-bid"], "--cpc-bid"),
6167
+ status: args.status
6168
+ });
6169
+ await stageCreate("google.adGroup.create", customerId, payload);
6170
+ }
6171
+ }),
6172
+ update: defineCommand30({
6173
+ meta: { name: "update", description: "Stage an ad group update" },
6174
+ args: {
6175
+ ...customerIdArg,
6176
+ ...fileArg,
6177
+ name: { type: "string" },
6178
+ "cpc-bid": { type: "string" },
6179
+ status: { type: "string" }
6180
+ },
6181
+ run: async ({ args }) => {
6182
+ const customerId = requireCustomerId(args);
6183
+ const target = requireTarget(args, "ad group");
6184
+ const payload = mergePayload(loadJsonFileArg(args.file), {
6185
+ name: args.name,
6186
+ cpcBidMicros: microsFlag(args["cpc-bid"], "--cpc-bid"),
6187
+ status: args.status
6188
+ });
6189
+ await stageUpdate("google.adGroup.update", customerId, target, payload);
6190
+ }
6191
+ }),
6192
+ pause: statusCommand2("google.adGroup.pause", "ad group"),
6193
+ resume: statusCommand2("google.adGroup.resume", "ad group"),
6194
+ remove: statusCommand2("google.adGroup.remove", "ad group")
6195
+ }
6196
+ });
6197
+ var keywordWriteSubcommands = {
6198
+ add: defineCommand30({
6199
+ meta: { name: "add", description: "Add a keyword to an ad group" },
6200
+ args: {
6201
+ ...customerIdArg,
6202
+ "ad-group-ref": { type: "string", description: "Ad group ref (g_temp_*, id, or resource name)" },
6203
+ text: { type: "string", description: "Keyword text" },
6204
+ "match-type": { type: "string", description: "EXACT | PHRASE | BROAD" },
6205
+ "cpc-bid": { type: "string", description: "Keyword CPC bid in major units" },
6206
+ "final-url": { type: "string", description: "Keyword-level final URL" }
6207
+ },
6208
+ run: async ({ args }) => {
6209
+ const customerId = requireCustomerId(args);
6210
+ await stageCreate("google.keyword.add", customerId, {
6211
+ adGroup: requireStringFlag(args["ad-group-ref"], "--ad-group-ref"),
6212
+ text: requireStringFlag(args.text, "--text"),
6213
+ matchType: requireStringFlag(args["match-type"], "--match-type"),
6214
+ cpcBidMicros: microsFlag(args["cpc-bid"], "--cpc-bid"),
6215
+ finalUrls: args["final-url"] ? [args["final-url"]] : void 0
6216
+ });
6217
+ }
6218
+ }),
6219
+ update: defineCommand30({
6220
+ meta: { name: "update", description: "Update a keyword" },
6221
+ args: { ...customerIdArg, "cpc-bid": { type: "string" }, status: { type: "string" } },
6222
+ run: async ({ args }) => {
6223
+ const customerId = requireCustomerId(args);
6224
+ await stageUpdate("google.keyword.update", customerId, requireTarget(args, "keyword"), {
6225
+ cpcBidMicros: microsFlag(args["cpc-bid"], "--cpc-bid"),
6226
+ status: args.status
6227
+ });
6228
+ }
6229
+ }),
6230
+ remove: statusCommand2("google.keyword.remove", "keyword")
6231
+ };
6232
+ var negativeKeywordsCommand = defineCommand30({
6233
+ meta: { name: "negative-keywords", description: "Stage negative keyword add/remove (ad-group or campaign level)" },
6234
+ subCommands: {
6235
+ add: defineCommand30({
6236
+ meta: { name: "add", description: "Add a negative keyword" },
6237
+ args: {
6238
+ ...customerIdArg,
6239
+ level: { type: "string", description: "adGroup | campaign" },
6240
+ "parent-ref": { type: "string", description: "Ad group or campaign ref" },
6241
+ text: { type: "string" },
6242
+ "match-type": { type: "string", description: "EXACT | PHRASE | BROAD" }
6243
+ },
6244
+ run: async ({ args }) => {
6245
+ const customerId = requireCustomerId(args);
6246
+ await stageCreate("google.negativeKeyword.add", customerId, {
6247
+ level: requireStringFlag(args.level, "--level"),
6248
+ parent: requireStringFlag(args["parent-ref"], "--parent-ref"),
6249
+ text: requireStringFlag(args.text, "--text"),
6250
+ matchType: requireStringFlag(args["match-type"], "--match-type")
6251
+ });
6252
+ }
6253
+ }),
6254
+ remove: statusCommand2("google.negativeKeyword.remove", "negative keyword")
6255
+ }
6256
+ });
6257
+ var keywordListsCommand = defineCommand30({
6258
+ meta: { name: "keyword-lists", description: "Stage shared negative keyword lists (create/add/attach/detach)" },
6259
+ subCommands: {
6260
+ create: defineCommand30({
6261
+ meta: { name: "create", description: "Create a shared negative keyword list" },
6262
+ args: {
6263
+ ...customerIdArg,
6264
+ name: { type: "string" },
6265
+ type: {
6266
+ type: "string",
6267
+ description: "NEGATIVE_KEYWORDS (default) | NEGATIVE_PLACEMENTS | ACCOUNT_LEVEL_NEGATIVE_KEYWORDS"
6268
+ }
6269
+ },
6270
+ run: async ({ args }) => {
6271
+ const customerId = requireCustomerId(args);
6272
+ await stageCreate("google.sharedSet.create", customerId, {
6273
+ name: requireStringFlag(args.name, "--name"),
6274
+ type: args.type
6275
+ });
6276
+ }
6277
+ }),
6278
+ add: defineCommand30({
6279
+ meta: { name: "add", description: "Add a keyword to a shared list" },
6280
+ args: {
6281
+ ...customerIdArg,
6282
+ "list-ref": { type: "string", description: "Shared set ref" },
6283
+ text: { type: "string" },
6284
+ "match-type": { type: "string" }
6285
+ },
6286
+ run: async ({ args }) => {
6287
+ const customerId = requireCustomerId(args);
6288
+ await stageCreate("google.sharedSetMember.add", customerId, {
6289
+ sharedSet: requireStringFlag(args["list-ref"], "--list-ref"),
6290
+ text: requireStringFlag(args.text, "--text"),
6291
+ matchType: requireStringFlag(args["match-type"], "--match-type")
6292
+ });
6293
+ }
6294
+ }),
6295
+ attach: defineCommand30({
6296
+ meta: { name: "attach", description: "Attach a keyword list to a campaign" },
6297
+ args: { ...customerIdArg, "campaign-ref": { type: "string" }, "list-ref": { type: "string" } },
6298
+ run: async ({ args }) => {
6299
+ const customerId = requireCustomerId(args);
6300
+ await stageCreate("google.campaignSharedSet.attach", customerId, {
6301
+ campaign: requireStringFlag(args["campaign-ref"], "--campaign-ref"),
6302
+ sharedSet: requireStringFlag(args["list-ref"], "--list-ref")
6303
+ });
6304
+ }
6305
+ }),
6306
+ detach: statusCommand2("google.campaignSharedSet.detach", "campaign shared set")
6307
+ }
6308
+ });
6309
+ function rsaContentFromFlags(args) {
6310
+ const headlines = listFlag(args.headlines);
6311
+ const descriptions = listFlag(args.descriptions);
6312
+ if (!headlines || !descriptions) {
6313
+ failWriteValidation("responsive search ads need --headlines and --descriptions (comma-separated), or use --file");
6314
+ }
6315
+ const finalUrls = listFlag(args["final-url"]);
6316
+ if (!finalUrls) {
6317
+ failWriteValidation("--final-url is required for a responsive search ad");
6318
+ }
6319
+ return {
6320
+ format: "responsiveSearch",
6321
+ headlines: headlines.map((text) => ({ text })),
6322
+ descriptions: descriptions.map((text) => ({ text })),
6323
+ path1: args.path1,
6324
+ path2: args.path2,
6325
+ finalUrls
6326
+ };
6327
+ }
6328
+ var adsCommand = defineCommand30({
6329
+ meta: { name: "ads", description: "Stage ad create/update/pause/resume/remove" },
6330
+ subCommands: {
6331
+ create: defineCommand30({
6332
+ meta: { name: "create", description: "Stage an ad (responsive search via flags; other formats via --file)" },
6333
+ args: {
6334
+ ...customerIdArg,
6335
+ ...fileArg,
6336
+ "ad-group-ref": { type: "string", description: "Ad group ref" },
6337
+ format: {
6338
+ type: "string",
6339
+ description: "responsiveSearch (default) | responsiveDisplay | performanceMaxAssetGroup | call | app | video | demandGen"
6340
+ },
6341
+ headlines: { type: "string", description: "Comma-separated headlines (RSA)" },
6342
+ descriptions: { type: "string", description: "Comma-separated descriptions (RSA)" },
6343
+ path1: { type: "string" },
6344
+ path2: { type: "string" },
6345
+ "final-url": { type: "string", description: "Comma-separated final URLs" },
6346
+ status: { type: "string" }
6347
+ },
6348
+ run: async ({ args }) => {
6349
+ const customerId = requireCustomerId(args);
6350
+ const file = loadJsonFileArg(args.file);
6351
+ const format = args.format ?? "responsiveSearch";
6352
+ const content = file.content ?? (format === "responsiveSearch" ? rsaContentFromFlags(args) : failWriteValidation(`--format ${format} needs --file with the ad content`));
6353
+ await stageCreate("google.ad.create", customerId, {
6354
+ adGroup: requireStringFlag(args["ad-group-ref"] ?? file.adGroup, "--ad-group-ref"),
6355
+ status: args.status ?? file.status,
6356
+ content
6357
+ });
6358
+ }
6359
+ }),
6360
+ update: defineCommand30({
6361
+ meta: { name: "update", description: "Stage an ad update" },
6362
+ args: { ...customerIdArg, ...fileArg, status: { type: "string" } },
6363
+ run: async ({ args }) => {
6364
+ const customerId = requireCustomerId(args);
6365
+ const file = loadJsonFileArg(args.file);
6366
+ await stageUpdate(
6367
+ "google.ad.update",
6368
+ customerId,
6369
+ requireTarget(args, "ad"),
6370
+ mergePayload(file, { status: args.status })
6371
+ );
6372
+ }
6373
+ }),
6374
+ pause: statusCommand2("google.ad.pause", "ad"),
6375
+ resume: statusCommand2("google.ad.resume", "ad"),
6376
+ remove: statusCommand2("google.ad.remove", "ad")
6377
+ }
6378
+ });
6379
+ function fileCreateCommand(name, kind, description) {
6380
+ return defineCommand30({
6381
+ meta: { name, description },
6382
+ args: { ...customerIdArg, ...fileArg },
6383
+ run: async ({ args }) => {
6384
+ const customerId = requireCustomerId(args);
6385
+ const payload = loadJsonFileArg(args.file);
6386
+ if (Object.keys(payload).length === 0) {
6387
+ failWriteValidation(`${kind} needs --file with the op payload`);
6388
+ }
6389
+ await stageGoogleOp({ kind, customerId, payload });
6390
+ }
6391
+ });
6392
+ }
6393
+ var assetsCommand = defineCommand30({
6394
+ meta: { name: "assets", description: "Stage asset create + asset-link attach/detach (via --file)" },
6395
+ subCommands: {
6396
+ create: fileCreateCommand(
6397
+ "create",
6398
+ "google.asset.create",
6399
+ "Stage an asset (text/image/sitelink/callout/structuredSnippet/\u2026)"
6400
+ ),
6401
+ attach: fileCreateCommand("attach", "google.assetLink.attach", "Attach an asset to a campaign/adGroup/customer"),
6402
+ detach: statusCommand2("google.assetLink.detach", "asset link")
6403
+ }
6404
+ });
6405
+ var audiencesCommand = defineCommand30({
6406
+ meta: { name: "audiences", description: "Stage audience (user list) create + criterion attach/detach (via --file)" },
6407
+ subCommands: {
6408
+ create: fileCreateCommand("create", "google.audience.create", "Stage a user-list audience"),
6409
+ attach: fileCreateCommand(
6410
+ "attach",
6411
+ "google.audienceCriterion.attach",
6412
+ "Target/exclude an audience on a campaign/adGroup"
6413
+ ),
6414
+ detach: statusCommand2("google.audienceCriterion.detach", "audience criterion")
6415
+ }
6416
+ });
6417
+ var conversionsCommand = defineCommand30({
6418
+ meta: { name: "conversions", description: "Stage conversion action create/update (via --file)" },
6419
+ subCommands: {
6420
+ create: fileCreateCommand("create", "google.conversionAction.create", "Stage a conversion action"),
6421
+ update: defineCommand30({
6422
+ meta: { name: "update", description: "Stage a conversion action update" },
6423
+ args: { ...customerIdArg, ...fileArg },
6424
+ run: async ({ args }) => {
6425
+ const customerId = requireCustomerId(args);
6426
+ await stageUpdate(
6427
+ "google.conversionAction.update",
6428
+ customerId,
6429
+ requireTarget(args, "conversion action"),
6430
+ loadJsonFileArg(args.file)
6431
+ );
6432
+ }
6433
+ })
6434
+ }
6435
+ });
6436
+ var biddingStrategiesCommand = defineCommand30({
6437
+ meta: { name: "bidding-strategies", description: "Stage portfolio bidding strategy create/update (via --file)" },
6438
+ subCommands: {
6439
+ create: fileCreateCommand("create", "google.biddingStrategy.create", "Stage a portfolio bidding strategy"),
6440
+ update: defineCommand30({
6441
+ meta: { name: "update", description: "Stage a portfolio bidding strategy update" },
6442
+ args: { ...customerIdArg, ...fileArg },
6443
+ run: async ({ args }) => {
6444
+ const customerId = requireCustomerId(args);
6445
+ await stageUpdate(
6446
+ "google.biddingStrategy.update",
6447
+ customerId,
6448
+ requireTarget(args, "bidding strategy"),
6449
+ loadJsonFileArg(args.file)
6450
+ );
6451
+ }
6452
+ })
6453
+ }
6454
+ });
6455
+ var labelsCommand = defineCommand30({
6456
+ meta: { name: "labels", description: "Stage label create + attach (via --file)" },
6457
+ subCommands: {
6458
+ create: defineCommand30({
6459
+ meta: { name: "create", description: "Create a label" },
6460
+ args: {
6461
+ ...customerIdArg,
6462
+ name: { type: "string" },
6463
+ "background-color": { type: "string" },
6464
+ description: { type: "string" }
6465
+ },
6466
+ run: async ({ args }) => {
6467
+ const customerId = requireCustomerId(args);
6468
+ await stageCreate("google.label.create", customerId, {
6469
+ name: requireStringFlag(args.name, "--name"),
6470
+ backgroundColor: args["background-color"],
6471
+ description: args.description
6472
+ });
6473
+ }
6474
+ }),
6475
+ attach: fileCreateCommand("attach", "google.label.attach", "Attach a label to a campaign/adGroup/ad")
6476
+ }
6477
+ });
6478
+ var campaignCriteriaCommand = defineCommand30({
6479
+ meta: {
6480
+ name: "campaign-criteria",
6481
+ description: "Stage campaign criteria (location/language/adSchedule/device) add/remove (via --file)"
6482
+ },
6483
+ subCommands: {
6484
+ add: fileCreateCommand("add", "google.campaignCriterion.add", "Add a campaign criterion"),
6485
+ remove: statusCommand2("google.campaignCriterion.remove", "campaign criterion")
6486
+ }
6487
+ });
6488
+ var googleWriteCommands = {
6489
+ budgets: budgetsCommand,
6490
+ campaigns: campaignsCommand,
6491
+ "ad-groups": adGroupsCommand,
6492
+ "negative-keywords": negativeKeywordsCommand,
6493
+ "keyword-lists": keywordListsCommand,
6494
+ ads: adsCommand,
6495
+ assets: assetsCommand,
6496
+ audiences: audiencesCommand,
6497
+ conversions: conversionsCommand,
6498
+ "bidding-strategies": biddingStrategiesCommand,
6499
+ labels: labelsCommand,
6500
+ "campaign-criteria": campaignCriteriaCommand
6501
+ };
6502
+
5145
6503
  // src/commands/ads/google/index.ts
5146
- var googleCommand = defineCommand29({
6504
+ var keywordsWithWrites = defineCommand31({
6505
+ meta: keywordsCommand.meta,
6506
+ subCommands: { ...keywordsCommand.subCommands, ...keywordWriteSubcommands }
6507
+ });
6508
+ var googleCommand = defineCommand31({
5147
6509
  meta: {
5148
6510
  name: "google",
5149
6511
  description: `Google Ads commands. Query campaigns, keywords, search terms, and more via GAQL.
@@ -5158,20 +6520,28 @@ Examples:
5158
6520
  baker ads google query --preset campaign-performance --customer-id 1234567890
5159
6521
  baker ads google currency --customer-id 1234567890
5160
6522
  baker ads google keywords discover --customer-id 1234567890 --seeds "running shoes"
5161
- baker ads google library list-advertisers \u2014 list tracked Google advertisers`
6523
+ baker ads google library list-advertisers \u2014 list tracked Google advertisers
6524
+
6525
+ Staged writes (never touch Google until the chat is published):
6526
+ baker ads google budgets create --customer-id 1234567890 --name "Search" --amount 50
6527
+ baker ads google campaigns create --customer-id 1234567890 --name "Brand" --channel-type SEARCH --budget-ref g_temp_\u2026 --bidding-strategy MANUAL_CPC
6528
+ baker ads google keyword-lists create --customer-id 1234567890 --name "Brand exclusions"
6529
+ baker ads google draft list \u2014 review staged Google Ads changes`
5162
6530
  },
5163
6531
  subCommands: {
5164
6532
  accounts: accountsCommand,
5165
6533
  currency: currencyCommand,
5166
6534
  changes: changesCommand,
5167
6535
  query: queryCommand,
5168
- keywords: keywordsCommand,
5169
- library
6536
+ keywords: keywordsWithWrites,
6537
+ library,
6538
+ ...googleWriteCommands,
6539
+ draft: draftCommand2
5170
6540
  }
5171
6541
  });
5172
6542
 
5173
6543
  // src/commands/ads/linkedin/index.ts
5174
- import { defineCommand as defineCommand49 } from "citty";
6544
+ import { defineCommand as defineCommand51 } from "citty";
5175
6545
 
5176
6546
  // src/commands/ads/linkedin/schemas.ts
5177
6547
  registerSchema({
@@ -5832,7 +7202,7 @@ registerSchema({
5832
7202
  });
5833
7203
 
5834
7204
  // src/commands/ads/linkedin/account.ts
5835
- import { defineCommand as defineCommand30 } from "citty";
7205
+ import { defineCommand as defineCommand32 } from "citty";
5836
7206
 
5837
7207
  // src/commands/ads/linkedin/shared.ts
5838
7208
  var DAY_MS2 = 864e5;
@@ -5935,7 +7305,7 @@ function resolveStatusFilter(args) {
5935
7305
  }
5936
7306
 
5937
7307
  // src/commands/ads/linkedin/account.ts
5938
- var accountCommand = defineCommand30({
7308
+ var accountCommand = defineCommand32({
5939
7309
  meta: {
5940
7310
  name: "account",
5941
7311
  description: `Single LinkedIn ad account detail (currency, status, type).
@@ -5969,9 +7339,9 @@ Examples:
5969
7339
  });
5970
7340
 
5971
7341
  // src/commands/ads/linkedin/accounts.ts
5972
- import { defineCommand as defineCommand31 } from "citty";
7342
+ import { defineCommand as defineCommand33 } from "citty";
5973
7343
  var ACCOUNTS_TTL_MS = 60 * 60 * 1e3;
5974
- var accountsCommand2 = defineCommand31({
7344
+ var accountsCommand2 = defineCommand33({
5975
7345
  meta: {
5976
7346
  name: "accounts",
5977
7347
  description: `List LinkedIn ad accounts in this company's connected scope.
@@ -6019,7 +7389,7 @@ Examples:
6019
7389
  });
6020
7390
 
6021
7391
  // src/commands/ads/linkedin/analytics.ts
6022
- import { defineCommand as defineCommand32 } from "citty";
7392
+ import { defineCommand as defineCommand34 } from "citty";
6023
7393
 
6024
7394
  // src/commands/ads/linkedin/presets.ts
6025
7395
  var INTENTS = {
@@ -6291,7 +7661,7 @@ function numberOf(v) {
6291
7661
  }
6292
7662
  return 0;
6293
7663
  }
6294
- var analyticsCommand = defineCommand32({
7664
+ var analyticsCommand = defineCommand34({
6295
7665
  meta: {
6296
7666
  name: "analytics",
6297
7667
  description: `Performance reporting \u2014 the workhorse for AI agents.
@@ -6418,8 +7788,8 @@ Examples \u2014 common AI questions:
6418
7788
  });
6419
7789
 
6420
7790
  // src/commands/ads/linkedin/audience-size.ts
6421
- import { readFileSync as readFileSync4 } from "fs";
6422
- import { defineCommand as defineCommand33 } from "citty";
7791
+ import { readFileSync as readFileSync5 } from "fs";
7792
+ import { defineCommand as defineCommand35 } from "citty";
6423
7793
  function loadTargeting(args) {
6424
7794
  const inline = args.targeting;
6425
7795
  if (inline) {
@@ -6432,7 +7802,7 @@ function loadTargeting(args) {
6432
7802
  const file = args["targeting-file"];
6433
7803
  if (file) {
6434
7804
  try {
6435
- return JSON.parse(readFileSync4(file, "utf-8"));
7805
+ return JSON.parse(readFileSync5(file, "utf-8"));
6436
7806
  } catch (e) {
6437
7807
  handleLinkedinError(
6438
7808
  new Error(`Failed to read --targeting-file: ${e instanceof Error ? e.message : "I/O error"}`)
@@ -6441,7 +7811,7 @@ function loadTargeting(args) {
6441
7811
  }
6442
7812
  handleLinkedinError(new Error("Pass --targeting-file <path> or --targeting '{...JSON...}'"));
6443
7813
  }
6444
- var audienceSizeCommand = defineCommand33({
7814
+ var audienceSizeCommand = defineCommand35({
6445
7815
  meta: {
6446
7816
  name: "audience-size",
6447
7817
  description: `Estimate audience size for a targeting payload \u2014 pre-launch sanity check.
@@ -6486,7 +7856,7 @@ Examples:
6486
7856
  });
6487
7857
 
6488
7858
  // src/commands/ads/linkedin/audit.ts
6489
- import { defineCommand as defineCommand34 } from "citty";
7859
+ import { defineCommand as defineCommand36 } from "citty";
6490
7860
  var SEVERITY_RANK = {
6491
7861
  critical: 0,
6492
7862
  high: 1,
@@ -6545,7 +7915,7 @@ function noteOf(f) {
6545
7915
  const fix = f.fix?.explanation ?? "";
6546
7916
  return [fix, ev].filter(Boolean).join(" \u2014 ");
6547
7917
  }
6548
- var auditCommand = defineCommand34({
7918
+ var auditCommand = defineCommand36({
6549
7919
  meta: {
6550
7920
  name: "audit",
6551
7921
  description: `Run a LinkedIn Ads playbook audit \u2014 30+ checks across Settings, Tracking,
@@ -6611,8 +7981,8 @@ Examples:
6611
7981
  });
6612
7982
 
6613
7983
  // src/commands/ads/linkedin/bid-pricing.ts
6614
- import { readFileSync as readFileSync5 } from "fs";
6615
- import { defineCommand as defineCommand35 } from "citty";
7984
+ import { readFileSync as readFileSync6 } from "fs";
7985
+ import { defineCommand as defineCommand37 } from "citty";
6616
7986
  function loadTargeting2(args) {
6617
7987
  const inline = args.targeting;
6618
7988
  if (inline) {
@@ -6625,7 +7995,7 @@ function loadTargeting2(args) {
6625
7995
  const file = args["targeting-file"];
6626
7996
  if (file) {
6627
7997
  try {
6628
- return JSON.parse(readFileSync5(file, "utf-8"));
7998
+ return JSON.parse(readFileSync6(file, "utf-8"));
6629
7999
  } catch (e) {
6630
8000
  handleLinkedinError(
6631
8001
  new Error(`Failed to read --targeting-file: ${e instanceof Error ? e.message : "I/O error"}`)
@@ -6634,7 +8004,7 @@ function loadTargeting2(args) {
6634
8004
  }
6635
8005
  handleLinkedinError(new Error("Pass --targeting-file <path> or --targeting '{...JSON...}'"));
6636
8006
  }
6637
- var bidPricingCommand = defineCommand35({
8007
+ var bidPricingCommand = defineCommand37({
6638
8008
  meta: {
6639
8009
  name: "bid-pricing",
6640
8010
  description: `Get LinkedIn's suggested bid range for a targeting + objective + cost type.
@@ -6684,40 +8054,40 @@ Examples:
6684
8054
  });
6685
8055
 
6686
8056
  // src/commands/ads/linkedin/campaign-groups.ts
6687
- import { defineCommand as defineCommand37 } from "citty";
8057
+ import { defineCommand as defineCommand39 } from "citty";
6688
8058
 
6689
8059
  // src/commands/ads/linkedin/write-commands.ts
6690
- import { defineCommand as defineCommand36 } from "citty";
8060
+ import { defineCommand as defineCommand38 } from "citty";
6691
8061
 
6692
8062
  // src/commands/ads/linkedin/write-shared.ts
6693
8063
  import { createHash as createHash2 } from "crypto";
6694
- import { readFileSync as readFileSync6 } from "fs";
8064
+ import { readFileSync as readFileSync7 } from "fs";
6695
8065
  function bareAccountId(args) {
6696
8066
  const raw = resolveAccountIdArg(args);
6697
8067
  return raw.replace(/^urn:li:sponsoredAccount:/, "").replace(/^sponsoredAccount:/, "");
6698
8068
  }
6699
- function failWriteValidation(message) {
8069
+ function failWriteValidation2(message) {
6700
8070
  writeJsonEnvelope({ ok: false, error: { code: "VALIDATION_ERROR", message } });
6701
8071
  process.exit(1);
6702
8072
  }
6703
- function loadJsonFileArg(path11) {
8073
+ function loadJsonFileArg2(path11) {
6704
8074
  if (typeof path11 !== "string" || path11.length === 0) {
6705
8075
  return {};
6706
8076
  }
6707
8077
  try {
6708
- const parsed = JSON.parse(readFileSync6(path11, "utf8"));
8078
+ const parsed = JSON.parse(readFileSync7(path11, "utf8"));
6709
8079
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
6710
- failWriteValidation(`${path11} must contain a JSON object`);
8080
+ failWriteValidation2(`${path11} must contain a JSON object`);
6711
8081
  }
6712
8082
  return parsed;
6713
8083
  } catch (err) {
6714
8084
  if (err instanceof SyntaxError) {
6715
- failWriteValidation(`${path11} is not valid JSON: ${err.message}`);
8085
+ failWriteValidation2(`${path11} is not valid JSON: ${err.message}`);
6716
8086
  }
6717
8087
  throw err;
6718
8088
  }
6719
8089
  }
6720
- function mergePayload(file, flags) {
8090
+ function mergePayload2(file, flags) {
6721
8091
  const merged = { ...file };
6722
8092
  for (const [key, value] of Object.entries(flags)) {
6723
8093
  if (value !== void 0) {
@@ -6734,7 +8104,7 @@ function parseMoneyFlag(amount, currency, flag) {
6734
8104
  return { amount: String(amount) };
6735
8105
  }
6736
8106
  if (typeof currency !== "string" || currency.length !== 3) {
6737
- failWriteValidation(`${flag} got an invalid --currency (expected a 3-letter code like EUR)`);
8107
+ failWriteValidation2(`${flag} got an invalid --currency (expected a 3-letter code like EUR)`);
6738
8108
  }
6739
8109
  return { amount: String(amount), currencyCode: currency.toUpperCase() };
6740
8110
  }
@@ -6748,7 +8118,7 @@ function parseDateFlag(value, flag) {
6748
8118
  }
6749
8119
  const parsed = Date.parse(raw);
6750
8120
  if (Number.isNaN(parsed)) {
6751
- failWriteValidation(`${flag} must be an ISO date (2026-07-10) or epoch milliseconds`);
8121
+ failWriteValidation2(`${flag} must be an ISO date (2026-07-10) or epoch milliseconds`);
6752
8122
  }
6753
8123
  return parsed;
6754
8124
  }
@@ -6763,7 +8133,7 @@ function parseOnOffFlag(value, flag) {
6763
8133
  if (raw === "off" || raw === "false") {
6764
8134
  return false;
6765
8135
  }
6766
- failWriteValidation(`${flag} must be on|off`);
8136
+ failWriteValidation2(`${flag} must be on|off`);
6767
8137
  }
6768
8138
  function parseLocaleFlag(value) {
6769
8139
  if (value === void 0 || value === null || value === "") {
@@ -6771,7 +8141,7 @@ function parseLocaleFlag(value) {
6771
8141
  }
6772
8142
  const match = /^([a-z]{2})[_-]([A-Za-z]{2})$/.exec(String(value));
6773
8143
  if (!match) {
6774
- failWriteValidation("--locale must look like en_US (language_COUNTRY)");
8144
+ failWriteValidation2("--locale must look like en_US (language_COUNTRY)");
6775
8145
  }
6776
8146
  return { language: match[1], country: match[2].toUpperCase() };
6777
8147
  }
@@ -6779,10 +8149,10 @@ function loadTargetingFileArg(path11) {
6779
8149
  if (typeof path11 !== "string" || path11.length === 0) {
6780
8150
  return void 0;
6781
8151
  }
6782
- const parsed = loadJsonFileArg(path11);
8152
+ const parsed = loadJsonFileArg2(path11);
6783
8153
  const criteria = parsed.targetingCriteria ?? parsed;
6784
8154
  if (!criteria.include) {
6785
- failWriteValidation(
8155
+ failWriteValidation2(
6786
8156
  `${path11} must contain targeting criteria with an "include" block (see baker schema ads.linkedin.campaigns.create)`
6787
8157
  );
6788
8158
  }
@@ -6822,10 +8192,10 @@ function parseListFileArg(path11, maxRows) {
6822
8192
  if (typeof path11 !== "string" || path11.length === 0) {
6823
8193
  return void 0;
6824
8194
  }
6825
- const raw = readFileSync6(path11, "utf8");
8195
+ const raw = readFileSync7(path11, "utf8");
6826
8196
  const lines = raw.split(/\r?\n/).filter((line) => line.trim().length > 0);
6827
8197
  if (lines.length < 2) {
6828
- failWriteValidation(`${path11} needs a header row and at least one data row`);
8198
+ failWriteValidation2(`${path11} needs a header row and at least one data row`);
6829
8199
  }
6830
8200
  const columns = parseCsvLine(lines[0]).map((column) => column.trim());
6831
8201
  const rows = [];
@@ -6844,7 +8214,7 @@ function parseListFileArg(path11, maxRows) {
6844
8214
  }
6845
8215
  }
6846
8216
  if (rows.length > maxRows) {
6847
- failWriteValidation(`${path11} has ${rows.length} rows \u2014 the inline limit is ${maxRows}. Split the list.`);
8217
+ failWriteValidation2(`${path11} has ${rows.length} rows \u2014 the inline limit is ${maxRows}. Split the list.`);
6848
8218
  }
6849
8219
  return { columns, rows };
6850
8220
  }
@@ -6880,10 +8250,10 @@ async function stageStatusChange(input) {
6880
8250
  const payload = input.kind === "creative.update" ? { intendedStatus: input.status } : { status: input.status };
6881
8251
  await stageOp({ kind: input.kind, accountId: input.accountId, target: input.target, payload });
6882
8252
  }
6883
- function requireTarget(args, entity) {
8253
+ function requireTarget2(args, entity) {
6884
8254
  const target = args.id ?? args.target;
6885
8255
  if (typeof target !== "string" || target.length === 0) {
6886
- failWriteValidation(`pass the ${entity} id or URN as the positional argument`);
8256
+ failWriteValidation2(`pass the ${entity} id or URN as the positional argument`);
6887
8257
  }
6888
8258
  return target;
6889
8259
  }
@@ -6902,7 +8272,7 @@ function runScheduleFromFlags(args) {
6902
8272
  }
6903
8273
  return { ...start !== void 0 ? { start } : {}, ...end !== void 0 ? { end } : {} };
6904
8274
  }
6905
- var campaignGroupsCreateCommand = defineCommand36({
8275
+ var campaignGroupsCreateCommand = defineCommand38({
6906
8276
  meta: {
6907
8277
  name: "create",
6908
8278
  description: `Stage a new campaign group. ${STAGED_NOTE}
@@ -6920,7 +8290,7 @@ Example: baker ads linkedin campaign-groups create --name "Q3 ABM" --start 2026-
6920
8290
  },
6921
8291
  run: async ({ args }) => {
6922
8292
  const accountId = bareAccountId(args);
6923
- const payload = mergePayload(loadJsonFileArg(args.file), {
8293
+ const payload = mergePayload2(loadJsonFileArg2(args.file), {
6924
8294
  name: args.name,
6925
8295
  runSchedule: runScheduleFromFlags(args),
6926
8296
  totalBudget: parseMoneyFlag(args["total-budget"], args.currency, "--total-budget"),
@@ -6929,7 +8299,7 @@ Example: baker ads linkedin campaign-groups create --name "Q3 ABM" --start 2026-
6929
8299
  await stageOp({ kind: "campaignGroup.create", accountId, payload });
6930
8300
  }
6931
8301
  });
6932
- var campaignGroupsUpdateCommand = defineCommand36({
8302
+ var campaignGroupsUpdateCommand = defineCommand38({
6933
8303
  meta: {
6934
8304
  name: "update",
6935
8305
  description: `Stage changes to an existing campaign group. ${STAGED_NOTE}
@@ -6949,7 +8319,7 @@ Example: baker ads linkedin campaign-groups update 635137195 --total-budget 8000
6949
8319
  },
6950
8320
  run: async ({ args }) => {
6951
8321
  const accountId = bareAccountId(args);
6952
- const payload = mergePayload(loadJsonFileArg(args.file), {
8322
+ const payload = mergePayload2(loadJsonFileArg2(args.file), {
6953
8323
  name: args.name,
6954
8324
  runSchedule: runScheduleFromFlags(args),
6955
8325
  totalBudget: parseMoneyFlag(args["total-budget"], args.currency, "--total-budget"),
@@ -6958,7 +8328,7 @@ Example: baker ads linkedin campaign-groups update 635137195 --total-budget 8000
6958
8328
  await stageOp({
6959
8329
  kind: "campaignGroup.update",
6960
8330
  accountId,
6961
- target: requireTarget(args, "campaign group"),
8331
+ target: requireTarget2(args, "campaign group"),
6962
8332
  payload
6963
8333
  });
6964
8334
  }
@@ -7007,7 +8377,7 @@ var campaignFlagArgs = {
7007
8377
  status: { type: "string", description: "DRAFT|ACTIVE|PAUSED" },
7008
8378
  file: { type: "string", description: "JSON file with the full payload; flags override file keys" }
7009
8379
  };
7010
- var campaignsCreateCommand = defineCommand36({
8380
+ var campaignsCreateCommand = defineCommand38({
7011
8381
  meta: {
7012
8382
  name: "create",
7013
8383
  description: `Stage a new campaign. ${STAGED_NOTE}
@@ -7017,14 +8387,14 @@ Example: baker ads linkedin campaigns create --name "ABM Tier-1" --group li_temp
7017
8387
  args: campaignFlagArgs,
7018
8388
  run: async ({ args }) => {
7019
8389
  const accountId = bareAccountId(args);
7020
- const payload = mergePayload(loadJsonFileArg(args.file), campaignPayloadFromFlags(args));
8390
+ const payload = mergePayload2(loadJsonFileArg2(args.file), campaignPayloadFromFlags(args));
7021
8391
  if (payload.locale === void 0) {
7022
8392
  payload.locale = { country: "US", language: "en" };
7023
8393
  }
7024
8394
  await stageOp({ kind: "campaign.create", accountId, payload });
7025
8395
  }
7026
8396
  });
7027
- var campaignsUpdateCommand = defineCommand36({
8397
+ var campaignsUpdateCommand = defineCommand38({
7028
8398
  meta: {
7029
8399
  name: "update",
7030
8400
  description: `Stage changes to an existing campaign (budget, bid, targeting, flags, schedule, status). ${STAGED_NOTE}
@@ -7042,18 +8412,18 @@ Example: baker ads linkedin campaigns update 123456 --daily-budget 100 --currenc
7042
8412
  flags.type = void 0;
7043
8413
  flags.locale = void 0;
7044
8414
  flags.associatedEntity = void 0;
7045
- const payload = mergePayload(loadJsonFileArg(args.file), flags);
8415
+ const payload = mergePayload2(loadJsonFileArg2(args.file), flags);
7046
8416
  await stageOp({
7047
8417
  kind: "campaign.update",
7048
8418
  accountId,
7049
- target: requireTarget(args, "campaign"),
8419
+ target: requireTarget2(args, "campaign"),
7050
8420
  payload
7051
8421
  });
7052
8422
  }
7053
8423
  });
7054
8424
  function statusSugarCommand(entity, kind, name) {
7055
8425
  const status = name === "pause" ? "PAUSED" : name === "resume" ? "ACTIVE" : "ARCHIVED";
7056
- return defineCommand36({
8426
+ return defineCommand38({
7057
8427
  meta: {
7058
8428
  name,
7059
8429
  description: `Stage a status change to ${status}. ${STAGED_NOTE}
@@ -7067,7 +8437,7 @@ Example: baker ads linkedin ${entity} ${name} 123456`
7067
8437
  await stageStatusChange({
7068
8438
  kind,
7069
8439
  accountId: bareAccountId(args),
7070
- target: requireTarget(args, entity.replace(/-/g, " ").replace(/s$/, "")),
8440
+ target: requireTarget2(args, entity.replace(/-/g, " ").replace(/s$/, "")),
7071
8441
  status
7072
8442
  });
7073
8443
  }
@@ -7081,7 +8451,7 @@ var campaignGroupsResumeCommand = statusSugarCommand("campaign-groups", "campaig
7081
8451
  var creativesPauseCommand = statusSugarCommand("creatives", "creative.update", "pause");
7082
8452
  var creativesResumeCommand = statusSugarCommand("creatives", "creative.update", "resume");
7083
8453
  function duplicateCommand(entity, cliGroup) {
7084
- return defineCommand36({
8454
+ return defineCommand38({
7085
8455
  meta: {
7086
8456
  name: "duplicate",
7087
8457
  description: `Stage a copy of an existing ${entity} as a new DRAFT create (playbook: duplicate, never link-to-original). ${STAGED_NOTE}
@@ -7096,14 +8466,14 @@ Example: baker ads linkedin ${cliGroup} duplicate 123456 --name "New variant"`
7096
8466
  run: async ({ args }) => {
7097
8467
  try {
7098
8468
  const chatId = requireChatId();
7099
- const overrides = mergePayload(loadJsonFileArg(args.file), { name: args.name });
8469
+ const overrides = mergePayload2(loadJsonFileArg2(args.file), { name: args.name });
7100
8470
  const response = await apiPost(
7101
8471
  "/api/ads/linkedin/draft/duplicate",
7102
8472
  {
7103
8473
  chatId,
7104
8474
  accountId: bareAccountId(args),
7105
8475
  entity,
7106
- sourceId: requireTarget(args, entity),
8476
+ sourceId: requireTarget2(args, entity),
7107
8477
  ...Object.keys(overrides).length > 0 ? { overrides } : {}
7108
8478
  }
7109
8479
  );
@@ -7116,7 +8486,7 @@ Example: baker ads linkedin ${cliGroup} duplicate 123456 --name "New variant"`
7116
8486
  }
7117
8487
  var campaignsDuplicateCommand = duplicateCommand("campaign", "campaigns");
7118
8488
  var campaignGroupsDuplicateCommand = duplicateCommand("campaignGroup", "campaign-groups");
7119
- var creativesDuplicateCommand = defineCommand36({
8489
+ var creativesDuplicateCommand = defineCommand38({
7120
8490
  meta: {
7121
8491
  name: "duplicate",
7122
8492
  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}
@@ -7154,10 +8524,10 @@ Examples:
7154
8524
  run: async ({ args }) => {
7155
8525
  try {
7156
8526
  const chatId = requireChatId();
7157
- const file = loadJsonFileArg(args.file);
8527
+ const file = loadJsonFileArg2(args.file);
7158
8528
  const fileContent = file.content !== null && typeof file.content === "object" && !Array.isArray(file.content) ? file.content : {};
7159
8529
  const content = { ...fileContent, ...creativeContentPatch(args) };
7160
- const overrides = mergePayload(file, {
8530
+ const overrides = mergePayload2(file, {
7161
8531
  campaign: args.campaign,
7162
8532
  intendedStatus: args["intended-status"] ? String(args["intended-status"]).toUpperCase() : void 0,
7163
8533
  content: Object.keys(content).length > 0 ? content : void 0
@@ -7168,7 +8538,7 @@ Examples:
7168
8538
  chatId,
7169
8539
  accountId: bareAccountId(args),
7170
8540
  entity: "creative",
7171
- sourceId: requireTarget(args, "creative"),
8541
+ sourceId: requireTarget2(args, "creative"),
7172
8542
  ...Object.keys(overrides).length > 0 ? { overrides } : {},
7173
8543
  ...args.replace ? { replace: true } : {}
7174
8544
  }
@@ -7193,7 +8563,7 @@ var CREATIVE_FORMATS = [
7193
8563
  "event",
7194
8564
  "article"
7195
8565
  ];
7196
- var creativesCreateCommand = defineCommand36({
8566
+ var creativesCreateCommand = defineCommand38({
7197
8567
  meta: {
7198
8568
  name: "create",
7199
8569
  description: `Stage a new creative (ad). ${STAGED_NOTE}
@@ -7229,13 +8599,13 @@ Examples:
7229
8599
  run: async ({ args }) => {
7230
8600
  const accountId = bareAccountId(args);
7231
8601
  if (!args.campaign) {
7232
- failWriteValidation("--campaign is required (id, URN, or li_temp_* ref)");
8602
+ failWriteValidation2("--campaign is required (id, URN, or li_temp_* ref)");
7233
8603
  }
7234
8604
  const format = args.format ? String(args.format) : void 0;
7235
8605
  if (!format || !CREATIVE_FORMATS.includes(format)) {
7236
- failWriteValidation(`--format must be one of ${CREATIVE_FORMATS.join("|")}`);
8606
+ failWriteValidation2(`--format must be one of ${CREATIVE_FORMATS.join("|")}`);
7237
8607
  }
7238
- const content = mergePayload(loadJsonFileArg(args.file), {
8608
+ const content = mergePayload2(loadJsonFileArg2(args.file), {
7239
8609
  format,
7240
8610
  commentary: args.intro,
7241
8611
  imageId: args["image-id"],
@@ -7294,7 +8664,7 @@ function creativeContentPatch(args) {
7294
8664
  }
7295
8665
  return patch;
7296
8666
  }
7297
- var creativesUpdateCommand = defineCommand36({
8667
+ var creativesUpdateCommand = defineCommand38({
7298
8668
  meta: {
7299
8669
  name: "update",
7300
8670
  description: `Stage changes to an existing creative, or amend a creative staged in this chat by passing its li_temp_* ref. ${STAGED_NOTE}
@@ -7326,13 +8696,13 @@ Examples:
7326
8696
  },
7327
8697
  run: async ({ args }) => {
7328
8698
  const accountId = bareAccountId(args);
7329
- const target = requireTarget(args, "creative");
7330
- const file = loadJsonFileArg(args.file);
8699
+ const target = requireTarget2(args, "creative");
8700
+ const file = loadJsonFileArg2(args.file);
7331
8701
  const contentPatch = creativeContentPatch(args);
7332
8702
  const intendedStatus = args["intended-status"] ? String(args["intended-status"]).toUpperCase() : void 0;
7333
8703
  const fileContent = file.content !== null && typeof file.content === "object" && !Array.isArray(file.content) ? file.content : {};
7334
8704
  const content = { ...fileContent, ...contentPatch };
7335
- const payload = mergePayload(file, {
8705
+ const payload = mergePayload2(file, {
7336
8706
  intendedStatus,
7337
8707
  name: args.name,
7338
8708
  content: Object.keys(content).length > 0 ? content : void 0
@@ -7342,7 +8712,7 @@ Examples:
7342
8712
  });
7343
8713
  var AUDIENCE_TYPES2 = ["company-list", "user-list", "retargeting", "engagement"];
7344
8714
  var INLINE_ROWS_MAX = 1e4;
7345
- var audiencesCreateCommand = defineCommand36({
8715
+ var audiencesCreateCommand = defineCommand38({
7346
8716
  meta: {
7347
8717
  name: "create",
7348
8718
  description: `Stage a new matched audience. ${STAGED_NOTE}
@@ -7359,7 +8729,7 @@ Example: baker ads linkedin audiences create --name "ABM Tier-1" --type company-
7359
8729
  run: async ({ args }) => {
7360
8730
  const accountId = bareAccountId(args);
7361
8731
  const list = parseListFileArg(args["list-file"], INLINE_ROWS_MAX);
7362
- const raw = args.file ? loadJsonFileArg(args.file) : void 0;
8732
+ const raw = args.file ? loadJsonFileArg2(args.file) : void 0;
7363
8733
  await stageOp({
7364
8734
  kind: "audience.create",
7365
8735
  accountId,
@@ -7372,7 +8742,7 @@ Example: baker ads linkedin audiences create --name "ABM Tier-1" --type company-
7372
8742
  });
7373
8743
  }
7374
8744
  });
7375
- var audiencesUploadCommand = defineCommand36({
8745
+ var audiencesUploadCommand = defineCommand38({
7376
8746
  meta: {
7377
8747
  name: "upload",
7378
8748
  description: `Stage a list upload into an existing audience segment. ${STAGED_NOTE}
@@ -7387,20 +8757,20 @@ Example: baker ads linkedin audiences upload urn:li:dmpSegment:42 --list-file mo
7387
8757
  const accountId = bareAccountId(args);
7388
8758
  const list = parseListFileArg(args["list-file"], INLINE_ROWS_MAX);
7389
8759
  if (!list) {
7390
- failWriteValidation("--list-file is required");
8760
+ failWriteValidation2("--list-file is required");
7391
8761
  }
7392
8762
  await stageOp({
7393
8763
  kind: "audience.uploadList",
7394
8764
  accountId,
7395
8765
  payload: {
7396
- segment: requireTarget(args, "audience segment"),
8766
+ segment: requireTarget2(args, "audience segment"),
7397
8767
  listColumns: list.columns,
7398
8768
  listRows: list.rows
7399
8769
  }
7400
8770
  });
7401
8771
  }
7402
8772
  });
7403
- var audiencesCommand = defineCommand36({
8773
+ var audiencesCommand2 = defineCommand38({
7404
8774
  meta: {
7405
8775
  name: "audiences",
7406
8776
  description: "Stage LinkedIn matched-audience changes (create lists, upload rows). Staged until publish \u2014 never hits the API directly."
@@ -7410,7 +8780,7 @@ var audiencesCommand = defineCommand36({
7410
8780
  upload: audiencesUploadCommand
7411
8781
  }
7412
8782
  });
7413
- var conversionsCreateCommand = defineCommand36({
8783
+ var conversionsCreateCommand = defineCommand38({
7414
8784
  meta: {
7415
8785
  name: "create",
7416
8786
  description: `Stage a new conversion rule. ${STAGED_NOTE}
@@ -7429,7 +8799,7 @@ Example: baker ads linkedin conversions create --name "Demo booked" --type LEAD
7429
8799
  },
7430
8800
  run: async ({ args }) => {
7431
8801
  const accountId = bareAccountId(args);
7432
- const payload = mergePayload(loadJsonFileArg(args.file), {
8802
+ const payload = mergePayload2(loadJsonFileArg2(args.file), {
7433
8803
  name: args.name,
7434
8804
  type: args.type ? String(args.type).toUpperCase() : void 0,
7435
8805
  conversionMethod: args.method ? String(args.method).toUpperCase() : void 0,
@@ -7441,7 +8811,7 @@ Example: baker ads linkedin conversions create --name "Demo booked" --type LEAD
7441
8811
  await stageOp({ kind: "conversion.create", accountId, payload });
7442
8812
  }
7443
8813
  });
7444
- var conversionsUpdateCommand = defineCommand36({
8814
+ var conversionsUpdateCommand = defineCommand38({
7445
8815
  meta: {
7446
8816
  name: "update",
7447
8817
  description: `Stage changes to a conversion rule (windows, name, enabled). ${STAGED_NOTE}
@@ -7459,7 +8829,7 @@ Example: baker ads linkedin conversions update 104988516 --post-click-window 30
7459
8829
  },
7460
8830
  run: async ({ args }) => {
7461
8831
  const accountId = bareAccountId(args);
7462
- const payload = mergePayload(loadJsonFileArg(args.file), {
8832
+ const payload = mergePayload2(loadJsonFileArg2(args.file), {
7463
8833
  name: args.name,
7464
8834
  postClickAttributionWindowSize: args["post-click-window"] ? Number(args["post-click-window"]) : void 0,
7465
8835
  viewThroughAttributionWindowSize: args["view-window"] ? Number(args["view-window"]) : void 0,
@@ -7469,12 +8839,12 @@ Example: baker ads linkedin conversions update 104988516 --post-click-window 30
7469
8839
  await stageOp({
7470
8840
  kind: "conversion.update",
7471
8841
  accountId,
7472
- target: requireTarget(args, "conversion rule"),
8842
+ target: requireTarget2(args, "conversion rule"),
7473
8843
  payload
7474
8844
  });
7475
8845
  }
7476
8846
  });
7477
- var leadFormsCreateCommand = defineCommand36({
8847
+ var leadFormsCreateCommand = defineCommand38({
7478
8848
  meta: {
7479
8849
  name: "create",
7480
8850
  description: `Stage a new Lead Gen Form from a JSON file. ${STAGED_NOTE}
@@ -7487,11 +8857,11 @@ The file needs: name, headline (\u226460), privacyPolicyUrl, questions[] (\u2264
7487
8857
  },
7488
8858
  run: async ({ args }) => {
7489
8859
  const accountId = bareAccountId(args);
7490
- const payload = mergePayload(loadJsonFileArg(args.file), { name: args.name });
8860
+ const payload = mergePayload2(loadJsonFileArg2(args.file), { name: args.name });
7491
8861
  await stageOp({ kind: "leadForm.create", accountId, payload });
7492
8862
  }
7493
8863
  });
7494
- var leadFormsUpdateCommand = defineCommand36({
8864
+ var leadFormsUpdateCommand = defineCommand38({
7495
8865
  meta: {
7496
8866
  name: "update",
7497
8867
  description: `Stage changes to a Lead Gen Form from a JSON file. ${STAGED_NOTE}`
@@ -7504,16 +8874,16 @@ var leadFormsUpdateCommand = defineCommand36({
7504
8874
  },
7505
8875
  run: async ({ args }) => {
7506
8876
  const accountId = bareAccountId(args);
7507
- const payload = mergePayload({ raw: loadJsonFileArg(args.file) }, { name: args.name });
8877
+ const payload = mergePayload2({ raw: loadJsonFileArg2(args.file) }, { name: args.name });
7508
8878
  await stageOp({
7509
8879
  kind: "leadForm.update",
7510
8880
  accountId,
7511
- target: requireTarget(args, "lead form"),
8881
+ target: requireTarget2(args, "lead form"),
7512
8882
  payload
7513
8883
  });
7514
8884
  }
7515
8885
  });
7516
- var leadFormsCommand = defineCommand36({
8886
+ var leadFormsCommand = defineCommand38({
7517
8887
  meta: {
7518
8888
  name: "lead-forms",
7519
8889
  description: "Stage LinkedIn Lead Gen Form changes (file-first). Staged until publish \u2014 never hits the API directly."
@@ -7525,7 +8895,7 @@ var leadFormsCommand = defineCommand36({
7525
8895
  });
7526
8896
 
7527
8897
  // src/commands/ads/linkedin/campaign-groups.ts
7528
- var campaignGroupsCommand = defineCommand37({
8898
+ var campaignGroupsCommand = defineCommand39({
7529
8899
  meta: {
7530
8900
  name: "campaign-groups",
7531
8901
  description: `List LinkedIn campaign groups, or stage writes (create/update/pause/resume/duplicate).
@@ -7576,8 +8946,8 @@ Examples:
7576
8946
  });
7577
8947
 
7578
8948
  // src/commands/ads/linkedin/campaigns.ts
7579
- import { defineCommand as defineCommand38 } from "citty";
7580
- var campaignsCommand = defineCommand38({
8949
+ import { defineCommand as defineCommand40 } from "citty";
8950
+ var campaignsCommand2 = defineCommand40({
7581
8951
  meta: {
7582
8952
  name: "campaigns",
7583
8953
  description: `List LinkedIn campaigns, or stage writes (create/update/pause/resume/archive/duplicate).
@@ -7638,8 +9008,8 @@ Examples:
7638
9008
  });
7639
9009
 
7640
9010
  // src/commands/ads/linkedin/conversation.ts
7641
- import { defineCommand as defineCommand39 } from "citty";
7642
- var conversationCommand = defineCommand39({
9011
+ import { defineCommand as defineCommand41 } from "citty";
9012
+ var conversationCommand = defineCommand41({
7643
9013
  meta: {
7644
9014
  name: "conversation",
7645
9015
  description: `Per-button click rates inside Sponsored Messaging / Conversation Ads.
@@ -7702,7 +9072,7 @@ Examples:
7702
9072
  });
7703
9073
 
7704
9074
  // src/commands/ads/linkedin/conversions.ts
7705
- import { defineCommand as defineCommand40 } from "citty";
9075
+ import { defineCommand as defineCommand42 } from "citty";
7706
9076
  var DAY_MS3 = 864e5;
7707
9077
  function healthOf(rules) {
7708
9078
  const enabled = rules.filter((r) => r.enabled !== false);
@@ -7728,7 +9098,7 @@ function healthOf(rules) {
7728
9098
  wrongLeadDedup: wrongDedup
7729
9099
  };
7730
9100
  }
7731
- var listCmd = defineCommand40({
9101
+ var listCmd = defineCommand42({
7732
9102
  meta: {
7733
9103
  name: "list",
7734
9104
  description: `List conversion rules on the account.`
@@ -7756,7 +9126,7 @@ var listCmd = defineCommand40({
7756
9126
  }
7757
9127
  }
7758
9128
  });
7759
- var healthCmd = defineCommand40({
9129
+ var healthCmd = defineCommand42({
7760
9130
  meta: {
7761
9131
  name: "health",
7762
9132
  description: `5-point Insight Tag / CAPI health check (playbook \xA707).
@@ -7786,7 +9156,7 @@ Surfaces:
7786
9156
  }
7787
9157
  }
7788
9158
  });
7789
- var conversionsCommand = defineCommand40({
9159
+ var conversionsCommand2 = defineCommand42({
7790
9160
  meta: {
7791
9161
  name: "conversions",
7792
9162
  description: `Conversion rules \u2014 Insight Tag and Conversions API.
@@ -7805,8 +9175,8 @@ Subcommands:
7805
9175
  });
7806
9176
 
7807
9177
  // src/commands/ads/linkedin/creatives.ts
7808
- import { defineCommand as defineCommand41 } from "citty";
7809
- var creativesCommand = defineCommand41({
9178
+ import { defineCommand as defineCommand43 } from "citty";
9179
+ var creativesCommand = defineCommand43({
7810
9180
  meta: {
7811
9181
  name: "creatives",
7812
9182
  description: `List LinkedIn creatives (ads), or stage writes (create/update/pause/resume/duplicate).
@@ -7865,7 +9235,7 @@ Examples:
7865
9235
  });
7866
9236
 
7867
9237
  // src/commands/ads/linkedin/demographics.ts
7868
- import { defineCommand as defineCommand42 } from "citty";
9238
+ import { defineCommand as defineCommand44 } from "citty";
7869
9239
  var DEFAULT_PIVOTS = ["job-title", "company", "industry", "seniority", "job-function", "company-size"];
7870
9240
  function numberOf2(v) {
7871
9241
  if (typeof v === "number") return Number.isFinite(v) ? v : 0;
@@ -7878,7 +9248,7 @@ function numberOf2(v) {
7878
9248
  function topByImpressions(rows, limit) {
7879
9249
  return [...rows].sort((a, b) => numberOf2(b.impressions) - numberOf2(a.impressions)).slice(0, limit);
7880
9250
  }
7881
- var demographicsCommand = defineCommand42({
9251
+ var demographicsCommand = defineCommand44({
7882
9252
  meta: {
7883
9253
  name: "demographics",
7884
9254
  description: `Sweep all firmographic pivots in one command \u2014 LinkedIn's superpower.
@@ -7975,7 +9345,7 @@ function resolveRange(args) {
7975
9345
  }
7976
9346
 
7977
9347
  // src/commands/ads/linkedin/draft.ts
7978
- import { defineCommand as defineCommand43 } from "citty";
9348
+ import { defineCommand as defineCommand45 } from "citty";
7979
9349
  async function listDraft() {
7980
9350
  try {
7981
9351
  const chatId = requireChatId();
@@ -7987,14 +9357,14 @@ async function listDraft() {
7987
9357
  handleLinkedinError(err);
7988
9358
  }
7989
9359
  }
7990
- var listCommand3 = defineCommand43({
9360
+ var listCommand3 = defineCommand45({
7991
9361
  meta: {
7992
9362
  name: "list",
7993
9363
  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"
7994
9364
  },
7995
9365
  run: listDraft
7996
9366
  });
7997
- var removeCommand2 = defineCommand43({
9367
+ var removeCommand2 = defineCommand45({
7998
9368
  meta: {
7999
9369
  name: "remove",
8000
9370
  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"
@@ -8019,7 +9389,7 @@ var removeCommand2 = defineCommand43({
8019
9389
  }
8020
9390
  }
8021
9391
  });
8022
- var clearCommand2 = defineCommand43({
9392
+ var clearCommand2 = defineCommand45({
8023
9393
  meta: {
8024
9394
  name: "clear",
8025
9395
  description: "Discard ALL staged LinkedIn ops in this chat's draft \u2014 nothing will apply on publish. Example: baker ads linkedin draft clear"
@@ -8036,7 +9406,7 @@ var clearCommand2 = defineCommand43({
8036
9406
  }
8037
9407
  }
8038
9408
  });
8039
- var linkedinDraftCommand = defineCommand43({
9409
+ var linkedinDraftCommand = defineCommand45({
8040
9410
  meta: {
8041
9411
  name: "draft",
8042
9412
  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."
@@ -8050,8 +9420,8 @@ var linkedinDraftCommand = defineCommand43({
8050
9420
  });
8051
9421
 
8052
9422
  // src/commands/ads/linkedin/facets.ts
8053
- import { defineCommand as defineCommand44 } from "citty";
8054
- var listCmd2 = defineCommand44({
9423
+ import { defineCommand as defineCommand46 } from "citty";
9424
+ var listCmd2 = defineCommand46({
8055
9425
  meta: {
8056
9426
  name: "list",
8057
9427
  description: `List every targeting facet LinkedIn supports.
@@ -8079,7 +9449,7 @@ seniorities, titles, employers, growthRate, companyCategory, skills, etc.).`
8079
9449
  }
8080
9450
  }
8081
9451
  });
8082
- var valuesCmd = defineCommand44({
9452
+ var valuesCmd = defineCommand46({
8083
9453
  meta: {
8084
9454
  name: "values",
8085
9455
  description: `Look up entity values for a single facet \u2014 full list or typeahead search.
@@ -8120,7 +9490,7 @@ or the full URN (urn:li:adTargetingFacet:industries).`
8120
9490
  }
8121
9491
  }
8122
9492
  });
8123
- var facetsCommand = defineCommand44({
9493
+ var facetsCommand = defineCommand46({
8124
9494
  meta: {
8125
9495
  name: "facets",
8126
9496
  description: `LinkedIn targeting facets and entity lookup.
@@ -8137,8 +9507,8 @@ Subcommands:
8137
9507
  });
8138
9508
 
8139
9509
  // src/commands/ads/linkedin/forecast.ts
8140
- import { readFileSync as readFileSync7 } from "fs";
8141
- import { defineCommand as defineCommand45 } from "citty";
9510
+ import { readFileSync as readFileSync8 } from "fs";
9511
+ import { defineCommand as defineCommand47 } from "citty";
8142
9512
  function loadTargeting3(args) {
8143
9513
  const inline = args.targeting;
8144
9514
  if (inline) {
@@ -8151,7 +9521,7 @@ function loadTargeting3(args) {
8151
9521
  const file = args["targeting-file"];
8152
9522
  if (file) {
8153
9523
  try {
8154
- return JSON.parse(readFileSync7(file, "utf-8"));
9524
+ return JSON.parse(readFileSync8(file, "utf-8"));
8155
9525
  } catch (e) {
8156
9526
  handleLinkedinError(
8157
9527
  new Error(`Failed to read --targeting-file: ${e instanceof Error ? e.message : "I/O error"}`)
@@ -8168,7 +9538,7 @@ function parseMoney(raw) {
8168
9538
  }
8169
9539
  return { amount: m[1] ?? "0", currencyCode: m[2] ?? "USD" };
8170
9540
  }
8171
- var forecastCommand = defineCommand45({
9541
+ var forecastCommand = defineCommand47({
8172
9542
  meta: {
8173
9543
  name: "forecast",
8174
9544
  description: `Forecast reach + impressions + clicks + spend for a hypothetical campaign.
@@ -8215,9 +9585,9 @@ Examples:
8215
9585
  });
8216
9586
 
8217
9587
  // src/commands/ads/linkedin/leads.ts
8218
- import { defineCommand as defineCommand46 } from "citty";
9588
+ import { defineCommand as defineCommand48 } from "citty";
8219
9589
  var DAY_MS4 = 864e5;
8220
- var leadsCommand = defineCommand46({
9590
+ var leadsCommand = defineCommand48({
8221
9591
  meta: {
8222
9592
  name: "leads",
8223
9593
  description: `List Lead Gen Form responses (playbook \xA707).
@@ -8277,7 +9647,7 @@ Examples:
8277
9647
  });
8278
9648
 
8279
9649
  // src/commands/ads/linkedin/resolve.ts
8280
- import { defineCommand as defineCommand47 } from "citty";
9650
+ import { defineCommand as defineCommand49 } from "citty";
8281
9651
  function toOrgUrn(raw) {
8282
9652
  const trimmed = raw.trim();
8283
9653
  if (trimmed.length === 0) {
@@ -8288,7 +9658,7 @@ function toOrgUrn(raw) {
8288
9658
  }
8289
9659
  return /^\d+$/.test(trimmed) ? `urn:li:organization:${trimmed}` : null;
8290
9660
  }
8291
- var resolveCommand = defineCommand47({
9661
+ var resolveCommand = defineCommand49({
8292
9662
  meta: {
8293
9663
  name: "resolve",
8294
9664
  description: `Resolve organization URNs to company names.
@@ -8330,8 +9700,8 @@ couldn't be resolved \u2014 typically an org outside LinkedIn's targetable set.`
8330
9700
  });
8331
9701
 
8332
9702
  // src/commands/ads/linkedin/top-companies.ts
8333
- import { defineCommand as defineCommand48 } from "citty";
8334
- var topCompaniesCommand = defineCommand48({
9703
+ import { defineCommand as defineCommand50 } from "citty";
9704
+ var topCompaniesCommand = defineCommand50({
8335
9705
  meta: {
8336
9706
  name: "top-companies",
8337
9707
  description: `Top companies whose employees saw / clicked / converted on a campaign.
@@ -8402,7 +9772,7 @@ Examples:
8402
9772
  });
8403
9773
 
8404
9774
  // src/commands/ads/linkedin/index.ts
8405
- var linkedinCommand = defineCommand49({
9775
+ var linkedinCommand = defineCommand51({
8406
9776
  meta: {
8407
9777
  name: "linkedin",
8408
9778
  description: `LinkedIn Marketing API \u2014 AI-first command surface for B2B ad insights.
@@ -8447,9 +9817,9 @@ Account ID format:
8447
9817
  accounts: accountsCommand2,
8448
9818
  account: accountCommand,
8449
9819
  "campaign-groups": campaignGroupsCommand,
8450
- campaigns: campaignsCommand,
9820
+ campaigns: campaignsCommand2,
8451
9821
  creatives: creativesCommand,
8452
- audiences: audiencesCommand,
9822
+ audiences: audiencesCommand2,
8453
9823
  "lead-forms": leadFormsCommand,
8454
9824
  draft: linkedinDraftCommand,
8455
9825
  analytics: analyticsCommand,
@@ -8461,17 +9831,17 @@ Account ID format:
8461
9831
  "bid-pricing": bidPricingCommand,
8462
9832
  forecast: forecastCommand,
8463
9833
  leads: leadsCommand,
8464
- conversions: conversionsCommand,
9834
+ conversions: conversionsCommand2,
8465
9835
  conversation: conversationCommand,
8466
9836
  audit: auditCommand
8467
9837
  }
8468
9838
  });
8469
9839
 
8470
9840
  // src/commands/ads/meta/index.ts
8471
- import { defineCommand as defineCommand62 } from "citty";
9841
+ import { defineCommand as defineCommand64 } from "citty";
8472
9842
 
8473
9843
  // src/commands/ads/meta/account.ts
8474
- import { defineCommand as defineCommand50 } from "citty";
9844
+ import { defineCommand as defineCommand52 } from "citty";
8475
9845
 
8476
9846
  // src/commands/ads/meta/shared.ts
8477
9847
  var DAY_MS5 = 864e5;
@@ -8550,7 +9920,7 @@ function resolveEffectiveStatus(args) {
8550
9920
  }
8551
9921
 
8552
9922
  // src/commands/ads/meta/account.ts
8553
- var accountCommand2 = defineCommand50({
9923
+ var accountCommand2 = defineCommand52({
8554
9924
  meta: {
8555
9925
  name: "account",
8556
9926
  description: `Show single Meta ad account detail (currency, timezone, balance, business).
@@ -8577,8 +9947,8 @@ Examples:
8577
9947
  });
8578
9948
 
8579
9949
  // src/commands/ads/meta/accounts.ts
8580
- import { defineCommand as defineCommand51 } from "citty";
8581
- var accountsCommand3 = defineCommand51({
9950
+ import { defineCommand as defineCommand53 } from "citty";
9951
+ var accountsCommand3 = defineCommand53({
8582
9952
  meta: {
8583
9953
  name: "accounts",
8584
9954
  description: `List Meta ad accounts in this company's connected scope.
@@ -8626,8 +9996,8 @@ Examples:
8626
9996
  });
8627
9997
 
8628
9998
  // src/commands/ads/meta/activities.ts
8629
- import { defineCommand as defineCommand52 } from "citty";
8630
- var activitiesCommand = defineCommand52({
9999
+ import { defineCommand as defineCommand54 } from "citty";
10000
+ var activitiesCommand = defineCommand54({
8631
10001
  meta: {
8632
10002
  name: "activities",
8633
10003
  description: `Audit log of recent ad-account changes (created, paused, edited). Default lookback 7 days,
@@ -8664,8 +10034,8 @@ Examples:
8664
10034
  });
8665
10035
 
8666
10036
  // src/commands/ads/meta/ads.ts
8667
- import { defineCommand as defineCommand53 } from "citty";
8668
- var adsListCommand = defineCommand53({
10037
+ import { defineCommand as defineCommand55 } from "citty";
10038
+ var adsListCommand = defineCommand55({
8669
10039
  meta: {
8670
10040
  name: "ads",
8671
10041
  description: `List ads in a Meta ad account. Defaults to ACTIVE only \u2014 pass --all-statuses to widen.
@@ -8713,8 +10083,8 @@ Examples:
8713
10083
  });
8714
10084
 
8715
10085
  // src/commands/ads/meta/adsets.ts
8716
- import { defineCommand as defineCommand54 } from "citty";
8717
- var adsetsCommand = defineCommand54({
10086
+ import { defineCommand as defineCommand56 } from "citty";
10087
+ var adsetsCommand = defineCommand56({
8718
10088
  meta: {
8719
10089
  name: "adsets",
8720
10090
  description: `List ad sets in a Meta ad account, optionally scoped to one campaign. Defaults to ACTIVE only.
@@ -8756,8 +10126,8 @@ Examples:
8756
10126
  });
8757
10127
 
8758
10128
  // src/commands/ads/meta/audiences.ts
8759
- import { defineCommand as defineCommand55 } from "citty";
8760
- var audiencesCommand2 = defineCommand55({
10129
+ import { defineCommand as defineCommand57 } from "citty";
10130
+ var audiencesCommand3 = defineCommand57({
8761
10131
  meta: {
8762
10132
  name: "audiences",
8763
10133
  description: `List custom audiences for a Meta ad account. Includes lookalikes, website-pixel audiences,
@@ -8792,8 +10162,8 @@ Examples:
8792
10162
  });
8793
10163
 
8794
10164
  // src/commands/ads/meta/businesses.ts
8795
- import { defineCommand as defineCommand56 } from "citty";
8796
- var businessesCommand = defineCommand56({
10165
+ import { defineCommand as defineCommand58 } from "citty";
10166
+ var businessesCommand = defineCommand58({
8797
10167
  meta: {
8798
10168
  name: "businesses",
8799
10169
  description: `List Meta Business Manager accounts the connected user has access to. Required for ad-studies and product-catalogs commands.
@@ -8823,8 +10193,8 @@ Examples:
8823
10193
  });
8824
10194
 
8825
10195
  // src/commands/ads/meta/campaigns.ts
8826
- import { defineCommand as defineCommand57 } from "citty";
8827
- var campaignsCommand2 = defineCommand57({
10196
+ import { defineCommand as defineCommand59 } from "citty";
10197
+ var campaignsCommand3 = defineCommand59({
8828
10198
  meta: {
8829
10199
  name: "campaigns",
8830
10200
  description: `List campaigns for a Meta ad account. Defaults to ACTIVE only \u2014 pass --all-statuses to widen.
@@ -8868,8 +10238,8 @@ Examples:
8868
10238
  });
8869
10239
 
8870
10240
  // src/commands/ads/meta/creatives.ts
8871
- import { defineCommand as defineCommand58 } from "citty";
8872
- var creativesCommand2 = defineCommand58({
10241
+ import { defineCommand as defineCommand60 } from "citty";
10242
+ var creativesCommand2 = defineCommand60({
8873
10243
  meta: {
8874
10244
  name: "creatives",
8875
10245
  description: `List ad creatives in an account, or fetch a single creative by ID.
@@ -8913,7 +10283,7 @@ Examples:
8913
10283
  });
8914
10284
 
8915
10285
  // src/commands/ads/meta/insights.ts
8916
- import { defineCommand as defineCommand59 } from "citty";
10286
+ import { defineCommand as defineCommand61 } from "citty";
8917
10287
 
8918
10288
  // src/commands/ads/meta/presets.ts
8919
10289
  var INSIGHTS_INTENTS = {
@@ -9118,7 +10488,7 @@ function sortRowsBySpendDesc(rows) {
9118
10488
  return sb - sa;
9119
10489
  });
9120
10490
  }
9121
- var insightsCommand = defineCommand59({
10491
+ var insightsCommand = defineCommand61({
9122
10492
  meta: {
9123
10493
  name: "insights",
9124
10494
  description: `Performance reporting \u2014 the main Meta tool for AI agents.
@@ -9219,8 +10589,8 @@ Async is automatic for heavy queries; pass --async to force it, or --no-async to
9219
10589
  });
9220
10590
 
9221
10591
  // src/commands/ads/meta/pixels.ts
9222
- import { defineCommand as defineCommand60 } from "citty";
9223
- var pixelsCommand = defineCommand60({
10592
+ import { defineCommand as defineCommand62 } from "citty";
10593
+ var pixelsCommand = defineCommand62({
9224
10594
  meta: {
9225
10595
  name: "pixels",
9226
10596
  description: `List Meta Pixels for an ad account, or fetch firing stats for one pixel.
@@ -9291,7 +10661,7 @@ function emit(data, args) {
9291
10661
 
9292
10662
  // src/commands/ads/meta/preview.ts
9293
10663
  import { writeFileSync as writeFileSync3 } from "fs";
9294
- import { defineCommand as defineCommand61 } from "citty";
10664
+ import { defineCommand as defineCommand63 } from "citty";
9295
10665
  var VALID_AD_FORMATS = [
9296
10666
  "DESKTOP_FEED_STANDARD",
9297
10667
  "MOBILE_FEED_STANDARD",
@@ -9325,7 +10695,7 @@ var VALID_AD_FORMATS = [
9325
10695
  "MARKETPLACE_MOBILE",
9326
10696
  "BIZ_DISCO_FEED_MOBILE"
9327
10697
  ];
9328
- var previewCommand = defineCommand61({
10698
+ var previewCommand = defineCommand63({
9329
10699
  meta: {
9330
10700
  name: "preview",
9331
10701
  description: `Generate a Meta-hosted preview iframe for a creative or ad. Returns iframe HTML which you
@@ -9372,7 +10742,7 @@ Examples:
9372
10742
  });
9373
10743
 
9374
10744
  // src/commands/ads/meta/index.ts
9375
- var metaCommand = defineCommand62({
10745
+ var metaCommand = defineCommand64({
9376
10746
  meta: {
9377
10747
  name: "meta",
9378
10748
  description: `Meta Marketing API \u2014 AI-first command surface (Facebook + Instagram ads).
@@ -9411,11 +10781,11 @@ Audit & review:
9411
10781
  accounts: accountsCommand3,
9412
10782
  account: accountCommand2,
9413
10783
  businesses: businessesCommand,
9414
- campaigns: campaignsCommand2,
10784
+ campaigns: campaignsCommand3,
9415
10785
  adsets: adsetsCommand,
9416
10786
  ads: adsListCommand,
9417
10787
  creatives: creativesCommand2,
9418
- audiences: audiencesCommand2,
10788
+ audiences: audiencesCommand3,
9419
10789
  pixels: pixelsCommand,
9420
10790
  activities: activitiesCommand,
9421
10791
  insights: insightsCommand,
@@ -9424,10 +10794,10 @@ Audit & review:
9424
10794
  });
9425
10795
 
9426
10796
  // src/commands/ads/x/index.ts
9427
- import { defineCommand as defineCommand79 } from "citty";
10797
+ import { defineCommand as defineCommand81 } from "citty";
9428
10798
 
9429
10799
  // src/commands/ads/x/accounts.ts
9430
- import { defineCommand as defineCommand63 } from "citty";
10800
+ import { defineCommand as defineCommand65 } from "citty";
9431
10801
  registerSchema({
9432
10802
  command: "ads.x.accounts",
9433
10803
  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.",
@@ -9455,7 +10825,7 @@ function handleAccountsError2(err) {
9455
10825
  writeAdsJson({ ok: false, error: { code: "NETWORK_ERROR", message: "Unexpected error" } });
9456
10826
  process.exit(1);
9457
10827
  }
9458
- var accountsCommand4 = defineCommand63({
10828
+ var accountsCommand4 = defineCommand65({
9459
10829
  meta: {
9460
10830
  name: "accounts",
9461
10831
  description: `List accessible X Ads accounts. Returns account IDs needed for all other commands.
@@ -9495,7 +10865,7 @@ Examples:
9495
10865
  });
9496
10866
 
9497
10867
  // src/commands/ads/x/active-entities.ts
9498
- import { defineCommand as defineCommand64 } from "citty";
10868
+ import { defineCommand as defineCommand66 } from "citty";
9499
10869
 
9500
10870
  // src/commands/ads/x/error-parser.ts
9501
10871
  function mapXErrorCode(message) {
@@ -9646,7 +11016,7 @@ function parseCsv(v) {
9646
11016
  const parts = v.split(",").map((s) => s.trim()).filter(Boolean);
9647
11017
  return parts.length > 0 ? parts : void 0;
9648
11018
  }
9649
- var activeEntitiesCommand = defineCommand64({
11019
+ var activeEntitiesCommand = defineCommand66({
9650
11020
  meta: {
9651
11021
  name: "active-entities",
9652
11022
  description: `List entities with metric activity in a time range.
@@ -9704,7 +11074,7 @@ Examples:
9704
11074
  });
9705
11075
 
9706
11076
  // src/commands/ads/x/audiences.ts
9707
- import { defineCommand as defineCommand65 } from "citty";
11077
+ import { defineCommand as defineCommand67 } from "citty";
9708
11078
  registerSchema({
9709
11079
  command: "ads.x.audiences",
9710
11080
  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.",
@@ -9713,7 +11083,7 @@ registerSchema({
9713
11083
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
9714
11084
  }
9715
11085
  });
9716
- var audiencesCommand3 = defineCommand65({
11086
+ var audiencesCommand4 = defineCommand67({
9717
11087
  meta: {
9718
11088
  name: "audiences",
9719
11089
  description: `List X Ads custom audiences.
@@ -9762,7 +11132,7 @@ Examples:
9762
11132
  });
9763
11133
 
9764
11134
  // src/commands/ads/x/campaigns.ts
9765
- import { defineCommand as defineCommand66 } from "citty";
11135
+ import { defineCommand as defineCommand68 } from "citty";
9766
11136
 
9767
11137
  // src/commands/ads/x/run-list.ts
9768
11138
  function buildCleanParams(opts) {
@@ -9825,7 +11195,7 @@ registerSchema({
9825
11195
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
9826
11196
  }
9827
11197
  });
9828
- var campaignsCommand3 = defineCommand66({
11198
+ var campaignsCommand4 = defineCommand68({
9829
11199
  meta: {
9830
11200
  name: "campaigns",
9831
11201
  description: `List X Ads campaigns. Returns budget, schedule, funding instrument, status.
@@ -9867,7 +11237,7 @@ Examples:
9867
11237
  });
9868
11238
 
9869
11239
  // src/commands/ads/x/cards.ts
9870
- import { defineCommand as defineCommand67 } from "citty";
11240
+ import { defineCommand as defineCommand69 } from "citty";
9871
11241
  registerSchema({
9872
11242
  command: "ads.x.cards",
9873
11243
  description: "List website cards, video cards, and carousels for an X Ads account.",
@@ -9876,7 +11246,7 @@ registerSchema({
9876
11246
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
9877
11247
  }
9878
11248
  });
9879
- var cardsCommand = defineCommand67({
11249
+ var cardsCommand = defineCommand69({
9880
11250
  meta: {
9881
11251
  name: "cards",
9882
11252
  description: `List X Ads cards (rich creatives).
@@ -9925,7 +11295,7 @@ Examples:
9925
11295
  });
9926
11296
 
9927
11297
  // src/commands/ads/x/funding.ts
9928
- import { defineCommand as defineCommand68 } from "citty";
11298
+ import { defineCommand as defineCommand70 } from "citty";
9929
11299
  registerSchema({
9930
11300
  command: "ads.x.funding",
9931
11301
  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.",
@@ -9934,7 +11304,7 @@ registerSchema({
9934
11304
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
9935
11305
  }
9936
11306
  });
9937
- var fundingCommand = defineCommand68({
11307
+ var fundingCommand = defineCommand70({
9938
11308
  meta: {
9939
11309
  name: "funding",
9940
11310
  description: `List funding instruments for an X Ads account.
@@ -9983,7 +11353,7 @@ Examples:
9983
11353
  });
9984
11354
 
9985
11355
  // src/commands/ads/x/line-items.ts
9986
- import { defineCommand as defineCommand69 } from "citty";
11356
+ import { defineCommand as defineCommand71 } from "citty";
9987
11357
  registerSchema({
9988
11358
  command: "ads.x.lineItems",
9989
11359
  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).",
@@ -9995,7 +11365,7 @@ registerSchema({
9995
11365
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
9996
11366
  }
9997
11367
  });
9998
- var lineItemsCommand = defineCommand69({
11368
+ var lineItemsCommand = defineCommand71({
9999
11369
  meta: {
10000
11370
  name: "line-items",
10001
11371
  description: `List X Ads line items (ad groups).
@@ -10036,7 +11406,7 @@ Examples:
10036
11406
  });
10037
11407
 
10038
11408
  // src/commands/ads/x/media.ts
10039
- import { defineCommand as defineCommand70 } from "citty";
11409
+ import { defineCommand as defineCommand72 } from "citty";
10040
11410
  registerSchema({
10041
11411
  command: "ads.x.media",
10042
11412
  description: "List media assets in the X Ads media library (images, GIFs, videos). Filter by media-type (IMAGE, GIF, VIDEO).",
@@ -10046,7 +11416,7 @@ registerSchema({
10046
11416
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
10047
11417
  }
10048
11418
  });
10049
- var mediaCommand = defineCommand70({
11419
+ var mediaCommand = defineCommand72({
10050
11420
  meta: {
10051
11421
  name: "media",
10052
11422
  description: `List media assets in the X Ads media library.
@@ -10098,7 +11468,7 @@ Examples:
10098
11468
  });
10099
11469
 
10100
11470
  // src/commands/ads/x/promoted-tweets.ts
10101
- import { defineCommand as defineCommand71 } from "citty";
11471
+ import { defineCommand as defineCommand73 } from "citty";
10102
11472
  registerSchema({
10103
11473
  command: "ads.x.promotedTweets",
10104
11474
  description: "List promoted tweets for an X Ads account. Returns id, line_item_id, tweet_id, approval_status. Filter by line-item-ids (CSV).",
@@ -10109,7 +11479,7 @@ registerSchema({
10109
11479
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
10110
11480
  }
10111
11481
  });
10112
- var promotedTweetsCommand = defineCommand71({
11482
+ var promotedTweetsCommand = defineCommand73({
10113
11483
  meta: {
10114
11484
  name: "promoted-tweets",
10115
11485
  description: `List X Ads promoted tweets.
@@ -10163,11 +11533,11 @@ Examples:
10163
11533
  });
10164
11534
 
10165
11535
  // src/commands/ads/x/stats/index.ts
10166
- import { defineCommand as defineCommand76 } from "citty";
11536
+ import { defineCommand as defineCommand78 } from "citty";
10167
11537
 
10168
11538
  // src/commands/ads/x/stats/job.ts
10169
11539
  import { gunzipSync } from "zlib";
10170
- import { defineCommand as defineCommand72 } from "citty";
11540
+ import { defineCommand as defineCommand74 } from "citty";
10171
11541
  var POLL_INTERVAL_MS2 = 1e4;
10172
11542
  var DEADLINE_MS = 12 * 60 * 1e3;
10173
11543
  var RESULT_CACHE_TTL_MS = 6 * 60 * 60 * 1e3;
@@ -10237,7 +11607,7 @@ async function pollUntilDone(accountId, jobId) {
10237
11607
  function buildCacheKey(body) {
10238
11608
  return `stats-job:${JSON.stringify(body)}`;
10239
11609
  }
10240
- var statsJobCommand = defineCommand72({
11610
+ var statsJobCommand = defineCommand74({
10241
11611
  meta: {
10242
11612
  name: "job",
10243
11613
  description: `Async X Ads stats job, sync from the CLI's perspective. Creates \u2192 polls \u2192 downloads \u2192 returns.
@@ -10342,7 +11712,7 @@ For fine-grained control (don't wait, poll yourself), use:
10342
11712
  });
10343
11713
 
10344
11714
  // src/commands/ads/x/stats/job-create.ts
10345
- import { defineCommand as defineCommand73 } from "citty";
11715
+ import { defineCommand as defineCommand75 } from "citty";
10346
11716
  registerSchema({
10347
11717
  command: "ads.x.statsJobCreate",
10348
11718
  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.",
@@ -10365,7 +11735,7 @@ function parseCsv3(v) {
10365
11735
  const parts = v.split(",").map((s) => s.trim()).filter(Boolean);
10366
11736
  return parts.length > 0 ? parts : void 0;
10367
11737
  }
10368
- var statsJobCreateCommand = defineCommand73({
11738
+ var statsJobCreateCommand = defineCommand75({
10369
11739
  meta: {
10370
11740
  name: "job-create",
10371
11741
  description: `Create an async X Ads stats job (up to 90 days, supports segmentation).
@@ -10428,7 +11798,7 @@ Examples:
10428
11798
  });
10429
11799
 
10430
11800
  // src/commands/ads/x/stats/job-status.ts
10431
- import { defineCommand as defineCommand74 } from "citty";
11801
+ import { defineCommand as defineCommand76 } from "citty";
10432
11802
  registerSchema({
10433
11803
  command: "ads.x.statsJobStatus",
10434
11804
  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).",
@@ -10438,7 +11808,7 @@ registerSchema({
10438
11808
  "job-ids": { type: "string", description: "CSV of job IDs", required: false }
10439
11809
  }
10440
11810
  });
10441
- var statsJobStatusCommand = defineCommand74({
11811
+ var statsJobStatusCommand = defineCommand76({
10442
11812
  meta: {
10443
11813
  name: "job-status",
10444
11814
  description: `Poll the status of an async X Ads stats job.
@@ -10479,7 +11849,7 @@ Examples:
10479
11849
  });
10480
11850
 
10481
11851
  // src/commands/ads/x/stats/sync.ts
10482
- import { defineCommand as defineCommand75 } from "citty";
11852
+ import { defineCommand as defineCommand77 } from "citty";
10483
11853
 
10484
11854
  // src/commands/ads/x/presets.ts
10485
11855
  var X_STATS_PRESETS = [
@@ -10638,7 +12008,7 @@ async function runSync(args, q) {
10638
12008
  process.exit(1);
10639
12009
  }
10640
12010
  }
10641
- var statsSyncCommand = defineCommand75({
12011
+ var statsSyncCommand = defineCommand77({
10642
12012
  meta: {
10643
12013
  name: "sync",
10644
12014
  description: `Synchronous X Ads analytics (max 7-day window).
@@ -10681,7 +12051,7 @@ Examples:
10681
12051
  });
10682
12052
 
10683
12053
  // src/commands/ads/x/stats/index.ts
10684
- var statsCommand = defineCommand76({
12054
+ var statsCommand = defineCommand78({
10685
12055
  meta: {
10686
12056
  name: "stats",
10687
12057
  description: `X Ads analytics. Sync (\u22647 days, no segmentation) or async jobs (\u226490 days, segmentable).
@@ -10709,7 +12079,7 @@ Examples:
10709
12079
  });
10710
12080
 
10711
12081
  // src/commands/ads/x/targeting-constants.ts
10712
- import { defineCommand as defineCommand77 } from "citty";
12082
+ import { defineCommand as defineCommand79 } from "citty";
10713
12083
  var ALLOWED_CONSTANTS = [
10714
12084
  "locations",
10715
12085
  "interests",
@@ -10737,7 +12107,7 @@ registerSchema({
10737
12107
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
10738
12108
  }
10739
12109
  });
10740
- var targetingConstantsCommand = defineCommand77({
12110
+ var targetingConstantsCommand = defineCommand79({
10741
12111
  meta: {
10742
12112
  name: "targeting-constants",
10743
12113
  description: `Lookup X Ads targeting constants.
@@ -10787,7 +12157,7 @@ Examples:
10787
12157
  });
10788
12158
 
10789
12159
  // src/commands/ads/x/targeting-criteria.ts
10790
- import { defineCommand as defineCommand78 } from "citty";
12160
+ import { defineCommand as defineCommand80 } from "citty";
10791
12161
  registerSchema({
10792
12162
  command: "ads.x.targetingCriteria",
10793
12163
  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.",
@@ -10797,7 +12167,7 @@ registerSchema({
10797
12167
  "no-cache": { type: "boolean", description: "Skip cache", required: false }
10798
12168
  }
10799
12169
  });
10800
- var targetingCriteriaCommand = defineCommand78({
12170
+ var targetingCriteriaCommand = defineCommand80({
10801
12171
  meta: {
10802
12172
  name: "targeting-criteria",
10803
12173
  description: `List targeting criteria attached to line items.
@@ -10848,7 +12218,7 @@ Examples:
10848
12218
  });
10849
12219
 
10850
12220
  // src/commands/ads/x/index.ts
10851
- var xCommand = defineCommand79({
12221
+ var xCommand = defineCommand81({
10852
12222
  meta: {
10853
12223
  name: "x",
10854
12224
  description: `X (Twitter) Ads commands. Read campaigns, line items, promoted tweets, creatives, audiences, and analytics.
@@ -10872,12 +12242,12 @@ The CLI auto-detects --account-id when exactly one X Ads account is connected, o
10872
12242
  subCommands: {
10873
12243
  accounts: accountsCommand4,
10874
12244
  funding: fundingCommand,
10875
- campaigns: campaignsCommand3,
12245
+ campaigns: campaignsCommand4,
10876
12246
  "line-items": lineItemsCommand,
10877
12247
  "promoted-tweets": promotedTweetsCommand,
10878
12248
  cards: cardsCommand,
10879
12249
  media: mediaCommand,
10880
- audiences: audiencesCommand3,
12250
+ audiences: audiencesCommand4,
10881
12251
  "targeting-criteria": targetingCriteriaCommand,
10882
12252
  "targeting-constants": targetingConstantsCommand,
10883
12253
  "active-entities": activeEntitiesCommand,
@@ -10886,7 +12256,7 @@ The CLI auto-detects --account-id when exactly one X Ads account is connected, o
10886
12256
  });
10887
12257
 
10888
12258
  // src/commands/ads/index.ts
10889
- var adsCommand = defineCommand80({
12259
+ var adsCommand2 = defineCommand82({
10890
12260
  meta: {
10891
12261
  name: "ads",
10892
12262
  description: `Ad platform commands. Each platform exposes its own native command surface \u2014 no forced parity.
@@ -10916,11 +12286,11 @@ Examples:
10916
12286
  });
10917
12287
 
10918
12288
  // src/commands/canvas/index.ts
10919
- import { defineCommand as defineCommand88 } from "citty";
12289
+ import { defineCommand as defineCommand90 } from "citty";
10920
12290
 
10921
12291
  // src/commands/canvas/catalog.ts
10922
- import { defineCommand as defineCommand81 } from "citty";
10923
- var catalogCommand = defineCommand81({
12292
+ import { defineCommand as defineCommand83 } from "citty";
12293
+ var catalogCommand = defineCommand83({
10924
12294
  meta: {
10925
12295
  name: "catalog",
10926
12296
  description: "Print the agent-facing node catalog (JSON Schema). Includes every registered node grouped by category."
@@ -10937,9 +12307,9 @@ import { execFile } from "child_process";
10937
12307
  import { readdir, readFile, stat } from "fs/promises";
10938
12308
  import path from "path";
10939
12309
  import { promisify } from "util";
10940
- import { defineCommand as defineCommand82 } from "citty";
12310
+ import { defineCommand as defineCommand84 } from "citty";
10941
12311
  var execFileAsync = promisify(execFile);
10942
- var inspectCommand = defineCommand82({
12312
+ var inspectCommand = defineCommand84({
10943
12313
  meta: {
10944
12314
  name: "inspect",
10945
12315
  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."
@@ -11048,7 +12418,7 @@ async function probeDuration(filePath) {
11048
12418
  // src/commands/canvas/run.ts
11049
12419
  import { readFile as readFile2 } from "fs/promises";
11050
12420
  import path4 from "path";
11051
- import { defineCommand as defineCommand83 } from "citty";
12421
+ import { defineCommand as defineCommand85 } from "citty";
11052
12422
 
11053
12423
  // src/commands/canvas/placeholders.ts
11054
12424
  function unsuppliedPlaceholderAssets(canvas) {
@@ -11118,7 +12488,7 @@ async function pruneOldRuns(outputsDir, keep, currentRunId, log) {
11118
12488
  }
11119
12489
 
11120
12490
  // src/commands/canvas/run.ts
11121
- var runCommand = defineCommand83({
12491
+ var runCommand = defineCommand85({
11122
12492
  meta: { name: "run", description: "Validate and execute a canvas JSON file." },
11123
12493
  args: {
11124
12494
  file: { type: "positional", required: true, description: "Path to canvas JSON" },
@@ -11214,30 +12584,30 @@ var runCommand = defineCommand83({
11214
12584
  // src/commands/canvas/scaffold-static-ad.ts
11215
12585
  import { readFile as readFile3, writeFile } from "fs/promises";
11216
12586
  import path5 from "path";
11217
- import { defineCommand as defineCommand84 } from "citty";
12587
+ import { defineCommand as defineCommand86 } from "citty";
11218
12588
 
11219
12589
  // src/engine/scaffold/staticAd.ts
11220
- import { z as z8 } from "zod";
12590
+ import { z as z10 } from "zod";
11221
12591
  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"]);
11222
12592
  var DEFAULT_ASPECT_RATIO = "9:16";
11223
- var Blueprint = z8.object({
11224
- meta: z8.object({ estimated_aspect_ratio: z8.string().optional() }).loose().optional(),
11225
- text_content: z8.array(z8.object({ text: z8.string().optional() }).loose()).optional()
12593
+ var Blueprint = z10.object({
12594
+ meta: z10.object({ estimated_aspect_ratio: z10.string().optional() }).loose().optional(),
12595
+ text_content: z10.array(z10.object({ text: z10.string().optional() }).loose()).optional()
11226
12596
  }).loose();
11227
- var ElementLocator = z8.object({
11228
- collection: z8.enum(["subjects", "people", "brands_logos"]),
11229
- index: z8.number().int().nonnegative()
12597
+ var ElementLocator = z10.object({
12598
+ collection: z10.enum(["subjects", "people", "brands_logos"]),
12599
+ index: z10.number().int().nonnegative()
11230
12600
  }).loose();
11231
- var MainElement = z8.object({
12601
+ var MainElement = z10.object({
11232
12602
  // logo | product | person | animal | badge | other
11233
- type: z8.string(),
11234
- label: z8.string().optional(),
11235
- description: z8.string().optional(),
11236
- expression: z8.string().nullable().optional(),
11237
- reason: z8.string().optional(),
12603
+ type: z10.string(),
12604
+ label: z10.string().optional(),
12605
+ description: z10.string().optional(),
12606
+ expression: z10.string().nullable().optional(),
12607
+ reason: z10.string().optional(),
11238
12608
  locator: ElementLocator.optional()
11239
12609
  }).loose();
11240
- var MainElements = z8.array(MainElement);
12610
+ var MainElements = z10.array(MainElement);
11241
12611
  function sanitizeId(raw, fallback) {
11242
12612
  const id = raw.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
11243
12613
  return /^[a-z]/.test(id) ? id : `${fallback}_${id}`.replace(/_+$/g, "") || fallback;
@@ -11279,7 +12649,7 @@ function roleForType(type) {
11279
12649
  return "the showcased product; keep this exact product identity. Ignore any caption text printed on this reference.";
11280
12650
  case "person":
11281
12651
  case "animal":
11282
- 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.";
12652
+ return "the hero subject; keep this identity AND the expression the blueprint specifies. Ignore any caption text printed on this reference.";
11283
12653
  default:
11284
12654
  return "an identity-bearing element; reproduce it faithfully from this reference. Ignore any caption text printed on it.";
11285
12655
  }
@@ -11287,9 +12657,7 @@ function roleForType(type) {
11287
12657
  function todoPath(el, label) {
11288
12658
  const desc = el.description ? ` \u2014 ${el.description}` : "";
11289
12659
  const expr = el.expression ? `, with a ${el.expression} expression` : "";
11290
- const t = el.type.toLowerCase();
11291
- 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" : "";
11292
- return `[TODO: drop a real image for ${label} (${el.type})${desc}${expr}${lock}]`;
12660
+ return `[TODO: drop a real image for ${label} (${el.type})${desc}${expr}]`;
11293
12661
  }
11294
12662
  function aspectRatio(blueprint, opts) {
11295
12663
  const requested = opts.aspectRatio ?? blueprint.meta?.estimated_aspect_ratio;
@@ -11404,7 +12772,7 @@ function resolveModel(kind, preferred) {
11404
12772
  const ids = Object.keys(MODEL_REGISTRY[kind]);
11405
12773
  return ids.includes(preferred) ? preferred : ids[0] ?? preferred;
11406
12774
  }
11407
- 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`;
12775
+ 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";
11408
12776
  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.";
11409
12777
  var LAYOUT_PROMPT = `AD BLUEPRINT (from image_describe):
11410
12778
  {{blueprint}}
@@ -11426,20 +12794,7 @@ Return a JSON object describing the GLOBAL LAYOUT of the frame precisely enough
11426
12794
 
11427
12795
  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.`;
11428
12796
  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.';
11429
- var SELECT_PROMPT = `AD BLUEPRINT (from image_describe):
11430
- {{blueprint}}
11431
-
11432
- 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:
11433
- - the brand logo/wordmark (from brands_logos with function_in_image = advertiser_brand) -> type "logo"
11434
- - 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"
11435
- - a showcased/hero product or package (a foreground entry in subjects that the ad is selling) -> type "product"
11436
- - 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"
11437
- - 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"
11438
- (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.)
11439
-
11440
- DROP background extras, decorative props, generic scenery, and anything small or incidental. Keep at most ~6. If there are none, return an empty list.
11441
-
11442
- 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.`;
12797
+ 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.';
11443
12798
  async function loadAssetText(ref, label) {
11444
12799
  const r = ref;
11445
12800
  if (typeof r?.path === "string") return readFile3(r.path, "utf8");
@@ -11548,7 +12903,7 @@ async function runVisionPasses(canvas) {
11548
12903
  return fail("read_outputs", e instanceof Error ? e.message : String(e));
11549
12904
  }
11550
12905
  }
11551
- var scaffoldStaticAdCommand = defineCommand84({
12906
+ var scaffoldStaticAdCommand = defineCommand86({
11552
12907
  meta: {
11553
12908
  name: "scaffold-static-ad",
11554
12909
  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."
@@ -11642,7 +12997,7 @@ var scaffoldStaticAdCommand = defineCommand84({
11642
12997
  // src/commands/canvas/scaffold-video.ts
11643
12998
  import { cp, mkdir, readFile as readFile6, writeFile as writeFile2 } from "fs/promises";
11644
12999
  import path8 from "path";
11645
- import { defineCommand as defineCommand85 } from "citty";
13000
+ import { defineCommand as defineCommand87 } from "citty";
11646
13001
 
11647
13002
  // src/engine/nodes/local/lib/sceneDetect.ts
11648
13003
  import { execFile as execFile2 } from "child_process";
@@ -11747,7 +13102,7 @@ import { toCardinal as nwKo } from "n2words/ko-KR";
11747
13102
  import { toCardinal as nwNl } from "n2words/nl-NL";
11748
13103
  import { toCardinal as nwPl } from "n2words/pl-PL";
11749
13104
  import { toCardinal as nwPt } from "n2words/pt-PT";
11750
- import { z as z9 } from "zod";
13105
+ import { z as z11 } from "zod";
11751
13106
 
11752
13107
  // src/engine/scaffold/lib/shoot-modes.ts
11753
13108
  var SHOOT_MODES = [
@@ -12004,49 +13359,49 @@ function trimArgs(durationS, offsetS = 0) {
12004
13359
  "{{out.video}}"
12005
13360
  ];
12006
13361
  }
12007
- var FrameAsset = z9.object({ url: z9.string().optional() }).loose().optional();
12008
- var DialogueLine = z9.object({
12009
- speaker: z9.string().optional(),
12010
- line: z9.string().optional(),
13362
+ var FrameAsset = z11.object({ url: z11.string().optional() }).loose().optional();
13363
+ var DialogueLine = z11.object({
13364
+ speaker: z11.string().optional(),
13365
+ line: z11.string().optional(),
12011
13366
  // Absolute seconds on the source timeline (the deconstruct emits both).
12012
- start_s: z9.number().optional(),
12013
- end_s: z9.number().optional(),
12014
- delivery: z9.string().optional(),
12015
- voice_description: z9.string().optional()
13367
+ start_s: z11.number().optional(),
13368
+ end_s: z11.number().optional(),
13369
+ delivery: z11.string().optional(),
13370
+ voice_description: z11.string().optional()
12016
13371
  }).loose();
12017
- var Sfx = z9.object({
12018
- at_s: z9.number().optional(),
12019
- duration_s: z9.number().optional(),
12020
- sound_effect_prompt: z9.string().optional(),
12021
- description: z9.string().optional()
13372
+ var Sfx = z11.object({
13373
+ at_s: z11.number().optional(),
13374
+ duration_s: z11.number().optional(),
13375
+ sound_effect_prompt: z11.string().optional(),
13376
+ description: z11.string().optional()
12022
13377
  }).loose();
12023
- var CompositionRegion = z9.object({
13378
+ var CompositionRegion = z11.object({
12024
13379
  // full | top | bottom | left | right | inset
12025
- panel: z9.string().optional(),
13380
+ panel: z11.string().optional(),
12026
13381
  // 9-grid anchor for an `inset` presenter box.
12027
- position: z9.string().optional(),
12028
- is_presenter: z9.boolean().optional(),
13382
+ position: z11.string().optional(),
13383
+ is_presenter: z11.boolean().optional(),
12029
13384
  // The cast id shown/speaking in this region (routes lip-sync + element refs).
12030
- cast_ref: z9.string().optional(),
12031
- summary: z9.string().optional(),
12032
- frame_prompt: z9.string().optional(),
12033
- motion_prompt: z9.string().optional()
13385
+ cast_ref: z11.string().optional(),
13386
+ summary: z11.string().optional(),
13387
+ frame_prompt: z11.string().optional(),
13388
+ motion_prompt: z11.string().optional()
12034
13389
  }).loose();
12035
- var SceneComposition = z9.object({
13390
+ var SceneComposition = z11.object({
12036
13391
  // full_frame (default) | split_screen | pip | keyed_overlay
12037
- layout: z9.string().optional(),
13392
+ layout: z11.string().optional(),
12038
13393
  // split_screen only: vertical (top/bottom) | horizontal (left/right).
12039
- split_axis: z9.string().optional(),
12040
- regions: z9.array(CompositionRegion).optional()
13394
+ split_axis: z11.string().optional(),
13395
+ regions: z11.array(CompositionRegion).optional()
12041
13396
  }).loose();
12042
- var CameraMotion = z9.object({ movement: z9.string().optional(), detail: z9.string().optional() }).loose();
12043
- var TranscriptWord = z9.object({ text: z9.string().optional() }).loose();
12044
- var Scene = z9.object({
12045
- start_s: z9.number().optional(),
12046
- end_s: z9.number().optional(),
12047
- duration_s: z9.number().optional(),
12048
- summary: z9.string().optional(),
12049
- action_detail: z9.string().optional(),
13397
+ var CameraMotion = z11.object({ movement: z11.string().optional(), detail: z11.string().optional() }).loose();
13398
+ var TranscriptWord = z11.object({ text: z11.string().optional() }).loose();
13399
+ var Scene = z11.object({
13400
+ start_s: z11.number().optional(),
13401
+ end_s: z11.number().optional(),
13402
+ duration_s: z11.number().optional(),
13403
+ summary: z11.string().optional(),
13404
+ action_detail: z11.string().optional(),
12050
13405
  // The scene's spatial layout. Absent/full_frame ⇒ one uncut shot (default path).
12051
13406
  // A layered layout (split_screen/pip/keyed_overlay) with regions ⇒ the scaffold
12052
13407
  // builds one clip per region and stacks/overlays them into the scene picture.
@@ -12054,77 +13409,77 @@ var Scene = z9.object({
12054
13409
  // The capture "look" for this scene — selected from the ad-native shoot-mode
12055
13410
  // grammar (see lib/shoot-modes.ts). When absent the scaffold auto-derives a
12056
13411
  // UGC/product mode; a human can override per scene by setting this.
12057
- shoot_mode: z9.string().optional(),
13412
+ shoot_mode: z11.string().optional(),
12058
13413
  // Diegetic ambient the clip's native audio should carry (no music). When
12059
13414
  // absent the scene falls back to its shoot mode's default ambience.
12060
- ambient: z9.string().optional(),
13415
+ ambient: z11.string().optional(),
12061
13416
  camera_motion: CameraMotion.optional(),
12062
- start_frame_prompt: z9.string().optional(),
12063
- end_frame_prompt: z9.string().optional(),
12064
- motion_prompt: z9.string().optional(),
13417
+ start_frame_prompt: z11.string().optional(),
13418
+ end_frame_prompt: z11.string().optional(),
13419
+ motion_prompt: z11.string().optional(),
12065
13420
  // The scene's role in the ad's persuasion arc (DECON-supplied); drives the
12066
13421
  // script re-craft checklist. Inferred from position when absent.
12067
- narrative_role: z9.string().optional(),
13422
+ narrative_role: z11.string().optional(),
12068
13423
  // DECON-supplied on the HOOK scene: the engineered physical/emotional state that
12069
13424
  // makes the first frame stop the scroll (sweaty/breathless/urgent …). Injected
12070
13425
  // into the hook's start-frame description so the generator renders that state,
12071
13426
  // not a calm influencer (CCA-11).
12072
- hook_mechanic: z9.object({ mechanic: z9.string().optional(), why_it_stops_scroll: z9.string().optional() }).loose().optional(),
13427
+ hook_mechanic: z11.object({ mechanic: z11.string().optional(), why_it_stops_scroll: z11.string().optional() }).loose().optional(),
12073
13428
  // DECON-supplied per-scene location (so a gym hook isn't flattened to "home").
12074
- scene_setting: z9.string().optional(),
13429
+ scene_setting: z11.string().optional(),
12075
13430
  // How this scene cuts to the next (DECON-supplied). A recognized non-cut type
12076
13431
  // (fade/whip/zoom/dissolve/swipe) is reproduced as an ffmpeg xfade at the
12077
13432
  // boundary; cut/match_cut/none/other stay hard cuts. The last scene's value is
12078
13433
  // ignored (nothing follows it).
12079
- transition_out: z9.object({ type: z9.string().optional(), description: z9.string().optional() }).loose().optional(),
12080
- dialogue: z9.array(DialogueLine).optional(),
12081
- sfx: z9.array(Sfx).optional(),
12082
- overlays: z9.array(z9.unknown()).optional(),
12083
- floating_elements: z9.array(z9.unknown()).optional(),
12084
- transcript_slice: z9.array(TranscriptWord).optional(),
13434
+ transition_out: z11.object({ type: z11.string().optional(), description: z11.string().optional() }).loose().optional(),
13435
+ dialogue: z11.array(DialogueLine).optional(),
13436
+ sfx: z11.array(Sfx).optional(),
13437
+ overlays: z11.array(z11.unknown()).optional(),
13438
+ floating_elements: z11.array(z11.unknown()).optional(),
13439
+ transcript_slice: z11.array(TranscriptWord).optional(),
12085
13440
  start_frame_asset: FrameAsset,
12086
13441
  end_frame_asset: FrameAsset,
12087
13442
  // DECON-supplied: true when this scene is a length-split CONTINUATION of the
12088
13443
  // previous one (the SAME physical shot, broken up only because it exceeded the
12089
13444
  // clip ceiling). The scaffold then shares the splice keyframe — this scene's
12090
13445
  // start frame IS the previous scene's end frame — so the join is seamless.
12091
- continues_previous: z9.boolean().optional()
13446
+ continues_previous: z11.boolean().optional()
12092
13447
  }).loose();
12093
- var VideoBlueprint = z9.object({
12094
- source: z9.object({ aspect_ratio: z9.string().optional(), duration_s: z9.number().optional() }).loose().optional(),
12095
- global: z9.object({
12096
- music: z9.object({
12097
- present: z9.boolean().optional(),
12098
- music_prompt: z9.string().optional(),
13448
+ var VideoBlueprint = z11.object({
13449
+ source: z11.object({ aspect_ratio: z11.string().optional(), duration_s: z11.number().optional() }).loose().optional(),
13450
+ global: z11.object({
13451
+ music: z11.object({
13452
+ present: z11.boolean().optional(),
13453
+ music_prompt: z11.string().optional(),
12099
13454
  // Absolute second the music enters in the reference (the bed often
12100
13455
  // kicks in mid-ad, after the hook). We start the regenerated track here
12101
13456
  // instead of at 0 so the timing matches.
12102
- starts_at_s: z9.number().optional(),
13457
+ starts_at_s: z11.number().optional(),
12103
13458
  // Populated by the deconstruct when AudD (Shazam-style) recognizes the
12104
13459
  // reference track. We never reuse it — only style the regenerated bed.
12105
- identified_track: z9.object({ title: z9.string().optional(), artist: z9.string().optional() }).loose().nullish()
13460
+ identified_track: z11.object({ title: z11.string().optional(), artist: z11.string().optional() }).loose().nullish()
12106
13461
  }).loose().optional(),
12107
- cast: z9.array(
12108
- z9.object({
12109
- id: z9.string().optional(),
12110
- description: z9.string().optional(),
13462
+ cast: z11.array(
13463
+ z11.object({
13464
+ id: z11.string().optional(),
13465
+ description: z11.string().optional(),
12111
13466
  // The deconstruct's note on the target-market localization (e.g. "native
12112
13467
  // French speaker") — read to derive the spoken-track language code.
12113
- market_localization_note: z9.string().optional()
13468
+ market_localization_note: z11.string().optional()
12114
13469
  }).loose()
12115
13470
  ).optional(),
12116
- voiceover: z9.object({
13471
+ voiceover: z11.object({
12117
13472
  // on_camera | mixed → mouths are on screen (lip-sync candidates);
12118
13473
  // voiceover | none → narration over the picture (no lip-sync).
12119
- mode: z9.string().optional(),
12120
- voice_description: z9.string().optional(),
12121
- persona: z9.string().optional()
13474
+ mode: z11.string().optional(),
13475
+ voice_description: z11.string().optional(),
13476
+ persona: z11.string().optional()
12122
13477
  }).loose().optional(),
12123
13478
  // Visual palette — read only to colour a clean brand-card/CTA plate (the
12124
13479
  // first hex is the dominant brand colour); never to drive frame generation.
12125
- style: z9.object({ palette: z9.array(z9.object({ hex: z9.string().optional() }).loose()).optional() }).loose().optional()
13480
+ style: z11.object({ palette: z11.array(z11.object({ hex: z11.string().optional() }).loose()).optional() }).loose().optional()
12126
13481
  }).loose().optional(),
12127
- scenes: z9.array(Scene).min(1)
13482
+ scenes: z11.array(Scene).min(1)
12128
13483
  }).loose();
12129
13484
  function injectHookPhysicality(blueprint) {
12130
13485
  for (const scene of blueprint.scenes) {
@@ -12134,26 +13489,26 @@ function injectHookPhysicality(blueprint) {
12134
13489
  scene.start_frame_prompt = `${prompt} The subject's physical state IS the scroll-stopper \u2014 render it explicitly, not a calm pose: ${why}.`;
12135
13490
  }
12136
13491
  }
12137
- var AppearsItem = z9.union([z9.number(), z9.object({ scene: z9.number(), edge: z9.string().optional() }).loose()]);
12138
- var RecurringElement = z9.object({
13492
+ var AppearsItem = z11.union([z11.number(), z11.object({ scene: z11.number(), edge: z11.string().optional() }).loose()]);
13493
+ var RecurringElement = z11.object({
12139
13494
  // person | animal | product | logo | badge | other
12140
- type: z9.string(),
12141
- label: z9.string().optional(),
12142
- description: z9.string().optional(),
12143
- expression: z9.string().nullable().optional(),
13495
+ type: z11.string(),
13496
+ label: z11.string().optional(),
13497
+ description: z11.string().optional(),
13498
+ expression: z11.string().nullable().optional(),
12144
13499
  // When the element maps to a global cast entry, its stable id (for annotation).
12145
- cast_id: z9.string().nullable().optional(),
13500
+ cast_id: z11.string().nullable().optional(),
12146
13501
  // The label of another element that is the SAME individual as this one, shown
12147
13502
  // in a DIFFERENT wardrobe/persona/state (e.g. one creator playing skeptic in a
12148
13503
  // pink shirt and believer in a white shirt). Each look gets its own reference
12149
13504
  // slot, but the face/identity must stay identical across them.
12150
- same_as: z9.string().nullable().optional(),
13505
+ same_as: z11.string().nullable().optional(),
12151
13506
  // Scenes the element appears in. Either a bare list of scene indices (both
12152
13507
  // edges) or per-{scene,edge} entries. Both forms are accepted and merged.
12153
- scenes: z9.array(z9.number()).optional(),
12154
- appears_in: z9.array(AppearsItem).optional()
13508
+ scenes: z11.array(z11.number()).optional(),
13509
+ appears_in: z11.array(AppearsItem).optional()
12155
13510
  }).loose();
12156
- var RecurringElements = z9.array(RecurringElement);
13511
+ var RecurringElements = z11.array(RecurringElement);
12157
13512
  function sanitizeId2(raw, fallback) {
12158
13513
  const id = raw.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
12159
13514
  return /^[a-z]/.test(id) ? id : `${fallback}_${id}`.replace(/_+$/g, "") || fallback;
@@ -13616,25 +14971,25 @@ function buildSfxMusic(blueprint, nodes) {
13616
14971
  }
13617
14972
  return tracks;
13618
14973
  }
13619
- var OverlayStyle = z9.object({ color_hex: z9.string().optional(), background: z9.string().optional(), size: z9.string().optional() }).loose();
13620
- var Overlay = z9.object({
13621
- text: z9.string().optional(),
13622
- appears_at_s: z9.number().optional(),
13623
- duration_s: z9.number().optional(),
13624
- position: z9.string().optional(),
13625
- role: z9.string().optional(),
13626
- animation: z9.string().optional(),
13627
- animation_detail: z9.string().optional(),
14974
+ var OverlayStyle = z11.object({ color_hex: z11.string().optional(), background: z11.string().optional(), size: z11.string().optional() }).loose();
14975
+ var Overlay = z11.object({
14976
+ text: z11.string().optional(),
14977
+ appears_at_s: z11.number().optional(),
14978
+ duration_s: z11.number().optional(),
14979
+ position: z11.string().optional(),
14980
+ role: z11.string().optional(),
14981
+ animation: z11.string().optional(),
14982
+ animation_detail: z11.string().optional(),
13628
14983
  style: OverlayStyle.optional()
13629
14984
  }).loose();
13630
- var FloatingElement = z9.object({
13631
- kind: z9.string().optional(),
13632
- description: z9.string().optional(),
13633
- brand_name: z9.string().nullish(),
13634
- what_it_represents: z9.string().optional(),
13635
- appears_at_s: z9.number().optional(),
13636
- duration_s: z9.number().optional(),
13637
- position: z9.string().optional()
14985
+ var FloatingElement = z11.object({
14986
+ kind: z11.string().optional(),
14987
+ description: z11.string().optional(),
14988
+ brand_name: z11.string().nullish(),
14989
+ what_it_represents: z11.string().optional(),
14990
+ appears_at_s: z11.number().optional(),
14991
+ duration_s: z11.number().optional(),
14992
+ position: z11.string().optional()
13638
14993
  }).loose();
13639
14994
  function escapeHtml(s) {
13640
14995
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
@@ -13666,7 +15021,7 @@ function positionClass(position) {
13666
15021
  function collectCaptions(blueprint) {
13667
15022
  return blueprint.scenes.flatMap((scene) => {
13668
15023
  const sceneStart = scene.start_s ?? 0;
13669
- const overlays = z9.array(Overlay).safeParse(scene.overlays ?? []);
15024
+ const overlays = z11.array(Overlay).safeParse(scene.overlays ?? []);
13670
15025
  return overlays.success ? overlays.data.filter((ov) => Boolean(ov.text?.trim())).map((ov) => {
13671
15026
  const at = ov.appears_at_s ?? sceneStart;
13672
15027
  return { text: ov.text.trim(), at, end: at + (ov.duration_s ?? 2.5), ov };
@@ -13775,7 +15130,7 @@ function buildOverlayHtml(input) {
13775
15130
  if (ovParts.length > 0) blocks.push(ovParts.join("\n"));
13776
15131
  for (const scene of blueprint.scenes) {
13777
15132
  const sceneStart = scene.start_s ?? 0;
13778
- const floats = z9.array(FloatingElement).safeParse(scene.floating_elements ?? []);
15133
+ const floats = z11.array(FloatingElement).safeParse(scene.floating_elements ?? []);
13779
15134
  const parts = (floats.success ? floats.data.map((fe) => floatingStub(fe, sceneStart)) : []).filter(Boolean);
13780
15135
  const pip = uiPipStub(scene);
13781
15136
  if (pip) parts.push(pip);
@@ -14032,8 +15387,8 @@ function buildMotionBoard(blueprint) {
14032
15387
  const end_s = scene.end_s ?? start_s + sceneDurationS(scene);
14033
15388
  cursor = end_s;
14034
15389
  const spoken = sceneSpokenText(scene);
14035
- const overlays = z9.array(Overlay).safeParse(scene.overlays ?? []);
14036
- const floats = z9.array(FloatingElement).safeParse(scene.floating_elements ?? []);
15390
+ const overlays = z11.array(Overlay).safeParse(scene.overlays ?? []);
15391
+ const floats = z11.array(FloatingElement).safeParse(scene.floating_elements ?? []);
14037
15392
  const graphics = [
14038
15393
  ...(overlays.success ? overlays.data : []).filter((ov) => ov.text?.trim()).map((ov) => ({
14039
15394
  kind: "text",
@@ -14474,7 +15829,7 @@ async function runAnalysisPasses(deconstructCanvas, selectModel) {
14474
15829
  return fail2("deconstruct", e instanceof Error ? e.message : String(e));
14475
15830
  }
14476
15831
  }
14477
- var scaffoldVideoCommand = defineCommand85({
15832
+ var scaffoldVideoCommand = defineCommand87({
14478
15833
  meta: {
14479
15834
  name: "scaffold-video",
14480
15835
  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`."
@@ -14619,7 +15974,7 @@ var scaffoldVideoCommand = defineCommand85({
14619
15974
  // src/commands/canvas/set-prompt.ts
14620
15975
  import { readFile as readFile7, writeFile as writeFile3 } from "fs/promises";
14621
15976
  import path9 from "path";
14622
- import { defineCommand as defineCommand86 } from "citty";
15977
+ import { defineCommand as defineCommand88 } from "citty";
14623
15978
  function setNodePrompt(canvas, nodeId, text) {
14624
15979
  const nodes = canvas?.nodes;
14625
15980
  if (!Array.isArray(nodes)) throw new Error("canvas has no nodes array");
@@ -14634,7 +15989,7 @@ function setNodePrompt(canvas, nodeId, text) {
14634
15989
  newNodes[idx] = newNode;
14635
15990
  return { ...canvas, nodes: newNodes };
14636
15991
  }
14637
- var setPromptCommand = defineCommand86({
15992
+ var setPromptCommand = defineCommand88({
14638
15993
  meta: {
14639
15994
  name: "set-prompt",
14640
15995
  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."
@@ -14694,8 +16049,8 @@ var setPromptCommand = defineCommand86({
14694
16049
  // src/commands/canvas/validate.ts
14695
16050
  import { readFile as readFile8 } from "fs/promises";
14696
16051
  import path10 from "path";
14697
- import { defineCommand as defineCommand87 } from "citty";
14698
- var validateCommand = defineCommand87({
16052
+ import { defineCommand as defineCommand89 } from "citty";
16053
+ var validateCommand = defineCommand89({
14699
16054
  meta: {
14700
16055
  name: "validate",
14701
16056
  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)."
@@ -14738,7 +16093,7 @@ var validateCommand = defineCommand87({
14738
16093
  });
14739
16094
 
14740
16095
  // src/commands/canvas/index.ts
14741
- var canvasCommand = defineCommand88({
16096
+ var canvasCommand = defineCommand90({
14742
16097
  meta: {
14743
16098
  name: "canvas",
14744
16099
  description: `Run Baker creative canvas JSON files locally. Local nodes execute in-process; remote nodes POST to the Convex backend gateway.
@@ -14765,10 +16120,10 @@ Subcommands:
14765
16120
  });
14766
16121
 
14767
16122
  // src/commands/creatives/index.ts
14768
- import { defineCommand as defineCommand90 } from "citty";
16123
+ import { defineCommand as defineCommand92 } from "citty";
14769
16124
 
14770
16125
  // src/commands/creatives/publish.ts
14771
- import { defineCommand as defineCommand89 } from "citty";
16126
+ import { defineCommand as defineCommand91 } from "citty";
14772
16127
 
14773
16128
  // src/commands/images/api.ts
14774
16129
  import { readFile as readFile9 } from "fs/promises";
@@ -14891,7 +16246,7 @@ async function publishCreative(args, deps = defaultImageApiDeps) {
14891
16246
  sourceReferenceUrl
14892
16247
  });
14893
16248
  }
14894
- var publishCommand = defineCommand89({
16249
+ var publishCommand = defineCommand91({
14895
16250
  meta: {
14896
16251
  name: "publish",
14897
16252
  description: "Publish a final static creative image to Baker Creatives and print the creative reference JSON."
@@ -14937,7 +16292,7 @@ var publishCommand = defineCommand89({
14937
16292
  });
14938
16293
 
14939
16294
  // src/commands/creatives/index.ts
14940
- var creativesCommand3 = defineCommand90({
16295
+ var creativesCommand3 = defineCommand92({
14941
16296
  meta: {
14942
16297
  name: "creatives",
14943
16298
  description: `Publish static ad creatives as first-class Baker outputs.
@@ -14953,10 +16308,10 @@ Publishing uploads the image to the Company image library, applies the official
14953
16308
  });
14954
16309
 
14955
16310
  // src/commands/ga4/index.ts
14956
- import { defineCommand as defineCommand94 } from "citty";
16311
+ import { defineCommand as defineCommand96 } from "citty";
14957
16312
 
14958
16313
  // src/commands/ga4/audit.ts
14959
- import { defineCommand as defineCommand91 } from "citty";
16314
+ import { defineCommand as defineCommand93 } from "citty";
14960
16315
 
14961
16316
  // src/commands/ga4/resolve.ts
14962
16317
  async function fetchProperties(useCache = true) {
@@ -15019,7 +16374,7 @@ registerSchema({
15019
16374
  "no-cache": { type: "boolean", description: "Skip cache, hit API directly", required: false }
15020
16375
  }
15021
16376
  });
15022
- var auditCommand2 = defineCommand91({
16377
+ var auditCommand2 = defineCommand93({
15023
16378
  meta: {
15024
16379
  name: "audit",
15025
16380
  description: `Run all GA4 admin health checks. Returns property config with playbook warnings.
@@ -15071,7 +16426,7 @@ Examples:
15071
16426
  });
15072
16427
 
15073
16428
  // src/commands/ga4/properties.ts
15074
- import { defineCommand as defineCommand92 } from "citty";
16429
+ import { defineCommand as defineCommand94 } from "citty";
15075
16430
  registerSchema({
15076
16431
  command: "ga4.properties",
15077
16432
  description: "List all accessible GA4 properties. Returns property IDs needed for query and audit commands. Run this first to find property IDs.",
@@ -15079,7 +16434,7 @@ registerSchema({
15079
16434
  "no-cache": { type: "boolean", description: "Skip cache, hit API directly", required: false }
15080
16435
  }
15081
16436
  });
15082
- var propertiesCommand = defineCommand92({
16437
+ var propertiesCommand = defineCommand94({
15083
16438
  meta: {
15084
16439
  name: "properties",
15085
16440
  description: `List accessible GA4 properties.
@@ -15127,9 +16482,9 @@ Examples:
15127
16482
  });
15128
16483
 
15129
16484
  // src/commands/ga4/query.ts
15130
- import { appendFileSync as appendFileSync2, existsSync as existsSync5, readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "fs";
16485
+ import { appendFileSync as appendFileSync2, existsSync as existsSync5, readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "fs";
15131
16486
  import { resolve as resolve2 } from "path";
15132
- import { defineCommand as defineCommand93 } from "citty";
16487
+ import { defineCommand as defineCommand95 } from "citty";
15133
16488
 
15134
16489
  // src/commands/ga4/presets.ts
15135
16490
  var GA4_PRESETS = [
@@ -15218,7 +16573,7 @@ function writeRowsToFile2(filePath, rows, append) {
15218
16573
  writeFileSync4(filePath, content, "utf-8");
15219
16574
  }
15220
16575
  } else if (append && existsSync5(filePath)) {
15221
- const existing = JSON.parse(readFileSync8(filePath, "utf-8"));
16576
+ const existing = JSON.parse(readFileSync9(filePath, "utf-8"));
15222
16577
  writeFileSync4(filePath, JSON.stringify([...existing, ...rows], null, 2), "utf-8");
15223
16578
  } else {
15224
16579
  writeFileSync4(filePath, JSON.stringify(rows, null, 2), "utf-8");
@@ -15261,7 +16616,7 @@ function handleError(err) {
15261
16616
  });
15262
16617
  process.exit(1);
15263
16618
  }
15264
- var queryCommand2 = defineCommand93({
16619
+ var queryCommand2 = defineCommand95({
15265
16620
  meta: {
15266
16621
  name: "query",
15267
16622
  description: `Run GA4 Data API reports. Preset-first with free-form escape hatch.
@@ -15332,7 +16687,7 @@ Free-form (escape hatch):
15332
16687
  });
15333
16688
 
15334
16689
  // src/commands/ga4/index.ts
15335
- var ga4Command = defineCommand94({
16690
+ var ga4Command = defineCommand96({
15336
16691
  meta: {
15337
16692
  name: "ga4",
15338
16693
  description: `Google Analytics 4 commands. Audit property config, run playbook-aligned reports.
@@ -15355,12 +16710,12 @@ Examples:
15355
16710
  });
15356
16711
 
15357
16712
  // src/commands/gsc/index.ts
15358
- import { defineCommand as defineCommand98 } from "citty";
16713
+ import { defineCommand as defineCommand100 } from "citty";
15359
16714
 
15360
16715
  // src/commands/gsc/query.ts
15361
- import { appendFileSync as appendFileSync3, existsSync as existsSync6, readFileSync as readFileSync9, writeFileSync as writeFileSync5 } from "fs";
16716
+ import { appendFileSync as appendFileSync3, existsSync as existsSync6, readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "fs";
15362
16717
  import { resolve as resolve3 } from "path";
15363
- import { defineCommand as defineCommand95 } from "citty";
16718
+ import { defineCommand as defineCommand97 } from "citty";
15364
16719
 
15365
16720
  // src/commands/gsc/presets.ts
15366
16721
  var GSC_PRESETS = [
@@ -15503,7 +16858,7 @@ function writeRowsToFile3(filePath, rows, append) {
15503
16858
  writeFileSync5(filePath, content, "utf-8");
15504
16859
  }
15505
16860
  } else if (append && existsSync6(filePath)) {
15506
- const existing = JSON.parse(readFileSync9(filePath, "utf-8"));
16861
+ const existing = JSON.parse(readFileSync10(filePath, "utf-8"));
15507
16862
  writeFileSync5(filePath, JSON.stringify([...existing, ...rows], null, 2), "utf-8");
15508
16863
  } else {
15509
16864
  writeFileSync5(filePath, JSON.stringify(rows, null, 2), "utf-8");
@@ -15548,7 +16903,7 @@ function handleError2(err) {
15548
16903
  });
15549
16904
  process.exit(1);
15550
16905
  }
15551
- var queryCommand3 = defineCommand95({
16906
+ var queryCommand3 = defineCommand97({
15552
16907
  meta: {
15553
16908
  name: "query",
15554
16909
  description: `Run GSC Search Analytics queries. Preset-first with free-form escape hatch.
@@ -15626,7 +16981,7 @@ Free-form (escape hatch):
15626
16981
  });
15627
16982
 
15628
16983
  // src/commands/gsc/sitemaps.ts
15629
- import { defineCommand as defineCommand96 } from "citty";
16984
+ import { defineCommand as defineCommand98 } from "citty";
15630
16985
  registerSchema({
15631
16986
  command: "gsc.sitemaps",
15632
16987
  description: "List sitemaps for a Search Console site. Check sitemap health and errors.",
@@ -15635,7 +16990,7 @@ registerSchema({
15635
16990
  "no-cache": { type: "boolean", description: "Skip cache, hit API directly", required: false }
15636
16991
  }
15637
16992
  });
15638
- var sitemapsCommand = defineCommand96({
16993
+ var sitemapsCommand = defineCommand98({
15639
16994
  meta: {
15640
16995
  name: "sitemaps",
15641
16996
  description: `List sitemaps for a site. Check health and errors.
@@ -15685,7 +17040,7 @@ Examples:
15685
17040
  });
15686
17041
 
15687
17042
  // src/commands/gsc/sites.ts
15688
- import { defineCommand as defineCommand97 } from "citty";
17043
+ import { defineCommand as defineCommand99 } from "citty";
15689
17044
  registerSchema({
15690
17045
  command: "gsc.sites",
15691
17046
  description: "List all verified Google Search Console sites. Returns site URLs needed for query and sitemaps commands.",
@@ -15693,7 +17048,7 @@ registerSchema({
15693
17048
  "no-cache": { type: "boolean", description: "Skip cache, hit API directly", required: false }
15694
17049
  }
15695
17050
  });
15696
- var sitesCommand = defineCommand97({
17051
+ var sitesCommand = defineCommand99({
15697
17052
  meta: {
15698
17053
  name: "sites",
15699
17054
  description: `List verified Search Console sites.
@@ -15741,7 +17096,7 @@ Examples:
15741
17096
  });
15742
17097
 
15743
17098
  // src/commands/gsc/index.ts
15744
- var gscCommand = defineCommand98({
17099
+ var gscCommand = defineCommand100({
15745
17100
  meta: {
15746
17101
  name: "gsc",
15747
17102
  description: `Google Search Console commands. PPC-SEO arbitrage, brand halo analysis, negative keyword discovery.
@@ -15764,10 +17119,10 @@ Examples:
15764
17119
  });
15765
17120
 
15766
17121
  // src/commands/images/index.ts
15767
- import { defineCommand as defineCommand122 } from "citty";
17122
+ import { defineCommand as defineCommand124 } from "citty";
15768
17123
 
15769
17124
  // src/commands/images/crop.ts
15770
- import { defineCommand as defineCommand99 } from "citty";
17125
+ import { defineCommand as defineCommand101 } from "citty";
15771
17126
 
15772
17127
  // src/lib/image/crop-sprite.ts
15773
17128
  import sharp from "sharp";
@@ -15892,7 +17247,7 @@ function emitError2(err) {
15892
17247
  }
15893
17248
  process.exit(1);
15894
17249
  }
15895
- var cropCommand = defineCommand99({
17250
+ var cropCommand = defineCommand101({
15896
17251
  meta: {
15897
17252
  name: "crop",
15898
17253
  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"
@@ -15928,7 +17283,7 @@ var cropCommand = defineCommand99({
15928
17283
  });
15929
17284
 
15930
17285
  // src/commands/images/delete.ts
15931
- import { defineCommand as defineCommand100 } from "citty";
17286
+ import { defineCommand as defineCommand102 } from "citty";
15932
17287
  registerSchema({
15933
17288
  command: "images.delete",
15934
17289
  description: "Delete an image by ID",
@@ -15942,7 +17297,7 @@ registerSchema({
15942
17297
  }
15943
17298
  }
15944
17299
  });
15945
- var deleteCommand = defineCommand100({
17300
+ var deleteCommand = defineCommand102({
15946
17301
  meta: {
15947
17302
  name: "delete",
15948
17303
  description: "Delete an image by ID. Use --dry-run to preview. Example: baker images delete j571abc123 --dry-run"
@@ -15983,7 +17338,7 @@ var deleteCommand = defineCommand100({
15983
17338
  });
15984
17339
 
15985
17340
  // src/commands/images/dimensions.ts
15986
- import { defineCommand as defineCommand101 } from "citty";
17341
+ import { defineCommand as defineCommand103 } from "citty";
15987
17342
 
15988
17343
  // src/lib/image/dimensions.ts
15989
17344
  import { imageSize } from "image-size";
@@ -16006,7 +17361,7 @@ registerSchema({
16006
17361
  target: { type: "string", description: "Local file path or remote http(s) URL", required: true }
16007
17362
  }
16008
17363
  });
16009
- var dimensionsCommand = defineCommand101({
17364
+ var dimensionsCommand = defineCommand103({
16010
17365
  meta: {
16011
17366
  name: "dimensions",
16012
17367
  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"
@@ -16050,7 +17405,7 @@ var dimensionsCommand = defineCommand101({
16050
17405
  });
16051
17406
 
16052
17407
  // src/commands/images/extract.ts
16053
- import { defineCommand as defineCommand102 } from "citty";
17408
+ import { defineCommand as defineCommand104 } from "citty";
16054
17409
  registerSchema({
16055
17410
  command: "images.extract",
16056
17411
  description: "Extract images from a URL via Firecrawl (formats: images).",
@@ -16066,7 +17421,7 @@ registerSchema({
16066
17421
  }
16067
17422
  }
16068
17423
  });
16069
- var extractCommand = defineCommand102({
17424
+ var extractCommand = defineCommand104({
16070
17425
  meta: {
16071
17426
  name: "extract",
16072
17427
  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"
@@ -16104,7 +17459,7 @@ var extractCommand = defineCommand102({
16104
17459
  });
16105
17460
 
16106
17461
  // src/commands/images/find.ts
16107
- import { defineCommand as defineCommand103 } from "citty";
17462
+ import { defineCommand as defineCommand105 } from "citty";
16108
17463
  registerSchema({
16109
17464
  command: "images.find",
16110
17465
  description: "Fanout image search: library first, then opted-in external providers.",
@@ -16136,7 +17491,7 @@ registerSchema({
16136
17491
  }
16137
17492
  }
16138
17493
  });
16139
- var findCommand = defineCommand103({
17494
+ var findCommand = defineCommand105({
16140
17495
  meta: {
16141
17496
  name: "find",
16142
17497
  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"
@@ -16185,7 +17540,7 @@ var findCommand = defineCommand103({
16185
17540
 
16186
17541
  // src/commands/images/generate.ts
16187
17542
  import { readFile as readFile11 } from "fs/promises";
16188
- import { defineCommand as defineCommand104 } from "citty";
17543
+ import { defineCommand as defineCommand106 } from "citty";
16189
17544
  import sharp2 from "sharp";
16190
17545
  var GENERATE_TIMEOUT_MS = 18e4;
16191
17546
  var REFERENCE_MAX_EDGE = 1536;
@@ -16288,7 +17643,7 @@ async function resolveReferences(spec) {
16288
17643
  }
16289
17644
  return out;
16290
17645
  }
16291
- var generateCommand = defineCommand104({
17646
+ var generateCommand = defineCommand106({
16292
17647
  meta: {
16293
17648
  name: "generate",
16294
17649
  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]]'"
@@ -16340,7 +17695,7 @@ var generateCommand = defineCommand104({
16340
17695
  });
16341
17696
 
16342
17697
  // src/commands/images/get.ts
16343
- import { defineCommand as defineCommand105 } from "citty";
17698
+ import { defineCommand as defineCommand107 } from "citty";
16344
17699
  registerSchema({
16345
17700
  command: "images.get",
16346
17701
  description: "Get a single image by ID",
@@ -16348,7 +17703,7 @@ registerSchema({
16348
17703
  id: { type: "string", description: "Image ID", required: true }
16349
17704
  }
16350
17705
  });
16351
- var getCommand2 = defineCommand105({
17706
+ var getCommand2 = defineCommand107({
16352
17707
  meta: { name: "get", description: "Get a single image by ID. Example: baker images get j571abc123" },
16353
17708
  args: {
16354
17709
  id: { type: "positional", description: "Image ID", required: false },
@@ -16384,7 +17739,7 @@ var getCommand2 = defineCommand105({
16384
17739
  });
16385
17740
 
16386
17741
  // src/commands/images/gif.ts
16387
- import { defineCommand as defineCommand106 } from "citty";
17742
+ import { defineCommand as defineCommand108 } from "citty";
16388
17743
  registerSchema({
16389
17744
  command: "images.gif",
16390
17745
  description: "Search Giphy for GIFs / reaction memes (paid social creative).",
@@ -16416,7 +17771,7 @@ registerSchema({
16416
17771
  }
16417
17772
  }
16418
17773
  });
16419
- var gifCommand = defineCommand106({
17774
+ var gifCommand = defineCommand108({
16420
17775
  meta: {
16421
17776
  name: "gif",
16422
17777
  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"
@@ -16463,7 +17818,7 @@ var gifCommand = defineCommand106({
16463
17818
  });
16464
17819
 
16465
17820
  // src/commands/images/google.ts
16466
- import { defineCommand as defineCommand107 } from "citty";
17821
+ import { defineCommand as defineCommand109 } from "citty";
16467
17822
  registerSchema({
16468
17823
  command: "images.google",
16469
17824
  description: "Google Images search via the official Custom Search JSON API. Unverified source \u2014 inspect before placing.",
@@ -16499,7 +17854,7 @@ registerSchema({
16499
17854
  }
16500
17855
  }
16501
17856
  });
16502
- var googleCommand2 = defineCommand107({
17857
+ var googleCommand2 = defineCommand109({
16503
17858
  meta: {
16504
17859
  name: "google",
16505
17860
  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"
@@ -16547,7 +17902,7 @@ var googleCommand2 = defineCommand107({
16547
17902
  });
16548
17903
 
16549
17904
  // src/commands/images/icon.ts
16550
- import { defineCommand as defineCommand108 } from "citty";
17905
+ import { defineCommand as defineCommand110 } from "citty";
16551
17906
  registerSchema({
16552
17907
  command: "images.icon",
16553
17908
  description: "Icon lookup via Iconify (200+ icon sets, free CDN).",
@@ -16573,7 +17928,7 @@ registerSchema({
16573
17928
  }
16574
17929
  }
16575
17930
  });
16576
- var iconCommand = defineCommand108({
17931
+ var iconCommand = defineCommand110({
16577
17932
  meta: {
16578
17933
  name: "icon",
16579
17934
  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'"
@@ -16613,7 +17968,7 @@ var iconCommand = defineCommand108({
16613
17968
  });
16614
17969
 
16615
17970
  // src/commands/images/ingest.ts
16616
- import { defineCommand as defineCommand109 } from "citty";
17971
+ import { defineCommand as defineCommand111 } from "citty";
16617
17972
  registerSchema({
16618
17973
  command: "images.ingest",
16619
17974
  description: "Ingest a remote image URL into the library (full describe + embed).",
@@ -16625,7 +17980,7 @@ registerSchema({
16625
17980
  context: { type: "string", description: "Description context hint", required: false }
16626
17981
  }
16627
17982
  });
16628
- var ingestCommand = defineCommand109({
17983
+ var ingestCommand = defineCommand111({
16629
17984
  meta: {
16630
17985
  name: "ingest",
16631
17986
  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"
@@ -16667,7 +18022,7 @@ var ingestCommand = defineCommand109({
16667
18022
  });
16668
18023
 
16669
18024
  // src/commands/images/library.ts
16670
- import { defineCommand as defineCommand110 } from "citty";
18025
+ import { defineCommand as defineCommand112 } from "citty";
16671
18026
  registerSchema({
16672
18027
  command: "images.library",
16673
18028
  description: "Search the company image library. Returns only ready images.",
@@ -16693,7 +18048,7 @@ registerSchema({
16693
18048
  }
16694
18049
  }
16695
18050
  });
16696
- var libraryCommand = defineCommand110({
18051
+ var libraryCommand = defineCommand112({
16697
18052
  meta: {
16698
18053
  name: "library",
16699
18054
  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"
@@ -16750,7 +18105,7 @@ var libraryCommand = defineCommand110({
16750
18105
  });
16751
18106
 
16752
18107
  // src/commands/images/logo.ts
16753
- import { defineCommand as defineCommand111 } from "citty";
18108
+ import { defineCommand as defineCommand113 } from "citty";
16754
18109
  registerSchema({
16755
18110
  command: "images.logo",
16756
18111
  description: "Brand logo lookup via Brandfetch CDN (fallback/404). Auto-ingests by default.",
@@ -16775,7 +18130,7 @@ registerSchema({
16775
18130
  }
16776
18131
  }
16777
18132
  });
16778
- var logoCommand = defineCommand111({
18133
+ var logoCommand = defineCommand113({
16779
18134
  meta: {
16780
18135
  name: "logo",
16781
18136
  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"
@@ -16813,7 +18168,7 @@ var logoCommand = defineCommand111({
16813
18168
  });
16814
18169
 
16815
18170
  // src/commands/images/normalize.ts
16816
- import { defineCommand as defineCommand112 } from "citty";
18171
+ import { defineCommand as defineCommand114 } from "citty";
16817
18172
 
16818
18173
  // src/lib/image/color-changer.ts
16819
18174
  import quantize from "quantize";
@@ -17545,7 +18900,7 @@ function coerceRawArgs(args) {
17545
18900
  "dry-run": bool(args["dry-run"])
17546
18901
  };
17547
18902
  }
17548
- var normalizeCommand = defineCommand112({
18903
+ var normalizeCommand = defineCommand114({
17549
18904
  meta: {
17550
18905
  name: "normalize",
17551
18906
  description: `Normalize logos / images: declarative recolor + bg removal + trim + resize. Operates on local files; writes in-place by default.
@@ -17600,7 +18955,7 @@ Examples:
17600
18955
  });
17601
18956
 
17602
18957
  // src/commands/images/pinterest.ts
17603
- import { defineCommand as defineCommand113 } from "citty";
18958
+ import { defineCommand as defineCommand115 } from "citty";
17604
18959
  registerSchema({
17605
18960
  command: "images.pinterest",
17606
18961
  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.",
@@ -17620,7 +18975,7 @@ registerSchema({
17620
18975
  }
17621
18976
  }
17622
18977
  });
17623
- var pinterestCommand = defineCommand113({
18978
+ var pinterestCommand = defineCommand115({
17624
18979
  meta: {
17625
18980
  name: "pinterest",
17626
18981
  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'"
@@ -17660,7 +19015,7 @@ var pinterestCommand = defineCommand113({
17660
19015
  });
17661
19016
 
17662
19017
  // src/commands/images/screenshot.ts
17663
- import { defineCommand as defineCommand114 } from "citty";
19018
+ import { defineCommand as defineCommand116 } from "citty";
17664
19019
  registerSchema({
17665
19020
  command: "images.screenshot",
17666
19021
  description: "Capture a website screenshot via ScreenshotOne. Auto-ingests on success.",
@@ -17676,7 +19031,7 @@ registerSchema({
17676
19031
  }
17677
19032
  }
17678
19033
  });
17679
- var screenshotCommand = defineCommand114({
19034
+ var screenshotCommand = defineCommand116({
17680
19035
  meta: {
17681
19036
  name: "screenshot",
17682
19037
  description: "Screenshot a URL via ScreenshotOne. $0.009/capture. Auto-ingests to library.\n\nExample: baker images screenshot https://stripe.com --full-page"
@@ -17726,7 +19081,7 @@ var screenshotCommand = defineCommand114({
17726
19081
  });
17727
19082
 
17728
19083
  // src/commands/images/search.ts
17729
- import { defineCommand as defineCommand115 } from "citty";
19084
+ import { defineCommand as defineCommand117 } from "citty";
17730
19085
  registerSchema({
17731
19086
  command: "images.search",
17732
19087
  description: "Search images by text query. Only returns ready images.",
@@ -17742,7 +19097,7 @@ registerSchema({
17742
19097
  tags: { type: "string", description: "Comma-separated tags to filter by", required: false }
17743
19098
  }
17744
19099
  });
17745
- var searchCommand = defineCommand115({
19100
+ var searchCommand = defineCommand117({
17746
19101
  meta: {
17747
19102
  name: "search",
17748
19103
  description: "Semantic search images by text query. Uses hybrid BM25 + vector + reranking. Example: baker images search 'hero banner' --aspect-ratio 16:9 --tags logo"
@@ -17802,7 +19157,7 @@ var searchCommand = defineCommand115({
17802
19157
  });
17803
19158
 
17804
19159
  // src/commands/images/sticker.ts
17805
- import { defineCommand as defineCommand116 } from "citty";
19160
+ import { defineCommand as defineCommand118 } from "citty";
17806
19161
  registerSchema({
17807
19162
  command: "images.sticker",
17808
19163
  description: "Search Giphy stickers \u2014 transparent-background overlays for ad creative.",
@@ -17834,7 +19189,7 @@ registerSchema({
17834
19189
  }
17835
19190
  }
17836
19191
  });
17837
- var stickerCommand = defineCommand116({
19192
+ var stickerCommand = defineCommand118({
17838
19193
  meta: {
17839
19194
  name: "sticker",
17840
19195
  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"
@@ -17881,7 +19236,7 @@ var stickerCommand = defineCommand116({
17881
19236
  });
17882
19237
 
17883
19238
  // src/commands/images/stock.ts
17884
- import { defineCommand as defineCommand117 } from "citty";
19239
+ import { defineCommand as defineCommand119 } from "citty";
17885
19240
  registerSchema({
17886
19241
  command: "images.stock",
17887
19242
  description: "Stock photo, vector illustration, icon-set, and PSD search via Magnific (Freepik's developer API).",
@@ -17939,7 +19294,7 @@ registerSchema({
17939
19294
  }
17940
19295
  }
17941
19296
  });
17942
- var stockCommand = defineCommand117({
19297
+ var stockCommand = defineCommand119({
17943
19298
  meta: {
17944
19299
  name: "stock",
17945
19300
  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"
@@ -17995,7 +19350,7 @@ var stockCommand = defineCommand117({
17995
19350
  });
17996
19351
 
17997
19352
  // src/lib/tags-command.ts
17998
- import { defineCommand as defineCommand118 } from "citty";
19353
+ import { defineCommand as defineCommand120 } from "citty";
17999
19354
  function makeTagsCommand(command, label, endpoint) {
18000
19355
  registerSchema({
18001
19356
  command: `${command}.tags`,
@@ -18004,7 +19359,7 @@ function makeTagsCommand(command, label, endpoint) {
18004
19359
  output: { type: "string", description: "Output format: md|json", required: false, default: "md" }
18005
19360
  }
18006
19361
  });
18007
- return defineCommand118({
19362
+ return defineCommand120({
18008
19363
  meta: {
18009
19364
  name: "tags",
18010
19365
  description: `List the available ${label} tag names (defaults + company custom tags). Use before filtering with --tags. Example: baker ${command} tags`
@@ -18040,7 +19395,7 @@ function makeTagsCommand(command, label, endpoint) {
18040
19395
  var tagsCommand2 = makeTagsCommand("images", "image", "/api/images/tags");
18041
19396
 
18042
19397
  // src/commands/images/upload.ts
18043
- import { defineCommand as defineCommand119 } from "citty";
19398
+ import { defineCommand as defineCommand121 } from "citty";
18044
19399
  registerSchema({
18045
19400
  command: "images.upload",
18046
19401
  description: "Upload an image to the library \u2014 local file path or remote http(s) URL.",
@@ -18078,7 +19433,7 @@ registerSchema({
18078
19433
  function isRemoteUrl2(value) {
18079
19434
  return /^https?:\/\//i.test(value);
18080
19435
  }
18081
- var uploadCommand = defineCommand119({
19436
+ var uploadCommand = defineCommand121({
18082
19437
  meta: {
18083
19438
  name: "upload",
18084
19439
  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'"
@@ -18171,7 +19526,7 @@ async function uploadLocal(target, args) {
18171
19526
  }
18172
19527
 
18173
19528
  // src/commands/images/upscale.ts
18174
- import { defineCommand as defineCommand120 } from "citty";
19529
+ import { defineCommand as defineCommand122 } from "citty";
18175
19530
  registerSchema({
18176
19531
  command: "images.upscale",
18177
19532
  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).",
@@ -18186,7 +19541,7 @@ registerSchema({
18186
19541
  }
18187
19542
  });
18188
19543
  var POLL_INTERVAL_MS3 = 1500;
18189
- var upscaleCommand = defineCommand120({
19544
+ var upscaleCommand = defineCommand122({
18190
19545
  meta: {
18191
19546
  name: "upscale",
18192
19547
  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"
@@ -18241,7 +19596,7 @@ var upscaleCommand = defineCommand120({
18241
19596
  });
18242
19597
 
18243
19598
  // src/commands/images/use.ts
18244
- import { defineCommand as defineCommand121 } from "citty";
19599
+ import { defineCommand as defineCommand123 } from "citty";
18245
19600
  registerSchema({
18246
19601
  command: "images.use",
18247
19602
  description: "Ingest a URL and wait for the library record to be ready.",
@@ -18257,7 +19612,7 @@ registerSchema({
18257
19612
  }
18258
19613
  });
18259
19614
  var POLL_INTERVAL_MS4 = 1500;
18260
- var useCommand = defineCommand121({
19615
+ var useCommand = defineCommand123({
18261
19616
  meta: {
18262
19617
  name: "use",
18263
19618
  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"
@@ -18303,7 +19658,7 @@ var useCommand = defineCommand121({
18303
19658
  });
18304
19659
 
18305
19660
  // src/commands/images/index.ts
18306
- var imagesCommand = defineCommand122({
19661
+ var imagesCommand = defineCommand124({
18307
19662
  meta: {
18308
19663
  name: "images",
18309
19664
  description: `Find, source, and normalize images. Subcommands route by provider so cost + license are explicit.
@@ -18372,162 +19727,11 @@ Paid transforms (run on the Convex backend, cost-tracked):
18372
19727
  }
18373
19728
  });
18374
19729
 
18375
- // src/commands/mcp/index.ts
18376
- import { defineCommand as defineCommand123 } from "citty";
18377
- var SCOPES = ["user", "company", "org"];
18378
- function parseScope(raw) {
18379
- const scope = raw === void 0 ? "company" : String(raw);
18380
- if (!SCOPES.includes(scope)) {
18381
- throw new ApiError("VALIDATION_ERROR", `Invalid --scope "${scope}". Use user | company | org.`);
18382
- }
18383
- return scope;
18384
- }
18385
- function actingUserId() {
18386
- return getEnv().BAKER_ACTING_USER_ID;
18387
- }
18388
- function parseHeaders(raw) {
18389
- const list = raw === void 0 ? [] : Array.isArray(raw) ? raw : [raw];
18390
- const headers = {};
18391
- for (const entry of list) {
18392
- const text = String(entry);
18393
- const sep = text.indexOf(":") >= 0 && (text.indexOf(":") < text.indexOf("=") || text.indexOf("=") < 0) ? ":" : "=";
18394
- const at = text.indexOf(sep);
18395
- if (at <= 0) {
18396
- throw new ApiError("VALIDATION_ERROR", `Invalid header "${text}". Use "Key: Value".`);
18397
- }
18398
- headers[text.slice(0, at).trim()] = text.slice(at + 1).trim();
18399
- }
18400
- return Object.keys(headers).length > 0 ? headers : void 0;
18401
- }
18402
- function fail3(err) {
18403
- if (err instanceof ApiError) {
18404
- writeJson({ ok: false, error: { code: err.code, message: err.message } });
18405
- process.exit(1);
18406
- }
18407
- writeJson({ ok: false, error: { code: "NETWORK_ERROR", message: "Unexpected error" } });
18408
- process.exit(1);
18409
- }
18410
- registerSchema({
18411
- command: "mcp.list",
18412
- description: "List the custom MCP servers this company's chats see (org + company + your own user scope).",
18413
- args: {}
18414
- });
18415
- var listCommand4 = defineCommand123({
18416
- meta: { name: "list", description: "List custom MCP servers visible to this company's chats." },
18417
- run: async () => {
18418
- try {
18419
- const user = actingUserId();
18420
- const data = await apiGet(
18421
- "/api/mcp/custom",
18422
- user ? { actingUserId: user } : void 0
18423
- );
18424
- writeJson({ ok: true, data: data.servers });
18425
- } catch (err) {
18426
- fail3(err);
18427
- }
18428
- }
18429
- });
18430
- registerSchema({
18431
- command: "mcp.add",
18432
- 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).",
18433
- args: {
18434
- name: { type: "string", description: "Server name \u2192 tools appear as mcp__<name>__*", required: true },
18435
- url: { type: "string", description: "HTTPS MCP endpoint", required: true },
18436
- scope: { type: "string", description: "user | company | org (default company)", required: false },
18437
- header: { type: "string", description: 'Auth header "Key: Value" (repeatable)', required: false }
18438
- }
18439
- });
18440
- var addCommand = defineCommand123({
18441
- meta: {
18442
- name: "add",
18443
- description: `Register a custom MCP server. Tools appear as mcp__<name>__* on the NEXT message.
18444
-
18445
- 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).
18446
-
18447
- Examples:
18448
- baker mcp add --name weather --url https://mcp.example.com/mcp
18449
- baker mcp add --name acme --url https://acme.dev/mcp --header "Authorization: Bearer sk-\u2026"
18450
- baker mcp add --name mine --url https://my.dev/mcp --scope user`
18451
- },
18452
- args: {
18453
- name: { type: "string", description: "Server name (mcp__<name>__*)", required: true },
18454
- url: { type: "string", description: "HTTPS MCP endpoint", required: true },
18455
- scope: { type: "string", description: "user | company | org (default company)", required: false },
18456
- header: { type: "string", description: 'Auth header "Key: Value" (repeatable)', required: false }
18457
- },
18458
- run: async ({ args }) => {
18459
- try {
18460
- const scope = parseScope(args.scope);
18461
- const user = actingUserId();
18462
- const headers = parseHeaders(args.header);
18463
- const data = await apiPost("/api/mcp/custom", {
18464
- name: args.name,
18465
- url: args.url,
18466
- scope,
18467
- ...user ? { actingUserId: user } : {},
18468
- ...headers ? { headers } : {}
18469
- });
18470
- writeJson({ ok: true, data });
18471
- } catch (err) {
18472
- fail3(err);
18473
- }
18474
- }
18475
- });
18476
- registerSchema({
18477
- command: "mcp.remove",
18478
- description: "Remove a company custom MCP server by name.",
18479
- args: { name: { type: "string", description: "Server name to remove", required: true } }
18480
- });
18481
- var removeCommand3 = defineCommand123({
18482
- meta: {
18483
- name: "remove",
18484
- description: `Remove a company custom MCP server by name.
18485
-
18486
- Example:
18487
- baker mcp remove --name weather`
18488
- },
18489
- args: { name: { type: "string", description: "Server name to remove", required: true } },
18490
- run: async ({ args }) => {
18491
- try {
18492
- const user = actingUserId();
18493
- const data = await apiPost("/api/mcp/custom/remove", {
18494
- name: args.name,
18495
- ...user ? { actingUserId: user } : {}
18496
- });
18497
- writeJson({ ok: true, data });
18498
- } catch (err) {
18499
- fail3(err);
18500
- }
18501
- }
18502
- });
18503
- var mcpCommand = defineCommand123({
18504
- meta: {
18505
- name: "mcp",
18506
- description: `Custom MCP servers for this company \u2014 point the agent at any HTTPS MCP endpoint.
18507
-
18508
- Tools from a registered server appear as mcp__<name>__* on the next message.
18509
- Managed here are **company-scoped** servers; user- and org-scoped servers are managed in the dashboard.
18510
-
18511
- Start here:
18512
- baker mcp list
18513
-
18514
- Examples:
18515
- baker mcp add --name weather --url https://mcp.example.com/mcp
18516
- baker mcp add --name acme --url https://acme.dev/mcp --header "Authorization: Bearer sk-\u2026"
18517
- baker mcp remove --name weather`
18518
- },
18519
- subCommands: {
18520
- list: listCommand4,
18521
- add: addCommand,
18522
- remove: removeCommand3
18523
- }
18524
- });
18525
-
18526
19730
  // src/commands/research/index.ts
18527
- import { defineCommand as defineCommand134 } from "citty";
19731
+ import { defineCommand as defineCommand135 } from "citty";
18528
19732
 
18529
19733
  // src/commands/research/advertisers.ts
18530
- import { defineCommand as defineCommand124 } from "citty";
19734
+ import { defineCommand as defineCommand125 } from "citty";
18531
19735
 
18532
19736
  // src/commands/research/output.ts
18533
19737
  var RESEARCH_DATA_NOTE = "Estimates based on third-party SERP data \u2014 not exact figures. Use for directional insights, not precise measurement.";
@@ -18640,7 +19844,7 @@ var FIELDS3 = {
18640
19844
  etv: "Estimated traffic value (USD)",
18641
19845
  visibility: "SERP visibility score (0-1)"
18642
19846
  };
18643
- var advertisersCommand = defineCommand124({
19847
+ var advertisersCommand = defineCommand125({
18644
19848
  meta: {
18645
19849
  name: "advertisers",
18646
19850
  description: `Find domains competing for a keyword in Google SERPs.
@@ -18687,7 +19891,7 @@ Examples:
18687
19891
  });
18688
19892
 
18689
19893
  // src/commands/research/autocomplete.ts
18690
- import { defineCommand as defineCommand125 } from "citty";
19894
+ import { defineCommand as defineCommand126 } from "citty";
18691
19895
  registerSchema({
18692
19896
  command: "research.autocomplete",
18693
19897
  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).",
@@ -18710,7 +19914,7 @@ registerSchema({
18710
19914
  var FIELDS4 = {
18711
19915
  suggestion: "Autocomplete suggestion from Google"
18712
19916
  };
18713
- var autocompleteCommand = defineCommand125({
19917
+ var autocompleteCommand = defineCommand126({
18714
19918
  meta: {
18715
19919
  name: "autocomplete",
18716
19920
  description: `Get Google Autocomplete suggestions for keyword expansion.
@@ -18756,7 +19960,7 @@ Examples:
18756
19960
  });
18757
19961
 
18758
19962
  // src/commands/research/countries.ts
18759
- import { defineCommand as defineCommand126 } from "citty";
19963
+ import { defineCommand as defineCommand127 } from "citty";
18760
19964
  registerSchema({
18761
19965
  command: "research.countries",
18762
19966
  description: "List all supported country codes for --location flag in research commands.",
@@ -18813,7 +20017,7 @@ var FIELDS5 = {
18813
20017
  code: "Country code to pass as --location",
18814
20018
  name: "Country name"
18815
20019
  };
18816
- var countriesCommand = defineCommand126({
20020
+ var countriesCommand = defineCommand127({
18817
20021
  meta: {
18818
20022
  name: "countries",
18819
20023
  description: "List all supported country codes for --location flag."
@@ -18824,7 +20028,7 @@ var countriesCommand = defineCommand126({
18824
20028
  });
18825
20029
 
18826
20030
  // src/commands/research/intent.ts
18827
- import { defineCommand as defineCommand127 } from "citty";
20031
+ import { defineCommand as defineCommand128 } from "citty";
18828
20032
  registerSchema({
18829
20033
  command: "research.intent",
18830
20034
  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.",
@@ -18847,7 +20051,7 @@ var FIELDS6 = {
18847
20051
  intent: "Primary Google Search intent: informational, navigational, commercial, transactional",
18848
20052
  probability: "Confidence score 0.0-1.0"
18849
20053
  };
18850
- var intentCommand = defineCommand127({
20054
+ var intentCommand = defineCommand128({
18851
20055
  meta: {
18852
20056
  name: "intent",
18853
20057
  description: `Classify Google Search intent for keywords. Returns intent type and confidence.
@@ -18895,7 +20099,7 @@ Examples:
18895
20099
  });
18896
20100
 
18897
20101
  // src/commands/research/keyword-gap.ts
18898
- import { defineCommand as defineCommand128 } from "citty";
20102
+ import { defineCommand as defineCommand129 } from "citty";
18899
20103
  registerSchema({
18900
20104
  command: "research.keyword-gap",
18901
20105
  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.",
@@ -18924,7 +20128,7 @@ var FIELDS7 = {
18924
20128
  cpc: "Cost per click USD",
18925
20129
  their_position: "Competitor's ranking position"
18926
20130
  };
18927
- var keywordGapCommand = defineCommand128({
20131
+ var keywordGapCommand = defineCommand129({
18928
20132
  meta: {
18929
20133
  name: "keyword-gap",
18930
20134
  description: `Find keywords a competitor has that you don't. Supports pagination via --offset.
@@ -18998,7 +20202,7 @@ Examples:
18998
20202
  });
18999
20203
 
19000
20204
  // src/commands/research/keywords-for-site.ts
19001
- import { defineCommand as defineCommand129 } from "citty";
20205
+ import { defineCommand as defineCommand130 } from "citty";
19002
20206
  registerSchema({
19003
20207
  command: "research.keywords-for-site",
19004
20208
  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.",
@@ -19031,7 +20235,7 @@ var FIELDS8 = {
19031
20235
  competition: "LOW, MEDIUM, or HIGH",
19032
20236
  competition_index: "Competition score 0-100"
19033
20237
  };
19034
- var keywordsForSiteCommand = defineCommand129({
20238
+ var keywordsForSiteCommand = defineCommand130({
19035
20239
  meta: {
19036
20240
  name: "keywords-for-site",
19037
20241
  description: `Get keywords a competitor targets in Google. Use --type to filter paid/organic.
@@ -19084,7 +20288,7 @@ Examples:
19084
20288
  });
19085
20289
 
19086
20290
  // src/commands/research/languages.ts
19087
- import { defineCommand as defineCommand130 } from "citty";
20291
+ import { defineCommand as defineCommand131 } from "citty";
19088
20292
  registerSchema({
19089
20293
  command: "research.languages",
19090
20294
  description: "List all supported language codes for --language flag in research commands.",
@@ -19114,7 +20318,7 @@ var FIELDS9 = {
19114
20318
  code: "Language code to pass as --language",
19115
20319
  name: "Language name (also accepted by --language)"
19116
20320
  };
19117
- var languagesCommand2 = defineCommand130({
20321
+ var languagesCommand2 = defineCommand131({
19118
20322
  meta: {
19119
20323
  name: "languages",
19120
20324
  description: "List all supported language codes for --language flag."
@@ -19125,7 +20329,7 @@ var languagesCommand2 = defineCommand130({
19125
20329
  });
19126
20330
 
19127
20331
  // src/commands/research/lighthouse.ts
19128
- import { defineCommand as defineCommand131 } from "citty";
20332
+ import { defineCommand as defineCommand132 } from "citty";
19129
20333
  registerSchema({
19130
20334
  command: "research.lighthouse",
19131
20335
  description: "Landing page performance audit. Returns metrics that affect Google Ads Quality Score and CPC.",
@@ -19144,7 +20348,7 @@ var FIELDS10 = {
19144
20348
  speed_index_ms: "Speed Index in ms (good: < 3400)",
19145
20349
  interactive_ms: "Time to Interactive in ms (good: < 3800)"
19146
20350
  };
19147
- var lighthouseCommand = defineCommand131({
20351
+ var lighthouseCommand = defineCommand132({
19148
20352
  meta: {
19149
20353
  name: "lighthouse",
19150
20354
  description: `Landing page performance audit. Metrics affecting Google Ads Quality Score.
@@ -19182,7 +20386,7 @@ Examples:
19182
20386
  });
19183
20387
 
19184
20388
  // src/commands/research/relevant-pages.ts
19185
- import { defineCommand as defineCommand132 } from "citty";
20389
+ import { defineCommand as defineCommand133 } from "citty";
19186
20390
  registerSchema({
19187
20391
  command: "research.relevant-pages",
19188
20392
  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).",
@@ -19208,7 +20412,7 @@ var FIELDS11 = {
19208
20412
  keywords: "Total organic keywords the page ranks for",
19209
20413
  top_10: "Keywords in positions 1-10"
19210
20414
  };
19211
- var relevantPagesCommand = defineCommand132({
20415
+ var relevantPagesCommand = defineCommand133({
19212
20416
  meta: {
19213
20417
  name: "relevant-pages",
19214
20418
  description: `Get the top pages of a competitor domain with traffic data.
@@ -19254,7 +20458,7 @@ Examples:
19254
20458
  });
19255
20459
 
19256
20460
  // src/commands/research/web.ts
19257
- import { defineCommand as defineCommand133 } from "citty";
20461
+ import { defineCommand as defineCommand134 } from "citty";
19258
20462
  registerSchema({
19259
20463
  command: "research.web",
19260
20464
  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).",
@@ -19305,7 +20509,7 @@ async function runDeepResearch(question) {
19305
20509
  }
19306
20510
  throw new Error("Deep research timed out");
19307
20511
  }
19308
- var webCommand = defineCommand133({
20512
+ var webCommand = defineCommand134({
19309
20513
  meta: {
19310
20514
  name: "web",
19311
20515
  description: `Search the web with AI to answer any open-ended marketing question. Uses live internet data via Google Search.
@@ -19365,7 +20569,7 @@ Examples:
19365
20569
  });
19366
20570
 
19367
20571
  // src/commands/research/index.ts
19368
- var researchCommand = defineCommand134({
20572
+ var researchCommand = defineCommand135({
19369
20573
  meta: {
19370
20574
  name: "research",
19371
20575
  description: `Competitive intelligence and AI-powered research commands.
@@ -19405,10 +20609,10 @@ Examples:
19405
20609
  });
19406
20610
 
19407
20611
  // src/commands/scheduled-actions/index.ts
19408
- import { defineCommand as defineCommand141 } from "citty";
20612
+ import { defineCommand as defineCommand142 } from "citty";
19409
20613
 
19410
20614
  // src/commands/scheduled-actions/create.ts
19411
- import { defineCommand as defineCommand135 } from "citty";
20615
+ import { defineCommand as defineCommand136 } from "citty";
19412
20616
 
19413
20617
  // src/commands/scheduled-actions/shared.ts
19414
20618
  var TEMP_SCHEDULED_ACTION_PREFIX = "temp_sched_";
@@ -19523,7 +20727,7 @@ registerSchema({
19523
20727
  prompt: { type: "string", description: "Additional prompt instructions for the spawned agent", required: false }
19524
20728
  }
19525
20729
  });
19526
- var createCommand2 = defineCommand135({
20730
+ var createCommand2 = defineCommand136({
19527
20731
  meta: {
19528
20732
  name: "create",
19529
20733
  description: 'Stage a scheduled action. Example: baker scheduled-actions create --name "Weekly report" --description "..." --cron "0 9 * * MON"'
@@ -19572,7 +20776,7 @@ var createCommand2 = defineCommand135({
19572
20776
  });
19573
20777
 
19574
20778
  // src/commands/scheduled-actions/delete.ts
19575
- import { defineCommand as defineCommand136 } from "citty";
20779
+ import { defineCommand as defineCommand137 } from "citty";
19576
20780
  registerSchema({
19577
20781
  command: "scheduled-actions.delete",
19578
20782
  description: "Stage deletion of a published scheduled action or cancellation of a temp_sched_* draft creation.",
@@ -19580,7 +20784,7 @@ registerSchema({
19580
20784
  id: { type: "string", description: "Published scheduled action ID or temp_sched_* draft ID", required: true }
19581
20785
  }
19582
20786
  });
19583
- var deleteCommand2 = defineCommand136({
20787
+ var deleteCommand2 = defineCommand137({
19584
20788
  meta: {
19585
20789
  name: "delete",
19586
20790
  description: "Stage scheduled action deletion. Example: baker scheduled-actions delete <id-or-temp_sched_id>"
@@ -19609,7 +20813,7 @@ var deleteCommand2 = defineCommand136({
19609
20813
  });
19610
20814
 
19611
20815
  // src/commands/scheduled-actions/get.ts
19612
- import { defineCommand as defineCommand137 } from "citty";
20816
+ import { defineCommand as defineCommand138 } from "citty";
19613
20817
  registerSchema({
19614
20818
  command: "scheduled-actions.get",
19615
20819
  description: "Get a published scheduled action or a temp_sched_* draft-created scheduled action.",
@@ -19617,7 +20821,7 @@ registerSchema({
19617
20821
  id: { type: "string", description: "Published scheduled action ID or temp_sched_* draft ID", required: true }
19618
20822
  }
19619
20823
  });
19620
- var getCommand3 = defineCommand137({
20824
+ var getCommand3 = defineCommand138({
19621
20825
  meta: {
19622
20826
  name: "get",
19623
20827
  description: "Get a scheduled action. Example: baker scheduled-actions get <id-or-temp_sched_id>"
@@ -19654,13 +20858,13 @@ var getCommand3 = defineCommand137({
19654
20858
  });
19655
20859
 
19656
20860
  // src/commands/scheduled-actions/list.ts
19657
- import { defineCommand as defineCommand138 } from "citty";
20861
+ import { defineCommand as defineCommand139 } from "citty";
19658
20862
  registerSchema({
19659
20863
  command: "scheduled-actions.list",
19660
20864
  description: "List published scheduled actions. Includes draft state when BAKER_CHAT_ID is set.",
19661
20865
  args: {}
19662
20866
  });
19663
- var listCommand5 = defineCommand138({
20867
+ var listCommand4 = defineCommand139({
19664
20868
  meta: {
19665
20869
  name: "list",
19666
20870
  description: "List scheduled actions. Includes staged draft ops when BAKER_CHAT_ID is set."
@@ -19681,7 +20885,7 @@ var listCommand5 = defineCommand138({
19681
20885
  });
19682
20886
 
19683
20887
  // src/commands/scheduled-actions/trigger.ts
19684
- import { defineCommand as defineCommand139 } from "citty";
20888
+ import { defineCommand as defineCommand140 } from "citty";
19685
20889
  registerSchema({
19686
20890
  command: "scheduled-actions.trigger",
19687
20891
  description: "Immediately trigger a published scheduled action. Does not require BAKER_CHAT_ID and rejects temp_sched_* IDs.",
@@ -19689,7 +20893,7 @@ registerSchema({
19689
20893
  id: { type: "string", description: "Published scheduled action ID", required: true }
19690
20894
  }
19691
20895
  });
19692
- var triggerCommand = defineCommand139({
20896
+ var triggerCommand = defineCommand140({
19693
20897
  meta: {
19694
20898
  name: "trigger",
19695
20899
  description: "Immediately trigger a published scheduled action. Example: baker scheduled-actions trigger <id>"
@@ -19726,7 +20930,7 @@ var triggerCommand = defineCommand139({
19726
20930
  });
19727
20931
 
19728
20932
  // src/commands/scheduled-actions/update.ts
19729
- import { defineCommand as defineCommand140 } from "citty";
20933
+ import { defineCommand as defineCommand141 } from "citty";
19730
20934
  registerSchema({
19731
20935
  command: "scheduled-actions.update",
19732
20936
  description: "Stage an update to a published scheduled action or temp_sched_* draft-created scheduled action.",
@@ -19751,7 +20955,7 @@ registerSchema({
19751
20955
  prompt: { type: "string", description: "Replacement additional spawned-agent instructions", required: false }
19752
20956
  }
19753
20957
  });
19754
- var updateCommand2 = defineCommand140({
20958
+ var updateCommand2 = defineCommand141({
19755
20959
  meta: {
19756
20960
  name: "update",
19757
20961
  description: "Stage a scheduled action update. Example: baker scheduled-actions update <id> --enabled false"
@@ -19822,7 +21026,7 @@ var updateCommand2 = defineCommand140({
19822
21026
  });
19823
21027
 
19824
21028
  // src/commands/scheduled-actions/index.ts
19825
- var scheduledActionsCommand = defineCommand141({
21029
+ var scheduledActionsCommand = defineCommand142({
19826
21030
  meta: {
19827
21031
  name: "scheduled-actions",
19828
21032
  description: `Manage Scheduled Actions. Subcommands: list, get, create, update, delete, trigger.
@@ -19838,7 +21042,7 @@ Examples:
19838
21042
  baker scheduled-actions trigger <id>`
19839
21043
  },
19840
21044
  subCommands: {
19841
- list: listCommand5,
21045
+ list: listCommand4,
19842
21046
  get: getCommand3,
19843
21047
  create: createCommand2,
19844
21048
  update: updateCommand2,
@@ -19848,8 +21052,8 @@ Examples:
19848
21052
  });
19849
21053
 
19850
21054
  // src/commands/schema.ts
19851
- import { defineCommand as defineCommand142 } from "citty";
19852
- var schemaCommand = defineCommand142({
21055
+ import { defineCommand as defineCommand143 } from "citty";
21056
+ var schemaCommand = defineCommand143({
19853
21057
  meta: {
19854
21058
  name: "schema",
19855
21059
  description: "Inspect command argument schemas (for AI agent introspection). Lists all commands if no argument given. Example: baker schema images.search"
@@ -19885,10 +21089,10 @@ var schemaCommand = defineCommand142({
19885
21089
  });
19886
21090
 
19887
21091
  // src/commands/testimonials/index.ts
19888
- import { defineCommand as defineCommand146 } from "citty";
21092
+ import { defineCommand as defineCommand147 } from "citty";
19889
21093
 
19890
21094
  // src/commands/testimonials/get.ts
19891
- import { defineCommand as defineCommand143 } from "citty";
21095
+ import { defineCommand as defineCommand144 } from "citty";
19892
21096
  registerSchema({
19893
21097
  command: "testimonials.get",
19894
21098
  description: "Get a single testimonial by ID",
@@ -19896,7 +21100,7 @@ registerSchema({
19896
21100
  id: { type: "string", description: "Testimonial ID", required: true }
19897
21101
  }
19898
21102
  });
19899
- var getCommand4 = defineCommand143({
21103
+ var getCommand4 = defineCommand144({
19900
21104
  meta: { name: "get", description: "Get a single testimonial by ID. Example: baker testimonials get j571abc123" },
19901
21105
  args: {
19902
21106
  id: { type: "positional", description: "Testimonial ID", required: false },
@@ -19933,7 +21137,7 @@ var getCommand4 = defineCommand143({
19933
21137
  });
19934
21138
 
19935
21139
  // src/commands/testimonials/list.ts
19936
- import { defineCommand as defineCommand144 } from "citty";
21140
+ import { defineCommand as defineCommand145 } from "citty";
19937
21141
  registerSchema({
19938
21142
  command: "testimonials.list",
19939
21143
  description: "List testimonials with optional filters.",
@@ -19963,7 +21167,7 @@ registerSchema({
19963
21167
  limit: { type: "number", description: "Max results (default 50)", required: false, default: 50 }
19964
21168
  }
19965
21169
  });
19966
- var listCommand6 = defineCommand144({
21170
+ var listCommand5 = defineCommand145({
19967
21171
  meta: {
19968
21172
  name: "list",
19969
21173
  description: "List testimonials with optional filters. Example: baker testimonials list --source google --sentiment positive"
@@ -20012,7 +21216,7 @@ var listCommand6 = defineCommand144({
20012
21216
  });
20013
21217
 
20014
21218
  // src/commands/testimonials/search.ts
20015
- import { defineCommand as defineCommand145 } from "citty";
21219
+ import { defineCommand as defineCommand146 } from "citty";
20016
21220
  registerSchema({
20017
21221
  command: "testimonials.search",
20018
21222
  description: "Search testimonials by text query. Uses hybrid BM25 + vector + reranking.",
@@ -20043,7 +21247,7 @@ registerSchema({
20043
21247
  tags: { type: "string", description: "Comma-separated tags to filter by", required: false }
20044
21248
  }
20045
21249
  });
20046
- var searchCommand2 = defineCommand145({
21250
+ var searchCommand2 = defineCommand146({
20047
21251
  meta: {
20048
21252
  name: "search",
20049
21253
  description: "Semantic search testimonials by text query. Uses hybrid BM25 + vector + reranking. Example: baker testimonials search 'great service' --rating-min 4"
@@ -20117,7 +21321,7 @@ var searchCommand2 = defineCommand145({
20117
21321
  var tagsCommand3 = makeTagsCommand("testimonials", "testimonial", "/api/testimonials/tags");
20118
21322
 
20119
21323
  // src/commands/testimonials/index.ts
20120
- var testimonialsCommand = defineCommand146({
21324
+ var testimonialsCommand = defineCommand147({
20121
21325
  meta: {
20122
21326
  name: "testimonials",
20123
21327
  description: `Find and browse testimonials in Baker. Subcommands: search, get, list, tags.
@@ -20132,16 +21336,16 @@ Examples:
20132
21336
  subCommands: {
20133
21337
  get: getCommand4,
20134
21338
  search: searchCommand2,
20135
- list: listCommand6,
21339
+ list: listCommand5,
20136
21340
  tags: tagsCommand3
20137
21341
  }
20138
21342
  });
20139
21343
 
20140
21344
  // src/commands/videos/index.ts
20141
- import { defineCommand as defineCommand151 } from "citty";
21345
+ import { defineCommand as defineCommand152 } from "citty";
20142
21346
 
20143
21347
  // src/commands/videos/delete.ts
20144
- import { defineCommand as defineCommand147 } from "citty";
21348
+ import { defineCommand as defineCommand148 } from "citty";
20145
21349
  registerSchema({
20146
21350
  command: "videos.delete",
20147
21351
  description: "Delete a video by ID",
@@ -20155,7 +21359,7 @@ registerSchema({
20155
21359
  }
20156
21360
  }
20157
21361
  });
20158
- var deleteCommand3 = defineCommand147({
21362
+ var deleteCommand3 = defineCommand148({
20159
21363
  meta: {
20160
21364
  name: "delete",
20161
21365
  description: "Delete a video by ID. Use --dry-run to preview. Example: baker videos delete j571abc123 --dry-run"
@@ -20196,7 +21400,7 @@ var deleteCommand3 = defineCommand147({
20196
21400
  });
20197
21401
 
20198
21402
  // src/commands/videos/get.ts
20199
- import { defineCommand as defineCommand148 } from "citty";
21403
+ import { defineCommand as defineCommand149 } from "citty";
20200
21404
  registerSchema({
20201
21405
  command: "videos.get",
20202
21406
  description: "Get a single video by ID",
@@ -20204,7 +21408,7 @@ registerSchema({
20204
21408
  id: { type: "string", description: "Video ID", required: true }
20205
21409
  }
20206
21410
  });
20207
- var getCommand5 = defineCommand148({
21411
+ var getCommand5 = defineCommand149({
20208
21412
  meta: { name: "get", description: "Get a single video by ID. Example: baker videos get j571abc123" },
20209
21413
  args: {
20210
21414
  id: { type: "positional", description: "Video ID", required: false },
@@ -20241,7 +21445,7 @@ var getCommand5 = defineCommand148({
20241
21445
  });
20242
21446
 
20243
21447
  // src/commands/videos/search.ts
20244
- import { defineCommand as defineCommand149 } from "citty";
21448
+ import { defineCommand as defineCommand150 } from "citty";
20245
21449
  registerSchema({
20246
21450
  command: "videos.search",
20247
21451
  description: "Search videos by text query. Only returns ready videos.",
@@ -20251,7 +21455,7 @@ registerSchema({
20251
21455
  tags: { type: "string", description: "Comma-separated tags to filter by", required: false }
20252
21456
  }
20253
21457
  });
20254
- var searchCommand3 = defineCommand149({
21458
+ var searchCommand3 = defineCommand150({
20255
21459
  meta: {
20256
21460
  name: "search",
20257
21461
  description: "Semantic search videos by text query. Uses hybrid BM25 + vector + reranking. Example: baker videos search 'product demo' --tags tutorial"
@@ -20303,7 +21507,7 @@ var tagsCommand4 = makeTagsCommand("videos", "video", "/api/videos/tags");
20303
21507
  // src/commands/videos/upload.ts
20304
21508
  import { readFile as readFile12, stat as stat3 } from "fs/promises";
20305
21509
  import { extname as extname3 } from "path";
20306
- import { defineCommand as defineCommand150 } from "citty";
21510
+ import { defineCommand as defineCommand151 } from "citty";
20307
21511
  var MIME_MAP = {
20308
21512
  ".mp4": "video/mp4",
20309
21513
  ".mov": "video/quicktime",
@@ -20337,7 +21541,7 @@ function detectContentType(filePath) {
20337
21541
  }
20338
21542
  return mime;
20339
21543
  }
20340
- var uploadCommand2 = defineCommand150({
21544
+ var uploadCommand2 = defineCommand151({
20341
21545
  meta: {
20342
21546
  name: "upload",
20343
21547
  description: "Upload a video file to Baker via Mux direct upload. Auto-detects content type. Example: baker videos upload ./demo.mp4"
@@ -20391,7 +21595,7 @@ var uploadCommand2 = defineCommand150({
20391
21595
  });
20392
21596
 
20393
21597
  // src/commands/videos/index.ts
20394
- var videosCommand = defineCommand151({
21598
+ var videosCommand = defineCommand152({
20395
21599
  meta: {
20396
21600
  name: "videos",
20397
21601
  description: `Find and manage videos in Baker. Subcommands: search, get, upload, delete, tags.
@@ -20414,10 +21618,10 @@ Examples:
20414
21618
  });
20415
21619
 
20416
21620
  // src/commands/winning-ads/index.ts
20417
- import { defineCommand as defineCommand154 } from "citty";
21621
+ import { defineCommand as defineCommand155 } from "citty";
20418
21622
 
20419
21623
  // src/commands/winning-ads/advertisers.ts
20420
- import { defineCommand as defineCommand152 } from "citty";
21624
+ import { defineCommand as defineCommand153 } from "citty";
20421
21625
  registerSchema({
20422
21626
  command: "winning-ads.advertisers",
20423
21627
  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).",
@@ -20430,7 +21634,7 @@ registerSchema({
20430
21634
  function identity(record) {
20431
21635
  return record;
20432
21636
  }
20433
- var advertisersCommand2 = defineCommand152({
21637
+ var advertisersCommand2 = defineCommand153({
20434
21638
  meta: {
20435
21639
  name: "advertisers",
20436
21640
  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'
@@ -20481,7 +21685,7 @@ var advertisersCommand2 = defineCommand152({
20481
21685
  });
20482
21686
 
20483
21687
  // src/commands/winning-ads/search.ts
20484
- import { defineCommand as defineCommand153 } from "citty";
21688
+ import { defineCommand as defineCommand154 } from "citty";
20485
21689
  registerSchema({
20486
21690
  command: "winning-ads.search",
20487
21691
  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.",
@@ -20589,7 +21793,7 @@ function buildSearchBody(args) {
20589
21793
  }
20590
21794
  return body;
20591
21795
  }
20592
- var searchCommand4 = defineCommand153({
21796
+ var searchCommand4 = defineCommand154({
20593
21797
  meta: {
20594
21798
  name: "search",
20595
21799
  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"
@@ -20701,7 +21905,7 @@ var searchCommand4 = defineCommand153({
20701
21905
  });
20702
21906
 
20703
21907
  // src/commands/winning-ads/index.ts
20704
- var winningAdsCommand = defineCommand154({
21908
+ var winningAdsCommand = defineCommand155({
20705
21909
  meta: {
20706
21910
  name: "winning-ads",
20707
21911
  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.
@@ -20725,7 +21929,7 @@ Examples:
20725
21929
  });
20726
21930
 
20727
21931
  // src/version.ts
20728
- import { readFileSync as readFileSync10 } from "fs";
21932
+ import { readFileSync as readFileSync11 } from "fs";
20729
21933
  function packageJsonUrl() {
20730
21934
  return new URL("../package.json", import.meta.url);
20731
21935
  }
@@ -20737,11 +21941,11 @@ function parsePackageVersion(raw) {
20737
21941
  throw new Error("Invalid CLI package.json: missing version");
20738
21942
  }
20739
21943
  function getCliVersion() {
20740
- return parsePackageVersion(readFileSync10(packageJsonUrl(), "utf8"));
21944
+ return parsePackageVersion(readFileSync11(packageJsonUrl(), "utf8"));
20741
21945
  }
20742
21946
 
20743
21947
  // src/cli.ts
20744
- var main = defineCommand155({
21948
+ var main = defineCommand156({
20745
21949
  meta: {
20746
21950
  name: "baker",
20747
21951
  version: getCliVersion(),
@@ -20756,7 +21960,7 @@ Introspection: Run 'baker schema <command>' to inspect argument schemas.`
20756
21960
  subCommands: {
20757
21961
  actions: actionsCommand,
20758
21962
  "scheduled-actions": scheduledActionsCommand,
20759
- ads: adsCommand,
21963
+ ads: adsCommand2,
20760
21964
  ga4: ga4Command,
20761
21965
  gsc: gscCommand,
20762
21966
  research: researchCommand,
@@ -20766,7 +21970,6 @@ Introspection: Run 'baker schema <command>' to inspect argument schemas.`
20766
21970
  testimonials: testimonialsCommand,
20767
21971
  canvas: canvasCommand,
20768
21972
  "winning-ads": winningAdsCommand,
20769
- mcp: mcpCommand,
20770
21973
  schema: schemaCommand
20771
21974
  }
20772
21975
  });