dotenv-diff 2.1.7 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +46 -77
  2. package/dist/bin/dotenv-diff.d.ts +1 -0
  3. package/dist/bin/dotenv-diff.d.ts.map +1 -0
  4. package/dist/bin/dotenv-diff.js +1 -0
  5. package/dist/bin/dotenv-diff.js.map +1 -0
  6. package/dist/src/cli/program.d.ts +1 -0
  7. package/dist/src/cli/program.d.ts.map +1 -0
  8. package/dist/src/cli/program.js +8 -5
  9. package/dist/src/cli/program.js.map +1 -0
  10. package/dist/src/cli/run.d.ts +5 -0
  11. package/dist/src/cli/run.d.ts.map +1 -0
  12. package/dist/src/cli/run.js +14 -8
  13. package/dist/src/cli/run.js.map +1 -0
  14. package/dist/src/commands/compare.d.ts +7 -0
  15. package/dist/src/commands/compare.d.ts.map +1 -0
  16. package/dist/src/commands/compare.js +9 -5
  17. package/dist/src/commands/compare.js.map +1 -0
  18. package/dist/src/commands/init.d.ts +6 -0
  19. package/dist/src/commands/init.d.ts.map +1 -0
  20. package/dist/src/commands/init.js +6 -0
  21. package/dist/src/commands/init.js.map +1 -0
  22. package/dist/src/commands/scanUsage.d.ts +11 -2
  23. package/dist/src/commands/scanUsage.d.ts.map +1 -0
  24. package/dist/src/commands/scanUsage.js +58 -14
  25. package/dist/src/commands/scanUsage.js.map +1 -0
  26. package/dist/src/config/options.d.ts +7 -1
  27. package/dist/src/config/options.d.ts.map +1 -0
  28. package/dist/src/config/options.js +29 -6
  29. package/dist/src/config/options.js.map +1 -0
  30. package/dist/src/config/types.d.ts +18 -2
  31. package/dist/src/config/types.d.ts.map +1 -0
  32. package/dist/src/config/types.js +2 -0
  33. package/dist/src/config/types.js.map +1 -0
  34. package/dist/src/core/entropy.d.ts +8 -0
  35. package/dist/src/core/entropy.d.ts.map +1 -0
  36. package/dist/src/core/entropy.js +23 -0
  37. package/dist/src/core/entropy.js.map +1 -0
  38. package/dist/src/core/filterIgnoredKeys.d.ts +8 -0
  39. package/dist/src/core/filterIgnoredKeys.d.ts.map +1 -0
  40. package/dist/src/core/filterIgnoredKeys.js +8 -0
  41. package/dist/src/core/filterIgnoredKeys.js.map +1 -0
  42. package/dist/src/core/fixEnv.d.ts +9 -0
  43. package/dist/src/core/fixEnv.d.ts.map +1 -0
  44. package/dist/src/core/fixEnv.js +12 -1
  45. package/dist/src/core/fixEnv.js.map +1 -0
  46. package/dist/src/core/secretDetectors.d.ts +15 -0
  47. package/dist/src/core/secretDetectors.d.ts.map +1 -0
  48. package/dist/src/core/secretDetectors.js +90 -0
  49. package/dist/src/core/secretDetectors.js.map +1 -0
  50. package/dist/src/index.d.ts +2 -1
  51. package/dist/src/index.d.ts.map +1 -0
  52. package/dist/src/index.js +3 -2
  53. package/dist/src/index.js.map +1 -0
  54. package/dist/src/lib/diffEnv.d.ts +1 -0
  55. package/dist/src/lib/diffEnv.d.ts.map +1 -0
  56. package/dist/src/lib/diffEnv.js +4 -2
  57. package/dist/src/lib/diffEnv.js.map +1 -0
  58. package/dist/src/lib/parseEnv.d.ts +1 -0
  59. package/dist/src/lib/parseEnv.d.ts.map +1 -0
  60. package/dist/src/lib/parseEnv.js +1 -0
  61. package/dist/src/lib/parseEnv.js.map +1 -0
  62. package/dist/src/services/codeBaseScanner.d.ts +4 -0
  63. package/dist/src/services/codeBaseScanner.d.ts.map +1 -0
  64. package/dist/src/services/codeBaseScanner.js +20 -2
  65. package/dist/src/services/codeBaseScanner.js.map +1 -0
  66. package/dist/src/services/duplicates.d.ts +3 -0
  67. package/dist/src/services/duplicates.d.ts.map +1 -0
  68. package/dist/src/services/duplicates.js +3 -0
  69. package/dist/src/services/duplicates.js.map +1 -0
  70. package/dist/src/services/envDiscovery.d.ts +13 -0
  71. package/dist/src/services/envDiscovery.d.ts.map +1 -0
  72. package/dist/src/services/envDiscovery.js +8 -0
  73. package/dist/src/services/envDiscovery.js.map +1 -0
  74. package/dist/src/services/envPairing.d.ts +6 -0
  75. package/dist/src/services/envPairing.d.ts.map +1 -0
  76. package/dist/src/services/envPairing.js +6 -0
  77. package/dist/src/services/envPairing.js.map +1 -0
  78. package/dist/src/services/git.d.ts +5 -0
  79. package/dist/src/services/git.d.ts.map +1 -0
  80. package/dist/src/services/git.js +5 -0
  81. package/dist/src/services/git.js.map +1 -0
  82. package/dist/src/ui/prompts.d.ts +12 -0
  83. package/dist/src/ui/prompts.d.ts.map +1 -0
  84. package/dist/src/ui/prompts.js +12 -0
  85. package/dist/src/ui/prompts.js.map +1 -0
  86. package/package.json +2 -2
