forgedock 1.60.1 → 1.61.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.
Files changed (70) hide show
  1. package/bin/config-schema.mjs +44 -1
  2. package/bin/engine/runlog.mjs +52 -0
  3. package/bin/engine-cli.mjs +9 -4
  4. package/bin/env/bench.mjs +38 -0
  5. package/bin/env/cli.mjs +134 -0
  6. package/bin/env/env.mjs +339 -0
  7. package/bin/forgedock.mjs +32 -3
  8. package/bin/help-text.mjs +2 -0
  9. package/bin/lean/ci-budget.mjs +3 -1
  10. package/bin/lean/ci-classify.mjs +74 -0
  11. package/bin/lean/ci-classify.test.mjs +147 -0
  12. package/bin/lean/ci-emit.mjs +175 -0
  13. package/bin/lean/ci-emit.test.mjs +177 -0
  14. package/bin/lean/ci-preflight.mjs +183 -0
  15. package/bin/lean/ci-preflight.test.mjs +122 -0
  16. package/bin/lean/ci-runner-health.mjs +213 -0
  17. package/bin/lean/ci-runner-health.test.mjs +113 -0
  18. package/bin/lean/ci-watch.mjs +79 -0
  19. package/bin/lean/ci-watch.test.mjs +80 -0
  20. package/bin/lean/depcache.mjs +38 -8
  21. package/bin/lean/deploy-stages.mjs +514 -0
  22. package/bin/lean/deploy-stages.test.mjs +580 -0
  23. package/bin/lean/effects.mjs +50 -0
  24. package/bin/lean/execution.mjs +8 -1
  25. package/bin/lean/lean.mjs +38 -6
  26. package/bin/lean/lean.test.mjs +61 -0
  27. package/bin/lean/release-deploy.mjs +12 -6
  28. package/bin/lean/release-flakes.mjs +16 -0
  29. package/bin/lean/release-flakes.test.mjs +15 -0
  30. package/bin/lean/release-gates.mjs +24 -1
  31. package/bin/lean/release-ledger.mjs +21 -0
  32. package/bin/lean/release-minutes-timing.test.mjs +57 -0
  33. package/bin/lean/release-minutes.mjs +98 -0
  34. package/bin/lean/release-promote.mjs +444 -0
  35. package/bin/lean/release-promote.test.mjs +470 -0
  36. package/bin/lean/release-rollback.mjs +14 -6
  37. package/bin/lean/release.mjs +31 -2
  38. package/bin/lean/sandbox-remote.mjs +11 -3
  39. package/bin/lean/testengine-recall.mjs +82 -0
  40. package/bin/lean/testengine-recall.test.mjs +103 -0
  41. package/bin/lean/testengine-shard.mjs +150 -0
  42. package/bin/lean/testengine-shard.test.mjs +111 -0
  43. package/bin/lean/testengine.mjs +486 -0
  44. package/bin/lean/testengine.test.mjs +303 -0
  45. package/bin/lean/verify-settle.test.mjs +156 -0
  46. package/bin/lean/verify.mjs +98 -3
  47. package/bin/pool/agent.mjs +57 -6
  48. package/bin/pool/ci-events.mjs +183 -0
  49. package/bin/pool/ci-events.test.mjs +143 -0
  50. package/bin/pool/docker.mjs +7 -0
  51. package/bin/pool/lane-tools.mjs +1 -0
  52. package/bin/pool/router.mjs +18 -0
  53. package/bin/pool/warm.mjs +1 -1
  54. package/bin/stats/ci-awareness.mjs +66 -0
  55. package/bin/stats/index.mjs +44 -3
  56. package/bin/stats/release-ledger.test.mjs +226 -0
  57. package/bin/stats/release.mjs +365 -1
  58. package/bin/stats/stats.test.mjs +36 -0
  59. package/docs/CI.md +31 -0
  60. package/docs/CONFIG.md +235 -2
  61. package/docs/ENV-LIBRARY.md +172 -0
  62. package/docs/STATS.md +43 -0
  63. package/docs/ci-events.md +88 -0
  64. package/docs/test-engine.md +98 -0
  65. package/package.json +1 -1
  66. package/pool/README.md +1 -0
  67. package/pool/image/entrypoint.sh +15 -3
  68. package/pool/services/docker-compose.yml +53 -0
  69. package/pool/services/git-mirror.sh +22 -0
  70. package/templates/github-actions/forge-env/action.yml +65 -0
