@clemrig/factory 0.6.1 → 0.7.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 +56 -26
- package/dist/app/define.js +1 -1
- package/dist/app/define.js.map +1 -1
- package/dist/app/init.d.ts +1 -0
- package/dist/app/init.js +1 -0
- package/dist/app/init.js.map +1 -1
- package/dist/app/run.d.ts +2 -1
- package/dist/app/run.js +16 -4
- package/dist/app/run.js.map +1 -1
- package/dist/app/workflows/implement.d.ts +1 -1
- package/dist/app/workflows/implement.js +290 -73
- package/dist/app/workflows/implement.js.map +1 -1
- package/dist/cli/help.d.ts +1 -1
- package/dist/cli/help.js +4 -2
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/init.d.ts +3 -2
- package/dist/cli/init.js +10 -3
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/run.js +1 -1
- package/dist/cli/run.js.map +1 -1
- package/dist/domain/definition.d.ts +2 -0
- package/dist/domain/definition.js +1 -0
- package/dist/domain/definition.js.map +1 -1
- package/dist/domain/description.d.ts +51 -0
- package/dist/domain/description.js +78 -0
- package/dist/domain/description.js.map +1 -0
- package/dist/domain/plan.d.ts +2 -0
- package/dist/domain/plan.js +15 -0
- package/dist/domain/plan.js.map +1 -1
- package/dist/domain/pull-request.d.ts +42 -8
- package/dist/domain/pull-request.js +287 -24
- package/dist/domain/pull-request.js.map +1 -1
- package/dist/domain/review.d.ts +9 -1
- package/dist/domain/review.js +30 -5
- package/dist/domain/review.js.map +1 -1
- package/dist/system/browser.d.ts +29 -0
- package/dist/system/browser.js +84 -0
- package/dist/system/browser.js.map +1 -0
- package/dist/system/github.d.ts +15 -0
- package/dist/system/github.js +36 -2
- package/dist/system/github.js.map +1 -1
- package/dist/system/run-files.d.ts +14 -0
- package/dist/system/run-files.js +69 -2
- package/dist/system/run-files.js.map +1 -1
- package/dist/system/templates.d.ts +3 -2
- package/dist/system/templates.js +8 -3
- package/dist/system/templates.js.map +1 -1
- package/package.json +3 -3
- package/prompts/implement/describe.md +74 -0
- package/prompts/implement/implement.md +25 -8
- package/prompts/implement/plan.md +35 -7
- package/prompts/implement/review.md +43 -16
- package/templates/init/factory.ts +23 -5
|
@@ -1,36 +1,299 @@
|
|
|
1
1
|
import { isBlocking, natureLabel, } from "./review.js";
|
|
2
2
|
import { seconds } from "./verification.js";
|
|
3
|
+
/** The first `gh` that attaches images to a pull request (`--attach`). */
|
|
4
|
+
export const minimumGhVersion = "2.99.0";
|
|
5
|
+
/** Why this `gh` cannot open the pull request, if it cannot. */
|
|
6
|
+
export function ghVersionProblem(version) {
|
|
7
|
+
const parts = (text) => text.split(".").map(Number);
|
|
8
|
+
const [major = 0, minor = 0, patch = 0] = parts(version);
|
|
9
|
+
const [needMajor = 0, needMinor = 0, needPatch = 0] = parts(minimumGhVersion);
|
|
10
|
+
const recent = major !== needMajor
|
|
11
|
+
? major > needMajor
|
|
12
|
+
: minor !== needMinor
|
|
13
|
+
? minor > needMinor
|
|
14
|
+
: patch >= needPatch;
|
|
15
|
+
return recent
|
|
16
|
+
? undefined
|
|
17
|
+
: `gh ${minimumGhVersion} or later is required to attach screenshots (found ${version}): upgrade gh`;
|
|
18
|
+
}
|
|
19
|
+
/** Below GitHub's limit for a pull request's body (65,536 characters), with room for the screenshots' links. */
|
|
20
|
+
export const maxBodyLength = 60_000;
|
|
21
|
+
/** Agent text on one line. */
|
|
22
|
+
function line(text) {
|
|
23
|
+
return text.replace(/\s*\n\s*/g, " ");
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Text shown as prose, from the spec or an agent: nothing in it opens a code
|
|
27
|
+
* block or a comment, which would swallow the rest of the body.
|
|
28
|
+
*/
|
|
29
|
+
function inert(text) {
|
|
30
|
+
return text
|
|
31
|
+
.replaceAll("```", "\\`\\`\\`")
|
|
32
|
+
.replaceAll("~~~", "\\~\\~\\~")
|
|
33
|
+
.replaceAll("<!--", "<!--");
|
|
34
|
+
}
|
|
3
35
|
/** Agent text inside a table cell: one line, no column separator. */
|
|
4
36
|
function cell(text) {
|
|
5
|
-
return text
|
|
37
|
+
return inert(line(text)).replaceAll("|", "\\|");
|
|
6
38
|
}
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
39
|
+
/** A list item whose text may hold several lines. */
|
|
40
|
+
function item(text) {
|
|
41
|
+
return `- ${inert(text.trim()).replace(/\n/g, "\n ")}`;
|
|
42
|
+
}
|
|
43
|
+
/** Agent text as HTML, in a folded section's title. */
|
|
44
|
+
function html(text) {
|
|
45
|
+
return line(text)
|
|
46
|
+
.replaceAll("&", "&")
|
|
47
|
+
.replaceAll("<", "<")
|
|
48
|
+
.replaceAll(">", ">");
|
|
49
|
+
}
|
|
50
|
+
/** Agent text as an image's alternative text: one line, no bracket to end it. */
|
|
51
|
+
function alt(text) {
|
|
52
|
+
return line(text).replace(/[\\[\]]/g, "\\$&");
|
|
53
|
+
}
|
|
54
|
+
function plural(count, noun) {
|
|
55
|
+
return `${count} ${noun}${count === 1 ? "" : "s"}`;
|
|
56
|
+
}
|
|
57
|
+
/** Content folded under its title until the reader opens it. */
|
|
58
|
+
function folded(title, content) {
|
|
59
|
+
return `<details><summary>${title}</summary>\n\n${content}\n\n</details>`;
|
|
60
|
+
}
|
|
61
|
+
/** Above this many files, the review guide folds each group's list. */
|
|
62
|
+
const foldedFiles = 10;
|
|
63
|
+
/** A changed file with its added and removed lines, as the review guide lists it. */
|
|
64
|
+
function changedFile(file) {
|
|
65
|
+
const name = file.from
|
|
66
|
+
? `\`${file.from}\` → \`${file.path}\``
|
|
67
|
+
: `\`${file.path}\``;
|
|
68
|
+
return file.added === undefined || file.removed === undefined
|
|
69
|
+
? `${name} (binary)`
|
|
70
|
+
: `${name} (+${file.added} -${file.removed})`;
|
|
71
|
+
}
|
|
72
|
+
/** A review's finding, as the pull request lists it: where, what, and its nature. */
|
|
73
|
+
function finding({ nature, file, summary, }) {
|
|
74
|
+
const label = natureLabel(nature);
|
|
75
|
+
return item(`${file ? `\`${file}\` — ` : ""}${summary.trim()} _${label[0]?.toUpperCase()}${label.slice(1)}_`);
|
|
76
|
+
}
|
|
77
|
+
/** What the review still asks for, which the operator accepted to deliver. */
|
|
78
|
+
function openItems({ review, acceptedReview }) {
|
|
79
|
+
if (!acceptedReview)
|
|
80
|
+
return [];
|
|
81
|
+
return [
|
|
82
|
+
...review.criteria
|
|
83
|
+
.filter(({ status }) => status === "not_met")
|
|
84
|
+
.map(({ id, evidence }) => item(`${id} is not met — ${evidence.trim()}`)),
|
|
85
|
+
...review.findings.filter(({ nature }) => isBlocking(nature)).map(finding),
|
|
86
|
+
];
|
|
87
|
+
}
|
|
88
|
+
/** The criteria the last review found met. */
|
|
89
|
+
function metCriteria({ criteria, review }) {
|
|
90
|
+
return criteria.filter(({ id }) => review.criteria.find((criterion) => criterion.id === id)?.status ===
|
|
91
|
+
"met").length;
|
|
92
|
+
}
|
|
93
|
+
/** How the review ended, after how many rounds of changes. */
|
|
94
|
+
function rounds(facts) {
|
|
95
|
+
const after = facts.reviewRounds === 0
|
|
96
|
+
? "at the first review"
|
|
97
|
+
: `after ${plural(facts.reviewRounds, "round")} of changes`;
|
|
98
|
+
return openItems(facts).length > 0
|
|
99
|
+
? `Delivered by the operator ${after}`
|
|
100
|
+
: `Approved ${after}`;
|
|
101
|
+
}
|
|
102
|
+
/** The pull request at a glance: its scope, its danger, its proof and its review. */
|
|
103
|
+
function glance(facts) {
|
|
104
|
+
const { files, links, runId, description, checks, skippedChecks } = facts;
|
|
105
|
+
const sum = (key) => files.reduce((total, file) => total + (file[key] ?? 0), 0);
|
|
106
|
+
const { danger, screenshots } = description;
|
|
107
|
+
const open = openItems(facts).length;
|
|
108
|
+
const nonBlocking = facts.review.findings.filter(({ nature }) => !isBlocking(nature)).length;
|
|
109
|
+
const proof = [
|
|
110
|
+
`${metCriteria(facts)} / ${facts.criteria.length} criteria`,
|
|
111
|
+
...(checks.length > 0
|
|
112
|
+
? [`${checks.map(({ name }) => name).join(", ")} passed`]
|
|
113
|
+
: []),
|
|
114
|
+
...(skippedChecks.length > 0
|
|
115
|
+
? [`${skippedChecks.join(", ")} skipped`]
|
|
116
|
+
: []),
|
|
117
|
+
screenshots.length > 0
|
|
118
|
+
? plural(screenshots.length, "screenshot")
|
|
119
|
+
: "no screenshots",
|
|
120
|
+
];
|
|
121
|
+
const review = [
|
|
122
|
+
rounds(facts),
|
|
123
|
+
...(open > 0 ? [`${open} open`] : []),
|
|
124
|
+
...(nonBlocking > 0 ? [plural(nonBlocking, "non-blocking finding")] : []),
|
|
125
|
+
...(facts.resolved.length > 0
|
|
126
|
+
? [`${facts.resolved.length} fixed during review`]
|
|
127
|
+
: []),
|
|
128
|
+
...(facts.deviations.length > 0
|
|
129
|
+
? [`${plural(facts.deviations.length, "deviation")} from the plan`]
|
|
130
|
+
: []),
|
|
131
|
+
];
|
|
132
|
+
return [
|
|
133
|
+
`| **Scope** | ${plural(files.length, "file")}, +${sum("added")} −${sum("removed")} · [spec](${links.spec}) · [plan](${links.plan}) · run \`${runId}\` |`,
|
|
134
|
+
"|:--|:--|",
|
|
135
|
+
`| **Merge** | ${danger.door === "one_way" ? "**One-way door**" : "Two-way door"} · blast radius **${cell(danger.blastRadius)}** |`,
|
|
136
|
+
`| **Proof** | ${proof.join(" · ")} |`,
|
|
137
|
+
`| **Review** | ${review.join(" · ")} |`,
|
|
138
|
+
].join("\n");
|
|
139
|
+
}
|
|
140
|
+
/** A code block around `content`, its fence longer than any it holds. */
|
|
141
|
+
function codeBlock(kind, content) {
|
|
142
|
+
const longest = Math.max(0, ...[...content.matchAll(/`+/g)].map(([run]) => run.length));
|
|
143
|
+
const fence = "`".repeat(Math.max(3, longest + 1));
|
|
144
|
+
return `${fence}${kind}\n${content.trimEnd()}\n${fence}`;
|
|
145
|
+
}
|
|
146
|
+
function howItWorks({ visuals }) {
|
|
147
|
+
if (visuals.length === 0)
|
|
148
|
+
return "The change needs no diagram.";
|
|
149
|
+
return visuals
|
|
150
|
+
.map(({ caption, kind, content }) => `${inert(caption.trim())}\n\n${codeBlock(kind, content)}`)
|
|
151
|
+
.join("\n\n");
|
|
152
|
+
}
|
|
153
|
+
function mergeDanger({ danger }) {
|
|
154
|
+
const afterMerge = danger.afterMerge.length > 0
|
|
155
|
+
? danger.afterMerge
|
|
156
|
+
.map((action, index) => `${index + 1}. ${cell(action)}`)
|
|
157
|
+
.join("<br>")
|
|
158
|
+
: "Nothing.";
|
|
159
|
+
return [
|
|
160
|
+
`| **Door** | **${danger.door === "one_way" ? "One-way" : "Two-way"}.** ${cell(danger.reason)} |`,
|
|
161
|
+
"|:--|:--|",
|
|
162
|
+
`| **Blast radius** | **${cell(danger.blastRadius)}.** ${cell(danger.ramifications)} |`,
|
|
163
|
+
`| **Rollback** | ${cell(danger.rollback)} |`,
|
|
164
|
+
`| **After merge** | ${afterMerge} |`,
|
|
165
|
+
].join("\n");
|
|
166
|
+
}
|
|
167
|
+
function reviewGuide({ description, files }) {
|
|
168
|
+
const { start, groups } = description.guide;
|
|
169
|
+
const byPath = new Map(files.map((file) => [file.path, file]));
|
|
170
|
+
const listed = (paths) => paths.flatMap((path) => {
|
|
171
|
+
const file = byPath.get(path);
|
|
172
|
+
return file ? [`- ${changedFile(file)}`] : [];
|
|
14
173
|
});
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
174
|
+
const grouped = new Set(groups.flatMap((group) => group.files));
|
|
175
|
+
const others = files.filter(({ path }) => !grouped.has(path));
|
|
176
|
+
const sections = [
|
|
177
|
+
...groups.map(({ title, files: paths }, index) => ({
|
|
178
|
+
title: `${index + 1}. ${title.trim()}`,
|
|
179
|
+
lines: listed(paths),
|
|
180
|
+
})),
|
|
181
|
+
...(others.length > 0
|
|
182
|
+
? [
|
|
183
|
+
{
|
|
184
|
+
title: groups.length > 0 ? "Other files" : "Files",
|
|
185
|
+
lines: others.map((file) => `- ${changedFile(file)}`),
|
|
186
|
+
},
|
|
187
|
+
]
|
|
188
|
+
: []),
|
|
18
189
|
];
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
190
|
+
// A large change shows its groups, each list folded.
|
|
191
|
+
const fold = files.length > foldedFiles;
|
|
192
|
+
return [
|
|
193
|
+
`Start with \`${start.file}\`: ${inert(start.why.trim())}`,
|
|
194
|
+
...sections.map(({ title, lines }) => fold
|
|
195
|
+
? folded(`<b>${html(title)}</b> · ${plural(lines.length, "file")}`, lines.join("\n"))
|
|
196
|
+
: `**${inert(line(title))}**\n${lines.join("\n")}`),
|
|
197
|
+
].join("\n\n");
|
|
198
|
+
}
|
|
199
|
+
function judgment(facts) {
|
|
200
|
+
const open = openItems(facts);
|
|
201
|
+
const findings = facts.review.findings
|
|
23
202
|
.filter(({ nature }) => !isBlocking(nature))
|
|
24
|
-
.map(
|
|
25
|
-
const
|
|
203
|
+
.map(finding);
|
|
204
|
+
const lists = [
|
|
205
|
+
["Open, accepted by the operator", open],
|
|
206
|
+
["Non-blocking findings", findings],
|
|
207
|
+
["Deviations from the plan", facts.deviations.map(item)],
|
|
208
|
+
];
|
|
209
|
+
const shown = lists
|
|
210
|
+
.filter(([, items]) => items.length > 0)
|
|
211
|
+
.map(([title, items]) => `**${title}**\n${items.join("\n")}`);
|
|
212
|
+
const fixed = facts.resolved.length > 0
|
|
213
|
+
? [
|
|
214
|
+
folded(`Fixed during the review rounds · ${facts.resolved.length}`, facts.resolved
|
|
215
|
+
.map(({ summary, evidence }) => item(`${summary.trim()} Proof: ${evidence.trim()}`))
|
|
216
|
+
.join("\n")),
|
|
217
|
+
]
|
|
218
|
+
: [];
|
|
219
|
+
const assumptions = facts.assumptions.length > 0
|
|
220
|
+
? [
|
|
221
|
+
folded(`The plan's ${plural(facts.assumptions.length, "assumption")}`, facts.assumptions.map(item).join("\n")),
|
|
222
|
+
]
|
|
223
|
+
: [];
|
|
224
|
+
const sections = [...shown, ...fixed, ...assumptions];
|
|
225
|
+
if (sections.length === 0)
|
|
226
|
+
return `${rounds(facts)}. No non-blocking finding, deviation from the plan or assumption.`;
|
|
227
|
+
const left = open.length > 0 ? ", with what it still asked for left open" : "";
|
|
228
|
+
return [`${rounds(facts)}${left}.`, ...sections].join("\n\n");
|
|
229
|
+
}
|
|
230
|
+
function screenshots({ description, screenshotsPending, }) {
|
|
231
|
+
const shots = description.screenshots;
|
|
232
|
+
if (shots.length === 0)
|
|
233
|
+
return `No screenshots: ${inert(description.noScreenshots?.trim() ?? "")}`;
|
|
234
|
+
if (screenshotsPending)
|
|
235
|
+
return `_Attaching ${plural(shots.length, "screenshot")}…_`;
|
|
236
|
+
return shots
|
|
237
|
+
.map(({ file, caption }) =>
|
|
238
|
+
// A backslash would escape the closing underscore. Each image is a
|
|
239
|
+
// paragraph of its own, as gh attached them in a real run; a line
|
|
240
|
+
// that starts with `\n\n_${line(caption).replaceAll("\\", "\\\\")}_`)
|
|
242
|
+
.join("\n\n");
|
|
243
|
+
}
|
|
244
|
+
function evidence(facts) {
|
|
245
|
+
const met = metCriteria(facts);
|
|
246
|
+
const total = facts.criteria.length;
|
|
247
|
+
const checks = [
|
|
248
|
+
...(facts.checks.length > 0
|
|
249
|
+
? [
|
|
250
|
+
`passed: ${facts.checks.map(({ name, command, durationMs }) => `${name} (\`${command.join(" ")}\`, ${seconds(durationMs)})`).join(", ")}`,
|
|
251
|
+
]
|
|
252
|
+
: []),
|
|
253
|
+
...(facts.skippedChecks.length > 0
|
|
254
|
+
? [
|
|
255
|
+
`skipped, no change matching their files: ${facts.skippedChecks.join(", ")}`,
|
|
256
|
+
]
|
|
257
|
+
: []),
|
|
258
|
+
];
|
|
259
|
+
const criteria = facts.criteria.map(({ id, text }) => {
|
|
260
|
+
const judged = facts.review.criteria.find((criterion) => criterion.id === id);
|
|
261
|
+
const unmet = judged?.status === "not_met" ? "Not met: " : "";
|
|
262
|
+
return `| ${cell(`${id}: ${text}`)} | ${cell(`${unmet}${judged?.evidence ?? ""}`)} |`;
|
|
263
|
+
});
|
|
264
|
+
return [
|
|
265
|
+
screenshots(facts),
|
|
266
|
+
`**${met} / ${total} ${total === 1 ? "criterion" : "criteria"} met**, checked by an independent review${met < total ? "; the others are open, accepted by the operator" : ""}.`,
|
|
267
|
+
`Checks ${checks.join("; ")}.`,
|
|
268
|
+
folded("Each criterion and the review's evidence", `| Criterion | Evidence |\n|---|---|\n${criteria.join("\n")}`),
|
|
269
|
+
].join("\n\n");
|
|
270
|
+
}
|
|
271
|
+
/** Everything needed to review the change without remembering its issue or opening the run. */
|
|
272
|
+
export function pullRequestBody(facts) {
|
|
273
|
+
const { description } = facts;
|
|
274
|
+
const { danger } = description;
|
|
275
|
+
const open = openItems(facts).length;
|
|
26
276
|
return `${[
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
277
|
+
...(open > 0
|
|
278
|
+
? [
|
|
279
|
+
`> [!WARNING]\n> **Delivered with ${plural(open, "open review finding")}**, accepted by the operator: see Needs your judgment.`,
|
|
280
|
+
]
|
|
281
|
+
: []),
|
|
282
|
+
...(danger.door === "one_way"
|
|
283
|
+
? [`> [!CAUTION]\n> **One-way door:** ${cell(danger.reason)}`]
|
|
284
|
+
: []),
|
|
285
|
+
glance(facts),
|
|
286
|
+
`## Why\n\n${inert(facts.objective.trim())}`,
|
|
287
|
+
`## What changes\n\n${description.changes.map(item).join("\n")}`,
|
|
288
|
+
`## How it works\n\n${howItWorks(description)}`,
|
|
289
|
+
`## Merge danger\n\n${mergeDanger(description)}`,
|
|
290
|
+
`## Review guide\n\n${reviewGuide(facts)}`,
|
|
291
|
+
`### Needs your judgment\n\n${judgment(facts)}`,
|
|
292
|
+
`## Evidence\n\n${evidence(facts)}`,
|
|
34
293
|
].join("\n\n")}\n`;
|
|
35
294
|
}
|
|
295
|
+
/** The danger of merging, as the terminal shows it once the pull request is open. */
|
|
296
|
+
export function mergeDangerLine({ danger }) {
|
|
297
|
+
return `Merge danger: ${danger.door === "one_way" ? "one-way" : "two-way"} door, blast radius ${danger.blastRadius}`;
|
|
298
|
+
}
|
|
36
299
|
//# sourceMappingURL=pull-request.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull-request.js","sourceRoot":"","sources":["../../src/domain/pull-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,WAAW,GAEZ,MAAM,aAAa,CAAC;AAErB,OAAO,EAAoB,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAiB9D,qEAAqE;AACrE,SAAS,IAAI,CAAC,IAAY;IACxB,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AAC/D,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,eAAe,CAAC,KAAuB;IACrD,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzC,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACnD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACxE,MAAM,MAAM,GAAG,MAAM,EAAE,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QAC5D,OAAO,KAAK,IAAI,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,MAAM,IAAI,CAAC,MAAM,EAAE,QAAQ,IAAI,EAAE,CAAC,IAAI,CAAC;IACvF,CAAC,CAAC,CAAC;IACH,MAAM,MAAM,GAAG;QACb,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CACjB,CAAC,EAAE,IAAI,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,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAChE,sBAAsB,UAAU,CAAC,WAAW,CAAC,EAAE;QAC/C,sBAAsB,WAAW,CAAC,WAAW,CAAC,EAAE;QAChD,sBAAsB,WAAW,CAAC,KAAK,CAAC,EAAE;QAC1C,8BAA8B,QAAQ,CAAC,KAAK,CAAC,EAAE;QAC/C,kBAAkB,QAAQ,CAAC,KAAK,CAAC,EAAE;KACpC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,eAAe,CAAC,EAAE,MAAM,EAAe;IACrD,OAAO,iBAAiB,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,uBAAuB,MAAM,CAAC,WAAW,EAAE,CAAC;AACvH,CAAC"}
|
package/dist/domain/review.d.ts
CHANGED
|
@@ -67,8 +67,16 @@ export declare const reviewOutput: z.ZodObject<{
|
|
|
67
67
|
file: z.ZodOptional<z.ZodString>;
|
|
68
68
|
summary: z.ZodString;
|
|
69
69
|
}, z.core.$strict>>;
|
|
70
|
+
resolved: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
71
|
+
summary: z.ZodString;
|
|
72
|
+
evidence: z.ZodString;
|
|
73
|
+
}, z.core.$strict>>>;
|
|
70
74
|
}, z.core.$strict>;
|
|
71
75
|
export type Review = z.output<typeof reviewOutput>;
|
|
72
76
|
export declare function reviewProblem(review: Review, criteria: Criterion[]): string | undefined;
|
|
73
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* The correction sent to the implementing agent, or nothing when every
|
|
79
|
+
* criterion is met and nothing blocks. Once a round of changes is needed, the
|
|
80
|
+
* findings that do not block go with it, to fix when that is safe.
|
|
81
|
+
*/
|
|
74
82
|
export declare function reviewChanges(review: Review): string | undefined;
|
package/dist/domain/review.js
CHANGED
|
@@ -53,22 +53,47 @@ export const reviewOutput = z.strictObject({
|
|
|
53
53
|
/** The trigger, then its consequence. */
|
|
54
54
|
summary: text,
|
|
55
55
|
})),
|
|
56
|
+
/**
|
|
57
|
+
* What the previous review asked for that the change now fixes, each with
|
|
58
|
+
* its proof; given when the reviewer received that review.
|
|
59
|
+
*/
|
|
60
|
+
resolved: z
|
|
61
|
+
.array(z.strictObject({ summary: text, evidence: text }))
|
|
62
|
+
.optional(),
|
|
56
63
|
});
|
|
57
64
|
export function reviewProblem(review, criteria) {
|
|
58
65
|
return citationProblem(review.criteria.map(({ id }) => id), criteria, true);
|
|
59
66
|
}
|
|
60
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* The correction sent to the implementing agent, or nothing when every
|
|
69
|
+
* criterion is met and nothing blocks. Once a round of changes is needed, the
|
|
70
|
+
* findings that do not block go with it, to fix when that is safe.
|
|
71
|
+
*/
|
|
61
72
|
export function reviewChanges(review) {
|
|
73
|
+
const where = (file) => (file ? ` (${file})` : "");
|
|
62
74
|
const changes = [
|
|
63
75
|
...review.criteria
|
|
64
76
|
.filter(({ status }) => status === "not_met")
|
|
65
77
|
.map(({ id, evidence }) => `- ${id} is not met: ${evidence}`),
|
|
66
78
|
...review.findings
|
|
67
79
|
.filter(({ nature }) => isBlocking(nature))
|
|
68
|
-
.map(({ nature, file, summary }) => `- Blocking, ${natureLabel(nature)}${
|
|
80
|
+
.map(({ nature, file, summary }) => `- Blocking, ${natureLabel(nature)}${where(file)}: ${summary}`),
|
|
69
81
|
];
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
82
|
+
if (changes.length === 0)
|
|
83
|
+
return undefined;
|
|
84
|
+
const minor = review.findings
|
|
85
|
+
.filter(({ nature }) => !isBlocking(nature))
|
|
86
|
+
.map(({ nature, file, summary }) => `- ${natureLabel(nature)}${where(file)}: ${summary}`);
|
|
87
|
+
return [
|
|
88
|
+
"The review requires changes:",
|
|
89
|
+
...changes,
|
|
90
|
+
...(minor.length > 0
|
|
91
|
+
? [
|
|
92
|
+
"",
|
|
93
|
+
"Fix these findings too when the fix is safe and stays within the spec; otherwise say why in your summary:",
|
|
94
|
+
...minor,
|
|
95
|
+
]
|
|
96
|
+
: []),
|
|
97
|
+
].join("\n");
|
|
73
98
|
}
|
|
74
99
|
//# sourceMappingURL=review.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review.js","sourceRoot":"","sources":["../../src/domain/review.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAkB,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5D,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEtC,yCAAyC;AACzC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,YAAY,CAAC;IACjD,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/D,qDAAqD;IACrD,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;CAC1B,CAAC,CAAC;AAGH,MAAM,UAAU,qBAAqB,CACnC,cAA8B,EAC9B,QAAqB;IAErB,OAAO,eAAe,CACpB,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAC3C,QAAQ,EACR,IAAI,CACL,CAAC;AACJ,CAAC;AAED,0HAA0H;AAC1H,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAiBrC,qDAAqD;AACrD,MAAM,eAAe,GAAG;IACtB,oBAAoB;IACpB,WAAW;IACX,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,gBAAgB;CACR,CAAC;AAEX;;;GAGG;AACH,MAAM,CAA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MAAM,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;aAC1C,GAAG,CACF,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAC5B,eAAe,WAAW,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,OAAO,EAAE,CACjE;KACJ,CAAC;IACF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC3C,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ;SAC1B,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;SAC3C,GAAG,CACF,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAC5B,KAAK,WAAW,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,OAAO,EAAE,CACvD,CAAC;IACJ,OAAO;QACL,8BAA8B;QAC9B,GAAG,OAAO;QACV,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;YAClB,CAAC,CAAC;gBACE,EAAE;gBACF,2GAA2G;gBAC3G,GAAG,KAAK;aACT;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** The browser command line `factory init` installs in `.factory/`, and its version. */
|
|
2
|
+
export declare const browserPackage: {
|
|
3
|
+
name: string;
|
|
4
|
+
version: string;
|
|
5
|
+
};
|
|
6
|
+
/** Where a `.factory/` installs the browser command line. */
|
|
7
|
+
export declare function installedBrowser(factoryDir: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* The browser of the run's agents, when `.factory/` installs one: a command in
|
|
10
|
+
* the run's directory that runs Playwright CLI from there. Playwright CLI keeps
|
|
11
|
+
* its sessions in the workspace of the folder it runs from, the nearest one
|
|
12
|
+
* holding `.playwright`: the run's folder holds one, so that every session the
|
|
13
|
+
* agents open, whatever its name, stays in the run's own workspace, out of the
|
|
14
|
+
* repository and away from the operator's. Its files go to the run's folder,
|
|
15
|
+
* reported by their absolute path, and it uses the browser `factory init`
|
|
16
|
+
* downloaded. It refuses `kill-all`,
|
|
17
|
+
* which ends the browsers of every workspace.
|
|
18
|
+
*/
|
|
19
|
+
export declare function runBrowser(dir: string, runDir: string): Promise<string | undefined>;
|
|
20
|
+
/**
|
|
21
|
+
* Closes every session of the run's browser, which outlives the agent that
|
|
22
|
+
* opened it; returns why it could not, if it could not.
|
|
23
|
+
*/
|
|
24
|
+
export declare function closeBrowser(command: string): Promise<string | undefined>;
|
|
25
|
+
/** Downloads the browser of the installed command line; `output` explains a failure. */
|
|
26
|
+
export declare function installBrowser(factoryDir: string): Promise<{
|
|
27
|
+
ok: boolean;
|
|
28
|
+
output: string;
|
|
29
|
+
}>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { access, chmod, mkdir, writeFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { runProcess } from "@clemrig/flow";
|
|
4
|
+
/** The browser command line `factory init` installs in `.factory/`, and its version. */
|
|
5
|
+
export const browserPackage = { name: "@playwright/cli", version: "0.1.22" };
|
|
6
|
+
/** The browser it downloads: the agents never use the machine's own. */
|
|
7
|
+
const browser = "chromium";
|
|
8
|
+
/** Where a `.factory/` installs the browser command line. */
|
|
9
|
+
export function installedBrowser(factoryDir) {
|
|
10
|
+
return join(factoryDir, "node_modules", ".bin", "playwright-cli");
|
|
11
|
+
}
|
|
12
|
+
/** A command's failure, `undefined` once it succeeded. */
|
|
13
|
+
async function attempt(command, cwd) {
|
|
14
|
+
const result = await runProcess(command, cwd, 60_000).catch((error) => ({
|
|
15
|
+
exitCode: 1,
|
|
16
|
+
stdout: "",
|
|
17
|
+
stderr: error instanceof Error ? error.message : String(error),
|
|
18
|
+
}));
|
|
19
|
+
if (result.exitCode === 0)
|
|
20
|
+
return undefined;
|
|
21
|
+
return ((result.stderr || result.stdout).trim() || `exit code ${result.exitCode}`);
|
|
22
|
+
}
|
|
23
|
+
/** A path as one word of a POSIX shell. */
|
|
24
|
+
function quoted(text) {
|
|
25
|
+
return `'${text.replaceAll("'", "'\\''")}'`;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The browser of the run's agents, when `.factory/` installs one: a command in
|
|
29
|
+
* the run's directory that runs Playwright CLI from there. Playwright CLI keeps
|
|
30
|
+
* its sessions in the workspace of the folder it runs from, the nearest one
|
|
31
|
+
* holding `.playwright`: the run's folder holds one, so that every session the
|
|
32
|
+
* agents open, whatever its name, stays in the run's own workspace, out of the
|
|
33
|
+
* repository and away from the operator's. Its files go to the run's folder,
|
|
34
|
+
* reported by their absolute path, and it uses the browser `factory init`
|
|
35
|
+
* downloaded. It refuses `kill-all`,
|
|
36
|
+
* which ends the browsers of every workspace.
|
|
37
|
+
*/
|
|
38
|
+
export async function runBrowser(dir, runDir) {
|
|
39
|
+
const cli = installedBrowser(join(dir, ".factory"));
|
|
40
|
+
if (!(await access(cli).then(() => true, () => false)))
|
|
41
|
+
return undefined;
|
|
42
|
+
const folder = join(runDir, "browser");
|
|
43
|
+
await mkdir(join(folder, ".playwright"), { recursive: true });
|
|
44
|
+
await mkdir(join(folder, "output"), { recursive: true });
|
|
45
|
+
const command = join(folder, "playwright-cli");
|
|
46
|
+
await writeFile(command, [
|
|
47
|
+
"#!/bin/sh",
|
|
48
|
+
'for arg in "$@"; do',
|
|
49
|
+
' if [ "$arg" = kill-all ]; then',
|
|
50
|
+
' echo "playwright-cli: kill-all would end the operator\'s browsers too: use close-all" >&2',
|
|
51
|
+
" exit 2",
|
|
52
|
+
" fi",
|
|
53
|
+
"done",
|
|
54
|
+
`cd ${quoted(folder)} || exit 1`,
|
|
55
|
+
`export PLAYWRIGHT_MCP_OUTPUT_DIR=${quoted(join(folder, "output"))}`,
|
|
56
|
+
// The files it reports, the agent opens from wherever it is.
|
|
57
|
+
"export PLAYWRIGHT_MCP_FILE_PATHS=absolute",
|
|
58
|
+
`export PLAYWRIGHT_MCP_BROWSER=${browser}`,
|
|
59
|
+
`exec ${quoted(cli)} "$@"`,
|
|
60
|
+
"",
|
|
61
|
+
].join("\n"));
|
|
62
|
+
await chmod(command, 0o755);
|
|
63
|
+
return command;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Closes every session of the run's browser, which outlives the agent that
|
|
67
|
+
* opened it; returns why it could not, if it could not.
|
|
68
|
+
*/
|
|
69
|
+
export function closeBrowser(command) {
|
|
70
|
+
return attempt([command, "close-all"], dirname(command));
|
|
71
|
+
}
|
|
72
|
+
/** Downloads the browser of the installed command line; `output` explains a failure. */
|
|
73
|
+
export async function installBrowser(factoryDir) {
|
|
74
|
+
const install = await runProcess([installedBrowser(factoryDir), "install-browser", browser], factoryDir, 600_000).catch((error) => ({
|
|
75
|
+
exitCode: 1,
|
|
76
|
+
stdout: "",
|
|
77
|
+
stderr: error instanceof Error ? error.message : String(error),
|
|
78
|
+
}));
|
|
79
|
+
return {
|
|
80
|
+
ok: install.exitCode === 0,
|
|
81
|
+
output: install.stderr || install.stdout,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/system/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,wFAAwF;AACxF,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,QAAQ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AU,EACV,OAAO,CACR,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC;QAC3B,QAAQ,EAAE,CAAC;QACX,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;KAC/D,CAAC,CAAC,CAAC;IACJ,OAAO;QACL,EAAE,EAAE,OAAO,CAAC,QAAQ,KAAK,CAAC;QAC1B,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM;KACzC,CAAC;AACJ,CAAC"}
|
package/dist/system/github.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
export declare function isAuthenticated(dir: string): Promise<boolean>;
|
|
2
|
+
/** The version of gh, such as `2.102.0`. */
|
|
3
|
+
export declare function version(dir: string): Promise<string>;
|
|
4
|
+
/** The repository's GitHub page, and whether anyone can see it. */
|
|
5
|
+
export declare function repository(dir: string): Promise<{
|
|
6
|
+
url: string;
|
|
7
|
+
public: boolean;
|
|
8
|
+
}>;
|
|
2
9
|
/** Updates the branch's open pull request, or opens one; returns its URL. */
|
|
3
10
|
export declare function openPullRequest(dir: string, pullRequest: {
|
|
4
11
|
base: string;
|
|
@@ -6,3 +13,11 @@ export declare function openPullRequest(dir: string, pullRequest: {
|
|
|
6
13
|
title: string;
|
|
7
14
|
body: string;
|
|
8
15
|
}): Promise<string>;
|
|
16
|
+
/** Replaces the pull request's body. */
|
|
17
|
+
export declare function editBody(dir: string, pullRequest: string, body: string): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Replaces the pull request's body, uploading the `images` of `folder` it
|
|
20
|
+
* names: gh, run there, points each reference at its upload. When some fail,
|
|
21
|
+
* gh still writes the body, with the others' references unchanged.
|
|
22
|
+
*/
|
|
23
|
+
export declare function attachImages(folder: string, pullRequest: string, body: string, images: string[]): Promise<void>;
|