package/README.md CHANGED
@@ -2,9 +2,13 @@
2
2
 
3
3
  ![Demo](./public/demo.gif)
4
4
 
5
- Easily compare your .env, .env.example, and other environment files (like .env.local, .env.production) to detect missing, extra, empty, or mismatched variables — and ensure they’re properly ignored by Git.
5
+ Easily scan your codebase to detect which environment variables are actually used in your code — and which ones are not.
6
6
 
7
- Or scan your codebase to find out which environment variables are actually used in your code, and which ones are not.
7
+ This package will:
8
+ - Scan your codebase to find environment variables in use.
9
+ - Show statistics about the usage of these variables.
10
+ - Detect missing environment variables.
11
+ - Find potential secrets in your codebase.
8
12
 
9
13
  Optimized for JavaScript/TypeScript projects and frontend frameworks including Node.js, Next.js, Vite, SvelteKit, Nuxt, Vue, and Deno. Can also be used with other project types for basic .env file comparison.
10
14
 
@@ -30,12 +34,8 @@ pnpm add -g dotenv-diff
30
34
  ```bash
31
35
  dotenv-diff
32
36
  ```
33
- ## What it checks
34
- dotenv-diff will automatically compare all matching .env* files in your project against .env.example, including:
35
- - `.env`
36
- - `.env.local`
37
- - `.env.production`
38
- - Any other .env.* file
37
+
38
+ This scans your entire codebase to detect which environment variables are actually used in the code — and compare them against your `.env` file.
39
39
 
40
40
  ## Why dotenv-diff?
41
41
 
@@ -45,12 +45,6 @@ dotenv-diff will automatically compare all matching .env* files in your project
45
45
  - **Enhance security**: Ensure sensitive variables are not accidentally committed to version control.
46
46
  - **Scale confidently**: Perfect for turbo monorepos and multi-environment setups.
47
47
 
48
- ## Scan your codebase for environment variable usage
49
-
50
- ```bash
51
- dotenv-diff --scan-usage
52
- ```
53
- This scans your entire codebase to detect which environment variables are actually used in the code — and compare them against your `.env` file(s).
54
48
 
55
49
  ## CI/CD integration with `--ci` option
56
50
  You can scan and compare against specific environment file, eg. `.env.example`
@@ -64,26 +58,26 @@ And the `--example` option allows you to specify which `.env.example` file to co
64
58
 
65
59
  ```yaml
66
60
  - name: Check environment variables
67
- run: dotenv-diff --ci --scan-usage --example .env.example --ignore VITE_MODE,NODE_ENV
61
+ run: dotenv-diff --ci --example .env.example --ignore VITE_MODE,NODE_ENV
68
62
  ```
69
63
 
70
64
  You can also change the comparison file by using the `--example` flag to point to a different `.env.example` file.
71
65
 
72
66
  ```bash
73
- dotenv-diff --scan-usage --example .env.example.staging --ci
67
+ dotenv-diff --example .env.example.staging --ci
74
68
  ```
75
69
 
76
70
  ## Use it in a Turborepo Monorepo
77
71
 
