@savvy-web/github-action-builder 0.7.3 → 0.7.5

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