@vm0/cli 9.252.1 → 9.254.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/{agent-6DLY56R2.js → agent-RMGI2J4J.js} +7 -7
  2. package/{banking-22B7QVCY.js → banking-MY3UOHLJ.js} +5 -5
  3. package/chat-YXUYGE6R.js +622 -0
  4. package/chat-YXUYGE6R.js.map +1 -0
  5. package/{chunk-OAESJHRL.js → chunk-5SWLOAHS.js} +2 -2
  6. package/{chunk-7NPYHUEQ.js → chunk-7JATDT76.js} +147 -46
  7. package/{chunk-7NPYHUEQ.js.map → chunk-7JATDT76.js.map} +1 -1
  8. package/{chunk-7QTOTACG.js → chunk-7U3FWIOP.js} +2 -2
  9. package/chunk-B6ELBBRJ.js +83 -0
  10. package/chunk-B6ELBBRJ.js.map +1 -0
  11. package/{chunk-KBUXPDDX.js → chunk-CMTIFAL7.js} +4 -4
  12. package/{chunk-DK3C2ME6.js → chunk-D4OTAABD.js} +10 -2
  13. package/chunk-D4OTAABD.js.map +1 -0
  14. package/{chunk-7DGYI4QB.js → chunk-ES2FTLAP.js} +9 -76
  15. package/chunk-ES2FTLAP.js.map +1 -0
  16. package/{chunk-CPJVE3HV.js → chunk-OVTYR6LM.js} +2 -2
  17. package/{chunk-FBISVSTZ.js → chunk-RPYYZK6K.js} +214 -11
  18. package/chunk-RPYYZK6K.js.map +1 -0
  19. package/{chunk-Z6BXUYYX.js → chunk-SISEWEDH.js} +2 -2
  20. package/{chunk-CUAL7MH6.js → chunk-UUKFGXX5.js} +2 -2
  21. package/{chunk-MFNEXCZL.js → chunk-YHVB66HI.js} +2 -2
  22. package/{computer-use-TWN6NBIN.js → computer-use-SLXQQH6Q.js} +5 -5
  23. package/{connector-DEKQFV2G.js → connector-KVBWTIAC.js} +8 -8
  24. package/{credit-SGN2CQ4F.js → credit-RNDNLWHJ.js} +7 -7
  25. package/{developer-support-7DKJHHFR.js → developer-support-CFRQKOWQ.js} +5 -5
  26. package/{doctor-PINI2CXE.js → doctor-FAAS4UMJ.js} +7 -7
  27. package/{feishu-RVNSCNUY.js → feishu-RLVDQZZT.js} +5 -5
  28. package/{finance-IL3LEHYM.js → finance-SASI7YWY.js} +5 -5
  29. package/{generate-DVB7CDWO.js → generate-TTD32HUK.js} +7 -7
  30. package/{github-HECK3WC6.js → github-5TLXNMQW.js} +5 -5
  31. package/{goal-RJ4KHBJZ.js → goal-XLBFOMEC.js} +5 -5
  32. package/{host-UAVQ4BZY.js → host-G2TQRV4H.js} +5 -5
  33. package/{logs-PFZVJGHK.js → logs-YB3S2OWH.js} +12 -10
  34. package/{logs-PFZVJGHK.js.map → logs-YB3S2OWH.js.map} +1 -1
  35. package/{mail-SJOUFJDK.js → mail-446A7J5Y.js} +7 -7
  36. package/{maps-JCB6I264.js → maps-5WELBNFI.js} +5 -5
  37. package/{model-GI5HI3B5.js → model-WTBLQPBE.js} +6 -6
  38. package/{model-provider-YVF7DWLL.js → model-provider-DFU346QW.js} +6 -6
  39. package/{org-SPWQ25RJ.js → org-DPZYCCSA.js} +5 -5
  40. package/package.json +1 -1
  41. package/{people-search-24TMMWRS.js → people-search-OI637MVP.js} +5 -5
  42. package/{phone-3XXRREOH.js → phone-JJBH46SC.js} +5 -5
  43. package/{preference-SSKGMIHI.js → preference-WDN7V4ZO.js} +5 -5
  44. package/{resource-HJBJYOZW.js → resource-QZJY6YQN.js} +5 -5
  45. package/{scrape-LCD2CT5P.js → scrape-BNBCWLIJ.js} +5 -5
  46. package/{search-IU6AXAPL.js → search-BK4RVQZI.js} +11 -9
  47. package/{search-IU6AXAPL.js.map → search-BK4RVQZI.js.map} +1 -1
  48. package/{secret-4GZ5YF55.js → secret-74X2Y5XO.js} +5 -5
  49. package/{slack-TLBZUY27.js → slack-HHZLW2WS.js} +5 -5
  50. package/{teams-ZKQMACHI.js → teams-SPHFPBB3.js} +5 -5
  51. package/{telegram-J4ZWDUEB.js → telegram-QXFDSGQX.js} +5 -5
  52. package/{upgrade-UBEBOHV6.js → upgrade-IXKNUAPA.js} +4 -4
  53. package/{variable-4K5GUB4B.js → variable-HTV3JLS7.js} +5 -5
  54. package/{video-5LENA5YA.js → video-AVKB4NEL.js} +4 -4
  55. package/{weather-UL4D4T3L.js → weather-GAER2LFF.js} +5 -5
  56. package/{web-6452PFF7.js → web-PF3ZHXHX.js} +5 -5
  57. package/{web-search-D5HGEWU5.js → web-search-ZPAQX3HG.js} +5 -5
  58. package/{whoami-HYDZ6YSH.js → whoami-WPZMQHJF.js} +7 -7
  59. package/{workflow-W2HNGAVJ.js → workflow-M5KSFXFM.js} +577 -41
  60. package/workflow-M5KSFXFM.js.map +1 -0
  61. package/zero.js +42 -42
  62. package/chat-2QVQ3MLT.js +0 -246
  63. package/chat-2QVQ3MLT.js.map +0 -1
  64. package/chunk-7DGYI4QB.js.map +0 -1
  65. package/chunk-DK3C2ME6.js.map +0 -1
  66. package/chunk-FBISVSTZ.js.map +0 -1
  67. package/workflow-W2HNGAVJ.js.map +0 -1
  68. /package/{agent-6DLY56R2.js.map → agent-RMGI2J4J.js.map} +0 -0
  69. /package/{banking-22B7QVCY.js.map → banking-MY3UOHLJ.js.map} +0 -0
  70. /package/{chunk-OAESJHRL.js.map → chunk-5SWLOAHS.js.map} +0 -0
  71. /package/{chunk-7QTOTACG.js.map → chunk-7U3FWIOP.js.map} +0 -0
  72. /package/{chunk-KBUXPDDX.js.map → chunk-CMTIFAL7.js.map} +0 -0
  73. /package/{chunk-CPJVE3HV.js.map → chunk-OVTYR6LM.js.map} +0 -0
  74. /package/{chunk-Z6BXUYYX.js.map → chunk-SISEWEDH.js.map} +0 -0
  75. /package/{chunk-CUAL7MH6.js.map → chunk-UUKFGXX5.js.map} +0 -0
  76. /package/{chunk-MFNEXCZL.js.map → chunk-YHVB66HI.js.map} +0 -0
  77. /package/{computer-use-TWN6NBIN.js.map → computer-use-SLXQQH6Q.js.map} +0 -0
  78. /package/{connector-DEKQFV2G.js.map → connector-KVBWTIAC.js.map} +0 -0
  79. /package/{credit-SGN2CQ4F.js.map → credit-RNDNLWHJ.js.map} +0 -0
  80. /package/{developer-support-7DKJHHFR.js.map → developer-support-CFRQKOWQ.js.map} +0 -0
  81. /package/{doctor-PINI2CXE.js.map → doctor-FAAS4UMJ.js.map} +0 -0
  82. /package/{feishu-RVNSCNUY.js.map → feishu-RLVDQZZT.js.map} +0 -0
  83. /package/{finance-IL3LEHYM.js.map → finance-SASI7YWY.js.map} +0 -0
  84. /package/{generate-DVB7CDWO.js.map → generate-TTD32HUK.js.map} +0 -0
  85. /package/{github-HECK3WC6.js.map → github-5TLXNMQW.js.map} +0 -0
  86. /package/{goal-RJ4KHBJZ.js.map → goal-XLBFOMEC.js.map} +0 -0
  87. /package/{host-UAVQ4BZY.js.map → host-G2TQRV4H.js.map} +0 -0
  88. /package/{mail-SJOUFJDK.js.map → mail-446A7J5Y.js.map} +0 -0
  89. /package/{maps-JCB6I264.js.map → maps-5WELBNFI.js.map} +0 -0
  90. /package/{model-GI5HI3B5.js.map → model-WTBLQPBE.js.map} +0 -0
  91. /package/{model-provider-YVF7DWLL.js.map → model-provider-DFU346QW.js.map} +0 -0
  92. /package/{org-SPWQ25RJ.js.map → org-DPZYCCSA.js.map} +0 -0
  93. /package/{people-search-24TMMWRS.js.map → people-search-OI637MVP.js.map} +0 -0
  94. /package/{phone-3XXRREOH.js.map → phone-JJBH46SC.js.map} +0 -0
  95. /package/{preference-SSKGMIHI.js.map → preference-WDN7V4ZO.js.map} +0 -0
  96. /package/{resource-HJBJYOZW.js.map → resource-QZJY6YQN.js.map} +0 -0
  97. /package/{scrape-LCD2CT5P.js.map → scrape-BNBCWLIJ.js.map} +0 -0
  98. /package/{secret-4GZ5YF55.js.map → secret-74X2Y5XO.js.map} +0 -0
  99. /package/{slack-TLBZUY27.js.map → slack-HHZLW2WS.js.map} +0 -0
  100. /package/{teams-ZKQMACHI.js.map → teams-SPHFPBB3.js.map} +0 -0
  101. /package/{telegram-J4ZWDUEB.js.map → telegram-QXFDSGQX.js.map} +0 -0
  102. /package/{upgrade-UBEBOHV6.js.map → upgrade-IXKNUAPA.js.map} +0 -0
  103. /package/{variable-4K5GUB4B.js.map → variable-HTV3JLS7.js.map} +0 -0
  104. /package/{video-5LENA5YA.js.map → video-AVKB4NEL.js.map} +0 -0
  105. /package/{weather-UL4D4T3L.js.map → weather-GAER2LFF.js.map} +0 -0
  106. /package/{web-6452PFF7.js.map → web-PF3ZHXHX.js.map} +0 -0
  107. /package/{web-search-D5HGEWU5.js.map → web-search-ZPAQX3HG.js.map} +0 -0
  108. /package/{whoami-HYDZ6YSH.js.map → whoami-WPZMQHJF.js.map} +0 -0
