dotenv-diff 2.5.0 → 2.5.2

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 (199) hide show
  1. package/CHANGELOG.md +341 -536
  2. package/dist/bin/dotenv-diff.js +0 -0
  3. package/package.json +5 -1
  4. package/dist/cli.d.ts +0 -9
  5. package/dist/cli.js +0 -294
  6. package/dist/diffEnv.d.ts +0 -5
  7. package/dist/diffEnv.js +0 -7
  8. package/dist/index.d.ts +0 -2
  9. package/dist/index.js +0 -2
  10. package/dist/lib/checkGitignore.d.ts +0 -23
  11. package/dist/lib/checkGitignore.js +0 -73
  12. package/dist/lib/diffEnv.d.ts +0 -18
  13. package/dist/lib/diffEnv.js +0 -29
  14. package/dist/lib/parseEnv.d.ts +0 -10
  15. package/dist/lib/parseEnv.js +0 -25
  16. package/dist/parseEnv.d.ts +0 -1
  17. package/dist/parseEnv.js +0 -16
  18. package/dist/src/core/compareScan.d.ts +0 -10
  19. package/dist/src/core/compareScan.d.ts.map +0 -1
  20. package/dist/src/core/compareScan.js +0 -19
  21. package/dist/src/core/compareScan.js.map +0 -1
  22. package/dist/src/core/computeHealthScore.d.ts +0 -8
  23. package/dist/src/core/computeHealthScore.d.ts.map +0 -1
  24. package/dist/src/core/computeHealthScore.js +0 -35
  25. package/dist/src/core/computeHealthScore.js.map +0 -1
  26. package/dist/src/core/cspDetector.d.ts +0 -7
  27. package/dist/src/core/cspDetector.d.ts.map +0 -1
  28. package/dist/src/core/cspDetector.js +0 -38
  29. package/dist/src/core/cspDetector.js.map +0 -1
  30. package/dist/src/core/defaultExcludeKeys.d.ts +0 -7
  31. package/dist/src/core/defaultExcludeKeys.d.ts.map +0 -1
  32. package/dist/src/core/detectClientExposure.d.ts +0 -12
  33. package/dist/src/core/detectClientExposure.d.ts.map +0 -1
  34. package/dist/src/core/detectClientExposure.js +0 -62
  35. package/dist/src/core/detectClientExposure.js.map +0 -1
  36. package/dist/src/core/detectExpirations.d.ts +0 -14
  37. package/dist/src/core/detectExpirations.d.ts.map +0 -1
  38. package/dist/src/core/detectExpirations.js +0 -44
  39. package/dist/src/core/detectExpirations.js.map +0 -1
  40. package/dist/src/core/detectUppercaseKeys.d.ts +0 -9
  41. package/dist/src/core/detectUppercaseKeys.d.ts.map +0 -1
  42. package/dist/src/core/detectUppercaseKeys.js +0 -28
  43. package/dist/src/core/detectUppercaseKeys.js.map +0 -1
  44. package/dist/src/core/determineComparisonFile.d.ts +0 -13
  45. package/dist/src/core/determineComparisonFile.d.ts.map +0 -1
  46. package/dist/src/core/determineComparisonFile.js +0 -33
  47. package/dist/src/core/determineComparisonFile.js.map +0 -1
  48. package/dist/src/core/entropy.d.ts +0 -8
  49. package/dist/src/core/entropy.d.ts.map +0 -1
  50. package/dist/src/core/entropy.js +0 -23
  51. package/dist/src/core/entropy.js.map +0 -1
  52. package/dist/src/core/envDiscovery.d.ts +0 -19
  53. package/dist/src/core/envDiscovery.d.ts.map +0 -1
  54. package/dist/src/core/envDiscovery.js +0 -81
  55. package/dist/src/core/envDiscovery.js.map +0 -1
  56. package/dist/src/core/envPairing.d.ts +0 -8
  57. package/dist/src/core/envPairing.d.ts.map +0 -1
  58. package/dist/src/core/envPairing.js +0 -36
  59. package/dist/src/core/envPairing.js.map +0 -1
  60. package/dist/src/core/envValidator.d.ts +0 -9
  61. package/dist/src/core/envValidator.d.ts.map +0 -1
  62. package/dist/src/core/envValidator.js +0 -103
  63. package/dist/src/core/envValidator.js.map +0 -1
  64. package/dist/src/core/exampleSecretDetector.d.ts +0 -13
  65. package/dist/src/core/exampleSecretDetector.d.ts.map +0 -1
  66. package/dist/src/core/exampleSecretDetector.js +0 -61
  67. package/dist/src/core/exampleSecretDetector.js.map +0 -1
  68. package/dist/src/core/frameworkDetector.d.ts +0 -14
  69. package/dist/src/core/frameworkDetector.d.ts.map +0 -1
  70. package/dist/src/core/frameworkDetector.js +0 -40
  71. package/dist/src/core/frameworkDetector.js.map +0 -1
  72. package/dist/src/core/frameworkValidator.d.ts +0 -10
  73. package/dist/src/core/frameworkValidator.d.ts.map +0 -1
  74. package/dist/src/core/frameworkValidator.js +0 -21
  75. package/dist/src/core/frameworkValidator.js.map +0 -1
  76. package/dist/src/core/frameworks/angularRules.d.ts +0 -4
  77. package/dist/src/core/frameworks/angularRules.d.ts.map +0 -1
  78. package/dist/src/core/helpers/isAllOk.d.ts +0 -9
  79. package/dist/src/core/helpers/isAllOk.d.ts.map +0 -1
  80. package/dist/src/core/helpers/isAllOk.js +0 -16
  81. package/dist/src/core/helpers/isAllOk.js.map +0 -1
  82. package/dist/src/core/helpers/updateTotals.d.ts +0 -19
  83. package/dist/src/core/helpers/updateTotals.d.ts.map +0 -1
  84. package/dist/src/core/helpers/updateTotals.js +0 -37
  85. package/dist/src/core/helpers/updateTotals.js.map +0 -1
  86. package/dist/src/core/parseAndFilterEnv.d.ts +0 -20
  87. package/dist/src/core/parseAndFilterEnv.d.ts.map +0 -1
  88. package/dist/src/core/parseAndFilterEnv.js +0 -22
  89. package/dist/src/core/parseAndFilterEnv.js.map +0 -1
  90. package/dist/src/core/processComparisonFile.d.ts +0 -43
  91. package/dist/src/core/processComparisonFile.d.ts.map +0 -1
  92. package/dist/src/core/processComparisonFile.js +0 -170
  93. package/dist/src/core/processComparisonFile.js.map +0 -1
  94. package/dist/src/core/scan/scanJsonOutput.d.ts +0 -85
  95. package/dist/src/core/scan/scanJsonOutput.d.ts.map +0 -1
  96. package/dist/src/core/scan/scanJsonOutput.js +0 -97
  97. package/dist/src/core/scan/scanJsonOutput.js.map +0 -1
  98. package/dist/src/core/scan/secretDetectors.d.ts +0 -28
  99. package/dist/src/core/scan/secretDetectors.d.ts.map +0 -1
  100. package/dist/src/core/scan/secretDetectors.js +0 -272
  101. package/dist/src/core/scan/secretDetectors.js.map +0 -1
  102. package/dist/src/core/scanFile.d.ts +0 -10
  103. package/dist/src/core/scanFile.d.ts.map +0 -1
  104. package/dist/src/core/scanFile.js +0 -65
  105. package/dist/src/core/scanFile.js.map +0 -1
  106. package/dist/src/core/scanJsonOutput.d.ts +0 -85
  107. package/dist/src/core/scanJsonOutput.d.ts.map +0 -1
  108. package/dist/src/core/scanJsonOutput.js +0 -97
  109. package/dist/src/core/scanJsonOutput.js.map +0 -1
  110. package/dist/src/core/secretDetectors.d.ts +0 -28
  111. package/dist/src/core/secretDetectors.d.ts.map +0 -1
  112. package/dist/src/core/secretDetectors.js +0 -272
  113. package/dist/src/core/secretDetectors.js.map +0 -1
  114. package/dist/src/core/t3env/detectT3Env.d.ts +0 -12
  115. package/dist/src/core/t3env/detectT3Env.d.ts.map +0 -1
  116. package/dist/src/core/t3env/detectT3Env.js +0 -113
  117. package/dist/src/core/t3env/detectT3Env.js.map +0 -1
  118. package/dist/src/core/t3env/t3EnvRules.d.ts +0 -10
  119. package/dist/src/core/t3env/t3EnvRules.d.ts.map +0 -1
  120. package/dist/src/core/t3env/t3EnvRules.js +0 -61
  121. package/dist/src/core/t3env/t3EnvRules.js.map +0 -1
  122. package/dist/src/core/t3env/t3EnvValidator.d.ts +0 -9
  123. package/dist/src/core/t3env/t3EnvValidator.d.ts.map +0 -1
  124. package/dist/src/core/t3env/t3EnvValidator.js +0 -32
  125. package/dist/src/core/t3env/t3EnvValidator.js.map +0 -1
  126. package/dist/src/lib/diffEnv.d.ts +0 -19
  127. package/dist/src/lib/diffEnv.d.ts.map +0 -1
  128. package/dist/src/lib/diffEnv.js +0 -31
  129. package/dist/src/lib/diffEnv.js.map +0 -1
  130. package/dist/src/lib/parseEnv.d.ts +0 -11
  131. package/dist/src/lib/parseEnv.d.ts.map +0 -1
  132. package/dist/src/lib/parseEnv.js +0 -26
  133. package/dist/src/lib/parseEnv.js.map +0 -1
  134. package/dist/src/services/codeBaseScanner.d.ts +0 -8
  135. package/dist/src/services/codeBaseScanner.d.ts.map +0 -1
  136. package/dist/src/services/codeBaseScanner.js +0 -110
  137. package/dist/src/services/codeBaseScanner.js.map +0 -1
  138. package/dist/src/services/duplicates.d.ts +0 -12
  139. package/dist/src/services/duplicates.d.ts.map +0 -1
  140. package/dist/src/services/duplicates.js +0 -36
  141. package/dist/src/services/duplicates.js.map +0 -1
  142. package/dist/src/services/ensureFilesOrPrompt.d.ts +0 -22
  143. package/dist/src/services/ensureFilesOrPrompt.d.ts.map +0 -1
  144. package/dist/src/services/ensureFilesOrPrompt.js +0 -76
  145. package/dist/src/services/ensureFilesOrPrompt.js.map +0 -1
  146. package/dist/src/services/scanOutputToConsole.d.ts +0 -17
  147. package/dist/src/services/scanOutputToConsole.d.ts.map +0 -1
  148. package/dist/src/services/scanOutputToConsole.js +0 -127
  149. package/dist/src/services/scanOutputToConsole.js.map +0 -1
  150. package/dist/src/ui/compare/printAutoFix.d.ts +0 -16
  151. package/dist/src/ui/compare/printAutoFix.d.ts.map +0 -1
  152. package/dist/src/ui/compare/printAutoFix.js +0 -34
  153. package/dist/src/ui/compare/printAutoFix.js.map +0 -1
  154. package/dist/src/ui/compare/printAutoFixApplied.d.ts +0 -7
  155. package/dist/src/ui/compare/printAutoFixApplied.d.ts.map +0 -1
  156. package/dist/src/ui/compare/printAutoFixApplied.js +0 -22
  157. package/dist/src/ui/compare/printAutoFixApplied.js.map +0 -1
  158. package/dist/src/ui/compare/printDuplicates.d.ts +0 -17
  159. package/dist/src/ui/compare/printDuplicates.d.ts.map +0 -1
  160. package/dist/src/ui/compare/printDuplicates.js +0 -25
  161. package/dist/src/ui/compare/printDuplicates.js.map +0 -1
  162. package/dist/src/ui/compare/printFixTips.d.ts +0 -11
  163. package/dist/src/ui/compare/printFixTips.d.ts.map +0 -1
  164. package/dist/src/ui/compare/printFixTips.js +0 -46
  165. package/dist/src/ui/compare/printFixTips.js.map +0 -1
  166. package/dist/src/ui/compare/printSuccess.d.ts +0 -11
  167. package/dist/src/ui/compare/printSuccess.d.ts.map +0 -1
  168. package/dist/src/ui/compare/printSuccess.js +0 -27
  169. package/dist/src/ui/compare/printSuccess.js.map +0 -1
  170. package/dist/src/ui/scan/printCspWarning.d.ts +0 -9
  171. package/dist/src/ui/scan/printCspWarning.d.ts.map +0 -1
  172. package/dist/src/ui/scan/printCspWarning.js +0 -20
  173. package/dist/src/ui/scan/printCspWarning.js.map +0 -1
  174. package/dist/src/ui/scan/printEnvWarnings.d.ts +0 -8
  175. package/dist/src/ui/scan/printEnvWarnings.d.ts.map +0 -1
  176. package/dist/src/ui/scan/printEnvWarnings.js +0 -20
  177. package/dist/src/ui/scan/printEnvWarnings.js.map +0 -1
  178. package/dist/src/ui/scan/printExposedVars.d.ts +0 -8
  179. package/dist/src/ui/scan/printExposedVars.d.ts.map +0 -1
  180. package/dist/src/ui/scan/printExposedVars.js +0 -24
  181. package/dist/src/ui/scan/printExposedVars.js.map +0 -1
  182. package/dist/src/ui/scan/printT3EnvWarnings.d.ts +0 -8
  183. package/dist/src/ui/scan/printT3EnvWarnings.d.ts.map +0 -1
  184. package/dist/src/ui/scan/printT3EnvWarnings.js +0 -20
  185. package/dist/src/ui/scan/printT3EnvWarnings.js.map +0 -1
  186. package/dist/src/ui/scan/printUniqueVariables.d.ts +0 -7
  187. package/dist/src/ui/scan/printUniqueVariables.d.ts.map +0 -1
  188. package/dist/src/ui/scan/printUniqueVariables.js +0 -14
  189. package/dist/src/ui/scan/printUniqueVariables.js.map +0 -1
  190. package/dist/src/ui/scan/printVariables.d.ts +0 -10
  191. package/dist/src/ui/scan/printVariables.d.ts.map +0 -1
  192. package/dist/src/ui/scan/printVariables.js +0 -37
  193. package/dist/src/ui/scan/printVariables.js.map +0 -1
  194. package/dist/src/ui/shared/printProgress.d.ts +0 -24
  195. package/dist/src/ui/shared/printProgress.d.ts.map +0 -1
  196. package/dist/src/ui/shared/printProgress.js +0 -43
  197. package/dist/src/ui/shared/printProgress.js.map +0 -1
  198. package/dist/types/scanUsage.d.ts +0 -43
  199. package/dist/types/scanUsage.d.ts.map +0 -1
