@hublo/sentinel 1.7.0-alpha.1 → 1.7.0-alpha.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 (35) hide show
  1. package/dist/bin/sentinel.js +74 -13
  2. package/dist/{chunk-XGMMTX2N.js → chunk-DLGBRLUU.js} +2 -2
  3. package/dist/{chunk-7CRRGBHI.js → chunk-F6ART7RH.js} +93 -36
  4. package/dist/{chunk-ZVHUG6CA.js → chunk-H4HAFJFZ.js} +4 -13
  5. package/dist/chunk-H4HAFJFZ.js.map +1 -0
  6. package/dist/{chunk-POZDYETY.js → chunk-LNFGVGLE.js} +5 -3
  7. package/dist/{chunk-POZDYETY.js.map → chunk-LNFGVGLE.js.map} +1 -1
  8. package/dist/{chunk-4HYOGCOX.js → chunk-P6KTBQ2Q.js} +161 -460
  9. package/dist/chunk-QXFCZON7.js +16 -0
  10. package/dist/chunk-QXFCZON7.js.map +1 -0
  11. package/dist/{chunk-7E6YTTAK.js → chunk-THTXP2QU.js} +1 -1
  12. package/dist/chunk-THTXP2QU.js.map +1 -0
  13. package/dist/chunk-ZFG6P27V.js +313 -0
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.js +6 -4
  16. package/dist/migrate-NWQ3LYER.js +544 -0
  17. package/dist/roles/build/nest/toolchain.js +3 -2
  18. package/dist/roles/build/nest/toolchain.js.map +1 -1
  19. package/dist/roles/static-analysis/config.js +1 -1
  20. package/dist/roles/test/nest/toolchain.js +4 -3
  21. package/dist/roles/test/nest/toolchain.js.map +1 -1
  22. package/dist/roles/test/react/toolchain.js +4 -3
  23. package/dist/roles/test/react/toolchain.js.map +1 -1
  24. package/dist/roles/test/shared-test-config.js +4 -3
  25. package/dist/tsconfig/legacy.json +21 -0
  26. package/dist/tsconfig/nest.json +10 -1
  27. package/dist/tsconfig/node.json +11 -1
  28. package/dist/tsconfig/react.json +3 -0
  29. package/dist/{validate-LMGBKN6L.js → validate-4V3EGTXN.js} +4 -2
  30. package/docs/typescript-adoption.md +55 -13
  31. package/docs/typescript-traces.md +1 -1
  32. package/package.json +4 -1
  33. package/dist/chunk-7E6YTTAK.js.map +0 -1
  34. package/dist/chunk-ZVHUG6CA.js.map +0 -1
  35. /package/dist/{chunk-XGMMTX2N.js.map → chunk-DLGBRLUU.js.map} +0 -0