@@ -19,14 +19,17 @@ import {
19
19
  listWorkflows,
20
20
  updateWorkflow,
21
21
  updateWorkflowAutomation
22
- } from "./chunk-FBISVSTZ.js";
23
- import "./chunk-OAESJHRL.js";
22
+ } from "./chunk-RPYYZK6K.js";
23
+ import "./chunk-5SWLOAHS.js";
24
24
  import "./chunk-SB7EZ2ZO.js";
25
25
  import {
26
26
  source_default,
27
27
  withErrorHandler
28
- } from "./chunk-7NPYHUEQ.js";
29
- import "./chunk-DK3C2ME6.js";
28
+ } from "./chunk-7JATDT76.js";
29
+ import {
30
+ decodeZeroTokenPayload,
31
+ isFeatureEnabled
32
+ } from "./chunk-D4OTAABD.js";
30
33
  import {
31
34
  Command
32
35
  } from "./chunk-LD4ZVU4O.js";
@@ -620,6 +623,14 @@ function workflowAutomationKindLabel(automation) {
620
623
  return "Gmail label applied";
621
624
  case "github-label-applied":
622
625
  return "GitHub label applied";
626
+ case "github-deployment-status-created":
627
+ return "GitHub deployment status created";
628
+ case "github-issue-comment-created":
629
+ return "GitHub issue comment created";
630
+ case "github-pull-request-review-submitted":
631
+ return "GitHub pull request review submitted";
632
+ case "github-workflow-job-completed":
633
+ return "GitHub workflow job completed";
623
634
  case "github-workflow-run-completed":
624
635
  return "GitHub workflow completed";
625
636
  case "google-calendar-event-created":
@@ -689,20 +700,71 @@ function printWorkflowAutomationsTable(automations) {
689
700
  );
690
701
  }
