vercel 58.4.0 → 58.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/chunks/{add-IOYS5JE4.js → add-2KSAN7EK.js} +43 -8
  2. package/dist/chunks/{add-JTIGJQ75.js → add-HTKUQ3KF.js} +3 -3
  3. package/dist/chunks/{add-QKKUAXFL.js → add-Y3ACMZQ3.js} +3 -3
  4. package/dist/chunks/{build-ZHZDIIS5.js → build-SOTUMEPT.js} +3 -3
  5. package/dist/chunks/{chunk-MAHXF73X.js → chunk-3L2YLLHC.js} +1 -1
  6. package/dist/chunks/{chunk-G47QOVJ7.js → chunk-4PZ2IIZI.js} +1 -1
  7. package/dist/chunks/{chunk-JHIWAM64.js → chunk-4ZZI2JPE.js} +1 -1
  8. package/dist/chunks/{chunk-WUMURQKS.js → chunk-7RTO3VPE.js} +122 -44
  9. package/dist/chunks/{chunk-SWHPI3G7.js → chunk-CVZWB2MA.js} +1 -1
  10. package/dist/chunks/{chunk-56QCZ4RL.js → chunk-FQ4R66UG.js} +1 -1
  11. package/dist/chunks/chunk-GE5R7SYE.js +85 -0
  12. package/dist/chunks/{chunk-DI54DSTV.js → chunk-GKLT2ZGC.js} +210 -60
  13. package/dist/chunks/{chunk-NJUPUGOE.js → chunk-HT2XWSAJ.js} +1 -1
  14. package/dist/chunks/chunk-I2XE3GMB.js +21 -0
  15. package/dist/chunks/{chunk-2ILCTO6A.js → chunk-I5F5AE2Q.js} +2 -2
  16. package/dist/chunks/{chunk-GJ5DKYDQ.js → chunk-IKIPDMQT.js} +7 -5
  17. package/dist/chunks/{chunk-U7Y5DZXS.js → chunk-IRX26ZL5.js} +2 -2
  18. package/dist/chunks/{chunk-U5E5J56I.js → chunk-LTEFJ3VD.js} +3 -3
  19. package/dist/chunks/{chunk-PVWXPWLQ.js → chunk-LXRK7KPA.js} +1255 -1371
  20. package/dist/chunks/{chunk-27FZN5LR.js → chunk-MEOBIY2L.js} +3 -3
  21. package/dist/chunks/chunk-MXLA3VQS.js +20 -0
  22. package/dist/chunks/{chunk-QTXQOWOJ.js → chunk-NXLNRLL7.js} +2 -2
  23. package/dist/chunks/{chunk-IBSUQT6H.js → chunk-OQ6UFVGM.js} +1 -1
  24. package/dist/chunks/{chunk-OWY3MF3E.js → chunk-PGH6RJJF.js} +7 -3
  25. package/dist/chunks/{chunk-DXS2X7KK.js → chunk-QS5I33VI.js} +6 -4
  26. package/dist/chunks/{chunk-EBLH23AQ.js → chunk-TEQKKTJQ.js} +4 -7
  27. package/dist/chunks/{chunk-Z5ZQJ5VJ.js → chunk-TJJ562C5.js} +3 -0
  28. package/dist/chunks/{chunk-ZQR5RIAX.js → chunk-TQE7DRGH.js} +5 -5
  29. package/dist/chunks/{chunk-4UYKSYKQ.js → chunk-UMA66MKW.js} +66 -2
  30. package/dist/chunks/chunk-V5P25P7F.js +22 -0
  31. package/dist/chunks/{chunk-AZS5CLCN.js → chunk-YFQSZI5Q.js} +1 -1
  32. package/dist/chunks/{chunk-CAWBO7SQ.js → chunk-Z3VYQ7JP.js} +9 -7
  33. package/dist/chunks/chunk-ZHDQMUK4.js +96 -0
  34. package/dist/chunks/{chunk-KWOWGI7Z.js → chunk-ZYCVYZSR.js} +1 -1
  35. package/dist/chunks/{clear-R3DI3AA6.js → clear-GLMDDDUR.js} +3 -3
  36. package/dist/chunks/{compile-vercel-config-NEC63GCN.js → compile-vercel-config-7JTL7U5E.js} +2 -2
  37. package/dist/chunks/config-validator.mjs +1 -1
  38. package/dist/chunks/{constants-3FSSR6E7.js → constants-T6BULVX6.js} +1 -1
  39. package/dist/chunks/{delete-BYB66ET3.js → delete-HE6FCDYS.js} +3 -3
  40. package/dist/chunks/{delete-DIZK7FRU.js → delete-M3DCAYTX.js} +3 -3
  41. package/dist/chunks/{disable-HW6CHEVD.js → disable-LHOHFHGU.js} +3 -3
  42. package/dist/chunks/{discard-3UG4K6G2.js → discard-D2SI77HA.js} +3 -3
  43. package/dist/chunks/{edit-EY7LRITZ.js → edit-PSUYL34C.js} +3 -3
  44. package/dist/chunks/{edit-LD5G6GL3.js → edit-XCJDQOZR.js} +4 -4
  45. package/dist/chunks/{enable-MDNLCSAW.js → enable-QXXBU3QH.js} +3 -3
  46. package/dist/chunks/{export-25X6M77L.js → export-CRCAJ72L.js} +3 -3
  47. package/dist/chunks/{image-YQWZLM6Z.js → image-4YES44D3.js} +4 -4
  48. package/dist/chunks/{inspect-H7GEYNIF.js → inspect-CFJWOYWD.js} +4 -4
  49. package/dist/chunks/{inspect-KYAB4F3P.js → inspect-FEW47KAZ.js} +3 -3
  50. package/dist/chunks/{inspect-73FISCNZ.js → inspect-GYUTUSOP.js} +6 -6
  51. package/dist/chunks/{inspect-QVI6UVBJ.js → inspect-JIGB2JK7.js} +3 -3
  52. package/dist/chunks/{inspect-R6ADYTPB.js → inspect-WUT7EW6R.js} +3 -3
  53. package/dist/chunks/{list-SRKON4E4.js → list-4N6HI5LH.js} +6 -6
  54. package/dist/chunks/{list-FTNOS4FT.js → list-W4ZLROFI.js} +4 -4
  55. package/dist/chunks/{list-SDNYJJ4M.js → list-ZQOF2B2L.js} +2 -2
  56. package/dist/chunks/{login-7NR7N4ZF.js → login-FWYKZ642.js} +3 -3
  57. package/dist/chunks/{ls-T276Z2QR.js → ls-7YYHSZIR.js} +3 -3
  58. package/dist/chunks/{ls-BDLEGFY3.js → ls-AV2WYGNW.js} +3 -3
  59. package/dist/chunks/{ls-TWHG22W7.js → ls-DD7RQ7KH.js} +3 -3
  60. package/dist/chunks/{ls-PZHHHKZ7.js → ls-V7E37ERN.js} +7 -7
  61. package/dist/chunks/{ls-NIEZW5O3.js → ls-VOD4NK6A.js} +3 -3
  62. package/dist/chunks/{open-TNEPXGZK.js → open-YEJQVMYZ.js} +3 -3
  63. package/dist/chunks/{permissions-KI2JGJSN.js → permissions-OJCRKNGQ.js} +5 -5
  64. package/dist/chunks/{publish-NBGFOHLV.js → publish-XDKQYIKH.js} +3 -3
  65. package/dist/chunks/{push-SPPWXOAJ.js → push-Z2EQUVOV.js} +3 -3
  66. package/dist/chunks/{query-LS4PEYHG.js → query-KEICHLVN.js} +2 -2
  67. package/dist/chunks/{reorder-UTQ632H5.js → reorder-Z6YCND2X.js} +3 -3
  68. package/dist/chunks/{reply-QFGX5YBV.js → reply-CIWFPTEK.js} +3 -3
  69. package/dist/chunks/{resolve-ZDO5BCI7.js → resolve-BYDSKVYN.js} +3 -3
  70. package/dist/chunks/{restore-T77AKNZ2.js → restore-2KP5DLEC.js} +3 -3
  71. package/dist/chunks/{rm-3RTVWGWR.js → rm-5Z75EGOZ.js} +3 -3
  72. package/dist/chunks/{rm-D24FHFMF.js → rm-FRKS6Y2G.js} +5 -5
  73. package/dist/chunks/{rm-JTOFOKOZ.js → rm-RJOWQHQV.js} +3 -3
  74. package/dist/chunks/{rm-IQPLVKJR.js → rm-TNCPDKEX.js} +3 -3
  75. package/dist/chunks/{rule-inspect-VVHTVTRD.js → rule-inspect-NOSNKD63.js} +7 -14
  76. package/dist/chunks/{rules-EEWMLKRI.js → rules-THS42KX4.js} +10 -7
  77. package/dist/chunks/{schema-XLJLZ4OE.js → schema-MDLX6ZDL.js} +2 -2
  78. package/dist/chunks/schema-R54OXIXC.js +426 -0
  79. package/dist/chunks/{tags-5DZYPJDP.js → tags-NDPHPWME.js} +3 -3
  80. package/dist/chunks/{update-YFXZDNIV.js → update-YAN3MGMW.js} +37 -5
  81. package/dist/commands/build/index.js +61 -22
  82. package/dist/commands/deploy/index.js +27 -17
  83. package/dist/commands/dev/index.js +47 -12
  84. package/dist/commands/env/index.js +284 -20
  85. package/dist/commands/link/index.js +9 -9
  86. package/dist/commands/list/index.js +3 -3
  87. package/dist/commands-bulk.js +1966 -1264
  88. package/dist/index.js +23 -20
  89. package/dist/version.mjs +1 -1
  90. package/package.json +47 -54
  91. package/dist/chunks/chunk-V4RMJKQP.js +0 -36