78
72
  In a monorepo setup (e.g. with Turborepo), you often have multiple apps under apps/ and shared packages under packages/.
79
- You can run dotenv-diff from one app and still include files from sibling apps or packages.
73
+ You can run dotenv-diff from one app and still include files from your packages folder.
80
74
 
81
75
  For example, if you want to scan from the apps/app1 folder and also include code in packages/auth, you can do:
82
76
 
83
77
  ```json
84
78
  {
85
79
  "scripts": {
86
- "dotenv-diff": "dotenv-diff --scan-usage --example .env.example --include-files '../../packages/**/*' --ignore VITE_MODE"
80
+ "dotenv-diff": "dotenv-diff --example .env.example --include-files '../../packages/**/*' --ignore VITE_MODE"
87
81
  }
88
82
  }
89
83
  ```
@@ -91,65 +85,49 @@ For example, if you want to scan from the apps/app1 folder and also include code
91
85
  This will:
92
86
  - Compare the variables used in your `apps/app1` code against `apps/app1/.env.example`.
93
87
  - Also scan files in `../../packages`(like `packages/components/src/..`)
94
- - Ignore variables like VITE_MODE that you only use in special cases.
88
+ - Ignore variables like VITE_MODE that you only use in special cases (.env.test).
95
89
 
96
90
  ## Automatic fixes with `--fix`
97
91
 
98
- Use the `--fix` flag to automatically fix missing keys in your `.env` and remove duplicate keys.
92
+ Use the `--fix` flag to automatically fix missing keys in your `.env`.
99
93
 
100
94
  ```bash
101
95
  dotenv-diff --fix
102
96
  ```
103
97
 
104
- This will:
105
- - Add any missing keys from `.env.example` to your `.env` file with empty values
106
- - Remove duplicate keys in your `.env` file (keeping the last occurrence)
107
-
108
- ## Use --fix with scan-usage
109
-
110
- You can also combine `--fix` with `--scan-usage` to automatically add any missing keys that are used in your code but not defined in your `.env` file:
111
-
112
- ```bash
113
- dotenv-diff --scan-usage --fix
114
- ```
115
-
116
- Using `--fix`with `--scan-usage` will not detect duplicate keys, it will only add missing keys.
117
-
118
98
  ### Example workflow
119
99
 
120
- 1. You add `process.env.NEW_API_KEY` in your code.
121
- 2. You run `dotenv-diff --scan-usage --fix`.
100
+ 1. You have `process.env.NEW_API_KEY` in your code.
101
+ 2. You run `dotenv-diff --fix`.
122
102
  3. The tool automatically adds `NEW_API_KEY=` to your `.env` file.
123
103
 
124
- ## Scan your codebase for environment variables and add it directly to .env.example?
104
+ ## Show unused variables
105
+
106
+ As default, `dotenv-diff` will list variables that are defined in `.env` but never used in your codebase.
125
107
 
108
+ To disable this behavior, use the `--no-show-unused` flag:
126
109
  ```bash
127
- dotenv-diff --scan-usage --example .env.example --fix
110
+ dotenv-diff --no-show-unused
128
111
  ```
112
+ This will prevent the tool from listing variables that are defined in `.env` but not used in your codebase.
129
113
 
130
- This scans your codebase for environment variable usage and adds any missing keys directly to your `.env.example` file with empty values.
131
-
132
- ## Show unused variables
114
+ ## Show statistics
133
115
 
134
- Use `--show-unused` together with `--scan-usage` to list variables that are defined in `.env` but never used in your codebase:
135
- ```bash
136
- dotenv-diff --scan-usage --show-unused
137
- ```
138
- This will show you which variables are defined in your `.env` file but not used in your codebase. This helps you clean up unnecessary environment variables.
116
+ By default, `dotenv-diff` will show statistics about the scan, such as the number of files scanned, variables found, and unique variables used.
139
117
 
140
- ## Show scan statistics
118
+ To disable this behavior, use the `--no-show-stats` flag:
141
119
 
142
120
  ```bash
143
- dotenv-diff --show-stats
121
+ dotenv-diff --no-show-stats
144
122
  ```
145
- This will display statistics about the scan, such as the number of files scanned, variables found, and any unused variables. It provides a quick overview of your environment variable usage.
123
+ This will prevent the tool from displaying statistics about the scan.
146
124
 
147
125
  ## include or exclude specific files for scanning
148
126
 
