@hublo/sentinel 1.7.0-alpha.6 → 1.7.0-alpha.8

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 (57) hide show
  1. package/README.md +1 -0
  2. package/dist/bin/sentinel.js +25 -87
  3. package/dist/{chunk-DLGBRLUU.js → chunk-EESVRILJ.js} +3 -16
  4. package/dist/chunk-EESVRILJ.js.map +1 -0
  5. package/dist/{chunk-ZNANJEMK.js → chunk-JT7ZMH44.js} +30 -16
  6. package/dist/chunk-JT7ZMH44.js.map +1 -0
  7. package/dist/chunk-LU4E4TVD.js +183 -0
  8. package/dist/chunk-LU4E4TVD.js.map +1 -0
  9. package/dist/{chunk-THTXP2QU.js → chunk-LX7EG6PJ.js} +5 -6
  10. package/dist/chunk-LX7EG6PJ.js.map +1 -0
  11. package/dist/{chunk-4YQXLPJ5.js → chunk-PMRL4MH6.js} +2 -2
  12. package/dist/chunk-PXTU5MPW.js +9 -0
  13. package/dist/chunk-PXTU5MPW.js.map +1 -0
  14. package/dist/{chunk-LNFGVGLE.js → chunk-SWWQ7X7B.js} +11 -23
  15. package/dist/{chunk-LNFGVGLE.js.map → chunk-SWWQ7X7B.js.map} +1 -1
  16. package/dist/{chunk-YRBFCQQI.js → chunk-VZZ3DOC3.js} +2954 -1219
  17. package/dist/{chunk-P6KTBQ2Q.js → chunk-ZASD5YPF.js} +480 -186
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.js +6 -7
  20. package/dist/roles/build/nest/toolchain.d.ts +1 -1
  21. package/dist/roles/build/nest/toolchain.js +2 -6
  22. package/dist/roles/build/nest/toolchain.js.map +1 -1
  23. package/dist/roles/sql/config.d.ts +68 -0
  24. package/dist/roles/sql/config.js +8 -0
  25. package/dist/roles/sql/config.js.map +1 -0
  26. package/dist/roles/static-analysis/config.js +2 -1
  27. package/dist/roles/test/nest/toolchain.d.ts +1 -1
  28. package/dist/roles/test/nest/toolchain.js +2 -3
  29. package/dist/roles/test/nest/toolchain.js.map +1 -1
  30. package/dist/roles/test/react/toolchain.js +2 -3
  31. package/dist/roles/test/react/toolchain.js.map +1 -1
  32. package/dist/roles/test/setup/jest-parity.js +2 -2
  33. package/dist/roles/test/setup/workspace-entry.js +2 -2
  34. package/dist/roles/test/shared-test-config.d.ts +1 -1
  35. package/dist/roles/test/shared-test-config.js +2 -3
  36. package/dist/tsconfig/nest.json +1 -10
  37. package/dist/tsconfig/node.json +1 -11
  38. package/dist/tsconfig/react.json +0 -3
  39. package/dist/{tsconfig-aliases-C_PxuZni.d.ts → tsconfig-aliases-Ce6axdJ4.d.ts} +2 -17
  40. package/dist/{validate-4V3EGTXN.js → validate-QYP7HFSY.js} +2 -4
  41. package/docs/build-adoption.md +0 -7
  42. package/docs/sql-adoption.md +282 -0
  43. package/docs/test-adoption.md +1 -8
  44. package/docs/typescript-adoption.md +13 -96
  45. package/docs/typescript-traces.md +217 -3
  46. package/docs/using-sentinel.md +2 -1
  47. package/package.json +6 -4
  48. package/dist/chunk-DLGBRLUU.js.map +0 -1
  49. package/dist/chunk-H4HAFJFZ.js +0 -79
  50. package/dist/chunk-H4HAFJFZ.js.map +0 -1
  51. package/dist/chunk-THTXP2QU.js.map +0 -1
  52. package/dist/chunk-ZFG6P27V.js +0 -313
  53. package/dist/chunk-ZNANJEMK.js.map +0 -1
  54. package/dist/chunk-ZZMYV576.js +0 -297
  55. package/dist/migrate-X7PB2X7R.js +0 -553
  56. package/dist/tsconfig/legacy.json +0 -21
  57. /package/dist/{chunk-4YQXLPJ5.js.map → chunk-PMRL4MH6.js.map} +0 -0
@@ -1,9 +1,3 @@
1
- import {
2
- binFromOwnInstall,
3
- binSearchPath,
4
- resolveBin,
5
- writtenFileFormatter
6
- } from "./chunk-ZFG6P27V.js";
7
1
  import {
8
2
  DEFAULT_MAX_DIAGNOSTICS,
9
3
  WORKSPACE_ROOT_MARKER,
@@ -12,15 +6,10 @@ import {
12
6
  readNxProjectName,
13
7
  readOwnPackage,
14
8
  readProjectPackageJson
15
- } from "./chunk-ZNANJEMK.js";
9
+ } from "./chunk-JT7ZMH44.js";
16
10
  import {
17
11
  matchesTsconfigPattern
18
12
  } from "./chunk-O7REVMOC.js";
19
- import {
20
- WORKSPACE_TSCONFIG,
21
- chainPaths,
22
- effectivePaths
23
- } from "./chunk-H4HAFJFZ.js";
24
13
  import {
25
14
  parseJsonc
26
15
  } from "./chunk-QXFCZON7.js";