@@ -1,3 +1,9 @@
1
+ import {
2
+ binFromOwnInstall,
3
+ binSearchPath,
4
+ resolveBin,
5
+ writtenFileFormatter
6
+ } from "./chunk-ZFG6P27V.js";
1
7
  import {
2
8
  DEFAULT_MAX_DIAGNOSTICS,
3
9
  WORKSPACE_ROOT_MARKER,
@@ -13,9 +19,11 @@ import {
13
19
  import {
14
20
  WORKSPACE_TSCONFIG,
15
21
  chainPaths,
16
- effectivePaths,
22
+ effectivePaths
23
+ } from "./chunk-H4HAFJFZ.js";
24
+ import {
17
25
  parseJsonc
18
- } from "./chunk-ZVHUG6CA.js";
26
+ } from "./chunk-QXFCZON7.js";
19
27
 
20
28
  // src/core/base-adapter.ts
21
29
  var BaseAdapter = class {
@@ -401,53 +409,9 @@ function moduleEnvironment(cwd) {
401
409
  // src/roles/test/reference.ts
402
410
  import { execFileSync } from "node:child_process";
403
411
  import { createHash } from "node:crypto";
404
- import { existsSync as existsSync6, mkdirSync, mkdtempSync, readFileSync as readFileSync5, rmSync, writeFileSync } from "node:fs";
412
+ import { existsSync as existsSync5, mkdirSync, mkdtempSync, readFileSync as readFileSync5, rmSync, writeFileSync } from "node:fs";
405
413
  import { tmpdir } from "node:os";
406
- import { join as join6, resolve as resolve2 } from "node:path";
407
-
408
- // src/shared/resolve-bin.ts
409
- import { existsSync as existsSync5 } from "node:fs";
410
- import { createRequire } from "node:module";
411
- import { delimiter, dirname, join as join5 } from "node:path";
412
- var require2 = createRequire(import.meta.url);
413
- function resolveBin(fromDir, name) {
414
- let dir = fromDir;
415
- for (; ; ) {
416
- const candidate = join5(dir, "node_modules", ".bin", name);
417
- if (existsSync5(candidate)) return candidate;
418
- const parent = dirname(dir);
419
- if (parent === dir) return void 0;
420
- dir = parent;
421
- }
422
- }
423
- function binFromOwnInstall(packageName, binName) {
424
- try {
425
- const manifest = require2.resolve(`${packageName}/package.json`);
426
- const bin = require2(manifest).bin;
427
- const relative8 = typeof bin === "string" ? bin : bin?.[binName];
428
- if (!relative8) return void 0;
429
- const executable = join5(dirname(manifest), relative8);
430
- return existsSync5(executable) ? executable : void 0;
431
- } catch {
432
- return void 0;
433
- }
434
- }
435
- function binSearchPath(cwd) {
436
- return [`${cwd}${delimiter}node_modules/.bin (and parents)`, "sentinel's own install"].join(
437
- " then "
438
- );
439
- }
440
- function scriptPath(cwd, path) {
441
- const bins = [];
442
- let dir = cwd;
443
- for (; ; ) {
444
- bins.push(join5(dir, "node_modules", ".bin"));
445
- const parent = dirname(dir);
446
- if (parent === dir) break;
447
- dir = parent;
448
- }
449
- return [...bins, path].filter(Boolean).join(delimiter);
450
- }
414
+ import { join as join5, resolve as resolve2 } from "node:path";
451
415
 
452
416
  // src/roles/test/baseline.ts
453
417
  function readSnapshot(report) {
@@ -715,7 +679,7 @@ function describeComparison(comparison) {
715
679
  // src/roles/test/reference.ts
716
680
  function referencePath(cwd, suite) {
717
681
  const key = createHash("sha256").update(`${resolve2(cwd)}\0${suite}`).digest("hex").slice(0, 16);
718
- return join6(tmpdir(), "sentinel-test-reference", `${key}.json`);
682
+ return join5(tmpdir(), "sentinel-test-reference", `${key}.json`);
719
683
  }
720
684
  function suiteOf(config) {
721
685
  const base = config.replace(/^(jest|vitest)\./, "").replace(/\.[cm]?[jt]s$/, "");
@@ -726,9 +690,9 @@ function runJest(cwd, config) {
726
690
  const bin = resolveBin(cwd, "jest");
727
691
  if (bin === void 0) return void 0;
728
692
  const root = findWorkspaceRoot(cwd) ?? cwd;
729
- const out = join6(mkdtempSync(join6(tmpdir(), "sentinel-reference-")), "jest.json");
693
+ const out = join5(mkdtempSync(join5(tmpdir(), "sentinel-reference-")), "jest.json");
730
694
  try {
731
- execFileSync(bin, ["-c", join6(cwd, config), "--json", `--outputFile=${out}`, "--silent"], {
695
+ execFileSync(bin, ["-c", join5(cwd, config), "--json", `--outputFile=${out}`, "--silent"], {
732
696
  cwd: root,
733
697
  /*
734
698
  * ⚠️ The module's environment, not the shell's, and this is what made the reference lie.
@@ -743,7 +707,7 @@ function runJest(cwd, config) {
743
707
  });
744
708
  } catch {
745
709
  }
746
- if (!existsSync6(out)) return void 0;
710
+ if (!existsSync5(out)) return void 0;
747
711
  try {
748
712
  return JSON.parse(readFileSync5(out, "utf8"));
749
713
  } catch {
@@ -776,7 +740,7 @@ function captureReference(cwd, config) {
776
740
  snapshot
777
741
  };
778
742
  const path = referencePath(cwd, suiteOf(config));
779
- mkdirSync(join6(path, ".."), { recursive: true });
743
+ mkdirSync(join5(path, ".."), { recursive: true });
780
744
  writeFileSync(path, `${JSON.stringify(stored, void 0, 2)}
781
745
  `);
782
746
  return {
@@ -785,7 +749,7 @@ function captureReference(cwd, config) {
785
749
  };
786
750
  }
787
751
  function hasReference(cwd, suite) {
788
- return existsSync6(referencePath(cwd, suite));
752
+ return existsSync5(referencePath(cwd, suite));
789
753
  }
790
754
  function compareAgainstReference(cwd, suite, report) {
791
755
  const path = referencePath(cwd, suite);
@@ -815,9 +779,9 @@ function resolveVitest(cwd) {
815
779
 
816
780
  // src/roles/test/adapters/vitest/vitest.adapter.ts
817
781
  import { spawnSync } from "node:child_process";
818
- import { existsSync as existsSync25, mkdtempSync as mkdtempSync3, readFileSync as readFileSync25, writeFileSync as writeFileSync2 } from "node:fs";
782
+ import { existsSync as existsSync22, mkdtempSync as mkdtempSync3, readFileSync as readFileSync23, writeFileSync as writeFileSync2 } from "node:fs";
819
783
  import { tmpdir as tmpdir3 } from "node:os";
820
- import { isAbsolute as isAbsolute2, join as join32, relative as relative7, resolve as resolve10 } from "node:path";
784
+ import { isAbsolute as isAbsolute2, join as join28, relative as relative7, resolve as resolve10 } from "node:path";
821
785
 
822
786
  // src/roles/test/ordering-is-a-permutation.ts
823
787
  function isAnImport(line) {
@@ -842,15 +806,15 @@ function lineLostByTheFixer(before, after) {
842
806
  }
843
807
 
844
808
  // src/core/config/nx-target.ts
845
- import { existsSync as existsSync8 } from "node:fs";
846
- import { join as join8 } from "node:path";
809
+ import { existsSync as existsSync7 } from "node:fs";
810
+ import { join as join7 } from "node:path";
847
811
 
848
812
  // src/core/config/project-json.ts
849
- import { existsSync as existsSync7, readFileSync as readFileSync6 } from "node:fs";
850
- import { join as join7 } from "node:path";
813
+ import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
814
+ import { join as join6 } from "node:path";
851
815
  function projectTargets(cwd) {
852
- const path = join7(cwd, "project.json");
853
- if (!existsSync7(path)) return void 0;
816
+ const path = join6(cwd, "project.json");
817
+ if (!existsSync6(path)) return void 0;
854
818
  try {
855
819
  return JSON.parse(readFileSync6(path, "utf8")).targets;
856
820
  } catch {
@@ -903,7 +867,7 @@ function nxTargetOperations(options) {
903
867
  if (names.length === 0) return [];
904
868
  const targets = withTeamInputs(cwd, options.targets);
905
869
  const operations = [];
906
- if (existsSync8(join8(cwd, "project.json"))) {
870
+ if (existsSync7(join7(cwd, "project.json"))) {
907
871
  operations.push({
908
872
  kind: "remove-json-keys",
909
873
  path: "project.json",
@@ -1007,24 +971,24 @@ function rewriteToolchainImports(toolchain, source, fileName) {
1007
971
  }
1008
972
 
1009
973
  // src/roles/test/jest-migration.ts
1010
- import { existsSync as existsSync19, readFileSync as readFileSync20, readdirSync as readdirSync6 } from "node:fs";
1011
- import { createRequire as createRequire5 } from "node:module";
1012
- import { dirname as dirname12, join as join25, relative as relative6 } from "node:path";
974
+ import { existsSync as existsSync16, readFileSync as readFileSync18, readdirSync as readdirSync6 } from "node:fs";
975
+ import { createRequire as createRequire3 } from "node:module";
976
+ import { dirname as dirname9, join as join21, relative as relative6 } from "node:path";
1013
977
 
1014
978
  // src/roles/test/codemod/migrate-module.ts
1015
979
  import { readdirSync as readdirSync4, readFileSync as readFileSync15, statSync as statSync5 } from "node:fs";
1016
- import { join as join18 } from "node:path";
980
+ import { join as join17 } from "node:path";
1017
981
  import { parseSync as parseSync9 } from "oxc-parser";
1018
982
 
1019
983
  // src/roles/test/msw-lifecycle.ts
1020
- import { existsSync as existsSync9, readFileSync as readFileSync7 } from "node:fs";
1021
- import { join as join9 } from "node:path";
984
+ import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
985
+ import { join as join8 } from "node:path";
1022
986
  var ROOT_SETUP = "jest.setup.after.env.js";
1023
987
  function ownsMswLifecycle(cwd, setupFiles) {
1024
988
  for (const raw of setupFiles) {
1025
989
  if (raw.endsWith(ROOT_SETUP)) continue;
1026
- const file = join9(cwd, raw.replaceAll("<rootDir>/", "").replaceAll("<rootDir>", "."));
1027
- if (!existsSync9(file)) continue;
990
+ const file = join8(cwd, raw.replaceAll("<rootDir>/", "").replaceAll("<rootDir>", "."));
991
+ if (!existsSync8(file)) continue;
1028
992
  try {
1029
993
  if (/\.listen\s*\(/.test(readFileSync7(file, "utf8"))) return true;
1030
994
  } catch {
@@ -1046,7 +1010,7 @@ function vitestSupportName(relative8) {
1046
1010
  }
1047
1011
 
1048
1012
  // src/roles/test/codemod/inherited-automocks.ts
1049
- import { existsSync as existsSync10, readFileSync as readFileSync8 } from "node:fs";
1013
+ import { existsSync as existsSync9, readFileSync as readFileSync8 } from "node:fs";
1050
1014
  import { resolve as resolve3 } from "node:path";
1051
1015
 
1052
1016
  // src/shared/ast.ts
@@ -1090,7 +1054,7 @@ function inheritedAutomocks(cwd, setupFiles, parse6) {
1090
1054
  for (const named of setupFiles) {
1091
1055
  const path = resolve3(cwd, named.replace("<rootDir>/", "./"));
1092
1056
  if (path.startsWith(`${cwd}/`)) continue;
1093
- if (!existsSync10(path)) continue;
1057
+ if (!existsSync9(path)) continue;
1094
1058
  let source;
1095
1059
  try {
1096
1060
  source = readFileSync8(path, "utf8");
@@ -1359,7 +1323,7 @@ ${source}`;
1359
1323
  }
1360
1324
 
1361
1325
  // src/roles/test/codemod/migrate-file.ts
1362
- import { dirname as dirname8 } from "node:path";
1326
+ import { dirname as dirname7 } from "node:path";
1363
1327
  import { parseSync as parseSync8 } from "oxc-parser";
1364
1328
 
1365
1329
  // src/roles/test/codemod/edits.ts
@@ -2145,9 +2109,9 @@ function asyncifyEdits(source, fn) {
2145
2109
  }
2146
2110
 
2147
2111
  // src/roles/test/codemod/named-rules.ts
2148
- import { existsSync as existsSync11, readFileSync as readFileSync10 } from "node:fs";
2149
- import { createRequire as createRequire2 } from "node:module";
2150
- import { dirname as dirname3, join as join11 } from "node:path";
2112
+ import { existsSync as existsSync10, readFileSync as readFileSync10 } from "node:fs";
2113
+ import { createRequire } from "node:module";
2114
+ import { dirname as dirname2, join as join10 } from "node:path";
2151
2115
 
2152
2116
  // src/roles/test/codemod/namespace-import.ts
2153
2117
  function sameModule(specifier) {
@@ -2217,7 +2181,7 @@ function namespaceBindings(program) {
2217
2181
 
2218
2182
  // src/roles/test/codemod/static-import-for-require.ts
2219
2183
  import { readFileSync as readFileSync9, statSync } from "node:fs";
2220
- import { dirname as dirname2, join as join10, resolve as resolve4 } from "node:path";
2184
+ import { dirname, join as join9, resolve as resolve4 } from "node:path";
2221
2185
  import { parseSync as parseSync4 } from "oxc-parser";
2222
2186
 
2223
2187
  // src/shared/module-resolution.ts
@@ -2234,11 +2198,11 @@ var RESOLVABLE_EXTENSIONS = [
2234
2198
 
2235
2199
  // src/roles/test/codemod/static-import-for-require.ts
2236
2200
  function resolveRelative(fromFile, specifier) {
2237
- const base = resolve4(dirname2(fromFile), specifier);
2201
+ const base = resolve4(dirname(fromFile), specifier);
2238
2202
  const candidates = [
2239
2203
  base,
2240
2204
  ...RESOLVABLE_EXTENSIONS.map((extension) => `${base}${extension}`),
2241
- ...RESOLVABLE_EXTENSIONS.map((extension) => join10(base, `index${extension}`))
2205
+ ...RESOLVABLE_EXTENSIONS.map((extension) => join9(base, `index${extension}`))
2242
2206
  ];
2243
2207
  for (const candidate of candidates) {
2244
2208
  try {
@@ -2440,24 +2404,24 @@ function isCommonJsPackage(fromFile, specifier) {
2440
2404
  if (specifier.startsWith(".") || specifier.startsWith("/")) return false;
2441
2405
  let resolved;
2442
2406
  try {
2443
- resolved = createRequire2(fromFile).resolve(specifier);
2407
+ resolved = createRequire(fromFile).resolve(specifier);
2444
2408
  } catch {
2445
2409
  return false;
2446
2410
  }
2447
2411
  if (!resolved.includes(`${"/"}node_modules${"/"}`)) return false;
2448
2412
  if (resolved.endsWith(".mjs")) return false;
2449
2413
  if (resolved.endsWith(".cjs")) return true;
2450
- let dir = dirname3(resolved);
2414
+ let dir = dirname2(resolved);
2451
2415
  for (let depth = 0; depth < 12; depth += 1) {
2452
- const manifest = join11(dir, "package.json");
2453
- if (existsSync11(manifest)) {
2416
+ const manifest = join10(dir, "package.json");
2417
+ if (existsSync10(manifest)) {
2454
2418
  try {
2455
2419
  return JSON.parse(readFileSync10(manifest, "utf8")).type !== "module";
2456
2420
  } catch {
2457
2421
  return false;
2458
2422
  }
2459
2423
  }
2460
- const parent = dirname3(dir);
2424
+ const parent = dirname2(dir);
2461
2425
  if (parent === dir) break;
2462
2426
  dir = parent;
2463
2427
  }
@@ -3328,8 +3292,8 @@ function propagateAwait(fileName, source, original, elsewhere = /* @__PURE__ */
3328
3292
 
3329
3293
  // src/roles/test/codemod/reexport-barrel-mock.ts
3330
3294
  import { readFileSync as readFileSync11, readdirSync as readdirSync2, statSync as statSync2 } from "node:fs";
3331
- import { createRequire as createRequire3 } from "node:module";
3332
- import { dirname as dirname4, join as join12 } from "node:path";
3295
+ import { createRequire as createRequire2 } from "node:module";
3296
+ import { dirname as dirname3, join as join11 } from "node:path";
3333
3297
  var PACKAGE_SUBPATH = /^(@[^/]+\/[^/]+|[^@.][^/]*)\/(.+)$/;
3334
3298
  var PURE_REEXPORT = /^module\.exports\s*=\s*require\(\s*(['"])([^'"]+)\1\s*\)\s*;?$/;
3335
3299
  function mockCalls(program) {
@@ -3357,14 +3321,14 @@ function mockCalls(program) {
3357
3321
  }
3358
3322
  function packageRoot(fromFile, name) {
3359
3323
  try {
3360
- return dirname4(createRequire3(fromFile).resolve(`${name}/package.json`));
3324
+ return dirname3(createRequire2(fromFile).resolve(`${name}/package.json`));
3361
3325
  } catch {
3362
3326
  return void 0;
3363
3327
  }
3364
3328
  }
3365
3329
  function resolveFrom(fromFile, specifier) {
3366
3330
  try {
3367
- return createRequire3(fromFile).resolve(specifier);
3331
+ return createRequire2(fromFile).resolve(specifier);
3368
3332
  } catch {
3369
3333
  return void 0;
3370
3334
  }
@@ -3381,7 +3345,7 @@ function barrelsFor(fromFile, name, target) {
3381
3345
  const aliases = [];
3382
3346
  for (const entry of entries) {
3383
3347
  if (!entry.endsWith(".js")) continue;
3384
- const path = join12(root, entry);
3348
+ const path = join11(root, entry);
3385
3349
  let body;
3386
3350
  try {
3387
3351
  if (!statSync2(path).isFile()) continue;
@@ -3484,17 +3448,17 @@ function rewriteRunnerArtefactNames(source, program) {
3484
3448
  }
3485
3449
 
3486
3450
  // src/roles/test/codemod/setup-static-imports.ts
3487
- import { dirname as dirname6, resolve as resolve7 } from "node:path";
3451
+ import { dirname as dirname5, resolve as resolve7 } from "node:path";
3488
3452
 
3489
3453
  // src/core/context.ts
3490
- import { existsSync as existsSync12 } from "node:fs";
3491
- import { dirname as dirname5, join as join14, resolve as resolve5 } from "node:path";
3454
+ import { existsSync as existsSync11 } from "node:fs";
3455
+ import { dirname as dirname4, join as join13, resolve as resolve5 } from "node:path";
3492
3456
 
3493
3457
  // src/core/discover-modules.ts
3494
3458
  import { execFileSync as execFileSync2 } from "node:child_process";
3495
3459
  import { mkdtempSync as mkdtempSync2, readFileSync as readFileSync12, rmSync as rmSync2 } from "node:fs";
3496
3460
  import { tmpdir as tmpdir2 } from "node:os";
3497
- import { join as join13 } from "node:path";
3461
+ import { join as join12 } from "node:path";
3498
3462
  function runNx(cwd, args) {
3499
3463
  const nx = resolveBin(cwd, "nx") ?? "nx";
3500
3464
  try {
@@ -3512,8 +3476,8 @@ function runNx(cwd, args) {
3512
3476
  }
3513
3477
  }
3514
3478
  function readGraph(cwd) {
3515
- const dir = mkdtempSync2(join13(tmpdir2(), "sentinel-nx-"));
3516
- const file = join13(dir, "graph.json");
3479
+ const dir = mkdtempSync2(join12(tmpdir2(), "sentinel-nx-"));
3480
+ const file = join12(dir, "graph.json");
3517
3481
  try {
3518
3482
  runNx(cwd, ["graph", "--file", file]);
3519
3483
  const parsed = JSON.parse(readFileSync12(file, "utf8"));
@@ -3525,7 +3489,7 @@ function readGraph(cwd) {
3525
3489
  }
3526
3490
  return Object.entries(nodes).map(([name, node]) => ({
3527
3491
  name,
3528
- root: join13(cwd, node.data.root)
3492
+ root: join12(cwd, node.data.root)
3529
3493
  }));
3530
3494
  } finally {
3531
3495
  rmSync2(dir, { recursive: true, force: true });
@@ -3566,20 +3530,20 @@ ${raw.slice(0, 300)}`
3566
3530
  // src/core/context.ts
3567
3531
  var MODULE_MARKERS = ["package.json", "project.json"];
3568
3532
  function isModuleDir(cwd) {
3569
- return MODULE_MARKERS.some((marker) => existsSync12(join14(cwd, marker)));
3533
+ return MODULE_MARKERS.some((marker) => existsSync11(join13(cwd, marker)));
3570
3534
  }
3571
3535
  function findModuleRoot(startDir, workspaceRoot) {
3572
3536
  let dir = resolve5(startDir);
3573
3537
  for (; ; ) {
3574
3538
  if (workspaceRoot !== void 0 && dir === resolve5(workspaceRoot)) return void 0;
3575
3539
  if (isModuleDir(dir)) return dir;
3576
- const parent = dirname5(dir);
3540
+ const parent = dirname4(dir);
3577
3541
  if (parent === dir) return void 0;
3578
3542
  dir = parent;
3579
3543
  }
3580
3544
  }
3581
3545
  function resolveContext(cwd, opts) {
3582
- const atRoot = existsSync12(join14(cwd, WORKSPACE_ROOT_MARKER));
3546
+ const atRoot = existsSync11(join13(cwd, WORKSPACE_ROOT_MARKER));
3583
3547
  if (!atRoot && isModuleDir(cwd)) {
3584
3548
  if (opts.module) {
3585
3549
  throw new Error(
@@ -3607,15 +3571,15 @@ function resolveContext(cwd, opts) {
3607
3571
  }
3608
3572
 
3609
3573
  // src/roles/test/codemod/workspace-specifier.ts
3610
- import { existsSync as existsSync13 } from "node:fs";
3611
- import { join as join15, relative as relative2, resolve as resolve6 } from "node:path";
3574
+ import { existsSync as existsSync12 } from "node:fs";
3575
+ import { join as join14, relative as relative2, resolve as resolve6 } from "node:path";
3612
3576
  var EXTENSIONS = ["", ".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", "/index.ts", "/index.js"];
3613
3577
  var SPEC_TSCONFIGS = ["tsconfig.spec.json", "tsconfig.app.json", "tsconfig.json"];
3614
3578
  function pathsFor(workspaceRoot, moduleRoot) {
3615
3579
  try {
3616
3580
  if (moduleRoot !== void 0) return effectivePaths(moduleRoot, workspaceRoot, SPEC_TSCONFIGS);
3617
- const file = join15(workspaceRoot, WORKSPACE_TSCONFIG);
3618
- if (!existsSync13(file)) return void 0;
3581
+ const file = join14(workspaceRoot, WORKSPACE_TSCONFIG);
3582
+ if (!existsSync12(file)) return void 0;
3619
3583
  const found = chainPaths(file);
3620
3584
  return found && { ...found, fromWorkspaceFallback: false };
3621
3585
  } catch {
@@ -3668,7 +3632,7 @@ function requireCall(source, node) {
3668
3632
  }
3669
3633
  function importable(written, fileName, workspaceRoot) {
3670
3634
  if (!written.startsWith(".")) return written;
3671
- const fileDir = dirname6(fileName);
3635
+ const fileDir = dirname5(fileName);
3672
3636
  const moduleRoot = findModuleRoot(fileDir, workspaceRoot) ?? fileDir;
3673
3637
  const target = resolve7(fileDir, written);
3674
3638
  if (target.startsWith(`${moduleRoot}/`)) return written;
@@ -3785,15 +3749,15 @@ function rewriteMockFactoryGenerics(source, program) {
3785
3749
 
3786
3750
  // src/roles/test/codemod/spy-on-internal-call.ts
3787
3751
  import { readFileSync as readFileSync13, statSync as statSync3 } from "node:fs";
3788
- import { dirname as dirname7, join as join16, relative as relative3, resolve as resolve8 } from "node:path";
3752
+ import { dirname as dirname6, join as join15, relative as relative3, resolve as resolve8 } from "node:path";
3789
3753
  import { parseSync as parseSync7 } from "oxc-parser";
3790
3754
  function resolveRelative2(fromFile, specifier) {
3791
3755
  if (!specifier.startsWith(".")) return void 0;
3792
- const base = resolve8(dirname7(fromFile), specifier);
3756
+ const base = resolve8(dirname6(fromFile), specifier);
3793
3757
  const candidates = [
3794
3758
  base,
3795
3759
  ...RESOLVABLE_EXTENSIONS.map((extension) => `${base}${extension}`),
3796
- ...RESOLVABLE_EXTENSIONS.map((extension) => join16(base, `index${extension}`))
3760
+ ...RESOLVABLE_EXTENSIONS.map((extension) => join15(base, `index${extension}`))
3797
3761
  ];
3798
3762
  for (const candidate of candidates) {
3799
3763
  try {
@@ -3926,7 +3890,7 @@ function importOf(program, local) {
3926
3890
  return void 0;
3927
3891
  }
3928
3892
  function respell(fromFile, target) {
3929
- const path = relative3(dirname7(fromFile), target).replaceAll("\\", "/").replace(/\.(?:m|c)?[jt]sx?$/, "").replace(/\/index$/, "");
3893
+ const path = relative3(dirname6(fromFile), target).replaceAll("\\", "/").replace(/\.(?:m|c)?[jt]sx?$/, "").replace(/\/index$/, "");
3930
3894
  return path.startsWith(".") ? path : `./${path}`;
3931
3895
  }
3932
3896
  function namesInUse2(program) {
@@ -4239,7 +4203,7 @@ function migrateTestFile(fileName, source, defaultImported = /* @__PURE__ */ new
4239
4203
  fileName,
4240
4204
  source,
4241
4205
  beforeStatic,
4242
- findWorkspaceRoot(dirname8(fileName))
4206
+ findWorkspaceRoot(dirname7(fileName))
4243
4207
  );
4244
4208
  source = statics.source;
4245
4209
  const original = statics.rewritten === 0 ? beforeStatic : parse3(fileName, source);
@@ -4377,8 +4341,8 @@ function migrateTestFile(fileName, source, defaultImported = /* @__PURE__ */ new
4377
4341
  }
4378
4342
 
4379
4343
  // src/roles/test/codemod/test-support-files.ts
4380
- import { existsSync as existsSync14, readFileSync as readFileSync14, readdirSync as readdirSync3, statSync as statSync4 } from "node:fs";
4381
- import { dirname as dirname9, join as join17, relative as relative4, resolve as resolve9 } from "node:path";
4344
+ import { existsSync as existsSync13, readFileSync as readFileSync14, readdirSync as readdirSync3, statSync as statSync4 } from "node:fs";
4345
+ import { dirname as dirname8, join as join16, relative as relative4, resolve as resolve9 } from "node:path";
4382
4346
  var THE_SHIM_CANNOT_ANSWER = [/\brequire\s*\(/, /\bjest\.(?:fn|Mock|SpyInstance)\s*</];
4383
4347
  var SKIPPED = /* @__PURE__ */ new Set(["node_modules", "dist", "coverage", ".git", ".vite"]);
4384
4348
  var TEST_FILE2 = /[.-](spec|test)\.[cm]?[jt]sx?$/;
@@ -4398,14 +4362,14 @@ function relativeSpecifiers2(source) {
4398
4362
  return found;
4399
4363
  }
4400
4364
  function resolveSpecifier(fromFile, specifier) {
4401
- const base = resolve9(dirname9(fromFile), specifier);
4402
- if (existsSync14(base) && statSync4(base).isFile()) return base;
4365
+ const base = resolve9(dirname8(fromFile), specifier);
4366
+ if (existsSync13(base) && statSync4(base).isFile()) return base;
4403
4367
  for (const extension of EXTENSIONS2) {
4404
- if (existsSync14(`${base}${extension}`)) return `${base}${extension}`;
4368
+ if (existsSync13(`${base}${extension}`)) return `${base}${extension}`;
4405
4369
  }
4406
4370
  for (const extension of EXTENSIONS2) {
4407
- const index = join17(base, `index${extension}`);
4408
- if (existsSync14(index)) return index;
4371
+ const index = join16(base, `index${extension}`);
4372
+ if (existsSync13(index)) return index;
4409
4373
  }
4410
4374
  return void 0;
4411
4375
  }
@@ -4422,9 +4386,9 @@ function moduleSources(cwd) {
4422
4386
  }
4423
4387
  for (const entry of entries) {
4424
4388
  if (entry.isDirectory()) {
4425
- if (!SKIPPED.has(entry.name)) stack.push(join17(dir, entry.name));
4389
+ if (!SKIPPED.has(entry.name)) stack.push(join16(dir, entry.name));
4426
4390
  } else if (SOURCE_FILE.test(entry.name)) {
4427
- found.push(join17(dir, entry.name));
4391
+ found.push(join16(dir, entry.name));
4428
4392
  }
4429
4393
  }
4430
4394
  }
@@ -4444,7 +4408,7 @@ function setupFilesInside(cwd, named) {
4444
4408
  const full = resolve9(cwd, withoutToken);
4445
4409
  const inside = relative4(cwd, full);
4446
4410
  if (inside.startsWith("..") || inside === "") continue;
4447
- if (!existsSync14(full)) continue;
4411
+ if (!existsSync13(full)) continue;
4448
4412
  kept.push(inside.replaceAll("\\", "/"));
4449
4413
  }
4450
4414
  return kept;
@@ -4508,7 +4472,7 @@ function defaultImportedSpecifiers(cwd) {
4508
4472
  }
4509
4473
  for (const entry of entries) {
4510
4474
  if (SKIPPED2.has(entry)) continue;
4511
- const path = join18(dir, entry);
4475
+ const path = join17(dir, entry);
4512
4476
  let directory;
4513
4477
  try {
4514
4478
  directory = statSync5(path).isDirectory();
@@ -4540,13 +4504,13 @@ function migrateModuleTests(cwd, setupFiles = []) {
4540
4504
  const defaultImported = defaultImportedSpecifiers(cwd);
4541
4505
  const asyncHelpers = /* @__PURE__ */ new Set();
4542
4506
  for (const relative8 of listTestSupportFiles(cwd, setupFiles)) {
4543
- const source = read3(join18(cwd, relative8));
4507
+ const source = read3(join17(cwd, relative8));
4544
4508
  if (source === void 0) {
4545
4509
  blockers.push({ file: relative8, reason: "this file could not be read" });
4546
4510
  continue;
4547
4511
  }
4548
4512
  const migrated = migrateTestFile(
4549
- join18(cwd, relative8),
4513
+ join17(cwd, relative8),
4550
4514
  source,
4551
4515
  defaultImported,
4552
4516
  /* @__PURE__ */ new Set(),
@@ -4565,8 +4529,8 @@ function migrateModuleTests(cwd, setupFiles = []) {
4565
4529
  const renamedTo = vitestSupportName(relative8);
4566
4530
  if (!migrated.changed && renamedTo === relative8) continue;
4567
4531
  if (renamedTo !== relative8) operations.push({ kind: "delete", path: relative8 });
4568
- const before = parse4(join18(cwd, relative8), source);
4569
- const after = parse4(join18(cwd, relative8), migrated.source);
4532
+ const before = parse4(join17(cwd, relative8), source);
4533
+ const after = parse4(join17(cwd, relative8), migrated.source);
4570
4534
  if (before !== void 0 && after !== void 0) {
4571
4535
  const wasAsync = asyncFunctionNames(before);
4572
4536
  for (const name of asyncFunctionNames(after)) {
@@ -4575,17 +4539,17 @@ function migrateModuleTests(cwd, setupFiles = []) {
4575
4539
  }
4576
4540
  files++;
4577
4541
  renamed += migrated.renamed;
4578
- const contents = /\bvi\./.test(migrated.source) ? injectViImport(join18(cwd, renamedTo), migrated.source) : migrated.source;
4542
+ const contents = /\bvi\./.test(migrated.source) ? injectViImport(join17(cwd, renamedTo), migrated.source) : migrated.source;
4579
4543
  operations.push({ kind: "write", path: renamedTo, contents });
4580
4544
  }
4581
4545
  for (const relative8 of listTestFiles(cwd)) {
4582
- const source = read3(join18(cwd, relative8));
4546
+ const source = read3(join17(cwd, relative8));
4583
4547
  if (source === void 0) {
4584
4548
  blockers.push({ file: relative8, reason: "this file could not be read" });
4585
4549
  continue;
4586
4550
  }
4587
4551
  const migrated = migrateTestFile(
4588
- join18(cwd, relative8),
4552
+ join17(cwd, relative8),
4589
4553
  source,
4590
4554
  defaultImported,
4591
4555
  asyncHelpers,
@@ -4620,7 +4584,7 @@ function migrateModuleTests(cwd, setupFiles = []) {
4620
4584
 
4621
4585
  // src/roles/test/nest/generate-config.ts
4622
4586
  import { readdirSync as readdirSync5, readFileSync as readFileSync16, statSync as statSync6 } from "node:fs";
4623
- import { join as join19, relative as relative5 } from "node:path";
4587
+ import { join as join18, relative as relative5 } from "node:path";
4624
4588
  import { parseSync as parseSync10 } from "oxc-parser";
4625
4589
  var NEST_TEST_PRESET_SPECIFIER = "@hublo/sentinel/test/nest";
4626
4590
  var REACT_TEST_PRESET_SPECIFIER = "@hublo/sentinel/test/react";
@@ -4667,7 +4631,7 @@ function readModuleTraits(cwd) {
4667
4631
  }
4668
4632
  for (const entry of entries) {
4669
4633
  if (SKIPPED3.has(entry)) continue;
4670
- const path = join19(dir, entry);
4634
+ const path = join18(dir, entry);
4671
4635
  let directory;
4672
4636
  try {
4673
4637
  directory = statSync6(path).isDirectory();
@@ -4822,8 +4786,8 @@ ${overrides.join("\n")}
4822
4786
  }
4823
4787
 
4824
4788
  // src/roles/test/nest/read-jest-config.ts
4825
- import { existsSync as existsSync15, readFileSync as readFileSync17 } from "node:fs";
4826
- import { join as join20 } from "node:path";
4789
+ import { existsSync as existsSync14, readFileSync as readFileSync17 } from "node:fs";
4790
+ import { join as join19 } from "node:path";
4827
4791
  var CARRIED = [
4828
4792
  "testEnvironment",
4829
4793
  "coverageDirectory",
@@ -5013,7 +4977,7 @@ function extendedConfig(source, cwd) {
5013
4977
  (name) => name.replace(/^\.\//, "")
5014
4978
  );
5015
4979
  const file = candidates.find(
5016
- (name) => /^jest[\w.-]*\.(ts|js)$/.test(name) && existsSync15(join20(cwd, name))
4980
+ (name) => /^jest[\w.-]*\.(ts|js)$/.test(name) && existsSync14(join19(cwd, name))
5017
4981
  );
5018
4982
  if (file === void 0) continue;
5019
4983
  if (!new RegExp(String.raw`\{\s*\.\.\.${binding}\b`).test(source)) continue;
@@ -5040,11 +5004,11 @@ function sideEffects(source, extended) {
5040
5004
  return found;
5041
5005
  }
5042
5006
  function readJestConfig(cwd, named) {
5043
- const file = named ?? JEST_CONFIG_FILES.find((name) => existsSync15(join20(cwd, name)));
5044
- if (file === void 0 || !existsSync15(join20(cwd, file))) return void 0;
5007
+ const file = named ?? JEST_CONFIG_FILES.find((name) => existsSync14(join19(cwd, name)));
5008
+ if (file === void 0 || !existsSync14(join19(cwd, file))) return void 0;
5045
5009
  let source;
5046
5010
  try {
5047
- source = readFileSync17(join20(cwd, file), "utf8");
5011
+ source = readFileSync17(join19(cwd, file), "utf8");
5048
5012
  } catch {
5049
5013
  return { file, refusals: [`${file} could not be read`], notes: [] };
5050
5014
  }
@@ -5125,8 +5089,8 @@ function readJestConfig(cwd, named) {
5125
5089
  }
5126
5090
 
5127
5091
  // src/roles/test/nest/run-modes.ts
5128
- import { existsSync as existsSync16 } from "node:fs";
5129
- import { basename as basename2, join as join21 } from "node:path";
5092
+ import { existsSync as existsSync15 } from "node:fs";
5093
+ import { basename as basename2, join as join20 } from "node:path";
5130
5094
  var JEST_EXECUTOR = "@nx/jest:jest";
5131
5095
  var PRIMARY_CONFIG_FILE = "vitest.config.mts";
5132
5096
  var PRIMARY_TARGET = "test";
@@ -5147,7 +5111,7 @@ function runModes(cwd, fallback) {
5147
5111
  const jestConfig = entry.options?.jestConfig;
5148
5112
  if (jestConfig === void 0) continue;
5149
5113
  const name = configName(jestConfig);
5150
- if (!existsSync16(join21(cwd, name))) continue;
5114
+ if (!existsSync15(join20(cwd, name))) continue;
5151
5115
  declared.push({
5152
5116
  target,
5153
5117
  jestConfig: name,
@@ -5171,260 +5135,16 @@ function runModes(cwd, fallback) {
5171
5135
  );
5172
5136
  }
5173
5137
 
5174
- // src/roles/test/written-file-formatter.ts
5175
- import { existsSync as existsSync18 } from "node:fs";
5176
- import { dirname as dirname11, join as join24 } from "node:path";
5177
-
5178
- // src/roles/format/read-adoption.ts
5179
- import { existsSync as existsSync17, readFileSync as readFileSync18 } from "node:fs";
5180
- import { join as join22 } from "node:path";
5181
-
5182
- // src/roles/format/config-policy.ts
5183
- var FORMAT_CONFIG_FILE = ".oxfmtrc.json";
5184
- var FORMAT_SCRIPT_NAME = "format";
5185
- var PROVENANCE_KEY = "$sentinel";
5186
- var PERMITTED_LOCAL_KEYS = [
5187
- "useTabs",
5188
- "tabWidth",
5189
- "printWidth",
5190
- "semi",
5191
- "singleQuote",
5192
- "jsxSingleQuote",
5193
- "trailingComma",
5194
- "quoteProps",
5195
- "bracketSpacing",
5196
- "bracketSameLine",
5197
- "arrowParens",
5198
- "endOfLine",
5199
- "objectWrap",
5200
- "proseWrap",
5201
- "experimentalOperatorPosition"
5202
- ];
5203
- var ALWAYS_LOCAL_KEYS = ["ignorePatterns", "overrides"];
5204
- var OWNED_WHEN_SET_KEYS = ["sortImports"];
5205
- var FORMAT_DEFAULT_IGNORES = ["**/*.toml"];
5206
- var PRETTIER_CONFIG_FILES = [
5207
- ".prettierrc",
5208
- ".prettierrc.json",
5209
- ".prettierrc.json5",
5210
- ".prettierrc.yml",
5211
- ".prettierrc.yaml",
5212
- ".prettierrc.js",
5213
- ".prettierrc.cjs",
5214
- ".prettierrc.mjs",
5215
- "prettier.config.js",
5216
- "prettier.config.cjs",
5217
- "prettier.config.mjs"
5218
- ];
5219
- function formatTargets() {
5220
- return {
5221
- [FORMAT_SCRIPT_NAME]: {
5222
- cache: true,
5223
- inputs: ["default", `{projectRoot}/${FORMAT_CONFIG_FILE}`]
5224
- },
5225
- [`${FORMAT_SCRIPT_NAME}:fix`]: { cache: false }
5226
- };
5227
- }
5228
-
5229
- // src/roles/format/presets/base.json
5230
- var base_default = {
5231
- printWidth: 80,
5232
- semi: false,
5233
- singleQuote: true,
5234
- trailingComma: "all",
5235
- sortPackageJson: false,
5236
- sortImports: false
5237
- };
5238
-
5239
- // src/roles/format/presets/nest-imports.json
5240
- var nest_imports_default = {
5241
- customGroups: [
5242
- {
5243
- groupName: "workspace",
5244
- elementNamePattern: ["@hublo/**", "@shared/**", "@front/**", "@network/**"]
5245
- }
5246
- ],
5247
- groups: ["builtin", "external", "workspace", ["parent", "index"], "sibling"],
5248
- newlinesBetween: true,
5249
- order: "asc",
5250
- ignoreCase: false
5251
- };
5252
-
5253
- // src/roles/format/preset-data.ts
5254
- var FORMAT_PRESETS = ["base", "svelte", "nest"];
5255
- function hasFormatPreset(name) {
5256
- return FORMAT_PRESETS.includes(name);
5257
- }
5258
- function formatPresetName(declared) {
5259
- if (declared === "svelte") return "svelte";
5260
- if (declared === "nest") return "nest";
5261
- return "base";
5262
- }
5263
- function formatPresetFor(preset) {
5264
- const base = base_default;
5265
- const name = formatPresetName(preset);
5266
- if (name === "svelte") return { ...base, svelte: true };
5267
- if (name === "nest") return { ...base, sortImports: nest_imports_default };
5268
- return base;
5269
- }
5270
-
5271
- // src/roles/format/read-adoption.ts
5272
- var NOT_ADOPTED = (configFile, unreadable = null) => ({
5273
- configFile,
5274
- preset: null,
5275
- adopted: false,
5276
- conformant: false,
5277
- drift: [],
5278
- local: {},
5279
- presetVersion: null,
5280
- effective: {},
5281
- unreadable
5282
- });
5283
- function sameValue(a, b) {
5284
- return JSON.stringify(a) === JSON.stringify(b);
5285
- }
5286
- function readFormatAdoption(cwd) {
5287
- const path = join22(cwd, FORMAT_CONFIG_FILE);
5288
- if (!existsSync17(path)) return NOT_ADOPTED(null);
5289
- let parsed;
5290
- try {
5291
- parsed = parseJsonc(readFileSync18(path, "utf8"), FORMAT_CONFIG_FILE);
5292
- } catch (error) {
5293
- const reason = error instanceof Error ? error.message : String(error);
5294
- return NOT_ADOPTED(FORMAT_CONFIG_FILE, `${FORMAT_CONFIG_FILE} could not be parsed (${reason})`);
5295
- }
5296
- const provenance = parsed[PROVENANCE_KEY];
5297
- if (!provenance || typeof provenance.preset !== "string") return NOT_ADOPTED(FORMAT_CONFIG_FILE);
5298
- if (!hasFormatPreset(provenance.preset)) {
5299
- return NOT_ADOPTED(
5300
- FORMAT_CONFIG_FILE,
5301
- `${FORMAT_CONFIG_FILE} declares the format preset "${provenance.preset}", which sentinel does not ship (shipped: ${FORMAT_PRESETS.join(", ")}). Re-run \`sentinel --init --format\`.`
5302
- );
5303
- }
5304
- const declaredLocal = Array.isArray(provenance.local) ? provenance.local : [];
5305
- const preset = formatPresetFor(provenance.preset);
5306
- const drift = [];
5307
- const local = {};
5308
- for (const [key, expected] of Object.entries(preset)) {
5309
- if (declaredLocal.includes(key)) {
5310
- local[key] = parsed[key];
5311
- continue;
5312
- }
5313
- if (!(key in parsed) || !sameValue(parsed[key], expected)) drift.push(key);
5314
- }
5315
- for (const key of declaredLocal) {
5316
- if (!(key in preset)) local[key] = parsed[key];
5317
- }
5318
- for (const key of ALWAYS_LOCAL_KEYS) {
5319
- if (key in parsed) local[key] = parsed[key];
5320
- }
5321
- return {
5322
- configFile: FORMAT_CONFIG_FILE,
5323
- preset: provenance.preset,
5324
- adopted: true,
5325
- conformant: drift.length === 0,
5326
- drift,
5327
- local,
5328
- presetVersion: typeof provenance.version === "string" ? provenance.version : null,
5329
- effective: parsed,
5330
- unreadable: null
5331
- };
5332
- }
5333
-
5334
- // src/roles/format/resolve-oxfmt.ts
5335
- import { readFileSync as readFileSync19 } from "node:fs";
5336
- import { createRequire as createRequire4 } from "node:module";
5337
- import { dirname as dirname10, join as join23 } from "node:path";
5338
- function resolveOxfmt(cwd) {
5339
- return resolveBin(cwd, "oxfmt") ?? binFromOwnInstall("oxfmt", "oxfmt");
5340
- }
5341
- function oxfmtRejects(key, value) {
5342
- const schema = configSchema();
5343
- const property = schema?.properties?.[key];
5344
- if (!property) return false;
5345
- const definition = resolveRef(schema, property);
5346
- if (Array.isArray(definition.enum)) return !definition.enum.includes(value);
5347
- if (definition.type === "boolean") return typeof value !== "boolean";
5348
- if (definition.type === "integer" || definition.type === "number")
5349
- return typeof value !== "number";
5350
- return false;
5351
- }
5352
- function resolveRef(schema, node) {
5353
- const ref = node.$ref ?? node.allOf?.[0]?.$ref;
5354
- const name = ref?.startsWith("#/definitions/") ? ref.slice("#/definitions/".length) : void 0;
5355
- return (name ? schema.definitions?.[name] : void 0) ?? node;
5356
- }
5357
- var cachedSchema;
5358
- function configSchema() {
5359
- if (cachedSchema !== void 0) return cachedSchema ?? void 0;
5360
- cachedSchema = readConfigSchema() ?? null;
5361
- return cachedSchema ?? void 0;
5362
- }
5363
- function readConfigSchema() {
5364
- try {
5365
- const manifest = createRequire4(import.meta.url).resolve("oxfmt/package.json");
5366
- const schemaPath = join23(dirname10(manifest), "configuration_schema.json");
5367
- return JSON.parse(readFileSync19(schemaPath, "utf8"));
5368
- } catch {
5369
- return void 0;
5370
- }
5371
- }
5372
-
5373
- // src/roles/test/written-file-formatter.ts
5374
- var PRETTIER_CONFIGS = [
5375
- ".prettierrc",
5376
- ".prettierrc.json",
5377
- ".prettierrc.json5",
5378
- ".prettierrc.yaml",
5379
- ".prettierrc.yml",
5380
- ".prettierrc.js",
5381
- ".prettierrc.cjs",
5382
- ".prettierrc.mjs",
5383
- ".prettierrc.toml",
5384
- "prettier.config.js",
5385
- "prettier.config.cjs",
5386
- "prettier.config.mjs"
5387
- ];
5388
- function prettierConfigFrom(cwd) {
5389
- let dir = cwd;
5390
- for (; ; ) {
5391
- for (const name of PRETTIER_CONFIGS) {
5392
- if (existsSync18(join24(dir, name))) return join24(dir, name);
5393
- }
5394
- const parent = dirname11(dir);
5395
- if (parent === dir) return void 0;
5396
- dir = parent;
5397
- }
5398
- }
5399
- function writtenFileFormatter(cwd) {
5400
- if (readFormatAdoption(cwd).configFile !== null) {
5401
- const oxfmt = resolveOxfmt(cwd);
5402
- if (oxfmt !== void 0) {
5403
- return { bin: oxfmt, args: ["--write"], origin: "this module's own oxfmt config" };
5404
- }
5405
- }
5406
- const config = prettierConfigFrom(cwd);
5407
- const prettier = resolveBin(cwd, "prettier");
5408
- if (config !== void 0 && prettier !== void 0) {
5409
- return {
5410
- bin: prettier,
5411
- args: ["--write", "--log-level", "warn"],
5412
- origin: `the workspace's Prettier`
5413
- };
5414
- }
5415
- return void 0;
5416
- }
5417
-
5418
5138
  // src/roles/test/jest-migration.ts
5419
5139
  var SPEC_TSCONFIG = "tsconfig.spec.json";
5420
5140
  var VITEST_GLOBAL_TYPES = "vitest/globals";
5421
5141
  function specTypesOperation(cwd) {
5422
- const path = join25(cwd, SPEC_TSCONFIG);
5423
- if (!existsSync19(path)) return void 0;
5142
+ const path = join21(cwd, SPEC_TSCONFIG);
5143
+ if (!existsSync16(path)) return void 0;
5424
5144
  let config;
5425
5145
  try {
5426
5146
  config = parseJsonc(
5427
- readFileSync20(path, "utf8"),
5147
+ readFileSync18(path, "utf8"),
5428
5148
  SPEC_TSCONFIG
5429
5149
  );
5430
5150
  } catch {
@@ -5443,12 +5163,12 @@ function specTypesOperation(cwd) {
5443
5163
  };
5444
5164
  }
5445
5165
  function specTypesCleanupOperation(cwd) {
5446
- const path = join25(cwd, SPEC_TSCONFIG);
5447
- if (!existsSync19(path)) return void 0;
5166
+ const path = join21(cwd, SPEC_TSCONFIG);
5167
+ if (!existsSync16(path)) return void 0;
5448
5168
  let config;
5449
5169
  try {
5450
5170
  config = parseJsonc(
5451
- readFileSync20(path, "utf8"),
5171
+ readFileSync18(path, "utf8"),
5452
5172
  SPEC_TSCONFIG
5453
5173
  );
5454
5174
  } catch {
@@ -5466,9 +5186,9 @@ function specTypesCleanupOperation(cwd) {
5466
5186
  }
5467
5187
  function shippedTypesPath(cwd, declaration) {
5468
5188
  try {
5469
- const manifest = createRequire5(join25(cwd, "noop.cjs")).resolve("@hublo/sentinel/package.json");
5470
- const file = join25(dirname12(manifest), declaration);
5471
- if (existsSync19(file)) {
5189
+ const manifest = createRequire3(join21(cwd, "noop.cjs")).resolve("@hublo/sentinel/package.json");
5190
+ const file = join21(dirname9(manifest), declaration);
5191
+ if (existsSync16(file)) {
5472
5192
  const path = relative6(cwd, file);
5473
5193
  return path.startsWith(".") ? path : `./${path}`;
5474
5194
  }
@@ -5487,7 +5207,7 @@ function helpersStillCallingJest(cwd) {
5487
5207
  return;
5488
5208
  }
5489
5209
  for (const entry of entries) {
5490
- const path = join25(dir, entry.name);
5210
+ const path = join21(dir, entry.name);
5491
5211
  if (entry.isDirectory()) {
5492
5212
  if (!skip.has(entry.name)) walk2(path);
5493
5213
  continue;
@@ -5497,7 +5217,7 @@ function helpersStillCallingJest(cwd) {
5497
5217
  if (/^(jest|vitest)\./.test(entry.name)) continue;
5498
5218
  let source;
5499
5219
  try {
5500
- source = readFileSync20(path, "utf8");
5220
+ source = readFileSync18(path, "utf8");
5501
5221
  } catch {
5502
5222
  continue;
5503
5223
  }
@@ -5534,7 +5254,7 @@ function tsconfigFileListOperations(cwd) {
5534
5254
  let config;
5535
5255
  try {
5536
5256
  config = parseJsonc(
5537
- readFileSync20(join25(cwd, name), "utf8"),
5257
+ readFileSync18(join21(cwd, name), "utf8"),
5538
5258
  name
5539
5259
  );
5540
5260
  } catch {
@@ -5949,12 +5669,12 @@ function plan(context) {
5949
5669
  }
5950
5670
 
5951
5671
  // src/roles/test/written-file-linter.ts
5952
- import { existsSync as existsSync24 } from "node:fs";
5953
- import { join as join31 } from "node:path";
5672
+ import { existsSync as existsSync21 } from "node:fs";
5673
+ import { join as join27 } from "node:path";
5954
5674
 
5955
5675
  // src/roles/lint/module-baseline.ts
5956
- import { existsSync as existsSync20, readFileSync as readFileSync21 } from "node:fs";
5957
- import { join as join26 } from "node:path";
5676
+ import { existsSync as existsSync17, readFileSync as readFileSync19 } from "node:fs";
5677
+ import { join as join22 } from "node:path";
5958
5678
 
5959
5679
  // src/roles/lint/oxlint-rule-owners.json
5960
5680
  var oxlint_rule_owners_default = {
@@ -6696,10 +6416,10 @@ function describeHolds(holds) {
6696
6416
  return `held ${holds.length} rule(s) at \`warn\` for this module, covering ${total} violation(s) that were already there: ${listed}${rest}. They are written to ${LINT_BASELINE_FILE}, they still report, and they return to \`error\` once fixed and re-initialized`;
6697
6417
  }
6698
6418
  function heldRules(cwd) {
6699
- const path = join26(cwd, LINT_BASELINE_FILE);
6700
- if (!existsSync20(path)) return [];
6419
+ const path = join22(cwd, LINT_BASELINE_FILE);
6420
+ if (!existsSync17(path)) return [];
6701
6421
  try {
6702
- const parsed = parseJsonc(readFileSync21(path, "utf8"), LINT_BASELINE_FILE);
6422
+ const parsed = parseJsonc(readFileSync19(path, "utf8"), LINT_BASELINE_FILE);
6703
6423
  const scoped = (parsed.overrides ?? []).flatMap((override) => Object.keys(override.rules ?? {}));
6704
6424
  return [.../* @__PURE__ */ new Set([...Object.keys(parsed.rules ?? {}), ...scoped])];
6705
6425
  } catch {
@@ -6735,7 +6455,7 @@ var SENTINEL_LINT_PRESET = /@hublo\/sentinel\/(?:lint|oxlint)\/([a-z-]+)\.json$/
6735
6455
  function presetNameFromPath(preset) {
6736
6456
  return preset ? SENTINEL_LINT_PRESET.exec(preset)?.[1] ?? void 0 : void 0;
6737
6457
  }
6738
- var PERMITTED_LOCAL_KEYS2 = ["extends", "ignorePatterns"];
6458
+ var PERMITTED_LOCAL_KEYS = ["extends", "ignorePatterns"];
6739
6459
  var ESLINT_CONFIG_FILES = [
6740
6460
  "eslint.config.js",
6741
6461
  "eslint.config.mjs",
@@ -6747,12 +6467,12 @@ function lintTarget() {
6747
6467
  }
6748
6468
 
6749
6469
  // src/roles/lint/read-adoption.ts
6750
- import { readFileSync as readFileSync24 } from "node:fs";
6751
- import { join as join29 } from "node:path";
6470
+ import { readFileSync as readFileSync22 } from "node:fs";
6471
+ import { join as join25 } from "node:path";
6752
6472
 
6753
6473
  // src/core/config/read-adoption.ts
6754
- import { existsSync as existsSync22, readFileSync as readFileSync23 } from "node:fs";
6755
- import { join as join28 } from "node:path";
6474
+ import { existsSync as existsSync19, readFileSync as readFileSync21 } from "node:fs";
6475
+ import { join as join24 } from "node:path";
6756
6476
 
6757
6477
  // src/core/config/owned-keys.ts
6758
6478
  function presetOwnedKeys(config, permitted, presetSets) {
@@ -6767,12 +6487,12 @@ function localOnlyKeys(config, permitted, presetSets) {
6767
6487
  }
6768
6488
 
6769
6489
  // src/core/config/resolve-config-target.ts
6770
- import { existsSync as existsSync21, readFileSync as readFileSync22 } from "node:fs";
6771
- import { join as join27 } from "node:path";
6490
+ import { existsSync as existsSync18, readFileSync as readFileSync20 } from "node:fs";
6491
+ import { join as join23 } from "node:path";
6772
6492
  function readExtends(absolutePath) {
6773
6493
  let parsed;
6774
6494
  try {
6775
- parsed = parseJsonc(readFileSync22(absolutePath, "utf8"), absolutePath);
6495
+ parsed = parseJsonc(readFileSync20(absolutePath, "utf8"), absolutePath);
6776
6496
  } catch {
6777
6497
  return [];
6778
6498
  }
@@ -6786,8 +6506,8 @@ function resolveConfigTarget(moduleDir, { candidates, markers, fallback }) {
6786
6506
  let existing;
6787
6507
  let existingExtendsSomething = false;
6788
6508
  for (const candidate of candidates) {
6789
- const absolutePath = join27(moduleDir, candidate);
6790
- if (!existsSync21(absolutePath)) continue;
6509
+ const absolutePath = join23(moduleDir, candidate);
6510
+ if (!existsSync18(absolutePath)) continue;
6791
6511
  const chain = readExtends(absolutePath);
6792
6512
  if (existing === void 0) {
6793
6513
  existing = candidate;
@@ -6810,7 +6530,7 @@ function normaliseExtends(value) {
6810
6530
  }
6811
6531
  return [];
6812
6532
  }
6813
- var NOT_ADOPTED2 = (configFile, unreadable = null) => ({
6533
+ var NOT_ADOPTED = (configFile, unreadable = null) => ({
6814
6534
  configFile,
6815
6535
  preset: null,
6816
6536
  adopted: false,
@@ -6820,18 +6540,18 @@ var NOT_ADOPTED2 = (configFile, unreadable = null) => ({
6820
6540
  });
6821
6541
  function readAdoption(cwd, options) {
6822
6542
  const target = resolveConfigTarget(cwd, options);
6823
- if (target.reason === "none" || !existsSync22(join28(cwd, target.path))) {
6824
- return NOT_ADOPTED2(target.reason === "none" ? null : target.path);
6543
+ if (target.reason === "none" || !existsSync19(join24(cwd, target.path))) {
6544
+ return NOT_ADOPTED(target.reason === "none" ? null : target.path);
6825
6545
  }
6826
6546
  let parsed;
6827
6547
  try {
6828
- parsed = parseJsonc(readFileSync23(join28(cwd, target.path), "utf8"), target.path);
6548
+ parsed = parseJsonc(readFileSync21(join24(cwd, target.path), "utf8"), target.path);
6829
6549
  } catch (error) {
6830
6550
  const reason = error instanceof Error ? error.message : String(error);
6831
- return NOT_ADOPTED2(target.path, `${target.path} could not be parsed (${reason})`);
6551
+ return NOT_ADOPTED(target.path, `${target.path} could not be parsed (${reason})`);
6832
6552
  }
6833
6553
  const preset = normaliseExtends(parsed.extends).find((entry) => options.presetPattern.test(entry)) ?? null;
6834
- if (preset === null) return NOT_ADOPTED2(target.path);
6554
+ if (preset === null) return NOT_ADOPTED(target.path);
6835
6555
  const settings = options.settingsKey === null ? parsed : parsed[options.settingsKey];
6836
6556
  const owned = presetOwnedKeys(settings, options.permitted, options.presetOwns?.(preset));
6837
6557
  const drift = options.refineDrift !== void 0 && settings !== void 0 ? options.refineDrift(owned, settings, preset) : owned;
@@ -9491,7 +9211,7 @@ function readLintAdoption(cwd) {
9491
9211
  // Drift for lint is read from the TOP-LEVEL keys beyond `extends`, so the settings the
9492
9212
  // shared reader inspects are the config's own root rather than a nested options object.
9493
9213
  settingsKey: null,
9494
- permitted: PERMITTED_LOCAL_KEYS2,
9214
+ permitted: PERMITTED_LOCAL_KEYS,
9495
9215
  // `rules` and `overrides` are drift only when they CONFLICT with the preset, by the
9496
9216
  // criterion a re-init keeps or drops them by: a rule the preset does not name is the
9497
9217
  // module's addition, kept and listed by `--inspect`, not drift. A preset sentinel does not
@@ -9509,7 +9229,7 @@ function readModuleAdditions(cwd) {
9509
9229
  if (preset === void 0 || adoption.configFile === null) return NO_ADDITIONS;
9510
9230
  try {
9511
9231
  const config = parseJsonc(
9512
- readFileSync24(join29(cwd, adoption.configFile), "utf8"),
9232
+ readFileSync22(join25(cwd, adoption.configFile), "utf8"),
9513
9233
  adoption.configFile
9514
9234
  );
9515
9235
  if (typeof config !== "object" || config === null || Array.isArray(config)) {
@@ -9526,15 +9246,15 @@ function readModuleAdditions(cwd) {
9526
9246
  }
9527
9247
 
9528
9248
  // src/roles/lint/resolve-oxlint.ts
9529
- import { existsSync as existsSync23 } from "node:fs";
9530
- import { createRequire as createRequire6 } from "node:module";
9531
- import { delimiter as delimiter2, dirname as dirname13, join as join30 } from "node:path";
9249
+ import { existsSync as existsSync20 } from "node:fs";
9250
+ import { createRequire as createRequire4 } from "node:module";
9251
+ import { delimiter, dirname as dirname10, join as join26 } from "node:path";
9532
9252
  import { fileURLToPath } from "node:url";
9533
9253
  var PACKAGE_OF = {
9534
9254
  oxlint: "oxlint",
9535
9255
  tsgolint: "oxlint-tsgolint"
9536
9256
  };
9537
- var require3 = createRequire6(import.meta.url);
9257
+ var require2 = createRequire4(import.meta.url);
9538
9258
  function resolveOxlint(cwd, name = "oxlint") {
9539
9259
  return resolveBin(cwd, name) ?? binFromOwnInstall(PACKAGE_OF[name], name);
9540
9260
  }
@@ -9544,7 +9264,7 @@ function canRunTypeAware(cwd) {
9544
9264
  function oxlintPath(cwd, env) {
9545
9265
  const shim = tsgolintShim(cwd);
9546
9266
  if (!shim) return env.PATH;
9547
- return [dirname13(shim), env.PATH].filter(Boolean).join(delimiter2);
9267
+ return [dirname10(shim), env.PATH].filter(Boolean).join(delimiter);
9548
9268
  }
9549
9269
  function tsgolintShim(cwd) {
9550
9270
  const fromModule = resolveBin(cwd, "tsgolint");
@@ -9552,19 +9272,19 @@ function tsgolintShim(cwd) {
9552
9272
  const candidates = [];
9553
9273
  for (const owner of ["oxlint-tsgolint", "oxlint"]) {
9554
9274
  try {
9555
- const packageDir = dirname13(require3.resolve(`${owner}/package.json`));
9556
- candidates.push(join30(packageDir, "node_modules", ".bin", "tsgolint"));
9557
- candidates.push(join30(packageDir, "..", ".bin", "tsgolint"));
9275
+ const packageDir = dirname10(require2.resolve(`${owner}/package.json`));
9276
+ candidates.push(join26(packageDir, "node_modules", ".bin", "tsgolint"));
9277
+ candidates.push(join26(packageDir, "..", ".bin", "tsgolint"));
9558
9278
  } catch {
9559
9279
  }
9560
9280
  }
9561
9281
  try {
9562
- const ownRoot = dirname13(require3.resolve("@hublo/sentinel/package.json"));
9563
- candidates.push(join30(ownRoot, "node_modules", ".bin", "tsgolint"));
9282
+ const ownRoot = dirname10(require2.resolve("@hublo/sentinel/package.json"));
9283
+ candidates.push(join26(ownRoot, "node_modules", ".bin", "tsgolint"));
9564
9284
  } catch {
9565
- candidates.push(resolveBin(dirname13(fileURLToPath(import.meta.url)), "tsgolint") ?? "");
9285
+ candidates.push(resolveBin(dirname10(fileURLToPath(import.meta.url)), "tsgolint") ?? "");
9566
9286
  }
9567
- return candidates.find((candidate) => candidate !== "" && existsSync23(candidate));
9287
+ return candidates.find((candidate) => candidate !== "" && existsSync20(candidate));
9568
9288
  }
9569
9289
  function oxlintSearchPath(cwd) {
9570
9290
  return binSearchPath(cwd);
@@ -9578,7 +9298,7 @@ function writtenFileLinter(cwd) {
9578
9298
  return { bin: oxlint, args: ["--fix"], origin: "this module's own oxlint config" };
9579
9299
  }
9580
9300
  }
9581
- const config = ESLINT_CONFIG_FILES.map((name) => join31(cwd, name)).find((path) => existsSync24(path));
9301
+ const config = ESLINT_CONFIG_FILES.map((name) => join27(cwd, name)).find((path) => existsSync21(path));
9582
9302
  const eslint = resolveBin(cwd, "eslint");
9583
9303
  if (config !== void 0 && eslint !== void 0) {
9584
9304
  return {
@@ -9600,7 +9320,7 @@ var FORMATTABLE = /\.(m|c)?(j|t)sx?$|\.json$/;
9600
9320
  var FORMAT_BATCH = 25;
9601
9321
  function readIfPossible(path) {
9602
9322
  try {
9603
- return readFileSync25(path, "utf8");
9323
+ return readFileSync23(path, "utf8");
9604
9324
  } catch {
9605
9325
  return void 0;
9606
9326
  }
@@ -9726,12 +9446,12 @@ var VitestAdapter = class _VitestAdapter extends BaseAdapter {
9726
9446
  const linter = writtenFileLinter(ctx.cwd);
9727
9447
  if (linter === void 0) return;
9728
9448
  const workspaceRoot = findWorkspaceRoot(ctx.cwd) ?? ctx.cwd;
9729
- const fromRoot = (file) => relative7(workspaceRoot, join32(ctx.cwd, file));
9449
+ const fromRoot = (file) => relative7(workspaceRoot, join28(ctx.cwd, file));
9730
9450
  let unsettled = 0;
9731
9451
  const reverted = [];
9732
9452
  for (let at = 0; at < written.length; at += FORMAT_BATCH) {
9733
9453
  const batch = written.slice(at, at + FORMAT_BATCH);
9734
- const before = new Map(batch.map((file) => [file, readIfPossible(join32(ctx.cwd, file))]));
9454
+ const before = new Map(batch.map((file) => [file, readIfPossible(join28(ctx.cwd, file))]));
9735
9455
  const pass = spawnSync(linter.bin, [...linter.args, ...batch.map(fromRoot)], {
9736
9456
  cwd: workspaceRoot,
9737
9457
  encoding: "utf8"
@@ -9740,11 +9460,11 @@ var VitestAdapter = class _VitestAdapter extends BaseAdapter {
9740
9460
  for (const file of batch) {
9741
9461
  const was = before.get(file);
9742
9462
  if (was === void 0) continue;
9743
- const now = readIfPossible(join32(ctx.cwd, file));
9463
+ const now = readIfPossible(join28(ctx.cwd, file));
9744
9464
  if (now === void 0 || now === was) continue;
9745
9465
  const lost = lineLostByTheFixer(was, now);
9746
9466
  if (lost === void 0) continue;
9747
- writeFileSync2(join32(ctx.cwd, file), was);
9467
+ writeFileSync2(join28(ctx.cwd, file), was);
9748
9468
  reverted.push(`${file}: \`${lost.slice(0, 80)}\``);
9749
9469
  }
9750
9470
  }
@@ -9823,7 +9543,7 @@ var VitestAdapter = class _VitestAdapter extends BaseAdapter {
9823
9543
  metrics: { ..._VitestAdapter.NOTHING_TO_REPORT, error: "vitest not available" }
9824
9544
  };
9825
9545
  }
9826
- const out = join32(mkdtempSync3(join32(tmpdir3(), "sentinel-test-report-")), "vitest.json");
9546
+ const out = join28(mkdtempSync3(join28(tmpdir3(), "sentinel-test-report-")), "vitest.json");
9827
9547
  const { cwd: runFrom, options, env } = fromWorkspaceRoot(ctx.cwd, [], []);
9828
9548
  const result = spawnSync(bin, ["run", ...options, "--reporter=json", `--outputFile=${out}`], {
9829
9549
  cwd: runFrom,
@@ -9838,7 +9558,7 @@ var VitestAdapter = class _VitestAdapter extends BaseAdapter {
9838
9558
  metrics: { ..._VitestAdapter.NOTHING_TO_REPORT, error: result.error.message }
9839
9559
  };
9840
9560
  }
9841
- if (!existsSync25(out)) {
9561
+ if (!existsSync22(out)) {
9842
9562
  return {
9843
9563
  ok: false,
9844
9564
  code: 1,
@@ -9847,7 +9567,7 @@ var VitestAdapter = class _VitestAdapter extends BaseAdapter {
9847
9567
  }
9848
9568
  let parsed;
9849
9569
  try {
9850
- parsed = JSON.parse(readFileSync25(out, "utf8"));
9570
+ parsed = JSON.parse(readFileSync23(out, "utf8"));
9851
9571
  } catch {
9852
9572
  return {
9853
9573
  ok: false,
@@ -9970,26 +9690,8 @@ export {
9970
9690
  BaseAdapter,
9971
9691
  splitToolArgs,
9972
9692
  separateToolArgs,
9973
- resolveBin,
9974
- binFromOwnInstall,
9975
- binSearchPath,
9976
- scriptPath,
9977
9693
  nxTargetOperations,
9978
- FORMAT_CONFIG_FILE,
9979
- FORMAT_SCRIPT_NAME,
9980
- PROVENANCE_KEY,
9981
- PERMITTED_LOCAL_KEYS,
9982
- ALWAYS_LOCAL_KEYS,
9983
- OWNED_WHEN_SET_KEYS,
9984
- FORMAT_DEFAULT_IGNORES,
9985
- PRETTIER_CONFIG_FILES,
9986
- formatTargets,
9987
- formatPresetName,
9988
- formatPresetFor,
9989
- readFormatAdoption,
9990
9694
  rewriteToolchainImports,
9991
- resolveOxfmt,
9992
- oxfmtRejects,
9993
9695
  canonicalRuleName,
9994
9696
  describeRuleKey,
9995
9697
  LINT_BASELINE_FILE,
@@ -10030,7 +9732,6 @@ export {
10030
9732
  oxlintPath,
10031
9733
  oxlintSearchPath,
10032
9734
  walk,
10033
- writtenFileFormatter,
10034
9735
  RESOLVABLE_EXTENSIONS,
10035
9736
  readTestAdoption,
10036
9737
  resolveContext,