149
127
  You can specify which files to include or exclude from the scan using the `--include-files` and `--exclude-files` options:
150
128
 
151
129
  ```bash
152
- dotenv-diff --scan-usage --include-files '**/*.js,**/*.ts' --exclude-files '**/*.spec.ts'
130
+ dotenv-diff --include-files '**/*.js,**/*.ts' --exclude-files '**/*.spec.ts'
153
131
  ```
154
132
 
155
133
  By default, the scanner looks at JavaScript, TypeScript, Vue, and Svelte files.
@@ -157,32 +135,18 @@ The --include-files and --exclude-files options let you refine this list to focu
157
135
 
158
136
  ### Override with `--files`
159
137
 
160
- If you want to completely override the default include/exclude logic (for example, to also include test files), you can use --files:
138
+ If you want to completely override the default include/exclude logic (for example, to only include specific files), you can use --files:
161
139
  ```bash
162
- dotenv-diff --scan-usage --files '**/*.js'
140
+ dotenv-diff --files '**/*.js'
163
141
  ```
164
- This will only scan the files matching the given patterns, even if they would normally be excluded.
165
142
 
166
143
  ## Optional: Check values too
167
144
 
168
145
  ```bash
169
- dotenv-diff --check-values
146
+ dotenv-diff --check-values --compare
170
147
  ```
171
148
 
172
- When using the `--check-values` option, the tool will also compare the actual values of the variables in `.env` and `.env.example`. It will report any mismatches found and it also compares values if .env.example defines a non-empty expected value.
173
-
174
- ## Duplicate key warnings
175
-
176
- `dotenv-diff` warns when a `.env*` file contains the same key multiple times. The last occurrence wins. Suppress these warnings with `--allow-duplicates`.
177
-
178
- ## Only show specific categories
179
-
180
- Use the `--only` flag to restrict the comparison to specific categories. For example:
181
-
182
- ```bash
183
- dotenv-diff --only missing,extra
184
- ```
185
- This will only show missing and extra keys, ignoring empty, mismatched, duplicate keys and so on.
149
+ When using the `--check-values` option together with `--compare`, the tool will also compare the actual values of the variables in `.env` and `.env.example`. It will report any mismatches found and it also compares values if .env.example defines a non-empty expected value.
186
150
 
187
151
  ## Ignore specific keys
188
152
 
@@ -216,35 +180,40 @@ dotenv-diff --no-color
216
180
 
217
181
  ## Compare specific files
218
182
 
183
+ The `--compare` flag will compare all matching .env* files in your project against .env.example, including:
184
+ - `.env`
185
+ - `.env.local`
186
+ - `.env.production`
187
+ - Any other .env.* file
188
+
219
189
  Override the autoscan and compare exactly two files:
220
190
 
221
191
  ```bash
222
- dotenv-diff --env .env.staging --example .env.example.staging
192
+ dotenv-diff --compare --env .env.local --example .env.example.local
223
193
  ```
224
194
 
225
195
  You can also fix only one side. For example, force a particular `.env` file and let the tool find the matching `.env.example`:
226
196
 
227
- ```bash
228
- dotenv-diff --env .env.production
229
- ```
197
+ When using the `--compare` flag, `dotenv-diff` warns when a `.env*` file contains the same key multiple times. The last occurrence wins. Suppress these warnings with `--allow-duplicates`.
230
198
 
231
- Or provide just an example file and let the tool locate the appropriate `.env`:
199
+ Use the `--only` flag to restrict the comparison to specific categories. For example:
232
200
 
233
201
  ```bash
234
- dotenv-diff --example .env.example.production
202
+ dotenv-diff --only missing,extra
235
203
  ```
204
+ This will only show missing and extra keys, ignoring empty, mismatched, duplicate keys and so on.
236
205
 
237
206
  ## Automatically create missing files
238
207
 
239
208
  Run non-interactively in CI environments with:
240
209
 
241
210
  ```bash
242
- dotenv-diff --yes # auto-create missing files without prompts
211
+ dotenv-diff --compare --yes # auto-create missing files without prompts
243
212
  ```
244
213
 
245
214
  You can also use `-y` as a shorthand for `--yes`.
246
215
 
247
- ## Automatic file creation prompts
216
+ ### Automatic file creation prompts
248
217
 
249
218
  If one of the files is missing, `dotenv-diff` will ask if you want to create it from the other:
250
219
 