691
702
  }
692
- function printGithubWorkflowRunFilters(automation) {
693
- if (automation.kind !== "event" || automation.eventType !== "github-workflow-run-completed") {
703
+ function printGithubFilters(automation) {
704
+ if (automation.kind !== "event") {
694
705
  return;
695
706
  }
696
707
  const printFilter = (label, values) => {
697
708
  console.log(`${`${label}:`.padEnd(14)}${values?.join(", ") ?? "any"}`);
698
709
  };
699
- const { filters } = automation.eventConfig;
700
- printFilter("Repositories", filters.repositories);
701
- printFilter("Workflows", filters.workflows);
702
- printFilter("Conclusions", filters.conclusions);
703
- printFilter("Branches", filters.branches);
704
- printFilter("Events", filters.events);
705
- printFilter("Actors", filters.actors);
710
+ switch (automation.eventType) {
711
+ case "github-workflow-run-completed": {
712
+ const { filters } = automation.eventConfig;
713
+ printFilter("Repositories", filters.repositories);
714
+ printFilter("Workflows", filters.workflows);
715
+ printFilter("Conclusions", filters.conclusions);
716
+ printFilter("Branches", filters.branches);
717
+ printFilter("Events", filters.events);
718
+ printFilter("Actors", filters.actors);
719
+ return;
720
+ }
721
+ case "github-workflow-job-completed": {
722
+ const { filters } = automation.eventConfig;
723
+ printFilter("Repositories", filters.repositories);
724
+ printFilter("Workflows", filters.workflows);
725
+ printFilter("Jobs", filters.jobs);
726
+ printFilter("Conclusions", filters.conclusions);
727
+ printFilter("Branches", filters.branches);
728
+ printFilter("Runner labels", filters.runnerLabels);
729
+ printFilter("Runner groups", filters.runnerGroups);
730
+ return;
731
+ }
732
+ case "github-pull-request-review-submitted": {
733
+ const { filters } = automation.eventConfig;
734
+ printFilter("Repositories", filters.repositories);
735
+ printFilter("Review states", filters.reviewStates);
736
+ printFilter("Base branches", filters.baseBranches);
737
+ printFilter("Head branches", filters.headBranches);
738
+ printFilter("Authors", filters.trustedAuthors);
739
+ return;
740
+ }
741
+ case "github-deployment-status-created": {
742
+ const { filters } = automation.eventConfig;
743
+ printFilter("Repositories", filters.repositories);
744
+ printFilter("Environments", filters.environments);
745
+ printFilter("States", filters.states);
746
+ printFilter("Refs", filters.refs);
747
+ console.log(
748
+ `${"Production:".padEnd(14)}${filters.productionEnvironment === void 0 ? "any" : String(filters.productionEnvironment)}`
749
+ );
750
+ printFilter("Creators", filters.creators);
751
+ printFilter("Apps", filters.apps);
752
+ return;
753
+ }
754
+ case "github-issue-comment-created": {
755
+ const { filters } = automation.eventConfig;
756
+ printFilter("Repositories", filters.repositories);
757
+ console.log(
758
+ `${"Subject:".padEnd(14)}${formatGithubSubject(filters.subject)}`
759
+ );
760
+ printFilter("Authors", filters.trustedAuthors);
761
+ printFilter("Prefixes", filters.commentPrefixes);
762
+ return;
763
+ }
764
+ default: {
765
+ return;
766
+ }
767
+ }
706
768
  }
707
769
  function printWorkflowAutomationDetails(automation, options) {
708
770
  const status = automation.enabled ? source_default.green("enabled") : source_default.yellow("disabled");
@@ -734,7 +796,7 @@ function printWorkflowAutomationDetails(automation, options) {
734
796
  `${"Actor:".padEnd(14)}${automation.eventConfig.filters.actor.type}`
735
797
  );
736
798
  }
737
- printGithubWorkflowRunFilters(automation);
799
+ printGithubFilters(automation);
738
800
  if (isGoogleCalendarAutomation(automation)) {
739
801
  console.log(
740
802
  `${"Calendar:".padEnd(14)}${automation.eventConfig.calendarId}`
@@ -1063,7 +1125,31 @@ var EVENT_KINDS = [
1063
1125
  "notion-page-content-updated",
1064
1126
  "webhook"
1065
1127
  ];
1066
- var AUTOMATION_KINDS = [...SCHEDULE_KINDS, ...EVENT_KINDS];
1128
+ var GITHUB_WEBHOOK_EVENT_KINDS = [
1129
+ "github-workflow-job-completed",
1130
+ "github-pull-request-review-submitted",
1131
+ "github-deployment-status-created",
1132
+ "github-issue-comment-created"
1133
+ ];
1134
+ function githubWebhookAutomationsEnabled() {
1135
+ const payload = decodeZeroTokenPayload();
1136
+ return isFeatureEnabled("githubWebhookAutomations" /* GithubWebhookAutomations */, {
1137
+ userId: payload?.userId,
1138
+ orgId: payload?.orgId
1139
+ });
1140
+ }
1141
+ function automationKinds() {
1142
+ return [
1143
+ ...SCHEDULE_KINDS,
1144
+ ...EVENT_KINDS,
1145
+ ...githubWebhookAutomationsEnabled() ? GITHUB_WEBHOOK_EVENT_KINDS : []
1146
+ ];
1147
+ }
1148
+ function githubWebhookEventKind(kind) {
1149
+ return GITHUB_WEBHOOK_EVENT_KINDS.some((eventKind) => {
1150
+ return eventKind === kind;
1151
+ });
1152
+ }
1067
1153
  var EXACTLY_ONE_FLAG_MESSAGE = "Provide exactly one of --expr (cron), --at (once), --every (loop), Gmail match options, --label, --subject, --actor, --calendar-id, --page-url, --parent-page-url, or --database-url";
1068
1154
  function addGmailAutomationOptions(command) {
1069
1155
  return command.option(
@@ -1095,22 +1181,52 @@ function addGmailAutomationOptions(command) {
1095
1181
  function addGithubAutomationOptions(command) {
1096
1182
  return command.option(
1097
1183
  "--subject <subject>",
1098
- "GitHub subject filter for github-label-applied: both | issues | pull-requests"
1184
+ "GitHub subject filter for label/comment automations: both | issues | pull-requests"
1099
1185
  ).option(
1100
1186
  "--actor <actor>",
1101
1187
  "GitHub actor filter: me | anyone for labels, or comma-separated logins for workflow runs"
1102
1188
  ).option(
1103
1189
  "--repository <repositories>",
1104
- "GitHub workflow run repositories, comma-separated owner/name values"
1190
+ "GitHub repositories, comma-separated owner/name values"
1105
1191
  ).option(
1106
1192
  "--workflow <workflows>",
1107
1193
  "GitHub workflows, comma-separated IDs, names, or paths"
1108
1194
  ).option(
1109
1195
  "--conclusion <conclusions>",
1110
- "Workflow run conclusions, comma-separated values"
1111
- ).option("--branch <branches>", "Workflow run branches, comma-separated").option(
1196
+ "Workflow run or job conclusions, comma-separated values"
1197
+ ).option(
1198
+ "--branch <branches>",
1199
+ "Workflow run or job branches, comma-separated"
1200
+ ).option(
1112
1201
  "--triggering-event <events>",
1113
1202
  "Workflow run triggering events, comma-separated"
1203
+ ).option("--job <jobs>", "GitHub Actions job names or IDs, comma-separated").option("--runner-label <labels>", "Runner labels, comma-separated").option(
1204
+ "--runner-group <groups>",
1205
+ "Runner group names or IDs, comma-separated"
1206
+ ).option(
1207
+ "--review-state <states>",
1208
+ "Review states: approved, changes_requested, commented, or any"
1209
+ ).option(
1210
+ "--base-branch <branches>",
1211
+ "Pull request base branches, comma-separated"
1212
+ ).option(
1213
+ "--head-branch <branches>",
1214
+ "Pull request head branches, comma-separated"
1215
+ ).option(
1216
+ "--trusted-author <logins>",
1217
+ "Trusted GitHub author logins, comma-separated; omit to allow anyone"
1218
+ ).option("--environment <names>", "Deployment environments, comma-separated").option("--deployment-state <states>", "Deployment states, comma-separated").option("--ref <refs>", "Deployment refs, comma-separated").option(
1219
+ "--production-environment <value>",
1220
+ "Deployment environment filter: true | false | any"
1221
+ ).option(
1222
+ "--creator <logins>",
1223
+ "Deployment creator logins or IDs, comma-separated"
1224
+ ).option(
1225
+ "--app <apps>",
1226
+ "Deployment GitHub App slugs, names, or IDs, comma-separated"
1227
+ ).option(
1228
+ "--comment-prefix <prefixes>",
1229
+ "Required trimmed comment prefixes, comma-separated"
1114
1230
  );
1115
1231
  }
1116
1232
  function timezoneOrUtc(timezone) {
@@ -1245,7 +1361,7 @@ function buildSchedule(kind, options) {
1245
1361
  };
1246
1362
  default:
1247
1363
  throw new Error(
1248
- `Unknown automation kind: "${kind}". Use one of: ${AUTOMATION_KINDS.join(", ")}`
1364
+ `Unknown automation kind: "${kind}". Use one of: ${automationKinds().join(", ")}`
1249
1365
  );
1250
1366
  }
1251
1367
  }
@@ -1258,8 +1374,56 @@ function hasGithubLabelAutomationOptions(options) {
1258
1374
  function hasGithubWorkflowRunSpecificOptions(options) {
1259
1375
  return options.repository !== void 0 || options.workflow !== void 0 || options.conclusion !== void 0 || options.branch !== void 0 || options.triggeringEvent !== void 0;
1260
1376
  }
1377
+ var GITHUB_AUTOMATION_OPTION_KEYS = [
1378
+ "subject",
1379
+ "actor",
1380
+ "repository",
1381
+ "workflow",
1382
+ "job",
1383
+ "conclusion",
1384
+ "branch",
1385
+ "triggeringEvent",
1386
+ "runnerLabel",
1387
+ "runnerGroup",
1388
+ "reviewState",
1389
+ "baseBranch",
1390
+ "headBranch",
1391
+ "trustedAuthor",
1392
+ "environment",
1393
+ "deploymentState",
1394
+ "ref",
1395
+ "productionEnvironment",
1396
+ "creator",
1397
+ "app",
1398
+ "commentPrefix"
1399
+ ];
1400
+ function githubOptionValue(options, key) {
1401
+ return options[key];
1402
+ }
1403
+ function hasGithubWebhookOptions(options) {
1404
+ return GITHUB_AUTOMATION_OPTION_KEYS.some((key) => {
1405
+ return githubOptionValue(options, key) !== void 0;
1406
+ });
1407
+ }
1261
1408
  function hasGithubAutomationOptions(options) {
1262
- return hasGithubLabelAutomationOptions(options) || hasGithubWorkflowRunSpecificOptions(options);
1409
+ return hasGithubLabelAutomationOptions(options) || hasGithubWorkflowRunSpecificOptions(options) || hasGithubWebhookOptions(options);
1410
+ }
1411
+ function assertOnlyGithubAutomationOptions(options, allowed) {
1412
+ const invalid = GITHUB_AUTOMATION_OPTION_KEYS.find((key) => {
1413
+ return githubOptionValue(options, key) !== void 0 && !allowed.includes(key);
1414
+ });
1415
+ if (invalid) {
1416
+ throw new Error(
1417
+ `--${invalid.replace(/[A-Z]/g, (match) => {
1418
+ return `-${match.toLowerCase()}`;
1419
+ })} does not apply to this GitHub automation`
1420
+ );
1421
+ }
1422
+ }
1423
+ function hasAnyGithubAutomationOption(options, allowed) {
1424
+ return allowed.some((key) => {
1425
+ return githubOptionValue(options, key) !== void 0;
1426
+ });
1263
1427
  }
1264
1428
  function hasCalendarAutomationOptions(options) {
1265
1429
  return options.calendarId !== void 0;
@@ -1380,7 +1544,7 @@ function parseGithubWorkflowRunFilter(value, fallback) {
1380
1544
  )
1381
1545
  );
1382
1546
  if (values.length === 0) {
1383
- throw new Error("GitHub workflow run filters cannot be empty; use any");
1547
+ throw new Error("GitHub filters cannot be empty; use any");
1384
1548
  }
1385
1549
  return values;
1386
1550
  }
@@ -1400,6 +1564,64 @@ function parseGithubWorkflowRunConclusions(value, fallback) {
1400
1564
  );
1401
1565
  });
1402
1566
  }
1567
+ var GITHUB_PULL_REQUEST_REVIEW_STATES = ["approved", "changes_requested", "commented"];
1568
+ var GITHUB_DEPLOYMENT_STATES = [
1569
+ "error",
1570
+ "failure",
1571
+ "inactive",
1572
+ "in_progress",
1573
+ "pending",
1574
+ "queued",
1575
+ "success",
1576
+ "waiting"
1577
+ ];
1578
+ function parseGithubReviewStates(value, fallback) {
1579
+ const values = parseGithubWorkflowRunFilter(value, fallback);
1580
+ if (!values) {
1581
+ return void 0;
1582
+ }
1583
+ return values.map((state) => {
1584
+ if (GITHUB_PULL_REQUEST_REVIEW_STATES.includes(
1585
+ state
1586
+ )) {
1587
+ return state;
1588
+ }
1589
+ throw new Error(
1590
+ `Invalid --review-state "${state}". Use one of: ${GITHUB_PULL_REQUEST_REVIEW_STATES.join(", ")}, any`
1591
+ );
1592
+ });
1593
+ }
1594
+ function parseGithubDeploymentStates(value, fallback) {
1595
+ const values = parseGithubWorkflowRunFilter(value, fallback);
1596
+ if (!values) {
1597
+ return void 0;
1598
+ }
1599
+ return values.map((state) => {
1600
+ if (GITHUB_DEPLOYMENT_STATES.includes(state)) {
1601
+ return state;
1602
+ }
1603
+ throw new Error(
1604
+ `Invalid --deployment-state "${state}". Use one of: ${GITHUB_DEPLOYMENT_STATES.join(", ")}, any`
1605
+ );
1606
+ });
1607
+ }
1608
+ function parseProductionEnvironment(value, fallback) {
1609
+ if (value === void 0) {
1610
+ return fallback;
1611
+ }
1612
+ switch (value.trim().toLowerCase()) {
1613
+ case "any":
1614
+ return void 0;
1615
+ case "true":
1616
+ return true;
1617
+ case "false":
1618
+ return false;
1619
+ default:
1620
+ throw new Error(
1621
+ `Invalid --production-environment "${value}". Use true, false, or any`
1622
+ );
1623
+ }
1624
+ }
1403
1625
  function buildGithubWorkflowRunCompletedEventConfig(options, existing) {
1404
1626
  const filters = existing?.eventConfig.filters;
1405
1627
  return {
@@ -1427,6 +1649,119 @@ function buildGithubWorkflowRunCompletedEventConfig(options, existing) {
1427
1649
  }
1428
1650
  };
1429
1651
  }
1652
+ function buildGithubWorkflowJobCompletedEventConfig(options, existing) {
1653
+ const filters = existing?.eventConfig.filters;
1654
+ return {
1655
+ provider: "github",
1656
+ event: "workflow_job_completed",
1657
+ filters: {
1658
+ repositories: parseGithubWorkflowRunFilter(
1659
+ options.repository,
1660
+ filters?.repositories
1661
+ ),
1662
+ workflows: parseGithubWorkflowRunFilter(
1663
+ options.workflow,
1664
+ filters?.workflows
1665
+ ),
1666
+ jobs: parseGithubWorkflowRunFilter(options.job, filters?.jobs),
1667
+ conclusions: parseGithubWorkflowRunConclusions(
1668
+ options.conclusion,
1669
+ filters?.conclusions
1670
+ ),
1671
+ branches: parseGithubWorkflowRunFilter(options.branch, filters?.branches),
1672
+ runnerLabels: parseGithubWorkflowRunFilter(
1673
+ options.runnerLabel,
1674
+ filters?.runnerLabels
1675
+ ),
1676
+ runnerGroups: parseGithubWorkflowRunFilter(
1677
+ options.runnerGroup,
1678
+ filters?.runnerGroups
1679
+ )
1680
+ }
1681
+ };
1682
+ }
1683
+ function buildGithubPullRequestReviewSubmittedEventConfig(options, existing) {
1684
+ const filters = existing?.eventConfig.filters;
1685
+ return {
1686
+ provider: "github",
1687
+ event: "pull_request_review_submitted",
1688
+ filters: {
1689
+ repositories: parseGithubWorkflowRunFilter(
1690
+ options.repository,
1691
+ filters?.repositories
1692
+ ),
1693
+ reviewStates: parseGithubReviewStates(
1694
+ options.reviewState,
1695
+ filters?.reviewStates
1696
+ ),
1697
+ baseBranches: parseGithubWorkflowRunFilter(
1698
+ options.baseBranch,
1699
+ filters?.baseBranches
1700
+ ),
1701
+ headBranches: parseGithubWorkflowRunFilter(
1702
+ options.headBranch,
1703
+ filters?.headBranches
1704
+ ),
1705
+ trustedAuthors: parseGithubWorkflowRunFilter(
1706
+ options.trustedAuthor,
1707
+ filters?.trustedAuthors
1708
+ )
1709
+ }
1710
+ };
1711
+ }
1712
+ function buildGithubDeploymentStatusCreatedEventConfig(options, existing) {
1713
+ const filters = existing?.eventConfig.filters;
1714
+ return {
1715
+ provider: "github",
1716
+ event: "deployment_status_created",
1717
+ filters: {
1718
+ repositories: parseGithubWorkflowRunFilter(
1719
+ options.repository,
1720
+ filters?.repositories
1721
+ ),
1722
+ environments: parseGithubWorkflowRunFilter(
1723
+ options.environment,
1724
+ filters?.environments
1725
+ ),
1726
+ states: parseGithubDeploymentStates(
1727
+ options.deploymentState,
1728
+ filters?.states
1729
+ ),
1730
+ refs: parseGithubWorkflowRunFilter(options.ref, filters?.refs),
1731
+ productionEnvironment: parseProductionEnvironment(
1732
+ options.productionEnvironment,
1733
+ filters?.productionEnvironment
1734
+ ),
1735
+ creators: parseGithubWorkflowRunFilter(
1736
+ options.creator,
1737
+ filters?.creators
1738
+ ),
1739
+ apps: parseGithubWorkflowRunFilter(options.app, filters?.apps)
1740
+ }
1741
+ };
1742
+ }
1743
+ function buildGithubIssueCommentCreatedEventConfig(options, existing) {
1744
+ const filters = existing?.eventConfig.filters;
1745
+ return {
1746
+ provider: "github",
1747
+ event: "issue_comment_created",
1748
+ filters: {
1749
+ repositories: parseGithubWorkflowRunFilter(
1750
+ options.repository,
1751
+ filters?.repositories
1752
+ ),
1753
+ subject: parseGithubSubject(options.subject, filters?.subject ?? "both"),
1754
+ trustedAuthors: parseGithubWorkflowRunFilter(
1755
+ options.trustedAuthor,
1756
+ filters?.trustedAuthors
1757
+ ),
1758
+ commentPrefixes: parseGithubWorkflowRunFilter(
1759
+ options.commentPrefix,
1760
+ filters?.commentPrefixes
1761
+ )
1762
+ }
1763
+ };
1764
+ }
1430
1765
  function buildGmailNewMessageCreateRequest(options) {
1431
1766
  assertNoScheduleAddOptions(options);
1432
1767
  if (hasGmailLabelOption(options)) {
@@ -1471,6 +1806,7 @@ function buildGithubLabelAppliedCreateRequest(options) {
1471
1806
  "Workflow run filter flags only apply to github-workflow-run-completed automations"
1472
1807
  );
1473
1808
  }
1809
+ assertOnlyGithubAutomationOptions(options, ["subject", "actor"]);
1474
1810
  return {
1475
1811
  kind: "event",
1476
1812
  eventType: "github-label-applied",
@@ -1489,6 +1825,14 @@ function buildGithubWorkflowRunCompletedCreateRequest(options) {
1489
1825
  "--subject only applies to github-label-applied automations"
1490
1826
  );
1491
1827
  }
1828
+ assertOnlyGithubAutomationOptions(options, [
1829
+ "repository",
1830
+ "workflow",
1831
+ "conclusion",
1832
+ "branch",
1833
+ "triggeringEvent",
1834
+ "actor"
1835
+ ]);
1492
1836
  assertNoCalendarAutomationOptions(options);
1493
1837
  assertNoNotionAutomationOptions(options);
1494
1838
  return {
@@ -1497,6 +1841,76 @@ function buildGithubWorkflowRunCompletedCreateRequest(options) {
1497
1841
  eventConfig: buildGithubWorkflowRunCompletedEventConfig(options)
1498
1842
  };
1499
1843
  }
1844
+ function assertGithubWebhookCreateOptions(options, allowed) {
1845
+ assertNoScheduleAddOptions(options);
1846
+ if (hasGmailAutomationOptions(options) || hasGmailLabelOption(options)) {
1847
+ throw new Error(
1848
+ "Gmail automation flags only apply to Gmail event automations"
1849
+ );
1850
+ }
1851
+ assertNoCalendarAutomationOptions(options);
1852
+ assertNoNotionAutomationOptions(options);
1853
+ assertOnlyGithubAutomationOptions(options, allowed);
1854
+ }
1855
+ function buildGithubWorkflowJobCompletedCreateRequest(options) {
1856
+ assertGithubWebhookCreateOptions(options, [
1857
+ "repository",
1858
+ "workflow",
1859
+ "job",
1860
+ "conclusion",
1861
+ "branch",
1862
+ "runnerLabel",
1863
+ "runnerGroup"
1864
+ ]);
1865
+ return {
1866
+ kind: "event",
1867
+ eventType: "github-workflow-job-completed",
1868
+ eventConfig: buildGithubWorkflowJobCompletedEventConfig(options)
1869
+ };
1870
+ }
1871
+ function buildGithubPullRequestReviewSubmittedCreateRequest(options) {
1872
+ assertGithubWebhookCreateOptions(options, [
1873
+ "repository",
1874
+ "reviewState",
1875
+ "baseBranch",
1876
+ "headBranch",
1877
+ "trustedAuthor"
1878
+ ]);
1879
+ return {
1880
+ kind: "event",
1881
+ eventType: "github-pull-request-review-submitted",
1882
+ eventConfig: buildGithubPullRequestReviewSubmittedEventConfig(options)
1883
+ };
1884
+ }
1885
+ function buildGithubDeploymentStatusCreatedCreateRequest(options) {
1886
+ assertGithubWebhookCreateOptions(options, [
1887
+ "repository",
1888
+ "environment",
1889
+ "deploymentState",
1890
+ "ref",
1891
+ "productionEnvironment",
1892
+ "creator",
1893
+ "app"
1894
+ ]);
1895
+ return {
1896
+ kind: "event",
1897
+ eventType: "github-deployment-status-created",
1898
+ eventConfig: buildGithubDeploymentStatusCreatedEventConfig(options)
1899
+ };
1900
+ }
1901
+ function buildGithubIssueCommentCreatedCreateRequest(options) {
1902
+ assertGithubWebhookCreateOptions(options, [
1903
+ "repository",
1904
+ "subject",
1905
+ "trustedAuthor",
1906
+ "commentPrefix"
1907
+ ]);
1908
+ return {
1909
+ kind: "event",
1910
+ eventType: "github-issue-comment-created",
1911
+ eventConfig: buildGithubIssueCommentCreatedEventConfig(options)
1912
+ };
1913
+ }
1500
1914
  function buildGoogleCalendarEventCreateRequest(eventType, options) {
1501
1915
  assertNoScheduleAddOptions(options);
1502
1916
  if (hasGmailAutomationOptions(options) || hasGmailLabelOption(options) || hasGithubAutomationOptions(options) || hasNotionAutomationOptions(options)) {
@@ -1657,6 +2071,14 @@ function buildCreateRequest(kind, options) {
1657
2071
  return buildGithubLabelAppliedCreateRequest(options);
1658
2072
  case "github-workflow-run-completed":
1659
2073
  return buildGithubWorkflowRunCompletedCreateRequest(options);
2074
+ case "github-workflow-job-completed":
2075
+ return buildGithubWorkflowJobCompletedCreateRequest(options);
2076
+ case "github-pull-request-review-submitted":
2077
+ return buildGithubPullRequestReviewSubmittedCreateRequest(options);
2078
+ case "github-deployment-status-created":
2079
+ return buildGithubDeploymentStatusCreatedCreateRequest(options);
2080
+ case "github-issue-comment-created":
2081
+ return buildGithubIssueCommentCreatedCreateRequest(options);
1660
2082
  case "google-calendar-event-created":
1661
2083
  return buildGoogleCalendarEventCreateRequest(kind, options);
1662
2084
  case "google-calendar-event-updated":
@@ -1675,6 +2097,125 @@ function buildCreateRequest(kind, options) {
1675
2097
  return buildScheduleCreateRequest(kind, options);
1676
2098
  }
1677
2099
  }
2100
+ function buildGithubWorkflowEventUpdate(options, existing) {
2101
+ switch (existing.eventType) {
2102
+ case "github-workflow-run-completed": {
2103
+ if (hasGmailAutomationOptions(options) || hasGmailLabelOption(options) || options.subject !== void 0) {
2104
+ throw new Error(
2105
+ "Gmail, label, and subject flags do not apply to GitHub workflow run automations"
2106
+ );
2107
+ }
2108
+ if (!hasGithubAutomationOptions(options)) {
2109
+ throw new Error(
2110
+ "Provide a GitHub workflow run filter flag; use any to clear a filter"
2111
+ );
2112
+ }
2113
+ assertOnlyGithubAutomationOptions(options, [
2114
+ "repository",
2115
+ "workflow",
2116
+ "conclusion",
2117
+ "branch",
2118
+ "triggeringEvent",
2119
+ "actor"
2120
+ ]);
2121
+ return {
2122
+ eventConfig: buildGithubWorkflowRunCompletedEventConfig(
2123
+ options,
2124
+ existing
2125
+ )
2126
+ };
2127
+ }
2128
+ case "github-workflow-job-completed": {
2129
+ const allowed = [
2130
+ "repository",
2131
+ "workflow",
2132
+ "job",
2133
+ "conclusion",
2134
+ "branch",
2135
+ "runnerLabel",
2136
+ "runnerGroup"
2137
+ ];
2138
+ assertOnlyGithubAutomationOptions(options, allowed);
2139
+ if (!hasAnyGithubAutomationOption(options, allowed)) {
2140
+ throw new Error(
2141
+ "Provide a GitHub workflow job filter flag; use any to clear a filter"
2142
+ );
2143
+ }
2144
+ return {
2145
+ eventConfig: buildGithubWorkflowJobCompletedEventConfig(
2146
+ options,
2147
+ existing
2148
+ )
2149
+ };
2150
+ }
2151
+ case "github-pull-request-review-submitted": {
2152
+ const allowed = [
2153
+ "repository",
2154
+ "reviewState",
2155
+ "baseBranch",
2156
+ "headBranch",
2157
+ "trustedAuthor"
2158
+ ];
2159
+ assertOnlyGithubAutomationOptions(options, allowed);
2160
+ if (!hasAnyGithubAutomationOption(options, allowed)) {
2161
+ throw new Error(
2162
+ "Provide a GitHub pull request review filter flag; use any to clear a filter"
2163
+ );
2164
+ }
2165
+ return {
2166
+ eventConfig: buildGithubPullRequestReviewSubmittedEventConfig(
2167
+ options,
2168
+ existing
2169
+ )
2170
+ };
2171
+ }
2172
+ case "github-deployment-status-created": {
2173
+ const allowed = [
2174
+ "repository",
2175
+ "environment",
2176
+ "deploymentState",
2177
+ "ref",
2178
+ "productionEnvironment",
2179
+ "creator",
2180
+ "app"
2181
+ ];
2182
+ assertOnlyGithubAutomationOptions(options, allowed);
2183
+ if (!hasAnyGithubAutomationOption(options, allowed)) {
2184
+ throw new Error(
2185
+ "Provide a GitHub deployment status filter flag; use any to clear a filter"
2186
+ );
2187
+ }
2188
+ return {
2189
+ eventConfig: buildGithubDeploymentStatusCreatedEventConfig(
2190
+ options,
2191
+ existing
2192
+ )
2193
+ };
2194
+ }
2195
+ case "github-issue-comment-created": {
2196
+ const allowed = [
2197
+ "repository",
2198
+ "subject",
2199
+ "trustedAuthor",
2200
+ "commentPrefix"
2201
+ ];
2202
+ assertOnlyGithubAutomationOptions(options, allowed);
2203
+ if (!hasAnyGithubAutomationOption(options, allowed)) {
2204
+ throw new Error(
2205
+ "Provide a GitHub issue comment filter flag; use any to clear a filter"
2206
+ );
2207
+ }
2208
+ return {
2209
+ eventConfig: buildGithubIssueCommentCreatedEventConfig(
2210
+ options,
2211
+ existing
2212
+ )
2213
+ };
2214
+ }
2215
+ default:
2216
+ return void 0;
2217
+ }
2218
+ }
1678
2219
  function buildEventUpdate(options, existing) {
1679
2220
  const hasGmailOptions = hasGmailAutomationOptions(options);
1680
2221
  const hasLabelOption = hasGmailLabelOption(options);
@@ -1693,6 +2234,7 @@ function buildEventUpdate(options, existing) {
1693
2234
  "Workflow run filter flags only apply to github-workflow-run-completed automations"
1694
2235
  );
1695
2236
  }
2237
+ assertOnlyGithubAutomationOptions(options, ["subject", "actor"]);
1696
2238
  if (!hasLabelOption && !hasGithubOptions) {
1697
2239
  throw new Error(
1698
2240
  "Provide --label, --subject, or --actor for github-label-applied automations"
@@ -1702,23 +2244,12 @@ function buildEventUpdate(options, existing) {
1702
2244
  eventConfig: buildGithubLabelAppliedEventConfig(options, existing)
1703
2245
  };
1704
2246
  }
1705
- if (existing.eventType === "github-workflow-run-completed") {
1706
- if (hasGmailOptions || hasLabelOption || options.subject !== void 0) {
1707
- throw new Error(
1708
- "Gmail, label, and subject flags do not apply to GitHub workflow run automations"
1709
- );
1710
- }
1711
- if (!hasGithubAutomationOptions(options)) {
1712
- throw new Error(
1713
- "Provide a GitHub workflow run filter flag; use any to clear a filter"
1714
- );
1715
- }
1716
- return {
1717
- eventConfig: buildGithubWorkflowRunCompletedEventConfig(
1718
- options,
1719
- existing
1720
- )
1721
- };
2247
+ const githubWorkflowUpdate = buildGithubWorkflowEventUpdate(
2248
+ options,
2249
+ existing
2250
+ );
2251
+ if (githubWorkflowUpdate) {
2252
+ return githubWorkflowUpdate;
1722
2253
  }
1723
2254
  if (hasGithubOptions) {
1724
2255
  throw new Error(
@@ -1784,7 +2315,7 @@ function buildUpdate(options, existing) {
1784
2315
  }
1785
2316
  var addCommand = addGithubAutomationOptions(
1786
2317
  addGmailAutomationOptions(
1787
- new Command().name("add").description("Add an automation to a workflow").argument("<workflow>", "Workflow ID or name").argument("<kind>", `Automation type: ${AUTOMATION_KINDS.join(" | ")}`).option("--expr <expression>", 'Cron expression for kind "cron"').option("--at <iso-time>", 'Fire time for kind "once"').option(
2318
+ new Command().name("add").description("Add an automation to a workflow").argument("<workflow>", "Workflow ID or name").argument("<kind>", `Automation type: ${automationKinds().join(" | ")}`).option("--expr <expression>", 'Cron expression for kind "cron"').option("--at <iso-time>", 'Fire time for kind "once"').option(
1788
2319
  "--every <duration>",
1789
2320
  'Interval for kind "loop" (e.g. 15m, 1h, 90s)'
1790
2321
  ).option(
@@ -1835,6 +2366,11 @@ Notes:
1835
2366
  ).action(
1836
2367
  withErrorHandler(
1837
2368
  async (workflowRef, kind, options) => {
2369
+ if (githubWebhookEventKind(kind) && !githubWebhookAutomationsEnabled()) {
2370
+ throw new Error(
2371
+ "GitHub webhook automations are not enabled for this workspace"
2372
+ );
2373
+ }
1838
2374
  if (options.timezone && kind !== "cron" && kind !== "once" && kind !== "gmail-new-message") {
1839
2375
  throw new Error(
1840
2376
  "--timezone only applies to cron and once automations"
@@ -1957,4 +2493,4 @@ Examples:
1957
2493
  export {
1958
2494
  zeroWorkflowCommand
1959
2495
  };
1960
- //# sourceMappingURL=workflow-W2HNGAVJ.js.map
2496
+ //# sourceMappingURL=workflow-M5KSFXFM.js.map