@subramanyaks/env-drift 1.0.1 → 1.2.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.
- package/CHANGELOG.md +48 -0
- package/README.md +48 -11
- package/dist/cli.js +976 -79
- package/dist/index.cjs +867 -57
- package/dist/index.d.cts +127 -7
- package/dist/index.d.ts +127 -7
- package/dist/index.js +854 -56
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -2,13 +2,14 @@ interface EnvReference {
|
|
|
2
2
|
name: string;
|
|
3
3
|
file: string;
|
|
4
4
|
line: number;
|
|
5
|
-
source: "process.env" | "import.meta.env";
|
|
5
|
+
source: "process.env" | "import.meta.env" | "Bun.env" | "Deno.env";
|
|
6
6
|
}
|
|
7
7
|
interface ParsedEnvFile {
|
|
8
8
|
filePath: string;
|
|
9
9
|
exists: boolean;
|
|
10
10
|
keys: string[];
|
|
11
11
|
values: Record<string, string>;
|
|
12
|
+
lines: Record<string, number>;
|
|
12
13
|
duplicates: string[];
|
|
13
14
|
}
|
|
14
15
|
interface SecretExposureWarning {
|
|
@@ -17,6 +18,12 @@ interface SecretExposureWarning {
|
|
|
17
18
|
matchedKeyword: string;
|
|
18
19
|
references: EnvReference[];
|
|
19
20
|
}
|
|
21
|
+
interface ExampleSecretLeak {
|
|
22
|
+
name: string;
|
|
23
|
+
reason: string;
|
|
24
|
+
file: string;
|
|
25
|
+
line: number;
|
|
26
|
+
}
|
|
20
27
|
interface AuditResult {
|
|
21
28
|
rootDir: string;
|
|
22
29
|
scannedFiles: number;
|
|
@@ -25,29 +32,65 @@ interface AuditResult {
|
|
|
25
32
|
usedInCode: Record<string, EnvReference[]>;
|
|
26
33
|
missingInEnv: string[];
|
|
27
34
|
missingInExample: string[];
|
|
35
|
+
emptyInEnv: string[];
|
|
28
36
|
unusedInEnv: string[];
|
|
29
37
|
unusedInExample: string[];
|
|
30
38
|
secretExposures: SecretExposureWarning[];
|
|
39
|
+
exampleSecretLeaks: ExampleSecretLeak[];
|
|
31
40
|
duplicateKeys: {
|
|
32
41
|
env: string[];
|
|
33
42
|
example: string[];
|
|
34
43
|
};
|
|
35
44
|
}
|
|
36
|
-
interface
|
|
37
|
-
rootDir?: string;
|
|
45
|
+
interface EnvDriftConfig {
|
|
38
46
|
envFile?: string;
|
|
39
47
|
exampleFile?: string;
|
|
40
48
|
ignore?: string[];
|
|
49
|
+
ignoreDirs?: string[];
|
|
50
|
+
publicPrefixes?: string[];
|
|
51
|
+
sensitiveKeywords?: string[];
|
|
52
|
+
strict?: boolean;
|
|
53
|
+
}
|
|
54
|
+
interface AuditOptions extends EnvDriftConfig {
|
|
55
|
+
rootDir?: string;
|
|
56
|
+
}
|
|
57
|
+
interface EnvDiffResult {
|
|
58
|
+
fileA: string;
|
|
59
|
+
fileB: string;
|
|
60
|
+
fileAExists: boolean;
|
|
61
|
+
fileBExists: boolean;
|
|
62
|
+
onlyInA: string[];
|
|
63
|
+
onlyInB: string[];
|
|
64
|
+
inBoth: string[];
|
|
65
|
+
emptyInA: string[];
|
|
66
|
+
emptyInB: string[];
|
|
67
|
+
}
|
|
68
|
+
interface WorkspaceAuditItem {
|
|
69
|
+
name: string;
|
|
70
|
+
path: string;
|
|
71
|
+
result: AuditResult;
|
|
72
|
+
}
|
|
73
|
+
interface WorkspaceAuditResult {
|
|
74
|
+
rootDir: string;
|
|
75
|
+
workspaces: WorkspaceAuditItem[];
|
|
41
76
|
}
|
|
42
77
|
|
|
43
78
|
declare const BUILTIN_ENV_VARS: Set<string>;
|
|
44
79
|
declare const PUBLIC_ENV_PREFIXES: readonly ["NEXT_PUBLIC_", "VITE_", "REACT_APP_", "NUXT_PUBLIC_", "PUBLIC_", "EXPO_PUBLIC_", "GATSBY_"];
|
|
45
80
|
declare const SENSITIVE_KEYWORDS: readonly ["SECRET", "PASSWORD", "PASSWD", "PRIVATE_KEY", "PRIVATE", "DATABASE_URL", "DB_URL", "DB_PASS", "JWT_SECRET", "AUTH_TOKEN", "ACCESS_KEY", "API_SECRET", "SERVICE_ROLE", "CREDENTIALS"];
|
|
81
|
+
/**
|
|
82
|
+
* Detects whether an `.env.example` value looks like a real committed secret
|
|
83
|
+
* rather than an empty or placeholder value.
|
|
84
|
+
*/
|
|
85
|
+
declare function detectExampleSecretLeak(_name: string, value: string): string | null;
|
|
46
86
|
/**
|
|
47
87
|
* Detects whether an environment variable name combines a client-exposed prefix
|
|
48
88
|
* with a sensitive keyword (e.g. `NEXT_PUBLIC_DB_PASSWORD`).
|
|
49
89
|
*/
|
|
50
|
-
declare function detectSecretExposure(name: string
|
|
90
|
+
declare function detectSecretExposure(name: string, options?: {
|
|
91
|
+
publicPrefixes?: readonly string[];
|
|
92
|
+
sensitiveKeywords?: readonly string[];
|
|
93
|
+
}): {
|
|
51
94
|
prefix: string;
|
|
52
95
|
matchedKeyword: string;
|
|
53
96
|
} | null;
|
|
@@ -56,12 +99,35 @@ declare function detectSecretExposure(name: string): {
|
|
|
56
99
|
*/
|
|
57
100
|
declare function auditEnv(options?: AuditOptions): AuditResult;
|
|
58
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Loads optional project configuration from `.envdriftrc.json` or the `"env-drift"`
|
|
104
|
+
* field in `package.json`.
|
|
105
|
+
*/
|
|
106
|
+
declare function loadConfig(rootDir: string): EnvDriftConfig;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Compares keys across two `.env` files (e.g. `.env.staging` vs `.env.production`)
|
|
110
|
+
* without ever exposing secret values.
|
|
111
|
+
*/
|
|
112
|
+
declare function diffEnvFiles(fileA: string, fileB: string, options?: {
|
|
113
|
+
rootDir?: string;
|
|
114
|
+
ignore?: string[];
|
|
115
|
+
}): EnvDiffResult;
|
|
116
|
+
/**
|
|
117
|
+
* Returns true if the diff found blocking drift between the two env files.
|
|
118
|
+
*/
|
|
119
|
+
declare function hasDiffIssues(diff: EnvDiffResult, options?: {
|
|
120
|
+
strict?: boolean;
|
|
121
|
+
}): boolean;
|
|
122
|
+
|
|
59
123
|
/**
|
|
60
124
|
* Parses the text contents of a .env file without external dependencies.
|
|
125
|
+
* Supports multiline double-quoted values (e.g. PEM private keys).
|
|
61
126
|
*/
|
|
62
127
|
declare function parseEnvContent(content: string): {
|
|
63
128
|
keys: string[];
|
|
64
129
|
values: Record<string, string>;
|
|
130
|
+
lines: Record<string, number>;
|
|
65
131
|
duplicates: string[];
|
|
66
132
|
};
|
|
67
133
|
/**
|
|
@@ -79,7 +145,8 @@ declare function syncEnvExample(examplePath: string, missingKeys: string[]): {
|
|
|
79
145
|
declare const DEFAULT_IGNORE_DIRS: Set<string>;
|
|
80
146
|
declare const DEFAULT_EXTENSIONS: Set<string>;
|
|
81
147
|
/**
|
|
82
|
-
* Extracts all `process.env
|
|
148
|
+
* Extracts all `process.env`, `import.meta.env`, `Bun.env`, and `Deno.env.get()`
|
|
149
|
+
* references from a source string.
|
|
83
150
|
*/
|
|
84
151
|
declare function extractEnvReferences(content: string, filePath: string): EnvReference[];
|
|
85
152
|
interface ScanOptions {
|
|
@@ -94,6 +161,22 @@ declare function scanFiles(rootDir: string, options?: ScanOptions): {
|
|
|
94
161
|
references: EnvReference[];
|
|
95
162
|
};
|
|
96
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Infers a sensible starter Zod validator expression from an env variable name.
|
|
166
|
+
*/
|
|
167
|
+
declare function inferZodRule(key: string): string;
|
|
168
|
+
/**
|
|
169
|
+
* Generates a starter Zod runtime validation schema (`env.schema.ts`) from an AuditResult.
|
|
170
|
+
*/
|
|
171
|
+
declare function generateZodSchema(result: AuditResult): string;
|
|
172
|
+
/**
|
|
173
|
+
* Writes the generated Zod schema file to disk.
|
|
174
|
+
*/
|
|
175
|
+
declare function writeZodSchema(outputPath: string, result: AuditResult): {
|
|
176
|
+
outputPath: string;
|
|
177
|
+
count: number;
|
|
178
|
+
};
|
|
179
|
+
|
|
97
180
|
/**
|
|
98
181
|
* Generates TypeScript ambient declarations (`env.d.ts`) from an AuditResult.
|
|
99
182
|
*/
|
|
@@ -107,12 +190,15 @@ declare function writeEnvTypes(outputPath: string, result: AuditResult): {
|
|
|
107
190
|
};
|
|
108
191
|
|
|
109
192
|
/**
|
|
110
|
-
* Returns true if the audit found blocking issues (missing vars
|
|
193
|
+
* Returns true if the audit found blocking issues (missing vars, exposed public secrets,
|
|
194
|
+
* or real secrets committed in `.env.example`).
|
|
111
195
|
* When no local `.env` file exists (e.g. in CI where `.env` is gitignored), `missingInEnv`
|
|
112
196
|
* is skipped by default unless `requireEnvFile` is true.
|
|
197
|
+
* When `strict` is true, empty values, unused keys, and duplicate keys are also blocking.
|
|
113
198
|
*/
|
|
114
199
|
declare function hasBlockingIssues(result: AuditResult, options?: {
|
|
115
200
|
requireEnvFile?: boolean;
|
|
201
|
+
strict?: boolean;
|
|
116
202
|
}): boolean;
|
|
117
203
|
/**
|
|
118
204
|
* Formats an AuditResult into a colorized terminal report.
|
|
@@ -122,5 +208,39 @@ declare function formatAuditReport(result: AuditResult, options?: {
|
|
|
122
208
|
exampleFile?: string;
|
|
123
209
|
ci?: boolean;
|
|
124
210
|
}): string;
|
|
211
|
+
/**
|
|
212
|
+
* Formats an AuditResult as GitHub Actions workflow commands (`::error` / `::warning`)
|
|
213
|
+
* so findings render inline on Pull Request diffs.
|
|
214
|
+
*/
|
|
215
|
+
declare function formatGitHubAnnotations(result: AuditResult, options?: {
|
|
216
|
+
envFile?: string;
|
|
217
|
+
exampleFile?: string;
|
|
218
|
+
ci?: boolean;
|
|
219
|
+
}): string;
|
|
220
|
+
/**
|
|
221
|
+
* Formats an EnvDiffResult into a colorized terminal report without ever printing secret values.
|
|
222
|
+
*/
|
|
223
|
+
declare function formatDiffReport(diff: EnvDiffResult): string;
|
|
224
|
+
/**
|
|
225
|
+
* Formats a multi-workspace audit report.
|
|
226
|
+
*/
|
|
227
|
+
declare function formatWorkspaceReport(wsResult: WorkspaceAuditResult, options?: {
|
|
228
|
+
envFile?: string;
|
|
229
|
+
exampleFile?: string;
|
|
230
|
+
ci?: boolean;
|
|
231
|
+
}): string;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Discovers workspace package directories from `package.json` (`workspaces`)
|
|
235
|
+
* or `pnpm-workspace.yaml`.
|
|
236
|
+
*/
|
|
237
|
+
declare function discoverWorkspaces(rootDir: string): Array<{
|
|
238
|
+
name: string;
|
|
239
|
+
path: string;
|
|
240
|
+
}>;
|
|
241
|
+
/**
|
|
242
|
+
* Audits every discovered workspace package in a monorepo.
|
|
243
|
+
*/
|
|
244
|
+
declare function auditWorkspaces(rootDir: string, options?: Omit<AuditOptions, "rootDir">): WorkspaceAuditResult;
|
|
125
245
|
|
|
126
|
-
export { type AuditOptions, type AuditResult, BUILTIN_ENV_VARS, DEFAULT_EXTENSIONS, DEFAULT_IGNORE_DIRS, type EnvReference, PUBLIC_ENV_PREFIXES, type ParsedEnvFile, SENSITIVE_KEYWORDS, type SecretExposureWarning, auditEnv, detectSecretExposure, extractEnvReferences, formatAuditReport, generateEnvTypes, hasBlockingIssues, parseEnvContent, parseEnvFile, scanFiles, syncEnvExample, writeEnvTypes };
|
|
246
|
+
export { type AuditOptions, type AuditResult, BUILTIN_ENV_VARS, DEFAULT_EXTENSIONS, DEFAULT_IGNORE_DIRS, type EnvDiffResult, type EnvDriftConfig, type EnvReference, type ExampleSecretLeak, PUBLIC_ENV_PREFIXES, type ParsedEnvFile, SENSITIVE_KEYWORDS, type SecretExposureWarning, type WorkspaceAuditItem, type WorkspaceAuditResult, auditEnv, auditWorkspaces, detectExampleSecretLeak, detectSecretExposure, diffEnvFiles, discoverWorkspaces, extractEnvReferences, formatAuditReport, formatDiffReport, formatGitHubAnnotations, formatWorkspaceReport, generateEnvTypes, generateZodSchema, hasBlockingIssues, hasDiffIssues, inferZodRule, loadConfig, parseEnvContent, parseEnvFile, scanFiles, syncEnvExample, writeEnvTypes, writeZodSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,13 +2,14 @@ interface EnvReference {
|
|
|
2
2
|
name: string;
|
|
3
3
|
file: string;
|
|
4
4
|
line: number;
|
|
5
|
-
source: "process.env" | "import.meta.env";
|
|
5
|
+
source: "process.env" | "import.meta.env" | "Bun.env" | "Deno.env";
|
|
6
6
|
}
|
|
7
7
|
interface ParsedEnvFile {
|
|
8
8
|
filePath: string;
|
|
9
9
|
exists: boolean;
|
|
10
10
|
keys: string[];
|
|
11
11
|
values: Record<string, string>;
|
|
12
|
+
lines: Record<string, number>;
|
|
12
13
|
duplicates: string[];
|
|
13
14
|
}
|
|
14
15
|
interface SecretExposureWarning {
|
|
@@ -17,6 +18,12 @@ interface SecretExposureWarning {
|
|
|
17
18
|
matchedKeyword: string;
|
|
18
19
|
references: EnvReference[];
|
|
19
20
|
}
|
|
21
|
+
interface ExampleSecretLeak {
|
|
22
|
+
name: string;
|
|
23
|
+
reason: string;
|
|
24
|
+
file: string;
|
|
25
|
+
line: number;
|
|
26
|
+
}
|
|
20
27
|
interface AuditResult {
|
|
21
28
|
rootDir: string;
|
|
22
29
|
scannedFiles: number;
|
|
@@ -25,29 +32,65 @@ interface AuditResult {
|
|
|
25
32
|
usedInCode: Record<string, EnvReference[]>;
|
|
26
33
|
missingInEnv: string[];
|
|
27
34
|
missingInExample: string[];
|
|
35
|
+
emptyInEnv: string[];
|
|
28
36
|
unusedInEnv: string[];
|
|
29
37
|
unusedInExample: string[];
|
|
30
38
|
secretExposures: SecretExposureWarning[];
|
|
39
|
+
exampleSecretLeaks: ExampleSecretLeak[];
|
|
31
40
|
duplicateKeys: {
|
|
32
41
|
env: string[];
|
|
33
42
|
example: string[];
|
|
34
43
|
};
|
|
35
44
|
}
|
|
36
|
-
interface
|
|
37
|
-
rootDir?: string;
|
|
45
|
+
interface EnvDriftConfig {
|
|
38
46
|
envFile?: string;
|
|
39
47
|
exampleFile?: string;
|
|
40
48
|
ignore?: string[];
|
|
49
|
+
ignoreDirs?: string[];
|
|
50
|
+
publicPrefixes?: string[];
|
|
51
|
+
sensitiveKeywords?: string[];
|
|
52
|
+
strict?: boolean;
|
|
53
|
+
}
|
|
54
|
+
interface AuditOptions extends EnvDriftConfig {
|
|
55
|
+
rootDir?: string;
|
|
56
|
+
}
|
|
57
|
+
interface EnvDiffResult {
|
|
58
|
+
fileA: string;
|
|
59
|
+
fileB: string;
|
|
60
|
+
fileAExists: boolean;
|
|
61
|
+
fileBExists: boolean;
|
|
62
|
+
onlyInA: string[];
|
|
63
|
+
onlyInB: string[];
|
|
64
|
+
inBoth: string[];
|
|
65
|
+
emptyInA: string[];
|
|
66
|
+
emptyInB: string[];
|
|
67
|
+
}
|
|
68
|
+
interface WorkspaceAuditItem {
|
|
69
|
+
name: string;
|
|
70
|
+
path: string;
|
|
71
|
+
result: AuditResult;
|
|
72
|
+
}
|
|
73
|
+
interface WorkspaceAuditResult {
|
|
74
|
+
rootDir: string;
|
|
75
|
+
workspaces: WorkspaceAuditItem[];
|
|
41
76
|
}
|
|
42
77
|
|
|
43
78
|
declare const BUILTIN_ENV_VARS: Set<string>;
|
|
44
79
|
declare const PUBLIC_ENV_PREFIXES: readonly ["NEXT_PUBLIC_", "VITE_", "REACT_APP_", "NUXT_PUBLIC_", "PUBLIC_", "EXPO_PUBLIC_", "GATSBY_"];
|
|
45
80
|
declare const SENSITIVE_KEYWORDS: readonly ["SECRET", "PASSWORD", "PASSWD", "PRIVATE_KEY", "PRIVATE", "DATABASE_URL", "DB_URL", "DB_PASS", "JWT_SECRET", "AUTH_TOKEN", "ACCESS_KEY", "API_SECRET", "SERVICE_ROLE", "CREDENTIALS"];
|
|
81
|
+
/**
|
|
82
|
+
* Detects whether an `.env.example` value looks like a real committed secret
|
|
83
|
+
* rather than an empty or placeholder value.
|
|
84
|
+
*/
|
|
85
|
+
declare function detectExampleSecretLeak(_name: string, value: string): string | null;
|
|
46
86
|
/**
|
|
47
87
|
* Detects whether an environment variable name combines a client-exposed prefix
|
|
48
88
|
* with a sensitive keyword (e.g. `NEXT_PUBLIC_DB_PASSWORD`).
|
|
49
89
|
*/
|
|
50
|
-
declare function detectSecretExposure(name: string
|
|
90
|
+
declare function detectSecretExposure(name: string, options?: {
|
|
91
|
+
publicPrefixes?: readonly string[];
|
|
92
|
+
sensitiveKeywords?: readonly string[];
|
|
93
|
+
}): {
|
|
51
94
|
prefix: string;
|
|
52
95
|
matchedKeyword: string;
|
|
53
96
|
} | null;
|
|
@@ -56,12 +99,35 @@ declare function detectSecretExposure(name: string): {
|
|
|
56
99
|
*/
|
|
57
100
|
declare function auditEnv(options?: AuditOptions): AuditResult;
|
|
58
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Loads optional project configuration from `.envdriftrc.json` or the `"env-drift"`
|
|
104
|
+
* field in `package.json`.
|
|
105
|
+
*/
|
|
106
|
+
declare function loadConfig(rootDir: string): EnvDriftConfig;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Compares keys across two `.env` files (e.g. `.env.staging` vs `.env.production`)
|
|
110
|
+
* without ever exposing secret values.
|
|
111
|
+
*/
|
|
112
|
+
declare function diffEnvFiles(fileA: string, fileB: string, options?: {
|
|
113
|
+
rootDir?: string;
|
|
114
|
+
ignore?: string[];
|
|
115
|
+
}): EnvDiffResult;
|
|
116
|
+
/**
|
|
117
|
+
* Returns true if the diff found blocking drift between the two env files.
|
|
118
|
+
*/
|
|
119
|
+
declare function hasDiffIssues(diff: EnvDiffResult, options?: {
|
|
120
|
+
strict?: boolean;
|
|
121
|
+
}): boolean;
|
|
122
|
+
|
|
59
123
|
/**
|
|
60
124
|
* Parses the text contents of a .env file without external dependencies.
|
|
125
|
+
* Supports multiline double-quoted values (e.g. PEM private keys).
|
|
61
126
|
*/
|
|
62
127
|
declare function parseEnvContent(content: string): {
|
|
63
128
|
keys: string[];
|
|
64
129
|
values: Record<string, string>;
|
|
130
|
+
lines: Record<string, number>;
|
|
65
131
|
duplicates: string[];
|
|
66
132
|
};
|
|
67
133
|
/**
|
|
@@ -79,7 +145,8 @@ declare function syncEnvExample(examplePath: string, missingKeys: string[]): {
|
|
|
79
145
|
declare const DEFAULT_IGNORE_DIRS: Set<string>;
|
|
80
146
|
declare const DEFAULT_EXTENSIONS: Set<string>;
|
|
81
147
|
/**
|
|
82
|
-
* Extracts all `process.env
|
|
148
|
+
* Extracts all `process.env`, `import.meta.env`, `Bun.env`, and `Deno.env.get()`
|
|
149
|
+
* references from a source string.
|
|
83
150
|
*/
|
|
84
151
|
declare function extractEnvReferences(content: string, filePath: string): EnvReference[];
|
|
85
152
|
interface ScanOptions {
|
|
@@ -94,6 +161,22 @@ declare function scanFiles(rootDir: string, options?: ScanOptions): {
|
|
|
94
161
|
references: EnvReference[];
|
|
95
162
|
};
|
|
96
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Infers a sensible starter Zod validator expression from an env variable name.
|
|
166
|
+
*/
|
|
167
|
+
declare function inferZodRule(key: string): string;
|
|
168
|
+
/**
|
|
169
|
+
* Generates a starter Zod runtime validation schema (`env.schema.ts`) from an AuditResult.
|
|
170
|
+
*/
|
|
171
|
+
declare function generateZodSchema(result: AuditResult): string;
|
|
172
|
+
/**
|
|
173
|
+
* Writes the generated Zod schema file to disk.
|
|
174
|
+
*/
|
|
175
|
+
declare function writeZodSchema(outputPath: string, result: AuditResult): {
|
|
176
|
+
outputPath: string;
|
|
177
|
+
count: number;
|
|
178
|
+
};
|
|
179
|
+
|
|
97
180
|
/**
|
|
98
181
|
* Generates TypeScript ambient declarations (`env.d.ts`) from an AuditResult.
|
|
99
182
|
*/
|
|
@@ -107,12 +190,15 @@ declare function writeEnvTypes(outputPath: string, result: AuditResult): {
|
|
|
107
190
|
};
|
|
108
191
|
|
|
109
192
|
/**
|
|
110
|
-
* Returns true if the audit found blocking issues (missing vars
|
|
193
|
+
* Returns true if the audit found blocking issues (missing vars, exposed public secrets,
|
|
194
|
+
* or real secrets committed in `.env.example`).
|
|
111
195
|
* When no local `.env` file exists (e.g. in CI where `.env` is gitignored), `missingInEnv`
|
|
112
196
|
* is skipped by default unless `requireEnvFile` is true.
|
|
197
|
+
* When `strict` is true, empty values, unused keys, and duplicate keys are also blocking.
|
|
113
198
|
*/
|
|
114
199
|
declare function hasBlockingIssues(result: AuditResult, options?: {
|
|
115
200
|
requireEnvFile?: boolean;
|
|
201
|
+
strict?: boolean;
|
|
116
202
|
}): boolean;
|
|
117
203
|
/**
|
|
118
204
|
* Formats an AuditResult into a colorized terminal report.
|
|
@@ -122,5 +208,39 @@ declare function formatAuditReport(result: AuditResult, options?: {
|
|
|
122
208
|
exampleFile?: string;
|
|
123
209
|
ci?: boolean;
|
|
124
210
|
}): string;
|
|
211
|
+
/**
|
|
212
|
+
* Formats an AuditResult as GitHub Actions workflow commands (`::error` / `::warning`)
|
|
213
|
+
* so findings render inline on Pull Request diffs.
|
|
214
|
+
*/
|
|
215
|
+
declare function formatGitHubAnnotations(result: AuditResult, options?: {
|
|
216
|
+
envFile?: string;
|
|
217
|
+
exampleFile?: string;
|
|
218
|
+
ci?: boolean;
|
|
219
|
+
}): string;
|
|
220
|
+
/**
|
|
221
|
+
* Formats an EnvDiffResult into a colorized terminal report without ever printing secret values.
|
|
222
|
+
*/
|
|
223
|
+
declare function formatDiffReport(diff: EnvDiffResult): string;
|
|
224
|
+
/**
|
|
225
|
+
* Formats a multi-workspace audit report.
|
|
226
|
+
*/
|
|
227
|
+
declare function formatWorkspaceReport(wsResult: WorkspaceAuditResult, options?: {
|
|
228
|
+
envFile?: string;
|
|
229
|
+
exampleFile?: string;
|
|
230
|
+
ci?: boolean;
|
|
231
|
+
}): string;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Discovers workspace package directories from `package.json` (`workspaces`)
|
|
235
|
+
* or `pnpm-workspace.yaml`.
|
|
236
|
+
*/
|
|
237
|
+
declare function discoverWorkspaces(rootDir: string): Array<{
|
|
238
|
+
name: string;
|
|
239
|
+
path: string;
|
|
240
|
+
}>;
|
|
241
|
+
/**
|
|
242
|
+
* Audits every discovered workspace package in a monorepo.
|
|
243
|
+
*/
|
|
244
|
+
declare function auditWorkspaces(rootDir: string, options?: Omit<AuditOptions, "rootDir">): WorkspaceAuditResult;
|
|
125
245
|
|
|
126
|
-
export { type AuditOptions, type AuditResult, BUILTIN_ENV_VARS, DEFAULT_EXTENSIONS, DEFAULT_IGNORE_DIRS, type EnvReference, PUBLIC_ENV_PREFIXES, type ParsedEnvFile, SENSITIVE_KEYWORDS, type SecretExposureWarning, auditEnv, detectSecretExposure, extractEnvReferences, formatAuditReport, generateEnvTypes, hasBlockingIssues, parseEnvContent, parseEnvFile, scanFiles, syncEnvExample, writeEnvTypes };
|
|
246
|
+
export { type AuditOptions, type AuditResult, BUILTIN_ENV_VARS, DEFAULT_EXTENSIONS, DEFAULT_IGNORE_DIRS, type EnvDiffResult, type EnvDriftConfig, type EnvReference, type ExampleSecretLeak, PUBLIC_ENV_PREFIXES, type ParsedEnvFile, SENSITIVE_KEYWORDS, type SecretExposureWarning, type WorkspaceAuditItem, type WorkspaceAuditResult, auditEnv, auditWorkspaces, detectExampleSecretLeak, detectSecretExposure, diffEnvFiles, discoverWorkspaces, extractEnvReferences, formatAuditReport, formatDiffReport, formatGitHubAnnotations, formatWorkspaceReport, generateEnvTypes, generateZodSchema, hasBlockingIssues, hasDiffIssues, inferZodRule, loadConfig, parseEnvContent, parseEnvFile, scanFiles, syncEnvExample, writeEnvTypes, writeZodSchema };
|