@maverickcer/env-cap 0.6.0 → 0.7.1

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 (137) hide show
  1. package/ADOPTION.md +144 -0
  2. package/AGENTS.md +146 -0
  3. package/CHANGELOG.md +449 -0
  4. package/CODE_OF_CONDUCT.md +124 -0
  5. package/CODE_REVIEW.md +200 -0
  6. package/CONTRIBUTING.md +131 -0
  7. package/GUIDE.md +1214 -0
  8. package/PROMPT.md +89 -0
  9. package/README.md +92 -200
  10. package/RELEASING.md +160 -0
  11. package/SECURITY.md +270 -0
  12. package/SUPPORT.md +76 -0
  13. package/VERSIONING.md +118 -0
  14. package/benchmarks/READING-BENCHMARKS.md +197 -0
  15. package/benchmarks/README.md +126 -0
  16. package/benchmarks/WRITING-BENCHMARKS.md +252 -0
  17. package/benchmarks/performance-buildtime/BENCHMARKS.md +889 -0
  18. package/benchmarks/performance-runtime/BENCHMARKS.md +1988 -0
  19. package/dist/.dts/_ipc/build-fs.d.ts +53 -0
  20. package/dist/.dts/_ipc/build-fs.d.ts.map +1 -0
  21. package/dist/.dts/_ipc/compiler-api.d.ts +17 -0
  22. package/dist/.dts/_ipc/compiler-api.d.ts.map +1 -0
  23. package/dist/.dts/_ipc/display-path.d.ts +27 -0
  24. package/dist/.dts/_ipc/display-path.d.ts.map +1 -0
  25. package/dist/.dts/_ipc/generated-banner.d.ts +58 -0
  26. package/dist/.dts/_ipc/generated-banner.d.ts.map +1 -0
  27. package/dist/.dts/_ipc/glob.d.ts +22 -0
  28. package/dist/.dts/_ipc/glob.d.ts.map +1 -0
  29. package/dist/.dts/_ipc/no-node-fs.d.ts +35 -0
  30. package/dist/.dts/_ipc/no-node-fs.d.ts.map +1 -0
  31. package/dist/.dts/_ipc/resolve-tsconfig-paths.d.ts +134 -0
  32. package/dist/.dts/_ipc/resolve-tsconfig-paths.d.ts.map +1 -0
  33. package/dist/.dts/_ipc/typescript.d.ts +20 -0
  34. package/dist/.dts/_ipc/typescript.d.ts.map +1 -0
  35. package/dist/.dts/build/compatibility.d.ts.map +1 -1
  36. package/dist/.dts/build/compiler-api.d.ts +3 -6
  37. package/dist/.dts/build/compiler-api.d.ts.map +1 -1
  38. package/dist/.dts/build/display-path.d.ts +3 -21
  39. package/dist/.dts/build/display-path.d.ts.map +1 -1
  40. package/dist/.dts/build/generated-banner.d.ts +21 -42
  41. package/dist/.dts/build/generated-banner.d.ts.map +1 -1
  42. package/dist/.dts/build/glob.d.ts +3 -15
  43. package/dist/.dts/build/glob.d.ts.map +1 -1
  44. package/dist/.dts/build/index.d.ts +3 -3
  45. package/dist/.dts/build/link.d.ts.map +1 -1
  46. package/dist/.dts/build/merge-documentation.d.ts +35 -0
  47. package/dist/.dts/build/merge-documentation.d.ts.map +1 -0
  48. package/dist/.dts/build/resolution/resolve-tsconfig-paths.d.ts +11 -112
  49. package/dist/.dts/build/resolution/resolve-tsconfig-paths.d.ts.map +1 -1
  50. package/dist/.dts/build/types.d.ts +4 -53
  51. package/dist/.dts/build/types.d.ts.map +1 -1
  52. package/dist/.dts/build/typescript.d.ts +3 -17
  53. package/dist/.dts/build/typescript.d.ts.map +1 -1
  54. package/dist/.dts/eslint-plugin/glob.d.ts +4 -15
  55. package/dist/.dts/eslint-plugin/glob.d.ts.map +1 -1
  56. package/dist/.dts/eslint-plugin/index.d.ts +1 -1
  57. package/dist/.dts/eslint-plugin/no-node-fs.d.ts +8 -18
  58. package/dist/.dts/eslint-plugin/no-node-fs.d.ts.map +1 -1
  59. package/dist/.dts/eslint-plugin/no-raw-process-env.d.ts.map +1 -1
  60. package/dist/{build-H4KFV44Z.js → build-F3RQS7VE.js} +218 -63
  61. package/dist/build-F3RQS7VE.js.map +1 -0
  62. package/dist/build.cjs +257 -102
  63. package/dist/build.cjs.map +1 -1
  64. package/dist/build.js +256 -101
  65. package/dist/build.js.map +1 -1
  66. package/dist/{chunk-7GVPOHDU.js → chunk-QKIQ3LZP.js} +2 -2
  67. package/dist/cli/index.js +36 -29
  68. package/dist/cli/index.js.map +1 -1
  69. package/dist/eslint-plugin/index.cjs +95 -54
  70. package/dist/eslint-plugin/index.cjs.map +1 -1
  71. package/dist/eslint-plugin/index.js +94 -53
  72. package/dist/eslint-plugin/index.js.map +1 -1
  73. package/examples/README.md +95 -0
  74. package/package.json +53 -19
  75. package/skills/env-cap/SKILL.md +91 -0
  76. package/skills/env-cap/references/api.md +220 -0
  77. package/specs/architecture.md +634 -0
  78. package/specs/decisions/0001-runtime-documentation-separation.md +197 -0
  79. package/specs/decisions/0002-static-analysis-never-execution.md +233 -0
  80. package/specs/decisions/0003-no-global-env-object.md +172 -0
  81. package/specs/decisions/0004-no-client-server-package-split.md +116 -0
  82. package/specs/decisions/0005-warn-not-throw-by-default.md +93 -0
  83. package/specs/decisions/0006-self-redacting-contracts.md +124 -0
  84. package/specs/decisions/0007-processor-not-transformer.md +109 -0
  85. package/specs/decisions/0008-gzip-size-budget.md +173 -0
  86. package/specs/decisions/0009-exclusive-groups-are-always-errors.md +139 -0
  87. package/specs/decisions/0010-dependency-ownership-engine-scope-boundary.md +100 -0
  88. package/specs/decisions/0011-shared-discovery-compute-atomic-write-non-atomic.md +104 -0
  89. package/specs/decisions/0012-live-expiration-overrides-not-ast-functions.md +145 -0
  90. package/specs/decisions/0013-json-output-is-a-versioned-mirror.md +136 -0
  91. package/specs/decisions/0014-cross-package-schema-discovery.md +206 -0
  92. package/specs/decisions/0015-security-backport-window.md +60 -0
  93. package/specs/decisions/0016-check-mode-compute-before-compare-never-partial-write.md +113 -0
  94. package/specs/decisions/0017-eslint-plugin-entry-point.md +113 -0
  95. package/specs/decisions/0018-rotation-alert-issue-on-non-pr-runs.md +104 -0
  96. package/specs/decisions/0019-published-json-schema-generated-from-types.md +100 -0
  97. package/specs/decisions/0020-declaration-maps-via-separate-tsc-pass.md +101 -0
  98. package/specs/decisions/0021-manifest-change-report-persisted-snapshot.md +177 -0
  99. package/specs/decisions/0022-validation-contexts.md +267 -0
  100. package/specs/decisions/0023-tsconfig-path-alias-resolution.md +182 -0
  101. package/specs/decisions/0024-fact-model-architecture.md +144 -0
  102. package/specs/decisions/0025-contract-model-json-projection.md +105 -0
  103. package/specs/decisions/0026-finding-model-unifies-four-families.md +109 -0
  104. package/specs/decisions/0027-dependency-model-fact-shape-not-engine-access.md +98 -0
  105. package/specs/decisions/0028-ownership-model-shared-effective-owner.md +85 -0
  106. package/specs/decisions/0029-lifecycle-model-deprecation-rename-fields.md +98 -0
  107. package/specs/decisions/0030-change-model-wraps-manifest-change-report.md +97 -0
  108. package/specs/decisions/0031-evidence-entry-point.md +85 -0
  109. package/specs/decisions/0032-evidence-projection-provenance-mechanism.md +120 -0
  110. package/specs/decisions/0033-reference-projections-live-in-examples.md +81 -0
  111. package/specs/decisions/0034-three-tier-examples-restructuring.md +85 -0
  112. package/specs/decisions/0035-documentenv-metadata-generalization-and-compliance-fields.md +85 -0
  113. package/specs/decisions/0036-exact-source-position-evidence.md +122 -0
  114. package/specs/decisions/0037-developer-declared-dynamic-access-citations.md +114 -0
  115. package/specs/decisions/0038-always-computed-evidence-model-backs-generate-check-docs.md +244 -0
  116. package/specs/decisions/0039-scanner-local-dataflow-boundary.md +160 -0
  117. package/specs/decisions/0040-library-surfaces-do-not-acquire-node-fs.md +156 -0
  118. package/specs/decisions/0041-dual-package-hazard-checked-documented.md +75 -0
  119. package/specs/decisions/0042-init-cli-subcommand-scaffolds-only.md +95 -0
  120. package/specs/decisions/0043-env-cap-resolver-relocated-and-duplicated.md +71 -0
  121. package/specs/decisions/0044-strict-escalates-every-warning-family.md +88 -0
  122. package/specs/decisions/0045-promote-experimental-surfaces-to-stable.md +103 -0
  123. package/specs/decisions/0046-cli-restricted-to-runtime-and-evidence-output.md +177 -0
  124. package/specs/decisions/0047-supported-toolchain-node-22-and-typescript-5-6.md +30 -0
  125. package/specs/decisions/0048-eslint-plugin-does-not-vendor-typescript-eslint.md +25 -0
  126. package/specs/decisions/0049-typescript-7-scanner-uses-a-bundled-typescript-6.md +87 -0
  127. package/specs/decisions/0050-a-variable-declared-twice-is-documented-once.md +55 -0
  128. package/specs/generated-artifacts.md +104 -0
  129. package/specs/migrations/README.md +30 -0
  130. package/specs/migrations/from-centralized-schema.md +503 -0
  131. package/specs/migrations/from-dotenv.md +352 -0
  132. package/specs/migrations/from-envalid.md +482 -0
  133. package/specs/migrations/from-process-env.md +398 -0
  134. package/specs/migrations/from-t3-env.md +416 -0
  135. package/specs/migrations/from-zod.md +303 -0
  136. package/dist/build-H4KFV44Z.js.map +0 -1
  137. /package/dist/{chunk-7GVPOHDU.js.map → chunk-QKIQ3LZP.js.map} +0 -0