@@ -409,9 +398,53 @@ function moduleEnvironment(cwd) {
409
398
  // src/roles/test/reference.ts
410
399
  import { execFileSync } from "node:child_process";
411
400
  import { createHash } from "node:crypto";
412
- import { existsSync as existsSync5, mkdirSync, mkdtempSync, readFileSync as readFileSync5, rmSync, writeFileSync } from "node:fs";
401
+ import { existsSync as existsSync6, mkdirSync, mkdtempSync, readFileSync as readFileSync5, rmSync, writeFileSync } from "node:fs";
413
402
  import { tmpdir } from "node:os";
414
- import { join as join5, resolve as resolve2 } from "node:path";
403
+ import { join as join6, resolve as resolve2 } from "node:path";
404
+
405
+ // src/shared/resolve-bin.ts
406
+ import { existsSync as existsSync5 } from "node:fs";
407
+ import { createRequire } from "node:module";
408
+ import { delimiter, dirname, join as join5 } from "node:path";
409
+ var require2 = createRequire(import.meta.url);
410
+ function resolveBin(fromDir, name) {
411
+ let dir = fromDir;
412
+ for (; ; ) {
413
+ const candidate = join5(dir, "node_modules", ".bin", name);
414
+ if (existsSync5(candidate)) return candidate;
415
+ const parent = dirname(dir);
416
+ if (parent === dir) return void 0;
417
+ dir = parent;
418
+ }
419
+ }
420
+ function binFromOwnInstall(packageName, binName) {
421
+ try {
422
+ const manifest = require2.resolve(`${packageName}/package.json`);
423
+ const bin = require2(manifest).bin;
424
+ const relative8 = typeof bin === "string" ? bin : bin?.[binName];
425
+ if (!relative8) return void 0;
426
+ const executable = join5(dirname(manifest), relative8);
427
+ return existsSync5(executable) ? executable : void 0;
428
+ } catch {
429
+ return void 0;
430
+ }
431
+ }
432
+ function binSearchPath(cwd) {
433
+ return [`${cwd}${delimiter}node_modules/.bin (and parents)`, "sentinel's own install"].join(
434
+ " then "
435
+ );
436
+ }
437
+ function scriptPath(cwd, path) {
438
+ const bins = [];
439
+ let dir = cwd;
440
+ for (; ; ) {
441
+ bins.push(join5(dir, "node_modules", ".bin"));
442
+ const parent = dirname(dir);
443
+ if (parent === dir) break;
444
+ dir = parent;
445
+ }
446
+ return [...bins, path].filter(Boolean).join(delimiter);
447
+ }
415
448
 
416
449
  // src/roles/test/baseline.ts
417
450
  function readSnapshot(report) {
@@ -679,7 +712,7 @@ function describeComparison(comparison) {
679
712
  // src/roles/test/reference.ts
680
713
  function referencePath(cwd, suite) {
681
714
  const key = createHash("sha256").update(`${resolve2(cwd)}\0${suite}`).digest("hex").slice(0, 16);
682
- return join5(tmpdir(), "sentinel-test-reference", `${key}.json`);
715
+ return join6(tmpdir(), "sentinel-test-reference", `${key}.json`);
683
716
  }
684
717
  function suiteOf(config) {
685
718
  const base = config.replace(/^(jest|vitest)\./, "").replace(/\.[cm]?[jt]s$/, "");
@@ -690,9 +723,9 @@ function runJest(cwd, config) {
690
723
  const bin = resolveBin(cwd, "jest");
691
724
  if (bin === void 0) return void 0;
692
725
  const root = findWorkspaceRoot(cwd) ?? cwd;
693
- const out = join5(mkdtempSync(join5(tmpdir(), "sentinel-reference-")), "jest.json");
726
+ const out = join6(mkdtempSync(join6(tmpdir(), "sentinel-reference-")), "jest.json");
694
727
  try {
695
- execFileSync(bin, ["-c", join5(cwd, config), "--json", `--outputFile=${out}`, "--silent"], {
728
+ execFileSync(bin, ["-c", join6(cwd, config), "--json", `--outputFile=${out}`, "--silent"], {
696
729
  cwd: root,
697
730
  /*
698
731
  * ⚠️ The module's environment, not the shell's, and this is what made the reference lie.
@@ -707,7 +740,7 @@ function runJest(cwd, config) {
707
740
  });
708
741
  } catch {
709
742
  }
710
- if (!existsSync5(out)) return void 0;
743
+ if (!existsSync6(out)) return void 0;
711
744
  try {
712
745
  return JSON.parse(readFileSync5(out, "utf8"));
713
746
  } catch {
@@ -740,7 +773,7 @@ function captureReference(cwd, config) {
740
773
  snapshot
741
774
  };
742
775
  const path = referencePath(cwd, suiteOf(config));
743
- mkdirSync(join5(path, ".."), { recursive: true });
776
+ mkdirSync(join6(path, ".."), { recursive: true });
744
777
  writeFileSync(path, `${JSON.stringify(stored, void 0, 2)}
745
778
  `);
746
779
  return {
@@ -749,7 +782,7 @@ function captureReference(cwd, config) {
749
782
  };
750
783
  }
751
784
  function hasReference(cwd, suite) {
752
- return existsSync5(referencePath(cwd, suite));
785
+ return existsSync6(referencePath(cwd, suite));
753
786
  }
754
787
  function compareAgainstReference(cwd, suite, report) {
755
788
  const path = referencePath(cwd, suite);
@@ -779,9 +812,9 @@ function resolveVitest(cwd) {
779
812
 
780
813
  // src/roles/test/adapters/vitest/vitest.adapter.ts
781
814
  import { spawnSync } from "node:child_process";
782
- import { existsSync as existsSync22, mkdtempSync as mkdtempSync3, readFileSync as readFileSync23, writeFileSync as writeFileSync2 } from "node:fs";
815
+ import { existsSync as existsSync25, mkdtempSync as mkdtempSync3, readFileSync as readFileSync26, writeFileSync as writeFileSync2 } from "node:fs";
783
816
  import { tmpdir as tmpdir3 } from "node:os";
784
- import { isAbsolute as isAbsolute2, join as join28, relative as relative7, resolve as resolve10 } from "node:path";
817
+ import { isAbsolute as isAbsolute2, join as join32, relative as relative7, resolve as resolve10 } from "node:path";
785
818
 
786
819
  // src/roles/test/ordering-is-a-permutation.ts
787
820
  function isAnImport(line) {
@@ -806,15 +839,15 @@ function lineLostByTheFixer(before, after) {
806
839
  }
807
840
 
808
841
  // src/core/config/nx-target.ts
809
- import { existsSync as existsSync7 } from "node:fs";
810
- import { join as join7 } from "node:path";
842
+ import { existsSync as existsSync8 } from "node:fs";
843
+ import { join as join8 } from "node:path";
811
844
 
812
845
  // src/core/config/project-json.ts
813
- import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
814
- import { join as join6 } from "node:path";
846
+ import { existsSync as existsSync7, readFileSync as readFileSync6 } from "node:fs";
847
+ import { join as join7 } from "node:path";
815
848
  function projectTargets(cwd) {
816
- const path = join6(cwd, "project.json");
817
- if (!existsSync6(path)) return void 0;
849
+ const path = join7(cwd, "project.json");
850
+ if (!existsSync7(path)) return void 0;
818
851
  try {
819
852
  return JSON.parse(readFileSync6(path, "utf8")).targets;
820
853
  } catch {
@@ -867,7 +900,7 @@ function nxTargetOperations(options) {
867
900
  if (names.length === 0) return [];
868
901
  const targets = withTeamInputs(cwd, options.targets);
869
902
  const operations = [];
870
- if (existsSync7(join7(cwd, "project.json"))) {
903
+ if (existsSync8(join8(cwd, "project.json"))) {
871
904
  operations.push({
872
905
  kind: "remove-json-keys",
873
906
  path: "project.json",
@@ -971,24 +1004,24 @@ function rewriteToolchainImports(toolchain, source, fileName) {
971
1004
  }
972
1005
 
973
1006
  // src/roles/test/jest-migration.ts
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";
1007
+ import { existsSync as existsSync19, readFileSync as readFileSync21, readdirSync as readdirSync6 } from "node:fs";
1008
+ import { createRequire as createRequire5 } from "node:module";
1009
+ import { dirname as dirname12, join as join25, relative as relative6 } from "node:path";
977
1010
 
978
1011
  // src/roles/test/codemod/migrate-module.ts
979
- import { readdirSync as readdirSync4, readFileSync as readFileSync15, statSync as statSync5 } from "node:fs";
980
- import { join as join17 } from "node:path";
1012
+ import { readdirSync as readdirSync4, readFileSync as readFileSync16, statSync as statSync5 } from "node:fs";
1013
+ import { join as join18 } from "node:path";
981
1014
  import { parseSync as parseSync9 } from "oxc-parser";
982
1015
 
983
1016
  // src/roles/test/msw-lifecycle.ts
984
- import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
985
- import { join as join8 } from "node:path";
1017
+ import { existsSync as existsSync9, readFileSync as readFileSync7 } from "node:fs";
1018
+ import { join as join9 } from "node:path";
986
1019
  var ROOT_SETUP = "jest.setup.after.env.js";
987
1020
  function ownsMswLifecycle(cwd, setupFiles) {
988
1021
  for (const raw of setupFiles) {
989
1022
  if (raw.endsWith(ROOT_SETUP)) continue;
990
- const file = join8(cwd, raw.replaceAll("<rootDir>/", "").replaceAll("<rootDir>", "."));
991
- if (!existsSync8(file)) continue;
1023
+ const file = join9(cwd, raw.replaceAll("<rootDir>/", "").replaceAll("<rootDir>", "."));
1024
+ if (!existsSync9(file)) continue;
992
1025
  try {
993
1026
  if (/\.listen\s*\(/.test(readFileSync7(file, "utf8"))) return true;
994
1027
  } catch {
@@ -1010,7 +1043,7 @@ function vitestSupportName(relative8) {
1010
1043
  }
1011
1044
 
1012
1045
  // src/roles/test/codemod/inherited-automocks.ts
1013
- import { existsSync as existsSync9, readFileSync as readFileSync8 } from "node:fs";
1046
+ import { existsSync as existsSync10, readFileSync as readFileSync8 } from "node:fs";
1014
1047
  import { resolve as resolve3 } from "node:path";
1015
1048
 
1016
1049
  // src/shared/ast.ts
@@ -1054,7 +1087,7 @@ function inheritedAutomocks(cwd, setupFiles, parse6) {
1054
1087
  for (const named of setupFiles) {
1055
1088
  const path = resolve3(cwd, named.replace("<rootDir>/", "./"));
1056
1089
  if (path.startsWith(`${cwd}/`)) continue;
1057
- if (!existsSync9(path)) continue;
1090
+ if (!existsSync10(path)) continue;
1058
1091
  let source;
1059
1092
  try {
1060
1093
  source = readFileSync8(path, "utf8");
@@ -1323,7 +1356,7 @@ ${source}`;
1323
1356
  }
1324
1357
 
1325
1358
  // src/roles/test/codemod/migrate-file.ts
1326
- import { dirname as dirname7 } from "node:path";
1359
+ import { dirname as dirname8 } from "node:path";
1327
1360
  import { parseSync as parseSync8 } from "oxc-parser";
1328
1361
 
1329
1362
  // src/roles/test/codemod/edits.ts
@@ -2109,9 +2142,9 @@ function asyncifyEdits(source, fn) {
2109
2142
  }
2110
2143
 
2111
2144
  // src/roles/test/codemod/named-rules.ts
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";
2145
+ import { existsSync as existsSync11, readFileSync as readFileSync10 } from "node:fs";
2146
+ import { createRequire as createRequire2 } from "node:module";
2147
+ import { dirname as dirname3, join as join11 } from "node:path";
2115
2148
 
2116
2149
  // src/roles/test/codemod/namespace-import.ts
2117
2150
  function sameModule(specifier) {
@@ -2181,7 +2214,7 @@ function namespaceBindings(program) {
2181
2214
 
2182
2215
  // src/roles/test/codemod/static-import-for-require.ts
2183
2216
  import { readFileSync as readFileSync9, statSync } from "node:fs";
2184
- import { dirname, join as join9, resolve as resolve4 } from "node:path";
2217
+ import { dirname as dirname2, join as join10, resolve as resolve4 } from "node:path";
2185
2218
  import { parseSync as parseSync4 } from "oxc-parser";
2186
2219
 
2187
2220
  // src/shared/module-resolution.ts
@@ -2198,11 +2231,11 @@ var RESOLVABLE_EXTENSIONS = [
2198
2231
 
2199
2232
  // src/roles/test/codemod/static-import-for-require.ts
2200
2233
  function resolveRelative(fromFile, specifier) {
2201
- const base = resolve4(dirname(fromFile), specifier);
2234
+ const base = resolve4(dirname2(fromFile), specifier);
2202
2235
  const candidates = [
2203
2236
  base,
2204
2237
  ...RESOLVABLE_EXTENSIONS.map((extension) => `${base}${extension}`),
2205
- ...RESOLVABLE_EXTENSIONS.map((extension) => join9(base, `index${extension}`))
2238
+ ...RESOLVABLE_EXTENSIONS.map((extension) => join10(base, `index${extension}`))
2206
2239
  ];
2207
2240
  for (const candidate of candidates) {
2208
2241
  try {
@@ -2404,24 +2437,24 @@ function isCommonJsPackage(fromFile, specifier) {
2404
2437
  if (specifier.startsWith(".") || specifier.startsWith("/")) return false;
2405
2438
  let resolved;
2406
2439
  try {
2407
- resolved = createRequire(fromFile).resolve(specifier);
2440
+ resolved = createRequire2(fromFile).resolve(specifier);
2408
2441
  } catch {
2409
2442
  return false;
2410
2443
  }
2411
2444
  if (!resolved.includes(`${"/"}node_modules${"/"}`)) return false;
2412
2445
  if (resolved.endsWith(".mjs")) return false;
2413
2446
  if (resolved.endsWith(".cjs")) return true;
2414
- let dir = dirname2(resolved);
2447
+ let dir = dirname3(resolved);
2415
2448
  for (let depth = 0; depth < 12; depth += 1) {
2416
- const manifest = join10(dir, "package.json");
2417
- if (existsSync10(manifest)) {
2449
+ const manifest = join11(dir, "package.json");
2450
+ if (existsSync11(manifest)) {
2418
2451
  try {
2419
2452
  return JSON.parse(readFileSync10(manifest, "utf8")).type !== "module";
2420
2453
  } catch {
2421
2454
  return false;
2422
2455
  }
2423
2456
  }
2424
- const parent = dirname2(dir);
2457
+ const parent = dirname3(dir);
2425
2458
  if (parent === dir) break;
2426
2459
  dir = parent;
2427
2460
  }
@@ -3292,8 +3325,8 @@ function propagateAwait(fileName, source, original, elsewhere = /* @__PURE__ */
3292
3325
 
3293
3326
  // src/roles/test/codemod/reexport-barrel-mock.ts
3294
3327
  import { readFileSync as readFileSync11, readdirSync as readdirSync2, statSync as statSync2 } from "node:fs";
3295
- import { createRequire as createRequire2 } from "node:module";
3296
- import { dirname as dirname3, join as join11 } from "node:path";
3328
+ import { createRequire as createRequire3 } from "node:module";
3329
+ import { dirname as dirname4, join as join12 } from "node:path";
3297
3330
  var PACKAGE_SUBPATH = /^(@[^/]+\/[^/]+|[^@.][^/]*)\/(.+)$/;
3298
3331
  var PURE_REEXPORT = /^module\.exports\s*=\s*require\(\s*(['"])([^'"]+)\1\s*\)\s*;?$/;
3299
3332
  function mockCalls(program) {
@@ -3321,14 +3354,14 @@ function mockCalls(program) {
3321
3354
  }
3322
3355
  function packageRoot(fromFile, name) {
3323
3356
  try {
3324
- return dirname3(createRequire2(fromFile).resolve(`${name}/package.json`));
3357
+ return dirname4(createRequire3(fromFile).resolve(`${name}/package.json`));
3325
3358
  } catch {
3326
3359
  return void 0;
3327
3360
  }
3328
3361
  }
3329
3362
  function resolveFrom(fromFile, specifier) {
3330
3363
  try {
3331
- return createRequire2(fromFile).resolve(specifier);
3364
+ return createRequire3(fromFile).resolve(specifier);
3332
3365
  } catch {
3333
3366
  return void 0;
3334
3367
  }
@@ -3345,7 +3378,7 @@ function barrelsFor(fromFile, name, target) {
3345
3378
  const aliases = [];
3346
3379
  for (const entry of entries) {
3347
3380
  if (!entry.endsWith(".js")) continue;
3348
- const path = join11(root, entry);
3381
+ const path = join12(root, entry);
3349
3382
  let body;
3350
3383
  try {
3351
3384
  if (!statSync2(path).isFile()) continue;
@@ -3448,17 +3481,17 @@ function rewriteRunnerArtefactNames(source, program) {
3448
3481
  }
3449
3482
 
3450
3483
  // src/roles/test/codemod/setup-static-imports.ts
3451
- import { dirname as dirname5, resolve as resolve7 } from "node:path";
3484
+ import { dirname as dirname6, resolve as resolve7 } from "node:path";
3452
3485
 
3453
3486
  // src/core/context.ts
3454
- import { existsSync as existsSync11 } from "node:fs";
3455
- import { dirname as dirname4, join as join13, resolve as resolve5 } from "node:path";
3487
+ import { existsSync as existsSync12 } from "node:fs";
3488
+ import { dirname as dirname5, join as join14, resolve as resolve5 } from "node:path";
3456
3489
 
3457
3490
  // src/core/discover-modules.ts
3458
3491
  import { execFileSync as execFileSync2 } from "node:child_process";
3459
3492
  import { mkdtempSync as mkdtempSync2, readFileSync as readFileSync12, rmSync as rmSync2 } from "node:fs";
3460
3493
  import { tmpdir as tmpdir2 } from "node:os";
3461
- import { join as join12 } from "node:path";
3494
+ import { join as join13 } from "node:path";
3462
3495
  function runNx(cwd, args) {
3463
3496
  const nx = resolveBin(cwd, "nx") ?? "nx";
3464
3497
  try {
@@ -3476,8 +3509,8 @@ function runNx(cwd, args) {
3476
3509
  }
3477
3510
  }
3478
3511
  function readGraph(cwd) {
3479
- const dir = mkdtempSync2(join12(tmpdir2(), "sentinel-nx-"));
3480
- const file = join12(dir, "graph.json");
3512
+ const dir = mkdtempSync2(join13(tmpdir2(), "sentinel-nx-"));
3513
+ const file = join13(dir, "graph.json");
3481
3514
  try {
3482
3515
  runNx(cwd, ["graph", "--file", file]);
3483
3516
  const parsed = JSON.parse(readFileSync12(file, "utf8"));
@@ -3489,7 +3522,7 @@ function readGraph(cwd) {
3489
3522
  }
3490
3523
  return Object.entries(nodes).map(([name, node]) => ({
3491
3524
  name,
3492
- root: join12(cwd, node.data.root)
3525
+ root: join13(cwd, node.data.root)
3493
3526
  }));
3494
3527
  } finally {
3495
3528
  rmSync2(dir, { recursive: true, force: true });
@@ -3530,20 +3563,20 @@ ${raw.slice(0, 300)}`
3530
3563
  // src/core/context.ts
3531
3564
  var MODULE_MARKERS = ["package.json", "project.json"];
3532
3565
  function isModuleDir(cwd) {
3533
- return MODULE_MARKERS.some((marker) => existsSync11(join13(cwd, marker)));
3566
+ return MODULE_MARKERS.some((marker) => existsSync12(join14(cwd, marker)));
3534
3567
  }
3535
3568
  function findModuleRoot(startDir, workspaceRoot) {
3536
3569
  let dir = resolve5(startDir);
3537
3570
  for (; ; ) {
3538
3571
  if (workspaceRoot !== void 0 && dir === resolve5(workspaceRoot)) return void 0;
3539
3572
  if (isModuleDir(dir)) return dir;
3540
- const parent = dirname4(dir);
3573
+ const parent = dirname5(dir);
3541
3574
  if (parent === dir) return void 0;
3542
3575
  dir = parent;
3543
3576
  }
3544
3577
  }
3545
3578
  function resolveContext(cwd, opts) {
3546
- const atRoot = existsSync11(join13(cwd, WORKSPACE_ROOT_MARKER));
3579
+ const atRoot = existsSync12(join14(cwd, WORKSPACE_ROOT_MARKER));
3547
3580
  if (!atRoot && isModuleDir(cwd)) {
3548
3581
  if (opts.module) {
3549
3582
  throw new Error(
@@ -3571,40 +3604,37 @@ function resolveContext(cwd, opts) {
3571
3604
  }
3572
3605
 
3573
3606
  // src/roles/test/codemod/workspace-specifier.ts
3574
- import { existsSync as existsSync12 } from "node:fs";
3575
- import { join as join14, relative as relative2, resolve as resolve6 } from "node:path";
3607
+ import { existsSync as existsSync13, readFileSync as readFileSync13 } from "node:fs";
3608
+ import { join as join15, relative as relative2, resolve as resolve6 } from "node:path";
3576
3609
  var EXTENSIONS = ["", ".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", "/index.ts", "/index.js"];
3577
- var SPEC_TSCONFIGS = ["tsconfig.spec.json", "tsconfig.app.json", "tsconfig.json"];
3578
- function pathsFor(workspaceRoot, moduleRoot) {
3610
+ function pathEntries(workspaceRoot) {
3611
+ const file = join15(workspaceRoot, "tsconfig.base.json");
3612
+ if (!existsSync13(file)) return [];
3613
+ let paths;
3579
3614
  try {
3580
- if (moduleRoot !== void 0) return effectivePaths(moduleRoot, workspaceRoot, SPEC_TSCONFIGS);
3581
- const file = join14(workspaceRoot, WORKSPACE_TSCONFIG);
3582
- if (!existsSync12(file)) return void 0;
3583
- const found = chainPaths(file);
3584
- return found && { ...found, fromWorkspaceFallback: false };
3615
+ paths = parseJsonc(
3616
+ readFileSync13(file, "utf8"),
3617
+ "tsconfig.base.json"
3618
+ )?.compilerOptions?.paths;
3585
3619
  } catch {
3586
- return void 0;
3620
+ return [];
3587
3621
  }
3588
- }
3589
- function pathEntries(workspaceRoot, moduleRoot) {
3590
- const found = pathsFor(workspaceRoot, moduleRoot);
3591
- if (found === void 0) return [];
3592
3622
  const entries = [];
3593
- for (const [key, targets] of Object.entries(found.paths)) {
3623
+ for (const [key, targets] of Object.entries(paths ?? {})) {
3594
3624
  const target = targets[0];
3595
3625
  if (target === void 0) continue;
3596
3626
  const wildcard = key.endsWith("/*") && target.endsWith("/*");
3597
3627
  entries.push({
3598
3628
  key: wildcard ? key.slice(0, -2) : key,
3599
- target: resolve6(found.baseDirectory, wildcard ? target.slice(0, -2) : target),
3629
+ target: resolve6(workspaceRoot, wildcard ? target.slice(0, -2) : target),
3600
3630
  wildcard
3601
3631
  });
3602
3632
  }
3603
3633
  return entries.sort((left, right) => right.target.length - left.target.length);
3604
3634
  }
3605
- function workspaceSpecifier(workspaceRoot, file, moduleRoot) {
3635
+ function workspaceSpecifier(workspaceRoot, file) {
3606
3636
  const absolute = resolve6(file);
3607
- for (const entry of pathEntries(workspaceRoot, moduleRoot)) {
3637
+ for (const entry of pathEntries(workspaceRoot)) {
3608
3638
  if (!entry.wildcard) {
3609
3639
  if (EXTENSIONS.some((extension) => `${entry.target}${extension}` === absolute)) {
3610
3640
  return entry.key;
@@ -3632,12 +3662,12 @@ function requireCall(source, node) {
3632
3662
  }
3633
3663
  function importable(written, fileName, workspaceRoot) {
3634
3664
  if (!written.startsWith(".")) return written;
3635
- const fileDir = dirname5(fileName);
3665
+ const fileDir = dirname6(fileName);
3636
3666
  const moduleRoot = findModuleRoot(fileDir, workspaceRoot) ?? fileDir;
3637
3667
  const target = resolve7(fileDir, written);
3638
3668
  if (target.startsWith(`${moduleRoot}/`)) return written;
3639
3669
  if (workspaceRoot === void 0) return void 0;
3640
- return workspaceSpecifier(workspaceRoot, target, moduleRoot);
3670
+ return workspaceSpecifier(workspaceRoot, target);
3641
3671
  }
3642
3672
  function statement(fileName, source, node, specifier, written) {
3643
3673
  if (node.type === "ExpressionStatement") return `import '${specifier}'`;
@@ -3748,16 +3778,16 @@ function rewriteMockFactoryGenerics(source, program) {
3748
3778
  }
3749
3779
 
3750
3780
  // src/roles/test/codemod/spy-on-internal-call.ts
3751
- import { readFileSync as readFileSync13, statSync as statSync3 } from "node:fs";
3752
- import { dirname as dirname6, join as join15, relative as relative3, resolve as resolve8 } from "node:path";
3781
+ import { readFileSync as readFileSync14, statSync as statSync3 } from "node:fs";
3782
+ import { dirname as dirname7, join as join16, relative as relative3, resolve as resolve8 } from "node:path";
3753
3783
  import { parseSync as parseSync7 } from "oxc-parser";
3754
3784
  function resolveRelative2(fromFile, specifier) {
3755
3785
  if (!specifier.startsWith(".")) return void 0;
3756
- const base = resolve8(dirname6(fromFile), specifier);
3786
+ const base = resolve8(dirname7(fromFile), specifier);
3757
3787
  const candidates = [
3758
3788
  base,
3759
3789
  ...RESOLVABLE_EXTENSIONS.map((extension) => `${base}${extension}`),
3760
- ...RESOLVABLE_EXTENSIONS.map((extension) => join15(base, `index${extension}`))
3790
+ ...RESOLVABLE_EXTENSIONS.map((extension) => join16(base, `index${extension}`))
3761
3791
  ];
3762
3792
  for (const candidate of candidates) {
3763
3793
  try {
@@ -3769,7 +3799,7 @@ function resolveRelative2(fromFile, specifier) {
3769
3799
  }
3770
3800
  function read(path) {
3771
3801
  try {
3772
- return readFileSync13(path, "utf8");
3802
+ return readFileSync14(path, "utf8");
3773
3803
  } catch {
3774
3804
  return void 0;
3775
3805
  }
@@ -3890,7 +3920,7 @@ function importOf(program, local) {
3890
3920
  return void 0;
3891
3921
  }
3892
3922
  function respell(fromFile, target) {
3893
- const path = relative3(dirname6(fromFile), target).replaceAll("\\", "/").replace(/\.(?:m|c)?[jt]sx?$/, "").replace(/\/index$/, "");
3923
+ const path = relative3(dirname7(fromFile), target).replaceAll("\\", "/").replace(/\.(?:m|c)?[jt]sx?$/, "").replace(/\/index$/, "");
3894
3924
  return path.startsWith(".") ? path : `./${path}`;
3895
3925
  }
3896
3926
  function namesInUse2(program) {
@@ -4203,7 +4233,7 @@ function migrateTestFile(fileName, source, defaultImported = /* @__PURE__ */ new
4203
4233
  fileName,
4204
4234
  source,
4205
4235
  beforeStatic,
4206
- findWorkspaceRoot(dirname7(fileName))
4236
+ findWorkspaceRoot(dirname8(fileName))
4207
4237
  );
4208
4238
  source = statics.source;
4209
4239
  const original = statics.rewritten === 0 ? beforeStatic : parse3(fileName, source);
@@ -4324,7 +4354,7 @@ function migrateTestFile(fileName, source, defaultImported = /* @__PURE__ */ new
4324
4354
  */
4325
4355
  ...statics.refusals.map((specifier) => ({
4326
4356
  binding: specifier,
4327
- reason: `\`require('${specifier}')\` reaches another project, and no \`paths\` entry covers it, in this module's tsconfig or in \`tsconfig.base.json\`. A static import of a relative path is refused by nx, and \`await import()\` would make it a dynamic dependency, which forbids every static import of that project across this module. Add a \`paths\` entry for it, or move the file inside this project.`
4357
+ reason: `\`require('${specifier}')\` reaches another project, and \`tsconfig.base.json\` declares no path for it. A static import of a relative path is refused by nx, and \`await import()\` would make it a dynamic dependency, which forbids every static import of that project across this module. Add a \`paths\` entry for it, or move the file inside this project.`
4328
4358
  })),
4329
4359
  ...fakeTimers.refusals,
4330
4360
  ...hoist.refusals,
@@ -4341,8 +4371,8 @@ function migrateTestFile(fileName, source, defaultImported = /* @__PURE__ */ new
4341
4371
  }
4342
4372
 
4343
4373
  // src/roles/test/codemod/test-support-files.ts
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";
4374
+ import { existsSync as existsSync14, readFileSync as readFileSync15, readdirSync as readdirSync3, statSync as statSync4 } from "node:fs";
4375
+ import { dirname as dirname9, join as join17, relative as relative4, resolve as resolve9 } from "node:path";
4346
4376
  var THE_SHIM_CANNOT_ANSWER = [/\brequire\s*\(/, /\bjest\.(?:fn|Mock|SpyInstance)\s*</];
4347
4377
  var SKIPPED = /* @__PURE__ */ new Set(["node_modules", "dist", "coverage", ".git", ".vite"]);
4348
4378
  var TEST_FILE2 = /[.-](spec|test)\.[cm]?[jt]sx?$/;
@@ -4362,14 +4392,14 @@ function relativeSpecifiers2(source) {
4362
4392
  return found;
4363
4393
  }
4364
4394
  function resolveSpecifier(fromFile, specifier) {
4365
- const base = resolve9(dirname8(fromFile), specifier);
4366
- if (existsSync13(base) && statSync4(base).isFile()) return base;
4395
+ const base = resolve9(dirname9(fromFile), specifier);
4396
+ if (existsSync14(base) && statSync4(base).isFile()) return base;
4367
4397
  for (const extension of EXTENSIONS2) {
4368
- if (existsSync13(`${base}${extension}`)) return `${base}${extension}`;
4398
+ if (existsSync14(`${base}${extension}`)) return `${base}${extension}`;
4369
4399
  }
4370
4400
  for (const extension of EXTENSIONS2) {
4371
- const index = join16(base, `index${extension}`);
4372
- if (existsSync13(index)) return index;
4401
+ const index = join17(base, `index${extension}`);
4402
+ if (existsSync14(index)) return index;
4373
4403
  }
4374
4404
  return void 0;
4375
4405
  }
@@ -4386,9 +4416,9 @@ function moduleSources(cwd) {
4386
4416
  }
4387
4417
  for (const entry of entries) {
4388
4418
  if (entry.isDirectory()) {
4389
- if (!SKIPPED.has(entry.name)) stack.push(join16(dir, entry.name));
4419
+ if (!SKIPPED.has(entry.name)) stack.push(join17(dir, entry.name));
4390
4420
  } else if (SOURCE_FILE.test(entry.name)) {
4391
- found.push(join16(dir, entry.name));
4421
+ found.push(join17(dir, entry.name));
4392
4422
  }
4393
4423
  }
4394
4424
  }
@@ -4396,7 +4426,7 @@ function moduleSources(cwd) {
4396
4426
  }
4397
4427
  function read2(path) {
4398
4428
  try {
4399
- return readFileSync14(path, "utf8");
4429
+ return readFileSync15(path, "utf8");
4400
4430
  } catch {
4401
4431
  return void 0;
4402
4432
  }
@@ -4408,7 +4438,7 @@ function setupFilesInside(cwd, named) {
4408
4438
  const full = resolve9(cwd, withoutToken);
4409
4439
  const inside = relative4(cwd, full);
4410
4440
  if (inside.startsWith("..") || inside === "") continue;
4411
- if (!existsSync13(full)) continue;
4441
+ if (!existsSync14(full)) continue;
4412
4442
  kept.push(inside.replaceAll("\\", "/"));
4413
4443
  }
4414
4444
  return kept;
@@ -4454,7 +4484,7 @@ function parse4(fileName, source) {
4454
4484
  }
4455
4485
  function read3(path) {
4456
4486
  try {
4457
- return readFileSync15(path, "utf8");
4487
+ return readFileSync16(path, "utf8");
4458
4488
  } catch {
4459
4489
  return void 0;
4460
4490
  }
@@ -4472,7 +4502,7 @@ function defaultImportedSpecifiers(cwd) {
4472
4502
  }
4473
4503
  for (const entry of entries) {
4474
4504
  if (SKIPPED2.has(entry)) continue;
4475
- const path = join17(dir, entry);
4505
+ const path = join18(dir, entry);
4476
4506
  let directory;
4477
4507
  try {
4478
4508
  directory = statSync5(path).isDirectory();
@@ -4504,13 +4534,13 @@ function migrateModuleTests(cwd, setupFiles = []) {
4504
4534
  const defaultImported = defaultImportedSpecifiers(cwd);
4505
4535
  const asyncHelpers = /* @__PURE__ */ new Set();
4506
4536
  for (const relative8 of listTestSupportFiles(cwd, setupFiles)) {
4507
- const source = read3(join17(cwd, relative8));
4537
+ const source = read3(join18(cwd, relative8));
4508
4538
  if (source === void 0) {
4509
4539
  blockers.push({ file: relative8, reason: "this file could not be read" });
4510
4540
  continue;
4511
4541
  }
4512
4542
  const migrated = migrateTestFile(
4513
- join17(cwd, relative8),
4543
+ join18(cwd, relative8),
4514
4544
  source,
4515
4545
  defaultImported,
4516
4546
  /* @__PURE__ */ new Set(),
@@ -4529,8 +4559,8 @@ function migrateModuleTests(cwd, setupFiles = []) {
4529
4559
  const renamedTo = vitestSupportName(relative8);
4530
4560
  if (!migrated.changed && renamedTo === relative8) continue;
4531
4561
  if (renamedTo !== relative8) operations.push({ kind: "delete", path: relative8 });
4532
- const before = parse4(join17(cwd, relative8), source);
4533
- const after = parse4(join17(cwd, relative8), migrated.source);
4562
+ const before = parse4(join18(cwd, relative8), source);
4563
+ const after = parse4(join18(cwd, relative8), migrated.source);
4534
4564
  if (before !== void 0 && after !== void 0) {
4535
4565
  const wasAsync = asyncFunctionNames(before);
4536
4566
  for (const name of asyncFunctionNames(after)) {
@@ -4539,17 +4569,17 @@ function migrateModuleTests(cwd, setupFiles = []) {
4539
4569
  }
4540
4570
  files++;
4541
4571
  renamed += migrated.renamed;
4542
- const contents = /\bvi\./.test(migrated.source) ? injectViImport(join17(cwd, renamedTo), migrated.source) : migrated.source;
4572
+ const contents = /\bvi\./.test(migrated.source) ? injectViImport(join18(cwd, renamedTo), migrated.source) : migrated.source;
4543
4573
  operations.push({ kind: "write", path: renamedTo, contents });
4544
4574
  }
4545
4575
  for (const relative8 of listTestFiles(cwd)) {
4546
- const source = read3(join17(cwd, relative8));
4576
+ const source = read3(join18(cwd, relative8));
4547
4577
  if (source === void 0) {
4548
4578
  blockers.push({ file: relative8, reason: "this file could not be read" });
4549
4579
  continue;
4550
4580
  }
4551
4581
  const migrated = migrateTestFile(
4552
- join17(cwd, relative8),
4582
+ join18(cwd, relative8),
4553
4583
  source,
4554
4584
  defaultImported,
4555
4585
  asyncHelpers,
@@ -4583,8 +4613,8 @@ function migrateModuleTests(cwd, setupFiles = []) {
4583
4613
  }
4584
4614
 
4585
4615
  // src/roles/test/nest/generate-config.ts
4586
- import { readdirSync as readdirSync5, readFileSync as readFileSync16, statSync as statSync6 } from "node:fs";
4587
- import { join as join18, relative as relative5 } from "node:path";
4616
+ import { readdirSync as readdirSync5, readFileSync as readFileSync17, statSync as statSync6 } from "node:fs";
4617
+ import { join as join19, relative as relative5 } from "node:path";
4588
4618
  import { parseSync as parseSync10 } from "oxc-parser";
4589
4619
  var NEST_TEST_PRESET_SPECIFIER = "@hublo/sentinel/test/nest";
4590
4620
  var REACT_TEST_PRESET_SPECIFIER = "@hublo/sentinel/test/react";
@@ -4631,7 +4661,7 @@ function readModuleTraits(cwd) {
4631
4661
  }
4632
4662
  for (const entry of entries) {
4633
4663
  if (SKIPPED3.has(entry)) continue;
4634
- const path = join18(dir, entry);
4664
+ const path = join19(dir, entry);
4635
4665
  let directory;
4636
4666
  try {
4637
4667
  directory = statSync6(path).isDirectory();
@@ -4645,7 +4675,7 @@ function readModuleTraits(cwd) {
4645
4675
  if (!/\.tsx?$/.test(entry)) continue;
4646
4676
  let source;
4647
4677
  try {
4648
- source = readFileSync16(path, "utf8");
4678
+ source = readFileSync17(path, "utf8");
4649
4679
  } catch {
4650
4680
  continue;
4651
4681
  }
@@ -4786,8 +4816,8 @@ ${overrides.join("\n")}
4786
4816
  }
4787
4817
 
4788
4818
  // src/roles/test/nest/read-jest-config.ts
4789
- import { existsSync as existsSync14, readFileSync as readFileSync17 } from "node:fs";
4790
- import { join as join19 } from "node:path";
4819
+ import { existsSync as existsSync15, readFileSync as readFileSync18 } from "node:fs";
4820
+ import { join as join20 } from "node:path";
4791
4821
  var CARRIED = [
4792
4822
  "testEnvironment",
4793
4823
  "coverageDirectory",
@@ -4977,7 +5007,7 @@ function extendedConfig(source, cwd) {
4977
5007
  (name) => name.replace(/^\.\//, "")
4978
5008
  );
4979
5009
  const file = candidates.find(
4980
- (name) => /^jest[\w.-]*\.(ts|js)$/.test(name) && existsSync14(join19(cwd, name))
5010
+ (name) => /^jest[\w.-]*\.(ts|js)$/.test(name) && existsSync15(join20(cwd, name))
4981
5011
  );
4982
5012
  if (file === void 0) continue;
4983
5013
  if (!new RegExp(String.raw`\{\s*\.\.\.${binding}\b`).test(source)) continue;
@@ -5004,11 +5034,11 @@ function sideEffects(source, extended) {
5004
5034
  return found;
5005
5035
  }
5006
5036
  function readJestConfig(cwd, named) {
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;
5037
+ const file = named ?? JEST_CONFIG_FILES.find((name) => existsSync15(join20(cwd, name)));
5038
+ if (file === void 0 || !existsSync15(join20(cwd, file))) return void 0;
5009
5039
  let source;
5010
5040
  try {
5011
- source = readFileSync17(join19(cwd, file), "utf8");
5041
+ source = readFileSync18(join20(cwd, file), "utf8");
5012
5042
  } catch {
5013
5043
  return { file, refusals: [`${file} could not be read`], notes: [] };
5014
5044
  }
@@ -5089,8 +5119,8 @@ function readJestConfig(cwd, named) {
5089
5119
  }
5090
5120
 
5091
5121
  // src/roles/test/nest/run-modes.ts
5092
- import { existsSync as existsSync15 } from "node:fs";
5093
- import { basename as basename2, join as join20 } from "node:path";
5122
+ import { existsSync as existsSync16 } from "node:fs";
5123
+ import { basename as basename2, join as join21 } from "node:path";
5094
5124
  var JEST_EXECUTOR = "@nx/jest:jest";
5095
5125
  var PRIMARY_CONFIG_FILE = "vitest.config.mts";
5096
5126
  var PRIMARY_TARGET = "test";
@@ -5111,7 +5141,7 @@ function runModes(cwd, fallback) {
5111
5141
  const jestConfig = entry.options?.jestConfig;
5112
5142
  if (jestConfig === void 0) continue;
5113
5143
  const name = configName(jestConfig);
5114
- if (!existsSync15(join20(cwd, name))) continue;
5144
+ if (!existsSync16(join21(cwd, name))) continue;
5115
5145
  declared.push({
5116
5146
  target,
5117
5147
  jestConfig: name,
@@ -5135,16 +5165,260 @@ function runModes(cwd, fallback) {
5135
5165
  );
5136
5166
  }
5137
5167
 
5168
+ // src/roles/test/written-file-formatter.ts
5169
+ import { existsSync as existsSync18 } from "node:fs";
5170
+ import { dirname as dirname11, join as join24 } from "node:path";
5171
+
5172
+ // src/roles/format/read-adoption.ts
5173
+ import { existsSync as existsSync17, readFileSync as readFileSync19 } from "node:fs";
5174
+ import { join as join22 } from "node:path";
5175
+
5176
+ // src/roles/format/config-policy.ts
5177
+ var FORMAT_CONFIG_FILE = ".oxfmtrc.json";
5178
+ var FORMAT_SCRIPT_NAME = "format";
5179
+ var PROVENANCE_KEY = "$sentinel";
5180
+ var PERMITTED_LOCAL_KEYS = [
5181
+ "useTabs",
5182
+ "tabWidth",
5183
+ "printWidth",
5184
+ "semi",
5185
+ "singleQuote",
5186
+ "jsxSingleQuote",
5187
+ "trailingComma",
5188
+ "quoteProps",
5189
+ "bracketSpacing",
5190
+ "bracketSameLine",
5191
+ "arrowParens",
5192
+ "endOfLine",
5193
+ "objectWrap",
5194
+ "proseWrap",
5195
+ "experimentalOperatorPosition"
5196
+ ];
5197
+ var ALWAYS_LOCAL_KEYS = ["ignorePatterns", "overrides"];
5198
+ var OWNED_WHEN_SET_KEYS = ["sortImports"];
5199
+ var FORMAT_DEFAULT_IGNORES = ["**/*.toml"];
5200
+ var PRETTIER_CONFIG_FILES = [
5201
+ ".prettierrc",
5202
+ ".prettierrc.json",
5203
+ ".prettierrc.json5",
5204
+ ".prettierrc.yml",
5205
+ ".prettierrc.yaml",
5206
+ ".prettierrc.js",
5207
+ ".prettierrc.cjs",
5208
+ ".prettierrc.mjs",
5209
+ "prettier.config.js",
5210
+ "prettier.config.cjs",
5211
+ "prettier.config.mjs"
5212
+ ];
5213
+ function formatTargets() {
5214
+ return {
5215
+ [FORMAT_SCRIPT_NAME]: {
5216
+ cache: true,
5217
+ inputs: ["default", `{projectRoot}/${FORMAT_CONFIG_FILE}`]
5218
+ },
5219
+ [`${FORMAT_SCRIPT_NAME}:fix`]: { cache: false }
5220
+ };
5221
+ }
5222
+
5223
+ // src/roles/format/presets/base.json
5224
+ var base_default = {
5225
+ printWidth: 80,
5226
+ semi: false,
5227
+ singleQuote: true,
5228
+ trailingComma: "all",
5229
+ sortPackageJson: false,
5230
+ sortImports: false
5231
+ };
5232
+
5233
+ // src/roles/format/presets/nest-imports.json
5234
+ var nest_imports_default = {
5235
+ customGroups: [
5236
+ {
5237
+ groupName: "workspace",
5238
+ elementNamePattern: ["@hublo/**", "@shared/**", "@front/**", "@network/**"]
5239
+ }
5240
+ ],
5241
+ groups: ["builtin", "external", "workspace", ["parent", "index"], "sibling"],
5242
+ newlinesBetween: true,
5243
+ order: "asc",
5244
+ ignoreCase: false
5245
+ };
5246
+
5247
+ // src/roles/format/preset-data.ts
5248
+ var FORMAT_PRESETS = ["base", "svelte", "nest"];
5249
+ function hasFormatPreset(name) {
5250
+ return FORMAT_PRESETS.includes(name);
5251
+ }
5252
+ function formatPresetName(declared) {
5253
+ if (declared === "svelte") return "svelte";
5254
+ if (declared === "nest") return "nest";
5255
+ return "base";
5256
+ }
5257
+ function formatPresetFor(preset) {
5258
+ const base = base_default;
5259
+ const name = formatPresetName(preset);
5260
+ if (name === "svelte") return { ...base, svelte: true };
5261
+ if (name === "nest") return { ...base, sortImports: nest_imports_default };
5262
+ return base;
5263
+ }
5264
+
5265
+ // src/roles/format/read-adoption.ts
5266
+ var NOT_ADOPTED = (configFile, unreadable = null) => ({
5267
+ configFile,
5268
+ preset: null,
5269
+ adopted: false,
5270
+ conformant: false,
5271
+ drift: [],
5272
+ local: {},
5273
+ presetVersion: null,
5274
+ effective: {},
5275
+ unreadable
5276
+ });
5277
+ function sameValue(a, b) {
5278
+ return JSON.stringify(a) === JSON.stringify(b);
5279
+ }
5280
+ function readFormatAdoption(cwd) {
5281
+ const path = join22(cwd, FORMAT_CONFIG_FILE);
5282
+ if (!existsSync17(path)) return NOT_ADOPTED(null);
5283
+ let parsed;
5284
+ try {
5285
+ parsed = parseJsonc(readFileSync19(path, "utf8"), FORMAT_CONFIG_FILE);
5286
+ } catch (error) {
5287
+ const reason = error instanceof Error ? error.message : String(error);
5288
+ return NOT_ADOPTED(FORMAT_CONFIG_FILE, `${FORMAT_CONFIG_FILE} could not be parsed (${reason})`);
5289
+ }
5290
+ const provenance = parsed[PROVENANCE_KEY];
5291
+ if (!provenance || typeof provenance.preset !== "string") return NOT_ADOPTED(FORMAT_CONFIG_FILE);
5292
+ if (!hasFormatPreset(provenance.preset)) {
5293
+ return NOT_ADOPTED(
5294
+ FORMAT_CONFIG_FILE,
5295
+ `${FORMAT_CONFIG_FILE} declares the format preset "${provenance.preset}", which sentinel does not ship (shipped: ${FORMAT_PRESETS.join(", ")}). Re-run \`sentinel --init --format\`.`
5296
+ );
5297
+ }
5298
+ const declaredLocal = Array.isArray(provenance.local) ? provenance.local : [];
5299
+ const preset = formatPresetFor(provenance.preset);
5300
+ const drift = [];
5301
+ const local = {};
5302
+ for (const [key, expected] of Object.entries(preset)) {
5303
+ if (declaredLocal.includes(key)) {
5304
+ local[key] = parsed[key];
5305
+ continue;
5306
+ }
5307
+ if (!(key in parsed) || !sameValue(parsed[key], expected)) drift.push(key);
5308
+ }
5309
+ for (const key of declaredLocal) {
5310
+ if (!(key in preset)) local[key] = parsed[key];
5311
+ }
5312
+ for (const key of ALWAYS_LOCAL_KEYS) {
5313
+ if (key in parsed) local[key] = parsed[key];
5314
+ }
5315
+ return {
5316
+ configFile: FORMAT_CONFIG_FILE,
5317
+ preset: provenance.preset,
5318
+ adopted: true,
5319
+ conformant: drift.length === 0,
5320
+ drift,
5321
+ local,
5322
+ presetVersion: typeof provenance.version === "string" ? provenance.version : null,
5323
+ effective: parsed,
5324
+ unreadable: null
5325
+ };
5326
+ }
5327
+
5328
+ // src/roles/format/resolve-oxfmt.ts
5329
+ import { readFileSync as readFileSync20 } from "node:fs";
5330
+ import { createRequire as createRequire4 } from "node:module";
5331
+ import { dirname as dirname10, join as join23 } from "node:path";
5332
+ function resolveOxfmt(cwd) {
5333
+ return resolveBin(cwd, "oxfmt") ?? binFromOwnInstall("oxfmt", "oxfmt");
5334
+ }
5335
+ function oxfmtRejects(key, value) {
5336
+ const schema = configSchema();
5337
+ const property = schema?.properties?.[key];
5338
+ if (!property) return false;
5339
+ const definition = resolveRef(schema, property);
5340
+ if (Array.isArray(definition.enum)) return !definition.enum.includes(value);
5341
+ if (definition.type === "boolean") return typeof value !== "boolean";
5342
+ if (definition.type === "integer" || definition.type === "number")
5343
+ return typeof value !== "number";
5344
+ return false;
5345
+ }
5346
+ function resolveRef(schema, node) {
5347
+ const ref = node.$ref ?? node.allOf?.[0]?.$ref;
5348
+ const name = ref?.startsWith("#/definitions/") ? ref.slice("#/definitions/".length) : void 0;
5349
+ return (name ? schema.definitions?.[name] : void 0) ?? node;
5350
+ }
5351
+ var cachedSchema;
5352
+ function configSchema() {
5353
+ if (cachedSchema !== void 0) return cachedSchema ?? void 0;
5354
+ cachedSchema = readConfigSchema() ?? null;
5355
+ return cachedSchema ?? void 0;
5356
+ }
5357
+ function readConfigSchema() {
5358
+ try {
5359
+ const manifest = createRequire4(import.meta.url).resolve("oxfmt/package.json");
5360
+ const schemaPath = join23(dirname10(manifest), "configuration_schema.json");
5361
+ return JSON.parse(readFileSync20(schemaPath, "utf8"));
5362
+ } catch {
5363
+ return void 0;
5364
+ }
5365
+ }
5366
+
5367
+ // src/roles/test/written-file-formatter.ts
5368
+ var PRETTIER_CONFIGS = [
5369
+ ".prettierrc",
5370
+ ".prettierrc.json",
5371
+ ".prettierrc.json5",
5372
+ ".prettierrc.yaml",
5373
+ ".prettierrc.yml",
5374
+ ".prettierrc.js",
5375
+ ".prettierrc.cjs",
5376
+ ".prettierrc.mjs",
5377
+ ".prettierrc.toml",
5378
+ "prettier.config.js",
5379
+ "prettier.config.cjs",
5380
+ "prettier.config.mjs"
5381
+ ];
5382
+ function prettierConfigFrom(cwd) {
5383
+ let dir = cwd;
5384
+ for (; ; ) {
5385
+ for (const name of PRETTIER_CONFIGS) {
5386
+ if (existsSync18(join24(dir, name))) return join24(dir, name);
5387
+ }
5388
+ const parent = dirname11(dir);
5389
+ if (parent === dir) return void 0;
5390
+ dir = parent;
5391
+ }
5392
+ }
5393
+ function writtenFileFormatter(cwd) {
5394
+ if (readFormatAdoption(cwd).configFile !== null) {
5395
+ const oxfmt = resolveOxfmt(cwd);
5396
+ if (oxfmt !== void 0) {
5397
+ return { bin: oxfmt, args: ["--write"], origin: "this module's own oxfmt config" };
5398
+ }
5399
+ }
5400
+ const config = prettierConfigFrom(cwd);
5401
+ const prettier = resolveBin(cwd, "prettier");
5402
+ if (config !== void 0 && prettier !== void 0) {
5403
+ return {
5404
+ bin: prettier,
5405
+ args: ["--write", "--log-level", "warn"],
5406
+ origin: `the workspace's Prettier`
5407
+ };
5408
+ }
5409
+ return void 0;
5410
+ }
5411
+
5138
5412
  // src/roles/test/jest-migration.ts
5139
5413
  var SPEC_TSCONFIG = "tsconfig.spec.json";
5140
5414
  var VITEST_GLOBAL_TYPES = "vitest/globals";
5141
5415
  function specTypesOperation(cwd) {
5142
- const path = join21(cwd, SPEC_TSCONFIG);
5143
- if (!existsSync16(path)) return void 0;
5416
+ const path = join25(cwd, SPEC_TSCONFIG);
5417
+ if (!existsSync19(path)) return void 0;
5144
5418
  let config;
5145
5419
  try {
5146
5420
  config = parseJsonc(
5147
- readFileSync18(path, "utf8"),
5421
+ readFileSync21(path, "utf8"),
5148
5422
  SPEC_TSCONFIG
5149
5423
  );
5150
5424
  } catch {
@@ -5163,12 +5437,12 @@ function specTypesOperation(cwd) {
5163
5437
  };
5164
5438
  }
5165
5439
  function specTypesCleanupOperation(cwd) {
5166
- const path = join21(cwd, SPEC_TSCONFIG);
5167
- if (!existsSync16(path)) return void 0;
5440
+ const path = join25(cwd, SPEC_TSCONFIG);
5441
+ if (!existsSync19(path)) return void 0;
5168
5442
  let config;
5169
5443
  try {
5170
5444
  config = parseJsonc(
5171
- readFileSync18(path, "utf8"),
5445
+ readFileSync21(path, "utf8"),
5172
5446
  SPEC_TSCONFIG
5173
5447
  );
5174
5448
  } catch {
@@ -5186,9 +5460,9 @@ function specTypesCleanupOperation(cwd) {
5186
5460
  }
5187
5461
  function shippedTypesPath(cwd, declaration) {
5188
5462
  try {
5189
- const manifest = createRequire3(join21(cwd, "noop.cjs")).resolve("@hublo/sentinel/package.json");
5190
- const file = join21(dirname9(manifest), declaration);
5191
- if (existsSync16(file)) {
5463
+ const manifest = createRequire5(join25(cwd, "noop.cjs")).resolve("@hublo/sentinel/package.json");
5464
+ const file = join25(dirname12(manifest), declaration);
5465
+ if (existsSync19(file)) {
5192
5466
  const path = relative6(cwd, file);
5193
5467
  return path.startsWith(".") ? path : `./${path}`;
5194
5468
  }
@@ -5207,7 +5481,7 @@ function helpersStillCallingJest(cwd) {
5207
5481
  return;
5208
5482
  }
5209
5483
  for (const entry of entries) {
5210
- const path = join21(dir, entry.name);
5484
+ const path = join25(dir, entry.name);
5211
5485
  if (entry.isDirectory()) {
5212
5486
  if (!skip.has(entry.name)) walk2(path);
5213
5487
  continue;
@@ -5217,7 +5491,7 @@ function helpersStillCallingJest(cwd) {
5217
5491
  if (/^(jest|vitest)\./.test(entry.name)) continue;
5218
5492
  let source;
5219
5493
  try {
5220
- source = readFileSync18(path, "utf8");
5494
+ source = readFileSync21(path, "utf8");
5221
5495
  } catch {
5222
5496
  continue;
5223
5497
  }
@@ -5254,7 +5528,7 @@ function tsconfigFileListOperations(cwd) {
5254
5528
  let config;
5255
5529
  try {
5256
5530
  config = parseJsonc(
5257
- readFileSync18(join21(cwd, name), "utf8"),
5531
+ readFileSync21(join25(cwd, name), "utf8"),
5258
5532
  name
5259
5533
  );
5260
5534
  } catch {
@@ -5669,12 +5943,12 @@ function plan(context) {
5669
5943
  }
5670
5944
 
5671
5945
  // src/roles/test/written-file-linter.ts
5672
- import { existsSync as existsSync21 } from "node:fs";
5673
- import { join as join27 } from "node:path";
5946
+ import { existsSync as existsSync24 } from "node:fs";
5947
+ import { join as join31 } from "node:path";
5674
5948
 
5675
5949
  // src/roles/lint/module-baseline.ts
5676
- import { existsSync as existsSync17, readFileSync as readFileSync19 } from "node:fs";
5677
- import { join as join22 } from "node:path";
5950
+ import { existsSync as existsSync20, readFileSync as readFileSync22 } from "node:fs";
5951
+ import { join as join26 } from "node:path";
5678
5952
 
5679
5953
  // src/roles/lint/oxlint-rule-owners.json
5680
5954
  var oxlint_rule_owners_default = {
@@ -6416,10 +6690,10 @@ function describeHolds(holds) {
6416
6690
  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`;
6417
6691
  }
6418
6692
  function heldRules(cwd) {
6419
- const path = join22(cwd, LINT_BASELINE_FILE);
6420
- if (!existsSync17(path)) return [];
6693
+ const path = join26(cwd, LINT_BASELINE_FILE);
6694
+ if (!existsSync20(path)) return [];
6421
6695
  try {
6422
- const parsed = parseJsonc(readFileSync19(path, "utf8"), LINT_BASELINE_FILE);
6696
+ const parsed = parseJsonc(readFileSync22(path, "utf8"), LINT_BASELINE_FILE);
6423
6697
  const scoped = (parsed.overrides ?? []).flatMap((override) => Object.keys(override.rules ?? {}));
6424
6698
  return [.../* @__PURE__ */ new Set([...Object.keys(parsed.rules ?? {}), ...scoped])];
6425
6699
  } catch {
@@ -6455,7 +6729,7 @@ var SENTINEL_LINT_PRESET = /@hublo\/sentinel\/(?:lint|oxlint)\/([a-z-]+)\.json$/
6455
6729
  function presetNameFromPath(preset) {
6456
6730
  return preset ? SENTINEL_LINT_PRESET.exec(preset)?.[1] ?? void 0 : void 0;
6457
6731
  }
6458
- var PERMITTED_LOCAL_KEYS = ["extends", "ignorePatterns"];
6732
+ var PERMITTED_LOCAL_KEYS2 = ["extends", "ignorePatterns"];
6459
6733
  var ESLINT_CONFIG_FILES = [
6460
6734
  "eslint.config.js",
6461
6735
  "eslint.config.mjs",
@@ -6467,12 +6741,12 @@ function lintTarget() {
6467
6741
  }
6468
6742
 
6469
6743
  // src/roles/lint/read-adoption.ts
6470
- import { readFileSync as readFileSync22 } from "node:fs";
6471
- import { join as join25 } from "node:path";
6744
+ import { readFileSync as readFileSync25 } from "node:fs";
6745
+ import { join as join29 } from "node:path";
6472
6746
 
6473
6747
  // src/core/config/read-adoption.ts
6474
- import { existsSync as existsSync19, readFileSync as readFileSync21 } from "node:fs";
6475
- import { join as join24 } from "node:path";
6748
+ import { existsSync as existsSync22, readFileSync as readFileSync24 } from "node:fs";
6749
+ import { join as join28 } from "node:path";
6476
6750
 
6477
6751
  // src/core/config/owned-keys.ts
6478
6752
  function presetOwnedKeys(config, permitted, presetSets) {
@@ -6487,12 +6761,12 @@ function localOnlyKeys(config, permitted, presetSets) {
6487
6761
  }
6488
6762
 
6489
6763
  // src/core/config/resolve-config-target.ts
6490
- import { existsSync as existsSync18, readFileSync as readFileSync20 } from "node:fs";
6491
- import { join as join23 } from "node:path";
6764
+ import { existsSync as existsSync21, readFileSync as readFileSync23 } from "node:fs";
6765
+ import { join as join27 } from "node:path";
6492
6766
  function readExtends(absolutePath) {
6493
6767
  let parsed;
6494
6768
  try {
6495
- parsed = parseJsonc(readFileSync20(absolutePath, "utf8"), absolutePath);
6769
+ parsed = parseJsonc(readFileSync23(absolutePath, "utf8"), absolutePath);
6496
6770
  } catch {
6497
6771
  return [];
6498
6772
  }
@@ -6506,8 +6780,8 @@ function resolveConfigTarget(moduleDir, { candidates, markers, fallback }) {
6506
6780
  let existing;
6507
6781
  let existingExtendsSomething = false;
6508
6782
  for (const candidate of candidates) {
6509
- const absolutePath = join23(moduleDir, candidate);
6510
- if (!existsSync18(absolutePath)) continue;
6783
+ const absolutePath = join27(moduleDir, candidate);
6784
+ if (!existsSync21(absolutePath)) continue;
6511
6785
  const chain = readExtends(absolutePath);
6512
6786
  if (existing === void 0) {
6513
6787
  existing = candidate;
@@ -6530,7 +6804,7 @@ function normaliseExtends(value) {
6530
6804
  }
6531
6805
  return [];
6532
6806
  }
6533
- var NOT_ADOPTED = (configFile, unreadable = null) => ({
6807
+ var NOT_ADOPTED2 = (configFile, unreadable = null) => ({
6534
6808
  configFile,
6535
6809
  preset: null,
6536
6810
  adopted: false,
@@ -6540,18 +6814,18 @@ var NOT_ADOPTED = (configFile, unreadable = null) => ({
6540
6814
  });
6541
6815
  function readAdoption(cwd, options) {
6542
6816
  const target = resolveConfigTarget(cwd, options);
6543
- if (target.reason === "none" || !existsSync19(join24(cwd, target.path))) {
6544
- return NOT_ADOPTED(target.reason === "none" ? null : target.path);
6817
+ if (target.reason === "none" || !existsSync22(join28(cwd, target.path))) {
6818
+ return NOT_ADOPTED2(target.reason === "none" ? null : target.path);
6545
6819
  }
6546
6820
  let parsed;
6547
6821
  try {
6548
- parsed = parseJsonc(readFileSync21(join24(cwd, target.path), "utf8"), target.path);
6822
+ parsed = parseJsonc(readFileSync24(join28(cwd, target.path), "utf8"), target.path);
6549
6823
  } catch (error) {
6550
6824
  const reason = error instanceof Error ? error.message : String(error);
6551
- return NOT_ADOPTED(target.path, `${target.path} could not be parsed (${reason})`);
6825
+ return NOT_ADOPTED2(target.path, `${target.path} could not be parsed (${reason})`);
6552
6826
  }
6553
6827
  const preset = normaliseExtends(parsed.extends).find((entry) => options.presetPattern.test(entry)) ?? null;
6554
- if (preset === null) return NOT_ADOPTED(target.path);
6828
+ if (preset === null) return NOT_ADOPTED2(target.path);
6555
6829
  const settings = options.settingsKey === null ? parsed : parsed[options.settingsKey];
6556
6830
  const owned = presetOwnedKeys(settings, options.permitted, options.presetOwns?.(preset));
6557
6831
  const drift = options.refineDrift !== void 0 && settings !== void 0 ? options.refineDrift(owned, settings, preset) : owned;
@@ -9211,7 +9485,7 @@ function readLintAdoption(cwd) {
9211
9485
  // Drift for lint is read from the TOP-LEVEL keys beyond `extends`, so the settings the
9212
9486
  // shared reader inspects are the config's own root rather than a nested options object.
9213
9487
  settingsKey: null,
9214
- permitted: PERMITTED_LOCAL_KEYS,
9488
+ permitted: PERMITTED_LOCAL_KEYS2,
9215
9489
  // `rules` and `overrides` are drift only when they CONFLICT with the preset, by the
9216
9490
  // criterion a re-init keeps or drops them by: a rule the preset does not name is the
9217
9491
  // module's addition, kept and listed by `--inspect`, not drift. A preset sentinel does not
@@ -9229,7 +9503,7 @@ function readModuleAdditions(cwd) {
9229
9503
  if (preset === void 0 || adoption.configFile === null) return NO_ADDITIONS;
9230
9504
  try {
9231
9505
  const config = parseJsonc(
9232
- readFileSync22(join25(cwd, adoption.configFile), "utf8"),
9506
+ readFileSync25(join29(cwd, adoption.configFile), "utf8"),
9233
9507
  adoption.configFile
9234
9508
  );
9235
9509
  if (typeof config !== "object" || config === null || Array.isArray(config)) {
@@ -9246,15 +9520,15 @@ function readModuleAdditions(cwd) {
9246
9520
  }
9247
9521
 
9248
9522
  // src/roles/lint/resolve-oxlint.ts
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";
9523
+ import { existsSync as existsSync23 } from "node:fs";
9524
+ import { createRequire as createRequire6 } from "node:module";
9525
+ import { delimiter as delimiter2, dirname as dirname13, join as join30 } from "node:path";
9252
9526
  import { fileURLToPath } from "node:url";
9253
9527
  var PACKAGE_OF = {
9254
9528
  oxlint: "oxlint",
9255
9529
  tsgolint: "oxlint-tsgolint"
9256
9530
  };
9257
- var require2 = createRequire4(import.meta.url);
9531
+ var require3 = createRequire6(import.meta.url);
9258
9532
  function resolveOxlint(cwd, name = "oxlint") {
9259
9533
  return resolveBin(cwd, name) ?? binFromOwnInstall(PACKAGE_OF[name], name);
9260
9534
  }
@@ -9264,7 +9538,7 @@ function canRunTypeAware(cwd) {
9264
9538
  function oxlintPath(cwd, env) {
9265
9539
  const shim = tsgolintShim(cwd);
9266
9540
  if (!shim) return env.PATH;
9267
- return [dirname10(shim), env.PATH].filter(Boolean).join(delimiter);
9541
+ return [dirname13(shim), env.PATH].filter(Boolean).join(delimiter2);
9268
9542
  }
9269
9543
  function tsgolintShim(cwd) {
9270
9544
  const fromModule = resolveBin(cwd, "tsgolint");
@@ -9272,19 +9546,19 @@ function tsgolintShim(cwd) {
9272
9546
  const candidates = [];
9273
9547
  for (const owner of ["oxlint-tsgolint", "oxlint"]) {
9274
9548
  try {
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"));
9549
+ const packageDir = dirname13(require3.resolve(`${owner}/package.json`));
9550
+ candidates.push(join30(packageDir, "node_modules", ".bin", "tsgolint"));
9551
+ candidates.push(join30(packageDir, "..", ".bin", "tsgolint"));
9278
9552
  } catch {
9279
9553
  }
9280
9554
  }
9281
9555
  try {
9282
- const ownRoot = dirname10(require2.resolve("@hublo/sentinel/package.json"));
9283
- candidates.push(join26(ownRoot, "node_modules", ".bin", "tsgolint"));
9556
+ const ownRoot = dirname13(require3.resolve("@hublo/sentinel/package.json"));
9557
+ candidates.push(join30(ownRoot, "node_modules", ".bin", "tsgolint"));
9284
9558
  } catch {
9285
- candidates.push(resolveBin(dirname10(fileURLToPath(import.meta.url)), "tsgolint") ?? "");
9559
+ candidates.push(resolveBin(dirname13(fileURLToPath(import.meta.url)), "tsgolint") ?? "");
9286
9560
  }
9287
- return candidates.find((candidate) => candidate !== "" && existsSync20(candidate));
9561
+ return candidates.find((candidate) => candidate !== "" && existsSync23(candidate));
9288
9562
  }
9289
9563
  function oxlintSearchPath(cwd) {
9290
9564
  return binSearchPath(cwd);
@@ -9298,7 +9572,7 @@ function writtenFileLinter(cwd) {
9298
9572
  return { bin: oxlint, args: ["--fix"], origin: "this module's own oxlint config" };
9299
9573
  }
9300
9574
  }
9301
- const config = ESLINT_CONFIG_FILES.map((name) => join27(cwd, name)).find((path) => existsSync21(path));
9575
+ const config = ESLINT_CONFIG_FILES.map((name) => join31(cwd, name)).find((path) => existsSync24(path));
9302
9576
  const eslint = resolveBin(cwd, "eslint");
9303
9577
  if (config !== void 0 && eslint !== void 0) {
9304
9578
  return {
@@ -9320,7 +9594,7 @@ var FORMATTABLE = /\.(m|c)?(j|t)sx?$|\.json$/;
9320
9594
  var FORMAT_BATCH = 25;
9321
9595
  function readIfPossible(path) {
9322
9596
  try {
9323
- return readFileSync23(path, "utf8");
9597
+ return readFileSync26(path, "utf8");
9324
9598
  } catch {
9325
9599
  return void 0;
9326
9600
  }
@@ -9446,12 +9720,12 @@ var VitestAdapter = class _VitestAdapter extends BaseAdapter {
9446
9720
  const linter = writtenFileLinter(ctx.cwd);
9447
9721
  if (linter === void 0) return;
9448
9722
  const workspaceRoot = findWorkspaceRoot(ctx.cwd) ?? ctx.cwd;
9449
- const fromRoot = (file) => relative7(workspaceRoot, join28(ctx.cwd, file));
9723
+ const fromRoot = (file) => relative7(workspaceRoot, join32(ctx.cwd, file));
9450
9724
  let unsettled = 0;
9451
9725
  const reverted = [];
9452
9726
  for (let at = 0; at < written.length; at += FORMAT_BATCH) {
9453
9727
  const batch = written.slice(at, at + FORMAT_BATCH);
9454
- const before = new Map(batch.map((file) => [file, readIfPossible(join28(ctx.cwd, file))]));
9728
+ const before = new Map(batch.map((file) => [file, readIfPossible(join32(ctx.cwd, file))]));
9455
9729
  const pass = spawnSync(linter.bin, [...linter.args, ...batch.map(fromRoot)], {
9456
9730
  cwd: workspaceRoot,
9457
9731
  encoding: "utf8"
@@ -9460,11 +9734,11 @@ var VitestAdapter = class _VitestAdapter extends BaseAdapter {
9460
9734
  for (const file of batch) {
9461
9735
  const was = before.get(file);
9462
9736
  if (was === void 0) continue;
9463
- const now = readIfPossible(join28(ctx.cwd, file));
9737
+ const now = readIfPossible(join32(ctx.cwd, file));
9464
9738
  if (now === void 0 || now === was) continue;
9465
9739
  const lost = lineLostByTheFixer(was, now);
9466
9740
  if (lost === void 0) continue;
9467
- writeFileSync2(join28(ctx.cwd, file), was);
9741
+ writeFileSync2(join32(ctx.cwd, file), was);
9468
9742
  reverted.push(`${file}: \`${lost.slice(0, 80)}\``);
9469
9743
  }
9470
9744
  }
@@ -9543,7 +9817,7 @@ var VitestAdapter = class _VitestAdapter extends BaseAdapter {
9543
9817
  metrics: { ..._VitestAdapter.NOTHING_TO_REPORT, error: "vitest not available" }
9544
9818
  };
9545
9819
  }
9546
- const out = join28(mkdtempSync3(join28(tmpdir3(), "sentinel-test-report-")), "vitest.json");
9820
+ const out = join32(mkdtempSync3(join32(tmpdir3(), "sentinel-test-report-")), "vitest.json");
9547
9821
  const { cwd: runFrom, options, env } = fromWorkspaceRoot(ctx.cwd, [], []);
9548
9822
  const result = spawnSync(bin, ["run", ...options, "--reporter=json", `--outputFile=${out}`], {
9549
9823
  cwd: runFrom,
@@ -9558,7 +9832,7 @@ var VitestAdapter = class _VitestAdapter extends BaseAdapter {
9558
9832
  metrics: { ..._VitestAdapter.NOTHING_TO_REPORT, error: result.error.message }
9559
9833
  };
9560
9834
  }
9561
- if (!existsSync22(out)) {
9835
+ if (!existsSync25(out)) {
9562
9836
  return {
9563
9837
  ok: false,
9564
9838
  code: 1,
@@ -9567,7 +9841,7 @@ var VitestAdapter = class _VitestAdapter extends BaseAdapter {
9567
9841
  }
9568
9842
  let parsed;
9569
9843
  try {
9570
- parsed = JSON.parse(readFileSync23(out, "utf8"));
9844
+ parsed = JSON.parse(readFileSync26(out, "utf8"));
9571
9845
  } catch {
9572
9846
  return {
9573
9847
  ok: false,
@@ -9690,8 +9964,26 @@ export {
9690
9964
  BaseAdapter,
9691
9965
  splitToolArgs,
9692
9966
  separateToolArgs,
9967
+ resolveBin,
9968
+ binFromOwnInstall,
9969
+ binSearchPath,
9970
+ scriptPath,
9693
9971
  nxTargetOperations,
9972
+ FORMAT_CONFIG_FILE,
9973
+ FORMAT_SCRIPT_NAME,
9974
+ PROVENANCE_KEY,
9975
+ PERMITTED_LOCAL_KEYS,
9976
+ ALWAYS_LOCAL_KEYS,
9977
+ OWNED_WHEN_SET_KEYS,
9978
+ FORMAT_DEFAULT_IGNORES,
9979
+ PRETTIER_CONFIG_FILES,
9980
+ formatTargets,
9981
+ formatPresetName,
9982
+ formatPresetFor,
9983
+ readFormatAdoption,
9694
9984
  rewriteToolchainImports,
9985
+ resolveOxfmt,
9986
+ oxfmtRejects,
9695
9987
  canonicalRuleName,
9696
9988
  describeRuleKey,
9697
9989
  LINT_BASELINE_FILE,
@@ -9732,6 +10024,8 @@ export {
9732
10024
  oxlintPath,
9733
10025
  oxlintSearchPath,
9734
10026
  walk,
10027
+ MEMBER_TYPES,
10028
+ writtenFileFormatter,
9735
10029
  RESOLVABLE_EXTENSIONS,
9736
10030
  readTestAdoption,
9737
10031
  resolveContext,