@@ -0,0 +1,426 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __dirname_ } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ const __filename = __fileURLToPath(import.meta.url);
6
+ const __dirname = __dirname_(__filename);
7
+ import {
8
+ CUSTOM_ALERT_EVENT_HELP
9
+ } from "./chunk-MXLA3VQS.js";
10
+ import {
11
+ indent_default
12
+ } from "./chunk-A3NYPUKZ.js";
13
+ import {
14
+ outputError
15
+ } from "./chunk-BUZRVER7.js";
16
+ import {
17
+ formatTable
18
+ } from "./chunk-JLWQWYKO.js";
19
+ import {
20
+ validateJsonOutput
21
+ } from "./chunk-XPKWKPWA.js";
22
+ import {
23
+ rulesSchemaSubcommand
24
+ } from "./chunk-UMA66MKW.js";
25
+ import "./chunk-KT4XXKJK.js";
26
+ import {
27
+ printError
28
+ } from "./chunk-KBEX5MYS.js";
29
+ import {
30
+ parseArguments
31
+ } from "./chunk-XLKFJPMT.js";
32
+ import {
33
+ getFlagsSpecification
34
+ } from "./chunk-SOFC4MLS.js";
35
+ import "./chunk-P4QNYOFB.js";
36
+ import {
37
+ output_manager_default
38
+ } from "./chunk-OX7KI3LF.js";
39
+ import "./chunk-GGP5R3FU.js";
40
+ import "./chunk-S7KYDPEM.js";
41
+ import "./chunk-TZ2YI2VH.js";
42
+
43
+ // src/commands/alerts/rules/schema.ts
44
+ var RULE_TYPES = [
45
+ {
46
+ type: "usage_anomaly",
47
+ description: "Built-in usage anomaly alerts"
48
+ },
49
+ {
50
+ type: "error_anomaly",
51
+ description: "Built-in error anomaly alerts"
52
+ },
53
+ {
54
+ type: "custom_alert",
55
+ description: "Custom Observability metric alerts"
56
+ }
57
+ ];
58
+ var BUILT_IN_COMMON_FIELDS = [
59
+ field("name", "yes", "string", "Rule name"),
60
+ field("alertTypes", "yes", "array", "One or more alert type configs"),
61
+ field(
62
+ "projectId",
63
+ "no",
64
+ "string",
65
+ "OData project filter; omit for team-wide"
66
+ ),
67
+ field(
68
+ "autosubscribeOwnersInKnock",
69
+ "no",
70
+ "boolean",
71
+ "Subscribe project owners"
72
+ )
73
+ ];
74
+ var CUSTOM_ALERT_COMMON_FIELDS = [
75
+ field("name", "yes", "string", "Rule name"),
76
+ field(
77
+ "projectId",
78
+ "no",
79
+ "string",
80
+ "Defaults to --project or the linked project"
81
+ ),
82
+ field("alertTypes", "yes", "array", "One or more alert type configs"),
83
+ field("customAlert", "yes", "object", "Custom alert definition"),
84
+ field(
85
+ "autosubscribeOwnersInKnock",
86
+ "no",
87
+ "boolean",
88
+ "Subscribe project owners"
89
+ )
90
+ ];
91
+ var USAGE_METRICS = [
92
+ "fluid_cpu_duration",
93
+ "fluid_duration",
94
+ "fast_data_transfer",
95
+ "edge_requests",
96
+ "function_invocations"
97
+ ];
98
+ var customQueryJson = {
99
+ event: "incomingRequest",
100
+ rollups: {
101
+ requests: {
102
+ measure: "count",
103
+ aggregation: "sum"
104
+ }
105
+ },
106
+ groupBy: ["route"],
107
+ granularity: { minutes: 5 }
108
+ };
109
+ var ratioQueryJson = {
110
+ event: "incomingRequest",
111
+ rollups: {
112
+ numerator: {
113
+ measure: "count",
114
+ aggregation: "sum",
115
+ filter: "httpStatus ge 500"
116
+ },
117
+ denominator: {
118
+ measure: "count",
119
+ aggregation: "sum"
120
+ }
121
+ },
122
+ granularity: { hours: 1 }
123
+ };
124
+ var SCHEMAS = {
125
+ usage_anomaly: {
126
+ type: "usage_anomaly",
127
+ description: "Built-in usage anomaly alerts",
128
+ fields: [
129
+ ...BUILT_IN_COMMON_FIELDS,
130
+ field("alertTypes[].type", "yes", "string", "usage_anomaly"),
131
+ field(
132
+ "alertTypes[].filter",
133
+ "no",
134
+ "string",
135
+ "OData filter for this type"
136
+ )
137
+ ],
138
+ alertTypeFilterValues: [["metric", USAGE_METRICS.join(", ")]],
139
+ examples: [
140
+ {
141
+ name: "Minimal",
142
+ body: {
143
+ name: "Usage anomalies",
144
+ alertTypes: [{ type: "usage_anomaly" }]
145
+ }
146
+ },
147
+ {
148
+ name: "Filtered to one metric",
149
+ body: {
150
+ name: "Edge request anomalies",
151
+ projectId: "projectId eq 'prj_123'",
152
+ alertTypes: [
153
+ { type: "usage_anomaly", filter: "metric eq 'edge_requests'" }
154
+ ]
155
+ }
156
+ }
157
+ ]
158
+ },
159
+ error_anomaly: {
160
+ type: "error_anomaly",
161
+ description: "Built-in error anomaly alerts",
162
+ fields: [
163
+ ...BUILT_IN_COMMON_FIELDS,
164
+ field("alertTypes[].type", "yes", "string", "error_anomaly"),
165
+ field(
166
+ "alertTypes[].filter",
167
+ "no",
168
+ "string",
169
+ "OData filter for this type"
170
+ )
171
+ ],
172
+ alertTypeFilterValues: [
173
+ ["statusGroup", "4xx, 5xx"],
174
+ ["route", `route eq '/api/checkout', contains(route, '/api')`]
175
+ ],
176
+ examples: [
177
+ {
178
+ name: "Minimal",
179
+ body: {
180
+ name: "Error anomalies",
181
+ alertTypes: [{ type: "error_anomaly" }]
182
+ }
183
+ },
184
+ {
185
+ name: "Filtered to 5xx on one route",
186
+ body: {
187
+ name: "Checkout 5xx errors",
188
+ projectId: "projectId eq 'prj_123'",
189
+ alertTypes: [
190
+ {
191
+ type: "error_anomaly",
192
+ filter: "statusGroup eq '5xx' and route eq '/api/checkout'"
193
+ }
194
+ ]
195
+ }
196
+ }
197
+ ]
198
+ },
199
+ custom_alert: {
200
+ type: "custom_alert",
201
+ description: "Custom Observability metric alerts",
202
+ fields: [
203
+ ...CUSTOM_ALERT_COMMON_FIELDS,
204
+ field("alertTypes[].type", "yes", "string", "custom_alert")
205
+ ],
206
+ customAlertFields: [
207
+ field(
208
+ "customAlert.queryJsonString",
209
+ "yes",
210
+ "string",
211
+ "Escaped query JSON"
212
+ ),
213
+ field("customAlert.triggerType", "yes", "string", "threshold, anomaly"),
214
+ field("customAlert.triggerOperator", "yes", "string", "gt, gte, lt, lte"),
215
+ field(
216
+ "customAlert.triggerThreshold",
217
+ "yes",
218
+ "number",
219
+ "Threshold value or z-score"
220
+ ),
221
+ field(
222
+ "customAlert.minThreshold",
223
+ "no",
224
+ "number",
225
+ "Minimum observed value"
226
+ ),
227
+ field(
228
+ "customAlert.formula",
229
+ "no",
230
+ "object",
231
+ "Ratio formula; left and right reference rollup keys"
232
+ )
233
+ ],
234
+ queryJsonFields: [
235
+ field("scope", "no", "object", "Project scope"),
236
+ field(
237
+ "event",
238
+ "yes",
239
+ "string",
240
+ "Alert query event name, for example incomingRequest"
241
+ ),
242
+ field("rollups", "yes", "object", "Named measure aggregations"),
243
+ field("rollups.*.measure", "yes", "string", "Metric measure"),
244
+ field("rollups.*.aggregation", "yes", "string", "Metric aggregation"),
245
+ field("rollups.*.filter", "no", "string", "Rollup-level OData filter"),
246
+ field("groupBy", "no", "array", "At most one dimension"),
247
+ field("filter", "no", "string", "Top-level OData filter"),
248
+ field("granularity", "no", "object", "5m, 1h, or 1d; defaults to 5m")
249
+ ],
250
+ queryJsonBeforeEscaping: customQueryJson,
251
+ help: CUSTOM_ALERT_EVENT_HELP,
252
+ examples: [
253
+ {
254
+ name: "Anomaly",
255
+ body: {
256
+ name: "Request volume anomaly",
257
+ alertTypes: [{ type: "custom_alert" }],
258
+ customAlert: {
259
+ queryJsonString: JSON.stringify(customQueryJson),
260
+ triggerType: "anomaly",
261
+ triggerOperator: "gt",
262
+ triggerThreshold: 3
263
+ }
264
+ }
265
+ },
266
+ {
267
+ name: "Threshold ratio",
268
+ body: {
269
+ name: "Checkout error rate",
270
+ alertTypes: [{ type: "custom_alert" }],
271
+ customAlert: {
272
+ queryJsonString: JSON.stringify(ratioQueryJson),
273
+ triggerType: "threshold",
274
+ triggerOperator: "gt",
275
+ triggerThreshold: 0.05,
276
+ formula: {
277
+ operator: "divide",
278
+ left: "numerator",
279
+ right: "denominator"
280
+ },
281
+ minThreshold: 20
282
+ }
283
+ }
284
+ }
285
+ ]
286
+ }
287
+ };
288
+ async function schema(client, argv) {
289
+ let parsedArgs;
290
+ try {
291
+ parsedArgs = parseArguments(
292
+ argv,
293
+ getFlagsSpecification(rulesSchemaSubcommand.options)
294
+ );
295
+ } catch (err) {
296
+ printError(err);
297
+ return 1;
298
+ }
299
+ const formatResult = validateJsonOutput(parsedArgs.flags);
300
+ if (!formatResult.valid) {
301
+ output_manager_default.error(formatResult.error);
302
+ return 1;
303
+ }
304
+ const jsonOutput = formatResult.jsonOutput;
305
+ const ruleType = normalizeRuleType(parsedArgs.flags["--type"]);
306
+ if (!ruleType) {
307
+ if (parsedArgs.flags["--type"]) {
308
+ return outputError(
309
+ client,
310
+ jsonOutput,
311
+ "INVALID_ARGUMENTS",
312
+ `Invalid alert rule type "${String(parsedArgs.flags["--type"])}". Use usage_anomaly, error_anomaly, or custom_alert.`
313
+ );
314
+ }
315
+ if (jsonOutput) {
316
+ client.stdout.write(
317
+ `${JSON.stringify({ types: RULE_TYPES }, null, 2)}
318
+ `
319
+ );
320
+ } else {
321
+ output_manager_default.log("Alert rule schema");
322
+ output_manager_default.print(
323
+ `
324
+ ${formatRows(
325
+ ["Type", "Description"],
326
+ RULE_TYPES.map((type) => [type.type, type.description])
327
+ )}
328
+
329
+ Run \`vercel alerts rules schema --type <type>\` to see a rule body schema.
330
+ `
331
+ );
332
+ }
333
+ return 0;
334
+ }
335
+ printRuleSchema(client, SCHEMAS[ruleType], jsonOutput);
336
+ return 0;
337
+ }
338
+ function field(field2, required, type, notes) {
339
+ return { field: field2, required, type, notes };
340
+ }
341
+ function normalizeRuleType(value) {
342
+ if (typeof value !== "string") {
343
+ return void 0;
344
+ }
345
+ const normalized = value.trim().toLowerCase().replace(/[-\s]+/g, "_");
346
+ return RULE_TYPES.some((type) => type.type === normalized) ? normalized : void 0;
347
+ }
348
+ function printRuleSchema(client, schema2, jsonOutput) {
349
+ if (jsonOutput) {
350
+ client.stdout.write(`${JSON.stringify({ schema: schema2 }, null, 2)}
351
+ `);
352
+ return;
353
+ }
354
+ output_manager_default.log(`Alert rule schema: ${schema2.type}`);
355
+ output_manager_default.print("\n");
356
+ printFieldSection("Fields", schema2.fields);
357
+ if (schema2.alertTypeFilterValues) {
358
+ output_manager_default.print("alertTypes[].filter values\n\n");
359
+ output_manager_default.print(
360
+ `${formatRows(
361
+ ["Field", "Allowed values / examples"],
362
+ schema2.alertTypeFilterValues
363
+ )}
364
+
365
+ `
366
+ );
367
+ }
368
+ if (schema2.customAlertFields) {
369
+ printFieldSection("Custom alert fields", schema2.customAlertFields);
370
+ }
371
+ if (schema2.queryJsonFields) {
372
+ printFieldSection(
373
+ "customAlert.queryJsonString fields",
374
+ schema2.queryJsonFields
375
+ );
376
+ }
377
+ if (schema2.queryJsonBeforeEscaping) {
378
+ output_manager_default.print("customAlert.queryJsonString before escaping\n\n");
379
+ output_manager_default.print(
380
+ `${indent_default(JSON.stringify(schema2.queryJsonBeforeEscaping, null, 2), 2)}
381
+
382
+ `
383
+ );
384
+ }
385
+ if (schema2.help) {
386
+ output_manager_default.print("Custom alert metric discovery\n\n");
387
+ output_manager_default.print(`${indent_default(schema2.help.join("\n"), 2)}
388
+
389
+ `);
390
+ }
391
+ output_manager_default.print("Body examples\n\n");
392
+ for (const example of schema2.examples) {
393
+ output_manager_default.print(` ${example.name}
394
+
395
+ `);
396
+ output_manager_default.print(`${indent_default(JSON.stringify(example.body, null, 2), 4)}
397
+
398
+ `);
399
+ }
400
+ }
401
+ function printFieldSection(title, fields) {
402
+ output_manager_default.print(`${title}
403
+
404
+ `);
405
+ output_manager_default.print(
406
+ `${formatRows(
407
+ ["Field", "Required", "Type", "Values / notes"],
408
+ fields.map((field2) => [
409
+ field2.field,
410
+ field2.required,
411
+ field2.type,
412
+ field2.notes
413
+ ])
414
+ )}
415
+
416
+ `
417
+ );
418
+ }
419
+ function formatRows(headers, rows) {
420
+ const alignment = headers.map(() => "l");
421
+ const tableRows = rows.map((row) => [...row]);
422
+ return formatTable(headers, alignment, [{ rows: tableRows }]).trim();
423
+ }
424
+ export {
425
+ schema as default
426
+ };
@@ -14,7 +14,7 @@ import {
14
14
  AGENT_REASON,
15
15
  buildCommandWithGlobalFlags,
16
16
  outputAgentError
17
- } from "./chunk-Z5ZQJ5VJ.js";
17
+ } from "./chunk-TJJ562C5.js";
18
18
  import "./chunk-SOFC4MLS.js";