@@ -253,7 +222,7 @@ If one of the files is missing, `dotenv-diff` will ask if you want to create it
253
222
 
254
223
  This makes it quick to set up environment files without manually copying or retyping variable names.
255
224
 
256
- ## Also checks your .gitignore
225
+ ### Also checks your .gitignore
257
226
 
258
227
  `dotenv-diff` will warn you if your `.env` file is **not** ignored by Git.
259
228
  This helps prevent accidentally committing sensitive environment variables.
@@ -1,2 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  export {};
3
+ //# sourceMappingURL=dotenv-diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dotenv-diff.d.ts","sourceRoot":"","sources":["../../bin/dotenv-diff.ts"],"names":[],"mappings":""}
@@ -6,3 +6,4 @@ run(program).catch((err) => {
6
6
  console.error(err?.message ?? err);
7
7
  process.exit(1);
8
8
  });
9
+ //# sourceMappingURL=dotenv-diff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dotenv-diff.js","sourceRoot":"","sources":["../../bin/dotenv-diff.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;AAChC,GAAG,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACzB,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,IAAI,GAAG,CAAC,CAAC;IACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -1,2 +1,3 @@
1
1
  import { Command } from 'commander';
2
2
  export declare function createProgram(): Command;
3
+ //# sourceMappingURL=program.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../../src/cli/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,wBAAgB,aAAa,YAgD5B"}
@@ -16,9 +16,12 @@ export function createProgram() {
16
16
  .option('--no-color', 'Disable colored output')
17
17
  .option('--only <list>', 'Comma-separated categories to only run (missing,extra,empty,mismatch,duplicate,gitignore)')
18
18
  .option('--scan-usage', 'Scan codebase for environment variable usage')
19
- .option('--include-files <patterns>', '[requires --scan-usage] Comma-separated file patterns to ADD to default scan patterns (extends default)')
20
- .option('--files <patterns>', '[requires --scan-usage] Comma-separated file patterns to scan (completely replaces default patterns)')
21
- .option('--exclude-files <patterns>', '[requires --scan-usage] Comma-separated file patterns to exclude from scan')
22
- .option('--show-unused', '[requires --scan-usage] Show variables defined in .env but not used in code')
23
- .option('--show-stats', 'Show statistics (in scan-usage mode: scan stats, in compare mode: env compare stats)');
19
+ .option('--compare', 'Compare .env and .env.example files')
20
+ .option('--include-files <patterns>', 'Comma-separated file patterns to ADD to default scan patterns (extends default)')
21
+ .option('--files <patterns>', 'Comma-separated file patterns to scan (completely replaces default patterns)')
22
+ .option('--exclude-files <patterns>', 'Comma-separated file patterns to exclude from scan')
23
+ .option('--no-show-unused', 'Do not list variables that are defined in .env but not used in code')
24
+ .option('--no-show-stats', 'Do not show statistics')
25
+ .option('--no-secrets', 'Disable secret detection during scan (enabled by default)');
24
26
  }
27
+ //# sourceMappingURL=program.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"program.js","sourceRoot":"","sources":["../../../src/cli/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,OAAO,EAAE;SACjB,IAAI,CAAC,aAAa,CAAC;SACnB,WAAW,CAAC,qCAAqC,CAAC;SAClD,MAAM,CAAC,gBAAgB,EAAE,6CAA6C,CAAC;SACvE,MAAM,CAAC,MAAM,EAAE,8CAA8C,CAAC;SAC9D,MAAM,CAAC,WAAW,EAAE,iDAAiD,CAAC;SACtE,MAAM,CAAC,cAAc,EAAE,8BAA8B,CAAC;SACtD,MAAM,CAAC,kBAAkB,EAAE,sCAAsC,CAAC;SAClE,MAAM,CACL,oBAAoB,EACpB,iDAAiD,CAClD;SACA,MAAM,CAAC,iBAAiB,EAAE,wCAAwC,CAAC;SACnE,MAAM,CAAC,0BAA0B,EAAE,uCAAuC,CAAC;SAC3E,MAAM,CACL,OAAO,EACP,sEAAsE,CACvE;SACA,MAAM,CAAC,QAAQ,EAAE,+BAA+B,CAAC;SACjD,MAAM,CAAC,YAAY,EAAE,wBAAwB,CAAC;SAC9C,MAAM,CACL,eAAe,EACf,2FAA2F,CAC5F;SACA,MAAM,CAAC,cAAc,EAAE,8CAA8C,CAAC;SACtE,MAAM,CAAC,WAAW,EAAE,qCAAqC,CAAC;SAC1D,MAAM,CACL,4BAA4B,EAC5B,iFAAiF,CAClF;SACA,MAAM,CACL,oBAAoB,EACpB,8EAA8E,CAC/E;SACA,MAAM,CACL,4BAA4B,EAC5B,oDAAoD,CACrD;SACA,MAAM,CACL,kBAAkB,EAClB,qEAAqE,CACtE;SACA,MAAM,CAAC,iBAAiB,EAAE,wBAAwB,CAAC;SACnD,MAAM,CACL,cAAc,EACd,2DAA2D,CAC5D,CAAC;AACN,CAAC"}
@@ -1,2 +1,7 @@
1
1
  import type { Command } from 'commander';
