@detergent-software/conductor 1.4.0-dev.1 → 1.4.0-dev.11
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/CHANGELOG.md +102 -0
- package/README.md +86 -20
- package/build/brief-cli.js +105 -23
- package/build/brief-cli.js.map +1 -1
- package/build/brief.js +107 -9
- package/build/brief.js.map +1 -1
- package/build/broker.js +40 -14
- package/build/broker.js.map +1 -1
- package/build/cli.js +49 -18
- package/build/cli.js.map +1 -1
- package/build/code-host-cli.js +46 -2
- package/build/code-host-cli.js.map +1 -1
- package/build/code-host.js +2 -0
- package/build/code-host.js.map +1 -1
- package/build/conditions.js +22 -13
- package/build/conditions.js.map +1 -1
- package/build/config.js +4 -0
- package/build/config.js.map +1 -1
- package/build/daemon.js +74 -19
- package/build/daemon.js.map +1 -1
- package/build/follow-ups.js +72 -0
- package/build/follow-ups.js.map +1 -0
- package/build/help.js +712 -208
- package/build/help.js.map +1 -1
- package/build/in-process.js +30 -0
- package/build/in-process.js.map +1 -0
- package/build/inbox.js +137 -11
- package/build/inbox.js.map +1 -1
- package/build/lib/providers/ado/code-host.js +8 -5
- package/build/lib/providers/ado/code-host.js.map +1 -1
- package/build/lib/providers/ado/pipelines.js +16 -10
- package/build/lib/providers/ado/pipelines.js.map +1 -1
- package/build/lib/providers/github/actions.js +11 -0
- package/build/lib/providers/github/actions.js.map +1 -1
- package/build/lib/providers/github/code-host.js +17 -0
- package/build/lib/providers/github/code-host.js.map +1 -1
- package/build/lib/providers/index.js +1 -1
- package/build/lib/providers/index.js.map +1 -1
- package/build/lib/providers/verdicts/pr.js +14 -12
- package/build/lib/providers/verdicts/pr.js.map +1 -1
- package/build/manager.js +116 -13
- package/build/manager.js.map +1 -1
- package/build/note.js +95 -14
- package/build/note.js.map +1 -1
- package/build/notes.js +104 -16
- package/build/notes.js.map +1 -1
- package/build/notify.js +2 -1
- package/build/notify.js.map +1 -1
- package/build/package-info.js +12 -0
- package/build/package-info.js.map +1 -0
- package/build/profile.js +64 -13
- package/build/profile.js.map +1 -1
- package/build/project-check-cli.js +85 -0
- package/build/project-check-cli.js.map +1 -0
- package/build/project-check.js +362 -0
- package/build/project-check.js.map +1 -0
- package/build/resolve.js +11 -3
- package/build/resolve.js.map +1 -1
- package/build/rule-actions.js +26 -6
- package/build/rule-actions.js.map +1 -1
- package/build/rules-service.js +33 -20
- package/build/rules-service.js.map +1 -1
- package/build/rules.js +31 -14
- package/build/rules.js.map +1 -1
- package/build/runs.js.map +1 -1
- package/build/scheduler.js +43 -1
- package/build/scheduler.js.map +1 -1
- package/build/server.js +76 -7
- package/build/server.js.map +1 -1
- package/build/spend.js +37 -4
- package/build/spend.js.map +1 -1
- package/build/store.js +42 -4
- package/build/store.js.map +1 -1
- package/build/tracker-writes.js +74 -0
- package/build/tracker-writes.js.map +1 -0
- package/build/trackers.js +20 -0
- package/build/trackers.js.map +1 -1
- package/build/watchers/ado.js +7 -1
- package/build/watchers/ado.js.map +1 -1
- package/build/watchers/boards-writes.js +182 -34
- package/build/watchers/boards-writes.js.map +1 -1
- package/build/watchers/boards.js +7 -2
- package/build/watchers/boards.js.map +1 -1
- package/build/watchers/github.js +20 -2
- package/build/watchers/github.js.map +1 -1
- package/build/watchers/index.js +32 -4
- package/build/watchers/index.js.map +1 -1
- package/build/watchers/issues-brief.js +48 -0
- package/build/watchers/issues-brief.js.map +1 -0
- package/build/watchers/issues-queue.js +85 -0
- package/build/watchers/issues-queue.js.map +1 -0
- package/build/watchers/issues-writes.js +233 -0
- package/build/watchers/issues-writes.js.map +1 -0
- package/build/watchers/issues.js +264 -0
- package/build/watchers/issues.js.map +1 -0
- package/build/watchers/linear-writes.js +198 -0
- package/build/watchers/linear-writes.js.map +1 -0
- package/build/watchers/source.js.map +1 -1
- package/build/worktrees.js +1 -0
- package/build/worktrees.js.map +1 -1
- package/mod/hooks/model.ts +11 -0
- package/mod/hooks/register.tsx +25 -3
- package/package.json +1 -1
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { repoKey, repoOf } from "./code-host.js";
|
|
5
|
+
import { TRACKER_API } from "./conditions.js";
|
|
6
|
+
import { ConductorError } from "./errors.js";
|
|
7
|
+
import { answersTo, NotFound } from "./lib/providers/index.js";
|
|
8
|
+
import { PROFILE_FILE, PROTOCOL, readProfile, releasesOf } from "./profile.js";
|
|
9
|
+
import { ciRefusal } from "./runs.js";
|
|
10
|
+
// `conduct project check <name>` (ATK-490): whether a registered project can be conducted, checked
|
|
11
|
+
// before the first launch instead of found by a failed one. Each check reads what the launch and the
|
|
12
|
+
// watchers would use, as the project's accounts; only the worktree check writes, and it removes what
|
|
13
|
+
// it made. One result per check, in this order.
|
|
14
|
+
export const CHECKS = ['profile', 'tracker', 'code-host', 'ci', 'worktree', 'skills', 'ports', 'health'];
|
|
15
|
+
const HEALTH_TIMEOUT_MS = 15_000;
|
|
16
|
+
export const checkResultSchema = z.object({
|
|
17
|
+
check: z.enum(CHECKS),
|
|
18
|
+
// What a summary line can't hold: the fields that differ, each problem, a hook's output.
|
|
19
|
+
details: z.array(z.string()),
|
|
20
|
+
// What to do about a warn or a fail.
|
|
21
|
+
fix: z.string().nullable(),
|
|
22
|
+
// skip: the check couldn't run (an earlier one left nothing to check, or --no-worktree).
|
|
23
|
+
status: z.enum(['fail', 'ok', 'skip', 'warn']),
|
|
24
|
+
summary: z.string(),
|
|
25
|
+
});
|
|
26
|
+
export const checkReportSchema = z.object({ project: z.string(), results: z.array(checkResultSchema) });
|
|
27
|
+
const ok = (summary, details = []) => ({ details, fix: null, status: 'ok', summary });
|
|
28
|
+
const warn = (summary, fix, details = []) => ({
|
|
29
|
+
details,
|
|
30
|
+
fix,
|
|
31
|
+
status: 'warn',
|
|
32
|
+
summary,
|
|
33
|
+
});
|
|
34
|
+
const fail = (summary, fix, details = []) => ({
|
|
35
|
+
details: [...details],
|
|
36
|
+
fix,
|
|
37
|
+
status: 'fail',
|
|
38
|
+
summary,
|
|
39
|
+
});
|
|
40
|
+
const skip = (summary) => ({ details: [], fix: null, status: 'skip', summary });
|
|
41
|
+
// "2 fail, 1 warn" and the like, or that every check passed.
|
|
42
|
+
export function checkCounts(report) {
|
|
43
|
+
const counts = ['fail', 'warn', 'skip']
|
|
44
|
+
.map((status) => [status, report.results.filter((r) => r.status === status).length])
|
|
45
|
+
.filter(([, n]) => n > 0)
|
|
46
|
+
.map(([status, n]) => `${n} ${status}`);
|
|
47
|
+
return counts.length === 0 ? 'every check passed' : counts.join(', ');
|
|
48
|
+
}
|
|
49
|
+
export function checkFailed(report) {
|
|
50
|
+
return report.results.some((r) => r.status === 'fail');
|
|
51
|
+
}
|
|
52
|
+
// One line per check, its details and fix under it, then the counts.
|
|
53
|
+
export function checkLines(report) {
|
|
54
|
+
const width = Math.max(...CHECKS.map((c) => c.length));
|
|
55
|
+
const lines = [`project check ${report.project}`];
|
|
56
|
+
for (const r of report.results) {
|
|
57
|
+
lines.push(` ${r.status.padEnd(4)} ${r.check.padEnd(width)} ${r.summary}`);
|
|
58
|
+
const indent = ' '.repeat(width + 10);
|
|
59
|
+
for (const detail of r.details)
|
|
60
|
+
lines.push(`${indent}${detail}`);
|
|
61
|
+
if (r.fix !== null)
|
|
62
|
+
lines.push(`${indent}fix: ${r.fix}`);
|
|
63
|
+
}
|
|
64
|
+
lines.push(checkCounts(report));
|
|
65
|
+
return lines;
|
|
66
|
+
}
|
|
67
|
+
// Runs every check, one after another. A check that throws is a fail of its own; the others still run.
|
|
68
|
+
export async function checkProject(deps, project, options) {
|
|
69
|
+
const { profile, result } = profileCheck(project);
|
|
70
|
+
const results = [{ check: 'profile', ...result }];
|
|
71
|
+
const steps = [
|
|
72
|
+
['tracker', (p) => trackerCheck(deps, p)],
|
|
73
|
+
['code-host', (p) => codeHostCheck(deps, p)],
|
|
74
|
+
['ci', (p) => ciCheck(deps, p)],
|
|
75
|
+
['worktree', (p) => worktreeCheck(deps, project.root, p, options)],
|
|
76
|
+
['skills', (p) => skillsCheck(deps, project.root, p)],
|
|
77
|
+
['ports', (p) => portsCheck(deps, p)],
|
|
78
|
+
['health', (p) => healthCheck(deps, p)],
|
|
79
|
+
];
|
|
80
|
+
for (const [check, run] of steps) {
|
|
81
|
+
if (profile === null) {
|
|
82
|
+
results.push({ check, ...skip('no profile to check: fix the profile first') });
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
let outcome;
|
|
86
|
+
try {
|
|
87
|
+
outcome = await run(profile);
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
outcome = fail(`the check failed: ${messageOf(error)}`, 'run it again; if it fails the same way, file it', [
|
|
91
|
+
...detailsOf(error),
|
|
92
|
+
]);
|
|
93
|
+
}
|
|
94
|
+
results.push({ check, ...outcome });
|
|
95
|
+
}
|
|
96
|
+
return { project: project.name, results };
|
|
97
|
+
}
|
|
98
|
+
// The dotted paths at which two profiles differ, an array counting as one value.
|
|
99
|
+
export function differences(a, b, path = '') {
|
|
100
|
+
if (isRecord(a) && isRecord(b)) {
|
|
101
|
+
const keys = [...new Set([...Object.keys(a), ...Object.keys(b)])].sort();
|
|
102
|
+
return keys.flatMap((key) => differences(a[key], b[key], path === '' ? key : `${path}.${key}`));
|
|
103
|
+
}
|
|
104
|
+
return JSON.stringify(a) === JSON.stringify(b) ? [] : [path === '' ? '(the whole profile)' : path];
|
|
105
|
+
}
|
|
106
|
+
// The check of a name no project is registered under.
|
|
107
|
+
export function noProject(name, names) {
|
|
108
|
+
return new ConductorError(`no project ${name}`, [
|
|
109
|
+
names.length > 0 ? `registered: ${names.join(', ')}` : 'register one with `conduct project add <path>`',
|
|
110
|
+
]);
|
|
111
|
+
}
|
|
112
|
+
// The profile on disk against this build's schema and the stored copy the daemon works from. The
|
|
113
|
+
// rest of the checks use the file when it reads (the daemon takes it on its next save or start),
|
|
114
|
+
// else the stored copy, else nothing.
|
|
115
|
+
export function profileCheck(project) {
|
|
116
|
+
let disk;
|
|
117
|
+
try {
|
|
118
|
+
disk = readProfile(project.root).profile;
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
return {
|
|
122
|
+
profile: project.profile,
|
|
123
|
+
result: fail(messageOf(error), `fix ${project.profilePath} and check again; until then the daemon keeps its stored copy`, detailsOf(error)),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
if (disk.name !== project.name) {
|
|
127
|
+
return {
|
|
128
|
+
profile: project.profile ?? disk,
|
|
129
|
+
result: fail(`${project.profilePath} renames the project to "${disk.name}"`, `put "name": "${project.name}" back: a project keeps the name it was registered under`),
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
if (project.profile === null) {
|
|
133
|
+
return {
|
|
134
|
+
profile: disk,
|
|
135
|
+
result: warn(`${PROFILE_FILE} is valid, but the daemon's stored copy is one this build can't read (${project.problem ?? 'unknown'})`, 'the daemon takes the file when it next starts, or on the next save of the file'),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
const changed = differences(project.profile, disk);
|
|
139
|
+
if (changed.length > 0) {
|
|
140
|
+
return {
|
|
141
|
+
profile: disk,
|
|
142
|
+
result: warn(`${PROFILE_FILE} is valid, but ${changed.length === 1 ? 'a field differs' : `${changed.length} fields differ`} from the daemon's stored copy`, 'the daemon takes the file on its next save, or when it next starts', changed),
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
return { profile: disk, result: ok(`${PROFILE_FILE} is valid (protocol ${PROTOCOL}) and matches the stored copy`) };
|
|
146
|
+
}
|
|
147
|
+
async function ciCheck(deps, profile) {
|
|
148
|
+
const repo = repoOf(profile);
|
|
149
|
+
const refusal = ciRefusal(profile, repo);
|
|
150
|
+
if (refusal !== null)
|
|
151
|
+
return fail(refusal, "set ci to the code host's own: ado-pipelines for Azure DevOps, github-actions for GitHub");
|
|
152
|
+
let pipelines;
|
|
153
|
+
try {
|
|
154
|
+
pipelines = await deps.hosts(profile.name)(repo).ci.pipelines();
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
return fail(`${profile.ci.kind} pipelines of ${repoKey(repo)} can't be listed: ${messageOf(error)}`, 'check that the account can read the pipelines', detailsOf(error));
|
|
158
|
+
}
|
|
159
|
+
const problems = [];
|
|
160
|
+
const resolved = [];
|
|
161
|
+
for (const release of releasesOf(profile)) {
|
|
162
|
+
const found = pipelines.filter((p) => answersTo(p, release.pipeline));
|
|
163
|
+
const [only] = found;
|
|
164
|
+
if (only && found.length === 1)
|
|
165
|
+
resolved.push(`${release.key} → ${only.file ?? only.name}`);
|
|
166
|
+
else if (found.length === 0)
|
|
167
|
+
problems.push(`release ${release.key}: no pipeline answers to "${release.pipeline}"`);
|
|
168
|
+
else
|
|
169
|
+
problems.push(`release ${release.key}: "${release.pipeline}" names ${found.map((p) => p.file ?? p.name).join(' and ')}`);
|
|
170
|
+
}
|
|
171
|
+
if (problems.length > 0) {
|
|
172
|
+
const known = pipelines.map((p) => p.file ?? p.name).sort();
|
|
173
|
+
return fail(problems.join('; '), `name each release's pipeline by its YAML file name, path or name, once; ${repoKey(repo)} has ${known.length > 0 ? known.join(', ') : 'none'}`);
|
|
174
|
+
}
|
|
175
|
+
const releases = resolved.length > 0 ? `; releases: ${resolved.join(', ')}` : '; no release pipelines named';
|
|
176
|
+
return ok(`${pipelines.length} ${profile.ci.kind} pipelines on ${repoKey(repo)}${releases}`);
|
|
177
|
+
}
|
|
178
|
+
async function codeHostCheck(deps, profile) {
|
|
179
|
+
const repo = repoOf(profile);
|
|
180
|
+
const { account, error } = await deps.credentials.probe(repo.host, profile.name);
|
|
181
|
+
if (error !== null)
|
|
182
|
+
return fail(`${account.label} doesn't answer: ${error}`, `sign in: ${account.command}`);
|
|
183
|
+
let tip;
|
|
184
|
+
try {
|
|
185
|
+
tip = await deps.hosts(profile.name)(repo).branchTip(profile.baseBranch);
|
|
186
|
+
}
|
|
187
|
+
catch (caught) {
|
|
188
|
+
if (caught instanceof NotFound) {
|
|
189
|
+
return fail(`${repoKey(repo)} is not there, or ${account.label} can't see it`, 'check codeHost: the organization, project and repository, or the owner and repo', [caught.message]);
|
|
190
|
+
}
|
|
191
|
+
return fail(`${repoKey(repo)} can't be read: ${messageOf(caught)}`, 'check again; if it persists, check the account', detailsOf(caught));
|
|
192
|
+
}
|
|
193
|
+
if (tip === null)
|
|
194
|
+
return fail(`${repoKey(repo)} has no branch ${profile.baseBranch}`, "set baseBranch to the repo's base");
|
|
195
|
+
return ok(`${repoKey(repo)} answers as ${account.label}; ${profile.baseBranch} is at ${tip.slice(0, 7)}`);
|
|
196
|
+
}
|
|
197
|
+
// A worker skill says which worker protocol it speaks in its SKILL.md ("worker protocol v1").
|
|
198
|
+
function declaresProtocol(skill) {
|
|
199
|
+
return new RegExp(`worker protocol v?${PROTOCOL}\\b`, 'i').test(skill);
|
|
200
|
+
}
|
|
201
|
+
function detailsOf(error) {
|
|
202
|
+
return error instanceof ConductorError ? error.details : [];
|
|
203
|
+
}
|
|
204
|
+
async function healthCheck(deps, profile) {
|
|
205
|
+
const urls = Object.entries(profile.health ?? {});
|
|
206
|
+
if (urls.length === 0)
|
|
207
|
+
return ok('no health URLs in the profile');
|
|
208
|
+
const fetcher = deps.fetch ?? globalThis.fetch;
|
|
209
|
+
const answers = await Promise.all(urls.map(async ([env, url]) => {
|
|
210
|
+
try {
|
|
211
|
+
const response = await fetcher(url, { signal: AbortSignal.timeout(HEALTH_TIMEOUT_MS) });
|
|
212
|
+
await response.body?.cancel();
|
|
213
|
+
return response.ok ? null : `${env}: ${url} answered ${response.status}`;
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
return `${env}: ${url} didn't answer (${messageOf(error)})`;
|
|
217
|
+
}
|
|
218
|
+
}));
|
|
219
|
+
const problems = answers.filter((a) => a !== null);
|
|
220
|
+
if (problems.length > 0) {
|
|
221
|
+
return warn(`${problems.length} of ${urls.length} health URLs don't answer`, 'only `conduct wait health` needs them: check the environment, or its URL in health', problems);
|
|
222
|
+
}
|
|
223
|
+
return ok(`${urls.map(([env]) => env).join(', ')} answer`);
|
|
224
|
+
}
|
|
225
|
+
function isRecord(value) {
|
|
226
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
227
|
+
}
|
|
228
|
+
function messageOf(error) {
|
|
229
|
+
return error instanceof Error ? error.message : String(error);
|
|
230
|
+
}
|
|
231
|
+
async function portsCheck(deps, profile) {
|
|
232
|
+
try {
|
|
233
|
+
const { ports, slot } = await deps.ports.previewPorts(profile);
|
|
234
|
+
const named = Object.entries(ports)
|
|
235
|
+
.map(([name, port]) => `${name} ${port}`)
|
|
236
|
+
.join(', ');
|
|
237
|
+
return ok(`a new worktree gets slot ${slot} (${named}), of 1 to ${profile.ports.maxSlot}`);
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
if (!(error instanceof ConductorError))
|
|
241
|
+
throw error;
|
|
242
|
+
return fail(error.message, error.details[0] ?? '`conduct ports` lists the assignments');
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function readInstalledSkill(root, name) {
|
|
246
|
+
try {
|
|
247
|
+
return readFileSync(join(root, '.claude', 'skills', name, 'SKILL.md'), 'utf8');
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
// The main checkout's skills, read-only: the worktree hooks copy them into each worker's worktree.
|
|
254
|
+
async function skillsCheck(deps, root, profile) {
|
|
255
|
+
const read = deps.readSkill ?? readInstalledSkill;
|
|
256
|
+
const { aliases, verify, work } = profile.skills;
|
|
257
|
+
const problems = [];
|
|
258
|
+
const installed = [];
|
|
259
|
+
const workSkill = read(root, work);
|
|
260
|
+
if (workSkill === null)
|
|
261
|
+
problems.push(`the work skill ${work} isn't installed`);
|
|
262
|
+
else {
|
|
263
|
+
installed.push(work);
|
|
264
|
+
if (!declaresProtocol(workSkill))
|
|
265
|
+
problems.push(`${work} doesn't declare worker protocol v${PROTOCOL}`);
|
|
266
|
+
}
|
|
267
|
+
if (read(root, verify) === null)
|
|
268
|
+
problems.push(`the verify skill ${verify} isn't installed`);
|
|
269
|
+
else
|
|
270
|
+
installed.push(verify);
|
|
271
|
+
const missing = aliases.filter((alias) => read(root, alias) === null);
|
|
272
|
+
// Only the installed ones: a missing one is said once, above.
|
|
273
|
+
const stale = installed.length > 0 ? await deps.worktrees.auditSkills(root, installed) : null;
|
|
274
|
+
// An audit that couldn't run carries atk's output, JSON over several lines: one line here.
|
|
275
|
+
if (stale !== null && stale.length > 0)
|
|
276
|
+
problems.push(`atk audit: ${stale.join(', ').replace(/\s+/g, ' ')}`);
|
|
277
|
+
if (problems.length > 0) {
|
|
278
|
+
return fail(problems.join('; '), `atk install in ${root}, or set skills.work and skills.verify to the installed skills' names`);
|
|
279
|
+
}
|
|
280
|
+
const audited = stale === null ? '' : ', matching .atk-lock.json';
|
|
281
|
+
const summary = `${work} (worker protocol v${PROTOCOL}) and ${verify} are installed${audited}`;
|
|
282
|
+
if (missing.length > 0) {
|
|
283
|
+
return warn(`${summary}; the alias ${missing.join(', ')} isn't`, 'notes under an alias still count; install it only for launchers that call it (atk install), or drop it from skills.aliases once no item in flight uses it');
|
|
284
|
+
}
|
|
285
|
+
return ok(`${summary}${aliases.length > 0 ? `, as is ${aliases.join(', ')}` : ''}`);
|
|
286
|
+
}
|
|
287
|
+
// A timestamp safe in a worktree and branch name.
|
|
288
|
+
// To the millisecond, so two checks started together get worktrees of their own.
|
|
289
|
+
function stamp(at) {
|
|
290
|
+
return at.toISOString().replace(/\D/g, '').slice(0, 17);
|
|
291
|
+
}
|
|
292
|
+
async function trackerCheck(deps, profile) {
|
|
293
|
+
const { tracker } = profile;
|
|
294
|
+
const { account, error } = await deps.credentials.probe(TRACKER_API[tracker.kind], profile.name);
|
|
295
|
+
if (error !== null)
|
|
296
|
+
return fail(`${account.label} doesn't answer: ${error}`, `sign in: ${account.command}`);
|
|
297
|
+
const where = tracker.kind === 'linear'
|
|
298
|
+
? `Linear team ${tracker.team}`
|
|
299
|
+
: tracker.kind === 'ado-boards'
|
|
300
|
+
? `the Boards query "${tracker.query}"`
|
|
301
|
+
: `the issues labelled ${tracker.queueLabel}`;
|
|
302
|
+
let snapshot;
|
|
303
|
+
try {
|
|
304
|
+
// In the daemon, within the budget its scheduler reads the tracker in.
|
|
305
|
+
snapshot = await deps.queue.read(profile, [], deps.budget?.(profile) ?? { take: () => true });
|
|
306
|
+
}
|
|
307
|
+
catch (caught) {
|
|
308
|
+
const fix = tracker.kind === 'linear'
|
|
309
|
+
? `check tracker.team: "${tracker.team}" must be the key of a Linear team ${account.label} can see`
|
|
310
|
+
: tracker.kind === 'ado-boards'
|
|
311
|
+
? `check tracker.query: "${tracker.query}" must be a saved WIQL query ${account.label} can run`
|
|
312
|
+
: `check the issues' repo (tracker.owner and repo, or the code host's) and that ${account.label} can read it`;
|
|
313
|
+
return fail(`${where} can't be read: ${messageOf(caught)}`, fix, detailsOf(caught));
|
|
314
|
+
}
|
|
315
|
+
const items = `${snapshot.issues.length} open ${snapshot.issues.length === 1 ? 'item' : 'items'}`;
|
|
316
|
+
if (tracker.kind !== 'linear')
|
|
317
|
+
return ok(`${where} lists ${items}, as ${account.label}`);
|
|
318
|
+
// Linear filters by the team's key, so a key no team has reads as a team with nothing.
|
|
319
|
+
if (snapshot.projects.length === 0 && snapshot.issues.length === 0) {
|
|
320
|
+
return fail(`${where} has no projects and no open items`, `check tracker.team: "${tracker.team}" must be the key of a Linear team ${account.label} can see`);
|
|
321
|
+
}
|
|
322
|
+
if (snapshot.areaLabels.length === 0) {
|
|
323
|
+
return warn(`${where} lists ${items}, but no label sits under the Area group "${tracker.areaLabelGroup}"`, "check tracker.areaLabelGroup: the scheduler keeps one item per Area, and with no Areas it can't tell them apart");
|
|
324
|
+
}
|
|
325
|
+
const prioritized = snapshot.projects.filter((p) => p.priority !== null && p.priority > 0).length;
|
|
326
|
+
if (prioritized === 0) {
|
|
327
|
+
return warn(`${where} lists ${items}, but none of its projects has a priority, so nothing is conducted`, 'give the Linear projects to conduct a priority');
|
|
328
|
+
}
|
|
329
|
+
return ok(`${where} lists ${items}, and ${prioritized} of its projects have a priority, as ${account.label}`);
|
|
330
|
+
}
|
|
331
|
+
// The launch's first two stages on a throwaway worktree (manager.ts launchWorker): the project's
|
|
332
|
+
// create hook, then the skills check. Whatever it made is removed, whichever way it went.
|
|
333
|
+
async function worktreeCheck(deps, root, profile, options) {
|
|
334
|
+
if (!options.worktree)
|
|
335
|
+
return skip('--no-worktree');
|
|
336
|
+
const name = `conduct-check-${stamp((deps.now ?? (() => new Date()))())}`;
|
|
337
|
+
let path = null;
|
|
338
|
+
let outcome;
|
|
339
|
+
try {
|
|
340
|
+
path = await deps.worktrees.create(root, name);
|
|
341
|
+
const problem = await deps.worktrees.checkSkills(path, [profile.skills.work, profile.skills.verify]);
|
|
342
|
+
outcome =
|
|
343
|
+
problem === null
|
|
344
|
+
? ok(`the worktree hooks created and removed ${name}, and its skills match`)
|
|
345
|
+
: fail(`a new worktree's skills: ${problem}`, `atk install in ${root}, then commit .atk-lock.json if it changed`);
|
|
346
|
+
}
|
|
347
|
+
catch (error) {
|
|
348
|
+
outcome = fail(`the worktree hooks couldn't create a worktree: ${messageOf(error)}`, `the project needs the ATK worktree-kit bundle (/worktree-setup); its hook output is above. If the hook made the branch worktree-${name} first, delete it: git -C ${root} branch -D worktree-${name}`, detailsOf(error));
|
|
349
|
+
}
|
|
350
|
+
// A create that failed part way can leave its directory behind.
|
|
351
|
+
const left = path ?? join(root, '.claude', 'worktrees', name);
|
|
352
|
+
if (path !== null || existsSync(left)) {
|
|
353
|
+
try {
|
|
354
|
+
await deps.worktrees.remove(root, left);
|
|
355
|
+
}
|
|
356
|
+
catch (error) {
|
|
357
|
+
return fail(`${left} is still there: ${messageOf(error)}`, `remove it by hand: git -C ${root} worktree remove --force ${left}, then git -C ${root} branch -D worktree-${name}`, [`before that: ${outcome.status} ${outcome.summary}`, ...detailsOf(error)]);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return outcome;
|
|
361
|
+
}
|
|
362
|
+
//# sourceMappingURL=project-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-check.js","sourceRoot":"","sources":["../src/project-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,OAAO,EAAiB,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAgB,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,mGAAmG;AACnG,qGAAqG;AACrG,qGAAqG;AACrG,gDAAgD;AAEhD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AAGlH,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAEjC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;IACrB,yFAAyF;IACzF,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC5B,qCAAqC;IACrC,GAAG,EAA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,CAAC,KAAK,CAAC,EAAE,EACpE,mIAAmI,IAAI,6BAA6B,IAAI,uBAAuB,IAAI,EAAE,EACrM,SAAS,CAAC,KAAK,CAAC,CACjB,CAAC;IACJ,CAAC;IACD,gEAAgE;IAChE,MAAM,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;IAC9D,IAAI,IAAI,KAAK,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CACT,GAAG,IAAI,oBAAoB,SAAS,CAAC,KAAK,CAAC,EAAE,EAC7C,6BAA6B,IAAI,4BAA4B,IAAI,iBAAiB,IAAI,uBAAuB,IAAI,EAAE,EACnH,CAAC,gBAAgB,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE,EAAE,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAC3E,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/build/resolve.js
CHANGED
|
@@ -3,8 +3,9 @@ import { ACTIVE_STATUSES } from "./store.js";
|
|
|
3
3
|
// The one way a wait resolves, whoever saw its condition (the clock in the manager's sweep, or a
|
|
4
4
|
// watcher): the wait is closed with a factual line and a `wait.resolved` event records it. The
|
|
5
5
|
// sweep then parks or resumes the worker. Null when nobody is left to wake (a retired worker) or
|
|
6
|
-
// the wait was resolved meanwhile.
|
|
7
|
-
|
|
6
|
+
// the wait was resolved meanwhile. `facts` go on the event beside the line, such as a PR's settled
|
|
7
|
+
// checks (`checks: passed`), so readers needn't parse the line.
|
|
8
|
+
export function resolveOpenWait(store, wait, resolution, facts = {}) {
|
|
8
9
|
const worker = store.getWorker(wait.worker);
|
|
9
10
|
if (!worker || !ACTIVE_STATUSES.includes(worker.status))
|
|
10
11
|
return null;
|
|
@@ -18,7 +19,14 @@ export function resolveOpenWait(store, wait, resolution) {
|
|
|
18
19
|
throw error;
|
|
19
20
|
}
|
|
20
21
|
store.appendEvent({
|
|
21
|
-
data: {
|
|
22
|
+
data: {
|
|
23
|
+
...facts,
|
|
24
|
+
condition: resolved.condition,
|
|
25
|
+
name: worker.name,
|
|
26
|
+
resolution,
|
|
27
|
+
wait: resolved.id,
|
|
28
|
+
worker: worker.id,
|
|
29
|
+
},
|
|
22
30
|
kind: 'wait.resolved',
|
|
23
31
|
project: worker.project,
|
|
24
32
|
subject: worker.item,
|
package/build/resolve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAyB,MAAM,YAAY,CAAC;AAEpE,iGAAiG;AACjG,+FAA+F;AAC/F,iGAAiG;AACjG,
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAyB,MAAM,YAAY,CAAC;AAEpE,iGAAiG;AACjG,+FAA+F;AAC/F,iGAAiG;AACjG,mGAAmG;AACnG,gEAAgE;AAChE,MAAM,UAAU,eAAe,CAC7B,KAAY,EACZ,IAAU,EACV,UAAkB,EAClB,QAAiC,EAAE;IAEnC,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IACrE,IAAI,QAAc,CAAC;IACnB,IAAI,CAAC;QACH,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IACpD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,cAAc;YAAE,OAAO,IAAI,CAAC;QACjD,MAAM,KAAK,CAAC;IACd,CAAC;IACD,KAAK,CAAC,WAAW,CAAC;QAChB,IAAI,EAAE;YACJ,GAAG,KAAK;YACR,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,UAAU;YACV,IAAI,EAAE,QAAQ,CAAC,EAAE;YACjB,MAAM,EAAE,MAAM,CAAC,EAAE;SAClB;QACD,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,OAAO,EAAE,MAAM,CAAC,IAAI;KACrB,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/build/rule-actions.js
CHANGED
|
@@ -104,6 +104,7 @@ export function ruleActions(deps) {
|
|
|
104
104
|
return {};
|
|
105
105
|
const spend = facts.spend.byWorker.get(worker.id) ?? 0;
|
|
106
106
|
return {
|
|
107
|
+
...(worker.context === null ? {} : { 'worker.context': worker.context }),
|
|
107
108
|
...(worker.phase === null ? {} : { 'worker.phase': worker.phase }),
|
|
108
109
|
'spend.worker': spend,
|
|
109
110
|
'worker.retries': retriesOf(worker, facts),
|
|
@@ -167,6 +168,15 @@ export function ruleActions(deps) {
|
|
|
167
168
|
target,
|
|
168
169
|
};
|
|
169
170
|
}
|
|
171
|
+
case 'pr.checks-failed': {
|
|
172
|
+
// A PR's required checks failed: its worker's failed run.
|
|
173
|
+
const data = waitData.safeParse(event.data).data;
|
|
174
|
+
const wait = data ? store.getWait(data.wait) : null;
|
|
175
|
+
if (!data || !wait)
|
|
176
|
+
return null;
|
|
177
|
+
const target = { ...targetOf(event, worker(data.worker)), wait };
|
|
178
|
+
return { events: ['run.failed'], fields: base(target, facts), target };
|
|
179
|
+
}
|
|
170
180
|
case 'provider.login-failed': {
|
|
171
181
|
const target = targetOf(event, null);
|
|
172
182
|
return { events: ['provider.login-failed'], fields: base(target, facts), target };
|
|
@@ -203,6 +213,15 @@ export function ruleActions(deps) {
|
|
|
203
213
|
: ['worker.idle'];
|
|
204
214
|
return { events, fields: base(target, facts), target };
|
|
205
215
|
}
|
|
216
|
+
case 'worker.parked': {
|
|
217
|
+
// A rule may notify or label on a park; `compact` is the session manager's, which asks the
|
|
218
|
+
// rules of each parked worker itself.
|
|
219
|
+
const data = workerData.safeParse(event.data).data;
|
|
220
|
+
const target = targetOf(event, worker(data?.worker));
|
|
221
|
+
if (!target.worker)
|
|
222
|
+
return null;
|
|
223
|
+
return { events: ['worker.parked'], fields: base(target, facts), target };
|
|
224
|
+
}
|
|
206
225
|
default:
|
|
207
226
|
return null;
|
|
208
227
|
}
|
|
@@ -284,6 +303,12 @@ export function ruleActions(deps) {
|
|
|
284
303
|
const pushed = await notifier.announce({ kind: 'plan' }, { item: target.item, project: target.project, text }, by);
|
|
285
304
|
return `auto-approves ${target.item}'s plan at ${when}${pushed === null ? '' : ` (not pushed: ${pushed})`}`;
|
|
286
305
|
}
|
|
306
|
+
case 'compact':
|
|
307
|
+
case 'none':
|
|
308
|
+
case 'park':
|
|
309
|
+
case 'resume':
|
|
310
|
+
case 'retire':
|
|
311
|
+
return `${action.verb} is the scheduler's and the session manager's`;
|
|
287
312
|
case 'escalate':
|
|
288
313
|
store.appendEvent({
|
|
289
314
|
data: { cause: fired.id, text: action.text },
|
|
@@ -349,11 +374,6 @@ export function ruleActions(deps) {
|
|
|
349
374
|
return `scheduler.mode ${deps.mode}: not done (it launches nothing)`;
|
|
350
375
|
deps.scheduler.nudge();
|
|
351
376
|
return 'the scheduler picks it if slots, Areas, blockers, quiet hours and pauses allow';
|
|
352
|
-
case 'none':
|
|
353
|
-
case 'park':
|
|
354
|
-
case 'resume':
|
|
355
|
-
case 'retire':
|
|
356
|
-
return `${action.verb} is the scheduler's and the session manager's`;
|
|
357
377
|
case 'notify': {
|
|
358
378
|
const why = await notifier.announce(action.channel, {
|
|
359
379
|
item: target.item,
|
|
@@ -445,7 +465,7 @@ export function ruleActions(deps) {
|
|
|
445
465
|
// rules changed since (by its ref, as it was).
|
|
446
466
|
const now = event.kind === 'note.posted' ? noteData.safeParse(event.data).data?.autoApprove : undefined;
|
|
447
467
|
for (const { action, rule } of fired) {
|
|
448
|
-
if (['launch', 'none', 'park', 'resume', 'retire'].includes(action.verb) &&
|
|
468
|
+
if (['compact', 'launch', 'none', 'park', 'resume', 'retire'].includes(action.verb) &&
|
|
449
469
|
!(action.verb === 'launch' && found.events.includes('item.unblocked')))
|
|
450
470
|
continue;
|
|
451
471
|
if (action.verb === 'auto-approve' && (now !== undefined || action.afterMinutes === 0))
|