@savvy-web/github-action-builder 1.1.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,9 +4,9 @@ import { buildCommand } from "../cli/commands/build.js";
4
4
  import { initCommand } from "../cli/commands/init.js";
5
5
  import { validateCommand } from "../cli/commands/validate.js";
6
6
  import "../cli/commands/index.js";
7
- import { Cause, Console, Effect, Layer } from "effect";
8
- import { Command } from "@effect/cli";
9
- import { NodeContext, NodeRuntime } from "@effect/platform-node";
7
+ import { Effect, Layer } from "effect";
8
+ import { NodeRuntime, NodeServices } from "@effect/platform-node";
9
+ import { Command } from "effect/unstable/cli";
10
10
 
11
11
  //#region src/cli/index.ts
12
12
  /* v8 ignore start - CLI entry point requires integration testing */
@@ -22,28 +22,23 @@ const rootCommand = Command.make("github-action-builder").pipe(Command.withSubco
22
22
  initCommand
23
23
  ]));
24
24
  /**
25
- * CLI application configuration.
25
+ * CLI application: reads argv from the Stdio service provided by NodeServices.
26
26
  */
27
- const cli = Command.run(rootCommand, {
28
- name: "github-action-builder",
29
- version: "1.1.2"
30
- });
27
+ const cli = Command.run(rootCommand, { version: "2.0.0" });
31
28
  /**
32
- * Combined layer: AppLayer + NodeContext for CLI.
29
+ * Combined layer: AppLayer + the Node implementations of the CLI
30
+ * environment (FileSystem, Path, Terminal, Stdio, ChildProcessSpawner).
33
31
  */
34
- const CliLayer = Layer.merge(AppLayer, NodeContext.layer);
32
+ const CliLayer = Layer.mergeAll(AppLayer, NodeServices.layer);
35
33
  /**
36
- * Run the CLI with full error cause rendering.
34
+ * Run the CLI.
37
35
  *
38
36
  * Expected typed errors (ValidationFailed, BuildFailed, etc.) are already
39
- * printed by command handlers — they just need to exit with failure.
40
- * Unexpected defects get full Cause.pretty rendering with stack traces.
37
+ * printed by command handlers — the failed effect makes the runtime exit
38
+ * non-zero. Usage errors print help via the CLI framework and also fail.
39
+ * NodeRuntime.runMain reports unexpected defects with full cause rendering.
41
40
  */
42
- const main = Effect.suspend(() => cli(process.argv)).pipe(Effect.provide(CliLayer), Effect.catchAllCause((cause) => {
43
- if (Cause.defects(cause).length > 0) return Console.error(Cause.pretty(cause)).pipe(Effect.andThen(Effect.failCause(cause)));
44
- return Effect.failCause(cause);
45
- }));
46
- NodeRuntime.runMain(main);
41
+ NodeRuntime.runMain(cli.pipe(Effect.provide(CliLayer)));
47
42
 
48
43
  //#endregion
49
44
  export { };
@@ -4,7 +4,7 @@ import { ConfigService } from "../../services/config.js";
4
4
  import { PersistLocalService } from "../../services/persist-local.js";
5
5
  import { ValidationService } from "../../services/validation.js";
6
6
  import { Console, Effect, Option } from "effect";
7
- import { Command, Options } from "@effect/cli";
7
+ import { Command, Flag } from "effect/unstable/cli";
8
8
 
9
9
  //#region src/cli/commands/build.ts
10
10
  /* v8 ignore start - CLI commands require integration testing */
@@ -14,19 +14,19 @@ import { Command, Options } from "@effect/cli";
14
14
  /**
15
15
  * Config file option - shared across commands.
16
16
  */
17
- const configOption = Options.file("config").pipe(Options.withAlias("c"), Options.withDescription("Path to configuration file"), Options.optional);
17
+ const configOption = Flag.file("config").pipe(Flag.withAlias("c"), Flag.withDescription("Path to configuration file"), Flag.optional);
18
18
  /**
19
19
  * Quiet mode option - suppress non-error output.
20
20
  */
