@seasb/metafab 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +79 -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 +14 -7
|
@@ -0,0 +1,594 @@
|
|
|
1
|
+
import { isAlias, isMap, isScalar, isSeq } from "yaml";
|
|
2
|
+
import { isSingleLine } from "../../util/text.js";
|
|
3
|
+
import { didYouMean } from "../../util/suggest.js";
|
|
4
|
+
import { MAX_SKILL_NAME_LENGTH, SKILL_NAME_PATTERN, slugify } from "../factory/validate.js";
|
|
5
|
+
import { cronProblem, validTimeZone } from "./cron.js";
|
|
6
|
+
export const AUTOMATION_KEYS = [
|
|
7
|
+
"owner",
|
|
8
|
+
"description",
|
|
9
|
+
"enabled",
|
|
10
|
+
"checkout",
|
|
11
|
+
"triggers",
|
|
12
|
+
];
|
|
13
|
+
/** The spec's pattern for finding an email address in a frontmatter string. */
|
|
14
|
+
const EMAIL = /[^\s@"]+@[^\s@"]+\.[^\s@"]+/;
|
|
15
|
+
const EMAIL_ONLY = /^[^\s@"]+@[^\s@"]+\.[^\s@"]+$/;
|
|
16
|
+
export function automationFile(name) {
|
|
17
|
+
return `.factory/automations/${name}/automation.md`;
|
|
18
|
+
}
|
|
19
|
+
/** Rule 2's name check for an automation directory, with rule 5's fix. */
|
|
20
|
+
export function automationNameProblems(name) {
|
|
21
|
+
if (name.length <= MAX_SKILL_NAME_LENGTH && SKILL_NAME_PATTERN.test(name))
|
|
22
|
+
return [];
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
level: "error",
|
|
26
|
+
file: `.factory/automations/${name}`,
|
|
27
|
+
line: 1,
|
|
28
|
+
message: `Automation name "${name}" is not a valid Agent Skill name`,
|
|
29
|
+
fix: `Use a name like '${slugify(name)}'`,
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
/** Rule 3: a file directly in `automations/` that is not `run.md`. */
|
|
34
|
+
export function automationFileProblem(file) {
|
|
35
|
+
return {
|
|
36
|
+
level: "error",
|
|
37
|
+
file,
|
|
38
|
+
line: 1,
|
|
39
|
+
message: `${file} is not allowed directly in .factory/automations/`,
|
|
40
|
+
fix: "Only run.md may sit there; move it into an automation's directory or remove it",
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** Rule 2: a directory directly in `automations/` with no `automation.md`. */
|
|
44
|
+
export function automationMissingFileProblem(name) {
|
|
45
|
+
return {
|
|
46
|
+
level: "error",
|
|
47
|
+
file: `.factory/automations/${name}`,
|
|
48
|
+
line: 1,
|
|
49
|
+
message: `Automation "${name}" has no automation.md`,
|
|
50
|
+
fix: `Add .factory/automations/${name}/automation.md, or remove the directory`,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** Rule 1: a `SKILL.md` anywhere below `automations/`. */
|
|
54
|
+
export function automationSkillFileProblem(file) {
|
|
55
|
+
return {
|
|
56
|
+
level: "error",
|
|
57
|
+
file,
|
|
58
|
+
line: 1,
|
|
59
|
+
message: "SKILL.md is not allowed below .factory/automations/",
|
|
60
|
+
fix: "Move the skill out of .factory/automations/: build never installs anything from it",
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function scalarString(node) {
|
|
64
|
+
return isScalar(node) && typeof node.value === "string" ? node.value : undefined;
|
|
65
|
+
}
|
|
66
|
+
function resolved(node, parsed) {
|
|
67
|
+
return isAlias(node) ? node.resolve(parsed.document) : node;
|
|
68
|
+
}
|
|
69
|
+
/** Every string in a converted frontmatter value, however deeply nested. */
|
|
70
|
+
function stringValues(value) {
|
|
71
|
+
if (typeof value === "string")
|
|
72
|
+
return [value];
|
|
73
|
+
if (Array.isArray(value))
|
|
74
|
+
return value.flatMap(stringValues);
|
|
75
|
+
if (value !== null && typeof value === "object")
|
|
76
|
+
return Object.values(value).flatMap(stringValues);
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
/** Two triggers are equal when their names, or their cron fields, read the same. */
|
|
80
|
+
function triggerKey(trigger) {
|
|
81
|
+
return trigger.kind === "schedule"
|
|
82
|
+
? `schedule ${trigger.cron.trim().split(/\s+/).join(" ")} ${trigger.tz}`
|
|
83
|
+
: `after ${[...trigger.names].sort().join(",")}`;
|
|
84
|
+
}
|
|
85
|
+
function triggerShapeProblem(file, line) {
|
|
86
|
+
return {
|
|
87
|
+
level: "error",
|
|
88
|
+
file,
|
|
89
|
+
line,
|
|
90
|
+
message: 'A trigger must have exactly one of "schedule" or "after"',
|
|
91
|
+
fix: 'Write - schedule: { cron: "0 8 * * 1,4", tz: Australia/Sydney } or - after: [<name>]',
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function parseSchedule(node, parsed, file, line, problems) {
|
|
95
|
+
if (!isMap(node)) {
|
|
96
|
+
problems.push({
|
|
97
|
+
level: "error",
|
|
98
|
+
file,
|
|
99
|
+
line,
|
|
100
|
+
message: 'schedule must be a mapping with "cron" and "tz"',
|
|
101
|
+
fix: 'Write schedule: { cron: "0 8 * * 1,4", tz: Australia/Sydney }',
|
|
102
|
+
});
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
let cron;
|
|
106
|
+
let tz;
|
|
107
|
+
for (const pair of node.items) {
|
|
108
|
+
const key = scalarString(pair.key);
|
|
109
|
+
const fieldLine = parsed.lineOf(pair.key);
|
|
110
|
+
if (key !== "cron" && key !== "tz") {
|
|
111
|
+
problems.push({
|
|
112
|
+
level: "error",
|
|
113
|
+
file,
|
|
114
|
+
line: fieldLine,
|
|
115
|
+
message: `Unknown key "${key ?? "?"}" in schedule`,
|
|
116
|
+
fix: "Use cron and tz",
|
|
117
|
+
});
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const value = resolved(pair.value, parsed);
|
|
121
|
+
if (!isScalar(value) || typeof value.value !== "string" || value.value.trim() === "") {
|
|
122
|
+
problems.push({
|
|
123
|
+
level: "error",
|
|
124
|
+
file,
|
|
125
|
+
line: fieldLine,
|
|
126
|
+
message: `"${key}" must be a non-empty string`,
|
|
127
|
+
fix: key === "cron" ? 'Write cron: "0 8 * * 1,4"' : "Write tz: Australia/Sydney",
|
|
128
|
+
});
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
const field = { value: value.value.trim(), line: fieldLine };
|
|
132
|
+
if (key === "cron")
|
|
133
|
+
cron = field;
|
|
134
|
+
else
|
|
135
|
+
tz = field;
|
|
136
|
+
}
|
|
137
|
+
if (cron === undefined) {
|
|
138
|
+
problems.push({
|
|
139
|
+
level: "error",
|
|
140
|
+
file,
|
|
141
|
+
line,
|
|
142
|
+
message: 'schedule is missing "cron"',
|
|
143
|
+
fix: 'Add cron: "0 8 * * 1,4"',
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (tz === undefined) {
|
|
147
|
+
problems.push({
|
|
148
|
+
level: "error",
|
|
149
|
+
file,
|
|
150
|
+
line,
|
|
151
|
+
message: 'schedule is missing "tz"',
|
|
152
|
+
fix: "Add tz: Australia/Sydney",
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
if (cron === undefined || tz === undefined)
|
|
156
|
+
return undefined;
|
|
157
|
+
const problem = cronProblem(cron.value);
|
|
158
|
+
if (problem !== undefined) {
|
|
159
|
+
problems.push({
|
|
160
|
+
level: "error",
|
|
161
|
+
file,
|
|
162
|
+
line: cron.line,
|
|
163
|
+
message: problem,
|
|
164
|
+
fix: "Write five fields: minute hour day of month month day of week",
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
if (!validTimeZone(tz.value)) {
|
|
168
|
+
problems.push({
|
|
169
|
+
level: "error",
|
|
170
|
+
file,
|
|
171
|
+
line: tz.line,
|
|
172
|
+
message: `"${tz.value}" is not an IANA time zone`,
|
|
173
|
+
fix: "Use an IANA zone, such as Australia/Sydney",
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return { kind: "schedule", cron: cron.value, tz: tz.value, line };
|
|
177
|
+
}
|
|
178
|
+
function parseAfter(node, parsed, file, line, problems) {
|
|
179
|
+
if (!isSeq(node)) {
|
|
180
|
+
problems.push({
|
|
181
|
+
level: "error",
|
|
182
|
+
file,
|
|
183
|
+
line,
|
|
184
|
+
message: "after must be a list of automation names",
|
|
185
|
+
fix: "Write after: [<name>]",
|
|
186
|
+
});
|
|
187
|
+
return undefined;
|
|
188
|
+
}
|
|
189
|
+
const names = [];
|
|
190
|
+
for (const item of node.items) {
|
|
191
|
+
const value = resolved(item, parsed);
|
|
192
|
+
if (!isScalar(value) || typeof value.value !== "string" || value.value.trim() === "") {
|
|
193
|
+
problems.push({
|
|
194
|
+
level: "error",
|
|
195
|
+
file,
|
|
196
|
+
line: parsed.lineOf(item),
|
|
197
|
+
message: "after names must be non-empty strings",
|
|
198
|
+
fix: "Write each automation's name as a plain name",
|
|
199
|
+
});
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
names.push(value.value.trim());
|
|
203
|
+
}
|
|
204
|
+
if (names.length === 0) {
|
|
205
|
+
problems.push({
|
|
206
|
+
level: "error",
|
|
207
|
+
file,
|
|
208
|
+
line,
|
|
209
|
+
message: "after must name at least one automation",
|
|
210
|
+
fix: "Write after: [<name>]",
|
|
211
|
+
});
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
214
|
+
return { kind: "after", names, line };
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Reads one `automation.md` frontmatter into an `Automation`, reporting every
|
|
218
|
+
* frontmatter, trigger and cron problem. Rules that need the other automations
|
|
219
|
+
* are in `automationProblems`. The automation is returned when its `owner` is
|
|
220
|
+
* valid, so a broken cron or trigger still leaves it a named `after` target.
|
|
221
|
+
* The body is returned either way, so it is checked even when there is no
|
|
222
|
+
* runnable automation.
|
|
223
|
+
*/
|
|
224
|
+
export function parseAutomation(name, parsed) {
|
|
225
|
+
const file = automationFile(name);
|
|
226
|
+
const problems = [];
|
|
227
|
+
const contents = parsed.document.contents;
|
|
228
|
+
const pairs = isMap(contents) ? contents.items : [];
|
|
229
|
+
const keyLine = (key) => {
|
|
230
|
+
for (const pair of pairs) {
|
|
231
|
+
if (scalarString(pair.key) === key)
|
|
232
|
+
return parsed.lineOf(pair.key);
|
|
233
|
+
}
|
|
234
|
+
return 1;
|
|
235
|
+
};
|
|
236
|
+
for (const pair of pairs) {
|
|
237
|
+
const key = scalarString(pair.key);
|
|
238
|
+
if (key === undefined) {
|
|
239
|
+
problems.push({
|
|
240
|
+
level: "error",
|
|
241
|
+
file,
|
|
242
|
+
line: parsed.lineOf(pair.key),
|
|
243
|
+
message: "Automation key names must be strings",
|
|
244
|
+
fix: "Use a string key",
|
|
245
|
+
});
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
if (AUTOMATION_KEYS.includes(key))
|
|
249
|
+
continue;
|
|
250
|
+
problems.push({
|
|
251
|
+
level: "error",
|
|
252
|
+
file,
|
|
253
|
+
line: parsed.lineOf(pair.key),
|
|
254
|
+
message: `Unknown key "${key}" in automation.md`,
|
|
255
|
+
fix: didYouMean(key, AUTOMATION_KEYS) ??
|
|
256
|
+
`Remove the key or use ${AUTOMATION_KEYS.join(", ")}`,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
const ownerValue = parsed.value.owner;
|
|
260
|
+
let owner;
|
|
261
|
+
if (ownerValue === undefined) {
|
|
262
|
+
problems.push({
|
|
263
|
+
level: "error",
|
|
264
|
+
file,
|
|
265
|
+
line: 1,
|
|
266
|
+
message: 'automation.md is missing "owner"',
|
|
267
|
+
fix: 'Add owner: "*" or owner: <email>',
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
const text = typeof ownerValue === "string" ? ownerValue.trim() : undefined;
|
|
272
|
+
if (text === undefined || (text !== "*" && !EMAIL_ONLY.test(text))) {
|
|
273
|
+
problems.push({
|
|
274
|
+
level: "error",
|
|
275
|
+
file,
|
|
276
|
+
line: keyLine("owner"),
|
|
277
|
+
message: '"owner" must be "*" or one email address',
|
|
278
|
+
fix: 'Set owner: "*" or the email of the account that runs it',
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
owner = text;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
const descriptionValue = parsed.value.description;
|
|
286
|
+
let description;
|
|
287
|
+
if (descriptionValue !== undefined) {
|
|
288
|
+
if (typeof descriptionValue !== "string") {
|
|
289
|
+
problems.push({
|
|
290
|
+
level: "error",
|
|
291
|
+
file,
|
|
292
|
+
line: keyLine("description"),
|
|
293
|
+
message: '"description" must be a string',
|
|
294
|
+
fix: "Write the description on one line",
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
else if (!isSingleLine(descriptionValue)) {
|
|
298
|
+
problems.push({
|
|
299
|
+
level: "error",
|
|
300
|
+
file,
|
|
301
|
+
line: keyLine("description"),
|
|
302
|
+
message: '"description" must be a single line',
|
|
303
|
+
fix: "Write the description on one line",
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
description = descriptionValue;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
const enabledValue = parsed.value.enabled;
|
|
311
|
+
let enabled = true;
|
|
312
|
+
if (enabledValue !== undefined) {
|
|
313
|
+
if (typeof enabledValue !== "boolean") {
|
|
314
|
+
problems.push({
|
|
315
|
+
level: "error",
|
|
316
|
+
file,
|
|
317
|
+
line: keyLine("enabled"),
|
|
318
|
+
message: '"enabled" must be true or false',
|
|
319
|
+
fix: "Write enabled: true or enabled: false",
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
enabled = enabledValue;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
const checkoutValue = parsed.value.checkout;
|
|
327
|
+
let checkout = "worktree";
|
|
328
|
+
if (checkoutValue !== undefined) {
|
|
329
|
+
if (checkoutValue !== "worktree" && checkoutValue !== "main") {
|
|
330
|
+
problems.push({
|
|
331
|
+
level: "error",
|
|
332
|
+
file,
|
|
333
|
+
line: keyLine("checkout"),
|
|
334
|
+
message: '"checkout" must be worktree or main',
|
|
335
|
+
fix: "Write checkout: worktree or checkout: main",
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
checkout = checkoutValue;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
const triggers = [];
|
|
343
|
+
const triggersValue = parsed.value.triggers;
|
|
344
|
+
const triggersNode = resolved(parsed.document.get("triggers", true), parsed);
|
|
345
|
+
const triggerNodes = isSeq(triggersNode) ? triggersNode.items : [];
|
|
346
|
+
if (triggersValue === undefined) {
|
|
347
|
+
problems.push({
|
|
348
|
+
level: "error",
|
|
349
|
+
file,
|
|
350
|
+
line: 1,
|
|
351
|
+
message: 'automation.md is missing "triggers"',
|
|
352
|
+
fix: "Add a triggers list with a schedule or after entry",
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
else if (triggerNodes.length === 0) {
|
|
356
|
+
problems.push({
|
|
357
|
+
level: "error",
|
|
358
|
+
file,
|
|
359
|
+
line: keyLine("triggers"),
|
|
360
|
+
message: '"triggers" must be a non-empty list',
|
|
361
|
+
fix: 'Add a - schedule: { cron: ..., tz: ... } or - after: [<name>] entry',
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
let schedules = 0;
|
|
365
|
+
for (const itemNode of triggerNodes) {
|
|
366
|
+
const item = resolved(itemNode, parsed);
|
|
367
|
+
const line = parsed.lineOf(itemNode);
|
|
368
|
+
if (!isMap(item) || item.items.length !== 1) {
|
|
369
|
+
problems.push(triggerShapeProblem(file, line));
|
|
370
|
+
continue;
|
|
371
|
+
}
|
|
372
|
+
const entry = item.items[0];
|
|
373
|
+
const key = scalarString(entry.key);
|
|
374
|
+
if (key === "schedule") {
|
|
375
|
+
schedules += 1;
|
|
376
|
+
if (schedules > 1) {
|
|
377
|
+
problems.push({
|
|
378
|
+
level: "error",
|
|
379
|
+
file,
|
|
380
|
+
line,
|
|
381
|
+
message: "An automation has at most one schedule trigger",
|
|
382
|
+
fix: "Write several times in one cron, such as 0 8,17 * * 1-5",
|
|
383
|
+
});
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
const trigger = parseSchedule(resolved(entry.value, parsed), parsed, file, line, problems);
|
|
387
|
+
if (trigger !== undefined)
|
|
388
|
+
triggers.push(trigger);
|
|
389
|
+
continue;
|
|
390
|
+
}
|
|
391
|
+
if (key === "after") {
|
|
392
|
+
const trigger = parseAfter(resolved(entry.value, parsed), parsed, file, line, problems);
|
|
393
|
+
if (trigger !== undefined)
|
|
394
|
+
triggers.push(trigger);
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
problems.push({
|
|
398
|
+
level: "error",
|
|
399
|
+
file,
|
|
400
|
+
line,
|
|
401
|
+
message: `Unknown trigger "${key ?? "?"}"`,
|
|
402
|
+
fix: "Use schedule or after",
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
const seen = new Set();
|
|
406
|
+
for (const trigger of triggers) {
|
|
407
|
+
const key = triggerKey(trigger);
|
|
408
|
+
if (seen.has(key)) {
|
|
409
|
+
problems.push({
|
|
410
|
+
level: "error",
|
|
411
|
+
file,
|
|
412
|
+
line: trigger.line,
|
|
413
|
+
message: "Two triggers are equal",
|
|
414
|
+
fix: "Remove one of them",
|
|
415
|
+
});
|
|
416
|
+
continue;
|
|
417
|
+
}
|
|
418
|
+
seen.add(key);
|
|
419
|
+
}
|
|
420
|
+
for (const pair of pairs) {
|
|
421
|
+
const key = scalarString(pair.key);
|
|
422
|
+
if (key === undefined || key === "owner")
|
|
423
|
+
continue;
|
|
424
|
+
if (!stringValues(parsed.value[key]).some((text) => EMAIL.test(text)))
|
|
425
|
+
continue;
|
|
426
|
+
problems.push({
|
|
427
|
+
level: "error",
|
|
428
|
+
file,
|
|
429
|
+
line: parsed.lineOf(pair.key),
|
|
430
|
+
message: `"${key}" holds an email address, and only "owner" may`,
|
|
431
|
+
fix: `Remove the email address from "${key}", or move it to owner`,
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
const body = { name, file, bodyLine: parsed.endLine + 1 };
|
|
435
|
+
if (owner === undefined)
|
|
436
|
+
return { body, problems };
|
|
437
|
+
return {
|
|
438
|
+
automation: {
|
|
439
|
+
name,
|
|
440
|
+
file,
|
|
441
|
+
owner,
|
|
442
|
+
...(description === undefined ? {} : { description }),
|
|
443
|
+
enabled,
|
|
444
|
+
checkout,
|
|
445
|
+
triggers,
|
|
446
|
+
body: parsed.body,
|
|
447
|
+
bodyLine: body.bodyLine,
|
|
448
|
+
triggersLine: keyLine("triggers"),
|
|
449
|
+
},
|
|
450
|
+
body,
|
|
451
|
+
problems,
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Rules that need every automation: an `after` name is another automation and
|
|
456
|
+
* not itself, an owner chain runs in its parent's account, and no `after`
|
|
457
|
+
* chain loops.
|
|
458
|
+
*/
|
|
459
|
+
export function automationProblems(automations) {
|
|
460
|
+
const problems = [];
|
|
461
|
+
const byName = new Map(automations.map((automation) => [automation.name, automation]));
|
|
462
|
+
const names = [...byName.keys()].sort();
|
|
463
|
+
for (const automation of automations) {
|
|
464
|
+
for (const trigger of automation.triggers) {
|
|
465
|
+
if (trigger.kind !== "after")
|
|
466
|
+
continue;
|
|
467
|
+
for (const name of trigger.names) {
|
|
468
|
+
if (name === automation.name) {
|
|
469
|
+
problems.push({
|
|
470
|
+
level: "error",
|
|
471
|
+
file: automation.file,
|
|
472
|
+
line: trigger.line,
|
|
473
|
+
message: `after names the automation itself: "${name}"`,
|
|
474
|
+
fix: `Remove "${name}" from after`,
|
|
475
|
+
});
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
478
|
+
const parent = byName.get(name);
|
|
479
|
+
if (parent === undefined) {
|
|
480
|
+
problems.push({
|
|
481
|
+
level: "error",
|
|
482
|
+
file: automation.file,
|
|
483
|
+
line: trigger.line,
|
|
484
|
+
message: `after names unknown automation "${name}"`,
|
|
485
|
+
fix: didYouMean(name, names) ??
|
|
486
|
+
"Name an automation in .factory/automations/, or add it",
|
|
487
|
+
});
|
|
488
|
+
continue;
|
|
489
|
+
}
|
|
490
|
+
if (automation.owner === "*" ||
|
|
491
|
+
automation.owner.toLowerCase() === parent.owner.toLowerCase()) {
|
|
492
|
+
continue;
|
|
493
|
+
}
|
|
494
|
+
problems.push({
|
|
495
|
+
level: "error",
|
|
496
|
+
file: automation.file,
|
|
497
|
+
line: trigger.line,
|
|
498
|
+
message: `owner: ${automation.owner} cannot run after "${parent.name}", owned by ${parent.owner}: a chained run starts in its parent's account`,
|
|
499
|
+
fix: `Set owner to "*" or to ${parent.owner}`,
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
problems.push(...cycleProblems(automations));
|
|
505
|
+
return problems;
|
|
506
|
+
}
|
|
507
|
+
/** A cycle's names in a stable order, so each loop is reported once. */
|
|
508
|
+
function canonical(cycle) {
|
|
509
|
+
let first = 0;
|
|
510
|
+
for (let index = 1; index < cycle.length; index += 1) {
|
|
511
|
+
if (cycle[index] < cycle[first])
|
|
512
|
+
first = index;
|
|
513
|
+
}
|
|
514
|
+
return [...cycle.slice(first), ...cycle.slice(0, first)].join("\u0000");
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Each loop in the `after` graph once, as the path of an automation's children:
|
|
518
|
+
* an edge runs from a named parent to the automation that starts after it.
|
|
519
|
+
* Depth-first from each automation in name order, keeping the first path that
|
|
520
|
+
* returns to the start.
|
|
521
|
+
*/
|
|
522
|
+
export function findCycles(automations) {
|
|
523
|
+
const names = automations.map((automation) => automation.name).sort();
|
|
524
|
+
const children = new Map(names.map((name) => [name, []]));
|
|
525
|
+
for (const automation of automations) {
|
|
526
|
+
for (const trigger of automation.triggers) {
|
|
527
|
+
if (trigger.kind !== "after")
|
|
528
|
+
continue;
|
|
529
|
+
for (const name of trigger.names) {
|
|
530
|
+
const list = children.get(name);
|
|
531
|
+
if (list === undefined || name === automation.name || list.includes(automation.name)) {
|
|
532
|
+
continue;
|
|
533
|
+
}
|
|
534
|
+
list.push(automation.name);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
for (const list of children.values())
|
|
539
|
+
list.sort();
|
|
540
|
+
const cycles = [];
|
|
541
|
+
const seen = new Set();
|
|
542
|
+
for (const start of names) {
|
|
543
|
+
const path = [];
|
|
544
|
+
const visiting = new Set();
|
|
545
|
+
const walk = (name) => {
|
|
546
|
+
path.push(name);
|
|
547
|
+
visiting.add(name);
|
|
548
|
+
for (const child of children.get(name) ?? []) {
|
|
549
|
+
if (child === start)
|
|
550
|
+
return [...path];
|
|
551
|
+
if (visiting.has(child))
|
|
552
|
+
continue;
|
|
553
|
+
const found = walk(child);
|
|
554
|
+
if (found !== undefined)
|
|
555
|
+
return found;
|
|
556
|
+
}
|
|
557
|
+
path.pop();
|
|
558
|
+
visiting.delete(name);
|
|
559
|
+
return undefined;
|
|
560
|
+
};
|
|
561
|
+
const found = walk(start);
|
|
562
|
+
if (found === undefined)
|
|
563
|
+
continue;
|
|
564
|
+
const key = canonical(found);
|
|
565
|
+
if (seen.has(key))
|
|
566
|
+
continue;
|
|
567
|
+
seen.add(key);
|
|
568
|
+
cycles.push(found);
|
|
569
|
+
}
|
|
570
|
+
return cycles;
|
|
571
|
+
}
|
|
572
|
+
/** One error per member of a loop, with the loop written from that member. */
|
|
573
|
+
function cycleProblems(automations) {
|
|
574
|
+
const byName = new Map(automations.map((automation) => [automation.name, automation]));
|
|
575
|
+
const problems = [];
|
|
576
|
+
for (const cycle of findCycles(automations)) {
|
|
577
|
+
for (const member of [...cycle].sort()) {
|
|
578
|
+
const automation = byName.get(member);
|
|
579
|
+
if (automation === undefined)
|
|
580
|
+
continue;
|
|
581
|
+
const index = cycle.indexOf(member);
|
|
582
|
+
const path = [...cycle.slice(index), ...cycle.slice(0, index), member];
|
|
583
|
+
problems.push({
|
|
584
|
+
level: "error",
|
|
585
|
+
file: automation.file,
|
|
586
|
+
line: automation.triggersLine,
|
|
587
|
+
message: `cycle: ${path.join(" → ")}`,
|
|
588
|
+
fix: "Remove one of the after entries in the loop",
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
return problems;
|
|
593
|
+
}
|
|
594
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/core/automations/validate.ts"],"names":[],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CAAC;QAC5C,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;YACvC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACtC,IAAI,UAAU,KAAK,SAAS;gBAAE,SAAS;YAEvC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACpC,MAAM,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;YACvE,QAAQ,CAAC,IAAI,CAAC;gBACZ,KAAK,EAAE,OAAO;gBACd,IAAI,EAAE,UAAU,CAAC,IAAI;gBACrB,IAAI,EAAE,UAAU,CAAC,YAAY;gBAC7B,OAAO,EAAE,UAAU,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;gBACrC,GAAG,EAAE,6CAA6C;aACnD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -13,14 +13,27 @@ export declare const GITIGNORE_MARKERS: {
|
|
|
13
13
|
};
|
|
14
14
|
export declare const AGENTS_BLOCK_LINE_LIMIT = 300;
|
|
15
15
|
export declare const PIPELINE_INTRO = "Work moves through these workflows in order. When one ends, suggest the next.";
|
|
16
|
+
export declare const WORKFLOWS_INTRO = "This repository's process lives in `.factory/`:";
|
|
17
|
+
export declare const WORKFLOWS_SENTENCE = "When a request matches a workflow, read its file and follow it. A workflow that is also installed as a skill can be loaded as that skill.";
|
|
16
18
|
export declare function renderPipelineEntry(entry: PipelineEntry, index: number): string;
|
|
19
|
+
/**
|
|
20
|
+
* The Workflows section: the `.factory/` layout, how to read a workflow file,
|
|
21
|
+
* and one row per workflow. It depends on the factory only, never on the
|
|
22
|
+
* environment selection, like the rest of the block.
|
|
23
|
+
*/
|
|
24
|
+
export declare function renderWorkflowsSection(factory: Factory): string[];
|
|
25
|
+
/** The `agents-md` settings the block honours. */
|
|
26
|
+
export interface AgentsBlockOptions {
|
|
27
|
+
/** False when `agents-md.workflows` is false: the block has no Workflows section. */
|
|
28
|
+
workflows: boolean;
|
|
29
|
+
}
|
|
17
30
|
/**
|
|
18
31
|
* The text between the factory markers in the root AGENTS.md. `standing` is the
|
|
19
32
|
* rendered `.factory/AGENTS.md`; without it the source text is used as written.
|
|
20
33
|
*/
|
|
21
|
-
export declare function renderAgentsBlockBody(factory: Factory, standing?: string): string;
|
|
34
|
+
export declare function renderAgentsBlockBody(factory: Factory, standing?: string, options?: AgentsBlockOptions): string;
|
|
22
35
|
/** The full root AGENTS.md block, markers included. */
|
|
23
|
-
export declare function renderAgentsBlock(factory: Factory, standing?: string): string;
|
|
24
|
-
export declare function agentsBlockLineCount(factory: Factory, standing?: string): number;
|
|
36
|
+
export declare function renderAgentsBlock(factory: Factory, standing?: string, options?: AgentsBlockOptions): string;
|
|
37
|
+
export declare function agentsBlockLineCount(factory: Factory, standing?: string, options?: AgentsBlockOptions): number;
|
|
25
38
|
export declare function claudeBlockBody(): string;
|
|
26
39
|
export declare function gitignoreBlockBody(agents: readonly string[]): string[];
|