19
19
  import "./chunk-P4QNYOFB.js";
20
20
  import {
@@ -52,9 +52,9 @@ async function tags(client, argv, telemetry) {
52
52
  }
53
53
  switch (subcommand) {
54
54
  case "ls":
55
- return (await import("./ls-TWHG22W7.js")).default(client, args, telemetry);
55
+ return (await import("./ls-DD7RQ7KH.js")).default(client, args, telemetry);
56
56
  case "inspect":
57
- return (await import("./inspect-R6ADYTPB.js")).default(client, args, telemetry);
57
+ return (await import("./inspect-WUT7EW6R.js")).default(client, args, telemetry);
58
58
  default:
59
59
  output_manager_default.error(`Unhandled tags subcommand: ${subcommand}`);
60
60
  return 1;
@@ -4,27 +4,35 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
+ import {
8
+ parseCustomAlertQueryBody,
9
+ resolveCustomAlertProjectName,
10
+ setMissingCustomAlertProjectScope
11
+ } from "./chunk-ZHDQMUK4.js";
7
12
  import {
8
13
  emitRulesArgParseError,
9
14
  handleRulesApiError,
10
15
  parseRulesFlagsAndScope,
11
16
  rulesItemPath
12
- } from "./chunk-U7Y5DZXS.js";
13
- import "./chunk-DXS2X7KK.js";
17
+ } from "./chunk-IRX26ZL5.js";
18
+ import "./chunk-QS5I33VI.js";
14
19
  import "./chunk-BUZRVER7.js";
20
+ import "./chunk-GKLT2ZGC.js";
21
+ import "./chunk-V5P25P7F.js";
15
22
  import {
16
23
  validateJsonOutput
17
24
  } from "./chunk-XPKWKPWA.js";
18
25
  import {
19
26
  rulesUpdateSubcommand
20
- } from "./chunk-4UYKSYKQ.js";
21
- import "./chunk-PVWXPWLQ.js";
27
+ } from "./chunk-UMA66MKW.js";
28
+ import "./chunk-GE5R7SYE.js";
29
+ import "./chunk-LXRK7KPA.js";
22
30
  import "./chunk-ECCWJHC6.js";
