@savvy-web/github-action-builder 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.
package/index.d.ts ADDED
@@ -0,0 +1,1621 @@
1
+ /**
2
+ * GitHub Action Builder
3
+ *
4
+ * A zero-config build tool for creating GitHub Actions from TypeScript source code.
5
+ * This package provides both a programmatic API and CLI for bundling TypeScript
6
+ * GitHub Actions into production-ready JavaScript bundles.
7
+ *
8
+ * @remarks
9
+ * The package uses vercel/ncc under the hood to create single-file bundles
10
+ * that include all dependencies. It automatically detects entry points
11
+ * (`main.ts`, `pre.ts`, `post.ts`) and validates `action.yml` configuration.
12
+ *
13
+ * @example Programmatic usage with GitHubAction class
14
+ * ```typescript
15
+ * import { GitHubAction } from "@savvy-web/github-action-builder";
16
+ *
17
+ * async function main(): Promise<void> {
18
+ * const action = GitHubAction.create();
19
+ * const result = await action.build();
20
+ *
21
+ * if (result.success) {
22
+ * console.log("Build completed successfully");
23
+ * } else {
24
+ * console.error(result.error);
25
+ * process.exit(1);
26
+ * }
27
+ * }
28
+ *
29
+ * main();
30
+ * ```
31
+ *
32
+ * @example Configuration file (action.config.ts)
33
+ * ```typescript
34
+ * import { defineConfig } from "@savvy-web/github-action-builder";
35
+ *
36
+ * export default defineConfig({
37
+ * entries: {
38
+ * main: "src/main.ts",
39
+ * post: "src/cleanup.ts",
40
+ * },
41
+ * build: {
42
+ * minify: true,
43
+ * target: "es2022",
44
+ * },
45
+ * });
46
+ * ```
47
+ *
48
+ * @packageDocumentation
49
+ */
50
+
51
+ import { Context } from 'effect';
52
+ import type { Effect } from 'effect';
53
+ import { Equals } from 'effect/Types';
54
+ import { Layer } from 'effect';
55
+ import { Schema } from 'effect';
56
+ import { URL as URL_2 } from 'node:url';
57
+ import { YieldableError } from 'effect/Cause';
58
+
59
+ /**
60
+ * Error when action.yml file is missing.
61
+ *
62
+ * @public
63
+ */
64
+ export declare class ActionYmlMissing extends ActionYmlMissingBase<{
65
+ /**
66
+ * The working directory that was searched.
67
+ */
68
+ readonly cwd: string;
69
+ }> {
70
+ }
71
+
72
+ /**
73
+ * Base class for ActionYmlMissing error.
74
+ *
75
+ * @privateRemarks
76
+ * This export is required for api-extractor documentation generation.
77
+ * Effect's Data.TaggedError creates an anonymous base class that must be
78
+ * explicitly exported to avoid "forgotten export" warnings. Do not delete.
79
+ *
80
+ * @internal
81
+ */
82
+ export declare const ActionYmlMissingBase: new <A extends Record<string, any> = {}>(args: Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => YieldableError & {
83
+ readonly _tag: "ActionYmlMissing";
84
+ } & Readonly<A>;
85
+
86
+ /**
87
+ * Result of action.yml validation.
88
+ * @public
89
+ */
90
+ export declare type ActionYmlResult = typeof ActionYmlResultSchema.Type;
91
+
92
+ /**
93
+ * Result of action.yml validation.
94
+ * @internal
95
+ */
96
+ export declare const ActionYmlResultSchema: Schema.Struct<{
97
+ /** Whether the action.yml is valid. */
98
+ valid: typeof Schema.Boolean;
99
+ /** Parsed action.yml content if valid. */
100
+ content: Schema.optional<typeof Schema.Any>;
101
+ /** Validation errors. */
102
+ errors: Schema.Array$<Schema.Struct<{
103
+ /** Error code for categorization. */
104
+ code: typeof Schema.String;
105
+ /** Human-readable error message. */
106
+ message: typeof Schema.String;
107
+ /** File path where error occurred. */
108
+ file: Schema.optional<typeof Schema.String>;
109
+ /** Suggestion for fixing the error. */
110
+ suggestion: Schema.optional<typeof Schema.String>;
111
+ }>>;
112
+ /** Validation warnings. */
113
+ warnings: Schema.Array$<Schema.Struct<{
114
+ /** Warning code for categorization. */
115
+ code: typeof Schema.String;
116
+ /** Human-readable warning message. */
117
+ message: typeof Schema.String;
118
+ /** File path where warning occurred. */
119
+ file: Schema.optional<typeof Schema.String>;
120
+ /** Suggestion for addressing the warning. */
121
+ suggestion: Schema.optional<typeof Schema.String>;
122
+ }>>;
123
+ }>;
124
+
125
+ /**
126
+ * Error when action.yml fails schema validation.
127
+ *
128
+ * @public
129
+ */
130
+ export declare class ActionYmlSchemaError extends ActionYmlSchemaErrorBase<{
131
+ /**
132
+ * The path to the action.yml file.
133
+ */
134
+ readonly path: string;
135
+ /**
136
+ * List of schema validation errors.
137
+ */
138
+ readonly errors: ReadonlyArray<{
139
+ readonly path: string;
140
+ readonly message: string;
141
+ }>;
142
+ }> {
143
+ }
144
+
145
+ /**
146
+ * Base class for ActionYmlSchemaError error.
147
+ *
148
+ * @privateRemarks
149
+ * This export is required for api-extractor documentation generation.
150
+ * Effect's Data.TaggedError creates an anonymous base class that must be
151
+ * explicitly exported to avoid "forgotten export" warnings. Do not delete.
152
+ *
153
+ * @internal
154
+ */
155
+ export declare const ActionYmlSchemaErrorBase: new <A extends Record<string, any> = {}>(args: Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => YieldableError & {
156
+ readonly _tag: "ActionYmlSchemaError";
157
+ } & Readonly<A>;
158
+
159
+ /**
160
+ * Error when action.yml has invalid YAML syntax.
161
+ *
162
+ * @public
163
+ */
164
+ export declare class ActionYmlSyntaxError extends ActionYmlSyntaxErrorBase<{
165
+ /**
166
+ * The path to the action.yml file.
167
+ */
168
+ readonly path: string;
169
+ /**
170
+ * The syntax error message.
171
+ */
172
+ readonly message: string;
173
+ /**
174
+ * Line number where the error occurred, if available.
175
+ */
176
+ readonly line?: number;
177
+ /**
178
+ * Column number where the error occurred, if available.
179
+ */
180
+ readonly column?: number;
181
+ }> {
182
+ }
183
+
184
+ /**
185
+ * Base class for ActionYmlSyntaxError error.
186
+ *
187
+ * @privateRemarks
188
+ * This export is required for api-extractor documentation generation.
189
+ * Effect's Data.TaggedError creates an anonymous base class that must be
190
+ * explicitly exported to avoid "forgotten export" warnings. Do not delete.
191
+ *
192
+ * @internal
193
+ */
194
+ export declare const ActionYmlSyntaxErrorBase: new <A extends Record<string, any> = {}>(args: Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => YieldableError & {
195
+ readonly _tag: "ActionYmlSyntaxError";
196
+ } & Readonly<A>;
197
+
198
+ /**
199
+ * Union of all possible errors in the GitHub Action Builder.
200
+ *
201
+ * @public
202
+ */
203
+ export declare type AppError = ConfigError | ValidationError | BuildError;
204
+
205
+ /**
206
+ * Combined layer providing all services.
207
+ *
208
+ * @remarks
209
+ * This layer composes ConfigService, ValidationService, and BuildService.
210
+ * Use this when you need access to all services in your Effect program.
211
+ *
212
+ * @example Using AppLayer with Effect
213
+ * ```typescript
214
+ * import { Effect } from "effect";
215
+ * import { AppLayer, BuildService, ConfigService } from "@savvy-web/github-action-builder";
216
+ *
217
+ * const program = Effect.gen(function* () {
218
+ * const configService = yield* ConfigService;
219
+ * const buildService = yield* BuildService;
220
+ *
221
+ * const { config } = yield* configService.load();
222
+ * const result = yield* buildService.build(config);
223
+ *
224
+ * return result;
225
+ * });
226
+ *
227
+ * Effect.runPromise(program.pipe(Effect.provide(AppLayer)));
228
+ * ```
229
+ *
230
+ * @public
231
+ */
232
+ export declare const AppLayer: Layer.Layer<BuildService | ConfigService | ValidationService, never, never>;
233
+
234
+ /**
235
+ * Union of all build-related errors.
236
+ *
237
+ * @public
238
+ */
239
+ export declare type BuildError = BundleFailed | WriteError | CleanError | BuildFailed;
240
+
241
+ /**
242
+ * Error when the build process fails overall.
243
+ *
244
+ * @public
245
+ */
246
+ export declare class BuildFailed extends BuildFailedBase<{
247
+ /**
248
+ * Summary message of the build failure.
249
+ */
250
+ readonly message: string;
251
+ /**
252
+ * Number of entries that failed.
253
+ */
254
+ readonly failedEntries: number;
255
+ }> {
256
+ }
257
+
258
+ /**
259
+ * Base class for BuildFailed error.
260
+ *
261
+ * @privateRemarks
262
+ * This export is required for api-extractor documentation generation.
263
+ * Effect's Data.TaggedError creates an anonymous base class that must be
264
+ * explicitly exported to avoid "forgotten export" warnings. Do not delete.
265
+ *
266
+ * @internal
267
+ */
268
+ export declare const BuildFailedBase: new <A extends Record<string, any> = {}>(args: Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => YieldableError & {
269
+ readonly _tag: "BuildFailed";
270
+ } & Readonly<A>;
271
+
272
+ /**
273
+ * Layer providing BuildService (depends on ConfigService).
274
+ *
275
+ * @remarks
276
+ * Includes ConfigService automatically.
277
+ *
278
+ * @public
279
+ */
280
+ export declare const BuildLayer: Layer.Layer<BuildService, never, never>;
281
+
282
+ /**
283
+ * Build options for the bundler.
284
+ *
285
+ * @public
286
+ */
287
+ export declare type BuildOptions = typeof BuildOptionsSchema.Type;
288
+
289
+ /**
290
+ * Schema for build options.
291
+ *
292
+ * @remarks
293
+ * Build options control how the TypeScript source is bundled using `@vercel/ncc`.
294
+ * The bundler creates a single JavaScript file with all dependencies inlined.
295
+ *
296
+ * @internal
297
+ */
298
+ export declare const BuildOptionsSchema: Schema.Struct<{
299
+ /** Enable minification to reduce bundle size. Defaults to true. */
300
+ minify: Schema.optionalWith<typeof Schema.Boolean, {
301
+ default: () => true;
302
+ }>;
303
+ /** ECMAScript target version for the output. Defaults to "es2022". */
304
+ target: Schema.optionalWith<Schema.Literal<["es2020", "es2021", "es2022", "es2023", "es2024"]>, {
305
+ default: () => "es2022";
306
+ }>;
307
+ /** Generate source maps for debugging. Defaults to false. */
308
+ sourceMap: Schema.optionalWith<typeof Schema.Boolean, {
309
+ default: () => false;
310
+ }>;
311
+ /** Packages to exclude from the bundle. Defaults to []. */
312
+ externals: Schema.optionalWith<Schema.Array$<typeof Schema.String>, {
313
+ default: () => never[];
314
+ }>;
315
+ /** Suppress build output. Defaults to false. */
316
+ quiet: Schema.optionalWith<typeof Schema.Boolean, {
317
+ default: () => false;
318
+ }>;
319
+ }>;
320
+
321
+ /**
322
+ * Result of the complete build process.
323
+ * @public
324
+ */
325
+ export declare type BuildResult = typeof BuildResultSchema.Type;
326
+
327
+ /**
328
+ * Result of the complete build process.
329
+ * @internal
330
+ */
331
+ export declare const BuildResultSchema: Schema.Struct<{
332
+ /** Whether the overall build succeeded. */
333
+ success: typeof Schema.Boolean;
334
+ /** Results for each entry that was built. */
335
+ entries: Schema.Array$<Schema.Struct<{
336
+ /** Whether bundling succeeded. */
337
+ success: typeof Schema.Boolean;
338
+ /** Bundle statistics if successful. */
339
+ stats: Schema.optional<Schema.Struct<{
340
+ /** Entry type (main, pre, or post). */
341
+ entry: typeof Schema.String;
342
+ /** Bundle size in bytes. */
343
+ size: typeof Schema.Number;
344
+ /** Build duration in milliseconds. */
345
+ duration: typeof Schema.Number;
346
+ /** Output path relative to working directory. */
347
+ outputPath: typeof Schema.String;
348
+ }>>;
349
+ /** Error message if failed. */
350
+ error: Schema.optional<typeof Schema.String>;
351
+ }>>;
352
+ /** Total build duration in milliseconds. */
353
+ duration: typeof Schema.Number;
354
+ /** Error message if build failed. */
355
+ error: Schema.optional<typeof Schema.String>;
356
+ }>;
357
+
358
+ /**
359
+ * Options for the build process.
360
+ * @public
361
+ */
362
+ export declare type BuildRunnerOptions = typeof BuildRunnerOptionsSchema.Type;
363
+
364
+ /**
365
+ * Options for the build process.
366
+ * @internal
367
+ */
368
+ export declare const BuildRunnerOptionsSchema: Schema.Struct<{
369
+ /** Working directory for the build. Accepts string, Buffer, or URL. */
370
+ cwd: Schema.optional<Schema.transform<Schema.Union<[typeof Schema.String, Schema.instanceOf<Buffer<ArrayBufferLike>>, Schema.instanceOf<URL_2>]>, typeof Schema.String>>;
371
+ /** Clean output directory before building. Defaults to true. */
372
+ clean: Schema.optional<typeof Schema.Boolean>;
373
+ }>;
374
+
375
+ /**
376
+ * BuildService interface for build and bundling capabilities.
377
+ *
378
+ * @remarks
379
+ * This service handles:
380
+ * - Bundling TypeScript entries with vercel/ncc
381
+ * - Managing output directory
382
+ * - Collecting build statistics
383
+ * - Formatting build results
384
+ *
385
+ * @example Using BuildService with Effect
386
+ * ```typescript
387
+ * import { Effect } from "effect";
388
+ * import { AppLayer, BuildService, ConfigService } from "@savvy-web/github-action-builder";
389
+ *
390
+ * const program = Effect.gen(function* () {
391
+ * const configService = yield* ConfigService;
392
+ * const buildService = yield* BuildService;
393
+ *
394
+ * const { config } = yield* configService.load();
395
+ * const result = yield* buildService.build(config);
396
+ *
397
+ * if (result.success) {
398
+ * console.log("Build complete:", result.entries.length, "entries");
399
+ * }
400
+ * });
401
+ *
402
+ * Effect.runPromise(program.pipe(Effect.provide(AppLayer)));
403
+ * ```
404
+ *
405
+ * @public
406
+ */
407
+ export declare interface BuildService {
408
+ /**
409
+ * Build all entries from the configuration.
410
+ *
411
+ * @param config - Configuration with entry points
412
+ * @param options - Build options
413
+ * @returns Effect that resolves to build result
414
+ */
415
+ readonly build: (config: Config, options?: BuildRunnerOptions) => Effect.Effect<BuildResult, BuildError | MainEntryMissing>;
416
+ /**
417
+ * Bundle a single entry point.
418
+ *
419
+ * @param entry - Entry to bundle
420
+ * @param config - Build configuration
421
+ * @returns Effect that resolves to bundle result
422
+ */
423
+ readonly bundle: (entry: DetectedEntry, config: Config) => Effect.Effect<BundleResult, BuildError>;
424
+ /**
425
+ * Clean the output directory.
426
+ *
427
+ * @param outputDir - Directory to clean
428
+ * @returns Effect that resolves when complete
429
+ */
430
+ readonly clean: (outputDir: string) => Effect.Effect<void, BuildError>;
431
+ /**
432
+ * Format build result for display.
433
+ *
434
+ * @param result - Build result to format
435
+ * @returns Formatted string for terminal output
436
+ */
437
+ readonly formatResult: (result: BuildResult) => string;
438
+ /**
439
+ * Format bytes as human-readable string.
440
+ *
441
+ * @param bytes - Number of bytes
442
+ * @returns Formatted string like "1.5 MB"
443
+ */
444
+ readonly formatBytes: (bytes: number) => string;
445
+ }
446
+
447
+ /**
448
+ * BuildService tag for dependency injection.
449
+ *
450
+ * @public
451
+ */
452
+ export declare const BuildService: Context.Tag<BuildService, BuildService>;
453
+
454
+ /**
455
+ * Error when bundling with ncc fails.
456
+ *
457
+ * @public
458
+ */
459
+ export declare class BundleFailed extends BundleFailedBase<{
460
+ /**
461
+ * The entry file that failed to bundle.
462
+ */
463
+ readonly entry: string;
464
+ /**
465
+ * The underlying error message.
466
+ */
467
+ readonly cause: string;
468
+ }> {
469
+ }
470
+
471
+ /**
472
+ * Base class for BundleFailed error.
473
+ *
474
+ * @privateRemarks
475
+ * This export is required for api-extractor documentation generation.
476
+ * Effect's Data.TaggedError creates an anonymous base class that must be
477
+ * explicitly exported to avoid "forgotten export" warnings. Do not delete.
478
+ *
479
+ * @internal
480
+ */
481
+ export declare const BundleFailedBase: new <A extends Record<string, any> = {}>(args: Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => YieldableError & {
482
+ readonly _tag: "BundleFailed";
483
+ } & Readonly<A>;
484
+
485
+ /**
486
+ * Result of bundling a single entry.
487
+ * @public
488
+ */
489
+ export declare type BundleResult = typeof BundleResultSchema.Type;
490
+
491
+ /**
492
+ * Result of bundling a single entry.
493
+ * @internal
494
+ */
495
+ export declare const BundleResultSchema: Schema.Struct<{
496
+ /** Whether bundling succeeded. */
497
+ success: typeof Schema.Boolean;
498
+ /** Bundle statistics if successful. */
499
+ stats: Schema.optional<Schema.Struct<{
500
+ /** Entry type (main, pre, or post). */
501
+ entry: typeof Schema.String;
502
+ /** Bundle size in bytes. */
503
+ size: typeof Schema.Number;
504
+ /** Build duration in milliseconds. */
505
+ duration: typeof Schema.Number;
506
+ /** Output path relative to working directory. */
507
+ outputPath: typeof Schema.String;
508
+ }>>;
509
+ /** Error message if failed. */
510
+ error: Schema.optional<typeof Schema.String>;
511
+ }>;
512
+
513
+ /**
514
+ * Statistics for a single bundled entry.
515
+ * @public
516
+ */
517
+ export declare type BundleStats = typeof BundleStatsSchema.Type;
518
+
519
+ /**
520
+ * Statistics for a single bundled entry.
521
+ * @internal
522
+ */
523
+ export declare const BundleStatsSchema: Schema.Struct<{
524
+ /** Entry type (main, pre, or post). */
525
+ entry: typeof Schema.String;
526
+ /** Bundle size in bytes. */
527
+ size: typeof Schema.Number;
528
+ /** Build duration in milliseconds. */
529
+ duration: typeof Schema.Number;
530
+ /** Output path relative to working directory. */
531
+ outputPath: typeof Schema.String;
532
+ }>;
533
+
534
+ /**
535
+ * Error when cleaning the output directory fails.
536
+ *
537
+ * @public
538
+ */
539
+ export declare class CleanError extends CleanErrorBase<{
540
+ /**
541
+ * The directory that failed to clean.
542
+ */
543
+ readonly directory: string;
544
+ /**
545
+ * The underlying error message.
546
+ */
547
+ readonly cause: string;
548
+ }> {
549
+ }
550
+
551
+ /**
552
+ * Base class for CleanError error.
553
+ *
554
+ * @privateRemarks
555
+ * This export is required for api-extractor documentation generation.
556
+ * Effect's Data.TaggedError creates an anonymous base class that must be
557
+ * explicitly exported to avoid "forgotten export" warnings. Do not delete.
558
+ *
559
+ * @internal
560
+ */
561
+ export declare const CleanErrorBase: new <A extends Record<string, any> = {}>(args: Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => YieldableError & {
562
+ readonly _tag: "CleanError";
563
+ } & Readonly<A>;
564
+
565
+ /**
566
+ * Fully resolved configuration with all defaults applied.
567
+ *
568
+ * @remarks
569
+ * This type represents the final configuration after all defaults
570
+ * have been applied. It is the result of calling {@link defineConfig}.
571
+ *
572
+ * @public
573
+ */
574
+ export declare type Config = typeof ConfigSchema.Type;
575
+
576
+ /**
577
+ * Union of all configuration-related errors.
578
+ *
579
+ * @public
580
+ */
581
+ export declare type ConfigError = ConfigNotFound | ConfigInvalid | ConfigLoadFailed;
582
+
583
+ /**
584
+ * User-provided configuration input (all fields optional).
585
+ *
586
+ * @remarks
587
+ * Use this type when accepting configuration from users.
588
+ * All fields are optional and will be merged with defaults.
589
+ *
590
+ * @public
591
+ */
592
+ export declare type ConfigInput = typeof ConfigInputSchema.Type;
593
+
594
+ /**
595
+ * User-provided configuration input (all fields optional).
596
+ *
597
+ * @remarks
598
+ * This schema is used for parsing user-provided configuration.
599
+ * All sections are optional; defaults are applied via {@link defineConfig}.
600
+ *
601
+ * @internal
602
+ */
603
+ export declare const ConfigInputSchema: Schema.Struct<{
604
+ entries: Schema.optional<Schema.Struct<{
605
+ main: Schema.optional<typeof Schema.String>;
606
+ pre: Schema.optional<typeof Schema.String>;
607
+ post: Schema.optional<typeof Schema.String>;
608
+ }>>;
609
+ build: Schema.optional<Schema.Struct<{
610
+ minify: Schema.optional<typeof Schema.Boolean>;
611
+ target: Schema.optional<Schema.Literal<["es2020", "es2021", "es2022", "es2023", "es2024"]>>;
612
+ sourceMap: Schema.optional<typeof Schema.Boolean>;
613
+ externals: Schema.optional<Schema.Array$<typeof Schema.String>>;
614
+ quiet: Schema.optional<typeof Schema.Boolean>;
615
+ }>>;
616
+ validation: Schema.optional<Schema.Struct<{
617
+ requireActionYml: Schema.optional<typeof Schema.Boolean>;
618
+ maxBundleSize: Schema.optional<typeof Schema.String>;
619
+ strict: Schema.optional<typeof Schema.Boolean>;
620
+ }>>;
621
+ }>;
622
+
623
+ /**
624
+ * Error when configuration file exists but contains invalid content.
625
+ *
626
+ * @public
627
+ */
628
+ export declare class ConfigInvalid extends ConfigInvalidBase<{
629
+ /**
630
+ * The path to the invalid config file.
631
+ */
632
+ readonly path: string;
633
+ /**
634
+ * List of validation errors.
635
+ */
636
+ readonly errors: ReadonlyArray<string>;
637
+ }> {
638
+ }
639
+
640
+ /**
641
+ * Base class for ConfigInvalid error.
642
+ *
643
+ * @privateRemarks
644
+ * This export is required for api-extractor documentation generation.
645
+ * Effect's Data.TaggedError creates an anonymous base class that must be
646
+ * explicitly exported to avoid "forgotten export" warnings. Do not delete.
647
+ *
648
+ * @internal
649
+ */
650
+ export declare const ConfigInvalidBase: new <A extends Record<string, any> = {}>(args: Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => YieldableError & {
651
+ readonly _tag: "ConfigInvalid";
652
+ } & Readonly<A>;
653
+
654
+ /**
655
+ * Layer providing ConfigService (no dependencies).
656
+ *
657
+ * @remarks
658
+ * Use this layer when you only need configuration management.
659
+ *
660
+ * @public
661
+ */
662
+ export declare const ConfigLayer: Layer.Layer<ConfigService, never, never>;
663
+
664
+ /**
665
+ * Error when configuration file fails to load (import error, syntax error, etc.).
666
+ *
667
+ * @public
668
+ */
669
+ export declare class ConfigLoadFailed extends ConfigLoadFailedBase<{
670
+ /**
671
+ * The path to the config file that failed to load.
672
+ */
673
+ readonly path: string;
674
+ /**
675
+ * The underlying error message.
676
+ */
677
+ readonly cause: string;
678
+ }> {
679
+ }
680
+
681
+ /**
682
+ * Base class for ConfigLoadFailed error.
683
+ *
684
+ * @privateRemarks
685
+ * This export is required for api-extractor documentation generation.
686
+ * Effect's Data.TaggedError creates an anonymous base class that must be
687
+ * explicitly exported to avoid "forgotten export" warnings. Do not delete.
688
+ *
689
+ * @internal
690
+ */
691
+ export declare const ConfigLoadFailedBase: new <A extends Record<string, any> = {}>(args: Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => YieldableError & {
692
+ readonly _tag: "ConfigLoadFailed";
693
+ } & Readonly<A>;
694
+
695
+ /**
696
+ * Error when configuration file is not found.
697
+ *
698
+ * @public
699
+ */
700
+ export declare class ConfigNotFound extends ConfigNotFoundBase<{
701
+ /**
702
+ * The path that was searched for the config file.
703
+ */
704
+ readonly path: string;
705
+ /**
706
+ * Additional context about the search.
707
+ */
708
+ readonly message?: string;
709
+ }> {
710
+ }
711
+
712
+ /**
713
+ * Base class for ConfigNotFound error.
714
+ *
715
+ * @privateRemarks
716
+ * This export is required for api-extractor documentation generation.
717
+ * Effect's Data.TaggedError creates an anonymous base class that must be
718
+ * explicitly exported to avoid "forgotten export" warnings. Do not delete.
719
+ *
720
+ * @internal
721
+ */
722
+ export declare const ConfigNotFoundBase: new <A extends Record<string, any> = {}>(args: Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => YieldableError & {
723
+ readonly _tag: "ConfigNotFound";
724
+ } & Readonly<A>;
725
+
726
+ /**
727
+ * Fully resolved configuration with all defaults applied.
728
+ *
729
+ * @internal
730
+ */
731
+ export declare const ConfigSchema: Schema.Struct<{
732
+ entries: Schema.Struct<{
733
+ /** Path to the main action entry point. Defaults to "src/main.ts". */
734
+ main: Schema.optionalWith<typeof Schema.String, {
735
+ default: () => string;
736
+ }>;
737
+ /** Path to the pre-action hook entry point. */
738
+ pre: Schema.optional<typeof Schema.String>;
739
+ /** Path to the post-action hook entry point. */
740
+ post: Schema.optional<typeof Schema.String>;
741
+ }>;
742
+ build: Schema.Struct<{
743
+ /** Enable minification to reduce bundle size. Defaults to true. */
744
+ minify: Schema.optionalWith<typeof Schema.Boolean, {
745
+ default: () => true;
746
+ }>;
747
+ /** ECMAScript target version for the output. Defaults to "es2022". */
748
+ target: Schema.optionalWith<Schema.Literal<["es2020", "es2021", "es2022", "es2023", "es2024"]>, {
749
+ default: () => "es2022";
750
+ }>;
751
+ /** Generate source maps for debugging. Defaults to false. */
752
+ sourceMap: Schema.optionalWith<typeof Schema.Boolean, {
753
+ default: () => false;
754
+ }>;
755
+ /** Packages to exclude from the bundle. Defaults to []. */
756
+ externals: Schema.optionalWith<Schema.Array$<typeof Schema.String>, {
757
+ default: () => never[];
758
+ }>;
759
+ /** Suppress build output. Defaults to false. */
760
+ quiet: Schema.optionalWith<typeof Schema.Boolean, {
761
+ default: () => false;
762
+ }>;
763
+ }>;
764
+ validation: Schema.Struct<{
765
+ /** Require action.yml to exist and be valid. Defaults to true. */
766
+ requireActionYml: Schema.optionalWith<typeof Schema.Boolean, {
767
+ default: () => true;
768
+ }>;
769
+ /** Maximum bundle size before warning/error (e.g., "5mb", "500kb"). */
770
+ maxBundleSize: Schema.optional<typeof Schema.String>;
771
+ /** Treat warnings as errors. Auto-detects from CI when undefined. */
772
+ strict: Schema.optional<typeof Schema.Boolean>;
773
+ }>;
774
+ }>;
775
+
776
+ /**
777
+ * ConfigService interface for configuration management capabilities.
778
+ *
779
+ * @remarks
780
+ * This service handles:
781
+ * - Loading configuration from `action.config.ts` files
782
+ * - Resolving partial configuration with defaults
783
+ * - Detecting entry points in the project
784
+ *
785
+ * @example Using ConfigService with Effect
786
+ * ```typescript
787
+ * import { Effect } from "effect";
788
+ * import { AppLayer, ConfigService } from "@savvy-web/github-action-builder";
789
+ *
790
+ * const program = Effect.gen(function* () {
791
+ * const configService = yield* ConfigService;
792
+ * const result = yield* configService.load({ cwd: process.cwd() });
793
+ * console.log("Loaded config:", result.config);
794
+ * });
795
+ *
796
+ * Effect.runPromise(program.pipe(Effect.provide(AppLayer)));
797
+ * ```
798
+ *
799
+ * @public
800
+ */
801
+ export declare interface ConfigService {
802
+ /**
803
+ * Load configuration from file or use defaults.
804
+ *
805
+ * @param options - Loading options
806
+ * @returns Effect that resolves to the loaded configuration
807
+ */
808
+ readonly load: (options?: LoadConfigOptions) => Effect.Effect<LoadConfigResult, ConfigError>;
809
+ /**
810
+ * Resolve partial configuration input to full configuration.
811
+ *
812
+ * @param input - Partial configuration input
813
+ * @returns Effect that resolves to full configuration
814
+ */
815
+ readonly resolve: (input?: Partial<ConfigInput>) => Effect.Effect<Config, ConfigError>;
816
+ /**
817
+ * Detect entry points in the project.
818
+ *
819
+ * @param cwd - Working directory to search
820
+ * @param entries - Optional explicit entry configuration
821
+ * @returns Effect that resolves to detected entries
822
+ */
823
+ readonly detectEntries: (cwd: string, entries?: {
824
+ main?: string;
825
+ pre?: string;
826
+ post?: string;
827
+ }) => Effect.Effect<DetectEntriesResult, MainEntryMissing>;
828
+ }
829
+
830
+ /**
831
+ * ConfigService tag for dependency injection.
832
+ *
833
+ * @public
834
+ */
835
+ export declare const ConfigService: Context.Tag<ConfigService, ConfigService>;
836
+
837
+ /**
838
+ * Define a configuration with full TypeScript support.
839
+ *
840
+ * @remarks
841
+ * This function validates the configuration and applies all defaults.
842
+ * Use it in your `action.config.ts` file for autocomplete and type checking.
843
+ *
844
+ * @param config - Partial configuration object
845
+ * @returns Fully resolved configuration with defaults applied
846
+ *
847
+ * @example Basic configuration file
848
+ * ```typescript
849
+ * // action.config.ts
850
+ * import { defineConfig } from "@savvy-web/github-action-builder";
851
+ *
852
+ * export default defineConfig({
853
+ * entries: {
854
+ * main: "src/main.ts",
855
+ * },
856
+ * build: {
857
+ * minify: true,
858
+ * },
859
+ * });
860
+ * ```
861
+ *
862
+ * @example Full configuration with all options
863
+ * ```typescript
864
+ * // action.config.ts
865
+ * import { defineConfig } from "@savvy-web/github-action-builder";
866
+ *
867
+ * export default defineConfig({
868
+ * entries: {
869
+ * main: "src/action.ts",
870
+ * pre: "src/setup.ts",
871
+ * post: "src/cleanup.ts",
872
+ * },
873
+ * build: {
874
+ * minify: true,
875
+ * target: "es2022",
876
+ * sourceMap: true,
877
+ * externals: ["@aws-sdk/client-s3"],
878
+ * },
879
+ * validation: {
880
+ * requireActionYml: true,
881
+ * maxBundleSize: "10mb",
882
+ * strict: true,
883
+ * },
884
+ * });
885
+ * ```
886
+ *
887
+ * @public
888
+ */
889
+ export declare function defineConfig(config?: Partial<ConfigInput>): Config;
890
+
891
+ /**
892
+ * Detected entry point information.
893
+ * @public
894
+ */
895
+ export declare type DetectedEntry = typeof DetectedEntrySchema.Type;
896
+
897
+ /**
898
+ * Detected entry point information.
899
+ * @internal
900
+ */
901
+ export declare const DetectedEntrySchema: Schema.Struct<{
902
+ /** Entry type (main, pre, or post). */
903
+ type: Schema.Literal<["main", "pre", "post"]>;
904
+ /** Absolute path to the entry file. */
905
+ path: typeof Schema.String;
906
+ /** Output path for the bundled file. */
907
+ output: typeof Schema.String;
908
+ }>;
909
+
910
+ /**
911
+ * Result of entry detection.
912
+ * @public
913
+ */
914
+ export declare type DetectEntriesResult = typeof DetectEntriesResultSchema.Type;
915
+
916
+ /**
917
+ * Result of entry detection.
918
+ * @internal
919
+ */
920
+ export declare const DetectEntriesResultSchema: Schema.Struct<{
921
+ /** Whether detection was successful. */
922
+ success: typeof Schema.Boolean;
923
+ /** Detected entries. */
924
+ entries: Schema.Array$<Schema.Struct<{
925
+ /** Entry type (main, pre, or post). */
926
+ type: Schema.Literal<["main", "pre", "post"]>;
927
+ /** Absolute path to the entry file. */
928
+ path: typeof Schema.String;
929
+ /** Output path for the bundled file. */
930
+ output: typeof Schema.String;
931
+ }>>;
932
+ }>;
933
+
934
+ /**
935
+ * Entry point paths configuration.
936
+ *
937
+ * @public
938
+ */
939
+ export declare type Entries = typeof EntriesSchema.Type;
940
+
941
+ /**
942
+ * Schema for entry point paths.
943
+ *
944
+ * @remarks
945
+ * GitHub Actions support three entry points:
946
+ * - `main`: The primary action entry point (required)
947
+ * - `pre`: Runs before the main action (optional)
948
+ * - `post`: Runs after the main action for cleanup (optional)
949
+ *
950
+ * @internal
951
+ */
952
+ export declare const EntriesSchema: Schema.Struct<{
953
+ /** Path to the main action entry point. Defaults to "src/main.ts". */
954
+ main: Schema.optionalWith<typeof Schema.String, {
955
+ default: () => string;
956
+ }>;
957
+ /** Path to the pre-action hook entry point. */
958
+ pre: Schema.optional<typeof Schema.String>;
959
+ /** Path to the post-action hook entry point. */
960
+ post: Schema.optional<typeof Schema.String>;
961
+ }>;
962
+
963
+ /**
964
+ * Error when an explicitly specified entry file is missing.
965
+ *
966
+ * @public
967
+ */
968
+ export declare class EntryFileMissing extends EntryFileMissingBase<{
969
+ /**
970
+ * The type of entry (main, pre, post).
971
+ */
972
+ readonly entryType: "main" | "pre" | "post";
973
+ /**
974
+ * The path that was specified but not found.
975
+ */
976
+ readonly path: string;
977
+ }> {
978
+ }
979
+
980
+ /**
981
+ * Base class for EntryFileMissing error.
982
+ *
983
+ * @privateRemarks
984
+ * This export is required for api-extractor documentation generation.
985
+ * Effect's Data.TaggedError creates an anonymous base class that must be
986
+ * explicitly exported to avoid "forgotten export" warnings. Do not delete.
987
+ *
988
+ * @internal
989
+ */
990
+ export declare const EntryFileMissingBase: new <A extends Record<string, any> = {}>(args: Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => YieldableError & {
991
+ readonly _tag: "EntryFileMissing";
992
+ } & Readonly<A>;
993
+
994
+ /**
995
+ * ECMAScript target versions supported by the bundler.
996
+ *
997
+ * @internal
998
+ */
999
+ export declare const EsTarget: Schema.Literal<["es2020", "es2021", "es2022", "es2023", "es2024"]>;
1000
+
1001
+ /**
1002
+ * Type for ECMAScript target.
1003
+ *
1004
+ * @public
1005
+ */
1006
+ export declare type EsTarget = typeof EsTarget.Type;
1007
+
1008
+ /**
1009
+ * Main API class for building GitHub Actions.
1010
+ *
1011
+ * @remarks
1012
+ * This class provides a Promise-based interface wrapping Effect services.
1013
+ * It handles configuration loading, validation, and bundling in a single workflow.
1014
+ *
1015
+ * For Effect consumers, use the services directly:
1016
+ * - {@link ConfigService} for configuration
1017
+ * - {@link ValidationService} for validation
1018
+ * - {@link BuildService} for building
1019
+ *
1020
+ * @example Complete build workflow
1021
+ * ```typescript
1022
+ * import { GitHubAction } from "@savvy-web/github-action-builder";
1023
+ *
1024
+ * async function buildAction(): Promise<void> {
1025
+ * const action = GitHubAction.create();
1026
+ * const result = await action.build();
1027
+ *
1028
+ * if (result.success) {
1029
+ * console.log(`Built ${result.build?.entries.length} entry points`);
1030
+ * } else {
1031
+ * console.error(`Build failed: ${result.error}`);
1032
+ * process.exit(1);
1033
+ * }
1034
+ * }
1035
+ *
1036
+ * buildAction();
1037
+ * ```
1038
+ *
1039
+ * @example With custom configuration
1040
+ * ```typescript
1041
+ * import { GitHubAction } from "@savvy-web/github-action-builder";
1042
+ *
1043
+ * async function main(): Promise<void> {
1044
+ * const action = GitHubAction.create({
1045
+ * config: {
1046
+ * entries: { main: "src/action.ts" },
1047
+ * build: { minify: true, target: "es2022" },
1048
+ * },
1049
+ * cwd: "/path/to/project",
1050
+ * });
1051
+ *
1052
+ * const result = await action.build();
1053
+ * console.log(result.success ? "Success" : result.error);
1054
+ * }
1055
+ *
1056
+ * main();
1057
+ * ```
1058
+ *
1059
+ * @public
1060
+ */
1061
+ export declare class GitHubAction {
1062
+ /**
1063
+ * Managed runtime for running Effects.
1064
+ * @internal
1065
+ */
1066
+ private readonly runtime;
1067
+ /**
1068
+ * Cached configuration after first load.
1069
+ * @internal
1070
+ */
1071
+ private config;
1072
+ /**
1073
+ * Resolved options.
1074
+ * @internal
1075
+ */
1076
+ private readonly cwd;
1077
+ private readonly configSource;
1078
+ private readonly skipValidation;
1079
+ private readonly clean;
1080
+ private constructor();
1081
+ /**
1082
+ * Create a new GitHubAction builder instance.
1083
+ *
1084
+ * @param options - Builder options
1085
+ * @returns A new GitHubAction instance
1086
+ *
1087
+ * @example
1088
+ * ```typescript
1089
+ * import { GitHubAction } from "@savvy-web/github-action-builder";
1090
+ *
1091
+ * // Auto-detect configuration
1092
+ * const action = GitHubAction.create();
1093
+ *
1094
+ * // With inline config
1095
+ * const action2 = GitHubAction.create({
1096
+ * config: { build: { minify: false } },
1097
+ * });
1098
+ *
1099
+ * // With config file path
1100
+ * const action3 = GitHubAction.create({
1101
+ * config: "./custom.config.ts",
1102
+ * });
1103
+ * ```
1104
+ */
1105
+ static create(options?: GitHubActionOptions): GitHubAction;
1106
+ /**
1107
+ * Load and resolve configuration.
1108
+ *
1109
+ * @remarks
1110
+ * Configuration is cached after the first load. Subsequent calls
1111
+ * return the cached configuration.
1112
+ *
1113
+ * @returns Resolved configuration with all defaults applied
1114
+ * @throws Error if configuration file cannot be loaded or is invalid
1115
+ */
1116
+ loadConfig(): Promise<Config>;
1117
+ /**
1118
+ * Validate the action configuration and action.yml.
1119
+ *
1120
+ * @remarks
1121
+ * Validation checks:
1122
+ * - Entry point files exist
1123
+ * - Output directory is writable
1124
+ * - action.yml exists and is valid (if required)
1125
+ *
1126
+ * In CI environments, warnings are treated as errors by default.
1127
+ *
1128
+ * @param options - Validation options
1129
+ * @returns Validation result with errors and warnings
1130
+ */
1131
+ validate(options?: ValidateOptions): Promise<ValidationResult>;
1132
+ /**
1133
+ * Build the GitHub Action.
1134
+ *
1135
+ * @remarks
1136
+ * The build process:
1137
+ * 1. Loads configuration (if not already loaded)
1138
+ * 2. Validates the project (unless `skipValidation` is set)
1139
+ * 3. Bundles each entry point with vercel/ncc
1140
+ * 4. Writes output to the `dist/` directory
1141
+ *
1142
+ * @returns Build result with success status and details
1143
+ *
1144
+ * @example
1145
+ * ```typescript
1146
+ * import { GitHubAction } from "@savvy-web/github-action-builder";
1147
+ *
1148
+ * async function main(): Promise<void> {
1149
+ * const action = GitHubAction.create();
1150
+ * const result = await action.build();
1151
+ *
1152
+ * if (result.success && result.build) {
1153
+ * console.log(`Built ${result.build.entries.length} entries`);
1154
+ * } else {
1155
+ * console.error(result.error);
1156
+ * }
1157
+ * }
1158
+ *
1159
+ * main();
1160
+ * ```
1161
+ */
1162
+ build(): Promise<GitHubActionBuildResult>;
1163
+ /**
1164
+ * Dispose the runtime and release resources.
1165
+ *
1166
+ * @remarks
1167
+ * Call this when you're done using the GitHubAction instance
1168
+ * to clean up any resources held by the Effect runtime.
1169
+ */
1170
+ dispose(): Promise<void>;
1171
+ }
1172
+
1173
+ /**
1174
+ * Result of a GitHubAction build operation.
1175
+ * @public
1176
+ */
1177
+ export declare type GitHubActionBuildResult = typeof GitHubActionBuildResultSchema.Type;
1178
+
1179
+ /**
1180
+ * Result of a GitHubAction build operation.
1181
+ *
1182
+ * @remarks
1183
+ * The result contains detailed information about both validation and build steps.
1184
+ * Check the `success` property first, then examine `error`, `validation`, or `build`
1185
+ * for details.
1186
+ *
1187
+ * @internal
1188
+ */
1189
+ export declare const GitHubActionBuildResultSchema: Schema.Struct<{
1190
+ /** Whether the build completed successfully. */
1191
+ success: typeof Schema.Boolean;
1192
+ /** Build result details if the build step ran. */
1193
+ build: Schema.optional<Schema.Struct<{
1194
+ success: typeof Schema.Boolean;
1195
+ entries: Schema.Array$<Schema.Struct<{
1196
+ success: typeof Schema.Boolean;
1197
+ stats: Schema.optional<Schema.Struct<{
1198
+ entry: typeof Schema.String;
1199
+ size: typeof Schema.Number;
1200
+ duration: typeof Schema.Number;
1201
+ outputPath: typeof Schema.String;
1202
+ }>>;
1203
+ error: Schema.optional<typeof Schema.String>;
1204
+ }>>;
1205
+ duration: typeof Schema.Number;
1206
+ error: Schema.optional<typeof Schema.String>;
1207
+ }>>;
1208
+ /** Validation result if validation was performed. */
1209
+ validation: Schema.optional<Schema.Struct<{
1210
+ valid: typeof Schema.Boolean;
1211
+ errors: Schema.Array$<Schema.Struct<{
1212
+ code: typeof Schema.String;
1213
+ message: typeof Schema.String;
1214
+ file: Schema.optional<typeof Schema.String>;
1215
+ suggestion: Schema.optional<typeof Schema.String>;
1216
+ }>>;
1217
+ warnings: Schema.Array$<Schema.Struct<{
1218
+ code: typeof Schema.String;
1219
+ message: typeof Schema.String;
1220
+ file: Schema.optional<typeof Schema.String>;
1221
+ suggestion: Schema.optional<typeof Schema.String>;
1222
+ }>>;
1223
+ }>>;
1224
+ /** Error message if the build or validation failed. */
1225
+ error: Schema.optional<typeof Schema.String>;
1226
+ }>;
1227
+
1228
+ /**
1229
+ * Options for creating a GitHubAction builder instance.
1230
+ *
1231
+ * @remarks
1232
+ * All options are optional. When no options are provided, the builder
1233
+ * auto-detects configuration from `action.config.ts` in the current directory.
1234
+ *
1235
+ * @public
1236
+ */
1237
+ export declare interface GitHubActionOptions {
1238
+ /**
1239
+ * Configuration object or path to config file.
1240
+ *
1241
+ * @remarks
1242
+ * - If a string is provided, it's treated as a path to a config file
1243
+ * - If an object is provided, it's used directly as configuration
1244
+ * - If not provided, auto-detects `action.config.ts` or uses defaults
1245
+ */
1246
+ config?: Partial<ConfigInput> | string;
1247
+ /**
1248
+ * Working directory for the build.
1249
+ *
1250
+ * @defaultValue `process.cwd()`
1251
+ */
1252
+ cwd?: string;
1253
+ /**
1254
+ * Skip validation before building.
1255
+ *
1256
+ * @remarks
1257
+ * Skipping validation is not recommended for production builds.
1258
+ *
1259
+ * @defaultValue `false`
1260
+ */
1261
+ skipValidation?: boolean;
1262
+ /**
1263
+ * Clean output directory before building.
1264
+ *
1265
+ * @defaultValue `true`
1266
+ */
1267
+ clean?: boolean;
1268
+ /**
1269
+ * Custom Effect Layer to use instead of the default AppLayer.
1270
+ *
1271
+ * @remarks
1272
+ * Advanced option for testing or customizing service implementations.
1273
+ */
1274
+ layer?: Layer.Layer<ConfigService | ValidationService | BuildService>;
1275
+ }
1276
+
1277
+ /**
1278
+ * Options for loading configuration.
1279
+ * @public
1280
+ */
1281
+ export declare type LoadConfigOptions = typeof LoadConfigOptionsSchema.Type;
1282
+
1283
+ /**
1284
+ * Options for loading configuration.
1285
+ * @internal
1286
+ */
1287
+ export declare const LoadConfigOptionsSchema: Schema.Struct<{
1288
+ /** Working directory to search for config. Accepts string, Buffer, or URL. */
1289
+ cwd: Schema.optional<Schema.transform<Schema.Union<[typeof Schema.String, Schema.instanceOf<Buffer<ArrayBufferLike>>, Schema.instanceOf<URL_2>]>, typeof Schema.String>>;
1290
+ /** Explicit path to config file. Accepts string, Buffer, or URL. */
1291
+ configPath: Schema.optional<Schema.transform<Schema.Union<[typeof Schema.String, Schema.instanceOf<Buffer<ArrayBufferLike>>, Schema.instanceOf<URL_2>]>, typeof Schema.String>>;
1292
+ }>;
1293
+
1294
+ /**
1295
+ * Result of configuration loading.
1296
+ * @public
1297
+ */
1298
+ export declare interface LoadConfigResult {
1299
+ /** The resolved configuration. */
1300
+ config: Config;
1301
+ /** Path to the config file that was loaded, if any. */
1302
+ configPath?: string;
1303
+ /** Whether defaults were used (no config file found). */
1304
+ usingDefaults: boolean;
1305
+ }
1306
+
1307
+ /**
1308
+ * Error when the required main entry point is missing.
1309
+ *
1310
+ * @public
1311
+ */
1312
+ export declare class MainEntryMissing extends MainEntryMissingBase<{
1313
+ /**
1314
+ * The expected path for the main entry.
1315
+ */
1316
+ readonly expectedPath: string;
1317
+ /**
1318
+ * The working directory that was searched.
1319
+ */
1320
+ readonly cwd: string;
1321
+ }> {
1322
+ }
1323
+
1324
+ /**
1325
+ * Base class for MainEntryMissing error.
1326
+ *
1327
+ * @privateRemarks
1328
+ * This export is required for api-extractor documentation generation.
1329
+ * Effect's Data.TaggedError creates an anonymous base class that must be
1330
+ * explicitly exported to avoid "forgotten export" warnings. Do not delete.
1331
+ *
1332
+ * @internal
1333
+ */
1334
+ export declare const MainEntryMissingBase: new <A extends Record<string, any> = {}>(args: Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => YieldableError & {
1335
+ readonly _tag: "MainEntryMissing";
1336
+ } & Readonly<A>;
1337
+
1338
+ /**
1339
+ * Options for validation.
1340
+ * @public
1341
+ */
1342
+ export declare type ValidateOptions = typeof ValidateOptionsSchema.Type;
1343
+
1344
+ /**
1345
+ * Options for validation.
1346
+ * @internal
1347
+ */
1348
+ export declare const ValidateOptionsSchema: Schema.Struct<{
1349
+ /** Working directory for file operations. Accepts string, Buffer, or URL. */
1350
+ cwd: Schema.optional<Schema.transform<Schema.Union<[typeof Schema.String, Schema.instanceOf<Buffer<ArrayBufferLike>>, Schema.instanceOf<URL_2>]>, typeof Schema.String>>;
1351
+ /** Force strict mode regardless of environment. Auto-detects from CI when undefined. */
1352
+ strict: Schema.optional<typeof Schema.Boolean>;
1353
+ }>;
1354
+
1355
+ /**
1356
+ * Union of all validation-related errors.
1357
+ *
1358
+ * @public
1359
+ */
1360
+ export declare type ValidationError = MainEntryMissing | EntryFileMissing | ActionYmlMissing | ActionYmlSyntaxError | ActionYmlSchemaError | ValidationFailed;
1361
+
1362
+ /**
1363
+ * A validation error item.
1364
+ * @public
1365
+ */
1366
+ export declare type ValidationErrorItem = typeof ValidationErrorSchema.Type;
1367
+
1368
+ /**
1369
+ * A validation error item.
1370
+ * @internal
1371
+ */
1372
+ export declare const ValidationErrorSchema: Schema.Struct<{
1373
+ /** Error code for categorization. */
1374
+ code: typeof Schema.String;
1375
+ /** Human-readable error message. */
1376
+ message: typeof Schema.String;
1377
+ /** File path where error occurred. */
1378
+ file: Schema.optional<typeof Schema.String>;
1379
+ /** Suggestion for fixing the error. */
1380
+ suggestion: Schema.optional<typeof Schema.String>;
1381
+ }>;
1382
+
1383
+ /**
1384
+ * Error when validation fails in strict mode (CI environment).
1385
+ *
1386
+ * @public
1387
+ */
1388
+ export declare class ValidationFailed extends ValidationFailedBase<{
1389
+ /**
1390
+ * Number of errors encountered.
1391
+ */
1392
+ readonly errorCount: number;
1393
+ /**
1394
+ * Number of warnings encountered.
1395
+ */
1396
+ readonly warningCount: number;
1397
+ /**
1398
+ * Formatted validation result message.
1399
+ */
1400
+ readonly message: string;
1401
+ }> {
1402
+ }
1403
+
1404
+ /**
1405
+ * Base class for ValidationFailed error.
1406
+ *
1407
+ * @privateRemarks
1408
+ * This export is required for api-extractor documentation generation.
1409
+ * Effect's Data.TaggedError creates an anonymous base class that must be
1410
+ * explicitly exported to avoid "forgotten export" warnings. Do not delete.
1411
+ *
1412
+ * @internal
1413
+ */
1414
+ export declare const ValidationFailedBase: new <A extends Record<string, any> = {}>(args: Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => YieldableError & {
1415
+ readonly _tag: "ValidationFailed";
1416
+ } & Readonly<A>;
1417
+
1418
+ /**
1419
+ * Layer providing ValidationService (depends on ConfigService).
1420
+ *
1421
+ * @remarks
1422
+ * Includes ConfigService automatically.
1423
+ *
1424
+ * @public
1425
+ */
1426
+ export declare const ValidationLayer: Layer.Layer<ValidationService, never, never>;
1427
+
1428
+ /**
1429
+ * Validation options for the build process.
1430
+ *
1431
+ * @public
1432
+ */
1433
+ export declare type ValidationOptions = typeof ValidationOptionsSchema.Type;
1434
+
1435
+ /**
1436
+ * Schema for validation options.
1437
+ *
1438
+ * @remarks
1439
+ * Validation options control how strictly the build process validates
1440
+ * the project structure and configuration before building.
1441
+ *
1442
+ * @internal
1443
+ */
1444
+ export declare const ValidationOptionsSchema: Schema.Struct<{
1445
+ /** Require action.yml to exist and be valid. Defaults to true. */
1446
+ requireActionYml: Schema.optionalWith<typeof Schema.Boolean, {
1447
+ default: () => true;
1448
+ }>;
1449
+ /** Maximum bundle size before warning/error (e.g., "5mb", "500kb"). */
1450
+ maxBundleSize: Schema.optional<typeof Schema.String>;
1451
+ /** Treat warnings as errors. Auto-detects from CI when undefined. */
1452
+ strict: Schema.optional<typeof Schema.Boolean>;
1453
+ }>;
1454
+
1455
+ /**
1456
+ * Validation result with errors and warnings.
1457
+ * @public
1458
+ */
1459
+ export declare type ValidationResult = typeof ValidationResultSchema.Type;
1460
+
1461
+ /**
1462
+ * Validation result with errors and warnings.
1463
+ * @internal
1464
+ */
1465
+ export declare const ValidationResultSchema: Schema.Struct<{
1466
+ /** Whether validation passed (no errors, or only warnings in non-strict mode). */
1467
+ valid: typeof Schema.Boolean;
1468
+ /** Validation errors. */
1469
+ errors: Schema.Array$<Schema.Struct<{
1470
+ /** Error code for categorization. */
1471
+ code: typeof Schema.String;
1472
+ /** Human-readable error message. */
1473
+ message: typeof Schema.String;
1474
+ /** File path where error occurred. */
1475
+ file: Schema.optional<typeof Schema.String>;
1476
+ /** Suggestion for fixing the error. */
1477
+ suggestion: Schema.optional<typeof Schema.String>;
1478
+ }>>;
1479
+ /** Validation warnings. */
1480
+ warnings: Schema.Array$<Schema.Struct<{
1481
+ /** Warning code for categorization. */
1482
+ code: typeof Schema.String;
1483
+ /** Human-readable warning message. */
1484
+ message: typeof Schema.String;
1485
+ /** File path where warning occurred. */
1486
+ file: Schema.optional<typeof Schema.String>;
1487
+ /** Suggestion for addressing the warning. */
1488
+ suggestion: Schema.optional<typeof Schema.String>;
1489
+ }>>;
1490
+ }>;
1491
+
1492
+ /**
1493
+ * ValidationService interface for validation capabilities.
1494
+ *
1495
+ * @remarks
1496
+ * This service handles:
1497
+ * - Validating configuration and entry points
1498
+ * - Validating action.yml structure and schema
1499
+ * - Formatting validation results for display
1500
+ * - CI-aware strict mode handling
1501
+ *
1502
+ * @example Using ValidationService with Effect
1503
+ * ```typescript
1504
+ * import { Effect } from "effect";
1505
+ * import { AppLayer, ConfigService, ValidationService } from "@savvy-web/github-action-builder";
1506
+ *
1507
+ * const program = Effect.gen(function* () {
1508
+ * const configService = yield* ConfigService;
1509
+ * const validationService = yield* ValidationService;
1510
+ *
1511
+ * const { config } = yield* configService.load();
1512
+ * const result = yield* validationService.validate(config);
1513
+ *
1514
+ * if (!result.valid) {
1515
+ * console.error("Validation failed:", result.errors);
1516
+ * }
1517
+ * });
1518
+ *
1519
+ * Effect.runPromise(program.pipe(Effect.provide(AppLayer)));
1520
+ * ```
1521
+ *
1522
+ * @public
1523
+ */
1524
+ export declare interface ValidationService {
1525
+ /**
1526
+ * Validate configuration and project structure.
1527
+ *
1528
+ * @param config - Configuration to validate
1529
+ * @param options - Validation options
1530
+ * @returns Effect that resolves to validation result
1531
+ */
1532
+ readonly validate: (config: Config, options?: ValidateOptions) => Effect.Effect<ValidationResult, ValidationError>;
1533
+ /**
1534
+ * Validate action.yml file.
1535
+ *
1536
+ * @param path - Path to action.yml file
1537
+ * @returns Effect that resolves to action.yml validation result
1538
+ */
1539
+ readonly validateActionYml: (path: string) => Effect.Effect<ActionYmlResult, ValidationError>;
1540
+ /**
1541
+ * Format validation result for display.
1542
+ *
1543
+ * @param result - Validation result to format
1544
+ * @returns Formatted string for terminal output
1545
+ */
1546
+ readonly formatResult: (result: ValidationResult) => string;
1547
+ /**
1548
+ * Check if running in CI environment.
1549
+ *
1550
+ * @returns Effect that resolves to true if in CI
1551
+ */
1552
+ readonly isCI: () => Effect.Effect<boolean>;
1553
+ /**
1554
+ * Check if strict mode is enabled.
1555
+ *
1556
+ * @param configStrict - Optional config override
1557
+ * @returns Effect that resolves to true if strict mode
1558
+ */
1559
+ readonly isStrict: (configStrict?: boolean) => Effect.Effect<boolean>;
1560
+ }
1561
+
1562
+ /**
1563
+ * ValidationService tag for dependency injection.
1564
+ *
1565
+ * @public
1566
+ */
1567
+ export declare const ValidationService: Context.Tag<ValidationService, ValidationService>;
1568
+
1569
+ /**
1570
+ * A validation warning.
1571
+ * @public
1572
+ */
1573
+ export declare type ValidationWarning = typeof ValidationWarningSchema.Type;
1574
+
1575
+ /**
1576
+ * A validation warning.
1577
+ * @internal
1578
+ */
1579
+ export declare const ValidationWarningSchema: Schema.Struct<{
1580
+ /** Warning code for categorization. */
1581
+ code: typeof Schema.String;
1582
+ /** Human-readable warning message. */
1583
+ message: typeof Schema.String;
1584
+ /** File path where warning occurred. */
1585
+ file: Schema.optional<typeof Schema.String>;
1586
+ /** Suggestion for addressing the warning. */
1587
+ suggestion: Schema.optional<typeof Schema.String>;
1588
+ }>;
1589
+
1590
+ /**
1591
+ * Error when writing output files fails.
1592
+ *
1593
+ * @public
1594
+ */
1595
+ export declare class WriteError extends WriteErrorBase<{
1596
+ /**
1597
+ * The path that failed to write.
1598
+ */
1599
+ readonly path: string;
1600
+ /**
1601
+ * The underlying error message.
1602
+ */
1603
+ readonly cause: string;
1604
+ }> {
1605
+ }
1606
+
1607
+ /**
1608
+ * Base class for WriteError error.
1609
+ *
1610
+ * @privateRemarks
1611
+ * This export is required for api-extractor documentation generation.
1612
+ * Effect's Data.TaggedError creates an anonymous base class that must be
1613
+ * explicitly exported to avoid "forgotten export" warnings. Do not delete.
1614
+ *
1615
+ * @internal
1616
+ */
1617
+ export declare const WriteErrorBase: new <A extends Record<string, any> = {}>(args: Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => YieldableError & {
1618
+ readonly _tag: "WriteError";
1619
+ } & Readonly<A>;
1620
+
1621
+ export { }