@dialecte/cli 0.2.2 → 0.2.3

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 (2) hide show
  1. package/dist/cli.js +517 -476
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -4523,7 +4523,7 @@ function parseFixtureOptions(params) {
4523
4523
  }
4524
4524
 
4525
4525
  // src/commands/gate.ts
4526
- import { join as join34 } from "path";
4526
+ import { join as join35 } from "path";
4527
4527
 
4528
4528
  // src/lib/gate-records/check-key.ts
4529
4529
  import { createHash as createHash2 } from "crypto";
@@ -5434,6 +5434,9 @@ var MESSAGE_LINES = 6;
5434
5434
  var PROVES_NOTHING = "it ran green: this test proves nothing yet";
5435
5435
  var FROZEN_AFTER_RED = "tests are frozen after red; go back to the test station";
5436
5436
  var VITEST_COMMAND = ["npx", "--no-install", "vitest", "run"];
5437
+ var VITEST_BIN_PATH = ["node_modules", ".bin", "vitest"];
5438
+ var VITEST_RUN_ARGUMENT = "run";
5439
+ var REPOSITORY_MARKER = ".git";
5437
5440
  var RUN_OUTPUT_TAIL_LINES = 20;
5438
5441
  var NO_RED_RECEIPT = "no red receipt: the test station runs tdd red first";
5439
5442
  var TDD_SUBCOMMANDS = ["red", "green", "status"];
@@ -7496,8 +7499,8 @@ function unknownKeyOf(params) {
7496
7499
  }
7497
7500
 
7498
7501
  // src/lib/tdd/tdd-state.ts
7499
- import { existsSync as existsSync31 } from "fs";
7500
- import { join as join33 } from "path";
7502
+ import { existsSync as existsSync32 } from "fs";
7503
+ import { join as join34 } from "path";
7501
7504
 
7502
7505
  // src/lib/tdd/case-status.ts