@@ -1,26 +0,0 @@
1
- import fs from 'fs';
2
- /**
3
- * Parses a `.env` file and returns an object with key-value pairs.
4
- *
5
- * @param path - The file path to the `.env` file.
6
- * @returns A record object representing parsed environment variables.
7
- *
8
- * Lines that are empty or start with `#` (comments) are ignored.
9
- * Multi-line or quoted values are not supported.
10
- */
11
- export function parseEnvFile(path) {
12
- const content = fs.readFileSync(path, 'utf-8');
13
- const lines = content.split('\n');
14
- const result = {};
15
- for (const line of lines) {
16
- const trimmed = line.trim();
17
- if (!trimmed || trimmed.startsWith('#'))
18
- continue;
19
- const [key, ...rest] = trimmed.split('=');
20
- if (!key)
21
- continue;
22
- result[key.trim()] = rest.join('=').trim();
23
- }
24
- return result;
25
- }
26
- //# sourceMappingURL=parseEnv.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseEnv.js","sourceRoot":"","sources":["../../../src/lib/parseEnv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAElC,MAAM,MAAM,GAA2B,EAAE,CAAC;IAE1C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAElD,MAAM,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1C,IAAI,CAAC,GAAG;YAAE,SAAS;QAEnB,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7C,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,8 +0,0 @@
1
- import type { ScanOptions, ScanResult } from '../config/types.js';
2
- /**
3
- * Scans the codebase for environment variable usage based on the provided options.
4
- * @param opts - Options for scanning the codebase.
5
- * @returns A promise that resolves to the scan result containing used, missing, and unused variables.
6
- */
7
- export declare function scanCodebase(opts: ScanOptions): Promise<ScanResult>;
8
- //# sourceMappingURL=codeBaseScanner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codeBaseScanner.d.ts","sourceRoot":"","sources":["../../../src/services/codeBaseScanner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAY,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAU5E;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAsEzE"}
@@ -1,110 +0,0 @@
1
- import fs from 'fs/promises';
2
- import path from 'path';
3
- import { detectSecretsInSource, } from '../core/secretDetectors.js';
4
- import { DEFAULT_EXCLUDE_PATTERNS } from '../core/patterns.js';
5
- import { scanFile } from '../core/scanFile.js';
6
- import { findFiles } from './fileWalker.js';
7
- import { printProgress } from '../ui/scan/printProgress.js';
8
- /**
9
- * Scans the codebase for environment variable usage based on the provided options.
10
- * @param opts - Options for scanning the codebase.
11
- * @returns A promise that resolves to the scan result containing used, missing, and unused variables.
12
- */
13
- export async function scanCodebase(opts) {
14
- const files = await findFiles(opts.cwd, {
15
- include: opts.include,
16
- exclude: [...DEFAULT_EXCLUDE_PATTERNS, ...opts.exclude],
17
- ...(opts.files ? { files: opts.files } : {}), // Pass files option
18
- });
19
- const allUsages = [];
20
- let filesScanned = 0;
21
- const allSecrets = [];
22
- const fileContentMap = new Map();
23
- for (const filePath of files) {
24
- const content = await safeReadFile(filePath);
25
- if (!content)
26
- continue;
27
- // Scan the file for environment variable usages
28
- const fileUsages = scanFile(filePath, content, opts);
29
- allUsages.push(...fileUsages);
30
- // Store file content for later use (e.g., framework validation 'use client')
31
- const relativePath = path.relative(opts.cwd, filePath);
32
- fileContentMap.set(relativePath, content);
33
- // Detect secrets in the file content
34
- const secrets = safeDetectSecrets(relativePath, content, opts);
35
- if (secrets.length)
36
- allSecrets.push(...secrets);
37
- // Count successfully scanned files
38
- filesScanned++;
39
- if (shouldPrintProgress(filesScanned, files.length)) {
40
- printProgress({
41
- isJson: opts.json,
42
- current: filesScanned,
43
- total: files.length,
44
- });
45
- }
46
- }
47
- // Filter out ignored variables
48
- const filteredUsages = allUsages.filter((usage) => !opts.ignore.includes(usage.variable) &&
49
- !opts.ignoreRegex.some((regex) => regex.test(usage.variable)));
50
- const uniqueVariables = [...new Set(filteredUsages.map((u) => u.variable))];
51
- const loggedVariables = filteredUsages.filter((u) => u.isLogged);
52
- return {
53
- used: filteredUsages,
54
- missing: [],
55
- unused: [],
56
- secrets: allSecrets,
57
- stats: {
58
- filesScanned,
59
- totalUsages: filteredUsages.length,
60
- uniqueVariables: uniqueVariables.length,
61
- warningsCount: 0,
62
- duration: 0,
63
- },
64
- duplicates: {
65
- env: [],
66
- example: [],
67
- },
68
- logged: loggedVariables,
69
- fileContentMap,
70
- };
71
- }
72
- /**
73
- * Detects secrets in the given file content if secret detection is enabled.
74
- * @param relativePath - The relative path of the file being scanned.
75
- * @param content - The content of the file.
76
- * @param opts - The scan options.
77
- * @returns An array of secret findings.
78
- */
79
- function safeDetectSecrets(relativePath, content, opts) {
80
- if (!opts.secrets)
81
- return [];
82
- try {
83
- return detectSecretsInSource(relativePath, content, opts).filter((s) => s.severity !== 'low');
84
- }
85
- catch {
86
- return [];
87
- }
88
- }
89
- /**
90
- * Safely reads a file and returns its content or null if reading fails.
91
- * @param filePath - The path to the file to read.
92
- * @returns The file content as a string, or null if an error occurs.
93
- */
94
- async function safeReadFile(filePath) {
95
- try {
96
- return await fs.readFile(filePath, 'utf-8');
97
- }
98
- catch {
99
- return null;
100
- }
101
- }
102
- /** * Determines whether to print progress based on the number of files scanned.
103
- * @param scanned - The number of files scanned so far.
104
- * @param total - The total number of files to scan.
105
- * @returns True if progress should be printed, false otherwise.
106
- */
107
- function shouldPrintProgress(scanned, total) {
108
- return scanned === 1 || scanned % 10 === 0 || scanned === total;
109
- }
110
- //# sourceMappingURL=codeBaseScanner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codeBaseScanner.js","sourceRoot":"","sources":["../../../src/services/codeBaseScanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,qBAAqB,GAEtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAiB;IAClD,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE;QACtC,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,OAAO,EAAE,CAAC,GAAG,wBAAwB,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACvD,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,oBAAoB;KACnE,CAAC,CAAC;IAEH,MAAM,SAAS,GAAe,EAAE,CAAC;IACjC,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,MAAM,UAAU,GAAoB,EAAE,CAAC;IACvC,MAAM,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEjD,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE,CAAC;QAC7B,MAA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AAe,EAAE,KAAa;IACzD,OAAO,OAAO,KAAK,CAAC,IAAI,OAAO,GAAG,EAAE,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,CAAC;AAClE,CAAC"}
@@ -1,12 +0,0 @@
1
- import type { Duplicate } from '../config/types.js';
2
- /**
3
- * Scan a .env-like file for duplicate keys.
4
- * - Ignores empty lines and comments (#...)
5
- * - Splits on first '='
6
- * - Trims the key
7
- * - Returns keys that appear more than once, with counts
8
- * @param filePath - Path to the .env file to scan
9
- * @returns An array of objects representing duplicate keys and their counts.
10
- */
11
- export declare function findDuplicateKeys(filePath: string): Array<Duplicate>;
12
- //# sourceMappingURL=duplicates.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"duplicates.d.ts","sourceRoot":"","sources":["../../../src/services/duplicates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,CA0BpE"}
@@ -1,36 +0,0 @@
1
- import fs from 'fs';
2
- /**
3
- * Scan a .env-like file for duplicate keys.
4
- * - Ignores empty lines and comments (#...)
5
- * - Splits on first '='
6
- * - Trims the key
7
- * - Returns keys that appear more than once, with counts
8
- * @param filePath - Path to the .env file to scan
9
- * @returns An array of objects representing duplicate keys and their counts.
10
- */
11
- export function findDuplicateKeys(filePath) {
12
- if (!fs.existsSync(filePath))
13
- return [];
14
- const raw = fs.readFileSync(filePath, 'utf8').replace(/^\uFEFF/, '');
15
- const lines = raw.split(/\r?\n/);
16
- const counts = new Map();
17
- for (const line of lines) {
18
- const trimmed = line.trim();
19
- if (!trimmed || trimmed.startsWith('#'))
20
- continue;
21
- const eq = trimmed.indexOf('=');
22
- if (eq <= 0)
23
- continue; // no '=' or empty key
24
- const key = trimmed.slice(0, eq).trim();
25
- if (!key)
26
- continue;
27
- counts.set(key, (counts.get(key) ?? 0) + 1);
28
- }
29
- const duplicates = [];
30
- for (const [key, count] of counts) {
31
- if (count > 1)
32
- duplicates.push({ key, count });
33
- }
34
- return duplicates;
35
- }
36
- //# sourceMappingURL=duplicates.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"duplicates.js","sourceRoot":"","sources":["../../../src/services/duplicates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAGpB;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,EAAE,CAAC;IAExC,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACrE,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEjC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEzC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAElD,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,EAAE,IAAI,CAAC;YAAE,SAAS,CAAC,sBAAsB;QAE7C,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACxC,IAAI,CAAC,GAAG;YAAE,SAAS;QAEnB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,UAAU,GAAqB,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,CAAC;QAClC,IAAI,KAAK,GAAG,CAAC;YAAE,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -1,22 +0,0 @@
1
- interface EnsureFilesResult {
2
- didCreate: boolean;
3
- shouldExit: boolean;
4
- exitCode: number;
5
- }
6
- interface EnsureFilesArgs {
7
- cwd: string;
8
- primaryEnv: string;
9
- primaryExample: string;
10
- alreadyWarnedMissingEnv: boolean;
11
- isYesMode: boolean;
12
- isCiMode: boolean;
13
- }
14
- /**
15
- * Ensures that the necessary .env files exist or prompts the user to create them.
16
- * This function handles only scenarios where the --compare flag is set
17
- * @param args - The arguments for the function.
18
- * @returns An object indicating whether a file was created or if the process should exit.
19
- */
20
- export declare function ensureFilesOrPrompt(args: EnsureFilesArgs): Promise<EnsureFilesResult>;
21
- export {};
22
- //# sourceMappingURL=ensureFilesOrPrompt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureFilesOrPrompt.d.ts","sourceRoot":"","sources":["../../../src/services/ensureFilesOrPrompt.ts"],"names":[],"mappings":"AAOA,UAAU,iBAAiB;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,eAAe;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,uBAAuB,EAAE,OAAO,CAAC;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB;AACD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,iBAAiB,CAAC,CAuF5B"}
@@ -1,76 +0,0 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import { confirmYesNo } from '../ui/prompts.js';
4
- import { warnIfEnvNotIgnored } from './git.js';
5
- import { printPrompt } from '../ui/compare/printPrompt.js';
6
- import { DEFAULT_ENV_FILE } from '../config/constants.js';
7
- /**
8
- * Ensures that the necessary .env files exist or prompts the user to create them.
9
- * This function handles only scenarios where the --compare flag is set
10
- * @param args - The arguments for the function.
11
- * @returns An object indicating whether a file was created or if the process should exit.
12
- */
13
- export async function ensureFilesOrPrompt(args) {
14
- const { cwd, primaryEnv, primaryExample, alreadyWarnedMissingEnv, isYesMode, isCiMode, } = args;
15
- const envPath = path.resolve(cwd, primaryEnv);
16
- const examplePath = path.resolve(cwd, primaryExample);
17
- const envExists = fs.existsSync(envPath);
18
- const exampleExists = fs.existsSync(examplePath);
19
- // Case 1: no .env and no .env.example
20
- if (!envExists && !exampleExists) {
21
- const hasAnyEnv = fs
22
- .readdirSync(cwd)
23
- .some((f) => f.startsWith(DEFAULT_ENV_FILE));
24
- if (!hasAnyEnv) {
25
- printPrompt.noEnvFound();
26
- return { didCreate: false, shouldExit: true, exitCode: 0 };
27
- }
28
- }
29
- // Case 2: missing .env but has .env.example
30
- if (!envExists && exampleExists) {
31
- if (!alreadyWarnedMissingEnv) {
32
- printPrompt.missingEnv(envPath);
33
- }
34
- const createEnv = isYesMode
35
- ? true
36
- : isCiMode
37
- ? false
38
- : await confirmYesNo(`❓ Do you want to create a new ${path.basename(envPath)} file from ${path.basename(examplePath)}?`, { isCiMode, isYesMode });
39
- if (!createEnv) {
40
- printPrompt.skipCreation(DEFAULT_ENV_FILE);
41
- return { didCreate: false, shouldExit: true, exitCode: 0 };
42
- }
43
- const exampleContent = fs.readFileSync(examplePath, 'utf-8');
44
- fs.writeFileSync(envPath, exampleContent);
45
- printPrompt.envCreated(envPath, examplePath);
46
- warnIfEnvNotIgnored({ envFile: path.basename(envPath) });
47
- }
48
- // Case 3: has .env but is missing .env.example
49
- if (envExists && !exampleExists) {
50
- printPrompt.missingEnv(examplePath);
51
- const createExample = isYesMode
52
- ? true
53
- : isCiMode
54
- ? false
55
- : await confirmYesNo(`❓ Do you want to create a new ${path.basename(examplePath)} file from ${path.basename(envPath)}?`, { isCiMode, isYesMode });
56
- if (!createExample) {
57
- printPrompt.skipCreation('.env.example');
58
- return { didCreate: false, shouldExit: true, exitCode: 0 };
59
- }
60
- const envContent = fs
61
- .readFileSync(envPath, 'utf-8')
62
- .split('\n')
63
- .map((line) => {
64
- const trimmed = line.trim();
65
- if (!trimmed || trimmed.startsWith('#'))
66
- return trimmed;
67
- const [key] = trimmed.split('=');
68
- return `${key}=`;
69
- })
70
- .join('\n');
71
- fs.writeFileSync(examplePath, envContent);
72
- printPrompt.exampleCreated(examplePath, envPath);
73
- }
74
- return { didCreate: true, shouldExit: false, exitCode: 0 };
75
- }
76
- //# sourceMappingURL=ensureFilesOrPrompt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureFilesOrPrompt.js","sourceRoot":"","sources":["../../../src/services/ensureFilesOrPrompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAgB1D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,IAAqB;IAErB,MAAM,EACJ,GAAG,EACH,UAAU,EACV,cAAc,EACd,uBAAuB,EACvB,SAAS,EACT,QAAQ,GACT,GAAG,IAAI,CAAC;IAET,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,CA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;YACxD,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACjC,OAAO,GAAG,GAAG,GAAG,CAAC;QACnB,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,EAAE,CAAC,aAAa,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QAC1C,WAAW,CAAC,cAAc,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;AAC7D,CAAC"}
@@ -1,17 +0,0 @@
1
- import type { ScanUsageOptions, ScanResult, ExitResult } from '../config/types.js';
2
- interface FixContext {
3
- fixApplied: boolean;
4
- removedDuplicates: string[];
5
- addedEnv: string[];
6
- gitignoreUpdated: boolean;
7
- }
8
- /**
9
- * Outputs the scan results to the console.
10
- * @param scanResult - The result of the scan.
11
- * @param opts - The scan options.
12
- * @param comparedAgainst - The file being compared against.
13
- * @returns An object indicating whether to exit with an error.
14
- */
15
- export declare function outputToConsole(scanResult: ScanResult, opts: ScanUsageOptions, comparedAgainst: string, fixContext?: FixContext): ExitResult;
16
- export {};
17
- //# sourceMappingURL=scanOutputToConsole.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scanOutputToConsole.d.ts","sourceRoot":"","sources":["../../../src/services/scanOutputToConsole.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EAChB,UAAU,EACV,UAAU,EACX,MAAM,oBAAoB,CAAC;AAqB5B,UAAU,UAAU;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,gBAAgB,EACtB,eAAe,EAAE,MAAM,EACvB,UAAU,CAAC,EAAE,UAAU,GACtB,UAAU,CAkLZ"}
@@ -1,127 +0,0 @@
1
- import path from 'path';
2
- import { checkGitignoreStatus } from './git.js';
3
- import { printGitignoreWarning } from '../ui/shared/printGitignore.js';
4
- import { DEFAULT_ENV_FILE } from '../config/constants.js';
5
- import { printHeader } from '../ui/scan/printHeader.js';
6
- import { printStats } from '../ui/scan/printStats.js';
7
- import { printMissing } from '../ui/scan/printMissing.js';
8
- import { printUnused } from '../ui/scan/printUnused.js';
9
- import { printDuplicates } from '../ui/shared/printDuplicates.js';
10
- import { printSecrets } from '../ui/scan/printSecrets.js';
11
- import { printSuccess } from '../ui/shared/printSuccess.js';
12
- import { printStrictModeError } from '../ui/shared/printStrictModeError.js';
13
- import { printFixTips } from '../ui/shared/printFixTips.js';
14
- import { printAutoFix } from '../ui/shared/printAutoFix.js';
15
- import { printFrameworkWarnings } from '../ui/scan/printFrameworkWarnings.js';
16
- import { printExampleWarnings } from '../ui/scan/printExampleWarnings.js';
17
- import { printConsolelogWarning } from '../ui/scan/printConsolelogWarning.js';
18
- import { printUppercaseWarning } from '../ui/scan/printUppercaseWarning.js';
19
- import { computeHealthScore } from '../core/computeHealthScore.js';
20
- import { printHealthScore } from '../ui/scan/printHealthScore.js';
21
- import { printExpireWarnings } from '../ui/scan/printExpireWarnings.js';
22
- import { printInconsistentNamingWarning } from '../ui/scan/printInconsistentNamingWarning.js';
23
- /**
24
- * Outputs the scan results to the console.
25
- * @param scanResult - The result of the scan.
26
- * @param opts - The scan options.
27
- * @param comparedAgainst - The file being compared against.
28
- * @returns An object indicating whether to exit with an error.
29
- */
30
- export function outputToConsole(scanResult, opts, comparedAgainst, fixContext) {
31
- let exitWithError = false;
32
- // Determine if output should be in JSON format
33
- const isJson = opts.json ?? false;
34
- printHeader(comparedAgainst);
35
- // Show stats if requested
36
- printStats(scanResult.stats, isJson, opts.showStats ?? true);
37
- // Missing variables (used in code but not in env file)
38
- if (printMissing(scanResult.missing, scanResult.used, comparedAgainst, opts.isCiMode ?? false, isJson)) {
39
- exitWithError = true;
40
- }
41
- if (scanResult.frameworkWarnings && scanResult.frameworkWarnings.length > 0) {
42
- printFrameworkWarnings(scanResult.frameworkWarnings, isJson);
43
- }
44
- if (scanResult.uppercaseWarnings && scanResult.uppercaseWarnings.length > 0) {
45
- printUppercaseWarning(scanResult.uppercaseWarnings, comparedAgainst, isJson);
46
- }
47
- if (scanResult.inconsistentNamingWarnings &&
48
- scanResult.inconsistentNamingWarnings.length > 0) {
49
- printInconsistentNamingWarning(scanResult.inconsistentNamingWarnings, isJson);
50
- }
51
- printExampleWarnings(scanResult.exampleWarnings ?? [], isJson);
52
- // Unused
53
- printUnused(scanResult.unused, comparedAgainst, opts.showUnused ?? false, isJson);
54
- // Duplicates
55
- printDuplicates(comparedAgainst || DEFAULT_ENV_FILE, 'example file', scanResult.duplicates?.env ?? [], scanResult.duplicates?.example ?? [], isJson);
56
- // Print potential secrets found
57
- printSecrets(scanResult.secrets ?? [], isJson);
58
- // Console log usage warning
59
- printConsolelogWarning(scanResult.logged ?? [], isJson);
60
- // Expiration warnings
61
- printExpireWarnings(scanResult.expireWarnings ?? [], isJson);
62
- // Check for high severity secrets - ALWAYS exit with error
63
- const hasHighSeveritySecrets = (scanResult.secrets ?? []).some((s) => s.severity === 'high');
64
- if (hasHighSeveritySecrets) {
65
- exitWithError = true;
66
- }
67
- // Check for high severity example secrets - ALWAYS exit with error
68
- const hasHighSeverityExampleSecrets = (scanResult.exampleWarnings ?? []).some((w) => w.severity === 'high');
69
- if (hasHighSeverityExampleSecrets) {
70
- exitWithError = true;
71
- }
72
- // Success message for env file comparison
73
- if (comparedAgainst &&
74
- scanResult.missing.length === 0 &&
75
- (scanResult.secrets?.length ?? 0) === 0 &&
76
- scanResult.used.length > 0) {
77
- printSuccess(isJson, 'scan', comparedAgainst, scanResult.unused, opts.showUnused ?? true);
78
- }
79
- // Gitignore check
80
- const gitignoreIssue = checkGitignoreStatus({
81
- cwd: opts.cwd,
82
- envFile: DEFAULT_ENV_FILE,
83
- });
84
- if (gitignoreIssue && !opts.json) {
85
- printGitignoreWarning({
86
- envFile: DEFAULT_ENV_FILE,
87
- reason: gitignoreIssue.reason,
88
- });
89
- }
90
- const hasGitignoreIssue = gitignoreIssue !== null;
91
- if (opts.strict) {
92
- const exit = printStrictModeError({
93
- unused: scanResult.unused.length,
94
- duplicatesEnv: scanResult.duplicates?.env?.length ?? 0,
95
- duplicatesEx: scanResult.duplicates?.example?.length ?? 0,
96
- secrets: scanResult.secrets?.length ?? 0,
97
- exampleSecrets: scanResult.exampleWarnings?.length ?? 0,
98
- hasGitignoreIssue,
99
- frameworkWarnings: scanResult.frameworkWarnings?.length ?? 0,
100
- logged: scanResult.logged?.length ?? 0,
101
- uppercaseWarnings: scanResult.uppercaseWarnings?.length ?? 0,
102
- expireWarnings: scanResult.expireWarnings?.length ?? 0,
103
- inconsistentNamingWarnings: scanResult.inconsistentNamingWarnings?.length ?? 0,
104
- }, isJson);
105
- if (exit)
106
- exitWithError = true;
107
- }
108
- if (opts.fix && fixContext) {
109
- printAutoFix(fixContext.fixApplied, {
110
- removedDuplicates: fixContext.removedDuplicates,
111
- addedEnv: fixContext.addedEnv,
112
- addedExample: opts.examplePath ? fixContext.addedEnv : [],
113
- }, comparedAgainst || DEFAULT_ENV_FILE, opts.examplePath ? path.basename(opts.examplePath) : 'example file', isJson, fixContext.gitignoreUpdated);
114
- }
115
- // Health score
116
- const score = computeHealthScore(scanResult);
117
- printHealthScore(score);
118
- // Filtered results for fix tips
119
- printFixTips({
120
- missing: scanResult.missing,
121
- duplicatesEnv: scanResult.duplicates?.env ?? [],
122
- duplicatesEx: scanResult.duplicates?.example ?? [],
123
- gitignoreIssue: hasGitignoreIssue ? { reason: 'not-ignored' } : null,
124
- }, hasGitignoreIssue, isJson, opts.fix ?? false);
125
- return { exitWithError };
126
- }
127
- //# sourceMapp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;QAEF,IAAI,IAAI;YAAE,aAAa,GAAG,IAAI,CAAC;IACjC,CAAC;IAED,IAAI,IAAI,CAAC,GAAG,IAAI,UAAU,EAAE,CAAC;QAC3B,YAAY,CACV,UAAU,CAAC,UAAU,EACrB;YACE,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;YAC/C,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;SAC1D,EACD,eAAe,IAAI,gBAAgB,EACnC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,cAAc,EACnE,MAAM,EACN,UAAU,CAAC,gBAAgB,CAC5B,CAAC;IACJ,CAAC;IAED,eAAe;IACf,MAAM,KAAK,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC7C,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAExB,gCAAgC;IAChC,YAAY,CACV;QACE,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,aAAa,EAAE,UAAU,CAAC,UAAU,EAAE,GAAG,IAAI,EAAE;QAC/C,YAAY,EAAE,UAAU,CAAC,UAAU,EAAE,OAAO,IAAI,EAAE;QAClD,cAAc,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,IAAI;KACrE,EACD,iBAAiB,EACjB,MAAM,EACN,IAAI,CAAC,GAAG,IAAI,KAAK,CAClB,CAAC;IAEF,OAAO,EAAE,aAAa,EAAE,CAAC;AAC3B,CAAC"}
@@ -1,16 +0,0 @@
1
- export interface AutoFixResult {
2
- removedDuplicates: string[];
3
- addedEnv: string[];
4
- addedExample: string[];
5
- }
6
- /**
7
- * Prints the result of the auto-fix operation.
8
- * @param changed - Whether any changes were made.
9
- * @param result - The result of the auto-fix operation.
10
- * @param envName - The name of the environment file.
11
- * @param exampleName - The name of the example file.
12
- * @param json - Whether to output in JSON format.
13
- * @returns void
14
- */
15
- export declare function printAutoFix(changed: boolean, result: AutoFixResult, envName: string, exampleName: string, json: boolean, gitignoreUpdated: boolean): void;
16
- //# sourceMappingURL=printAutoFix.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"printAutoFix.d.ts","sourceRoot":"","sources":["../../../../src/ui/compare/printAutoFix.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,OAAO,EACb,gBAAgB,EAAE,OAAO,GACxB,IAAI,CAiCN"}
@@ -1,34 +0,0 @@
1
- import chalk from 'chalk';
2
- /**
3
- * Prints the result of the auto-fix operation.
4
- * @param changed - Whether any changes were made.
5
- * @param result - The result of the auto-fix operation.
6
- * @param envName - The name of the environment file.
7
- * @param exampleName - The name of the example file.
8
- * @param json - Whether to output in JSON format.
9
- * @returns void
10
- */
11
- export function printAutoFix(changed, result, envName, exampleName, json, gitignoreUpdated) {
12
- if (json)
13
- return;
14
- if (changed) {
15
- console.log(chalk.green('✅ Auto-fix applied:'));
16
- if (result.removedDuplicates.length) {
17
- console.log(chalk.green(` - Removed ${result.removedDuplicates.length} duplicate keys from ${envName}: ${result.removedDuplicates.join(', ')}`));
18
- }
19
- if (result.addedEnv.length) {
20
- console.log(chalk.green(` - Added ${result.addedEnv.length} missing keys to ${envName}: ${result.addedEnv.join(', ')}`));
21
- }
22
- if (result.addedExample.length) {
23
- console.log(chalk.green(` - Synced ${result.addedExample.length} keys to ${exampleName}: ${result.addedExample.join(', ')}`));
24
- }
25
- if (gitignoreUpdated) {
26
- console.log(chalk.green(` - Added ${envName} to .gitignore`));
27
- }
28
- }
29
- else {
30
- console.log(chalk.green('✅ Auto-fix applied: no changes needed.'));
31
- }
32
- console.log();
33
- }
34
- //# sourceMappingURL=printAutoFix.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"printAutoFix.js","sourceRoot":"","sources":["../../../../src/ui/compare/printAutoFix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAgB,EAChB,MAAqB,EACrB,OAAe,EACf,WAAmB,EACnB,IAAa,EACb,gBAAyB;IAEzB,IAAI,IAAI;QAAE,OAAO;IAEjB,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC;QAChD,IAAI,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC;YACpC,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CACT,eAAe,MAAM,CAAC,iBAAiB,CAAC,MAAM,wBAAwB,OAAO,KAAK,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxH,CACF,CAAC;QACJ,CAAC;QACD,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC3B,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CACT,aAAa,MAAM,CAAC,QAAQ,CAAC,MAAM,oBAAoB,OAAO,KAAK,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAChG,CACF,CAAC;QACJ,CAAC;QACD,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CACT,cAAc,MAAM,CAAC,YAAY,CAAC,MAAM,YAAY,WAAW,KAAK,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACrG,CACF,CAAC;QACJ,CAAC;QACD,IAAI,gBAAgB,EAAE,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,OAAO,gBAAgB,CAAC,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC"}
@@ -1,7 +0,0 @@
1
- export interface AutoFixResult {
2
- removedDuplicates: string[];
3
- addedEnv: string[];
4
- addedExample: string[];
5
- }
6
- export declare function printAutoFixApplied(changed: boolean, result: AutoFixResult, envName: string, exampleName: string, json: boolean): void;
7
- //# sourceMappingURL=printAutoFixApplied.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"printAutoFixApplied.d.ts","sourceRoot":"","sources":["../../../../src/ui/compare/printAutoFixApplied.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,OAAO,GACZ,IAAI,CA8BN"}
@@ -1,22 +0,0 @@
1
- import chalk from 'chalk';
2
- export function printAutoFixApplied(changed, result, envName, exampleName, json) {
3
- if (json)
4
- return;
5
- if (changed) {
6
- console.log(chalk.green('✅ Auto-fix applied:'));
7
- if (result.removedDuplicates.length) {
8
- console.log(chalk.green(` - Removed ${result.removedDuplicates.length} duplicate keys from ${envName}: ${result.removedDuplicates.join(', ')}`));
9
- }
10
- if (result.addedEnv.length) {
11
- console.log(chalk.green(` - Added ${result.addedEnv.length} missing keys to ${envName}: ${result.addedEnv.join(', ')}`));
12
- }
13
- if (result.addedExample.length) {
14
- console.log(chalk.green(` - Synced ${result.addedExample.length} keys to ${exampleName}: ${result.addedExample.join(', ')}`));
15
- }
16
- }
17
- else {
18
- console.log(chalk.green('✅ Auto-fix applied: no changes needed.'));
19
- }
20
- console.log();
21
- }
22
- //# sourceMappingURL=printAutoFixApplied.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"printAutoFixApplied.js","sourceRoot":"","sources":["../../../../src/ui/compare/printAutoFixApplied.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,MAAM,UAAU,mBAAmB,CACjC,OAAgB,EAChB,MAAqB,EACrB,OAAe,EACf,WAAmB,EACnB,IAAa;IAEb,IAAI,IAAI;QAAE,OAAO;IAEjB,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC;QAChD,IAAI,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC;YACpC,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CACT,eAAe,MAAM,CAAC,iBAAiB,CAAC,MAAM,wBAAwB,OAAO,KAAK,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxH,CACF,CAAC;QACJ,CAAC;QACD,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC3B,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CACT,aAAa,MAAM,CAAC,QAAQ,CAAC,MAAM,oBAAoB,OAAO,KAAK,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAChG,CACF,CAAC;QACJ,CAAC;QACD,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CACT,cAAc,MAAM,CAAC,YAAY,CAAC,MAAM,YAAY,WAAW,KAAK,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACrG,CACF,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC"}
@@ -1,17 +0,0 @@
1
- /**
2
- * Prints duplicate keys found in the environment and example files.
3
- * @param envName The name of the environment file.
4
- * @param exampleName The name of the example file.
5
- * @param dEnv Array of duplicate keys in the environment file with their counts.
6
- * @param dEx Array of duplicate keys in the example file with their counts.
7
- * @param json Whether to output in JSON format.
8
- * @returns void
9
- */
10
- export declare function printDuplicates(envName: string, exampleName: string, dEnv: Array<{
11
- key: string;
12
- count: number;
13
- }>, dEx: Array<{
14
- key: string;
15
- count: number;
16
- }>, json: boolean): void;
17
- //# sourceMappingURL=printDuplicates.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"printDuplicates.d.ts","sourceRoot":"","sources":["../../../../src/ui/compare/printDuplicates.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,EAC3C,GAAG,EAAE,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,EAC1C,IAAI,EAAE,OAAO,QAuBd"}