23
31
  import {
24
32
  AGENT_REASON,
25
33
  buildCommandWithGlobalFlags,
26
34
  outputAgentError
27
- } from "./chunk-Z5ZQJ5VJ.js";
35
+ } from "./chunk-TJJ562C5.js";
28
36
  import {
29
37
  printError
30
38
  } from "./chunk-KBEX5MYS.js";
@@ -168,11 +176,35 @@ async function update(client, argv) {
168
176
  output_manager_default.error("Invalid JSON in --body file.");
169
177
  return 1;
170
178
  }
179
+ const parsedCustomAlertQuery = parseCustomAlertQueryBody(client, body);
180
+ if (typeof parsedCustomAlertQuery === "number") {
181
+ return parsedCustomAlertQuery;
182
+ }
171
183
  delete body.id;
172
184
  delete body.teamId;
173
185
  const path = rulesItemPath(scope, ruleId);
174
186
  output_manager_default.spinner("Updating alert rule...");
175
187
  try {
188
+ if (parsedCustomAlertQuery && !Object.hasOwn(parsedCustomAlertQuery.query, "scope")) {
189
+ let projectId = typeof body.projectId === "string" ? body.projectId : void 0;
190
+ if (!projectId) {
191
+ const rule = await client.fetch(path);
192
+ projectId = rule.projectId;
193
+ }
194
+ if (projectId) {
195
+ const projectName = await resolveCustomAlertProjectName(
196
+ client,
197
+ scope,
198
+ projectId
199
+ );
200
+ setMissingCustomAlertProjectScope(
201
+ parsedCustomAlertQuery,
202
+ scope.teamId,
203
+ projectId,
204
+ projectName
205
+ );
206
+ }
207
+ }
176
208
  const updated = await client.fetch(path, {
177
209
  method: "PATCH",
178
210
  body
@@ -12,31 +12,31 @@ import {
12
12
  isLambda,
13
13
  staticFiles,
14
14
  writeBuildResult
15
- } from "../../chunks/chunk-OWY3MF3E.js";
15
+ } from "../../chunks/chunk-PGH6RJJF.js";
16
16
  import {
17
17
  pullCommandLogic
18
- } from "../../chunks/chunk-ZQR5RIAX.js";
18
+ } from "../../chunks/chunk-TQE7DRGH.js";
19
19
  import {
20
20
  require_semver
21
21
  } from "../../chunks/chunk-IB5L4LKZ.js";
22
22
  import {
23
23
  pickOverrides,
24
24
  readProjectSettings
25
- } from "../../chunks/chunk-G47QOVJ7.js";
25
+ } from "../../chunks/chunk-4PZ2IIZI.js";
26
26
  import "../../chunks/chunk-R6IGDGX3.js";
