@seasb/metafab 2.0.0 → 2.1.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/README.md +6 -0
- package/dist/cli.js +31 -3
- package/dist/cli.js.map +1 -1
- package/dist/commands/automations-list.d.ts +2 -0
- package/dist/commands/automations-list.js +81 -0
- package/dist/commands/automations-list.js.map +1 -0
- package/dist/commands/automations-plan.d.ts +2 -0
- package/dist/commands/automations-plan.js +146 -0
- package/dist/commands/automations-plan.js.map +1 -0
- package/dist/commands/automations-prompt.d.ts +2 -0
- package/dist/commands/automations-prompt.js +123 -0
- package/dist/commands/automations-prompt.js.map +1 -0
- package/dist/commands/automations-stub.d.ts +2 -0
- package/dist/commands/automations-stub.js +125 -0
- package/dist/commands/automations-stub.js.map +1 -0
- package/dist/commands/automations-sync.d.ts +2 -0
- package/dist/commands/automations-sync.js +104 -0
- package/dist/commands/automations-sync.js.map +1 -0
- package/dist/commands/create.js +18 -10
- package/dist/commands/create.js.map +1 -1
- package/dist/core/adopt.d.ts +4 -3
- package/dist/core/adopt.js +17 -10
- package/dist/core/adopt.js.map +1 -1
- package/dist/core/automations/account.d.ts +7 -0
- package/dist/core/automations/account.js +27 -0
- package/dist/core/automations/account.js.map +1 -0
- package/dist/core/automations/amp-schedule.d.ts +50 -0
- package/dist/core/automations/amp-schedule.js +272 -0
- package/dist/core/automations/amp-schedule.js.map +1 -0
- package/dist/core/automations/cron.d.ts +15 -0
- package/dist/core/automations/cron.js +75 -0
- package/dist/core/automations/cron.js.map +1 -0
- package/dist/core/automations/desired.d.ts +28 -0
- package/dist/core/automations/desired.js +95 -0
- package/dist/core/automations/desired.js.map +1 -0
- package/dist/core/automations/index.d.ts +10 -0
- package/dist/core/automations/index.js +11 -0
- package/dist/core/automations/index.js.map +1 -0
- package/dist/core/automations/load.d.ts +9 -0
- package/dist/core/automations/load.js +141 -0
- package/dist/core/automations/load.js.map +1 -0
- package/dist/core/automations/orca.d.ts +126 -0
- package/dist/core/automations/orca.js +513 -0
- package/dist/core/automations/orca.js.map +1 -0
- package/dist/core/automations/problems.d.ts +32 -0
- package/dist/core/automations/problems.js +110 -0
- package/dist/core/automations/problems.js.map +1 -0
- package/dist/core/automations/prompt.d.ts +38 -0
- package/dist/core/automations/prompt.js +211 -0
- package/dist/core/automations/prompt.js.map +1 -0
- package/dist/core/automations/stub.d.ts +40 -0
- package/dist/core/automations/stub.js +96 -0
- package/dist/core/automations/stub.js.map +1 -0
- package/dist/core/automations/types.d.ts +53 -0
- package/dist/core/automations/types.js +3 -0
- package/dist/core/automations/types.js.map +1 -0
- package/dist/core/automations/validate.d.ts +45 -0
- package/dist/core/automations/validate.js +594 -0
- package/dist/core/automations/validate.js.map +1 -0
- package/dist/core/build/agents.d.ts +16 -3
- package/dist/core/build/agents.js +125 -5
- package/dist/core/build/agents.js.map +1 -1
- package/dist/core/build/plan.js +51 -28
- package/dist/core/build/plan.js.map +1 -1
- package/dist/core/check/drift.js +5 -5
- package/dist/core/check/drift.js.map +1 -1
- package/dist/core/config/parse.js +7 -0
- package/dist/core/config/parse.js.map +1 -1
- package/dist/core/config/types.d.ts +5 -0
- package/dist/core/config/validate.d.ts +2 -1
- package/dist/core/config/validate.js +40 -1
- package/dist/core/config/validate.js.map +1 -1
- package/dist/core/edit/create.d.ts +14 -6
- package/dist/core/edit/create.js +124 -34
- package/dist/core/edit/create.js.map +1 -1
- package/dist/core/edit/map.js +3 -3
- package/dist/core/edit/map.js.map +1 -1
- package/dist/core/edit/pipeline.js +13 -9
- package/dist/core/edit/pipeline.js.map +1 -1
- package/dist/core/edit/skill.d.ts +5 -0
- package/dist/core/edit/skill.js +9 -0
- package/dist/core/edit/skill.js.map +1 -1
- package/dist/core/env/declarations.d.ts +2 -1
- package/dist/core/env/declarations.js +4 -3
- package/dist/core/env/declarations.js.map +1 -1
- package/dist/core/env/render.d.ts +12 -0
- package/dist/core/env/render.js +51 -0
- package/dist/core/env/render.js.map +1 -1
- package/dist/core/env/validate.js +76 -5
- package/dist/core/env/validate.js.map +1 -1
- package/dist/core/factory/discovery.d.ts +12 -2
- package/dist/core/factory/discovery.js +119 -2
- package/dist/core/factory/discovery.js.map +1 -1
- package/dist/core/factory/factory-yaml.d.ts +2 -1
- package/dist/core/factory/factory-yaml.js +4 -3
- package/dist/core/factory/factory-yaml.js.map +1 -1
- package/dist/core/factory/format.d.ts +26 -0
- package/dist/core/factory/format.js +34 -0
- package/dist/core/factory/format.js.map +1 -0
- package/dist/core/factory/load.d.ts +2 -2
- package/dist/core/factory/load.js +129 -16
- package/dist/core/factory/load.js.map +1 -1
- package/dist/core/factory/types.d.ts +24 -1
- package/dist/core/factory/validate.d.ts +31 -5
- package/dist/core/factory/validate.js +154 -22
- package/dist/core/factory/validate.js.map +1 -1
- package/dist/core/hooks/script.d.ts +22 -0
- package/dist/core/hooks/script.js +17 -3
- package/dist/core/hooks/script.js.map +1 -1
- package/dist/core/import/run.js +6 -2
- package/dist/core/import/run.js.map +1 -1
- package/dist/core/publish/package-json.d.ts +2 -1
- package/dist/core/publish/package-json.js.map +1 -1
- package/dist/core/publish/readme.js +13 -3
- package/dist/core/publish/readme.js.map +1 -1
- package/dist/core/publish/stage.js +18 -3
- package/dist/core/publish/stage.js.map +1 -1
- package/dist/core/sources/npm.js +3 -2
- package/dist/core/sources/npm.js.map +1 -1
- package/dist/core/sources/types.d.ts +2 -1
- package/dist/core/sources/validate.js +3 -2
- package/dist/core/sources/validate.js.map +1 -1
- package/dist/core/summary.js +49 -13
- package/dist/core/summary.js.map +1 -1
- package/package.json +2 -2
- package/resources/metafab-automations-skill/SKILL.md +53 -0
- package/resources/metafab-skill/SKILL.md +13 -6
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { ExitCode, MetafabError } from "../../errors.js";
|
|
2
|
+
import { validTimeZone } from "./cron.js";
|
|
3
|
+
/** Amp's day codes, indexed by a cron day number mod 7: 0 is Sunday. */
|
|
4
|
+
const DAY_CODES = ["SU", "MO", "TU", "WE", "TH", "FR", "SA"];
|
|
5
|
+
/** Every day code, in the order an `RRULE` and a label list them. */
|
|
6
|
+
const DAY_ORDER = ["MO", "TU", "WE", "TH", "FR", "SA", "SU"];
|
|
7
|
+
const DAY_NAMES = {
|
|
8
|
+
MO: "Mondays",
|
|
9
|
+
TU: "Tuesdays",
|
|
10
|
+
WE: "Wednesdays",
|
|
11
|
+
TH: "Thursdays",
|
|
12
|
+
FR: "Fridays",
|
|
13
|
+
SA: "Saturdays",
|
|
14
|
+
SU: "Sundays",
|
|
15
|
+
};
|
|
16
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
17
|
+
function clock(tz) {
|
|
18
|
+
return new Intl.DateTimeFormat("en-US", {
|
|
19
|
+
timeZone: tz,
|
|
20
|
+
hourCycle: "h23",
|
|
21
|
+
year: "numeric",
|
|
22
|
+
month: "2-digit",
|
|
23
|
+
day: "2-digit",
|
|
24
|
+
hour: "2-digit",
|
|
25
|
+
minute: "2-digit",
|
|
26
|
+
second: "2-digit",
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function part(parts, type) {
|
|
30
|
+
return Number(parts.find((candidate) => candidate.type === type)?.value ?? "0");
|
|
31
|
+
}
|
|
32
|
+
/** What the zone's clock reads at `instant`. */
|
|
33
|
+
function wallClockAt(instant, format) {
|
|
34
|
+
const parts = format.formatToParts(new Date(instant));
|
|
35
|
+
return {
|
|
36
|
+
year: part(parts, "year"),
|
|
37
|
+
month: part(parts, "month"),
|
|
38
|
+
day: part(parts, "day"),
|
|
39
|
+
hour: part(parts, "hour"),
|
|
40
|
+
minute: part(parts, "minute"),
|
|
41
|
+
second: part(parts, "second"),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function sameWallClock(left, right) {
|
|
45
|
+
return (left.year === right.year &&
|
|
46
|
+
left.month === right.month &&
|
|
47
|
+
left.day === right.day &&
|
|
48
|
+
left.hour === right.hour &&
|
|
49
|
+
left.minute === right.minute);
|
|
50
|
+
}
|
|
51
|
+
/** The zone's offset from UTC at `instant`, in milliseconds. */
|
|
52
|
+
function offsetAt(instant, format) {
|
|
53
|
+
const at = Math.floor(instant / 1000) * 1000;
|
|
54
|
+
const wall = wallClockAt(at, format);
|
|
55
|
+
return (Date.UTC(wall.year, wall.month - 1, wall.day, wall.hour, wall.minute, wall.second) - at);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The earliest instant whose zone clock reads `wall`, or undefined when the
|
|
59
|
+
* zone skips that wall clock. It is the reading RFC 5545 gives a `TZID` time
|
|
60
|
+
* that a fall-back change repeats: the first occurrence.
|
|
61
|
+
*
|
|
62
|
+
* It tries the zone's offsets a day before and a day after the time, keeps
|
|
63
|
+
* those that read back exactly, and returns the smallest.
|
|
64
|
+
*/
|
|
65
|
+
export function firstInstant(wall, tz) {
|
|
66
|
+
const format = clock(tz);
|
|
67
|
+
const base = Date.UTC(wall.year, wall.month - 1, wall.day, wall.hour, wall.minute, 0);
|
|
68
|
+
const offsets = new Set();
|
|
69
|
+
for (const delta of [-DAY_MS, DAY_MS])
|
|
70
|
+
offsets.add(offsetAt(base + delta, format));
|
|
71
|
+
let earliest;
|
|
72
|
+
for (const offset of offsets) {
|
|
73
|
+
const instant = base - offset;
|
|
74
|
+
if (!sameWallClock(wallClockAt(instant, format), wall))
|
|
75
|
+
continue;
|
|
76
|
+
if (earliest === undefined || instant < earliest)
|
|
77
|
+
earliest = instant;
|
|
78
|
+
}
|
|
79
|
+
return earliest;
|
|
80
|
+
}
|
|
81
|
+
/** One number or a comma list of numbers inside the field's range, deduplicated and sorted. */
|
|
82
|
+
function plainNumbers(text, field, min, max) {
|
|
83
|
+
const values = new Set();
|
|
84
|
+
for (const part of text.split(",")) {
|
|
85
|
+
if (!/^\d+$/.test(part)) {
|
|
86
|
+
return { reason: `its ${field} "${text}" is not a single number or a comma list of numbers` };
|
|
87
|
+
}
|
|
88
|
+
const value = Number(part);
|
|
89
|
+
if (value < min || value > max) {
|
|
90
|
+
return { reason: `its ${field} "${text}" has ${value}, which is outside ${min}-${max}` };
|
|
91
|
+
}
|
|
92
|
+
values.add(value);
|
|
93
|
+
}
|
|
94
|
+
return { value: [...values].sort((left, right) => left - right) };
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The day codes a cron day-of-week field names, in `MO TU WE TH FR SA SU`
|
|
98
|
+
* order: `*` is every day, and a part is a day or a range of days.
|
|
99
|
+
*/
|
|
100
|
+
function dayCodes(text) {
|
|
101
|
+
if (text === "*")
|
|
102
|
+
return { value: [...DAY_ORDER] };
|
|
103
|
+
const days = new Set();
|
|
104
|
+
for (const part of text.split(",")) {
|
|
105
|
+
const range = /^(\d+)-(\d+)$/.exec(part);
|
|
106
|
+
if (range !== null) {
|
|
107
|
+
const start = Number(range[1]);
|
|
108
|
+
const end = Number(range[2]);
|
|
109
|
+
if (start > 7 || end > 7) {
|
|
110
|
+
return {
|
|
111
|
+
reason: `its day of week "${text}" has a day outside 0-7, where 0 and 7 are both Sunday`,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
if (start > end) {
|
|
115
|
+
return {
|
|
116
|
+
reason: `its day of week "${text}" has the range "${part}", which starts after it ends`,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
for (let day = start; day <= end; day += 1)
|
|
120
|
+
days.add(day % 7);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (!/^\d+$/.test(part)) {
|
|
124
|
+
return {
|
|
125
|
+
reason: `its day of week "${text}" has "${part}", which is not a day or a range of days`,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const day = Number(part);
|
|
129
|
+
if (day > 7) {
|
|
130
|
+
return {
|
|
131
|
+
reason: `its day of week "${text}" has a day outside 0-7, where 0 and 7 are both Sunday`,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
days.add(day % 7);
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
value: DAY_ORDER.filter((code) => days.has(DAY_CODES.indexOf(code))),
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function joinList(items) {
|
|
141
|
+
if (items.length <= 1)
|
|
142
|
+
return items[0] ?? "";
|
|
143
|
+
if (items.length === 2)
|
|
144
|
+
return `${items[0]} and ${items[1]}`;
|
|
145
|
+
return `${items.slice(0, -1).join(", ")} and ${items[items.length - 1]}`;
|
|
146
|
+
}
|
|
147
|
+
function timeOf(hour, minute) {
|
|
148
|
+
const suffix = hour < 12 ? "AM" : "PM";
|
|
149
|
+
const twelve = hour % 12 === 0 ? 12 : hour % 12;
|
|
150
|
+
return `${twelve}:${String(minute).padStart(2, "0")} ${suffix}`;
|
|
151
|
+
}
|
|
152
|
+
function daysOf(codes) {
|
|
153
|
+
if (codes.length === DAY_ORDER.length)
|
|
154
|
+
return "Every day";
|
|
155
|
+
const set = new Set(codes);
|
|
156
|
+
if (codes.length === 5 && ["MO", "TU", "WE", "TH", "FR"].every((code) => set.has(code))) {
|
|
157
|
+
return "Weekdays";
|
|
158
|
+
}
|
|
159
|
+
if (codes.length === 2 && set.has("SA") && set.has("SU"))
|
|
160
|
+
return "Weekends";
|
|
161
|
+
return joinList(codes.map((code) => DAY_NAMES[code]));
|
|
162
|
+
}
|
|
163
|
+
function labelOf(codes, hours, minutes, tz) {
|
|
164
|
+
const times = [];
|
|
165
|
+
for (const hour of hours)
|
|
166
|
+
for (const minute of minutes)
|
|
167
|
+
times.push(timeOf(hour, minute));
|
|
168
|
+
return `${daysOf(codes)}, ${joinList(times)} ${tz}`;
|
|
169
|
+
}
|
|
170
|
+
function pad(value, width) {
|
|
171
|
+
return String(value).padStart(width, "0");
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* The schedule Amp holds for one cron in one zone, or the reason it cannot
|
|
175
|
+
* express it. `now` decides which firing `DTSTART` names: the first one at or
|
|
176
|
+
* after now, looking 15 days ahead so a weekly time that a spring-forward
|
|
177
|
+
* change skips fires a week later.
|
|
178
|
+
*/
|
|
179
|
+
export function ampSchedule(cron, tz, now) {
|
|
180
|
+
const fields = cron.trim().split(/\s+/);
|
|
181
|
+
if (fields.length !== 5)
|
|
182
|
+
return { reason: "it is not five cron fields" };
|
|
183
|
+
const [minuteText, hourText, dayOfMonth, month, dayOfWeek] = fields;
|
|
184
|
+
const minutes = plainNumbers(minuteText, "minute", 0, 59);
|
|
185
|
+
if ("reason" in minutes)
|
|
186
|
+
return minutes;
|
|
187
|
+
const hours = plainNumbers(hourText, "hour", 0, 23);
|
|
188
|
+
if ("reason" in hours)
|
|
189
|
+
return hours;
|
|
190
|
+
if (dayOfMonth !== "*") {
|
|
191
|
+
return {
|
|
192
|
+
reason: `its day of month "${dayOfMonth}" must be *, because an Amp schedule repeats by day of the week, not by date`,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
if (month !== "*") {
|
|
196
|
+
return { reason: `its month "${month}" must be *, because an Amp schedule repeats all year` };
|
|
197
|
+
}
|
|
198
|
+
const codes = dayCodes(dayOfWeek);
|
|
199
|
+
if ("reason" in codes)
|
|
200
|
+
return codes;
|
|
201
|
+
const rule = codes.value.length === DAY_ORDER.length
|
|
202
|
+
? `FREQ=DAILY;BYHOUR=${hours.value.join(",")};BYMINUTE=${minutes.value.join(",")}`
|
|
203
|
+
: `FREQ=WEEKLY;BYDAY=${codes.value.join(",")};BYHOUR=${hours.value.join(",")};BYMINUTE=${minutes.value.join(",")}`;
|
|
204
|
+
if (!validTimeZone(tz))
|
|
205
|
+
return { reason: `"${tz}" is not an IANA time zone` };
|
|
206
|
+
const format = clock(tz);
|
|
207
|
+
const today = wallClockAt(now.getTime(), format);
|
|
208
|
+
const allowed = new Set(codes.value.map((code) => DAY_CODES.indexOf(code)));
|
|
209
|
+
for (let ahead = 0; ahead <= 14; ahead += 1) {
|
|
210
|
+
const date = new Date(Date.UTC(today.year, today.month - 1, today.day + ahead));
|
|
211
|
+
if (!allowed.has(date.getUTCDay()))
|
|
212
|
+
continue;
|
|
213
|
+
for (const hour of hours.value) {
|
|
214
|
+
for (const minute of minutes.value) {
|
|
215
|
+
const wall = {
|
|
216
|
+
year: date.getUTCFullYear(),
|
|
217
|
+
month: date.getUTCMonth() + 1,
|
|
218
|
+
day: date.getUTCDate(),
|
|
219
|
+
hour,
|
|
220
|
+
minute,
|
|
221
|
+
};
|
|
222
|
+
const instant = firstInstant(wall, tz);
|
|
223
|
+
if (instant === undefined || instant < now.getTime())
|
|
224
|
+
continue;
|
|
225
|
+
const stamp = `${pad(wall.year, 4)}${pad(wall.month, 2)}${pad(wall.day, 2)}T${pad(hour, 2)}${pad(minute, 2)}00`;
|
|
226
|
+
return {
|
|
227
|
+
schedule: `DTSTART;TZID=${tz}:${stamp}\nRRULE:${rule}`,
|
|
228
|
+
label: labelOf(codes.value, hours.value, minutes.value, tz),
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return { reason: "no allowed day, hour and minute falls in the fortnight after now" };
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* The set `plan amp` prints, one entry per desired automation in name order.
|
|
237
|
+
* One automation Amp cannot express refuses the whole set, naming each one and
|
|
238
|
+
* its reason.
|
|
239
|
+
*/
|
|
240
|
+
export function planAmp(desired, now) {
|
|
241
|
+
const entries = [];
|
|
242
|
+
const problems = [];
|
|
243
|
+
for (const entry of desired) {
|
|
244
|
+
const schedule = ampSchedule(entry.cron, entry.tz, now);
|
|
245
|
+
if ("reason" in schedule) {
|
|
246
|
+
problems.push({
|
|
247
|
+
level: "error",
|
|
248
|
+
file: `.factory/automations/${entry.name}/automation.md`,
|
|
249
|
+
message: `${entry.name} cannot be expressed in Amp: ${schedule.reason}`,
|
|
250
|
+
fix: "Use plain hours and minutes, * for day of month and month, and days or ranges of days for day of week",
|
|
251
|
+
});
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
entries.push({
|
|
255
|
+
name: entry.name,
|
|
256
|
+
title: entry.title,
|
|
257
|
+
schedule: schedule.schedule,
|
|
258
|
+
schedule_label: schedule.label,
|
|
259
|
+
run_mode: "fresh",
|
|
260
|
+
prompt: entry.stub.trimEnd(),
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
if (problems.length > 0) {
|
|
264
|
+
throw new MetafabError("The automations cannot be expressed in Amp", {
|
|
265
|
+
exitCode: ExitCode.Failed,
|
|
266
|
+
code: "amp-schedule",
|
|
267
|
+
problems,
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
return entries;
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=amp-schedule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amp-schedule.js","sourceRoot":"","sources":["../../../src/core/automations/amp-schedule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AA+B1C,wEAAwE;AACxE,MAAM,SAAS,GAAsB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAEhF,qEAAqE;AACrE,MAAM,SAAS,GAAsB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAEhF,MAAM,SAAS,GAA2B;IACxC,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,UAAU;IACd,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,SAAS;CACd,CAAC;AAEF,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAInC,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;QACtC,QAA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AAC,CAAC;IACL,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,YAAY,CAAC,4CAA4C,EAAE;YACnE,QAAQ,EAAE,QAAQ,CAAC,MAAM;YACzB,IAAI,EAAE,cAAc;YACpB,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** One field of a five-field cron, with the range the spec gives it. */
|
|
2
|
+
export interface CronField {
|
|
3
|
+
name: string;
|
|
4
|
+
min: number;
|
|
5
|
+
max: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const CRON_FIELDS: readonly CronField[];
|
|
8
|
+
/**
|
|
9
|
+
* The spec's cron grammar: five whitespace-separated fields, each a list of
|
|
10
|
+
* `*`, a number or a range, each optionally followed by `/<positive step>`.
|
|
11
|
+
* Returns the problem, or undefined when the cron is valid.
|
|
12
|
+
*/
|
|
13
|
+
export declare function cronProblem(cron: string): string | undefined;
|
|
14
|
+
/** True when `Intl.DateTimeFormat` accepts `tz` as a time zone. */
|
|
15
|
+
export declare function validTimeZone(tz: string): boolean;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export const CRON_FIELDS = [
|
|
2
|
+
{ name: "minute", min: 0, max: 59 },
|
|
3
|
+
{ name: "hour", min: 0, max: 23 },
|
|
4
|
+
{ name: "day of month", min: 1, max: 31 },
|
|
5
|
+
{ name: "month", min: 1, max: 12 },
|
|
6
|
+
{ name: "day of week", min: 0, max: 7 },
|
|
7
|
+
];
|
|
8
|
+
const NUMBER = /^\d+$/;
|
|
9
|
+
const RANGE = /^(\d+)-(\d+)$/;
|
|
10
|
+
function outside(value, field) {
|
|
11
|
+
return `${value} is outside ${field.min}-${field.max}`;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Why one comma-separated part of a cron field is invalid, in the order the
|
|
15
|
+
* spec lists: the step, then the shape of the part, then its numbers.
|
|
16
|
+
*/
|
|
17
|
+
function partProblem(part, field) {
|
|
18
|
+
const pieces = part.split("/");
|
|
19
|
+
if (pieces.length > 2)
|
|
20
|
+
return "more than one /step";
|
|
21
|
+
const base = pieces[0];
|
|
22
|
+
const step = pieces[1];
|
|
23
|
+
if (step !== undefined && (!NUMBER.test(step) || Number(step) <= 0)) {
|
|
24
|
+
return "the step is not a positive integer";
|
|
25
|
+
}
|
|
26
|
+
if (base === "*")
|
|
27
|
+
return undefined;
|
|
28
|
+
const range = RANGE.exec(base);
|
|
29
|
+
if (NUMBER.test(base)) {
|
|
30
|
+
const value = Number(base);
|
|
31
|
+
return value < field.min || value > field.max ? outside(value, field) : undefined;
|
|
32
|
+
}
|
|
33
|
+
if (range === null)
|
|
34
|
+
return "it is not *, a number or a range";
|
|
35
|
+
const start = Number(range[1]);
|
|
36
|
+
const end = Number(range[2]);
|
|
37
|
+
if (start < field.min || start > field.max)
|
|
38
|
+
return outside(start, field);
|
|
39
|
+
if (end < field.min || end > field.max)
|
|
40
|
+
return outside(end, field);
|
|
41
|
+
if (start > end)
|
|
42
|
+
return "the range starts after it ends";
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The spec's cron grammar: five whitespace-separated fields, each a list of
|
|
47
|
+
* `*`, a number or a range, each optionally followed by `/<positive step>`.
|
|
48
|
+
* Returns the problem, or undefined when the cron is valid.
|
|
49
|
+
*/
|
|
50
|
+
export function cronProblem(cron) {
|
|
51
|
+
const trimmed = cron.trim();
|
|
52
|
+
const fields = trimmed.split(/\s+/);
|
|
53
|
+
if (fields.length !== 5)
|
|
54
|
+
return `the cron "${trimmed}" is not five fields`;
|
|
55
|
+
for (const [index, field] of CRON_FIELDS.entries()) {
|
|
56
|
+
for (const part of fields[index].split(",")) {
|
|
57
|
+
const problem = partProblem(part, field);
|
|
58
|
+
if (problem !== undefined) {
|
|
59
|
+
return `the cron "${trimmed}" has a bad ${field.name} part "${part}": ${problem}`;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
/** True when `Intl.DateTimeFormat` accepts `tz` as a time zone. */
|
|
66
|
+
export function validTimeZone(tz) {
|
|
67
|
+
try {
|
|
68
|
+
new Intl.DateTimeFormat("en-US", { timeZone: tz });
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=cron.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cron.js","sourceRoot":"","sources":["../../../src/core/automations/cron.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,WAAW,GAAyB;IAC/C,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;IACnC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;IACjC,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;IACzC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;IAClC,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE;CACxC,CAAC;AAEF,MAAM,MAAM,GAAG,OAAO,CAAC;AACvB,MAAM,KAAK,GAAG,eAAe,CAAC;AAE9B,SAAS,OAAO,CAAC,KAAa,EAAE,KAAgB;IAC9C,OAAO,GAAG,KAAK,eAAe,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC;AACzD,CAAC;AAED;;;GAGG;AACH,SAAS,WAAW,CAAC,IAAY,EAAE,KAAgB;IACjD,MAAM,MAAM,GAAG,IAAI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OAAO,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACnE,IAAI,KAAK,GAAG,GAAG;QAAE,OAAO,gCAAgC,CAAC;IACzD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACpC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,aAAa,OAAO,sBAAsB,CAAC;IAE3E,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;QACnD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,CAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7C,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACzC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC1B,OAAO,aAAa,OAAO,eAAe,KAAK,CAAC,IAAI,UAAU,IAAI,MAAM,OAAO,EAAE,CAAC;YACpF,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,aAAa,CAAC,EAAU;IACtC,IAAI,CAAC;QACH,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Factory } from "../factory/types.js";
|
|
2
|
+
import type { Target } from "./types.js";
|
|
3
|
+
/** One automation a target's sync registers. */
|
|
4
|
+
export interface DesiredEntry {
|
|
5
|
+
name: string;
|
|
6
|
+
title: string;
|
|
7
|
+
cron: string;
|
|
8
|
+
tz: string;
|
|
9
|
+
checkout: "worktree" | "main";
|
|
10
|
+
/** The text the target registers, from `renderStub`. */
|
|
11
|
+
stub: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The set a target's sync makes the target match: one entry per enabled
|
|
15
|
+
* automation with a schedule trigger, owned by `account` or `"*"`, in name
|
|
16
|
+
* order. Any automation error, including one in a file its prompt depends on,
|
|
17
|
+
* stops it before the target is touched.
|
|
18
|
+
*/
|
|
19
|
+
export declare function desiredSet(factory: Factory, target: Target, account: string, trunk: string): Promise<DesiredEntry[]>;
|
|
20
|
+
/**
|
|
21
|
+
* The automation name a registration is managed for, or undefined when it is
|
|
22
|
+
* not this factory's: its name must be `automation: <name>`, and the prompt's
|
|
23
|
+
* first line must be the marker for that name and factory.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isManaged(entry: {
|
|
26
|
+
name: string;
|
|
27
|
+
prompt: string;
|
|
28
|
+
}, factoryName: string): string | undefined;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { ExitCode, MetafabError } from "../../errors.js";
|
|
2
|
+
import { toLF } from "../../util/text.js";
|
|
3
|
+
import { cliVersion } from "../../util/version.js";
|
|
4
|
+
import { supportsFeature } from "../factory/format.js";
|
|
5
|
+
import { automationErrors } from "./problems.js";
|
|
6
|
+
import { promptProblems } from "./prompt.js";
|
|
7
|
+
import { relativeFactoryDir, renderStub, stubMarker } from "./stub.js";
|
|
8
|
+
/** The title every registration sync owns starts with. */
|
|
9
|
+
const TITLE_PREFIX = "automation: ";
|
|
10
|
+
function scheduleOf(automation) {
|
|
11
|
+
for (const trigger of automation.triggers) {
|
|
12
|
+
if (trigger.kind === "schedule")
|
|
13
|
+
return trigger;
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Every problem that stops a sync: the errors in `.factory/automations/`, plus
|
|
19
|
+
* the dependency errors that stop a prompt for an automation, such as an error
|
|
20
|
+
* in `run.md` or in a partial either of them imports. A file that several
|
|
21
|
+
* automations depend on reports each of its problems once.
|
|
22
|
+
*/
|
|
23
|
+
async function syncProblems(factory) {
|
|
24
|
+
const problems = automationErrors(factory);
|
|
25
|
+
for (const automation of factory.automations?.list ?? []) {
|
|
26
|
+
problems.push(...(await promptProblems(automation.name, factory)));
|
|
27
|
+
}
|
|
28
|
+
const seen = new Set();
|
|
29
|
+
return problems.filter((problem) => {
|
|
30
|
+
const key = `${problem.file}\u0000${problem.line ?? 0}\u0000${problem.message}`;
|
|
31
|
+
if (seen.has(key))
|
|
32
|
+
return false;
|
|
33
|
+
seen.add(key);
|
|
34
|
+
return true;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The set a target's sync makes the target match: one entry per enabled
|
|
39
|
+
* automation with a schedule trigger, owned by `account` or `"*"`, in name
|
|
40
|
+
* order. Any automation error, including one in a file its prompt depends on,
|
|
41
|
+
* stops it before the target is touched.
|
|
42
|
+
*/
|
|
43
|
+
export async function desiredSet(factory, target, account, trunk) {
|
|
44
|
+
const problems = await syncProblems(factory);
|
|
45
|
+
if (problems.length > 0) {
|
|
46
|
+
throw new MetafabError("The automations have errors", {
|
|
47
|
+
exitCode: ExitCode.Failed,
|
|
48
|
+
code: "automation-errors",
|
|
49
|
+
problems,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const yaml = factory.factoryYaml;
|
|
53
|
+
if (yaml === undefined || !supportsFeature(yaml.format, "automations"))
|
|
54
|
+
return [];
|
|
55
|
+
const wanted = (factory.automations?.list ?? []).filter((automation) => automation.enabled &&
|
|
56
|
+
scheduleOf(automation) !== undefined &&
|
|
57
|
+
(automation.owner === "*" || automation.owner.toLowerCase() === account.toLowerCase()));
|
|
58
|
+
if (wanted.length === 0)
|
|
59
|
+
return [];
|
|
60
|
+
const factoryRelDir = await relativeFactoryDir(factory.root);
|
|
61
|
+
const version = cliVersion();
|
|
62
|
+
return wanted.map((automation) => {
|
|
63
|
+
const schedule = scheduleOf(automation);
|
|
64
|
+
return {
|
|
65
|
+
name: automation.name,
|
|
66
|
+
title: `${TITLE_PREFIX}${automation.name}`,
|
|
67
|
+
cron: schedule.cron,
|
|
68
|
+
tz: schedule.tz,
|
|
69
|
+
checkout: automation.checkout,
|
|
70
|
+
stub: renderStub({
|
|
71
|
+
factoryName: yaml.name,
|
|
72
|
+
automation,
|
|
73
|
+
target,
|
|
74
|
+
trunk,
|
|
75
|
+
factoryRelDir,
|
|
76
|
+
cliVersion: version,
|
|
77
|
+
}),
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The automation name a registration is managed for, or undefined when it is
|
|
83
|
+
* not this factory's: its name must be `automation: <name>`, and the prompt's
|
|
84
|
+
* first line must be the marker for that name and factory.
|
|
85
|
+
*/
|
|
86
|
+
export function isManaged(entry, factoryName) {
|
|
87
|
+
if (!entry.name.startsWith(TITLE_PREFIX))
|
|
88
|
+
return undefined;
|
|
89
|
+
const name = entry.name.slice(TITLE_PREFIX.length);
|
|
90
|
+
if (name === "")
|
|
91
|
+
return undefined;
|
|
92
|
+
const firstLine = toLF(entry.prompt).split("\n")[0] ?? "";
|
|
93
|
+
return firstLine === stubMarker(name, factoryName) ? name : undefined;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=desired.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"desired.js","sourceRoot":"","sources":["../../../src/core/automations/desired.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MA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,CAAC,IAAI;YACnB,EAAE,EAAE,QAAQ,CAAC,EAAE;YACf,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,IAAI,EAAE,UAAU,CAAC;gBACf,WAAW,EAAE,IAAI,CAAC,IAAI;gBACtB,UAAU;gBACV,MAAM;gBACN,KAAK;gBACL,aAAa;gBACb,UAAU,EAAE,OAAO;aACpB,CAAC;SACH,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CACvB,KAAuC,EACvC,WAAmB;IAEnB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;QAAE,OAAO,SAAS,CAAC;IAC3D,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACnD,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAClC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1D,OAAO,SAAS,KAAK,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./cron.js";
|
|
3
|
+
export * from "./load.js";
|
|
4
|
+
export * from "./validate.js";
|
|
5
|
+
export * from "./account.js";
|
|
6
|
+
export * from "./prompt.js";
|
|
7
|
+
export * from "./stub.js";
|
|
8
|
+
export * from "./desired.js";
|
|
9
|
+
export * from "./amp-schedule.js";
|
|
10
|
+
export * from "./orca.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./cron.js";
|
|
3
|
+
export * from "./load.js";
|
|
4
|
+
export * from "./validate.js";
|
|
5
|
+
export * from "./account.js";
|
|
6
|
+
export * from "./prompt.js";
|
|
7
|
+
export * from "./stub.js";
|
|
8
|
+
export * from "./desired.js";
|
|
9
|
+
export * from "./amp-schedule.js";
|
|
10
|
+
export * from "./orca.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/automations/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Factory } from "../factory/types.js";
|
|
2
|
+
import type { Automations } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Reads `.factory/automations/` for a format 2 factory: the layout rules, then
|
|
5
|
+
* every `automation.md` and the rules that need all of them. Format 1 has no
|
|
6
|
+
* automations, so it loads none; `loadFactory` warns when the directory is
|
|
7
|
+
* non-empty there.
|
|
8
|
+
*/
|
|
9
|
+
export declare function loadAutomations(factoryDir: string, factory: Factory): Promise<Automations>;
|