@hawkeyexl/manni 2.2.0 → 2.3.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.
@@ -8,7 +8,7 @@ var __export = (target, all) => {
8
8
  // package.json
9
9
  var package_default = {
10
10
  name: "@hawkeyexl/manni",
11
- version: "2.2.0",
11
+ version: "2.3.1",
12
12
  description: "One command line for documentation that is meant to be checked. `manni meta` validates the presence and format of document metadata (Markdown frontmatter and more) against JSON Schema, built for CI. Formerly docmeta.",
13
13
  type: "module",
14
14
  bin: {
@@ -93,6 +93,7 @@ var package_default = {
93
93
  "ajv-formats": "^3.0.1",
94
94
  commander: "^15.0.0",
95
95
  "fast-glob": "^3.3.2",
96
+ "github-slugger": "^2.0.0",
96
97
  parse5: "^8.0.1",
97
98
  picocolors: "^1.1.1",
98
99
  picomatch: "^4.0.7",
@@ -1063,7 +1064,6 @@ function verify(flavor, inner, merged, patch, deletions = []) {
1063
1064
  var markdownExtractor = {
1064
1065
  name: "markdown",
1065
1066
  extensions: [".md", ".markdown"],
1066
- implemented: true,
1067
1067
  extract: (content) => extractFrontmatter(content, "markdown"),
1068
1068
  apply: (content, patch, options) => applyFrontmatter(content, patch, options)
1069
1069
  };
@@ -1072,7 +1072,6 @@ var markdownExtractor = {
1072
1072
  var mdxExtractor = {
1073
1073
  name: "mdx",
1074
1074
  extensions: [".mdx"],
1075
- implemented: true,
1076
1075
  extract: (content) => extractFrontmatter(content, "mdx"),
1077
1076
  apply: (content, patch, options) => applyFrontmatter(content, patch, options)
1078
1077
  };
@@ -1132,7 +1131,6 @@ function extractHeader(content, lineOffset = 0) {
1132
1131
  var asciidocExtractor = {
1133
1132
  name: "asciidoc",
1134
1133
  extensions: [".adoc", ".asciidoc"],
1135
- implemented: true,
1136
1134
  apply: (content, patch, options) => applyFencedOnly(content, patch, options, "asciidoc"),
1137
1135
  extract(content) {
1138
1136
  if (hasFrontmatterFence(content)) {
@@ -1218,7 +1216,6 @@ function extractDocinfo(content) {
1218
1216
  var rstExtractor = {
1219
1217
  name: "rst",
1220
1218
  extensions: [".rst"],
1221
- implemented: true,
1222
1219
  apply: (content, patch, options) => applyFencedOnly(content, patch, options, "rst"),
1223
1220
  extract(content) {
1224
1221
  if (hasFrontmatterFence(content)) {
@@ -2351,7 +2348,6 @@ var xmlExtractor = {
2351
2348
  // DITA topics and maps are XML, and their metadata lives on the root element
2352
2349
  // (`id`, `type`, `xml:lang`, …), so they need no extractor of their own.
2353
2350
  extensions: [".xml", ".dita", ".ditamap"],
2354
- implemented: true,
2355
2351
  extract(content, filePath, options) {
2356
2352
  return toExtracted(readXml(content, filePath, options));
2357
2353
  },
@@ -2675,7 +2671,6 @@ function verify3(next, before, patch, moved, options) {
2675
2671
  var htmlExtractor = {
2676
2672
  name: "html",
2677
2673
  extensions: [".html", ".htm"],
2678
- implemented: true,
2679
2674
  extract(content, _filePath, options) {
2680
2675
  const { data, lineMap, colMap } = readHtml(content, options);
2681
2676
  return {
@@ -2705,20 +2700,18 @@ for (const ex of EXTRACTORS) {
2705
2700
  for (const ext of ex.extensions) byExtension.set(ext.toLowerCase(), ex);
2706
2701
  }
2707
2702
  function extractorForExtension(ext) {
2708
- const ex = byExtension.get(ext.toLowerCase());
2709
- return ex?.implemented ? ex : void 0;
2703
+ return byExtension.get(ext.toLowerCase());
2710
2704
  }
2711
2705
  function extractorByName(name2) {
2712
2706
  return byName.get(name2.toLowerCase());
2713
2707
  }
2714
2708
  function supportedExtensions() {
2715
- return EXTRACTORS.filter((e) => e.implemented).flatMap((e) => e.extensions);
2709
+ return EXTRACTORS.flatMap((e) => e.extensions);
2716
2710
  }
2717
2711
  function listFormats() {
2718
2712
  return EXTRACTORS.map((e) => ({
2719
2713
  name: e.name,
2720
2714
  extensions: e.extensions,
2721
- implemented: e.implemented,
2722
2715
  // Writability is the presence of the optional `apply` method, so a format
2723
2716
  // never has to declare it twice and the two can't drift apart.
2724
2717
  writable: typeof e.apply === "function"
@@ -2733,8 +2726,8 @@ var RENAME_ATTEMPTS = 3;
2733
2726
  function errorCode(err) {
2734
2727
  return typeof err === "object" && err !== null && "code" in err ? String(err.code) : void 0;
2735
2728
  }
2736
- var wait = (ms) => new Promise((resolve20) => {
2737
- setTimeout(resolve20, ms);
2729
+ var wait = (ms) => new Promise((resolve21) => {
2730
+ setTimeout(resolve21, ms);
2738
2731
  });
2739
2732
  async function writeFileAtomic(path, contents) {
2740
2733
  const tmp = join(
@@ -5287,8 +5280,8 @@ var SCHEMA_KEYS = [
5287
5280
  "multipleOf"
5288
5281
  ];
5289
5282
  var RETRY_DELAY_MS = 500;
5290
- var wait2 = (ms) => new Promise((resolve20) => {
5291
- setTimeout(resolve20, ms);
5283
+ var wait2 = (ms) => new Promise((resolve21) => {
5284
+ setTimeout(resolve21, ms);
5292
5285
  });
5293
5286
  var RetryableFetchError = class extends DocmetaError {
5294
5287
  };
@@ -5792,12 +5785,12 @@ function isPlainObject(v) {
5792
5785
  }
5793
5786
 
5794
5787
  // src/meta/core/config.ts
5795
- import { resolve as resolve4 } from "node:path";
5788
+ import { resolve as resolve5 } from "node:path";
5796
5789
  import { parse as parseYaml2 } from "yaml";
5797
5790
 
5798
5791
  // src/shared/config-file.ts
5799
5792
  import { readFile as readFile3 } from "node:fs/promises";
5800
- import { basename as basename2, dirname as dirname3, join as join4, relative as relative2, resolve as resolve3 } from "node:path";
5793
+ import { basename as basename2, dirname as dirname3, join as join4, relative as relative2, resolve as resolve4 } from "node:path";
5801
5794
  import { parse as parseYaml } from "yaml";
5802
5795
 
5803
5796
  // src/shared/encryption.ts
@@ -5953,6 +5946,55 @@ function searchPath(cwd) {
5953
5946
  }
5954
5947
  }
5955
5948
 
5949
+ // src/shared/tools.ts
5950
+ import { isAbsolute as isAbsolute2, resolve as resolve3 } from "node:path";
5951
+ var TOOL_KEYS = ["vale"];
5952
+ var VALE_KEYS = ["config"];
5953
+ function isMapping2(value) {
5954
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5955
+ }
5956
+ function rejectUnknownKeys2(raw, allowed, where, source, toError) {
5957
+ for (const key of Object.keys(raw)) {
5958
+ if (!allowed.includes(key)) {
5959
+ throw toError(
5960
+ `${source}: ${where} has unknown key "${key}". Supported keys: ${allowed.join(", ")}.`
5961
+ );
5962
+ }
5963
+ }
5964
+ }
5965
+ function parseTools(raw, source, toError) {
5966
+ if (raw === null || raw === void 0) return {};
5967
+ if (!isMapping2(raw)) {
5968
+ throw toError(`${source}: "tools" must be a mapping.`);
5969
+ }
5970
+ rejectUnknownKeys2(raw, TOOL_KEYS, "tools", source, toError);
5971
+ const tools = {};
5972
+ if (Object.hasOwn(raw, "vale")) {
5973
+ tools.vale = parseVale(raw["vale"], source, toError);
5974
+ }
5975
+ return tools;
5976
+ }
5977
+ function parseVale(raw, source, toError) {
5978
+ if (!isMapping2(raw)) {
5979
+ throw toError(`${source}: tools.vale must be a mapping.`);
5980
+ }
5981
+ rejectUnknownKeys2(raw, VALE_KEYS, "tools.vale", source, toError);
5982
+ const vale = {};
5983
+ if (Object.hasOwn(raw, "config")) {
5984
+ const config = raw["config"];
5985
+ if (typeof config !== "string" || config.trim() === "") {
5986
+ throw toError(`${source}: tools.vale.config must be a non-empty string.`);
5987
+ }
5988
+ vale.config = config;
5989
+ }
5990
+ return vale;
5991
+ }
5992
+ function valeConfigPath(tools, configDir) {
5993
+ const config = tools.vale?.config;
5994
+ if (config === void 0) return void 0;
5995
+ return isAbsolute2(config) ? config : resolve3(configDir, config);
5996
+ }
5997
+
5956
5998
  // src/shared/warn.ts
5957
5999
  var said = /* @__PURE__ */ new Set();
5958
6000
  function warn(message) {
@@ -6000,7 +6042,8 @@ function parseMapping(text2, source, toError) {
6000
6042
  return raw;
6001
6043
  }
6002
6044
  var COLLECTIONS_KEY = "collections";
6003
- var FAMILY_KEYS = [COLLECTIONS_KEY, ENCRYPTION_KEY_FIELD];
6045
+ var TOOLS_KEY = "tools";
6046
+ var FAMILY_KEYS = [COLLECTIONS_KEY, TOOLS_KEY, ENCRYPTION_KEY_FIELD];
6004
6047
  function slice(document, opts) {
6005
6048
  const { doc } = document;
6006
6049
  if (doc !== null && Object.hasOwn(doc, opts.section)) {
@@ -6016,6 +6059,11 @@ function collectionsOf(document, source, toError) {
6016
6059
  if (doc === null || !Object.hasOwn(doc, COLLECTIONS_KEY)) return [];
6017
6060
  return parseCollections(doc[COLLECTIONS_KEY], source, toError);
6018
6061
  }
6062
+ function toolsOf(document, source, toError) {
6063
+ const { doc } = document;
6064
+ if (doc === null || !Object.hasOwn(doc, TOOLS_KEY)) return {};
6065
+ return parseTools(doc[TOOLS_KEY], source, toError);
6066
+ }
6019
6067
  function encryptionKeyOf(document, source, toError) {
6020
6068
  const { doc } = document;
6021
6069
  if (doc === null) return {};
@@ -6059,7 +6107,7 @@ var FAMILY_FILES = [
6059
6107
  { names: MOOSE_CONFIG_NAMES, kind: "moose" }
6060
6108
  ];
6061
6109
  async function findConfigFile(cwd, opts) {
6062
- const start = resolve3(cwd);
6110
+ const start = resolve4(cwd);
6063
6111
  for (const dir of searchPath(start)) {
6064
6112
  for (const { names, kind } of FAMILY_FILES) {
6065
6113
  for (const name2 of names) {
@@ -6077,6 +6125,7 @@ async function findConfigFile(cwd, opts) {
6077
6125
  text: document.text,
6078
6126
  kind,
6079
6127
  collections: collectionsOf(document, source, opts.toError),
6128
+ tools: toolsOf(document, source, opts.toError),
6080
6129
  ...encryptionKeyOf(document, source, opts.toError),
6081
6130
  ...found
6082
6131
  };
@@ -6088,7 +6137,7 @@ async function findConfigFile(cwd, opts) {
6088
6137
  const document = await readDocument(path, source, opts.toError);
6089
6138
  if (document === null) continue;
6090
6139
  warn(
6091
- `"${name2}" is a deprecated config file name and will stop being read in a future major version. Move its keys under \`${opts.section}:\` in "${FAMILY_CONFIG_NAMES[0] ?? "manni.config.yaml"}", and its paths, exclude and sidecars keys to a top-level collections: list, where sidecars becomes externalMetadata.`
6140
+ `"${name2}" is a deprecated config file name. Move its keys under \`${opts.section}:\` in "${FAMILY_CONFIG_NAMES[0] ?? "manni.config.yaml"}", and its paths, exclude and sidecars keys to a top-level collections: list, where sidecars becomes externalMetadata.`
6092
6141
  );
6093
6142
  return {
6094
6143
  path,
@@ -6098,14 +6147,15 @@ async function findConfigFile(cwd, opts) {
6098
6147
  value: document.doc,
6099
6148
  wrapped: false,
6100
6149
  kind: "legacy",
6101
- collections: []
6150
+ collections: [],
6151
+ tools: {}
6102
6152
  };
6103
6153
  }
6104
6154
  }
6105
6155
  return null;
6106
6156
  }
6107
6157
  async function readConfigFile(explicitPath, cwd, opts) {
6108
- const path = resolve3(cwd, explicitPath);
6158
+ const path = resolve4(cwd, explicitPath);
6109
6159
  const document = await readDocument(path, explicitPath, opts.toError);
6110
6160
  if (document === null) {
6111
6161
  throw opts.toError(`Config file not found: "${explicitPath}".`);
@@ -6121,6 +6171,7 @@ async function readConfigFile(explicitPath, cwd, opts) {
6121
6171
  text: document.text,
6122
6172
  kind: "explicit",
6123
6173
  collections: collectionsOf(document, explicitPath, opts.toError),
6174
+ tools: toolsOf(document, explicitPath, opts.toError),
6124
6175
  // An unwrapped document carries no family key (else it would be wrapped),
6125
6176
  // so this only ever reads a family file's key.
6126
6177
  ...encryptionKeyOf(document, explicitPath, opts.toError),
@@ -6128,7 +6179,7 @@ async function readConfigFile(explicitPath, cwd, opts) {
6128
6179
  };
6129
6180
  }
6130
6181
  async function findFamilyConfigFile(cwd, toError) {
6131
- const start = resolve3(cwd);
6182
+ const start = resolve4(cwd);
6132
6183
  for (const dir of searchPath(start)) {
6133
6184
  for (const { names, kind } of FAMILY_FILES) {
6134
6185
  for (const name2 of names) {
@@ -6146,6 +6197,7 @@ async function findFamilyConfigFile(cwd, toError) {
6146
6197
  wrapped: true,
6147
6198
  kind,
6148
6199
  collections: collectionsOf(document, source, toError),
6200
+ tools: toolsOf(document, source, toError),
6149
6201
  ...tolerantKeysOf(document)
6150
6202
  };
6151
6203
  }
@@ -6154,7 +6206,7 @@ async function findFamilyConfigFile(cwd, toError) {
6154
6206
  return null;
6155
6207
  }
6156
6208
  async function readFamilyConfigFile(explicitPath, cwd, toError) {
6157
- const path = resolve3(cwd, explicitPath);
6209
+ const path = resolve4(cwd, explicitPath);
6158
6210
  const document = await readDocument(path, explicitPath, toError);
6159
6211
  if (document === null) {
6160
6212
  throw toError(`Config file not found: "${explicitPath}".`);
@@ -6171,6 +6223,7 @@ async function readFamilyConfigFile(explicitPath, cwd, toError) {
6171
6223
  wrapped: family,
6172
6224
  kind: "explicit",
6173
6225
  collections: collectionsOf(document, explicitPath, toError),
6226
+ tools: toolsOf(document, explicitPath, toError),
6174
6227
  ...tolerantKeysOf(document)
6175
6228
  };
6176
6229
  }
@@ -6239,7 +6292,7 @@ var CONFIG_KEYS = [
6239
6292
  "fill",
6240
6293
  "elements"
6241
6294
  ];
6242
- function rejectUnknownKeys2(raw, allowed, where, source) {
6295
+ function rejectUnknownKeys3(raw, allowed, where, source) {
6243
6296
  for (const key of Object.keys(raw)) {
6244
6297
  if (!allowed.includes(key)) {
6245
6298
  throw new DocmetaError(
@@ -6309,7 +6362,7 @@ function parseSchemaEntry(entry, where, source) {
6309
6362
  );
6310
6363
  }
6311
6364
  const raw = entry;
6312
- rejectUnknownKeys2(raw, SCHEMA_ENTRY_KEYS, where, source);
6365
+ rejectUnknownKeys3(raw, SCHEMA_ENTRY_KEYS, where, source);
6313
6366
  if (typeof raw.ref !== "string" || raw.ref.trim() === "") {
6314
6367
  throw new DocmetaError(
6315
6368
  `${source}: ${where}.ref must be a non-empty schema reference string.`
@@ -6462,7 +6515,7 @@ function parseDerive(raw, source) {
6462
6515
  );
6463
6516
  }
6464
6517
  const e = raw;
6465
- rejectUnknownKeys2(e, DERIVE_KEYS, '"derive"', source);
6518
+ rejectUnknownKeys3(e, DERIVE_KEYS, '"derive"', source);
6466
6519
  if (e.fields === void 0 && e.sources === void 0 && e.codeowners === void 0 && e.commands === void 0 && e.machines === void 0) {
6467
6520
  throw new DocmetaError(
6468
6521
  `${source}: "derive" sets nothing. Give it \`fields:\` to manage, \`commands:\` to derive from a command, or \`sources:\`, \`codeowners:\` or \`machines:\` to shape the reads.`
@@ -6569,7 +6622,7 @@ function parseDeriveCommands(raw, source) {
6569
6622
  );
6570
6623
  }
6571
6624
  const c = value;
6572
- rejectUnknownKeys2(c, DERIVE_COMMAND_KEYS, where, source);
6625
+ rejectUnknownKeys3(c, DERIVE_COMMAND_KEYS, where, source);
6573
6626
  if (!Array.isArray(c.run) || c.run.length === 0) {
6574
6627
  throw new DocmetaError(
6575
6628
  `${source}: ${where}.run must be a non-empty list of strings, the program first.`
@@ -6601,7 +6654,7 @@ function parseConfigDocument(raw, source) {
6601
6654
  throw new DocmetaError(`${source}: top level must be a mapping.`);
6602
6655
  }
6603
6656
  const obj = raw;
6604
- rejectUnknownKeys2(obj, CONFIG_KEYS, "the top level", source);
6657
+ rejectUnknownKeys3(obj, CONFIG_KEYS, "the top level", source);
6605
6658
  const config = {};
6606
6659
  if (obj.schemas !== void 0)
6607
6660
  config.schemas = asSchemaList(obj.schemas, "schemas", source);
@@ -6614,7 +6667,7 @@ function parseConfigDocument(raw, source) {
6614
6667
  throw new DocmetaError(`${source}: overrides[${i}] must be a mapping.`);
6615
6668
  }
6616
6669
  const e = entry;
6617
- rejectUnknownKeys2(e, OVERRIDE_KEYS, `overrides[${i}]`, source);
6670
+ rejectUnknownKeys3(e, OVERRIDE_KEYS, `overrides[${i}]`, source);
6618
6671
  const hasFiles = e.files !== void 0;
6619
6672
  const hasCollection = e.collection !== void 0;
6620
6673
  if (hasFiles === hasCollection) {
@@ -6703,7 +6756,7 @@ function parseChecks(value, source) {
6703
6756
  );
6704
6757
  }
6705
6758
  const e = entry;
6706
- rejectUnknownKeys2(e, CHECK_KEYS, `checks[${i}]`, source);
6759
+ rejectUnknownKeys3(e, CHECK_KEYS, `checks[${i}]`, source);
6707
6760
  if (typeof e.name !== "string" || e.name === "") {
6708
6761
  throw new DocmetaError(
6709
6762
  `${source}: checks[${i}].name must be a non-empty string.`
@@ -6739,7 +6792,7 @@ function parseSchemaCache(value, source) {
6739
6792
  throw new DocmetaError(`${source}: "schemaCache" must be a mapping.`);
6740
6793
  }
6741
6794
  const raw = value;
6742
- rejectUnknownKeys2(raw, SCHEMA_CACHE_KEYS, '"schemaCache"', source);
6795
+ rejectUnknownKeys3(raw, SCHEMA_CACHE_KEYS, '"schemaCache"', source);
6743
6796
  const schemaCache = {};
6744
6797
  const ttl = raw.ttlHours;
6745
6798
  if (ttl !== void 0) {
@@ -6759,7 +6812,7 @@ function parseSchemaTrust(value, source) {
6759
6812
  );
6760
6813
  }
6761
6814
  const raw = value;
6762
- rejectUnknownKeys2(raw, SCHEMA_TRUST_KEYS, '"schemaTrust"', source);
6815
+ rejectUnknownKeys3(raw, SCHEMA_TRUST_KEYS, '"schemaTrust"', source);
6763
6816
  const schemaTrust = {};
6764
6817
  const mode = raw.documentRefs;
6765
6818
  if (mode !== void 0) {
@@ -6786,7 +6839,7 @@ function parseFill(value, source) {
6786
6839
  throw new DocmetaError(`${source}: "fill" must be a mapping.`);
6787
6840
  }
6788
6841
  const raw = value;
6789
- rejectUnknownKeys2(raw, FILL_KEYS, '"fill"', source);
6842
+ rejectUnknownKeys3(raw, FILL_KEYS, '"fill"', source);
6790
6843
  const fill = {};
6791
6844
  const asString = (key) => {
6792
6845
  const v = raw[key];
@@ -6822,8 +6875,8 @@ function parseFill(value, source) {
6822
6875
  function schemaTrustRoot(cwd, configDir) {
6823
6876
  const git2 = findGitRoot(cwd);
6824
6877
  if (git2 !== null) return { dir: git2, source: "git" };
6825
- if (configDir !== void 0) return { dir: resolve4(configDir), source: "config" };
6826
- return { dir: resolve4(cwd), source: "cwd" };
6878
+ if (configDir !== void 0) return { dir: resolve5(configDir), source: "config" };
6879
+ return { dir: resolve5(cwd), source: "cwd" };
6827
6880
  }
6828
6881
  async function loadConfig(explicitPath, cwd = process.cwd()) {
6829
6882
  const file = explicitPath ? await readConfigFile(explicitPath, cwd, CONFIG_FILE) : await findConfigFile(cwd, CONFIG_FILE);
@@ -6887,23 +6940,23 @@ async function resolveRunConfig(opts) {
6887
6940
  }
6888
6941
 
6889
6942
  // src/meta/reporters/sarif.ts
6890
- import { isAbsolute as isAbsolute2 } from "node:path";
6943
+ import { isAbsolute as isAbsolute3 } from "node:path";
6891
6944
 
6892
6945
  // src/meta/core/baseline.ts
6893
6946
  import { createHash as createHash3 } from "node:crypto";
6894
6947
  import { existsSync as existsSync2 } from "node:fs";
6895
6948
  import { readFile as readFile4 } from "node:fs/promises";
6896
- import { relative as relative5, resolve as resolve7 } from "node:path";
6949
+ import { relative as relative5, resolve as resolve8 } from "node:path";
6897
6950
 
6898
6951
  // src/meta/core/load-files.ts
6899
6952
  import { stat as stat3 } from "node:fs/promises";
6900
- import { extname, relative as relative4, resolve as resolve6 } from "node:path";
6953
+ import { extname, relative as relative4, resolve as resolve7 } from "node:path";
6901
6954
  import fg from "fast-glob";
6902
6955
  import picomatch3 from "picomatch";
6903
6956
 
6904
6957
  // src/meta/core/gitignore.ts
6905
6958
  import { spawn } from "node:child_process";
6906
- import { dirname as dirname4, relative as relative3, resolve as resolve5, sep } from "node:path";
6959
+ import { dirname as dirname4, relative as relative3, resolve as resolve6, sep } from "node:path";
6907
6960
  var GITIGNORE_UNAVAILABLE = ".gitignore filtering was requested but git could not answer here (no repository, or no git on PATH); no files were skipped.";
6908
6961
  var unavailable = () => ({
6909
6962
  ignored: /* @__PURE__ */ new Set(),
@@ -6917,7 +6970,7 @@ async function gitIgnored(paths, cwd) {
6917
6970
  const byRoot = /* @__PURE__ */ new Map();
6918
6971
  let inSomeRepo = false;
6919
6972
  for (const spelled of paths) {
6920
- const abs = resolve5(cwd, spelled);
6973
+ const abs = resolve6(cwd, spelled);
6921
6974
  const dir = dirname4(abs);
6922
6975
  let root = rootOf.get(dir);
6923
6976
  if (root === void 0) {
@@ -7029,7 +7082,7 @@ async function resolveTargetSet(opts) {
7029
7082
  for (const input of opts.inputs) {
7030
7083
  if (input === STDIN_TOKEN) continue;
7031
7084
  const posixInput = toPosix(input);
7032
- const abs = resolve6(cwd, posixInput);
7085
+ const abs = resolve7(cwd, posixInput);
7033
7086
  const st = await statOrNull(abs);
7034
7087
  if (st?.isFile()) {
7035
7088
  named.add(toPosix(relative4(cwd, abs)));
@@ -7077,7 +7130,8 @@ async function resolveTargetSet(opts) {
7077
7130
  }
7078
7131
  return {
7079
7132
  files: [.../* @__PURE__ */ new Set([...named, ...walked])].sort(),
7080
- gitignoreSkipped
7133
+ gitignoreSkipped,
7134
+ named: [...named].sort()
7081
7135
  };
7082
7136
  }
7083
7137
  function assertNonEmpty(p) {
@@ -7113,12 +7167,12 @@ var FINGERPRINT_RE = /^[0-9a-f]{16}$/;
7113
7167
  function canonicalFilePath(file, ctx) {
7114
7168
  if (!ctx) return file;
7115
7169
  const from = ctx.runBase ?? ctx.base;
7116
- return relative5(ctx.base, resolve7(from, file)).replace(/\\/g, "/");
7170
+ return relative5(ctx.base, resolve8(from, file)).replace(/\\/g, "/");
7117
7171
  }
7118
7172
  function canonicalSchemaRef(ref, ctx) {
7119
7173
  if (!ctx) return ref;
7120
7174
  if (classifyRef(ref).kind !== "file") return ref;
7121
- const abs = resolve7(ctx.cwd, ref);
7175
+ const abs = resolve8(ctx.cwd, ref);
7122
7176
  return relative5(ctx.base, abs).replace(/\\/g, "/");
7123
7177
  }
7124
7178
  function fingerprint(e, ctx) {
@@ -7276,17 +7330,17 @@ function countFingerprints(baseline) {
7276
7330
  }
7277
7331
  function resolveBaselineRequest(opts, configured, configDir, cwd, defaults) {
7278
7332
  const named = (label) => ({
7279
- absPath: resolve7(cwd, label),
7333
+ absPath: resolve8(cwd, label),
7280
7334
  label
7281
7335
  });
7282
7336
  const implied = () => {
7283
7337
  const base = configDir ?? cwd;
7284
7338
  if (configured !== void 0) {
7285
- return { absPath: resolve7(base, configured), label: configured };
7339
+ return { absPath: resolve8(base, configured), label: configured };
7286
7340
  }
7287
- const current = resolve7(base, defaults.current);
7341
+ const current = resolve8(base, defaults.current);
7288
7342
  if (defaults.legacy !== void 0) {
7289
- const legacy = resolve7(base, defaults.legacy);
7343
+ const legacy = resolve8(base, defaults.legacy);
7290
7344
  if (!existsSync2(current) && existsSync2(legacy)) {
7291
7345
  warn(
7292
7346
  `"${defaults.legacy}" is the pre-rename baseline file name. Rename it to "${defaults.current}".`
@@ -7399,7 +7453,7 @@ function uriFrame(frame) {
7399
7453
  }
7400
7454
  function artifactUri(file, frame) {
7401
7455
  const uri = canonicalFilePath(file, frame);
7402
- if (uri === "" || uri.startsWith("../") || isAbsolute2(uri)) return null;
7456
+ if (uri === "" || uri.startsWith("../") || isAbsolute3(uri)) return null;
7403
7457
  return uri;
7404
7458
  }
7405
7459
  function renderSarif(results, opts = {}) {
@@ -7793,7 +7847,7 @@ async function readCapped(url, res, maxBytes) {
7793
7847
 
7794
7848
  // src/meta/core/external-metadata.ts
7795
7849
  import { readFile as readFile6 } from "node:fs/promises";
7796
- import { isAbsolute as isAbsolute3, relative as relative7, resolve as resolve9, sep as sep2 } from "node:path";
7850
+ import { isAbsolute as isAbsolute4, relative as relative7, resolve as resolve10, sep as sep2 } from "node:path";
7797
7851
  import {
7798
7852
  LineCounter as LineCounter2,
7799
7853
  isMap as isMap4,
@@ -7806,7 +7860,7 @@ import {
7806
7860
  // src/shared/encryption-key.ts
7807
7861
  import { spawnSync } from "node:child_process";
7808
7862
  import { readFile as readFile5 } from "node:fs/promises";
7809
- import { basename as basename4, dirname as dirname6, join as join6, relative as relative6, resolve as resolve8 } from "node:path";
7863
+ import { basename as basename4, dirname as dirname6, join as join6, relative as relative6, resolve as resolve9 } from "node:path";
7810
7864
  import { isDeepStrictEqual } from "node:util";
7811
7865
  import { isMap as isMap3, parseDocument as parseDocument3, parse as parseYaml3, stringify } from "yaml";
7812
7866
 
@@ -7818,8 +7872,8 @@ var RENAME_ATTEMPTS2 = 3;
7818
7872
  function errorCode2(err) {
7819
7873
  return typeof err === "object" && err !== null && "code" in err ? String(err.code) : void 0;
7820
7874
  }
7821
- var wait3 = (ms) => new Promise((resolve20) => {
7822
- setTimeout(resolve20, ms);
7875
+ var wait3 = (ms) => new Promise((resolve21) => {
7876
+ setTimeout(resolve21, ms);
7823
7877
  });
7824
7878
  async function writeTextAtomic(path, text2) {
7825
7879
  const tmp = join5(
@@ -7868,7 +7922,7 @@ function resolveEncryptionKey(opts) {
7868
7922
  return { key: void 0, source: "none" };
7869
7923
  }
7870
7924
  function relativeSource2(cwd, path) {
7871
- return relative6(resolve8(cwd), path).replace(/\\/g, "/");
7925
+ return relative6(resolve9(cwd), path).replace(/\\/g, "/");
7872
7926
  }
7873
7927
  function errorCode3(err) {
7874
7928
  return typeof err === "object" && err !== null && "code" in err ? String(err.code) : void 0;
@@ -7891,7 +7945,7 @@ async function fileTarget(file, toError) {
7891
7945
  return { path: file.path, source: file.source, text: text2 ?? file.text };
7892
7946
  }
7893
7947
  async function defaultTarget(cwd) {
7894
- const root = findGitRoot(cwd) ?? resolve8(cwd);
7948
+ const root = findGitRoot(cwd) ?? resolve9(cwd);
7895
7949
  for (const name2 of [...FAMILY_CONFIG_NAMES, ...MOOSE_CONFIG_NAMES]) {
7896
7950
  const path2 = join6(root, name2);
7897
7951
  const text2 = await readIfPresent(path2);
@@ -7914,20 +7968,20 @@ function withKey(text2, key, previous, source, toError) {
7914
7968
  if (previous === null) doc.delete(ENCRYPTION_KEY_PREVIOUS_FIELD);
7915
7969
  return doc.toString();
7916
7970
  }
7917
- function isMapping2(value) {
7971
+ function isMapping3(value) {
7918
7972
  return typeof value === "object" && value !== null && !Array.isArray(value);
7919
7973
  }
7920
7974
  function verify4(before, after, key, previous, source, toError) {
7921
7975
  const old = before === null ? null : parseYaml3(before);
7922
7976
  const expected = Object.fromEntries(
7923
7977
  Object.entries({
7924
- ...isMapping2(old) ? old : {},
7978
+ ...isMapping3(old) ? old : {},
7925
7979
  [ENCRYPTION_KEY_FIELD]: key,
7926
7980
  ...typeof previous === "string" ? { [ENCRYPTION_KEY_PREVIOUS_FIELD]: previous } : {}
7927
7981
  }).filter(([name2]) => previous !== null || name2 !== ENCRYPTION_KEY_PREVIOUS_FIELD)
7928
7982
  );
7929
7983
  const reread = parseYaml3(after);
7930
- if (!isMapping2(reread) || !isDeepStrictEqual(reread, expected)) {
7984
+ if (!isMapping3(reread) || !isDeepStrictEqual(reread, expected)) {
7931
7985
  throw toError(
7932
7986
  `Could not write ${ENCRYPTION_KEY_FIELD} to ${source}; add the key by hand.`
7933
7987
  );
@@ -8206,7 +8260,7 @@ async function loadExternalMetadata(collections, opts) {
8206
8260
  ...opts.env !== void 0 ? { env: opts.env } : {}
8207
8261
  });
8208
8262
  } else {
8209
- const abs = isAbsolute3(manifest.file) ? manifest.file : resolve9(opts.configDir, manifest.file);
8263
+ const abs = isAbsolute4(manifest.file) ? manifest.file : resolve10(opts.configDir, manifest.file);
8210
8264
  file = reportedPath(abs, opts.base);
8211
8265
  text2 = await readManifest(abs, file);
8212
8266
  }
@@ -8288,7 +8342,7 @@ function parseManifest(manifest, collection, text2, file, configDir, join11, tar
8288
8342
  `Manifest ${where}: "${spelled}" must be a mapping of owned keys to values.`
8289
8343
  );
8290
8344
  }
8291
- const indexKey = join11 === PATH_JOIN ? resolve9(configDir, spelled) : spelled;
8345
+ const indexKey = join11 === PATH_JOIN ? resolve10(configDir, spelled) : spelled;
8292
8346
  const values = target.get(indexKey) ?? /* @__PURE__ */ new Map();
8293
8347
  for (const kv of pair.value.items) {
8294
8348
  const key = isScalar2(kv.key) ? String(kv.key.value) : String(kv.key);
@@ -8366,7 +8420,7 @@ function mergeExternalMetadata(label, extracted, index, memberOf2, base, options
8366
8420
  const sources = [];
8367
8421
  const joins = [];
8368
8422
  if (label !== STDIN_LABEL) {
8369
- const byPath = index.byPath.get(resolve9(base, label));
8423
+ const byPath = index.byPath.get(resolve10(base, label));
8370
8424
  if (byPath) sources.push(byPath);
8371
8425
  }
8372
8426
  for (const [field, byValue] of index.byField) {
@@ -8461,7 +8515,7 @@ function externalMetadataPointer(key) {
8461
8515
  }
8462
8516
  function orphanEntries(index, loaded, base, collections) {
8463
8517
  if (!index) return [];
8464
- const have = new Set(loaded.map((l) => resolve9(base, l)));
8518
+ const have = new Set(loaded.map((l) => resolve10(base, l)));
8465
8519
  return index.entries.filter(
8466
8520
  (e) => inCollections(e, collections) && e.join === PATH_JOIN && e.abs !== void 0 && !have.has(e.abs)
8467
8521
  );
@@ -8496,7 +8550,7 @@ function isFieldLocation(value) {
8496
8550
  }
8497
8551
 
8498
8552
  // src/meta/core/collections.ts
8499
- import { isAbsolute as isAbsolute4, relative as relative8, resolve as resolvePath2, sep as sep3 } from "node:path";
8553
+ import { isAbsolute as isAbsolute5, relative as relative8, resolve as resolvePath2, sep as sep3 } from "node:path";
8500
8554
 
8501
8555
  // src/meta/core/projection.ts
8502
8556
  var SYSTEM_COLUMNS = ["_path", "_format", "_present", "_data"];
@@ -8718,7 +8772,7 @@ function memberOf(collections, configDir, base, label) {
8718
8772
  if (collections.length === 0) return [];
8719
8773
  if (label === STDIN_LABEL) return [];
8720
8774
  const rel = relative8(configDir, resolvePath2(base, label)).split(sep3).join("/");
8721
- if (isAbsolute4(rel)) return [];
8775
+ if (isAbsolute5(rel)) return [];
8722
8776
  return collections.filter((c) => isMember(c, rel)).map((c) => c.name);
8723
8777
  }
8724
8778
  function retainMembers(files, membersFor) {
@@ -9756,12 +9810,12 @@ function utcDate(iso) {
9756
9810
  }
9757
9811
 
9758
9812
  // src/meta/core/derive/index.ts
9759
- import { dirname as dirname9, resolve as resolve11 } from "node:path";
9813
+ import { dirname as dirname9, resolve as resolve12 } from "node:path";
9760
9814
 
9761
9815
  // src/meta/core/derive/codeowners.ts
9762
9816
  import { existsSync as existsSync3 } from "node:fs";
9763
9817
  import { readFile as readFile7 } from "node:fs/promises";
9764
- import { dirname as dirname7, relative as relative9, resolve as resolve10, sep as sep4 } from "node:path";
9818
+ import { dirname as dirname7, relative as relative9, resolve as resolve11, sep as sep4 } from "node:path";
9765
9819
  import picomatch4 from "picomatch";
9766
9820
  var CODEOWNERS_LOCATIONS = [
9767
9821
  ".github/CODEOWNERS",
@@ -9771,11 +9825,11 @@ var CODEOWNERS_LOCATIONS = [
9771
9825
  ];
9772
9826
  function findCodeowners(root, explicit) {
9773
9827
  if (explicit !== void 0) {
9774
- const path = resolve10(root, explicit);
9828
+ const path = resolve11(root, explicit);
9775
9829
  return existsSync3(path) ? path : null;
9776
9830
  }
9777
9831
  for (const loc of CODEOWNERS_LOCATIONS) {
9778
- const path = resolve10(root, ...loc.split("/"));
9832
+ const path = resolve11(root, ...loc.split("/"));
9779
9833
  if (existsSync3(path)) return path;
9780
9834
  }
9781
9835
  return null;
@@ -9890,7 +9944,7 @@ function toGlobs(pattern) {
9890
9944
  var NOT_FOUND_REASON = `no CODEOWNERS file found (looked for ${CODEOWNERS_LOCATIONS.join(", ")})`;
9891
9945
  async function deriveFromCodeowners(inputs, opts) {
9892
9946
  const records = /* @__PURE__ */ new Map();
9893
- const explicitPath = opts.explicit === void 0 ? void 0 : resolve10(opts.configDir ?? process.cwd(), opts.explicit);
9947
+ const explicitPath = opts.explicit === void 0 ? void 0 : resolve11(opts.configDir ?? process.cwd(), opts.explicit);
9894
9948
  if (explicitPath !== void 0 && !existsSync3(explicitPath)) {
9895
9949
  return {
9896
9950
  status: { available: false, reason: `CODEOWNERS not found at ${explicitPath}` },
@@ -9972,7 +10026,7 @@ function toPosix2(p) {
9972
10026
  // src/meta/core/derive/git.ts
9973
10027
  import { constants as bufferConstants } from "node:buffer";
9974
10028
  import { spawn as spawn3 } from "node:child_process";
9975
- import { dirname as dirname8, extname as extname2, isAbsolute as isAbsolute5, posix as posix2, relative as relative10, sep as sep5 } from "node:path";
10029
+ import { dirname as dirname8, extname as extname2, isAbsolute as isAbsolute6, posix as posix2, relative as relative10, sep as sep5 } from "node:path";
9976
10030
  import { parse as parseYaml4 } from "yaml";
9977
10031
 
9978
10032
  // src/shared/pin.ts
@@ -11071,7 +11125,7 @@ async function commitEvidence(run2, root, entry, blame, history, blobs, manifest
11071
11125
  }
11072
11126
  function insideRoot(root, abs) {
11073
11127
  const rel = relative10(root, abs);
11074
- if (rel === "" || rel.startsWith("..") || isAbsolute5(rel)) return void 0;
11128
+ if (rel === "" || rel.startsWith("..") || isAbsolute6(rel)) return void 0;
11075
11129
  return rel.split(sep5).join("/");
11076
11130
  }
11077
11131
  function entryAt(entry, rel, relAtCommit) {
@@ -11399,7 +11453,7 @@ async function deriveReviewsByRoot(inputs, git2, rootFor, ctx, requested) {
11399
11453
  if (byRoot.size === 0) {
11400
11454
  return unavailable3(requested, "no git repository contains the documents");
11401
11455
  }
11402
- const cacheDir = resolve11(ctx.configDir ?? ctx.cwd, REVIEW_CACHE_DIR);
11456
+ const cacheDir = resolve12(ctx.configDir ?? ctx.cwd, REVIEW_CACHE_DIR);
11403
11457
  for (const [root, bucket] of byRoot) {
11404
11458
  const client = ctx.reviews ?? await createReviewClient(root, { cwd: ctx.cwd, cache: ctx.cache, cacheDir, requested });
11405
11459
  const identity = await client.detect();
@@ -11581,7 +11635,7 @@ import { readFile as readFile9 } from "node:fs/promises";
11581
11635
 
11582
11636
  // src/meta/core/relocation.ts
11583
11637
  import { access, readFile as readFile8, stat as stat5, unlink } from "node:fs/promises";
11584
- import { basename as basename5, extname as extname3, isAbsolute as isAbsolute6, join as join8, relative as relative11, resolve as resolve12, sep as sep6 } from "node:path";
11638
+ import { basename as basename5, extname as extname3, isAbsolute as isAbsolute7, join as join8, relative as relative11, resolve as resolve13, sep as sep6 } from "node:path";
11585
11639
  import picomatch6 from "picomatch";
11586
11640
  import {
11587
11641
  LineCounter as LineCounter4,
@@ -12115,7 +12169,7 @@ var Model = class {
12115
12169
  for (const c of this.collections) {
12116
12170
  c.externalMetadata.forEach((m, index) => {
12117
12171
  const url = classifyRef(m.file).kind === "url";
12118
- const absPath = url ? void 0 : isAbsolute6(m.file) ? m.file : resolve12(configDir, m.file);
12172
+ const absPath = url ? void 0 : isAbsolute7(m.file) ? m.file : resolve13(configDir, m.file);
12119
12173
  this.manifests.push({
12120
12174
  collection: c.name,
12121
12175
  index,
@@ -12272,8 +12326,8 @@ var Model = class {
12272
12326
  /** A label relative to the config directory, posix; undefined outside it. */
12273
12327
  relative(label) {
12274
12328
  if (label === "<stdin>") return void 0;
12275
- const rel = toPosix3(relative11(this.configDir, resolve12(this.ctx.base, label)));
12276
- return isAbsolute6(rel) || rel.startsWith("../") ? void 0 : rel;
12329
+ const rel = toPosix3(relative11(this.configDir, resolve13(this.ctx.base, label)));
12330
+ return isAbsolute7(rel) || rel.startsWith("../") ? void 0 : rel;
12277
12331
  }
12278
12332
  };
12279
12333
  function dedupe2(xs) {
@@ -12287,13 +12341,13 @@ async function collectionPath(target, cwd, configDir) {
12287
12341
  const posix4 = target.replace(/\\/g, "/");
12288
12342
  const scanned = picomatch6.scan(posix4);
12289
12343
  if (scanned.isGlob) {
12290
- const rel2 = toPosix3(relative11(configDir, resolve12(cwd, scanned.base === "" ? "." : scanned.base)));
12291
- if (isAbsolute6(rel2) || rel2 === ".." || rel2.startsWith("../")) return void 0;
12344
+ const rel2 = toPosix3(relative11(configDir, resolve13(cwd, scanned.base === "" ? "." : scanned.base)));
12345
+ if (isAbsolute7(rel2) || rel2 === ".." || rel2.startsWith("../")) return void 0;
12292
12346
  return rel2 === "" ? scanned.glob : `${rel2}/${scanned.glob}`;
12293
12347
  }
12294
- const abs = resolve12(cwd, posix4);
12348
+ const abs = resolve13(cwd, posix4);
12295
12349
  const rel = toPosix3(relative11(configDir, abs));
12296
- if (isAbsolute6(rel) || rel.startsWith("..")) return void 0;
12350
+ if (isAbsolute7(rel) || rel.startsWith("..")) return void 0;
12297
12351
  let directory = posix4.endsWith("/");
12298
12352
  if (!directory) {
12299
12353
  try {
@@ -12315,7 +12369,7 @@ async function exists(absPath, file) {
12315
12369
  }
12316
12370
  }
12317
12371
  function plannedConfigDir(ctx) {
12318
- return ctx.configDir ?? findGitRoot(ctx.cwd) ?? resolve12(ctx.cwd);
12372
+ return ctx.configDir ?? findGitRoot(ctx.cwd) ?? resolve13(ctx.cwd);
12319
12373
  }
12320
12374
  async function keyHome(ctx, label, data, key) {
12321
12375
  const model = new Model(ctx, plannedConfigDir(ctx));
@@ -12336,7 +12390,7 @@ async function keyHome(ctx, label, data, key) {
12336
12390
  return { kind: "unowned", home: (await model.home(label, false)).proposed };
12337
12391
  }
12338
12392
  function entryFor(m, label, data, configDir, base, key) {
12339
- if (m.join === PATH_JOIN) return toPosix3(relative11(configDir, resolve12(base, label)));
12393
+ if (m.join === PATH_JOIN) return toPosix3(relative11(configDir, resolve13(base, label)));
12340
12394
  let raw = data[m.join];
12341
12395
  if (isEncryptedValue(raw)) {
12342
12396
  const k = key();
@@ -12377,7 +12431,7 @@ async function planRelocation(ctx, request) {
12377
12431
  if (beyond) return void 0;
12378
12432
  throw new DocmetaError(`Unsupported file type "${extname3(label)}" for "${label}". Use --as to override.`);
12379
12433
  }
12380
- const absPath = resolve12(ctx.base, label);
12434
+ const absPath = resolve13(ctx.base, label);
12381
12435
  const elements = resolveElements(label, ctx.config, currentMembers(label));
12382
12436
  let content = "";
12383
12437
  let own2 = {};
@@ -12590,7 +12644,7 @@ async function planRelocation(ctx, request) {
12590
12644
  });
12591
12645
  const labels = dedupe2([
12592
12646
  ...request.files,
12593
- ...walked.files.map((f) => reported(resolve12(configDir, f), ctx.base))
12647
+ ...walked.files.map((f) => reported(resolve13(configDir, f), ctx.base))
12594
12648
  ]).filter((label) => model.members(label).includes(name2));
12595
12649
  for (const label of labels) {
12596
12650
  const page = await load(label, !runSet.has(label));
@@ -13205,7 +13259,7 @@ function relocationOffers(plan) {
13205
13259
  }
13206
13260
 
13207
13261
  // src/meta/commands/validate.ts
13208
- import { resolve as resolve14, extname as extname4 } from "node:path";
13262
+ import { resolve as resolve15, extname as extname4 } from "node:path";
13209
13263
 
13210
13264
  // src/meta/core/checks.ts
13211
13265
  var CHECK_KEYWORD = "check";
@@ -13343,7 +13397,7 @@ async function runChecks(checks, entries, ctx = {}) {
13343
13397
  }
13344
13398
 
13345
13399
  // src/meta/core/derive/provenance-place.ts
13346
- import { isAbsolute as isAbsolute7, relative as relative12, resolve as resolve13, sep as sep7 } from "node:path";
13400
+ import { isAbsolute as isAbsolute8, relative as relative12, resolve as resolve14, sep as sep7 } from "node:path";
13347
13401
  var toPosix4 = (p) => p.split(sep7).join("/");
13348
13402
  function provenanceManifests(collections, configDir, base) {
13349
13403
  const out = [];
@@ -13355,7 +13409,7 @@ function provenanceManifests(collections, configDir, base) {
13355
13409
  `collection ${collection.name}: ${PROVENANCE_FIELD} cannot come from a URL manifest, because manni meta derive writes it.`
13356
13410
  );
13357
13411
  }
13358
- const absPath = isAbsolute7(manifest.file) ? manifest.file : resolve13(configDir, manifest.file);
13412
+ const absPath = isAbsolute8(manifest.file) ? manifest.file : resolve14(configDir, manifest.file);
13359
13413
  const rel = relative12(base, absPath);
13360
13414
  out.push({
13361
13415
  collection: collection.name,
@@ -13379,7 +13433,7 @@ function provenancePlace(label, data, manifests, collections, configDir, base) {
13379
13433
  );
13380
13434
  }
13381
13435
  if (manifest.join === PATH_JOIN) {
13382
- const entry = toPosix4(relative12(configDir, resolve13(base, label)));
13436
+ const entry = toPosix4(relative12(configDir, resolve14(base, label)));
13383
13437
  return { manifest, absPath: manifest.absPath, entry, join: manifest.join };
13384
13438
  }
13385
13439
  const value = data[manifest.join];
@@ -13643,7 +13697,7 @@ async function runValidate(opts) {
13643
13697
  const place = provenanceManifests2.length === 0 ? void 0 : readerPlace(label, extracted.data, provenanceManifests2, declaredCollections, configDir ?? cwd, base);
13644
13698
  deriveInputs.push({
13645
13699
  label,
13646
- absPath: resolve14(base, label),
13700
+ absPath: resolve15(base, label),
13647
13701
  content,
13648
13702
  extracted,
13649
13703
  ...place !== void 0 ? { provenanceManifest: place } : {}
@@ -13774,7 +13828,7 @@ async function runValidate(opts) {
13774
13828
  await processOne(STDIN_LABEL, content, forcedExtractor.extensions[0] ?? "");
13775
13829
  }
13776
13830
  for (const file of files) {
13777
- const content = await readFile9(resolve14(base, file), "utf8");
13831
+ const content = await readFile9(resolve15(base, file), "utf8");
13778
13832
  await processOne(file, content, extname4(file));
13779
13833
  }
13780
13834
  if (unverified > 0) opts.onNotice?.(unverifiedWarning(unverified));
@@ -13920,7 +13974,7 @@ async function runValidate(opts) {
13920
13974
 
13921
13975
  // src/meta/commands/get.ts
13922
13976
  import { readFile as readFile10 } from "node:fs/promises";
13923
- import { resolve as resolve15, extname as extname5 } from "node:path";
13977
+ import { resolve as resolve16, extname as extname5 } from "node:path";
13924
13978
  async function runGet(opts) {
13925
13979
  const cwd = opts.cwd ?? process.cwd();
13926
13980
  if (opts.fields.length === 0) {
@@ -14006,7 +14060,7 @@ async function runGet(opts) {
14006
14060
  const place = provenanceManifests2.length === 0 ? void 0 : readerPlace(label, own2.data, provenanceManifests2, declaredCollections, configDir ?? cwd, base);
14007
14061
  deriveInputs.push({
14008
14062
  label,
14009
- absPath: resolve15(base, label),
14063
+ absPath: resolve16(base, label),
14010
14064
  content,
14011
14065
  extracted: own2,
14012
14066
  ...place !== void 0 ? { provenanceManifest: place } : {}
@@ -14048,7 +14102,7 @@ async function runGet(opts) {
14048
14102
  readOne(STDIN_LABEL, opts.stdinContent ?? "", forced.extensions[0] ?? "");
14049
14103
  }
14050
14104
  for (const file of files) {
14051
- const content = await readFile10(resolve15(base, file), "utf8");
14105
+ const content = await readFile10(resolve16(base, file), "utf8");
14052
14106
  readOne(file, content, extname5(file));
14053
14107
  }
14054
14108
  if (deriving) {
@@ -14175,7 +14229,7 @@ function parseJsonPointer(pointer) {
14175
14229
  // src/meta/commands/schemas.ts
14176
14230
  import { existsSync as existsSync4 } from "node:fs";
14177
14231
  import { mkdir as mkdir2, readFile as readFile11 } from "node:fs/promises";
14178
- import { dirname as dirname10, extname as extname6, isAbsolute as isAbsolute8, join as join9, relative as relative13, resolve as resolve16, sep as sep8 } from "node:path";
14232
+ import { dirname as dirname10, extname as extname6, isAbsolute as isAbsolute9, join as join9, relative as relative13, resolve as resolve17, sep as sep8 } from "node:path";
14179
14233
  import { parseDocument as parseDocument7, parse as parseYaml6, stringify as stringify3 } from "yaml";
14180
14234
  function getSchemasInfo() {
14181
14235
  return { builtins: listBuiltins(), formats: listFormats() };
@@ -14269,13 +14323,13 @@ async function runVendorSchema(opts) {
14269
14323
  );
14270
14324
  }
14271
14325
  const loaded = await loadConfig(opts.configPath, cwd);
14272
- const configPath = loaded?.path ?? resolve16(cwd, DEFAULT_CONFIG_NAME);
14326
+ const configPath = loaded?.path ?? resolve17(cwd, DEFAULT_CONFIG_NAME);
14273
14327
  const configDir = loaded?.dir ?? cwd;
14274
- const absDir = resolve16(cwd, opts.dir ?? DEFAULT_VENDOR_DIR);
14328
+ const absDir = resolve17(cwd, opts.dir ?? DEFAULT_VENDOR_DIR);
14275
14329
  const absFile = join9(absDir, vendorFileName(url));
14276
14330
  await assertNotIgnored(absFile, absDir, cwd, opts.onNotice);
14277
14331
  const fromConfig = posixRelative(configDir, absFile);
14278
- const ref = isAbsolute8(fromConfig) || fromConfig === "" ? absFile : fromConfig.startsWith(".") ? fromConfig : `./${fromConfig}`;
14332
+ const ref = isAbsolute9(fromConfig) || fromConfig === "" ? absFile : fromConfig.startsWith(".") ? fromConfig : `./${fromConfig}`;
14279
14333
  const { bytes } = await fetchSchemaBytes(url, {
14280
14334
  ...opts.timeoutMs !== void 0 ? { timeoutMs: opts.timeoutMs } : {},
14281
14335
  ...opts.maxBytes !== void 0 ? { maxBytes: opts.maxBytes } : {}
@@ -14452,7 +14506,7 @@ async function runInferSchema(opts) {
14452
14506
  }
14453
14507
  let absOut;
14454
14508
  if (opts.out !== void 0) {
14455
- absOut = resolve16(cwd, opts.out);
14509
+ absOut = resolve17(cwd, opts.out);
14456
14510
  await assertNotIgnored(
14457
14511
  absOut,
14458
14512
  dirname10(absOut),
@@ -14540,7 +14594,7 @@ async function runInferSchema(opts) {
14540
14594
  scanOne(STDIN_LABEL, opts.stdinContent ?? "", forced.extensions[0] ?? "");
14541
14595
  }
14542
14596
  for (const file of files) {
14543
- const content = await readFile11(resolve16(base, file), "utf8");
14597
+ const content = await readFile11(resolve17(base, file), "utf8");
14544
14598
  scanOne(file, content, extname6(file));
14545
14599
  }
14546
14600
  for (const u of unreadable) {
@@ -14602,7 +14656,7 @@ async function runInferSchema(opts) {
14602
14656
  import { randomBytes as randomBytes2 } from "node:crypto";
14603
14657
  import { existsSync as existsSync5 } from "node:fs";
14604
14658
  import { mkdir as mkdir3, open as open2, readFile as readFile12, rename as rename3, rm as rm3 } from "node:fs/promises";
14605
- import { dirname as dirname11, isAbsolute as isAbsolute9, resolve as resolve17, extname as extname7, sep as sep9 } from "node:path";
14659
+ import { dirname as dirname11, isAbsolute as isAbsolute10, resolve as resolve18, extname as extname7, sep as sep9 } from "node:path";
14606
14660
 
14607
14661
  // src/shared/prompt.ts
14608
14662
  import { createInterface } from "node:readline";
@@ -14941,10 +14995,10 @@ async function runQuery(opts) {
14941
14995
  readOne(STDIN_LABEL, opts.stdinContent ?? "", ext);
14942
14996
  }
14943
14997
  for (const file of files) {
14944
- const content = await readFile12(resolve17(base, file), "utf8");
14998
+ const content = await readFile12(resolve18(base, file), "utf8");
14945
14999
  readOne(file, content, extname7(file));
14946
15000
  }
14947
- const db = opts.db === void 0 ? void 0 : { resolved: resolve17(cwd, opts.db), display: opts.db };
15001
+ const db = opts.db === void 0 ? void 0 : { resolved: resolve18(cwd, opts.db), display: opts.db };
14948
15002
  const run2 = await runSql(sql, entries, {
14949
15003
  target: db,
14950
15004
  params: boundParams,
@@ -15085,7 +15139,7 @@ async function runSql(sql, entries, ctx) {
15085
15139
  const place = manifests.length === 0 ? void 0 : readerPlace(e.label, e.own.data, manifests, ctx.declaredCollections, manifestRoot, ctx.base);
15086
15140
  return {
15087
15141
  label: e.label,
15088
- absPath: resolve17(ctx.base, e.label),
15142
+ absPath: resolve18(ctx.base, e.label),
15089
15143
  content: e.content,
15090
15144
  extracted: e.own,
15091
15145
  ...place !== void 0 ? { provenanceManifest: place } : {}
@@ -15550,20 +15604,20 @@ function displayPath(ctx, abs) {
15550
15604
  }
15551
15605
  function assertSchemaWriteWithin(ctx, abs) {
15552
15606
  const within = posixRelative(ctx.trustRoot.dir, abs);
15553
- if (within !== "" && !within.startsWith("..") && !isAbsolute9(within)) return;
15607
+ if (within !== "" && !within.startsWith("..") && !isAbsolute10(within)) return;
15554
15608
  throw new DocmetaError(
15555
15609
  `The resolved schema "${abs}" lives outside ${ctx.trustRoot.dir}; DDL edits schemas inside the repository. Evolve it where it lives, or vendor a copy in.`
15556
15610
  );
15557
15611
  }
15558
15612
  function foldPath(p) {
15559
- const abs = resolve17(p);
15613
+ const abs = resolve18(p);
15560
15614
  return process.platform === "win32" ? abs.toLowerCase() : abs;
15561
15615
  }
15562
15616
  function filePinsByPath(ctx) {
15563
15617
  const byPath = /* @__PURE__ */ new Map();
15564
15618
  for (const [ref, pin] of collectSchemaPins(ctx.config)) {
15565
15619
  if (classifyRef(ref).kind !== "file") continue;
15566
- byPath.set(foldPath(resolve17(ctx.cwd, ref)), pin);
15620
+ byPath.set(foldPath(resolve18(ctx.cwd, ref)), pin);
15567
15621
  }
15568
15622
  return byPath;
15569
15623
  }
@@ -15591,7 +15645,7 @@ async function loadSetMembers(refs, ctx) {
15591
15645
  });
15592
15646
  continue;
15593
15647
  }
15594
- const abs = resolve17(ctx.cwd, ref);
15648
+ const abs = resolve18(ctx.cwd, ref);
15595
15649
  const canon = foldPath(abs);
15596
15650
  if (seenFiles.has(canon)) continue;
15597
15651
  seenFiles.add(canon);
@@ -15796,7 +15850,7 @@ async function planSchemaMutation(ops, entries, ctx) {
15796
15850
  const [, name2, ver] = target.builtinId.split(":");
15797
15851
  const safe = (s) => s.replace(/[^A-Za-z0-9._-]/g, "-");
15798
15852
  const forkName = `${safe(name2 ?? "schema")}-${safe(ver ?? "0")}.local.json`;
15799
- schemaAbs = resolve17(ctx.configDir ?? ctx.cwd, "schemas", forkName);
15853
+ schemaAbs = resolve18(ctx.configDir ?? ctx.cwd, "schemas", forkName);
15800
15854
  assertSchemaWriteWithin(ctx, schemaAbs);
15801
15855
  if (existsSync5(schemaAbs)) {
15802
15856
  throw new DocmetaError(
@@ -15963,7 +16017,7 @@ async function planConfigEdit(ctx, edit, runRefs) {
15963
16017
  }
15964
16018
  return void 0;
15965
16019
  };
15966
- const rebaseRaw = (raw) => classifyRef(raw).kind === "file" && !isAbsolute9(raw) ? resolve17(configDir, raw) : raw;
16020
+ const rebaseRaw = (raw) => classifyRef(raw).kind === "file" && !isAbsolute10(raw) ? resolve18(configDir, raw) : raw;
15967
16021
  const wantSet = runRefs.map(rebaseRaw).sort().join("\n");
15968
16022
  const seqResolvesToRunSet = (node) => {
15969
16023
  if (!isSeq5(node)) return false;
@@ -16008,7 +16062,7 @@ async function planConfigEdit(ctx, edit, runRefs) {
16008
16062
  if (!isMap8(item)) continue;
16009
16063
  const raw = rawRefOf(item);
16010
16064
  if (raw === void 0 || classifyRef(raw).kind !== "file") continue;
16011
- const abs = isAbsolute9(raw) ? raw : resolve17(configDir, raw);
16065
+ const abs = isAbsolute10(raw) ? raw : resolve18(configDir, raw);
16012
16066
  if (foldPath(abs) !== wantPath) continue;
16013
16067
  pinFrom = item.get("integrity");
16014
16068
  item.set("integrity", edit.integrity.value);
@@ -16237,7 +16291,7 @@ function buildChanges(diff, entries, sentinel, ctx, renameHints = [], booleanAdd
16237
16291
  `"${file}": no writable format for that extension.`
16238
16292
  );
16239
16293
  }
16240
- if (existsSync5(resolve17(ctx.base, file))) {
16294
+ if (existsSync5(resolve18(ctx.base, file))) {
16241
16295
  throw new DocmetaError(
16242
16296
  `"${file}" already exists; INSERT creates new files only.`
16243
16297
  );
@@ -16256,7 +16310,7 @@ function buildChanges(diff, entries, sentinel, ctx, renameHints = [], booleanAdd
16256
16310
  `"${from}" -> "${to}": a rename may not change the extension.`
16257
16311
  );
16258
16312
  }
16259
- if (existsSync5(resolve17(ctx.base, to))) {
16313
+ if (existsSync5(resolve18(ctx.base, to))) {
16260
16314
  throw new DocmetaError(
16261
16315
  `"${to}" already exists; the rename would overwrite it.`
16262
16316
  );
@@ -16285,13 +16339,13 @@ function validateNewPath(p, base) {
16285
16339
  const refuse = (why) => {
16286
16340
  throw new DocmetaError(`"${p}" is not a usable path: ${why}.`);
16287
16341
  };
16288
- if (isAbsolute9(p)) refuse("it is absolute");
16342
+ if (isAbsolute10(p)) refuse("it is absolute");
16289
16343
  if (p.split(/[\\/]/).some((segment) => segment === "..")) {
16290
16344
  refuse("it traverses upward");
16291
16345
  }
16292
- const abs = resolve17(base, p);
16293
- if (abs === resolve17(base)) refuse("it points at the corpus root, not a file");
16294
- if (!abs.startsWith(resolve17(base) + sep9)) refuse("it escapes the corpus");
16346
+ const abs = resolve18(base, p);
16347
+ if (abs === resolve18(base)) refuse("it points at the corpus root, not a file");
16348
+ if (!abs.startsWith(resolve18(base) + sep9)) refuse("it escapes the corpus");
16295
16349
  }
16296
16350
  function refuseJoinFieldChanges(changes, entries, ctx) {
16297
16351
  const index = ctx.externalMetadata;
@@ -16442,7 +16496,7 @@ async function planManifestEdits(changes, entries, ctx, renameHints) {
16442
16496
  );
16443
16497
  const index = await leftOut;
16444
16498
  if (index === null) return void 0;
16445
- const abs = resolve17(ctx.base, file);
16499
+ const abs = resolve18(ctx.base, file);
16446
16500
  const named = index.entries.find(
16447
16501
  (e) => e.join === PATH_JOIN && e.abs === abs && excluded.includes(e.collection)
16448
16502
  );
@@ -16489,7 +16543,7 @@ async function planManifestEdits(changes, entries, ctx, renameHints) {
16489
16543
  continue;
16490
16544
  }
16491
16545
  if ("renamed" in c) {
16492
- const supplied = ctx.externalMetadata?.byPath.get(resolve17(ctx.base, c.file));
16546
+ const supplied = ctx.externalMetadata?.byPath.get(resolve18(ctx.base, c.file));
16493
16547
  const seen = /* @__PURE__ */ new Set();
16494
16548
  for (const [key, sv] of supplied ?? []) {
16495
16549
  if (seen.has(sv.file) || !ctx.memberships(c.file).includes(sv.collection)) continue;
@@ -16791,14 +16845,14 @@ async function applyChanges(changes, entries, ctx, schemaPlan, manifestWrites =
16791
16845
  const pendingWrites = [];
16792
16846
  const pendingRenames = [];
16793
16847
  for (const [label, ops] of grouped) {
16794
- const path = resolve17(ctx.base, label);
16848
+ const path = resolve18(ctx.base, label);
16795
16849
  if (ops.renamedTo !== void 0) {
16796
16850
  if (!existsSync5(path)) {
16797
16851
  throw new DocmetaError(
16798
16852
  `"${label}" is gone from disk since it was read; re-run the query.`
16799
16853
  );
16800
16854
  }
16801
- const toDisk = resolve17(ctx.base, ops.renamedTo);
16855
+ const toDisk = resolve18(ctx.base, ops.renamedTo);
16802
16856
  if (existsSync5(toDisk)) {
16803
16857
  throw new DocmetaError(
16804
16858
  `"${ops.renamedTo}" appeared on disk since the plan; re-run the query.`
@@ -17052,7 +17106,7 @@ function skipExpression(sql, from) {
17052
17106
 
17053
17107
  // src/meta/commands/fill.ts
17054
17108
  import { readFile as readFile13 } from "node:fs/promises";
17055
- import { resolve as resolve18, extname as extname8, join as join10 } from "node:path";
17109
+ import { resolve as resolve19, extname as extname8, join as join10 } from "node:path";
17056
17110
  import {
17057
17111
  completeValidatedJSON,
17058
17112
  makeProvider,
@@ -17916,7 +17970,7 @@ async function runFill(opts) {
17916
17970
  }
17917
17971
  const changed = next !== content || manifestChanged;
17918
17972
  if (next !== content && !dryRun && label !== "<stdin>") {
17919
- await writeFileAtomic(resolve18(base, label), next);
17973
+ await writeFileAtomic(resolve19(base, label), next);
17920
17974
  }
17921
17975
  if (manifestChanged) {
17922
17976
  let texts;
@@ -17948,7 +18002,7 @@ async function runFill(opts) {
17948
18002
  const prepareAll = async () => ({
17949
18003
  stdin: usingStdin ? await prepareOne("<stdin>", opts.stdinContent ?? "", forcedExtractor?.extensions[0] ?? "") : void 0,
17950
18004
  files: await mapConcurrent(files, concurrency, async (file) => {
17951
- const content = await readFile13(resolve18(base, file), "utf8");
18005
+ const content = await readFile13(resolve19(base, file), "utf8");
17952
18006
  return prepareOne(file, content, extname8(file));
17953
18007
  })
17954
18008
  });
@@ -18378,7 +18432,7 @@ async function mapConcurrent(items2, limit, fn) {
18378
18432
 
18379
18433
  // src/meta/commands/derive.ts
18380
18434
  import { readFile as readFile14 } from "node:fs/promises";
18381
- import { extname as extname9, relative as relative14, resolve as resolve19, sep as sep10 } from "node:path";
18435
+ import { extname as extname9, relative as relative14, resolve as resolve20, sep as sep10 } from "node:path";
18382
18436
  var GENERATED_BY_ENV = "MANNI_GENERATED_BY";
18383
18437
  var SOURCE_HINT = "narrow --sources or --fields";
18384
18438
  async function runDerive(opts) {
@@ -18489,7 +18543,7 @@ async function runDerive(opts) {
18489
18543
  const files = fromCollections ? retainMembers(walked, membersFor) : walked;
18490
18544
  const rangesByPage = /* @__PURE__ */ new Map();
18491
18545
  for (const t of targets) {
18492
- const label = relative14(base, resolve19(base, t.page)).split(sep10).join("/");
18546
+ const label = relative14(base, resolve20(base, t.page)).split(sep10).join("/");
18493
18547
  if (!files.includes(label)) {
18494
18548
  throw new DocmetaError(
18495
18549
  `${t.target} does not name one file that derive reads; a range names lines of one file.`
@@ -18514,7 +18568,7 @@ async function runDerive(opts) {
18514
18568
  const loaded2 = /* @__PURE__ */ new Map();
18515
18569
  const errors2 = /* @__PURE__ */ new Map();
18516
18570
  for (const label of files) {
18517
- const absPath = resolve19(base, label);
18571
+ const absPath = resolve20(base, label);
18518
18572
  const extractor = forcedExtractor ?? extractorForExtension(extname9(label));
18519
18573
  if (!extractor) {
18520
18574
  errors2.set(label, {
@@ -19698,6 +19752,7 @@ export {
19698
19752
  encryptValue,
19699
19753
  decryptValue,
19700
19754
  findGitRoot,
19755
+ valeConfigPath,
19701
19756
  notice,
19702
19757
  findConfigFile,
19703
19758
  readConfigFile,
@@ -19877,4 +19932,4 @@ export {
19877
19932
  renderQuery,
19878
19933
  renderQueryCsv
19879
19934
  };
19880
- //# sourceMappingURL=chunk-5O4FIGDJ.js.map
19935
+ //# sourceMappingURL=chunk-HUHERW7E.js.map