package/dist/build.js CHANGED
@@ -1,12 +1,14 @@
1
- import path6 from 'path';
1
+ import path from 'path';
2
2
  import crypto from 'crypto';
3
3
  import { createRequire } from 'module';
4
4
 
5
5
  // src/build/evidence-snapshot.ts
6
- function displayPath(root, absolutePath) {
7
- const relative = path6.relative(root, absolutePath);
8
- if (relative.startsWith("..") || path6.isAbsolute(relative)) return absolutePath;
9
- return relative.split(path6.sep).join("/");
6
+ function displayPath(root, filePath) {
7
+ if (!path.isAbsolute(filePath)) return filePath.split(path.sep).join("/");
8
+ const relative = path.relative(root, filePath);
9
+ if (relative === ".." || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))
10
+ return filePath;
11
+ return relative.split(path.sep).join("/");
10
12
  }
11
13
 
12
14
  // src/build/source-position.ts
@@ -66,7 +68,7 @@ async function buildCitationSnapshots(activeContracts, previous, root, readFile)
66
68
  let acknowledgment;
67
69
  let contentHash;
68
70
  try {
69
- const content = await readFile(path6.resolve(root, position.file));
71
+ const content = await readFile(path.resolve(root, position.file));
70
72
  contentHash = hashContent(content);
71
73
  const baseline = previousBaselines.get(
72
74
  `${identity}#${position.file}:${position.line}:${position.column}`
@@ -260,7 +262,7 @@ async function readEvidenceSnapshot(snapshotPath, fs) {
260
262
  return { status: "ok", snapshot: parsed };
261
263
  }
262
264
  async function writeEvidenceSnapshot(snapshotPath, snapshot, fs) {
263
- await fs.mkdir(path6.dirname(snapshotPath), { recursive: true });
265
+ await fs.mkdir(path.dirname(snapshotPath), { recursive: true });
264
266
  await fs.writeFile(snapshotPath, `${JSON.stringify(snapshot, null, 2)}
265
267
  `, "utf8");
266
268
  }
@@ -331,7 +333,7 @@ async function computeEvidenceChanges(root, snapshotPath, activeContracts, curre
331
333
  };
332
334
  }
333
335
 
334
- // src/build/glob.ts
336
+ // src/_ipc/glob.ts
335
337
  function globToRegExp(pattern) {
336
338
  let out = "";
337
339
  let resume = 0;
@@ -376,13 +378,13 @@ async function discoverSchemaFiles(options) {
376
378
  `discoverSchemaFiles: found ${String(included.length)} files matching "include" under ${options.root} -- more than the ${String(MAX_DISCOVERED_SCHEMA_FILES)}-file sanity limit. This almost always means "root" (or "include"/"exclude") resolved more broadly than intended -- e.g. an omitted "root" falling back to an unexpectedly large process.cwd() -- rather than a real project genuinely declaring this many contracts. Narrow "root"/"include"/"exclude" to the intended project boundary.`
377
379
  );
378
380
  }
379
- return included.map((file) => path6.normalize(file)).sort();
381
+ return included.map((file) => path.normalize(file)).sort();
380
382
  }
