@miroshnik/elves 2026.1027.1 → 2026.1029.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/AGENTS.md +3 -2
- package/bin/elves.ts +19 -4
- package/dist/github/scripts/github.js +86 -28
- package/dist/spec/scripts/architecture.js +2 -2
- package/dist/spec/scripts/{harness-91h1qpb5.js → harness-1rfkbdbn.js} +33 -9
- package/dist/spec/scripts/{harness-whad9qej.js → harness-dms3b7ke.js} +1 -1
- package/dist/spec/scripts/harness.js +1 -1
- package/docs/cloud-sessions.md +3 -2
- package/docs/testing.md +1 -1
- package/package.json +2 -2
- package/skills/github/SKILL.md +2 -2
- package/skills/github/locales/en.json +4 -4
- package/skills/github/locales/ru.json +4 -4
- package/skills/github/reference.md +25 -9
- package/skills/github/scripts/github.ts +122 -34
- package/skills/github/scripts/locale.ts +30 -1
- package/skills/slot/SKILL.md +55 -4
- package/skills/slot/scripts/slot.ts +366 -20
- package/skills/spec/scripts/spec-diff.ts +14 -31
package/AGENTS.md
CHANGED
|
@@ -123,8 +123,9 @@ done. The session can be closed.` · `All done, but there are questions: …` ·
|
|
|
123
123
|
(scope, not merges outside auto) — any session, its task stays; one started
|
|
124
124
|
for it — in the project folder, not a worktree: executors start from `main`.
|
|
125
125
|
`github task queue` prints executors' prompts; an executor — a background
|
|
126
|
-
subagent (own worktree) or a cloud session: at most
|
|
127
|
-
sessions at once, the owner's number replaces
|
|
126
|
+
subagent (own worktree) or a cloud session: at most the machine's executors
|
|
127
|
+
in subagents and 5 cloud sessions at once, the owner's number replaces
|
|
128
|
+
either (`task queue` names the executors, `slot`'s `machine.json` sets them); failed — a task
|
|
128
129
|
comment, no restart; an executor session whose task closed — the dispatcher
|
|
129
130
|
archives it in an auto project, not one still working in the background or
|
|
130
131
|
awaiting the owner's answer; outside auto the owner closes it. A batch
|
package/bin/elves.ts
CHANGED
|
@@ -84,6 +84,7 @@ import { fileURLToPath } from "node:url";
|
|
|
84
84
|
import { packageManager, specRoots } from "../skills/github/scripts/github.ts";
|
|
85
85
|
import locale from "../skills/github/scripts/locale.ts";
|
|
86
86
|
import { PACKAGE_BUNX, PACKAGE_RUN, packageRun } from "../skills/spec/scripts/package-run.ts";
|
|
87
|
+
import { machineCapacity } from "../skills/slot/scripts/slot.ts";
|
|
87
88
|
import { COMPOSE_FILES, proxyName } from "../skills/task-env/scripts/task-env.ts";
|
|
88
89
|
|
|
89
90
|
const SRC = fileURLToPath(new URL("..", import.meta.url)).replace(/\/$/, "");
|
|
@@ -2207,14 +2208,28 @@ function agentShellLines(): string[] {
|
|
|
2207
2208
|
}
|
|
2208
2209
|
|
|
2209
2210
|
/**
|
|
2210
|
-
* The
|
|
2211
|
-
*
|
|
2212
|
-
*
|
|
2211
|
+
* The machine's capacity (the slot skill, #779): heavy runs at once and the dispatcher's executors, and where they come
|
|
2212
|
+
* from — machine.json of the personal configuration or the cores and memory; a value machine.json gets wrong — its line.
|
|
2213
|
+
* Information, not the flow falling behind: it doesn't change the check's code.
|
|
2214
|
+
*/
|
|
2215
|
+
function capacityLines(): string[] {
|
|
2216
|
+
const c = machineCapacity();
|
|
2217
|
+
const set = c.from.slots === "machine.json" || c.from.executors === "machine.json";
|
|
2218
|
+
return [
|
|
2219
|
+
` machine: slots ${c.slots} (${c.from.slots}), executors ${c.executors} (${c.from.executors})${set ? "" : " — ~/.config/elves/machine.json replaces them"}`,
|
|
2220
|
+
...c.warnings.map((w) => ` ${w}`),
|
|
2221
|
+
];
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
/**
|
|
2225
|
+
* The check's result plus the machine's lines, installed or not, behind or not: the capacity (`capacityLines`), the
|
|
2226
|
+
* proxy (`proxyLines`), the agent's Bash environment — the hook passes what writing it gave, `check -g` asks
|
|
2227
|
+
* `agentShellLines` — and Claude Code's prompt cache TTL (`cacheTtlLines`).
|
|
2213
2228
|
*/
|
|
2214
2229
|
function withMachine(global: boolean, r: Result, shell = agentShellLines()): Result {
|
|
2215
2230
|
if (!global || r.absent) return r;
|
|
2216
2231
|
const ttl = cacheTtlLines(os.homedir());
|
|
2217
|
-
const lines = [...proxyLines(os.homedir()), ...shell, ...ttl];
|
|
2232
|
+
const lines = [...capacityLines(), ...proxyLines(os.homedir()), ...shell, ...ttl];
|
|
2218
2233
|
return lines.length ? { ...r, text: [r.text, ...lines].join("\n"), ...(ttl.length ? { ttl: true } : {}) } : r;
|
|
2219
2234
|
}
|
|
2220
2235
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import {
|
|
3
3
|
locale_default
|
|
4
|
-
} from "../../spec/scripts/harness-
|
|
4
|
+
} from "../../spec/scripts/harness-1rfkbdbn.js";
|
|
5
5
|
|
|
6
6
|
// skills/github/scripts/github.ts
|
|
7
7
|
import { spawnSync } from "node:child_process";
|
|
@@ -1726,16 +1726,6 @@ function projectChecked(io, slug) {
|
|
|
1726
1726
|
}
|
|
1727
1727
|
return true;
|
|
1728
1728
|
}
|
|
1729
|
-
function scenarioItems(body, heading) {
|
|
1730
|
-
const lines = body.replace(/\r\n/g, `
|
|
1731
|
-
`).split(`
|
|
1732
|
-
`);
|
|
1733
|
-
const start = lines.findIndex((l) => l.trim().toLowerCase() === heading.toLowerCase());
|
|
1734
|
-
if (start < 0)
|
|
1735
|
-
return null;
|
|
1736
|
-
const end = lines.findIndex((l, k) => k > start && /^#{1,2}\s/.test(l));
|
|
1737
|
-
return lines.slice(start + 1, end < 0 ? undefined : end).map((l) => /^\s*\d+[.)]\s+(.+)$/.exec(l)?.[1]?.trim()).filter((x) => Boolean(x));
|
|
1738
|
-
}
|
|
1739
1729
|
function cmdTaskStart(io, slug, number, branch, resume = false) {
|
|
1740
1730
|
if (resume && branch !== undefined)
|
|
1741
1731
|
throw new GhError(`--resume continues the task's existing branch — without --branch`);
|
|
@@ -1773,7 +1763,7 @@ function cmdTaskStart(io, slug, number, branch, resume = false) {
|
|
|
1773
1763
|
if (!t.estimate && type)
|
|
1774
1764
|
runEstimate(io, slug, number, type);
|
|
1775
1765
|
const now = git(io, io.cwd, "branch", "--show-current").stdout.trim();
|
|
1776
|
-
const scenarios = scenarioItems(t.body
|
|
1766
|
+
const scenarios = locale_default.scenarioItems(t.body);
|
|
1777
1767
|
io.out(`Next: the session name — «#${number} ${t.title}»`);
|
|
1778
1768
|
if (resume && !here)
|
|
1779
1769
|
io.out(`Branch: continue ${parallel.join(", ")} — checked out in another worktree (git worktree list): work in that one; in none — git switch it here`);
|
|
@@ -2159,6 +2149,20 @@ function cmdTaskEdit(io, slug, number, edits) {
|
|
|
2159
2149
|
return 0;
|
|
2160
2150
|
}
|
|
2161
2151
|
var QUEUE_EXECUTORS = 3;
|
|
2152
|
+
var slotScript = (io) => io.env["ELVES_SLOT_SCRIPT"] ?? path.resolve(import.meta.dir, "../../slot/scripts/slot.ts");
|
|
2153
|
+
function queueExecutors(io) {
|
|
2154
|
+
const script = slotScript(io);
|
|
2155
|
+
if (!existsSync(script))
|
|
2156
|
+
return { n: QUEUE_EXECUTORS, from: "no slot skill" };
|
|
2157
|
+
const env = Object.fromEntries(Object.entries(io.env).filter((e) => e[1] !== undefined));
|
|
2158
|
+
const r = (io.run ?? realRun)("bun", ["--no-env-file", script, "--capacity"], io.cwd, env);
|
|
2159
|
+
try {
|
|
2160
|
+
const c = JSON.parse(r.stdout);
|
|
2161
|
+
if (Number.isInteger(c.executors) && c.executors > 0)
|
|
2162
|
+
return { n: c.executors, from: c.from.executors };
|
|
2163
|
+
} catch {}
|
|
2164
|
+
return { n: QUEUE_EXECUTORS, from: `slot --capacity: ${why(r)}` };
|
|
2165
|
+
}
|
|
2162
2166
|
var priorityRank = (p) => PRIORITIES.indexOf(p ?? DEFAULT_PRIORITY);
|
|
2163
2167
|
function externalBlocker(io, slug, number, label) {
|
|
2164
2168
|
const marks = locale_default.every((n) => n.comments.externalBlocker);
|
|
@@ -2224,6 +2228,7 @@ function cmdTaskQueue(io, slug, o) {
|
|
|
2224
2228
|
if (o.epic !== undefined && o.tasks !== undefined)
|
|
2225
2229
|
throw new GhError("--epic or --tasks, not both: the group is the epic's open tasks or the ones named");
|
|
2226
2230
|
let numbers;
|
|
2231
|
+
let subs = null;
|
|
2227
2232
|
if (o.tasks !== undefined) {
|
|
2228
2233
|
if (!o.tasks.length)
|
|
2229
2234
|
throw new GhError("--tasks: the group's task numbers, comma-separated — --tasks 47,49");
|
|
@@ -2235,12 +2240,18 @@ function cmdTaskQueue(io, slug, o) {
|
|
|
2235
2240
|
if (epic.state !== "OPEN")
|
|
2236
2241
|
throw new GhError(`epic #${o.epic} is closed`);
|
|
2237
2242
|
numbers = epic.subIssues.filter((x) => x.state === "OPEN").map((x) => x.number);
|
|
2243
|
+
subs = new Set(epic.subIssues.map((x) => x.number));
|
|
2238
2244
|
} else {
|
|
2239
2245
|
const found = graphql(io, Q.IssueSearch, { q: `repo:${slug} is:issue is:open` }).search.nodes;
|
|
2240
2246
|
if (found.length >= 100)
|
|
2241
2247
|
io.out("○ the search gave 100 open tasks — the queue sees only them: narrow it with --epic");
|
|
2242
2248
|
numbers = found.filter((x) => x?.state === "OPEN").map((x) => x.number);
|
|
2243
2249
|
}
|
|
2250
|
+
const handed = handedOut(io, slug);
|
|
2251
|
+
if (o.tasks === undefined) {
|
|
2252
|
+
numbers = [...new Set([...numbers, ...handed.filter((h) => subs === null || subs.has(h.number)).map((h) => h.number)])];
|
|
2253
|
+
}
|
|
2254
|
+
const awaiting = awaitingCloseOf(io, slug, handed);
|
|
2244
2255
|
const recent = recentPrs(io, slug);
|
|
2245
2256
|
const openPr = openPrOf(io, slug, recent);
|
|
2246
2257
|
const args = [o.epic !== undefined && `--epic ${o.epic}`, o.tasks !== undefined && `--tasks ${numbers.join(",")}`, o.type !== undefined && `--type ${o.type}`, o.priority?.length && `--priority ${o.priority.join(",")}`].filter(Boolean).join(" ");
|
|
@@ -2256,7 +2267,6 @@ function cmdTaskQueue(io, slug, o) {
|
|
|
2256
2267
|
const pastBatch = (i) => prsOf(i).some((p) => (p.state === "OPEN" || p.merged) && p.base !== batch);
|
|
2257
2268
|
const release = batch === null ? undefined : releasePrOf(recent, batch);
|
|
2258
2269
|
const releasing = release?.state === "OPEN" ? release.number : null;
|
|
2259
|
-
const handed = handedOut(io, slug);
|
|
2260
2270
|
const states = new Map;
|
|
2261
2271
|
const read = openOf(io, slug);
|
|
2262
2272
|
const isOpen = (n) => states.has(n) ? states.get(n) === "OPEN" : read(n);
|
|
@@ -2269,7 +2279,8 @@ function cmdTaskQueue(io, slug, o) {
|
|
|
2269
2279
|
for (const n of numbers.sort((a, b) => a - b)) {
|
|
2270
2280
|
const i = loadIssue(io, slug, n);
|
|
2271
2281
|
states.set(i.number, i.state);
|
|
2272
|
-
|
|
2282
|
+
const closer = i.state === "OPEN" ? null : awaiting(i.number, i);
|
|
2283
|
+
if (i.state !== "OPEN" && closer === null)
|
|
2273
2284
|
continue;
|
|
2274
2285
|
const label = `#${i.number} ${q(i.title)}`;
|
|
2275
2286
|
if (isEpic(i, org)) {
|
|
@@ -2284,7 +2295,8 @@ function cmdTaskQueue(io, slug, o) {
|
|
|
2284
2295
|
const pr = openPr(i);
|
|
2285
2296
|
const merged = inBatch?.(i.number, i.prs);
|
|
2286
2297
|
const work = [
|
|
2287
|
-
|
|
2298
|
+
closer === null ? "" : `PR #${closer} merged and closed the issue — waits for the deploy and task close`,
|
|
2299
|
+
closer === null && status === N.status.inProgress ? q(N.status.inProgress) : "",
|
|
2288
2300
|
pr === undefined ? "" : `open PR #${pr} https://github.com/${slug}/pull/${pr}`,
|
|
2289
2301
|
merged === undefined ? "" : `PR #${merged} merged into ${batch} — the task closes with the batch's release`
|
|
2290
2302
|
].filter(Boolean);
|
|
@@ -2310,7 +2322,11 @@ function cmdTaskQueue(io, slug, o) {
|
|
|
2310
2322
|
continue;
|
|
2311
2323
|
}
|
|
2312
2324
|
const batched = (b) => inBatch !== null && b.repo.toLowerCase() === slug.toLowerCase() && inBatch(b.number) !== undefined;
|
|
2313
|
-
const
|
|
2325
|
+
const unclosed = (b) => b.state !== "OPEN" && b.repo.toLowerCase() === slug.toLowerCase() && awaiting(b.number) !== null;
|
|
2326
|
+
const blockers = [
|
|
2327
|
+
...i.blockers.filter((b) => b.state === "OPEN" && !batched(b)).map((b) => blockerRef(slug, b)),
|
|
2328
|
+
...i.blockers.filter(unclosed).map((b) => `#${b.number} (merged, not closed by task close)`)
|
|
2329
|
+
];
|
|
2314
2330
|
const external = i.labels.find((l) => locale_default.every((n) => n.labels.externalBlocker).includes(l));
|
|
2315
2331
|
if (status === N.status.done)
|
|
2316
2332
|
waiting.push(`○ ${label} — ${STATUS} ${q(status)}, but the task is open`);
|
|
@@ -2341,7 +2357,7 @@ ${batches.map((b) => `batch ${b.repo} ${b.branch}
|
|
|
2341
2357
|
} else
|
|
2342
2358
|
io.out("○ session not recognized (no CLAUDE_CODE_SESSION_ID) — not marked as a dispatcher: task status in the executors would pin their tasks");
|
|
2343
2359
|
appWorktreeWarning(io);
|
|
2344
|
-
pruneExecutors(io, slug, handed, isOpen);
|
|
2360
|
+
pruneExecutors(io, slug, handed, isOpen, awaiting);
|
|
2345
2361
|
if (settled.length && checkoutOfRepo(io, originUrl(io), slug))
|
|
2346
2362
|
for (const n of settled)
|
|
2347
2363
|
takeDownStacks(io, n, true);
|
|
@@ -2366,7 +2382,8 @@ ${batches.map((b) => `batch ${b.repo} ${b.branch}
|
|
|
2366
2382
|
} else if (releasing !== null) {
|
|
2367
2383
|
io.out(`Next: the release of ${batch} is open — PR #${releasing} https://github.com/${slug}/pull/${releasing}: no new executors till its merge, ` + `the live executors' PRs into ${batch} wait for it (pr premerge refuses the merge); its steps — ${releaseCommand} prints them; ` + `after each executor's answer — task queue again; ${SESSION_ARCHIVE}.`);
|
|
2368
2384
|
} else if (ready.length) {
|
|
2369
|
-
|
|
2385
|
+
const executors = queueExecutors(io);
|
|
2386
|
+
io.out(`Next: each ready task above — a background subagent in its own worktree while fewer than ${executors.n} run (the machine's capacity: ${executors.from}; a number from the request replaces it); ` + `the indented line is its whole prompt. After each executor's answer — task queue again: new tasks get in${ask}; ${SESSION_ARCHIVE}${now}.`);
|
|
2370
2387
|
} else if (holding || !settled.length && running.length)
|
|
2371
2388
|
io.out(`Next: no ready tasks — wait for the executors' answers; after each — task queue again${ask}; ${SESSION_ARCHIVE}${now}.`);
|
|
2372
2389
|
else if (settled.length) {
|
|
@@ -2421,14 +2438,15 @@ function releaseChecks(io, slug, release) {
|
|
|
2421
2438
|
}
|
|
2422
2439
|
var TEST_FILE = /((?:[\w.@-]+\/)*[\w.@-]+\.(?:test|spec|e2e)\.[cm]?[jt]sx?)\b/;
|
|
2423
2440
|
var isTestFile = (p) => new RegExp(`^${TEST_FILE.source}$`).test(p);
|
|
2441
|
+
var ANSI = /\u001b\][^\u0007\u001b]*(?:\u0007|\u001b\\)|\u001b\[[0-?]*[ -/]*[@-~]|\u001b[@-Z\\-_]/g;
|
|
2424
2442
|
function failedFilesIn(log) {
|
|
2425
2443
|
const out = [];
|
|
2426
2444
|
const rel = (p) => p.replace(/^.*?\/work\/[^/]+\/[^/]+\//, "").replace(/^\.\//, "");
|
|
2427
2445
|
const header = new RegExp(`^\\s*/?${TEST_FILE.source}:$`);
|
|
2428
2446
|
let current = null;
|
|
2429
|
-
for (const raw of asTsc(log).split(`
|
|
2447
|
+
for (const raw of asTsc(log.replace(ANSI, "")).split(`
|
|
2430
2448
|
`)) {
|
|
2431
|
-
const line = raw.replace(
|
|
2449
|
+
const line = raw.replace(/^\d{4}-\d\d-\d\dT[\d:.]+Z ?/, "").trimEnd();
|
|
2432
2450
|
const file = header.exec(line);
|
|
2433
2451
|
if (file) {
|
|
2434
2452
|
current = rel(file[1]);
|
|
@@ -2447,7 +2465,7 @@ function failedFilesOf(io, slug, failed) {
|
|
|
2447
2465
|
for (const r of failed) {
|
|
2448
2466
|
let log;
|
|
2449
2467
|
try {
|
|
2450
|
-
log = io.gh(["api", `repos/${slug}/actions/jobs/${r.id}/logs
|
|
2468
|
+
log = io.gh(["api", `repos/${slug}/actions/jobs/${r.id}/logs`, "--allow-escape-sequences"]);
|
|
2451
2469
|
} catch (e) {
|
|
2452
2470
|
if (!(e instanceof GhError))
|
|
2453
2471
|
throw e;
|
|
@@ -2776,9 +2794,31 @@ function lockHolds(reason) {
|
|
|
2776
2794
|
}
|
|
2777
2795
|
}
|
|
2778
2796
|
var plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
2779
|
-
function pruneExecutors(io, slug, handed, isOpen) {
|
|
2797
|
+
function pruneExecutors(io, slug, handed, isOpen, awaiting = awaitingCloseOf(io, slug, handed)) {
|
|
2780
2798
|
const executors = handed.flatMap((h) => h.worktree === null ? [] : [{ number: h.number, worktree: realPath(h.worktree) }]);
|
|
2781
|
-
|
|
2799
|
+
const live = (n) => isOpen(n) || awaiting(n) !== null;
|
|
2800
|
+
pruneAgentWorktrees(io, slug, (dir) => executors.some((h) => h.worktree === realPath(dir) && live(h.number)), (n) => !live(n));
|
|
2801
|
+
}
|
|
2802
|
+
function awaitingCloseOf(io, slug, handed) {
|
|
2803
|
+
const memo = new Map;
|
|
2804
|
+
return (n, issue) => {
|
|
2805
|
+
if (!handed.some((h) => h.number === n))
|
|
2806
|
+
return null;
|
|
2807
|
+
if (!memo.has(n)) {
|
|
2808
|
+
let pr = null;
|
|
2809
|
+
try {
|
|
2810
|
+
const i = issue ?? loadIssue(io, slug, n);
|
|
2811
|
+
const closer = i.state === "CLOSED" && i.stateReason === "COMPLETED" ? i.prs.find((p) => p.merged && !isBatchBranch(p.base) && !isBatchBranch(p.head)) : undefined;
|
|
2812
|
+
if (closer && !tailOver(io, slug, n))
|
|
2813
|
+
pr = closer.number;
|
|
2814
|
+
} catch (e) {
|
|
2815
|
+
if (!(e instanceof GhError))
|
|
2816
|
+
throw e;
|
|
2817
|
+
}
|
|
2818
|
+
memo.set(n, pr);
|
|
2819
|
+
}
|
|
2820
|
+
return memo.get(n);
|
|
2821
|
+
};
|
|
2782
2822
|
}
|
|
2783
2823
|
function openOf(io, slug) {
|
|
2784
2824
|
const states = new Map;
|
|
@@ -3604,7 +3644,7 @@ function cmdTaskFinish(io, slug, number, o) {
|
|
|
3604
3644
|
const dirty = git(io, io.cwd, "status", "--porcelain", "--untracked-files=no").stdout.trim();
|
|
3605
3645
|
if (dirty)
|
|
3606
3646
|
return stop(1, `! uncommitted changes in the checkout — the PR would go without them`, `the checks before a commit, git commit, then ${again}`);
|
|
3607
|
-
const base = open?.base ?? (
|
|
3647
|
+
const base = open?.base ?? finishBase(io, slug, number, found);
|
|
3608
3648
|
const fetched = git(io, io.cwd, "fetch", "-q", "origin", `+refs/heads/${base}:refs/remotes/origin/${base}`);
|
|
3609
3649
|
if (fetched.status !== 0)
|
|
3610
3650
|
throw new GhError(`git fetch origin ${base}: ${why(fetched)}`);
|
|
@@ -3612,6 +3652,11 @@ function cmdTaskFinish(io, slug, number, o) {
|
|
|
3612
3652
|
`).filter((l) => l.trim());
|
|
3613
3653
|
if (!commits.length)
|
|
3614
3654
|
return stop(1, `! no commits on ${branch} past origin/${base} — nothing to put into a PR`, `commit the task's work, then ${again}`);
|
|
3655
|
+
const applied = git(io, io.cwd, "cherry", `origin/${base}`, "HEAD").stdout.split(`
|
|
3656
|
+
`).filter((l) => l.startsWith("-")).length;
|
|
3657
|
+
if (applied) {
|
|
3658
|
+
return stop(1, `! ${applied} ${applied > 1 ? "commits" : "commit"} of ${branch} ${applied > 1 ? "are" : "is"} in origin/${base} already by the changes (a released batch's, a merged PR's) — the PR would take its title and decision labels from them`, `git rebase origin/${base} (it drops them), then ${again} (it pushes the rebased branch with --force-with-lease)`);
|
|
3659
|
+
}
|
|
3615
3660
|
const refused = pushTaskBranch(io, branch);
|
|
3616
3661
|
if (refused)
|
|
3617
3662
|
return stop(1, `! ${refused}`, `then ${again}`);
|
|
@@ -3665,6 +3710,18 @@ function cmdTaskFinish(io, slug, number, o) {
|
|
|
3665
3710
|
const yes = locale_default.autoProject(io.cwd ?? process.cwd()) ? "" : "the owner's «yes» (the project is without auto) — then ";
|
|
3666
3711
|
return stop(4, `✅ PR #${pr} is ready to merge`, `${yes}gh pr merge ${pr} --rebase — a separate call, no cd or pipeline (the owner's permission rule matches it); then ${again}${isBatchBranch(base) ? "" : " — in the background: it waits for the deploy"}`);
|
|
3667
3712
|
}
|
|
3713
|
+
function finishBase(io, slug, number, found) {
|
|
3714
|
+
const batch = handedPastBatch(io, slug, number) ? null : batchOf(io, slug);
|
|
3715
|
+
if (!batch)
|
|
3716
|
+
return found.base;
|
|
3717
|
+
const release = releasePrOf(found.recent, batch);
|
|
3718
|
+
if (release?.merged)
|
|
3719
|
+
return io.out(`○ ${batch} is released by PR #${release.number} — the PR goes into ${found.base}`), found.base;
|
|
3720
|
+
const listed = git(io, io.cwd, "ls-remote", "--heads", "origin", `refs/heads/${batch}`);
|
|
3721
|
+
if (listed.status === 0 && !listed.stdout.trim())
|
|
3722
|
+
return io.out(`○ ${batch} is gone from origin (released) — the PR goes into ${found.base}`), found.base;
|
|
3723
|
+
return batch;
|
|
3724
|
+
}
|
|
3668
3725
|
function tailOver(io, slug, number) {
|
|
3669
3726
|
if (inCloud(io))
|
|
3670
3727
|
return true;
|
|
@@ -3793,7 +3850,8 @@ function renameBranch(io, slug, target) {
|
|
|
3793
3850
|
return false;
|
|
3794
3851
|
}
|
|
3795
3852
|
function unlinkedPrs(io, slug, number) {
|
|
3796
|
-
const
|
|
3853
|
+
const recent = recentPrs(io, slug);
|
|
3854
|
+
const { base, nodes } = recent;
|
|
3797
3855
|
const prs = [];
|
|
3798
3856
|
const batched = [];
|
|
3799
3857
|
for (const p of nodes) {
|
|
@@ -3805,7 +3863,7 @@ function unlinkedPrs(io, slug, number) {
|
|
|
3805
3863
|
if (why)
|
|
3806
3864
|
(into === base ? prs : batched).push({ number: p.number, state: p.state ?? "", merged: Boolean(p.merged), head, base: into, why });
|
|
3807
3865
|
}
|
|
3808
|
-
return { base, prs, batched };
|
|
3866
|
+
return { base, prs, batched, recent };
|
|
3809
3867
|
}
|
|
3810
3868
|
var estScript = (io) => io.env["ELVES_EST"] ?? path.resolve(import.meta.dir, "../../est/scripts/est.ts");
|
|
3811
3869
|
function originUrl(io) {
|
|
@@ -4676,7 +4734,8 @@ Examples:
|
|
|
4676
4734
|
The tail of a task from its committed branch to its close, resumable: each call does what is ready within --timeout
|
|
4677
4735
|
(default ${FINISH_TIMEOUT} s), prints the state and the Next line, a repeat goes on from there. Before the merge: the task
|
|
4678
4736
|
branch pushed (a rebased one — --force-with-lease), the PR into the dispatcher's batch branch or the default branch
|
|
4679
|
-
(
|
|
4737
|
+
(a released batch — the default branch; commits of the branch already in the base by their changes — a stop: git
|
|
4738
|
+
rebase drops them; the title — --title, otherwise the branch type's first commit; the body — spec-diff and Closes #N; an existing PR —
|
|
4680
4739
|
its body updated), pr labels, the CI wait (ci-wait pr; none into a batch), pr premerge, then the merge command — a
|
|
4681
4740
|
separate gh pr merge <PR> --rebase. After the merge: the deploy wait on the merge SHA (ci-wait merged), the epic
|
|
4682
4741
|
refresh's mechanics and its subagent's prompt (once), task close once the report is on the epic; merged into a batch —
|
|
@@ -5149,7 +5208,6 @@ export {
|
|
|
5149
5208
|
questionItems,
|
|
5150
5209
|
realGh,
|
|
5151
5210
|
realRun,
|
|
5152
|
-
scenarioItems,
|
|
5153
5211
|
sectionNames,
|
|
5154
5212
|
sectionTopics,
|
|
5155
5213
|
sessionPin,
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
invariant2,
|
|
3
3
|
codeOnly2,
|
|
4
4
|
envNamesInCode2
|
|
5
|
-
} from "./harness-
|
|
5
|
+
} from "./harness-dms3b7ke.js";
|
|
6
6
|
import {
|
|
7
7
|
locale_default
|
|
8
|
-
} from "./harness-
|
|
8
|
+
} from "./harness-1rfkbdbn.js";
|
|
9
9
|
|
|
10
10
|
// skills/spec/scripts/architecture.ts
|
|
11
11
|
import { readdirSync, readFileSync } from "node:fs";
|
|
@@ -107,13 +107,13 @@ var en_default = {
|
|
|
107
107
|
subagents: "- writing subagents — launch as needed, no limit: each gets its own worktree and «{task} #{number}» at the start of its prompt (`est` links its work by it); bring their commits into your branch, remove their worktrees and branches yourself after the merge — what didn't go, name in the answer;",
|
|
108
108
|
live: "- while any of your subagents works, don't answer: wait for their answers — a background subagent wakes you with its answer; an answer with live subagents looks like a failure, and the dispatcher would give the task to a second executor next to you. Can't wait — answer `waits for subagents: <which and what they do>`: it isn't `failed`, there will be no second executor;",
|
|
109
109
|
refresh: '- the epic refresh — the subagent `task actualize` prints, without a worktree of its own (in yours) and not in the background (`run_in_background: false`): its answer — in the same turn, then `{script} task close {number}`, and only then the answer to the dispatcher: once you answer, a worktree without changes is removed, and a background subagent is left without a directory; a task without a PR (a data edit, a reconciliation, research) — first close the issue as completed with a result comment: `gh issue close {number} --repo {repo} --reason completed --comment "<result>"`;',
|
|
110
|
-
batchLead: "{task} #{number} «{title}» in {repo}{epic}: you are an executor of the dispatcher session, the task goes into the batch `{batch}` — do the task whole by the canon, {mode}: `{script} task start {number} --branch
|
|
110
|
+
batchLead: "{task} #{number} «{title}» in {repo}{epic}: you are an executor of the dispatcher session, the task goes into the batch `{batch}` — do the task whole by the canon, {mode}: `{script} task start {number} --branch exec/<type>/{number}-<slug>` (the task's questions and its parallel work — inside it), the branch from a fresh origin/{batch}, not from main (`git fetch origin {batch}`, then the task branch on `origin/{batch}`), code and tests, the checks before a commit, PR into the batch (`gh pr create --base {batch}`), `pr premerge`, merge. No CI wait, no deploy, no epic refresh and no `task close`: the task stays «{inProgress}» till the batch's release — the dispatcher's, with one full CI run and one refresh per epic.",
|
|
111
111
|
batchWait: "- don't wait for CI: a PR into the batch runs none — its gate is the checks before a commit by the canon (`elves precommit --base origin/<batch branch>`: `lint`, `typecheck`, `test:spec`, the affected tests — `docs/testing.md`) and `pr premerge` (the fast checks on the merge, if the batch moved on); after its code 0 — `gh pr merge <PR> --rebase` without a CI wait; the full run and the deploy are the release's, nothing to wait for after the merge, but before the answer take the task's stacks down (`{taskEnv} down {number}`, unsandboxed: Docker): the task waits for the release, its stack would load the machine till then;",
|
|
112
112
|
batchRefresh: "- the epic refresh and `task close` aren't yours: both are the batch's release — one refresh per epic of its tasks, then `task close` of each, the dispatcher's; a task without a PR (a data edit, a reconciliation, research) isn't in the batch — close the issue as completed with a result comment: `gh issue close {number} --repo {repo} --reason completed --comment \"<result>\"`, then the epic refresh — the subagent `task actualize {number}` prints, without a worktree of its own (in yours) and not in the background (`run_in_background: false`): its answer — in the same turn, then `{script} task close {number}`, and only then the answer to the dispatcher: once you answer, a worktree without changes is removed, and a background subagent is left without a directory;",
|
|
113
113
|
bypass: "- the task goes past the dispatcher's batch `{batch}` — the owner's word: the task branch from a fresh origin/main, not from the batch, the PR into the default branch (not `--base {batch}`) with the full CI, the deploy, the epic refresh and `task close` — yours, as in a project without batches; the batch's release doesn't wait for you;",
|
|
114
|
-
fixLead: '{task} #{number} «{title}» in {repo}{epic}: you are an executor of the dispatcher session — a fix in the batch `{batch}`: its release PR #{release} is red ({checks}), and the task, merged into the batch already, is named guilty — fix it in the batch by the canon, {mode}: `{script} task status {number} "{inProgress}" --branch fix/{number}-<slug>`, a new branch from a fresh origin/{batch} (`git fetch origin {batch}`, then the branch on `origin/{batch}`){previous}, the cause by the failed checks (`gh pr checks {release}`, their logs), the fix and its test, commits with `Refs #{number}`, the checks before a commit, PR into the batch (`gh pr create --base {batch}`, `Refs #{number}` in the body), `pr premerge` (it lets the guilty task\'s PR through the open release), merge. No CI wait, no deploy, no epic refresh and no `task close`: after the merge the dispatcher runs the release again — the full run on the same PR #{release}.',
|
|
114
|
+
fixLead: '{task} #{number} «{title}» in {repo}{epic}: you are an executor of the dispatcher session — a fix in the batch `{batch}`: its release PR #{release} is red ({checks}), and the task, merged into the batch already, is named guilty — fix it in the batch by the canon, {mode}: `{script} task status {number} "{inProgress}" --branch exec/fix/{number}-<slug>`, a new branch from a fresh origin/{batch} (`git fetch origin {batch}`, then the branch on `origin/{batch}`){previous}, the cause by the failed checks (`gh pr checks {release}`, their logs), the fix and its test, commits with `Refs #{number}`, the checks before a commit, PR into the batch (`gh pr create --base {batch}`, `Refs #{number}` in the body), `pr premerge` (it lets the guilty task\'s PR through the open release), merge. No CI wait, no deploy, no epic refresh and no `task close`: after the merge the dispatcher runs the release again — the full run on the same PR #{release}.',
|
|
115
115
|
fixPrevious: ", not the task's earlier branch {branches} — it is in the batch already, merged by a rebase",
|
|
116
|
-
sessionFixLead: '{task} #{number} «{title}» in {repo}{epic}: you are an executor session of the dispatcher session — a fix in the batch `{batch}`: its release PR #{release} is red ({checks}), and the task, merged into the batch already, is named guilty — fix it in the batch by the canon of this project, in its mode (`check` prints it; outside auto — commit, push and merge on the owner\'s «yes»): `{script} task status {number} "{inProgress}" --branch fix/{number}-<slug>`, a new branch from a fresh origin/{batch}{previous}, the cause by the failed checks (`gh pr checks {release}`, their logs), the fix and its test, commits with `Refs #{number}`, the checks before a commit, PR into the batch (`gh pr create --base {batch}`, `Refs #{number}` in the body), `pr premerge`, merge. No CI wait, no deploy, no epic refresh and no `task close`: after the merge the dispatcher runs the release again — the full run on the same PR #{release}.',
|
|
116
|
+
sessionFixLead: '{task} #{number} «{title}» in {repo}{epic}: you are an executor session of the dispatcher session — a fix in the batch `{batch}`: its release PR #{release} is red ({checks}), and the task, merged into the batch already, is named guilty — fix it in the batch by the canon of this project, in its mode (`check` prints it; outside auto — commit, push and merge on the owner\'s «yes»): `{script} task status {number} "{inProgress}" --branch exec/fix/{number}-<slug>`, a new branch from a fresh origin/{batch}{previous}, the cause by the failed checks (`gh pr checks {release}`, their logs), the fix and its test, commits with `Refs #{number}`, the checks before a commit, PR into the batch (`gh pr create --base {batch}`, `Refs #{number}` in the body), `pr premerge`, merge. No CI wait, no deploy, no epic refresh and no `task close`: after the merge the dispatcher runs the release again — the full run on the same PR #{release}.',
|
|
117
117
|
repeats: "- before the PR — repeats in the files the task changes anyway: fix them in the same PR, don't file a task for them; a repeat outside the task's files is the epic refresh's;",
|
|
118
118
|
found: "- work found outside the task — `{script} task new …` (work of the task's epic — with `--epic`: the dispatcher picks it up) — name it in the answer: whether to queue it is the owner's call;",
|
|
119
119
|
question: "- a question without a clear recommendation — into «{questions}» of the task; don't start the code that depends on it and answer the dispatcher: the owner's answer comes back here.",
|
|
@@ -127,7 +127,7 @@ var en_default = {
|
|
|
127
127
|
cloudDispatcher: "- the dispatcher waits for the task to close and closes it locally — the actual, the status, the merged branch, archiving this session: don't message it, don't archive the session;",
|
|
128
128
|
cloudQuestion: "- a question without a clear recommendation — into «{questions}» of the task and to the owner in this session, don't start the code that depends on it; stopped (a question, a failure, a limit) — a «{state}» comment into the task.",
|
|
129
129
|
sessionLead: "{task} #{number} «{title}» in {repo}{epic}: you are an executor session of the dispatcher session — do the task whole by the canon of this project, in its mode (`check` prints it; outside auto — commit, push and merge on the owner's «yes»): `{script} task start {number} --branch <type>/{number}-<slug>` (the task's questions and its parallel work — inside it), the branch from a fresh origin/main, code and tests, PR, green CI, `pr premerge`, merge, deploy, the epic refresh, `{script} task close {number}`.",
|
|
130
|
-
sessionBatchLead: "{task} #{number} «{title}» in {repo}{epic}: you are an executor session of the dispatcher session, the task goes into the batch `{batch}` — do the task whole by the canon of this project, in its mode (`check` prints it; outside auto — commit, push and merge on the owner's «yes»): `{script} task start {number} --branch
|
|
130
|
+
sessionBatchLead: "{task} #{number} «{title}» in {repo}{epic}: you are an executor session of the dispatcher session, the task goes into the batch `{batch}` — do the task whole by the canon of this project, in its mode (`check` prints it; outside auto — commit, push and merge on the owner's «yes»): `{script} task start {number} --branch exec/<type>/{number}-<slug>` (the task's questions and its parallel work — inside it), the branch from a fresh origin/{batch}, not from main, code and tests, the checks before a commit, PR into the batch (`gh pr create --base {batch}`), `pr premerge`, merge. No CI wait, no deploy, no epic refresh and no `task close`: the task stays «{inProgress}» till the batch's release — the dispatcher's, with one full CI run and one refresh per epic.",
|
|
131
131
|
sessionIs: "You are a session, not a subagent:",
|
|
132
132
|
sessionName: "- name the session `#{number} {title}` (`set_session_title`) once the task is taken — `est` links the session to the task by it;",
|
|
133
133
|
sessionWait: "- wait for CI and the deploy with a background command — `{waitCi} pr <PR>` (after the merge — `merged <PR>`): its completion wakes the session; no `Monitor`, watcher loop or `ScheduleWakeup` on top;",
|
|
@@ -587,13 +587,13 @@ var ru_default = {
|
|
|
587
587
|
subagents: "- пишущих субагентов запускай по необходимости, без лимита: каждому — свой worktree и «{task} #{number}» в начале промпта (по нему `est` привяжет его работу); их коммиты перенеси в свою ветку, их worktree и ветки после мержа убери сам — что не убралось, назови в ответе;",
|
|
588
588
|
live: "- пока работает хоть один твой субагент, ответ не отдавай: жди их ответов — фоновый субагент будит тебя своим ответом; ответ при живых субагентах выглядит провалом, и диспетчер отдал бы задачу второму исполнителю рядом с тобой. Ждать нельзя — ответь `ждёт субагентов: <какие и что делают>`: это не «сломалось», второго исполнителя не будет;",
|
|
589
589
|
refresh: '- актуализация эпика — субагент, которого печатает `task actualize`, без своего worktree (в твоём) и не в фоне (`run_in_background: false`): его ответ — в том же ходе, затем `{script} task close {number}`, и только потом ответ диспетчеру: стоит тебе ответить, worktree без изменений убирают, и фоновый субагент остаётся без каталога; у задачи без PR (правка данных, сверка, исследование) — сначала закрой issue как выполненную с итоговым комментарием: `gh issue close {number} --repo {repo} --reason completed --comment "<итог>"`;',
|
|
590
|
-
batchLead: "{task} #{number} «{title}» в {repo}{epic}: ты исполнитель сессии-диспетчера, задача идёт в пачку `{batch}` — сделай задачу целиком по канону, {mode}: `{script} task start {number} --branch
|
|
590
|
+
batchLead: "{task} #{number} «{title}» в {repo}{epic}: ты исполнитель сессии-диспетчера, задача идёт в пачку `{batch}` — сделай задачу целиком по канону, {mode}: `{script} task start {number} --branch exec/<тип>/{number}-<slug>` (вопросы задачи и её параллельная работа — в нём), ветка от свежего origin/{batch}, а не от main (`git fetch origin {batch}`, затем ветка задачи на `origin/{batch}`), код и тесты, проверки перед коммитом, PR в пачку (`gh pr create --base {batch}`), `pr premerge`, мерж. Ожидания CI, деплоя, актуализации эпика и `task close` нет: задача — «{inProgress}» до выпуска пачки, его делает диспетчер — с одним полным прогоном CI и одной актуализацией на эпик.",
|
|
591
591
|
batchWait: "- CI не жди: PR в пачку его не запускает — его ворота — проверки перед коммитом по канону (`elves precommit --base origin/<ветка пачки>`: `lint`, `typecheck`, `test:spec`, затронутые тесты — `docs/testing.md`) и `pr premerge` (быстрые проверки на слиянии, если пачка ушла вперёд); после его кода 0 — `gh pr merge <PR> --rebase` без ожидания CI; полный прогон и деплой — у выпуска, после мержа ждать нечего, но до ответа сними стеки задачи (`{taskEnv} down {number}`, вне песочницы: Docker): задача ждёт выпуска, а её стек до него грузил бы машину;",
|
|
592
592
|
batchRefresh: '- актуализация эпика и `task close` — не твои: обе — у выпуска пачки, одна актуализация на каждый эпик её задач, затем `task close` каждой, их делает диспетчер; задача без PR (правка данных, сверка, исследование) в пачку не идёт — закрой issue как выполненную с итоговым комментарием: `gh issue close {number} --repo {repo} --reason completed --comment "<итог>"`, затем актуализация эпика — субагент, которого печатает `task actualize {number}`, без своего worktree (в твоём) и не в фоне (`run_in_background: false`): его ответ — в том же ходе, затем `{script} task close {number}`, и только потом ответ диспетчеру: стоит тебе ответить, worktree без изменений убирают, и фоновый субагент остаётся без каталога;',
|
|
593
593
|
bypass: "- задача идёт мимо пачки диспетчера `{batch}` — слово владельца: ветка задачи от свежего origin/main, а не от пачки, PR в ветку по умолчанию (не `--base {batch}`) с полным CI, деплой, актуализация эпика и `task close` — твои, как в проекте без пачек; выпуск пачки тебя не ждёт;",
|
|
594
|
-
fixLead: '{task} #{number} «{title}» в {repo}{epic}: ты исполнитель сессии-диспетчера — починка в пачке `{batch}`: её PR выпуска #{release} красный ({checks}), а задача, уже влитая в пачку, названа виновной — почини её в пачке по канону, {mode}: `{script} task status {number} "{inProgress}" --branch fix/{number}-<slug>`, новая ветка от свежего origin/{batch} (`git fetch origin {batch}`, затем ветка на `origin/{batch}`){previous}, причина — по упавшим проверкам (`gh pr checks {release}`, их логи), починка и её тест, коммиты с `Refs #{number}`, проверки перед коммитом, PR в пачку (`gh pr create --base {batch}`, в теле `Refs #{number}`), `pr premerge` (PR виновной задачи он пропускает при открытом выпуске), мерж. Ожидания CI, деплоя, актуализации эпика и `task close` нет: после мержа диспетчер гонит выпуск заново — полный прогон на том же PR #{release}.',
|
|
594
|
+
fixLead: '{task} #{number} «{title}» в {repo}{epic}: ты исполнитель сессии-диспетчера — починка в пачке `{batch}`: её PR выпуска #{release} красный ({checks}), а задача, уже влитая в пачку, названа виновной — почини её в пачке по канону, {mode}: `{script} task status {number} "{inProgress}" --branch exec/fix/{number}-<slug>`, новая ветка от свежего origin/{batch} (`git fetch origin {batch}`, затем ветка на `origin/{batch}`){previous}, причина — по упавшим проверкам (`gh pr checks {release}`, их логи), починка и её тест, коммиты с `Refs #{number}`, проверки перед коммитом, PR в пачку (`gh pr create --base {batch}`, в теле `Refs #{number}`), `pr premerge` (PR виновной задачи он пропускает при открытом выпуске), мерж. Ожидания CI, деплоя, актуализации эпика и `task close` нет: после мержа диспетчер гонит выпуск заново — полный прогон на том же PR #{release}.',
|
|
595
595
|
fixPrevious: ", а не от прежней ветки задачи {branches} — она уже в пачке, влита rebase-мержем",
|
|
596
|
-
sessionFixLead: '{task} #{number} «{title}» в {repo}{epic}: ты сессия-исполнитель сессии-диспетчера — починка в пачке `{batch}`: её PR выпуска #{release} красный ({checks}), а задача, уже влитая в пачку, названа виновной — почини её в пачке по канону этого проекта, в его режиме (его печатает `check`; не в auto — коммит, пуш и мерж по «да» владельца): `{script} task status {number} "{inProgress}" --branch fix/{number}-<slug>`, новая ветка от свежего origin/{batch}{previous}, причина — по упавшим проверкам (`gh pr checks {release}`, их логи), починка и её тест, коммиты с `Refs #{number}`, проверки перед коммитом, PR в пачку (`gh pr create --base {batch}`, в теле `Refs #{number}`), `pr premerge`, мерж. Ожидания CI, деплоя, актуализации эпика и `task close` нет: после мержа диспетчер гонит выпуск заново — полный прогон на том же PR #{release}.',
|
|
596
|
+
sessionFixLead: '{task} #{number} «{title}» в {repo}{epic}: ты сессия-исполнитель сессии-диспетчера — починка в пачке `{batch}`: её PR выпуска #{release} красный ({checks}), а задача, уже влитая в пачку, названа виновной — почини её в пачке по канону этого проекта, в его режиме (его печатает `check`; не в auto — коммит, пуш и мерж по «да» владельца): `{script} task status {number} "{inProgress}" --branch exec/fix/{number}-<slug>`, новая ветка от свежего origin/{batch}{previous}, причина — по упавшим проверкам (`gh pr checks {release}`, их логи), починка и её тест, коммиты с `Refs #{number}`, проверки перед коммитом, PR в пачку (`gh pr create --base {batch}`, в теле `Refs #{number}`), `pr premerge`, мерж. Ожидания CI, деплоя, актуализации эпика и `task close` нет: после мержа диспетчер гонит выпуск заново — полный прогон на том же PR #{release}.',
|
|
597
597
|
repeats: "- перед PR — повторы в файлах, которые задача и так правит: исправь в том же PR, новую задачу на них не заводи; повтор вне файлов задачи — дело актуализации эпика;",
|
|
598
598
|
found: "- найденная работа вне задачи — `{script} task new …` (работа эпика задачи — с `--epic`: диспетчер её подхватит) — назови её в ответе: ставить ли её в очередь, решает владелец;",
|
|
599
599
|
question: "- вопрос без ясной рекомендации — в «{questions}» задачи; код, который от него зависит, не начинай и ответь диспетчеру: ответ владельца придёт сюда же.",
|
|
@@ -607,7 +607,7 @@ var ru_default = {
|
|
|
607
607
|
cloudDispatcher: "- диспетчер ждёт закрытия задачи и закрывает её локально — факт, статус, влитая ветка, архив этой сессии: сообщать ему не нужно, сессию не архивируй;",
|
|
608
608
|
cloudQuestion: "- вопрос без ясной рекомендации — в «{questions}» задачи и владельцу в этой сессии, код, который от него зависит, не начинай; остановился (вопрос, сбой, лимит) — комментарий «{state}» в задачу.",
|
|
609
609
|
sessionLead: "{task} #{number} «{title}» в {repo}{epic}: ты сессия-исполнитель сессии-диспетчера — сделай задачу целиком по канону этого проекта, в его режиме (его печатает `check`; не в auto — коммит, пуш и мерж по «да» владельца): `{script} task start {number} --branch <тип>/{number}-<slug>` (вопросы задачи и её параллельная работа — в нём), ветка от свежего origin/main, код и тесты, PR, зелёный CI, `pr premerge`, мерж, деплой, актуализация эпика, `{script} task close {number}`.",
|
|
610
|
-
sessionBatchLead: "{task} #{number} «{title}» в {repo}{epic}: ты сессия-исполнитель сессии-диспетчера, задача идёт в пачку `{batch}` — сделай задачу целиком по канону этого проекта, в его режиме (его печатает `check`; не в auto — коммит, пуш и мерж по «да» владельца): `{script} task start {number} --branch
|
|
610
|
+
sessionBatchLead: "{task} #{number} «{title}» в {repo}{epic}: ты сессия-исполнитель сессии-диспетчера, задача идёт в пачку `{batch}` — сделай задачу целиком по канону этого проекта, в его режиме (его печатает `check`; не в auto — коммит, пуш и мерж по «да» владельца): `{script} task start {number} --branch exec/<тип>/{number}-<slug>` (вопросы задачи и её параллельная работа — в нём), ветка от свежего origin/{batch}, а не от main, код и тесты, проверки перед коммитом, PR в пачку (`gh pr create --base {batch}`), `pr premerge`, мерж. Ожидания CI, деплоя, актуализации эпика и `task close` нет: задача — «{inProgress}» до выпуска пачки, его делает диспетчер — с одним полным прогоном CI и одной актуализацией на эпик.",
|
|
611
611
|
sessionIs: "Ты сессия, а не субагент:",
|
|
612
612
|
sessionName: "- назови сессию `#{number} {title}` (`set_session_title`), как только взял задачу, — по имени `est` привяжет сессию к задаче;",
|
|
613
613
|
sessionWait: "- CI и деплой жди фоновой командой — `{waitCi} pr <PR>` (после мержа — `merged <PR>`): её завершение будит сессию; без `Monitor`, цикла-наблюдателя и `ScheduleWakeup` поверх;",
|
|
@@ -1027,6 +1027,30 @@ function count(language, forms, n) {
|
|
|
1027
1027
|
function escapeRe(text) {
|
|
1028
1028
|
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1029
1029
|
}
|
|
1030
|
-
|
|
1030
|
+
function scenarioItems(md) {
|
|
1031
|
+
let fence = null;
|
|
1032
|
+
const lines = md.split(/\r?\n/).map((l) => {
|
|
1033
|
+
const f = /^\s*(`{3,}|~{3,})/.exec(l)?.[1];
|
|
1034
|
+
if (f && (fence === null || f[0] === fence[0] && f.length >= fence.length)) {
|
|
1035
|
+
fence = fence === null ? f : null;
|
|
1036
|
+
return "";
|
|
1037
|
+
}
|
|
1038
|
+
return fence === null ? l : "";
|
|
1039
|
+
});
|
|
1040
|
+
const heads = every((n) => n.sections.scenarios).map((h) => new RegExp(`^${escapeRe(h).replace(/ +/g, "\\s+")}\\s*$`));
|
|
1041
|
+
const start = lines.findIndex((l) => heads.some((h) => h.test(l.trim())));
|
|
1042
|
+
if (start < 0)
|
|
1043
|
+
return null;
|
|
1044
|
+
const out = [];
|
|
1045
|
+
for (const l of lines.slice(start + 1)) {
|
|
1046
|
+
if (/^#{1,2}\s/.test(l))
|
|
1047
|
+
break;
|
|
1048
|
+
const m = /^\s*(?:[-*+]|\d+[.)])\s+(?:\[[ xX]\]\s+)?(.+?)\s*$/.exec(l);
|
|
1049
|
+
if (m)
|
|
1050
|
+
out.push(m[1]);
|
|
1051
|
+
}
|
|
1052
|
+
return out;
|
|
1053
|
+
}
|
|
1054
|
+
var locale_default = { LANGUAGE_CODE, DEFAULT_LANGUAGE, projectRoot, manifestOf, projectLanguage, missingManifest, batchProject, autoProject, names, languages, everyNames, every, fill, plural, count, escapeRe, scenarioItems };
|
|
1031
1055
|
|
|
1032
1056
|
export { locale_default };
|
package/docs/cloud-sessions.md
CHANGED
|
@@ -4,8 +4,9 @@ Reference for the cloud-session line in `AGENTS.md`. A cloud session is
|
|
|
4
4
|
Claude Code on claude.ai/code, including one started from the phone app: a
|
|
5
5
|
temporary container into which only the project repository is cloned.
|
|
6
6
|
A dispatcher's executor can be one (`AGENTS.md`, "Session and branch — one
|
|
7
|
-
task"): at most
|
|
8
|
-
replaces either — a cloud session's container doesn't
|
|
7
|
+
task"): at most the machine's executors in subagents and 5 cloud sessions at
|
|
8
|
+
once, the owner's number replaces either — a cloud session's container doesn't
|
|
9
|
+
load the machine.
|
|
9
10
|
|
|
10
11
|
## What it sees
|
|
11
12
|
|
package/docs/testing.md
CHANGED
|
@@ -24,7 +24,7 @@ against the Playwright, Next.js, Vite, SvelteKit and Nuxt documentation.
|
|
|
24
24
|
and print whom they wait for (the `slot` skill). Without the queue,
|
|
25
25
|
neighboring sessions, the linter and another worktree's e2e share the cores —
|
|
26
26
|
timeouts and flakes that aren't about the code. Runner workers come from
|
|
27
|
-
`ELVES_SLOT_CPUS` (
|
|
27
|
+
`ELVES_SLOT_CPUS` (its slot's share of half of the cores); CI has its own:
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
30
|
maxWorkers: Number(process.env.ELVES_SLOT_CPUS) || undefined, // vitest.config.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miroshnik/elves",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.1029.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Elves — a development flow with AI agents: shared rules and skills for any agent; install — bunx @miroshnik/elves install -g; the installer and skill scripts — TypeScript under Bun, tests — bun test in tests/",
|
|
6
6
|
"repository": {
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"eslint-plugin-boundaries": "^7.2.0",
|
|
73
73
|
"knip": "^6.41.0"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "293d7b8e52929a23c58bffe49de33c84f4b8cd12"
|
|
76
76
|
}
|
package/skills/github/SKILL.md
CHANGED
|
@@ -148,8 +148,8 @@ folder, not a worktree: executors (subagents, cloud sessions) start from
|
|
|
148
148
|
`main`. `task queue` prints ready
|
|
149
149
|
tasks, each with an indented line — its executor's prompt. In Claude Code: an executor — `Agent` with
|
|
150
150
|
`isolation: "worktree"` and `run_in_background: true`, the prompt — as
|
|
151
|
-
is; at most
|
|
152
|
-
owner's number replaces either; another project's task — an app session in
|
|
151
|
+
is; at most the machine's executors in subagents and 5 cloud sessions at
|
|
152
|
+
once, the owner's number replaces either; another project's task — an app session in
|
|
153
153
|
its folder (`start_session`, own worktree);
|
|
154
154
|
`=` — a task in work, its line says why, not launched again. A batch project
|
|
155
155
|
(`"batch": true` in `.agents/elves.json`) — executors merge into the batch
|
|
@@ -103,13 +103,13 @@
|
|
|
103
103
|
"subagents": "- writing subagents — launch as needed, no limit: each gets its own worktree and «{task} #{number}» at the start of its prompt (`est` links its work by it); bring their commits into your branch, remove their worktrees and branches yourself after the merge — what didn't go, name in the answer;",
|
|
104
104
|
"live": "- while any of your subagents works, don't answer: wait for their answers — a background subagent wakes you with its answer; an answer with live subagents looks like a failure, and the dispatcher would give the task to a second executor next to you. Can't wait — answer `waits for subagents: <which and what they do>`: it isn't `failed`, there will be no second executor;",
|
|
105
105
|
"refresh": "- the epic refresh — the subagent `task actualize` prints, without a worktree of its own (in yours) and not in the background (`run_in_background: false`): its answer — in the same turn, then `{script} task close {number}`, and only then the answer to the dispatcher: once you answer, a worktree without changes is removed, and a background subagent is left without a directory; a task without a PR (a data edit, a reconciliation, research) — first close the issue as completed with a result comment: `gh issue close {number} --repo {repo} --reason completed --comment \"<result>\"`;",
|
|
106
|
-
"batchLead": "{task} #{number} «{title}» in {repo}{epic}: you are an executor of the dispatcher session, the task goes into the batch `{batch}` — do the task whole by the canon, {mode}: `{script} task start {number} --branch
|
|
106
|
+
"batchLead": "{task} #{number} «{title}» in {repo}{epic}: you are an executor of the dispatcher session, the task goes into the batch `{batch}` — do the task whole by the canon, {mode}: `{script} task start {number} --branch exec/<type>/{number}-<slug>` (the task's questions and its parallel work — inside it), the branch from a fresh origin/{batch}, not from main (`git fetch origin {batch}`, then the task branch on `origin/{batch}`), code and tests, the checks before a commit, PR into the batch (`gh pr create --base {batch}`), `pr premerge`, merge. No CI wait, no deploy, no epic refresh and no `task close`: the task stays «{inProgress}» till the batch's release — the dispatcher's, with one full CI run and one refresh per epic.",
|
|
107
107
|
"batchWait": "- don't wait for CI: a PR into the batch runs none — its gate is the checks before a commit by the canon (`elves precommit --base origin/<batch branch>`: `lint`, `typecheck`, `test:spec`, the affected tests — `docs/testing.md`) and `pr premerge` (the fast checks on the merge, if the batch moved on); after its code 0 — `gh pr merge <PR> --rebase` without a CI wait; the full run and the deploy are the release's, nothing to wait for after the merge, but before the answer take the task's stacks down (`{taskEnv} down {number}`, unsandboxed: Docker): the task waits for the release, its stack would load the machine till then;",
|
|
108
108
|
"batchRefresh": "- the epic refresh and `task close` aren't yours: both are the batch's release — one refresh per epic of its tasks, then `task close` of each, the dispatcher's; a task without a PR (a data edit, a reconciliation, research) isn't in the batch — close the issue as completed with a result comment: `gh issue close {number} --repo {repo} --reason completed --comment \"<result>\"`, then the epic refresh — the subagent `task actualize {number}` prints, without a worktree of its own (in yours) and not in the background (`run_in_background: false`): its answer — in the same turn, then `{script} task close {number}`, and only then the answer to the dispatcher: once you answer, a worktree without changes is removed, and a background subagent is left without a directory;",
|
|
109
109
|
"bypass": "- the task goes past the dispatcher's batch `{batch}` — the owner's word: the task branch from a fresh origin/main, not from the batch, the PR into the default branch (not `--base {batch}`) with the full CI, the deploy, the epic refresh and `task close` — yours, as in a project without batches; the batch's release doesn't wait for you;",
|
|
110
|
-
"fixLead": "{task} #{number} «{title}» in {repo}{epic}: you are an executor of the dispatcher session — a fix in the batch `{batch}`: its release PR #{release} is red ({checks}), and the task, merged into the batch already, is named guilty — fix it in the batch by the canon, {mode}: `{script} task status {number} \"{inProgress}\" --branch fix/{number}-<slug>`, a new branch from a fresh origin/{batch} (`git fetch origin {batch}`, then the branch on `origin/{batch}`){previous}, the cause by the failed checks (`gh pr checks {release}`, their logs), the fix and its test, commits with `Refs #{number}`, the checks before a commit, PR into the batch (`gh pr create --base {batch}`, `Refs #{number}` in the body), `pr premerge` (it lets the guilty task's PR through the open release), merge. No CI wait, no deploy, no epic refresh and no `task close`: after the merge the dispatcher runs the release again — the full run on the same PR #{release}.",
|
|
110
|
+
"fixLead": "{task} #{number} «{title}» in {repo}{epic}: you are an executor of the dispatcher session — a fix in the batch `{batch}`: its release PR #{release} is red ({checks}), and the task, merged into the batch already, is named guilty — fix it in the batch by the canon, {mode}: `{script} task status {number} \"{inProgress}\" --branch exec/fix/{number}-<slug>`, a new branch from a fresh origin/{batch} (`git fetch origin {batch}`, then the branch on `origin/{batch}`){previous}, the cause by the failed checks (`gh pr checks {release}`, their logs), the fix and its test, commits with `Refs #{number}`, the checks before a commit, PR into the batch (`gh pr create --base {batch}`, `Refs #{number}` in the body), `pr premerge` (it lets the guilty task's PR through the open release), merge. No CI wait, no deploy, no epic refresh and no `task close`: after the merge the dispatcher runs the release again — the full run on the same PR #{release}.",
|
|
111
111
|
"fixPrevious": ", not the task's earlier branch {branches} — it is in the batch already, merged by a rebase",
|
|
112
|
-
"sessionFixLead": "{task} #{number} «{title}» in {repo}{epic}: you are an executor session of the dispatcher session — a fix in the batch `{batch}`: its release PR #{release} is red ({checks}), and the task, merged into the batch already, is named guilty — fix it in the batch by the canon of this project, in its mode (`check` prints it; outside auto — commit, push and merge on the owner's «yes»): `{script} task status {number} \"{inProgress}\" --branch fix/{number}-<slug>`, a new branch from a fresh origin/{batch}{previous}, the cause by the failed checks (`gh pr checks {release}`, their logs), the fix and its test, commits with `Refs #{number}`, the checks before a commit, PR into the batch (`gh pr create --base {batch}`, `Refs #{number}` in the body), `pr premerge`, merge. No CI wait, no deploy, no epic refresh and no `task close`: after the merge the dispatcher runs the release again — the full run on the same PR #{release}.",
|
|
112
|
+
"sessionFixLead": "{task} #{number} «{title}» in {repo}{epic}: you are an executor session of the dispatcher session — a fix in the batch `{batch}`: its release PR #{release} is red ({checks}), and the task, merged into the batch already, is named guilty — fix it in the batch by the canon of this project, in its mode (`check` prints it; outside auto — commit, push and merge on the owner's «yes»): `{script} task status {number} \"{inProgress}\" --branch exec/fix/{number}-<slug>`, a new branch from a fresh origin/{batch}{previous}, the cause by the failed checks (`gh pr checks {release}`, their logs), the fix and its test, commits with `Refs #{number}`, the checks before a commit, PR into the batch (`gh pr create --base {batch}`, `Refs #{number}` in the body), `pr premerge`, merge. No CI wait, no deploy, no epic refresh and no `task close`: after the merge the dispatcher runs the release again — the full run on the same PR #{release}.",
|
|
113
113
|
"repeats": "- before the PR — repeats in the files the task changes anyway: fix them in the same PR, don't file a task for them; a repeat outside the task's files is the epic refresh's;",
|
|
114
114
|
"found": "- work found outside the task — `{script} task new …` (work of the task's epic — with `--epic`: the dispatcher picks it up) — name it in the answer: whether to queue it is the owner's call;",
|
|
115
115
|
"question": "- a question without a clear recommendation — into «{questions}» of the task; don't start the code that depends on it and answer the dispatcher: the owner's answer comes back here.",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"cloudDispatcher": "- the dispatcher waits for the task to close and closes it locally — the actual, the status, the merged branch, archiving this session: don't message it, don't archive the session;",
|
|
124
124
|
"cloudQuestion": "- a question without a clear recommendation — into «{questions}» of the task and to the owner in this session, don't start the code that depends on it; stopped (a question, a failure, a limit) — a «{state}» comment into the task.",
|
|
125
125
|
"sessionLead": "{task} #{number} «{title}» in {repo}{epic}: you are an executor session of the dispatcher session — do the task whole by the canon of this project, in its mode (`check` prints it; outside auto — commit, push and merge on the owner's «yes»): `{script} task start {number} --branch <type>/{number}-<slug>` (the task's questions and its parallel work — inside it), the branch from a fresh origin/main, code and tests, PR, green CI, `pr premerge`, merge, deploy, the epic refresh, `{script} task close {number}`.",
|
|
126
|
-
"sessionBatchLead": "{task} #{number} «{title}» in {repo}{epic}: you are an executor session of the dispatcher session, the task goes into the batch `{batch}` — do the task whole by the canon of this project, in its mode (`check` prints it; outside auto — commit, push and merge on the owner's «yes»): `{script} task start {number} --branch
|
|
126
|
+
"sessionBatchLead": "{task} #{number} «{title}» in {repo}{epic}: you are an executor session of the dispatcher session, the task goes into the batch `{batch}` — do the task whole by the canon of this project, in its mode (`check` prints it; outside auto — commit, push and merge on the owner's «yes»): `{script} task start {number} --branch exec/<type>/{number}-<slug>` (the task's questions and its parallel work — inside it), the branch from a fresh origin/{batch}, not from main, code and tests, the checks before a commit, PR into the batch (`gh pr create --base {batch}`), `pr premerge`, merge. No CI wait, no deploy, no epic refresh and no `task close`: the task stays «{inProgress}» till the batch's release — the dispatcher's, with one full CI run and one refresh per epic.",
|
|
127
127
|
"sessionIs": "You are a session, not a subagent:",
|
|
128
128
|
"sessionName": "- name the session `#{number} {title}` (`set_session_title`) once the task is taken — `est` links the session to the task by it;",
|
|
129
129
|
"sessionWait": "- wait for CI and the deploy with a background command — `{waitCi} pr <PR>` (after the merge — `merged <PR>`): its completion wakes the session; no `Monitor`, watcher loop or `ScheduleWakeup` on top;",
|