@hawkeyexl/manni 4.0.3 → 4.1.0

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,6 +8,7 @@ import {
8
8
  DocmetaError,
9
9
  FILL_FORMATS,
10
10
  FILL_FORMAT_LIST,
11
+ LOCAL_FLAG_HELP,
11
12
  LOCATION_EXTERNAL_SCHEMA,
12
13
  LOCATION_PAGE_SCHEMA,
13
14
  OMITTED_WHEN_CLEAN,
@@ -63,7 +64,7 @@ import {
63
64
  terminalConfirm,
64
65
  toJsonText,
65
66
  warn
66
- } from "./chunk-TQG3WCJY.js";
67
+ } from "./chunk-I57KBF45.js";
67
68
 
68
69
  // src/meta/cli.ts
69
70
  import { existsSync } from "node:fs";
@@ -1063,14 +1064,11 @@ function buildProgram() {
1063
1064
  []
1064
1065
  ).option("--ext <list>", "comma-separated extensions for directory walks").option("--exclude <glob>", "glob to exclude; repeatable", collect, []).option("--as <format>", "force an input format (e.g. markdown, mdx)").option("--fields <list>", "comma-separated fields to fill").option("--confidence <n>", "minimum confidence to write (0-1)", parseFloat).option("--dry-run", "report proposals without writing them").option(
1065
1066
  "--provider <name>",
1066
- "provider: auto (default), anthropic, openai, claude-cli, llama-cpp, mock"
1067
+ "provider: auto (default), anthropic, openai, claude-cli, llama-cpp"
1067
1068
  ).option(
1068
1069
  "--model <model>",
1069
1070
  "model override; needs a named provider, from here or config"
1070
- ).option("--no-cache", "bypass the proposal cache").option(
1071
- "--local",
1072
- "run inference on this machine; refuses any hosted provider, claude-cli included"
1073
- ).option("--max-turns <n>", "stop after this many inference calls", parseFloat).option(
1071
+ ).option("--no-cache", "bypass the proposal cache").option("--local", LOCAL_FLAG_HELP).option("--max-turns <n>", "stop after this many inference calls", parseFloat).option(
1074
1072
  "--chunk-chars <n>",
1075
1073
  "characters of document per call (default 12000)",
1076
1074
  parseFloat
@@ -1533,4 +1531,4 @@ export {
1533
1531
  reportConfig,
1534
1532
  buildProgram
1535
1533
  };
1536
- //# sourceMappingURL=chunk-DEP5AMVA.js.map
1534
+ //# sourceMappingURL=chunk-JODRT4NF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/meta/cli.ts","../src/shared/cli-options.ts","../src/meta/reporters/relocate.ts","../src/meta/commands/validate-offer.ts","../src/meta/reporters/infer.ts"],"sourcesContent":["/**\n * docmeta CLI. Thin commander wrapper over the command cores. Follows clig.dev:\n * primary output to stdout, diagnostics to stderr, color only on a TTY (and\n * never when NO_COLOR/--no-color), meaningful exit codes (0 ok, 1 validation\n * failures, 2 operational/usage errors).\n */\nimport { existsSync } from \"node:fs\";\nimport { extname, resolve as resolvePath } from \"node:path\";\nimport { Command, Option } from \"commander\";\nimport picomatch from \"picomatch\";\nimport pkg from \"../../package.json\" with { type: \"json\" };\nimport {\n collect,\n configOption,\n explicitFalse,\n readStdin,\n reportConfig,\n splitList,\n} from \"../shared/cli-options.js\";\nimport { fail } from \"../shared/run.js\";\nimport { notice, warn } from \"../shared/warn.js\";\nimport { LOCAL_FLAG_HELP } from \"../shared/providers.js\";\nimport { terminalConfirm } from \"../shared/prompt.js\";\nimport {\n DocmetaError,\n type RunSummary,\n type ValidationResult,\n} from \"./types.js\";\nimport { runValidate } from \"./commands/validate.js\";\nimport { offerRelocation } from \"./commands/validate-offer.js\";\nimport { runGet } from \"./commands/get.js\";\nimport { runQuery } from \"./commands/query.js\";\nimport {\n DEFAULT_VENDOR_DIR,\n getSchemasInfo,\n runInferSchema,\n runVendorSchema,\n} from \"./commands/schemas.js\";\nimport { runFill } from \"./commands/fill.js\";\nimport { deriveFailed, runDerive } from \"./commands/derive.js\";\nimport { supportedExtensions } from \"./extractors/index.js\";\nimport {\n COMMON_FORMATS,\n COMMON_FORMAT_LIST,\n OMITTED_WHEN_CLEAN,\n QUERY_FORMATS,\n QUERY_FORMAT_LIST,\n REPORT_FORMATS,\n REPORT_FORMAT_LIST,\n isCommonFormat,\n isMachineFormat,\n isQueryFindingsFormat,\n isQueryFormat,\n isReportFormat,\n render,\n type CommonFormat,\n type QueryFindingsFormat,\n} from \"./reporters/index.js\";\nimport { rowsToFindings } from \"./core/checks.js\";\nimport { loadConfig } from \"./core/config.js\";\nimport type { RegisteredSchemas } from \"./core/schema-registry.js\";\nimport { isParamName } from \"./core/projection.js\";\nimport type { QueryRun } from \"./commands/query.js\";\nimport {\n FILL_FORMATS,\n FILL_FORMAT_LIST,\n isFillFormat,\n renderFill,\n} from \"./reporters/fill.js\";\nimport {\n DERIVE_FORMATS,\n DERIVE_FORMAT_LIST,\n isDeriveFormat,\n renderDerive,\n} from \"./reporters/derive.js\";\nimport { relocateFailed, runRelocate } from \"./commands/relocate.js\";\nimport {\n RELOCATE_FORMATS,\n isRelocateFormat,\n renderRelocate,\n} from \"./reporters/relocate.js\";\nimport { renderGet } from \"./reporters/get.js\";\nimport { renderQuery, renderQueryCsv } from \"./reporters/query.js\";\nimport { renderInfer } from \"./reporters/infer.js\";\nimport { shouldColor, palette } from \"../shared/color.js\";\n\nfunction resolveColor(program: Command): boolean {\n // commander maps --no-color to opts.color === false.\n const noColor = program.opts().color === false;\n // Passed through uncoerced. `@types/node` declares `isTTY` as `boolean`, but\n // Node leaves it **undefined** on a stream that is not a terminal — it is\n // never `false` — and `shouldColor` already takes `isTTY?` and treats a\n // missing one as \"not a terminal\". A `Boolean()` here only restated that,\n // where the declared type says it restates nothing.\n return shouldColor({ noColor, isTTY: process.stdout.isTTY });\n}\n\n/**\n * The `--format` a subcommand was actually given, when its **parent** also\n * declares one.\n *\n * commander lets an option declared on a parent be written anywhere in the\n * argv, so `manni meta schemas infer -f json` binds `json` to the `schemas`\n * command — `infer`'s own `--format` keeps its default and the run answers in\n * `pretty`. Silently. That is the same false green `schemas -f github` was\n * fixed for: a request docmeta could honor, answered in a format nobody asked\n * for, with exit 0.\n *\n * `getOptionValueSource` is the public way to tell a typed value from a\n * default, so this reads both commands and prefers whichever was actually\n * typed, rather than depending on which one commander happens to bind to.\n */\nfunction formatFor(command: Command, own: unknown): unknown {\n if (command.getOptionValueSource(\"format\") === \"cli\") return own;\n const parent = command.parent;\n if (parent && parent.getOptionValueSource(\"format\") === \"cli\") {\n return parent.opts().format;\n }\n return own;\n}\n\n/** A `--format` value one of the two-format commands (`get`, `schemas`) rejects. */\nfunction assertCommonFormat(value: unknown): CommonFormat {\n const format = String(value);\n if (!isCommonFormat(format)) {\n throw new DocmetaError(\n `Unknown --format \"${format}\". Use ${COMMON_FORMAT_LIST}.`,\n );\n }\n return format;\n}\n\n/** The one input token that is neither a path nor a field: stdin. */\nconst STDIN = \"-\";\n\n/**\n * Does this token name a path rather than a field list?\n *\n * `get`'s field list is positional, so a user who forgets it has their *path*\n * bound to `[fields]`. Since the argument became optional the CLI can say so\n * outright instead of reporting the paths that are left as missing.\n *\n * The four positive tests mirror `suggestCommand`'s, `existsSync` included —\n * that leg is the one that catches a bare directory name (`manni meta get docs`),\n * which has neither a dot, a separator, nor a glob character.\n *\n * `existsSync` alone is too eager for a token with **no path shape at all**,\n * though, because field names collide with directory names constantly: `tags`,\n * `docs`, `type`, `content`. In a site repo holding a `tags/` directory,\n * `manni meta get tags docs/a.md` was refused as a path, and the remedy it\n * suggested (`manni meta get title tags`) was nonsense. So a shapeless token is\n * only read as a path when it is **alone** — nothing else was offered as one,\n * which is the shape of someone who forgot the field list. Give a path *and* a\n * bare name and the bare name is the field list: the only reading that makes\n * sense of both.\n *\n * Two negative tests matter more than any of the shape tests, because a false\n * positive rejects a legal field list:\n *\n * - a **comma** makes it a list, and a path holding one is vanishingly rare;\n * - a **leading `/`** is a JSON Pointer, the documented way to address a nested\n * or dotted key — `manni meta get /author/email page.md` is exactly the usage\n * the separator test would otherwise refuse.\n *\n * They do not run *first*, though, and the distinction is worth stating because\n * the obvious reading of the list above is that they do: a token that names a\n * file which really exists is taken as a path before either is consulted. So a\n * JSON Pointer that happens to match a real absolute path — `/author/email`, on\n * a machine where that file exists — is read as a path. `--fields` is the\n * escape, and is why the guard can afford to be wrong here.\n */\nfunction looksLikePath(token: string, cwd: string, alone: boolean): boolean {\n if (token === STDIN) return false;\n // One scan, used twice: `shaped` needs it, and so does the positive test\n // below when `existsSync` did not settle the question.\n const scan = picomatch.scan(token);\n const shaped = /[\\\\/]/.test(token) || extname(token) !== \"\" || scan.isGlob;\n // A file that really is there settles it — but only when the token looks\n // like a path, or nothing else was offered as one.\n if ((shaped || alone) && existsSync(resolvePath(cwd, token))) return true;\n if (token.includes(\",\") || token.startsWith(\"/\")) return false;\n if (scan.isGlob) return true;\n const ext = extname(token).toLowerCase();\n if (ext !== \"\" && supportedExtensions().includes(ext)) return true;\n return /[\\\\/]/.test(token);\n}\n\n/**\n * `get`'s one input rule: **if `--fields` is present, every positional is a\n * path.** Otherwise the first positional is the field list, exactly as before.\n *\n * The missing-field-list case is handled *here* rather than left to `runGet`.\n * `options.fields ?? fieldsArg` is `undefined` when neither was given, and\n * `String(undefined).split(\",\")` is `[\"undefined\"]` — a field list of length\n * one, so `runGet`'s `fields.length === 0` guard never fires and a bare\n * `manni meta get` in a repo with config `paths:` prints `undefined=(unset)` per\n * file and exits 0. A successful-looking report for a field nobody named is\n * worse than the error it replaced.\n *\n * The positional is folded in on `fieldsArg !== undefined`, not with\n * `.filter(Boolean)`: an empty-string path is a mistake worth reporting, and\n * filtering it would silently drop it instead.\n */\nexport function resolveGetInputs(\n fieldsArg: string | undefined,\n pathsArg: string[],\n fieldsOption: unknown,\n cwd: string,\n): { fields: string[]; paths: string[] } {\n const flag = typeof fieldsOption === \"string\" ? fieldsOption : undefined;\n\n if (\n flag === undefined &&\n fieldsArg !== undefined &&\n looksLikePath(fieldsArg, cwd, pathsArg.length === 0)\n ) {\n throw new DocmetaError(\n `\"${fieldsArg}\" looks like a path, not a field list. Pass fields first (manni meta get title ${fieldsArg}) or use --fields.`,\n );\n }\n\n // `-` is stdin, never a field name. Letting it become one made\n // `manni meta get - --as markdown` print `-=(unset)` for every file in the\n // config's `paths:` and exit 0 — the piped document never read, the run\n // looking entirely successful. Dropping it here leaves `fields` empty, so\n // the missing-field-list error below fires instead.\n const source = flag ?? (fieldsArg === STDIN ? undefined : fieldsArg);\n const fields = source === undefined ? [] : splitList(source);\n if (fields.length === 0) {\n throw new DocmetaError(\n \"Specify at least one field to get. Pass fields first (manni meta get title docs/a.md) or use --fields.\",\n );\n }\n\n const paths =\n fieldsArg !== undefined && (flag !== undefined || fieldsArg === STDIN)\n ? [fieldsArg, ...pathsArg]\n : pathsArg;\n return { fields, paths };\n}\n\n/**\n * `query`'s input rule is `get`'s with SQL in the fields slot: **if `--query`\n * is present, every positional is a path**; otherwise the first positional is\n * the SQL. The same three guards apply and for the same reasons — a token\n * shaped like a path in the SQL slot is a forgotten statement, `-` is stdin\n * and never SQL, and an absent statement is an error rather than a\n * plausible-looking run. Real SQL never trips `looksLikePath`: a statement\n * with a column list contains a comma, and anything else with a space cannot\n * name a file that exists.\n *\n * `--db` relaxes exactly one of those guards: exporting needs no SQL, so with\n * `sqlOptional` a path-shaped first positional is a path and an absent\n * statement means \"just write the database\".\n */\nexport function resolveQueryInputs(\n sqlArg: string | undefined,\n pathsArg: string[],\n queryOption: unknown,\n cwd: string,\n sqlOptional = false,\n): { sql: string; paths: string[] } {\n const flag = typeof queryOption === \"string\" ? queryOption : undefined;\n\n if (\n flag === undefined &&\n sqlArg !== undefined &&\n // A token with whitespace is never a path: every real statement has\n // spaces, and without this test `SELECT count(*) FROM docs` reads as a\n // *glob* — picomatch parses `(*)` as an extglob — the one SQL shape the\n // comma test inside looksLikePath does not catch.\n !/\\s/.test(sqlArg) &&\n // With SQL optional there is no \"forgot the statement\" reading to\n // protect, so a shapeless token that really exists on disk is a path\n // even when other paths follow — hence `alone` is forced on.\n looksLikePath(sqlArg, cwd, sqlOptional || pathsArg.length === 0)\n ) {\n if (sqlOptional) return { sql: \"\", paths: [sqlArg, ...pathsArg] };\n throw new DocmetaError(\n `\"${sqlArg}\" looks like a path, not SQL. Pass the SQL first (manni meta query \"SELECT _path FROM docs\" ${sqlArg}) or use --query.`,\n );\n }\n\n const source = flag ?? (sqlArg === STDIN ? undefined : sqlArg);\n const sql = source?.trim() ?? \"\";\n if (sql === \"\" && !sqlOptional) {\n throw new DocmetaError(\n 'Specify SQL to run. Pass it first (manni meta query \"SELECT _path FROM docs\" docs/) or use --query.',\n );\n }\n\n const paths =\n sqlArg !== undefined && (flag !== undefined || sqlArg === STDIN)\n ? [sqlArg, ...pathsArg]\n : pathsArg;\n return { sql, paths };\n}\n\n/**\n * `--param` values into `QueryOptions.params` (proposal 0029).\n *\n * `name=value` binds the value as a **string** — metadata is mostly strings,\n * and a projection column has no type affinity, so a bound number would\n * silently never equal a stored string. `name:=value` parses the value as\n * JSON for the deliberate typed bind (numbers, booleans, arrays, null) — the\n * httpie/jq convention. `:=` is checked before `=`, the split happens at the\n * first separator, and everything after it is the value verbatim, so values\n * containing `=` need no escaping.\n */\nexport function parseQueryParams(\n raw: readonly string[],\n): Record<string, unknown> {\n // Null prototype: `__proto__` passes the name grammar, so it must land as\n // an ordinary own key rather than silently mutating the prototype.\n const params: Record<string, unknown> = Object.create(null) as Record<\n string,\n unknown\n >;\n for (const item of raw) {\n const typed = item.indexOf(\":=\");\n const plain = item.indexOf(\"=\");\n const useTyped = typed !== -1 && (plain === -1 || typed < plain);\n const at = useTyped ? typed : plain;\n if (at <= 0) {\n throw new DocmetaError(\n `--param \"${item}\" is not name=value. Use name=value to bind a string, or name:=json for a typed value.`,\n );\n }\n const name = item.slice(0, at);\n // Exactly the token grammar `collectNamedParameters` recognizes (an\n // optional $/:/@ prefix tolerated, as the API's key handling does) —\n // `isParamName` is the scan's own predicate, so the two cannot drift.\n // Anything else — a space, a leading digit, an empty name — could never\n // be referenced from the SQL, so the engine would ignore the bind and\n // the unbound-reference guard would never fire: the false-green path\n // this flag's design closes would reopen through a typo.\n const bare = /^[$:@]/.test(name) ? name.slice(1) : name;\n if (!isParamName(bare)) {\n throw new DocmetaError(\n `--param name \"${name}\" cannot be bound: a SQL named parameter is letters, digits, and underscores, starting with a letter or underscore.`,\n );\n }\n const value = item.slice(at + (useTyped ? 2 : 1));\n if (!useTyped) {\n params[name] = value;\n continue;\n }\n try {\n params[name] = JSON.parse(value) as unknown;\n } catch {\n throw new DocmetaError(\n `--param ${name}:=${value} is not valid JSON. Quote a string — --param '${name}:=\"${value}\"' — or drop the colon (--param ${name}=${value}) to bind it as a string.`,\n );\n }\n }\n return params;\n}\n\n/**\n * Render a `query --check` run through a findings format (proposal 0026).\n *\n * The row→finding mapping is the same module `validate`'s named checks use;\n * here the check has no configured name, so its findings carry `check:query`.\n * The `RunSummary` `render()` takes is synthesized from the mapped results —\n * every file present has findings, so passed is zero by construction — and\n * JUnit ships under its own classname rather than validate's.\n *\n * Exit semantics stay `--check`'s own: rows mean findings mean exit 1.\n */\nfunction renderQueryFindings(run: QueryRun, format: QueryFindingsFormat): void {\n if (run.changes) {\n throw new DocmetaError(\n `--format ${format} renders result rows with a \\`path\\` column; this statement produced pending changes, not rows. Use pretty or json for the change preview.`,\n );\n }\n const results: ValidationResult[] = [...rowsToFindings(\n \"query\",\n run.columns,\n run.rows,\n )].map(([file, errors]) => ({\n file,\n format: \"query\",\n ok: false,\n schemas: [],\n errors,\n }));\n const summary: RunSummary = {\n files: results.length,\n passed: 0,\n failed: results.length,\n errors: results.reduce((n, r) => n + r.errors.length, 0),\n };\n const text = render(format, results, summary, {\n frame: run.frame,\n classname: \"manni.query\",\n onNotice: notice,\n });\n if (text.length > 0 || !OMITTED_WHEN_CLEAN.has(format)) {\n process.stdout.write(`${text}\\n`);\n }\n process.exitCode = run.rows.length > 0 ? 1 : 0;\n}\n\nconst COMMAND_NAMES = [\"validate\", \"get\", \"query\", \"fill\", \"schemas\"];\n\n/** Levenshtein distance. Only used to offer a \"did you mean\" hint. */\nfunction editDistance(a: string, b: string): number {\n let prev = Array.from({ length: b.length + 1 }, (_, i) => i);\n for (let i = 1; i <= a.length; i++) {\n const row = [i];\n for (let j = 1; j <= b.length; j++) {\n const cost = a[i - 1] === b[j - 1] ? 0 : 1;\n row.push(\n Math.min(\n (row[j - 1] ?? 0) + 1,\n (prev[j] ?? 0) + 1,\n (prev[j - 1] ?? 0) + cost,\n ),\n );\n }\n prev = row;\n }\n return prev[b.length] ?? 0;\n}\n\n/**\n * `validate` is the default command, so an unrecognized first token is parsed as\n * a *path* rather than rejected. Since a named path that does not exist is now\n * an error, `docmeta valdiate docs/` already fails with the right exit code —\n * but it fails as `File not found: \"valdiate\"`, which does not say what went\n * wrong. Upgrade the message when the token is plainly a misspelled command.\n *\n * The guard is deliberately narrow: anything holding a separator or a dot, any\n * glob, and — crucially — anything that actually exists on disk is a path, not a\n * typo. That last check is what makes a false positive impossible.\n */\nfunction suggestCommand(token: string | undefined, cwd: string): void {\n if (token === undefined || token === \"-\") return;\n if (/[\\\\/.]/.test(token)) return;\n if (picomatch.scan(token).isGlob) return;\n if (existsSync(resolvePath(cwd, token))) return;\n\n const near = COMMAND_NAMES.map(\n (name) => [name, editDistance(token.toLowerCase(), name)] as const,\n )\n .filter(([, d]) => d > 0 && d <= 2)\n .sort((x, y) => x[1] - y[1]);\n\n const best = near[0];\n if (!best) return;\n throw new DocmetaError(\n `Unknown command \"${token}\". Did you mean \"${best[0]}\"?`,\n );\n}\n\n/**\n * Range-check a numeric flag. `parseFloat(\"abc\")` is NaN and every comparison\n * against NaN is false, so the finite check has to be explicit or garbage\n * passes silently.\n */\nfunction numeric(\n name: string,\n value: number | undefined,\n min: number,\n max: number,\n): void {\n if (value === undefined) return;\n if (!Number.isFinite(value) || value < min || value > max) {\n throw new DocmetaError(\n `${name} must be a number between ${min} and ${max}, got ${value}.`,\n );\n }\n}\n\n/**\n * Commander hands an `.action()` callback an untyped bag of option values, so\n * each subcommand declares the shape it actually reads.\n *\n * The three-state flags are the reason this is worth writing down rather than\n * coercing at each use site. `-c`/`--no-config`, `--baseline`/`--no-baseline`,\n * `--no-gitignore` and `--no-cache` are only correct while *absent*, *a value*\n * and *an explicit `false`* stay distinguishable — absence leaves config in\n * charge, `false` overrides it. A union that names all three states is the one\n * place a reader finds that out; `String(options.format)` never said anything.\n */\n\n/** The flags the parity rule keeps identical across every input-taking command. */\ninterface InputCliOptions {\n /** `--ext <list>`; the command splits it. */\n ext?: string;\n /** `--exclude <glob>`, repeatable — commander's default value is `[]`. */\n exclude: string[];\n /** `--as <format>`: force an extractor. */\n as?: string;\n /** `-f, --format <format>`. Always a string: every declaration has a default. */\n format: string;\n /**\n * `--collection <name>`, repeatable — commander's default value is `[]`, and\n * that empty array travels to the core unchanged. `selectCollections` reads\n * it as \"every declared collection\", the same as absence, so there is no\n * `undefined` dance here and must not be one: `[]` meaning \"no collections\"\n * would make a plain run validate nothing and exit 0.\n */\n collection: string[];\n /**\n * `-c, --config <path>` and `--no-config` share one commander attribute:\n * `undefined` with neither flag, the path with `-c`, `false` with\n * `--no-config`. Split by `configOption`.\n */\n config?: string | boolean;\n}\n\n/** The rest of what `validate`, `get`, and `fill` share. */\ninterface RunCliOptions extends InputCliOptions {\n quiet?: boolean;\n allowEmpty?: boolean;\n /**\n * `--no-gitignore`. Commander supplies `true` when the flag is absent, so\n * this is `boolean` and never `undefined` — which is exactly why\n * `explicitFalse` exists to turn that default back into \"no opinion\".\n */\n gitignore: boolean;\n offline?: boolean;\n}\n\ninterface ValidateCliOptions extends RunCliOptions {\n /** `-s, --schema <ref>`, repeatable — commander's default value is `[]`. */\n schema: string[];\n /**\n * `--baseline [path]` / `--no-baseline`, the same three-state split as\n * `config`: absent leaves the config in charge, a string names a file, `true`\n * is a bare `--baseline` (the default path), `false` is `--no-baseline`.\n */\n baseline?: string | boolean;\n /** `--write-baseline [path]`; `true` for the bare flag. See `baseline`. */\n writeBaseline?: string | boolean;\n /**\n * `--no-checks`. Commander supplies `true` when the flag is absent — its\n * default, not a choice — so only the explicit `false` travels to the core,\n * the same shape as `gitignore`.\n */\n checks: boolean;\n /**\n * `--no-derive`. The same shape as `checks`: commander's `true` default is\n * not a choice, so only the explicit `false` travels to the core.\n */\n derive: boolean;\n /**\n * `--no-cache`. Commander's `true` default travels straight through: the\n * review cache answers the comparison unless the user said otherwise.\n */\n cache: boolean;\n}\n\ninterface GetCliOptions extends RunCliOptions {\n /** `--fields <list>`; when present, every positional is a path. */\n fields?: string;\n /**\n * `--no-derived` / `--derived`. Both spellings are registered, which is\n * why this is `boolean | undefined` rather than commander's usual `true`\n * default for a `--no-` flag: registering the positive form alongside it\n * removes that default, so the key is absent when neither was given.\n * Only the explicit `false` means anything — derivation is on otherwise,\n * and `--derived` is the no-op kept for scripts written before 0043.\n */\n derived?: boolean;\n /**\n * `--no-cache`. Commander supplies `true` when the flag is absent, so\n * this travels straight through: the review cache answers unless the\n * user said otherwise.\n */\n cache: boolean;\n}\n\n/**\n * Not `RunCliOptions`: `query` declares no `-q/--quiet`. `get` uses it to hide\n * files and `validate` to hide passes; a query result has no analogous noise,\n * and a flag that means nothing is what 0016 says not to declare.\n */\ninterface QueryCliOptions extends InputCliOptions {\n /** `--query <sql>`; when present, every positional is a path. */\n query?: string;\n /** `-s, --schema <ref>`, repeatable — commander's default value is `[]`. */\n schema: string[];\n /** `--check`: any row returned is a finding, so exit 1. */\n check?: boolean;\n /** `--param <name=value>`, repeatable — commander's default value is `[]`. */\n param: string[];\n /** `--db <path>`: also write the built database; SQL becomes optional. */\n db?: string;\n /** `--dry-run`: preview a mutating statement's diff; default applies. */\n dryRun?: boolean;\n allowEmpty?: boolean;\n /** `--no-gitignore`; commander's `true` default, see `explicitFalse`. */\n gitignore: boolean;\n offline?: boolean;\n /**\n * `--no-cache`. Commander's `true` default, like `gitignore`: the review\n * cache answers a `derived` build unless the user said otherwise.\n */\n cache: boolean;\n}\n\ninterface FillCliOptions extends RunCliOptions {\n /** `-s, --schema <ref>`, repeatable — commander's default value is `[]`. */\n schema: string[];\n fields?: string;\n /** Parsed by `parseFloat`, so possibly NaN — `numeric` is the range check. */\n confidence?: number;\n dryRun?: boolean;\n provider?: string;\n model?: string;\n /**\n * `--no-cache`. Commander supplies `true` when the flag is absent; unlike\n * `gitignore` that default is passed straight through, because the core's\n * `cache` has no config counterpart for it to override.\n */\n cache: boolean;\n local?: boolean;\n maxTurns?: number;\n chunkChars?: number;\n concurrency?: number;\n}\n\n/**\n * Not `RunCliOptions`: `derive` declares no `-q/--quiet` and no `--offline`.\n * It loads no schema, so there is nothing to fetch, and its report already\n * says `current` in one line per untouched file.\n */\ninterface DeriveCliOptions extends InputCliOptions {\n fields?: string;\n sources?: string;\n dryRun?: boolean;\n /** `--check`: implies `--dry-run`; a stale or unset field is a finding. */\n check?: boolean;\n /** `--no-cache`; commander's `true` default is passed through, as `fill` does. */\n cache: boolean;\n allowEmpty?: boolean;\n /** `--no-gitignore`; commander's `true` default, see `explicitFalse`. */\n gitignore: boolean;\n /**\n * `--generated-by <name>` (proposal 0046). No commander default: the core\n * reads `MANNI_GENERATED_BY` when it is absent, so help and the CLI\n * reference stay the same whatever the environment holds.\n */\n generatedBy?: string;\n}\n\n/**\n * Not `RunCliOptions`: `relocate` declares no `-q/--quiet` and no `--offline`.\n * It reads every page it moves, so there is nothing quiet to hide, and it\n * takes `-s` for the marks alone.\n */\ninterface RelocateCliOptions extends InputCliOptions {\n /** `--fields <list>`; the command splits it. */\n fields?: string;\n /** `-s, --schema <ref>`, repeatable — commander's default value is `[]`. */\n schema: string[];\n dryRun?: boolean;\n allowEmpty?: boolean;\n /** `--no-gitignore`; commander's `true` default, see `explicitFalse`. */\n gitignore: boolean;\n}\n\ninterface SchemasCliOptions {\n format: string;\n}\n\ninterface InferCliOptions extends InputCliOptions {\n out?: string;\n /** `--min-coverage <pct>`; commander's default value is `0`. */\n minCoverage: number;\n allowEmpty?: boolean;\n /** `--no-gitignore`; commander's `true` default, see `explicitFalse`. */\n gitignore: boolean;\n /** `--offline`; a no-op here by construction, see `InferOptions.offline`. */\n offline?: boolean;\n}\n\ninterface VendorCliOptions {\n /** `--dir <path>`; commander's default value is `DEFAULT_VENDOR_DIR`. */\n dir: string;\n /** `-c, --config <path>`. `vendor` declares no `--no-config`, so no `false`. */\n config?: string;\n}\n\n/**\n * The metadata tool's program. Named `meta` because that is where it is\n * mounted (`manni meta …`); the `docmeta` bin renames it before running it.\n */\nexport function buildProgram(): Command {\n const program = new Command();\n program\n .name(\"meta\")\n .description(\n \"Validate the presence and format of document metadata against JSON Schema.\",\n )\n .version(pkg.version, \"-V, --version\")\n .option(\"--no-color\", \"disable colored output\")\n // A pointer, not the whole help screen. Commander appends this after every\n // usage error, and ~40 lines of options per typo is noise in a CI log — the\n // message that precedes it already names the offending flag.\n .showHelpAfterError(\"(add --help for usage)\")\n // MUST come before the `.command()` calls below. `copyInheritedSettings`\n // copies `_exitCallback` **by value** at subcommand-creation time, so an\n // `exitOverride()` installed afterwards (including\n // `buildProgram().exitOverride()` from main) leaves every subcommand still\n // calling `process.exit(1)` while the program-level case looks fixed.\n .exitOverride();\n\n program\n .command(\"validate\", { isDefault: true })\n .description(\"Validate metadata in the given files/dirs/globs\")\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to validate (use - for stdin)\",\n )\n .option(\n \"-s, --schema <ref>\",\n \"schema to validate against; repeatable; overrides $schema/config\",\n collect,\n [],\n )\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format (e.g. markdown, mdx)\")\n .option(\n \"-f, --format <format>\",\n `output: ${REPORT_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\"-q, --quiet\", \"in pretty output, hide passing files\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"check files .gitignore covers\")\n .option(\n \"--offline\",\n \"never fetch a remote schema; resolve URL refs from the schema cache\",\n )\n // Neither flag carries `.preset()`, and neither carries a `defaultValue`.\n //\n // No `defaultValue`, because that would make the baseline active on runs\n // where the flag was never typed — semantically wrong, and it would oblige\n // the docs to carry a matching Default cell.\n //\n // No `.preset()` either, which is subtler. A preset hands the core the\n // default path as a *string*, making a bare `--baseline` indistinguishable\n // from an explicitly typed `--baseline .docmeta-baseline.json`. A typed path\n // is rightly relative to where the user is standing; an omitted one has to\n // mean \"the file this project's baseline lives in\" — `baseline:` from config\n // when there is one, resolved against the config's directory. Collapsing the\n // two made `--baseline` from a subdirectory look for the file beside the\n // user instead of beside the config, so the ratchet broke the moment anyone\n // ran from `docs/`, and a bare `--write-baseline` in a repo with a custom\n // `baseline:` recorded into a second file nothing reads.\n //\n // Commander hands the core `true` for an omitted value, which is exactly the\n // signal needed to tell the two cases apart.\n .addOption(\n new Option(\n \"--baseline [path]\",\n \"compare against a baseline; fail only on new findings\",\n ),\n )\n .addOption(\n new Option(\n \"--write-baseline [path]\",\n \"record current findings as the baseline, then exit 0 (stdin findings are not recorded and still fail)\",\n ),\n )\n .option(\"--no-baseline\", \"ignore a baseline configured by `baseline:`\")\n .option(\n \"--no-checks\",\n \"skip the corpus checks configured by `checks:` for this run\",\n )\n .option(\"--no-cache\", \"bypass the GitHub or GitLab review cache\")\n .option(\n \"--no-derive\",\n \"skip the derived-value comparison configured by derive:\",\n )\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni meta validate docs/ # walk a directory\",\n ' manni meta validate \"**/*.md\" -f github # CI annotations',\n ' manni meta validate \"**/*.md\" -f sarif > o.sarif # code scanning',\n \" manni meta validate page.md -s google:okf:0.1 -s ./my.schema.json\",\n \" cat page.md | manni meta validate - --as markdown\",\n \" manni meta validate --write-baseline # record today's backlog\",\n \" manni meta validate --baseline # fail only on new findings\",\n ].join(\"\\n\"),\n )\n .action(\n async (paths: string[], options: ValidateCliOptions, command: Command) => {\n try {\n // `validate` is the default command, so a misspelled subcommand lands\n // here as a path. Upgrade the message before it becomes \"not found\".\n suggestCommand(paths[0], process.cwd());\n const format = options.format;\n if (!isReportFormat(format)) {\n throw new DocmetaError(\n `Unknown --format \"${format}\". Use ${REPORT_FORMAT_LIST}.`,\n );\n }\n const exts: string[] | undefined = options.ext\n ? splitList(options.ext)\n : undefined;\n const stdinContent = paths.includes(\"-\")\n ? await readStdin()\n : undefined;\n\n const { results, summary, frame } = await runValidate({\n inputs: paths,\n cliSchemas: options.schema,\n exts,\n exclude: options.exclude,\n as: options.as,\n // Straight through: commander gives `[]` when the flag was never\n // typed, and the core reads an empty list as every declared\n // collection. Refusing paths beside it, and refusing it with no\n // config, is `resolveRunConfig`'s job, before the walk.\n collections: options.collection,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(\n !isMachineFormat(format),\n process.cwd(),\n ),\n stdinContent,\n // `undefined` rather than `false` when the flag is absent, so config\n // `allowEmpty:` still wins (the cores do `opts ?? config`).\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n // `undefined` rather than `false` when absent, so config `offline:`\n // still decides.\n offline: options.offline ? true : undefined,\n onNotice: notice,\n // `--baseline` and `--no-baseline` share one commander attribute, the\n // same three-state `undefined | string | false` split as `-c` /\n // `--no-config`: absent leaves the config in charge, a string names a\n // file, `false` suppresses a configured one for this run.\n baseline: options.baseline,\n writeBaseline: options.writeBaseline,\n // Like `gitignore`: only the explicit `--no-checks` travels, so\n // absence stays \"run them when the corpus rule allows\".\n checks: options.checks ? undefined : false,\n // And `--no-derive`, for the managed-field comparison.\n derive: options.derive ? undefined : false,\n // And `--no-cache`, so a wrong cached review answer can be re-asked.\n cache: options.cache,\n });\n\n const color = resolveColor(command.parent ?? command);\n const text = render(format, results, summary, {\n color,\n quiet: Boolean(options.quiet),\n // Non-presentational: SARIF needs to know where the run stood before\n // it can name a file the way the repository does.\n frame,\n onNotice: notice,\n });\n // Only `github` may say nothing on a clean run. Every other format owes\n // its envelope even when it is empty — see `OMITTED_WHEN_CLEAN`.\n if (text.length > 0 || !OMITTED_WHEN_CLEAN.has(format)) {\n process.stdout.write(`${text}\\n`);\n }\n process.exitCode = summary.failed > 0 ? 1 : 0;\n // P2 (proposal 0047): on a terminal, after the report, offer to move\n // what the location findings named. On stderr, so the report stays\n // machine-readable, and the exit code stays the report's. Never with\n // stdin among the inputs: it is not a terminal to ask on.\n await offerRelocation({\n results,\n inputs: paths,\n cliSchemas: options.schema,\n as: options.as,\n collections: options.collection,\n ...configOption(options.config),\n respectGitignore: explicitFalse(options.gitignore),\n offline: options.offline ? true : undefined,\n confirm: paths.includes(STDIN) ? undefined : terminalConfirm(),\n output: process.stderr,\n color: shouldColor({\n noColor: (command.parent ?? command).opts().color === false,\n isTTY: process.stderr.isTTY,\n }),\n });\n } catch (err) {\n fail(err);\n }\n },\n );\n\n program\n .command(\"get\")\n .description(\"Print metadata field values from the given files/dirs/globs\")\n // Optional, and the flag below is the unambiguous spelling. A required\n // positional ate the user's *path* when the field list was forgotten, and\n // reported the paths — which were never the problem — as missing.\n .argument(\n \"[fields]\",\n \"comma-separated metadata fields to print, unless --fields is given\",\n )\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to read (use - for stdin)\",\n )\n .option(\n \"--fields <list>\",\n \"comma-separated metadata fields to print; every positional is then a path\",\n )\n .option(\n \"--no-derived\",\n \"print only what the document stores, consulting no source\",\n )\n // Registered beside `--no-derived` on purpose. Commander gives a lone\n // `--no-x` the default `true`; declaring `--x` as well removes that\n // default, so \"neither flag\" is `undefined` and stays distinguishable —\n // and the spelling that used to turn derivation on still parses.\n .option(\"--derived\", \"accepted and inert: derivation is already on\")\n .option(\"--no-cache\", \"bypass the GitHub or GitLab review cache\")\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format (e.g. markdown, mdx)\")\n .option(\n \"-f, --format <format>\",\n `output: ${COMMON_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\n \"-q, --quiet\",\n \"in pretty output, hide files where every requested field is unset\",\n )\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"read files .gitignore covers\")\n .option(\n \"--offline\",\n \"accepted and ignored: get loads no schema, so there is nothing to fetch\",\n )\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni meta get title,type docs/intro.md\",\n \" manni meta get --fields title,type docs/intro.md\",\n \" manni meta get author.name,/author/email docs/intro.md\",\n ' manni meta get type \"**/*.md\" -f json',\n \" manni meta get owner docs/intro.md --no-derived\",\n \" cat page.md | manni meta get title - --as markdown\",\n ].join(\"\\n\"),\n )\n .action(\n async (\n fieldsArg: string | undefined,\n pathsArg: string[],\n options: GetCliOptions,\n command: Command,\n ) => {\n try {\n const format = assertCommonFormat(options.format);\n const { fields, paths } = resolveGetInputs(\n fieldsArg,\n pathsArg,\n options.fields,\n process.cwd(),\n );\n const exts: string[] | undefined = options.ext\n ? splitList(options.ext)\n : undefined;\n const stdinContent = paths.includes(\"-\")\n ? await readStdin()\n : undefined;\n\n const results = await runGet({\n fields,\n derived: options.derived !== false,\n cache: options.cache,\n inputs: paths,\n as: options.as,\n exclude: options.exclude,\n exts,\n collections: options.collection,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(format === \"pretty\", process.cwd()),\n stdinContent,\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n offline: options.offline ? true : undefined,\n onNotice: notice,\n });\n switch (format) {\n case \"json\":\n // `--quiet` is a pretty-output affordance; a filtered array would\n // be indistinguishable from an empty run to whatever parses this.\n process.stdout.write(`${JSON.stringify(results, null, 2)}\\n`);\n break;\n case \"pretty\": {\n const text = renderGet(results, fields, {\n color: resolveColor(command.parent ?? command),\n quiet: Boolean(options.quiet),\n });\n if (text.length > 0) process.stdout.write(`${text}\\n`);\n break;\n }\n default: {\n const unreachable: never = format;\n throw new DocmetaError(\n `Unknown --format ${JSON.stringify(unreachable)}. Use ${COMMON_FORMAT_LIST}.`,\n );\n }\n }\n // A document that would not parse is a finding, not an operational\n // failure: the run completed and reported on every file it was given.\n // Set after the report is written, so the values that did resolve are\n // on stdout either way.\n process.exitCode = results.some((r) => r.error !== undefined) ? 1 : 0;\n } catch (err) {\n fail(err);\n }\n },\n );\n\n program\n .command(\"query\")\n .description(\"Run SQL over the metadata of the given files/dirs/globs\")\n // Optional for the same reason `get`'s `[fields]` is: a required\n // positional would eat the user's *path* when the SQL was forgotten.\n .argument(\"[sql]\", \"SQL to run against the `docs` table, unless --query is given\")\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to load (use - for stdin)\",\n )\n .option(\n \"--query <sql>\",\n \"SQL to run against the `docs` table; every positional is then a path\",\n )\n .option(\n \"-s, --schema <ref>\",\n \"schema set a DDL statement evolves; repeatable; replaces the per-file resolution for the DDL planner only\",\n collect,\n [],\n )\n .option(\n \"--check\",\n \"treat returned rows as findings: exit 1 if the query returns any\",\n )\n .option(\n \"--param <name=value>\",\n \"bind a named SQL parameter ($name/:name/@name) as a string; name:=value parses the value as JSON; repeatable\",\n collect,\n [],\n )\n // The findings formats (github, sarif, junit) are declared in the shared\n // `-f, --format` option below; they are legal only with --check and a\n // `path` result column — see the action's gates.\n .option(\n \"--db <path>\",\n \"also write the built database to this file; SQL is then optional\",\n )\n .option(\n \"--dry-run\",\n \"preview a mutating statement's diff without applying it (--check implies this)\",\n )\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format (e.g. markdown, mdx)\")\n .option(\n \"-f, --format <format>\",\n `output: ${QUERY_FORMATS.join(\" | \")} (github, sarif, junit need --check)`,\n \"pretty\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"load files .gitignore covers\")\n .option(\"--no-cache\", \"bypass the GitHub or GitLab review cache\")\n .option(\n \"--offline\",\n \"accepted and ignored: query resolves schemas from disk and built-ins, never the network\",\n )\n .addHelpText(\n \"after\",\n [\n \"\",\n \"One row per file in a table named `docs`: your top-level metadata keys\",\n \"as columns, plus _path, _format, _present, and _data (all metadata as\",\n \"JSON, for json_each/->> reach into nested values).\",\n \"\",\n \"Examples:\",\n ' manni meta query \"SELECT _path, title FROM docs WHERE draft = 1\" docs/',\n ' manni meta query \"SELECT t.value tag, count(*) n FROM docs, json_each(docs.tags) t GROUP BY tag\" docs/',\n ' manni meta query --check \"SELECT slug, count(*) n FROM docs GROUP BY slug HAVING n > 1\" docs/',\n ' manni meta query -f csv \"SELECT _path, title, last_reviewed FROM docs\" docs/ > stale.csv',\n \" manni meta query --param author=\\\"O'Brien\\\" \\\"SELECT _path FROM docs WHERE author = \\\\$author\\\" docs/\",\n ' cat page.md | manni meta query \"SELECT title FROM docs\" - --as markdown',\n \" manni meta query --db docs.db docs/ # export only; open with any SQLite UI\",\n ].join(\"\\n\"),\n )\n .action(\n async (\n sqlArg: string | undefined,\n pathsArg: string[],\n options: QueryCliOptions,\n command: Command,\n ) => {\n try {\n const format = options.format;\n if (!isQueryFormat(format)) {\n throw new DocmetaError(\n `Unknown --format \"${format}\". Use ${QUERY_FORMAT_LIST}.`,\n );\n }\n // The findings formats render findings, and only `--check` produces\n // them. Gated before the run so the refusal costs nothing.\n if (isQueryFindingsFormat(format) && !options.check) {\n throw new DocmetaError(\n `--format ${format} renders findings, which only --check produces. Add --check, or use pretty, json, or csv.`,\n );\n }\n const { sql, paths } = resolveQueryInputs(\n sqlArg,\n pathsArg,\n options.query,\n process.cwd(),\n typeof options.db === \"string\",\n );\n // A `--db`-only export has no result rows to shape into CSV; its\n // summary stays with pretty/json. Refused before the run, like the\n // findings gate above.\n if (format === \"csv\" && sql === \"\") {\n throw new DocmetaError(\n \"--format csv renders result rows, and a --db export without SQL produces none. Use pretty or json for the export summary.\",\n );\n }\n // The findings formats have the same no-rows problem on an\n // export-only run — and silently printing the export summary would\n // be a --check gate that checked nothing.\n if (isQueryFindingsFormat(format) && sql === \"\") {\n throw new DocmetaError(\n `--format ${format} renders findings, which need a statement to produce rows — a --db export without SQL has none. Pass the SQL, or drop --check -f ${format}.`,\n );\n }\n // Ditto --param: with no statement there is nothing to bind into,\n // and silently ignoring the flag would hide a misspelled command.\n if (options.param.length > 0 && sql === \"\") {\n throw new DocmetaError(\n \"--param needs a statement to bind into; a --db export without SQL references no parameters. Pass the SQL, or drop --param.\",\n );\n }\n // And -s (0030): it names the schema set DDL evolves, and with no\n // SQL nothing can evolve it — the same flag-means-nothing seam,\n // refused at the same gate. Worded without naming --db: the gate\n // guards every empty-SQL arrival, not just the export spelling.\n if (options.schema.length > 0 && sql === \"\") {\n throw new DocmetaError(\n \"-s names the schema set DDL evolves; without SQL there is no statement to evolve it. Pass the SQL, or drop -s.\",\n );\n }\n const params = parseQueryParams(options.param);\n const exts: string[] | undefined = options.ext\n ? splitList(options.ext)\n : undefined;\n const stdinContent = paths.includes(STDIN)\n ? await readStdin()\n : undefined;\n\n // `--check` implies a dry run: a check judges and exits, it never\n // mutates — which keeps every CI drift gate a read-only step. So\n // does `-f csv`: csv refuses a changes-producing statement below,\n // and that refusal must land before anything is applied, not after.\n const dryRun =\n Boolean(options.dryRun) || Boolean(options.check) ||\n format === \"csv\";\n const run = await runQuery({\n sql,\n db: options.db,\n dryRun,\n cache: options.cache,\n ...(Object.keys(params).length > 0 ? { params } : {}),\n ...(options.schema.length > 0 ? { schemas: options.schema } : {}),\n inputs: paths,\n as: options.as,\n exclude: options.exclude,\n exts,\n collections: options.collection,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(format === \"pretty\", process.cwd()),\n stdinContent,\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n offline: options.offline ? true : undefined,\n onNotice: notice,\n // A write to a column marked x-manni-encrypt with no key asks\n // for one on a terminal, and refuses off one (proposal 0045).\n // The same Confirm asks P1 (proposal 0047).\n confirm: terminalConfirm(),\n // An accepted P1 offer prints relocate's report: on stdout\n // beside a pretty report, on stderr when stdout must parse.\n onRelocated: (result) => {\n const text = renderRelocate(result, \"pretty\", {\n color: format === \"pretty\" && resolveColor(command.parent ?? command),\n });\n (format === \"pretty\" ? process.stdout : process.stderr).write(`${text}\\n`);\n },\n });\n // With SQL, the rows own stdout and the export is a diagnostic;\n // export-only, the export summary IS the report.\n if (run.db && sql === \"\") {\n process.stdout.write(\n format === \"json\"\n ? `${JSON.stringify(run.db, null, 2)}\\n`\n : `Wrote ${run.db.path} (${run.db.files} files, ${run.db.columns} columns)\\n`,\n );\n process.exitCode = 0;\n return;\n }\n if (run.db) {\n notice(`wrote ${run.db.path} (${run.db.files} files)`);\n }\n // Narrowing guard: past this return, `format` is\n // `pretty | json | csv`, which is what keeps the switch below\n // compile-time exhaustive.\n if (isQueryFindingsFormat(format)) {\n renderQueryFindings(run, format);\n return;\n }\n switch (format) {\n case \"csv\":\n // CSV describes result rows. Changes are heterogeneous per-file\n // diffs (eight kinds since 0024), not a table — the refusal\n // lives here in the dispatch, where the format is known and the\n // reporter stays presentation-only (proposal 0029). The run was\n // forced dry above, so the refusal is truthful: nothing landed.\n if (run.changes) {\n throw new DocmetaError(\n \"--format csv renders result rows; this statement produced changes, which have no tabular shape — nothing was applied. Use pretty or json to preview them, and run without -f csv to apply.\",\n );\n }\n process.stdout.write(`${renderQueryCsv(run)}\\n`);\n break;\n case \"json\":\n // The bare array, mirroring `get`'s bare result array: changes\n // for a metadata edit, rows for a read. The `--check` verdict\n // travels in the exit code, not the envelope.\n process.stdout.write(\n `${JSON.stringify(run.changes ?? run.rows, null, 2)}\\n`,\n );\n break;\n case \"pretty\": {\n const text = renderQuery(run, {\n color: resolveColor(command.parent ?? command),\n check: Boolean(options.check),\n dryRun,\n });\n if (text.length > 0) process.stdout.write(`${text}\\n`);\n break;\n }\n default: {\n // Exhaustive: the findings formats returned above and narrowed\n // the union, so adding a value to QUERY_FORMATS without a case\n // here (or a findings-format branch) is a compile error. The\n // throw is the runtime half, as in `render`.\n const unreachable: never = format;\n throw new DocmetaError(\n `Unknown --format ${JSON.stringify(unreachable)}. Use ${QUERY_FORMAT_LIST}.`,\n );\n }\n }\n // Rows from a `--check` run are findings, and so are its pending\n // changes — the drift gate (`--check` never applies). An applied\n // statement is the work done, so it succeeds or fails outright.\n const findings = run.changes ? run.changes.length : run.rows.length;\n process.exitCode = options.check && findings > 0 ? 1 : 0;\n } catch (err) {\n fail(err);\n }\n },\n );\n\n program\n .command(\"fill\")\n .description(\n \"Infer missing or invalid metadata and write values above the confidence threshold\",\n )\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to fill (use - for stdin)\",\n )\n .option(\n \"-s, --schema <ref>\",\n \"schema to fill against; repeatable; overrides $schema/config\",\n collect,\n [],\n )\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format (e.g. markdown, mdx)\")\n .option(\"--fields <list>\", \"comma-separated fields to fill\")\n .option(\"--confidence <n>\", \"minimum confidence to write (0-1)\", parseFloat)\n .option(\"--dry-run\", \"report proposals without writing them\")\n .option(\n \"--provider <name>\",\n \"provider: auto (default), anthropic, openai, claude-cli, llama-cpp\",\n )\n .option(\n \"--model <model>\",\n \"model override; needs a named provider, from here or config\",\n )\n .option(\"--no-cache\", \"bypass the proposal cache\")\n .option(\"--local\", LOCAL_FLAG_HELP)\n .option(\"--max-turns <n>\", \"stop after this many inference calls\", parseFloat)\n .option(\n \"--chunk-chars <n>\",\n \"characters of document per call (default 12000)\",\n parseFloat,\n )\n // parseFloat, not parseInt: parseInt(\"3.5\") silently yields 3, which would\n // defeat runFill's integer check and hide the mistake from the user.\n .option(\"--concurrency <n>\", \"files inferred in parallel\", parseFloat)\n .option(\n \"-f, --format <format>\",\n `output: ${FILL_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\n \"-q, --quiet\",\n \"in pretty output, hide files with nothing written and nothing required left undone\",\n )\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"fill files .gitignore covers\")\n .option(\n \"--offline\",\n \"never fetch a remote schema; resolve URL refs from the schema cache\",\n )\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni meta fill docs/ --dry-run # preview proposals\",\n \" manni meta fill docs/ --confidence 0.9 # only near-certain values\",\n \" manni meta fill page.md --fields description\",\n \" manni meta fill docs/ -f github # CI annotations\",\n \" cat page.md | manni meta fill - --as markdown # filled doc to stdout\",\n ].join(\"\\n\"),\n )\n .action(async (paths: string[], options: FillCliOptions, command: Command) => {\n try {\n const format = options.format;\n if (!isFillFormat(format)) {\n throw new DocmetaError(\n `Unknown --format \"${format}\". Use ${FILL_FORMAT_LIST}.`,\n );\n }\n // parseFloat(\"abc\") is NaN, and every comparison against NaN is false,\n // so a bare range check would silently accept garbage.\n numeric(\"--confidence\", options.confidence, 0, 1);\n numeric(\"--max-turns\", options.maxTurns, 1, Number.MAX_SAFE_INTEGER);\n numeric(\n \"--chunk-chars\",\n options.chunkChars,\n 1,\n Number.MAX_SAFE_INTEGER,\n );\n numeric(\"--concurrency\", options.concurrency, 1, 64);\n\n const exts: string[] | undefined = options.ext\n ? splitList(options.ext)\n : undefined;\n const usingStdin = paths.includes(STDIN);\n // With `-` the filled document owns stdout and the report is a\n // diagnostic on stderr — where GitHub never reads `::error`. The\n // annotations would be produced, and nothing would ever render them.\n // Refuse the combination rather than degrade to a silent no-op, which\n // is the exact false green this parity work exists to remove.\n if (usingStdin && format === \"github\") {\n throw new DocmetaError(\n 'Cannot use --format github with stdin (\"-\"): the filled document owns stdout, so the annotations would go to stderr, where GitHub ignores them. Pass file paths instead.',\n );\n }\n const stdinContent = usingStdin ? await readStdin() : undefined;\n\n const run = await runFill({\n inputs: paths,\n cliSchemas: options.schema,\n exts,\n exclude: options.exclude,\n as: options.as,\n collections: options.collection,\n ...configOption(options.config),\n // With `-` the filled document owns stdout, so the notice is a\n // diagnostic there just as the report is.\n onConfigLoaded: reportConfig(\n format === \"pretty\" && !usingStdin,\n process.cwd(),\n ),\n stdinContent,\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n offline: options.offline ? true : undefined,\n onNotice: notice,\n fields: options.fields ? splitList(options.fields) : undefined,\n confidence: options.confidence,\n dryRun: Boolean(options.dryRun),\n provider: options.provider,\n model: options.model,\n cache: options.cache,\n local: Boolean(options.local),\n maxTurns: options.maxTurns,\n chunkChars: options.chunkChars,\n concurrency: options.concurrency,\n includeContent: usingStdin,\n // A field marked x-manni-encrypt with no key asks for one on a\n // terminal, and refuses off one (proposal 0045). Reading the page\n // from stdin leaves no terminal to ask on. The same Confirm asks\n // P1 (proposal 0047).\n confirm: usingStdin ? undefined : terminalConfirm(),\n // An accepted P1 offer prints relocate's report: on stdout beside a\n // pretty report, on stderr when stdout must parse.\n onRelocated: (result) => {\n const text = renderRelocate(result, \"pretty\", {\n color: format === \"pretty\" && resolveColor(command.parent ?? command),\n });\n (format === \"pretty\" ? process.stdout : process.stderr).write(`${text}\\n`);\n },\n });\n\n const color = resolveColor(command.parent ?? command);\n const report = renderFill(format, run, {\n color,\n quiet: Boolean(options.quiet),\n });\n if (usingStdin) {\n // The filled document owns stdout here; the report is a diagnostic.\n const filled = run.results[0]?.content;\n if (filled != null) process.stdout.write(filled);\n if (report.length > 0) process.stderr.write(`${report}\\n`);\n } else if (report.length > 0) {\n process.stdout.write(`${report}\\n`);\n }\n\n // A field the schema requires that could not be filled confidently is\n // work left undone, so CI should see it. Optional fields are not.\n process.exitCode =\n run.summary.requiredSkipped > 0 || run.summary.errors > 0 ? 1 : 0;\n } catch (err) {\n fail(err);\n }\n });\n\n program\n .command(\"derive\")\n .description(\n \"Stamp the managed stewardship fields from git history, CODEOWNERS and GitHub or GitLab reviews\",\n )\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to stamp; <path>:L1-L2 names lines for --generated-by\",\n )\n .option(\n \"--fields <list>\",\n \"comma-separated managed fields to stamp; config derive.fields otherwise, else the merge-safe fields each page's schemas claim\",\n )\n .option(\n \"--generated-by <name>\",\n \"attribute uncommitted body lines, or a <path>:L1-L2 range, to this machine in provenance; MANNI_GENERATED_BY otherwise\",\n )\n .option(\n \"--sources <list>\",\n \"comma-separated sources to consult: git, codeowners, github, gitlab, command (default all)\",\n )\n .option(\"--dry-run\", \"report what would change and write nothing\")\n .option(\n \"--check\",\n \"implies --dry-run: a stale or unset managed field is a finding, exit 1 if any\",\n )\n .option(\n \"-f, --format <format>\",\n `output: ${DERIVE_FORMATS.join(\" | \")} (github, sarif, junit need --check)`,\n \"pretty\",\n )\n .option(\"--no-cache\", \"bypass the GitHub or GitLab review cache\")\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format (e.g. markdown, mdx)\")\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"stamp files .gitignore covers\")\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni meta derive # stamp the managed fields over every collection\",\n \" manni meta derive --collection guides # stamp one configured collection\",\n \" manni meta derive --dry-run docs/install.md # what would change, nothing written\",\n \" manni meta derive --check -f github # CI: a stale stamp is an annotation, exit 1\",\n \" manni meta derive --fields reviewed-by,last-reviewed\",\n \" manni meta derive --sources git,codeowners # no gh on this machine\",\n \" MANNI_GENERATED_BY=claude-fable-5 manni meta derive --fields provenance\",\n \" manni meta derive docs/limits.md:12-31 --generated-by claude-fable-5\",\n ].join(\"\\n\"),\n )\n .action(async (paths: string[], options: DeriveCliOptions, command: Command) => {\n try {\n const format = options.format;\n if (!isDeriveFormat(format)) {\n throw new DocmetaError(\n `Unknown --format \"${format}\". Use ${DERIVE_FORMAT_LIST}.`,\n );\n }\n // The findings formats render findings, and only `--check` produces\n // them. Gated before the run so the refusal costs nothing — and so\n // nothing is written on a run whose report was never going to render.\n if (\n (format === \"github\" || format === \"sarif\" || format === \"junit\") &&\n !options.check\n ) {\n throw new DocmetaError(\n `${format} is a findings format, which only --check produces`,\n );\n }\n const exts: string[] | undefined = options.ext\n ? splitList(options.ext)\n : undefined;\n\n const run = await runDerive({\n inputs: paths,\n fields: options.fields ? splitList(options.fields) : undefined,\n sources: options.sources ? splitList(options.sources) : undefined,\n ...(options.generatedBy !== undefined ? { generatedBy: options.generatedBy } : {}),\n dryRun: Boolean(options.dryRun),\n check: Boolean(options.check),\n cache: options.cache,\n exts,\n exclude: options.exclude,\n as: options.as,\n collections: options.collection,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(!isMachineFormat(format), process.cwd()),\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n onNotice: notice,\n // A field its schema marks x-manni-encrypt (proposal 0045) with no\n // key yet: asked on a terminal, refused off one. The same Confirm\n // asks P1 (proposal 0047).\n confirm: terminalConfirm(),\n // An accepted P1 offer prints relocate's report: on stdout beside a\n // pretty report, on stderr when stdout must parse.\n onRelocated: (result) => {\n const text = renderRelocate(result, \"pretty\", {\n color: format === \"pretty\" && resolveColor(command.parent ?? command),\n });\n (format === \"pretty\" ? process.stdout : process.stderr).write(`${text}\\n`);\n },\n });\n\n const text = renderDerive(run, format, {\n color: resolveColor(command.parent ?? command),\n frame: run.frame,\n onNotice: notice,\n });\n // Only `github` may say nothing on a clean run — see `OMITTED_WHEN_CLEAN`.\n if (text.length > 0 || !OMITTED_WHEN_CLEAN.has(format)) {\n process.stdout.write(`${text}\\n`);\n }\n // A file error fails any run; a finding fails `--check`. See `deriveFailed`.\n process.exitCode = deriveFailed(run) ? 1 : 0;\n } catch (err) {\n fail(err);\n }\n });\n\n program\n .command(\"relocate\")\n .description(\n \"Move each value to where its schema's x-manni-location and the config's manifests say it belongs\",\n )\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to relocate (stdin is refused)\",\n )\n .option(\n \"--fields <list>\",\n \"comma-separated fields to move; each must be marked x-manni-location or manifest-owned\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\n \"-s, --schema <ref>\",\n \"schema to judge preferences against; repeatable; overrides $schema/config\",\n collect,\n [],\n )\n .option(\"--dry-run\", \"report what would move and be created, and write nothing\")\n .option(\n \"-f, --format <format>\",\n `output: ${RELOCATE_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format (e.g. markdown, mdx)\")\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file (refused: relocate writes the config)\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"relocate files .gitignore covers\")\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni meta relocate # every collection, as config declares it\",\n \" manni meta relocate --dry-run # what would move and be created\",\n \" manni meta relocate docs/install.md --fields owner\",\n \" manni meta relocate docs/ guides/intro.md # no collections yet: creates collection default\",\n \" manni meta relocate -f json --dry-run # the scripting form\",\n ].join(\"\\n\"),\n )\n .action(async (paths: string[], options: RelocateCliOptions, command: Command) => {\n try {\n const format = options.format;\n if (!isRelocateFormat(format)) {\n throw new DocmetaError(\n `relocate --format must be pretty or json; got \"${format}\".`,\n );\n }\n const result = await runRelocate({\n inputs: paths,\n fields: options.fields ? splitList(options.fields) : undefined,\n collections: options.collection,\n cliSchemas: options.schema,\n dryRun: Boolean(options.dryRun),\n exts: options.ext ? splitList(options.ext) : undefined,\n exclude: options.exclude,\n as: options.as,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(format === \"pretty\", process.cwd()),\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n onNotice: notice,\n });\n const text = renderRelocate(result, format, {\n color: resolveColor(command.parent ?? command),\n });\n process.stdout.write(`${text}\\n`);\n // A value left on the wrong side is work undone. See `relocateFailed`.\n process.exitCode = relocateFailed(result) ? 1 : 0;\n } catch (err) {\n fail(err);\n }\n });\n\n // `-f, --format` stays on the parent rather than moving to a `list`\n // subcommand: bare `manni meta schemas` is a *default action*, not group help,\n // and both are part of the documented surface.\n const schemas = program\n .command(\"schemas\")\n .description(\"List built-in schemas and supported input formats\")\n .option(\n \"-f, --format <format>\",\n `output: ${COMMON_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .action(async (options: SchemasCliOptions, command: Command) => {\n try {\n // A closed set, checked like every other command's --format. This used\n // to be a bare `=== \"json\" ? json : pretty`, so `schemas -f github`\n // printed a pretty listing and exited 0 — a request docmeta cannot\n // honor, answered with success in a different format. `github` is the\n // case that matters: it is a real docmeta format, just not one this\n // command produces, so nothing about the invocation looked wrong.\n const format = assertCommonFormat(options.format);\n // The registered schemas come from the config discovery finds. A\n // broken config does not stop the listing of the built-ins, which\n // never depended on it; it is named on stderr instead.\n let registered: RegisteredSchemas | undefined;\n try {\n registered = (await loadConfig(undefined, process.cwd()))?.config.registered;\n } catch (err) {\n if (!(err instanceof DocmetaError)) throw err;\n warn(`${err.message} Registered schemas are not listed.`);\n }\n const info = getSchemasInfo(registered);\n if (format === \"json\") {\n process.stdout.write(`${JSON.stringify(info, null, 2)}\\n`);\n return;\n }\n const c = palette(resolveColor(command.parent ?? command));\n const lines: string[] = [c.bold(\"Built-in schemas:\")];\n for (const b of info.builtins) {\n lines.push(` ${c.cyan(b.id)} ${c.dim(\"—\")} ${b.title}`);\n }\n if (info.registered.length > 0) {\n lines.push(\"\", c.bold(\"Registered schemas:\"));\n for (const r of info.registered) {\n lines.push(` ${c.cyan(r.id)} ${c.dim(\"—\")} ${r.file}`);\n }\n }\n lines.push(\"\", c.bold(\"Input formats:\"));\n for (const f of info.formats) {\n const tag = f.writable ? c.green(\"writable\") : c.dim(\"read-only\");\n lines.push(` ${f.name} (${f.extensions.join(\", \")}) [${tag}]`);\n }\n process.stdout.write(`${lines.join(\"\\n\")}\\n`);\n } catch (err) {\n fail(err);\n }\n });\n\n schemas\n .command(\"infer\")\n .description(\n \"Report metadata coverage across a docset, and draft a schema from what is there\",\n )\n .argument(\n \"[paths...]\",\n \"files, directories, or globs to scan (use - for stdin)\",\n )\n .option(\"--out <path>\", \"write the draft schema here\")\n // Default 0, and it must stay 0. A default that hid the long tail would\n // hide exactly the \"3% is one team's convention, not a standard\" signal the\n // report exists to surface.\n .option(\n \"--min-coverage <pct>\",\n \"hide keys below this coverage percentage\",\n parseFloat,\n 0,\n )\n .option(\"--ext <list>\", \"comma-separated extensions for directory walks\")\n .option(\"--exclude <glob>\", \"glob to exclude; repeatable\", collect, [])\n .option(\"--as <format>\", \"force an input format (e.g. markdown, mdx)\")\n .option(\n \"-f, --format <format>\",\n `output: ${COMMON_FORMATS.join(\" | \")}`,\n \"pretty\",\n )\n .option(\n \"--collection <name>\",\n \"configured collection to run over; repeatable\",\n collect,\n [],\n )\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .option(\"--no-config\", \"ignore any discovered config file\")\n .option(\"--allow-empty\", \"treat zero matched files as success\")\n .option(\"--no-gitignore\", \"scan files .gitignore covers\")\n .option(\n \"--offline\",\n \"accepted and ignored: infer loads no schema and no provider\",\n )\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni meta schemas infer docs/ # what does this repo have?\",\n \" manni meta schemas infer docs/ --min-coverage 5 # drop the long tail\",\n \" manni meta schemas infer docs/ --out ./schemas/permissive.json\",\n \" manni meta schemas infer docs/ -f json\",\n \"\",\n \"Purely statistical and offline: no provider, no network, no model. The\",\n \"draft never marks anything `required` — coverage is your decision to\",\n \"make, not the tool's.\",\n ].join(\"\\n\"),\n )\n .action(async (paths: string[], options: InferCliOptions, command: Command) => {\n try {\n const format = assertCommonFormat(formatFor(command, options.format));\n numeric(\"--min-coverage\", options.minCoverage, 0, 100);\n const exts: string[] | undefined = options.ext\n ? splitList(options.ext)\n : undefined;\n const stdinContent = paths.includes(STDIN)\n ? await readStdin()\n : undefined;\n\n const result = await runInferSchema({\n inputs: paths,\n exts,\n exclude: options.exclude,\n as: options.as,\n collections: options.collection,\n ...configOption(options.config),\n onConfigLoaded: reportConfig(format === \"pretty\", process.cwd()),\n stdinContent,\n out: options.out,\n minCoverage: options.minCoverage,\n // Same shape as the other four input-taking commands: only an\n // explicit `--allow-empty` / `--no-gitignore` travels, so config\n // `allowEmpty:` and `respectGitignore:` still decide otherwise.\n allowEmpty: options.allowEmpty ? true : undefined,\n respectGitignore: explicitFalse(options.gitignore),\n // Accepted and ignored — `infer` never fetches. `undefined` rather\n // than `false` all the same, so this stays the same shape as the\n // other four if it ever does gain a meaning.\n offline: options.offline ? true : undefined,\n onNotice: notice,\n });\n\n if (format === \"json\") {\n process.stdout.write(`${JSON.stringify(result, null, 2)}\\n`);\n return;\n }\n const text = renderInfer(result, {\n color: resolveColor(command.parent?.parent ?? command),\n });\n process.stdout.write(`${text}\\n`);\n } catch (err) {\n fail(err);\n }\n });\n\n schemas\n .command(\"vendor\")\n .description(\n \"Download a remote schema into this repository and pin it in config\",\n )\n .argument(\"<url>\", \"http(s) URL of the schema to vendor\")\n .option(\n \"--dir <path>\",\n \"directory for the committed copy\",\n DEFAULT_VENDOR_DIR,\n )\n .option(\"-c, --config <path>\", \"path to a manni config file\")\n .addHelpText(\n \"after\",\n [\n \"\",\n \"Examples:\",\n \" manni meta schemas vendor https://schemas.example.com/house/2.1.json\",\n \" manni meta schemas vendor https://schemas.example.com/house/2.1.json --dir ./contracts\",\n \"\",\n \"Commit both the downloaded file and the config change: the point of\",\n \"vendoring is that CI validates against a copy in your own history.\",\n ].join(\"\\n\"),\n )\n .action(async (url: string, options: VendorCliOptions) => {\n try {\n const result = await runVendorSchema({\n url,\n dir: options.dir,\n // `typeof === \"string\"`, not `!== undefined`. `vendor` is the one\n // config-taking command with no `--no-config`, and the parity rule in\n // CLAUDE.md points straight at adding one — at which point commander\n // starts passing `false` here. The annotation on `VendorCliOptions`\n // says that cannot happen, so it would not be caught at the point the\n // flag is declared; this test is what keeps a `false` out of a field\n // that must be a path.\n ...(typeof options.config === \"string\"\n ? { configPath: options.config }\n : {}),\n onNotice: notice,\n });\n // Three states, and the operator needs to be able to tell them apart in\n // a diff: a config was created, an existing reference was replaced (the\n // re-vendor and the bare-URL migration both land here), or an entry was\n // added beside what was already there.\n const configNote = result.configCreated\n ? \"created\"\n : result.replaced\n ? \"reference updated\"\n : \"reference added\";\n process.stdout.write(\n [\n `Vendored ${result.url}`,\n ` file ${result.file} (${result.bytes} bytes${result.unchanged ? \", unchanged\" : \"\"})`,\n ` integrity ${result.integrity}`,\n ` config ${result.config} (${configNote})`,\n \"\",\n `Commit ${result.file} and ${result.config} so CI validates against this copy.`,\n ].join(\"\\n\") + \"\\n\",\n );\n } catch (err) {\n fail(err);\n }\n });\n\n return program;\n}\n\n// No entry point here. `src/cli.ts` mounts this program as `manni meta` and\n// `src/docmeta.ts` runs it under its old name; both go through `runProgram`\n// in src/shared/run.ts, which owns the exit-code contract.\n","/**\n * Option plumbing every tool's commander wrapper needs.\n *\n * These are the pieces of `src/meta/cli.ts` that had nothing to do with\n * metadata: how a repeatable flag accumulates, how a comma list splits, how\n * stdin is drained, how `-c`/`--no-config` share one attribute, and how a\n * `--no-<thing>` flag is kept from clobbering a config value it never meant to\n * touch. A sibling tool that re-derived any of these would get one of them\n * subtly different, and \"commands must have parallel behaviors\" is the rule\n * that says it must not.\n */\nimport { basename, relative } from \"node:path\";\n\n/** Accumulate a repeatable option (`--exclude a --exclude b`). */\nexport function collect(value: string, prev: string[]): string[] {\n return prev.concat([value]);\n}\n\n/** Split a comma-separated option value, dropping blanks. */\nexport function splitList(value: string): string[] {\n return value\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean);\n}\n\n/** Drain stdin to a UTF-8 string. */\nexport async function readStdin(): Promise<string> {\n const chunks: Buffer[] = [];\n for await (const chunk of process.stdin) chunks.push(chunk as Buffer);\n return Buffer.concat(chunks).toString(\"utf8\");\n}\n\n/**\n * Split the one commander attribute that `-c, --config <path>` and\n * `--no-config` share. Verified by experiment: `opts.config` is `undefined`\n * with neither flag, the string with `-c`, and `false` with `--no-config`.\n */\nexport function configOption(value: unknown): {\n configPath?: string;\n noConfig?: boolean;\n} {\n if (value === false) return { noConfig: true };\n return typeof value === \"string\" ? { configPath: value } : {};\n}\n\n/**\n * A `--no-<thing>` flag for the core: only an explicit false travels.\n *\n * Commander gives `true` when the flag is absent, but that is its *default*,\n * not a choice the user made — passing it on would override the config's own\n * answer (`respectGitignore:`, say). Only the explicit `false` travels; absence\n * stays `undefined` so config still decides.\n */\nexport function explicitFalse(value: unknown): boolean | undefined {\n return value === false ? false : undefined;\n}\n\n/**\n * Say which config governed the run, and where it came from.\n *\n * Discovery walks up to the project boundary, so the answer is no longer\n * obvious from the working directory, and an unexpected ancestor config is the\n * difference between a five-minute diagnosis and an hour of confusion. Goes to\n * stderr for anything a machine reads, so structured output stays parseable.\n */\nexport function reportConfig(\n toStdout: boolean,\n cwd: string,\n): (info: { path: string; dir: string }) => void {\n return (info) => {\n const where = (relative(cwd, info.dir) || \".\").replace(/\\\\/g, \"/\");\n const line = `Using ${basename(info.path)} (${where})\\n`;\n (toStdout ? process.stdout : process.stderr).write(line);\n };\n}\n","/**\n * Reporter for `relocate` (proposal 0047).\n *\n * `pretty` leads with what the config gains or loses (a created collection or\n * manifest, an appended path, a `keys:` change and the pages it reaches), then\n * each page with a value that moved or stayed, then one summary line. A page\n * reached only through a `keys:` change, outside the paths the run named, is\n * counted rather than listed unless a value on it stayed. `json` is the\n * scripting form: the run's shape minus what only the pretty lines need.\n */\nimport { DocmetaError } from \"../types.js\";\nimport type { RelocateResult } from \"../core/relocation.js\";\nimport { palette } from \"../../shared/color.js\";\nimport { formatList } from \"./index.js\";\n\nexport const RELOCATE_FORMATS = [\"pretty\", \"json\"] as const;\n\nexport type RelocateReportFormat = (typeof RELOCATE_FORMATS)[number];\n\n/** `\"pretty or json\"`, for messages and help text. */\nexport const RELOCATE_FORMAT_LIST = formatList(RELOCATE_FORMATS);\n\nexport function isRelocateFormat(value: string): value is RelocateReportFormat {\n return (RELOCATE_FORMATS as readonly string[]).includes(value);\n}\n\nexport interface RelocateReportOptions {\n color?: boolean;\n}\n\nexport function renderRelocate(\n result: RelocateResult,\n format: RelocateReportFormat,\n opts: RelocateReportOptions = {},\n): string {\n switch (format) {\n case \"json\":\n return JSON.stringify(relocateJson(result), null, 2);\n case \"pretty\":\n return renderRelocatePretty(result, opts);\n default: {\n const unreachable: never = format;\n throw new DocmetaError(\n `relocate --format must be pretty or json; got ${JSON.stringify(unreachable)}.`,\n );\n }\n }\n}\n\n/** The JSON shape: what a script reads, without the pretty reporter's own fields. */\nexport function relocateJson(result: RelocateResult): unknown {\n return {\n dryRun: result.dryRun,\n config: {\n file: result.config.file,\n created: result.config.created,\n collectionsCreated: result.config.collectionsCreated,\n pathsAdded: result.config.pathsAdded,\n },\n manifests: result.manifests.map((m) => ({\n file: m.file,\n collection: m.collection,\n created: m.created,\n keysAdded: m.keysAdded,\n keysRemoved: m.keysRemoved,\n undeclared: m.undeclared,\n })),\n files: result.files.map((f) => ({\n file: f.file,\n moved: f.moved,\n stayed: f.stayed.map((s) => ({ key: s.key, reason: s.reason })),\n })),\n summary: result.summary,\n };\n}\n\nconst plural = (n: number, noun: string): string => `${n} ${noun}${n === 1 ? \"\" : \"s\"}`;\nconst list = (xs: readonly string[]): string => xs.join(\", \");\n\nexport function renderRelocatePretty(result: RelocateResult, opts: RelocateReportOptions = {}): string {\n const c = palette(opts.color ?? false);\n const dry = result.dryRun;\n const lines: string[] = [];\n\n // ---- The config ------------------------------------------------------------\n if (result.config.created && result.config.file !== null) {\n lines.push(dry ? `Would create ${result.config.file}.` : `Created ${result.config.file}.`);\n }\n const pathsOf = (collection: string): string[] =>\n result.config.pathsAdded.filter((p) => p.collection === collection).map((p) => p.path);\n const said = new Set<string>();\n for (const created of result.config.collectionsCreated) {\n said.add(created.name);\n const made = result.manifests.filter((m) => m.collection === created.name && m.created);\n const head = `${dry ? \"Would create\" : \"Created\"} collection ${created.name} (paths: ${list(created.paths)})`;\n if (made.length === 0) {\n lines.push(`${head}.`);\n continue;\n }\n const owns = list(made.flatMap((m) => m.keys));\n lines.push(`${head} and ${list(made.map((m) => m.file))}; it ${dry ? \"would own\" : \"owns\"} ${owns}.`);\n }\n for (const m of result.manifests) {\n if (said.has(m.collection) && m.created) continue;\n const added = said.has(m.collection) ? [] : pathsOf(m.collection);\n if (added.length > 0) said.add(m.collection);\n const keys = list(m.keys);\n if (m.created) {\n if (added.length > 0) {\n lines.push(\n dry\n ? `Would add ${list(added)} to collection ${m.collection}'s paths and create ${m.file}; it would own ${keys}.`\n : `Added ${list(added)} to collection ${m.collection}'s paths and created ${m.file}; it owns ${keys}.`,\n );\n } else {\n lines.push(\n dry\n ? `Would create ${m.file}; collections[${m.collection}].externalMetadata[${m.index}] would own ${keys}.`\n : `Created ${m.file}; collections[${m.collection}].externalMetadata[${m.index}] owns ${keys}.`,\n );\n }\n continue;\n }\n const beyond = m.beyond > 0 ? `, ${m.beyond} beyond the paths you named` : \"\";\n const pronoun = (n: number): string => (n === 1 ? \"it\" : \"them\");\n if (m.keysRemoved.length > 0) {\n const what = `${list(m.keysRemoved)} from ${m.file}'s keys`;\n const it = pronoun(m.keysRemoved.length);\n const where = `into every page in collection ${m.collection}${beyond}`;\n lines.push(dry ? `Would remove ${what}, moving ${it} ${where}.` : `Removing ${what} moves ${it} ${where}.`);\n }\n if (added.length > 0) {\n lines.push(\n dry\n ? `Would add ${list(added)} to collection ${m.collection}'s paths; ${m.file} would own ${keys}.`\n : `Added ${list(added)} to collection ${m.collection}'s paths; ${m.file} now owns ${keys}.`,\n );\n } else if (m.keysAdded.length > 0) {\n const what = `${list(m.keysAdded)} to ${m.file}'s keys`;\n const it = pronoun(m.keysAdded.length);\n const where = `out of every page in collection ${m.collection}${beyond}`;\n lines.push(dry ? `Would add ${what}, moving ${it} ${where}.` : `Adding ${what} moves ${it} ${where}.`);\n }\n if (m.undeclared) {\n lines.push(\n dry\n ? `${m.file} would no longer own any keys and would no longer be declared; delete it when you are ready.`\n : `${m.file} no longer owns any keys and is no longer declared; delete it when you are ready.`,\n );\n }\n }\n for (const p of result.config.pathsAdded) {\n if (said.has(p.collection)) continue;\n said.add(p.collection);\n lines.push(`${dry ? \"Would add\" : \"Added\"} ${list(pathsOf(p.collection))} to collection ${p.collection}'s paths.`);\n }\n\n // ---- The pages ---------------------------------------------------------------\n const width = Math.max(\n 7,\n ...result.files.flatMap((f) => [...f.moved, ...f.stayed].map((v) => v.key.length)),\n );\n const shown = result.files.filter((f) => !f.beyond || f.stayed.length > 0);\n for (const f of shown) {\n lines.push(f.file);\n for (const mv of f.moved) {\n const name = c.cyan(mv.key.padEnd(width));\n if (mv.to === \"page\") {\n lines.push(` ${name} ← ${mv.from}`);\n } else {\n lines.push(` ${name} → ${mv.manifest}${mv.line !== undefined ? `:${mv.line}` : \"\"}`);\n }\n }\n for (const st of f.stayed) {\n lines.push(` ${c.cyan(st.key.padEnd(width))} ${c.yellow(`stays: ${st.detail ?? st.reason}`)}`);\n }\n }\n const hidden = result.files.length - shown.length;\n if (hidden > 0) lines.push(`… (${plural(hidden, \"more file\")})`);\n\n // ---- The summary ---------------------------------------------------------------\n const s = result.summary;\n if (s.files === 0) {\n lines.push(\"0 files, nothing to move\");\n return lines.join(\"\\n\");\n }\n const moves = result.files.flatMap((f) => f.moved);\n const toPage = moves.filter((m) => m.to === \"page\").length;\n const toManifest = moves.flatMap((m) => (m.to === \"manifest\" ? [m.manifest] : []));\n const manifests = plural(new Set(toManifest).size, \"manifest\");\n let footer = `${plural(s.files, \"file\")}, ${plural(s.moved, \"value\")} ${dry ? \"would move\" : \"moved\"}`;\n if (toPage > 0 && toManifest.length > 0) {\n footer += `: ${toPage} into pages, ${toManifest.length} into ${manifests}`;\n } else if (toManifest.length > 0) {\n footer += ` to ${manifests}`;\n } else if (toPage > 0) {\n footer += \" into pages\";\n }\n if (s.stayed > 0) footer += `, ${s.stayed} stayed`;\n lines.push(s.stayed > 0 ? c.yellow(footer) : footer);\n return lines.join(\"\\n\");\n}\n","/**\n * validate's offer to move misplaced values (proposal 0047, prompt P2).\n *\n * After the report is printed, on a terminal, each collection with an\n * unsuppressed `location:external` or `location:page` finding gets one\n * question. A yes runs relocate for the files and keys of those findings (a\n * `keys:` change still reaches every member page, as relocate's does) and\n * prints relocate's pretty output. A no does nothing: the findings already\n * said it.\n *\n * Everything the user reads goes to `output`, which the CLI makes stderr so\n * the report on stdout stays machine-readable. The exit code is never this\n * module's to change: it is the report's.\n *\n * No question is put without a `Confirm` (off a terminal, or a run reading\n * stdin), under `--no-config`, for stdin's own findings, or for a page with no\n * possible home. A baselined finding never reaches here, so a baseline is how\n * someone stops being asked.\n */\nimport type { Confirm } from \"../../shared/prompt.js\";\nimport { programName } from \"../../shared/program-name.js\";\nimport { resolveRunConfig } from \"../core/config.js\";\nimport { STDIN_LABEL } from \"../core/load-files.js\";\nimport { LOCATION_EXTERNAL_SCHEMA, LOCATION_PAGE_SCHEMA } from \"../core/location.js\";\nimport {\n applyRelocation,\n keyHome,\n offerPrompt,\n planRelocation,\n relocationContext,\n type RelocateResult,\n type RelocationContext,\n} from \"../core/relocation.js\";\nimport { collectSchemaPins } from \"../core/resolve-schema.js\";\nimport { schemaLoadOptions } from \"../core/schema-registry.js\";\nimport { Validator } from \"../core/validator.js\";\nimport { renderRelocatePretty } from \"../reporters/relocate.js\";\nimport { DocmetaError, type ValidationResult } from \"../types.js\";\n\nexport interface ValidateOfferOptions {\n /** The results as reported: after the baseline, so a suppressed finding is not offered. */\n results: readonly ValidationResult[];\n /** The run's inputs as validate got them, for the config and a created collection's `paths:`. */\n inputs: string[];\n cwd?: string;\n configPath?: string;\n noConfig?: boolean;\n collections?: string[];\n cliSchemas?: string[];\n as?: string;\n respectGitignore?: boolean;\n offline?: boolean;\n env?: NodeJS.ProcessEnv;\n /** The terminal's `Confirm`; absent means no question is put. */\n confirm?: Confirm;\n /** Where the notice and relocate's output go: stderr, from the CLI. */\n output: { write: (chunk: string) => unknown };\n color?: boolean;\n}\n\n/** The files and keys of one collection's findings. */\ninterface Group {\n files: Set<string>;\n keys: Set<string>;\n}\n\n/**\n * Put P2 once per collection with a location finding, and run relocate for\n * each yes. Returns the applied results, in the order they ran.\n */\nexport async function offerRelocation(opts: ValidateOfferOptions): Promise<RelocateResult[]> {\n const { confirm, output } = opts;\n if (confirm === undefined || opts.noConfig === true) return [];\n const findings = opts.results.flatMap((r) =>\n r.file === STDIN_LABEL\n ? []\n : r.errors\n .filter((e) => e.schema === LOCATION_EXTERNAL_SCHEMA || e.schema === LOCATION_PAGE_SCHEMA)\n .flatMap((e) => (e.subject === undefined ? [] : [{ file: r.file, key: e.subject, schema: e.schema }])),\n );\n if (findings.length === 0) return [];\n\n const cwd = opts.cwd ?? process.cwd();\n const run = await resolveRunConfig({\n cwd,\n ...(opts.configPath !== undefined ? { configPath: opts.configPath } : {}),\n inputs: opts.inputs,\n ...(opts.collections !== undefined ? { collections: opts.collections } : {}),\n });\n const validator = new Validator(\n schemaLoadOptions({\n root: run.configDir ?? cwd,\n fileBase: cwd,\n ttlHours: run.config?.schemaCache?.ttlHours,\n offline: opts.offline ?? run.config?.offline,\n pins: collectSchemaPins(run.config),\n registered: run.config?.registered,\n }),\n );\n const ctx: RelocationContext = relocationContext(run, {\n cwd,\n targets: run.fromCollections ? [] : opts.inputs,\n validator,\n ...(opts.cliSchemas !== undefined && opts.cliSchemas.length > 0 ? { cliSchemas: opts.cliSchemas } : {}),\n ...(opts.as !== undefined ? { as: opts.as } : {}),\n ...(opts.respectGitignore !== undefined ? { respectGitignore: opts.respectGitignore } : {}),\n ...(opts.env !== undefined ? { env: opts.env } : {}),\n });\n\n // The collection each finding's value would move within: the one whose\n // manifest holds a `location:page` value, or the home §3 picks for a\n // `location:external` one. A page with no possible home is not offered.\n const groups = new Map<string, Group>();\n for (const f of findings) {\n const home = await keyHome(ctx, f.file, {}, f.key);\n let collection: string | undefined;\n if (f.schema === LOCATION_PAGE_SCHEMA) {\n if (home.kind === \"manifest\") collection = home.collection;\n } else if (home.kind === \"unowned\" && home.home.kind === \"collection\") {\n collection = home.home.collection;\n }\n if (collection === undefined) continue;\n const group = groups.get(collection) ?? { files: new Set<string>(), keys: new Set<string>() };\n group.files.add(f.file);\n group.keys.add(f.key);\n groups.set(collection, group);\n }\n\n const applied: RelocateResult[] = [];\n const say = (message: string): void => {\n output.write(`${programName()}: ${message}\\n`);\n };\n for (const [collection, group] of groups) {\n let plan;\n try {\n plan = await planRelocation(ctx, { files: [...group.files], fields: [...group.keys] });\n } catch (err) {\n // A plan that cannot be made (a manifest path that exists undeclared, a\n // single-tool config) is reported and not offered. The report already\n // stands, and its exit code is not this offer's to change.\n if (!(err instanceof DocmetaError)) throw err;\n say(err.message);\n continue;\n }\n if (plan.writes.length === 0) continue;\n // Only this collection's offer: another's would word changes this question does not cover.\n const offer = plan.offers.find((o) => o.collection === collection);\n if (offer === undefined) continue;\n const { notice, question } = offerPrompt(offer, \"validate\");\n say(notice);\n if (!(await confirm(question))) continue;\n const result = await applyRelocation(ctx, plan);\n output.write(`${renderRelocatePretty(result, { color: opts.color ?? false })}\\n`);\n applied.push(result);\n }\n return applied;\n}\n","/**\n * Reporter for `schemas infer`.\n *\n * The report **is** the product of this command, so the columns are chosen to\n * answer exactly one question each (0010 stress test 1):\n *\n * - **coverage** — require it now (~100%), require it behind a\n * `--write-baseline` ratchet (middling), or do not require it at all (low\n * single digits: one team's convention, not a standard).\n * - **types** — a distribution with counts, so a `string ×900, number ×4` split\n * reads as four data errors rather than as a union worth encoding.\n * - **sample** — what the values actually look like, which is what tells you\n * whether the key means what its name suggests.\n *\n * Files with no metadata block are on their own line rather than folded into a\n * denominator: they pass a require-nothing schema and fail the moment any key\n * becomes required, which is the surprise the report exists to prevent.\n */\nimport type { InferKeyReport, InferResult } from \"../commands/schemas.js\";\nimport { toJsonText } from \"../core/json-text.js\";\nimport { palette } from \"../../shared/color.js\";\n\nexport interface InferReportOptions {\n color?: boolean;\n}\n\n/** Outliers listed inline before the report defers to the count. */\nconst OUTLIERS_SHOWN = 5;\n\n/** Enum values listed in the sample column before it elides the rest. */\nconst ENUM_SHOWN = 3;\n\nconst SAMPLE_WIDTH = 46;\n\n/** Thousands separators, pinned to one locale so output is machine-stable. */\nfunction count(n: number): string {\n return n.toLocaleString(\"en-US\");\n}\n\nfunction percent(n: number): string {\n return `${n.toFixed(1)}%`;\n}\n\nfunction truncate(text: string, width: number): string {\n return text.length <= width ? text : `${text.slice(0, width - 1)}…`;\n}\n\n/** `\"Getting started\"` — JSON spelling, so a string is visibly a string. */\nexport function sampleCell(key: InferKeyReport): string {\n if (key.enumValues) {\n const shown = key.enumValues\n .slice(0, ENUM_SHOWN)\n .map((v) => (typeof v === \"string\" ? v : JSON.stringify(v)));\n if (key.enumValues.length > ENUM_SHOWN) shown.push(\"…\");\n return truncate(shown.join(\" | \"), SAMPLE_WIDTH);\n }\n if (key.sample === undefined) return \"\";\n // `toJsonText`, not `JSON.stringify`, so the `?? \"\"` stays visibly\n // reachable — see there.\n return truncate(toJsonText(key.sample) ?? \"\", SAMPLE_WIDTH);\n}\n\n/** `string`, `string (date)`, `string (7 enum)`, or `string ×900, number ×4`. */\nexport function typesCell(key: InferKeyReport): string {\n if (key.types.length > 1) {\n return key.types.map((t) => `${t.type} ×${count(t.count)}`).join(\", \");\n }\n if (key.enumValues) return `${key.dominantType} (${key.enumValues.length} enum)`;\n if (key.format) return `${key.dominantType} (${key.format})`;\n return key.dominantType;\n}\n\nexport function renderInfer(\n result: InferResult,\n opts: InferReportOptions = {},\n): string {\n const c = palette(opts.color ?? false);\n const lines: string[] = [];\n\n const headline = [\n `${count(result.filesScanned)} file${result.filesScanned === 1 ? \"\" : \"s\"} scanned`,\n ];\n headline.push(\n `${count(result.filesWithoutMetadata)} with no metadata block`,\n );\n if (result.unreadable.length > 0) {\n headline.push(`${count(result.unreadable.length)} unreadable`);\n }\n // Same reason `validate` names it on its summary line: every coverage\n // percentage below is computed over `filesScanned`, so a denominator that\n // quietly shrank moves every number in the report. A key at 100% across the\n // eight files `.gitignore` left is not the same finding as one at 100%\n // across all forty, and the headline is the only place that is visible.\n // Omitted at zero, which is every run in a clean repo.\n if (result.gitignoreSkipped > 0) {\n headline.push(`${count(result.gitignoreSkipped)} skipped by .gitignore`);\n }\n lines.push(headline.join(c.dim(\" · \")));\n\n if (result.keys.length === 0) {\n lines.push(\"\", c.dim(\"No metadata keys found.\"));\n return lines.join(\"\\n\");\n }\n\n const rows = result.keys.map((k) => ({\n key: k.key,\n coverage: percent(k.coverage),\n types: typesCell(k),\n sample: sampleCell(k),\n }));\n const width = (pick: (r: (typeof rows)[number]) => string, head: string) =>\n Math.max(head.length, ...rows.map((r) => pick(r).length));\n const wKey = width((r) => r.key, \"key\");\n const wCov = width((r) => r.coverage, \"coverage\");\n const wTypes = width((r) => r.types, \"types\");\n\n lines.push(\n \"\",\n c.dim(\n `${\"key\".padEnd(wKey)} ${\"coverage\".padStart(wCov)} ${\"types\".padEnd(wTypes)} sample`,\n ),\n );\n for (const r of rows) {\n lines.push(\n `${c.cyan(r.key.padEnd(wKey))} ${r.coverage.padStart(wCov)} ${r.types.padEnd(wTypes)} ${c.dim(r.sample)}`,\n );\n }\n\n if (result.hiddenByMinCoverage > 0) {\n lines.push(\n \"\",\n c.dim(\n `${count(result.hiddenByMinCoverage)} key(s) below --min-coverage are not shown.`,\n ),\n );\n }\n\n const withOutliers = result.keys.filter((k) => k.outlierCount > 0);\n if (withOutliers.length > 0) {\n lines.push(\n \"\",\n c.bold(\"Type outliers — these are data errors, not a union:\"),\n );\n for (const k of withOutliers) {\n for (const o of k.outliers.slice(0, OUTLIERS_SHOWN)) {\n const at = o.line === undefined ? o.file : `${o.file}:${o.line}`;\n lines.push(` ${k.key} ${at} ${o.type} (expected ${k.dominantType})`);\n }\n const rest = k.outlierCount - Math.min(k.outliers.length, OUTLIERS_SHOWN);\n if (rest > 0) lines.push(c.dim(` ${k.key} …and ${count(rest)} more`));\n }\n }\n\n for (const u of result.unreadable) {\n lines.push(\"\", `${c.yellow(\"!\")} ${u.file}: ${u.message}`);\n }\n\n if (result.out !== undefined) {\n const properties = Object.keys(result.draft.properties ?? {}).length;\n lines.push(\n \"\",\n `Wrote a draft schema to ${c.cyan(result.out)} — ${count(properties)} propert${properties === 1 ? \"y\" : \"ies\"}, nothing required.`,\n c.dim(\n \"Nothing is required on purpose: what your docset contains is not the same as what your standard should demand. Promote a key with `validate --write-baseline` behind it.\",\n ),\n );\n }\n\n return lines.join(\"\\n\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAAS,kBAAkB;AAC3B,SAAS,SAAS,WAAW,mBAAmB;AAChD,SAAS,SAAS,cAAc;AAChC,OAAO,eAAe;;;ACEtB,SAAS,UAAU,gBAAgB;AAG5B,SAAS,QAAQ,OAAe,MAA0B;AAC/D,SAAO,KAAK,OAAO,CAAC,KAAK,CAA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