@@ -0,0 +1,79 @@
1
+ // SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
2
+ // SPDX-License-Identifier: AGPL-3.0-or-later
3
+ /**
4
+ * #5692: step-granular CI awareness for the lane's merge wait. `watchCi` yields `step_failed` / `test_failed` events for
5
+ * one head sha: from the router's long-poll GET /ci/events (#5688) when it is configured and has events for the sha,
6
+ * else by polling the Actions jobs API and synthesizing `step_failed` from the first failed step of an in_progress job.
7
+ * Events only start a fix round; the GitHub check status stays the merge gate (lean.mjs). Never throws.
8
+ */
9
+ import { failFastDecision } from "./ci-classify.mjs";
10
+
11
+ export const POLL_MS = 15000, LONG_POLL_S = 25;
12
+ const FAIL_TYPES = new Set(["step_failed", "test_failed"]);
13
+ const FAILED = new Set(["failure", "timed_out"]);
14
+
15
+ /** First failed step of every in_progress job: [{job, step, completed_at, run_id}] (a finished job is the check poll's business). */
16
+ export function failedStepsOf(jobs, runId = null) {
17
+ const out = [];
18
+ for (const j of jobs ?? []) {
19
+ if (j?.status !== "in_progress") continue;
20
+ const s = (j.steps ?? []).find((x) => FAILED.has(String(x?.conclusion ?? "")));
21
+ if (s) out.push({ job: j.name ?? null, step: s.name ?? null, completed_at: s.completed_at ?? null, run_id: runId });
22
+ }
23
+ return out;
24
+ }
25
+
26
+ /**
27
+ * Async iterator of failure events for `sha`. `io`: ciEventsWait({repo,sha,pr,since,waitS}) -> {events,next}|null (router),
28
+ * runsForSha(sha) -> [{id|databaseId}], jobsOf(runId) -> [job]. `sleep`/`now` are injectable (fake clock in tests).
29
+ */
30
+ export async function* watchCi({ repo, sha, pr, io, sleep, now = Date.now, pollMs = POLL_MS, waitS = LONG_POLL_S, signal } = {}) {
31
+ const seen = new Set();
32
+ const fresh = (key) => (seen.has(key) ? false : (seen.add(key), true));
33
+ let since = 0, router = false;
34
+ const poll = async (w) => {
35
+ try { return (await io?.ciEventsWait?.({ repo, sha, pr, since, waitS: w })) ?? null; } catch { return null; }
36
+ };
37
+ if (io?.ciEventsWait) { // the router is used only when it has already emitted events for this sha
38
+ const first = await poll(0);
39
+ if (first?.events?.length) { router = true; since = first.next ?? since; for (const e of first.events) if (FAIL_TYPES.has(e.type) && fresh(`e${e.seq}`)) yield e; }
40
+ }
41
+ while (!signal?.aborted) {
42
+ if (router) {
43
+ const r = await poll(waitS);
44
+ if (!r) { await sleep(pollMs); continue; }
45
+ since = r.next ?? since;
46
+ for (const e of r.events ?? []) if (FAIL_TYPES.has(e.type) && fresh(`e${e.seq}`)) yield e;
47
+ continue;
48
+ }
49
+ try {
50
+ for (const run of (await io?.runsForSha?.(sha)) ?? []) {
51
+ const id = run.id ?? run.databaseId;
52
+ if (id == null || run.status === "completed") continue;
53
+ for (const f of failedStepsOf(await io.jobsOf(id), id)) {
54
+ if (fresh(`j${id}\n${f.job}\n${f.step}`)) yield { type: "step_failed", repo, sha, run_id: String(id), job: f.job, step: f.step, lines: [], ts: f.completed_at ?? new Date(now()).toISOString(), source: "jobs-api" };
55
+ }
56
+ }
57
+ } catch { /* the check poll still runs */ }
58
+ await sleep(pollMs);
59
+ }
60
+ }
61
+
62
+ /** One pending `next()` at a time, so the merge loop can race it against its own sleep: `next()` resolves an event or null once stopped. */
63
+ export function ciSignal(opts) {
64
+ const ac = new AbortController(), it = watchCi({ ...opts, signal: ac.signal });
65
+ let pending = null;
66
+ return {
67
+ next() {
68
+ pending ??= it.next().then((r) => { pending = null; return r.done ? null : r.value; }, () => { pending = null; return null; });
69
+ return pending;
70
+ },
71
+ stop() { ac.abort(); it.return?.().catch?.(() => {}); },
72
+ };
73
+ }
74
+
75
+ /** Cancel the run only when the classifier says downstream and the policy is `deterministic` (#5690). */
76
+ export const cancelDecision = (event, policy) => failFastDecision(event, policy);
77
+
78
+ /** Builder context for an event-triggered round: the failing step's lines and test id. */
79
+ export const eventLog = (e) => [e.test ? `test: ${e.test}` : null, e.step ? `step: ${e.step}` : null, ...(e.lines ?? [])].filter(Boolean).join("\n");
@@ -0,0 +1,80 @@
1
+ // SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
2
+ // SPDX-License-Identifier: AGPL-3.0-or-later
3
+ import { describe, it } from "node:test";
4
+ import assert from "node:assert/strict";
5
+ import { watchCi, ciSignal, failedStepsOf, cancelDecision, eventLog } from "./ci-watch.mjs";
6
+ import { tmpDir } from "../tests/_tmp.mjs";
7
+
8
+ /** Fake clock: sleep advances time, never waits. */
9
+ const clock = () => { const c = { t: 0 }; c.sleep = async (ms) => { c.t += ms; }; c.now = () => c.t; return c; };
10
+ const JOBS = [{ name: "build", status: "in_progress", conclusion: null, steps: [{ name: "setup", conclusion: "success" }, { name: "pnpm test", conclusion: "failure", completed_at: "2026-11-15T10:00:00Z" }, { name: "after", conclusion: null }] }];
11
+
12
+ describe("watchCi (#5692)", () => {
13
+ it("fallback: an in_progress job with one failed step yields step_failed on the next poll", async () => {
14
+ const c = clock(); let polls = 0;
15
+ const io = { runsForSha: async () => [{ id: 9, status: "in_progress" }], jobsOf: async () => (++polls < 2 ? [{ ...JOBS[0], steps: [{ name: "pnpm test", conclusion: null }] }] : JOBS) };
16
+ const it_ = watchCi({ repo: "o/r", sha: "abc", io, sleep: c.sleep, now: c.now });
17
+ const e = (await it_.next()).value;
18
+ assert.equal(e.type, "step_failed"); assert.equal(e.step, "pnpm test"); assert.equal(e.job, "build"); assert.equal(e.ts, "2026-11-15T10:00:00Z"); assert.equal(e.source, "jobs-api");
19
+ assert.equal(polls, 2); assert.equal(c.t, 15000, "one 15 s poll interval");
20
+ await it_.return();
21
+ });
22
+ it("fallback: the same failed step is yielded once; finished jobs and runs are not synthesized", async () => {
23
+ assert.deepEqual(failedStepsOf([{ ...JOBS[0], status: "completed" }]), []);
24
+ assert.equal(failedStepsOf(JOBS).length, 1);
25
+ const c = clock(); let n = 0;
26
+ const io = { runsForSha: async () => [{ id: 9, status: "in_progress" }, { id: 8, status: "completed" }], jobsOf: async (id) => { assert.equal(id, 9); return JOBS; } };
27
+ const sig = ciSignal({ repo: "o/r", sha: "abc", io, sleep: async (ms) => { c.t += ms; if (++n > 3) await new Promise(() => {}); }, now: c.now });
28
+ assert.equal((await sig.next()).type, "step_failed");
29
+ const second = await Promise.race([sig.next(), new Promise((r) => setTimeout(() => r("none"), 20))]);
30
+ assert.equal(second, "none"); sig.stop();
31
+ });
32
+ it("router: yields step_failed/test_failed from the long-poll when it has events for the sha, and resumes from the cursor", async () => {
33
+ const c = clock(), calls = [];
34
+ const batches = [{ events: [{ seq: 1, type: "step_started" }, { seq: 2, type: "step_failed", step: "lint", lines: ["x"] }], next: 2 }, { events: [{ seq: 3, type: "test_failed", test: "t" }], next: 3 }];
35
+ const io = { ciEventsWait: async (q) => { calls.push(q.since); return batches.shift() ?? { events: [], next: 3 }; }, runsForSha: async () => { throw new Error("must not poll the jobs API"); } };
36
+ const it_ = watchCi({ repo: "o/r", sha: "abc", io, sleep: c.sleep, now: c.now });
37
+ assert.equal((await it_.next()).value.step, "lint");
38
+ assert.equal((await it_.next()).value.test, "t");
39
+ assert.deepEqual(calls.slice(0, 2), [0, 2]); await it_.return();
40
+ });
41
+ it("router configured but silent for the sha: falls back to the jobs API", async () => {
42
+ const c = clock();
43
+ const io = { ciEventsWait: async () => ({ events: [], next: 0 }), runsForSha: async () => [{ id: 1, status: "queued" }], jobsOf: async () => JOBS };
44
+ const it_ = watchCi({ repo: "o/r", sha: "abc", io, sleep: c.sleep, now: c.now });
45
+ assert.equal((await it_.next()).value.source, "jobs-api"); await it_.return();
46
+ });
47
+ it("an unreachable io never throws", async () => {
48
+ const c = clock(); let n = 0;
49
+ const io = { runsForSha: async () => { throw new Error("HTTP 502"); } };
50
+ const sig = ciSignal({ repo: "o/r", sha: "a", io, sleep: async (ms) => { c.t += ms; if (++n > 2) await new Promise(() => {}); }, now: c.now });
51
+ assert.equal(await Promise.race([sig.next(), new Promise((r) => setTimeout(() => r("quiet"), 20))]), "quiet"); sig.stop();
52
+ });
53
+ });
54
+
55
+ describe("cancelDecision (#5692)", () => {
56
+ const setup = { type: "step_failed", step: "pnpm install", lines: ["ERR_PNPM_OUTDATED_LOCKFILE Cannot install with frozen-lockfile"] };
57
+ const code = { type: "test_failed", test: "a.test.ts > adds", lines: ["AssertionError: expected 1 to be 2"] };
58
+ it("cancels only for a downstream class under policy deterministic", () => {
59
+ assert.equal(cancelDecision({ ...setup, class: "deterministic-setup" }, { fail_fast: "deterministic" }).action, "cancel");
60
+ assert.equal(cancelDecision({ ...setup, class: "generated-artifact-stale" }, "deterministic").action, "cancel");
61
+ assert.equal(cancelDecision(code, "deterministic").action, "continue");
62
+ for (const class_ of ["code", "infra", "flaky-suspect"]) assert.equal(cancelDecision({ ...code, class: class_ }, "deterministic").action, "continue");
63
+ for (const policy of [undefined, "off", { fail_fast: "off" }, {}]) assert.equal(cancelDecision({ ...setup, class: "deterministic-setup" }, policy).action, "continue");
64
+ });
65
+ it("eventLog carries the test id, step and lines to the builder", () => {
66
+ assert.equal(eventLog({ test: "t1", step: "s", lines: ["l1", "l2"] }), "test: t1\nstep: s\nl1\nl2");
67
+ });
68
+ });
69
+
70
+ describe("forge.yaml ci.fail_fast plumbing (#5692)", () => {
71
+ it("readCiFailFast returns deterministic only for that value", async () => {
72
+ const { writeFileSync } = await import("node:fs"), { tmpdir } = await import("node:os"), { join } = await import("node:path");
73
+ const { readCiFailFast } = await import("../engine-cli.mjs");
74
+ const at = (yaml) => { const d = tmpDir("ci-ff-"); writeFileSync(join(d, "forge.yaml"), yaml); return readCiFailFast(d); };
75
+ assert.equal(at("ci:\n fail_fast: deterministic\n"), "deterministic");
76
+ assert.equal(at("ci:\n fail_fast: off\n"), undefined);
77
+ assert.equal(at("name: x\n"), undefined);
78
+ assert.equal(readCiFailFast(join(tmpdir(), "no-such-dir-5692")), undefined);
79
+ });
80
+ });
@@ -143,6 +143,10 @@ export function pySatisfies(spec, v) {
143
143
  return String(spec).split("||").some((grp) => grp.replace(/(\^|~=|~|==|!=|>=|<=|>|<)\s+/g, "$1").split(/[,\s]+/).filter(Boolean).every((c) => clauseOk(c, v)));
144
144
  }