7503
7506
  function caseStatusOf(params) {
@@ -7698,17 +7701,44 @@ function isFile3(path) {
7698
7701
  }
7699
7702
 
7700
7703
  // src/lib/tdd/run-test-cases.ts
7701
- import { existsSync as existsSync29, mkdtempSync as mkdtempSync3, readFileSync as readFileSync23, rmSync as rmSync9 } from "fs";
7704
+ import { existsSync as existsSync30, mkdtempSync as mkdtempSync3, readFileSync as readFileSync23, rmSync as rmSync9 } from "fs";
7702
7705
  import { tmpdir as tmpdir3 } from "os";
7703
- import { dirname as dirname14, join as join31 } from "path";
7706
+ import { dirname as dirname15, join as join32 } from "path";
7704
7707
  import { fileURLToPath as fileURLToPath2 } from "url";
7708
+
7709
+ // src/lib/tdd/package-vitest.ts
7710
+ import { existsSync as existsSync29 } from "fs";
7711
+ import { dirname as dirname14, join as join31 } from "path";
7712
+ function resolvePackageVitest(params) {
7713
+ const binary = findBinary({ root: params.root });
7714
+ if (binary) return { command: binary, arguments: [VITEST_RUN_ARGUMENT] };
7715
+ const [command, ...commandArguments] = VITEST_COMMAND;
7716
+ return { command, arguments: commandArguments };
7717
+ }
7718
+ function findBinary(params) {
7719
+ const folders = walkedFolders({ root: params.root });
7720
+ return folders.map((folder) => join31(folder, ...VITEST_BIN_PATH)).find((path) => existsSync29(path));
7721
+ }
7722
+ function walkedFolders(params) {
7723
+ const folders = [];
7724
+ let folder = params.root;
7725
+ for (; ; ) {
7726
+ folders.push(folder);
7727
+ if (existsSync29(join31(folder, REPOSITORY_MARKER))) return folders;
7728
+ const parent = dirname14(folder);
7729
+ if (parent === folder) return [params.root];
7730
+ folder = parent;
7731
+ }
7732
+ }
7733
+
7734
+ // src/lib/tdd/run-test-cases.ts
7705
7735
  async function runTestCases(params) {
7706
- const folder = mkdtempSync3(join31(tmpdir3(), "dialecte-tdd-"));
7707
- const reportPath = join31(folder, "report.json");
7736
+ const folder = mkdtempSync3(join32(tmpdir3(), "dialecte-tdd-"));
7737
+ const reportPath = join32(folder, "report.json");
7708
7738
  const { filter } = params;
7709
7739
  const nameFilter = filter === "all" ? [] : ["-t", filter === "collect" ? COLLECT_ONLY_PATTERN : namePattern(filter.names)];
7710
7740
  try {
7711
- const [command, ...commandArguments] = VITEST_COMMAND;
7741
+ const { command, arguments: commandArguments } = resolvePackageVitest({ root: params.root });
7712
7742
  const execution = await runChild({
7713
7743
  command,
7714
7744
  args: [
@@ -7738,7 +7768,7 @@ async function runTestCases(params) {
7738
7768
  ${execution.stalled.report}
7739
7769
  ${tail}`.trimEnd()
7740
7770
  };
7741
- if (!existsSync29(reportPath))
7771
+ if (!existsSync30(reportPath))
7742
7772
  return {
7743
7773
  failure: `vitest wrote no report (exit ${execution.exitCode ?? "none"}):
7744
7774
  ${tail}`
@@ -7755,17 +7785,17 @@ function namePattern(names) {
7755
7785
  return `^(?:${alternatives.join("|")})$`;
7756
7786
  }
7757
7787
  function reporterPath() {
7758
- const folder = dirname14(fileURLToPath2(import.meta.url));
7759
- const found = REPORTER_FILE_NAMES.map((name) => join31(folder, name)).find(
7760
- (path) => existsSync29(path)
7788
+ const folder = dirname15(fileURLToPath2(import.meta.url));
7789
+ const found = REPORTER_FILE_NAMES.map((name) => join32(folder, name)).find(
7790
+ (path) => existsSync30(path)
7761
7791
  );
7762
7792
  if (!found) throw new Error(`the tdd reporter is missing next to ${folder}`);
7763
7793
  return found;
7764
7794
  }
7765
7795
 
7766
7796
  // src/lib/tdd/test-dependencies.ts
7767
- import { existsSync as existsSync30, readFileSync as readFileSync24 } from "fs";
7768
- import { basename as basename3, dirname as dirname15, join as join32, posix } from "path";
7797
+ import { existsSync as existsSync31, readFileSync as readFileSync24 } from "fs";
7798
+ import { basename as basename3, dirname as dirname16, join as join33, posix } from "path";
7769
7799
  function listTestDependencies(params) {
7770
7800
  const { root } = params;
7771
7801
  const found = /* @__PURE__ */ new Set();
@@ -7777,7 +7807,7 @@ function listTestDependencies(params) {
7777
7807
  while (queue.length) {
7778
7808
  while (queue.length) {
7779
7809
  const current = queue.shift() ?? "";
7780
- const text = readFileSync24(join32(root, current), "utf8");
7810
+ const text = readFileSync24(join33(root, current), "utf8");
7781
7811
  texts.push(text);
7782
7812
  if (!SOURCE_FILE_PATTERN.test(current)) continue;
7783
7813
  for (const specifier of moduleSpecifiers({ text, file: current })) {
@@ -7795,13 +7825,13 @@ function listTestDependencies(params) {
7795
7825
  queue.push(resolved);
7796
7826
  } else if (!productionRead.has(resolved)) {
7797
7827
  productionRead.add(resolved);
7798
- texts.push(readFileSync24(join32(root, resolved), "utf8"));
7828
+ texts.push(readFileSync24(join33(root, resolved), "utf8"));
7799
7829
  }
7800
7830
  }
7801
7831
  }
7802
7832
  for (const candidate of params.changedTestCode) {
7803
7833
  if (followed.has(candidate)) continue;
7804
- const withFolder = posix.join(basename3(dirname15(candidate)), basename3(candidate));
7834
+ const withFolder = posix.join(basename3(dirname16(candidate)), basename3(candidate));
7805
7835
  if (texts.some((text) => text.includes(withFolder))) {
7806
7836
  found.add(candidate);
7807
7837
  followed.add(candidate);
@@ -7809,8 +7839,8 @@ function listTestDependencies(params) {
7809
7839
  } else if (texts.some((text) => text.includes(basename3(candidate)))) found.add(candidate);
7810
7840
  }
7811
7841
  }
7812
- const snapshot = join32(dirname15(params.file), "__snapshots__", `${basename3(params.file)}.snap`);
7813
- if (existsSync30(join32(root, snapshot))) found.add(snapshot);
7842
+ const snapshot = join33(dirname16(params.file), "__snapshots__", `${basename3(params.file)}.snap`);
7843
+ if (existsSync31(join33(root, snapshot))) found.add(snapshot);
7814
7844
  return { dependencies: [...found].sort(), unresolved: [...unresolved].sort() };
7815
7845
  }
7816
7846
 
@@ -7901,7 +7931,7 @@ function findDeletedCases(params) {
7901
7931
  params.ledger.entries.flatMap((entry) => entry.kind === "freeze" ? [] : [entry.file])
7902
7932
  );
7903
7933
  for (const file of receiptFiles)
7904
- if (!existsSync31(join33(params.root, file)) && readAtBase({ ...params, file }) === void 0)
7934
+ if (!existsSync32(join34(params.root, file)) && readAtBase({ ...params, file }) === void 0)
7905
7935
  findings.push({ verb: "deleted", file, detail: "a new test file deleted after its receipts" });
7906
7936
  return findings;
7907
7937
  }
@@ -8065,7 +8095,7 @@ async function runGate(params) {
8065
8095
  const underHandover = "folder" in hold ? [
8066
8096
  GATE_UNDER_HANDOVER.replace("{folder}", hold.folder).replace(
8067
8097
  "{lots}",
8068
- join34(hold.folder, HANDOVER_FILES.lots)
8098
+ join35(hold.folder, HANDOVER_FILES.lots)
8069
8099
  )
8070
8100
  ] : [];
8071
8101
  const packageJson = readPackageJson(cwd);
@@ -8316,9 +8346,9 @@ function renderRerun(rerun) {
8316
8346
  }
8317
8347
 
8318
8348
  // src/commands/handover.ts
8319
- import { existsSync as existsSync51, realpathSync as realpathSync8 } from "fs";
8349
+ import { existsSync as existsSync52, realpathSync as realpathSync8 } from "fs";
8320
8350
  import { tmpdir as tmpdir6 } from "os";
8321
- import { dirname as dirname24, join as join58, resolve as resolve18 } from "path";
8351
+ import { dirname as dirname25, join as join59, resolve as resolve18 } from "path";
8322
8352
 
8323
8353
  // src/lib/card/card.constants.ts
8324
8354
  var EMPHASIS_CODES = { passed: 32, warning: 33, failed: 31, strong: 1 };
@@ -8511,10 +8541,7 @@ function resolveCardColumns(params) {
8511
8541
  }
8512
8542
 
8513
8543
  // src/lib/handover/handover-card.ts
8514
- import { spawnSync as spawnSync10 } from "child_process";
8515
- import { closeSync as closeSync2, mkdtempSync as mkdtempSync4, openSync as openSync2, readFileSync as readFileSync32, rmSync as rmSync12 } from "fs";
8516
- import { tmpdir as tmpdir4 } from "os";
8517
- import { basename as basename5, join as join45 } from "path";
8544
+ import { basename as basename5 } from "path";
8518
8545
 
8519
8546
  // src/lib/counted.ts
8520
8547
  function counted(params) {
@@ -8522,8 +8549,8 @@ function counted(params) {
8522
8549
  }
8523
8550
 
8524
8551
  // src/lib/gate-records/card-gates.ts
8525
- import { existsSync as existsSync37, readdirSync as readdirSync10, readFileSync as readFileSync29 } from "fs";
8526
- import { join as join40 } from "path";
8552
+ import { existsSync as existsSync38, readdirSync as readdirSync10, readFileSync as readFileSync29 } from "fs";
8553
+ import { join as join41 } from "path";
8527
8554
 
8528
8555
  // src/lib/mutation/pending-verdict.constants.ts
8529
8556
  var MUTATION_GATE_NAME = "mutation";
@@ -8546,8 +8573,8 @@ var GATE_LOT_WITHOUT_RUN = "gate lot: run dialecte mutants run on this tree firs
8546
8573
  var INVALID_FOLDER_MODE = '{file}: "mutation" must be one of {modes}, not {value}';
8547
8574
 
8548
8575
  // src/lib/mutation/pending-verdict.ts
8549
- import { existsSync as existsSync35 } from "fs";
8550
- import { join as join39 } from "path";
8576
+ import { existsSync as existsSync36 } from "fs";
8577
+ import { join as join40 } from "path";
8551
8578
 
8552
8579
  // src/lib/mutation/mutation.constants.ts
8553
8580
  var MUTATION_RECORDS_PATH = ".dialecte/mutation-records.json";
@@ -8697,7 +8724,7 @@ function isNonEmptyString(value) {
8697
8724
  import { randomBytes as randomBytes2 } from "crypto";
8698
8725
  import {
8699
8726
  closeSync,
8700
- existsSync as existsSync34,
8727
+ existsSync as existsSync35,
8701
8728
  linkSync,
8702
8729
  mkdirSync as mkdirSync9,
8703
8730
  openSync,
@@ -8707,7 +8734,7 @@ import {
8707
8734
  statSync as statSync7,
8708
8735
  writeSync
8709
8736
  } from "fs";
8710
- import { join as join37 } from "path";
8737
+ import { join as join38 } from "path";
8711
8738
 
8712
8739
  // src/lib/process-start-time.ts
8713
8740
  import { spawnSync as spawnSync7 } from "child_process";
@@ -8992,11 +9019,11 @@ function shortHash(params) {
8992
9019
  }
8993
9020
 
8994
9021
  // src/lib/mutation/records-file.ts
8995
- import { existsSync as existsSync32, mkdirSync as mkdirSync7, readFileSync as readFileSync25, writeFileSync as writeFileSync13 } from "fs";
8996
- import { dirname as dirname16, join as join35 } from "path";
9022
+ import { existsSync as existsSync33, mkdirSync as mkdirSync7, readFileSync as readFileSync25, writeFileSync as writeFileSync13 } from "fs";
9023
+ import { dirname as dirname17, join as join36 } from "path";
8997
9024
  function readRecordsFile(params) {
8998
- const path = join35(params.root, MUTATION_RECORDS_PATH);
8999
- if (!existsSync32(path)) return {};
9025
+ const path = join36(params.root, MUTATION_RECORDS_PATH);
9026
+ if (!existsSync33(path)) return {};
9000
9027
  try {
9001
9028
  return JSON.parse(readFileSync25(path, "utf8"));
9002
9029
  } catch (error) {
@@ -9004,8 +9031,8 @@ function readRecordsFile(params) {
9004
9031
  }
9005
9032
  }
9006
9033
  function writeRecordsFile(params) {
9007
- const path = join35(params.root, MUTATION_RECORDS_PATH);
9008
- mkdirSync7(dirname16(path), { recursive: true });
9034
+ const path = join36(params.root, MUTATION_RECORDS_PATH);
9035
+ mkdirSync7(dirname17(path), { recursive: true });
9009
9036
  writeFileSync13(path, `${JSON.stringify(params.records, null, " ")}
9010
9037
  `);
9011
9038
  }
@@ -9013,14 +9040,14 @@ function writeRecordsFile(params) {
9013
9040
  // src/lib/mutation/run-store.ts
9014
9041
  import { randomBytes } from "crypto";
9015
9042
  import {
9016
- existsSync as existsSync33,
9043
+ existsSync as existsSync34,
9017
9044
  mkdirSync as mkdirSync8,
9018
9045
  readdirSync as readdirSync9,
9019
9046
  readFileSync as readFileSync26,
9020
9047
  renameSync as renameSync2,
9021
9048
  writeFileSync as writeFileSync14
9022
9049
  } from "fs";
9023
- import { basename as basename4, join as join36 } from "path";
9050
+ import { basename as basename4, join as join37 } from "path";
9024
9051
  function startRun(params) {
9025
9052
  const { root, pid, lot, tree, mode, base, targets } = params;
9026
9053
  const startedAt = (params.now ?? /* @__PURE__ */ new Date()).toISOString();
@@ -9065,9 +9092,9 @@ function readRuns(params) {
9065
9092
  }
9066
9093
  function readStoredRuns(root) {
9067
9094
  const folder = runsFolderOf(root);
9068
- if (!existsSync33(folder)) return [];
9095
+ if (!existsSync34(folder)) return [];
9069
9096
  return readdirSync9(folder).filter((file) => file.endsWith(".json")).flatMap((file) => {
9070
- const entry = parseRunEntry(join36(folder, file));
9097
+ const entry = parseRunEntry(join37(folder, file));
9071
9098
  return entry ? [entry] : [];
9072
9099
  }).sort((first, second) => first.startedAt.localeCompare(second.startedAt));
9073
9100
  }
@@ -9085,7 +9112,7 @@ function abandonRun(params) {
9085
9112
  return { ok: true };
9086
9113
  }
9087
9114
  function mutationStoreFolderOf(root) {
9088
- return join36(commonGitFolderOf(root), MUTATION_STORE_FOLDER);
9115
+ return join37(commonGitFolderOf(root), MUTATION_STORE_FOLDER);
9089
9116
  }
9090
9117
  function packageNameOf(root) {
9091
9118
  return readPackageJson(root).name ?? basename4(root);
@@ -9096,20 +9123,20 @@ function writeAtomically(params) {
9096
9123
  renameSync2(written, params.path);
9097
9124
  }
9098
9125
  function runsFolderOf(root) {
9099
- return join36(mutationStoreFolderOf(root), MUTATION_RUNS_FOLDER);
9126
+ return join37(mutationStoreFolderOf(root), MUTATION_RUNS_FOLDER);
9100
9127
  }
9101
9128
  function writeRunEntry(params) {
9102
9129
  const folder = runsFolderOf(params.root);
9103
9130
  mkdirSync8(folder, { recursive: true });
9104
9131
  writeAtomically({
9105
- path: join36(folder, `${params.entry.runId}.json`),
9132
+ path: join37(folder, `${params.entry.runId}.json`),
9106
9133
  text: `${JSON.stringify(params.entry, null, " ")}
9107
9134
  `
9108
9135
  });
9109
9136
  }
9110
9137
  function readStoredRun(params) {
9111
- const path = join36(runsFolderOf(params.root), `${params.runId}.json`);
9112
- return existsSync33(path) ? parseRunEntry(path) : void 0;
9138
+ const path = join37(runsFolderOf(params.root), `${params.runId}.json`);
9139
+ return existsSync34(path) ? parseRunEntry(path) : void 0;
9113
9140
  }
9114
9141
  function parseRunEntry(path) {
9115
9142
  try {
@@ -9213,13 +9240,13 @@ function withLedgerLock(params) {
9213
9240
  const { root, given, work } = params;
9214
9241
  const folder = mutationStoreFolderOf(root);
9215
9242
  mkdirSync9(folder, { recursive: true });
9216
- const lock = join37(folder, MUTATION_LEDGER_LOCK_FILE);
9243
+ const lock = join38(folder, MUTATION_LEDGER_LOCK_FILE);
9217
9244
  takeLock(lock);
9218
9245
  try {
9219
9246
  const state = {
9220
- ledger: readJson({ path: join37(folder, MUTATION_LEDGER_FILE), empty: {} }),
9247
+ ledger: readJson({ path: join38(folder, MUTATION_LEDGER_FILE), empty: {} }),
9221
9248
  applied: new Set(
9222
- readJson({ path: join37(folder, MUTATION_APPLIED_RUNS_FILE), empty: [] })
9249
+ readJson({ path: join38(folder, MUTATION_APPLIED_RUNS_FILE), empty: [] })
9223
9250
  ),
9224
9251
  // the ledger file exists once anything took it in: a reader of a fresh store writes nothing
9225
9252
  changed: false
@@ -9228,12 +9255,12 @@ function withLedgerLock(params) {
9228
9255
  const result = work(state);
9229
9256
  if (state.changed) {
9230
9257
  writeAtomically({
9231
- path: join37(folder, MUTATION_LEDGER_FILE),
9258
+ path: join38(folder, MUTATION_LEDGER_FILE),
9232
9259
  text: `${JSON.stringify(state.ledger, null, " ")}
9233
9260
  `
9234
9261
  });
9235
9262
  writeAtomically({
9236
- path: join37(folder, MUTATION_APPLIED_RUNS_FILE),
9263
+ path: join38(folder, MUTATION_APPLIED_RUNS_FILE),
9237
9264
  text: `${JSON.stringify([...state.applied], null, " ")}
9238
9265
  `
9239
9266
  });
@@ -9259,7 +9286,7 @@ function compareRunsInFoldOrder(first, second) {
9259
9286
  function nothingMore() {
9260
9287
  }
9261
9288
  function recordsOfRun(run25) {
9262
- if (run25.packageRoot === void 0 || !existsSync34(run25.packageRoot)) return {};
9289
+ if (run25.packageRoot === void 0 || !existsSync35(run25.packageRoot)) return {};
9263
9290
  try {
9264
9291
  return readRecordsFile({ root: run25.packageRoot });
9265
9292
  } catch {
@@ -9415,7 +9442,7 @@ function sleep(milliseconds) {
9415
9442
  Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, milliseconds);
9416
9443
  }
9417
9444
  function readJson(params) {
9418
- return existsSync34(params.path) ? JSON.parse(readFileSync27(params.path, "utf8")) : params.empty;
9445
+ return existsSync35(params.path) ? JSON.parse(readFileSync27(params.path, "utf8")) : params.empty;
9419
9446
  }
9420
9447
  function ledgerKeyOf(params) {
9421
9448
  return `${params.packageName}${LEDGER_KEY_SEPARATOR}${params.key}`;
@@ -9429,9 +9456,9 @@ function locationOf(survivor) {
9429
9456
  }
9430
9457
 
9431
9458
  // src/lib/mutation/lot-mode.ts
9432
- import { join as join38 } from "path";
9459
+ import { join as join39 } from "path";
9433
9460
  function readMutationMode(params) {
9434
- const declaration = readLotDeclaration(join38(params.root, LOT_FILE));
9461
+ const declaration = readLotDeclaration(join39(params.root, LOT_FILE));
9435
9462
  if ("failure" in declaration) return { kind: "invalid", reason: declaration.failure };
9436
9463
  const { mutation } = declaration;
9437
9464
  if (mutation === void 0) return { kind: "default" };
@@ -9487,8 +9514,8 @@ function pendingVerdict(params) {
9487
9514
  };
9488
9515
  }
9489
9516
  function lotModeOf(params) {
9490
- const archived = join39(params.folder, ARCHIVED_LOT_FILE);
9491
- if (!existsSync35(archived)) return readMutationMode({ root: params.root });
9517
+ const archived = join40(params.folder, ARCHIVED_LOT_FILE);
9518
+ if (!existsSync36(archived)) return readMutationMode({ root: params.root });
9492
9519
  const declaration = readLotDeclaration(archived);
9493
9520
  if ("failure" in declaration)
9494
9521
  return {
@@ -9529,7 +9556,7 @@ function hasReportedRunOn(params) {
9529
9556
  }
9530
9557
 
9531
9558
  // src/lib/review-rounds/findings-ledger.ts
9532
- import { existsSync as existsSync36, readFileSync as readFileSync28, writeFileSync as writeFileSync15 } from "fs";
9559
+ import { existsSync as existsSync37, readFileSync as readFileSync28, writeFileSync as writeFileSync15 } from "fs";
9533
9560
  function escapeCell(value) {
9534
9561
  return value.replace(/\|/g, "\\|");
9535
9562
  }
@@ -9574,7 +9601,7 @@ function roundOfRow(cells) {
9574
9601
  return id ? Number(id[1]) : void 0;
9575
9602
  }
9576
9603
  function appendFinding(params) {
9577
- const text = existsSync36(params.path) ? readFileSync28(params.path, "utf8") : "";
9604
+ const text = existsSync37(params.path) ? readFileSync28(params.path, "utf8") : "";
9578
9605
  const lines = text.split("\n");
9579
9606
  const table = findLedgerTable(lines);
9580
9607
  const numbers = (table?.rows ?? []).map(function numberInRound(row2) {
@@ -9806,8 +9833,8 @@ function rulesLine(params) {
9806
9833
  });
9807
9834
  }
9808
9835
  function reviewLine(folder) {
9809
- const ledgerPath2 = join40(folder, LEDGER_FILE);
9810
- if (!existsSync37(ledgerPath2))
9836
+ const ledgerPath2 = join41(folder, LEDGER_FILE);
9837
+ if (!existsSync38(ledgerPath2))
9811
9838
  return { name: REVIEW_LINE_NAME, status: "warning", detail: NO_LEDGER_DETAIL };
9812
9839
  const lines = readFileSync29(ledgerPath2, "utf8").split("\n");
9813
9840
  const rows = findLedgerTable(lines)?.rows ?? [];
@@ -9853,18 +9880,18 @@ function snapshotRounds(folder) {
9853
9880
  }
9854
9881
 
9855
9882
  // src/lib/handover/lot-size.ts
9856
- import { join as join42 } from "path";
9883
+ import { join as join43 } from "path";
9857
9884
 
9858
9885
  // src/lib/handover/committed-bytes.ts
9859
9886
  import { spawnSync as spawnSync8 } from "child_process";
9860
9887
  import { lstatSync as lstatSync6, readFileSync as readFileSync30, readlinkSync as readlinkSync2 } from "fs";
9861
- import { join as join41 } from "path";
9888
+ import { join as join42 } from "path";
9862
9889
  function readCommittedBytes(path) {
9863
9890
  return lstatSync6(path).isSymbolicLink() ? Buffer.from(readlinkSync2(path)) : readFileSync30(path);
9864
9891
  }
9865
9892
  function gitBlobIds(params) {
9866
9893
  return params.files.map(function blobIdOf(file) {
9867
- const path = join41(params.root, file);
9894
+ const path = join42(params.root, file);
9868
9895
  const linked = lstatSync6(path).isSymbolicLink();
9869
9896
  const result = spawnSync8(
9870
9897
  "git",
@@ -9896,7 +9923,7 @@ function workingTreeSizeOf(params) {
9896
9923
  })
9897
9924
  ) : { insertions: 0, deletions: 0 };
9898
9925
  for (const file of params.files.filter((path) => !tracked.has(path)))
9899
- size.insertions += lineCountOf(readCommittedBytes(join42(params.root, file)).toString("utf8"));
9926
+ size.insertions += lineCountOf(readCommittedBytes(join43(params.root, file)).toString("utf8"));
9900
9927
  return size;
9901
9928
  }
9902
9929
  function commitSizeOf(params) {
@@ -9937,13 +9964,13 @@ function lineCountOf(text) {
9937
9964
 
9938
9965
  // src/lib/handover/merge-lot.ts
9939
9966
  import { spawnSync as spawnSync9 } from "child_process";
9940
- import { copyFileSync as copyFileSync2, existsSync as existsSync39, mkdirSync as mkdirSync11, readFileSync as readFileSync31, rmSync as rmSync11, writeFileSync as writeFileSync17 } from "fs";
9941
- import { dirname as dirname17, isAbsolute as isAbsolute5, join as join44 } from "path";
9967
+ import { copyFileSync as copyFileSync2, existsSync as existsSync40, mkdirSync as mkdirSync11, readFileSync as readFileSync31, rmSync as rmSync11, writeFileSync as writeFileSync17 } from "fs";
9968
+ import { dirname as dirname18, isAbsolute as isAbsolute5, join as join45 } from "path";
9942
9969
 
9943
9970
  // src/lib/handover/write-handover.ts
9944
9971
  import { createHash as createHash5 } from "crypto";
9945
- import { chmodSync, existsSync as existsSync38, mkdirSync as mkdirSync10, writeFileSync as writeFileSync16 } from "fs";
9946
- import { join as join43, resolve as resolve13 } from "path";
9972
+ import { chmodSync, existsSync as existsSync39, mkdirSync as mkdirSync10, writeFileSync as writeFileSync16 } from "fs";
9973
+ import { join as join44, resolve as resolve13 } from "path";
9947
9974
 
9948
9975
  // src/lib/handover/commit-script.ts
9949
9976
  function renderCommitScript(params) {
@@ -9973,36 +10000,36 @@ function renderCommitScript(params) {
9973
10000
  function writeHandover(params) {
9974
10001
  const { plan, out } = params;
9975
10002
  mkdirSync10(out, { recursive: true });
9976
- const lotsCopy = join43(out, HANDOVER_FILES.lots);
9977
- if (resolve13(params.lotsPath) !== resolve13(lotsCopy) || !existsSync38(lotsCopy))
10003
+ const lotsCopy = join44(out, HANDOVER_FILES.lots);
10004
+ if (resolve13(params.lotsPath) !== resolve13(lotsCopy) || !existsSync39(lotsCopy))
9978
10005
  writeFileSync16(lotsCopy, `${JSON.stringify(params.lotsFile, null, " ")}
9979
10006
  `);
9980
- writeFileSync16(join43(out, HANDOVER_FILES.lotsHash), `${hashFile2(lotsCopy)}
10007
+ writeFileSync16(join44(out, HANDOVER_FILES.lotsHash), `${hashFile2(lotsCopy)}
9981
10008
  `);
9982
10009
  const existing = plan.lots.flatMap((lot) => lot.files).sort();
9983
10010
  writeFileSync16(
9984
- join43(out, HANDOVER_FILES.files),
10011
+ join44(out, HANDOVER_FILES.files),
9985
10012
  linesOf(plan.lots.flatMap((lot) => [...lot.files, ...lot.deletedFiles]).sort())
9986
10013
  );
9987
10014
  writeFileSync16(
9988
- join43(out, HANDOVER_FILES.hashes),
9989
- linesOf(existing.map((file) => `${hashFile2(join43(plan.repository, file))} ${file}`))
10015
+ join44(out, HANDOVER_FILES.hashes),
10016
+ linesOf(existing.map((file) => `${hashFile2(join44(plan.repository, file))} ${file}`))
9990
10017
  );
9991
10018
  writeFileSync16(
9992
- join43(out, HANDOVER_FILES.deleted),
10019
+ join44(out, HANDOVER_FILES.deleted),
9993
10020
  linesOf(plan.lots.flatMap((lot) => lot.deletedFiles).sort())
9994
10021
  );
9995
10022
  const merges = Object.fromEntries(
9996
10023
  plan.lots.flatMap((lot, index) => lot.merge ? [[String(index), lot.merge]] : [])
9997
10024
  );
9998
10025
  if (Object.keys(merges).length) {
9999
- const mergesPath = join43(out, HANDOVER_FILES.merges);
10026
+ const mergesPath = join44(out, HANDOVER_FILES.merges);
10000
10027
  writeFileSync16(mergesPath, `${JSON.stringify(merges, null, " ")}
10001
10028
  `);
10002
- writeFileSync16(join43(out, HANDOVER_FILES.mergesHash), `${hashFile2(mergesPath)}
10029
+ writeFileSync16(join44(out, HANDOVER_FILES.mergesHash), `${hashFile2(mergesPath)}
10003
10030
  `);
10004
10031
  }
10005
- const scriptPath = join43(out, COMMIT_SCRIPT_FILE);
10032
+ const scriptPath = join44(out, COMMIT_SCRIPT_FILE);
10006
10033
  writeFileSync16(scriptPath, renderCommitScript({ plan, folder: out, cliPath: params.cliPath }));
10007
10034
  chmodSync(scriptPath, 493);
10008
10035
  writeFileSync16(handoverLockPath(plan.repository), `${scriptPath}
@@ -10034,8 +10061,8 @@ function planMergeLot(params) {
10034
10061
  );
10035
10062
  const resolutions = Object.entries(lot.resolved).sort(([left], [right]) => left.localeCompare(right)).flatMap(function resolutionOf([path, relative12]) {
10036
10063
  if (relative12 === null) return [{ path, removed: true }];
10037
- const file = isAbsolute5(relative12) ? relative12 : join44(dirname17(params.lotsPath), relative12);
10038
- if (!existsSync39(file)) {
10064
+ const file = isAbsolute5(relative12) ? relative12 : join45(dirname18(params.lotsPath), relative12);
10065
+ if (!existsSync40(file)) {
10039
10066
  refusals.push(`merge lot ${number}: the resolution ${relative12} of ${path} does not exist`);
10040
10067
  return [];
10041
10068
  }
@@ -10129,12 +10156,12 @@ function runMergeLot(params) {
10129
10156
  readGit({ root, args: ["rm", "-q", "-f", "--", resolution.path] });
10130
10157
  continue;
10131
10158
  }
10132
- if (!existsSync39(resolution.file) || hashFile2(resolution.file) !== resolution.sha256)
10159
+ if (!existsSync40(resolution.file) || hashFile2(resolution.file) !== resolution.sha256)
10133
10160
  return {
10134
10161
  refusal: `the resolution of ${resolution.path} changed since the review: ${resolution.file}`
10135
10162
  };
10136
- const target = join44(root, resolution.path);
10137
- mkdirSync11(dirname17(target), { recursive: true });
10163
+ const target = join45(root, resolution.path);
10164
+ mkdirSync11(dirname18(target), { recursive: true });
10138
10165
  copyFileSync2(resolution.file, target);
10139
10166
  readGit({ root, args: ["add", "--", resolution.path] });
10140
10167
  }
@@ -10164,7 +10191,7 @@ function undoMerge(params) {
10164
10191
  }
10165
10192
  function readMergeMarker(root) {
10166
10193
  const path = mergeMarkerPath(root);
10167
- if (!existsSync39(path)) return void 0;
10194
+ if (!existsSync40(path)) return void 0;
10168
10195
  try {
10169
10196
  return JSON.parse(readFileSync31(path, "utf8")).tip;
10170
10197
  } catch {
@@ -10179,8 +10206,8 @@ function stagedFilesWithMarkers(root) {
10179
10206
  root,
10180
10207
  args: ["diff", "--cached", "--name-only", "-z", "--diff-filter=d"]
10181
10208
  }).filter(function holdsMarkers(file) {
10182
- const path = join44(root, file);
10183
- if (!existsSync39(path)) return false;
10209
+ const path = join45(root, file);
10210
+ if (!existsSync40(path)) return false;
10184
10211
  const text = readCommittedBytes(path);
10185
10212
  return !text.subarray(0, BINARY_PROBE_LENGTH).includes(0) && CONFLICT_MARKER_PATTERN.test(text.toString("utf8"));
10186
10213
  });
@@ -10240,7 +10267,7 @@ function mergedBranchesOf(lots) {
10240
10267
  function buildHandoverCard(params) {
10241
10268
  const { root } = params;
10242
10269
  const commitRoot = params.commitRoot ?? root;
10243
- const ownCli = params.done || params.cliPath === void 0 || runsHandovers({ root, timeout: params.probeTimeout ?? HANDOVER_PROBE_TIMEOUT_MILLISECONDS });
10270
+ const ownCli = params.done || params.cliPath === void 0 || params.probe({ root, timeout: params.probeTimeout ?? HANDOVER_PROBE_TIMEOUT_MILLISECONDS });
10244
10271
  const stateTree = computeStateTree(root);
10245
10272
  const stateHash = hashStateTree(stateTree);
10246
10273
  const gates = buildCardGateLines({
@@ -10327,24 +10354,6 @@ function mergeLine(merge) {
10327
10354
  merge.tree ? `tree ${merge.tree.slice(0, CARD_SHA_LENGTH)}` : TREE_NOT_RECORDED
10328
10355
  ].join(CARD_PART_SEPARATOR);
10329
10356
  }
10330
- function runsHandovers(params) {
10331
- const [command, ...args] = HANDOVER_PROBE_COMMAND;
10332
- const folder = mkdtempSync4(join45(tmpdir4(), HANDOVER_PROBE_FOLDER_PREFIX));
10333
- const answerPath = join45(folder, "answer.txt");
10334
- const answer = openSync2(answerPath, "w");
10335
- try {
10336
- const probe = spawnSync10(command, args, {
10337
- cwd: params.root,
10338
- stdio: ["ignore", answer, "ignore"],
10339
- timeout: params.timeout,
10340
- killSignal: "SIGKILL"
10341
- });
10342
- return probe.status === 0 && readFileSync32(answerPath, "utf8").includes(HANDOVER_PROBE_ANSWER);
10343
- } finally {
10344
- closeSync2(answer);
10345
- rmSync12(folder, { recursive: true, force: true });
10346
- }
10347
- }
10348
10357
  function tddSection(params) {
10349
10358
  const { root, judged } = params;
10350
10359
  const lines = [];
@@ -10674,8 +10683,8 @@ function optionalSection(params) {
10674
10683
  }
10675
10684
 
10676
10685
  // src/lib/handover/list-handovers.ts
10677
- import { spawnSync as spawnSync11 } from "child_process";
10678
- import { existsSync as existsSync41, lstatSync as lstatSync7, readdirSync as readdirSync11, realpathSync as realpathSync6, statSync as statSync8 } from "fs";
10686
+ import { spawnSync as spawnSync10 } from "child_process";
10687
+ import { existsSync as existsSync42, lstatSync as lstatSync7, readdirSync as readdirSync11, realpathSync as realpathSync6, statSync as statSync8 } from "fs";
10679
10688
  import { basename as basename6, join as join47 } from "path";
10680
10689
 
10681
10690
  // src/lib/handover/find-committed-lots.ts
@@ -10743,7 +10752,7 @@ function describeMismatch(params) {
10743
10752
  }
10744
10753
 
10745
10754
  // src/lib/handover/read-handover-folder.ts
10746
- import { existsSync as existsSync40, readFileSync as readFileSync33 } from "fs";
10755
+ import { existsSync as existsSync41, readFileSync as readFileSync32 } from "fs";
10747
10756
  import { join as join46, resolve as resolve14 } from "path";
10748
10757
  function readHandoverFolder(folder) {
10749
10758
  const absoluteFolder = resolve14(folder);
@@ -10754,13 +10763,13 @@ function readHandoverFolder(folder) {
10754
10763
  HANDOVER_FILES.hashes,
10755
10764
  HANDOVER_FILES.deleted,
10756
10765
  HANDOVER_FILES.lotsHash
10757
- ].filter((name) => !existsSync40(join46(absoluteFolder, name)));
10766
+ ].filter((name) => !existsSync41(join46(absoluteFolder, name)));
10758
10767
  if (missing.length)
10759
10768
  return `${absoluteFolder} misses ${missing.join(", ")}: write it with \`dialecte handover <lots.json>\``;
10760
10769
  const files = readLines(join46(absoluteFolder, HANDOVER_FILES.files));
10761
10770
  const deleted = new Set(readLines(join46(absoluteFolder, HANDOVER_FILES.deleted)));
10762
10771
  const mergesPath = join46(absoluteFolder, HANDOVER_FILES.merges);
10763
- const merges = existsSync40(mergesPath) ? JSON.parse(readFileSync33(mergesPath, "utf8")) : {};
10772
+ const merges = existsSync41(mergesPath) ? JSON.parse(readFileSync32(mergesPath, "utf8")) : {};
10764
10773
  if (lotsFile.lots.some((lot, index) => isMergeLotPlan(lot) && !merges[index]))
10765
10774
  return `${absoluteFolder} misses the merge records (${HANDOVER_FILES.merges}): write it again with \`dialecte handover --rehash <lots.json>\``;
10766
10775
  if (Object.values(merges).some((merge) => typeof merge.onTree !== "string"))
@@ -10781,21 +10790,21 @@ function readHandoverFolder(folder) {
10781
10790
  };
10782
10791
  }),
10783
10792
  snapshotLines: readLines(join46(absoluteFolder, HANDOVER_FILES.hashes)),
10784
- lotsHash: readFileSync33(join46(absoluteFolder, HANDOVER_FILES.lotsHash), "utf8").trim(),
10785
- ...existsSync40(join46(absoluteFolder, HANDOVER_FILES.mergesHash)) && {
10786
- mergesHash: readFileSync33(join46(absoluteFolder, HANDOVER_FILES.mergesHash), "utf8").trim()
10793
+ lotsHash: readFileSync32(join46(absoluteFolder, HANDOVER_FILES.lotsHash), "utf8").trim(),
10794
+ ...existsSync41(join46(absoluteFolder, HANDOVER_FILES.mergesHash)) && {
10795
+ mergesHash: readFileSync32(join46(absoluteFolder, HANDOVER_FILES.mergesHash), "utf8").trim()
10787
10796
  }
10788
10797
  };
10789
10798
  }
10790
10799
  function readLines(path) {
10791
- return readFileSync33(path, "utf8").split("\n").filter(Boolean);
10800
+ return readFileSync32(path, "utf8").split("\n").filter(Boolean);
10792
10801
  }
10793
10802
 
10794
10803
  // src/lib/handover/list-handovers.ts
10795
10804
  function listHandovers(params) {
10796
10805
  const folders = findHandoverFolders({ folder: params.root, depth: LIST_DEPTH });
10797
10806
  return onePerRealPath(folders).flatMap(function listing(folder) {
10798
- if (!existsSync41(join47(folder, HANDOVER_FILES.lots)))
10807
+ if (!existsSync42(join47(folder, HANDOVER_FILES.lots)))
10799
10808
  return [
10800
10809
  {
10801
10810
  folder,
@@ -10810,7 +10819,7 @@ function listHandovers(params) {
10810
10819
  const handover = readHandoverFolder(folder);
10811
10820
  if (typeof handover === "string") return [];
10812
10821
  const { lotsFile } = handover;
10813
- const repositoryExists = existsSync41(lotsFile.repository);
10822
+ const repositoryExists = existsSync42(lotsFile.repository);
10814
10823
  return [
10815
10824
  {
10816
10825
  folder,
@@ -10848,7 +10857,7 @@ function handoverState(handover) {
10848
10857
  return "pending";
10849
10858
  }
10850
10859
  function revisionOf(params) {
10851
- const result = spawnSync11("git", ["rev-parse", "--verify", "--quiet", params.revision], {
10860
+ const result = spawnSync10("git", ["rev-parse", "--verify", "--quiet", params.revision], {
10852
10861
  cwd: params.root,
10853
10862
  encoding: "utf8"
10854
10863
  });
@@ -10862,9 +10871,9 @@ function newestScriptTime(folder) {
10862
10871
  }
10863
10872
  function findHandoverFolders(params) {
10864
10873
  const { folder } = params;
10865
- if (!existsSync41(folder)) return [];
10866
- const hasLots = existsSync41(join47(folder, HANDOVER_FILES.lots));
10867
- const found = hasLots && existsSync41(join47(folder, COMMIT_SCRIPT_FILE)) || !hasLots && listLegacyScripts(folder).length > 0 ? [folder] : [];
10874
+ if (!existsSync42(folder)) return [];
10875
+ const hasLots = existsSync42(join47(folder, HANDOVER_FILES.lots));
10876
+ const found = hasLots && existsSync42(join47(folder, COMMIT_SCRIPT_FILE)) || !hasLots && listLegacyScripts(folder).length > 0 ? [folder] : [];
10868
10877
  if (params.depth === 0) return found;
10869
10878
  for (const entry of readdirSync11(folder, { withFileTypes: true }))
10870
10879
  if (isFolder({ folder, entry }) && entry.name !== "node_modules" && !entry.name.startsWith("."))
@@ -11052,27 +11061,27 @@ function readGitVersion() {
11052
11061
  }
11053
11062
 
11054
11063
  // src/lib/handover/rehearse-handover.ts
11055
- import { spawnSync as spawnSync16 } from "child_process";
11064
+ import { spawnSync as spawnSync15 } from "child_process";
11056
11065
  import {
11057
11066
  cpSync as cpSync2,
11058
- existsSync as existsSync49,
11067
+ existsSync as existsSync50,
11059
11068
  lstatSync as lstatSync10,
11060
11069
  mkdirSync as mkdirSync14,
11061
- mkdtempSync as mkdtempSync6,
11070
+ mkdtempSync as mkdtempSync5,
11062
11071
  readdirSync as readdirSync14,
11063
11072
  readlinkSync as readlinkSync5,
11064
11073
  rmdirSync,
11065
- rmSync as rmSync18,
11074
+ rmSync as rmSync17,
11066
11075
  symlinkSync as symlinkSync5,
11067
11076
  writeFileSync as writeFileSync21
11068
11077
  } from "fs";
11069
11078
  import { constants as constants2 } from "os";
11070
- import { basename as basename7, dirname as dirname22, isAbsolute as isAbsolute9, join as join56 } from "path";
11079
+ import { basename as basename7, dirname as dirname23, isAbsolute as isAbsolute9, join as join56 } from "path";
11071
11080
 
11072
11081
  // src/lib/worktree/copy-node-modules.ts
11073
- import { spawnSync as spawnSync12 } from "child_process";
11074
- import { existsSync as existsSync42, lstatSync as lstatSync8, readdirSync as readdirSync12, readlinkSync as readlinkSync3, rmSync as rmSync13, symlinkSync as symlinkSync2 } from "fs";
11075
- import { dirname as dirname18, isAbsolute as isAbsolute6, join as join50, relative as relative6, resolve as resolve15 } from "path";
11082
+ import { spawnSync as spawnSync11 } from "child_process";
11083
+ import { existsSync as existsSync43, lstatSync as lstatSync8, readdirSync as readdirSync12, readlinkSync as readlinkSync3, rmSync as rmSync12, symlinkSync as symlinkSync2 } from "fs";
11084
+ import { dirname as dirname19, isAbsolute as isAbsolute6, join as join50, relative as relative6, resolve as resolve15 } from "path";
11076
11085
  function copyNodeModules(params) {
11077
11086
  const { from, to } = params;
11078
11087
  const runCopy = params.runCopy ?? runCp;
@@ -11083,19 +11092,19 @@ function copyNodeModules(params) {
11083
11092
  for (const attempt of attempts) {
11084
11093
  const result = runCopy(attempt.args);
11085
11094
  if (result.signal) {
11086
- rmSync13(to, { recursive: true, force: true });
11095
+ rmSync12(to, { recursive: true, force: true });
11087
11096
  throw new Error(`copying ${from} was interrupted (${result.signal})`);
11088
11097
  }
11089
11098
  if (result.status === 0) {
11090
11099
  const relinked = relinkEscapingLinks({ from, to });
11091
11100
  return { method: attempt.method, relinked };
11092
11101
  }
11093
- rmSync13(to, { recursive: true, force: true });
11102
+ rmSync12(to, { recursive: true, force: true });
11094
11103
  }
11095
11104
  throw new Error(`cannot copy ${from} to ${to}`);
11096
11105
  }
11097
11106
  function runCp(args) {
11098
- const result = spawnSync12("cp", args, { encoding: "utf8" });
11107
+ const result = spawnSync11("cp", args, { encoding: "utf8" });
11099
11108
  return { status: result.status, signal: result.signal };
11100
11109
  }
11101
11110
  function relinkEscapingLinks(params) {
@@ -11105,17 +11114,17 @@ function relinkEscapingLinks(params) {
11105
11114
  if (!lstatSync8(source).isSymbolicLink()) continue;
11106
11115
  const target = readlinkSync3(source);
11107
11116
  if (isAbsolute6(target)) continue;
11108
- const resolved = resolve15(dirname18(source), target);
11117
+ const resolved = resolve15(dirname19(source), target);
11109
11118
  if (!relative6(params.from, resolved).startsWith("..")) continue;
11110
11119
  const copy = join50(params.to, entry);
11111
- rmSync13(copy, { force: true });
11120
+ rmSync12(copy, { force: true });
11112
11121
  symlinkSync2(resolved, copy);
11113
11122
  relinked.push(entry);
11114
11123
  }
11115
11124
  return relinked;
11116
11125
  }
11117
11126
  function packageEntries(folder) {
11118
- if (!existsSync42(folder)) return [];
11127
+ if (!existsSync43(folder)) return [];
11119
11128
  return readdirSync12(folder).flatMap(function entriesOf(name) {
11120
11129
  if (!name.startsWith("@")) return [name];
11121
11130
  const scope = join50(folder, name);
@@ -11125,12 +11134,12 @@ function packageEntries(folder) {
11125
11134
  }
11126
11135
 
11127
11136
  // src/lib/handover/rehearsal-links.ts
11128
- import { existsSync as existsSync44, mkdirSync as mkdirSync12, rmSync as rmSync14, symlinkSync as symlinkSync4, unlinkSync as unlinkSync2 } from "fs";
11129
- import { dirname as dirname20, isAbsolute as isAbsolute8, resolve as resolve17 } from "path";
11137
+ import { existsSync as existsSync45, mkdirSync as mkdirSync12, rmSync as rmSync13, symlinkSync as symlinkSync4, unlinkSync as unlinkSync2 } from "fs";
11138
+ import { dirname as dirname21, isAbsolute as isAbsolute8, resolve as resolve17 } from "path";
11130
11139
 
11131
11140
  // src/lib/worktree/sibling-links.ts
11132
- import { existsSync as existsSync43, lstatSync as lstatSync9, readlinkSync as readlinkSync4, realpathSync as realpathSync7, symlinkSync as symlinkSync3 } from "fs";
11133
- import { dirname as dirname19, isAbsolute as isAbsolute7, join as join51, relative as relative7, resolve as resolve16, sep } from "path";
11141
+ import { existsSync as existsSync44, lstatSync as lstatSync9, readlinkSync as readlinkSync4, realpathSync as realpathSync7, symlinkSync as symlinkSync3 } from "fs";
11142
+ import { dirname as dirname20, isAbsolute as isAbsolute7, join as join51, relative as relative7, resolve as resolve16, sep } from "path";
11134
11143
 
11135
11144
  // src/lib/workspace.constants.ts
11136
11145
  var WORKSPACE_MARKERS = ["_commit-plan", ".worktrees"];
@@ -11140,7 +11149,7 @@ var WORKTREES_FOLDER = ".worktrees";
11140
11149
  // src/lib/worktree/sibling-links.ts
11141
11150
  function linkSiblings(params) {
11142
11151
  const { worktree, repository } = params;
11143
- const worktreesFolder = join51(dirname19(repository), WORKTREES_FOLDER);
11152
+ const worktreesFolder = join51(dirname20(repository), WORKTREES_FOLDER);
11144
11153
  const packageJson = readPackageJson(worktree);
11145
11154
  const links = [];
11146
11155
  for (const section of DEPENDENCY_SECTIONS)
@@ -11171,12 +11180,12 @@ function linkSiblings(params) {
11171
11180
  function linkOutcome(params) {
11172
11181
  const { link, target } = params;
11173
11182
  if (isPresent(link)) return describeExisting({ link, target });
11174
- if (!existsSync43(target)) return `skipped: ${target} missing`;
11175
- const missingParent = topMissingFolder({ path: dirname19(link), above: params.worktreesFolder });
11183
+ if (!existsSync44(target)) return `skipped: ${target} missing`;
11184
+ const missingParent = topMissingFolder({ path: dirname20(link), above: params.worktreesFolder });
11176
11185
  if (missingParent) return `skipped: ${missingParent} missing`;
11177
11186
  params.beforeLink?.(link);
11178
11187
  try {
11179
- symlinkSync3(relative7(dirname19(link), target), link);
11188
+ symlinkSync3(relative7(dirname20(link), target), link);
11180
11189
  return "created";
11181
11190
  } catch (error) {
11182
11191
  const code2 = error.code;
@@ -11186,7 +11195,7 @@ function linkOutcome(params) {
11186
11195
  }
11187
11196
  function topMissingFolder(params) {
11188
11197
  let missing;
11189
- for (let folder = params.path; folder !== params.above && folder !== dirname19(folder) && !isPresent(folder); folder = dirname19(folder))
11198
+ for (let folder = params.path; folder !== params.above && folder !== dirname20(folder) && !isPresent(folder); folder = dirname20(folder))
11190
11199
  missing = folder;
11191
11200
  return missing;
11192
11201
  }
@@ -11194,7 +11203,7 @@ function describeExisting(params) {
11194
11203
  const { link, target } = params;
11195
11204
  const status = lstatSync9(link);
11196
11205
  if (!status.isSymbolicLink()) return `kept: a real ${status.isDirectory() ? "folder" : "file"}`;
11197
- if (existsSync43(target) && existsSync43(link) && realpathSync7(link) === realpathSync7(target))
11206
+ if (existsSync44(target) && existsSync44(link) && realpathSync7(link) === realpathSync7(target))
11198
11207
  return "present";
11199
11208
  return `kept: points to ${readlinkSync4(link)}, not ${target}`;
11200
11209
  }
@@ -11222,11 +11231,11 @@ function linkRehearsalSiblings(params) {
11222
11231
  }
11223
11232
  const target = resolve17(repository, path);
11224
11233
  if (isPresent(link)) continue;
11225
- if (!existsSync44(target)) {
11234
+ if (!existsSync45(target)) {
11226
11235
  lines.push(` not linked: ${path} (${target} missing)`);
11227
11236
  continue;
11228
11237
  }
11229
- mkdirSync12(dirname20(link), { recursive: true });
11238
+ mkdirSync12(dirname21(link), { recursive: true });
11230
11239
  symlinkSync4(target, link);
11231
11240
  links.push(link);
11232
11241
  linked.push(path);
@@ -11236,15 +11245,15 @@ function linkRehearsalSiblings(params) {
11236
11245
  }
11237
11246
  function removeRehearsalFolder(params) {
11238
11247
  for (const link of params.links) if (isPresent(link)) unlinkSync2(link);
11239
- rmSync14(params.folder, { recursive: true, force: true });
11248
+ rmSync13(params.folder, { recursive: true, force: true });
11240
11249
  }
11241
11250
 
11242
11251
  // src/lib/handover/rehearsal-plan.ts
11243
- import { readFileSync as readFileSync34 } from "fs";
11252
+ import { readFileSync as readFileSync33 } from "fs";
11244
11253
  function planRehearsal(params) {
11245
11254
  const root = params.handover.lotsFile.repository;
11246
11255
  const trees = listLotTrees({ root, lots: params.handover.lots });
11247
- const hookText = listCommitHookFiles(root).map((file) => readFileSync34(file, "utf8")).join("\n");
11256
+ const hookText = listCommitHookFiles(root).map((file) => readFileSync33(file, "utf8")).join("\n");
11248
11257
  const context = {
11249
11258
  root,
11250
11259
  branch: params.handover.lotsFile.branch,
@@ -11351,21 +11360,21 @@ function fillReason(params) {
11351
11360
  }
11352
11361
 
11353
11362
  // src/lib/handover/run-handover-folder.ts
11354
- import { copyFileSync as copyFileSync3, existsSync as existsSync48, readFileSync as readFileSync36, rmSync as rmSync17, writeFileSync as writeFileSync20 } from "fs";
11363
+ import { copyFileSync as copyFileSync3, existsSync as existsSync49, readFileSync as readFileSync35, rmSync as rmSync16, writeFileSync as writeFileSync20 } from "fs";
11355
11364
  import { join as join55 } from "path";
11356
11365
 
11357
11366
  // src/lib/handover/check-handover-guards.ts
11358
- import { spawnSync as spawnSync14 } from "child_process";
11359
- import { existsSync as existsSync46 } from "fs";
11367
+ import { spawnSync as spawnSync13 } from "child_process";
11368
+ import { existsSync as existsSync47 } from "fs";
11360
11369
  import { join as join53 } from "path";
11361
11370
 
11362
11371
  // src/lib/handover/sync-node-modules.ts
11363
- import { spawnSync as spawnSync13 } from "child_process";
11364
- import { existsSync as existsSync45, mkdirSync as mkdirSync13, readdirSync as readdirSync13, readFileSync as readFileSync35, rmSync as rmSync15, writeFileSync as writeFileSync18 } from "fs";
11372
+ import { spawnSync as spawnSync12 } from "child_process";
11373
+ import { existsSync as existsSync46, mkdirSync as mkdirSync13, readdirSync as readdirSync13, readFileSync as readFileSync34, rmSync as rmSync14, writeFileSync as writeFileSync18 } from "fs";
11365
11374
  import { join as join52 } from "path";
11366
11375
  async function syncNodeModules(params) {
11367
11376
  const { root, clock } = params;
11368
- const lockChanged = spawnSync13("git", ["diff", "--cached", "--quiet", "--", PACKAGE_LOCK_FILE2], { cwd: root }).status === 1;
11377
+ const lockChanged = spawnSync12("git", ["diff", "--cached", "--quiet", "--", PACKAGE_LOCK_FILE2], { cwd: root }).status === 1;
11369
11378
  if (!lockChanged) return {};
11370
11379
  const before = nodeModulesAgainstStagedLock(root);
11371
11380
  if (before.length === 0) return {};
@@ -11373,7 +11382,7 @@ async function syncNodeModules(params) {
11373
11382
  const files = [PACKAGE_LOCK_FILE2, PACKAGE_MANIFEST_FILE].map((file) => ({
11374
11383
  file,
11375
11384
  path: join52(root, file),
11376
- working: existsSync45(join52(root, file)) ? readFileSync35(join52(root, file)) : void 0,
11385
+ working: existsSync46(join52(root, file)) ? readFileSync34(join52(root, file)) : void 0,
11377
11386
  staged: stagedBytes({ root, file })
11378
11387
  }));
11379
11388
  const overwritten = files.filter((entry) => entry.staged !== void 0);
@@ -11386,9 +11395,9 @@ async function syncNodeModules(params) {
11386
11395
  }
11387
11396
  function restore() {
11388
11397
  for (const { path, working } of overwritten)
11389
- if (working === void 0) rmSync15(path, { force: true });
11398
+ if (working === void 0) rmSync14(path, { force: true });
11390
11399
  else writeFileSync18(path, working);
11391
- rmSync15(backup, { recursive: true, force: true });
11400
+ rmSync14(backup, { recursive: true, force: true });
11392
11401
  }
11393
11402
  const removeSignalHook = onSignalExit(restore);
11394
11403
  let changed;
@@ -11401,7 +11410,7 @@ async function syncNodeModules(params) {
11401
11410
  refusal: `${INSTALL_COMMAND2.join(" ")} failed (exit ${installed.exitCode ?? "stalled"}): ${installed.output.trim().split("\n").slice(-3).join(" / ")}; node_modules is now incomplete (npm ci removes it first): the same command installs it again`
11402
11411
  };
11403
11412
  changed = overwritten.find(
11404
- ({ path, staged }) => !existsSync45(path) || !readFileSync35(path).equals(staged ?? Buffer.alloc(0))
11413
+ ({ path, staged }) => !existsSync46(path) || !readFileSync34(path).equals(staged ?? Buffer.alloc(0))
11405
11414
  )?.file;
11406
11415
  } finally {
11407
11416
  restore();
@@ -11420,11 +11429,11 @@ async function syncNodeModules(params) {
11420
11429
  }
11421
11430
  function restoreLeftoverBackup(root) {
11422
11431
  const backup = installBackupPath(root);
11423
- if (!existsSync45(backup)) return void 0;
11432
+ if (!existsSync46(backup)) return void 0;
11424
11433
  const names = readdirSync13(backup).filter((name) => name.endsWith(STAGED_SUFFIX)).map((name) => name.slice(0, -STAGED_SUFFIX.length));
11425
11434
  const stillStaged2 = names.every((name) => {
11426
11435
  const path = join52(root, name);
11427
- return existsSync45(path) && readFileSync35(path).equals(readFileSync35(join52(backup, `${name}${STAGED_SUFFIX}`)));
11436
+ return existsSync46(path) && readFileSync34(path).equals(readFileSync34(join52(backup, `${name}${STAGED_SUFFIX}`)));
11428
11437
  });
11429
11438
  if (!stillStaged2)
11430
11439
  return {
@@ -11432,10 +11441,10 @@ function restoreLeftoverBackup(root) {
11432
11441
  detail: `${backup} holds the working ${names.join(", ")} an interrupted install saved, and the working files changed since: compare them by hand, keep what is right, then delete ${backup}`
11433
11442
  };
11434
11443
  for (const name of names)
11435
- if (existsSync45(join52(backup, `${name}${ABSENT_SUFFIX}`)))
11436
- rmSync15(join52(root, name), { force: true });
11437
- else writeFileSync18(join52(root, name), readFileSync35(join52(backup, name)));
11438
- rmSync15(backup, { recursive: true, force: true });
11444
+ if (existsSync46(join52(backup, `${name}${ABSENT_SUFFIX}`)))
11445
+ rmSync14(join52(root, name), { force: true });
11446
+ else writeFileSync18(join52(root, name), readFileSync34(join52(backup, name)));
11447
+ rmSync14(backup, { recursive: true, force: true });
11439
11448
  return {
11440
11449
  ok: true,
11441
11450
  detail: `${names.join(", ")} restored from ${backup}, which an interrupted install left`
@@ -11448,11 +11457,11 @@ function installBackupPath(root) {
11448
11457
  }).trim();
11449
11458
  }
11450
11459
  function stagedBytes(params) {
11451
- const staged = spawnSync13("git", ["show", `:${params.file}`], { cwd: params.root });
11460
+ const staged = spawnSync12("git", ["show", `:${params.file}`], { cwd: params.root });
11452
11461
  return staged.status === 0 ? staged.stdout : void 0;
11453
11462
  }
11454
11463
  function readStagedLockPackages(root) {
11455
- const staged = spawnSync13("git", ["show", `:${PACKAGE_LOCK_FILE2}`], {
11464
+ const staged = spawnSync12("git", ["show", `:${PACKAGE_LOCK_FILE2}`], {
11456
11465
  cwd: root,
11457
11466
  encoding: "utf8"
11458
11467
  });
@@ -11462,7 +11471,7 @@ function readStagedLockPackages(root) {
11462
11471
  }
11463
11472
  function installedVersion2(params) {
11464
11473
  const manifest = join52(params.root, params.path, "package.json");
11465
- return existsSync45(manifest) ? JSON.parse(readFileSync35(manifest, "utf8")).version : void 0;
11474
+ return existsSync46(manifest) ? JSON.parse(readFileSync34(manifest, "utf8")).version : void 0;
11466
11475
  }
11467
11476
  function nodeModulesAgainstStagedLock(root) {
11468
11477
  return readStagedLockPackages(root).flatMap(function differs([path, entry]) {
@@ -11503,7 +11512,7 @@ function checkHandoverGuards(params) {
11503
11512
  {
11504
11513
  name: "repository",
11505
11514
  check: function repositoryExists() {
11506
- return existsSync46(root) ? { ok: true, detail: root } : { ok: false, detail: `${root} does not exist` };
11515
+ return existsSync47(root) ? { ok: true, detail: root } : { ok: false, detail: `${root} does not exist` };
11507
11516
  }
11508
11517
  },
11509
11518
  {
@@ -11659,7 +11668,7 @@ function checkHandoverGuards(params) {
11659
11668
  }
11660
11669
  }
11661
11670
  ];
11662
- const leftover = existsSync46(root) ? restoreLeftoverBackup(root) : void 0;
11671
+ const leftover = existsSync47(root) ? restoreLeftoverBackup(root) : void 0;
11663
11672
  if (leftover) {
11664
11673
  write(`${leftover.ok ? "\u2713" : "\u2717"} ${"backup".padEnd(GUARD_NAME_WIDTH)} ${leftover.detail}`);
11665
11674
  if (!leftover.ok) return void 0;
@@ -11702,7 +11711,7 @@ function checkMerges(params) {
11702
11711
  detail: `lot ${number}: tree not recorded: rehearse first (\`--rehearse\` prints it), add it as "tree" to the lot, then \`dialecte handover --rehash\``
11703
11712
  };
11704
11713
  const changed = merge.resolutions.filter(
11705
- (resolution) => !("removed" in resolution) && (!existsSync46(resolution.file) || hashFile2(resolution.file) !== resolution.sha256)
11714
+ (resolution) => !("removed" in resolution) && (!existsSync47(resolution.file) || hashFile2(resolution.file) !== resolution.sha256)
11706
11715
  );
11707
11716
  if (changed.length)
11708
11717
  return {
@@ -11749,7 +11758,7 @@ function checkMutation(params) {
11749
11758
  };
11750
11759
  }
11751
11760
  function resolveCommit(params) {
11752
- const result = spawnSync14(
11761
+ const result = spawnSync13(
11753
11762
  "git",
11754
11763
  ["rev-parse", "--verify", "--quiet", `${params.revision}^{commit}`],
11755
11764
  { cwd: params.root, encoding: "utf8" }
@@ -11758,9 +11767,9 @@ function resolveCommit(params) {
11758
11767
  }
11759
11768
 
11760
11769
  // src/lib/handover/commit-lots.ts
11761
- import { appendFileSync, mkdtempSync as mkdtempSync5, rmSync as rmSync16, writeFileSync as writeFileSync19 } from "fs";
11762
- import { tmpdir as tmpdir5 } from "os";
11763
- import { dirname as dirname21, join as join54 } from "path";
11770
+ import { appendFileSync, mkdtempSync as mkdtempSync4, rmSync as rmSync15, writeFileSync as writeFileSync19 } from "fs";
11771
+ import { tmpdir as tmpdir4 } from "os";
11772
+ import { dirname as dirname22, join as join54 } from "path";
11764
11773
 
11765
11774
  // src/lib/progress/heartbeat.ts
11766
11775
  function startHeartbeat(params) {
@@ -12191,26 +12200,26 @@ function createHookLiveView(params) {
12191
12200
  }
12192
12201
 
12193
12202
  // src/lib/handover/unstage-lot.ts
12194
- import { spawnSync as spawnSync15 } from "child_process";
12195
- import { existsSync as existsSync47 } from "fs";
12203
+ import { spawnSync as spawnSync14 } from "child_process";
12204
+ import { existsSync as existsSync48 } from "fs";
12196
12205
  function unstageLot(params) {
12197
12206
  const { root, clock } = params;
12198
12207
  const giveUpAt = clock.now() + INDEX_LOCK_WAIT_MILLISECONDS;
12199
12208
  for (; ; ) {
12200
- const reset = spawnSync15("git", ["reset", "-q", "--", ...params.paths], {
12209
+ const reset = spawnSync14("git", ["reset", "-q", "--", ...params.paths], {
12201
12210
  cwd: root,
12202
12211
  encoding: "utf8"
12203
12212
  });
12204
12213
  if (reset.status === 0) return { unstaged: true };
12205
12214
  const lock = indexLockPath(root);
12206
12215
  const reason = (reset.stderr || reset.stdout || `git reset exited ${reset.status}`).trim().split("\n")[0];
12207
- if (!lock || !existsSync47(lock) || clock.now() >= giveUpAt)
12208
- return { unstaged: false, reason, ...lock && existsSync47(lock) && { lock } };
12216
+ if (!lock || !existsSync48(lock) || clock.now() >= giveUpAt)
12217
+ return { unstaged: false, reason, ...lock && existsSync48(lock) && { lock } };
12209
12218
  clock.sleep(INDEX_LOCK_RETRY_MILLISECONDS);
12210
12219
  }
12211
12220
  }
12212
12221
  function indexLockPath(root) {
12213
- const result = spawnSync15(
12222
+ const result = spawnSync14(
12214
12223
  "git",
12215
12224
  ["rev-parse", "--path-format=absolute", "--git-path", "index.lock"],
12216
12225
  { cwd: root, encoding: "utf8" }
@@ -12295,7 +12304,7 @@ async function commitLots(params) {
12295
12304
  });
12296
12305
  hookView.end();
12297
12306
  const hookRan = commit.output !== "" || hooked;
12298
- if (!hookRan) rmSync16(dirname21(hookLog), { recursive: true, force: true });
12307
+ if (!hookRan) rmSync15(dirname22(hookLog), { recursive: true, force: true });
12299
12308
  const hookOutcome = hookRan ? hookOutcomeLines({
12300
12309
  output: commit.output,
12301
12310
  passed: commit.exitCode === 0,
@@ -12367,7 +12376,7 @@ function recordedHookStep(step) {
12367
12376
  };
12368
12377
  }
12369
12378
  function createHookLog(params) {
12370
- const path = join54(mkdtempSync5(join54(tmpdir5(), HOOK_LOG_FOLDER_PREFIX)), `lot-${params.lot}.log`);
12379
+ const path = join54(mkdtempSync4(join54(tmpdir4(), HOOK_LOG_FOLDER_PREFIX)), `lot-${params.lot}.log`);
12371
12380
  writeFileSync19(path, "");
12372
12381
  return path;
12373
12382
  }
@@ -12431,6 +12440,7 @@ async function runHandoverFolder(params) {
12431
12440
  lots,
12432
12441
  commits,
12433
12442
  cliPath: params.cliPath,
12443
+ probe: params.probe,
12434
12444
  // the repository's hand-over is done only by a real run that committed every lot
12435
12445
  done: !rehearsal && commits.length === lots.length
12436
12446
  });
@@ -12450,8 +12460,8 @@ async function runHandoverFolder(params) {
12450
12460
  function archiveLotFile(params) {
12451
12461
  const source = join55(params.root, LOT_FILE);
12452
12462
  const target = join55(params.folder, ARCHIVED_LOT_FILE);
12453
- if (!existsSync48(source) || existsSync48(target)) return void 0;
12454
- if (isEmptyDeclaration(readFileSync36(source, "utf8"))) return void 0;
12463
+ if (!existsSync49(source) || existsSync49(target)) return void 0;
12464
+ if (isEmptyDeclaration(readFileSync35(source, "utf8"))) return void 0;
12455
12465
  copyFileSync3(source, target);
12456
12466
  writeFileSync20(source, EMPTY_LOT_DECLARATION);
12457
12467
  return target;
@@ -12466,8 +12476,8 @@ function isEmptyDeclaration(text) {
12466
12476
  }
12467
12477
  function releaseLock(params) {
12468
12478
  const lockPath = handoverLockPath(params.root);
12469
- if (existsSync48(lockPath) && readFileSync36(lockPath, "utf8").trim() === join55(params.folder, COMMIT_SCRIPT_FILE))
12470
- rmSync17(lockPath);
12479
+ if (existsSync49(lockPath) && readFileSync35(lockPath, "utf8").trim() === join55(params.folder, COMMIT_SCRIPT_FILE))
12480
+ rmSync16(lockPath);
12471
12481
  }
12472
12482
 
12473
12483
  // src/lib/handover/rehearse-handover.ts
@@ -12493,6 +12503,7 @@ async function rehearseHandover(params) {
12493
12503
  write,
12494
12504
  clock: params.clock,
12495
12505
  colour: params.colour,
12506
+ probe: params.probe,
12496
12507
  progress: params.progress,
12497
12508
  tty: params.tty,
12498
12509
  columns: params.columns,
@@ -12506,7 +12517,7 @@ async function rehearseHandover(params) {
12506
12517
  clock: params.clock
12507
12518
  });
12508
12519
  const repository = handover.lotsFile.repository;
12509
- const folder = mkdtempSync6(join56(params.scratchRoot, REHEARSAL_FOLDER_PREFIX));
12520
+ const folder = mkdtempSync5(join56(params.scratchRoot, REHEARSAL_FOLDER_PREFIX));
12510
12521
  const clone = join56(folder, basename7(repository));
12511
12522
  const hookTemporary = join56(folder, REHEARSAL_TEMPORARY_FOLDER);
12512
12523
  mkdirSync14(hookTemporary);
@@ -12547,6 +12558,7 @@ async function rehearseHandover(params) {
12547
12558
  write,
12548
12559
  clock: params.clock,
12549
12560
  colour: params.colour,
12561
+ probe: params.probe,
12550
12562
  progress,
12551
12563
  tty: params.tty,
12552
12564
  columns: params.columns,
@@ -12605,7 +12617,7 @@ function prepareClone(params) {
12605
12617
  const { repository, clone, write } = params;
12606
12618
  const head = readGit({ root: repository, args: ["rev-parse", "HEAD"] }).trim();
12607
12619
  readGit({
12608
- root: dirname22(clone),
12620
+ root: dirname23(clone),
12609
12621
  args: ["clone", "-q", "--shared", "--no-checkout", repository, clone]
12610
12622
  });
12611
12623
  readGit({ root: clone, args: ["checkout", "-q", "-B", params.branch, head] });
@@ -12623,14 +12635,14 @@ function prepareClone(params) {
12623
12635
  const source = join56(repository, file);
12624
12636
  const target = join56(clone, file);
12625
12637
  if (isPresent(source)) {
12626
- mkdirSync14(dirname22(target), { recursive: true });
12638
+ mkdirSync14(dirname23(target), { recursive: true });
12627
12639
  if (lstatSync10(source).isSymbolicLink()) {
12628
- rmSync18(target, { force: true });
12640
+ rmSync17(target, { force: true });
12629
12641
  symlinkSync5(readlinkSync5(source), target);
12630
12642
  } else cpSync2(source, target);
12631
12643
  } else {
12632
- rmSync18(target, { force: true });
12633
- removeEmptiedFolders({ clone, folder: dirname22(target) });
12644
+ rmSync17(target, { force: true });
12645
+ removeEmptiedFolders({ clone, folder: dirname23(target) });
12634
12646
  }
12635
12647
  }
12636
12648
  write(` working tree: ${changed.length} changed file(s) on top of ${head.slice(0, 12)}`);
@@ -12638,28 +12650,52 @@ function prepareClone(params) {
12638
12650
  if (hooks.configured && isAbsolute9(hooks.configured))
12639
12651
  readGit({ root: clone, args: ["config", "core.hooksPath", hooks.configured] });
12640
12652
  else if (hooks.configured) {
12641
- if (existsSync49(hooks.folder))
12653
+ if (existsSync50(hooks.folder))
12642
12654
  cpSync2(hooks.folder, join56(clone, hooks.configured), { recursive: true });
12643
12655
  readGit({ root: clone, args: ["config", "core.hooksPath", hooks.configured] });
12644
- } else if (existsSync49(hooks.folder))
12656
+ } else if (existsSync50(hooks.folder))
12645
12657
  cpSync2(hooks.folder, join56(clone, ".git", "hooks"), { recursive: true });
12646
12658
  write(` hooks: ${hooks.configured ?? "git hooks folder"} copied`);
12647
12659
  const nodeModules = join56(repository, "node_modules");
12648
- if (existsSync49(nodeModules)) {
12660
+ if (existsSync50(nodeModules)) {
12649
12661
  const copy = copyNodeModules({ from: nodeModules, to: join56(clone, "node_modules") });
12650
12662
  write(
12651
12663
  ` node_modules: ${copy.method}${copy.relinked.length ? `, ${copy.relinked.length} link(s) re-pointed` : ""}`
12652
12664
  );
12653
12665
  }
12654
- spawnSync16("git", ["update-index", "-q", "--refresh"], { cwd: clone });
12666
+ spawnSync15("git", ["update-index", "-q", "--refresh"], { cwd: clone });
12655
12667
  }
12656
12668
  function removeEmptiedFolders(params) {
12657
- for (let folder = params.folder; folder !== params.clone && folder.startsWith(params.clone) && existsSync49(folder); folder = dirname22(folder)) {
12669
+ for (let folder = params.folder; folder !== params.clone && folder.startsWith(params.clone) && existsSync50(folder); folder = dirname23(folder)) {
12658
12670
  if (readdirSync14(folder).length) return;
12659
12671
  rmdirSync(folder);
12660
12672
  }
12661
12673
  }
12662
12674
 
12675
+ // src/lib/handover/repository-cli-probe.ts
12676
+ import { spawnSync as spawnSync16 } from "child_process";
12677
+ import { closeSync as closeSync2, mkdtempSync as mkdtempSync6, openSync as openSync2, readFileSync as readFileSync36, rmSync as rmSync18 } from "fs";
12678
+ import { tmpdir as tmpdir5 } from "os";
12679
+ import { join as join57 } from "path";
12680
+ function probeRepositoryCli(params) {
12681
+ const [command, ...args] = HANDOVER_PROBE_COMMAND;
12682
+ const folder = mkdtempSync6(join57(tmpdir5(), HANDOVER_PROBE_FOLDER_PREFIX));
12683
+ const answerPath = join57(folder, "answer.txt");
12684
+ const answer = openSync2(answerPath, "w");
12685
+ try {
12686
+ const probe = spawnSync16(command, args, {
12687
+ cwd: params.root,
12688
+ stdio: ["ignore", answer, "ignore"],
12689
+ timeout: params.timeout,
12690
+ killSignal: "SIGKILL"
12691
+ });
12692
+ return probe.status === 0 && readFileSync36(answerPath, "utf8").includes(HANDOVER_PROBE_ANSWER);
12693
+ } finally {
12694
+ closeSync2(answer);
12695
+ rmSync18(folder, { recursive: true, force: true });
12696
+ }
12697
+ }
12698
+
12663
12699
  // src/lib/legend/legend.constants.ts
12664
12700
  var VERDICT_TERMS = [
12665
12701
  {
@@ -12885,13 +12921,13 @@ function renderLegend(params) {
12885
12921
  }
12886
12922
 
12887
12923
  // src/lib/workspace.ts
12888
- import { existsSync as existsSync50 } from "fs";
12889
- import { dirname as dirname23, join as join57 } from "path";
12924
+ import { existsSync as existsSync51 } from "fs";
12925
+ import { dirname as dirname24, join as join58 } from "path";
12890
12926
  function findWorkspace(cwd) {
12891
12927
  let folder = cwd;
12892
12928
  for (; ; ) {
12893
- if (WORKSPACE_MARKERS.some((marker) => existsSync50(join57(folder, marker)))) return folder;
12894
- const parent = dirname23(folder);
12929
+ if (WORKSPACE_MARKERS.some((marker) => existsSync51(join58(folder, marker)))) return folder;
12930
+ const parent = dirname24(folder);
12895
12931
  if (parent === folder) return void 0;
12896
12932
  folder = parent;
12897
12933
  }
@@ -12913,6 +12949,7 @@ async function run8(argv) {
12913
12949
  clock: createSystemClock(),
12914
12950
  colour,
12915
12951
  columns,
12952
+ probe: probeRepositoryCli,
12916
12953
  scratchRoot: rehearsalScratchRoot({
12917
12954
  platform: process.platform,
12918
12955
  systemTemporaryFolder: tmpdir6()
@@ -12925,7 +12962,8 @@ async function run8(argv) {
12925
12962
  argv,
12926
12963
  cliPath: realpathSync8(process.argv[1]),
12927
12964
  colour,
12928
- columns
12965
+ columns,
12966
+ probe: probeRepositoryCli
12929
12967
  });
12930
12968
  (result.exitCode === 0 ? console.log : console.error)(result.output);
12931
12969
  if (result.exitCode !== 0) process.exit(result.exitCode);
@@ -12945,14 +12983,14 @@ function runHandover(params) {
12945
12983
  const absoluteLotsPath = resolve18(lotsPath);
12946
12984
  const lotsFile = readLotsFile(absoluteLotsPath);
12947
12985
  if (typeof lotsFile === "string") return usage(`handover: ${lotsFile}`);
12948
- const out = resolve18(getArg(argv, "out") ?? dirname24(absoluteLotsPath));
12949
- const scriptPath = join58(out, COMMIT_SCRIPT_FILE);
12950
- if (existsSync51(scriptPath) && !hasFlag(argv, "rehash"))
12986
+ const out = resolve18(getArg(argv, "out") ?? dirname25(absoluteLotsPath));
12987
+ const scriptPath = join59(out, COMMIT_SCRIPT_FILE);
12988
+ if (existsSync52(scriptPath) && !hasFlag(argv, "rehash"))
12951
12989
  return usage(
12952
12990
  `handover: ${scriptPath} exists: pass --rehash to take the snapshot again after an edit`
12953
12991
  );
12954
12992
  const heldBy = readHandoverLock(lotsFile.repository);
12955
- if (heldBy && heldBy !== scriptPath && existsSync51(heldBy))
12993
+ if (heldBy && heldBy !== scriptPath && existsSync52(heldBy))
12956
12994
  return refused([
12957
12995
  handoverHoldRefusal({
12958
12996
  script: heldBy,
@@ -12978,7 +13016,8 @@ function runHandover(params) {
12978
13016
  lots: plan.lots,
12979
13017
  commits: [],
12980
13018
  cliPath: params.cliPath,
12981
- probeTimeout: params.probeTimeout
13019
+ probeTimeout: params.probeTimeout,
13020
+ probe: params.probe
12982
13021
  });
12983
13022
  if (hasFlag(argv, "json"))
12984
13023
  return {
@@ -13024,6 +13063,7 @@ async function runHandoverRun(params) {
13024
13063
  write,
13025
13064
  clock: params.clock,
13026
13065
  colour: params.colour,
13066
+ probe: params.probe,
13027
13067
  scratchRoot: params.scratchRoot,
13028
13068
  keep: hasFlag(argv, "keep"),
13029
13069
  progress,
@@ -13040,6 +13080,7 @@ async function runHandoverRun(params) {
13040
13080
  write,
13041
13081
  clock: params.clock,
13042
13082
  colour: params.colour,
13083
+ probe: params.probe,
13043
13084
  progress,
13044
13085
  tty: live.tty,
13045
13086
  columns: params.columns ?? live.columns,
@@ -13053,10 +13094,10 @@ async function runHandoverRun(params) {
13053
13094
  function runHandoverList(params) {
13054
13095
  const { argv, cwd } = params;
13055
13096
  const workspace = findWorkspace(cwd);
13056
- const commitPlan = workspace && join58(workspace, COMMIT_PLAN_FOLDER);
13097
+ const commitPlan = workspace && join59(workspace, COMMIT_PLAN_FOLDER);
13057
13098
  const root = resolve18(
13058
13099
  cwd,
13059
- getArg(argv, "root") ?? (commitPlan && existsSync51(commitPlan) ? commitPlan : cwd)
13100
+ getArg(argv, "root") ?? (commitPlan && existsSync52(commitPlan) ? commitPlan : cwd)
13060
13101
  );
13061
13102
  const listings = listHandovers({ root, now: params.now });
13062
13103
  if (hasFlag(argv, "json")) return { exitCode: 0, output: JSON.stringify(listings, null, 2) };
@@ -13096,16 +13137,16 @@ function refused(reasons) {
13096
13137
  }
13097
13138
 
13098
13139
  // src/commands/lot.ts
13099
- import { existsSync as existsSync53, mkdirSync as mkdirSync15, readFileSync as readFileSync37, writeFileSync as writeFileSync22 } from "fs";
13100
- import { dirname as dirname26, join as join60 } from "path";
13140
+ import { existsSync as existsSync54, mkdirSync as mkdirSync15, readFileSync as readFileSync37, writeFileSync as writeFileSync22 } from "fs";
13141
+ import { dirname as dirname27, join as join61 } from "path";
13101
13142
 
13102
13143
  // src/lib/package-root.ts
13103
- import { existsSync as existsSync52 } from "fs";
13104
- import { dirname as dirname25, join as join59 } from "path";
13144
+ import { existsSync as existsSync53 } from "fs";
13145
+ import { dirname as dirname26, join as join60 } from "path";
13105
13146
  function packageRootOf(cwd) {
13106
- for (let folder = cwd; ; folder = dirname25(folder)) {
13107
- if (existsSync52(join59(folder, "package.json"))) return folder;
13108
- if (dirname25(folder) === folder) return void 0;
13147
+ for (let folder = cwd; ; folder = dirname26(folder)) {
13148
+ if (existsSync53(join60(folder, "package.json"))) return folder;
13149
+ if (dirname26(folder) === folder) return void 0;
13109
13150
  }
13110
13151
  }
13111
13152
 
@@ -13137,9 +13178,9 @@ function runLot(params) {
13137
13178
  };
13138
13179
  const root = packageRootOf(params.cwd);
13139
13180
  if (!root) return { exitCode: 1, output: `lot: no package.json at or above ${params.cwd}` };
13140
- const path = join60(root, LOT_FILE);
13181
+ const path = join61(root, LOT_FILE);
13141
13182
  let read = {};
13142
- if (existsSync53(path))
13183
+ if (existsSync54(path))
13143
13184
  try {
13144
13185
  read = JSON.parse(readFileSync37(path, "utf8"));
13145
13186
  } catch (error) {
@@ -13166,7 +13207,7 @@ function runLot(params) {
13166
13207
  declaration.gone = known ? entries.map((entry) => entry.file === file ? { file, reason } : entry) : [...entries, { file, reason }];
13167
13208
  } else if (verb === "mutation") declaration.mutation = words[0];
13168
13209
  else declaration.tdd = `exempt: ${words[0]}`;
13169
- mkdirSync15(dirname26(path), { recursive: true });
13210
+ mkdirSync15(dirname27(path), { recursive: true });
13170
13211
  writeFileSync22(path, `${JSON.stringify(declaration, null, " ")}
13171
13212
  `);
13172
13213
  return { exitCode: 0, output: `lot: ${path} written` };
@@ -13443,13 +13484,13 @@ function runModels(params) {
13443
13484
  }
13444
13485
 
13445
13486
  // src/commands/mutants.ts
13446
- import { existsSync as existsSync58, mkdirSync as mkdirSync18, readFileSync as readFileSync40, rmSync as rmSync21, writeFileSync as writeFileSync24 } from "fs";
13487
+ import { existsSync as existsSync59, mkdirSync as mkdirSync18, readFileSync as readFileSync40, rmSync as rmSync21, writeFileSync as writeFileSync24 } from "fs";
13447
13488
  import { createRequire as createRequire5 } from "module";
13448
- import { dirname as dirname29, join as join65, resolve as resolve19 } from "path";
13489
+ import { dirname as dirname30, join as join66, resolve as resolve19 } from "path";
13449
13490
  import { fileURLToPath as fileURLToPath3, pathToFileURL as pathToFileURL4 } from "url";
13450
13491
 
13451
13492
  // src/lib/mutation/cache-key.ts
13452
- import { existsSync as existsSync54 } from "fs";
13493
+ import { existsSync as existsSync55 } from "fs";
13453
13494
 
13454
13495
  // src/lib/mutation/incremental-cache.constants.ts
13455
13496
  var INCREMENTAL_FILE_NAME = "incremental.json";
@@ -13475,7 +13516,7 @@ function computeIncrementalKey(params) {
13475
13516
  ...readInstalledKey(root),
13476
13517
  options: withoutPerRunFields(options),
13477
13518
  cliVersion,
13478
- ignorer: existsSync54(ignorerPlugin) ? hashFile(ignorerPlugin) : MISSING_KEY_INPUT
13519
+ ignorer: existsSync55(ignorerPlugin) ? hashFile(ignorerPlugin) : MISSING_KEY_INPUT
13479
13520
  };
13480
13521
  return hashText(JSON.stringify(withSortedKeys(keyed)));
13481
13522
  }
@@ -13502,7 +13543,7 @@ function withSortedKeys(value) {
13502
13543
 
13503
13544
  // src/lib/mutation/incremental-cache.ts
13504
13545
  import {
13505
- existsSync as existsSync55,
13546
+ existsSync as existsSync56,
13506
13547
  mkdirSync as mkdirSync16,
13507
13548
  readdirSync as readdirSync15,
13508
13549
  readFileSync as readFileSync38,
@@ -13510,14 +13551,14 @@ import {
13510
13551
  statSync as statSync9,
13511
13552
  writeFileSync as writeFileSync23
13512
13553
  } from "fs";
13513
- import { dirname as dirname27, join as join61 } from "path";
13554
+ import { dirname as dirname28, join as join62 } from "path";
13514
13555
  function incrementalCachePathOf(params) {
13515
- return join61(storeFolderOf2(params.root), `${params.packageHash}-${params.key}.json`);
13556
+ return join62(storeFolderOf2(params.root), `${params.packageHash}-${params.key}.json`);
13516
13557
  }
13517
13558
  function seedIncrementalFile(params) {
13518
13559
  const text = readParsableText(incrementalCachePathOf(params));
13519
13560
  if (text === void 0) return "cold";
13520
- mkdirSync16(dirname27(params.incrementalFile), { recursive: true });
13561
+ mkdirSync16(dirname28(params.incrementalFile), { recursive: true });
13521
13562
  writeFileSync23(params.incrementalFile, text);
13522
13563
  return "warm";
13523
13564
  }
@@ -13525,21 +13566,21 @@ function storeIncrementalFile(params) {
13525
13566
  const text = readParsableText(params.incrementalFile);
13526
13567
  if (text === void 0) return false;
13527
13568
  const path = incrementalCachePathOf(params);
13528
- mkdirSync16(dirname27(path), { recursive: true });
13569
+ mkdirSync16(dirname28(path), { recursive: true });
13529
13570
  writeAtomically({ path, text });
13530
- evictOldFiles({ folder: dirname27(path), packageHash: params.packageHash, kept: path });
13571
+ evictOldFiles({ folder: dirname28(path), packageHash: params.packageHash, kept: path });
13531
13572
  return true;
13532
13573
  }
13533
13574
  function storeFolderOf2(root) {
13534
- return join61(mutationStoreFolderOf(root), INCREMENTAL_STORE_FOLDER);
13575
+ return join62(mutationStoreFolderOf(root), INCREMENTAL_STORE_FOLDER);
13535
13576
  }
13536
13577
  function evictOldFiles(params) {
13537
13578
  const { folder, packageHash, kept } = params;
13538
13579
  const prefix2 = `${packageHash}-`;
13539
13580
  const files = readdirSync15(folder).filter((name) => name.startsWith(prefix2) && name.endsWith(".json")).map((name) => ({
13540
13581
  name,
13541
- path: join61(folder, name),
13542
- modified: modifiedTimeOf(join61(folder, name))
13582
+ path: join62(folder, name),
13583
+ modified: modifiedTimeOf(join62(folder, name))
13543
13584
  })).filter(
13544
13585
  (file) => file.modified !== void 0
13545
13586
  ).filter((file) => file.path !== kept).sort(
@@ -13556,7 +13597,7 @@ function modifiedTimeOf(path) {
13556
13597
  }
13557
13598
  }
13558
13599
  function readParsableText(path) {
13559
- if (!existsSync55(path)) return void 0;
13600
+ if (!existsSync56(path)) return void 0;
13560
13601
  try {
13561
13602
  const text = readFileSync38(path, "utf8");
13562
13603
  JSON.parse(text);
@@ -13683,21 +13724,21 @@ function readArguments(params) {
13683
13724
  }
13684
13725
 
13685
13726
  // src/lib/mutation/drop-run.ts
13686
- import { existsSync as existsSync56, rmSync as rmSync20 } from "fs";
13687
- import { join as join62 } from "path";
13727
+ import { existsSync as existsSync57, rmSync as rmSync20 } from "fs";
13728
+ import { join as join63 } from "path";
13688
13729
  function dropRun(params) {
13689
13730
  const { root, runId, isAlive, startTimeOf, afterDecision } = params;
13690
13731
  const store = mutationStoreFolderOf(root);
13691
- const path = join62(store, MUTATION_RUNS_FOLDER, `${runId}.json`);
13732
+ const path = join63(store, MUTATION_RUNS_FOLDER, `${runId}.json`);
13692
13733
  return withLedgerLock({
13693
13734
  root,
13694
13735
  work: function dropUnderLock(state) {
13695
13736
  const runs = readRuns({ root, isAlive, startTimeOf });
13696
13737
  const run25 = isRunId(runId) ? runs.find((entry) => entry.runId === runId) : void 0;
13697
- if (run25 === void 0 || !existsSync56(path))
13738
+ if (run25 === void 0 || !existsSync57(path))
13698
13739
  return {
13699
13740
  ok: false,
13700
- reason: `no mutation run ${runId} in ${join62(store, MUTATION_RUNS_FOLDER)}`
13741
+ reason: `no mutation run ${runId} in ${join63(store, MUTATION_RUNS_FOLDER)}`
13701
13742
  };
13702
13743
  if (run25.state === "running")
13703
13744
  return {
@@ -13781,8 +13822,8 @@ function dropVerb(params) {
13781
13822
  }
13782
13823
 
13783
13824
  // src/lib/mutation/judge-packet.ts
13784
- import { existsSync as existsSync57, readFileSync as readFileSync39 } from "fs";
13785
- import { join as join63 } from "path";
13825
+ import { existsSync as existsSync58, readFileSync as readFileSync39 } from "fs";
13826
+ import { join as join64 } from "path";
13786
13827
 
13787
13828
  // node_modules/@babel/parser/lib/index.js
13788
13829
  var Position = class {
@@ -28209,10 +28250,10 @@ function judgePackets(params) {
28209
28250
  const byFile = /* @__PURE__ */ new Map();
28210
28251
  for (const item of pending) byFile.set(item.file, [...byFile.get(item.file) ?? [], item]);
28211
28252
  return [...byFile.keys()].sort().map((each) => {
28212
- const path = join63(root, each);
28253
+ const path = join64(root, each);
28213
28254
  return packetOf({
28214
28255
  file: each,
28215
- source: existsSync57(path) ? readFileSync39(path, "utf8") : void 0,
28256
+ source: existsSync58(path) ? readFileSync39(path, "utf8") : void 0,
28216
28257
  survivors: (byFile.get(each) ?? []).map(
28217
28258
  (item) => inputOf({ item, survivor: reported.get(item.key) })
28218
28259
  )
@@ -28378,7 +28419,7 @@ function judgeVerb(params) {
28378
28419
 
28379
28420
  // src/lib/mutation/records-write.ts
28380
28421
  import { mkdirSync as mkdirSync17 } from "fs";
28381
- import { dirname as dirname28, join as join64 } from "path";
28422
+ import { dirname as dirname29, join as join65 } from "path";
28382
28423
  function recordKeys(params) {
28383
28424
  const { root, keys, family, removable, afterRecordsWritten } = params;
28384
28425
  const reason = params.reason.trim();
@@ -28442,8 +28483,8 @@ function writeRecords(params) {
28442
28483
  );
28443
28484
  for (const item of items)
28444
28485
  (next[item.file] ??= {})[item.key] = recordOf({ item, family, reason, removable });
28445
- const path = join64(root, MUTATION_RECORDS_PATH);
28446
- mkdirSync17(dirname28(path), { recursive: true });
28486
+ const path = join65(root, MUTATION_RECORDS_PATH);
28487
+ mkdirSync17(dirname29(path), { recursive: true });
28447
28488
  writeAtomically({ path, text: `${JSON.stringify(sortedRecords(next), null, " ")}
28448
28489
  ` });
28449
28490
  }
@@ -28615,7 +28656,7 @@ async function runMutants(params) {
28615
28656
  }
28616
28657
  }
28617
28658
  function ignorerPluginPath(params) {
28618
- return join65(params.distFolder, IGNORER_PLUGIN_FILE);
28659
+ return join66(params.distFolder, IGNORER_PLUGIN_FILE);
28619
28660
  }
28620
28661
  async function runVerb(params) {
28621
28662
  const { root, runStryker, startTimeOf } = params;
@@ -28632,7 +28673,7 @@ async function runVerb(params) {
28632
28673
  if (declared.kind === "none")
28633
28674
  return {
28634
28675
  exitCode: 1,
28635
- output: `mutants run: ${join65(root, "package.json")} declares no dialecte.mutation: declare its scope and fast tier first`
28676
+ output: `mutants run: ${join66(root, "package.json")} declares no dialecte.mutation: declare its scope and fast tier first`
28636
28677
  };
28637
28678
  if (declared.kind === "invalid") return { exitCode: 1, output: `mutants run: ${declared.reason}` };
28638
28679
  const { declaration } = declared;
@@ -28684,8 +28725,8 @@ async function runVerb(params) {
28684
28725
  startTimeOf
28685
28726
  });
28686
28727
  const workDir = `${MUTANTS_WORK_FOLDER}/${entry.runId}`;
28687
- mkdirSync18(join65(root, workDir), { recursive: true });
28688
- writeFileSync24(join65(root, workDir, EMPTY_STRYKER_CONFIG_FILE), "{}\n");
28728
+ mkdirSync18(join66(root, workDir), { recursive: true });
28729
+ writeFileSync24(join66(root, workDir, EMPTY_STRYKER_CONFIG_FILE), "{}\n");
28689
28730
  const records = readRecordsFile({ root });
28690
28731
  const tiers = await runTiers({
28691
28732
  root,
@@ -28710,7 +28751,7 @@ run ${entry.runId} stays running until this process ends, then reads as died: re
28710
28751
  ...mutantKeysOf({ report: tiers.report })
28711
28752
  });
28712
28753
  updateLedger({ root, run: finished, records, targets });
28713
- rmSync21(join65(root, workDir), { recursive: true, force: true });
28754
+ rmSync21(join66(root, workDir), { recursive: true, force: true });
28714
28755
  return { exitCode: 0, output: renderRun({ root, run: finished }) };
28715
28756
  }
28716
28757
  async function runTiers(params) {
@@ -28784,7 +28825,7 @@ async function runTier(params) {
28784
28825
  }
28785
28826
  if (exitCode !== 0) return { failure: `Stryker exited ${exitCode} in the ${tier} tier` };
28786
28827
  const reportPath = resolve19(root, options.jsonReporter.fileName);
28787
- if (!existsSync58(reportPath))
28828
+ if (!existsSync59(reportPath))
28788
28829
  return { failure: `Stryker wrote no report in the ${tier} tier (${reportPath})` };
28789
28830
  return { report: JSON.parse(readFileSync40(reportPath, "utf8")) };
28790
28831
  }
@@ -28973,10 +29014,10 @@ function migrateVerb(params) {
28973
29014
  const read = readArguments({ argv: params.argv, valueOptions: [], flags: ["json"] });
28974
29015
  if (typeof read === "string" || read.words.length > 0)
28975
29016
  return usageResult({ verb: "migrate", json, read });
28976
- const legacyPath = join65(root, LEGACY_RECORDS_PATH);
28977
- if (!existsSync58(legacyPath))
29017
+ const legacyPath = join66(root, LEGACY_RECORDS_PATH);
29018
+ if (!existsSync59(legacyPath))
28978
29019
  return refused2({ verb: "migrate", json, reason: `no ${LEGACY_RECORDS_PATH} in ${root}` });
28979
- if (existsSync58(join65(root, MUTATION_RECORDS_PATH)))
29020
+ if (existsSync59(join66(root, MUTATION_RECORDS_PATH)))
28980
29021
  return refused2({
28981
29022
  verb: "migrate",
28982
29023
  json,
@@ -28997,8 +29038,8 @@ function migrateVerb(params) {
28997
29038
  });
28998
29039
  }
28999
29040
  function readLineOf(params) {
29000
- const path = join65(params.root, params.file);
29001
- if (!existsSync58(path)) return "";
29041
+ const path = join66(params.root, params.file);
29042
+ if (!existsSync59(path)) return "";
29002
29043
  return readFileSync40(path, "utf8").split("\n")[params.line - 1] ?? "";
29003
29044
  }
29004
29045
  function usage2(read) {
@@ -29008,11 +29049,11 @@ function newDate() {
29008
29049
  return /* @__PURE__ */ new Date();
29009
29050
  }
29010
29051
  function cliDistFolder() {
29011
- const start = dirname29(fileURLToPath3(import.meta.url));
29012
- return join65(packageRootOf(start) ?? start, CLI_DIST_FOLDER);
29052
+ const start = dirname30(fileURLToPath3(import.meta.url));
29053
+ return join66(packageRootOf(start) ?? start, CLI_DIST_FOLDER);
29013
29054
  }
29014
29055
  async function runStrykerOfPackage(params) {
29015
- const requireFromPackage = createRequire5(join65(process.cwd(), "package.json"));
29056
+ const requireFromPackage = createRequire5(join66(process.cwd(), "package.json"));
29016
29057
  const entry = requireFromPackage.resolve("@stryker-mutator/core");
29017
29058
  const strykerModule = await import(pathToFileURL4(entry).href);
29018
29059
  const stryker = new strykerModule.Stryker(params.options);
@@ -29022,8 +29063,8 @@ async function runStrykerOfPackage(params) {
29022
29063
 
29023
29064
  // src/commands/narrowing.ts
29024
29065
  import { spawnSync as spawnSync17 } from "child_process";
29025
- import { writeFileSync as writeFileSync25, mkdirSync as mkdirSync19, rmSync as rmSync22, existsSync as existsSync59 } from "fs";
29026
- import { join as join66, resolve as resolve20 } from "path";
29066
+ import { writeFileSync as writeFileSync25, mkdirSync as mkdirSync19, rmSync as rmSync22, existsSync as existsSync60 } from "fs";
29067
+ import { join as join67, resolve as resolve20 } from "path";
29027
29068
  async function run13(argv) {
29028
29069
  const ROOT = process.cwd();
29029
29070
  const tsc = resolveBin("tsc", "typescript", ROOT);
@@ -29039,12 +29080,12 @@ async function run13(argv) {
29039
29080
  const schema = await loadSchema(resolve20(ROOT, target.constantsDir));
29040
29081
  mkdirSync19(resolve20(ROOT, target.outDir), { recursive: true });
29041
29082
  const relFile = `${target.outDir}/narrowing.generated.test-d.ts`;
29042
- writeFileSync25(join66(ROOT, relFile), genNarrowing({ schema, binding: target.binding }));
29083
+ writeFileSync25(join67(ROOT, relFile), genNarrowing({ schema, binding: target.binding }));
29043
29084
  const apiFile = `${target.outDir}/coverage.api.generated.ts`;
29044
- const include = existsSync59(join66(ROOT, apiFile)) ? [relFile, apiFile] : [relFile];
29085
+ const include = existsSync60(join67(ROOT, apiFile)) ? [relFile, apiFile] : [relFile];
29045
29086
  const tmp = `.narrow-${target.version}.tsconfig.json`;
29046
29087
  writeFileSync25(
29047
- join66(ROOT, tmp),
29088
+ join67(ROOT, tmp),
29048
29089
  JSON.stringify({
29049
29090
  extends: `./${tsconfig}`,
29050
29091
  compilerOptions: {
@@ -29063,7 +29104,7 @@ async function run13(argv) {
29063
29104
  encoding: "utf8",
29064
29105
  maxBuffer: 1e8
29065
29106
  });
29066
- rmSync22(join66(ROOT, tmp), { force: true });
29107
+ rmSync22(join67(ROOT, tmp), { force: true });
29067
29108
  if (res.status === 0) {
29068
29109
  console.log(
29069
29110
  `\u2705 [${target.version}] narrowing holds \u2014 ${schema.elements.length} elements asserted`
@@ -29080,7 +29121,7 @@ ${res.stdout || ""}${res.stderr || ""}`
29080
29121
  }
29081
29122
 
29082
29123
  // src/commands/new-verb.ts
29083
- import { join as join68 } from "path";
29124
+ import { join as join69 } from "path";
29084
29125
 
29085
29126
  // src/lib/scaffold/new-verb.constants.ts
29086
29127
  var VERB_KINDS = ["query", "transaction"];
@@ -29098,8 +29139,8 @@ var KIND_SHAPES = {
29098
29139
  var OPTIONS_WITH_VALUE = ["--version", "--format-config"];
29099
29140
 
29100
29141
  // src/lib/scaffold/new-verb.ts
29101
- import { existsSync as existsSync60, mkdirSync as mkdirSync20, readFileSync as readFileSync41, writeFileSync as writeFileSync26 } from "fs";
29102
- import { dirname as dirname30, join as join67 } from "path";
29142
+ import { existsSync as existsSync61, mkdirSync as mkdirSync20, readFileSync as readFileSync41, writeFileSync as writeFileSync26 } from "fs";
29143
+ import { dirname as dirname31, join as join68 } from "path";
29103
29144
 
29104
29145
  // src/lib/scaffold/edit-module.ts
29105
29146
  import ts7 from "typescript";
@@ -29247,20 +29288,20 @@ function scaffoldVerb(params) {
29247
29288
  [`${kindFolder}/${file}.types.ts`]: renderTypesFile(names),
29248
29289
  [`${kindFolder}/${file}.test.ts`]: renderTestFile(names)
29249
29290
  };
29250
- const existing = Object.keys(newFiles).filter((path) => existsSync60(join67(root, path)));
29291
+ const existing = Object.keys(newFiles).filter((path) => existsSync61(join68(root, path)));
29251
29292
  if (existing.length) return `already there: ${existing.join(", ")}`;
29252
29293
  const edits = {};
29253
29294
  const barrel = `${kindFolder}/index.ts`;
29254
29295
  const exportLine = `export { ${name} } from './${file}'
29255
29296
  `;
29256
- if (existsSync60(join67(root, barrel)))
29297
+ if (existsSync61(join68(root, barrel)))
29257
29298
  edits[barrel] = withLine({ text: readText({ root, path: barrel }), line: exportLine });
29258
29299
  else newFiles[barrel] = exportLine;
29259
29300
  const group = `${namespace}${KIND_SHAPES[kind].group}`;
29260
29301
  const groupImport = `import * as ${group} from './${kind}'`;
29261
29302
  const groupProperty = `${KIND_SHAPES[kind].moduleKey}: ${group}`;
29262
29303
  const namespaceModule = `${namespaceFolder}/index.ts`;
29263
- if (!existsSync60(join67(root, namespaceModule))) {
29304
+ if (!existsSync61(join68(root, namespaceModule))) {
29264
29305
  newFiles[namespaceModule] = `${groupImport}
29265
29306
 
29266
29307
  export const ${namespace} = {
@@ -29268,7 +29309,7 @@ export const ${namespace} = {
29268
29309
  }
29269
29310
  `;
29270
29311
  const registry = `${extensionsFolder}/index.ts`;
29271
- if (!existsSync60(join67(root, registry))) return `no extension registry at ${registry}`;
29312
+ if (!existsSync61(join68(root, registry))) return `no extension registry at ${registry}`;
29272
29313
  const registered = addObjectProperty({
29273
29314
  source: addImportLine({
29274
29315
  source: readText({ root, path: registry }),
@@ -29279,7 +29320,7 @@ export const ${namespace} = {
29279
29320
  });
29280
29321
  if (registered === void 0) return `no *_EXTENSION_MODULES object in ${registry}`;
29281
29322
  edits[registry] = registered;
29282
- } else if (!existsSync60(join67(root, barrel))) {
29323
+ } else if (!existsSync61(join68(root, barrel))) {
29283
29324
  const extended = addObjectProperty({
29284
29325
  source: addImportLine({
29285
29326
  source: readText({ root, path: namespaceModule }),
@@ -29293,8 +29334,8 @@ export const ${namespace} = {
29293
29334
  edits[namespaceModule] = extended;
29294
29335
  }
29295
29336
  for (const [path, text] of Object.entries({ ...newFiles, ...edits })) {
29296
- mkdirSync20(dirname30(join67(root, path)), { recursive: true });
29297
- writeFileSync26(join67(root, path), text);
29337
+ mkdirSync20(dirname31(join68(root, path)), { recursive: true });
29338
+ writeFileSync26(join68(root, path), text);
29298
29339
  }
29299
29340
  return {
29300
29341
  written: Object.keys(newFiles).sort(),
@@ -29314,12 +29355,12 @@ function withLine(params) {
29314
29355
  ${line}`;
29315
29356
  }
29316
29357
  function readRootElement(params) {
29317
- const path = join67(params.root, "src", params.version, "definition", "constants.generated.ts");
29318
- if (!existsSync60(path)) return "FILL_ROOT_ELEMENT";
29358
+ const path = join68(params.root, "src", params.version, "definition", "constants.generated.ts");
29359
+ if (!existsSync61(path)) return "FILL_ROOT_ELEMENT";
29319
29360
  return ROOT_ELEMENT_PATTERN.exec(readFileSync41(path, "utf8"))?.[1] ?? "FILL_ROOT_ELEMENT";
29320
29361
  }
29321
29362
  function readText(params) {
29322
- return readFileSync41(join67(params.root, params.path), "utf8");
29363
+ return readFileSync41(join68(params.root, params.path), "utf8");
29323
29364
  }
29324
29365
  function kebabCase(name) {
29325
29366
  return name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
@@ -29360,7 +29401,7 @@ function runNewVerb(params) {
29360
29401
  return { exitCode: 1, output: `new verb: ${result}, nothing written` };
29361
29402
  const formatted = formatFiles({
29362
29403
  root: cwd,
29363
- files: [...result.written, ...result.edited].map((path) => join68(cwd, path)),
29404
+ files: [...result.written, ...result.edited].map((path) => join69(cwd, path)),
29364
29405
  options: formatOptsFromArgv(argv)
29365
29406
  });
29366
29407
  if (!formatted)
@@ -29389,13 +29430,13 @@ function usage3(message) {
29389
29430
  import { resolve as resolve21 } from "path";
29390
29431
 
29391
29432
  // src/lib/recap/read-recap-records.ts
29392
- import { existsSync as existsSync63, realpathSync as realpathSync9 } from "fs";
29393
- import { basename as basename8, dirname as dirname31, join as join69 } from "path";
29433
+ import { existsSync as existsSync64, realpathSync as realpathSync9 } from "fs";
29434
+ import { basename as basename8, dirname as dirname32, join as join70 } from "path";
29394
29435
 
29395
29436
  // src/lib/review-rounds/decisions-file.ts
29396
- import { existsSync as existsSync61, readFileSync as readFileSync42 } from "fs";
29437
+ import { existsSync as existsSync62, readFileSync as readFileSync42 } from "fs";
29397
29438
  function appendDecision(params) {
29398
- const lines = (existsSync61(params.path) ? readFileSync42(params.path, "utf8") : "").split("\n");
29439
+ const lines = (existsSync62(params.path) ? readFileSync42(params.path, "utf8") : "").split("\n");
29399
29440
  appendTableRow({
29400
29441
  path: params.path,
29401
29442
  lines,
@@ -29406,7 +29447,7 @@ function appendDecision(params) {
29406
29447
  });
29407
29448
  }
29408
29449
  function readDecisions(path) {
29409
- if (!existsSync61(path)) return [];
29450
+ if (!existsSync62(path)) return [];
29410
29451
  const lines = readFileSync42(path, "utf8").split("\n");
29411
29452
  const table = findTable({ lines, firstCell: DECISIONS_FIRST_CELL });
29412
29453
  return (table?.rowLines ?? []).map(function decisionOf(line) {
@@ -29421,7 +29462,7 @@ function dayOf(date) {
29421
29462
  }
29422
29463
 
29423
29464
  // src/lib/recap/read-findings.ts
29424
- import { existsSync as existsSync62, readFileSync as readFileSync43 } from "fs";
29465
+ import { existsSync as existsSync63, readFileSync as readFileSync43 } from "fs";
29425
29466
  import { relative as relative8 } from "path";
29426
29467
 
29427
29468
  // src/lib/recap/recap.constants.ts
@@ -29511,7 +29552,7 @@ var RECAP_SCHEDULED_ITEM = "- `{file}:{line}` {mutation}: scheduled for {followU
29511
29552
 
29512
29553
  // src/lib/recap/read-findings.ts
29513
29554
  function readFindings(params) {
29514
- if (!existsSync62(params.path)) return void 0;
29555
+ if (!existsSync63(params.path)) return void 0;
29515
29556
  const lines = readFileSync43(params.path, "utf8").split("\n");
29516
29557
  const table = findTable({ lines, firstCell: "id" });
29517
29558
  if (!table) return [];
@@ -29630,20 +29671,20 @@ function readRecapRecords(params) {
29630
29671
  const { handover } = params;
29631
29672
  const { folder, lotsFile } = handover;
29632
29673
  const root = lotsFile.repository;
29633
- const repositoryExists = existsSync63(root);
29674
+ const repositoryExists = existsSync64(root);
29634
29675
  const user = readGitConfig({ root: repositoryExists ? root : params.cwd, key: "user.name" });
29635
29676
  if (!user)
29636
29677
  return NO_USER_NAME.replace(
29637
29678
  "{where}",
29638
29679
  repositoryExists ? "the repository" : "the current folder"
29639
29680
  );
29640
- const declarationPath = existsSync63(join69(folder, FOLDER_LOT_FILE)) ? join69(folder, FOLDER_LOT_FILE) : join69(root, LOT_FILE);
29681
+ const declarationPath = existsSync64(join70(folder, FOLDER_LOT_FILE)) ? join70(folder, FOLDER_LOT_FILE) : join70(root, LOT_FILE);
29641
29682
  const accepted = readCases({ path: declarationPath, list: "accept" });
29642
29683
  if (typeof accepted === "string") return accepted;
29643
29684
  const revised = readCases({ path: declarationPath, list: "revised" });
29644
29685
  if (typeof revised === "string") return revised;
29645
29686
  const findings = readFindings({
29646
- path: join69(folder, LEDGER_FILE),
29687
+ path: join70(folder, LEDGER_FILE),
29647
29688
  bases: pathBasesOf({ root, repositoryExists })
29648
29689
  });
29649
29690
  if (typeof findings === "string") return findings;
@@ -29670,7 +29711,7 @@ function readRecapRecords(params) {
29670
29711
  findings,
29671
29712
  accepted,
29672
29713
  revised,
29673
- decisions: readDecisions(join69(folder, DECISIONS_FILE)),
29714
+ decisions: readDecisions(join70(folder, DECISIONS_FILE)),
29674
29715
  user
29675
29716
  };
29676
29717
  }
@@ -29692,15 +29733,15 @@ function readCommits(params) {
29692
29733
  }
29693
29734
  function pathBasesOf(params) {
29694
29735
  const { root, repositoryExists } = params;
29695
- const parent = dirname31(repositoryExists ? mainCheckoutOf(root) : root);
29696
- const workspace = !repositoryExists && basename8(parent) === WORKTREES_FOLDER ? dirname31(parent) : parent;
29736
+ const parent = dirname32(repositoryExists ? mainCheckoutOf(root) : root);
29737
+ const workspace = !repositoryExists && basename8(parent) === WORKTREES_FOLDER ? dirname32(parent) : parent;
29697
29738
  return {
29698
29739
  repository: spellingsOf(root),
29699
29740
  workspace: spellingsOf(workspace)
29700
29741
  };
29701
29742
  }
29702
29743
  function spellingsOf(folder) {
29703
- const real = existsSync63(folder) ? realpathSync9(folder) : folder;
29744
+ const real = existsSync64(folder) ? realpathSync9(folder) : folder;
29704
29745
  return real === folder ? [folder] : [folder, real];
29705
29746
  }
29706
29747
  function readChecks(params) {
@@ -29885,14 +29926,14 @@ function runRecap(params) {
29885
29926
  }
29886
29927
 
29887
29928
  // src/commands/record.ts
29888
- import { existsSync as existsSync65, mkdirSync as mkdirSync22, readFileSync as readFileSync44, writeFileSync as writeFileSync28 } from "fs";
29889
- import { basename as basename9, join as join71, resolve as resolve22 } from "path";
29929
+ import { existsSync as existsSync66, mkdirSync as mkdirSync22, readFileSync as readFileSync44, writeFileSync as writeFileSync28 } from "fs";
29930
+ import { basename as basename9, join as join72, resolve as resolve22 } from "path";
29890
29931
 
29891
29932
  // src/lib/review-rounds/snapshot-round.ts
29892
29933
  import {
29893
29934
  chmodSync as chmodSync2,
29894
29935
  copyFileSync as copyFileSync4,
29895
- existsSync as existsSync64,
29936
+ existsSync as existsSync65,
29896
29937
  lstatSync as lstatSync11,
29897
29938
  mkdirSync as mkdirSync21,
29898
29939
  readdirSync as readdirSync16,
@@ -29902,7 +29943,7 @@ import {
29902
29943
  symlinkSync as symlinkSync6,
29903
29944
  writeFileSync as writeFileSync27
29904
29945
  } from "fs";
29905
- import { dirname as dirname32, join as join70 } from "path";
29946
+ import { dirname as dirname33, join as join71 } from "path";
29906
29947
  function roundNames(round) {
29907
29948
  return {
29908
29949
  folder: `round-${round}`,
@@ -29911,7 +29952,7 @@ function roundNames(round) {
29911
29952
  };
29912
29953
  }
29913
29954
  function copyFileOrLink(params) {
29914
- mkdirSync21(dirname32(params.to), { recursive: true });
29955
+ mkdirSync21(dirname33(params.to), { recursive: true });
29915
29956
  const stats = lstatSync11(params.from);
29916
29957
  if (isFileOrLink(params.to)) rmSync23(params.to);
29917
29958
  if (stats.isSymbolicLink()) symlinkSync6(readlinkSync6(params.from), params.to);
@@ -29923,10 +29964,10 @@ function copyFileOrLink(params) {
29923
29964
  function snapshotRefusal(params) {
29924
29965
  const names = roundNames(params.round);
29925
29966
  const existing = [names.folder, names.deleted, names.base].find(
29926
- (name) => existsSync64(join70(params.folder, name))
29967
+ (name) => existsSync65(join71(params.folder, name))
29927
29968
  );
29928
29969
  if (existing)
29929
- return `${join70(params.folder, existing)} exists already: round ${params.round} was taken`;
29970
+ return `${join71(params.folder, existing)} exists already: round ${params.round} was taken`;
29930
29971
  return worktreeStateRefusal({ root: params.root, state: params.state });
29931
29972
  }
29932
29973
  function takeSnapshot(params) {
@@ -29937,19 +29978,19 @@ function takeSnapshot(params) {
29937
29978
  const base = readGit({ root, args: ["rev-parse", "HEAD"] }).trim();
29938
29979
  const copied = [];
29939
29980
  const deleted = [];
29940
- const partial = join70(folder, `${names.folder}${PARTIAL_SUFFIX}`);
29981
+ const partial = join71(folder, `${names.folder}${PARTIAL_SUFFIX}`);
29941
29982
  mkdirSync21(partial);
29942
29983
  for (const path of params.state.status.paths) {
29943
- if (isFileOrLink(join70(root, path))) {
29944
- copyFileOrLink({ from: join70(root, path), to: join70(partial, path) });
29984
+ if (isFileOrLink(join71(root, path))) {
29985
+ copyFileOrLink({ from: join71(root, path), to: join71(partial, path) });
29945
29986
  copied.push(path);
29946
29987
  } else if (params.state.head.files.has(path)) deleted.push(path);
29947
29988
  }
29948
29989
  writeFileSync27(
29949
- join70(folder, `${names.deleted}${PARTIAL_SUFFIX}`),
29990
+ join71(folder, `${names.deleted}${PARTIAL_SUFFIX}`),
29950
29991
  deleted.sort().map((path) => `${path}\0`).join("")
29951
29992
  );
29952
- writeFileSync27(join70(folder, `${names.base}${PARTIAL_SUFFIX}`), `${base}
29993
+ writeFileSync27(join71(folder, `${names.base}${PARTIAL_SUFFIX}`), `${base}
29953
29994
  `);
29954
29995
  renameAll({ folder, names: [names.deleted, names.base, names.folder] });
29955
29996
  return { copied: copied.length, deleted: deleted.length, base };
@@ -29958,18 +29999,18 @@ function removeLeftovers(params) {
29958
29999
  const names = Object.values(roundNames(params.round));
29959
30000
  for (const entry of readdirSync16(params.folder))
29960
30001
  if (names.some((name) => entry.startsWith(`${name}${PARTIAL_SUFFIX}`)))
29961
- rmSync23(join70(params.folder, entry), { recursive: true, force: true });
30002
+ rmSync23(join71(params.folder, entry), { recursive: true, force: true });
29962
30003
  }
29963
30004
  function renameAll(params) {
29964
30005
  const renamed = [];
29965
30006
  try {
29966
30007
  for (const name of params.names) {
29967
- renameSync4(join70(params.folder, `${name}${PARTIAL_SUFFIX}`), join70(params.folder, name));
30008
+ renameSync4(join71(params.folder, `${name}${PARTIAL_SUFFIX}`), join71(params.folder, name));
29968
30009
  renamed.push(name);
29969
30010
  }
29970
30011
  } catch (error) {
29971
30012
  for (const name of renamed)
29972
- renameSync4(join70(params.folder, name), join70(params.folder, `${name}${PARTIAL_SUFFIX}`));
30013
+ renameSync4(join71(params.folder, name), join71(params.folder, `${name}${PARTIAL_SUFFIX}`));
29973
30014
  throw error;
29974
30015
  }
29975
30016
  }
@@ -30008,7 +30049,7 @@ function recordChoice(params) {
30008
30049
  const refusal = handoverFolderRefusal(folder);
30009
30050
  if (refusal) return { exitCode: 1, output: `record: ${refusal}` };
30010
30051
  mkdirSync22(folder, { recursive: true });
30011
- const path = join71(folder, DECISIONS_FILE);
30052
+ const path = join72(folder, DECISIONS_FILE);
30012
30053
  appendDecision({
30013
30054
  path,
30014
30055
  title: basename9(folder),
@@ -30038,7 +30079,7 @@ function recordReview(params) {
30038
30079
  const refusal = handoverFolderRefusal(folder);
30039
30080
  if (refusal) return { exitCode: 1, output: `record: ${refusal}` };
30040
30081
  mkdirSync22(folder, { recursive: true });
30041
- const ledger = join71(folder, LEDGER_FILE);
30082
+ const ledger = join72(folder, LEDGER_FILE);
30042
30083
  const id = appendFinding({ path: ledger, title: basename9(folder), round, severity, at, finding: finding2 });
30043
30084
  return { exitCode: 0, output: `record: ${id} open - ${ledger}` };
30044
30085
  }
@@ -30053,8 +30094,8 @@ function recordDecision(params) {
30053
30094
  const folder = resolve22(params.cwd, folderWord);
30054
30095
  const refusal = handoverFolderRefusal(folder);
30055
30096
  if (refusal) return { exitCode: 1, output: `record: ${refusal}` };
30056
- const ledger = join71(folder, LEDGER_FILE);
30057
- if (!existsSync65(ledger))
30097
+ const ledger = join72(folder, LEDGER_FILE);
30098
+ if (!existsSync66(ledger))
30058
30099
  return {
30059
30100
  exitCode: 1,
30060
30101
  output: `record: no findings ledger ${ledger}: record review writes the first finding`
@@ -30106,24 +30147,24 @@ import { resolve as resolve24 } from "path";
30106
30147
 
30107
30148
  // src/lib/review-rounds/review-delta.ts
30108
30149
  import { spawnSync as spawnSync19 } from "child_process";
30109
- import { existsSync as existsSync69, readFileSync as readFileSync48, statSync as statSync10 } from "fs";
30110
- import { join as join75 } from "path";
30150
+ import { existsSync as existsSync70, readFileSync as readFileSync48, statSync as statSync10 } from "fs";
30151
+ import { join as join76 } from "path";
30111
30152
 
30112
30153
  // src/lib/worktree/add-worktree.ts
30113
30154
  import { spawnSync as spawnSync18 } from "child_process";
30114
- import { appendFileSync as appendFileSync2, cpSync as cpSync3, existsSync as existsSync68, mkdirSync as mkdirSync23, readFileSync as readFileSync47 } from "fs";
30115
- import { basename as basename10, dirname as dirname33, isAbsolute as isAbsolute10, join as join74 } from "path";
30155
+ import { appendFileSync as appendFileSync2, cpSync as cpSync3, existsSync as existsSync69, mkdirSync as mkdirSync23, readFileSync as readFileSync47 } from "fs";
30156
+ import { basename as basename10, dirname as dirname34, isAbsolute as isAbsolute10, join as join75 } from "path";
30116
30157
 
30117
30158
  // src/lib/worktree/check-node-modules.ts
30118
- import { existsSync as existsSync67, readFileSync as readFileSync46, realpathSync as realpathSync10 } from "fs";
30119
- import { join as join73, resolve as resolve23 } from "path";
30159
+ import { existsSync as existsSync68, readFileSync as readFileSync46, realpathSync as realpathSync10 } from "fs";
30160
+ import { join as join74, resolve as resolve23 } from "path";
30120
30161
 
30121
30162
  // src/lib/worktree/locked-packages.ts
30122
- import { existsSync as existsSync66, readFileSync as readFileSync45 } from "fs";
30123
- import { join as join72 } from "path";
30163
+ import { existsSync as existsSync67, readFileSync as readFileSync45 } from "fs";
30164
+ import { join as join73 } from "path";
30124
30165
  function readLockedPackages(params) {
30125
- const path = join72(params.worktree, PACKAGE_LOCK_FILE);
30126
- if (!existsSync66(path)) return { notChecked: "no lockfile" };
30166
+ const path = join73(params.worktree, PACKAGE_LOCK_FILE);
30167
+ if (!existsSync67(path)) return { notChecked: "no lockfile" };
30127
30168
  let lockfile;
30128
30169
  try {
30129
30170
  lockfile = JSON.parse(readFileSync45(path, "utf8"));
@@ -30133,7 +30174,7 @@ function readLockedPackages(params) {
30133
30174
  if (typeof lockfile?.packages !== "object" || lockfile.packages === null)
30134
30175
  return { notChecked: "has no packages map" };
30135
30176
  return {
30136
- packages: Object.entries(lockfile.packages).filter(([key, entry]) => key.startsWith(NODE_MODULES_PREFIX) && !entry.inBundle).filter(([key, entry]) => !mayBeLeftOut(entry) || isPresent(join72(params.worktree, key))).map(([key, entry]) => ({ key, entry }))
30177
+ packages: Object.entries(lockfile.packages).filter(([key, entry]) => key.startsWith(NODE_MODULES_PREFIX) && !entry.inBundle).filter(([key, entry]) => !mayBeLeftOut(entry) || isPresent(join73(params.worktree, key))).map(([key, entry]) => ({ key, entry }))
30137
30178
  };
30138
30179
  }
30139
30180
  function mayBeLeftOut(entry) {
@@ -30165,15 +30206,15 @@ function checkNodeModules(params) {
30165
30206
  }
30166
30207
  function problemOf(params) {
30167
30208
  const { key, entry } = params.locked;
30168
- const installed = join73(params.worktree, key);
30209
+ const installed = join74(params.worktree, key);
30169
30210
  if (entry.link) {
30170
30211
  const resolved = entry.resolved ?? "";
30171
30212
  const target = resolve23(params.worktree, resolved);
30172
- if (!existsSync67(installed) || !existsSync67(target)) return `link to ${resolved} missing`;
30213
+ if (!existsSync68(installed) || !existsSync68(target)) return `link to ${resolved} missing`;
30173
30214
  return realpathSync10(installed) === realpathSync10(target) ? void 0 : `link to ${resolved} points elsewhere`;
30174
30215
  }
30175
- const manifest = join73(installed, "package.json");
30176
- if (!existsSync67(manifest)) return "missing";
30216
+ const manifest = join74(installed, "package.json");
30217
+ if (!existsSync68(manifest)) return "missing";
30177
30218
  let version;
30178
30219
  try {
30179
30220
  version = JSON.parse(readFileSync46(manifest, "utf8")).version;
@@ -30193,12 +30234,12 @@ function packageName2(key) {
30193
30234
  function addWorktree(params) {
30194
30235
  const { branch } = params;
30195
30236
  const repository = mainCheckoutOf(params.repository);
30196
- const worktree = join74(
30197
- dirname33(repository),
30237
+ const worktree = join75(
30238
+ dirname34(repository),
30198
30239
  WORKTREES_FOLDER,
30199
30240
  `${basename10(repository)}-${branch.split("/").at(-1)}`
30200
30241
  );
30201
- if (existsSync68(worktree)) return `${worktree} exists already`;
30242
+ if (existsSync69(worktree)) return `${worktree} exists already`;
30202
30243
  const branchExists = spawnSync18("git", ["rev-parse", "--verify", "--quiet", `refs/heads/${branch}`], {
30203
30244
  cwd: repository
30204
30245
  }).status === 0;
@@ -30211,16 +30252,16 @@ function addWorktree(params) {
30211
30252
  });
30212
30253
  const hooks = readHooksFolder(repository);
30213
30254
  let copiedHooks;
30214
- if (hooks.configured && !isAbsolute10(hooks.configured) && existsSync68(hooks.folder)) {
30215
- const target = join74(worktree, hooks.configured);
30216
- if (!existsSync68(target)) cpSync3(hooks.folder, target, { recursive: true });
30255
+ if (hooks.configured && !isAbsolute10(hooks.configured) && existsSync69(hooks.folder)) {
30256
+ const target = join75(worktree, hooks.configured);
30257
+ if (!existsSync69(target)) cpSync3(hooks.folder, target, { recursive: true });
30217
30258
  copiedHooks = hooks.configured;
30218
30259
  }
30219
30260
  excludeLotFolder(worktree);
30220
30261
  const siblingLinks = linkSiblings({ worktree, repository });
30221
30262
  const checkout = params.from ? checkoutOf({ repository, branch: params.from }) : void 0;
30222
- const nodeModules = [checkout, repository].filter((folder) => folder !== void 0).map((folder) => join74(folder, "node_modules")).find((folder) => existsSync68(folder)) ?? join74(repository, "node_modules");
30223
- const copy = existsSync68(nodeModules) ? copyNodeModules({ from: nodeModules, to: join74(worktree, "node_modules") }) : void 0;
30263
+ const nodeModules = [checkout, repository].filter((folder) => folder !== void 0).map((folder) => join75(folder, "node_modules")).find((folder) => existsSync69(folder)) ?? join75(repository, "node_modules");
30264
+ const copy = existsSync69(nodeModules) ? copyNodeModules({ from: nodeModules, to: join75(worktree, "node_modules") }) : void 0;
30224
30265
  const nodeModulesCheck = checkNodeModules({ worktree });
30225
30266
  const lockfileRead = readLockedPackages({ worktree });
30226
30267
  const lockedPackages = "packages" in lockfileRead ? lockfileRead.packages.length : 0;
@@ -30255,9 +30296,9 @@ function excludeLotFolder(worktree) {
30255
30296
  root: worktree,
30256
30297
  args: ["rev-parse", "--path-format=absolute", "--git-path", "info/exclude"]
30257
30298
  }).trim();
30258
- const text = existsSync68(exclude) ? readFileSync47(exclude, "utf8") : "";
30299
+ const text = existsSync69(exclude) ? readFileSync47(exclude, "utf8") : "";
30259
30300
  if (text.split("\n").includes(LOT_FOLDER_EXCLUDE)) return;
30260
- mkdirSync23(dirname33(exclude), { recursive: true });
30301
+ mkdirSync23(dirname34(exclude), { recursive: true });
30261
30302
  appendFileSync2(exclude, `${text && !text.endsWith("\n") ? "\n" : ""}${LOT_FOLDER_EXCLUDE}
30262
30303
  `);
30263
30304
  }
@@ -30265,23 +30306,23 @@ function excludeLotFolder(worktree) {
30265
30306
  // src/lib/review-rounds/review-delta.ts
30266
30307
  function previousRoundRefusal(params) {
30267
30308
  const names = roundNames(params.previous);
30268
- const snapshot = join75(params.folder, names.folder);
30269
- if (!existsSync69(snapshot) || !statSync10(snapshot).isDirectory())
30309
+ const snapshot = join76(params.folder, names.folder);
30310
+ if (!existsSync70(snapshot) || !statSync10(snapshot).isDirectory())
30270
30311
  return `no snapshot ${snapshot}: record snapshot --round ${params.previous} takes it`;
30271
- if (!existsSync69(join75(params.folder, names.deleted)))
30272
- return `no ${join75(params.folder, names.deleted)}: record snapshot --round ${params.previous} writes it`;
30273
- const baseFile = join75(params.folder, names.base);
30274
- if (!existsSync69(baseFile)) return void 0;
30312
+ if (!existsSync70(join76(params.folder, names.deleted)))
30313
+ return `no ${join76(params.folder, names.deleted)}: record snapshot --round ${params.previous} writes it`;
30314
+ const baseFile = join76(params.folder, names.base);
30315
+ if (!existsSync70(baseFile)) return void 0;
30275
30316
  const base = readFileSync48(baseFile, "utf8").trim();
30276
30317
  const head = readGit({ root: params.root, args: ["rev-parse", "HEAD"] }).trim();
30277
30318
  return base === head ? void 0 : `HEAD moved since round-${params.previous} (base ${base}, HEAD ${head})`;
30278
30319
  }
30279
30320
  function readDeletedPaths(params) {
30280
- return readFileSync48(join75(params.folder, roundNames(params.previous).deleted), "utf8").split("\0").filter(Boolean);
30321
+ return readFileSync48(join76(params.folder, roundNames(params.previous).deleted), "utf8").split("\0").filter(Boolean);
30281
30322
  }
30282
30323
  function computeDelta(params) {
30283
30324
  const { root, previous } = params;
30284
- const snapshot = join75(params.folder, roundNames(previous).folder);
30325
+ const snapshot = join76(params.folder, roundNames(previous).folder);
30285
30326
  const inPrevious = new Set(listTreeFiles(snapshot));
30286
30327
  const inDeleted = new Set(readDeletedPaths(params));
30287
30328
  const atHead = params.state.head.files;
@@ -30291,7 +30332,7 @@ function computeDelta(params) {
30291
30332
  const sides = {
30292
30333
  inPrevious: inPrevious.has(path),
30293
30334
  inDeleted: inDeleted.has(path),
30294
- inWorktree: isFileOrLink(join75(root, path)),
30335
+ inWorktree: isFileOrLink(join76(root, path)),
30295
30336
  atBase: atHead.has(path)
30296
30337
  };
30297
30338
  const diff = diffOf({ root, snapshot, path, sides, previous });
@@ -30301,8 +30342,8 @@ function computeDelta(params) {
30301
30342
  }
30302
30343
  function diffOf(params) {
30303
30344
  const { sides } = params;
30304
- const current = join75(params.root, params.path);
30305
- const before = join75(params.snapshot, params.path);
30345
+ const current = join76(params.root, params.path);
30346
+ const before = join76(params.snapshot, params.path);
30306
30347
  if (sides.inPrevious)
30307
30348
  return sides.inWorktree ? {
30308
30349
  form: `round-${params.previous} \u2192 worktree`,
@@ -30386,8 +30427,8 @@ function addThrowaway(params) {
30386
30427
  removal: removalCommand({ main: added.repository, path: added.worktree, branch })
30387
30428
  };
30388
30429
  const names = roundNames(params.previous);
30389
- const deletedFile = join75(params.folder, names.deleted);
30390
- const snapshot = join75(params.folder, names.folder);
30430
+ const deletedFile = join76(params.folder, names.deleted);
30431
+ const snapshot = join76(params.folder, names.folder);
30391
30432
  try {
30392
30433
  if (statSync10(deletedFile).size > 0)
30393
30434
  readGit({
@@ -30402,7 +30443,7 @@ function addThrowaway(params) {
30402
30443
  });
30403
30444
  for (const path of listTreeFiles(snapshot))
30404
30445
  if (!LOT_FILE_PATTERN.test(path))
30405
- copyFileOrLink({ from: join75(snapshot, path), to: join75(added.worktree, path) });
30446
+ copyFileOrLink({ from: join76(snapshot, path), to: join76(added.worktree, path) });
30406
30447
  } catch (error) {
30407
30448
  return `${error.message}; the throwaway worktree is half made, remove it: ${throwaway.removal}`;
30408
30449
  }
@@ -30492,7 +30533,7 @@ function reviewDelta(params) {
30492
30533
  }
30493
30534
 
30494
30535
  // src/commands/rules.ts
30495
- import { existsSync as existsSync70, readFileSync as readFileSync49, statSync as statSync11 } from "fs";
30536
+ import { existsSync as existsSync71, readFileSync as readFileSync49, statSync as statSync11 } from "fs";
30496
30537
  import { resolve as resolve25 } from "path";
30497
30538
 
30498
30539
  // src/lib/rules/check-code-rules.constants.ts
@@ -30774,7 +30815,7 @@ function expandFolder(params) {
30774
30815
  const { cwd, path } = params;
30775
30816
  if (!statSync11(resolve25(cwd, path)).isDirectory()) return [path];
30776
30817
  return listRepositoryFiles({ root: cwd, folder: path }).filter(
30777
- (file) => TEXT_FILE_PATTERN.test(file) && existsSync70(resolve25(cwd, file))
30818
+ (file) => TEXT_FILE_PATTERN.test(file) && existsSync71(resolve25(cwd, file))
30778
30819
  );
30779
30820
  }
30780
30821
  function renderFinding(finding2) {
@@ -31070,12 +31111,12 @@ async function readSchemaDialectes(params) {
31070
31111
  }
31071
31112
 
31072
31113
  // src/commands/skills.ts
31073
- import { existsSync as existsSync80, readdirSync as readdirSync19, readFileSync as readFileSync59, writeFileSync as writeFileSync33 } from "fs";
31074
- import { dirname as dirname36, join as join85, relative as relative9, sep as sep2 } from "path";
31114
+ import { existsSync as existsSync81, readdirSync as readdirSync19, readFileSync as readFileSync59, writeFileSync as writeFileSync33 } from "fs";
31115
+ import { dirname as dirname37, join as join86, relative as relative9, sep as sep2 } from "path";
31075
31116
 
31076
31117
  // src/lib/api/api-json.ts
31077
- import { existsSync as existsSync72, readFileSync as readFileSync52 } from "fs";
31078
- import { join as join77 } from "path";
31118
+ import { existsSync as existsSync73, readFileSync as readFileSync52 } from "fs";
31119
+ import { join as join78 } from "path";
31079
31120
 
31080
31121
  // src/lib/skills/api-index.ts
31081
31122
  function renderApiIndex(entries) {
@@ -31182,14 +31223,14 @@ function tableCell(text) {
31182
31223
  }
31183
31224
 
31184
31225
  // src/lib/api/find-example.ts
31185
- import { existsSync as existsSync71, readFileSync as readFileSync51 } from "fs";
31186
- import { join as join76 } from "path";
31226
+ import { existsSync as existsSync72, readFileSync as readFileSync51 } from "fs";
31227
+ import { join as join77 } from "path";
31187
31228
  import ts9 from "typescript";
31188
31229
  function findTestExample(params) {
31189
31230
  const { file, position } = splitDeclaredAt(params.declaredAt);
31190
- const testFile = join76(params.root, file.replace(/\.ts$/, ".test.ts"));
31191
- if (!file.endsWith(".ts") || !existsSync71(testFile)) return void 0;
31192
- const functionName = declaredName({ path: join76(params.root, file), position });
31231
+ const testFile = join77(params.root, file.replace(/\.ts$/, ".test.ts"));
31232
+ if (!file.endsWith(".ts") || !existsSync72(testFile)) return void 0;
31233
+ const functionName = declaredName({ path: join77(params.root, file), position });
31193
31234
  if (!functionName) return void 0;
31194
31235
  const source = ts9.createSourceFile(
31195
31236
  testFile,
@@ -31218,7 +31259,7 @@ function splitDeclaredAt(declaredAt) {
31218
31259
  };
31219
31260
  }
31220
31261
  function declaredName(params) {
31221
- if (!existsSync71(params.path)) return void 0;
31262
+ if (!existsSync72(params.path)) return void 0;
31222
31263
  const source = ts9.createSourceFile(
31223
31264
  params.path,
31224
31265
  readFileSync51(params.path, "utf8"),
@@ -31303,8 +31344,8 @@ function rootOf(path) {
31303
31344
  }
31304
31345
  function lineOf(params) {
31305
31346
  const { file, position } = splitDeclaredAt(params.declaredAt);
31306
- const path = join77(params.root, file);
31307
- if (!existsSync72(path)) return file;
31347
+ const path = join78(params.root, file);
31348
+ if (!existsSync73(path)) return file;
31308
31349
  const line = readFileSync52(path, "utf8").slice(0, position).split("\n").length;
31309
31350
  return `${file}:${line}`;
31310
31351
  }
@@ -31339,8 +31380,8 @@ function prompt(params) {
31339
31380
  }
31340
31381
 
31341
31382
  // src/lib/models/resolve-sync-vendor.ts
31342
- import { existsSync as existsSync76, readdirSync as readdirSync17, readFileSync as readFileSync55, statSync as statSync12 } from "fs";
31343
- import { basename as basename11, dirname as dirname35, join as join81 } from "path";
31383
+ import { existsSync as existsSync77, readdirSync as readdirSync17, readFileSync as readFileSync55, statSync as statSync12 } from "fs";
31384
+ import { basename as basename11, dirname as dirname36, join as join82 } from "path";
31344
31385
 
31345
31386
  // src/lib/stations/session-check.constants.ts
31346
31387
  var SESSION_CHECK_COMMAND = "npx --no-install @dialecte/cli doctor --brief";
@@ -31362,12 +31403,12 @@ var AGENTS_CHECK_END = "<!-- /dialecte-skills:session-check -->";
31362
31403
  var AGENTS_CHECK_LINE = `At the start of a session, run \`${SESSION_CHECK_COMMAND}\`: nothing printed means the Dialecte skills are in sync; otherwise each line is a problem with its fix.`;
31363
31404
 
31364
31405
  // src/lib/stations/agents-file-check.ts
31365
- import { existsSync as existsSync73, readFileSync as readFileSync53, unlinkSync as unlinkSync3, writeFileSync as writeFileSync30 } from "fs";
31366
- import { join as join78 } from "path";
31406
+ import { existsSync as existsSync74, readFileSync as readFileSync53, unlinkSync as unlinkSync3, writeFileSync as writeFileSync30 } from "fs";
31407
+ import { join as join79 } from "path";
31367
31408
  function syncAgentsFileCheck(params) {
31368
31409
  const { cwd, enabled } = params;
31369
- const path = join78(cwd, AGENTS_FILE);
31370
- const exists = existsSync73(path);
31410
+ const path = join79(cwd, AGENTS_FILE);
31411
+ const exists = existsSync74(path);
31371
31412
  const text = exists ? readFileSync53(path, "utf8") : "";
31372
31413
  const found = findSection(text);
31373
31414
  if (found === "unclosed") return "unclosed";
@@ -31432,15 +31473,15 @@ function withoutSection(params) {
31432
31473
  }
31433
31474
 
31434
31475
  // src/lib/stations/session-check.ts
31435
- import { existsSync as existsSync75, mkdirSync as mkdirSync24, readFileSync as readFileSync54, unlinkSync as unlinkSync4, writeFileSync as writeFileSync31 } from "fs";
31436
- import { dirname as dirname34, join as join80 } from "path";
31476
+ import { existsSync as existsSync76, mkdirSync as mkdirSync24, readFileSync as readFileSync54, unlinkSync as unlinkSync4, writeFileSync as writeFileSync31 } from "fs";
31477
+ import { dirname as dirname35, join as join81 } from "path";
31437
31478
 
31438
31479
  // src/lib/stations/station-manifest.ts
31439
- import { existsSync as existsSync74 } from "fs";
31440
- import { join as join79 } from "path";
31480
+ import { existsSync as existsSync75 } from "fs";
31481
+ import { join as join80 } from "path";
31441
31482
  function updateStationManifest(params) {
31442
31483
  const { folder, patch } = params;
31443
- if (!existsSync74(join79(folder, MANIFEST_FILE))) return;
31484
+ if (!existsSync75(join80(folder, MANIFEST_FILE))) return;
31444
31485
  const manifest = readSyncManifest(folder);
31445
31486
  const { stationAgents, sessionCheck, settingsCreated, sessionCheckInserted, ...rest } = manifest;
31446
31487
  writeSyncManifest({
@@ -31459,11 +31500,11 @@ function updateStationManifest(params) {
31459
31500
  import { findNodeAtLocation, getNodeValue, parse as parse3, parseTree } from "jsonc-parser";
31460
31501
  function syncSessionCheck(params) {
31461
31502
  const { cwd, enabled } = params;
31462
- const manifestFolder = join80(cwd, AGENT_SKILL_FOLDERS.claude);
31503
+ const manifestFolder = join81(cwd, AGENT_SKILL_FOLDERS.claude);
31463
31504
  const recorded = readSyncManifest(manifestFolder).sessionCheck === true;
31464
- const path = join80(cwd, CLAUDE_SETTINGS_FILE);
31505
+ const path = join81(cwd, CLAUDE_SETTINGS_FILE);
31465
31506
  if (!enabled && !recorded) return "unchanged";
31466
- const exists = existsSync75(path);
31507
+ const exists = existsSync76(path);
31467
31508
  if (!exists && !enabled) {
31468
31509
  updateStationManifest({
31469
31510
  folder: manifestFolder,
@@ -31490,7 +31531,7 @@ function syncSessionCheck(params) {
31490
31531
  return present ? "removed" : "unchanged";
31491
31532
  }
31492
31533
  if (present) return recorded ? "unchanged" : "kept";
31493
- mkdirSync24(dirname34(path), { recursive: true });
31534
+ mkdirSync24(dirname35(path), { recursive: true });
31494
31535
  const added = withCheck(text);
31495
31536
  writeFileSync31(path, added.text);
31496
31537
  updateStationManifest({
@@ -31716,32 +31757,32 @@ function presentPaths(cwd) {
31716
31757
  const candidates = VENDOR_HOSTS.flatMap((host) => host.anyOf.flat());
31717
31758
  return new Set(
31718
31759
  candidates.filter(
31719
- (path) => existsSync76(join81(cwd, path)) && !holdsOnlySyncedSkills({ cwd, path })
31760
+ (path) => existsSync77(join82(cwd, path)) && !holdsOnlySyncedSkills({ cwd, path })
31720
31761
  )
31721
31762
  );
31722
31763
  }
31723
31764
  function holdsOnlySyncedSkills(params) {
31724
31765
  const skillFolders = Object.values(AGENT_SKILL_FOLDERS);
31725
- if (skillFolders.includes(params.path)) return isSyncedSkillsFolder(join81(params.cwd, params.path));
31726
- const stat = statSync12(join81(params.cwd, params.path));
31766
+ if (skillFolders.includes(params.path)) return isSyncedSkillsFolder(join82(params.cwd, params.path));
31767
+ const stat = statSync12(join82(params.cwd, params.path));
31727
31768
  if (params.path === AGENTS_FILE)
31728
- return stat.isFile() && holdsOnlyTheAgentsCheck(readFileSync55(join81(params.cwd, params.path), "utf8"));
31769
+ return stat.isFile() && holdsOnlyTheAgentsCheck(readFileSync55(join82(params.cwd, params.path), "utf8"));
31729
31770
  if (!stat.isDirectory()) return false;
31730
- const entries = readdirSync17(join81(params.cwd, params.path));
31731
- const ownSkillFolders2 = skillFolders.filter((folder) => dirname35(folder) === params.path);
31771
+ const entries = readdirSync17(join82(params.cwd, params.path));
31772
+ const ownSkillFolders2 = skillFolders.filter((folder) => dirname36(folder) === params.path);
31732
31773
  return entries.length > 0 && entries.every(
31733
31774
  (entry) => ownSkillFolders2.some(
31734
- (folder) => basename11(folder) === entry && isSyncedSkillsFolder(join81(params.cwd, folder))
31775
+ (folder) => basename11(folder) === entry && isSyncedSkillsFolder(join82(params.cwd, folder))
31735
31776
  ) || isSyncedClaudeExtra({ cwd: params.cwd, folder: params.path, entry })
31736
31777
  );
31737
31778
  }
31738
31779
  function isSyncedClaudeExtra(params) {
31739
- if (params.folder !== dirname35(AGENT_SKILL_FOLDERS.claude)) return false;
31740
- const manifest = readManifestOrNothing(join81(params.cwd, AGENT_SKILL_FOLDERS.claude));
31741
- const path = join81(params.cwd, params.folder, params.entry);
31742
- if (path === join81(params.cwd, CLAUDE_AGENTS_FOLDER))
31780
+ if (params.folder !== dirname36(AGENT_SKILL_FOLDERS.claude)) return false;
31781
+ const manifest = readManifestOrNothing(join82(params.cwd, AGENT_SKILL_FOLDERS.claude));
31782
+ const path = join82(params.cwd, params.folder, params.entry);
31783
+ if (path === join82(params.cwd, CLAUDE_AGENTS_FOLDER))
31743
31784
  return readdirSync17(path).every((file) => manifest.stationAgents?.includes(file));
31744
- if (path === join81(params.cwd, CLAUDE_SETTINGS_FILE))
31785
+ if (path === join82(params.cwd, CLAUDE_SETTINGS_FILE))
31745
31786
  return manifest.sessionCheck === true && holdsOnlyTheCheck(readFileSync55(path, "utf8"));
31746
31787
  return false;
31747
31788
  }
@@ -31753,7 +31794,7 @@ function readManifestOrNothing(folder) {
31753
31794
  }
31754
31795
  }
31755
31796
  function isSyncedSkillsFolder(folder) {
31756
- if (!existsSync76(join81(folder, MANIFEST_FILE))) return false;
31797
+ if (!existsSync77(join82(folder, MANIFEST_FILE))) return false;
31757
31798
  const { installed } = readSyncManifest(folder);
31758
31799
  return readdirSync17(folder).every((entry) => entry === MANIFEST_FILE || installed.includes(entry));
31759
31800
  }
@@ -31901,8 +31942,8 @@ function checkLine(params) {
31901
31942
  }
31902
31943
 
31903
31944
  // src/lib/skills/export-entries.ts
31904
- import { existsSync as existsSync77, readFileSync as readFileSync56 } from "fs";
31905
- import { join as join82 } from "path";
31945
+ import { existsSync as existsSync78, readFileSync as readFileSync56 } from "fs";
31946
+ import { join as join83 } from "path";
31906
31947
 
31907
31948
  // src/lib/skills/export-entries.constants.ts
31908
31949
  var SOURCE_FOLDER = "src";
@@ -31917,7 +31958,7 @@ var SUBPATH_PATTERN_MARKER = "*";
31917
31958
  // src/lib/skills/export-entries.ts
31918
31959
  function readExportEntries(params) {
31919
31960
  const manifest = JSON.parse(
31920
- readFileSync56(join82(params.root, "package.json"), "utf8")
31961
+ readFileSync56(join83(params.root, "package.json"), "utf8")
31921
31962
  );
31922
31963
  const packageName3 = typeof manifest.name === "string" ? manifest.name : "";
31923
31964
  return Object.entries(subpathsOf(manifest.exports)).flatMap(
@@ -31957,7 +31998,7 @@ function sourceOf(params) {
31957
31998
  `${withoutExtension}${sourceExtension}`,
31958
31999
  `${withoutExtension}/index${sourceExtension}`
31959
32000
  ]);
31960
- const source = candidates.find((candidate) => existsSync77(join82(params.root, candidate)));
32001
+ const source = candidates.find((candidate) => existsSync78(join83(params.root, candidate)));
31961
32002
  if (source === void 0)
31962
32003
  throw new Error(
31963
32004
  `exports entry "${params.subpath}": no source at ${candidates.join(" nor at ")}`
@@ -32072,8 +32113,8 @@ function findUnclosedGeneratedBlocks(markdown) {
32072
32113
 
32073
32114
  // src/lib/skills/package-facts.ts
32074
32115
  import { spawnSync as spawnSync20 } from "child_process";
32075
- import { existsSync as existsSync78, readdirSync as readdirSync18, readFileSync as readFileSync57 } from "fs";
32076
- import { join as join83 } from "path";
32116
+ import { existsSync as existsSync79, readdirSync as readdirSync18, readFileSync as readFileSync57 } from "fs";
32117
+ import { join as join84 } from "path";
32077
32118
 
32078
32119
  // src/lib/skills/package-facts.constants.ts
32079
32120
  var EXCLUDED_FOLDERS = [
@@ -32093,14 +32134,14 @@ function listRepositoryPaths(root) {
32093
32134
  return gitFiles ? withFolders(gitFiles) : walkRepositoryPaths(root);
32094
32135
  }
32095
32136
  function listGitFiles(root) {
32096
- if (!existsSync78(join83(root, ".git"))) return void 0;
32137
+ if (!existsSync79(join84(root, ".git"))) return void 0;
32097
32138
  const result = spawnSync20("git", ["ls-files", "--cached", "--others", "--exclude-standard"], {
32098
32139
  cwd: root,
32099
32140
  encoding: "utf8",
32100
32141
  maxBuffer: 1e8
32101
32142
  });
32102
32143
  if (result.status !== 0) return void 0;
32103
- return result.stdout.split("\n").filter(Boolean).filter((path) => existsSync78(join83(root, path)));
32144
+ return result.stdout.split("\n").filter(Boolean).filter((path) => existsSync79(join84(root, path)));
32104
32145
  }
32105
32146
  function withFolders(files) {
32106
32147
  const paths = /* @__PURE__ */ new Set();
@@ -32114,7 +32155,7 @@ function withFolders(files) {
32114
32155
  function walkRepositoryPaths(root) {
32115
32156
  const paths = [];
32116
32157
  function walk(relativeFolder) {
32117
- for (const entry of readdirSync18(join83(root, relativeFolder), { withFileTypes: true })) {
32158
+ for (const entry of readdirSync18(join84(root, relativeFolder), { withFileTypes: true })) {
32118
32159
  const path = relativeFolder ? `${relativeFolder}/${entry.name}` : entry.name;
32119
32160
  if (entry.isDirectory()) {
32120
32161
  if (EXCLUDED_FOLDERS.includes(entry.name) || EXCLUDED_FOLDERS.includes(path)) continue;
@@ -32127,31 +32168,31 @@ function walkRepositoryPaths(root) {
32127
32168
  return paths.sort();
32128
32169
  }
32129
32170
  function readNpmScripts(root) {
32130
- const path = join83(root, "package.json");
32131
- if (!existsSync78(path)) return /* @__PURE__ */ new Set();
32171
+ const path = join84(root, "package.json");
32172
+ if (!existsSync79(path)) return /* @__PURE__ */ new Set();
32132
32173
  return new Set(Object.keys(JSON.parse(readFileSync57(path, "utf8")).scripts ?? {}));
32133
32174
  }
32134
32175
  function readWorkspaceFacts(workspaceRoot) {
32135
32176
  const packageFolders = readdirSync18(workspaceRoot, { withFileTypes: true }).filter(
32136
- (entry) => entry.isDirectory() && !entry.name.startsWith(".") && existsSync78(join83(workspaceRoot, entry.name, "package.json"))
32177
+ (entry) => entry.isDirectory() && !entry.name.startsWith(".") && existsSync79(join84(workspaceRoot, entry.name, "package.json"))
32137
32178
  ).map((entry) => entry.name).sort();
32138
32179
  return {
32139
32180
  repositoryPaths: packageFolders.flatMap(
32140
- (folder) => listRepositoryPaths(join83(workspaceRoot, folder)).map((path) => `${folder}/${path}`)
32181
+ (folder) => listRepositoryPaths(join84(workspaceRoot, folder)).map((path) => `${folder}/${path}`)
32141
32182
  ),
32142
32183
  npmScripts: new Set(
32143
- packageFolders.flatMap((folder) => [...readNpmScripts(join83(workspaceRoot, folder))])
32184
+ packageFolders.flatMap((folder) => [...readNpmScripts(join84(workspaceRoot, folder))])
32144
32185
  )
32145
32186
  };
32146
32187
  }
32147
32188
  function listHookConcernFiles(root) {
32148
32189
  const concernFilesByFolder = {};
32149
32190
  for (const version of discoverVersions(root)) {
32150
- const hooksFolder = join83(root, "src", version, "hooks");
32151
- if (!existsSync78(hooksFolder)) continue;
32191
+ const hooksFolder = join84(root, "src", version, "hooks");
32192
+ if (!existsSync79(hooksFolder)) continue;
32152
32193
  for (const folder of readdirSync18(hooksFolder, { withFileTypes: true })) {
32153
32194
  if (!folder.isDirectory()) continue;
32154
- const files = readdirSync18(join83(hooksFolder, folder.name)).filter(
32195
+ const files = readdirSync18(join84(hooksFolder, folder.name)).filter(
32155
32196
  (file) => file.endsWith(".ts") && !NOT_A_CONCERN_FILE.test(file)
32156
32197
  );
32157
32198
  concernFilesByFolder[folder.name] = [
@@ -32164,7 +32205,7 @@ function listHookConcernFiles(root) {
32164
32205
 
32165
32206
  // src/lib/stations/sync-station-agents.ts
32166
32207
  import {
32167
- existsSync as existsSync79,
32208
+ existsSync as existsSync80,
32168
32209
  lstatSync as lstatSync12,
32169
32210
  mkdirSync as mkdirSync25,
32170
32211
  readFileSync as readFileSync58,
@@ -32172,11 +32213,11 @@ import {
32172
32213
  rmSync as rmSync24,
32173
32214
  writeFileSync as writeFileSync32
32174
32215
  } from "fs";
32175
- import { join as join84 } from "path";
32216
+ import { join as join85 } from "path";
32176
32217
  function syncStationAgents(params) {
32177
32218
  const { cwd, plan } = params;
32178
- const manifestFolder = join84(cwd, AGENT_SKILL_FOLDERS.claude);
32179
- const agentsFolder = join84(cwd, CLAUDE_AGENTS_FOLDER);
32219
+ const manifestFolder = join85(cwd, AGENT_SKILL_FOLDERS.claude);
32220
+ const agentsFolder = join85(cwd, CLAUDE_AGENTS_FOLDER);
32180
32221
  const previous = (readSyncManifest(manifestFolder).stationAgents ?? []).filter(
32181
32222
  (name) => STATION_AGENT_FILE_PATTERN.test(name)
32182
32223
  );
@@ -32190,15 +32231,15 @@ function syncStationAgents(params) {
32190
32231
  const owned = [];
32191
32232
  const produced = new Set(files.map((file) => file.name));
32192
32233
  for (const name of previous.filter((candidate) => !produced.has(candidate))) {
32193
- const path = join84(agentsFolder, name);
32194
- if (!existsSync79(path) || !lstatSync12(path).isFile()) continue;
32234
+ const path = join85(agentsFolder, name);
32235
+ if (!existsSync80(path) || !lstatSync12(path).isFile()) continue;
32195
32236
  rmSync24(path);
32196
32237
  report.removed.push(name);
32197
32238
  }
32198
32239
  if (report.removed.length > 0) removeFolderIfEmpty(agentsFolder);
32199
32240
  for (const file of files) {
32200
- const path = join84(agentsFolder, file.name);
32201
- if (existsSync79(path)) {
32241
+ const path = join85(agentsFolder, file.name);
32242
+ if (existsSync80(path)) {
32202
32243
  if (readFileSync58(path, "utf8") === file.content) {
32203
32244
  owned.push(file.name);
32204
32245
  continue;
@@ -32290,8 +32331,8 @@ function runSync(params) {
32290
32331
  throw new Error("skills sync: --contributing and --no-contributing exclude each other");
32291
32332
  if (params.vendor !== void 0)
32292
32333
  for (const folder of listManifestFolders(cwd))
32293
- rememberVendor({ folder: join85(cwd, folder), vendor: params.vendor });
32294
- const targetFolders = agents.map((agent) => join85(cwd, AGENT_SKILL_FOLDERS[agent]));
32334
+ rememberVendor({ folder: join86(cwd, folder), vendor: params.vendor });
32335
+ const targetFolders = agents.map((agent) => join86(cwd, AGENT_SKILL_FOLDERS[agent]));
32295
32336
  const contributing = isContributingSync({ argv, targetFolders });
32296
32337
  const discovered = discoverSkillSources({ cwd, from: getArg(argv, "from") });
32297
32338
  const { missingDependencies } = discovered;
@@ -32348,7 +32389,7 @@ function isContributingSync(params) {
32348
32389
  }
32349
32390
  function syncClaudeCodeExtras(params) {
32350
32391
  const { argv, cwd, claudeIsTarget } = params;
32351
- const manifest = readSyncManifest(join85(cwd, AGENT_SKILL_FOLDERS.claude));
32392
+ const manifest = readSyncManifest(join86(cwd, AGENT_SKILL_FOLDERS.claude));
32352
32393
  const vendor = params.vendor ?? manifest.vendor;
32353
32394
  const hasLot = claudeIsTarget && manifest.installed.includes(LOT_SKILL);
32354
32395
  const plan = hasLot ? planStationAgents({ vendor: vendor !== void 0 && isVendorId(vendor) ? vendor : void 0 }) : { kind: "files", files: [] };
@@ -32417,12 +32458,12 @@ function generatePages(params) {
32417
32458
  console.error(`\u274C ${page.file}: unknown generated block "${kind}"`);
32418
32459
  }
32419
32460
  if (findStaleGeneratedKinds({ markdown, blocks }).length === 0) continue;
32420
- writeFileSync33(join85(cwd, page.file), result.markdown);
32461
+ writeFileSync33(join86(cwd, page.file), result.markdown);
32421
32462
  written.push(page.file);
32422
32463
  console.log(`\u270F\uFE0F ${page.file}`);
32423
32464
  }
32424
32465
  for (const apiJson of staleApiJsonFiles({ cwd, methods: params.methods })) {
32425
- writeFileSync33(join85(cwd, apiJson.file), apiJson.content);
32466
+ writeFileSync33(join86(cwd, apiJson.file), apiJson.content);
32426
32467
  written.push(apiJson.file);
32427
32468
  console.log(`\u270F\uFE0F ${apiJson.file}`);
32428
32469
  }
@@ -32522,8 +32563,8 @@ function staleApiJsonFiles(params) {
32522
32563
  const content = renderApiJson(
32523
32564
  buildApiJson({ packageName: readPackageName(cwd), methods: params.methods, root: cwd })
32524
32565
  );
32525
- return pagesWithIndex.map((page) => ({ file: `${dirname36(page.file)}/${API_JSON_FILE}`, content })).filter(
32526
- (apiJson) => !holdsSameJson({ path: join85(cwd, apiJson.file), content: apiJson.content })
32566
+ return pagesWithIndex.map((page) => ({ file: `${dirname37(page.file)}/${API_JSON_FILE}`, content })).filter(
32567
+ (apiJson) => !holdsSameJson({ path: join86(cwd, apiJson.file), content: apiJson.content })
32527
32568
  );
32528
32569
  }
32529
32570
  function holdsGeneratedBlock(params) {
@@ -32532,11 +32573,11 @@ function holdsGeneratedBlock(params) {
32532
32573
  );
32533
32574
  }
32534
32575
  function readPackageName(cwd) {
32535
- const manifest = JSON.parse(readFileSync59(join85(cwd, "package.json"), "utf8"));
32576
+ const manifest = JSON.parse(readFileSync59(join86(cwd, "package.json"), "utf8"));
32536
32577
  return typeof manifest.name === "string" ? manifest.name : "";
32537
32578
  }
32538
32579
  function holdsSameJson(params) {
32539
- if (!existsSync80(params.path)) return false;
32580
+ if (!existsSync81(params.path)) return false;
32540
32581
  try {
32541
32582
  return JSON.stringify(JSON.parse(readFileSync59(params.path, "utf8"))) === JSON.stringify(JSON.parse(params.content));
32542
32583
  } catch {
@@ -32554,14 +32595,14 @@ function renderBlocks(params) {
32554
32595
  };
32555
32596
  }
32556
32597
  function readStationsPage(cwd) {
32557
- const path = join85(cwd, STATIONS_FILE);
32558
- return existsSync80(path) ? readFileSync59(path, "utf8") : void 0;
32598
+ const path = join86(cwd, STATIONS_FILE);
32599
+ return existsSync81(path) ? readFileSync59(path, "utf8") : void 0;
32559
32600
  }
32560
32601
  function readPage(params) {
32561
- return readFileSync59(join85(params.cwd, params.page.file), "utf8").replace(/\r\n/g, "\n");
32602
+ return readFileSync59(join86(params.cwd, params.page.file), "utf8").replace(/\r\n/g, "\n");
32562
32603
  }
32563
32604
  function listSkillPages(cwd) {
32564
- const skillsRoot = join85(cwd, SKILLS_FOLDER);
32605
+ const skillsRoot = join86(cwd, SKILLS_FOLDER);
32565
32606
  let skillNames;
32566
32607
  try {
32567
32608
  skillNames = readdirSync19(skillsRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
@@ -32569,7 +32610,7 @@ function listSkillPages(cwd) {
32569
32610
  return [];
32570
32611
  }
32571
32612
  return skillNames.flatMap(
32572
- (skillName) => listRepositoryPaths(join85(skillsRoot, skillName)).filter((path) => path.endsWith(".md") && !path.startsWith("evals/")).map((path) => ({
32613
+ (skillName) => listRepositoryPaths(join86(skillsRoot, skillName)).filter((path) => path.endsWith(".md") && !path.startsWith("evals/")).map((path) => ({
32573
32614
  file: `${SKILLS_FOLDER}/${skillName}/${path}`,
32574
32615
  skillName,
32575
32616
  isSkillFile: path === "SKILL.md"
@@ -32577,22 +32618,22 @@ function listSkillPages(cwd) {
32577
32618
  );
32578
32619
  }
32579
32620
  function siblingFilesOf(params) {
32580
- const skillFolder = join85(params.cwd, SKILLS_FOLDER, params.skillName);
32581
- const pageFolder = dirname36(join85(params.cwd, params.page));
32621
+ const skillFolder = join86(params.cwd, SKILLS_FOLDER, params.skillName);
32622
+ const pageFolder = dirname37(join86(params.cwd, params.page));
32582
32623
  return new Set(
32583
32624
  listRepositoryPaths(skillFolder).map(
32584
- (path) => relative9(pageFolder, join85(skillFolder, path)).split(sep2).join("/")
32625
+ (path) => relative9(pageFolder, join86(skillFolder, path)).split(sep2).join("/")
32585
32626
  )
32586
32627
  );
32587
32628
  }
32588
32629
 
32589
32630
  // src/lib/tdd/production-states.ts
32590
- import { join as join86 } from "path";
32631
+ import { join as join87 } from "path";
32591
32632
  function readProductionState(params) {
32592
32633
  const { root, base, packageJson } = params;
32593
32634
  const files = {};
32594
32635
  for (const file of listChangedSince({ root, base }))
32595
- if (isProductionPath({ file, packageJson })) files[file] = hashFile(join86(root, file));
32636
+ if (isProductionPath({ file, packageJson })) files[file] = hashFile(join87(root, file));
32596
32637
  const deleted = readGit({
32597
32638
  root,
32598
32639
  args: ["diff", "--name-only", "--relative", "--no-renames", "--diff-filter=D", base]
@@ -33179,7 +33220,7 @@ function isSubcommand3(word) {
33179
33220
  }
33180
33221
 
33181
33222
  // src/commands/text.ts
33182
- import { existsSync as existsSync81, readFileSync as readFileSync60 } from "fs";
33223
+ import { existsSync as existsSync82, readFileSync as readFileSync60 } from "fs";
33183
33224
  import { resolve as resolve27 } from "path";
33184
33225
 
33185
33226
  // src/lib/text-check/text-check.constants.ts
@@ -33400,7 +33441,7 @@ function runText2(params) {
33400
33441
  if (read.words.length !== 1) return { exitCode: 2, output: TEXT_CHECK_USAGE };
33401
33442
  const [file] = read.words;
33402
33443
  const path = resolve27(params.cwd, file);
33403
- if (!existsSync81(path)) return { exitCode: 1, output: `text check: no file ${path}` };
33444
+ if (!existsSync82(path)) return { exitCode: 1, output: `text check: no file ${path}` };
33404
33445
  return renderTextCheck({
33405
33446
  file,
33406
33447
  kind,
@@ -33414,7 +33455,7 @@ function isTextKind(kind) {
33414
33455
  // src/commands/worktree.ts
33415
33456
  import { spawnSync as spawnSync22 } from "child_process";
33416
33457
  import { tmpdir as tmpdir7 } from "os";
33417
- import { dirname as dirname38, join as join88, relative as relative11, resolve as resolve28 } from "path";
33458
+ import { dirname as dirname39, join as join89, relative as relative11, resolve as resolve28 } from "path";
33418
33459
  import { createInterface as createInterface2 } from "readline/promises";
33419
33460
 
33420
33461
  // src/lib/card/render-card.ts
@@ -33467,8 +33508,8 @@ function wrapText2(params) {
33467
33508
 
33468
33509
  // src/lib/worktree/prune-worktrees.ts
33469
33510
  import { spawnSync as spawnSync21 } from "child_process";
33470
- import { existsSync as existsSync82, lstatSync as lstatSync13, readdirSync as readdirSync20, readFileSync as readFileSync61, realpathSync as realpathSync11, statSync as statSync13 } from "fs";
33471
- import { basename as basename12, dirname as dirname37, isAbsolute as isAbsolute11, join as join87, relative as relative10, sep as sep3 } from "path";
33511
+ import { existsSync as existsSync83, lstatSync as lstatSync13, readdirSync as readdirSync20, readFileSync as readFileSync61, realpathSync as realpathSync11, statSync as statSync13 } from "fs";
33512
+ import { basename as basename12, dirname as dirname38, isAbsolute as isAbsolute11, join as join88, relative as relative10, sep as sep3 } from "path";
33472
33513
  function planPrune(params) {
33473
33514
  const scratchRoots = [
33474
33515
  .../* @__PURE__ */ new Set([params.scratchRoot, params.formerScratchRoot ?? params.scratchRoot])
@@ -33479,15 +33520,15 @@ function planPrune(params) {
33479
33520
  });
33480
33521
  const links = [
33481
33522
  params.workspace,
33482
- join87(params.workspace, WORKTREES_FOLDER),
33483
- join87(params.workspace, COMMIT_PLAN_FOLDER),
33523
+ join88(params.workspace, WORKTREES_FOLDER),
33524
+ join88(params.workspace, COMMIT_PLAN_FOLDER),
33484
33525
  ...scratchRoots
33485
33526
  ].flatMap((folder) => findLinks(folder));
33486
- const repositories = readdirSync20(params.workspace, { withFileTypes: true }).filter((entry) => entry.isDirectory() && isMainCheckout(join87(params.workspace, entry.name))).map(
33487
- (entry) => planRepository({ repository: join87(params.workspace, entry.name), handovers, links })
33527
+ const repositories = readdirSync20(params.workspace, { withFileTypes: true }).filter((entry) => entry.isDirectory() && isMainCheckout(join88(params.workspace, entry.name))).map(
33528
+ (entry) => planRepository({ repository: join88(params.workspace, entry.name), handovers, links })
33488
33529
  );
33489
33530
  const scratch = scratchRoots.flatMap(function rehearsalsIn(scratchRoot) {
33490
- if (!existsSync82(scratchRoot)) return [];
33531
+ if (!existsSync83(scratchRoot)) return [];
33491
33532
  return readdirSync20(scratchRoot).filter((name) => name.startsWith(REHEARSAL_FOLDER_PREFIX)).sort().map((name) => planRehearsalClone({ scratchRoot, name, links }));
33492
33533
  });
33493
33534
  return { repositories, scratch };
@@ -33516,13 +33557,13 @@ function planRepository(params) {
33516
33557
  }).trim();
33517
33558
  const keptBranches = /* @__PURE__ */ new Set([baseBranch, checkedOut]);
33518
33559
  const ownedRuns = readRuns({ root: repository }).filter(
33519
- (run25) => (run25.state === "running" || run25.state === "died") && existsSync82(run25.worktree)
33560
+ (run25) => (run25.state === "running" || run25.state === "died") && existsSync83(run25.worktree)
33520
33561
  );
33521
33562
  const worktrees = listWorktrees(repository).slice(1).map((worktree) => ({
33522
33563
  ...worktree,
33523
- name: spellUnder({ path: worktree.path, folder: dirname37(repository) })
33564
+ name: spellUnder({ path: worktree.path, folder: dirname38(repository) })
33524
33565
  }));
33525
- const linkedWorktrees = worktrees.map((worktree) => worktree.name).filter((name) => isLink2(name) && !existsSync82(join87(name, ".git")));
33566
+ const linkedWorktrees = worktrees.map((worktree) => worktree.name).filter((name) => isLink2(name) && !existsSync83(join88(name, ".git")));
33526
33567
  for (const worktree of worktrees) {
33527
33568
  const { name } = worktree;
33528
33569
  if (isLink2(name)) {
@@ -33534,7 +33575,7 @@ function planRepository(params) {
33534
33575
  items.push({ kind: "worktree", name, kept: "detached HEAD" });
33535
33576
  continue;
33536
33577
  }
33537
- const kept = existsSync82(name) ? whyKeepWorktree({
33578
+ const kept = existsSync83(name) ? whyKeepWorktree({
33538
33579
  repository,
33539
33580
  worktree: name,
33540
33581
  branch: worktree.branch,
@@ -33546,7 +33587,7 @@ function planRepository(params) {
33546
33587
  if (kept) {
33547
33588
  keptBranches.add(worktree.branch);
33548
33589
  items.push({ kind: "worktree", name, kept: `${worktree.branch}: ${kept}` });
33549
- } else if (!existsSync82(name) && linkedWorktrees.length > 0) {
33590
+ } else if (!existsSync83(name) && linkedWorktrees.length > 0) {
33550
33591
  keptBranches.add(worktree.branch);
33551
33592
  items.push({
33552
33593
  kind: "worktree",
@@ -33557,7 +33598,7 @@ function planRepository(params) {
33557
33598
  items.push({
33558
33599
  kind: "worktree",
33559
33600
  name,
33560
- command: existsSync82(name) ? `${cd} git worktree remove ${shellQuote(name)}` : `${cd} git worktree prune`
33601
+ command: existsSync83(name) ? `${cd} git worktree remove ${shellQuote(name)}` : `${cd} git worktree prune`
33561
33602
  });
33562
33603
  }
33563
33604
  for (const branch of readGit({
@@ -33590,7 +33631,7 @@ function planRepository(params) {
33590
33631
  for (const handover of mine) {
33591
33632
  if (handoverStateOf(handover) !== "committed") continue;
33592
33633
  const { folder } = handover;
33593
- if (isReachedThroughLink({ path: folder, root: dirname37(repository) })) {
33634
+ if (isReachedThroughLink({ path: folder, root: dirname38(repository) })) {
33594
33635
  items.push({ kind: "hand-over", name: folder, kept: PRUNE_LINK_REASON });
33595
33636
  continue;
33596
33637
  }
@@ -33600,16 +33641,16 @@ function planRepository(params) {
33600
33641
  reachedBy ? { kind: "hand-over", name: folder, kept: `the link ${reachedBy} points to it` } : {
33601
33642
  kind: "hand-over",
33602
33643
  name: folder,
33603
- command: `cd ${shellQuote(dirname37(folder))} && rm -rf ${shellQuote(basename12(folder))}`
33644
+ command: `cd ${shellQuote(dirname38(folder))} && rm -rf ${shellQuote(basename12(folder))}`
33604
33645
  }
33605
33646
  );
33606
33647
  }
33607
33648
  return { repository, baseBranch, items };
33608
33649
  }
33609
33650
  function findLinks(folder) {
33610
- if (!existsSync82(folder)) return [];
33651
+ if (!existsSync83(folder)) return [];
33611
33652
  return readdirSync20(folder, { withFileTypes: true }).filter((entry) => entry.isSymbolicLink()).flatMap(function reach(entry) {
33612
- const link = join87(folder, entry.name);
33653
+ const link = join88(folder, entry.name);
33613
33654
  try {
33614
33655
  return [{ link, target: realpathSync11(link) }];
33615
33656
  } catch {
@@ -33628,7 +33669,7 @@ function isReachedThroughLink(params) {
33628
33669
  const fromRoot = relative10(params.root, params.path);
33629
33670
  if (fromRoot === "" || fromRoot === ".." || fromRoot.startsWith(`..${sep3}`) || isAbsolute11(fromRoot))
33630
33671
  return isLink2(params.path);
33631
- for (let folder = params.path; folder !== params.root && folder !== dirname37(folder); folder = dirname37(folder))
33672
+ for (let folder = params.path; folder !== params.root && folder !== dirname38(folder); folder = dirname38(folder))
33632
33673
  if (isLink2(folder)) return true;
33633
33674
  return false;
33634
33675
  }
@@ -33644,11 +33685,11 @@ function isRemovableHandoverFolder(folder) {
33644
33685
  return !readdirSync20(folder, { withFileTypes: true }).some((entry) => entry.isDirectory());
33645
33686
  }
33646
33687
  function isMainCheckout(folder) {
33647
- const gitFolder = join87(folder, ".git");
33648
- return existsSync82(gitFolder) && statSync13(gitFolder).isDirectory() && existsSync82(join87(gitFolder, "HEAD"));
33688
+ const gitFolder = join88(folder, ".git");
33689
+ return existsSync83(gitFolder) && statSync13(gitFolder).isDirectory() && existsSync83(join88(gitFolder, "HEAD"));
33649
33690
  }
33650
33691
  function planRehearsalClone(params) {
33651
- const clone = join87(params.scratchRoot, params.name);
33692
+ const clone = join88(params.scratchRoot, params.name);
33652
33693
  if (isLink2(clone)) return { kind: "rehearsal clone", name: clone, kept: PRUNE_LINK_REASON };
33653
33694
  const marker = readRehearsalMarker(rehearsalMarkerPath(clone));
33654
33695
  if (!marker)
@@ -33673,10 +33714,10 @@ function planRehearsalClone(params) {
33673
33714
  };
33674
33715
  }
33675
33716
  function rehearsalMarkerPath(entry) {
33676
- const ownMarker = join87(entry, ".git", REHEARSAL_MARKER_FILE);
33677
- if (existsSync82(ownMarker) || !isDirectory(entry)) return ownMarker;
33678
- const inside = readdirSync20(entry, { withFileTypes: true }).filter((child) => child.isDirectory()).map((child) => join87(entry, child.name, ".git", REHEARSAL_MARKER_FILE));
33679
- return inside.find((path) => existsSync82(path)) ?? ownMarker;
33717
+ const ownMarker = join88(entry, ".git", REHEARSAL_MARKER_FILE);
33718
+ if (existsSync83(ownMarker) || !isDirectory(entry)) return ownMarker;
33719
+ const inside = readdirSync20(entry, { withFileTypes: true }).filter((child) => child.isDirectory()).map((child) => join88(entry, child.name, ".git", REHEARSAL_MARKER_FILE));
33720
+ return inside.find((path) => existsSync83(path)) ?? ownMarker;
33680
33721
  }
33681
33722
  function isDirectory(path) {
33682
33723
  try {
@@ -33686,7 +33727,7 @@ function isDirectory(path) {
33686
33727
  }
33687
33728
  }
33688
33729
  function readRehearsalMarker(path) {
33689
- if (!existsSync82(path)) return void 0;
33730
+ if (!existsSync83(path)) return void 0;
33690
33731
  try {
33691
33732
  const marker = JSON.parse(readFileSync61(path, "utf8"));
33692
33733
  return typeof marker.pid === "number" ? { pid: marker.pid } : void 0;
@@ -33707,7 +33748,7 @@ function whyKeepWorktree(params) {
33707
33748
  baseBranch: params.baseBranch
33708
33749
  });
33709
33750
  if (unmerged > 0) return `${unmerged} commit(s) not in ${params.baseBranch}`;
33710
- if (params.pending || existsSync82(handoverLockPath(params.worktree)))
33751
+ if (params.pending || existsSync83(handoverLockPath(params.worktree)))
33711
33752
  return "a hand-over is pending in it";
33712
33753
  if (readGit({
33713
33754
  root: params.worktree,
@@ -33780,10 +33821,10 @@ function listWorktrees(repository) {
33780
33821
  }
33781
33822
  function spellUnder(params) {
33782
33823
  const realFolder = realpathSync11(params.folder);
33783
- return params.path.startsWith(`${realFolder}/`) ? join87(params.folder, params.path.slice(realFolder.length + 1)) : params.path;
33824
+ return params.path.startsWith(`${realFolder}/`) ? join88(params.folder, params.path.slice(realFolder.length + 1)) : params.path;
33784
33825
  }
33785
33826
  function isSameRepository(params) {
33786
- if (!existsSync82(params.worktree)) return false;
33827
+ if (!existsSync83(params.worktree)) return false;
33787
33828
  const common = spawnSync21("git", ["rev-parse", "--path-format=absolute", "--git-common-dir"], {
33788
33829
  cwd: params.worktree,
33789
33830
  encoding: "utf8"
@@ -33796,7 +33837,7 @@ function isSameRepository(params) {
33796
33837
  return common.stdout.trim() === mainCommon;
33797
33838
  }
33798
33839
  function handoverStateOf(handover) {
33799
- return existsSync82(handover.lotsFile.repository) ? handoverState(handover) : "repository missing";
33840
+ return existsSync83(handover.lotsFile.repository) ? handoverState(handover) : "repository missing";
33800
33841
  }
33801
33842
  function refExists(params) {
33802
33843
  return spawnSync21("git", ["rev-parse", "--verify", "--quiet", params.ref], { cwd: params.root }).status === 0;
@@ -33851,7 +33892,7 @@ async function runWorktreePrune(params) {
33851
33892
  const plan = planPrune({
33852
33893
  workspace,
33853
33894
  handoverFolders: findHandoverFolders({
33854
- folder: join88(workspace, COMMIT_PLAN_FOLDER),
33895
+ folder: join89(workspace, COMMIT_PLAN_FOLDER),
33855
33896
  depth: LIST_DEPTH
33856
33897
  }),
33857
33898
  scratchRoot: params.scratchRoot,
@@ -33922,7 +33963,7 @@ function worktreeCard(added) {
33922
33963
  { label: "hooks", lines: [added.hooks ? `${added.hooks} copied` : "none to copy"] },
33923
33964
  ...linksRows({
33924
33965
  links: added.siblingLinks,
33925
- workspace: dirname38(added.repository),
33966
+ workspace: dirname39(added.repository),
33926
33967
  worktree: added.worktree
33927
33968
  }),
33928
33969
  {