@wrkspace-co/env 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,707 @@
1
+ import { E as EnvValidationIssue, a as EnvTarget, b as EnvSchema, P as PrefixPolicy, c as EnvScope, d as EnvVariableDefinition, D as DeprecatedMetadata, e as ProviderMapping } from './plugin-Dj0BMNPC.js';
2
+ export { B as BooleanVariableDefinition, C as CreateEnvOptions, f as EnumVariableDefinition, g as EnvKind, h as EnvValidationError, i as EnvVariableConfig, j as EnvVariableMetadata, J as JsonVariableDefinition, N as NumberVariableDefinition, k as PrefixPolicyContext, l as PrefixPolicyIssue, R as RuntimeEnv, S as StringVariableDefinition, U as UrlVariableDefinition, V as ValidationSeverity, m as boolean, n as builders, o as createAirlockProgram, p as createEnv, q as defineSchema, r as enum, s as formatValidationIssues, t as json, u as number, v as plugin, w as prefixPolicies, x as register, y as string, z as url } from './plugin-Dj0BMNPC.js';
3
+ import 'commander';
4
+
5
+ interface DriftIssue extends EnvValidationIssue {
6
+ source?: string;
7
+ }
8
+ interface DriftSummary {
9
+ total: number;
10
+ errors: number;
11
+ warnings: number;
12
+ }
13
+ interface DriftResult {
14
+ target: EnvTarget;
15
+ summary: DriftSummary;
16
+ issues: DriftIssue[];
17
+ }
18
+ interface DriftOptions {
19
+ target: EnvTarget;
20
+ values: Record<string, string | undefined>;
21
+ source?: string;
22
+ allowUnknown?: boolean;
23
+ }
24
+ declare function detectDrift(schema: EnvSchema, options: DriftOptions): DriftResult;
25
+
26
+ type ExitCode$6 = 0 | 1;
27
+ interface AuditTargetResult {
28
+ target: EnvTarget;
29
+ inspectedFiles: string[];
30
+ summary: {
31
+ total: number;
32
+ errors: number;
33
+ warnings: number;
34
+ };
35
+ issues: DriftIssue[];
36
+ }
37
+ interface AuditCommandResult {
38
+ ok: boolean;
39
+ exitCode: ExitCode$6;
40
+ schemaPath: string;
41
+ summary: {
42
+ total: number;
43
+ errors: number;
44
+ warnings: number;
45
+ };
46
+ targets: AuditTargetResult[];
47
+ issues: DriftIssue[];
48
+ }
49
+ interface AuditCommandOptions {
50
+ schema?: string;
51
+ json?: boolean;
52
+ cwd?: string;
53
+ stdout?: {
54
+ write: (message: string) => unknown;
55
+ };
56
+ stderr?: {
57
+ write: (message: string) => unknown;
58
+ };
59
+ }
60
+ declare function runAuditCommand(options?: AuditCommandOptions): Promise<AuditCommandResult>;
61
+
62
+ type ExitCode$5 = 0 | 1;
63
+ interface CheckCommandOptions {
64
+ target: EnvTarget;
65
+ schema?: string;
66
+ app?: string;
67
+ allowUnknown?: boolean;
68
+ json?: boolean;
69
+ strict?: boolean;
70
+ cwd?: string;
71
+ values?: Record<string, string | undefined>;
72
+ prefixPolicy?: PrefixPolicy;
73
+ now?: Date;
74
+ stdout?: {
75
+ write: (message: string) => unknown;
76
+ };
77
+ stderr?: {
78
+ write: (message: string) => unknown;
79
+ };
80
+ }
81
+ interface CheckCommandResult {
82
+ ok: boolean;
83
+ exitCode: ExitCode$5;
84
+ target: EnvTarget;
85
+ allowUnknown: boolean;
86
+ strict: boolean;
87
+ schemaPath: string;
88
+ summary: {
89
+ total: number;
90
+ errors: number;
91
+ warnings: number;
92
+ };
93
+ issues: EnvValidationIssue[];
94
+ }
95
+ declare function runCheckCommand(options: CheckCommandOptions): Promise<CheckCommandResult>;
96
+
97
+ type ExitCode$4 = 0;
98
+ type DeprecationStatus = "active" | "expired" | "no-deadline";
99
+ interface DeprecationItem {
100
+ key: string;
101
+ scope: EnvScope;
102
+ replacedBy?: string;
103
+ removeAfter?: string;
104
+ message?: string;
105
+ status: DeprecationStatus;
106
+ }
107
+ interface DeprecationsCommandOptions {
108
+ schema?: string;
109
+ app?: string;
110
+ json?: boolean;
111
+ now?: Date;
112
+ cwd?: string;
113
+ stdout?: {
114
+ write: (message: string) => unknown;
115
+ };
116
+ }
117
+ interface DeprecationsCommandResult {
118
+ ok: true;
119
+ exitCode: ExitCode$4;
120
+ schemaPath: string;
121
+ app?: string;
122
+ count: number;
123
+ items: DeprecationItem[];
124
+ }
125
+ declare function runDeprecationsCommand(options?: DeprecationsCommandOptions): Promise<DeprecationsCommandResult>;
126
+
127
+ type DotenvQuoteStyle = "none" | "single" | "double";
128
+ interface DotenvBlankLine {
129
+ type: "blank";
130
+ raw: string;
131
+ }
132
+ interface DotenvCommentLine {
133
+ type: "comment";
134
+ raw: string;
135
+ }
136
+ interface DotenvPairLine {
137
+ type: "pair";
138
+ raw: string;
139
+ key: string;
140
+ value: string;
141
+ quote: DotenvQuoteStyle;
142
+ exported: boolean;
143
+ inlineComment?: string;
144
+ }
145
+ interface DotenvUnknownLine {
146
+ type: "unknown";
147
+ raw: string;
148
+ }
149
+ type DotenvLine = DotenvBlankLine | DotenvCommentLine | DotenvPairLine | DotenvUnknownLine;
150
+ interface DotenvDocument {
151
+ lines: DotenvLine[];
152
+ newline: "\n" | "\r\n";
153
+ hasTrailingNewline: boolean;
154
+ }
155
+ declare function parseDotenv(content: string): DotenvDocument;
156
+ declare function formatDotenvValue(value: string, preferredQuote?: DotenvQuoteStyle): string;
157
+ interface WriteDotenvOptions {
158
+ updates?: Record<string, string | undefined>;
159
+ sortNewKeys?: boolean;
160
+ }
161
+ declare function writeDotenv(document: DotenvDocument, options?: WriteDotenvOptions): string;
162
+ declare function dotenvToObject(document: DotenvDocument): Record<string, string>;
163
+
164
+ type ExportFormat = "docker-compose" | "k8s" | "github-actions";
165
+ type ExitCode$3 = 0 | 1;
166
+ interface ExportCommandOptions {
167
+ format: ExportFormat;
168
+ schema?: string;
169
+ withValues?: boolean;
170
+ from?: string;
171
+ cwd?: string;
172
+ stdout?: {
173
+ write: (message: string) => unknown;
174
+ };
175
+ stderr?: {
176
+ write: (message: string) => unknown;
177
+ };
178
+ }
179
+ interface ExportCommandResult {
180
+ ok: boolean;
181
+ exitCode: ExitCode$3;
182
+ format: ExportFormat;
183
+ schemaPath?: string;
184
+ sourcePath?: string;
185
+ output?: string;
186
+ }
187
+ interface BuildExportOptions {
188
+ withValues: boolean;
189
+ sourceValues: Record<string, string | undefined>;
190
+ }
191
+ declare function renderExport(schema: EnvSchema, format: ExportFormat, options: BuildExportOptions): string;
192
+ declare function runExportCommand(options: ExportCommandOptions): Promise<ExportCommandResult>;
193
+
194
+ interface GenerateArtifactsOptions {
195
+ app?: string;
196
+ }
197
+ interface GeneratedArtifacts {
198
+ envExample: string;
199
+ envDefaults: string;
200
+ envMarkdown: string;
201
+ envAuditJson: string;
202
+ envLocal: string;
203
+ }
204
+ declare function generateArtifacts(schema: EnvSchema, options?: GenerateArtifactsOptions): GeneratedArtifacts;
205
+ declare function generateTargetEnvFile(schema: EnvSchema, target: EnvTarget, options?: GenerateArtifactsOptions): string;
206
+
207
+ interface GenerateCommandOptions {
208
+ schema?: string;
209
+ app?: string;
210
+ writeLocal?: boolean;
211
+ writeTargetFiles?: boolean;
212
+ cwd?: string;
213
+ stdout?: {
214
+ write: (message: string) => unknown;
215
+ };
216
+ }
217
+ interface GenerateCommandResult {
218
+ schemaPath: string;
219
+ writtenFiles: string[];
220
+ artifacts: GeneratedArtifacts;
221
+ }
222
+ declare function runGenerateCommand(options?: GenerateCommandOptions): Promise<GenerateCommandResult>;
223
+
224
+ type ExitCode$2 = 0 | 1;
225
+ interface MigrateMakeCommandOptions {
226
+ name: string;
227
+ cwd?: string;
228
+ migrationsDir?: string;
229
+ now?: Date;
230
+ stdout?: {
231
+ write: (message: string) => unknown;
232
+ };
233
+ stderr?: {
234
+ write: (message: string) => unknown;
235
+ };
236
+ }
237
+ interface MigrateMakeCommandResult {
238
+ ok: boolean;
239
+ exitCode: ExitCode$2;
240
+ id?: string;
241
+ filePath?: string;
242
+ migrationsDir?: string;
243
+ }
244
+ interface MigrateCommandOptions {
245
+ cwd?: string;
246
+ migrationsDir?: string;
247
+ stateFile?: string;
248
+ generatedSchemaFile?: string;
249
+ now?: Date;
250
+ stdout?: {
251
+ write: (message: string) => unknown;
252
+ };
253
+ stderr?: {
254
+ write: (message: string) => unknown;
255
+ };
256
+ }
257
+ interface MigrateCommandResult {
258
+ ok: boolean;
259
+ exitCode: ExitCode$2;
260
+ migrationsDir?: string;
261
+ statePath?: string;
262
+ applied: string[];
263
+ changedFiles: string[];
264
+ }
265
+ interface MigrateStatusCommandOptions {
266
+ cwd?: string;
267
+ migrationsDir?: string;
268
+ stateFile?: string;
269
+ generatedSchemaFile?: string;
270
+ json?: boolean;
271
+ stdout?: {
272
+ write: (message: string) => unknown;
273
+ };
274
+ stderr?: {
275
+ write: (message: string) => unknown;
276
+ };
277
+ }
278
+ interface MigrateStatusCommandResult {
279
+ ok: boolean;
280
+ exitCode: ExitCode$2;
281
+ migrationsDir: string;
282
+ statePath: string;
283
+ schemaPath?: string;
284
+ error?: string;
285
+ summary: {
286
+ total: number;
287
+ applied: number;
288
+ pending: number;
289
+ changed: number;
290
+ missing: number;
291
+ };
292
+ entries: Array<{
293
+ id: string;
294
+ status: "applied" | "pending" | "changed" | "missing";
295
+ filePath?: string;
296
+ appliedAt?: string;
297
+ checksum?: string;
298
+ currentChecksum?: string;
299
+ }>;
300
+ }
301
+ interface MigrateRollbackCommandOptions {
302
+ steps: number;
303
+ cwd?: string;
304
+ migrationsDir?: string;
305
+ stateFile?: string;
306
+ generatedSchemaFile?: string;
307
+ stdout?: {
308
+ write: (message: string) => unknown;
309
+ };
310
+ stderr?: {
311
+ write: (message: string) => unknown;
312
+ };
313
+ }
314
+ interface SchemaBuildCommandOptions {
315
+ cwd?: string;
316
+ migrationsDir?: string;
317
+ stateFile?: string;
318
+ generatedSchemaFile?: string;
319
+ force?: boolean;
320
+ stdout?: {
321
+ write: (message: string) => unknown;
322
+ };
323
+ stderr?: {
324
+ write: (message: string) => unknown;
325
+ };
326
+ }
327
+ interface MigrateRollbackCommandResult {
328
+ ok: boolean;
329
+ exitCode: ExitCode$2;
330
+ migrationsDir?: string;
331
+ statePath?: string;
332
+ rolledBack: string[];
333
+ changedFiles: string[];
334
+ remainingApplied?: number;
335
+ }
336
+ interface SchemaBuildCommandResult {
337
+ ok: boolean;
338
+ exitCode: ExitCode$2;
339
+ schemaPath?: string;
340
+ appliedMigrationIds?: string[];
341
+ }
342
+ declare function runMigrateMakeCommand(options: MigrateMakeCommandOptions): Promise<MigrateMakeCommandResult>;
343
+ declare function runMigrateCommand(options?: MigrateCommandOptions): Promise<MigrateCommandResult>;
344
+ declare function runMigrateStatusCommand(options?: MigrateStatusCommandOptions): Promise<MigrateStatusCommandResult>;
345
+ declare function runMigrateRollbackCommand(options: MigrateRollbackCommandOptions): Promise<MigrateRollbackCommandResult>;
346
+ declare function runSchemaBuildCommand(options?: SchemaBuildCommandOptions): Promise<SchemaBuildCommandResult>;
347
+
348
+ declare const DEFAULT_MIGRATIONS_DIR = "env/migrations";
349
+ declare const DEFAULT_MIGRATION_STATE_FILE = "env/migrations.state.json";
350
+ declare const DEFAULT_GENERATED_SCHEMA_FILE = "env/schema.generated.json";
351
+ declare const DEFAULT_MIGRATION_TARGET_FILES: readonly [".env.local", ".env", ".env.example", ".env.defaults"];
352
+ type EnvMigrationTargetFile = (typeof DEFAULT_MIGRATION_TARGET_FILES)[number];
353
+ interface EnvMigrationTargetOptions {
354
+ targets?: readonly EnvMigrationTargetFile[];
355
+ }
356
+ interface EnvMigrationUpdateVariableOptions extends EnvMigrationTargetOptions {
357
+ overwrite?: boolean;
358
+ createIfMissing?: boolean;
359
+ comment?: string | readonly string[];
360
+ }
361
+ interface EnvMigrationRemoveVariableOptions extends EnvMigrationTargetOptions {
362
+ }
363
+ interface EnvMigrationRenameVariableOptions extends EnvMigrationTargetOptions {
364
+ overwrite?: boolean;
365
+ comment?: string | readonly string[];
366
+ }
367
+ interface EnvMigrationVariableChain {
368
+ kind(kind: EnvVariableDefinition["kind"]): EnvMigrationVariableChain;
369
+ define(definition: EnvVariableDefinition): EnvMigrationVariableChain;
370
+ string(): EnvMigrationVariableChain;
371
+ url(): EnvMigrationVariableChain;
372
+ number(): EnvMigrationVariableChain;
373
+ boolean(): EnvMigrationVariableChain;
374
+ enum(): EnvMigrationVariableChain;
375
+ json(): EnvMigrationVariableChain;
376
+ scope(scope: "server" | "client"): EnvMigrationVariableChain;
377
+ requiredIn(targets: EnvTarget | readonly EnvTarget[]): EnvMigrationVariableChain;
378
+ defaultValue(value: unknown): EnvMigrationVariableChain;
379
+ sensitive(value?: boolean): EnvMigrationVariableChain;
380
+ values(values: string | readonly string[]): EnvMigrationVariableChain;
381
+ description(value: string | undefined): EnvMigrationVariableChain;
382
+ example(value: string | undefined): EnvMigrationVariableChain;
383
+ owner(value: string | undefined): EnvMigrationVariableChain;
384
+ rotationDays(value: number | undefined): EnvMigrationVariableChain;
385
+ deprecated(value: DeprecatedMetadata | undefined): EnvMigrationVariableChain;
386
+ deprecate(replacedBy?: string, removeAfter?: string, message?: string): EnvMigrationVariableChain;
387
+ provider(value: ProviderMapping | undefined): EnvMigrationVariableChain;
388
+ providerAlias(provider: string, key: string | undefined): EnvMigrationVariableChain;
389
+ tags(values: string | readonly string[] | undefined): EnvMigrationVariableChain;
390
+ tag(value: string): EnvMigrationVariableChain;
391
+ value(value: string): EnvMigrationVariableChain;
392
+ targets(targets: EnvMigrationTargetFile | readonly EnvMigrationTargetFile[]): EnvMigrationVariableChain;
393
+ overwrite(value?: boolean): EnvMigrationVariableChain;
394
+ createIfMissing(value?: boolean): EnvMigrationVariableChain;
395
+ comment(comment: string | readonly string[] | undefined): EnvMigrationVariableChain;
396
+ rename(toKey: string, options?: EnvMigrationRenameVariableOptions): EnvMigrationVariableChain;
397
+ remove(options?: EnvMigrationRemoveVariableOptions): EnvMigrationVariableChain;
398
+ }
399
+ interface MigrationDerivedSchema {
400
+ schemaPath: string;
401
+ schema: EnvSchema;
402
+ prefixPolicy?: PrefixPolicy;
403
+ appliedMigrationIds: string[];
404
+ }
405
+ interface EnvMigrationOperation {
406
+ kind: "updateVariable" | "removeVariable" | "renameVariable" | "setPrefixPolicy";
407
+ key?: string;
408
+ fromKey?: string;
409
+ toKey?: string;
410
+ targets: EnvMigrationTargetFile[];
411
+ }
412
+ interface EnvMigrationContext {
413
+ key(key: string): EnvMigrationVariableChain;
414
+ string(key: string): EnvMigrationVariableChain;
415
+ url(key: string): EnvMigrationVariableChain;
416
+ number(key: string): EnvMigrationVariableChain;
417
+ boolean(key: string): EnvMigrationVariableChain;
418
+ enum(key: string): EnvMigrationVariableChain;
419
+ json(key: string): EnvMigrationVariableChain;
420
+ setPrefixPolicy(policy: PrefixPolicy | "nextjs" | "vite" | undefined): void;
421
+ }
422
+ interface EnvMigrationModule {
423
+ id: string;
424
+ up(ctx: EnvMigrationContext): Promise<void> | void;
425
+ down(ctx: EnvMigrationContext): Promise<void> | void;
426
+ }
427
+ interface LoadedEnvMigration extends EnvMigrationModule {
428
+ filePath: string;
429
+ checksum: string;
430
+ }
431
+ interface AppliedMigrationState {
432
+ id: string;
433
+ appliedAt: string;
434
+ checksum: string;
435
+ }
436
+ interface EnvMigrationState {
437
+ version: 1;
438
+ applied: AppliedMigrationState[];
439
+ }
440
+ interface MigrationStateLoadResult {
441
+ statePath: string;
442
+ state: EnvMigrationState;
443
+ }
444
+ interface MigrationStatusEntry {
445
+ id: string;
446
+ status: "applied" | "pending" | "changed" | "missing";
447
+ filePath?: string;
448
+ appliedAt?: string;
449
+ checksum?: string;
450
+ currentChecksum?: string;
451
+ }
452
+ interface MigrationStatusResult {
453
+ migrationsDir: string;
454
+ statePath: string;
455
+ entries: MigrationStatusEntry[];
456
+ summary: {
457
+ total: number;
458
+ applied: number;
459
+ pending: number;
460
+ changed: number;
461
+ missing: number;
462
+ };
463
+ }
464
+ interface ApplyMigrationsOptions {
465
+ cwd?: string;
466
+ migrationsDir?: string;
467
+ stateFile?: string;
468
+ generatedSchemaFile?: string;
469
+ now?: Date;
470
+ }
471
+ interface ApplyMigrationsResult {
472
+ migrationsDir: string;
473
+ statePath: string;
474
+ applied: string[];
475
+ changedFiles: string[];
476
+ pendingCount: number;
477
+ }
478
+ interface RollbackMigrationsOptions extends ApplyMigrationsOptions {
479
+ steps: number;
480
+ }
481
+ interface RollbackMigrationsResult {
482
+ migrationsDir: string;
483
+ statePath: string;
484
+ rolledBack: string[];
485
+ changedFiles: string[];
486
+ remainingApplied: number;
487
+ }
488
+ interface CreateMigrationFileOptions {
489
+ name: string;
490
+ cwd?: string;
491
+ migrationsDir?: string;
492
+ now?: Date;
493
+ template?: (id: string) => string;
494
+ }
495
+ interface CreateMigrationFileResult {
496
+ id: string;
497
+ filePath: string;
498
+ migrationsDir: string;
499
+ }
500
+ interface LoadedEnvTargetDocument {
501
+ target: EnvMigrationTargetFile;
502
+ filePath: string;
503
+ document: DotenvDocument;
504
+ source: string;
505
+ }
506
+ type LoadedEnvTargetDocuments = Map<EnvMigrationTargetFile, LoadedEnvTargetDocument>;
507
+ interface InMemorySchemaState {
508
+ schema: EnvSchema;
509
+ prefixPolicy?: PrefixPolicy;
510
+ }
511
+ declare function loadEnvTargetDocuments(options?: {
512
+ cwd?: string;
513
+ targets?: readonly EnvMigrationTargetFile[];
514
+ }): Promise<LoadedEnvTargetDocuments>;
515
+ declare function hasKeyInTargetDocuments(documents: LoadedEnvTargetDocuments, target: EnvMigrationTargetFile, key: string): boolean;
516
+ declare function finalizeFluentDefinitions(context: EnvMigrationContext): void;
517
+ declare function createEnvMigrationContext(documents: LoadedEnvTargetDocuments, operationLog?: EnvMigrationOperation[], schemaState?: InMemorySchemaState): EnvMigrationContext;
518
+ declare function writeEnvTargetDocuments(documents: LoadedEnvTargetDocuments): Promise<string[]>;
519
+ declare function loadMigrationState(options?: {
520
+ cwd?: string;
521
+ stateFile?: string;
522
+ }): Promise<MigrationStateLoadResult>;
523
+ declare function saveMigrationState(cwd: string, statePath: string, state: EnvMigrationState): Promise<void>;
524
+ declare function discoverMigrations(options?: {
525
+ cwd?: string;
526
+ migrationsDir?: string;
527
+ }): Promise<{
528
+ migrationsDir: string;
529
+ migrations: LoadedEnvMigration[];
530
+ }>;
531
+ declare function getMigrationStatus(options?: {
532
+ cwd?: string;
533
+ migrationsDir?: string;
534
+ stateFile?: string;
535
+ }): Promise<MigrationStatusResult>;
536
+ declare function loadOrBuildMigrationSchema(options?: {
537
+ cwd?: string;
538
+ migrationsDir?: string;
539
+ stateFile?: string;
540
+ generatedSchemaFile?: string;
541
+ forceRebuild?: boolean;
542
+ allowEmpty?: boolean;
543
+ }): Promise<MigrationDerivedSchema>;
544
+ declare function createMigrationFile(options: CreateMigrationFileOptions): Promise<CreateMigrationFileResult>;
545
+ declare function applyPendingMigrations(options?: ApplyMigrationsOptions): Promise<ApplyMigrationsResult>;
546
+ declare function rollbackMigrations(options: RollbackMigrationsOptions): Promise<RollbackMigrationsResult>;
547
+
548
+ type ProviderName = "vercel" | "heroku";
549
+ type ExitCode$1 = 0 | 1;
550
+ interface CommandRunnerOptions {
551
+ cwd?: string;
552
+ }
553
+ interface CommandRunnerResult {
554
+ exitCode: number;
555
+ stdout: string;
556
+ stderr: string;
557
+ missingBinary: boolean;
558
+ }
559
+ type CommandRunner = (command: string, args: readonly string[], options?: CommandRunnerOptions) => Promise<CommandRunnerResult>;
560
+ declare function runExternalCommand(command: string, args: readonly string[], options?: CommandRunnerOptions): Promise<CommandRunnerResult>;
561
+ interface DoctorCheck {
562
+ name: string;
563
+ ok: boolean;
564
+ message: string;
565
+ fix?: string;
566
+ }
567
+ interface DoctorResult {
568
+ ok: boolean;
569
+ exitCode: ExitCode$1;
570
+ schemaPath?: string;
571
+ checks: DoctorCheck[];
572
+ }
573
+ interface DoctorCommandOptions {
574
+ schema?: string;
575
+ cwd?: string;
576
+ runner?: CommandRunner;
577
+ stdout?: {
578
+ write: (message: string) => unknown;
579
+ };
580
+ stderr?: {
581
+ write: (message: string) => unknown;
582
+ };
583
+ }
584
+ declare function runDoctorCommand(options?: DoctorCommandOptions): Promise<DoctorResult>;
585
+ interface PullVercelOptions {
586
+ env: EnvTarget;
587
+ cwd?: string;
588
+ runner?: CommandRunner;
589
+ stdout?: {
590
+ write: (message: string) => unknown;
591
+ };
592
+ stderr?: {
593
+ write: (message: string) => unknown;
594
+ };
595
+ }
596
+ interface PullVercelResult {
597
+ ok: boolean;
598
+ exitCode: ExitCode$1;
599
+ outputPath: string;
600
+ }
601
+ declare function runPullVercelCommand(options: PullVercelOptions): Promise<PullVercelResult>;
602
+ interface DiffCommandOptions {
603
+ provider: ProviderName;
604
+ env?: EnvTarget;
605
+ app?: string;
606
+ target?: EnvTarget;
607
+ schema?: string;
608
+ snapshot?: string;
609
+ allowUnknown?: boolean;
610
+ json?: boolean;
611
+ cwd?: string;
612
+ stdout?: {
613
+ write: (message: string) => unknown;
614
+ };
615
+ stderr?: {
616
+ write: (message: string) => unknown;
617
+ };
618
+ }
619
+ interface DiffCommandResult {
620
+ provider: ProviderName;
621
+ ok: boolean;
622
+ exitCode: ExitCode$1;
623
+ schemaPath: string;
624
+ snapshotPath: string;
625
+ target: EnvTarget;
626
+ summary: {
627
+ total: number;
628
+ errors: number;
629
+ warnings: number;
630
+ };
631
+ issues: DriftIssue[];
632
+ }
633
+ declare function runDiffCommand(options: DiffCommandOptions): Promise<DiffCommandResult>;
634
+ interface PushHerokuOptions {
635
+ app: string;
636
+ target: EnvTarget;
637
+ from: string;
638
+ schema?: string;
639
+ cwd?: string;
640
+ runner?: CommandRunner;
641
+ stdout?: {
642
+ write: (message: string) => unknown;
643
+ };
644
+ stderr?: {
645
+ write: (message: string) => unknown;
646
+ };
647
+ }
648
+ interface PushHerokuResult {
649
+ ok: boolean;
650
+ exitCode: ExitCode$1;
651
+ pushedKeys: string[];
652
+ skippedKeys: string[];
653
+ }
654
+ declare function runPushHerokuCommand(options: PushHerokuOptions): Promise<PushHerokuResult>;
655
+
656
+ type ExitCode = 0 | 1;
657
+ interface ReconcileCommandOptions {
658
+ schema?: string;
659
+ app?: string;
660
+ cwd?: string;
661
+ writeMigration?: boolean;
662
+ migrationsDir?: string;
663
+ now?: Date;
664
+ stdout?: {
665
+ write: (message: string) => unknown;
666
+ };
667
+ stderr?: {
668
+ write: (message: string) => unknown;
669
+ };
670
+ }
671
+ interface ReconcileAddedKey {
672
+ key: string;
673
+ definition: EnvVariableDefinition;
674
+ value: string;
675
+ targets: EnvMigrationTargetFile[];
676
+ }
677
+ interface ReconcileCommandResult {
678
+ ok: boolean;
679
+ exitCode: ExitCode;
680
+ schemaPath?: string;
681
+ changedFiles: string[];
682
+ added: ReconcileAddedKey[];
683
+ migrationId?: string;
684
+ migrationPath?: string;
685
+ }
686
+ declare function runReconcileCommand(options?: ReconcileCommandOptions): Promise<ReconcileCommandResult>;
687
+
688
+ declare const DEFAULT_SCHEMA_FILES: readonly ["env.schema.mjs", "env.schema.js", "env.schema.cjs", "env.schema.json"];
689
+ interface LoadedSchema {
690
+ schema: EnvSchema;
691
+ prefixPolicy?: PrefixPolicy;
692
+ schemaPath: string;
693
+ app?: string;
694
+ }
695
+ interface LoadSchemaOptions {
696
+ app?: string;
697
+ }
698
+ interface ResolveSchemaPathOptions {
699
+ migrationsDir?: string;
700
+ stateFile?: string;
701
+ generatedSchemaFile?: string;
702
+ forceRebuildMigrationSchema?: boolean;
703
+ }
704
+ declare function resolveSchemaPath(schemaPath: string | undefined, cwd: string, options?: ResolveSchemaPathOptions): Promise<string>;
705
+ declare function loadSchema(schemaPath: string, options?: LoadSchemaOptions): Promise<LoadedSchema>;
706
+
707
+ export { type AppliedMigrationState, type ApplyMigrationsOptions, type ApplyMigrationsResult, type AuditCommandOptions, type AuditCommandResult, type AuditTargetResult, type CheckCommandOptions, type CheckCommandResult, type CommandRunner, type CommandRunnerOptions, type CommandRunnerResult, type CreateMigrationFileOptions, type CreateMigrationFileResult, DEFAULT_GENERATED_SCHEMA_FILE, DEFAULT_MIGRATIONS_DIR, DEFAULT_MIGRATION_STATE_FILE, DEFAULT_MIGRATION_TARGET_FILES, DEFAULT_SCHEMA_FILES, DeprecatedMetadata, type DeprecationItem, type DeprecationsCommandOptions, type DeprecationsCommandResult, type DiffCommandOptions, type DiffCommandResult, type DoctorCheck, type DoctorCommandOptions, type DoctorResult, type DotenvBlankLine, type DotenvCommentLine, type DotenvDocument, type DotenvLine, type DotenvPairLine, type DotenvQuoteStyle, type DotenvUnknownLine, type DriftIssue, type DriftOptions, type DriftResult, type DriftSummary, type EnvMigrationContext, type EnvMigrationModule, type EnvMigrationOperation, type EnvMigrationRemoveVariableOptions, type EnvMigrationRenameVariableOptions, type EnvMigrationState, type EnvMigrationTargetFile, type EnvMigrationTargetOptions, type EnvMigrationUpdateVariableOptions, type EnvMigrationVariableChain, EnvSchema, EnvScope, EnvTarget, EnvValidationIssue, EnvVariableDefinition, type ExportCommandOptions, type ExportCommandResult, type ExportFormat, type GenerateArtifactsOptions, type GenerateCommandOptions, type GenerateCommandResult, type GeneratedArtifacts, type LoadSchemaOptions, type LoadedEnvMigration, type LoadedEnvTargetDocument, type LoadedEnvTargetDocuments, type LoadedSchema, type MigrateCommandOptions, type MigrateCommandResult, type MigrateMakeCommandOptions, type MigrateMakeCommandResult, type MigrateRollbackCommandOptions, type MigrateRollbackCommandResult, type MigrateStatusCommandOptions, type MigrateStatusCommandResult, type MigrationDerivedSchema, type MigrationStateLoadResult, type MigrationStatusEntry, type MigrationStatusResult, PrefixPolicy, ProviderMapping, type ProviderName, type PullVercelOptions, type PullVercelResult, type PushHerokuOptions, type PushHerokuResult, type ReconcileAddedKey, type ReconcileCommandOptions, type ReconcileCommandResult, type ResolveSchemaPathOptions, type RollbackMigrationsOptions, type RollbackMigrationsResult, type SchemaBuildCommandOptions, type SchemaBuildCommandResult, type WriteDotenvOptions, applyPendingMigrations, createEnvMigrationContext, createMigrationFile, detectDrift, discoverMigrations, dotenvToObject, finalizeFluentDefinitions, formatDotenvValue, generateArtifacts, generateTargetEnvFile, getMigrationStatus, hasKeyInTargetDocuments, loadEnvTargetDocuments, loadMigrationState, loadOrBuildMigrationSchema, loadSchema, parseDotenv, renderExport, resolveSchemaPath, rollbackMigrations, runAuditCommand, runCheckCommand, runDeprecationsCommand, runDiffCommand, runDoctorCommand, runExportCommand, runExternalCommand, runGenerateCommand, runMigrateCommand, runMigrateMakeCommand, runMigrateRollbackCommand, runMigrateStatusCommand, runPullVercelCommand, runPushHerokuCommand, runReconcileCommand, runSchemaBuildCommand, saveMigrationState, writeDotenv, writeEnvTargetDocuments };