145
145
  /** Full frozen install on a miss, and the warm no-op repair pass on a hit (null: nothing path-dependent to repair). */
146
+ export { commands as depCommands };
147
+ /** The files a component's key hashes, relative to its own dir (lockfile, manifests, package-manager config). */
148
+ const keyFiles = (d, pkgs) => (JS.has(d.eco) ? [d.lock, ...pkgs, "pnpm-workspace.yaml", ".npmrc", ".yarnrc.yml"] : [d.lock, "pyproject.toml", ".python-version"]);
149
+ const expectedTrees = (d, pkgs) => (JS.has(d.eco) ? [...new Set(pkgs.map((p) => (dirname(p) === "." ? "node_modules" : `${dirname(p)}/node_modules`)))] : [".venv"]);
146
150
  function commands(d, py = null) {
147
151
  // #5651: with an in-range interpreter poetry itself runs under it (`<py> -m poetry`), so its resolver never sees the host default python.
148
152
  const poetry = (args) => (py ? [py.cmd, ["-m", "poetry", ...args]] : ["poetry", args]);
@@ -168,6 +172,7 @@ export function makeDepCache({ root = depcacheRoot(), exec, fs = nodeFs, now = (
168
172
  env: procEnv = process.env, installTimeoutMs = DEPCACHE_INSTALL_TIMEOUT_MS, lockWaitMs = DEPCACHE_INSTALL_TIMEOUT_MS, pollMs = 1000,
169
173
  sleep = (ms) => new Promise((r) => setTimeout(r, ms)) } = {}) {
170
174
  const disabled = () => String(procEnv.FORGE_DEPCACHE ?? "").trim() === "0";
175
+ const api = {}; // filled at the end; the env-library hook in prepare() passes it on
171
176
  const store = (n) => join(root, STORES, n);
172
177
 
173
178
  /** Shared package-manager stores for every runner call, so the builder's own installs reuse them too. */
@@ -227,8 +232,7 @@ export function makeDepCache({ root = depcacheRoot(), exec, fs = nodeFs, now = (
227
232
  const h = createHash("sha256").update(`v1\0${d.eco}\0${process.platform}-${process.arch}\0`);
228
233
  if (d.dir) h.update(`${d.dir}\0`);
229
234
  h.update(py ? py.version : await runtime(JS.has(d.eco) ? "node" : "python3")).update("\0");
230
- const files = JS.has(d.eco) ? [d.lock, ...pkgs, "pnpm-workspace.yaml", ".npmrc", ".yarnrc.yml"] : [d.lock, "pyproject.toml", ".python-version"];
231
- for (const f of files) {
235
+ for (const f of keyFiles(d, pkgs)) {
232
236
  h.update(`${f}\0`);
233
237
  try { h.update(fs.readFileSync(join(wt, f))); } catch { h.update("<absent>"); }
234
238
  h.update("\0");
@@ -352,7 +356,7 @@ export function makeDepCache({ root = depcacheRoot(), exec, fs = nodeFs, now = (
352
356
  }
353
357
  }
354
358
 
355
- async function prepareOne(wt, keyRoot, d, laneEnv) {
359
+ async function prepareOne(wt, keyRoot, d, laneEnv, publishSnap = true) {
356
360
  const t0 = now();
357
361
  let repaired = null;
358
362
  const done = (status, extra = {}) => ({ status, eco: d.eco, key: extra.key ?? null, ms: now() - t0, reason: extra.reason ?? repaired, ...(extra.published === undefined ? {} : { published: extra.published }) });
@@ -373,7 +377,7 @@ export function makeDepCache({ root = depcacheRoot(), exec, fs = nodeFs, now = (
373
377
  const key = await keyOf(wt, d, pkgs, py);
374
378
  const snap = join(keyRoot, `${d.eco}-${key}`);
375
379
  const cmds = commands(d, py);
376
- const expected = JS.has(d.eco) ? [...new Set(pkgs.map((p) => (dirname(p) === "." ? "node_modules" : `${dirname(p)}/node_modules`)))] : [".venv"];
380
+ const expected = expectedTrees(d, pkgs);
377
381
  const existing = expected.filter((t) => present(join(wt, t)));
378
382
  if (existing.length) {
379
383
  const broken = brokenTrees(wt, d, existing);
@@ -419,6 +423,10 @@ export function makeDepCache({ root = depcacheRoot(), exec, fs = nodeFs, now = (
419
423
  return { trees: treesOf(wt, d, pkgs) };
420
424
  };
421
425
 
426
+ if (!publishSnap) { // env snapshot build: the caller publishes the trees itself
427
+ const ins = await install();
428
+ return ins.failed ?? done("miss-installed", { key, published: false, reason: "publish off" });
429
+ }
422
430
  const lockPath = `${snap}.lock`;
423
431
  const r = await withLock(lockPath, async () => {
424
432
  if (fs.existsSync(join(snap, "manifest.json"))) return materialize(); // hit, or another lane published while we waited
@@ -445,22 +453,44 @@ export function makeDepCache({ root = depcacheRoot(), exec, fs = nodeFs, now = (
445
453
  * Materialize or build node_modules/.venv for `wt`; one result per detected ecosystem. Never throws.
446
454
  * `env` (#4347): the lane's toolchain env (PATH with the pinned pm shims) for install/repair; absent means the host PATH.
447
455
  */
448
- async function prepare({ wt, repoKey, env: laneEnv } = {}) {
456
+ async function prepare({ wt, repoKey, env: laneEnv, publish: publishSnap = true } = {}) {
449
457
  if (disabled()) return [{ status: "skipped", eco: null, key: null, ms: 0, reason: "FORGE_DEPCACHE=0" }];
450
458
  let found;
451
459
  try { found = detect(fs, wt); } catch (e) { return [{ status: "failed", eco: null, key: null, ms: 0, reason: msg(e) }]; }
452
460
  if (!found.length) return [{ status: "skipped", eco: null, key: null, ms: 0, reason: "no lockfile" }];
461
+ let envHit = null;
462
+ if (String(procEnv.FORGE_ENV_SNAPSHOTS ?? "").trim() === "1" && publishSnap) {
463
+ // Environment library (bin/env): a whole-environment snapshot for this exact lock set is claimed by rename. The loop
464
+ // below then finds complete trees (same completeness check as any existing tree); a miss or error is today's path.
465
+ try { envHit = await (await import("../env/env.mjs")).claimForLane({ wt, deps: api, fs, env: procEnv, now }); } catch { envHit = null; }
466
+ }
453
467
  const keyRoot = join(root, safeSegment(repoKey ?? "repo"));
454
468
  const out = [];
455
469
  for (const d of found) {
456
470
  try {
457
- const r = await prepareOne(d.dir ? join(wt, d.dir) : wt, keyRoot, d, laneEnv && typeof laneEnv === "object" ? laneEnv : undefined);
458
- out.push({ ...r, dir: d.dir ?? "." });
471
+ const r = await prepareOne(d.dir ? join(wt, d.dir) : wt, keyRoot, d, laneEnv && typeof laneEnv === "object" ? laneEnv : undefined, publishSnap);
472
+ const claimed = envHit && r.status === "skipped" && /already exists in the worktree$/.test(String(r.reason ?? ""));
473
+ out.push(claimed ? { ...r, status: "hit", key: envHit.key, ms: r.ms + (out.some((x) => x.env) ? 0 : envHit.ms), reason: `env snapshot (${envHit.mode})`, env: true, dir: d.dir ?? "." } : { ...r, dir: d.dir ?? "." });
459
474
  } catch (e) { out.push({ status: "failed", eco: d.eco, key: null, ms: 0, reason: msg(e), dir: d.dir ?? "." }); }
460
475
  }
461
476
  return out;
462
477
  }
463
478
 
479
+ /**
480
+ * What `prepare` would install for `wt`, without installing: one entry per detected ecosystem with the files its key
481
+ * hashes (`inputs`) and the trees an install leaves (`trees`), both relative to `wt`. Used by the environment library.
482
+ */
483
+ async function describe({ wt } = {}) {
484
+ const out = [];
485
+ for (const d of detect(fs, wt)) {
486
+ const base = d.dir ? join(wt, d.dir) : wt, at = (f) => (d.dir ? `${d.dir}/${f}` : f);
487
+ const pkgs = !d.skip && JS.has(d.eco) ? await manifests(base) : [];
488
+ out.push({ eco: d.eco, lock: d.lock, dir: d.dir ?? ".", ...(d.berry ? { berry: true } : {}), ...(d.skip ? { skip: d.skip } : {}),
489
+ inputs: d.skip ? [] : keyFiles(d, pkgs).map(at), trees: d.skip ? [] : expectedTrees(d, pkgs).map(at) });
490
+ }
491
+ return out;
492
+ }
493
+
464
494
  /**
465
495
  * Read-only scan for the reaper: snapshots unused for maxAgeMs, tmp dirs of dead publishers, locks of dead holders on
466
496
  * this host. Only names this module creates are listed. Each entry: {name, path, kind: snapshot|tmp|lock, ageMs, locked?, reason};
@@ -514,6 +544,6 @@ export function makeDepCache({ root = depcacheRoot(), exec, fs = nodeFs, now = (
514
544
  return removed;
515
545
  }
516
546
 
517
- return { env, prepare, prune, scan, remove, root };
547
+ return Object.assign(api, { env, prepare, describe, prune, scan, remove, root, linkTree, readOnly });
518
548
  }
519
549