27
- import "../../chunks/chunk-NJUPUGOE.js";
27
+ import "../../chunks/chunk-HT2XWSAJ.js";
28
28
  import {
29
29
  stamp_default
30
30
  } from "../../chunks/chunk-64IF634X.js";
31
31
  import "../../chunks/chunk-VXYGCOKL.js";
32
32
  import {
33
33
  ensureLink
34
- } from "../../chunks/chunk-27FZN5LR.js";
35
- import "../../chunks/chunk-U5E5J56I.js";
36
- import "../../chunks/chunk-V4RMJKQP.js";
34
+ } from "../../chunks/chunk-MEOBIY2L.js";
35
+ import "../../chunks/chunk-LTEFJ3VD.js";
36
+ import "../../chunks/chunk-GE5R7SYE.js";
37
37
  import {
38
38
  buildCommand
39
- } from "../../chunks/chunk-56QCZ4RL.js";
39
+ } from "../../chunks/chunk-FQ4R66UG.js";
40
40
  import {
41
41
  help
42
42
  } from "../../chunks/chunk-ZX2FSPWV.js";
@@ -64,7 +64,7 @@ import {
64
64
  resolveProjectCwd,
65
65
  ua_default,
66
66
  validateConfig
67
- } from "../../chunks/chunk-PVWXPWLQ.js";
67
+ } from "../../chunks/chunk-LXRK7KPA.js";
68
68
  import {
69
69
  TelemetryClient
70
70
  } from "../../chunks/chunk-ECCWJHC6.js";
