@cogs/config 0.2.0 → 0.5.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.
Files changed (63) hide show
  1. package/README.md +145 -8
  2. package/dist/cjs/correct-env.js +44 -0
  3. package/dist/cjs/dotenv-checkers.js +176 -0
  4. package/dist/cjs/dotenv-correlation.js +95 -0
  5. package/dist/cjs/dotenv-files.js +43 -0
  6. package/dist/cjs/dotenv-fixers.js +88 -0
  7. package/dist/cjs/dotenv-with-expand.js +123 -0
  8. package/dist/cjs/envs.js +93 -0
  9. package/dist/cjs/index.js +23 -0
  10. package/dist/cjs/package.json +3 -0
  11. package/dist/cjs/preload.js +18 -0
  12. package/dist/cjs/process-env.js +39 -0
  13. package/dist/cjs/redact.js +27 -0
  14. package/dist/cjs/utils.js +65 -0
  15. package/dist/cli-core.d.ts +72 -0
  16. package/dist/cli-core.d.ts.map +1 -0
  17. package/dist/cli-core.js +311 -0
  18. package/dist/cli-core.js.map +1 -0
  19. package/dist/cli.d.ts +9 -0
  20. package/dist/cli.d.ts.map +1 -0
  21. package/dist/cli.js +17 -0
  22. package/dist/cli.js.map +1 -0
  23. package/dist/correct-env.d.ts.map +1 -1
  24. package/dist/correct-env.js.map +1 -1
  25. package/dist/dotenv-checkers.d.ts +61 -11
  26. package/dist/dotenv-checkers.d.ts.map +1 -1
  27. package/dist/dotenv-checkers.js +87 -25
  28. package/dist/dotenv-checkers.js.map +1 -1
  29. package/dist/dotenv-correlation.d.ts +23 -0
  30. package/dist/dotenv-correlation.d.ts.map +1 -0
  31. package/dist/dotenv-correlation.js +92 -0
  32. package/dist/dotenv-correlation.js.map +1 -0
  33. package/dist/dotenv-files.d.ts +24 -0
  34. package/dist/dotenv-files.d.ts.map +1 -0
  35. package/dist/dotenv-files.js +40 -0
  36. package/dist/dotenv-files.js.map +1 -0
  37. package/dist/dotenv-fixers.d.ts.map +1 -1
  38. package/dist/dotenv-fixers.js +7 -7
  39. package/dist/dotenv-fixers.js.map +1 -1
  40. package/dist/dotenv-with-expand.d.ts +1 -1
  41. package/dist/dotenv-with-expand.d.ts.map +1 -1
  42. package/dist/dotenv-with-expand.js +5 -5
  43. package/dist/dotenv-with-expand.js.map +1 -1
  44. package/dist/envs.d.ts +9 -1
  45. package/dist/envs.d.ts.map +1 -1
  46. package/dist/envs.js +58 -31
  47. package/dist/envs.js.map +1 -1
  48. package/dist/index.d.ts +7 -7
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +7 -7
  51. package/dist/index.js.map +1 -1
  52. package/dist/preload.js +3 -3
  53. package/dist/preload.js.map +1 -1
  54. package/dist/process-env.d.ts.map +1 -1
  55. package/dist/process-env.js.map +1 -1
  56. package/dist/redact.d.ts +18 -0
  57. package/dist/redact.d.ts.map +1 -0
  58. package/dist/redact.js +24 -0
  59. package/dist/redact.js.map +1 -0
  60. package/dist/utils.d.ts.map +1 -1
  61. package/dist/utils.js +2 -2
  62. package/dist/utils.js.map +1 -1
  63. package/package.json +18 -7
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.config = exports.parseJSON = exports.parse = void 0;
7
+ const node_fs_1 = require("node:fs");
8
+ const dotenv_1 = __importDefault(require("dotenv"));
9
+ const dotenv_expand_1 = __importDefault(require("dotenv-expand"));
10
+ const dotenvExpandOverrideFix = (parsed) => {
11
+ const obj = {};
12
+ dotenv_expand_1.default.expand({ parsed, processEnv: obj });
13
+ const source = Object.keys(obj).length > 0 ? obj : parsed;
14
+ // Set process.env
15
+ for (const key of Object.keys(source)) {
16
+ if (Object.hasOwn(process.env, key)) {
17
+ const upcoming = source[key];
18
+ const prior = process.env[key];
19
+ if (prior !== upcoming) {
20
+ console.log(`"${key}" is already defined as ${prior}, and WAS overwritten with ${upcoming}`);
21
+ }
22
+ process.env[key] = source[key];
23
+ }
24
+ else {
25
+ process.env[key] = source[key];
26
+ }
27
+ }
28
+ };
29
+ /**
30
+ * Parse and expand environment variables from a .env file.
31
+ *
32
+ * @param src - The raw .env contents.
33
+ * @param override - Whether file values override existing process.env values.
34
+ * @param processEnv - The object expansion resolves references against.
35
+ * @returns An object containing the parsed and expanded environment variables.
36
+ */
37
+ const parse = (src, override, processEnv) => {
38
+ const parsed = dotenv_1.default.parse(src.toString());
39
+ if (override) {
40
+ dotenvExpandOverrideFix(parsed);
41
+ }
42
+ else {
43
+ dotenv_expand_1.default.expand({ parsed, processEnv });
44
+ }
45
+ return parsed;
46
+ };
47
+ exports.parse = parse;
48
+ /**
49
+ * Parse and expand environment variables from a JSON secrets file.
50
+ *
51
+ * @param src - The raw JSON contents.
52
+ * @param override - Whether file values override existing process.env values.
53
+ * @param processEnv - The object expansion resolves references against.
54
+ * @returns An object containing the parsed and expanded environment variables.
55
+ */
56
+ const parseJSON = (src, override, processEnv) => {
57
+ // Convert buffer to string
58
+ const parsed = JSON.parse(src.toString());
59
+ if (override) {
60
+ dotenvExpandOverrideFix(parsed);
61
+ }
62
+ else {
63
+ dotenv_expand_1.default.expand({ parsed, processEnv });
64
+ }
65
+ return parsed;
66
+ };
67
+ exports.parseJSON = parseJSON;
68
+ /**
69
+ * Configure and expand environment variables from a .env file.
70
+ *
71
+ * @param args - Configuration options passed to the loader.
72
+ * @returns An object containing the parsed and expanded environment variables.
73
+ */
74
+ const config = (args) => {
75
+ const { parsed: envs } = configHelper(args);
76
+ return { parsed: envs };
77
+ };
78
+ exports.config = config;
79
+ const configHelper = (options) => {
80
+ let optionPaths = [];
81
+ if (options?.path) {
82
+ if (!Array.isArray(options.path)) {
83
+ optionPaths = [options.path];
84
+ }
85
+ else {
86
+ optionPaths = []; // reset default
87
+ for (const filepath of options.path) {
88
+ optionPaths.push(filepath);
89
+ }
90
+ }
91
+ }
92
+ // Build the parsed data in a temporary object (because we need to return it).
93
+ // Once we have the final parsed data, we will combine it with process.env (or
94
+ // options.processEnv if provided).
95
+ let lastError;
96
+ const parsedAll = {};
97
+ for (const optPath of optionPaths) {
98
+ try {
99
+ let parsed;
100
+ const contents = (0, node_fs_1.readFileSync)(optPath, { encoding: 'utf8' });
101
+ if (optPath?.endsWith('.json')) {
102
+ parsed = (0, exports.parseJSON)(contents, options?.override);
103
+ }
104
+ else {
105
+ // Specifying an encoding returns a string instead of a buffer
106
+ parsed = (0, exports.parse)(contents, options?.override);
107
+ }
108
+ dotenv_1.default.populate(parsedAll, parsed, options);
109
+ }
110
+ catch (e) {
111
+ lastError = e;
112
+ }
113
+ }
114
+ let processEnv = process.env;
115
+ if (options?.processEnv != null) {
116
+ processEnv = options.processEnv;
117
+ }
118
+ dotenv_1.default.populate(processEnv, parsedAll, options);
119
+ if (lastError) {
120
+ return { parsed: parsedAll, error: lastError };
121
+ }
122
+ return { parsed: parsedAll };
123
+ };
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.envs = void 0;
4
+ const node_fs_1 = require("node:fs");
5
+ const dotenv_checkers_js_1 = require("./dotenv-checkers.js");
6
+ const dotenv_correlation_js_1 = require("./dotenv-correlation.js");
7
+ const dotenv_files_js_1 = require("./dotenv-files.js");
8
+ const dotenv_with_expand_js_1 = require("./dotenv-with-expand.js");
9
+ const utils_js_1 = require("./utils.js");
10
+ /**
11
+ * Load environment variables from .env* files and optionally perform linting.
12
+ * Suppress warnings using silent if this file is missing. Dotenv files are
13
+ * merged in precedence order before filling process.env, so `.env.<env>.local`
14
+ * wins over lower-priority dotenv files while inherited runtime variables remain
15
+ * authoritative unless `override` is enabled. Variable expansion is supported in
16
+ * .env files.
17
+ *
18
+ * @param options - Configuration options.
19
+ * @param options.appDirectory - The directory of the app.
20
+ * @param options.secretsPath - The path to an injected secrets file.
21
+ * @param options.lint - Whether to perform `.env` hygiene linting on the loaded
22
+ * variables. **Defaults to `false`** — linting is opt-in. It used to default
23
+ * to `true` and ran on every consumer's boot via `./preload`, but its output
24
+ * was never correct (three of six checkers were fed the key where a value was
25
+ * expected, and the two quote checkers were fed post-parse values with the
26
+ * wrapping quotes already stripped, so they structurally could not observe the
27
+ * defect they exist to detect). Nothing could have correctly depended on the
28
+ * old default. Pass `lint: true` to run the checkers deliberately, or use the
29
+ * `config-lint` bin.
30
+ * @param options.override - Whether file values override existing process.env values.
31
+ * @returns An object containing the loaded environment variables.
32
+ */
33
+ const envs = ({ appDirectory = '', lint = false, secretsPath = '', override = false, } = {}) => {
34
+ const absDotenvFiles = (0, dotenv_files_js_1.resolveDotenvFileChain)({
35
+ appDirectory,
36
+ secretsPath,
37
+ nodeEnv: process.env.NODE_ENV,
38
+ env: process.env.ENV,
39
+ });
40
+ const findings = [];
41
+ const resolvedEnv = absDotenvFiles.reduce((acc, dotenvFile) => {
42
+ if (!(0, node_fs_1.existsSync)(dotenvFile)) {
43
+ return acc;
44
+ }
45
+ const contents = (0, node_fs_1.readFileSync)(dotenvFile, { encoding: 'utf8' });
46
+ const isJson = dotenvFile.endsWith('.json');
47
+ const envs = isJson
48
+ ? (0, dotenv_with_expand_js_1.parseJSON)(contents, false, {})
49
+ : (0, dotenv_with_expand_js_1.parse)(contents, false, {});
50
+ if (lint && envs) {
51
+ // Correlate against the `contents` already in scope — no second read.
52
+ // A `.json` secrets file is not dotenv syntax, so the raw-value line
53
+ // checkers do not apply to it; the key checkers still do.
54
+ const rawValues = isJson
55
+ ? new Map()
56
+ : (0, dotenv_correlation_js_1.correlateRawValues)(contents);
57
+ Object.entries(envs).forEach(([key, value]) => {
58
+ // Key checkers: unchanged call shape, unchanged `console.log` output.
59
+ (0, dotenv_checkers_js_1.incorrectDelimiterChecker)(key, value);
60
+ (0, dotenv_checkers_js_1.leadingCharacterChecker)(key);
61
+ (0, dotenv_checkers_js_1.lowercaseKeyChecker)(key);
62
+ // UNCHANGED, deliberately. Under the previous uniform
63
+ // `checker(key, value)` call this single-parameter checker bound its
64
+ // `line` parameter to the *key*, never the value. Fixing that is an
65
+ // explicit, documented scope cut (see the plan's v3 changelog and
66
+ // follow-up 1), so its behavior is preserved exactly rather than
67
+ // quietly "improved" — zero regression in either direction.
68
+ (0, dotenv_checkers_js_1.trailingWhitespaceChecker)(key);
69
+ if (isJson) {
70
+ return;
71
+ }
72
+ // Line checkers: fed the raw pre-parse value, wrapping quotes intact.
73
+ const rawValue = rawValues.get(key) ?? '';
74
+ const quoteFinding = (0, dotenv_checkers_js_1.quoteCharacterChecker)(key, rawValue);
75
+ if (quoteFinding)
76
+ findings.push(quoteFinding);
77
+ const unquotedFinding = (0, dotenv_checkers_js_1.valueWithoutQuotesChecker)(key, rawValue);
78
+ if (unquotedFinding)
79
+ findings.push(unquotedFinding);
80
+ });
81
+ }
82
+ return (0, utils_js_1.mergeAssign)(acc, envs);
83
+ }, {});
84
+ // Sole formatting/printing point for findings. Every message already has its
85
+ // value masked to the last 4 characters by the checker that produced it.
86
+ for (const finding of findings) {
87
+ console.log(`warning: ${finding.message}`);
88
+ }
89
+ return override
90
+ ? (0, utils_js_1.mergeAssign)(process.env, resolvedEnv)
91
+ : (0, utils_js_1.mergeDefaults)(process.env, resolvedEnv);
92
+ };
93
+ exports.envs = envs;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./correct-env.js"), exports);
18
+ __exportStar(require("./dotenv-checkers.js"), exports);
19
+ __exportStar(require("./dotenv-fixers.js"), exports);
20
+ __exportStar(require("./dotenv-with-expand.js"), exports);
21
+ __exportStar(require("./envs.js"), exports);
22
+ __exportStar(require("./process-env.js"), exports);
23
+ __exportStar(require("./utils.js"), exports);
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // Preload entry for `dev` / `start` scripts and any process that must have the
4
+ // dotenv chain folded into `process.env` before a single application module is
5
+ // evaluated. Wire it via `NODE_OPTIONS="--import @cogs/config/preload"` (Node
6
+ // >= 20.6, ESM). Importing this module runs `correctEnv()` and then `envs()` as
7
+ // a side effect.
8
+ const correct_env_js_1 = require("./correct-env.js");
9
+ const envs_js_1 = require("./envs.js");
10
+ (0, correct_env_js_1.correctEnv)();
11
+ (0, envs_js_1.envs)({
12
+ appDirectory: process.cwd(),
13
+ // Guard the concat: an unset SECRETS_PATH must yield '' rather than the
14
+ // literal string 'undefinedsecrets.json'.
15
+ secretsPath: process.env.SECRETS_PATH
16
+ ? `${process.env.SECRETS_PATH}secrets.json`
17
+ : '',
18
+ });
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.processEnv = void 0;
4
+ /**
5
+ * Process environment variables based on specific rules.
6
+ *
7
+ * @param config - The configuration object.
8
+ * @returns An object containing processed environment variables.
9
+ */
10
+ const processEnv = (config) => {
11
+ // node env should be DEVELOPMENT | PRODUCTION as these are commonly used in
12
+ // node land this variable is used inside webpack
13
+ const nodeEnv = process.env.NODE_ENV;
14
+ // config env is dependent on the env that it's run, this can be anything from
15
+ // stage-prod this allows you to set use different .env environments
16
+ const configEnv = process.env.ENV;
17
+ const envObject = Object.keys(config).reduce((acc, key) => {
18
+ acc[key] = config[key];
19
+ return acc;
20
+ }, {});
21
+ const processEnvObj = Object.keys(process.env).reduce((acc, key) => {
22
+ acc[key] = process.env[key];
23
+ return acc;
24
+ }, {});
25
+ // Don't allow overwriting of NODE_ENV
26
+ envObject.NODE_ENV = nodeEnv;
27
+ // anything from dev, qa, prive and prod
28
+ envObject.ENV = configEnv;
29
+ let mergedEnvVars = Object.assign(envObject, processEnvObj);
30
+ mergedEnvVars = Object.keys(mergedEnvVars).reduce((acc, key) => {
31
+ acc[key] = mergedEnvVars[key];
32
+ return acc;
33
+ }, {});
34
+ return Object.keys(mergedEnvVars).reduce((acc, key) => {
35
+ acc[key] = mergedEnvVars[key];
36
+ return acc;
37
+ }, {});
38
+ };
39
+ exports.processEnv = processEnv;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ /**
3
+ * Value masking for lint findings.
4
+ *
5
+ * Local port of `packages/env-doctor/src/redact.ts`'s `maskLast4`, duplicated
6
+ * deliberately rather than imported across packages: `@cogs/config` is the
7
+ * published, dependency-light loader that every app preloads, and
8
+ * `@cogs/env-doctor` is a private tool. A cross-package import would invert that
9
+ * dependency direction for four lines of string slicing.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.maskLast4 = void 0;
13
+ /**
14
+ * Mask a value to its last 4 characters so a finding can say *which* value it
15
+ * is about without printing a secret in full.
16
+ *
17
+ * Values of 4 characters or fewer are masked outright rather than shown, and an
18
+ * empty value renders as `(empty)` so a `KEY=` line is still legible.
19
+ */
20
+ const maskLast4 = (value) => {
21
+ if (value.length === 0)
22
+ return '(empty)';
23
+ if (value.length <= 4)
24
+ return '****';
25
+ return `****${value.slice(-4)}`;
26
+ };
27
+ exports.maskLast4 = maskLast4;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isEmpty = exports.removeInvalidLeadingChars = exports.resolveApp = exports.mergeAssign = exports.mergeDefaults = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const mergeDefaults = (target, source) => {
9
+ const targetRecord = target;
10
+ if (!source) {
11
+ return target;
12
+ }
13
+ Object.entries(source).forEach(([key, value]) => {
14
+ if (targetRecord[key] === undefined) {
15
+ targetRecord[key] = value;
16
+ }
17
+ });
18
+ return target;
19
+ };
20
+ exports.mergeDefaults = mergeDefaults;
21
+ const mergeAssign = (target, source) => {
22
+ const targetRecord = target;
23
+ if (!source) {
24
+ return target;
25
+ }
26
+ Object.entries(source).forEach(([key, value]) => {
27
+ targetRecord[key] = value;
28
+ });
29
+ return target;
30
+ };
31
+ exports.mergeAssign = mergeAssign;
32
+ /**
33
+ * Resolve an absolute path by combining the `appDirectory` and `relativePath`.
34
+ *
35
+ * @param relativePath - The relative path to resolve.
36
+ * @param appDirectory - The base directory for the resolution.
37
+ * @returns The resolved absolute path.
38
+ */
39
+ const resolveApp = (relativePath, appDirectory) => node_path_1.default.resolve(appDirectory, relativePath);
40
+ exports.resolveApp = resolveApp;
41
+ /**
42
+ * Removes invalid leading characters (characters from A to Z and _(underscore)
43
+ * are allowed) from the given string.
44
+ *
45
+ * @param str - The input string.
46
+ * @returns The string with invalid leading characters removed.
47
+ */
48
+ const removeInvalidLeadingChars = (str) => {
49
+ const chars = str.split('');
50
+ let notFound = true;
51
+ let i = 0;
52
+ while (notFound && i < chars.length) {
53
+ const currentChar = chars[i];
54
+ if (currentChar !== undefined && /[a-z_]/i.test(currentChar)) {
55
+ notFound = false;
56
+ }
57
+ else {
58
+ i++;
59
+ }
60
+ }
61
+ return str.slice(i);
62
+ };
63
+ exports.removeInvalidLeadingChars = removeInvalidLeadingChars;
64
+ const isEmpty = (str) => str == null || str.length === 0;
65
+ exports.isEmpty = isEmpty;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * `config-lint` CLI core. All logic lives here behind injectable dependencies so
3
+ * it is unit-testable without a real filesystem; `cli.ts` is a thin `main()`
4
+ * wrapper. Split and posture follow `packages/env-doctor/src/cli-core.ts` +
5
+ * `cli.ts`.
6
+ *
7
+ * Deliberately NOT re-exported from `index.ts`: `@cogs/config` is preloaded into
8
+ * every consumer's process via `./preload`, and the bin's code has no business
9
+ * in that path's transitive footprint.
10
+ *
11
+ * Safety posture:
12
+ * - **Read-only by default.** `--fix` is the only path that writes, and it only
13
+ * rewrites single-line entries it can locate byte-exactly in the source.
14
+ * - **No value is ever printed in full**, in human or `--json` output: every
15
+ * finding message arrives pre-masked to its last 4 characters by
16
+ * `redact.ts`'s `maskLast4` — a package-local port of
17
+ * `packages/env-doctor/src/redact.ts`, not a cross-package import.
18
+ */
19
+ import { type Finding } from './dotenv-checkers.js';
20
+ export declare const TOOL_NAME = "config-lint";
21
+ /** Read from this package's own `package.json` — resolves the same from `src/` and `dist/`. */
22
+ export declare const VERSION: string;
23
+ /** 0 clean · 1 unexpected error · 2 usage error · 3 findings present. */
24
+ export declare const EXIT: {
25
+ readonly CLEAN: 0;
26
+ readonly ERROR: 1;
27
+ readonly USAGE: 2;
28
+ readonly FINDINGS: 3;
29
+ };
30
+ export declare const HELP: string;
31
+ export interface CliDeps {
32
+ existsSync?: (path: string) => boolean;
33
+ readFileSync?: (path: string) => string;
34
+ writeFileSync?: (path: string, data: string) => void;
35
+ log?: (message: string) => void;
36
+ error?: (message: string) => void;
37
+ env?: Record<string, string | undefined>;
38
+ }
39
+ export interface ParsedArgs {
40
+ appDirectory: string;
41
+ json: boolean;
42
+ fix: boolean;
43
+ help: boolean;
44
+ version: boolean;
45
+ }
46
+ export declare class CliUsageError extends Error {
47
+ }
48
+ export declare const parseArgs: (argv: string[]) => ParsedArgs;
49
+ /** Lint one file's raw contents. */
50
+ export declare const lintContents: (contents: string) => Finding[];
51
+ /**
52
+ * Rewrite the fixable single-line entries in `contents`.
53
+ *
54
+ * Conservative by construction. The raw values come from correlating the
55
+ * **whole file** — never the physical line in isolation — and an entry is only
56
+ * rewritten when that whole-file value is single-line AND can be located
57
+ * byte-exactly within the line. Correlating a line in isolation would see the
58
+ * opening half of a multiline quoted value (`ML="line1`) as a complete unquoted
59
+ * value and let `quoteCharacterFixer` strip its opening quote, corrupting the
60
+ * file. Anything the whole-file correlation and the line splitting disagree
61
+ * about — multiline values, duplicate keys, continuation lines that happen to
62
+ * look like entries — is left untouched rather than guessed at.
63
+ *
64
+ * See HELP's known limitations for the separate, pre-existing corruption risk
65
+ * the underlying fixers themselves carry.
66
+ */
67
+ export declare const applyFixes: (contents: string) => string;
68
+ export interface JsonFinding extends Finding {
69
+ file: string;
70
+ }
71
+ export declare function main(argv: string[], deps?: CliDeps): Promise<number>;
72
+ //# sourceMappingURL=cli-core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-core.d.ts","sourceRoot":"","sources":["../src/cli-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAQH,OAAO,EAGL,KAAK,OAAO,EACb,MAAM,sBAAsB,CAAA;AAK7B,eAAO,MAAM,SAAS,gBAAgB,CAAA;AAEtC,+FAA+F;AAC/F,eAAO,MAAM,OAAO,EAAE,MAYlB,CAAA;AAEJ,yEAAyE;AACzE,eAAO,MAAM,IAAI;;;;;CAKP,CAAA;AAEV,eAAO,MAAM,IAAI,QA2CT,CAAA;AAMR,MAAM,WAAW,OAAO;IACtB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;IACtC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IACvC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACpD,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;CACzC;AA4BD,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,OAAO,CAAA;IACb,GAAG,EAAE,OAAO,CAAA;IACZ,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,qBAAa,aAAc,SAAQ,KAAK;CAAG;AAE3C,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,KAAG,UA8B1C,CAAA;AA+DD,oCAAoC;AACpC,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM,KAAG,OAAO,EAetD,CAAA;AASD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU,GAAI,UAAU,MAAM,KAAG,MA8B7C,CAAA;AAMD,MAAM,WAAW,WAAY,SAAQ,OAAO;IAC1C,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAsB,IAAI,CACxB,IAAI,EAAE,MAAM,EAAE,EACd,IAAI,GAAE,OAAY,GACjB,OAAO,CAAC,MAAM,CAAC,CAoEjB"}