@vm0/cli 9.213.7 → 9.214.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.
- package/{agent-XO6L2N44.js → agent-MPDJ76OU.js} +4 -4
- package/{automation-RTPXOLQJ.js → automation-A7N2RTDA.js} +2 -2
- package/{banking-ONFKXLJL.js → banking-4KF33QY3.js} +2 -2
- package/{chunk-IMJM4MSF.js → chunk-73XD3BHA.js} +2 -2
- package/{chunk-VHQZF7HL.js → chunk-EXFLDUFG.js} +2 -2
- package/{chunk-WD35BPZI.js → chunk-HP73BCIH.js} +3 -3
- package/{chunk-3WC7YF42.js → chunk-IZJCDQVH.js} +72 -70
- package/chunk-IZJCDQVH.js.map +1 -0
- package/{chunk-BOPFTESJ.js → chunk-OD274GXN.js} +2 -2
- package/{chunk-XZXPLBOS.js → chunk-Q4C5Z46X.js} +3 -3
- package/{chunk-C3WSLFCZ.js → chunk-TIVKO5OM.js} +2 -2
- package/{chunk-NYVNECWO.js → chunk-WCLP6H4W.js} +8 -2
- package/chunk-WCLP6H4W.js.map +1 -0
- package/{chunk-QY544343.js → chunk-YXWJZ4II.js} +2 -2
- package/{computer-use-YBL32C2Z.js → computer-use-56HKGPIB.js} +2 -2
- package/{connector-VXVCJC7O.js → connector-RQWPWJZT.js} +3 -3
- package/{credit-NPXWPS7N.js → credit-42T5MAI6.js} +2 -2
- package/{developer-support-RJJ6MU4P.js → developer-support-KJLGEXSU.js} +2 -2
- package/{doctor-3DWZ6OK7.js → doctor-QCO7CRXG.js} +8 -8
- package/{generate-GVVANLYC.js → generate-4AD4KXJ2.js} +3 -3
- package/{github-SWD5WTUP.js → github-WOXPPAI4.js} +2 -2
- package/{gmail.generated-HG53NEQU.js → gmail.generated-PQRRPXQT.js} +41 -1
- package/{gmail.generated-HG53NEQU.js.map → gmail.generated-PQRRPXQT.js.map} +1 -1
- package/{goal-73BYBVE4.js → goal-7FBN733E.js} +2 -2
- package/{google-cloud.generated-V6NTCJJE.js → google-cloud.generated-YXGYYFFQ.js} +33 -1
- package/{google-cloud.generated-V6NTCJJE.js.map → google-cloud.generated-YXGYYFFQ.js.map} +1 -1
- package/{google-drive.generated-OROWMZTF.js → google-drive.generated-T5BTUU7V.js} +25 -1
- package/{google-drive.generated-OROWMZTF.js.map → google-drive.generated-T5BTUU7V.js.map} +1 -1
- package/{host-BK72W6PL.js → host-QAQ7JYL3.js} +2 -2
- package/index.js +13 -13
- package/{logs-D2WBV7KO.js → logs-AMX77H7X.js} +6 -6
- package/{maps-O4M3KIFK.js → maps-V5OLGHKP.js} +2 -2
- package/{model-7CWVS6JX.js → model-P7XADD6X.js} +7 -7
- package/model-P7XADD6X.js.map +1 -0
- package/{model-provider-PMCTLFDQ.js → model-provider-JECJM2KF.js} +3 -3
- package/{org-MKNE6LO7.js → org-DUSHK6SN.js} +2 -2
- package/package.json +1 -1
- package/{phone-Y6IXQLKK.js → phone-EXK7LGHN.js} +2 -2
- package/{preference-RZ7N6KYX.js → preference-2L4E3J3D.js} +2 -2
- package/{resource-DAKTXKBE.js → resource-UPLKX6QV.js} +2 -2
- package/{search-TODYOUN7.js → search-7UH7SXKW.js} +6 -6
- package/{secret-T523D5LM.js → secret-AQ7AP3DS.js} +3 -3
- package/{slack-G2TBUALH.js → slack-2IN77ZLP.js} +2 -2
- package/{telegram-2RI22G5A.js → telegram-DM6EHLCO.js} +2 -2
- package/{variable-MGGFJ2U5.js → variable-DHHXDYDR.js} +2 -2
- package/{web-CCVDAUYP.js → web-UUM7QCLI.js} +2 -2
- package/{whoami-ZZZUZIL7.js → whoami-SDUJGSRT.js} +4 -4
- package/{workflow-DR5N3QR7.js → workflow-33CNJGIN.js} +204 -37
- package/workflow-33CNJGIN.js.map +1 -0
- package/zero.js +30 -30
- package/chunk-3WC7YF42.js.map +0 -1
- package/chunk-NYVNECWO.js.map +0 -1
- package/model-7CWVS6JX.js.map +0 -1
- package/workflow-DR5N3QR7.js.map +0 -1
- /package/{agent-XO6L2N44.js.map → agent-MPDJ76OU.js.map} +0 -0
- /package/{automation-RTPXOLQJ.js.map → automation-A7N2RTDA.js.map} +0 -0
- /package/{banking-ONFKXLJL.js.map → banking-4KF33QY3.js.map} +0 -0
- /package/{chunk-IMJM4MSF.js.map → chunk-73XD3BHA.js.map} +0 -0
- /package/{chunk-VHQZF7HL.js.map → chunk-EXFLDUFG.js.map} +0 -0
- /package/{chunk-WD35BPZI.js.map → chunk-HP73BCIH.js.map} +0 -0
- /package/{chunk-BOPFTESJ.js.map → chunk-OD274GXN.js.map} +0 -0
- /package/{chunk-XZXPLBOS.js.map → chunk-Q4C5Z46X.js.map} +0 -0
- /package/{chunk-C3WSLFCZ.js.map → chunk-TIVKO5OM.js.map} +0 -0
- /package/{chunk-QY544343.js.map → chunk-YXWJZ4II.js.map} +0 -0
- /package/{computer-use-YBL32C2Z.js.map → computer-use-56HKGPIB.js.map} +0 -0
- /package/{connector-VXVCJC7O.js.map → connector-RQWPWJZT.js.map} +0 -0
- /package/{credit-NPXWPS7N.js.map → credit-42T5MAI6.js.map} +0 -0
- /package/{developer-support-RJJ6MU4P.js.map → developer-support-KJLGEXSU.js.map} +0 -0
- /package/{doctor-3DWZ6OK7.js.map → doctor-QCO7CRXG.js.map} +0 -0
- /package/{generate-GVVANLYC.js.map → generate-4AD4KXJ2.js.map} +0 -0
- /package/{github-SWD5WTUP.js.map → github-WOXPPAI4.js.map} +0 -0
- /package/{goal-73BYBVE4.js.map → goal-7FBN733E.js.map} +0 -0
- /package/{host-BK72W6PL.js.map → host-QAQ7JYL3.js.map} +0 -0
- /package/{logs-D2WBV7KO.js.map → logs-AMX77H7X.js.map} +0 -0
- /package/{maps-O4M3KIFK.js.map → maps-V5OLGHKP.js.map} +0 -0
- /package/{model-provider-PMCTLFDQ.js.map → model-provider-JECJM2KF.js.map} +0 -0
- /package/{org-MKNE6LO7.js.map → org-DUSHK6SN.js.map} +0 -0
- /package/{phone-Y6IXQLKK.js.map → phone-EXK7LGHN.js.map} +0 -0
- /package/{preference-RZ7N6KYX.js.map → preference-2L4E3J3D.js.map} +0 -0
- /package/{resource-DAKTXKBE.js.map → resource-UPLKX6QV.js.map} +0 -0
- /package/{search-TODYOUN7.js.map → search-7UH7SXKW.js.map} +0 -0
- /package/{secret-T523D5LM.js.map → secret-AQ7AP3DS.js.map} +0 -0
- /package/{slack-G2TBUALH.js.map → slack-2IN77ZLP.js.map} +0 -0
- /package/{telegram-2RI22G5A.js.map → telegram-DM6EHLCO.js.map} +0 -0
- /package/{variable-MGGFJ2U5.js.map → variable-DHHXDYDR.js.map} +0 -0
- /package/{web-CCVDAUYP.js.map → web-UUM7QCLI.js.map} +0 -0
- /package/{whoami-ZZZUZIL7.js.map → whoami-SDUJGSRT.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __createRequire } from "node:module";
|
|
3
3
|
const require = __createRequire(import.meta.url);
|
|
4
|
-
import "./chunk-
|
|
4
|
+
import "./chunk-IZJCDQVH.js";
|
|
5
5
|
import "./chunk-LTDQISD7.js";
|
|
6
6
|
import {
|
|
7
7
|
downloadWebFile,
|
|
@@ -106,4 +106,4 @@ Examples:
|
|
|
106
106
|
export {
|
|
107
107
|
zeroWebCommand
|
|
108
108
|
};
|
|
109
|
-
//# sourceMappingURL=web-
|
|
109
|
+
//# sourceMappingURL=web-UUM7QCLI.js.map
|
|
@@ -4,15 +4,15 @@ const require = __createRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
loadConnectorPermissionInfos,
|
|
6
6
|
policyIcon
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-73XD3BHA.js";
|
|
8
8
|
import {
|
|
9
9
|
permissionGrantsToFirewallPolicies
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-TIVKO5OM.js";
|
|
11
11
|
import {
|
|
12
12
|
getZeroAgentUserConnectors,
|
|
13
13
|
listZeroConnectors,
|
|
14
14
|
listZeroUserPermissionGrants
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-IZJCDQVH.js";
|
|
16
16
|
import "./chunk-LTDQISD7.js";
|
|
17
17
|
import {
|
|
18
18
|
getActiveOrg,
|
|
@@ -192,4 +192,4 @@ Notes:
|
|
|
192
192
|
export {
|
|
193
193
|
zeroWhoamiCommand
|
|
194
194
|
};
|
|
195
|
-
//# sourceMappingURL=whoami-
|
|
195
|
+
//# sourceMappingURL=whoami-SDUJGSRT.js.map
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
runWorkflow,
|
|
28
28
|
updateWorkflow,
|
|
29
29
|
updateWorkflowTrigger
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-IZJCDQVH.js";
|
|
31
31
|
import "./chunk-LTDQISD7.js";
|
|
32
32
|
import {
|
|
33
33
|
withErrorHandler
|
|
@@ -462,6 +462,12 @@ function formatGmailMatchSummary(config) {
|
|
|
462
462
|
}
|
|
463
463
|
return parts.length > 0 ? parts.join("; ") : "all inbound messages";
|
|
464
464
|
}
|
|
465
|
+
function formatGithubSubject(subject) {
|
|
466
|
+
if (subject === "pull_requests") {
|
|
467
|
+
return "pull requests";
|
|
468
|
+
}
|
|
469
|
+
return subject;
|
|
470
|
+
}
|
|
465
471
|
function formatWorkflowTriggerEntry(trigger) {
|
|
466
472
|
if (trigger.kind === "event" && trigger.eventType === "gmail-new-message") {
|
|
467
473
|
return `Gmail new message: ${formatGmailMatchSummary(trigger.eventConfig)}`;
|
|
@@ -469,6 +475,11 @@ function formatWorkflowTriggerEntry(trigger) {
|
|
|
469
475
|
if (trigger.kind === "event" && trigger.eventType === "gmail-label-applied") {
|
|
470
476
|
return `Gmail label applied: ${quote(trigger.eventConfig.labelName)}`;
|
|
471
477
|
}
|
|
478
|
+
if (trigger.kind === "event" && trigger.eventType === "github-label-applied") {
|
|
479
|
+
return `GitHub label applied: ${quote(trigger.eventConfig.labelName)} (${formatGithubSubject(
|
|
480
|
+
trigger.eventConfig.filters.subject
|
|
481
|
+
)}, actor ${trigger.eventConfig.filters.actor.type})`;
|
|
482
|
+
}
|
|
472
483
|
if (isWebhookTrigger(trigger)) {
|
|
473
484
|
return `Webhook: ${trigger.webhookUrl}`;
|
|
474
485
|
}
|
|
@@ -542,7 +553,7 @@ function printWorkflowTriggerDetails(trigger, options) {
|
|
|
542
553
|
}
|
|
543
554
|
console.log(`${"Status:".padEnd(14)}${status}`);
|
|
544
555
|
console.log(
|
|
545
|
-
`${"Trigger:".padEnd(14)}${trigger.kind === "event" ? trigger.eventType === "gmail-new-message" ? "Gmail new message" : trigger.eventType === "gmail-label-applied" ? "Gmail label applied" : "Webhook" : formatWorkflowTriggerEntry(trigger)}`
|
|
556
|
+
`${"Trigger:".padEnd(14)}${trigger.kind === "event" ? trigger.eventType === "gmail-new-message" ? "Gmail new message" : trigger.eventType === "gmail-label-applied" ? "Gmail label applied" : trigger.eventType === "github-label-applied" ? "GitHub label applied" : "Webhook" : formatWorkflowTriggerEntry(trigger)}`
|
|
546
557
|
);
|
|
547
558
|
if (trigger.kind === "event" && trigger.eventType === "gmail-new-message") {
|
|
548
559
|
console.log(
|
|
@@ -552,6 +563,17 @@ function printWorkflowTriggerDetails(trigger, options) {
|
|
|
552
563
|
if (trigger.kind === "event" && trigger.eventType === "gmail-label-applied") {
|
|
553
564
|
console.log(`${"Label:".padEnd(14)}${trigger.eventConfig.labelName}`);
|
|
554
565
|
}
|
|
566
|
+
if (trigger.kind === "event" && trigger.eventType === "github-label-applied") {
|
|
567
|
+
console.log(`${"Label:".padEnd(14)}${trigger.eventConfig.labelName}`);
|
|
568
|
+
console.log(
|
|
569
|
+
`${"Subject:".padEnd(14)}${formatGithubSubject(
|
|
570
|
+
trigger.eventConfig.filters.subject
|
|
571
|
+
)}`
|
|
572
|
+
);
|
|
573
|
+
console.log(
|
|
574
|
+
`${"Actor:".padEnd(14)}${trigger.eventConfig.filters.actor.type}`
|
|
575
|
+
);
|
|
576
|
+
}
|
|
555
577
|
if (isWebhookTrigger(trigger)) {
|
|
556
578
|
console.log(`${"Webhook URL:".padEnd(14)}${trigger.webhookUrl}`);
|
|
557
579
|
console.log(
|
|
@@ -794,15 +816,16 @@ var SCHEDULE_KINDS = ["cron", "once", "loop"];
|
|
|
794
816
|
var EVENT_KINDS = [
|
|
795
817
|
"gmail-new-message",
|
|
796
818
|
"gmail-label-applied",
|
|
819
|
+
"github-label-applied",
|
|
797
820
|
"webhook"
|
|
798
821
|
];
|
|
799
822
|
var TRIGGER_KINDS = [...SCHEDULE_KINDS, ...EVENT_KINDS];
|
|
800
|
-
var EXACTLY_ONE_FLAG_MESSAGE = "Provide exactly one of --expr (cron), --at (once), --every (loop), Gmail match options, or --
|
|
823
|
+
var EXACTLY_ONE_FLAG_MESSAGE = "Provide exactly one of --expr (cron), --at (once), --every (loop), Gmail match options, --label, --subject, or --actor";
|
|
801
824
|
function addGmailTriggerOptions(command) {
|
|
802
825
|
return command.option(
|
|
803
826
|
"--config <path>",
|
|
804
827
|
"Path to a Gmail new message trigger config JSON"
|
|
805
|
-
).option("--label <name>", "
|
|
828
|
+
).option("--label <name>", "Label name for label-applied triggers").option("--from-contains <text>", "Require the From header to contain text").option(
|
|
806
829
|
"--from-not-contains <text>",
|
|
807
830
|
"Require the From header not to contain text"
|
|
808
831
|
).option(
|
|
@@ -825,6 +848,15 @@ function addGmailTriggerOptions(command) {
|
|
|
825
848
|
"Require the Cc header not to contain text"
|
|
826
849
|
);
|
|
827
850
|
}
|
|
851
|
+
function addGithubTriggerOptions(command) {
|
|
852
|
+
return command.option(
|
|
853
|
+
"--subject <subject>",
|
|
854
|
+
"GitHub subject filter for github-label-applied: both | issues | pull-requests"
|
|
855
|
+
).option(
|
|
856
|
+
"--actor <actor>",
|
|
857
|
+
"GitHub actor filter for github-label-applied: me | anyone"
|
|
858
|
+
);
|
|
859
|
+
}
|
|
828
860
|
function timezoneOrUtc(timezone) {
|
|
829
861
|
return timezone ?? "UTC";
|
|
830
862
|
}
|
|
@@ -964,6 +996,67 @@ function buildSchedule(kind, options) {
|
|
|
964
996
|
function hasScheduleAddOptions(options) {
|
|
965
997
|
return options.expr !== void 0 || options.at !== void 0 || options.every !== void 0 || options.timezone !== void 0;
|
|
966
998
|
}
|
|
999
|
+
function hasGithubTriggerOptions(options) {
|
|
1000
|
+
return options.subject !== void 0 || options.actor !== void 0;
|
|
1001
|
+
}
|
|
1002
|
+
function scheduleUpdateFlagCount(options) {
|
|
1003
|
+
return [options.expr, options.at, options.every].filter((value) => {
|
|
1004
|
+
return value !== void 0;
|
|
1005
|
+
}).length;
|
|
1006
|
+
}
|
|
1007
|
+
function hasScheduleUpdateOptions(options) {
|
|
1008
|
+
return scheduleUpdateFlagCount(options) > 0 || options.timezone !== void 0;
|
|
1009
|
+
}
|
|
1010
|
+
function parseGithubSubject(value, fallback = "both") {
|
|
1011
|
+
if (value === void 0) {
|
|
1012
|
+
return fallback;
|
|
1013
|
+
}
|
|
1014
|
+
switch (value) {
|
|
1015
|
+
case "both":
|
|
1016
|
+
case "issues":
|
|
1017
|
+
return value;
|
|
1018
|
+
case "pull-requests":
|
|
1019
|
+
return "pull_requests";
|
|
1020
|
+
default:
|
|
1021
|
+
throw new Error(
|
|
1022
|
+
`Invalid --subject "${value}". Use one of: both, issues, pull-requests`
|
|
1023
|
+
);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
function parseGithubActor(value, fallback = "me") {
|
|
1027
|
+
if (value === void 0) {
|
|
1028
|
+
return fallback;
|
|
1029
|
+
}
|
|
1030
|
+
if (value === "me" || value === "anyone") {
|
|
1031
|
+
return value;
|
|
1032
|
+
}
|
|
1033
|
+
throw new Error(`Invalid --actor "${value}". Use one of: me, anyone`);
|
|
1034
|
+
}
|
|
1035
|
+
function buildGithubLabelAppliedEventConfig(options, existing) {
|
|
1036
|
+
const labelName = options.label?.trim() ?? existing?.eventConfig.labelName;
|
|
1037
|
+
if (!labelName) {
|
|
1038
|
+
throw new Error(
|
|
1039
|
+
'github-label-applied triggers require --label "Label name"'
|
|
1040
|
+
);
|
|
1041
|
+
}
|
|
1042
|
+
return {
|
|
1043
|
+
provider: "github",
|
|
1044
|
+
event: "label_applied",
|
|
1045
|
+
labelName,
|
|
1046
|
+
filters: {
|
|
1047
|
+
subject: parseGithubSubject(
|
|
1048
|
+
options.subject,
|
|
1049
|
+
existing?.eventConfig.filters.subject ?? "both"
|
|
1050
|
+
),
|
|
1051
|
+
actor: {
|
|
1052
|
+
type: parseGithubActor(
|
|
1053
|
+
options.actor,
|
|
1054
|
+
existing?.eventConfig.filters.actor.type ?? "me"
|
|
1055
|
+
)
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
};
|
|
1059
|
+
}
|
|
967
1060
|
function buildCreateRequest(kind, options) {
|
|
968
1061
|
if (kind === "gmail-new-message") {
|
|
969
1062
|
if (hasScheduleAddOptions(options)) {
|
|
@@ -972,7 +1065,12 @@ function buildCreateRequest(kind, options) {
|
|
|
972
1065
|
);
|
|
973
1066
|
}
|
|
974
1067
|
if (hasGmailLabelOption(options)) {
|
|
975
|
-
throw new Error("--label only applies to
|
|
1068
|
+
throw new Error("--label only applies to label-applied event triggers");
|
|
1069
|
+
}
|
|
1070
|
+
if (hasGithubTriggerOptions(options)) {
|
|
1071
|
+
throw new Error(
|
|
1072
|
+
"GitHub trigger flags only apply to GitHub event triggers"
|
|
1073
|
+
);
|
|
976
1074
|
}
|
|
977
1075
|
return {
|
|
978
1076
|
kind: "event",
|
|
@@ -991,20 +1089,42 @@ function buildCreateRequest(kind, options) {
|
|
|
991
1089
|
"Gmail match flags and --config only apply to gmail-new-message triggers"
|
|
992
1090
|
);
|
|
993
1091
|
}
|
|
1092
|
+
if (hasGithubTriggerOptions(options)) {
|
|
1093
|
+
throw new Error(
|
|
1094
|
+
"GitHub trigger flags only apply to GitHub event triggers"
|
|
1095
|
+
);
|
|
1096
|
+
}
|
|
994
1097
|
return {
|
|
995
1098
|
kind: "event",
|
|
996
1099
|
eventType: "gmail-label-applied",
|
|
997
1100
|
eventConfig: buildGmailLabelAppliedEventConfig(options)
|
|
998
1101
|
};
|
|
999
1102
|
}
|
|
1103
|
+
if (kind === "github-label-applied") {
|
|
1104
|
+
if (hasScheduleAddOptions(options)) {
|
|
1105
|
+
throw new Error(
|
|
1106
|
+
"--expr, --at, --every, and --timezone only apply to schedule triggers"
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
if (hasGmailTriggerOptions(options)) {
|
|
1110
|
+
throw new Error(
|
|
1111
|
+
"Gmail match flags and --config only apply to Gmail event triggers"
|
|
1112
|
+
);
|
|
1113
|
+
}
|
|
1114
|
+
return {
|
|
1115
|
+
kind: "event",
|
|
1116
|
+
eventType: "github-label-applied",
|
|
1117
|
+
eventConfig: buildGithubLabelAppliedEventConfig(options)
|
|
1118
|
+
};
|
|
1119
|
+
}
|
|
1000
1120
|
if (kind === "webhook") {
|
|
1001
1121
|
if (hasScheduleAddOptions(options)) {
|
|
1002
1122
|
throw new Error(
|
|
1003
1123
|
"--expr, --at, --every, and --timezone only apply to schedule triggers"
|
|
1004
1124
|
);
|
|
1005
1125
|
}
|
|
1006
|
-
if (hasGmailTriggerOptions(options) || hasGmailLabelOption(options)) {
|
|
1007
|
-
throw new Error("
|
|
1126
|
+
if (hasGmailTriggerOptions(options) || hasGmailLabelOption(options) || hasGithubTriggerOptions(options)) {
|
|
1127
|
+
throw new Error("Event trigger flags only apply to event triggers");
|
|
1008
1128
|
}
|
|
1009
1129
|
return {
|
|
1010
1130
|
kind: "event",
|
|
@@ -1016,34 +1136,49 @@ function buildCreateRequest(kind, options) {
|
|
|
1016
1136
|
}
|
|
1017
1137
|
};
|
|
1018
1138
|
}
|
|
1019
|
-
if (hasGmailTriggerOptions(options) || hasGmailLabelOption(options)) {
|
|
1020
|
-
throw new Error("
|
|
1139
|
+
if (hasGmailTriggerOptions(options) || hasGmailLabelOption(options) || hasGithubTriggerOptions(options)) {
|
|
1140
|
+
throw new Error("Event trigger flags only apply to event triggers");
|
|
1021
1141
|
}
|
|
1022
1142
|
return { schedule: buildSchedule(kind, options) };
|
|
1023
1143
|
}
|
|
1024
|
-
function
|
|
1025
|
-
const flagCount = [options.expr, options.at, options.every].filter(
|
|
1026
|
-
(value) => {
|
|
1027
|
-
return value !== void 0;
|
|
1028
|
-
}
|
|
1029
|
-
).length;
|
|
1144
|
+
function buildEventUpdate(options, existing) {
|
|
1030
1145
|
const hasGmailOptions = hasGmailTriggerOptions(options);
|
|
1031
1146
|
const hasLabelOption = hasGmailLabelOption(options);
|
|
1032
|
-
|
|
1033
|
-
|
|
1147
|
+
const hasGithubOptions = hasGithubTriggerOptions(options);
|
|
1148
|
+
if (existing.eventType === "github-label-applied") {
|
|
1149
|
+
if (hasGmailOptions) {
|
|
1150
|
+
throw new Error("Gmail match flags only apply to Gmail event triggers");
|
|
1151
|
+
}
|
|
1152
|
+
if (!hasLabelOption && !hasGithubOptions) {
|
|
1153
|
+
throw new Error(
|
|
1154
|
+
"Provide --label, --subject, or --actor for github-label-applied triggers"
|
|
1155
|
+
);
|
|
1156
|
+
}
|
|
1157
|
+
return {
|
|
1158
|
+
eventConfig: buildGithubLabelAppliedEventConfig(options, existing)
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
if (hasGithubOptions) {
|
|
1162
|
+
throw new Error("GitHub trigger flags only apply to GitHub event triggers");
|
|
1034
1163
|
}
|
|
1035
|
-
if (
|
|
1036
|
-
if (
|
|
1037
|
-
throw new Error("Use
|
|
1164
|
+
if (existing.eventType === "gmail-label-applied") {
|
|
1165
|
+
if (!hasLabelOption || hasGmailOptions) {
|
|
1166
|
+
throw new Error("Use --label for gmail-label-applied triggers");
|
|
1038
1167
|
}
|
|
1039
1168
|
return { eventConfig: buildGmailLabelAppliedEventConfig(options) };
|
|
1040
1169
|
}
|
|
1041
|
-
if (hasGmailOptions) {
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1170
|
+
if (!hasGmailOptions || hasLabelOption) {
|
|
1171
|
+
throw new Error("Use Gmail match options for gmail-new-message triggers");
|
|
1172
|
+
}
|
|
1173
|
+
return { eventConfig: buildGmailNewMessageEventConfig(options) };
|
|
1174
|
+
}
|
|
1175
|
+
function buildScheduleUpdate(options) {
|
|
1176
|
+
const hasGmailOptions = hasGmailTriggerOptions(options);
|
|
1177
|
+
const hasLabelOption = hasGmailLabelOption(options);
|
|
1178
|
+
if (hasGmailOptions || hasLabelOption) {
|
|
1179
|
+
throw new Error("Gmail trigger flags only apply to Gmail event triggers");
|
|
1046
1180
|
}
|
|
1181
|
+
const flagCount = scheduleUpdateFlagCount(options);
|
|
1047
1182
|
if (flagCount !== 1) {
|
|
1048
1183
|
throw new Error(EXACTLY_ONE_FLAG_MESSAGE);
|
|
1049
1184
|
}
|
|
@@ -1058,6 +1193,25 @@ function buildUpdate(options) {
|
|
|
1058
1193
|
}
|
|
1059
1194
|
return { schedule: buildSchedule("loop", options) };
|
|
1060
1195
|
}
|
|
1196
|
+
function buildUpdate(options, existing) {
|
|
1197
|
+
const hasEventOptions = hasGmailTriggerOptions(options) || hasGmailLabelOption(options) || hasGithubTriggerOptions(options);
|
|
1198
|
+
if (hasScheduleUpdateOptions(options) && hasEventOptions) {
|
|
1199
|
+
throw new Error("Use either schedule flags or event trigger options");
|
|
1200
|
+
}
|
|
1201
|
+
if (hasGmailTriggerOptions(options) && hasGmailLabelOption(options)) {
|
|
1202
|
+
throw new Error("Use either Gmail match options or --label");
|
|
1203
|
+
}
|
|
1204
|
+
if (existing.kind === "event") {
|
|
1205
|
+
if (hasScheduleUpdateOptions(options)) {
|
|
1206
|
+
throw new Error("Schedule flags only apply to schedule triggers");
|
|
1207
|
+
}
|
|
1208
|
+
return buildEventUpdate(options, existing);
|
|
1209
|
+
}
|
|
1210
|
+
if (hasGithubTriggerOptions(options)) {
|
|
1211
|
+
throw new Error("GitHub trigger flags only apply to GitHub event triggers");
|
|
1212
|
+
}
|
|
1213
|
+
return buildScheduleUpdate(options);
|
|
1214
|
+
}
|
|
1061
1215
|
async function resolveWorkflowId(ref, options) {
|
|
1062
1216
|
if (UUID_RE.test(ref)) {
|
|
1063
1217
|
return ref;
|
|
@@ -1078,13 +1232,15 @@ async function resolveWorkflowId(ref, options) {
|
|
|
1078
1232
|
}
|
|
1079
1233
|
return matches[0].id;
|
|
1080
1234
|
}
|
|
1081
|
-
var addCommand =
|
|
1082
|
-
|
|
1083
|
-
"--
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1235
|
+
var addCommand = addGithubTriggerOptions(
|
|
1236
|
+
addGmailTriggerOptions(
|
|
1237
|
+
new Command().name("add").description("Add a trigger to a workflow").argument("<workflow>", "Workflow ID or name").argument("<kind>", `Trigger type: ${TRIGGER_KINDS.join(" | ")}`).option("--expr <expression>", 'Cron expression for kind "cron"').option("--at <iso-time>", 'Fire time for kind "once"').option(
|
|
1238
|
+
"--every <duration>",
|
|
1239
|
+
'Interval for kind "loop" (e.g. 15m, 1h, 90s)'
|
|
1240
|
+
).option(
|
|
1241
|
+
"-z, --timezone <tz>",
|
|
1242
|
+
"IANA timezone for cron/once (default: UTC)"
|
|
1243
|
+
)
|
|
1088
1244
|
)
|
|
1089
1245
|
).option("--agent <id>", "Agent ID for resolving a workflow name").addHelpText(
|
|
1090
1246
|
"after",
|
|
@@ -1096,11 +1252,13 @@ Examples:
|
|
|
1096
1252
|
zero workflow trigger add triage gmail-new-message --from-contains "@example.com"
|
|
1097
1253
|
zero workflow trigger add triage gmail-new-message --config ./gmail-trigger.json
|
|
1098
1254
|
zero workflow trigger add triage gmail-label-applied --label "Support"
|
|
1255
|
+
zero workflow trigger add triage github-label-applied --label "triage" --subject both --actor me
|
|
1099
1256
|
zero workflow trigger add triage webhook
|
|
1100
1257
|
|
|
1101
1258
|
Notes:
|
|
1102
1259
|
- Workflow names resolve under --agent, then ZERO_AGENT_ID, then all visible workflows
|
|
1103
1260
|
- Gmail triggers match all inbound messages when no text match rules are provided
|
|
1261
|
+
- GitHub label triggers require the GitHub App installation in the workspace
|
|
1104
1262
|
- Webhook triggers print the signing secret only once after creation
|
|
1105
1263
|
- Use the workflow ID when a name is ambiguous`
|
|
1106
1264
|
).action(
|
|
@@ -1119,8 +1277,12 @@ Notes:
|
|
|
1119
1277
|
}
|
|
1120
1278
|
)
|
|
1121
1279
|
);
|
|
1122
|
-
var updateCommand =
|
|
1123
|
-
|
|
1280
|
+
var updateCommand = addGithubTriggerOptions(
|
|
1281
|
+
addGmailTriggerOptions(
|
|
1282
|
+
new Command().name("update").description(
|
|
1283
|
+
"Replace a workflow trigger's schedule or Gmail match config"
|
|
1284
|
+
).argument("<trigger>", "Workflow trigger ID").option("--expr <expression>", 'New cron schedule (e.g. "0 9 * * *")').option("--at <iso-time>", 'New one-time fire (e.g. "2026-06-10T09:00")').option("--every <duration>", "New loop interval (e.g. 15m, 1h, 90s)").option("-z, --timezone <tz>", "IANA timezone for --expr / --at")
|
|
1285
|
+
)
|
|
1124
1286
|
).addHelpText(
|
|
1125
1287
|
"after",
|
|
1126
1288
|
`
|
|
@@ -1130,10 +1292,15 @@ Examples:
|
|
|
1130
1292
|
zero workflow trigger update 22222222-2222-4222-8222-222222222222 --every 10m
|
|
1131
1293
|
zero workflow trigger update 22222222-2222-4222-8222-222222222222 --from-contains "@example.com"
|
|
1132
1294
|
zero workflow trigger update 22222222-2222-4222-8222-222222222222 --config ./gmail-trigger.json
|
|
1133
|
-
zero workflow trigger update 22222222-2222-4222-8222-222222222222 --label "Support"
|
|
1295
|
+
zero workflow trigger update 22222222-2222-4222-8222-222222222222 --label "Support"
|
|
1296
|
+
zero workflow trigger update 22222222-2222-4222-8222-222222222222 --actor anyone`
|
|
1134
1297
|
).action(
|
|
1135
1298
|
withErrorHandler(async (id, options) => {
|
|
1136
|
-
const
|
|
1299
|
+
const existing = await getWorkflowTrigger(id);
|
|
1300
|
+
const trigger = await updateWorkflowTrigger(
|
|
1301
|
+
id,
|
|
1302
|
+
buildUpdate(options, existing)
|
|
1303
|
+
);
|
|
1137
1304
|
console.log(source_default.green(`\u2713 Trigger ${trigger.id} updated`));
|
|
1138
1305
|
printWorkflowTriggerDetails(trigger);
|
|
1139
1306
|
})
|
|
@@ -1215,4 +1382,4 @@ Examples:
|
|
|
1215
1382
|
export {
|
|
1216
1383
|
zeroWorkflowCommand
|
|
1217
1384
|
};
|
|
1218
|
-
//# sourceMappingURL=workflow-
|
|
1385
|
+
//# sourceMappingURL=workflow-33CNJGIN.js.map
|