21
- const quietOption = Options.boolean("quiet").pipe(Options.withAlias("q"), Options.withDescription("Suppress non-error output"), Options.withDefault(false));
21
+ const quietOption = Flag.boolean("quiet").pipe(Flag.withAlias("q"), Flag.withDescription("Suppress non-error output"));
22
22
  /**
23
23
  * Skip validation option.
24
24
  */
25
- const noValidateOption = Options.boolean("no-validate").pipe(Options.withDescription("Skip validation step"), Options.withDefault(false));
25
+ const noValidateOption = Flag.boolean("no-validate").pipe(Flag.withDescription("Skip validation step"));
26
26
  /**
27
27
  * Skip persist-local option.
28
28
  */
29
- const noPersistOption = Options.boolean("no-persist").pipe(Options.withDescription("Skip persisting build output to local action directory"), Options.withDefault(false));
29
+ const noPersistOption = Flag.boolean("no-persist").pipe(Flag.withDescription("Skip persisting build output to local action directory"));
30
30
  /**
31
31
  * Build command handler using Effect services.
32
32
  */
@@ -1,7 +1,7 @@
1
1
  import { Console, Effect } from "effect";
2
2
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
3
3
  import { resolve } from "node:path";
4
- import { Args, Command, Options } from "@effect/cli";
4
+ import { Argument, Command, Flag } from "effect/unstable/cli";
5
5
 
6
6
  //#region src/cli/commands/init.ts
7
7
  /* v8 ignore start - CLI commands require integration testing */
@@ -11,16 +11,16 @@ import { Args, Command, Options } from "@effect/cli";
11
11
  /**
12
12
  * Action name positional argument.
13
13
  */
14
- const actionNameArg = Args.text({ name: "action-name" }).pipe(Args.withDescription("Name of the GitHub Action (also the output directory)"));
14
+ const actionNameArg = Argument.string("action-name").pipe(Argument.withDescription("Name of the GitHub Action (also the output directory)"));
15
15
  /**
16
16
  * Force overwrite option.
17
17
  */
18
- const forceOption = Options.boolean("force").pipe(Options.withAlias("f"), Options.withDescription("Overwrite existing files"), Options.withDefault(false));
18
+ const forceOption = Flag.boolean("force").pipe(Flag.withAlias("f"), Flag.withDescription("Overwrite existing files"));
19
19
  /**
20
20
  * Get current package version (replaced at build time).
21
21
  */
22
22
  const getPackageVersion = () => {
23
- return "1.1.2";
23
+ return "2.0.0";
24
24
  };
25
25
  /**
26
26
  * Generate package.json content.
@@ -2,7 +2,7 @@ import { ConfigService } from "../../services/config.js";
2
2
  import { ValidationService } from "../../services/validation.js";
3
3
  import { configOption, quietOption } from "./build.js";
4
4
  import { Console, Effect, Option } from "effect";
5
- import { Command } from "@effect/cli";
5
+ import { Command } from "effect/unstable/cli";
6
6
 
7
7
  //#region src/cli/commands/validate.ts
8
8
  /* v8 ignore start - CLI commands require integration testing */
package/github-action.js CHANGED
@@ -39,9 +39,9 @@ const GitHubActionBuildResultSchema = Schema.Struct({
39
39
  * It handles configuration loading, validation, and bundling in a single workflow.
40
40
  *
41
41
  * For Effect consumers, use the services directly:
42
- * - {@link (ConfigService:interface)} for configuration
43
- * - {@link (ValidationService:interface)} for validation
44
- * - {@link (BuildService:interface)} for building
42
+ * - {@link ConfigService} for configuration
43
+ * - {@link ValidationService} for validation
44
+ * - {@link BuildService} for building
45
45
  *
46
46
  * @example Complete build workflow
47
47
  * ```typescript