@@ -72,7 +72,7 @@ import {
72
72
  AGENT_REASON,
73
73
  AGENT_STATUS,
74
74
  outputAgentError
75
- } from "../../chunks/chunk-Z5ZQJ5VJ.js";
75
+ } from "../../chunks/chunk-TJJ562C5.js";
76
76
  import {
77
77
  printError,
78
78
  toEnumerableError
@@ -319,11 +319,11 @@ async function detectFirstDeploymentFramework(options) {
319
319
  ...detected.detectedVersion && { version: detected.detectedVersion }
320
320
  };
321
321
  }
322
- async function detectAllFrameworks(workPath) {
322
+ async function detectAllFrameworks(workPath, customFrameworkList) {
323
323
  logDebug(`Framework cross-check: detecting frameworks at "${workPath}"`);
324
324
  const frameworks = await (0, import_fs_detectors2.detectFrameworks)({
325
325
  fs: new import_fs_detectors2.LocalFileSystemDetector(workPath),
326
- frameworkList: import_frameworks.frameworkList
326
+ frameworkList: customFrameworkList ?? import_frameworks.frameworkList
327
327
  });
328
328
  const slugs = frameworks.map((f) => f.slug).filter((slug) => Boolean(slug));
329
329
  logDebug(`Framework cross-check: detected [${slugs.join(", ") || "<none>"}]`);
@@ -3556,11 +3556,12 @@ async function writeManifests(packageManifests, diagnostics, ops, outputDir) {
3556
3556
  builderUse
3557
3557
  } of packageManifests) {
3558
3558
  const key = `${builderUse}:${workspace}`;
3559
+ const framework = service?.framework ?? buildConfig.framework ?? manifest.framework;
3559
3560
  projectManifest[key] = {
3560
3561
  ...manifest,
3561
3562
  workspace,
3562
3563
  builder: builderUse,
3563
- framework: service?.framework ?? buildConfig.framework,
3564
+ framework,
3564
3565
  serviceName: service?.name,
3565
3566
  serviceType: service && isExperimentalService(service) ? service.type : void 0,
3566
3567
  routePrefix: service && isExperimentalService(service) ? service.routePrefix : void 0
@@ -3568,6 +3569,7 @@ async function writeManifests(packageManifests, diagnostics, ops, outputDir) {
3568
3569
  const { version: _version, ...manifestWithoutVersion } = manifest;
3569
3570
  deployManifestBuilds[key] = {
3570
3571
  ...manifestWithoutVersion,
3572
+ framework,
3571
3573
  root: workspace,
3572
3574
  builder: builderUse
3573
3575
  };
@@ -4318,6 +4320,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
4318
4320
  }
4319
4321
  const diagnostics = {};
4320
4322
  const packageManifests = [];
4323
+ const apiDirFrameworkDetector = createApiDirFrameworkDetector();
4321
4324
  const getHasDetectedServices = () => detectedResolvedServices !== void 0 && detectedResolvedServices.length > 0;
4322
4325
  const synthesizedServiceCrons = [];
4323
4326
  const serviceByBuilder = /* @__PURE__ */ new Map();
@@ -4383,6 +4386,10 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
4383
4386
  }
4384
4387
  const isFrontendBuilder = build.config && "framework" in build.config;
4385
4388
  const builderFramework = build.config?.framework ?? projectSettings.framework;
4389
+ const apiDirFramework = isZeroConfig && !service && !isFrontendBuilder ? await apiDirFrameworkDetector.detect(
4390
+ build.use ?? "",
4391
+ buildWorkPath
4392
+ ) : void 0;
4386
4393
  let buildConfig;
4387
4394
  if (isZeroConfig) {
4388
4395
  if (service) {
@@ -4416,7 +4423,7 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
4416
4423
  installCommand: projectSettings.installCommand ?? void 0,
4417
4424
  devCommand: projectSettings.devCommand ?? void 0,
4418
4425
  buildCommand: projectSettings.buildCommand ?? void 0,
4419
- framework: projectSettings.framework,
4426
+ framework: isFrontendBuilder ? projectSettings.framework : void 0,
4420
4427
  nodeVersion: projectSettings.nodeVersion,
4421
4428
  bunVersion: localConfig.bunVersion ?? void 0
4422
4429
  };
@@ -4545,14 +4552,22 @@ async function doBuild(client, project, buildsJson, cwd, outputDir, span, standa
4545
4552
  );
4546
4553
  } else {
4547
4554
  const workspace = service && serviceWorkspace && serviceWorkspace !== "." ? serviceWorkspace : ".";
4548
- packageManifests.push({
4549
- workspace,
4550
- key: fullKey,
4551
- buildConfig,
4552
- manifest: packageManifest,
4553
- service,
4554
- builderUse: builderPkg.name
4555
- });
4555
+ const alreadyPushed = packageManifests.some(
4556
+ (m) => m.builderUse === builderPkg.name && m.workspace === workspace
4557
+ );
4558
+ if (!alreadyPushed) {
4559
+ packageManifests.push({
4560
+ workspace,
4561
+ key: fullKey,
4562
+ buildConfig,
4563
+ manifest: {
4564
+ ...packageManifest,
4565
+ framework: packageManifest.framework ?? apiDirFramework
4566
+ },
4567
+ service,
4568
+ builderUse: builderPkg.name
4569
+ });
4570
+ }
4556
4571
  }
4557
4572
  } catch (e) {
4558
4573
  output_manager_default.debug(
@@ -5578,6 +5593,30 @@ async function writeFlagsJSON(buildResults, outputDir) {
5578
5593
  await import_fs_extra3.default.writeJSON(flagsFilePath, flags, { spaces: 2 });
5579
5594
  }
5580
5595
  }
5596
+ function createApiDirFrameworkDetector() {
5597
+ const cache = /* @__PURE__ */ new Map();
5598
+ return {
5599
+ detect(builderUse, workPath) {
5600
+ const cacheKey = `${builderUse}:${workPath}`;
5601
+ let cached = cache.get(cacheKey);
5602
+ if (!cached) {
5603
+ cached = detectApiDirFramework(builderUse, workPath);
5604
+ cache.set(cacheKey, cached);
5605
+ }
5606
+ return cached;
5607
+ }
5608
+ };
5609
+ }
5610
+ async function detectApiDirFramework(builderUse, workPath) {
5611
+ const runtimeFrameworks = import_fs_detectors3.builderToFrameworks.get(builderUse) ?? [];
5612
+ if (runtimeFrameworks.length === 0)
5613
+ return void 0;
5614
+ const detectedSlugs = await detectAllFrameworks(
5615
+ workPath,
5616
+ runtimeFrameworks
5617
+ ).catch(() => []);
5618
+ return detectedSlugs.length === 1 ? detectedSlugs[0] : void 0;
5619
+ }
5581
5620
  async function writeBuildJson(buildsJson, outputDir) {
5582
5621
  await import_fs_extra3.default.writeJSON(join5(outputDir, "builds.json"), buildsJson, { spaces: 2 });
5583
5622
  }