2
+ /**
3
+ * Run the CLI program
4
+ * @param program The commander program instance
5
+ */
2
6
  export declare function run(program: Command): Promise<void>;
7
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/cli/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAazC;;;GAGG;AACH,wBAAsB,GAAG,CAAC,OAAO,EAAE,OAAO,iBAkJzC"}
@@ -7,6 +7,10 @@ import { pairWithExample } from '../services/envPairing.js';
7
7
  import { ensureFilesOrPrompt } from '../commands/init.js';
8
8
  import { compareMany } from '../commands/compare.js';
9
9
  import { scanUsage } from '../commands/scanUsage.js';
10
+ /**
11
+ * Run the CLI program
12
+ * @param program The commander program instance
13
+ */
10
14
  export async function run(program) {
11
15
  program.parse(process.argv);
12
16
  const raw = program.opts();
@@ -14,7 +18,8 @@ export async function run(program) {
14
18
  if (opts.noColor) {
15
19
  chalk.level = 0; // disable colors globally
16
20
  }
17
- if (opts.scanUsage) {
21
+ // DEFAULT: scan-usage unless --compare is set
22
+ if (!opts.compare) {
18
23
  const envPath = opts.envFlag || (fs.existsSync('.env') ? '.env' : undefined);
19
24
  const { exitWithError } = await scanUsage({
20
25
  cwd: opts.cwd,
@@ -22,14 +27,15 @@ export async function run(program) {
22
27
  exclude: opts.excludeFiles,
23
28
  ignore: opts.ignore,
24
29
  ignoreRegex: opts.ignoreRegex,
25
- examplePath: opts.exampleFlag || undefined,
30
+ examplePath: opts.exampleFlag,
26
31
  envPath,
27
32
  fix: opts.fix,
28
33
  json: opts.json,
29
34
  showUnused: opts.showUnused,
30
35
  showStats: opts.showStats,
31
36
  isCiMode: opts.isCiMode,
32
- files: opts.files,
37
+ secrets: opts.secrets,
38
+ ...(opts.files ? { files: opts.files } : {}),
33
39
  });
34
40
  process.exit(exitWithError ? 1 : 0);
35
41
  }
@@ -80,9 +86,9 @@ export async function run(program) {
80
86
  json: opts.json,
81
87
  ignore: opts.ignore,
82
88
  ignoreRegex: opts.ignoreRegex,
83
- only: opts.only,
84
89
  showStats: opts.showStats,
85
90
  collect: (e) => report.push(e),
91
+ ...(opts.only ? { only: opts.only } : {}),
86
92
  });
87
93
  if (opts.json) {
88
94
  console.log(JSON.stringify(report, null, 2));
@@ -92,8 +98,8 @@ export async function run(program) {
92
98
  // Auto-discovery flow
93
99
  const d = discoverEnvFiles({
94
100
  cwd: opts.cwd,
95
- envFlag: opts.envFlag,
96
- exampleFlag: opts.exampleFlag,
101
+ envFlag: opts.envFlag ?? null,
102
+ exampleFlag: opts.exampleFlag ?? null,
97
103
  });
98
104
  // Init cases (may create files or early-exit)
99
105
  const res = await ensureFilesOrPrompt({
@@ -105,7 +111,6 @@ export async function run(program) {
105
111
  isCiMode: opts.isCiMode,
106
112
  });
107
113
  if (res.shouldExit) {
108
- // For JSON mode, emit an empty report to keep output machine-friendly (optional; safe).
109
114
  if (opts.json)
110
115
  console.log(JSON.stringify([], null, 2));
111
116
  process.exit(res.exitCode);
@@ -121,12 +126,13 @@ export async function run(program) {
121
126
  json: opts.json,
122
127
  ignore: opts.ignore,
123
128
  ignoreRegex: opts.ignoreRegex,
124
- only: opts.only,
125
129
  showStats: opts.showStats,
126
130
  collect: (e) => report.push(e),
131
+ ...(opts.only ? { only: opts.only } : {}),
127
132
  });
128
133
  if (opts.json) {
129
134
  console.log(JSON.stringify(report, null, 2));
130
135
  }
131
136
  process.exit(exitWithError ? 1 : 0);
132
137
  }
138
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/cli/run.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,OAAgB;IACxC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAEnC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,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,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC"}
@@ -1,4 +1,10 @@
1
1
  import type { Category, CompareJsonEntry } from '../config/types.js';
2
+ /**
3
+ * Compares multiple pairs of .env and .env.example files.
4
+ * @param pairs - The pairs of environment files to compare.
5
+ * @param opts - The comparison options.
6
+ * @returns An object indicating the overall comparison results.
7
+ */
2
8
  export declare function compareMany(pairs: Array<{
3
9
  envName: string;
4
10
  envPath: string;
@@ -17,3 +23,4 @@ export declare function compareMany(pairs: Array<{
17
23
  }): Promise<{
18
24
  exitWithError: boolean;
19
25
  }>;
26
+ //# sourceMappingURL=compare.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../../src/commands/compare.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGrE;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,EACvE,IAAI,EAAE;IACJ,WAAW,EAAE,OAAO,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC5C,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;;GAqTF"}
@@ -7,6 +7,12 @@ import { warnIfEnvNotIgnored } from '../services/git.js';
7
7
  import { findDuplicateKeys } from '../services/duplicates.js';
8
8
  import { filterIgnoredKeys } from '../core/filterIgnoredKeys.js';
9
9
  import { applyFixes } from '../core/fixEnv.js';
10
+ /**
11
+ * Compares multiple pairs of .env and .env.example files.
12
+ * @param pairs - The pairs of environment files to compare.
13
+ * @param opts - The comparison options.
14
+ * @returns An object indicating the overall comparison results.
15
+ */
10
16
  export async function compareMany(pairs, opts) {
11
17
  let exitWithError = false;
12
18
  const onlySet = opts.only?.length
@@ -50,9 +56,6 @@ export async function compareMany(pairs, opts) {
50
56
  },
51
57
  });
52
58
  }
53
- else {
54
- // still call to keep previous hints? No—masked by --only.
55
- }
56
59
  // Duplicate detection (skip entirely if --only excludes it)
57
60
  let dupsEnv = [];
58
61
  let dupsEx = [];
@@ -84,8 +87,8 @@ export async function compareMany(pairs, opts) {
84
87
  const exampleFull = parseEnvFile(examplePath);
85
88
  const currentKeys = filterIgnoredKeys(Object.keys(currentFull), opts.ignore, opts.ignoreRegex);
86
89
  const exampleKeys = filterIgnoredKeys(Object.keys(exampleFull), opts.ignore, opts.ignoreRegex);
87
- const current = Object.fromEntries(currentKeys.map((k) => [k, currentFull[k]]));
88
- const example = Object.fromEntries(exampleKeys.map((k) => [k, exampleFull[k]]));
90
+ const current = Object.fromEntries(currentKeys.map((k) => [k, currentFull[k] ?? '']));
91
+ const example = Object.fromEntries(exampleKeys.map((k) => [k, exampleFull[k] ?? '']));
89
92
  const diff = diffEnv(current, example, opts.checkValues);
90
93
  const emptyKeys = Object.entries(current)
91
94
  .filter(([, v]) => (v ?? '').trim() === '')
@@ -219,3 +222,4 @@ export async function compareMany(pairs, opts) {
219
222
  }
220
223
  return { exitWithError };
221
224
  }
225
+ //# sourceMappingURL=compare.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare.js","sourceRoot":"","sources":["../../../src/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AO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CACT,kBAAkB,MAAM,CAAC,YAAY,CAAC,MAAM,YAAY,WAAW,KAAK,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACzG,CACF,CAAC;oBACJ,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC,CAAC;gBACvE,CAAC;gBACD,OAAO,CAAC,GAAG,EAAE,CAAC;YAChB,CAAC;QACH,CAAC;QAED,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,OAAO,EAAE,aAAa,EAAE,CAAC;AAC3B,CAAC"}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Ensures that the necessary .env files exist or prompts the user to create them.
3
+ * @param args - The arguments for the function.
4
+ * @returns An object indicating whether a file was created or if the process should exit.
5
+ */
1
6
  export declare function ensureFilesOrPrompt(args: {
2
7
  cwd: string;
3
8
  primaryEnv: string;
@@ -10,3 +15,4 @@ export declare function ensureFilesOrPrompt(args: {
10
15
  shouldExit: boolean;
11
16
  exitCode: number;
12
17
  }>;
18
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,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;;;;GA8FA"}
@@ -3,6 +3,11 @@ import path from 'path';
3
3
  import chalk from 'chalk';
4
4
  import { confirmYesNo } from '../ui/prompts.js';
5
5
  import { warnIfEnvNotIgnored } from '../services/git.js';
6
+ /**
7
+ * Ensures that the necessary .env files exist or prompts the user to create them.
8
+ * @param args - The arguments for the function.
9
+ * @returns An object indicating whether a file was created or if the process should exit.
10
+ */
6
11
  export async function ensureFilesOrPrompt(args) {
7
12
  const { cwd, primaryEnv, primaryExample, alreadyWarnedMissingEnv, isYesMode, isCiMode, } = args;
8
13
  const envPath = path.resolve(cwd, primaryEnv);
@@ -64,3 +69,4 @@ export async function ensureFilesOrPrompt(args) {
64
69
  }
65
70
  return { didCreate: true, shouldExit: false, exitCode: 0 };
66
71
  }
72
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAOzC;IACC,MAAM,EACJ,GAAG,EACH,UAAU,EACV,cAAc,EACd,uBAAuB,EACvB,SAAS,EACT,QAAQ,GACT,GAAG,IAAI,CAAC;IACT,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAC9C,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,aAAa,GAAG,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAEjD,sCAAsC;IACtC,IAAI,CAAC,SAAS,IAAI,CAAC,aAAa,EAAE,CAAC;QACjC,MAAM,SAAS,G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AU,CAAC,GAAG,CAAC;gBAAE,OAAO,OAAO,CAAC;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,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CACT,KAAK,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,mCAAmC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAC9F,CACF,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;AAC7D,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import { type ScanOptions } from '../services/codeBaseScanner.js';
2
+ /** Options for scanning the codebase for environment variable usage. */
2
3
  export interface ScanUsageOptions extends ScanOptions {
3
- envPath?: string;
4
- examplePath?: string;
4
+ envPath?: string | undefined;
5
+ examplePath?: string | undefined;
5
6
  fix?: boolean;
6
7
  json: boolean;
7
8
  showUnused: boolean;
@@ -9,6 +10,7 @@ export interface ScanUsageOptions extends ScanOptions {
9
10
  isCiMode?: boolean;
10
11
  files?: string[];
11
12
  }
13
+ /** Represents a single entry in the scan results. */
12
14
  export interface ScanJsonEntry {
13
15
  stats: {
14
16
  filesScanned: number;
@@ -34,6 +36,12 @@ export interface ScanJsonEntry {
34
36
  }>;
35
37
  comparedAgainst?: string;
36
38
  totalEnvVariables?: number;
39
+ secrets?: Array<{
40
+ file: string;
41
+ line: number;
42
+ message: string;
43
+ snippet: string;
44
+ }>;
37
45
  }
38
46
  /**
39
47
  * Scans codebase for environment variable usage and compares with .env file
@@ -49,3 +57,4 @@ export interface ScanJsonEntry {
49
57
  export declare function scanUsage(opts: ScanUsageOptions): Promise<{
50
58
  exitWithError: boolean;
51
59
  }>;
60
+ //# sourceMappingURL=scanUsage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scanUsage.d.ts","sourceRoot":"","sources":["../../../src/commands/scanUsage.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,WAAW,EAGjB,MAAM,gCAAgC,CAAC;AAOxC,wEAAwE;AACxE,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,qDAAqD;AACrD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,OAAO,EAAE,KAAK,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,KAAK,CAAC;YACZ,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,MAAM,CAAC;YAChB,OAAO,EAAE,MAAM,CAAC;SACjB,CAAC,CAAC;KACJ,CAAC,CAAC;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,CAAC,EAAE,KAAK,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB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