381
383
  async function walkDirectory(directory, root, exclude, fs) {
382
384
  const entries = await fs.readdir(directory, { withFileTypes: true });
383
385
  const results = [];
384
386
  for (const entry of entries) {
385
- const fullPath = path6.join(directory, entry.name);
387
+ const fullPath = path.join(directory, entry.name);
386
388
  if (entry.isDirectory()) {
387
389
  if (isAlwaysSkippedDirName(entry.name)) continue;
388
390
  const relativeDir = `${toPosixRelative(root, fullPath)}/`;
@@ -397,7 +399,7 @@ async function walkDirectory(directory, root, exclude, fs) {
397
399
  return results;
398
400
  }
399
401
  function toPosixRelative(root, target) {
400
- return path6.relative(root, target).split(path6.sep).join("/");
402
+ return path.relative(root, target).split(path.sep).join("/");
401
403
  }
402
404
  function matchesAnyPattern(filePath, patterns) {
403
405
  return patterns.some((pattern) => globToRegExp(pattern).test(filePath));
@@ -427,14 +429,19 @@ function pickCompiler(load) {
427
429
  }
428
430
  var ts = pickCompiler(createRequire(import.meta.url));
429
431
 
430
- // src/build/compiler-api.ts
431
- function assertCompilerApi(compiler) {
432
+ // src/_ipc/compiler-api.ts
433
+ function assertCompilerApi(product, compiler) {
432
434
  if (typeof compiler.createSourceFile === "function") return;
433
435
  throw new Error(
434
- `env-cap's build-time scanner needs TypeScript's classic compiler API (typescript ^5 || ^6), but the installed typescript${compiler.version === void 0 ? "" : ` ${compiler.version}`} does not expose it and the bundled @typescript/typescript6 could not be loaded. Reinstall env-cap with its dependencies, or provide a TypeScript 6 compiler: npm install --save-dev typescript@npm:@typescript/typescript6 (this swaps your \`tsc\` for \`tsc6\`; to keep TypeScript 7's \`tsc\`, also add @typescript/native@npm:typescript@^7). See VERSIONING.md, 'Supported toolchain'.`
436
+ `${product}'s build-time scanner needs TypeScript's classic compiler API (typescript ^5 || ^6), but the installed typescript${compiler.version === void 0 ? "" : ` ${compiler.version}`} does not expose it and the bundled @typescript/typescript6 could not be loaded. Reinstall ${product} with its dependencies, or provide a TypeScript 6 compiler: npm install --save-dev typescript@npm:@typescript/typescript6 (this swaps your \`tsc\` for \`tsc6\`; to keep TypeScript 7's \`tsc\`, also add @typescript/native@npm:typescript@^7). See VERSIONING.md, 'Supported toolchain'.`
435
437
  );
436
438
  }
437
439
 
440
+ // src/build/compiler-api.ts
441
+ function assertCompilerApi2(compiler) {
442
+ assertCompilerApi("env-cap", compiler);
443
+ }
444
+
438
445
  // src/build/literal-eval.ts
439
446
  function evaluateLiteral(node) {
440
447
  if (ts.isStringLiteralLike(node)) return { ok: true, value: node.text };
@@ -479,7 +486,7 @@ function getStaticPropertyName(name) {
479
486
 
480
487
  // src/build/parse.ts
481
488
  function parseSchemaFile(filePath, sourceText) {
482
- assertCompilerApi(ts);
489
+ assertCompilerApi2(ts);
483
490
  const sourceFile = ts.createSourceFile(
484
491
  filePath,
485
492
  sourceText,
@@ -1005,12 +1012,99 @@ function mustGet(map, key) {
1005
1012
  throw new Error(`Internal error: expected key "${String(key)}" to be present in map.`);
1006
1013
  return value;
1007
1014
  }
1015
+
1016
+ // src/build/merge-documentation.ts
1017
+ var VALUE_FIELDS = [
1018
+ "description",
1019
+ "owner",
1020
+ "sensitivity",
1021
+ "expiresAt",
1022
+ "refreshInstructions",
1023
+ "authenticatorType",
1024
+ "rotationPeriod",
1025
+ "lastRotatedAt",
1026
+ "rotationTriggerEvents",
1027
+ "setupInstructions",
1028
+ "required",
1029
+ "deprecated",
1030
+ "deprecatedReason",
1031
+ "removeBy",
1032
+ "renamedFrom",
1033
+ "purpose",
1034
+ "legalBasis",
1035
+ "retention",
1036
+ "dataResidency",
1037
+ "auditRequired"
1038
+ ];
1039
+ function mergeSharedDocumentation(contracts) {
1040
+ const declarationsByKey = /* @__PURE__ */ new Map();
1041
+ for (const contract of contracts) {
1042
+ for (const variable of contract.variables) {
1043
+ const declarations = declarationsByKey.get(variable.key);
1044
+ if (declarations === void 0) declarationsByKey.set(variable.key, [{ contract, variable }]);
1045
+ else declarations.push({ contract, variable });
1046
+ }
1047
+ }
1048
+ return contracts.map((contract) => ({
1049
+ ...contract,
1050
+ variables: contract.variables.map((variable) => {
1051
+ const fromPackages = [];
1052
+ const fromApplication = [];
1053
+ for (const declaration of mustGet(declarationsByKey, variable.key)) {
1054
+ if (declaration.variable === variable) continue;
1055
+ const fromPackage = declaration.contract.packageOrigin !== void 0;
1056
+ if (!fromPackage && contract.packageOrigin === void 0) continue;
1057
+ (fromPackage ? fromPackages : fromApplication).push(declaration);
1058
+ }
1059
+ return fromPackages.length + fromApplication.length === 0 ? variable : filled(variable, fromPackages, fromApplication);
1060
+ })
1061
+ }));
1062
+ }
1063
+ function donated(read, fromPackages, fromApplication) {
1064
+ const fromPackage = fromPackages.find(({ variable }) => read(variable) !== void 0);
1065
+ if (fromPackage !== void 0) return read(fromPackage.variable);
1066
+ const values = fromApplication.map(({ variable }) => read(variable)).filter((v) => v !== void 0);
1067
+ return values.every((value) => deepEqual(value, values[0])) ? values[0] : void 0;
1068
+ }
1069
+ function filled(variable, fromPackages, fromApplication) {
1070
+ const donors = [...fromPackages, ...fromApplication];
1071
+ const merged = { ...variable };
1072
+ for (const field of VALUE_FIELDS) {
1073
+ if (variable[field] !== void 0) continue;
1074
+ merged[field] = donated((other) => other[field], fromPackages, fromApplication);
1075
+ }
1076
+ const metadata = {};
1077
+ for (const key of new Set(
1078
+ donors.flatMap(({ variable: other }) => Object.keys(other.metadata ?? {}))
1079
+ )) {
1080
+ const value = donated((other) => other.metadata?.[key], fromPackages, fromApplication);
1081
+ if (value !== void 0) metadata[key] = value;
1082
+ }
1083
+ Object.assign(metadata, variable.metadata);
1084
+ const result = {
1085
+ ...merged,
1086
+ metadata: Object.keys(metadata).length === 0 ? variable.metadata : metadata,
1087
+ documented: variable.documented || donors.some(({ variable: other }) => other.documented)
1088
+ };
1089
+ DONATED.set(
1090
+ result,
1091
+ /* @__PURE__ */ new Set([
1092
+ ...VALUE_FIELDS.filter((field) => result[field] !== variable[field]),
1093
+ ...Object.keys(metadata).filter((key) => metadata[key] !== variable.metadata?.[key]).map((key) => `metadata.${key}`)
1094
+ ])
1095
+ );
1096
+ return result;
1097
+ }
1098
+ var DONATED = /* @__PURE__ */ new WeakMap();
1099
+ function donatedTo(variable) {
1100
+ return DONATED.get(variable) ?? /* @__PURE__ */ new Set();
1101
+ }
1008
1102
  function isWithinDirectory(baseDir, targetPath) {
1009
- const relative = path6.relative(baseDir, targetPath);
1010
- return relative !== ".." && !relative.startsWith(`..${path6.sep}`) && !path6.isAbsolute(relative);
1103
+ const relative = path.relative(baseDir, targetPath);
1104
+ return relative !== ".." && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);
1011
1105
  }
1012
1106
  function resolveWithinRoot(root, location, optionName, functionName) {
1013
- const resolved = path6.resolve(root, location);
1107
+ const resolved = path.resolve(root, location);
1014
1108
  if (!isWithinDirectory(root, resolved)) {
1015
1109
  return {
1016
1110
  ok: false,
@@ -1033,10 +1127,10 @@ function isRecord2(value) {
1033
1127
  return typeof value === "object" && value !== null;
1034
1128
  }
1035
1129
  async function locatePackageManifest(packageName, root, fs) {
1036
- const req = createRequire(path6.join(root, "package.json"));
1130
+ const req = createRequire(path.join(root, "package.json"));
1037
1131
  try {
1038
1132
  const packageJsonPath = req.resolve(`${packageName}/package.json`);
1039
- return { packageJsonPath, packageDir: path6.dirname(packageJsonPath) };
1133
+ return { packageJsonPath, packageDir: path.dirname(packageJsonPath) };
1040
1134
  } catch {
1041
1135
  }
1042
1136
  let mainFile;
@@ -1045,9 +1139,9 @@ async function locatePackageManifest(packageName, root, fs) {
1045
1139
  } catch {
1046
1140
  return void 0;
1047
1141
  }
1048
- let dir = path6.dirname(mainFile);
1142
+ let dir = path.dirname(mainFile);
1049
1143
  for (let i = 0; i < PACKAGE_JSON_ANCESTOR_SEARCH_LIMIT; i++) {
1050
- const candidate = path6.join(dir, "package.json");
1144
+ const candidate = path.join(dir, "package.json");
1051
1145
  try {
1052
1146
  const parsed = JSON.parse(await fs.readFile(candidate, "utf8"));
1053
1147
  if (isRecord2(parsed) && parsed["name"] === packageName) {
@@ -1055,7 +1149,7 @@ async function locatePackageManifest(packageName, root, fs) {
1055
1149
  }
1056
1150
  } catch {
1057
1151
  }
1058
- const parent = path6.dirname(dir);
1152
+ const parent = path.dirname(dir);
1059
1153
  if (parent === dir) break;
1060
1154
  dir = parent;
1061
1155
  }
@@ -1097,7 +1191,7 @@ async function resolveUncached(packageName, root, fs) {
1097
1191
  reason: `"${packageName}"'s package.json has no "envCap.schema" field (or it is not a string).`
1098
1192
  };
1099
1193
  }
1100
- const lexicallyResolved = path6.resolve(packageDir, declaredField);
1194
+ const lexicallyResolved = path.resolve(packageDir, declaredField);
1101
1195
  if (!isWithinDirectory(packageDir, lexicallyResolved)) {
1102
1196
  return {
1103
1197
  ok: false,
@@ -1234,10 +1328,13 @@ async function fileExists(filePath, fs) {
1234
1328
  }
1235
1329
  return false;
1236
1330
  }
1237
- async function loadTsconfigPaths(root, tsconfigOption, fs) {
1331
+ function typescriptPath(file, separator) {
1332
+ return file.split(separator).join("/");
1333
+ }
1334
+ async function loadTsconfigPaths(product, root, tsconfigOption, fs) {
1238
1335
  if (tsconfigOption === false) return { resolution: void 0, warning: void 0 };
1239
1336
  const isExplicit = tsconfigOption !== void 0;
1240
- const configFile = path6.resolve(root, tsconfigOption ?? "tsconfig.json");
1337
+ const configFile = path.resolve(root, tsconfigOption ?? "tsconfig.json");
1241
1338
  if (!await fileExists(configFile, fs)) {
1242
1339
  if (!isExplicit) return { resolution: void 0, warning: void 0 };
1243
1340
  return {
@@ -1248,8 +1345,20 @@ async function loadTsconfigPaths(root, tsconfigOption, fs) {
1248
1345
  }
1249
1346
  };
1250
1347
  }
1251
- assertCompilerApi(ts);
1252
- const readResult = ts.readConfigFile(configFile, (p) => ts.sys.readFile(p));
1348
+ assertCompilerApi(product, ts);
1349
+ let text;
1350
+ try {
1351
+ text = await fs.readFile(configFile, "utf8");
1352
+ } catch (error) {
1353
+ return {
1354
+ resolution: void 0,
1355
+ warning: {
1356
+ file: configFile,
1357
+ message: `Could not read "${configFile}": ${error.message}`
1358
+ }
1359
+ };
1360
+ }
1361
+ const readResult = ts.parseConfigFileTextToJson(typescriptPath(configFile, path.sep), text);
1253
1362
  if (readResult.error) {
1254
1363
  const detail = ts.flattenDiagnosticMessageText(readResult.error.messageText, ts.sys.newLine);
1255
1364
  return {
@@ -1260,13 +1369,20 @@ async function loadTsconfigPaths(root, tsconfigOption, fs) {
1260
1369
  }
1261
1370
  };
1262
1371
  }
1263
- const parsed = ts.parseJsonConfigFileContent(readResult.config, ts.sys, path6.dirname(configFile));
1372
+ const parsed = ts.parseJsonConfigFileContent(readResult.config, ts.sys, path.dirname(configFile));
1373
+ const problems = parsed.errors.filter((diagnostic) => diagnostic.code !== 18003);
1374
+ const warning = problems.length === 0 ? void 0 : {
1375
+ file: configFile,
1376
+ message: `"${configFile}" has problems the compiler reported: ${problems.map(
1377
+ (diagnostic) => ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine)
1378
+ ).join("; ")}`
1379
+ };
1264
1380
  const { paths, baseUrl } = pathMappingOptions(parsed.options);
1265
1381
  const hasPaths = paths !== void 0 && Object.keys(paths).length > 0;
1266
1382
  if (!hasPaths && baseUrl === void 0) {
1267
- return { resolution: void 0, warning: void 0 };
1383
+ return { resolution: void 0, warning };
1268
1384
  }
1269
- return { resolution: { compilerOptions: parsed.options, configFile }, warning: void 0 };
1385
+ return { resolution: { compilerOptions: parsed.options, configFile }, warning };
1270
1386
  }
1271
1387
  function resolveAliasImport(specifier, importingFile, resolution, cache) {
1272
1388
  const cacheKey = `${importingFile}\0${specifier}`;
@@ -1275,8 +1391,8 @@ function resolveAliasImport(specifier, importingFile, resolution, cache) {
1275
1391
  const resolvedFileName = result.resolvedModule?.resolvedFileName;
1276
1392
  let resolved;
1277
1393
  if (resolvedFileName) {
1278
- const normalized = path6.normalize(resolvedFileName);
1279
- const isInNodeModules = normalized.split(path6.sep).includes("node_modules");
1394
+ const normalized = path.normalize(resolvedFileName);
1395
+ const isInNodeModules = normalized.split(path.sep).includes("node_modules");
1280
1396
  const isTsSource = /\.tsx?$/.test(normalized);
1281
1397
  if (!isInNodeModules && isTsSource) resolved = normalized;
1282
1398
  }
@@ -1284,16 +1400,21 @@ function resolveAliasImport(specifier, importingFile, resolution, cache) {
1284
1400
  return resolved;
1285
1401
  }
1286
1402
 
1403
+ // src/build/resolution/resolve-tsconfig-paths.ts
1404
+ function loadTsconfigPaths2(root, tsconfigOption, fs) {
1405
+ return loadTsconfigPaths("env-cap", root, tsconfigOption, fs);
1406
+ }
1407
+
1287
1408
  // src/build/resolution/resolve-import.ts
1288
1409
  async function resolveRelativeImport(importingFile, specifier, fs) {
1289
1410
  if (!specifier.startsWith("./") && !specifier.startsWith("../")) return void 0;
1290
1411
  const withoutExt = specifier.replace(/\.(js|jsx|ts|tsx)$/, "");
1291
- const base = path6.resolve(path6.dirname(importingFile), withoutExt);
1412
+ const base = path.resolve(path.dirname(importingFile), withoutExt);
1292
1413
  for (const candidate of [
1293
1414
  `${base}.ts`,
1294
1415
  `${base}.tsx`,
1295
- path6.join(base, "index.ts"),
1296
- path6.join(base, "index.tsx")
1416
+ path.join(base, "index.ts"),
1417
+ path.join(base, "index.tsx")
1297
1418
  ]) {
1298
1419
  if (await fileExists2(candidate, fs)) return candidate;
1299
1420
  }
@@ -1442,7 +1563,6 @@ async function linkFiles(discoveredFiles, readFile, context, packageOrigins = /*
1442
1563
  }
1443
1564
  const contracts = [];
1444
1565
  const undocumentedContracts = [];
1445
- const undocumentedVariables = [];
1446
1566
  const staleDocEntries = [];
1447
1567
  for (const entry of createEnvEntries) {
1448
1568
  const linked = documentEnvByIdentity.get(entry.identity);
@@ -1452,10 +1572,6 @@ async function linkFiles(discoveredFiles, readFile, context, packageOrigins = /*
1452
1572
  }
1453
1573
  const schemaKeys = new Set(entry.variables.map((v) => v.key));
1454
1574
  const docsVariables = docs?.variables ?? /* @__PURE__ */ new Map();
1455
- for (const key of schemaKeys) {
1456
- if (!docsVariables.has(key))
1457
- undocumentedVariables.push({ file: entry.file, exportName: entry.exportName, key });
1458
- }
1459
1575
  for (const key of docsVariables.keys()) {
1460
1576
  if (!schemaKeys.has(key))
1461
1577
  staleDocEntries.push({ file: entry.file, exportName: entry.exportName, key });
@@ -1517,18 +1633,23 @@ async function linkFiles(discoveredFiles, readFile, context, packageOrigins = /*
1517
1633
  for (const analysis of analysisCache.values()) {
1518
1634
  warnings.push(...analysis.warnings);
1519
1635
  }
1636
+ const merged = mergeSharedDocumentation(contracts);
1520
1637
  return {
1521
- contracts,
1638
+ contracts: merged,
1522
1639
  warnings,
1523
1640
  unresolvedLinks,
1641
+ // Judged after the merge: a variable a package's contract documents is documented for the application that
1642
+ // declares it again.
1643
+ undocumentedVariables: merged.flatMap(
1644
+ ({ file, exportName, variables }) => variables.filter(({ documented }) => !documented).map(({ key }) => ({ file, exportName, key }))
1645
+ ),
1524
1646
  undocumentedContracts,
1525
- undocumentedVariables,
1526
1647
  staleDocEntries
1527
1648
  };
1528
1649
  }
1529
1650
  function summarizeContract(contract, root) {
1530
1651
  return {
1531
- file: path6.relative(root, contract.file),
1652
+ file: path.relative(root, contract.file),
1532
1653
  exportName: contract.exportName,
1533
1654
  contractName: contract.contractName,
1534
1655
  variableCount: contract.variables.length,
@@ -1582,7 +1703,7 @@ async function assembleProject(options) {
1582
1703
  packageFiles.map((f) => f.file),
1583
1704
  fs
1584
1705
  );
1585
- const { resolution: tsconfigPaths, warning: tsconfigWarning } = await loadTsconfigPaths(
1706
+ const { resolution: tsconfigPaths, warning: tsconfigWarning } = await loadTsconfigPaths2(
1586
1707
  root,
1587
1708
  tsconfig,
1588
1709
  fs
@@ -1647,24 +1768,20 @@ function buildChangeModel(manifest, currentContracts, root) {
1647
1768
  }
1648
1769
 
1649
1770
  // src/build/compatibility.ts
1650
- var DOCUMENTATION_COMPARISON_FIELDS = [
1651
- "description",
1652
- "owner",
1653
- "sensitivity",
1654
- "expiresAt",
1655
- "refreshInstructions",
1656
- "setupInstructions",
1657
- "required"
1658
- ];
1659
1771
  function documentationDivergences(a, b) {
1660
1772
  const divergences = [];
1661
- for (const field of DOCUMENTATION_COMPARISON_FIELDS) {
1662
- if (a[field] !== b[field]) divergences.push(field);
1773
+ const given = /* @__PURE__ */ new Set([...donatedTo(a), ...donatedTo(b)]);
1774
+ for (const field of VALUE_FIELDS) {
1775
+ if (!given.has(field) && a[field] !== void 0 && b[field] !== void 0 && !deepEqual(a[field], b[field])) {
1776
+ divergences.push(field);
1777
+ }
1663
1778
  }
1664
1779
  const aMetadata = a.metadata ?? {};
1665
1780
  const bMetadata = b.metadata ?? {};
1666
- for (const key of /* @__PURE__ */ new Set([...Object.keys(aMetadata), ...Object.keys(bMetadata)])) {
1667
- if (!deepEqual(aMetadata[key], bMetadata[key])) divergences.push(`metadata.${key}`);
1781
+ for (const key of Object.keys(aMetadata)) {
1782
+ if (!given.has(`metadata.${key}`) && key in bMetadata && !deepEqual(aMetadata[key], bMetadata[key])) {
1783
+ divergences.push(`metadata.${key}`);
1784
+ }
1668
1785
  }
1669
1786
  return divergences;
1670
1787
  }
@@ -1711,17 +1828,15 @@ function detectCompatibilityIssues(contracts) {
1711
1828
  reason: `"${a.contractName}" and "${b.contractName}" both declare a validator for this variable with different implementations. Validator logic cannot be statically compared -- confirm they enforce compatible rules.`
1712
1829
  });
1713
1830
  }
1714
- if (a.variable.documented && b.variable.documented) {
1715
- const divergences = documentationDivergences(a.variable, b.variable);
1716
- if (divergences.length > 0) {
1717
- issues.push({
1718
- severity: "warning",
1719
- variable: key,
1720
- files: [a.file, b.file],
1721
- code: "DUPLICATE_VARIABLE_DOCUMENTATION",
1722
- reason: `"${a.contractName}" and "${b.contractName}" both document this variable, but disagree on: ${divergences.join(", ")}. Confirm they're still meant to be the same variable and align the documentation, or document them separately if they're not.`
1723
- });
1724
- }
1831
+ const divergences = documentationDivergences(a.variable, b.variable);
1832
+ if (divergences.length > 0) {
1833
+ issues.push({
1834
+ severity: "warning",
1835
+ variable: key,
1836
+ files: [a.file, b.file],
1837
+ code: "DUPLICATE_VARIABLE_DOCUMENTATION",
1838
+ reason: `"${a.contractName}" and "${b.contractName}" both document this variable, but disagree on: ${divergences.join(", ")}. Confirm they're still meant to be the same variable and align the documentation, or document them separately if they're not.`
1839
+ });
1725
1840
  }
1726
1841
  }
1727
1842
  }
@@ -1989,7 +2104,7 @@ function bindingElementKey(element) {
1989
2104
  return element.propertyName;
1990
2105
  }
1991
2106
  function scanFileForDependencies(filePath, sourceText) {
1992
- assertCompilerApi(ts);
2107
+ assertCompilerApi2(ts);
1993
2108
  const scriptKind = filePath.endsWith(".tsx") ? ts.ScriptKind.TSX : ts.ScriptKind.TS;
1994
2109
  const sourceFile = ts.createSourceFile(
1995
2110
  filePath,
@@ -2100,27 +2215,67 @@ function scanFileForDependencies(filePath, sourceText) {
2100
2215
  return { file: filePath, imports, accessesByLocalName: accesses, hasWildcardReExport };
2101
2216
  }
2102
2217
 
2218
+ // src/_ipc/generated-banner.ts
2219
+ function marker() {
2220
+ return "GENERATED FILE -- do not edit by hand";
2221
+ }
2222
+ function createGeneratedBanner(describe) {
2223
+ return {
2224
+ reportRegenerateHint: () => describe().reportRegenerateHint,
2225
+ generatedBanner: (format = "ts", regenerate = `Run \`${describe().cliCommand}\` to regenerate.`) => {
2226
+ const text = `${marker()}. ${regenerate}`;
2227
+ return { ts: `// ${text}`, markdown: `<!-- ${text} -->` }[format];
2228
+ },
2229
+ // Not a bare `startsWith`: a shebang, a `"use strict"` pragma or a license header pushes a real marker
2230
+ // off line one, and a stricter check would read a genuinely generated file as hand-written, which a
2231
+ // dependency scan would take as "a real consumer imports this" and so permanently mask an abandoned
2232
+ // contract. The first 20 non-empty lines clear every realistic preamble without scanning a whole file.
2233
+ // A line counts only when the marker opens a comment, as `generatedBanner` writes it, so code or prose that
2234
+ // merely quotes the marker is not mistaken for a generated file.
2235
+ isGeneratedFile: (content) => {
2236
+ let seen = 0;
2237
+ for (const [line] of content.matchAll(/[^\n]*/g)) {
2238
+ const text = line.trimStart();
2239
+ if (text === "") continue;
2240
+ if (text.startsWith(`// ${marker()}`) || text.startsWith(`<!-- ${marker()}`)) return true;
2241
+ seen += 1;
2242
+ if (seen === 20) break;
2243
+ }
2244
+ return false;
2245
+ },
2246
+ evidenceDisclaimer: () => "Machine-generated engineering artifact assembled from statically-provable code facts and author-declared documentation. It can support a security, privacy, or compliance review. It does not itself establish compliance with any standard.",
2247
+ evidenceProjectionNote: (evidencePath) => {
2248
+ const { product, guideUrl } = describe();
2249
+ const concept = `Projected from ${product}'s Evidence Model (${guideUrl}), the same source every other generated artifact draws from.`;
2250
+ return evidencePath === void 0 ? concept : `${concept} This run also wrote it to \`${evidencePath}\`.`;
2251
+ }
2252
+ };
2253
+ }
2254
+
2103
2255
  // src/build/generated-banner.ts
2104
- function generatedFileMarker() {
2105
- return "GENERATED FILE";
2256
+ function envCap() {
2257
+ return {
2258
+ product: "env-cap",
2259
+ guideUrl: "https://github.com/MaverickCER/env-cap/blob/main/GUIDE.md",
2260
+ cliCommand: "npx env-cap",
2261
+ reportRegenerateHint: "Regenerate it by re-running the script that calls `generateDocumentation()` / `generateUsageReport()` from `@maverickcer/env-cap/build`."
2262
+ };
2106
2263
  }
2264
+ var banner = createGeneratedBanner(envCap);
2107
2265
  function reportRegenerateHint() {
2108
- return "Regenerate it by re-running the script that calls `generateDocumentation()` / `generateUsageReport()` from `@maverickcer/env-cap/build`.";
2266
+ return banner.reportRegenerateHint();
2109
2267
  }
2110
- function generatedBanner(format = "ts", regenerate = "Run `npx env-cap` to regenerate.") {
2111
- const text = `${generatedFileMarker()} -- do not edit by hand. ${regenerate}`;
2112
- return { ts: `// ${text}`, markdown: `<!-- ${text} -->` }[format];
2268
+ function generatedBanner(format, regenerate) {
2269
+ return banner.generatedBanner(format, regenerate);
2113
2270
  }
2114
2271
  function isGeneratedFile(content) {
2115
- const nonEmptyLines = content.split("\n").filter((line) => line.trim().length > 0);
2116
- return nonEmptyLines.slice(0, 20).some((line) => line.includes(generatedFileMarker()));
2272
+ return banner.isGeneratedFile(content);
2117
2273
  }
2118
2274
  function evidenceDisclaimer() {
2119
- return "Machine-generated engineering artifact assembled from statically-provable code facts and author-declared documentation. It can support a security, privacy, or compliance review. It does not itself establish compliance with any standard.";
2275
+ return banner.evidenceDisclaimer();
2120
2276
  }
2121
2277
  function evidenceProjectionNote(evidencePath) {
2122
- const concept = "Projected from env-cap's Evidence Model (https://github.com/MaverickCER/env-cap/blob/main/GUIDE.md), the same source every other generated artifact draws from.";
2123
- return evidencePath === void 0 ? concept : `${concept} This run also wrote it to \`${evidencePath}\`.`;
2278
+ return banner.evidenceProjectionNote(evidencePath);
2124
2279
  }
2125
2280
 
2126
2281
  // src/build/dependency-graph.ts
@@ -2492,7 +2647,7 @@ function discoverValidationContexts(contracts) {
2492
2647
  }
2493
2648
  function renderManifest(contracts, outputFile) {
2494
2649
  const sorted = [...contracts].sort((a, b) => a.file.localeCompare(b.file));
2495
- const outputDir = path6.dirname(outputFile);
2650
+ const outputDir = path.dirname(outputFile);
2496
2651
  const usedNames = /* @__PURE__ */ new Set();
2497
2652
  const importLines = [];
2498
2653
  const referenceNames = [];
@@ -2512,7 +2667,7 @@ function renderManifest(contracts, outputFile) {
2512
2667
  specifier = contract.packageOrigin.packageName;
2513
2668
  } else {
2514
2669
  const withoutExt = contract.file.replace(/\.tsx?$/, "");
2515
- specifier = path6.relative(outputDir, withoutExt).split(path6.sep).join("/");
2670
+ specifier = path.relative(outputDir, withoutExt).split(path.sep).join("/");
2516
2671
  if (!specifier.startsWith(".")) specifier = `./${specifier}`;
2517
2672
  }
2518
2673
  const binding = localName === contract.exportName ? contract.exportName : `${contract.exportName} as ${localName}`;
@@ -2576,11 +2731,11 @@ function computeManifest(root, linkResult, onIncompatibility) {
2576
2731
  }
2577
2732
  async function writeManifest(outputPath, activeContracts, fs) {
2578
2733
  const manifestSource = renderManifest(activeContracts, outputPath);
2579
- await fs.mkdir(path6.dirname(outputPath), { recursive: true });
2734
+ await fs.mkdir(path.dirname(outputPath), { recursive: true });
2580
2735
  await fs.writeFile(outputPath, manifestSource, "utf8");
2581
2736
  }
2582
2737
  async function generateEnvManifest(options) {
2583
- const root = path6.resolve(options.root ?? process.cwd());
2738
+ const root = path.resolve(options.root ?? process.cwd());
2584
2739
  const include = options.include ?? defaultInclude();
2585
2740
  const exclude = options.exclude ?? defaultExclude();
2586
2741
  const locationResult = resolveWithinRoot(
@@ -2811,20 +2966,20 @@ async function computeUsage(root, contracts, scanFiles, readFile, context, scann
2811
2966
  };
2812
2967
  const dependencyOwnership = graph.contracts.map((c) => ({
2813
2968
  contractName: c.contractName,
2814
- file: path6.relative(root, c.file),
2969
+ file: path.relative(root, c.file),
2815
2970
  owner: ownerFor(c.file, c.exportName),
2816
2971
  variableCount: c.variables.size,
2817
- consumers: c.consumingFiles.map((f) => path6.relative(root, f))
2972
+ consumers: c.consumingFiles.map((f) => path.relative(root, f))
2818
2973
  }));
2819
2974
  const abandonedContracts = findings.abandoned.map((f) => ({
2820
2975
  contractName: f.contractName,
2821
- file: path6.relative(root, f.file),
2976
+ file: path.relative(root, f.file),
2822
2977
  owner: ownerFor(f.file, f.exportName)
2823
2978
  }));
2824
2979
  const unresolvedConsumers = findings.unresolvedConsumers.map(
2825
2980
  (f) => ({
2826
2981
  contractName: f.contractName,
2827
- file: path6.relative(root, f.file),
2982
+ file: path.relative(root, f.file),
2828
2983
  reason: f.reason
2829
2984
  })
2830
2985
  );
@@ -2891,11 +3046,11 @@ async function computeUsage(root, contracts, scanFiles, readFile, context, scann
2891
3046
  }
2892
3047
  async function writeUsageReport(reportPath, computed, fs) {
2893
3048
  const source = renderUsageReport(computed);
2894
- await fs.mkdir(path6.dirname(reportPath), { recursive: true });
3049
+ await fs.mkdir(path.dirname(reportPath), { recursive: true });
2895
3050
  await fs.writeFile(reportPath, source, "utf8");
2896
3051
  }
2897
3052
  async function generateUsageReport(options) {
2898
- const root = path6.resolve(options.root ?? process.cwd());
3053
+ const root = path.resolve(options.root ?? process.cwd());
2899
3054
  const include = options.include ?? defaultInclude();
2900
3055
  const exclude = options.exclude ?? defaultExclude();
2901
3056
  let reportPath;
@@ -3996,7 +4151,7 @@ async function writeEnvExample(contracts, location, fs, options = {}) {
3996
4151
  }
3997
4152
  if (existingContent === void 0) {
3998
4153
  const content2 = renderEnvExample(contracts, []);
3999
- await fs.mkdir(path6.dirname(location), { recursive: true });
4154
+ await fs.mkdir(path.dirname(location), { recursive: true });
4000
4155
  await fs.writeFile(location, content2, "utf8");
4001
4156
  return {
4002
4157
  writtenPath: location,
@@ -4021,7 +4176,7 @@ async function writeEnvExample(contracts, location, fs, options = {}) {
4021
4176
  const content = renderEnvExample(contracts, headerLines);
4022
4177
  const writtenPath = onExisting === "overwrite" ? location : `${location}.${Date.now()}`;
4023
4178
  const skippedExistingPath = onExisting === "overwrite" ? void 0 : location;
4024
- await fs.mkdir(path6.dirname(writtenPath), { recursive: true });
4179
+ await fs.mkdir(path.dirname(writtenPath), { recursive: true });
4025
4180
  await fs.writeFile(writtenPath, content, "utf8");
4026
4181
  return { writtenPath, skippedExistingPath, staleVariables, variablesToComment, variablesToAdd };
4027
4182
  }
@@ -4119,7 +4274,7 @@ async function writeDocumentation(docsPath, envExamplePath, root, contracts, con
4119
4274
  generatedAt,
4120
4275
  previousContent
4121
4276
  });
4122
- await fs.mkdir(path6.dirname(docsPath), { recursive: true });
4277
+ await fs.mkdir(path.dirname(docsPath), { recursive: true });
4123
4278
  await fs.writeFile(docsPath, docsSource, "utf8");
4124
4279
  const envExample = envExamplePath ? (
4125
4280
  // `exactOptionalPropertyTypes` rejects an explicit `undefined`, so the key is omitted when unset.
@@ -4133,7 +4288,7 @@ async function writeDocumentation(docsPath, envExamplePath, root, contracts, con
4133
4288
  return { envExample };
4134
4289
  }
4135
4290
  async function generateDocumentation(options) {
4136
- const root = path6.resolve(options.root ?? process.cwd());
4291
+ const root = path.resolve(options.root ?? process.cwd());
4137
4292
  const include = options.include ?? defaultInclude();
4138
4293
  const exclude = options.exclude ?? defaultExclude();
4139
4294
  const expiringWithinDays = options.expiringWithinDays ?? DEFAULT_EXPIRING_WITHIN_DAYS;
@@ -4337,12 +4492,12 @@ function buildOwnershipModel(contracts, root) {
4337
4492
 
4338
4493
  // src/build/tool-version.ts
4339
4494
  function readToolVersion() {
4340
- return "0.6.0";
4495
+ return "0.7.1";
4341
4496
  }
4342
4497
 
4343
4498
  // src/build/generate-evidence.ts
4344
4499
  async function generateEvidenceModel(options) {
4345
- const root = path6.resolve(options.root ?? process.cwd());
4500
+ const root = path.resolve(options.root ?? process.cwd());
4346
4501
  const include = options.include ?? defaultInclude();
4347
4502
  const exclude = options.exclude ?? defaultExclude();
4348
4503
  const expiringWithinDays = options.expiringWithinDays ?? DEFAULT_EXPIRING_WITHIN_DAYS;
@@ -4484,10 +4639,10 @@ async function writeEvidenceFingerprint(evidencePath, fingerprint, fs) {
4484
4639
  `, "utf8");
4485
4640
  }
4486
4641
  async function getEvidenceModel(options) {
4487
- const root = path6.resolve(options.root ?? process.cwd());
4642
+ const root = path.resolve(options.root ?? process.cwd());
4488
4643
  const include = options.include ?? defaultInclude();
4489
4644
  const exclude = options.exclude ?? defaultExclude();
4490
- const evidencePath = path6.resolve(root, options.location);
4645
+ const evidencePath = path.resolve(root, options.location);
4491
4646
  const fingerprintPath = fingerprintPathFor(evidencePath);
4492
4647
  const recompute = async (missReason) => ({
4493
4648
  evidence: await generateEvidenceModel(options),
@@ -4553,7 +4708,7 @@ function requestedPass(option) {
4553
4708
  return option === false ? void 0 : option;
4554
4709
  }
4555
4710
  async function computeArtifacts(options) {
4556
- const root = path6.resolve(options.root ?? process.cwd());
4711
+ const root = path.resolve(options.root ?? process.cwd());
4557
4712
  const include = options.include ?? defaultInclude();
4558
4713
  const exclude = options.exclude ?? defaultExclude();
4559
4714
  const manifestOptions = requestedPass(options.manifest);
@@ -4906,7 +5061,7 @@ function sarifLocations(finding) {
4906
5061
  function buildSarifLog(findingModel) {
4907
5062
  const ruleIds = [...new Set(findingModel.findings.map((f) => f.code))].sort();
4908
5063
  return {
4909
- $schema: "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/main/Schemata/sarif-schema-2.1.0.json",
5064
+ $schema: "https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json",
4910
5065
  version: "2.1.0",
4911
5066
  runs: [
4912
5067
  {